incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prachida...@apache.org
Subject [11/14] git commit: Removing BareMetalService referrences. We will load UserVMService by default.
Date Tue, 22 Jan 2013 21:19:38 GMT
Removing BareMetalService referrences. We will load UserVMService by default.


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

Branch: refs/heads/javelin
Commit: 1cb0ce44dff61ef385359da805df19d5ca0f91fa
Parents: 434c21a
Author: Prachi Damle <prachi@cloud.com>
Authored: Tue Jan 22 12:47:32 2013 -0800
Committer: Prachi Damle <prachi@cloud.com>
Committed: Tue Jan 22 12:54:20 2013 -0800

----------------------------------------------------------------------
 api/src/com/cloud/vm/VirtualMachine.java           |    2 +-
 api/src/org/apache/cloudstack/api/BaseCmd.java     |    1 -
 .../command/user/template/CreateTemplateCmd.java   |   28 ++++-------
 .../api/command/user/vm/DeployVMCmd.java           |   38 ++++++---------
 .../api/command/user/vm/DestroyVMCmd.java          |    6 +--
 .../api/command/user/vm/RebootVMCmd.java           |    6 +--
 .../cloudstack/api/command/user/vm/StartVMCmd.java |    6 +--
 .../cloudstack/api/command/user/vm/StopVMCmd.java  |    6 +--
 client/tomcatconf/componentContext.xml.in          |    3 +-
 setup/db/4.1-new-db-schema.sql                     |    9 +++-
 10 files changed, 39 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1cb0ce44/api/src/com/cloud/vm/VirtualMachine.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/VirtualMachine.java b/api/src/com/cloud/vm/VirtualMachine.java
index 83f1612..248b982 100755
--- a/api/src/com/cloud/vm/VirtualMachine.java
+++ b/api/src/com/cloud/vm/VirtualMachine.java
@@ -257,7 +257,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity,
I
     /**
      * @return data center id.
      */
-    public long getDataCenterIdToDeployIn();
+    public long getDataCenterId();
 
     /**
      * @return id of the host it was assigned last time.

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1cb0ce44/api/src/org/apache/cloudstack/api/BaseCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseCmd.java b/api/src/org/apache/cloudstack/api/BaseCmd.java
index 86aa6e1..6a166ba 100644
--- a/api/src/org/apache/cloudstack/api/BaseCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseCmd.java
@@ -111,7 +111,6 @@ public abstract class BaseCmd {
     @Inject public AutoScaleService _autoScaleService;
     @Inject public LoadBalancingRulesService _lbService;
     @Inject public RemoteAccessVpnService _ravService;
-    @Inject public BareMetalVmService _bareMetalVmService;
     @Inject public ProjectService _projectService;
     @Inject public FirewallService _firewallService;
     @Inject public DomainService _domainService;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1cb0ce44/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
b/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
index 5cb2107..84fa197 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
@@ -239,33 +239,23 @@ import com.cloud.user.UserContext;
 
     @Override
     public void create() throws ResourceAllocationException {
-        if (isBareMetal()) {
-            _bareMetalVmService.createPrivateTemplateRecord(this, _accountService.getAccount(getEntityOwnerId()));
-            /*Baremetal creates template record after taking image proceeded, use vmId as
entity id and uuid here*/
-            this.setEntityId(vmId);
-            this.setEntityUuid(vmId.toString());
+        VirtualMachineTemplate template = null;
+        template = _userVmService.createPrivateTemplateRecord(this, _accountService.getAccount(getEntityOwnerId()));
+        if (template != null) {
+            this.setEntityId(template.getId());
+            this.setEntityUuid(template.getUuid());
         } else {
-            VirtualMachineTemplate template = null;
-            template = _userVmService.createPrivateTemplateRecord(this, _accountService.getAccount(getEntityOwnerId()));
-            if (template != null) {
-                this.setEntityId(template.getId());
-                this.setEntityUuid(template.getUuid());
-            } else {
-                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,
-                "Failed to create a template");
-            }
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,
+            "Failed to create a template");
         }
