Skip to content

Commit d705d85

Browse files
Merge pull request #1361 from nvazquez/bothgoals
CLOUDSTACK-9252: Support configurable NFS version for Secondary Storage mountsJIRA Ticket: https://issues.apache.org/jira/browse/CLOUDSTACK-9252 ### Description of the problem After starting secondary storage VM, secondary storage tries to be mounted but fails with error: <code>Protocol family not supported</code> It was found out that adding <code>-o vers=X</code> to mount command it would work, where <code>X</code> is the desired NFS version to use. If it is desired to mount a store with a specific NFS version, it has passed in <code>image_store_details</code> table for a store with id <code>Y</code> as a property: | store_id| name| value | |:-------------:|:-------------:|:-------------:| |Y|nfs.version|X (e.g. 3)| Where X stands for NFS version * pr/1361: CLOUDSTACK-9252: Last refactor, passing nfs version to ssvm CLOUDSTACK-9252: Add missing licence header CLOUDSTACK-9252: Little refactor CLOUDSTACK-9252: Mock application context for unit test CLOUDSTACK-9252: Add unit tests CLOUDSTACK-9252: New refactor CLOUDSTACK-9252: Remove static dependencies, refactor CLOUDSTACK-9252: Remove duplicates getNfsVersion, refactor CLOUDSTACK-9252: Support configurable nfs version CLOUDSTACK-9252: Add nfs version to commands Signed-off-by: Rafael Weingärtner <[email protected]>
2 parents 8df8094 + db3e18d commit d705d85

File tree

35 files changed

+481
-144
lines changed

35 files changed

+481
-144
lines changed

