rbd: Allow RBD disks to be attached to a Instance

This commit is contained in:
Wido den Hollander 2013-05-17 17:03:21 +02:00 committed by Chip Childers
parent 08a3023824
commit e08dd76b3e
1 changed files with 7 additions and 1 deletions

View File

@ -3414,6 +3414,7 @@ ServerResource {
List<DiskDef> disks = null;
Domain dm = null;
DiskDef diskdef = null;
KVMStoragePool attachingPool = attachingDisk.getPool();
try {
if (!attach) {
dm = conn.domainLookupByUUID(UUID.nameUUIDFromBytes(vmName
@ -3438,7 +3439,12 @@ ServerResource {
}
} else {
diskdef = new DiskDef();
if (attachingDisk.getFormat() == PhysicalDiskFormat.QCOW2) {
if (attachingPool.getType() == StoragePoolType.RBD) {
diskdef.defNetworkBasedDisk(attachingDisk.getPath(),
attachingPool.getSourceHost(), attachingPool.getSourcePort(),
attachingPool.getAuthUserName(), attachingPool.getUuid(), devId,
DiskDef.diskBus.VIRTIO, diskProtocol.RBD);
} else if (attachingDisk.getFormat() == PhysicalDiskFormat.QCOW2) {
diskdef.defFileBasedDisk(attachingDisk.getPath(), devId,
DiskDef.diskBus.VIRTIO, DiskDef.diskFmtType.QCOW2);
} else if (attachingDisk.getFormat() == PhysicalDiskFormat.RAW) {