Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion agent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
<version>4.6.0-SNAPSHOT</version>
<version>4.6.1-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
<version>4.6.0-SNAPSHOT</version>
<version>4.6.1-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion build/replace.properties
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ AGENTLOG=logs/agent.log
MSMNTDIR=/mnt
COMPONENTS-SPEC=components.xml
REMOTEHOST=localhost
COMMONLIBDIR=client/target/cloud-client-ui-4.6.0-SNAPSHOT/WEB-INF/lib/
COMMONLIBDIR=client/target/cloud-client-ui-4.6.0/WEB-INF/lib/
2 changes: 1 addition & 1 deletion client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
<version>4.6.0-SNAPSHOT</version>
<version>4.6.1-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
<version>4.6.0-SNAPSHOT</version>
<version>4.6.1-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
Expand Down
13 changes: 13 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
cloudstack (4.6.1-SNAPSHOT) unstable; urgency=low

[ Remi Bergsma ]
* Update the version to 4.6.1.snapshot

-- the Apache CloudStack project <dev@cloudstack.apache.org> Sun, 15 Nov 2015 08:35:33 +0100

cloudstack (4.6.0) unstable; urgency=low

* Update the version to 4.6.0

-- the Apache CloudStack project <dev@cloudstack.apache.org> Tue, 10 Nov 2015 15:45:33 +0100

cloudstack (4.6.0-SNAPSHOT) unstable; urgency=low

[ Hugo Trippaers ]
Expand Down
2 changes: 1 addition & 1 deletion developer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
<version>4.6.0-SNAPSHOT</version>
<version>4.6.1-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion engine/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
<version>4.6.0-SNAPSHOT</version>
<version>4.6.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion engine/components-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
<version>4.6.0-SNAPSHOT</version>
<version>4.6.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion engine/network/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
<version>4.6.0-SNAPSHOT</version>
<version>4.6.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion engine/orchestration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
<version>4.6.0-SNAPSHOT</version>
<version>4.6.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
<version>4.6.0-SNAPSHOT</version>
<version>4.6.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<build>
Expand Down
2 changes: 1 addition & 1 deletion engine/schema/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
<version>4.6.0-SNAPSHOT</version>
<version>4.6.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
Expand Down
93 changes: 48 additions & 45 deletions engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java

Large diffs are not rendered by default.

151 changes: 1 addition & 150 deletions engine/schema/src/com/cloud/upgrade/dao/Upgrade442to450.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,12 @@
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.cloud.hypervisor.Hypervisor;
import com.cloud.utils.crypt.DBEncryptionUtil;

import org.apache.log4j.Logger;

import com.cloud.utils.crypt.DBEncryptionUtil;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.script.Script;

Expand Down Expand Up @@ -68,7 +64,6 @@ public File[] getPrepareScripts() {

@Override
public void performDataMigration(Connection conn) {
updateSystemVmTemplates(conn);
dropInvalidKeyFromStoragePoolTable(conn);
dropDuplicatedForeignKeyFromAsyncJobTable(conn);
updateMaxRouterSizeConfig(conn);
Expand Down Expand Up @@ -152,150 +147,6 @@ public File[] getCleanupScripts() {
return new File[] {new File(script)};
}

private void updateSystemVmTemplates(Connection conn) {
s_logger.debug("Updating System Vm template IDs");
//Get all hypervisors in use
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;
default: // no action on cases Any, BareMetal, None, Ovm, Parralels, Simulator and VirtualBox:
break;
}
}
} catch (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);
}

Map<Hypervisor.HypervisorType, String> NewTemplateNameList = new HashMap<Hypervisor.HypervisorType, String>() {
{
put(Hypervisor.HypervisorType.XenServer, "systemvm-xenserver-4.5");
put(Hypervisor.HypervisorType.VMware, "systemvm-vmware-4.5");
put(Hypervisor.HypervisorType.KVM, "systemvm-kvm-4.5");
put(Hypervisor.HypervisorType.LXC, "systemvm-lxc-4.5");
put(Hypervisor.HypervisorType.Hyperv, "systemvm-hyperv-4.5");
}
};

Map<Hypervisor.HypervisorType, String> routerTemplateConfigurationNames = new HashMap<Hypervisor.HypervisorType, String>() {
{
put(Hypervisor.HypervisorType.XenServer, "router.template.xen");
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");
}
};

