]> git.proxmox.com Git - qemu-server.git/blobdiff - PVE/API2/Qemu.pm
vncproxy: wait max 10s for the socket if it does not exist
[qemu-server.git] / PVE / API2 / Qemu.pm
index 924af264f47aa3ebd55682b223ccb09d0cc55287..f91716f3e91c670c24961cfeeea6d145f3862f6d 100644 (file)
@@ -646,8 +646,21 @@ my $vmconfig_delete_option = sub {
            $rpcenv->check($authuser, "/storage/$sid", ['Datastore.Allocate']);
        }
     }
-               
-    die "error hot-unplug $opt" if !PVE::QemuServer::vm_deviceunplug($vmid, $conf, $opt);
+
+    my $unplugwarning = "";
+    if($conf->{ostype} && $conf->{ostype} eq 'l26'){
+       $unplugwarning = "<br>verify that you have acpiphp && pci_hotplug modules loaded in your guest VM";
+    }elsif($conf->{ostype} && $conf->{ostype} eq 'l24'){
+       $unplugwarning = "<br>kernel 2.4 don't support hotplug, please disable hotplug in options";
+    }elsif(!$conf->{ostype} || ($conf->{ostype} && $conf->{ostype} eq 'other')){
+       $unplugwarning = "<br>verify that your guest support acpi hotplug";
+    }
+
+    if($opt eq 'tablet'){
+       PVE::QemuServer::vm_deviceplug(undef, $conf, $vmid, $opt);
+    }else{
+        die "error hot-unplug $opt $unplugwarning" if !PVE::QemuServer::vm_deviceunplug($vmid, $conf, $opt);
+    }
 
     if ($isDisk) {
        my $drive = PVE::QemuServer::parse_drive($opt, $conf->{$opt});
@@ -910,6 +923,12 @@ __PACKAGE__->register_method({
 
                } else {
 
+                   if($opt eq 'tablet' && $param->{$opt} == 1){
+                       PVE::QemuServer::vm_deviceplug(undef, $conf, $vmid, $opt);
+                   }elsif($opt eq 'tablet' && $param->{$opt} == 0){
+                       PVE::QemuServer::vm_deviceunplug($vmid, $conf, $opt);
+                   }
+
                    $conf->{$opt} = $param->{$opt};
                    PVE::QemuServer::update_config_nolock($vmid, $conf, 1);
                }
@@ -1091,6 +1110,9 @@ __PACKAGE__->register_method({
        my $realcmd = sub {
            my $upid = shift;
 
+           my $c = 0;
+           while ( ++$c < 10 && !-e "/var/run/qemu-server/$vmid.vnc" ) { sleep(1); }
+
            syslog('info', "starting vnc proxy $upid\n");
 
            my $qmcmd = [@$remcmd, "/usr/sbin/qm", 'vncproxy', $vmid];
@@ -1918,6 +1940,9 @@ __PACKAGE__->register_method({
 
            die "you can't resize a cdrom\n" if PVE::QemuServer::drive_is_cdrom($drive);
 
+           die "you can't online resize a virtio windows bootdisk\n" 
+               if PVE::QemuServer::check_running($vmid) && $conf->{bootdisk} eq $disk && $conf->{ostype} =~ m/^w/ && $disk =~ m/^virtio/;
+
            my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid);
 
            $rpcenv->check($authuser, "/storage/$storeid", ['Datastore.AllocateSpace']);
@@ -2305,9 +2330,6 @@ __PACKAGE__->register_method({
     protected => 1,
     proxyto => 'node',
     description => "Create a Template.",
-    permissions => {
-       check => ['perm', '/vms/{vmid}', [ 'VM.Template' ]],
-    },
     parameters => {
        additionalProperties => 0,
        properties => {
@@ -2342,7 +2364,8 @@ __PACKAGE__->register_method({
 
            PVE::QemuServer::check_lock($conf);
 
-           die "you can't convert a template to a template" if PVE::QemuServer::is_template($conf) && !$disk;
+           die "you can't convert a template to a template" 
+               if PVE::QemuServer::is_template($conf) && !$disk;
            my $realcmd = sub {
                PVE::QemuServer::template_create($vmid, $conf, $disk);
            };