|
19 | 19 | import java.util.ArrayList; |
20 | 20 | import java.util.EnumSet; |
21 | 21 | import java.util.List; |
| 22 | +import java.util.ListIterator; |
22 | 23 | import java.util.Map; |
23 | 24 | import java.util.Set; |
24 | 25 |
|
|
236 | 237 | import com.cloud.storage.Snapshot; |
237 | 238 | import com.cloud.storage.SnapshotVO; |
238 | 239 | import com.cloud.storage.Storage.ImageFormat; |
| 240 | +import com.cloud.storage.Storage.StoragePoolType; |
239 | 241 | import com.cloud.storage.StorageManager; |
240 | 242 | import com.cloud.storage.StoragePool; |
241 | 243 | import com.cloud.storage.StorageStats; |
@@ -1071,6 +1073,26 @@ public static HypervisorType getHypervisorTypeFromFormat(long dcId, ImageFormat |
1071 | 1073 | if (xenClusters.isEmpty()) { |
1072 | 1074 | type = HypervisorType.Hyperv; |
1073 | 1075 | } |
| 1076 | + } if (format == ImageFormat.RAW) { |
| 1077 | + // Currently, KVM only suppoorts RBD images of type RAW. |
| 1078 | + // This results in a weird collision with OVM volumes which |
| 1079 | + // can only be raw, thus making KVM RBD volumes show up as OVM |
| 1080 | + // rather than RBD. This block of code can (hopefuly) by checking to |
| 1081 | + // see if the pool is using either RBD or NFS. However, it isn't |
| 1082 | + // quite clear what to do if both storage types are used. If the image |
| 1083 | + // format is RAW, it narrows the hypervisor choice down to OVM and KVM / RBD or KVM / CLVM |
| 1084 | + // This would be better implemented at a cluster level. |
| 1085 | + List<StoragePoolVO> pools = s_storagePoolDao.listByDataCenterId(dcId); |
| 1086 | + ListIterator<StoragePoolVO> itr = pools.listIterator(); |
| 1087 | + while(itr.hasNext()) { |
| 1088 | + StoragePoolVO pool = itr.next(); |
| 1089 | + if(pool.getPoolType() == StoragePoolType.RBD || pool.getPoolType() == StoragePoolType.CLVM) { |
| 1090 | + // This case will note the presence of non-qcow2 primary stores, suggesting KVM without NFS. Otherwse, |
| 1091 | + // If this check is not passed, the hypervisor type will remain OVM. |
| 1092 | + type = HypervisorType.KVM; |
| 1093 | + break; |
| 1094 | + } |
| 1095 | + } |
1074 | 1096 | } |
1075 | 1097 | return type; |
1076 | 1098 | } |
|
0 commit comments