diff --git a/PVE/API2/OpenVZ.pm b/PVE/API2/OpenVZ.pm index 10d2f9be..938e4a42 100644 --- a/PVE/API2/OpenVZ.pm +++ b/PVE/API2/OpenVZ.pm @@ -59,6 +59,15 @@ CPUUNITS="1000" CPUS="1" __EOD +my $get_container_storage = sub { + my ($stcfg, $vmid, $veconf) = @_; + + my $path = PVE::OpenVZ::get_privatedir($veconf, $vmid); + my ($vtype, $volid) = PVE::Storage::path_to_volume_id($stcfg, $path); + my ($sid, $volname) = PVE::Storage::parse_volume_id($volid, 1) if $volid; + return wantarray ? ($sid, $volname, $path) : $sid; +}; + my $check_ct_modify_config_perm = sub { my ($rpcenv, $authuser, $vmid, $pool, $key_list) = @_; @@ -725,12 +734,8 @@ __PACKAGE__->register_method({ my $stcfg = cfs_read_file("storage.cfg"); - if ($veconf->{ve_private} && $veconf->{ve_private}->{value}) { - my $path = PVE::OpenVZ::get_privatedir($veconf, $param->{vmid}); - my ($vtype, $volid) = PVE::Storage::path_to_volume_id($stcfg, $path); - my ($sid, $volname) = PVE::Storage::parse_volume_id($volid, 1) if $volid; - $conf->{storage} = $sid || $path; - } + my ($sid, undef, $path) = &$get_container_storage($stcfg, $param->{vmid}, $veconf); + $conf->{storage} = $sid || $path; my $properties = PVE::OpenVZ::json_config_properties(); @@ -1074,6 +1079,12 @@ __PACKAGE__->register_method({ syslog('info', "starting CT $vmid: $upid\n"); + my $veconf = PVE::OpenVZ::load_config($vmid); + my $stcfg = cfs_read_file("storage.cfg"); + if (my $sid = &$get_container_storage($stcfg, $vmid, $veconf)) { + PVE::Storage::activate_storage($stcfg, $sid); + } + my $cmd = ['vzctl', 'start', $vmid]; run_command($cmd); diff --git a/debian/changelog.Debian b/debian/changelog.Debian index 9e1d1c05..1bd9b435 100644 --- a/debian/changelog.Debian +++ b/debian/changelog.Debian @@ -1,6 +1,8 @@ pve-manager (2.0-63) unstable; urgency=low * fix bug 128: implement pvectl startall/stopall + + * fix bug 171: activate storage before starting containers -- Proxmox Support Team Wed, 18 Apr 2012 10:02:54 +0200