4343
4444import javax .naming .ConfigurationException ;
4545
46- import com .ceph .rbd .jna .RbdImageInfo ;
4746import com .fasterxml .jackson .core .JsonProcessingException ;
4847import com .fasterxml .jackson .databind .JsonNode ;
4948import com .fasterxml .jackson .databind .ObjectMapper ;
@@ -1839,7 +1838,7 @@ public Answer createSnapshot(final CreateObjectCommand cmd) {
18391838 logger .debug ("Attempting to create RBD snapshot " + disk .getName () + "@" + snapshotName );
18401839 image .snapCreate (snapshotName );
18411840
1842- long rbdSnapshotSize = getRdbSnapshotSize (primaryPool .getSourceDir (), disk .getName (), snapshotName , primaryPool .getSourceHost (), primaryPool .getAuthUserName (), primaryPool .getAuthSecret ());
1841+ long rbdSnapshotSize = getRbdSnapshotSize (primaryPool .getSourceDir (), disk .getName (), snapshotName , primaryPool .getSourceHost (), primaryPool .getAuthUserName (), primaryPool .getAuthSecret ());
18431842 if (rbdSnapshotSize > 0 ) {
18441843 snapshotSize = rbdSnapshotSize ;
18451844 }
@@ -1882,7 +1881,7 @@ public Answer createSnapshot(final CreateObjectCommand cmd) {
18821881 }
18831882 }
18841883
1885- private long getRdbSnapshotSize (String poolPath , String diskName , String snapshotName , String rbdMonitor , String authUser , String authSecret ) {
1884+ private long getRbdSnapshotSize (String poolPath , String diskName , String snapshotName , String rbdMonitor , String authUser , String authSecret ) {
18861885 logger .debug ("Get RBD snapshot size for {}/{}@{}" , poolPath , diskName , snapshotName );
18871886 //cmd: rbd du <pool>/<disk-name>@<snapshot-name> --format json --mon-host <monitor-host> --id <user> --key <key> 2>/dev/null
18881887 String snapshotDetailsInJson = Script .runSimpleBashScript (String .format ("rbd du %s/%s@%s --format json --mon-host %s --id %s --key %s 2>/dev/null" , poolPath , diskName , snapshotName , rbdMonitor , authUser , authSecret ));
@@ -1900,8 +1899,10 @@ private long getRdbSnapshotSize(String poolPath, String diskName, String snapsho
19001899 }
19011900 }
19021901 } catch (JsonProcessingException e ) {
1903- logger .error ("Unable to get the RBD snapshot size" , e );
1902+ logger .error ("Unable to get the RBD snapshot size, RBD snapshot cmd output: {}" , snapshotDetailsInJson , e );
19041903 }
1904+ } else {
1905+ logger .warn ("Failed to get RBD snapshot size for {}/{}@{} - no output for RBD snapshot cmd" , poolPath , diskName , snapshotName );
19051906 }
19061907
19071908 return 0 ;
0 commit comments