It is however very unlikely that the destPool will be RBD, since it isn't supported
for Secondary Storage
*/
KVMStoragePool srcPool = disk.getPool();
PhysicalDiskFormat sourceFormat = disk.getFormat();
String sourcePath = disk.getPath();
KVMPhysicalDisk newDisk;
if (destPool.getType() != StoragePoolType.RBD) {
if (disk.getFormat() == PhysicalDiskFormat.TAR) {
newDisk = destPool.createPhysicalDisk(name, PhysicalDiskFormat.DIR, disk.getVirtualSize());
} else {
/* If the source device is on a RBD storage pool force the new disk to the same format (RAW) */
if (srcPool.getType() != StoragePoolType.RBD) {
newDisk = destPool.createPhysicalDisk(name, disk.getVirtualSize());
} else {
newDisk = destPool.createPhysicalDisk(name, sourceFormat, disk.getVirtualSize());
}
}
} else {
newDisk = new KVMPhysicalDisk(destPool.getSourceDir() + "/" + name, name, destPool);
newDisk.setFormat(PhysicalDiskFormat.RAW);
newDisk.setSize(disk.getVirtualSize());
newDisk.setVirtualSize(disk.getSize());
}
String destPath = newDisk.getPath();
PhysicalDiskFormat destFormat = newDisk.getFormat();
QemuImg qemu = new QemuImg();
QemuImgFile srcFile = null;
QemuImgFile destFile = null;