mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-03 12:42:56 +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,
|
optional => 1,
|
||||||
completion => \&PVE::QemuServer::complete_vmid,
|
completion => \&PVE::QemuServer::complete_vmid,
|
||||||
}),
|
}),
|
||||||
|
dryrun => {
|
||||||
|
type => 'boolean',
|
||||||
|
optional => 1,
|
||||||
|
default => 0,
|
||||||
|
description => 'Do not actually write changes out to conifg.',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
returns => { type => 'null'},
|
returns => { type => 'null'},
|
||||||
code => sub {
|
code => sub {
|
||||||
my ($param) = @_;
|
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;
|
return undef;
|
||||||
}});
|
}});
|
||||||
|
@ -5606,7 +5606,7 @@ sub update_disksize {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub rescan {
|
sub rescan {
|
||||||
my ($vmid, $nolock) = @_;
|
my ($vmid, $nolock, $dryrun) = @_;
|
||||||
|
|
||||||
my $cfg = PVE::Storage::config();
|
my $cfg = PVE::Storage::config();
|
||||||
|
|
||||||
@ -5634,7 +5634,7 @@ sub rescan {
|
|||||||
|
|
||||||
my $changes = update_disksize($vmid, $conf, $vm_volids);
|
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)) {
|
if (defined($vmid)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user