[pve-devel] [PATCH 1/2] activate_volume before generate kvm command line

Dietmar Maurer dietmar at proxmox.com
Tue May 29 09:46:42 CEST 2012


config_to_command() is also used in vm_commandline(), so you also need to activate storage there?

Then it is maybe better to activate inside config_to_command()? This is an unexpected side effect, so we should make config_to_command() a private method. Or do we use that somewhere else?

> -----Original Message-----
> From: pve-devel-bounces at pve.proxmox.com [mailto:pve-devel-
> bounces at pve.proxmox.com] On Behalf Of Alexandre Derumier
> Sent: Dienstag, 29. Mai 2012 08:12
> To: pve-devel at pve.proxmox.com
> Subject: [pve-devel] [PATCH 1/2] activate_volume before generate kvm
> command line
> 
> I need this for my nexenta plugin, guest config have nexentavolume in drive
> option, I need to translate it to /dev/disk/... , so volume must be activated
> before generating command line.
> 
> Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
> ---
>  PVE/QemuServer.pm |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index
> ad8dff1..8a56b04 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -2618,7 +2618,10 @@ sub vm_start {
> 
>  	my $defaults = load_defaults();
> 
> -	my ($cmd, $vollist) = config_to_command($storecfg, $vmid, $conf,
> $defaults, $migrate_uri);
> +        my $vollist = get_vm_volumes($conf);
> +        PVE::Storage::activate_volumes($storecfg, $vollist);
> +
> +	my ($cmd) = config_to_command($storecfg, $vmid, $conf, $defaults,
> +$migrate_uri);
>  	# host pci devices
>          for (my $i = 0; $i < $MAX_HOSTPCI_DEVICES; $i++)  {
>            my $d = parse_hostpci($conf->{"hostpci$i"});
> @@ -2630,8 +2633,6 @@ sub vm_start {
>            die "can't reset pci device '$d->{pciid}'\n" if !pci_dev_reset($info);
>          }
> 
> -	PVE::Storage::activate_volumes($storecfg, $vollist);
> -
>  	eval  { run_command($cmd, timeout => $migrate_uri ? undef : 30); };
>  	my $err = $@;
>  	die "start failed: $err" if $err;
> --
> 1.7.2.5
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel





More information about the pve-devel mailing list