use of org.ovirt.engine.core.common.action.RemoveAllVmImagesParameters in project ovirt-engine by oVirt.
the class RemoveVmTemplateFromImportExportCommand method executeCommand.
@Override
protected void executeCommand() {
getParameters().setEntityInfo(new EntityInfo(VdcObjectType.VmTemplate, getVmTemplateId()));
RemoveVMVDSCommandParameters tempVar = new RemoveVMVDSCommandParameters(getParameters().getStoragePoolId(), getVmTemplateId());
tempVar.setStorageDomainId(getParameters().getStorageDomainId());
runVdsCommand(VDSCommandType.RemoveVM, tempVar);
List<DiskImage> images = getParameters().getImages();
setSucceeded(true);
if (!images.isEmpty()) {
for (DiskImage image : images) {
ArrayList<Guid> storageIds = new ArrayList<>();
storageIds.add(getParameters().getStorageDomainId());
image.setStorageIds(storageIds);
image.setStoragePoolId(getParameters().getStoragePoolId());
}
RemoveAllVmImagesParameters tempVar2 = new RemoveAllVmImagesParameters(getVmId(), images);
tempVar2.setParentCommand(getActionType());
tempVar2.setEntityInfo(getParameters().getEntityInfo());
tempVar2.setForceDelete(true);
tempVar2.setParentParameters(getParameters());
ActionReturnValue vdcRetValue = runInternalActionWithTasksContext(ActionType.RemoveAllVmImages, tempVar2);
if (vdcRetValue.getSucceeded()) {
getReturnValue().getVdsmTaskIdList().addAll(vdcRetValue.getInternalVdsmTaskIdList());
} else {
getReturnValue().setFault(vdcRetValue.getFault());
setSucceeded(false);
}
}
}
use of org.ovirt.engine.core.common.action.RemoveAllVmImagesParameters in project ovirt-engine by oVirt.
the class RemoveVmCommand method buildRemoveAllVmImagesParameters.
private RemoveAllVmImagesParameters buildRemoveAllVmImagesParameters(List<DiskImage> images) {
RemoveAllVmImagesParameters params = new RemoveAllVmImagesParameters(getVmId(), images);
if (!isExecutedAsChildCommand()) {
params.setParentCommand(getActionType());
params.setEntityInfo(getParameters().getEntityInfo());
params.setParentParameters(getParameters());
} else {
params.setParentCommand(getParameters().getParentCommand());
params.setEntityInfo(getParameters().getParentParameters().getEntityInfo());
params.setParentParameters(getParameters().getParentParameters());
}
return params;
}
Aggregations