@@ -5091,6 +5091,14 @@ protected boolean checkSR(Connection conn, SR sr) {
50915091 s_logger .debug ("Checking " + srr .nameLabel + " or SR " + srr .uuid + " on " + _host );
50925092 }
50935093 if (srr .shared ) {
5094+ if (SRType .NFS .equals (srr .type ) ){
5095+ Map <String , String > smConfig = srr .smConfig ;
5096+ if ( !smConfig .containsKey ("nosubdir" )) {
5097+ smConfig .put ("nosubdir" , "true" );
5098+ sr .setSmConfig (conn ,smConfig );
5099+ }
5100+ }
5101+
50945102 Host host = Host .getByUuid (conn , _host .uuid );
50955103 boolean found = false ;
50965104 for (PBD pbd : pbds ) {
@@ -5910,10 +5918,10 @@ protected SR createNfsSRbyURI(Connection conn, URI uri, boolean shared) {
59105918 }
59115919
59125920 Host host = Host .getByUuid (conn , _host .uuid );
5921+ Map <String , String > smConfig = new HashMap <String , String >();
5922+ smConfig .put ("nosubdir" , "true" );
5923+ SR sr = SR .create (conn , host , deviceConfig , new Long (0 ), name , uri .getHost () + uri .getPath (), SRType .NFS .toString (), "user" , shared , smConfig );
59135924
5914- SR sr =
5915- SR .create (conn , host , deviceConfig , new Long (0 ), name , uri .getHost () + uri .getPath (), SRType .NFS .toString (), "user" , shared ,
5916- new HashMap <String , String >());
59175925 if (!checkSR (conn , sr )) {
59185926 throw new Exception ("no attached PBD" );
59195927 }
@@ -6183,9 +6191,9 @@ protected SR getNfsSR(Connection conn, StorageFilerTO pool) {
61836191 deviceConfig .put ("server" , server );
61846192 deviceConfig .put ("serverpath" , serverpath );
61856193 Host host = Host .getByUuid (conn , _host .uuid );
6186- SR sr =
6187- SR . create ( conn , host , deviceConfig , new Long ( 0 ), pool . getUuid (), Long . toString ( pool . getId ()), SRType . NFS . toString (), "user " , true ,
6188- new HashMap < String , String >() );
6194+ Map < String , String > smConfig = new HashMap < String , String >();
6195+ smConfig . put ( "nosubdir " , " true" );
6196+ SR sr = SR . create ( conn , host , deviceConfig , new Long ( 0 ), pool . getUuid (), Long . toString ( pool . getId ()), SRType . NFS . toString (), "user" , true , smConfig );
61896197 sr .scan (conn );
61906198 return sr ;
61916199 } catch (XenAPIException e ) {
0 commit comments