Skip to content

Commit 8ebc1e1

Browse files
Srivastava, PiyushSrivastava, Piyush
authored andcommitted
vm instance creation test
1 parent e8062fd commit 8ebc1e1

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/driver/OntapPrimaryDatastoreDriver.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,15 @@ private String createCloudStackVolumeForTypeVolume(DataStore dataStore, DataObje
135135
if (ProtocolType.ISCSI.name().equalsIgnoreCase(details.get(Constants.PROTOCOL)) && cloudStackVolume.getLun() != null && cloudStackVolume.getLun().getName() != null) {
136136
return cloudStackVolume.getLun().getName();
137137
} else if (ProtocolType.NFS.name().equalsIgnoreCase(details.get(Constants.PROTOCOL))) {
138-
return cloudStackVolume.getFile().getName();
138+
// For NFS, ONTAP creates a directory for organization
139+
// CloudStack will create the actual .qcow2 file inside this directory
140+
String directoryName = cloudStackVolume.getCloudstackVolName();
141+
String volumeUuid = ((VolumeInfo) dataObject).getUuid();
142+
// Return path: "directory-name/volume-uuid"
143+
// CloudStack will append .qcow2 extension when creating the actual disk file
144+
String volumePath = directoryName + "/" + volumeUuid;
145+
s_logger.info("createCloudStackVolumeForTypeVolume: NFS volume directory [{}] created, returning path: {}", directoryName, volumePath);
146+
return volumePath;
139147
} else {
140148
String errMsg = "createCloudStackVolumeForTypeVolume: Volume creation failed. Lun or Lun Path is null for dataObject: " + dataObject;
141149
s_logger.error(errMsg);

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/service/model/CloudStackVolume.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ public class CloudStackVolume {
2727

2828
private FileInfo file;
2929
private Lun lun;
30-
private Volume volume;
30+
private Volume storagePoolvolume;
3131
// will be replaced after testing
3232
private String cloudstackVolName;
33+
private String cloudstackVolUUID;
34+
3335

3436
public FileInfo getFile() {
3537
return file;
@@ -47,15 +49,21 @@ public void setLun(Lun lun) {
4749
this.lun = lun;
4850
}
4951
public Volume getVolume() {
50-
return volume;
52+
return storagePoolvolume;
5153
}
5254
public void setVolume(Volume volume) {
53-
this.volume = volume;
55+
this.storagePoolvolume = volume;
5456
}
5557
public String getCloudstackVolName() {
5658
return cloudstackVolName;
5759
}
5860
public void setCloudstackVolName(String cloudstackVolName) {
5961
this.cloudstackVolName = cloudstackVolName;
6062
}
63+
public String getCloudstackVolUUID() {
64+
return cloudstackVolUUID;
65+
}
66+
public void setCloudstackVolUUID(String cloudstackVolUUID) {
67+
this.cloudstackVolUUID = cloudstackVolUUID;
68+
}
6169
}

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/utils/Utility.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ public static CloudStackVolume createCloudStackVolumeRequestByProtocol(StoragePo
7070
FileInfo file = new FileInfo();
7171
//file.setName("test1"); // to be replaced with volume name // this should not be passed for dir
7272
//file.setName(volumeObject.getName()); // to check whether this needs to be sent or not
73-
file.setSize(Long.parseLong("10000"));
74-
file.setSize(volumeObject.getSize());
73+
//file.setSize(Long.parseLong("10000"));
74+
//file.setSize(volumeObject.getSize());
7575
file.setUnixPermissions(755); // check if it is needed only for dir ? it is needed for dir
7676
file.setType(FileInfo.TypeEnum.DIRECTORY); // We are creating file for a cloudstack volume . Should it be dir ? // TODO change once multipart is done
7777

@@ -81,6 +81,7 @@ public static CloudStackVolume createCloudStackVolumeRequestByProtocol(StoragePo
8181
cloudStackVolumeRequest.setVolume(poolVolume);
8282
cloudStackVolumeRequest.setFile(file);
8383
cloudStackVolumeRequest.setCloudstackVolName(volumeObject.getName());
84+
cloudStackVolumeRequest.setCloudstackVolName(volumeObject.getUuid());
8485
break;
8586
case ISCSI:
8687
cloudStackVolumeRequest = new CloudStackVolume();

0 commit comments

Comments
 (0)