Resolve
Fix the deletion policy in ApplianceVM
@@ -10,14 +10,16 @@ import org.zstack.core.MessageCommandRecorder;
import org.zstack.core.db.SQLBatch;
import org.zstack.core.db.SimpleQuery;
import org.zstack.core.db.SimpleQuery.Op;
-import org.zstack.header.core.Completion;
-import org.zstack.header.core.workflow.*;
-import org.zstack.header.errorcode.SysErrors;
import org.zstack.core.thread.ChainTask;
import org.zstack.core.thread.SyncTaskChain;
-import org.zstack.header.configuration.*;
+import org.zstack.header.configuration.DiskOfferingInventory;
+import org.zstack.header.configuration.DiskOfferingVO;
+import org.zstack.header.configuration.DiskOfferingVO_;
+import org.zstack.header.core.Completion;
import org.zstack.header.core.NoErrorCompletion;
+import org.zstack.header.core.workflow.*;
import org.zstack.header.errorcode.ErrorCode;
+import org.zstack.header.errorcode.SysErrors;
import org.zstack.header.host.HypervisorType;
import org.zstack.header.image.ImageInventory;
import org.zstack.header.image.ImageVO;
@@ -36,11 +38,10 @@ import org.zstack.utils.RangeSet;
import org.zstack.utils.RangeSet.Range;
import org.zstack.utils.function.Function;
-import static org.zstack.core.Platform.operr;
-
import java.util.*;
import java.util.concurrent.TimeUnit;
+import static org.zstack.core.Platform.operr;
import static org.zstack.utils.CollectionDSL.list;
public abstract class ApplianceVmBase extends VmInstanceBase implements ApplianceVm {
@@ -94,7 +95,9 @@ public abstract class ApplianceVmBase extends VmInstanceBase implements Applianc
@Override
protected void destroyHook(VmInstanceDeletionPolicy deletionPolicy, final Completion completion){
logger.debug(String.format("deleting appliance vm[uuid:%s], always use Direct deletion policy", self.getUuid()));
- super.doDestroy(VmInstanceDeletionPolicy.Direct, completion);
+ VmInstanceDeletionPolicy policy = (deletionPolicy == VmInstanceDeletionPolicy.DBOnly)
+ ? deletionPolicy : VmInstanceDeletionPolicy.Direct;
+ super.doDestroy(policy, completion);
}
@Override
