[pve-devel] [[PATCH pve-container] 4/4] Prevent that CT run at clone time.

Wolfgang Link w.link at proxmox.com
Wed Apr 20 08:06:04 CEST 2016


If we make a linked clone the CT must be a template, so it is not allowed to run.
If we make a full clone, it is safer to have the CT offline.
---
 src/PVE/API2/LXC.pm | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index 5c0ae99..1037f66 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -1079,7 +1079,7 @@ __PACKAGE__->register_method({
 
 	PVE::Cluster::check_cfs_quorum();
 
-	my $running = PVE::LXC::check_running($vmid) || 0;
+	die "Clone can't be done online\n." if  PVE::LXC::check_running($vmid) || 0;
 
 	my $clonefn = sub {
 
@@ -1089,10 +1089,6 @@ __PACKAGE__->register_method({
 
 	    PVE::LXC::Config->check_lock($conf);
 
-	    my $verify_running = PVE::LXC::check_running($vmid) || 0;
-
-	    die "unexpected state change\n" if $verify_running != $running;
-
 	    die "snapshot '$snapname' does not exist\n"
 		if $snapname && !defined( $conf->{snapshots}->{$snapname});
 
@@ -1125,7 +1121,7 @@ __PACKAGE__->register_method({
 			} else {
 			    # not full means clone instead of copy
 			    die "Linked clone feature for '$volid' is not available\n"
-				if !PVE::Storage::volume_has_feature($storecfg, 'clone', $volid, $snapname, $running);
+				if !PVE::Storage::volume_has_feature($storecfg, 'clone', $volid, $snapname, 0);
 			}
 
 			$mountpoints->{$opt} = $mp;
-- 
2.1.4




More information about the pve-devel mailing list