mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-14 15:56:50 +00:00
add nic hotplug to update_vm
Signed-off-by: Derumier Alexandre <aderumier@odiso.com>
This commit is contained in:
parent
5d39a18227
commit
3a1e36bb5a
@ -563,12 +563,24 @@ __PACKAGE__->register_method({
|
||||
}
|
||||
}
|
||||
#nics
|
||||
my $net = undef;
|
||||
if ($opt =~ m/^net(\d+)$/) {
|
||||
my $net = PVE::QemuServer::parse_net($param->{$opt});
|
||||
$net = PVE::QemuServer::parse_net($param->{$opt});
|
||||
$param->{$opt} = PVE::QemuServer::print_net($net);
|
||||
#if online update, then unplug first
|
||||
die "error hot-unplug $opt for update" if $conf->{$opt} && !PVE::QemuServer::vm_deviceunplug($vmid, $conf, $opt);
|
||||
}
|
||||
|
||||
PVE::QemuServer::change_config_nolock($vmid, { $opt => $param->{$opt} }, {}, 1);
|
||||
|
||||
#nic hotplug after config write as we need it for pve-bridge script
|
||||
if (defined ($net)) {
|
||||
if(!PVE::QemuServer::vm_deviceplug($storecfg, $conf, $vmid, $opt, $net)) {
|
||||
#rewrite conf to remove nic if hotplug fail
|
||||
PVE::QemuServer::change_config_nolock($vmid, {}, { $opt => 1 }, 1);
|
||||
die "error hotplug $opt";
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user