core/src/com/cloud/agent/api/BackupSnapshotCommand.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public class BackupSnapshotCommand extends SnapshotCommand {
3939
private S3TO s3;
4040
StorageFilerTO pool;
4141
private Long secHostId;
42+
private String nfsVersion;
4243

4344
protected BackupSnapshotCommand() {
4445

@@ -107,4 +108,12 @@ public Long getSnapshotId() {
107108
public Long getSecHostId() {
108109
return secHostId;
109110
}
111+
112+
public String getNfsVersion() {
113+
return nfsVersion;
114+
}
115+
116+
public void setNfsVersion(String nfsVersion) {
117+
this.nfsVersion = nfsVersion;
118+
}
110119
}

core/src/com/cloud/agent/api/CreatePrivateTemplateFromSnapshotCommand.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public class CreatePrivateTemplateFromSnapshotCommand extends SnapshotCommand {
2828
private String origTemplateInstallPath;
2929
private Long newTemplateId;
3030
private String templateName;
31+
private String nfsVersion;
3132

3233
protected CreatePrivateTemplateFromSnapshotCommand() {
3334

@@ -72,4 +73,12 @@ public Long getNewTemplateId() {
7273
public String getTemplateName() {
7374
return templateName;
7475
}
76+
77+
public String getNfsVersion() {
78+
return nfsVersion;
79+
}
80+
81+
public void setNfsVersion(String nfsVersion) {
82+
this.nfsVersion = nfsVersion;
83+
}
7584
}

core/src/com/cloud/agent/api/CreatePrivateTemplateFromVolumeCommand.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public class CreatePrivateTemplateFromVolumeCommand extends SnapshotCommand {
3232
StorageFilerTO _primaryPool;
3333
// For XenServer
3434
private String _secondaryStorageUrl;
35+
private String nfsVersion;
3536

3637
public CreatePrivateTemplateFromVolumeCommand() {
3738
}
@@ -99,4 +100,12 @@ public Long getAccountId() {
99100
public void setTemplateId(long templateId) {
100101
_templateId = templateId;
101102
}
103+
104+
public String getNfsVersion() {
105+
return nfsVersion;
106+
}
107+
108+
public void setNfsVersion(String nfsVersion) {
109+
this.nfsVersion = nfsVersion;
110+
}
102111
}

core/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
*/
2727
public class CreateVolumeFromSnapshotCommand extends SnapshotCommand {
2828

29+
private String nfsVersion;
30+
2931
protected CreateVolumeFromSnapshotCommand() {
3032

3133
}
@@ -50,4 +52,12 @@ public CreateVolumeFromSnapshotCommand(StoragePool pool, String secondaryStorage
5052
super(pool, secondaryStoragePoolURL, backedUpSnapshotUuid, backedUpSnapshotName, dcId, accountId, volumeId);
5153
setWait(wait);
5254
}
55+
56+
public String getNfsVersion() {
57+
return nfsVersion;
58+
}
59+
60+
public void setNfsVersion(String nfsVersion) {
61+
this.nfsVersion = nfsVersion;
62+
}
5363
}

core/src/com/cloud/agent/api/GetStorageStatsCommand.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public class GetStorageStatsCommand extends Command {
3030
private StoragePoolType pooltype;
3131
private String secUrl;
3232
private DataStoreTO store;
33+
private String nfsVersion;
3334

3435
public String getSecUrl() {
3536
return secUrl;
@@ -54,6 +55,11 @@ public GetStorageStatsCommand(DataStoreTO store) {
5455
this.store = store;
5556
}
5657

58+
public GetStorageStatsCommand(DataStoreTO store, String nfsVersion) {
59+
this.store = store;
60+
this.nfsVersion = nfsVersion;
61+
}
62+
5763
public GetStorageStatsCommand(String secUrl) {
5864
this.secUrl = secUrl;
5965
}
@@ -81,6 +87,14 @@ public DataStoreTO getStore() {
8187
return this.store;
8288
}
8389

90+
public String getNfsVersion() {
91+
return nfsVersion;
92+
}
93+
94+
public void setNfsVersion(String nfsVersion) {
95+
this.nfsVersion = nfsVersion;
96+
}
97+
8498
@Override
8599
public boolean executeInSequence() {
86100
return false;

core/src/com/cloud/agent/api/SecStorageSetupCommand.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public class SecStorageSetupCommand extends Command {
2828
private String secUrl;
2929
private KeystoreManager.Certificates certs;
3030
private String postUploadKey;
31+
private String nfsVersion;
3132

3233

3334
public SecStorageSetupCommand() {
@@ -74,4 +75,12 @@ public String getPostUploadKey() {
7475
public void setPostUploadKey(String postUploadKey) {
7576
this.postUploadKey = postUploadKey;
7677
}
78+
79+
public String getNfsVersion() {
80+
return nfsVersion;
81+
}
82+
83+
public void setNfsVersion(String nfsVersion) {
84+
this.nfsVersion = nfsVersion;
85+
}
7786
}

core/src/com/cloud/agent/api/storage/CopyVolumeCommand.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public class CopyVolumeCommand extends Command {
3232
boolean toSecondaryStorage;
3333
String vmName;
3434
boolean executeInSequence = false;
35+
String nfsVersion;
3536

3637
public CopyVolumeCommand() {
3738
}
@@ -75,4 +76,12 @@ public boolean toSecondaryStorage() {
7576
public String getVmName() {
7677
return vmName;
7778
}
79+
80+
public String getNfsVersion() {
81+
return nfsVersion;
82+
}
83+
84+
public void setNfsVersion(String nfsVersion) {
85+
this.nfsVersion = nfsVersion;
86+
}
7887
}

core/src/com/cloud/agent/api/storage/ListTemplateCommand.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
public class ListTemplateCommand extends StorageCommand {
2525
private DataStoreTO store;
26+
private String nfsVersion;
2627

2728
//private String secUrl;
2829

@@ -34,6 +35,11 @@ public ListTemplateCommand(DataStoreTO store) {
3435
// this.secUrl = url;
3536
}
3637

38+
public ListTemplateCommand(DataStoreTO store, String nfsVersion) {
39+
this.store = store;
40+
this.nfsVersion = nfsVersion;
41+
}
42+
3743
@Override
3844
public boolean executeInSequence() {
3945
return true;
@@ -43,6 +49,10 @@ public DataStoreTO getDataStore() {
4349
return store;
4450
}
4551

52+
public String getNfsVersion() {
53+
return nfsVersion;
54+
}
55+
4656
// public String getSecUrl() {
4757
// return secUrl;
4858
// }

core/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public class PrimaryStorageDownloadCommand extends AbstractDownloadCommand {
3535

3636
String secondaryStorageUrl;
3737
String primaryStorageUrl;
38+
String nfsVersion;
3839

3940
protected PrimaryStorageDownloadCommand() {
4041
}
@@ -87,4 +88,12 @@ public String getPrimaryStorageUrl() {
8788
public boolean executeInSequence() {
8889
return true;
8990
}
91+
92+
public String getNfsVersion() {
93+
return nfsVersion;
94+
}
95+
96+
public void setNfsVersion(String nfsVersion) {
97+
this.nfsVersion = nfsVersion;
98+
}
9099
}

core/src/org/apache/cloudstack/storage/command/TemplateOrVolumePostUploadCommand.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ public class TemplateOrVolumePostUploadCommand {
5353

5454
private long accountId;
5555

56+
private String nfsVersion;
57+
5658
public TemplateOrVolumePostUploadCommand(long entityId, String entityUUID, String absolutePath, String checksum, String type, String name, String imageFormat, String dataTo,
5759
String dataToRole) {
5860
this.entityId = entityId;
@@ -196,4 +198,12 @@ public void setAccountId(long accountId) {
196198
public long getAccountId() {
197199
return accountId;
198200
}
201+
202+
public String getNfsVersion() {
203+
return nfsVersion;
204+
}
205+
206+
public void setNfsVersion(String nfsVersion) {
207+
this.nfsVersion = nfsVersion;
208+
}
199209
}

0 commit comments

Comments
 (0)