]> git.proxmox.com Git - qemu-server.git/commitdiff
removed startall/stopall commands
authorDietmar Maurer <dietmar@proxmox.com>
Fri, 20 Apr 2012 07:30:42 +0000 (09:30 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 20 Apr 2012 07:30:42 +0000 (09:30 +0200)
Because we now support startup priorities, and start/stop order must include containers

PVE/QemuServer.pm
changelog.Debian
qemu.init.d
qm

index 0d78bac6b12462f2008c7ca0f016949307650c30..fbd4b54a91d4110f793ad24614df92a384677698 100644 (file)
@@ -2937,105 +2937,6 @@ sub vm_destroy {
     });
 }
 
-sub vm_stopall {
-    my ($storecfg, $timeout) = @_;
-
-    $timeout = 3*60 if !$timeout;
-
-    my $cleanuphash = {};
-
-    my $vzlist = vzlist();
-    my $count = 0;
-    foreach my $vmid (keys %$vzlist) {
-       next if !$vzlist->{$vmid}->{pid};
-       $count++;
-       $cleanuphash->{$vmid} = 1;
-    }
-
-    return if !$count;
-
-    my $msg = "Stopping Qemu Server - sending shutdown requests to all VMs\n";
-    syslog('info', $msg);
-    warn $msg;
-
-    foreach my $vmid (keys %$vzlist) {
-       next if !$vzlist->{$vmid}->{pid};
-       eval { vm_monitor_command($vmid, "system_powerdown"); };
-       warn $@ if $@;
-    }
-
-    my $wt = 5;
-    my $maxtries = int(($timeout + $wt -1)/$wt);
-    my $try = 0;
-    while (($try < $maxtries) && $count) {
-       $try++;
-       sleep $wt;
-
-       $vzlist = vzlist();
-       $count = 0;
-       foreach my $vmid (keys %$vzlist) {
-           next if !$vzlist->{$vmid}->{pid};
-           $count++;
-       }
-       last if !$count;
-    }
-
-    if ($count) {
-
-       foreach my $vmid (keys %$vzlist) {
-           next if !$vzlist->{$vmid}->{pid};
-
-           warn "VM $vmid still running - sending stop now\n";
-           eval { vm_monitor_command($vmid, "quit"); };
-           warn $@ if $@;
-       }
-
-       $timeout = 30;
-       $maxtries = int(($timeout + $wt -1)/$wt);
-       $try = 0;
-       while (($try < $maxtries) && $count) {
-           $try++;
-           sleep $wt;
-
-           $vzlist = vzlist();
-           $count = 0;
-           foreach my $vmid (keys %$vzlist) {
-               next if !$vzlist->{$vmid}->{pid};
-               $count++;
-           }
-           last if !$count;
-       }
-
-       if ($count) {
-
-           foreach my $vmid (keys %$vzlist) {
-               next if !$vzlist->{$vmid}->{pid};
-
-               warn "VM $vmid still running - terminating now with SIGTERM\n";
-               kill 15, $vzlist->{$vmid}->{pid};
-           }
-           sleep 1;
-       }
-
-       # this is called by system shotdown scripts, so remaining
-       # processes gets killed anyways (no need to send kill -9 here)
-    }
-
-    $vzlist = vzlist();
-    foreach my $vmid (keys %$cleanuphash) {
-       next if $vzlist->{$vmid}->{pid};
-       eval {
-           my $conf = load_config($vmid);
-           vm_stop_cleanup($storecfg, $vmid, $conf);
-       };
-       warn $@ if $@;
-    }
-
-    $msg = "Qemu Server stopped\n";
-    syslog('info', $msg);
-    print $msg;
-}
-
 # pci helpers
 
 sub file_write {
index 5bd70d73c19ba7f2c5991213c058296168f4aeb2..1e5449ff6006b2acddad4b7dc283fe6a73743d41 100644 (file)
@@ -1,6 +1,11 @@
 qemu-server (2.0-39) unstable; urgency=low
 
   * new startup option to define startup order.
+  
+  * do not start VMs with /etc/init.d/qemu-server. This is now
+  done with /etc/init.d/pve-manager
+  
+  * qm: removed startall/stopall commands
 
  -- Proxmox Support Team <support@proxmox.com>  Thu, 19 Apr 2012 14:26:04 +0200
 
index 333c0acc76d5ce334e86b0dfe90283cd28b3cef2..3b142ad0bbcec068fb10754ca947c184dec0baf4 100644 (file)
@@ -32,10 +32,9 @@ case "$1" in
        mkdir -p /var/run/qemu-server
        mkdir -p /var/lock/qemu-server
 
-       $PROG startall
        ;;
   stop)
