Skip to content

Commit d55aa70

Browse files
authored
Restore single backed-up volume on a live instance attaches the volume as a Raw image making it unreadable (apache#10844)
1 parent 52d9860 commit d55aa70

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;
@@ -280,6 +281,7 @@ public Pair<Boolean, String> restoreBackedUpVolume(Backup backup, String volumeU
280281
restoredVolume.setPoolId(dataStore.getPoolId());
281282
restoredVolume.setPath(restoredVolume.getUuid());
282283
restoredVolume.setState(Volume.State.Copying);
284+
restoredVolume.setFormat(Storage.ImageFormat.QCOW2);
283285
restoredVolume.setSize(backedUpVolumeSize);
284286
restoredVolume.setDiskOfferingId(volume.getDiskOfferingId());
285287

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)