+
     }
 
     @Override
     public void execute() {
         UserContext.current().setEventDetails("Template Id: "+getEntityId()+((getSnapshotId()
== null) ? " from volume Id: " + getVolumeId() : " from snapshot Id: " + getSnapshotId()));
         VirtualMachineTemplate template = null;
-        if (isBareMetal()) {
-            template = _bareMetalVmService.createPrivateTemplate(this);
-        } else {
-            template = _userVmService.createPrivateTemplate(this);
-        }
+        template = _userVmService.createPrivateTemplate(this);
 
         if (template != null){
             List<TemplateResponse> templateResponses;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1cb0ce44/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
index 0ef8092..0568cfa 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
@@ -361,11 +361,7 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
         if (getStartVm()) {
             try {
                 UserContext.current().setEventDetails("Vm Id: "+getEntityId());
-                if (getHypervisor() == HypervisorType.BareMetal) {
-                    result = _bareMetalVmService.startVirtualMachine(this);
-                } else {
-                    result = _userVmService.startVirtualMachine(this);
-                }
+                result = _userVmService.startVirtualMachine(this);
             } catch (ResourceUnavailableException ex) {
                 s_logger.warn("Exception: ", ex);
                 throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
@@ -430,27 +426,23 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
             }
 
             UserVm vm = null;
-            if (getHypervisor() == HypervisorType.BareMetal) {
-                vm = _bareMetalVmService.createVirtualMachine(this);
+            if (zone.getNetworkType() == NetworkType.Basic) {
+                if (getNetworkIds() != null) {
+                    throw new InvalidParameterValueException("Can't specify network Ids in
Basic zone");
+                } else {
+                    vm = _userVmService.createBasicSecurityGroupVirtualMachine(zone, serviceOffering,
template, getSecurityGroupIdList(), owner, name,
+                            displayName, diskOfferingId, size, group, getHypervisor(), userData,
sshKeyPairName, getIpToNetworkMap(), ipAddress, keyboard);
+                }
             } else {
-                if (zone.getNetworkType() == NetworkType.Basic) {
-                    if (getNetworkIds() != null) {
-                        throw new InvalidParameterValueException("Can't specify network Ids
in Basic zone");
-                    } else {
-                        vm = _userVmService.createBasicSecurityGroupVirtualMachine(zone,
serviceOffering, template, getSecurityGroupIdList(), owner, name,
-                                displayName, diskOfferingId, size, group, getHypervisor(),
userData, sshKeyPairName, getIpToNetworkMap(), ipAddress, keyboard);
-                    }
+                if (zone.isSecurityGroupEnabled())  {
+                    vm = _userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering,
template, getNetworkIds(), getSecurityGroupIdList(),
+                            owner, name, displayName, diskOfferingId, size, group, getHypervisor(),
userData, sshKeyPairName, getIpToNetworkMap(), ipAddress, keyboard);
                 } else {
-                    if (zone.isSecurityGroupEnabled())  {
-                        vm = _userVmService.createAdvancedSecurityGroupVirtualMachine(zone,
serviceOffering, template, getNetworkIds(), getSecurityGroupIdList(),
-                                owner, name, displayName, diskOfferingId, size, group, getHypervisor(),
userData, sshKeyPairName, getIpToNetworkMap(), ipAddress, keyboard);
-                    } else {
-                        if (getSecurityGroupIdList() != null && !getSecurityGroupIdList().isEmpty())
{
-                            throw new InvalidParameterValueException("Can't create vm with
security groups; security group feature is not enabled per zone");
-                        }
-                        vm = _userVmService.createAdvancedVirtualMachine(zone, serviceOffering,
template, getNetworkIds(), owner, name, displayName,
-                                diskOfferingId, size, group, getHypervisor(), userData, sshKeyPairName,
getIpToNetworkMap(), ipAddress, keyboard);
+                    if (getSecurityGroupIdList() != null && !getSecurityGroupIdList().isEmpty())
{
+                        throw new InvalidParameterValueException("Can't create vm with security
groups; security group feature is not enabled per zone");
                     }
+                    vm = _userVmService.createAdvancedVirtualMachine(zone, serviceOffering,
template, getNetworkIds(), owner, name, displayName,
+                            diskOfferingId, size, group, getHypervisor(), userData, sshKeyPairName,
getIpToNetworkMap(), ipAddress, keyboard);
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1cb0ce44/api/src/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java
index a8b4184..567768d 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java
@@ -97,11 +97,7 @@ public class DestroyVMCmd extends BaseAsyncCmd {
     public void execute() throws ResourceUnavailableException, ConcurrentOperationException{
         UserContext.current().setEventDetails("Vm Id: "+getId());
         UserVm result;
-        if (_userVmService.getHypervisorTypeOfUserVM(getId()) == HypervisorType.BareMetal)
{
-            result = _bareMetalVmService.destroyVm(this);
-        } else {
-            result = _userVmService.destroyVm(this);
-        }
+        result = _userVmService.destroyVm(this);
 
         if (result != null) {
             UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine",
result).get(0);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1cb0ce44/api/src/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java
index c8f8c71..6838b96 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java
@@ -96,11 +96,7 @@ public class RebootVMCmd extends BaseAsyncCmd {
     public void execute() throws ResourceUnavailableException, InsufficientCapacityException{
         UserContext.current().setEventDetails("Vm Id: "+getId());
         UserVm result;
-        if (_userVmService.getHypervisorTypeOfUserVM(getId()) == HypervisorType.BareMetal)
{
-            result = _bareMetalVmService.rebootVirtualMachine(this);
-        } else {
-            result = _userVmService.rebootVirtualMachine(this);
-        }
+        result = _userVmService.rebootVirtualMachine(this);
 
         if (result !=null){
             UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine",
result).get(0);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1cb0ce44/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java
index ad7c91f..3012780 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java
@@ -117,11 +117,7 @@ public class StartVMCmd extends BaseAsyncCmd {
             UserContext.current().setEventDetails("Vm Id: " + getId());
 
             UserVm result ;
-            if (_userVmService.getHypervisorTypeOfUserVM(getId()) == HypervisorType.BareMetal)
{
-                result = _bareMetalVmService.startVirtualMachine(this);
-            } else {
-                result = _userVmService.startVirtualMachine(this);
-            }
+            result = _userVmService.startVirtualMachine(this);
 
             if (result != null) {
                 UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine",
result).get(0);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1cb0ce44/api/src/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java
index d558bb5..d66c334 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java
@@ -114,11 +114,7 @@ public class StopVMCmd extends BaseAsyncCmd {
         UserContext.current().setEventDetails("Vm Id: " + getId());
         UserVm result;
 
-        if (_userVmService.getHypervisorTypeOfUserVM(getId()) == HypervisorType.BareMetal)
{
-            result = _bareMetalVmService.stopVirtualMachine(getId(), isForced());
-        } else {
-            result = _userVmService.stopVirtualMachine(getId(), isForced());
-        }
+        result = _userVmService.stopVirtualMachine(getId(), isForced());
 
         if (result != null) {
             UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine",
result).get(0);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1cb0ce44/client/tomcatconf/componentContext.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/componentContext.xml.in b/client/tomcatconf/componentContext.xml.in
index 782dfe0..07ae89d 100644
--- a/client/tomcatconf/componentContext.xml.in
+++ b/client/tomcatconf/componentContext.xml.in
@@ -43,7 +43,8 @@
   <bean id="clusteredAgentManagerImpl" class="com.cloud.agent.manager.ClusteredAgentManagerImpl"
/>
   <bean id="clusteredVirtualMachineManagerImpl" class="com.cloud.vm.ClusteredVirtualMachineManagerImpl"
/>
   <bean id="highAvailabilityManagerExtImpl" class="com.cloud.ha.HighAvailabilityManagerExtImpl"
/>
-  <bean id="bareMetalVmManagerImpl" class="com.cloud.baremetal.BareMetalVmManagerImpl"
/>
+  <!-- bean id="bareMetalVmManagerImpl" class="com.cloud.baremetal.BareMetalVmManagerImpl"
/ -->
+  <bean id="userVmManagerImpl" class="com.cloud.vm.UserVmManagerImpl" />
   <bean id="consoleProxyManagerImpl" class="com.cloud.consoleproxy.ConsoleProxyManagerImpl"
/>
   <bean id="securityGroupManagerImpl2" class="com.cloud.network.security.SecurityGroupManagerImpl2"
/>
   <bean id="premiumSecondaryStorageManagerImpl" class="com.cloud.secstorage.PremiumSecondaryStorageManagerImpl"
/>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1cb0ce44/setup/db/4.1-new-db-schema.sql
----------------------------------------------------------------------
diff --git a/setup/db/4.1-new-db-schema.sql b/setup/db/4.1-new-db-schema.sql
index 175b97d..fb80920 100644
--- a/setup/db/4.1-new-db-schema.sql
+++ b/setup/db/4.1-new-db-schema.sql
@@ -24,6 +24,13 @@ alter table template_spool_ref add update_count bigint unsigned;
 alter table volumes add disk_type varchar(255);
 alter table volumes drop foreign key `fk_volumes__account_id`;
 alter table vm_instance add column disk_offering_id bigint unsigned;
+alter table vm_instance add column cpu int(10) unsigned;
+alter table vm_instance add column ram bigint unsigned;
+alter table vm_instance add column owner varchar(255);
+alter table vm_instance add column speed int(10) unsigned;
+alter table vm_instance add column host_name varchar(255);
+alter table vm_instance add column display_name varchar(255);
+
 alter table data_center add column owner varchar(255);
 alter table data_center add column created datetime COMMENT 'date created';
 alter table data_center add column lastUpdated datetime COMMENT 'last updated';
@@ -90,7 +97,7 @@ CREATE TABLE `cloud`.`vm_reservation` (
   `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
   `uuid` varchar(40) NOT NULL COMMENT 'reservation id',
   `vm_id` bigint unsigned NOT NULL COMMENT 'vm id',
-  `datacenter_id` bigint unsigned NOT NULL COMMENT 'zone id',
+  `data_center_id` bigint unsigned NOT NULL COMMENT 'zone id',
   `pod_id` bigint unsigned NOT NULL COMMENT 'pod id',
   `cluster_id` bigint unsigned NOT NULL COMMENT 'cluster id',
   `host_id` bigint unsigned NOT NULL COMMENT 'host id',


Mime
View raw message