]> git.proxmox.com Git - pve-manager-legacy.git/commitdiff
activate storage before starting containers
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 18 Apr 2012 10:09:48 +0000 (12:09 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 18 Apr 2012 10:09:48 +0000 (12:09 +0200)
PVE/API2/OpenVZ.pm
debian/changelog.Debian

index 10d2f9be1727131a0061ef7b9022eb1db6c70ea0..938e4a420fae7f55cb22a8aedb24a90744bb15c2 100644 (file)
@@ -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);
index 9e1d1c0569197b9f1693a1c41a57d281f19c4ee1..1bd9b4350bbb2d56022659fdd22b9caf987f7eef 100644 (file)
@@ -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 <support@proxmox.com>  Wed, 18 Apr 2012 10:02:54 +0200