mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-29 18:34:50 +00:00
destroy_vm: use write_config from our Config module to set an "empty" config
brings us more in line with what we do in pve-container, also it's good to not use file_set_contents directly if we have all those nice wrapper interface methods to do things in a safe and guaranteed way. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
5172770df7
commit
3361d09901
@ -2619,8 +2619,6 @@ sub touch_config {
|
|||||||
sub destroy_vm {
|
sub destroy_vm {
|
||||||
my ($storecfg, $vmid, $keep_empty_config, $skiplock) = @_;
|
my ($storecfg, $vmid, $keep_empty_config, $skiplock) = @_;
|
||||||
|
|
||||||
my $conffile = PVE::QemuConfig->config_file($vmid);
|
|
||||||
|
|
||||||
my $conf = PVE::QemuConfig->load_config($vmid);
|
my $conf = PVE::QemuConfig->load_config($vmid);
|
||||||
|
|
||||||
PVE::QemuConfig->check_lock($conf) if !$skiplock;
|
PVE::QemuConfig->check_lock($conf) if !$skiplock;
|
||||||
@ -2663,7 +2661,7 @@ sub destroy_vm {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if ($keep_empty_config) {
|
if ($keep_empty_config) {
|
||||||
PVE::Tools::file_set_contents($conffile, "memory: 128\n");
|
PVE::QemuConfig->write_config($vmid, "memory: 128\n");
|
||||||
} else {
|
} else {
|
||||||
PVE::QemuConfig->destroy_config($vmid);
|
PVE::QemuConfig->destroy_config($vmid);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user