}
}
@Override
public Answer dettachVolume(DettachCommand cmd) {
DiskTO disk = cmd.getDisk();
VolumeObjectTO vol = (VolumeObjectTO) disk.getData();
PrimaryDataStoreTO primaryStore = (PrimaryDataStoreTO) vol.getDataStore();
String vmName = cmd.getVmName();
try {
Connect conn = LibvirtConnection.getConnectionByVmName(vmName);
KVMPhysicalDisk phyDisk = storagePoolMgr.getPhysicalDisk(primaryStore.getPoolType(), primaryStore.getUuid(), vol.getPath());
attachOrDetachDisk(conn, false, vmName, phyDisk, disk.getDiskSeq().intValue());
return new DettachAnswer(disk);
} catch (LibvirtException e) {
s_logger.debug("Failed to attach volume: " + vol.getPath() + ", due to " + e.toString());
return new DettachAnswer(e.toString());