Skip to content

Commit cb61d35

Browse files
author
Anthony Xu
committed
set nosubdir for NFS SR
1 parent 296dc86 commit cb61d35

2 files changed

Lines changed: 17 additions & 9 deletions

File tree

‎plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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) {

‎plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -560,9 +560,9 @@ protected SR getNfsSR(Connection conn, StorageFilerTO pool) {
560560
deviceConfig.put("server", server);
561561
deviceConfig.put("serverpath", serverpath);
562562
Host host = Host.getByUuid(conn, hypervisorResource.getHost().uuid);
563-
SR sr =
564-
SR.create(conn, host, deviceConfig, new Long(0), pool.getUuid(), Long.toString(pool.getId()), SRType.NFS.toString(), "user", true,
565-
new HashMap<String, String>());
563+
Map<String, String> smConfig = new HashMap<String, String>();
564+
smConfig.put("nosubdir", "true");
565+
SR sr = SR.create(conn, host, deviceConfig, new Long(0), pool.getUuid(), Long.toString(pool.getId()), SRType.NFS.toString(), "user", true, smConfig);
566566
sr.scan(conn);
567567
return sr;
568568
} catch (XenAPIException e) {

0 commit comments

Comments
 (0)