Signed-off-by: Dietmar Maurer <diet...@proxmox.com> --- PVE/QemuServer.pm | 54 ++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 9a649d3..5604661 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -1428,7 +1428,7 @@ sub vmconfig_undelete_pending_option { $conf->{pending}->{delete} = join(',', @keylist); } else { delete $conf->{pending}->{delete}; - } + } } sub vmconfig_register_unused_drive { @@ -1447,7 +1447,7 @@ sub vmconfig_cleanup_pending { # remove pending changes when nothing changed my $changes; - foreach my $opt (keys %{$conf->{pending}}) { + foreach my $opt (keys %{$conf->{pending}}) { if (defined($conf->{$opt}) && ($conf->{pending}->{$opt} eq $conf->{$opt})) { $changes = 1; delete $conf->{pending}->{$opt}; @@ -1884,7 +1884,7 @@ sub parse_vm_config { next if $line =~ m/^\s*$/; if ($line =~ m/^\[PENDING\]\s*$/i) { - $section = 'pending'; + $section = 'pending'; $conf->{description} = $descr if $descr; $descr = ''; $conf = $res->{$section} = {}; @@ -2040,12 +2040,12 @@ sub write_vm_config { }; my $raw = &$generate_raw_config($conf); - + if (scalar(keys %{$conf->{pending}})){ $raw .= "\n[PENDING]\n"; $raw .= &$generate_raw_config($conf->{pending}); } - + foreach my $snapname (sort keys %{$conf->{snapshots}}) { $raw .= "\n[$snapname]\n"; $raw .= &$generate_raw_config($conf->{snapshots}->{$snapname}); @@ -3480,8 +3480,8 @@ sub set_migration_caps { sub vmconfig_hotplug_pending { my ($vmid, $conf, $storecfg) = @_; - my $defaults = PVE::QemuServer::load_defaults(); - + my $defaults = load_defaults(); + # commit values which do not have any impact on running VM first my $changes = 0; @@ -3491,7 +3491,7 @@ sub vmconfig_hotplug_pending { delete $conf->{pending}->{$opt}; $changes = 1; } - } + } if ($changes) { update_config_nolock($vmid, $conf, 1); @@ -3518,12 +3518,12 @@ sub vmconfig_hotplug_pending { return if !$conf->{hotplug}; my @delete = PVE::Tools::split_list($conf->{pending}->{delete}); - foreach my $opt (@delete) { + foreach my $opt (@delete) { if ($opt eq 'tablet') { if ($defaults->{tablet}) { - PVE::QemuServer::vm_deviceplug($storecfg, $conf, $vmid, $opt); + vm_deviceplug($storecfg, $conf, $vmid, $opt); } else { - PVE::QemuServer::vm_deviceunplug($vmid, $conf, $opt); + vm_deviceunplug($vmid, $conf, $opt); } } else { # skip non-hot-pluggable options @@ -3543,9 +3543,9 @@ sub vmconfig_hotplug_pending { if ($opt eq 'tablet') { if ($value == 1) { - PVE::QemuServer::vm_deviceplug($storecfg, $conf, $vmid, $opt); + vm_deviceplug($storecfg, $conf, $vmid, $opt); } elsif ($value == 0) { - PVE::QemuServer::vm_deviceunplug($vmid, $conf, $opt); + vm_deviceunplug($vmid, $conf, $opt); } } else { # skip non-hot-pluggable options @@ -3570,7 +3570,7 @@ sub vmconfig_apply_pending { my @delete = PVE::Tools::split_list($conf->{pending}->{delete}); foreach my $opt (@delete) { # delete - die "internal error" if $opt =~ m/^unused/; + die "internal error" if $opt =~ m/^unused/; $conf = load_config($vmid); # update/reload if (!defined($conf->{$opt})) { vmconfig_undelete_pending_option($conf, $opt); @@ -3586,16 +3586,16 @@ sub vmconfig_apply_pending { update_config_nolock($vmid, $conf, 1); } } - + $conf = load_config($vmid); # update/reload - + foreach my $opt (keys %{$conf->{pending}}) { # add/change $conf = load_config($vmid); # update/reload - + if (defined($conf->{$opt}) && ($conf->{$opt} eq $conf->{pending}->{$opt})) { # skip if nothing changed } elsif (valid_drivename($opt)) { - vmconfig_register_unused_drive($storecfg, $vmid, $conf, parse_drive($opt, $conf->{$opt})) + vmconfig_register_unused_drive($storecfg, $vmid, $conf, parse_drive($opt, $conf->{$opt})) if defined($conf->{$opt}); $conf->{$opt} = $conf->{pending}->{$opt}; } else { @@ -3691,15 +3691,15 @@ sub vm_start { if ($migratedfrom) { eval { - PVE::QemuServer::set_migration_caps($vmid); + set_migration_caps($vmid); }; warn $@ if $@; if ($spice_port) { print "spice listens on port $spice_port\n"; if ($spice_ticket) { - PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "set_password", protocol => 'spice', password => $spice_ticket); - PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "expire_password", protocol => 'spice', time => "+30"); + vm_mon_cmd_nocheck($vmid, "set_password", protocol => 'spice', password => $spice_ticket); + vm_mon_cmd_nocheck($vmid, "expire_password", protocol => 'spice', time => "+30"); } } @@ -4763,7 +4763,7 @@ sub restore_tar_archive { my $storecfg = cfs_read_file('storage.cfg'); # destroy existing data - keep empty config - my $vmcfgfn = PVE::QemuServer::config_file($vmid); + my $vmcfgfn = config_file($vmid); destroy_vm($storecfg, $vmid, 1) if -f $vmcfgfn; my $tocmd = "/usr/lib/qemu-server/qmextract"; @@ -5435,7 +5435,7 @@ sub qemu_drive_mirror { #fixme : sometime drive-mirror timeout, but works fine after. # (I have see the problem with big volume > 200GB), so we need to eval - eval { vm_mon_cmd($vmid, "drive-mirror", %$opts); }; + eval { vm_mon_cmd($vmid, "drive-mirror", %$opts); }; # ignore errors here eval { @@ -5452,12 +5452,12 @@ sub qemu_drive_mirror { my $busy = $stat->{busy}; print "transferred: $transferred bytes remaining: $remaining bytes total: $total bytes progression: $percent % busy: $busy\n"; - + if ($stat->{len} == $stat->{offset}) { if ($busy eq 'false') { last if $vmiddst != $vmid; - + # try to switch the disk if source and destination are on the same guest eval { vm_mon_cmd($vmid, "block-job-complete", device => "drive-$drive") }; last if !$@; @@ -5492,7 +5492,7 @@ sub qemu_drive_mirror { }; if ($err) { - eval { &$cancel_job(); }; + eval { &$cancel_job(); }; die "mirroring error: $err"; } @@ -5553,7 +5553,7 @@ sub get_current_qemu_machine { my ($vmid) = @_; my $cmd = { execute => 'query-machines', arguments => {} }; - my $res = PVE::QemuServer::vm_qmp_command($vmid, $cmd); + my $res = vm_qmp_command($vmid, $cmd); my ($current, $default); foreach my $e (@$res) { -- 1.7.10.4 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel