use of org.ovirt.engine.core.common.action.UpdateVmVersionParameters in project ovirt-engine by oVirt.
the class RestoreStatelessVmCommand method buildUpdateVmVersionParameters.
private UpdateVmVersionParameters buildUpdateVmVersionParameters() {
UpdateVmVersionParameters parameters = new UpdateVmVersionParameters(getVmId());
// the VM is already locked by this command during the execute phase of UpdateVmVersion
parameters.setLockVm(false);
return parameters;
}
use of org.ovirt.engine.core.common.action.UpdateVmVersionParameters in project ovirt-engine by oVirt.
the class UpdateVmCommand method updateVmTemplateVersion.
/**
* Handles a template-version update use case.
* If vm is down -> updateVmVersionCommand will handle the rest and will preform the actual change.
* if it's running -> a NEXT_RUN snapshot will be created and the change will take affect only on power down.
* in both cases the command should end after this function as no more changes are possible.
*/
private void updateVmTemplateVersion() {
if (getVm().getStatus() == VMStatus.Down) {
ActionReturnValue result = runInternalActionWithTasksContext(ActionType.UpdateVmVersion, new UpdateVmVersionParameters(getVmId(), getParameters().getVm().getVmtGuid(), getParameters().getVm().isUseLatestVersion()), getLock());
if (result.getSucceeded()) {
getTaskIdList().addAll(result.getInternalVdsmTaskIdList());
}
setSucceeded(result.getSucceeded());
setActionReturnValue(ActionType.UpdateVmVersion);
} else {
vmHandler.createNextRunSnapshot(getVm(), getParameters().getVmStaticData(), getParameters(), getCompensationContext());
setSucceeded(true);
}
}
use of org.ovirt.engine.core.common.action.UpdateVmVersionParameters in project ovirt-engine by oVirt.
the class AddVmTemplateCommand method updateVmVersion.
private void updateVmVersion() {
for (Guid vmId : vmDao.getVmIdsForVersionUpdate(getParameters().getBaseTemplateId())) {
// if the job was removed, stop executing, we probably have new version creation going on
if (!updateVmsJobHashMap.containsKey(getParameters().getBaseTemplateId())) {
break;
}
UpdateVmVersionParameters params = new UpdateVmVersionParameters(vmId);
params.setSessionId(getParameters().getSessionId());
backend.runInternalAction(ActionType.UpdateVmVersion, params, cloneContextAndDetachFromParent());
}
updateVmsJobHashMap.remove(getParameters().getBaseTemplateId());
updateVmsJobMap.remove(getParameters().getBaseTemplateId());
}
Aggregations