use of org.ovirt.engine.core.common.action.VmDiskOperationParameterBase in project ovirt-engine by oVirt.
the class BackendDiskAttachmentResource method update.
@Override
public DiskAttachment update(DiskAttachment attachment) {
if (attachment.isSetActive()) {
DiskAttachment attachmentFromDb = get();
if (!attachmentFromDb.isActive().equals(attachment.isActive())) {
ActionType actionType = attachment.isActive() ? ActionType.HotPlugDiskToVm : ActionType.HotUnPlugDiskFromVm;
VmDiskOperationParameterBase params = new VmDiskOperationParameterBase(new DiskVmElement(guid, vmId));
try {
doAction(actionType, params);
} catch (BackendFailureException e) {
return handleError(e, false);
}
}
}
return performUpdate(attachment, new AddDiskResolver(), ActionType.UpdateVmDisk, new UpdateParametersProvider());
}
use of org.ovirt.engine.core.common.action.VmDiskOperationParameterBase in project ovirt-engine by oVirt.
the class UpdateVmDiskCommand method buildExtendCinderDiskParameters.
private ActionParametersBase buildExtendCinderDiskParameters(CinderDisk newCinderDisk) {
VmDiskOperationParameterBase parameters = new VmDiskOperationParameterBase(DiskVmElement.copyOf(getOldDiskVmElement()), newCinderDisk);
parameters.setParametersCurrentUser(getParameters().getParametersCurrentUser());
parameters.setEndProcedure(EndProcedure.COMMAND_MANAGED);
return parameters;
}
use of org.ovirt.engine.core.common.action.VmDiskOperationParameterBase in project ovirt-engine by oVirt.
the class AddDiskCommand method plugDiskToVmIfNeeded.
private void plugDiskToVmIfNeeded() {
if (Boolean.TRUE.equals(getParameters().getPlugDiskToVm()) && getVm() != null && getVm().getStatus() != VMStatus.Down) {
VmDiskOperationParameterBase params = new VmDiskOperationParameterBase(new DiskVmElement(getParameters().getDiskInfo().getId(), getVmId()));
params.setShouldBeLogged(false);
ActionReturnValue returnValue = runInternalAction(ActionType.HotPlugDiskToVm, params);
if (!returnValue.getSucceeded()) {
auditLogDirector.log(this, AuditLogType.USER_FAILED_HOTPLUG_DISK);
}
}
}
use of org.ovirt.engine.core.common.action.VmDiskOperationParameterBase in project ovirt-engine by oVirt.
the class ExtendCinderDiskCommandCallback method childCommandsExecutionEnded.
@Override
protected void childCommandsExecutionEnded(CommandBase<?> command, boolean anyFailed, List<Guid> childCmdIds, CommandExecutionStatus status, int completedChildren) {
ExtendCinderDiskCommand<VmDiskOperationParameterBase> extendCinderDiskCommand = (ExtendCinderDiskCommand<VmDiskOperationParameterBase>) command;
ImageStatus imageStatus = extendCinderDiskCommand.getCinderBroker().getDiskStatus(getDiskId(extendCinderDiskCommand));
if (imageStatus != null && imageStatus != getDisk(extendCinderDiskCommand).getImageStatus()) {
switch(imageStatus) {
case OK:
setCommandEndStatus(command, false, status, childCmdIds);
break;
case ILLEGAL:
setCommandEndStatus(command, true, status, childCmdIds);
break;
}
}
}
use of org.ovirt.engine.core.common.action.VmDiskOperationParameterBase in project ovirt-engine by oVirt.
the class EditDiskModel method store.
@Override
public void store(IFrontendActionAsyncCallback callback) {
if (getProgress() != null || !validate()) {
return;
}
startProgress();
VmDiskOperationParameterBase parameters = new VmDiskOperationParameterBase(getDiskVmElement(), getDisk());
IFrontendActionAsyncCallback onFinished = callback != null ? callback : result -> {
EditDiskModel diskModel = (EditDiskModel) result.getState();
diskModel.stopProgress();
diskModel.cancel();
};
Frontend.getInstance().runAction(ActionType.UpdateVmDisk, parameters, onFinished, this);
}
Aggregations