@@ -1886,16 +1886,14 @@ protected SR prepareManagedSr(Connection conn, Map<String, String> details) {
18861886 String mountpoint = details .get (DiskTO .MOUNT_POINT );
18871887 String protocoltype =details .get (DiskTO .PROTOCOL_TYPE );
18881888
1889- if (StoragePoolType .NetworkFilesystem .toString ().equalsIgnoreCase (protocoltype )){
1890- String poolid = storageHost + ":" + mountpoint ;
1891- String namelable = mountpoint ;
1892- String volumedesc = storageHost + ":" + mountpoint ;
1889+ if (StoragePoolType .NetworkFilesystem .toString ().equalsIgnoreCase (protocoltype )) {
1890+ String poolid = storageHost + ":" + mountpoint ;
1891+ String namelable = mountpoint ;
1892+ String volumedesc = storageHost + ":" + mountpoint ;
18931893
1894- return getNfsSR (conn , poolid , namelable , storageHost , mountpoint , volumedesc );
1895-
1896- }else {
1897-
1898- return getIscsiSR (conn , iScsiName , storageHost , iScsiName , chapInitiatorUsername , chapInitiatorSecret , true );
1894+ return getNfsSR (conn , poolid , namelable , storageHost , mountpoint , volumedesc );
1895+ } else {
1896+ return getIscsiSR (conn , iScsiName , storageHost , iScsiName , chapInitiatorUsername , chapInitiatorSecret , true );
18991897 }
19001898 }
19011899
@@ -1908,20 +1906,21 @@ protected VDI prepareManagedStorage(Connection conn, Map<String, String> details
19081906 if (vdi == null ) {
19091907
19101908 vdi = createVdi (sr , vdiNameLabel , volumeSize );
1911- }else {
1909+ } else {
1910+ // if VDI is not null, it must have already been created, so check whether a resize of the volume was performed
1911+ // if true, resize the VDI to the volume size
19121912
1913- // if vdi is not null, it must have been already created, check whether a resize of volume was done
1914- // if true , resize the vdi to the volume size
19151913 s_logger .info ("checking for the resize of the datadisk" );
1916- long vdiVirtualsize = vdi .getVirtualSize (conn );
19171914
1918- if (vdiVirtualsize != volumeSize ){
1919- s_logger .info ("resizing the datadisk(vdi) from vdiVirtualsize :" + vdiVirtualsize + "to volumeSize :" + volumeSize );
1915+ long vdiVirtualSize = vdi .getVirtualSize (conn );
1916+
1917+ if (vdiVirtualSize != volumeSize ) {
1918+ s_logger .info ("resizing the datadisk(vdi) from vdiVirtualsize :" + vdiVirtualSize + "to volumeSize :" + volumeSize );
19201919
19211920 try {
19221921 vdi .resize (conn , volumeSize );
19231922 } catch (Exception e ) {
1924- s_logger .warn ("Unable to resize volume" ,e );
1923+ s_logger .warn ("Unable to resize volume" , e );
19251924 }
19261925 }
19271926 }
@@ -5086,7 +5085,7 @@ protected Answer execute(CreateStoragePoolCommand cmd) {
50865085 StorageFilerTO pool = cmd .getPool ();
50875086 try {
50885087 if (pool .getType () == StoragePoolType .NetworkFilesystem ) {
5089- getNfsSR (conn , Long .toString (pool .getId ()),pool .getUuid (),pool .getHost (),pool .getPath (),pool .toString ());
5088+ getNfsSR (conn , Long .toString (pool .getId ()), pool .getUuid (), pool .getHost (), pool .getPath (), pool .toString ());
50905089 } else if (pool .getType () == StoragePoolType .IscsiLUN ) {
50915090 getIscsiSR (conn , pool .getUuid (), pool .getHost (), pool .getPath (), null , null , false );
50925091 } else if (pool .getType () == StoragePoolType .PreSetup ) {
@@ -6096,7 +6095,7 @@ protected SR getIscsiSR(Connection conn, String srNameLabel, String target, Stri
60966095 }
60976096 }
60986097
6099- protected SR getNfsSR (Connection conn ,String poolid ,String uuid , String server ,String serverpath ,String pooldesc ) {
6098+ protected SR getNfsSR (Connection conn , String poolid , String uuid , String server , String serverpath , String pooldesc ) {
61006099 Map <String , String > deviceConfig = new HashMap <String , String >();
61016100 try {
61026101 serverpath = serverpath .replace ("//" , "/" );
@@ -6129,7 +6128,7 @@ protected SR getNfsSR(Connection conn,String poolid,String uuid, String server,S
61296128
61306129 if (server .equals (dc .get ("server" )) && serverpath .equals (dc .get ("serverpath" ))) {
61316130 throw new CloudRuntimeException ("There is a SR using the same configuration server:" + dc .get ("server" ) + ", serverpath:" + dc .get ("serverpath" ) +
6132- " for pool " + uuid + "on host:" + _host .uuid );
6131+ " for pool " + uuid + " on host:" + _host .uuid );
61336132 }
61346133
61356134 }
0 commit comments