mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-02 09:13:06 +00:00
use 'boolean' for hotplug option
cleanup coding style
This commit is contained in:
parent
2bbed6c09a
commit
e8b9c17cac
@ -155,7 +155,7 @@ my $confdesc = {
|
|||||||
},
|
},
|
||||||
hotplug => {
|
hotplug => {
|
||||||
optional => 1,
|
optional => 1,
|
||||||
type => 'integer',
|
type => 'boolean',
|
||||||
description => "Activate hotplug for disk and network device",
|
description => "Activate hotplug for disk and network device",
|
||||||
default => 0,
|
default => 0,
|
||||||
},
|
},
|
||||||
@ -2277,7 +2277,7 @@ sub vm_deviceadd {
|
|||||||
my $cfspath = cfs_config_path($vmid);
|
my $cfspath = cfs_config_path($vmid);
|
||||||
my $conf = PVE::Cluster::cfs_read_file($cfspath) || {};
|
my $conf = PVE::Cluster::cfs_read_file($cfspath) || {};
|
||||||
|
|
||||||
return if !check_running ($vmid) || $conf->{hotplug} != 1 ; # do nothing if vm is running or hotplug option not set to 1
|
return if !check_running($vmid) || !$conf->{hotplug};
|
||||||
|
|
||||||
if($deviceid =~ m/^(virtio)(\d+)$/) {
|
if($deviceid =~ m/^(virtio)(\d+)$/) {
|
||||||
|
|
||||||
@ -2290,7 +2290,7 @@ sub vm_deviceadd {
|
|||||||
#verification
|
#verification
|
||||||
sleep 2; #give a litlle time to os to add the device
|
sleep 2; #give a litlle time to os to add the device
|
||||||
my $devices_list = vm_devices_list($vmid);
|
my $devices_list = vm_devices_list($vmid);
|
||||||
die "error on hotplug device" if(! defined($devices_list->{$deviceid}));
|
die "error on hotplug device" if !defined($devices_list->{$deviceid});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2300,7 +2300,7 @@ sub vm_devicedel {
|
|||||||
my $cfspath = cfs_config_path($vmid);
|
my $cfspath = cfs_config_path($vmid);
|
||||||
my $conf = PVE::Cluster::cfs_read_file($cfspath) || {};
|
my $conf = PVE::Cluster::cfs_read_file($cfspath) || {};
|
||||||
|
|
||||||
return if !check_running ($vmid) || $conf->{hotplug} != 1 ;
|
return if !check_running ($vmid) || !$conf->{hotplug};
|
||||||
|
|
||||||
if($deviceid =~ m/^(virtio)(\d+)$/){
|
if($deviceid =~ m/^(virtio)(\d+)$/){
|
||||||
|
|
||||||
@ -2311,7 +2311,7 @@ sub vm_devicedel {
|
|||||||
|
|
||||||
sleep 2;
|
sleep 2;
|
||||||
my $devices_list = vm_devices_list($vmid);
|
my $devices_list = vm_devices_list($vmid);
|
||||||
die "error on hot-unplugging device " if(defined $devices_list->{$deviceid});
|
die "error on hot-unplugging device " if defined($devices_list->{$deviceid});
|
||||||
}
|
}
|
||||||
|
|
||||||
sub vm_start {
|
sub vm_start {
|
||||||
|
Loading…
Reference in New Issue
Block a user