abh1sar commented on code in PR #12796:
URL: https://github.com/apache/cloudstack/pull/12796#discussion_r2929747278
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtRestoreBackupCommandWrapper.java:
##########
@@ -247,28 +262,38 @@ private boolean checkBackupPathExists(String backupPath) {
}
private boolean replaceVolumeWithBackup(KVMStoragePoolManager
storagePoolMgr, PrimaryDataStoreTO volumePool, String volumePath, String
backupPath, int timeout) {
- return replaceVolumeWithBackup(storagePoolMgr, volumePool, volumePath,
backupPath, timeout, false);
+ return replaceVolumeWithBackup(storagePoolMgr, volumePool, volumePath,
backupPath, timeout, false, null);
}
- private boolean replaceVolumeWithBackup(KVMStoragePoolManager
storagePoolMgr, PrimaryDataStoreTO volumePool, String volumePath, String
backupPath, int timeout, boolean createTargetVolume) {
- if (volumePool.getPoolType() != Storage.StoragePoolType.RBD) {
- int exitValue =
Script.runSimpleBashScriptForExitValue(String.format(RSYNC_COMMAND, backupPath,
volumePath));
- return exitValue == 0;
+ private boolean replaceVolumeWithBackup(KVMStoragePoolManager
storagePoolMgr, PrimaryDataStoreTO volumePool, String volumePath, String
backupPath, int timeout, boolean createTargetVolume, Long size) {
+ if (List.of(Storage.StoragePoolType.RBD,
Storage.StoragePoolType.Linstor).contains(volumePool.getPoolType())) {
+ return replaceBlockDeviceWithBackup(storagePoolMgr, volumePool,
volumePath, backupPath, timeout, createTargetVolume, size);
}
- return replaceRbdVolumeWithBackup(storagePoolMgr, volumePool,
volumePath, backupPath, timeout, createTargetVolume);
+ int exitValue =
Script.runSimpleBashScriptForExitValue(String.format(RSYNC_COMMAND, backupPath,
volumePath));
+ return exitValue == 0;
}
- private boolean replaceRbdVolumeWithBackup(KVMStoragePoolManager
storagePoolMgr, PrimaryDataStoreTO volumePool, String volumePath, String
backupPath, int timeout, boolean createTargetVolume) {
+ private boolean replaceBlockDeviceWithBackup(KVMStoragePoolManager
storagePoolMgr, PrimaryDataStoreTO volumePool, String volumePath, String
backupPath, int timeout, boolean createTargetVolume, Long size) {
KVMStoragePool volumeStoragePool =
storagePoolMgr.getStoragePool(volumePool.getPoolType(), volumePool.getUuid());
QemuImg qemu;
try {
qemu = new QemuImg(timeout * 1000, true, false);
- if (!createTargetVolume) {
- KVMPhysicalDisk rdbDisk =
volumeStoragePool.getPhysicalDisk(volumePath);
- logger.debug("Restoring RBD volume: {}", rdbDisk.toString());
+ String volumeUuid = getVolumeUuidFromPath(volumePath, volumePool);
+ KVMPhysicalDisk disk = null;
+ if (createTargetVolume) {
+ if
(Storage.StoragePoolType.Linstor.equals(volumePool.getPoolType())) {
+ disk = volumeStoragePool.createPhysicalDisk(volumeUuid,
QemuImg.PhysicalDiskFormat.RAW, Storage.ProvisioningType.THIN, size, null);
+ }
+ } else {
+ if
(Storage.StoragePoolType.Linstor.equals(volumePool.getPoolType())) {
+
storagePoolMgr.connectPhysicalDisk(volumePool.getPoolType(),
volumePool.getUuid(), volumeUuid, null);
+ } else {
+ disk =
volumeStoragePool.getPhysicalDisk(getVolumeUuidFromPath(volumePath,
volumePool));
Review Comment:
@sureshanaparti can you please review from RBD's regression perspective?
`volumeStoragePool.getPhysicalDisk` takes UUID as an argument. previously it
was passing `path`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]