use 'boolean' for hotplug option

cleanup coding style
This commit is contained in:
Dietmar Maurer 2011-10-11 13:20:59 +02:00
parent 2bbed6c09a
commit e8b9c17cac

View File

@ -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 {