mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-11 17:09:56 +00:00
add vm_devicedel sub
use qm monitor to hot-unplug device. Currently only virtio disk Signed-off-by: Derumier Alexandre <aderumier@odiso.com>
This commit is contained in:
parent
a4dea33125
commit
873c2d698f
@ -2293,6 +2293,26 @@ sub vm_deviceadd {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub vm_devicedel {
|
||||||
|
my ($vmid,$deviceid) = @_;
|
||||||
|
|
||||||
|
my $cfspath = cfs_config_path($vmid);
|
||||||
|
my $conf = PVE::Cluster::cfs_read_file($cfspath) || {};
|
||||||
|
|
||||||
|
return if !check_running ($vmid) || $conf->{hotplug} != 1 ;
|
||||||
|
|
||||||
|
if($deviceid =~ m/^(virtio)(\d+)$/){
|
||||||
|
|
||||||
|
vm_monitor_command ($vmid, "drive_del drive-$deviceid",1);
|
||||||
|
vm_monitor_command ($vmid, "device_del $deviceid",1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sleep 2;
|
||||||
|
my $devices_list=vm_devices_list($vmid);
|
||||||
|
die "error on hot-unplugging device " if(defined $devices_list->{$deviceid});
|
||||||
|
}
|
||||||
|
|
||||||
sub vm_start {
|
sub vm_start {
|
||||||
my ($storecfg, $vmid, $statefile, $skiplock) = @_;
|
my ($storecfg, $vmid, $statefile, $skiplock) = @_;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user