use of com.cloud.agent.api.AttachVolumeAnswer in project CloudStack-archive by CloudStack-extras.
the class LibvirtComputingResource method execute.
private AttachVolumeAnswer execute(AttachVolumeCommand cmd) {
try {
Connect conn = LibvirtConnection.getConnection();
KVMStoragePool primary = _storagePoolMgr.getStoragePool(cmd.getPoolUuid());
KVMPhysicalDisk disk = primary.getPhysicalDisk(cmd.getVolumePath());
attachOrDetachDisk(conn, cmd.getAttach(), cmd.getVmName(), disk, cmd.getDeviceId().intValue());
} catch (LibvirtException e) {
return new AttachVolumeAnswer(cmd, e.toString());
} catch (InternalErrorException e) {
return new AttachVolumeAnswer(cmd, e.toString());
}
return new AttachVolumeAnswer(cmd, cmd.getDeviceId());
}
use of com.cloud.agent.api.AttachVolumeAnswer in project CloudStack-archive by CloudStack-extras.
the class MockStorageManagerImpl method AttachVolume.
@Override
public AttachVolumeAnswer AttachVolume(AttachVolumeCommand cmd) {
String poolid = cmd.getPoolUuid();
String volumeName = cmd.getVolumeName();
MockVolumeVO volume = _mockVolumeDao.findByStoragePathAndType(cmd.getVolumePath());
if (volume == null) {
return new AttachVolumeAnswer(cmd, "Can't find volume:" + volumeName + "on pool:" + poolid);
}
String vmName = cmd.getVmName();
MockVMVO vm = _mockVMDao.findByVmName(vmName);
if (vm == null) {
return new AttachVolumeAnswer(cmd, "can't vm :" + vmName);
}
return new AttachVolumeAnswer(cmd, cmd.getDeviceId());
}
Aggregations