Updated Branches:
  refs/heads/no-more-premium [created] 0c7d14878

CLOUDSTACK-2037 Remove the premium configuration option

Remove (and fix) all dependencies on the isPremium function

Fixup PremiumSecondaryStorageResource and rename to
VmwareSecondaryStorageResource

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/0c7d1487
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/0c7d1487
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/0c7d1487

Branch: refs/heads/no-more-premium
Commit: 0c7d14878af72c8bbaabef301be11bd38832124e
Parents: 1adec81
Author: Hugo Trippaers <[email protected]>
Authored: Fri Apr 26 18:02:07 2013 +0200
Committer: Hugo Trippaers <[email protected]>
Committed: Fri Apr 26 18:02:07 2013 +0200

----------------------------------------------------------------------
 .../consoleproxy/ConsoleProxyResource.java         |    1 +
 client/tomcatconf/nonossComponentContext.xml.in    |    8 +-
 .../vmware/manager/VmwareManagerImpl.java          |    5 -
 .../resource/PremiumSecondaryStorageResource.java  |  107 ---------------
 .../resource/VmwareSecondaryStorageResource.java   |  107 +++++++++++++++
 .../VmwareSecondaryStorageResourceHandler.java     |    4 +-
 .../cloud/configuration/dao/ConfigurationDao.java  |    7 -
 .../configuration/dao/ConfigurationDaoImpl.java    |    9 --
 .../src/com/cloud/consoleproxy/AgentHookBase.java  |   25 ++--
 .../com/cloud/server/ConfigurationServerImpl.java  |    6 +-
 .../secondary/SecondaryStorageManagerImpl.java     |   19 +--
 .../cloud/vpc/dao/MockConfigurationDaoImpl.java    |    9 --
 .../src/com/cloud/consoleproxy/ConsoleProxy.java   |    1 +
 .../resource/SecondaryStorageDiscoverer.java       |   59 ++++-----
 14 files changed, 161 insertions(+), 206 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0c7d1487/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java
----------------------------------------------------------------------
diff --git 
a/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java 
b/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java
index 991764c..f8ae528 100644
--- a/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java
+++ b/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java
@@ -251,6 +251,7 @@ public class ConsoleProxyResource extends 
ServerResourceBase implements
             _properties.put(entry.getKey(), entry.getValue());
         }
 
+        // FIXME Premium reference
         String value = (String) params.get("premium");
         if (value != null && value.equals("premium"))
             _proxyPort = 443;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0c7d1487/client/tomcatconf/nonossComponentContext.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/nonossComponentContext.xml.in 
b/client/tomcatconf/nonossComponentContext.xml.in
index 2359ba8..a43dd95 100644
--- a/client/tomcatconf/nonossComponentContext.xml.in
+++ b/client/tomcatconf/nonossComponentContext.xml.in
@@ -52,13 +52,7 @@
   <!--
     DAO with customized configuration under non-OSS deployment
   -->
-  <bean id="configurationDaoImpl" 
class="com.cloud.configuration.dao.ConfigurationDaoImpl">
-    <property name="configParams">
-      <map>
-        <entry key="premium" value="true" />
-      </map>
-    </property>  
-  </bean>
+  <bean id="configurationDaoImpl" 
class="com.cloud.configuration.dao.ConfigurationDaoImpl"/ >  
 
   <!--
     VMware support components

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0c7d1487/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
 
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
index eb09af0..8c73bbe 100755
--- 
a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
+++ 
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
@@ -166,11 +166,6 @@ public class VmwareManagerImpl extends ManagerBase 
implements VmwareManager, Vmw
     public boolean configure(String name, Map<String, Object> params) throws 
