mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-02 13:14:11 +00:00
qm rescan: add dryrun option
tells an user what would get touched, so he has a chance to fix unwanted things before changes are actually made. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
53b81297c4
commit
9224dceefe
@ -404,13 +404,23 @@ __PACKAGE__->register_method ({
|
||||
optional => 1,
|
||||
completion => \&PVE::QemuServer::complete_vmid,
|
||||
}),
|
||||
dryrun => {
|
||||
type => 'boolean',
|
||||
optional => 1,
|
||||
default => 0,
|
||||
description => 'Do not actually write changes out to conifg.',
|
||||
},
|
||||
},
|
||||
},
|
||||
returns => { type => 'null'},
|
||||
code => sub {
|
||||
my ($param) = @_;
|
||||
|
||||
PVE::QemuServer::rescan($param->{vmid});
|
||||
my $dryrun = $param->{dryrun};
|
||||
|
||||
print "NOTE: running in dry-run mode, won't write changes out!\n" if $dryrun;
|
||||
|
||||
PVE::QemuServer::rescan($param->{vmid}, 0, $dryrun);
|
||||
|
||||
return undef;
|
||||
}});
|
||||
|
@ -5606,7 +5606,7 @@ sub update_disksize {
|
||||
}
|
||||
|
||||
sub rescan {
|
||||
my ($vmid, $nolock) = @_;
|
||||
my ($vmid, $nolock, $dryrun) = @_;
|
||||
|
||||
my $cfg = PVE::Storage::config();
|
||||
|
||||
@ -5634,7 +5634,7 @@ sub rescan {
|
||||
|
||||
my $changes = update_disksize($vmid, $conf, $vm_volids);
|
||||
|
||||
PVE::QemuConfig->write_config($vmid, $conf) if $changes;
|
||||
PVE::QemuConfig->write_config($vmid, $conf) if $changes && !$dryrun;
|
||||
};
|
||||
|
||||
if (defined($vmid)) {
|
||||
|
Loading…
Reference in New Issue
Block a user