[pve-devel] [PATCH 1/2] add qm disk resize

Alexandre DERUMIER aderumier at odiso.com
Tue Aug 7 08:50:22 CEST 2012


>>I think this is simply too dangerous. You can't simply use the size 
>>hint ($old_drive->{size}) - that value can be totally wrong (just good 
>>enough to display on the gui). 
yes, you are right, I think we can get value from volume_size_info.


>>Also, I do not think we should add this to the update API. Maybe a special 
>>resize API is better suited, with extra qm command: 
>>
>># qm resize <vmid> -ide1 +10G 
>>
>>What do you think? 
Ok, I'll work on it this week.
(How do you see that in pve-manager ? some kind of extendsize button with new button in hdedit form ?)


----- Mail original ----- 

De: "Dietmar Maurer" <dietmar at proxmox.com> 
À: "Alexandre Derumier" <aderumier at odiso.com>, pve-devel at pve.proxmox.com 
Envoyé: Mardi 7 Août 2012 07:51:55 
Objet: RE: [pve-devel] [PATCH 1/2] add qm disk resize 

I think this is simply too dangerous. You can't simply use the size 
hint ($old_drive->{size}) - that value can be totally wrong (just good 
enough to display on the gui). 

Also, I do not think we should add this to the update API. Maybe a special 
resize API is better suited, with extra qm command: 

# qm resize <vmid> -ide1 +10G 

What do you think? 


> -----Original Message----- 
> From: pve-devel-bounces at pve.proxmox.com [mailto:pve-devel- 
> bounces at pve.proxmox.com] On Behalf Of Alexandre Derumier 
> Sent: Montag, 06. August 2012 11:57 
> To: pve-devel at pve.proxmox.com 
> Subject: [pve-devel] [PATCH 1/2] add qm disk resize 
> 
> this add disk resizing if new size is bigger than old size. 
> 
> if new size is lower than old size, we die (can't shrink). 
> 
> if new size equal old size, we don't resize. 
> 
> (shrinking should work in theory, but too dangerous) 
> 
> qm set vmid -virtio0 storage:volume,size=XXG 
> 
> Signed-off-by: Alexandre Derumier <aderumier at odiso.com> 
> --- 
> PVE/API2/Qemu.pm | 8 ++++++++ 
> 1 files changed, 8 insertions(+), 0 deletions(-) 
> 
> diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index 
> 47c588f..b014e36 100644 
> --- a/PVE/API2/Qemu.pm 
> +++ b/PVE/API2/Qemu.pm 
> @@ -701,6 +701,14 @@ my $vmconfig_update_disk = sub { 
> &$safe_int_ne($drive->{iops_wr}, $old_drive->{iops_wr})) { 
> PVE::QemuServer::qemu_block_set_io_throttle($vmid,"drive- 
> $opt",$drive->{bps}, $drive->{bps_rd}, $drive->{bps_wr}, $drive->{iops}, 
> $drive->{iops_rd}, $drive->{iops_wr}) if 
> !PVE::QemuServer::drive_is_cdrom($drive); 
> } 
> + 
> + if ($old_drive->{size} && $drive->{size} && $drive->{size} > 
> $old_drive->{size}) { 
> + PVE::QemuServer::qemu_block_resize($vmid, "drive-$opt", 
> $storecfg, $drive->{file}, $drive->{size}); 
> + } 
> + elsif ($old_drive->{size} && $drive->{size} && $drive->{size} < 
> $old_drive->{size}) { 
> + die "can't shrink drive size"; 
> + } 
> + 
> } 
> } 
> 
> -- 
> 1.7.2.5 
> 
> _______________________________________________ 
> pve-devel mailing list 
> pve-devel at pve.proxmox.com 
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel 





-- 

-- 



	

Alexandre D e rumier 

Ingénieur Systèmes et Réseaux 


Fixe : 03 20 68 88 85 

Fax : 03 20 68 90 88 


45 Bvd du Général Leclerc 59100 Roubaix 
12 rue Marivaux 75002 Paris 



More information about the pve-devel mailing list