public DestroyCommand(StoragePool pool, Volume volume, String vmName) { this.volume = new VolumeTO(volume, pool); this.vmName = vmName; }
public DestroyCommand(StoragePool pool, VMTemplateStorageResourceAssoc templatePoolRef) { volume = new VolumeTO(templatePoolRef.getId(), null, pool.getPoolType(), pool.getUuid(), null, pool.getPath(), templatePoolRef.getInstallPath(), templatePoolRef.getTemplateSize(), null); }
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()); } }
protected CreateAnswer execute(CreateCommand cmd) { StorageFilerTO primaryStorage = cmd.getPool(); DiskProfile disk = cmd.getDiskCharacteristics(); try { OvmVolume.Details vol = null; if (cmd.getTemplateUrl() != null) { vol = OvmVolume.createFromTemplate(_conn, primaryStorage.getUuid(), cmd.getTemplateUrl()); } else { vol = OvmVolume.createDataDsik(_conn, primaryStorage.getUuid(), Long.toString(disk.getSize()), disk.getType() == Volume.Type.ROOT); } VolumeTO volume = new VolumeTO(cmd.getVolumeId(), disk.getType(), primaryStorage.getType(), primaryStorage.getUuid(), primaryStorage.getPath(), vol.name, vol.path, vol.size, null); return new CreateAnswer(cmd, volume); } catch (Exception e) { s_logger.debug("CreateCommand failed", e); return new CreateAnswer(cmd, e.getMessage()); } }
VolumeTO volume = new VolumeTO(cmd.getVolumeId(), disk.getType(), primaryStorage.getType(), primaryStorage.getUuid(), primaryStorage.getPath(), fileName, fp.getName(),
VolumeInfo volumeInfo = entry.getKey(); StoragePool storagePool = storagePoolDao.findById(volumeInfo.getPoolId()); VolumeTO volumeTo = new VolumeTO(volumeInfo, storagePool);
new VolumeTO(command.getVolumeId(), dskch.getType(), pool.getType(), pool.getUuid(), vdir.nameLabel, pool.getPath(), vdir.uuid, vdir.virtualSize, null);
final VolumeTO volume = new VolumeTO(command.getVolumeId(), dskch.getType(), pool.getType(), pool.getUuid(), pool.getPath(), vol.getName(), vol.getName(), disksize, null);