blockdev: resize: query and use node name for resize operation
This also works for -blockdev, which will be used instead of -drive starting with machine version 10.0. Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
parent
d2efc5074c
commit
d8de36c992
1 changed files with 9 additions and 1 deletions
|
|
@ -533,13 +533,21 @@ sub resize {
|
|||
|
||||
return if !$running;
|
||||
|
||||
my $block_info = get_block_info($vmid);
|
||||
my $drive_id = $deviceid =~ s/^drive-//r;
|
||||
my $inserted = $block_info->{$drive_id}->{inserted}
|
||||
or die "no block node inserted for drive '$drive_id'\n";
|
||||
|
||||
my $padding = (1024 - $size % 1024) % 1024;
|
||||
$size = $size + $padding;
|
||||
|
||||
mon_cmd(
|
||||
$vmid,
|
||||
"block_resize",
|
||||
device => $deviceid,
|
||||
# Need to use the top throttle node, not the node below, because QEMU won't update the size
|
||||
# of the top node otherwise, even though it's a filter node (as of QEMU 10.0). For legacy
|
||||
# -drive, there is no top throttle node, so this also is the correct node.
|
||||
'node-name' => "$inserted->{'node-name'}",
|
||||
size => int($size),
|
||||
timeout => 60,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue