blockdev: add underlay resize
This commit is contained in:
parent
102b8edd3d
commit
1ea3c1ae84
1 changed files with 19 additions and 1 deletions
|
|
@ -725,6 +725,24 @@ sub resize {
|
|||
);
|
||||
}
|
||||
|
||||
sub underlay_resize {
|
||||
my ($storecfg, $vmid, $drive_id, $volid) = @_;
|
||||
|
||||
my $running = PVE::QemuServer::Helpers::vm_running_locally($vmid);
|
||||
|
||||
# get backing_snap
|
||||
my $snapshots = PVE::Storage::volume_snapshot_info($storecfg, $volid);
|
||||
my $backing_snap = $snapshots->{current}->{parent};
|
||||
my $size = PVE::Storage::volume_underlay_resize($storecfg, $volid, $backing_snap);
|
||||
|
||||
return if !$running;
|
||||
my $block_info = get_block_info($vmid);
|
||||
my $inserted = $block_info->{$drive_id}->{inserted}
|
||||
or die "no block node inserted for drive '$drive_id'\n";
|
||||
|
||||
set_write_threshold($storecfg, $vmid, $drive_id, $volid);
|
||||
}
|
||||
|
||||
my sub blockdev_change_medium {
|
||||
my ($storecfg, $vmid, $qdev_id, $drive) = @_;
|
||||
|
||||
|
|
@ -861,7 +879,7 @@ sub block_set_write_threshold {
|
|||
sub compute_write_threshold {
|
||||
my ($storecfg, $scfg, $volid) = @_;
|
||||
|
||||
my $lv_size = PVE::Storage::volume_size_info($storecfg, $volid, 5);
|
||||
my $lv_size = PVE::Storage::volume_underlay_size_info($storecfg, $volid, 5);
|
||||
|
||||
my $write_threshold = $lv_size - $scfg->{chunksize} * $scfg->{'chunk-percentage'};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue