You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ch...@apache.org on 2013/05/11 19:26:58 UTC

[1/2] git commit: updated refs/heads/4.1 to a86e53d

Updated Branches:
  refs/heads/4.1 840bf2eda -> a86e53d18


CLOUDSTACK-2309: Add fix to handle Vmware 4.0 template upgrade


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

Branch: refs/heads/4.1
Commit: a3b5980510da8edabb34e1ff6c1dbc56b48c0a59
Parents: 1cef9a4
Author: Kishan Kavala <ki...@cloud.com>
Authored: Fri May 10 17:27:10 2013 +0530
Committer: Chip Childers <ch...@gmail.com>
Committed: Sat May 11 18:26:11 2013 +0100

----------------------------------------------------------------------
 .../src/com/cloud/upgrade/dao/Upgrade302to40.java  |   51 ++++++++++++++-
 1 files changed, 50 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a3b59805/server/src/com/cloud/upgrade/dao/Upgrade302to40.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/upgrade/dao/Upgrade302to40.java b/server/src/com/cloud/upgrade/dao/Upgrade302to40.java
index 753f64e..ecda872 100644
--- a/server/src/com/cloud/upgrade/dao/Upgrade302to40.java
+++ b/server/src/com/cloud/upgrade/dao/Upgrade302to40.java
@@ -63,6 +63,7 @@ public class Upgrade302to40 extends Upgrade30xBase implements DbUpgrade {
 
     @Override
     public void performDataMigration(Connection conn) {
+        updateVmWareSystemVms(conn);
         correctVRProviders(conn);
         correctMultiplePhysicaNetworkSetups(conn);
         addHostDetailsUniqueKey(conn);
@@ -82,7 +83,55 @@ public class Upgrade302to40 extends Upgrade30xBase implements DbUpgrade {
 
         return new File[] { new File(script) };
     }
-    
+
+    private void updateVmWareSystemVms(Connection conn){
+        PreparedStatement pstmt = null;
+        ResultSet rs = null;
+        boolean VMware = false;
+        try {
+            pstmt = conn.prepareStatement("select distinct(hypervisor_type) from `cloud`.`cluster` where removed is null");
+            rs = pstmt.executeQuery();
+            while(rs.next()){
+                if("VMware".equals(rs.getString(1))){
+                    VMware = true;
+                }
+            }
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("Error while iterating through list of hypervisors in use", e);
+        }
+        // Just update the VMware system template. Other hypervisor templates are unchanged from previous 3.0.x versions.
+        s_logger.debug("Updating VMware System Vms");
+        try {
+            //Get 4.0 VMware system Vm template Id
+            pstmt = conn.prepareStatement("select id from `cloud`.`vm_template` where name = 'systemvm-vmware-4.0' and removed is null");
+            rs = pstmt.executeQuery();
+            if(rs.next()){
+                long templateId = rs.getLong(1);
+                rs.close();
+                pstmt.close();
+                // change template type to SYSTEM
+                pstmt = conn.prepareStatement("update `cloud`.`vm_template` set type='SYSTEM' where id = ?");
+                pstmt.setLong(1, templateId);
+                pstmt.executeUpdate();
+                pstmt.close();
+                // update templete ID of system Vms
+                pstmt = conn.prepareStatement("update `cloud`.`vm_instance` set vm_template_id = ? where type <> 'User' and hypervisor_type = 'VMware'");
+                pstmt.setLong(1, templateId);
+                pstmt.executeUpdate();
+                pstmt.close();
+            } else {
+                if (VMware){
+                    throw new CloudRuntimeException("4.0 VMware SystemVm template not found. Cannot upgrade system Vms");
+                } else {
+                    s_logger.warn("4.0 VMware SystemVm template not found. VMware hypervisor is not used, so not failing upgrade");
+                }
+            }
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("Error while updating VMware systemVm template", e);
+        }
+        s_logger.debug("Updating System Vm Template IDs Complete");
+    }
+
     private void correctVRProviders(Connection conn) {
         PreparedStatement pstmtVR = null;
         ResultSet rsVR = null;


[2/2] git commit: updated refs/heads/4.1 to a86e53d

Posted by ch...@apache.org.
Merge branch '4.1' of https://git-wip-us.apache.org/repos/asf/cloudstack into 4.1


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

Branch: refs/heads/4.1
Commit: a86e53d187d7ff18b86f44ec83322a8e37016f3f
Parents: a3b5980 840bf2e
Author: Chip Childers <ch...@gmail.com>
Authored: Sat May 11 18:26:41 2013 +0100
Committer: Chip Childers <ch...@gmail.com>
Committed: Sat May 11 18:26:41 2013 +0100

----------------------------------------------------------------------
 docs/en-US/Release_Notes.xml                       |   12 ++++++------
 docs/en-US/aws-ec2-configuration.xml               |    2 +-
 docs/en-US/change-database-password.xml            |    8 ++++----
 docs/en-US/citrix-xenserver-installation.xml       |    4 ++--
 docs/en-US/configure-usage-server.xml              |    4 ++--
 docs/en-US/creating-network-offerings.xml          |    2 +-
 docs/en-US/database-replication.xml                |    4 ++--
 docs/en-US/hypervisor-host-install-agent.xml       |    6 +++---
 docs/en-US/hypervisor-host-install-libvirt.xml     |    2 +-
 .../increase-management-server-max-memory.xml      |    2 +-
 docs/en-US/install-usage-server.xml                |    2 +-
 docs/en-US/removing-xenserver-kvm-hosts.xml        |    2 +-
 docs/en-US/set-database-buffer-pool-size.xml       |    2 +-
 docs/en-US/set-global-project-resource-limits.xml  |    2 +-
 docs/en-US/set-projects-creator-permissions.xml    |    2 +-
 docs/en-US/set-up-invitations.xml                  |    2 +-
 docs/en-US/stop-restart-management-server.xml      |    6 +++---
 docs/en-US/sys-offering-sysvm.xml                  |    2 +-
 docs/en-US/zone-add.xml                            |    2 +-
 19 files changed, 34 insertions(+), 34 deletions(-)
----------------------------------------------------------------------