private synchronized void checkAndSetAttaching(Long volumeId, Long hostId) { VolumeInfo volumeToAttach = volFactory.getVolume(volumeId); if (volumeToAttach.isAttachedVM()) { throw new CloudRuntimeException("volume: " + volumeToAttach.getName() + " is already attached to a VM: " + volumeToAttach.getAttachedVmName()); } if (volumeToAttach.getState().equals(Volume.State.Ready)) { volumeToAttach.stateTransit(Volume.Event.AttachRequested); } else { String error = null; if (hostId == null) { error = "Please try attach operation after starting VM once"; } else { error = "Volume: " + volumeToAttach.getName() + " is in " + volumeToAttach.getState() + ". It should be in Ready state"; } s_logger.error(error); throw new CloudRuntimeException(error); } }
public SnapshotObjectTO(SnapshotInfo snapshot) { this.path = snapshot.getPath(); this.setId(snapshot.getId()); VolumeInfo vol = snapshot.getBaseVolume(); if (vol != null) { this.volume = (VolumeObjectTO)vol.getTO(); this.setVmName(vol.getAttachedVmName()); } SnapshotInfo parentSnapshot = snapshot.getParent(); ArrayList<String> parentsArry = new ArrayList<String>(); if (parentSnapshot != null) { this.parentSnapshotPath = parentSnapshot.getPath(); while(parentSnapshot != null) { parentsArry.add(parentSnapshot.getPath()); parentSnapshot = parentSnapshot.getParent(); } parents = parentsArry.toArray(new String[parentsArry.size()]); ArrayUtils.reverse(parents); } this.dataStore = snapshot.getDataStore().getTO(); this.setName(snapshot.getName()); this.hypervisorType = snapshot.getHypervisorType(); this.quiescevm = false; }
MigrateVolumeCommand command = new MigrateVolumeCommand(srcVolumeInfo.getId(), srcVolumeInfo.getPath(), destPool, srcVolumeInfo.getAttachedVmName(), srcVolumeInfo.getVolumeType(), waitInterval);
MigrateVolumeCommand command = new MigrateVolumeCommand(volume.getId(), volume.getPath(), destPool, volume.getAttachedVmName(), volume.getVolumeType(), waitInterval); EndPoint ep = selector.select(srcData, StorageAction.MIGRATEVOLUME); Answer answer = null;
if (attached) { ev = Volume.Event.OperationSucceeded; s_logger.debug("Volume: " + volInfo.getName() + " successfully attached to VM: " + volInfo.getAttachedVmName()); } else { s_logger.debug("Volume: " + volInfo.getName() + " failed to attach to VM: " + volInfo.getAttachedVmName());
public VolumeObjectTO(VolumeInfo volume) { uuid = volume.getUuid(); path = volume.getPath(); accountId = volume.getAccountId(); if (volume.getDataStore() != null) { dataStore = volume.getDataStore().getTO(); } else { dataStore = null; } vmName = volume.getAttachedVmName(); size = volume.getSize(); setVolumeId(volume.getId()); chainInfo = volume.getChainInfo(); volumeType = volume.getVolumeType(); name = volume.getName(); setId(volume.getId()); format = volume.getFormat(); provisioningType = volume.getProvisioningType(); bytesReadRate = volume.getBytesReadRate(); bytesWriteRate = volume.getBytesWriteRate(); iopsReadRate = volume.getIopsReadRate(); iopsWriteRate = volume.getIopsWriteRate(); cacheMode = volume.getCacheMode(); hypervisorType = volume.getHypervisorType(); setDeviceId(volume.getDeviceId()); }