|
22 | 22 | import com.cloud.agent.api.to.DataObjectType; |
23 | 23 | import com.cloud.agent.api.to.DataStoreTO; |
24 | 24 | 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; |
27 | 25 | import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector; |
28 | 26 | import com.cloud.exception.InvalidParameterValueException; |
29 | 27 | import com.cloud.host.Host; |
@@ -139,42 +137,42 @@ public void createAsync(DataStore dataStore, DataObject dataObject, AsyncComplet |
139 | 137 | * @param volumeInfo Volume information with size, format, uuid |
140 | 138 | * @return Answer from KVM agent indicating success/failure |
141 | 139 | */ |
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 | +// } |
178 | 176 |
|
179 | 177 | /** |
180 | 178 | * Creates CloudStack volume based on storage protocol type (NFS or iSCSI). |
@@ -203,14 +201,14 @@ private String createCloudStackVolumeForTypeVolume(DataStore dataStore, DataObje |
203 | 201 | String volumeUuid = createManagedNfsVolume(dataStore, dataObject, storagePool); |
204 | 202 |
|
205 | 203 | // 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 | +// } |
214 | 212 |
|
215 | 213 | return volumeUuid; |
216 | 214 | } else if (ProtocolType.ISCSI.name().equalsIgnoreCase(protocol)) { |
|
0 commit comments