@@ -139,6 +139,21 @@ public static enum TemplateType {
139139 ISODISK /* Template corresponding to a iso (non root disk) present in an OVA */
140140 }
141141
142+ public enum EncryptionSupport {
143+ /**
144+ * Encryption not supported.
145+ */
146+ Unsupported ,
147+ /**
148+ * Will use hypervisor encryption driver (qemu -> luks)
149+ */
150+ Hypervisor ,
151+ /**
152+ * Storage pool handles encryption and just provides an encrypted volume
153+ */
154+ Storage
155+ }
156+
142157 /**
143158 * StoragePoolTypes carry some details about the format and capabilities of a storage pool. While not necessarily a
144159 * 1:1 with PrimaryDataStoreDriver (and for KVM agent, KVMStoragePool and StorageAdaptor) implementations, it is
@@ -150,57 +165,35 @@ public static enum TemplateType {
150165 * ensure this is available on the agent side as well. This is best done by defining the StoragePoolType in a common
151166 * package available on both management server and agent plugin jars.
152167 */
153- public static class StoragePoolType {
154- private static final Map <String , StoragePoolType > map = new LinkedHashMap <>();
155-
156- public static final StoragePoolType Filesystem = new StoragePoolType ("Filesystem" , false , true , true );
157- public static final StoragePoolType NetworkFilesystem = new StoragePoolType ("NetworkFilesystem" , true , true , true );
158- public static final StoragePoolType IscsiLUN = new StoragePoolType ("IscsiLUN" , true , false , false );
159- public static final StoragePoolType Iscsi = new StoragePoolType ("Iscsi" , true , false , false );
160- public static final StoragePoolType ISO = new StoragePoolType ("ISO" , false , false , false );
161- public static final StoragePoolType LVM = new StoragePoolType ("LVM" , false , false , false );
162- public static final StoragePoolType CLVM = new StoragePoolType ("CLVM" , true , false , false );
163- public static final StoragePoolType RBD = new StoragePoolType ("RBD" , true , true , false );
164- public static final StoragePoolType SharedMountPoint = new StoragePoolType ("SharedMountPoint" , true , true , true );
165- public static final StoragePoolType VMFS = new StoragePoolType ("VMFS" , true , true , false );
166- public static final StoragePoolType PreSetup = new StoragePoolType ("PreSetup" , true , true , false );
167- public static final StoragePoolType EXT = new StoragePoolType ("EXT" , false , true , false );
168- public static final StoragePoolType OCFS2 = new StoragePoolType ("OCFS2" , true , false , false );
169- public static final StoragePoolType SMB = new StoragePoolType ("SMB" , true , false , false );
170- public static final StoragePoolType Gluster = new StoragePoolType ("Gluster" , true , false , false );
171- public static final StoragePoolType PowerFlex = new StoragePoolType ("PowerFlex" , true , true , true );
172- public static final StoragePoolType ManagedNFS = new StoragePoolType ("ManagedNFS" , true , false , false );
173- public static final StoragePoolType Linstor = new StoragePoolType ("Linstor" , true , true , false );
174- public static final StoragePoolType DatastoreCluster = new StoragePoolType ("DatastoreCluster" , true , true , false );
175- public static final StoragePoolType StorPool = new StoragePoolType ("StorPool" , true ,true ,true );
176- public static final StoragePoolType FiberChannel = new StoragePoolType ("FiberChannel" , true ,true ,false );
177-
168+ public static enum StoragePoolType {
169+ Filesystem (false , true , EncryptionSupport .Hypervisor ), // local directory
170+ NetworkFilesystem (true , true , EncryptionSupport .Hypervisor ), // NFS
171+ IscsiLUN (true , false , EncryptionSupport .Unsupported ), // shared LUN, with a clusterfs overlay
172+ Iscsi (true , false , EncryptionSupport .Unsupported ), // for e.g., ZFS Comstar
173+ ISO (false , false , EncryptionSupport .Unsupported ), // for iso image
174+ LVM (false , false , EncryptionSupport .Unsupported ), // XenServer local LVM SR
175+ CLVM (true , false , EncryptionSupport .Unsupported ),
176+ RBD (true , true , EncryptionSupport .Unsupported ), // http://libvirt.org/storage.html#StorageBackendRBD
177+ SharedMountPoint (true , true , EncryptionSupport .Hypervisor ),
178+ VMFS (true , true , EncryptionSupport .Unsupported ), // VMware VMFS storage
179+ PreSetup (true , true , EncryptionSupport .Unsupported ), // for XenServer, Storage Pool is set up by customers.
180+ EXT (false , true , EncryptionSupport .Unsupported ), // XenServer local EXT SR
181+ OCFS2 (true , false , EncryptionSupport .Unsupported ),
182+ SMB (true , false , EncryptionSupport .Unsupported ),
183+ Gluster (true , false , EncryptionSupport .Unsupported ),
184+ PowerFlex (true , true , EncryptionSupport .Hypervisor ), // Dell EMC PowerFlex/ScaleIO (formerly VxFlexOS)
185+ ManagedNFS (true , false , EncryptionSupport .Unsupported ),
186+ Linstor (true , true , EncryptionSupport .Storage ),
187+ DatastoreCluster (true , true , EncryptionSupport .Unsupported ), // for VMware, to abstract pool of clusters
188+ StorPool (true , true , EncryptionSupport .Hypervisor ),
189+ FiberChannel (true , true , EncryptionSupport .Unsupported ); // Fiber Channel Pool for KVM hypervisors is used to find the volume by WWN value (/dev/disk/by-id/wwn-<wwnvalue>)
178190
179191 private final String name ;
180192 private final boolean shared ;
181193 private final boolean overProvisioning ;
182- private final boolean encryption ;
194+ private final EncryptionSupport encryption ;
183195
184- /**
185- * New StoragePoolType, set the name to check with it in Dao (Note: Do not register it into the map of pool types).
186- * @param name name of the StoragePoolType.
187- */
188- public StoragePoolType (String name ) {
189- this .name = name ;
190- this .shared = false ;
191- this .overProvisioning = false ;
192- this .encryption = false ;
193- }
194-
195- /**
196- * Define a new StoragePoolType, and register it into the map of pool types known to the management server.
197- * @param name Simple unique name of the StoragePoolType.
198- * @param shared Storage pool is shared/accessible to multiple hypervisors
199- * @param overProvisioning Storage pool supports overProvisioning
200- * @param encryption Storage pool supports encrypted volumes
201- */
202- public StoragePoolType (String name , boolean shared , boolean overProvisioning , boolean encryption ) {
203- this .name = name ;
196+ StoragePoolType (boolean shared , boolean overProvisioning , EncryptionSupport encryption ) {
204197 this .shared = shared ;
205198 this .overProvisioning = overProvisioning ;
206199 this .encryption = encryption ;
@@ -216,6 +209,10 @@ public boolean supportsOverProvisioning() {
216209 }
217210
218211 public boolean supportsEncryption () {
212+ return encryption == EncryptionSupport .Hypervisor || encryption == EncryptionSupport .Storage ;
213+ }
214+
215+ public EncryptionSupport encryptionSupportMode () {
219216 return encryption ;
220217 }
221218
0 commit comments