$conf->{smbios1} = "uuid=$uuid_str";
}
- PVE::QemuServer::update_config_nolock($vmid, $conf);
+ PVE::QemuServer::write_config($vmid, $conf);
};
my $err = $@;
$rpcenv->check_vm_perm($authuser, $vmid, undef, ['VM.Config.Disk']);
if (PVE::QemuServer::try_deallocate_drive($storecfg, $vmid, $conf, $opt, $drive, $rpcenv, $authuser)) {
delete $conf->{$opt};
- PVE::QemuServer::update_config_nolock($vmid, $conf, 1);
+ PVE::QemuServer::write_config($vmid, $conf, 1);
}
} elsif (PVE::QemuServer::valid_drivename($opt)) {
&$check_protection($conf, "can't remove drive '$opt'");
PVE::QemuServer::vmconfig_register_unused_drive($storecfg, $vmid, $conf, PVE::QemuServer::parse_drive($opt, $conf->{pending}->{$opt}))
if defined($conf->{pending}->{$opt});
PVE::QemuServer::vmconfig_delete_pending_option($conf, $opt, $force);
- PVE::QemuServer::update_config_nolock($vmid, $conf, 1);
+ PVE::QemuServer::write_config($vmid, $conf, 1);
} else {
PVE::QemuServer::vmconfig_delete_pending_option($conf, $opt, $force);
- PVE::QemuServer::update_config_nolock($vmid, $conf, 1);
+ PVE::QemuServer::write_config($vmid, $conf, 1);
}
}
$conf->{pending}->{$opt} = $param->{$opt};
}
PVE::QemuServer::vmconfig_undelete_pending_option($conf, $opt);
- PVE::QemuServer::update_config_nolock($vmid, $conf, 1);
+ PVE::QemuServer::write_config($vmid, $conf, 1);
}
# remove pending changes when nothing changed
$conf = PVE::QemuServer::load_config($vmid); # update/reload
my $changes = PVE::QemuServer::vmconfig_cleanup_pending($conf);
- PVE::QemuServer::update_config_nolock($vmid, $conf, 1) if $changes;
+ PVE::QemuServer::write_config($vmid, $conf, 1) if $changes;
return if !scalar(keys %{$conf->{pending}});
$newconf->{$opt} = PVE::QemuServer::print_drive($vmid, $newdrive);
- PVE::QemuServer::update_config_nolock($newid, $newconf, 1);
+ PVE::QemuServer::write_config($newid, $newconf, 1);
}
delete $newconf->{lock};
- PVE::QemuServer::update_config_nolock($newid, $newconf, 1);
+ PVE::QemuServer::write_config($newid, $newconf, 1);
if ($target) {
# always deactivate volumes - avoid lvm LVs to be active on several nodes
PVE::QemuServer::add_unused_volume($conf, $old_volid) if !$param->{delete};
- PVE::QemuServer::update_config_nolock($vmid, $conf, 1);
+ PVE::QemuServer::write_config($vmid, $conf, 1);
eval {
# try to deactivate volumes - avoid lvm LVs to be active on several nodes
if (PVE::QemuServer::is_volume_in_use($storecfg, $conf, undef, $old_volid)) {
warn "volume $old_volid still has snapshots, can't delete it\n";
PVE::QemuServer::add_unused_volume($conf, $old_volid);
- PVE::QemuServer::update_config_nolock($vmid, $conf, 1);
+ PVE::QemuServer::write_config($vmid, $conf, 1);
} else {
eval { PVE::Storage::vdisk_free($storecfg, $old_volid); };
warn $@ if $@;
$drive->{size} = $newsize;
$conf->{$disk} = PVE::QemuServer::print_drive($vmid, $drive);
- PVE::QemuServer::update_config_nolock($vmid, $conf, 1);
+ PVE::QemuServer::write_config($vmid, $conf, 1);
};
PVE::QemuServer::lock_config($vmid, $updatefn);
$snap->{description} = $param->{description} if defined($param->{description});
- PVE::QemuServer::update_config_nolock($vmid, $conf, 1);
+ PVE::QemuServer::write_config($vmid, $conf, 1);
};
PVE::QemuServer::lock_config($vmid, $updatefn);
};
$conf->{template} = 1;
- PVE::QemuServer::update_config_nolock($vmid, $conf, 1);
+ PVE::QemuServer::write_config($vmid, $conf, 1);
return $rpcenv->fork_worker('qmtemplate', $vmid, $authuser, $realcmd);
};
my $conf = PVE::QemuServer::load_config($vmid);
delete $conf->{lock};
delete $conf->{pending}->{lock} if $conf->{pending}; # just to be sure
- PVE::QemuServer::update_config_nolock($vmid, $conf, 1);
+ PVE::QemuServer::write_config($vmid, $conf, 1);
});
return undef;
# set migrate lock in config file
$conf->{lock} = 'migrate';
- PVE::QemuServer::update_config_nolock($vmid, $conf, 1);
+ PVE::QemuServer::write_config($vmid, $conf, 1);
sync_disks($self, $vmid);
my $conf = $self->{vmconf};
delete $conf->{lock};
- eval { PVE::QemuServer::update_config_nolock($vmid, $conf, 1) };
+ eval { PVE::QemuServer::write_config($vmid, $conf, 1) };
if (my $err = $@) {
$self->log('err', $err);
}
my $conf = $self->{vmconf};
delete $conf->{lock};
- eval { PVE::QemuServer::update_config_nolock($vmid, $conf, 1) };
+ eval { PVE::QemuServer::write_config($vmid, $conf, 1) };
if (my $err = $@) {
$self->log('err', $err);
}
return $raw;
}
-sub update_config_nolock {
+sub write_config {
my ($vmid, $conf, $skiplock) = @_;
check_lock($conf) if !$skiplock;
PVE::Cluster::cfs_write_file($cfspath, $conf);
}
-sub update_config {
- my ($vmid, $conf, $skiplock) = @_;
-
- lock_config($vmid, &update_config_nolock, $conf, $skiplock);
-}
-
sub load_defaults {
my $res = {};
#if dimm_memory is not aligned to dimm map
if($current_size > $memory) {
$conf->{memory} = $current_size;
- update_config_nolock($vmid, $conf, 1);
+ write_config($vmid, $conf, 1);
}
});
}
}
#update conf after each succesful module hotplug
$conf->{memory} = $current_size;
- update_config_nolock($vmid, $conf, 1);
+ write_config($vmid, $conf, 1);
});
} else {
$conf->{memory} = $current_size;
eval { qemu_objectdel($vmid, "mem-$name"); };
- update_config_nolock($vmid, $conf, 1);
+ write_config($vmid, $conf, 1);
});
}
}
}
if ($changes) {
- update_config_nolock($vmid, $conf, 1);
+ write_config($vmid, $conf, 1);
$conf = load_config($vmid); # update/reload
}
# save new config if hotplug was successful
delete $conf->{$opt};
vmconfig_undelete_pending_option($conf, $opt);
- update_config_nolock($vmid, $conf, 1);
+ write_config($vmid, $conf, 1);
$conf = load_config($vmid); # update/reload
}
}
# save new config if hotplug was successful
$conf->{$opt} = $value;
delete $conf->{pending}->{$opt};
- update_config_nolock($vmid, $conf, 1);
+ write_config($vmid, $conf, 1);
$conf = load_config($vmid); # update/reload
}
}
$conf = load_config($vmid); # update/reload
if (!defined($conf->{$opt})) {
vmconfig_undelete_pending_option($conf, $opt);
- update_config_nolock($vmid, $conf, 1);
+ write_config($vmid, $conf, 1);
} elsif (valid_drivename($opt)) {
vmconfig_delete_or_detach_drive($vmid, $storecfg, $conf, $opt, $force);
vmconfig_undelete_pending_option($conf, $opt);
delete $conf->{$opt};
- update_config_nolock($vmid, $conf, 1);
+ write_config($vmid, $conf, 1);
} else {
vmconfig_undelete_pending_option($conf, $opt);
delete $conf->{$opt};
- update_config_nolock($vmid, $conf, 1);
+ write_config($vmid, $conf, 1);
}
}
}
delete $conf->{pending}->{$opt};
- update_config_nolock($vmid, $conf, 1);
+ write_config($vmid, $conf, 1);
}
}
my $changes = update_disksize($vmid, $conf, $vm_volids);
- update_config_nolock($vmid, $conf, 1) if $changes;
+ write_config($vmid, $conf, 1) if $changes;
};
if (defined($vmid)) {
# always overwrite machine if we save vmstate. This makes sure we
# can restore it later using correct machine type
$snap->{machine} = get_current_qemu_machine($vmid) if $snap->{vmstate};
-
- update_config_nolock($vmid, $conf, 1);
+ write_config($vmid, $conf, 1);
};
lock_config($vmid, $updatefn);
$newconf->{parent} = $snapname;
- update_config_nolock($vmid, $newconf, 1);
+ write_config($vmid, $newconf, 1);
};
lock_config($vmid, $updatefn);
delete $conf->{machine} if $snap->{vmstate} && !$has_machine_config;
}
- update_config_nolock($vmid, $conf, 1);
+ write_config($vmid, $conf, 1);
if (!$prepare && $snap->{vmstate}) {
my $statefile = PVE::Storage::path($storecfg, $snap->{vmstate});
}
}
- update_config_nolock($vmid, $conf, 1);
+ write_config($vmid, $conf, 1);
};
lock_config($vmid, $updatefn);
my $voliddst = PVE::Storage::vdisk_create_base($storecfg, $volid);
$drive->{file} = $voliddst;
$conf->{$ds} = print_drive($vmid, $drive);
- update_config_nolock($vmid, $conf, 1);
+ write_config($vmid, $conf, 1);
});
}