|
24 | 24 | import com.cloud.agent.api.to.DataTO; |
25 | 25 | import com.cloud.exception.InvalidParameterValueException; |
26 | 26 | import com.cloud.host.Host; |
| 27 | +import com.cloud.hypervisor.Hypervisor; |
27 | 28 | import com.cloud.storage.Storage; |
28 | 29 | import com.cloud.storage.StoragePool; |
29 | 30 | import com.cloud.storage.Volume; |
|
59 | 60 | import java.util.List; |
60 | 61 | import java.util.Map; |
61 | 62 |
|
| 63 | +import static com.cloud.hypervisor.Hypervisor.HypervisorType.KVM; |
| 64 | +import static com.cloud.hypervisor.Hypervisor.HypervisorType.VMware; |
| 65 | + |
62 | 66 | public class OntapPrimaryDatastoreDriver implements PrimaryDataStoreDriver { |
63 | 67 |
|
64 | 68 | private static final Logger logger = (Logger)LogManager.getLogger(OntapPrimaryDatastoreDriver.class); |
@@ -145,11 +149,22 @@ private String createCloudStackVolume(long storagePoolId, DataObject dataObject) |
145 | 149 | String lunOrFileName = dataObject.getName(); |
146 | 150 | Long size = dataObject.getSize(); |
147 | 151 | String volName = storagePool.getName(); |
| 152 | + String hypervisorType = storagePool.getHypervisor().name(); |
| 153 | + String osType = null; |
| 154 | + switch (hypervisorType) { |
| 155 | + case Constants.KVM: |
| 156 | + osType = Lun.OsTypeEnum.LINUX.getValue(); |
| 157 | + break; |
| 158 | + default: |
| 159 | + String errMsg = "createCloudStackVolume : Unsupported hypervisor type " + hypervisorType + " for ONTAP storage"; |
| 160 | + logger.error(errMsg); |
| 161 | + throw new CloudRuntimeException(errMsg); |
| 162 | + } |
148 | 163 |
|
149 | 164 | // Create LUN based on protocol |
150 | 165 | if (ontapStorage.getProtocol().equals(Constants.ISCSI)) { |
151 | 166 | SANStrategy sanStrategy = StorageProviderFactory.getSANStrategy(ontapStorage); |
152 | | - Lun lun = sanStrategy.createLUN(svmName, volName, lunOrFileName, size , Lun.OsTypeEnum.LINUX.getValue()); |
| 167 | + Lun lun = sanStrategy.createLUN(svmName, volName, lunOrFileName, size , osType); |
153 | 168 | if(lun.getName() == null || lun.getName().isEmpty()) { |
154 | 169 | throw new CloudRuntimeException("createCloudStackVolume : LUN Name is invalid"); |
155 | 170 | } |
|
0 commit comments