public ManageSnapshotCommand(long snapshotId, String volumePath, StoragePool pool, String preSnapshotPath, String snapshotName, String vmName) { _commandSwitch = ManageSnapshotCommand.CREATE_SNAPSHOT; _volumePath = volumePath; _pool = new StorageFilerTO(pool); _snapshotPath = preSnapshotPath; _snapshotName = snapshotName; _snapshotId = snapshotId; _vmName = vmName; }
public CreateCommand(DiskProfile diskCharacteristics, StoragePool pool, boolean executeInSequence) { this(diskCharacteristics, new StorageFilerTO(pool), executeInSequence); this.executeInSequence = executeInSequence; }
public ModifyStoragePoolCommand(boolean add, StoragePool pool, String localPath) { this.add = add; this.pool = new StorageFilerTO(pool); this.localPath = localPath; }
public DeleteStoragePoolCommand(StoragePool pool, String localPath) { _pool = new StorageFilerTO(pool); _localPath = localPath; }
public MigrateVolumeCommand(long volumeId, String volumePath, StoragePool sourcePool, StoragePool targetPool) { this(volumeId,volumePath,targetPool, null, Volume.Type.UNKNOWN, -1); this.sourcePool = new StorageFilerTO(sourcePool); }
public CreateCommand(DiskProfile diskCharacteristics, String templateUrl, StoragePool pool, boolean executeInSequence) { this(diskCharacteristics, templateUrl, new StorageFilerTO(pool), executeInSequence); }
public void setPool(StoragePool pool) { this.pool = new StorageFilerTO(pool); }
public void setPool(StoragePool pool) { _pool = new StorageFilerTO(pool); }
public MigrateVolumeCommand(long volumeId, String volumePath, StoragePool pool, int timeout) { this.volumeId = volumeId; this.volumePath = volumePath; this.pool = new StorageFilerTO(pool); this.setWait(timeout); }
public CreateVolumeOVACommand(String secUrl, String volPath, String volName, StoragePool pool, int wait) { this.secUrl = secUrl; this.volPath = volPath; this.volName = volName; this.pool = new StorageFilerTO(pool); setWait(wait); }
public CopyVolumeCommand(long volumeId, String volumePath, StoragePool pool, String secondaryStorageURL, boolean toSecondaryStorage, int wait, boolean executeInSequence) { this.volumeId = volumeId; this.volumePath = volumePath; this.pool = new StorageFilerTO(pool); this.secondaryStorageURL = secondaryStorageURL; this.toSecondaryStorage = toSecondaryStorage; setWait(wait); this.executeInSequence = executeInSequence; }
public CheckVMActivityOnStoragePoolCommand(final Host host, final StoragePool pool, final List<Volume> volumeList, final DateTime suspectTime) { this.host = new HostTO(host); this.pool = new StorageFilerTO(pool); this.suspectTimeSeconds = suspectTime.getMillis()/1000L; final StringBuilder stringBuilder = new StringBuilder(); for (final Volume v : volumeList) { stringBuilder.append(v.getUuid()).append(","); } this.volumeList = stringBuilder.deleteCharAt(stringBuilder.length() - 1).toString(); }
/** * @param primaryStoragePoolNameLabel * The primary storage Pool * @param snapshotUuid * The UUID of the snapshot which is going to be backed up * @param secondaryStoragePoolURL * This is what shows up in the UI when you click on Secondary * storage. In the code, it is present as: In the * vmops.host_details table, there is a field mount.parent. This * is the value of that field If you have better ideas on how to * get it, you are welcome. */ public SnapshotCommand(final StoragePool pool, final String secondaryStorageUrl, final String snapshotUuid, final String snapshotName, final Long dcId, final Long accountId, final Long volumeId) { primaryStoragePoolNameLabel = pool.getUuid(); primaryPool = new StorageFilerTO(pool); this.snapshotUuid = snapshotUuid; this.secondaryStorageUrl = secondaryStorageUrl; this.dcId = dcId; this.accountId = accountId; this.volumeId = volumeId; this.snapshotName = snapshotName; }
public CreatePrivateTemplateFromVolumeCommand(StoragePool pool, String secondaryStorageUrl, long templateId, long accountId, String userSpecifiedName, String uniqueName, String volumePath, String vmName, int wait) { _secondaryStorageUrl = secondaryStorageUrl; _templateId = templateId; _accountId = accountId; _userSpecifiedName = userSpecifiedName; _uniqueName = uniqueName; _volumePath = volumePath; _vmName = vmName; primaryStoragePoolNameLabel = pool.getUuid(); _primaryPool = new StorageFilerTO(pool); setWait(wait); }
public PrimaryStorageDownloadCommand(final String name, final String url, final ImageFormat format, final long accountId, final StoragePool pool, final int wait) { super(name, url, format, accountId); poolId = pool.getId(); poolUuid = pool.getUuid(); primaryPool = new StorageFilerTO(pool); setWait(wait); }
private Answer migrateVmWithVolumesWithinCluster(VMInstanceVO vm, VirtualMachineTO to, Host srcHost, Host destHost, Map<VolumeInfo, DataStore> volumeToPool) throws AgentUnavailableException { // Initiate migration of a virtual machine with its volumes. try { List<Pair<VolumeTO, StorageFilerTO>> volumeToFilerto = new ArrayList<Pair<VolumeTO, StorageFilerTO>>(); for (Map.Entry<VolumeInfo, DataStore> entry : volumeToPool.entrySet()) { VolumeInfo volume = entry.getKey(); VolumeTO volumeTo = new VolumeTO(volume, storagePoolDao.findById(volume.getPoolId())); StorageFilerTO filerTo = new StorageFilerTO((StoragePool)entry.getValue()); volumeToFilerto.add(new Pair<VolumeTO, StorageFilerTO>(volumeTo, filerTo)); } MigrateWithStorageCommand command = new MigrateWithStorageCommand(to, volumeToFilerto); MigrateWithStorageAnswer answer = (MigrateWithStorageAnswer)agentMgr.send(destHost.getId(), command); if (answer == null) { s_logger.error("Migration with storage of vm " + vm + " failed."); throw new CloudRuntimeException("Error while migrating the vm " + vm + " to host " + destHost); } else if (!answer.getResult()) { s_logger.error("Migration with storage of vm " + vm + " failed. Details: " + answer.getDetails()); throw new CloudRuntimeException("Error while migrating the vm " + vm + " to host " + destHost + ". " + answer.getDetails()); } else { // Update the volume details after migration. updateVolumePathsAfterMigration(volumeToPool, answer.getVolumeTos(), srcHost); } return answer; } catch (OperationTimedoutException e) { s_logger.error("Error while migrating vm " + vm + " to host " + destHost, e); throw new AgentUnavailableException("Operation timed out on storage motion for " + vm, destHost.getId()); } }
private Answer migrateVmWithVolumes(VMInstanceVO vm, VirtualMachineTO to, Host srcHost, Host destHost, Map<VolumeInfo, DataStore> volumeToPool) throws AgentUnavailableException { // Initiate migration of a virtual machine with it's volumes. try { List<Pair<VolumeTO, StorageFilerTO>> volumeToFilerto = new ArrayList<Pair<VolumeTO, StorageFilerTO>>(); for (Map.Entry<VolumeInfo, DataStore> entry : volumeToPool.entrySet()) { VolumeInfo volume = entry.getKey(); VolumeTO volumeTo = new VolumeTO(volume, storagePoolDao.findById(volume.getPoolId())); StorageFilerTO filerTo = new StorageFilerTO((StoragePool)entry.getValue()); volumeToFilerto.add(new Pair<VolumeTO, StorageFilerTO>(volumeTo, filerTo)); } MigrateWithStorageCommand command = new MigrateWithStorageCommand(to, volumeToFilerto, destHost.getPrivateIpAddress()); MigrateWithStorageAnswer answer = (MigrateWithStorageAnswer) agentMgr.send(srcHost.getId(), command); if (answer == null) { s_logger.error("Migration with storage of vm " + vm + " failed."); throw new CloudRuntimeException("Error while migrating the vm " + vm + " to host " + destHost); } else if (!answer.getResult()) { s_logger.error("Migration with storage of vm " + vm+ " failed. Details: " + answer.getDetails()); throw new CloudRuntimeException("Error while migrating the vm " + vm + " to host " + destHost + ". " + answer.getDetails()); } else { // Update the volume details after migration. updateVolumePathsAfterMigration(volumeToPool, answer.getVolumeTos()); } return answer; } catch (OperationTimedoutException e) { s_logger.error("Error while migrating vm " + vm + " to host " + destHost, e); throw new AgentUnavailableException("Operation timed out on storage motion for " + vm, destHost.getId()); } }
@Override public void resize(DataObject data, AsyncCompletionCallback<CreateCmdResult> callback) { VolumeObject vol = (VolumeObject) data; StoragePool pool = (StoragePool) data.getDataStore(); ResizeVolumePayload resizeParameter = (ResizeVolumePayload) vol.getpayload(); ResizeVolumeCommand resizeCmd = new ResizeVolumeCommand(vol.getPath(), new StorageFilerTO(pool), vol.getSize(), resizeParameter.newSize, resizeParameter.shrinkOk, resizeParameter.instanceName); CreateCmdResult result = new CreateCmdResult(null, null); try { ResizeVolumeAnswer answer = (ResizeVolumeAnswer) storageMgr.sendToPool(pool, resizeParameter.hosts, resizeCmd); if (answer != null && answer.getResult()) { long finalSize = answer.getNewSize(); s_logger.debug("Resize: volume started at size " + vol.getSize() + " and ended at size " + finalSize); vol.setSize(finalSize); vol.update(); } else if (answer != null) { result.setResult(answer.getDetails()); } else { s_logger.debug("return a null answer, mark it as failed for unknown reason"); result.setResult("return a null answer, mark it as failed for unknown reason"); } } catch (Exception e) { s_logger.debug("sending resize command failed", e); result.setResult(e.toString()); } callback.complete(result); }
@Override public void resizeVolumeOnHypervisor(long volumeId, long newSize, long destHostId, String instanceName) { final String errMsg = "Resize command failed"; try { Answer answer = null; Host destHost = _hostDao.findById(destHostId); EndPoint ep = RemoteHostEndPoint.getHypervisorHostEndPoint(destHost); if (ep != null) { VolumeVO volume = volDao.findById(volumeId); PrimaryDataStore primaryDataStore = this.dataStoreMgr.getPrimaryDataStore(volume.getPoolId()); ResizeVolumeCommand resizeCmd = new ResizeVolumeCommand(volume.getPath(), new StorageFilerTO(primaryDataStore), volume.getSize(), newSize, true, instanceName, primaryDataStore.isManaged(), volume.get_iScsiName()); answer = ep.sendMessage(resizeCmd); } else { throw new CloudRuntimeException("Could not find a remote endpoint to send command to. Check if host or SSVM is down."); } if (answer == null || !answer.getResult()) { throw new CloudRuntimeException(answer != null ? answer.getDetails() : errMsg); } } catch (Exception e) { throw new CloudRuntimeException(errMsg, e); } }