-       $PROG stopall
+        # nothing to do, because we are no real daemon
        ;;
   force-reload)
        ;;
diff --git a/qm b/qm
index b45dc319f25f6dca24d7876fdbbf52c778d55a05..044bc21dce24bfeca3067be4d1fd5ac1fc6cfc8f 100755 (executable)
--- a/qm
+++ b/qm
@@ -222,90 +222,6 @@ __PACKAGE__->register_method ({
        return undef;
     }});
 
-__PACKAGE__->register_method ({
-    name => 'startall', 
-    path => 'startall', 
-    method => 'POST',
-    description => "Start all virtual machines (when onboot=1).",
-    parameters => {
-       additionalProperties => 0,
-       properties => {},
-    },
-    returns => { type => 'null'},
-    code => sub {
-       my ($param) = @_;
-
-       # wait up to 10 seconds for quorum
-       for (my $i = 10; $i >= 0; $i--) {
-           last if PVE::Cluster::check_cfs_quorum($i != 0 ? 1 : 0);
-           sleep(1);
-       }
-       
-       my $vzlist = PVE::QemuServer::vzlist();
-       my $storecfg = PVE::Storage::config();
-
-       my $cc = PVE::Cluster::cfs_read_file('cluster.conf');
-
-       my $count = 0;
-       foreach my $vmid (keys %$vzlist) {
-           next if $vzlist->{$vmid}->{pid}; # already running
-
-           my $conf;
-           eval { $conf = PVE::QemuServer::load_config($vmid); };
-           if (my $err = $@) {
-               warn $err;
-               next;
-           }
-
-           next if !($conf && $conf->{onboot});
-
-           # skip ha managed VMs (started by rgmanager)
-           next if PVE::Cluster::cluster_conf_lookup_pvevm($cc, 0, $vmid, 1);
-
-           sleep(2) if $count != 0; # reduce load
-           $count++;
-
-           PVE::Cluster::check_cfs_quorum(); # abort when we loose quorum
-
-           eval {
-               print STDERR "Starting Qemu VM $vmid\n";
-               PVE::QemuServer::vm_start($storecfg, $vmid);
-           };
-           warn $@ if $@;
-       }
-
-       return undef;
-    }});
-
-__PACKAGE__->register_method ({
-    name => 'stopall', 
-    path => 'stopall', 
-    method => 'POST',
-    description => "Stop all virtual machines.",
-    parameters => {
-       additionalProperties => 0,
-       properties => {
-           timeout => {
-               description => "Timeout in seconds. Default is to wait 3 minutes.",
-               type => 'integer',
-               minimum => 1,
-               optional => 1,
-           }
-       },
-    },
-    returns => { type => 'null'},
-    code => sub {
-       my ($param) = @_;
-
-       my $timeout = $param->{timeout};
-
-       my $storecfg = PVE::Storage::config();
-
-       PVE::QemuServer::vm_stopall($storecfg, $timeout);
-
-       return undef;
-    }});
-
 __PACKAGE__->register_method ({
     name => 'wait', 
     path => 'wait', 
@@ -457,10 +373,6 @@ my $cmddef = {
 
     monitor  => [ __PACKAGE__, 'monitor', ['vmid']],
 
-    startall => [ __PACKAGE__, 'startall', []],
-
-    stopall => [ __PACKAGE__, 'stopall', []],
-
     mtunnel => [ __PACKAGE__, 'mtunnel', []],  
 };