Map<Hypervisor.HypervisorType, String> newTemplateUrl = new HashMap<Hypervisor.HypervisorType, String>() {
{
put(Hypervisor.HypervisorType.XenServer, "http://download.cloud.com/templates/4.5/systemvm64template-4.5-xen.vhd.bz2");
put(Hypervisor.HypervisorType.VMware, "http://download.cloud.com/templates/4.5/systemvm64template-4.5-vmware.ova");
put(Hypervisor.HypervisorType.KVM, "http://download.cloud.com/templates/4.5/systemvm64template-4.5-kvm.qcow2.bz2");
put(Hypervisor.HypervisorType.LXC, "http://download.cloud.com/templates/4.5/systemvm64template-4.5-kvm.qcow2.bz2");
put(Hypervisor.HypervisorType.Hyperv, "http://download.cloud.com/templates/4.5/systemvm64template-4.5-hyperv.vhd.zip");
}
};

Map<Hypervisor.HypervisorType, String> newTemplateChecksum = new HashMap<Hypervisor.HypervisorType, String>() {
{
put(Hypervisor.HypervisorType.XenServer, "2b15ab4401c2d655264732d3fc600241");
put(Hypervisor.HypervisorType.VMware, "3106a79a4ce66cd7f6a7c50e93f2db57");
put(Hypervisor.HypervisorType.KVM, "aa9f501fecd3de1daeb9e2f357f6f002");
put(Hypervisor.HypervisorType.LXC, "aa9f501fecd3de1daeb9e2f357f6f002");
put(Hypervisor.HypervisorType.Hyperv, "70bd30ea02ee9ed67d2c6b85c179cee9");
}
};

for (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")) {
//Get 4.5.0 system Vm template Id for corresponding hypervisor
long templateId = -1;
pstmt.setString(1, hypervisorAndTemplateName.getValue());
try (ResultSet rs = pstmt.executeQuery()) {
if(rs.next()){
templateId = rs.getLong(1);
}
} catch (SQLException e)
{
s_logger.error("updateSystemVmTemplates:Exception while getting ids of templates: "+e.getMessage());
throw new CloudRuntimeException("updateSystemVmTemplates:Exception while getting ids of templates", e);
}

// change template type to SYSTEM
if (templateId != -1) {
try(PreparedStatement templ_type_pstmt = conn.prepareStatement("update `cloud`.`vm_template` set type='SYSTEM' where id = ?");)
{
templ_type_pstmt.setLong(1, templateId);
templ_type_pstmt.executeUpdate();
}
catch (SQLException e)
{
s_logger.error("updateSystemVmTemplates:Exception while updating template with id " + templateId + " to be marked as 'system': "+e.getMessage());
throw new CloudRuntimeException("updateSystemVmTemplates:Exception while updating template with id " + templateId + " to be marked as 'system'", e);
}
// update template ID of system Vms
try(PreparedStatement update_templ_id_pstmt = conn.prepareStatement("update `cloud`.`vm_instance` set vm_template_id = ? where type <> 'User' and hypervisor_type = ?");)
{
update_templ_id_pstmt.setLong(1, templateId);
update_templ_id_pstmt.setString(2, hypervisorAndTemplateName.getKey().toString());
update_templ_id_pstmt.executeUpdate();
}catch (Exception e)
{
s_logger.error("updateSystemVmTemplates:Exception while setting template for " + hypervisorAndTemplateName.getKey().toString() + " to " + templateId + ": "+e.getMessage());
throw new CloudRuntimeException("updateSystemVmTemplates:Exception while setting template for " + hypervisorAndTemplateName.getKey().toString() + " to " + templateId, e);
}
// Change value of global configuration parameter router.template.* for the corresponding hypervisor
try(PreparedStatement update_pstmt = conn.prepareStatement("UPDATE `cloud`.`configuration` SET value = ? WHERE name = ?");) {
update_pstmt.setString(1, hypervisorAndTemplateName.getValue());
update_pstmt.setString(2, routerTemplateConfigurationNames.get(hypervisorAndTemplateName.getKey()));
update_pstmt.executeUpdate();
}catch (SQLException e)
{
s_logger.error("updateSystemVmTemplates:Exception while setting " + routerTemplateConfigurationNames.get(hypervisorAndTemplateName.getKey()) + " to " + hypervisorAndTemplateName.getValue() + ": "+e.getMessage());
throw new CloudRuntimeException("updateSystemVmTemplates:Exception while setting " + routerTemplateConfigurationNames.get(hypervisorAndTemplateName.getKey()) + " to " + hypervisorAndTemplateName.getValue(), e);
}
} else {
if (hypervisorsListInUse.contains(hypervisorAndTemplateName.getKey())){
throw new CloudRuntimeException("4.5.0 " + hypervisorAndTemplateName.getKey() + " SystemVm template not found. Cannot upgrade system Vms");
} else {
s_logger.warn("4.5.0 " + hypervisorAndTemplateName.getKey() + " SystemVm template not found. " + hypervisorAndTemplateName.getKey() + " hypervisor is not used, so not failing upgrade");
// Update the latest template URLs for corresponding hypervisor
try(PreparedStatement update_templ_url_pstmt = conn.prepareStatement("UPDATE `cloud`.`vm_template` SET url = ? , checksum = ? WHERE hypervisor_type = ? AND type = 'SYSTEM' AND removed is null order by id desc limit 1");) {
update_templ_url_pstmt.setString(1, newTemplateUrl.get(hypervisorAndTemplateName.getKey()));
update_templ_url_pstmt.setString(2, newTemplateChecksum.get(hypervisorAndTemplateName.getKey()));
update_templ_url_pstmt.setString(3, hypervisorAndTemplateName.getKey().toString());
update_templ_url_pstmt.executeUpdate();
}catch (SQLException e)
{
s_logger.error("updateSystemVmTemplates:Exception while updating 'url' and 'checksum' for hypervisor type " + hypervisorAndTemplateName.getKey().toString() + ": "+e.getMessage());
throw new CloudRuntimeException("updateSystemVmTemplates:Exception while updating 'url' and 'checksum' for hypervisor type " + hypervisorAndTemplateName.getKey().toString(), e);
}
}
}
} catch (SQLException e) {
s_logger.error("updateSystemVmTemplates:Exception while getting ids of templates: "+e.getMessage());
throw new CloudRuntimeException("updateSystemVmTemplates:Exception while getting ids of templates", e);
}
}
s_logger.debug("Updating System Vm Template IDs Complete");
}


