use of org.ovirt.engine.core.common.vdscommands.RemoveVMVDSCommandParameters 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);
}
}
}
Aggregations