Skip to content

Commit 0f5e9d6

Browse files
committed
review comments
1 parent 53c62f5 commit 0f5e9d6

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

plugins/backup/nas/src/main/java/org/apache/cloudstack/backup/NASBackupProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ public Pair<Boolean, String> restoreBackedUpVolume(Backup backup, Backup.VolumeI
426426
restoreCommand.setVmName(vmNameAndState.first());
427427
String restoreVolumePath = String.format("%s%s%s", getVolumePathPrefix(pool), volumeUUID, getVolumePathSuffix(pool));
428428
restoreCommand.setRestoreVolumePaths(Collections.singletonList(restoreVolumePath));
429-
restoreCommand.setRestoreVolumeSizes(Collections.singletonList(volume.getSize()));
429+
restoreCommand.setRestoreVolumeSizes(Collections.singletonList(backedUpVolumeSize));
430430
DataStore dataStore = dataStoreMgr.getDataStore(pool.getId(), DataStoreRole.Primary);
431431
restoreCommand.setRestoreVolumePools(Collections.singletonList(dataStore != null ? (PrimaryDataStoreTO)dataStore.getTO() : null));
432432
restoreCommand.setDiskType(backupVolumeInfo.getType().name().toLowerCase(Locale.ROOT));

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtRestoreBackupCommandWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ private boolean replaceBlockDeviceWithBackup(KVMStoragePoolManager storagePoolMg
300300
logger.debug("Restoring volume: {}", disk.toString());
301301
}
302302
} catch (LibvirtException ex) {
303-
throw new CloudRuntimeException("Failed to create qemu-img command to restore RBD volume with backup", ex);
303+
throw new CloudRuntimeException(String.format("Failed to create qemu-img command to restore %s volume with backup", volumePool.getPoolType()), ex);
304304
}
305305

306306
QemuImgFile srcBackupFile = null;

scripts/vm/hypervisor/kvm/nasbackup.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,19 @@ get_ceph_uuid_from_path() {
9393
local fullpath="$1"
9494
# disk for rbd => rbd:<pool>/<uuid>:mon_host=<monitor_host>...
9595
# sample: rbd:cloudstack/53d5c355-d726-4d3e-9422-046a503a0b12:mon_host=10.0.1.2...
96-
beforeUuid="${fullpath#*/}" # Remove up to first slash after rbd:
97-
volUuid="${beforeUuid%%:*}" # Remove everything after colon to get the uuid
98-
echo $volUuid
96+
local beforeUuid="${fullpath#*/}" # Remove up to first slash after rbd:
97+
local volUuid="${beforeUuid%%:*}" # Remove everything after colon to get the uuid
98+
echo ""$volUuid""
9999
}
100100

101101
get_linstor_uuid_from_path() {
102102
local fullpath="$1"
103103
# disk for linstor => /dev/drbd/by-res/cs-<uuid>/0
104104
# sample: /dev/drbd/by-res/cs-53d5c355-d726-4d3e-9422-046a503a0b12/0
105-
beforeUuid="${fullpath#/dev/drbd/by-res/}"
106-
volUuid="${beforeUuid%%/*}"
105+
local beforeUuid="${fullpath#/dev/drbd/by-res/}"
106+
local volUuid="${beforeUuid%%/*}"
107107
volUuid="${volUuid#cs-}"
108-
echo $volUuid
108+
echo "$volUuid"
109109
}
110110

111111
backup_running_vm() {
@@ -178,7 +178,7 @@ backup_running_vm() {
178178
continue
179179
fi
180180
volUuid=$(get_linstor_uuid_from_path "$fullpath")
181-
if ! qemu-img convert -O qcow2 "$dest/$name.$volUuid.qcow2" "$dest/$name.$volUuid.qcow2.tmp" >"$logFile" 2> >(cat >&2); then
181+
if ! qemu-img convert -O qcow2 "$dest/$name.$volUuid.qcow2" "$dest/$name.$volUuid.qcow2.tmp" >> "$logFile" 2> >(cat >&2); then
182182
echo "qemu-img convert failed for $dest/$name.$volUuid.qcow2"
183183
cleanup
184184
exit 1

0 commit comments

Comments
 (0)