Skip to content

Commit 2534f29

Browse files
abh1sardhslove
authored andcommitted
Restore single backed-up volume on a live instance attaches the volume as a Raw image making it unreadable (apache#10844)
1 parent ca2cf7f commit 2534f29

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import com.cloud.host.dao.HostDao;
2727
import com.cloud.hypervisor.Hypervisor;
2828
import com.cloud.storage.ScopeType;
29+
import com.cloud.storage.Storage;
2930
import com.cloud.storage.StoragePoolHostVO;
3031
import com.cloud.storage.Volume;
3132
import com.cloud.storage.VolumeVO;
@@ -279,6 +280,7 @@ public Pair<Boolean, String> restoreBackedUpVolume(Backup backup, String volumeU
279280
restoredVolume.setPoolId(dataStore.getPoolId());
280281
restoredVolume.setPath(restoredVolume.getUuid());
281282
restoredVolume.setState(Volume.State.Copying);
283+
restoredVolume.setFormat(Storage.ImageFormat.QCOW2);
282284
restoredVolume.setSize(backedUpVolumeSize);
283285
restoredVolume.setDiskOfferingId(volume.getDiskOfferingId());
284286

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
@@ -45,7 +45,7 @@ public class LibvirtRestoreBackupCommandWrapper extends CommandWrapper<RestoreBa
4545
private static final String MOUNT_COMMAND = "sudo mount -t %s %s %s";
4646
private static final String UMOUNT_COMMAND = "sudo umount %s";
4747
private static final String FILE_PATH_PLACEHOLDER = "%s/%s";
48-
private static final String ATTACH_DISK_COMMAND = " virsh attach-disk %s %s %s --cache none";
48+
private static final String ATTACH_DISK_COMMAND = " virsh attach-disk %s %s %s --driver qemu --subdriver qcow2 --cache none";
4949
private static final String CURRRENT_DEVICE = "virsh domblklist --domain %s | tail -n 3 | head -n 1 | awk '{print $1}'";
5050
private static final String RSYNC_COMMAND = "rsync -az %s %s";
5151

0 commit comments

Comments
 (0)