private void dropInvalidKeyFromStoragePoolTable(Connection conn) {
HashMap<String, List<String>> uniqueKeys = new HashMap<String, List<String>>();
List<String> keys = new ArrayList<String>();
Expand Down
67 changes: 67 additions & 0 deletions engine/schema/src/com/cloud/upgrade/dao/Upgrade460to461.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

package com.cloud.upgrade.dao;

import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.script.Script;
import org.apache.log4j.Logger;

import java.io.File;
import java.sql.Connection;

public class Upgrade460to461 implements DbUpgrade {
final static Logger s_logger = Logger.getLogger(Upgrade460to461.class);

@Override
public String[] getUpgradableVersionRange() {
return new String[] {"4.6.0", "4.6.1"};
}

@Override
public String getUpgradedVersion() {
return "4.6.1";
}

@Override
public boolean supportsRollingUpgrade() {
return false;
}

@Override
public File[] getPrepareScripts() {
String script = Script.findScript("", "db/schema-460to461.sql");
if (script == null) {
throw new CloudRuntimeException("Unable to find db/schema-460to461.sql");
}
return new File[] {new File(script)};
}

@Override
public void performDataMigration(Connection conn) {
}

@Override
public File[] getCleanupScripts() {
String script = Script.findScript("", "db/schema-460to461-cleanup.sql");
if (script == null) {
throw new CloudRuntimeException("Unable to find db/schema-460to461-cleanup.sql");
}

return new File[] {new File(script)};
}
}
2 changes: 1 addition & 1 deletion engine/service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
<version>4.6.0-SNAPSHOT</version>
<version>4.6.1-SNAPSHOT</version>
</parent>
<artifactId>cloud-engine-service</artifactId>
<packaging>war</packaging>
Expand Down
2 changes: 1 addition & 1 deletion engine/storage/cache/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
<version>4.6.0-SNAPSHOT</version>
<version>4.6.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion engine/storage/datamotion/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
<version>4.6.0-SNAPSHOT</version>
<version>4.6.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
Expand Down
Loading