-
- if ($opt eq 'tablet') {
- if ($value == 1) {
- vm_deviceplug($storecfg, $conf, $vmid, $opt);
- } elsif ($value == 0) {
- vm_deviceunplug($vmid, $conf, $opt);
+ my $skip;
+ eval {
+ if ($opt eq 'tablet') {
+ return undef if !$hotplug;
+ if ($value == 1) {
+ vm_deviceplug($storecfg, $conf, $vmid, $opt);
+ } elsif ($value == 0) {
+ vm_deviceunplug($vmid, $conf, $opt);
+ }
+ } elsif ($opt eq 'cores') {
+ return undef if !$hotplug;
+ qemu_cpu_hotplug($vmid, $conf, $value);
+ } elsif ($opt eq 'balloon') {
+ return undef if !(defined($conf->{shares}) && ($conf->{shares} == 0));
+ # allow manual ballooning if shares is set to zero
+ my $balloon = $conf->{pending}->{balloon} || $conf->{memory} || $defaults->{memory};
+ vm_mon_cmd($vmid, "balloon", value => $balloon*1024*1024);
+ } else {
+ $skip = 1; # skip non-hot-pluggable options
+ return undef;