cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wilderrodrigues <...@git.apache.org>
Subject [GitHub] cloudstack pull request: CLOUDSTACK-9046 - Fix upgrade path from 4...
Date Mon, 09 Nov 2015 14:43:07 GMT
Github user wilderrodrigues commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1050#discussion_r44281534
  
    --- Diff: engine/schema/src/com/cloud/upgrade/dao/Upgrade452to460.java ---
    @@ -165,4 +171,173 @@ private void addIndexForVMInstance(Connection conn) {
             return new File[] { new File(script) };
         }
     
    +    @SuppressWarnings("serial")
    +    private void updateSystemVmTemplates(final Connection conn) {
    +        s_logger.debug("Updating System Vm template IDs");
    +        // Get all hypervisors in use
    +        final Set<Hypervisor.HypervisorType> hypervisorsListInUse = new HashSet<Hypervisor.HypervisorType>();
    +        try (PreparedStatement pstmt = conn.prepareStatement("select distinct(hypervisor_type)
from `cloud`.`cluster` where removed is null"); ResultSet rs = pstmt.executeQuery()) {
    +            while (rs.next()) {
    +                switch (Hypervisor.HypervisorType.getType(rs.getString(1))) {
    +                case XenServer:
    +                    hypervisorsListInUse.add(Hypervisor.HypervisorType.XenServer);
    +                    break;
    +                case KVM:
    +                    hypervisorsListInUse.add(Hypervisor.HypervisorType.KVM);
    +                    break;
    +                case VMware:
    +                    hypervisorsListInUse.add(Hypervisor.HypervisorType.VMware);
    +                    break;
    +                case Hyperv:
    +                    hypervisorsListInUse.add(Hypervisor.HypervisorType.Hyperv);
    +                    break;
    +                case LXC:
    +                    hypervisorsListInUse.add(Hypervisor.HypervisorType.LXC);
    +                    break;
    +                case Ovm3:
    +                    hypervisorsListInUse.add(Hypervisor.HypervisorType.Ovm3);
    +                    break;
    +                default: // no action on cases Any, BareMetal, None, Ovm,
    +                    // Parralels, Simulator and VirtualBox:
    +                    break;
    +                }
    +            }
    +        } catch (final SQLException e) {
    +            s_logger.error("updateSystemVmTemplates:Exception while getting hypervisor
types from clusters: " + e.getMessage());
    +            throw new CloudRuntimeException("updateSystemVmTemplates:Exception while
getting hypervisor types from clusters", e);
    +        }
    +
    +        final Map<Hypervisor.HypervisorType, String> NewTemplateNameList = new
HashMap<Hypervisor.HypervisorType, String>() {
    +            {
    +                put(Hypervisor.HypervisorType.XenServer, "systemvm-xenserver-4.6");
    +                put(Hypervisor.HypervisorType.VMware, "systemvm-vmware-4.6");
    +                put(Hypervisor.HypervisorType.KVM, "systemvm-kvm-4.6");
    +                put(Hypervisor.HypervisorType.LXC, "systemvm-lxc-4.6");
    +                put(Hypervisor.HypervisorType.Hyperv, "systemvm-hyperv-4.6");
    +                put(Hypervisor.HypervisorType.Ovm3, "systemvm-ovm3-4.6");
    +            }
    +        };
    +
    +        final Map<Hypervisor.HypervisorType, String> routerTemplateConfigurationNames
= new HashMap<Hypervisor.HypervisorType, String>() {
    +            {
    +                put(Hypervisor.HypervisorType.XenServer, "router.template.xenserver");
    +                put(Hypervisor.HypervisorType.VMware, "router.template.vmware");
    +                put(Hypervisor.HypervisorType.KVM, "router.template.kvm");
    +                put(Hypervisor.HypervisorType.LXC, "router.template.lxc");
    +                put(Hypervisor.HypervisorType.Hyperv, "router.template.hyperv");
    +                put(Hypervisor.HypervisorType.Ovm3, "router.template.ovm3");
    +            }
    +        };
    +
    +        final Map<Hypervisor.HypervisorType, String> newTemplateUrl = new HashMap<Hypervisor.HypervisorType,
String>() {
    +            {
    +                put(Hypervisor.HypervisorType.XenServer, "http://cloudstack.apt-get.eu/systemvm/4.6/systemvm64template-4.6.0-xen.vhd.bz2");
    +                put(Hypervisor.HypervisorType.VMware, "http://cloudstack.apt-get.eu/systemvm/4.6/systemvm64template-4.6.0-vmware.ova");
    +                put(Hypervisor.HypervisorType.KVM, "http://cloudstack.apt-get.eu/systemvm/4.6/systemvm64template-4.6.0-kvm.qcow2.bz2");
    +                put(Hypervisor.HypervisorType.LXC, "http://cloudstack.apt-get.eu/systemvm/4.6/systemvm64template-4.6.0-kvm.qcow2.bz2");
    +                put(Hypervisor.HypervisorType.Hyperv, "http://cloudstack.apt-get.eu/systemvm/4.6/systemvm64template-4.6.0-hyperv.vhd.zip");
    +                put(Hypervisor.HypervisorType.Ovm3, "http://cloudstack.apt-get.eu/systemvm/4.6/systemvm64template-4.6.0-ovm.raw.bz2");
    +            }
    +        };
    +
    +        final Map<Hypervisor.HypervisorType, String> newTemplateChecksum = new
HashMap<Hypervisor.HypervisorType, String>() {
    +            {
    +                put(Hypervisor.HypervisorType.XenServer, "8886f554a499ec5405b6f203d9d36460");
    +                put(Hypervisor.HypervisorType.VMware, "4b415224fe00b258f66cad9fce9f73fc");
    +                put(Hypervisor.HypervisorType.KVM, "c059b0d051e0cd6fbe9d5d4fc40c7e5d");
    +                put(Hypervisor.HypervisorType.LXC, "c059b0d051e0cd6fbe9d5d4fc40c7e5d");
    +                put(Hypervisor.HypervisorType.Hyperv, "53e24bddfa56ea3139ed37af4b519013");
    +                put(Hypervisor.HypervisorType.Ovm3, "c8577d27b2daafb2d9a4ed307ce2f00f");
    +            }
    +        };
    +
    +        for (final Map.Entry<Hypervisor.HypervisorType, String> hypervisorAndTemplateName
: NewTemplateNameList.entrySet()) {
    +            s_logger.debug("Updating " + hypervisorAndTemplateName.getKey() + " System
Vms");
    +            try (PreparedStatement pstmt = conn.prepareStatement("select id from `cloud`.`vm_template`
where name = ? and removed is null order by id desc limit 1")) {
    --- End diff --
    
    Code is executed only once. I did not look, just cced the stuff from 4.4 to 4.5 and did
some changes. Not really worthy changing and force pushing it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message