[pve-devel] r5194 - in qemu-server/pve2: . PVE

svn-commits at proxmox.com svn-commits at proxmox.com
Tue Sep 21 11:48:02 CEST 2010


Author: dietmar
Date: 2010-09-21 09:48:02 +0000 (Tue, 21 Sep 2010)
New Revision: 5194

Modified:
   qemu-server/pve2/ChangeLog
   qemu-server/pve2/PVE/QemuServer.pm
Log:
	* PVE/QemuServer.pm (new): remove unused method
	(parse_options): remove unused method
	(vm_wait_old): remove unused method
	(vm_cdrom): remove unused method
	(vm_startall_old): remove unused method


Modified: qemu-server/pve2/ChangeLog
===================================================================
--- qemu-server/pve2/ChangeLog	2010-09-21 09:44:27 UTC (rev 5193)
+++ qemu-server/pve2/ChangeLog	2010-09-21 09:48:02 UTC (rev 5194)
@@ -1,5 +1,11 @@
 2010-09-21  Proxmox Support Team  <support at proxmox.com>
 
+	* PVE/QemuServer.pm (new): remove unused method
+	(parse_options): remove unused method
+	(vm_wait_old): remove unused method
+	(vm_cdrom): remove unused method
+	(vm_startall_old): remove unused method
+
 	* PVE/VZDump/QemuServer.pm: use PVE::QemuServer::foreach_drive()
 
 	* qmigrate: use PVE::QemuServer::foreach_drive()

Modified: qemu-server/pve2/PVE/QemuServer.pm
===================================================================
--- qemu-server/pve2/PVE/QemuServer.pm	2010-09-21 09:44:27 UTC (rev 5193)
+++ qemu-server/pve2/PVE/QemuServer.pm	2010-09-21 09:48:02 UTC (rev 5194)
@@ -611,22 +611,6 @@
     }
 }
 
-sub new {
-    my ($type, $storecfg) = @_;
-
-    my $self = {};
-
-    my $class = ref ($type) || $type;
-
-    bless ($self, $class);
-
-    $storecfg = read_file('storagecfg') if !$storecfg;
-
-    $self->{storecfg} = $storecfg;
-
-    return $self;
-}
-
 my $cdrom_path;
 
 sub get_cdrom_path {
@@ -709,67 +693,6 @@
     $drive->{media} = 'cdrom' if !$drive->{media} && $drive->{file} =~ m/^(cdrom|none)$/;
 }
 
-# fixme: remove
-sub parse_options {
-    my ($self, $vmid, $create) = @_;
-
-    my $settings = {};
-
-    my $get_option_func = sub {
-	my ($opt, $value) = @_;
-	    
-	if ($opt eq 'cdrom') {
-	    $opt = 'ide2';
-	    if ($value && $value ne 'undef' && $value ne 'delete' && 
-		$value !~ m/media=/) {
-		$value .= ",media=cdrom"; 
-	    }
-	}
-
-	if (!$create && ($value eq '' || $value eq 'undef')) {
-	    $settings->{$opt} = $value;
-	    return;
-	}
-
-	my $v;
-	eval { $v = check_type($opt, $value); };
-	if ($@) {
-	    die "unable to parse value for '$opt' : $@";
-	} else {
-	    if (valid_drivename($opt)) {
-		my $drive = parse_drive ($opt, $value);
-		if (($drive->{file} !~ m/^(undef|delete|cdrom|none)$/) &&
-		    ($drive->{file} !~ m|^/dev/.+|) &&
-		    ($drive->{file} !~ m/^([^:]+):(.+)$/) &&
-		    ($drive->{file} !~ m/^\d+$/)) { 
-		    # try to convert path to volume id
-		    my ($vtype, $volid) = PVE::Storage::path_to_volume_id 
-			($self->{storecfg}, $drive->{file});
-		    die "unable to parse value for '$opt'\n" if !$vtype;
-
-		    verify_media_type($opt, $vtype, $drive->{media});
-		    $drive->{file} = $volid;
-		    $v = print_drive ($vmid, $drive);
-		}
-	    }
-	    $settings->{$opt} = $v;
-	}
-    };
-
-    my $getopt;
-    foreach my $opt (keys %$confdesc) {
-	$getopt->{"$opt=s"} = $get_option_func;
-    }
-
-    $getopt->{"cdrom=s"} = $get_option_func;
- 
-    if (!GetOptions (%$getopt)) {
-	return undef;
-    }
-
-    return $settings;
-}
-
 sub create_conf_nolock {
     my ($vmid, $settings) = @_;
 
@@ -2284,26 +2207,6 @@
     });
 }
 
