use of org.ovirt.engine.core.common.vdscommands.VDSReturnValue in project ovirt-engine by oVirt.
the class GetBlockStorageDomainsWithAttachedStoragePoolGuidQueryTest method testNullStorageDomainListQuery.
@Test
public void testNullStorageDomainListQuery() {
StoragePool storagePool = new StoragePool();
storagePool.setStatus(StoragePoolStatus.Up);
mockStoragePoolDao(storagePool);
// Run 'HSMGetStorageDomainInfo' command
VDSReturnValue returnValue = new VDSReturnValue();
returnValue.setSucceeded(true);
Pair<StorageDomainStatic, Guid> storageDomainToPoolId = new Pair<>(storageDomain.getStorageStaticData(), Guid.newGuid());
returnValue.setReturnValue(storageDomainToPoolId);
when(vdsBrokerFrontendMock.runVdsCommand(eq(VDSCommandType.HSMGetStorageDomainInfo), any())).thenReturn(returnValue);
// Execute command
getQuery().executeQueryCommand();
// Assert the query's results
List<StorageDomainStatic> returnedStorageDomainList = new ArrayList<>();
assertEquals(returnedStorageDomainList, getQuery().getQueryReturnValue().getReturnValue());
}
use of org.ovirt.engine.core.common.vdscommands.VDSReturnValue in project ovirt-engine by oVirt.
the class UpdateStorageServerConnectionCommandTest method failUpdateConnectToStorage.
@Test
public void failUpdateConnectToStorage() {
StorageServerConnections newNFSConnection = createNFSConnection("multipass.my.domain.tlv.company.com:/export/allstorage/data2", StorageType.NFS, NfsVersion.V4, 300, 0);
parameters.setStorageServerConnection(newNFSConnection);
doReturn(false).when(command).connectToStorage();
VDSReturnValue returnValueUpdate = new VDSReturnValue();
returnValueUpdate.setSucceeded(true);
StorageDomainDynamic domainDynamic = new StorageDomainDynamic();
StorageDomain domain = createDomain();
initDomainListForConnection(newNFSConnection.getId(), domain);
StoragePoolIsoMap map = new StoragePoolIsoMap();
doReturn(Collections.singletonList(map)).when(command).getStoragePoolIsoMap(domain);
command.executeCommand();
CommandAssertUtils.checkSucceeded(command, true);
verify(storageDomainDynamicDao, never()).update(domainDynamic);
verify(command, never()).disconnectFromStorage();
}
use of org.ovirt.engine.core.common.vdscommands.VDSReturnValue in project ovirt-engine by oVirt.
the class CreateCloneOfTemplateCommand method performImageVdsmOperation.
@Override
protected boolean performImageVdsmOperation() {
setDestinationImageId(Guid.newGuid());
persistCommandIfNeeded();
newDiskImage = cloneDiskImage(getDestinationImageId());
newDiskImage.setId(Guid.newGuid());
Guid storagePoolID = newDiskImage.getStoragePoolId() != null ? newDiskImage.getStoragePoolId() : Guid.Empty;
if (isDataOperationsByHSM()) {
CopyImageGroupWithDataCommandParameters p = new CopyImageGroupWithDataCommandParameters(storagePoolID, getParameters().getStorageDomainId(), getDestinationStorageDomainId(), getDiskImage().getId(), getImage().getImageId(), newDiskImage.getId(), getDestinationImageId(), newDiskImage.getVolumeFormat(), true);
p.setParentParameters(getParameters());
p.setParentCommand(getActionType());
p.setEndProcedure(ActionParametersBase.EndProcedure.COMMAND_MANAGED);
runInternalAction(ActionType.CopyImageGroupWithData, p);
return true;
} else {
Guid taskId = persistAsyncTaskPlaceHolder(ActionType.AddVmFromTemplate);
VDSReturnValue vdsReturnValue;
try {
vdsReturnValue = runVdsCommand(VDSCommandType.CopyImage, postDeleteActionHandler.fixParameters(new CopyImageVDSCommandParameters(storagePoolID, getParameters().getStorageDomainId(), getVmTemplateId(), getDiskImage().getId(), getImage().getImageId(), newDiskImage.getId(), getDestinationImageId(), "", getDestinationStorageDomainId(), CopyVolumeType.LeafVol, newDiskImage.getVolumeFormat(), newDiskImage.getVolumeType(), getDiskImage().isWipeAfterDelete(), storageDomainDao.get(getDestinationStorageDomainId()).getDiscardAfterDelete(), false)));
} catch (EngineException e) {
log.error("Failed creating snapshot from image id '{}'", getImage().getImageId());
throw e;
}
if (vdsReturnValue.getSucceeded()) {
getTaskIdList().add(createTask(taskId, vdsReturnValue.getCreationInfo(), ActionType.AddVmFromTemplate, VdcObjectType.Storage, getParameters().getStorageDomainId(), getDestinationStorageDomainId()));
}
return vdsReturnValue.getSucceeded();
}
}
use of org.ovirt.engine.core.common.vdscommands.VDSReturnValue in project ovirt-engine by oVirt.
the class GlusterSnapshotSyncJob method refreshSnapshotsInCluster.
private void refreshSnapshotsInCluster(Cluster cluster) {
if (!supportsGlusterSnapshotFeature(cluster)) {
return;
}
final VDS upServer = glusterUtil.getRandomUpServer(cluster.getId());
if (upServer == null) {
log.info("No UP server found in cluster '{}' for snapshot monitoring", cluster.getName());
return;
}
VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeSnapshotInfo, new GlusterVolumeSnapshotVDSParameters(upServer.getId(), cluster.getId(), null));
if (returnValue.getSucceeded()) {
addOrUpdateSnapshots(cluster.getId(), (ArrayList<GlusterVolumeSnapshotEntity>) returnValue.getReturnValue());
// check if the snapshot soft limit reached for a volume and alert
List<GlusterVolumeEntity> volumes = volumeDao.getByClusterId(cluster.getId());
for (final GlusterVolumeEntity volume : volumes) {
// check if the snapshot soft limit reached for the volume and alert
glusterUtil.alertVolumeSnapshotLimitsReached(volume);
// Check and remove soft limit alert for the volume.
// It might have fallen below the soft limit as part of deletions of snapshots
glusterUtil.checkAndRemoveVolumeSnapshotLimitsAlert(volume);
}
} else {
log.error("VDS Error {}", returnValue.getVdsError().getMessage());
log.debug("VDS Error {}", returnValue.getVdsError());
}
}
use of org.ovirt.engine.core.common.vdscommands.VDSReturnValue in project ovirt-engine by oVirt.
the class ResetGlusterVolumeBrickCommand method executeCommand.
@Override
protected void executeCommand() {
VDSReturnValue returnValue = runVdsCommand(VDSCommandType.ResetGlusterVolumeBrick, new ResetGlusterVolumeBrickActionVDSParameters(upServer.getId(), getGlusterVolumeName(), getParameters().getExistingBrick().getQualifiedName()));
setSucceeded(returnValue.getSucceeded());
if (getSucceeded()) {
glusterBrickDao.updateBrickStatus(getParameters().getExistingBrick().getId(), GlusterStatus.UP);
} else {
handleVdsError(AuditLogType.GLUSTER_VOLUME_RESET_BRICK_FAILED, returnValue.getVdsError().getMessage());
return;
}
}
Aggregations