Github user wilderrodrigues commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1050#discussion_r44282419
  
    --- 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>() {
    --- End diff --
    
    @DaanHoogland: do you get that this code was copied from the stuff written 
for 4.4/4.5? Sorry, but I won't change it for the following reasons:
    
    1. The PR was already tested and changes will force me to re-test it;
    2. This is code executed once - for upgrades only;
    3. This was copied from a code pushed in Commit ID 
3cb78fc74221e521c205b21590e6d8a4a24e6b91;
    4. After working for several weekends, I don't have the energy to do it now.
    
    If you think it's a blocker, you can fork, change, test and push to the PR.
    
    Cheers,
    Wilder


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to