cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kis...@apache.org
Subject [1/2] git commit: updated refs/heads/master to c1e7880
Date Tue, 06 Aug 2013 11:51:08 GMT
Updated Branches:
  refs/heads/4.2 86e4d6f80 -> c0e718616
  refs/heads/master 42b81009b -> c1e78809b


CLOUDSTACK-4070: upgrade from 2.2.14 to 4.2 is failing with 4.0 VMware SystemVm template not
found. Cannot upgrade system Vms

System template upgrade is not required during 4.0 upgrade since we handle the same during
4.2 upgrade. So removing the system template update during 4.0 upgrade.


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

Branch: refs/heads/master
Commit: c1e78809b23abf9ebaa13175e83dc30756a95a44
Parents: 42b8100
Author: Harikrishna Patnala <harikrishna.patnala@citrix.com>
Authored: Tue Aug 6 12:13:50 2013 +0530
Committer: Kishan Kavala <kishan@cloud.com>
Committed: Tue Aug 6 17:17:20 2013 +0530

----------------------------------------------------------------------
 .../com/cloud/upgrade/dao/Upgrade2214to30.java  | 135 +------------------
 .../com/cloud/upgrade/dao/Upgrade302to40.java   |  50 +------
 2 files changed, 2 insertions(+), 183 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c1e78809/engine/schema/src/com/cloud/upgrade/dao/Upgrade2214to30.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade2214to30.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade2214to30.java
index e1b56df..78ee674 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade2214to30.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade2214to30.java
@@ -79,7 +79,7 @@ public class Upgrade2214to30 extends Upgrade30xBase implements DbUpgrade
{
         // drop keys
         dropKeysIfExist(conn);
         //update templete ID for system Vms
-        updateSystemVms(conn);
+        //updateSystemVms(conn); This is not required as system template update is handled
during 4.2 upgrade
         // update domain network ref
         updateDomainNetworkRef(conn);
         // update networks that use redundant routers to the new network offering
@@ -601,139 +601,6 @@ public class Upgrade2214to30 extends Upgrade30xBase implements DbUpgrade
{
         }
     }
 
-    private void updateSystemVms(Connection conn){
-    	PreparedStatement pstmt = null;
-    	ResultSet rs = null;
-    	boolean xenserver = false;
-    	boolean kvm = false;
-    	boolean VMware = false;
-    	s_logger.debug("Updating System Vm template IDs");
-    	try{
-    		//Get all hypervisors in use
-    		try {
-    			pstmt = conn.prepareStatement("select distinct(hypervisor_type) from `cloud`.`cluster`
where removed is null");
-    			rs = pstmt.executeQuery();
-    			while(rs.next()){
-    				if("XenServer".equals(rs.getString(1))){
-    					xenserver = true;
-    				} else if("KVM".equals(rs.getString(1))){
-    					kvm = true;
-    				} else if("VMware".equals(rs.getString(1))){
-    					VMware = true;
-    				}  
-    			}
-    		} catch (SQLException e) {
-    			throw new CloudRuntimeException("Error while listing hypervisors in use", e);
-    		}
-
-    		s_logger.debug("Updating XenSever System Vms");    		
-    		//XenServer
-    		try {
-               //Get 3.0.0 or later xenserer system Vm template Id
-               pstmt = conn.prepareStatement("select max(id) from `cloud`.`vm_template` where
name like 'systemvm-xenserver-%' 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 = 'XenServer'");
-    				pstmt.setLong(1, templateId);
-    				pstmt.executeUpdate();
-    				pstmt.close();
-    			} else {
-    				if (xenserver){
-                       throw new CloudRuntimeException("3.0.0 or later XenServer SystemVm
template not found. Cannot upgrade system Vms");
-    				} else {
-                       s_logger.warn("3.0.0 or later XenServer SystemVm template not found.
XenServer hypervisor is not used, so not failing upgrade");
-    				}
-    			}
-    		} catch (SQLException e) {
-    			throw new CloudRuntimeException("Error while updating XenServer systemVm template",
e);
-    		}
-
-    		//KVM
-    		s_logger.debug("Updating KVM System Vms");
-    		try {
-               //Get 3.0.0 or later KVM system Vm template Id
-               pstmt = conn.prepareStatement("select max(id) from `cloud`.`vm_template` where
name like 'systemvm-kvm-%' 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 = 'KVM'");
-    				pstmt.setLong(1, templateId);
-    				pstmt.executeUpdate();
-    				pstmt.close();
-    			} else {
-    				if (kvm){
-                       throw new CloudRuntimeException("3.0.0 or later KVM SystemVm template
not found. Cannot upgrade system Vms");
-    				} else {
-                       s_logger.warn("3.0.0 or later KVM SystemVm template not found. KVM
hypervisor is not used, so not failing upgrade");
-    				}
-    			}
-    		} catch (SQLException e) {
-    			throw new CloudRuntimeException("Error while updating KVM systemVm template", e);
-    		}
-
-    		//VMware
-    		s_logger.debug("Updating VMware System Vms");
-    		try {
-               //Get 3.0.0 or later VMware system Vm template Id
-               pstmt = conn.prepareStatement("select max(id) from `cloud`.`vm_template` where
name like 'systemvm-vmware-%' 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("3.0.0 or later VMware SystemVm template
not found. Cannot upgrade system Vms");
-    				} else {
-                       s_logger.warn("3.0.0 or later 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");
-    	}
-    	finally {
-    		try {
-    			if (rs != null) {
-    				rs.close();
-    			}
-
-    			if (pstmt != null) {
-    				pstmt.close();
-    			}
-    		} catch (SQLException e) {
-    		}
-    	}
-    }
-    
     private void createNetworkOfferingServices(Connection conn, String externalOfferingName)
{
         PreparedStatement pstmt = null;
         ResultSet rs = null;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c1e78809/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to40.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to40.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to40.java
index 6f31fdd..11e5608 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to40.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to40.java
@@ -64,7 +64,7 @@ public class Upgrade302to40 extends Upgrade30xBase implements DbUpgrade
{
 
     @Override
     public void performDataMigration(Connection conn) {
-        updateVmWareSystemVms(conn);
+        //updateVmWareSystemVms(conn); This is not required as system template update is
handled during 4.2 upgrade
         correctVRProviders(conn);
         correctMultiplePhysicaNetworkSetups(conn);
         addHostDetailsUniqueKey(conn);
@@ -86,54 +86,6 @@ 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;


Mime
View raw message