mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-6371: Set snapshot size in copycommand answer during snapshot backup
(cherry picked from commit 295fa84d4d)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
2aabcc11d3
commit
83df80b715
|
|
@ -689,6 +689,7 @@ public class KVMStorageProcessor implements StorageProcessor {
|
|||
primaryStore.getUuid(), volumePath);
|
||||
primaryPool = snapshotDisk.getPool();
|
||||
|
||||
long size = 0;
|
||||
/**
|
||||
* RBD snapshots can't be copied using qemu-img, so we have to use
|
||||
* the Java bindings for librbd here.
|
||||
|
|
@ -733,6 +734,7 @@ public class KVMStorageProcessor implements StorageProcessor {
|
|||
offset += bytes;
|
||||
}
|
||||
s_logger.debug("Completed backing up RBD snapshot " + snapshotName + " to " + snapFile.getAbsolutePath() + ". Bytes written: " + offset);
|
||||
size = offset;
|
||||
bos.close();
|
||||
|
||||
s_logger.debug("Attempting to remove snapshot RBD " + snapshotName + " from image " + snapshotDisk.getName());
|
||||
|
|
@ -763,10 +765,15 @@ public class KVMStorageProcessor implements StorageProcessor {
|
|||
s_logger.debug("Failed to backup snaptshot: " + result);
|
||||
return new CopyCmdAnswer(result);
|
||||
}
|
||||
File snapFile = new File(snapshotDestPath + "/" + snapshotName);
|
||||
if(snapFile.exists()){
|
||||
size = snapFile.length();
|
||||
}
|
||||
}
|
||||
|
||||
SnapshotObjectTO newSnapshot = new SnapshotObjectTO();
|
||||
newSnapshot.setPath(snapshotRelPath + File.separator + snapshotName);
|
||||
newSnapshot.setPhysicalSize(size);
|
||||
return new CopyCmdAnswer(newSnapshot);
|
||||
} catch (LibvirtException e) {
|
||||
s_logger.debug("Failed to backup snapshot: " + e.toString());
|
||||
|
|
|
|||
Loading…
Reference in New Issue