ConfigurationException {
         s_logger.info("Configure VmwareManagerImpl, manager name: " + name);
 
-        if(!_configDao.isPremium()) {
-            s_logger.error("Vmware component can only run under premium 
distribution");
-            throw new ConfigurationException("Vmware component can only run 
under premium distribution");
-        }
-
         _instance = _configDao.getValue(Config.InstanceName.key());
         if (_instance == null) {
             _instance = "DEFAULT";

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0c7d1487/plugins/hypervisors/vmware/src/com/cloud/storage/resource/PremiumSecondaryStorageResource.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/PremiumSecondaryStorageResource.java
 
b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/PremiumSecondaryStorageResource.java
deleted file mode 100644
index 3966e02..0000000
--- 
a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/PremiumSecondaryStorageResource.java
+++ /dev/null
@@ -1,107 +0,0 @@
-// 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.resource;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.naming.ConfigurationException;
-
-import org.apache.cloudstack.storage.resource.NfsSecondaryStorageResource;
-import org.apache.cloudstack.storage.resource.SecondaryStorageResourceHandler;
-import org.apache.log4j.Logger;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-import com.cloud.hypervisor.Hypervisor;
-
-public class PremiumSecondaryStorageResource extends 
NfsSecondaryStorageResource {
-
-    private static final Logger s_logger = 
Logger.getLogger(PremiumSecondaryStorageResource.class);
-
-    private Map<Hypervisor.HypervisorType, SecondaryStorageResourceHandler> 
_handlers = new HashMap<Hypervisor.HypervisorType, 
SecondaryStorageResourceHandler>();
-    
-    private Map<String, String> _activeOutgoingAddresses = new HashMap<String, 
String>();
-       
-    @Override
-    public Answer executeRequest(Command cmd) {
-       String hypervisor = cmd.getContextParam("hypervisor");
-       if(hypervisor != null) {
-               Hypervisor.HypervisorType hypervisorType = 
Hypervisor.HypervisorType.getType(hypervisor);
-               if(hypervisorType == null) {
-                       s_logger.error("Unsupported hypervisor type in command 
context, hypervisor: " + hypervisor);
-                       return defaultAction(cmd);
-               }
-               
-               SecondaryStorageResourceHandler handler = 
getHandler(hypervisorType);
-               if(handler == null) {
-                       s_logger.error("No handler can be found for hypervisor 
type in command context, hypervisor: " + hypervisor);
-                       return defaultAction(cmd);
-               }
-               
-               return handler.executeRequest(cmd);
-       }
-
-        return defaultAction(cmd);
-    }
-    
-    public Answer defaultAction(Command cmd) {
-       return super.executeRequest(cmd);
-    }
-    
-    public void ensureOutgoingRuleForAddress(String address) {
-       if(address == null || address.isEmpty() || 
address.startsWith("0.0.0.0")) {
-               if(s_logger.isInfoEnabled())
-                       s_logger.info("Drop invalid dynamic route/firewall 
entry " + address);
-               return;
-       }
-       
-       boolean needToSetRule = false;
-       synchronized(_activeOutgoingAddresses) {
-               if(!_activeOutgoingAddresses.containsKey(address)) {
-                       _activeOutgoingAddresses.put(address, address);
-                       needToSetRule = true;
-               }
-       }
-       
-       if(needToSetRule) {
-               if(s_logger.isInfoEnabled())
-                       s_logger.info("Add dynamic route/firewall entry for " + 
address);
-               allowOutgoingOnPrivate(address);
-       }
-    }
-    
-    private void registerHandler(Hypervisor.HypervisorType hypervisorType, 
SecondaryStorageResourceHandler handler) {
-       _handlers.put(hypervisorType, handler);
-    }
-    
-    private SecondaryStorageResourceHandler 
getHandler(Hypervisor.HypervisorType hypervisorType) {
-       return _handlers.get(hypervisorType);
-    }
-    
-    @Override
-    public boolean configure(String name, Map<String, Object> params) throws 
ConfigurationException {
-       super.configure(name, params);
-
-       if(_inSystemVM) {
-               VmwareSecondaryStorageContextFactory.initFactoryEnvironment();
-       }
-       
-       registerHandler(Hypervisor.HypervisorType.VMware, new 
VmwareSecondaryStorageResourceHandler(this));
-       return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0c7d1487/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageResource.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageResource.java
 
b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageResource.java
new file mode 100644
index 0000000..1a3797e
--- /dev/null
+++ 
b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageResource.java
@@ -0,0 +1,107 @@
+// 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.resource;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.naming.ConfigurationException;
+
+import org.apache.cloudstack.storage.resource.NfsSecondaryStorageResource;
+import org.apache.cloudstack.storage.resource.SecondaryStorageResourceHandler;
+import org.apache.log4j.Logger;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+import com.cloud.hypervisor.Hypervisor;
+
+public class VmwareSecondaryStorageResource extends 
NfsSecondaryStorageResource {
+
+    private static final Logger s_logger = 
Logger.getLogger(VmwareSecondaryStorageResource.class);
+
+    private Map<Hypervisor.HypervisorType, SecondaryStorageResourceHandler> 
_handlers = new HashMap<Hypervisor.HypervisorType, 
SecondaryStorageResourceHandler>();
+    
+    private Map<String, String> _activeOutgoingAddresses = new HashMap<String, 
String>();
+       
+    @Override
+    public Answer executeRequest(Command cmd) {
+       String hypervisor = cmd.getContextParam("hypervisor");
+       if(hypervisor != null) {
+               Hypervisor.HypervisorType hypervisorType = 
Hypervisor.HypervisorType.getType(hypervisor);
+               if(hypervisorType == null) {
+                       s_logger.error("Unsupported hypervisor type in command 
context, hypervisor: " + hypervisor);
+                       return defaultAction(cmd);
+               }
+               
+               SecondaryStorageResourceHandler handler = 
getHandler(hypervisorType);
+               if(handler == null) {
+                       s_logger.error("No handler can be found for hypervisor 
type in command context, hypervisor: " + hypervisor);
+                       return defaultAction(cmd);
+               }
+               
+               return handler.executeRequest(cmd);
+       }
+
+        return defaultAction(cmd);
+    }
+    
+    public Answer defaultAction(Command cmd) {
+       return super.executeRequest(cmd);
+    }
+    
+    public void ensureOutgoingRuleForAddress(String address) {
+       if(address == null || address.isEmpty() || 
address.startsWith("0.0.0.0")) {
+               if(s_logger.isInfoEnabled())
+                       s_logger.info("Drop invalid dynamic route/firewall 
entry " + address);
+               return;
+       }
+       
+       boolean needToSetRule = false;
+       synchronized(_activeOutgoingAddresses) {
+               if(!_activeOutgoingAddresses.containsKey(address)) {
+                       _activeOutgoingAddresses.put(address, address);
+                       needToSetRule = true;
+               }
+       }
+       
+       if(needToSetRule) {
+               if(s_logger.isInfoEnabled())
+                       s_logger.info("Add dynamic route/firewall entry for " + 
address);
+               allowOutgoingOnPrivate(address);
+       }
+    }
+    
+    private void registerHandler(Hypervisor.HypervisorType hypervisorType, 
SecondaryStorageResourceHandler handler) {
+       _handlers.put(hypervisorType, handler);
+    }
+    
+    private SecondaryStorageResourceHandler 
getHandler(Hypervisor.HypervisorType hypervisorType) {
+       return _handlers.get(hypervisorType);
+    }
+    
+    @Override
+    public boolean configure(String name, Map<String, Object> params) throws 
ConfigurationException {
+       super.configure(name, params);
+
+       if(_inSystemVM) {
+               VmwareSecondaryStorageContextFactory.initFactoryEnvironment();
+       }
+       
+       registerHandler(Hypervisor.HypervisorType.VMware, new 
VmwareSecondaryStorageResourceHandler(this));
+       return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0c7d1487/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageResourceHandler.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageResourceHandler.java
 
b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageResourceHandler.java
index ce42f67..b790316 100644
--- 
a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageResourceHandler.java
+++ 
b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageResourceHandler.java
@@ -48,7 +48,7 @@ import com.vmware.vim25.ManagedObjectReference;
 public class VmwareSecondaryStorageResourceHandler implements 
SecondaryStorageResourceHandler, VmwareHostService, VmwareStorageMount {
     private static final Logger s_logger = 
Logger.getLogger(VmwareSecondaryStorageResourceHandler.class);
 
-    private final PremiumSecondaryStorageResource _resource;
+    private final VmwareSecondaryStorageResource _resource;
     private final VmwareStorageManager _storageMgr;
 
     private final Gson _gson;
@@ -57,7 +57,7 @@ public class VmwareSecondaryStorageResourceHandler implements 
SecondaryStorageRe
        private Map<String, HostMO> _activeHosts = new HashMap<String, 
HostMO>();
      */
 
-    public 
VmwareSecondaryStorageResourceHandler(PremiumSecondaryStorageResource resource) 
{
+    public 
VmwareSecondaryStorageResourceHandler(VmwareSecondaryStorageResource resource) {
         _resource = resource;
         _storageMgr = new VmwareStorageManagerImpl(this);
         _gson = GsonHelper.getGsonLogger();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0c7d1487/server/src/com/cloud/configuration/dao/ConfigurationDao.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/dao/ConfigurationDao.java 
b/server/src/com/cloud/configuration/dao/ConfigurationDao.java
index 2b09901..fd14773 100644
--- a/server/src/com/cloud/configuration/dao/ConfigurationDao.java
+++ b/server/src/com/cloud/configuration/dao/ConfigurationDao.java
@@ -54,13 +54,6 @@ public interface ConfigurationDao extends 
GenericDao<ConfigurationVO, String> {
     
     public String getValueAndInitIfNotExist(String name, String category, 
String initValue);
     
-
-    /**
-     * returns whether or not this is a premium configuration
-     * @return true if premium configuration, false otherwise
-     */
-    boolean isPremium();
-    
     ConfigurationVO findByName(String name);
 
        boolean update(String name, String category, String value);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0c7d1487/server/src/com/cloud/configuration/dao/ConfigurationDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/dao/ConfigurationDaoImpl.java 
b/server/src/com/cloud/configuration/dao/ConfigurationDaoImpl.java
index fe5f5ae..1e59f5e 100644
--- a/server/src/com/cloud/configuration/dao/ConfigurationDaoImpl.java
+++ b/server/src/com/cloud/configuration/dao/ConfigurationDaoImpl.java
@@ -44,7 +44,6 @@ import com.cloud.utils.exception.CloudRuntimeException;
 public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, 
String> implements ConfigurationDao {
     private static final Logger s_logger = 
Logger.getLogger(ConfigurationDaoImpl.class);
     private Map<String, String> _configs = null;
-    private boolean _premium;
 
     final SearchBuilder<ConfigurationVO> InstanceSearch;
     final SearchBuilder<ConfigurationVO> NameSearch;
@@ -61,11 +60,6 @@ public class ConfigurationDaoImpl extends 
GenericDaoBase<ConfigurationVO, String
     }
 
     @Override
-    public boolean isPremium() {
-        return _premium;
-    }
-    
-    @Override
     public void invalidateCache() {
        _configs = null;
     }
@@ -124,9 +118,6 @@ public class ConfigurationDaoImpl extends 
GenericDaoBase<ConfigurationVO, String
        public boolean configure(String name, Map<String, Object> params) 
throws ConfigurationException {
        super.configure(name, params);
 
-       Object premium = params.get("premium");
-        _premium = (premium != null) && ((String) premium).equals("true");
-
         return true;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0c7d1487/server/src/com/cloud/consoleproxy/AgentHookBase.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/consoleproxy/AgentHookBase.java 
b/server/src/com/cloud/consoleproxy/AgentHookBase.java
index 2748a8c..68fc8e4 100644
--- a/server/src/com/cloud/consoleproxy/AgentHookBase.java
+++ b/server/src/com/cloud/consoleproxy/AgentHookBase.java
@@ -196,22 +196,19 @@ public abstract class AgentHookBase implements AgentHook {
 
     public void startAgentHttpHandlerInVM(StartupProxyCommand startupCmd) {
         StartConsoleProxyAgentHttpHandlerCommand cmd = null;
-        if (_configDao.isPremium()) {
-            String storePassword = String.valueOf(_random.nextLong());
-            byte[] ksBits =
-                    
_ksMgr.getKeystoreBits(ConsoleProxyManager.CERTIFICATE_NAME, 
ConsoleProxyManager.CERTIFICATE_NAME,
-                            storePassword);
-
-            assert (ksBits != null);
-            if (ksBits == null) {
-                s_logger.error("Could not find and construct a valid SSL 
certificate");
-            }
-            cmd = new StartConsoleProxyAgentHttpHandlerCommand(ksBits, 
storePassword);
-            cmd.setEncryptorPassword(getEncryptorPassword());
-        } else {
+        String storePassword = String.valueOf(_random.nextLong());
+        byte[] ksBits =
+                _ksMgr.getKeystoreBits(ConsoleProxyManager.CERTIFICATE_NAME, 
ConsoleProxyManager.CERTIFICATE_NAME,
+                        storePassword);
+
+        if (ksBits == null) {
+            s_logger.warn("Could not find and construct a valid SSL 
certificate");
             cmd = new StartConsoleProxyAgentHttpHandlerCommand();
-            cmd.setEncryptorPassword(getEncryptorPassword());
         }
+        else {
+            cmd = new StartConsoleProxyAgentHttpHandlerCommand(ksBits, 
storePassword);
+        }
+        cmd.setEncryptorPassword(getEncryptorPassword());
 
         try {
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0c7d1487/server/src/com/cloud/server/ConfigurationServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java 
b/server/src/com/cloud/server/ConfigurationServerImpl.java
index cd890ce..bbf9cd1 100755
--- a/server/src/com/cloud/server/ConfigurationServerImpl.java
+++ b/server/src/com/cloud/server/ConfigurationServerImpl.java
@@ -166,9 +166,9 @@ public class ConfigurationServerImpl extends ManagerBase 
implements Configuratio
             // Save default Configuration Table values
             List<String> categories = Config.getCategories();
             for (String category : categories) {
-                // If this is not a premium environment, don't insert premium 
configuration values
-                if (!_configDao.isPremium() && category.equals("Premium")) {
-                    continue;
+                // TODO This should go once finished with premium cleanup
+                if (category.equals("Premium")) {
+                    s_logger.debug ("Config found with category premium, 
please fix..");
                 }
 
                 List<Config> configs = Config.getConfigs(category);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0c7d1487/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
----------------------------------------------------------------------
diff --git 
a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java 
b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
index 3cf9a7e..1e84887 100755
--- a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
+++ b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
@@ -1055,20 +1055,17 @@ public class SecondaryStorageManagerImpl extends 
ManagerBase implements Secondar
 
         buf.append(" guid=").append(profile.getVirtualMachine().getHostName());
 
-        if (_configDao.isPremium()) {
-            if (profile.getHypervisorType() == HypervisorType.Hyperv) {
-               s_logger.debug("Hyperv hypervisor configured, telling the ssvm 
to load the CifsSecondaryStorageResource");
-                buf.append(" 
resource=com.cloud.storage.resource.CifsSecondaryStorageResource");
-            } else if (profile.getHypervisorType() == HypervisorType.VMware) {
-               s_logger.debug("VmWare hypervisor configured, telling the ssvm 
to load the PremiumSecondaryStorageResource");
-               buf.append(" 
resource=com.cloud.storage.resource.PremiumSecondaryStorageResource");
-            } else {
-               s_logger.debug("Telling the ssvm to load the 
NfsSecondaryStorageResource");
-                buf.append(" 
resource=org.apache.cloudstack.storage.resource.NfsSecondaryStorageResource");
-            }
+        if (profile.getHypervisorType() == HypervisorType.Hyperv) {
+               s_logger.debug("Hyperv hypervisor configured, telling the ssvm 
to load the CifsSecondaryStorageResource");
+            buf.append(" 
resource=com.cloud.storage.resource.CifsSecondaryStorageResource");
+        } else if (profile.getHypervisorType() == HypervisorType.VMware) {
+               s_logger.debug("VmWare hypervisor configured, telling the ssvm 
to load the VmwareSecondaryStorageResource");
+               buf.append(" 
resource=com.cloud.storage.resource.VmwareSecondaryStorageResource");
         } else {
+               s_logger.debug("Telling the ssvm to load the 
NfsSecondaryStorageResource");
             buf.append(" 
resource=org.apache.cloudstack.storage.resource.NfsSecondaryStorageResource");
         }
+
         buf.append(" instance=SecStorage");
         buf.append(" sslcopy=").append(Boolean.toString(_useSSlCopy));
         buf.append(" 
role=").append(profile.getVirtualMachine().getRole().toString());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0c7d1487/server/test/com/cloud/vpc/dao/MockConfigurationDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/dao/MockConfigurationDaoImpl.java 
b/server/test/com/cloud/vpc/dao/MockConfigurationDaoImpl.java
index 4322c32..5973c05 100644
--- a/server/test/com/cloud/vpc/dao/MockConfigurationDaoImpl.java
+++ b/server/test/com/cloud/vpc/dao/MockConfigurationDaoImpl.java
@@ -81,15 +81,6 @@ public class MockConfigurationDaoImpl  extends 
GenericDaoBase<ConfigurationVO, S
     }
 
     /* (non-Javadoc)
-     * @see com.cloud.configuration.dao.ConfigurationDao#isPremium()
-     */
-    @Override
-    public boolean isPremium() {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    /* (non-Javadoc)
      * @see 
com.cloud.configuration.dao.ConfigurationDao#findByName(java.lang.String)
      */
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0c7d1487/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxy.java
----------------------------------------------------------------------
diff --git 
a/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxy.java 
b/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxy.java
index 2abce56..4db4e81 100644
--- a/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxy.java
+++ b/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxy.java
@@ -130,6 +130,7 @@ public class ConsoleProxy {
             s_logger.info("Setting httpListenPort=" + s);
         }
         
+        // FIXME Premium reference
         s = conf.getProperty("premium");
         if(s != null && s.equalsIgnoreCase("true")) {
             s_logger.info("Premium setting will override settings from 
consoleproxy.properties, listen at port 443");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0c7d1487/services/secondary-storage/src/org/apache/cloudstack/storage/resource/SecondaryStorageDiscoverer.java
----------------------------------------------------------------------
diff --git 
a/services/secondary-storage/src/org/apache/cloudstack/storage/resource/SecondaryStorageDiscoverer.java
 
b/services/secondary-storage/src/org/apache/cloudstack/storage/resource/SecondaryStorageDiscoverer.java
index d3af792..6084c07 100755
--- 
a/services/secondary-storage/src/org/apache/cloudstack/storage/resource/SecondaryStorageDiscoverer.java
+++ 
b/services/secondary-storage/src/org/apache/cloudstack/storage/resource/SecondaryStorageDiscoverer.java
@@ -138,39 +138,34 @@ public class SecondaryStorageDiscoverer extends 
DiscovererBase implements Discov
         
         Map<NfsSecondaryStorageResource, Map<String, String>> srs = new 
HashMap<NfsSecondaryStorageResource, Map<String, String>>();
         
-        NfsSecondaryStorageResource storage;
-        if(_configDao.isPremium()) {
-            Class<?> impl;
-            String name = 
"com.cloud.storage.resource.PremiumSecondaryStorageResource";
-            try {
-                impl = Class.forName(name);
-                final Constructor<?> constructor = 
impl.getDeclaredConstructor();
-                constructor.setAccessible(true);
-                storage = 
(NfsSecondaryStorageResource)constructor.newInstance();
-            } catch (final ClassNotFoundException e) {
-               s_logger.error("Unable to load 
com.cloud.storage.resource.PremiumSecondaryStorageResource due to 
ClassNotFoundException");
-               return null;
-            } catch (final SecurityException e) {
-               s_logger.error("Unable to load 
com.cloud.storage.resource.PremiumSecondaryStorageResource due to 
SecurityException");
-               return null;
-            } catch (final NoSuchMethodException e) {
-               s_logger.error("Unable to load 
com.cloud.storage.resource.PremiumSecondaryStorageResource due to 
NoSuchMethodException");
-               return null;
-            } catch (final IllegalArgumentException e) {
-               s_logger.error("Unable to load 
com.cloud.storage.resource.PremiumSecondaryStorageResource due to 
IllegalArgumentException");
-               return null;
-            } catch (final InstantiationException e) {
-               s_logger.error("Unable to load 
com.cloud.storage.resource.PremiumSecondaryStorageResource due to 
InstantiationException");
-               return null;
-            } catch (final IllegalAccessException e) {
-               s_logger.error("Unable to load 
com.cloud.storage.resource.PremiumSecondaryStorageResource due to 
IllegalAccessException");
-               return null;
-            } catch (final InvocationTargetException e) {
-               s_logger.error("Unable to load 
com.cloud.storage.resource.PremiumSecondaryStorageResource due to 
InvocationTargetException");
-               return null;
+        NfsSecondaryStorageResource storage = null;
+
+        Class<?> impl;
+        String name = 
"com.cloud.storage.resource.VmwareSecondaryStorageResource";
+        try {
+            impl = Class.forName(name);
+            final Constructor<?> constructor = impl.getDeclaredConstructor();
+            constructor.setAccessible(true);
+            storage = (NfsSecondaryStorageResource)constructor.newInstance();
+        } catch (final ClassNotFoundException e) {
+               s_logger.error("Unable to load 
com.cloud.storage.resource.VmwareSecondaryStorageResource due to 
ClassNotFoundException");
+        } catch (final SecurityException e) {
+               s_logger.error("Unable to load 
com.cloud.storage.resource.VmwareSecondaryStorageResource due to 
SecurityException");
+        } catch (final NoSuchMethodException e) {
+               s_logger.error("Unable to load 
com.cloud.storage.resource.VmwareSecondaryStorageResource due to 
NoSuchMethodException");
+        } catch (final IllegalArgumentException e) {
+               s_logger.error("Unable to load 
com.cloud.storage.resource.VmwareSecondaryStorageResource due to 
IllegalArgumentException");
+        } catch (final InstantiationException e) {
+               s_logger.error("Unable to load 
com.cloud.storage.resource.VmwareSecondaryStorageResource due to 
InstantiationException");
+        } catch (final IllegalAccessException e) {
+               s_logger.error("Unable to load 
com.cloud.storage.resource.VmwareSecondaryStorageResource due to 
IllegalAccessException");
+        } catch (final InvocationTargetException e) {
+               s_logger.error("Unable to load 
com.cloud.storage.resource.VmwareSecondaryStorageResource due to 
InvocationTargetException");
+        } finally {
+            if (storage == null) {
+                s_logger.debug("Enable to load the 
VmwareSecondaryStorageResource, falling back to NfsSecondaryStorageResource");
+                storage = new NfsSecondaryStorageResource();
             }
-        } else {
-               storage = new NfsSecondaryStorageResource();
         }
         
         Map<String, String> details = new HashMap<String, String>();

Reply via email to