You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2017/12/12 15:27:25 UTC

[GitHub] rhtyd closed pull request #2356: CLOUDSTACK-8313: Support overprovisioning for local storage

rhtyd closed pull request #2356: CLOUDSTACK-8313: Support overprovisioning for local storage
URL: https://github.com/apache/cloudstack/pull/2356
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/api/src/com/cloud/storage/Storage.java b/api/src/com/cloud/storage/Storage.java
index ef872835779..f588aeaf4b3 100644
--- a/api/src/com/cloud/storage/Storage.java
+++ b/api/src/com/cloud/storage/Storage.java
@@ -117,27 +117,29 @@ public static ProvisioningType getProvisioningType(String provisioningType){
     }
 
     public static enum StoragePoolType {
-        Filesystem(false), // local directory
-        NetworkFilesystem(true), // NFS
-        IscsiLUN(true), // shared LUN, with a clusterfs overlay
-        Iscsi(true), // for e.g., ZFS Comstar
-        ISO(false), // for iso image
-        LVM(false), // XenServer local LVM SR
-        CLVM(true),
-        RBD(true), // http://libvirt.org/storage.html#StorageBackendRBD
-        SharedMountPoint(true),
-        VMFS(true), // VMware VMFS storage
-        PreSetup(true), // for XenServer, Storage Pool is set up by customers.
-        EXT(false), // XenServer local EXT SR
-        OCFS2(true),
-        SMB(true),
-        Gluster(true),
-        ManagedNFS(true);
-
-        boolean shared;
-
-        StoragePoolType(boolean shared) {
+        Filesystem(false, true), // local directory
+        NetworkFilesystem(true, true), // NFS
+        IscsiLUN(true, false), // shared LUN, with a clusterfs overlay
+        Iscsi(true, false), // for e.g., ZFS Comstar
+        ISO(false, false), // for iso image
+        LVM(false, false), // XenServer local LVM SR
+        CLVM(true, false),
+        RBD(true, true), // http://libvirt.org/storage.html#StorageBackendRBD
+        SharedMountPoint(true, false),
+        VMFS(true, true), // VMware VMFS storage
+        PreSetup(true, true), // for XenServer, Storage Pool is set up by customers.
+        EXT(false, true), // XenServer local EXT SR
+        OCFS2(true, false),
+        SMB(true, false),
+        Gluster(true, false),
+        ManagedNFS(true, false);
+
+        private final boolean shared;
+        private final boolean overprovisioning;
+
+        StoragePoolType(boolean shared, boolean overprovisioning) {
             this.shared = shared;
+            this.overprovisioning = overprovisioning;
         }
 
         public boolean isShared() {
@@ -145,7 +147,7 @@ public boolean isShared() {
         }
 
         public boolean supportsOverProvisioning() {
-            return this == StoragePoolType.NetworkFilesystem || this == StoragePoolType.VMFS || this == StoragePoolType.PreSetup || this == StoragePoolType.EXT;
+            return overprovisioning;
         }
     }
 
diff --git a/api/test/com/cloud/storage/StorageTest.java b/api/test/com/cloud/storage/StorageTest.java
new file mode 100644
index 00000000000..332a8060d08
--- /dev/null
+++ b/api/test/com/cloud/storage/StorageTest.java
@@ -0,0 +1,70 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.storage;
+
+import com.cloud.storage.Storage.StoragePoolType;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class StorageTest {
+    @Before
+    public void setUp() {
+    }
+
+    @Test
+    public void isSharedStoragePool() {
+        Assert.assertFalse(StoragePoolType.Filesystem.isShared());
+        Assert.assertTrue(StoragePoolType.NetworkFilesystem.isShared());
+        Assert.assertTrue(StoragePoolType.IscsiLUN.isShared());
+        Assert.assertTrue(StoragePoolType.Iscsi.isShared());
+        Assert.assertFalse(StoragePoolType.ISO.isShared());
+        Assert.assertTrue(StoragePoolType.Iscsi.isShared());
+        Assert.assertFalse(StoragePoolType.LVM.isShared());
+        Assert.assertTrue(StoragePoolType.CLVM.isShared());
+        Assert.assertTrue(StoragePoolType.RBD.isShared());
+        Assert.assertTrue(StoragePoolType.SharedMountPoint.isShared());
+        Assert.assertTrue(StoragePoolType.VMFS.isShared());
+        Assert.assertTrue(StoragePoolType.PreSetup.isShared());
+        Assert.assertFalse(StoragePoolType.EXT.isShared());
+        Assert.assertTrue(StoragePoolType.OCFS2.isShared());
+        Assert.assertTrue(StoragePoolType.SMB.isShared());
+        Assert.assertTrue(StoragePoolType.Gluster.isShared());
+        Assert.assertTrue(StoragePoolType.ManagedNFS.isShared());
+    }
+
+    @Test
+    public void supportsOverprovisioningStoragePool() {
+        Assert.assertTrue(StoragePoolType.Filesystem.supportsOverProvisioning());
+        Assert.assertTrue(StoragePoolType.NetworkFilesystem.supportsOverProvisioning());
+        Assert.assertFalse(StoragePoolType.IscsiLUN.supportsOverProvisioning());
+        Assert.assertFalse(StoragePoolType.Iscsi.supportsOverProvisioning());
+        Assert.assertFalse(StoragePoolType.ISO.supportsOverProvisioning());
+        Assert.assertFalse(StoragePoolType.Iscsi.supportsOverProvisioning());
+        Assert.assertFalse(StoragePoolType.LVM.supportsOverProvisioning());
+        Assert.assertFalse(StoragePoolType.CLVM.supportsOverProvisioning());
+        Assert.assertTrue(StoragePoolType.RBD.supportsOverProvisioning());
+        Assert.assertFalse(StoragePoolType.SharedMountPoint.supportsOverProvisioning());
+        Assert.assertTrue(StoragePoolType.VMFS.supportsOverProvisioning());
+        Assert.assertTrue(StoragePoolType.PreSetup.supportsOverProvisioning());
+        Assert.assertTrue(StoragePoolType.EXT.supportsOverProvisioning());
+        Assert.assertFalse(StoragePoolType.OCFS2.supportsOverProvisioning());
+        Assert.assertFalse(StoragePoolType.SMB.supportsOverProvisioning());
+        Assert.assertFalse(StoragePoolType.Gluster.supportsOverProvisioning());
+        Assert.assertFalse(StoragePoolType.ManagedNFS.supportsOverProvisioning());
+    }
+}


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services