Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions api/src/com/cloud/agent/api/to/NfsTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class NfsTO implements DataStoreTO {
private DataStoreRole _role;
private String uuid;
private static final String pathSeparator = "/";
private Integer nfsVersion;

public NfsTO() {

Expand Down Expand Up @@ -71,4 +72,12 @@ public void setUuid(String uuid) {
public String getPathSeparator() {
return pathSeparator;
}

public Integer getNfsVersion() {
return nfsVersion;
}

public void setNfsVersion(Integer nfsVersion) {
this.nfsVersion = nfsVersion;
}
}
8 changes: 0 additions & 8 deletions core/src/com/cloud/agent/api/BackupSnapshotCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public class BackupSnapshotCommand extends SnapshotCommand {
private S3TO s3;
StorageFilerTO pool;
private Long secHostId;
private String nfsVersion;

protected BackupSnapshotCommand() {

Expand Down Expand Up @@ -109,11 +108,4 @@ public Long getSecHostId() {
return secHostId;
}

public String getNfsVersion() {
return nfsVersion;
}

public void setNfsVersion(String nfsVersion) {
this.nfsVersion = nfsVersion;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class CreatePrivateTemplateFromSnapshotCommand extends SnapshotCommand {
private String origTemplateInstallPath;
private Long newTemplateId;
private String templateName;
private String nfsVersion;

protected CreatePrivateTemplateFromSnapshotCommand() {

Expand Down Expand Up @@ -74,11 +73,4 @@ public String getTemplateName() {
return templateName;
}

public String getNfsVersion() {
return nfsVersion;
}

public void setNfsVersion(String nfsVersion) {
this.nfsVersion = nfsVersion;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public class CreatePrivateTemplateFromVolumeCommand extends SnapshotCommand {
StorageFilerTO _primaryPool;
// For XenServer
private String _secondaryStorageUrl;
private String nfsVersion;

public CreatePrivateTemplateFromVolumeCommand() {
}
Expand Down Expand Up @@ -101,11 +100,4 @@ public void setTemplateId(long templateId) {
_templateId = templateId;
}

public String getNfsVersion() {
return nfsVersion;
}

public void setNfsVersion(String nfsVersion) {
this.nfsVersion = nfsVersion;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
*/
public class CreateVolumeFromSnapshotCommand extends SnapshotCommand {

private String nfsVersion;

protected CreateVolumeFromSnapshotCommand() {

}
Expand All @@ -53,11 +51,4 @@ public CreateVolumeFromSnapshotCommand(StoragePool pool, String secondaryStorage
setWait(wait);
}

public String getNfsVersion() {
return nfsVersion;
}

public void setNfsVersion(String nfsVersion) {
this.nfsVersion = nfsVersion;
}
}
16 changes: 4 additions & 12 deletions core/src/com/cloud/agent/api/GetStorageStatsCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@
package com.cloud.agent.api;

import com.cloud.agent.api.LogLevel.Log4jLevel;
import com.cloud.agent.api.storage.StorageNfsVersionCommand;
import com.cloud.agent.api.to.DataStoreTO;
import com.cloud.storage.Storage.StoragePoolType;

@LogLevel(Log4jLevel.Trace)
public class GetStorageStatsCommand extends Command {
public class GetStorageStatsCommand extends StorageNfsVersionCommand {
private String id;
private String localPath;
private StoragePoolType pooltype;
private String secUrl;
private DataStoreTO store;
private String nfsVersion;

public String getSecUrl() {
return secUrl;
Expand All @@ -55,9 +55,9 @@ public GetStorageStatsCommand(DataStoreTO store) {
this.store = store;
}

public GetStorageStatsCommand(DataStoreTO store, String nfsVersion) {
public GetStorageStatsCommand(DataStoreTO store, Integer nfsVersion) {
super(nfsVersion);
this.store = store;
this.nfsVersion = nfsVersion;
}

public GetStorageStatsCommand(String secUrl) {
Expand Down Expand Up @@ -87,14 +87,6 @@ public DataStoreTO getStore() {
return this.store;
}

public String getNfsVersion() {
return nfsVersion;
}

public void setNfsVersion(String nfsVersion) {
this.nfsVersion = nfsVersion;
}

@Override
public boolean executeInSequence() {
return false;
Expand Down
11 changes: 2 additions & 9 deletions core/src/com/cloud/agent/api/SecStorageSetupCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@

import org.apache.cloudstack.framework.security.keystore.KeystoreManager;

import com.cloud.agent.api.storage.StorageNfsVersionCommand;
import com.cloud.agent.api.to.DataStoreTO;

public class SecStorageSetupCommand extends Command {
public class SecStorageSetupCommand extends StorageNfsVersionCommand {
private DataStoreTO store;
private String secUrl;
private KeystoreManager.Certificates certs;
private String postUploadKey;
private String nfsVersion;


public SecStorageSetupCommand() {
Expand Down Expand Up @@ -76,11 +76,4 @@ public void setPostUploadKey(String postUploadKey) {
this.postUploadKey = postUploadKey;
}

public String getNfsVersion() {
return nfsVersion;
}

public void setNfsVersion(String nfsVersion) {
this.nfsVersion = nfsVersion;
}
}
3 changes: 2 additions & 1 deletion core/src/com/cloud/agent/api/SnapshotCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@

package com.cloud.agent.api;

import com.cloud.agent.api.storage.StorageNfsVersionCommand;
import com.cloud.agent.api.to.StorageFilerTO;
import com.cloud.storage.StoragePool;

/**
* This currently assumes that both primary and secondary storage are mounted on
* the XenServer.
*/
public class SnapshotCommand extends Command {
public class SnapshotCommand extends StorageNfsVersionCommand {
protected String primaryStoragePoolNameLabel;
StorageFilerTO primaryPool;
private String snapshotUuid;
Expand Down
11 changes: 1 addition & 10 deletions core/src/com/cloud/agent/api/storage/CopyVolumeCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@

package com.cloud.agent.api.storage;

import com.cloud.agent.api.Command;
import com.cloud.agent.api.to.StorageFilerTO;
import com.cloud.storage.StoragePool;

public class CopyVolumeCommand extends Command {
public class CopyVolumeCommand extends StorageNfsVersionCommand {

long volumeId;
String volumePath;
Expand All @@ -32,7 +31,6 @@ public class CopyVolumeCommand extends Command {
boolean toSecondaryStorage;
String vmName;
boolean executeInSequence = false;
String nfsVersion;

public CopyVolumeCommand() {
}
Expand Down Expand Up @@ -77,11 +75,4 @@ public String getVmName() {
return vmName;
}

public String getNfsVersion() {
return nfsVersion;
}

public void setNfsVersion(String nfsVersion) {
this.nfsVersion = nfsVersion;
}
}
16 changes: 2 additions & 14 deletions core/src/com/cloud/agent/api/storage/ListTemplateCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,17 @@

public class ListTemplateCommand extends StorageCommand {
private DataStoreTO store;
private String nfsVersion;

//private String secUrl;

public ListTemplateCommand() {
}

public ListTemplateCommand(DataStoreTO store) {
this.store = store;
// this.secUrl = url;
}

public ListTemplateCommand(DataStoreTO store, String nfsVersion) {
public ListTemplateCommand(DataStoreTO store, Integer nfsVersion) {
super(nfsVersion);
this.store = store;
this.nfsVersion = nfsVersion;
}

@Override
Expand All @@ -49,12 +45,4 @@ public DataStoreTO getDataStore() {
return store;
}

public String getNfsVersion() {
return nfsVersion;
}

// public String getSecUrl() {
// return secUrl;
// }

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public class PrimaryStorageDownloadCommand extends AbstractDownloadCommand {

String secondaryStorageUrl;
String primaryStorageUrl;
String nfsVersion;

protected PrimaryStorageDownloadCommand() {
}
Expand Down Expand Up @@ -89,11 +88,4 @@ public boolean executeInSequence() {
return true;
}

public String getNfsVersion() {
return nfsVersion;
}

public void setNfsVersion(String nfsVersion) {
this.nfsVersion = nfsVersion;
}
}
4 changes: 1 addition & 3 deletions core/src/com/cloud/agent/api/storage/SsCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@

package com.cloud.agent.api.storage;

import com.cloud.agent.api.Command;

public abstract class SsCommand extends Command {
public abstract class SsCommand extends StorageNfsVersionCommand {
private String secUrl;

public SsCommand() {
Expand Down
8 changes: 5 additions & 3 deletions core/src/com/cloud/agent/api/storage/StorageCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@

package com.cloud.agent.api.storage;

import com.cloud.agent.api.Command;

public abstract class StorageCommand extends Command {
public abstract class StorageCommand extends StorageNfsVersionCommand {
protected StorageCommand() {
super();
}

protected StorageCommand(Integer nfsVersion){
super(nfsVersion);
}

}
44 changes: 44 additions & 0 deletions core/src/com/cloud/agent/api/storage/StorageNfsVersionCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//
package com.cloud.agent.api.storage;

import com.cloud.agent.api.Command;

public abstract class StorageNfsVersionCommand extends Command {

protected StorageNfsVersionCommand(){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you using this constructor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I kept it for the hierarchy. Classes extending StorageNfsVersionCommand will not compile if I remove it, in their constructors the error will be:

Implicit super constructor StorageNfsVersionCommand() is undefined. Must explicitly invoke another constructor

Do you agree about keeping it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure I do, I had forgotten that in the child class they were invoking the super (). I am sorry for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem ;)

super();
}

protected StorageNfsVersionCommand(Integer nfsVersion){
super();
this.nfsVersion = nfsVersion;
}

private Integer nfsVersion;

public Integer getNfsVersion() {
return nfsVersion;
}

public void setNfsVersion(Integer nfsVersion) {
this.nfsVersion = nfsVersion;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class TemplateOrVolumePostUploadCommand {

private long accountId;

private String nfsVersion;
private Integer nfsVersion;

public TemplateOrVolumePostUploadCommand(long entityId, String entityUUID, String absolutePath, String checksum, String type, String name, String imageFormat, String dataTo,
String dataToRole) {
Expand Down Expand Up @@ -199,11 +199,11 @@ public long getAccountId() {
return accountId;
}

public String getNfsVersion() {
public Integer getNfsVersion() {
return nfsVersion;
}

public void setNfsVersion(String nfsVersion) {
public void setNfsVersion(Integer nfsVersion) {
this.nfsVersion = nfsVersion;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,8 @@ protected Void createTemplateAsyncCallBack(AsyncCallbackDispatcher<TemplateServi
}

private Map<String, TemplateProp> listTemplate(DataStore ssStore) {
ListTemplateCommand cmd = new ListTemplateCommand(ssStore.getTO(), imageStoreDetailsUtil.getNfsVersion(ssStore.getId()));
Integer nfsVersion = imageStoreDetailsUtil.getNfsVersion(ssStore.getId());
ListTemplateCommand cmd = new ListTemplateCommand(ssStore.getTO(), nfsVersion);
EndPoint ep = _epSelector.select(ssStore);
Answer answer = null;
if (ep == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public MockLocalNfsSecondaryStorageResource() {
}

@Override
public String getRootDir(String secUrl, String nfsVersion) {
public String getRootDir(String secUrl, Integer nfsVersion) {
return "/mnt";
}

Expand Down
Loading