-# fixme: remove
-sub vm_wait_old {
-    my ($self, $vmid, $timeout, $nolog) = @_;
-
-    my $pid = check_running ($vmid);
-
-    syslog ("info", "VM $vmid waiting until stopped") if !$nolog;
-
-    my $count = 0;
-    while ((!$timeout || ($count < $timeout)) && check_running ($vmid)) {
-	$count++;
-	sleep 1;
-    }
-
-    if (check_running ($vmid)) {
-	syslog ('info', "VM $vmid wait failed - got timeout");
-	die "wait failed - got timeout\n";
-    }
-}
-
 sub vm_shutdown {
     my ($vmid, $skiplock) = @_;
 
@@ -2423,61 +2326,6 @@
     });
 }
 
-# fixme: remove
-sub vm_cdrom {
-    my ($self, $vmid, $dev, $volid) = @_;
-
-    lock_config ($vmid, sub {
-
-	my $conf = load_config ($vmid);
-
-	check_lock ($conf);
-
-	my $disk;
-	if (($disk = $conf->{diskinfo}->{$dev}) && drive_is_cdrom ($disk)) {
-	    $disk->{file} = $volid;
-	    my $newdrive =  print_drive ($vmid, $disk);
-	    my $settings = { $dev => $newdrive };
-	    change_config_nolock  ($vmid, $settings);
-	} else {
-	    die "no such cdrom device '$dev'\n";
-	}
-
-	return if !check_running ($vmid); # do nothing
-
-	$conf = load_config ($vmid);# reload
-
-	my $qdn;
-	eval {
-	    if (!valid_drivename ($dev)) {
-		die "cdrom change failed - invalid device name '$dev'\n";
-	    }
-
-	    if ($volid eq 'eject' || $volid eq 'none') {
-		syslog ("info", "VM $vmid eject cdrom '$dev'");
-	    } else {
-		syslog ("info", "VM $vmid change cdrom '$dev' to '$volid'");
-	    }
-
-	    $qdn = qemu_drive_name ($dev, 'cdrom');
-	};
-
-	if (my $err = $@) {
-	    syslog ('err', "VM $vmid $err");
-	    die $err;
-	}
-
-	if ($volid eq 'eject' || $volid eq 'none') {
-	    vm_monitor_command ($vmid, "eject $qdn", 1);
-	} else {
-	    my $path = get_iso_path ($self->{storecfg}, $vmid, $volid);
-
-	    vm_monitor_command ($vmid, "eject $qdn", 1);
-	    vm_monitor_command ($vmid, "change $qdn \"$path\"", 1);
-	}
-    });
-}
-
 sub vm_destroy {
     my ($storecfg, $vmid, $skiplock) = @_;
 
@@ -2507,26 +2355,6 @@
     });
 }
 
-# fixme: remove
-sub vm_startall_old {
-    my ($self) = @_;
-
-    my $vzlist = vzlist();
-
-    foreach my $vmid (keys %$vzlist) {
-	next if $vzlist->{$vmid}->{pid}; # already running
-
-	eval {
-	    my $conf = load_config ($vmid);
-	    if ($conf->{onboot}) {
-		print STDERR "Starting Qemu VM $vmid\n";
-		$self->vm_start ($vmid);
-	    }
-	};
-	print STDERR $@ if $@;
-    }
-}
-
 sub vm_stopall {
     my ($timeout) = @_;
 




More information about the pve-devel mailing list