Skip to content

Commit e26feb0

Browse files
Srivastava, PiyushSrivastava, Piyush
authored andcommitted
managedNFS 4
1 parent 37536ad commit e26feb0

File tree

1 file changed

+44
-46
lines changed

1 file changed

+44
-46
lines changed

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

Lines changed: 44 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
import com.cloud.agent.api.to.DataObjectType;
2323
import com.cloud.agent.api.to.DataStoreTO;
2424
import com.cloud.agent.api.to.DataTO;
25-
import org.apache.cloudstack.storage.command.CreateObjectCommand;
26-
import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
2725
import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
2826
import com.cloud.exception.InvalidParameterValueException;
2927
import com.cloud.host.Host;
@@ -139,42 +137,42 @@ public void createAsync(DataStore dataStore, DataObject dataObject, AsyncComplet
139137
* @param volumeInfo Volume information with size, format, uuid
140138
* @return Answer from KVM agent indicating success/failure
141139
*/
142-
private Answer createVolumeOnKVMHost(VolumeInfo volumeInfo) {
143-
try {
144-
s_logger.info("createVolumeOnKVMHost: Sending CreateObjectCommand to KVM agent for volume: {}", volumeInfo.getUuid());
145-
146-
// Create command with volume TO (Transfer Object)
147-
CreateObjectCommand cmd = new CreateObjectCommand(volumeInfo.getTO());
148-
149-
// Select endpoint (KVM agent) to send command
150-
// epSelector will find an appropriate KVM host in the cluster/pod
151-
EndPoint ep = epSelector.select(volumeInfo);
152-
153-
if (ep == null) {
154-
String errMsg = "No remote endpoint to send CreateObjectCommand, check if host is up";
155-
s_logger.error(errMsg);
156-
return new Answer(cmd, false, errMsg);
157-
}
158-
159-
s_logger.info("createVolumeOnKVMHost: Sending command to endpoint: {}", ep.getHostAddr());
160-
161-
// Send command to KVM agent and wait for response
162-
Answer answer = ep.sendMessage(cmd);
163-
164-
if (answer != null && answer.getResult()) {
165-
s_logger.info("createVolumeOnKVMHost: Successfully created qcow2 file on KVM host");
166-
} else {
167-
s_logger.error("createVolumeOnKVMHost: Failed to create qcow2 file: {}",
168-
answer != null ? answer.getDetails() : "null answer");
169-
}
170-
171-
return answer;
172-
173-
} catch (Exception e) {
174-
s_logger.error("createVolumeOnKVMHost: Exception sending CreateObjectCommand", e);
175-
return new Answer(null, false, e.toString());
176-
}
177-
}
140+
// private Answer createVolumeOnKVMHost(VolumeInfo volumeInfo) {
141+
// try {
142+
// s_logger.info("createVolumeOnKVMHost: Sending CreateObjectCommand to KVM agent for volume: {}", volumeInfo.getUuid());
143+
//
144+
// // Create command with volume TO (Transfer Object)
145+
// CreateObjectCommand cmd = new CreateObjectCommand(volumeInfo.getTO());
146+
//
147+
// // Select endpoint (KVM agent) to send command
148+
// // epSelector will find an appropriate KVM host in the cluster/pod
149+
// EndPoint ep = epSelector.select(volumeInfo);
150+
//
151+
// if (ep == null) {
152+
// String errMsg = "No remote endpoint to send CreateObjectCommand, check if host is up";
153+
// s_logger.error(errMsg);
154+
// return new Answer(cmd, false, errMsg);
155+
// }
156+
//
157+
// s_logger.info("createVolumeOnKVMHost: Sending command to endpoint: {}", ep.getHostAddr());
158+
//
159+
// // Send command to KVM agent and wait for response
160+
// Answer answer = ep.sendMessage(cmd);
161+
//
162+
// if (answer != null && answer.getResult()) {
163+
// s_logger.info("createVolumeOnKVMHost: Successfully created qcow2 file on KVM host");
164+
// } else {
165+
// s_logger.error("createVolumeOnKVMHost: Failed to create qcow2 file: {}",
166+
// answer != null ? answer.getDetails() : "null answer");
167+
// }
168+
//
169+
// return answer;
170+
//
171+
// } catch (Exception e) {
172+
// s_logger.error("createVolumeOnKVMHost: Exception sending CreateObjectCommand", e);
173+
// return new Answer(null, false, e.toString());
174+
// }
175+
// }
178176

179177
/**
180178
* Creates CloudStack volume based on storage protocol type (NFS or iSCSI).
@@ -203,14 +201,14 @@ private String createCloudStackVolumeForTypeVolume(DataStore dataStore, DataObje
203201
String volumeUuid = createManagedNfsVolume(dataStore, dataObject, storagePool);
204202

205203
// Step 2: Send command to KVM host to create qcow2 file using qemu-img
206-
VolumeInfo volumeInfo = (VolumeInfo) dataObject;
207-
Answer answer = createVolumeOnKVMHost(volumeInfo);
208-
209-
if (answer == null || !answer.getResult()) {
210-
String errMsg = answer != null ? answer.getDetails() : "Failed to create qcow2 on KVM host";
211-
s_logger.error("createCloudStackVolumeForTypeVolume: " + errMsg);
212-
throw new CloudRuntimeException(errMsg);
213-
}
204+
// VolumeInfo volumeInfo = (VolumeInfo) dataObject;
205+
// Answer answer = createVolumeOnKVMHost(volumeInfo);
206+
207+
// if (answer == null || !answer.getResult()) {
208+
// String errMsg = answer != null ? answer.getDetails() : "Failed to create qcow2 on KVM host";
209+
// s_logger.error("createCloudStackVolumeForTypeVolume: " + errMsg);
210+
// throw new CloudRuntimeException(errMsg);
211+
// }
214212

215213
return volumeUuid;
216214
} else if (ProtocolType.ISCSI.name().equalsIgnoreCase(protocol)) {

0 commit comments

Comments
 (0)