mirror of https://github.com/apache/cloudstack.git
Fix remove VM and its volumes for deploy-as-is if have previously failed - restore cpu flags in nested virtualization test
This commit is contained in:
parent
950292dcb0
commit
ee5b8763a6
|
|
@ -28,6 +28,8 @@ import java.util.Random;
|
|||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.storage.dao.VMTemplateDao;
|
||||
import org.apache.cloudstack.engine.cloud.entity.api.VolumeEntity;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.ChapInfo;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult;
|
||||
|
|
@ -168,6 +170,8 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
private ClusterDao clusterDao;
|
||||
@Inject
|
||||
private VolumeDetailsDao _volumeDetailsDao;
|
||||
@Inject
|
||||
private VMTemplateDao templateDao;
|
||||
|
||||
private final static String SNAPSHOT_ID = "SNAPSHOT_ID";
|
||||
|
||||
|
|
@ -351,9 +355,12 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Marking volume that was never created as destroyed: " + vol);
|
||||
}
|
||||
volDao.remove(vol.getId());
|
||||
future.complete(result);
|
||||
return future;
|
||||
VMTemplateVO template = templateDao.findById(vol.getTemplateId());
|
||||
if (template != null && !template.isDeployAsIs()) {
|
||||
volDao.remove(vol.getId());
|
||||
future.complete(result);
|
||||
return future;
|
||||
}
|
||||
}
|
||||
}
|
||||
VolumeObject vo = (VolumeObject)volume;
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ class TestNestedVirtualization(cloudstackTestCase):
|
|||
#5) Check for CPU flags: vmx for Intel and svm for AMD indicates nested virtualization is enabled
|
||||
self.assert_(result is not None, "Empty result for CPU flags")
|
||||
res = str(result)
|
||||
self.assertTrue('vmx' in res or 'svm' in res or 'lm' in res)
|
||||
self.assertTrue('vmx' in res or 'svm' in res)
|
||||
except Exception as e:
|
||||
self.debug('Error=%s' % e)
|
||||
self.rollback_nested_configurations(rollback_nv, rollback_nv_per_vm)
|
||||
|
|
|
|||
Loading…
Reference in New Issue