[pve-devel] r5162 - in qemu-server/pve2/PVE: . API2/Qemu

svn-commits at proxmox.com svn-commits at proxmox.com
Wed Sep 15 14:20:25 CEST 2010


Author: dietmar
Date: 2010-09-15 12:20:24 +0000 (Wed, 15 Sep 2010)
New Revision: 5162

Modified:
   qemu-server/pve2/PVE/API2/Qemu/Config.pm
   qemu-server/pve2/PVE/QemuServer.pm
Log:
fix delete/undef


Modified: qemu-server/pve2/PVE/API2/Qemu/Config.pm
===================================================================
--- qemu-server/pve2/PVE/API2/Qemu/Config.pm	2010-09-15 10:14:20 UTC (rev 5161)
+++ qemu-server/pve2/PVE/API2/Qemu/Config.pm	2010-09-15 12:20:24 UTC (rev 5162)
@@ -115,7 +115,6 @@
 	die "unable to create vm $vmid: config file already exists\n" 
 	    if -f $filename;
 	
-
 	my $storecfg = read_file('storagecfg');
 
 	my $opts = PVE::QemuServer::parse_options_new($storecfg, $param->{vmid}, $param, 1);
@@ -224,6 +223,7 @@
 	    my $unset = {};
 
 	    foreach my $opt (PVE::Tools::split_list($delete)) {
+		$opt = 'ide2' if $opt eq 'cdrom';
 		if (!PVE::QemuServer::option_exists($opt)) {
 		    raise_param_exc({ delete => "unknown option '$opt'" });
 		} 
@@ -242,6 +242,8 @@
 	    PVE::QemuServer::create_disks ($storecfg, $vmid, $opts);
 
 	    PVE::QemuServer::change_config_nolock  ($vmid, $opts, $unset, 1);
+
+	    # return if !PVE::QemuServer::check_running ($vmid);
 	};
 
 	PVE::QemuServer::lock_config ($vmid, $updatefn);

Modified: qemu-server/pve2/PVE/QemuServer.pm
===================================================================
--- qemu-server/pve2/PVE/QemuServer.pm	2010-09-15 10:14:20 UTC (rev 5161)
+++ qemu-server/pve2/PVE/QemuServer.pm	2010-09-15 12:20:24 UTC (rev 5162)
@@ -762,25 +762,16 @@
 	    
 	if ($opt eq 'cdrom') {
 	    $opt = 'ide2';
-	    if ($value && $value ne 'undef' && $value ne 'delete' && 
-		$value !~ m/media=/) {
-		$value .= ",media=cdrom"; 
-	    }
+	    $value .= ",media=cdrom" if $value !~ m/media=/;
 	}
 
-	# fixme: howto implement this?
-	if (!$create && ($value eq '' || $value eq 'undef')) {
-	    $settings->{$opt} = $value;
-	    return;
-	}
-
 	my $v;
 	eval { $v = check_type($opt, $value); };
 	raise_param_exc({ $opt => $@ }) if $@;
 	my $fmt = $confdesc->{$opt}->{format};
 	if ($fmt && $fmt eq 'pve-qm-drive') {
 	    my $drive = parse_drive ($opt, $value);
-	    if (($drive->{file} !~ m/^(undef|delete|cdrom|none)$/) &&
+	    if (($drive->{file} !~ m/^(cdrom|none)$/) &&
 		($drive->{file} !~ m|^/dev/.+|) &&
 		($drive->{file} !~ m/^([^:]+):(.+)$/) &&
 		($drive->{file} !~ m/^\d+$/)) { 




More information about the pve-devel mailing list