@@ -90,18 +90,23 @@ private String convertImageToQCow2(
9090 // NOTE: the qemu img will also contain the drbd metadata at the end
9191 final QemuImg qemu = new QemuImg (waitMilliSeconds );
9292 qemu .convert (srcFile , dstFile );
93- s_logger .info ("Backup snapshot " + srcFile + " to " + dstPath );
93+ s_logger .info (String . format ( "Backup snapshot '%s' to '%s'" , srcPath , dstPath ) );
9494 return dstPath ;
9595 }
9696
9797 private SnapshotObjectTO setCorrectSnapshotSize (final SnapshotObjectTO dst , final String dstPath ) {
9898 final File snapFile = new File (dstPath );
99- final long size = snapFile .exists () ? snapFile .length () : 0 ;
99+ long size ;
100+ if (snapFile .exists ()) {
101+ size = snapFile .length ();
102+ } else {
103+ s_logger .warn (String .format ("Snapshot file %s does not exist. Reporting size 0" , dstPath ));
104+ size = 0 ;
105+ }
100106
101- final SnapshotObjectTO snapshot = new SnapshotObjectTO ();
102- snapshot .setPath (dst .getPath () + File .separator + dst .getName ());
103- snapshot .setPhysicalSize (size );
104- return snapshot ;
107+ dst .setPath (dst .getPath () + File .separator + dst .getName ());
108+ dst .setPhysicalSize (size );
109+ return dst ;
105110 }
106111
107112 @ Override
@@ -151,6 +156,7 @@ public CopyCmdAnswer execute(LinstorBackupSnapshotCommand cmd, LibvirtComputingR
151156 s_logger .info ("Backup shrunk " + dstPath + " to actual size " + src .getVolume ().getSize ());
152157
153158 SnapshotObjectTO snapshot = setCorrectSnapshotSize (dst , dstPath );
159+ s_logger .info (String .format ("Actual file size for '%s' is %d" , dstPath , snapshot .getPhysicalSize ()));
154160 return new CopyCmdAnswer (snapshot );
155161 } catch (final Exception e ) {
156162 final String error = String .format ("Failed to backup snapshot with id [%s] with a pool %s, due to %s" ,
0 commit comments