mirror of https://github.com/apache/cloudstack.git
Merge branch '2.2.4'
Conflicts: api/src/com/cloud/configuration/ConfigurationService.java core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java server/src/com/cloud/api/ApiDBUtils.java server/src/com/cloud/configuration/ConfigurationManagerImpl.java server/src/com/cloud/network/NetworkManagerImpl.java server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java setup/db/db/schema-21to22.sql setup/db/db/schema-222to224.sql utils/src/com/cloud/utils/exception/ExceptionUtil.java
This commit is contained in:
commit
288a36d09f
|
|
@ -34,6 +34,8 @@ import com.cloud.offering.DiskOffering;
|
|||
import com.cloud.offering.NetworkOffering;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachine.Type;
|
||||
|
||||
public interface ConfigurationService {
|
||||
|
||||
|
|
|
|||
|
|
@ -464,14 +464,14 @@ public class VirtualRoutingResource implements Manager {
|
|||
}
|
||||
}
|
||||
if (!foundLinkLocalBr) {
|
||||
Script.runSimpleBashScript("ip route add " + NetUtils.getLinkLocalCIDR() + " dev " + linkLocalBr + " src " + NetUtils.getLinkLocalGateway());
|
||||
Script.runSimpleBashScript("ifconfig " + linkLocalBr + " 169.254.0.1;" + "ip route add " + NetUtils.getLinkLocalCIDR() + " dev " + linkLocalBr + " src " + NetUtils.getLinkLocalGateway());
|
||||
}
|
||||
}
|
||||
|
||||
public void createControlNetwork(String privBrName) {
|
||||
deletExitingLinkLocalRoutTable(privBrName);
|
||||
if (!isBridgeExists(privBrName)) {
|
||||
Script.runSimpleBashScript("brctl addbr " + privBrName + "; ifconfig " + privBrName + " up;", _timeout);
|
||||
Script.runSimpleBashScript("brctl addbr " + privBrName + "; ifconfig " + privBrName + " up; ifconfig " + privBrName + " 169.254.0.1", _timeout);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -127,6 +127,8 @@ import com.cloud.utils.db.Transaction;
|
|||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
import com.cloud.vm.VMInstanceVO;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachine.Type;
|
||||
import com.cloud.vm.dao.ConsoleProxyDao;
|
||||
import com.cloud.vm.dao.DomainRouterDao;
|
||||
import com.cloud.vm.dao.SecondaryStorageVmDao;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class DataCenterIpAddressVO {
|
|||
@Column(name="reservation_id")
|
||||
String reservationId;
|
||||
|
||||
@Column(name="instance_id")
|
||||
@Column(name="nic_id")
|
||||
private Long instanceId;
|
||||
|
||||
@Column(name="mac_address")
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class DataCenterLinkLocalIpAddressVO {
|
|||
@Column(name="pod_id", updatable=false, nullable=false)
|
||||
private long podId;
|
||||
|
||||
@Column(name="instance_id")
|
||||
@Column(name="nic_id")
|
||||
private Long instanceId;
|
||||
|
||||
@Column(name="reservation_id")
|
||||
|
|
|
|||
|
|
@ -167,10 +167,10 @@ public class Upgrade218to22 implements DbUpgrade {
|
|||
pstmt.close();
|
||||
}
|
||||
|
||||
protected void insertNic(Connection conn, long networkId, long instanceId, boolean running, String macAddress, String ipAddress, String netmask, String strategy, String gateway, String vnet, String guru, boolean defNic, int deviceId, String mode, String reservationId) throws SQLException {
|
||||
protected long insertNic(Connection conn, long networkId, long instanceId, boolean running, String macAddress, String ipAddress, String netmask, String strategy, String gateway, String vnet, String guru, boolean defNic, int deviceId, String mode, String reservationId) throws SQLException {
|
||||
PreparedStatement pstmt = conn.prepareStatement(
|
||||
"INSERT INTO nics (instance_id, network_id, mac_address, ip4_address, netmask, strategy, ip_type, broadcast_uri, mode, reserver_name, reservation_id, device_id, update_time, isolation_uri, ip6_address, default_nic, created, removed, state, gateway) " +
|
||||
"VALUES (?, ?, ?, ?, ?, ?, 'Ip4', ?, ?, ?, ?, ?, now(), ?, NULL, ?, now(), NULL, ?, ?)");
|
||||
"VALUES (?, ?, ?, ?, ?, ?, 'Ip4', ?, ?, ?, ?, ?, now(), ?, NULL, ?, now(), NULL, ?, ?)", Statement.RETURN_GENERATED_KEYS);
|
||||
int i = 1;
|
||||
String isolationUri = null;
|
||||
|
||||
|
|
@ -199,10 +199,18 @@ public class Upgrade218to22 implements DbUpgrade {
|
|||
pstmt.setString(i++, running ? "Reserved" : "Allocated");
|
||||
pstmt.setString(i++, gateway);
|
||||
pstmt.executeUpdate();
|
||||
ResultSet rs = pstmt.getGeneratedKeys();
|
||||
long nicId = 0;
|
||||
if (!rs.next()) {
|
||||
throw new CloudRuntimeException("Unable to get id for nic");
|
||||
}
|
||||
nicId = rs.getLong(1);
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
return nicId;
|
||||
}
|
||||
|
||||
protected void upgradeDomR(Connection conn, long domrId, Long publicNetworkId, long guestNetworkId, long controlNetworkId, String zoneType) throws SQLException {
|
||||
protected void upgradeDomR(Connection conn, long dcId, long domrId, Long publicNetworkId, long guestNetworkId, long controlNetworkId, String zoneType) throws SQLException {
|
||||
s_logger.debug("Upgrading domR" + domrId);
|
||||
PreparedStatement pstmt = conn.prepareStatement("SELECT vm_instance.id, vm_instance.state, vm_instance.private_mac_address, vm_instance.private_ip_address, vm_instance.private_netmask, domain_router.public_mac_address, domain_router.public_ip_address, domain_router.public_netmask, domain_router.guest_mac_address, domain_router.guest_ip_address, domain_router.guest_netmask, domain_router.vnet, domain_router.gateway, vm_instance.type FROM vm_instance INNER JOIN domain_router ON vm_instance.id=domain_router.id WHERE vm_instance.removed is NULL AND vm_instance.id=?");
|
||||
pstmt.setLong(1, domrId);
|
||||
|
|
@ -230,12 +238,39 @@ public class Upgrade218to22 implements DbUpgrade {
|
|||
rs.close();
|
||||
pstmt.close();
|
||||
|
||||
|
||||
pstmt = conn.prepareStatement("SELECT v.vlan_id from vlan v, user_ip_address u where v.id=u.vlan_db_id and u.public_ip_address=?");
|
||||
pstmt.setString(1, publicIp);
|
||||
rs = pstmt.executeQuery();
|
||||
|
||||
String publicVlan = null;
|
||||
while (rs.next()) {
|
||||
publicVlan = rs.getString(1);
|
||||
}
|
||||
|
||||
if (zoneType.equalsIgnoreCase("Basic")) {
|
||||
insertNic(conn, controlNetworkId, domrId, running, privateMac, privateIp, privateNetmask, "Start", "169.254.0.1", null, "ControlNetworkGuru", false, 1, "Static", privateIp != null ? (domrId + privateIp) : null);
|
||||
long controlNicId = insertNic(conn, controlNetworkId, domrId, running, privateMac, privateIp, privateNetmask, "Start", "169.254.0.1", null, "ControlNetworkGuru", false, 1, "Static", privateIp != null ? (domrId + privateIp) : null);
|
||||
if (privateIp != null) {
|
||||
pstmt = conn.prepareStatement("UPDATE op_dc_link_local_ip_address_alloc SET instance_id=? WHERE ip_address=? AND data_center_id=?");
|
||||
pstmt.setLong(1, controlNicId);
|
||||
pstmt.setString(2, privateIp);
|
||||
pstmt.setLong(3, dcId);
|
||||
pstmt.executeUpdate();
|
||||
pstmt.close();
|
||||
}
|
||||
|
||||
insertNic(conn, guestNetworkId, domrId, running, guestMac, guestIp, guestNetmask, "Start", gateway, vnet, "DirectPodBasedNetworkGuru", false, 0, "Static", null);
|
||||
} else {
|
||||
insertNic(conn, publicNetworkId, domrId, running, publicMac, publicIp, publicNetmask, "Create", gateway, null, "PublicNetworkGuru", true, 2, "Static", null);
|
||||
insertNic(conn, controlNetworkId, domrId, running, privateMac, privateIp, privateNetmask, "Start", "169.254.0.1", null, "ControlNetworkGuru", false, 1, "Static", privateIp != null ? (domrId + privateIp) : null);
|
||||
insertNic(conn, publicNetworkId, domrId, running, publicMac, publicIp, publicNetmask, "Create", gateway, publicVlan, "PublicNetworkGuru", true, 2, "Static", null);
|
||||
long controlNicId = insertNic(conn, controlNetworkId, domrId, running, privateMac, privateIp, privateNetmask, "Start", "169.254.0.1", null, "ControlNetworkGuru", false, 1, "Static", privateIp != null ? (domrId + privateIp) : null);
|
||||
if (privateIp != null) {
|
||||
pstmt = conn.prepareStatement("UPDATE op_dc_link_local_ip_address_alloc SET instance_id=? WHERE ip_address=? AND data_center_id=?");
|
||||
pstmt.setLong(1, controlNicId);
|
||||
pstmt.setString(2, privateIp);
|
||||
pstmt.setLong(3, dcId);
|
||||
pstmt.executeUpdate();
|
||||
pstmt.close();
|
||||
}
|
||||
insertNic(conn, guestNetworkId, domrId, running, guestMac, guestIp, guestNetmask, "Start", null, vnet, "ExternalGuestNetworkGuru", false, 0, "Static", null);
|
||||
}
|
||||
|
||||
|
|
@ -285,18 +320,48 @@ public class Upgrade218to22 implements DbUpgrade {
|
|||
|
||||
s_logger.debug("Gateway is " + podGateway);
|
||||
|
||||
if (zoneType.equalsIgnoreCase("Basic")) {
|
||||
insertNic(conn, publicNetworkId, ssvmId, running, publicMac, publicIp, publicNetmask, "Start", gateway, null, "DirectPodBasedNetworkGuru", true, 2, "Static", null);
|
||||
|
||||
} else {
|
||||
insertNic(conn, publicNetworkId, ssvmId, running, publicMac, publicIp, publicNetmask, "Create", gateway, null, "PublicNetworkGuru", true, 2, "Static", null);
|
||||
pstmt = conn.prepareStatement("SELECT v.vlan_id from vlan v, user_ip_address u where v.id=u.vlan_db_id and u.public_ip_address=?");
|
||||
pstmt.setString(1, publicIp);
|
||||
rs = pstmt.executeQuery();
|
||||
|
||||
String publicVlan = null;
|
||||
while (rs.next()) {
|
||||
publicVlan = rs.getString(1);
|
||||
}
|
||||
|
||||
insertNic(conn, controlNetworkId, ssvmId, running, guestMac, guestIp, guestNetmask, "Start", "169.254.0.1", null, "ControlNetworkGuru", false, 0, "Static", guestIp != null ? (ssvmId + guestIp) : null);
|
||||
insertNic(conn, managementNetworkId, ssvmId, running, privateMac, privateIp, privateNetmask, "Start", podGateway, null, "PodBasedNetworkGuru", false, 1, "Static", null);
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
|
||||
|
||||
if (zoneType.equalsIgnoreCase("Basic")) {
|
||||
insertNic(conn, publicNetworkId, ssvmId, running, publicMac, publicIp, publicNetmask, "Start", gateway, publicVlan, "DirectPodBasedNetworkGuru", true, 2, "Static", null);
|
||||
|
||||
} else {
|
||||
insertNic(conn, publicNetworkId, ssvmId, running, publicMac, publicIp, publicNetmask, "Create", gateway, publicVlan, "PublicNetworkGuru", true, 2, "Static", null);
|
||||
}
|
||||
|
||||
long controlNicId = insertNic(conn, controlNetworkId, ssvmId, running, guestMac, guestIp, guestNetmask, "Start", "169.254.0.1", null, "ControlNetworkGuru", false, 0, "Static", guestIp != null ? (ssvmId + guestIp) : null);
|
||||
if (guestIp != null) {
|
||||
pstmt = conn.prepareStatement("UPDATE op_dc_link_local_ip_address_alloc SET instance_id=? WHERE ip_address=? AND data_center_id=?");
|
||||
pstmt.setLong(1, controlNicId);
|
||||
pstmt.setString(2, guestIp);
|
||||
pstmt.setLong(3, dataCenterId);
|
||||
pstmt.executeUpdate();
|
||||
pstmt.close();
|
||||
}
|
||||
|
||||
long mgmtNicId = insertNic(conn, managementNetworkId, ssvmId, running, privateMac, privateIp, privateNetmask, "Start", podGateway, null, "PodBasedNetworkGuru", false, 1, "Static", null);
|
||||
if (privateIp != null) {
|
||||
pstmt = conn.prepareStatement("UPDATE op_dc_ip_address_alloc SET instance_id=? WHERE ip_address=? AND data_center_id=?");
|
||||
pstmt.setLong(1, mgmtNicId);
|
||||
pstmt.setString(2, privateIp);
|
||||
pstmt.setLong(3, dataCenterId);
|
||||
pstmt.executeUpdate();
|
||||
pstmt.close();
|
||||
}
|
||||
}
|
||||
|
||||
protected void upgradeConsoleProxy(Connection conn, long cpId, long publicNetworkId, long managementNetworkId, long controlNetworkId, String zoneType) throws SQLException {
|
||||
protected void upgradeConsoleProxy(Connection conn, long dcId, long cpId, long publicNetworkId, long managementNetworkId, long controlNetworkId, String zoneType) throws SQLException {
|
||||
s_logger.debug("Upgrading cp" + cpId);
|
||||
PreparedStatement pstmt = conn.prepareStatement("SELECT vm_instance.id, vm_instance.state, vm_instance.private_mac_address, vm_instance.private_ip_address, vm_instance.private_netmask, console_proxy.public_mac_address, console_proxy.public_ip_address, console_proxy.public_netmask, console_proxy.guest_mac_address, console_proxy.guest_ip_address, console_proxy.guest_netmask, console_proxy.gateway, vm_instance.type FROM vm_instance INNER JOIN console_proxy ON vm_instance.id=console_proxy.id WHERE vm_instance.removed is NULL AND vm_instance.id=?");
|
||||
pstmt.setLong(1, cpId);
|
||||
|
|
@ -335,15 +400,42 @@ public class Upgrade218to22 implements DbUpgrade {
|
|||
rs.close();
|
||||
pstmt.close();
|
||||
|
||||
pstmt = conn.prepareStatement("SELECT v.vlan_id from vlan v, user_ip_address u where v.id=u.vlan_db_id and u.public_ip_address=?");
|
||||
pstmt.setString(1, publicIp);
|
||||
rs = pstmt.executeQuery();
|
||||
|
||||
if (zoneType.equalsIgnoreCase("Basic")) {
|
||||
insertNic(conn, publicNetworkId, cpId, running, publicMac, publicIp, publicNetmask, "Start", gateway, null, "DirectPodBasedNetworkGuru", true, 2, "Static", null);
|
||||
} else {
|
||||
insertNic(conn, publicNetworkId, cpId, running, publicMac, publicIp, publicNetmask, "Create", gateway, null, "PublicNetworkGuru", true, 2, "Static", null);
|
||||
String publicVlan = null;
|
||||
while (rs.next()) {
|
||||
publicVlan = rs.getString(1);
|
||||
}
|
||||
|
||||
insertNic(conn, controlNetworkId, cpId, running, guestMac, guestIp, guestNetmask, "Start", "169.254.0.1", null, "ControlNetworkGuru", false, 0, "Static", guestIp != null ? (cpId + guestIp) : null);
|
||||
insertNic(conn, managementNetworkId, cpId, running, privateMac, privateIp, privateNetmask, "Start", podGateway, null, "PodBasedNetworkGuru", false, 1, "Static", null);
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
|
||||
if (zoneType.equalsIgnoreCase("Basic")) {
|
||||
insertNic(conn, publicNetworkId, cpId, running, publicMac, publicIp, publicNetmask, "Start", gateway, publicVlan, "DirectPodBasedNetworkGuru", true, 2, "Static", null);
|
||||
} else {
|
||||
insertNic(conn, publicNetworkId, cpId, running, publicMac, publicIp, publicNetmask, "Create", gateway, publicVlan, "PublicNetworkGuru", true, 2, "Static", null);
|
||||
}
|
||||
|
||||
long controlNicId = insertNic(conn, controlNetworkId, cpId, running, guestMac, guestIp, guestNetmask, "Start", "169.254.0.1", null, "ControlNetworkGuru", false, 0, "Static", guestIp != null ? (cpId + guestIp) : null);
|
||||
if (guestIp != null) {
|
||||
pstmt = conn.prepareStatement("UPDATE op_dc_link_local_ip_address_alloc SET instance_id=? WHERE ip_address=? AND data_center_id=?");
|
||||
pstmt.setLong(1, controlNicId);
|
||||
pstmt.setString(2, guestIp);
|
||||
pstmt.setLong(3, dcId);
|
||||
pstmt.executeUpdate();
|
||||
pstmt.close();
|
||||
}
|
||||
long mgmtNicId = insertNic(conn, managementNetworkId, cpId, running, privateMac, privateIp, privateNetmask, "Start", podGateway, null, "PodBasedNetworkGuru", false, 1, "Static", privateIp != null ? (cpId + privateIp) : null);
|
||||
if (privateIp != null) {
|
||||
pstmt = conn.prepareStatement("UPDATE op_dc_ip_address_alloc SET instance_id=? WHERE ip_address=? AND data_center_id=?");
|
||||
pstmt.setLong(1, mgmtNicId);
|
||||
pstmt.setString(2, privateIp);
|
||||
pstmt.setLong(3, dcId);
|
||||
pstmt.executeUpdate();
|
||||
pstmt.close();
|
||||
}
|
||||
}
|
||||
|
||||
protected void upgradeVirtualUserVms(Connection conn, long domainRouterId, long networkId, String gateway, String vnet) throws SQLException {
|
||||
|
|
@ -727,7 +819,7 @@ public class Upgrade218to22 implements DbUpgrade {
|
|||
Long dcId = (Long)dc[0];
|
||||
long mgmtNetworkId = insertNetwork(conn, "ManagementNetwork" + dcId, "Management Network created for Zone " + dcId, "Management", "Native", null, null, null, "Static", managementNetworkOfferingId, dcId, "PodBasedNetworkGuru", "Setup", 1, 1, null, null, null, true, null, false, null);
|
||||
long storageNetworkId = insertNetwork(conn, "StorageNetwork" + dcId, "Storage Network created for Zone " + dcId, "Storage", "Native", null, null, null, "Static", storageNetworkOfferingId, dcId, "PodBasedNetworkGuru", "Setup", 1, 1, null, null, null, true, null, false, null);
|
||||
long controlNetworkId = insertNetwork(conn, "ControlNetwork" + dcId, "Control Network created for Zone " + dcId, "Control", "Native", null, null, null, "Static", controlNetworkOfferingId, dcId, "ControlNetworkGuru", "Setup", 1, 1, null, null, null, true, null, false, null);
|
||||
long controlNetworkId = insertNetwork(conn, "ControlNetwork" + dcId, "Control Network created for Zone " + dcId, "Control", "LinkLocal", null, NetUtils.getLinkLocalGateway(), NetUtils.getLinkLocalCIDR(), "Static", controlNetworkOfferingId, dcId, "ControlNetworkGuru", "Setup", 1, 1, null, null, null, true, null, false, null);
|
||||
upgradeManagementIpAddress(conn, dcId);
|
||||
long basicDefaultDirectNetworkId = insertNetwork(conn, "BasicZoneDirectNetwork" + dcId, "Basic Zone Direct Network created for Zone " + dcId, "Guest", "Native", null, null, null, "Dhcp", 5, dcId, "DirectPodBasedNetworkGuru", "Setup", 1, 1, null, null, "Direct", true, null, true, null);
|
||||
|
||||
|
|
@ -770,16 +862,16 @@ public class Upgrade218to22 implements DbUpgrade {
|
|||
pstmt.close();
|
||||
|
||||
upgradeBasicUserVms(conn, (Long)router[0], basicDefaultDirectNetworkId, (String)router[1], "untagged");
|
||||
upgradeDomR(conn, (Long)router[0], null, basicDefaultDirectNetworkId, controlNetworkId, "Basic");
|
||||
upgradeDomR(conn, dcId, (Long)router[0], null, basicDefaultDirectNetworkId, controlNetworkId, "Basic");
|
||||
}
|
||||
|
||||
upgradeSsvm(conn, dcId, basicDefaultDirectNetworkId, storageNetworkId, controlNetworkId, "Basic");
|
||||
upgradeSsvm(conn, dcId, basicDefaultDirectNetworkId, mgmtNetworkId, controlNetworkId, "Basic");
|
||||
|
||||
pstmt = conn.prepareStatement("SELECT vm_instance.id FROM vm_instance WHERE removed IS NULL AND type='ConsoleProxy' AND data_center_id=?");
|
||||
pstmt.setLong(1, dcId);
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next()) {
|
||||
upgradeConsoleProxy(conn, rs.getLong(1), basicDefaultDirectNetworkId, mgmtNetworkId, controlNetworkId, "Basic");
|
||||
upgradeConsoleProxy(conn, dcId, rs.getLong(1), basicDefaultDirectNetworkId, mgmtNetworkId, controlNetworkId, "Basic");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -790,7 +882,7 @@ public class Upgrade218to22 implements DbUpgrade {
|
|||
long storageNetworkId = insertNetwork(conn, "StorageNetwork" + dcId, "Storage Network created for Zone " + dcId, "Storage", "Native", null, null, null, "Static", storageNetworkOfferingId, dcId, "PodBasedNetworkGuru", "Setup", 1, 1, null, null, null, true, null, false, null);
|
||||
long controlNetworkId = insertNetwork(conn, "ControlNetwork" + dcId, "Control Network created for Zone " + dcId, "Control", "Native", null, null, null, "Static", controlNetworkOfferingId, dcId, "ControlNetworkGuru", "Setup", 1, 1, null, null, null, true, null, false, null);
|
||||
upgradeManagementIpAddress(conn, dcId);
|
||||
long publicNetworkId = insertNetwork(conn, "PublicNetwork" + dcId, "Public Network Created for Zone " + dcId, "Public", "Native", null, null, null, "Static", publicNetworkOfferingId, dcId, "PublicNetworkGuru", "Setup", 1,1, null, null, null, true, null, false, null);
|
||||
long publicNetworkId = insertNetwork(conn, "PublicNetwork" + dcId, "Public Network Created for Zone " + dcId, "Public", "Vlan", null, null, null, "Static", publicNetworkOfferingId, dcId, "PublicNetworkGuru", "Setup", 1,1, null, null, null, true, null, false, null);
|
||||
|
||||
pstmt = conn.prepareStatement("SELECT vm_instance.id, vm_instance.domain_id, vm_instance.account_id, domain_router.guest_ip_address, domain_router.domain, domain_router.dns1, domain_router.dns2, domain_router.vnet FROM vm_instance INNER JOIN domain_router ON vm_instance.id=domain_router.id WHERE vm_instance.removed IS NULL AND vm_instance.type='DomainRouter' AND vm_instance.data_center_id=?");
|
||||
pstmt.setLong(1, dcId);
|
||||
|
|
@ -828,7 +920,7 @@ public class Upgrade218to22 implements DbUpgrade {
|
|||
s_logger.debug("Network inserted for " + router[0] + " id = " + virtualNetworkId);
|
||||
|
||||
upgradeVirtualUserVms(conn, (Long)router[0], virtualNetworkId, (String)router[3], vnet);
|
||||
upgradeDomR(conn, (Long)router[0], publicNetworkId, virtualNetworkId, controlNetworkId, "Advanced");
|
||||
upgradeDomR(conn, dcId, (Long)router[0], publicNetworkId, virtualNetworkId, controlNetworkId, "Advanced");
|
||||
}
|
||||
|
||||
upgradePublicUserIpAddress(conn, dcId, publicNetworkId, "VirtualNetwork");
|
||||
|
|
@ -880,13 +972,13 @@ public class Upgrade218to22 implements DbUpgrade {
|
|||
upgradeDirectUserIpAddress(conn, dcId, vlanNetworkMap.get(tag), "DirectAttached");
|
||||
}
|
||||
|
||||
upgradeSsvm(conn, dcId, publicNetworkId, storageNetworkId, controlNetworkId, "Advanced");
|
||||
upgradeSsvm(conn, dcId, publicNetworkId, mgmtNetworkId, controlNetworkId, "Advanced");
|
||||
|
||||
pstmt = conn.prepareStatement("SELECT vm_instance.id FROM vm_instance WHERE removed IS NULL AND type='ConsoleProxy' AND data_center_id=?");
|
||||
pstmt.setLong(1, dcId);
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next()) {
|
||||
upgradeConsoleProxy(conn, rs.getLong(1), publicNetworkId, mgmtNetworkId, controlNetworkId, "Advanced");
|
||||
upgradeConsoleProxy(conn, dcId, rs.getLong(1), publicNetworkId, mgmtNetworkId, controlNetworkId, "Advanced");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,6 +92,19 @@ public class AdvanceZone217To224UpgradeTest extends TestCase {
|
|||
rs.close();
|
||||
pstmt.close();
|
||||
|
||||
pstmt = conn.prepareStatement("SELECT COUNT(*) FROM op_dc_link_local_ip_address_alloc WHERE nic_id IS NOT NULL");
|
||||
rs = pstmt.executeQuery();
|
||||
rs.next();
|
||||
int controlNics = rs.getInt(1);
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
|
||||
pstmt = conn.prepareStatement("SELECT COUNT(*) FROM nics WHERE reserver_name='ControlNetworkGuru' and ip4_address is NOT NULL");
|
||||
rs = pstmt.executeQuery();
|
||||
assert (rs.next() && controlNics == rs.getInt(1)) : "Allocated nics should have been " + controlNics + " but it is " + rs.getInt(1);
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
|
||||
|
||||
} finally {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -493,6 +493,7 @@ CREATE TABLE `cloud`.`data_center` (
|
|||
`allocation_state` varchar(32) NOT NULL DEFAULT 'Enabled' COMMENT 'Is this data center enabled for allocation for new resources',
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `fk_data_center__domain_id` FOREIGN KEY (`domain_id`) REFERENCES `domain`(`id`),
|
||||
INDEX `i_data_center__domain_id`(`domain_id`),
|
||||
INDEX `i_data_center__allocation_state`(`allocation_state`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
|
@ -501,13 +502,13 @@ CREATE TABLE `cloud`.`op_dc_ip_address_alloc` (
|
|||
`ip_address` char(40) NOT NULL COMMENT 'ip address',
|
||||
`data_center_id` bigint unsigned NOT NULL COMMENT 'data center it belongs to',
|
||||
`pod_id` bigint unsigned NOT NULL COMMENT 'pod it belongs to',
|
||||
`instance_id` bigint unsigned NULL COMMENT 'instance id',
|
||||
`nic_id` bigint unsigned NULL COMMENT 'nic id',
|
||||
`reservation_id` char(40) NULL COMMENT 'reservation id',
|
||||
`taken` datetime COMMENT 'Date taken',
|
||||
`mac_address` bigint unsigned NOT NULL COMMENT 'mac address for management ips',
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `fk_op_dc_ip_address_alloc__data_center_id` FOREIGN KEY (`data_center_id`) REFERENCES `data_center`(`id`) ON DELETE CASCADE,
|
||||
INDEX `i_op_dc_ip_address_alloc__pod_id__data_center_id__taken` (`pod_id`, `data_center_id`, `taken`, `instance_id`),
|
||||
INDEX `i_op_dc_ip_address_alloc__pod_id__data_center_id__taken` (`pod_id`, `data_center_id`, `taken`, `nic_id`),
|
||||
UNIQUE `i_op_dc_ip_address_alloc__ip_address__data_center_id`(`ip_address`, `data_center_id`),
|
||||
CONSTRAINT `fk_op_dc_ip_address_alloc__pod_id` FOREIGN KEY (`pod_id`) REFERENCES `host_pod_ref` (`id`) ON DELETE CASCADE,
|
||||
INDEX `i_op_dc_ip_address_alloc__pod_id`(`pod_id`)
|
||||
|
|
@ -518,7 +519,7 @@ CREATE TABLE `cloud`.`op_dc_link_local_ip_address_alloc` (
|
|||
`ip_address` char(40) NOT NULL COMMENT 'ip address',
|
||||
`data_center_id` bigint unsigned NOT NULL COMMENT 'data center it belongs to',
|
||||
`pod_id` bigint unsigned NOT NULL COMMENT 'pod it belongs to',
|
||||
`instance_id` bigint unsigned NULL COMMENT 'instance id',
|
||||
`nic_id` bigint unsigned NULL COMMENT 'instance id',
|
||||
`reservation_id` char(40) NULL COMMENT 'reservation id used to reserve this network',
|
||||
`taken` datetime COMMENT 'Date taken',
|
||||
PRIMARY KEY (`id`)
|
||||
|
|
@ -870,7 +871,7 @@ CREATE TABLE `cloud`.`domain_router` (
|
|||
`public_netmask` varchar(15) COMMENT 'netmask used for the domR',
|
||||
`guest_netmask` varchar(15) COMMENT 'netmask used for the guest network',
|
||||
`guest_ip_address` char(40) COMMENT ' ip address in the guest network',
|
||||
`network_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT 'network configuration that this domain router belongs to',
|
||||
`network_id` bigint unsigned NOT NULL COMMENT 'network configuration that this domain router belongs to',
|
||||
`role` varchar(64) NOT NULL COMMENT 'type of role played by this router',
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `fk_domain_router__id` FOREIGN KEY `fk_domain_router__id` (`id`) REFERENCES `vm_instance`(`id`) ON DELETE CASCADE
|
||||
|
|
@ -962,7 +963,7 @@ CREATE TABLE `cloud`.`domain` (
|
|||
`parent` bigint unsigned,
|
||||
`name` varchar(255),
|
||||
`owner` bigint unsigned NOT NULL,
|
||||
`path` varchar(255),
|
||||
`path` varchar(255) UNIQUE NOT NULL,
|
||||
`level` int(10) NOT NULL DEFAULT 0,
|
||||
`child_count` int(10) NOT NULL DEFAULT 0,
|
||||
`next_child_seq` bigint unsigned NOT NULL DEFAULT 1,
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ ALTER TABLE `cloud`.`domain_router` DROP COLUMN `vlan_id`;
|
|||
ALTER TABLE `cloud`.`domain_router` DROP COLUMN `domain_id`;
|
||||
ALTER TABLE `cloud`.`domain_router` DROP COLUMN `account_id`;
|
||||
ALTER TABLE `cloud`.`domain_router` DROP COLUMN `dhcp_ip_address`;
|
||||
ALTER TABLE `cloud`.`domain_router` DROP COLUMN `domain`;
|
||||
|
||||
ALTER TABLE `cloud`.`console_proxy` DROP FOREIGN KEY `fk_console_proxy__vlan_id`;
|
||||
ALTER TABLE `cloud`.`console_proxy` DROP INDEX `i_console_proxy__vlan_id`;
|
||||
|
|
|
|||
|
|
@ -289,23 +289,19 @@ ALTER TABLE `cloud`.`data_center` ADD COLUMN `vpn_provider` char(64) DEFAULT 'Vi
|
|||
ALTER TABLE `cloud`.`data_center` ADD COLUMN `userdata_provider` char(64) DEFAULT 'VirtualRouter';
|
||||
ALTER TABLE `cloud`.`data_center` ADD COLUMN `enable` tinyint NOT NULL DEFAULT 1;
|
||||
|
||||
#TODO: We need something to adjust the networktype for all of the existing data centers. How to tell if it is Basic/Advance?;
|
||||
ALTER TABLE `cloud`.`data_center` ADD CONSTRAINT `fk_data_center__domain_id` FOREIGN KEY (`domain_id`) REFERENCES `domain`(`id`);
|
||||
|
||||
ALTER TABLE `cloud`.`op_dc_ip_address_alloc` ADD COLUMN `reservation_id` char(40) NULL;
|
||||
ALTER TABLE `cloud`.`op_dc_ip_address_alloc` ADD COLUMN `mac_address` bigint unsigned NOT NULL;
|
||||
UPDATE `cloud`.`op_dc_ip_address_alloc` SET reservation_id=concat(cast(instance_id as CHAR), ip_address) WHERE taken is NOT NULL;
|
||||
#UPDATE `cloud`.`op_dc_ip_address_alloc` as alloc1 SET mac_address=id-(SELECT min(alloc2.id) from op_dc_ip_address_alloc as alloc2 WHERE alloc2.data_center_id=alloc1.data_center_id)+1;
|
||||
|
||||
ALTER TABLE `cloud`.`op_dc_link_local_ip_address_alloc` ADD COLUMN `reservation_id` char(40) NULL;
|
||||
UPDATE `cloud`.`op_dc_link_local_ip_address_alloc` SET reservation_id=concat(cast(instance_id as CHAR),ip_address) WHERE taken is NOT NULL;
|
||||
|
||||
#TODO: Set the Reservation id for this table?;
|
||||
|
||||
ALTER TABLE `cloud`.`host_pod_ref` ADD COLUMN `enabled` tinyint NOT NULL DEFAULT 1;
|
||||
|
||||
ALTER TABLE `cloud`.`op_dc_vnet_alloc` ADD COLUMN `reservation_id` char(40) NULL;
|
||||
UPDATE op_dc_vnet_alloc set reservation_id=concat(cast(data_center_id as CHAR), concat("-", vnet)) WHERE taken is NOT NULL;
|
||||
#TODO: Set the Reservation id for this table;
|
||||
|
||||
ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `service_offering_id` bigint unsigned NOT NULL;
|
||||
ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `reservation_id` char(40);
|
||||
|
|
@ -372,6 +368,9 @@ ALTER TABLE `cloud`.`disk_offering` ADD COLUMN `system_use` tinyint(1) unsigned
|
|||
ALTER TABLE `cloud`.`disk_offering` ADD COLUMN `customized` tinyint(1) unsigned NOT NULL DEFAULT 0;
|
||||
|
||||
update `cloud`.`disk_offering` set system_use=1, removed=null WHERE unique_name like 'Cloud.Com-%';
|
||||
update `cloud`.`disk_offering` set name='System Offering For Console Proxy' where name='Fake Offering For DomP' and system_use=1;
|
||||
update `cloud`.`disk_offering` set name='System Offering For Software Router' where name='Fake Offering For DomR' and system_use=1;
|
||||
update `cloud`.`disk_offering` set name='System Offering For Secondary Storage VM' where name='Fake Offering For Secondary Storage VM' and system_use=1;
|
||||
|
||||
ALTER TABLE `cloud`.`user_statistics` ADD COLUMN `public_ip_address` varchar(15) DEFAULT NULL;
|
||||
ALTER TABLE `cloud`.`user_statistics` ADD COLUMN `device_id` bigint unsigned NOT NULL;
|
||||
|
|
@ -950,4 +949,8 @@ ALTER TABLE `cloud`.`instance_group` ADD CONSTRAINT `fk_instance_group__account_
|
|||
|
||||
ALTER TABLE `cloud`.`instance_group_vm_map` ADD CONSTRAINT `fk_instance_group_vm_map___group_id` FOREIGN KEY `fk_instance_group_vm_map___group_id` (`group_id`) REFERENCES `instance_group` (`id`) ON DELETE CASCADE;
|
||||
ALTER TABLE `cloud`.`instance_group_vm_map` ADD CONSTRAINT `fk_instance_group_vm_map___instance_id` FOREIGN KEY `fk_instance_group_vm_map___instance_id` (`instance_id`) REFERENCES `user_vm` (`id`) ON DELETE CASCADE;
|
||||
ALTER TABLE `cloud`.`secondary_storage_vm` MODIFY COLUMN `guid` varchar(255);
|
||||
ALTER TABLE `cloud`.`domain` MODIFY COLUMN `path` varchar(255) UNIQUE NOT NULL;
|
||||
|
||||
ALTER TABLE `cloud`.`ssh_keypairs` ADD CONSTRAINT `fk_ssh_keypairs__account_id` FOREIGN KEY `fk_ssh_keypair__account_id` (`account_id`) REFERENCES `account` (`id`) ON DELETE CASCADE;
|
||||
ALTER TABLE `cloud`.`ssh_keypairs` ADD CONSTRAINT `fk_ssh_keypairs__domain_id` FOREIGN KEY `fk_ssh_keypair__domain_id` (`domain_id`) REFERENCES `domain` (`id`) ON DELETE CASCADE;
|
||||
|
|
|
|||
|
|
@ -61,7 +61,16 @@ ALTER TABLE `cloud`.`host` ADD INDEX `i_host__allocation_state`(`allocation_stat
|
|||
|
||||
ALTER TABLE `cloud`.`domain` ADD INDEX `i_domain__path`(`path`);
|
||||
|
||||
<<<<<<< HEAD
|
||||
CREATE TABLE `cloud`.`data_center_details` (
|
||||
`id` bigint unsigned NOT NULL auto_increment,
|
||||
`dc_id` bigint unsigned NOT NULL COMMENT 'dc id',
|
||||
`name` varchar(255) NOT NULL,
|
||||
`value` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `fk_dc_details__dc_id` FOREIGN KEY (`dc_id`) REFERENCES `data_center`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
#('Advanced','DEFAULT','management-server','management.network.cidr','192.168.130.0/24','The cidr of management server network'),;
|
||||
INSERT INTO `cloud`.`configuration` VALUES
|
||||
('Advanced','DEFAULT','management-server','control.cidr','169.254.0.0/16','Changes the cidr for the control network traffic. Defaults to using link local. Must be unique within pods'),
|
||||
('Advanced','DEFAULT','management-server','control.gateway','169.254.0.1','gateway for the control network traffic'),
|
||||
|
|
@ -72,6 +81,8 @@ INSERT INTO `cloud`.`configuration` VALUES
|
|||
('Console Proxy','DEFAULT','AgentManager','consoleproxy.restart','true','Console proxy restart flag, defaulted to true'),
|
||||
('Console Proxy','DEFAULT','AgentManager','consoleproxy.url.domain','realhostip.com','Console proxy url domain'),
|
||||
('Advanced','DEFAULT','management-server','extract.url.cleanup.interval','120','The interval (in seconds) to wait before cleaning up the extract URL\'s '),
|
||||
('Network','DEFAULT','AgentManager','guest.ip.network','10.1.1.1','The network address of the guest virtual network. Virtual machines will be assigned an IP in this subnet.'),
|
||||
('Network','DEFAULT','AgentManager','guest.netmask','255.255.255.0','The netmask of the guest virtual network.'),
|
||||
('Network','DEFAULT','management-server','guest.vlan.bits','12','The number of bits to reserve for the VLAN identifier in the guest subnet.'),
|
||||
('Advanced','DEFAULT','management-server','host.capacity.checker.interval','3600','Time (in seconds) to wait before recalculating host\'s capacity'),
|
||||
('Advanced','DEFAULT','management-server','host.capacity.checker.wait','3600','Time (in seconds) to wait before starting host capacity background checker'),
|
||||
|
|
@ -102,5 +113,8 @@ INSERT INTO `cloud`.`configuration` VALUES
|
|||
('Advanced','DEFAULT','management-server','vmware.service.console','Service Console','Specify the service console network name (ESX host only)'),
|
||||
('Advanced','DEFAULT','AgentManager','xapiwait','600','Time (in seconds) to wait for XAPI to return');
|
||||
|
||||
INSERT INTO `cloud`.`sequence` (name, value) VALUES ('checkpoint_seq', 1);
|
||||
DELETE FROM `cloud`.`sequence` WHERE name='snapshots_seq';
|
||||
ALTER TABLE `cloud`.`op_dc_ip_address_alloc` CHANGE COLUMN `instance_id` `nic_id` bigint unsigned DEFAULT NULL;
|
||||
ALTER TABLE op_dc_ip_address_alloc ADD CONSTRAINT `fk_op_dc_ip_address_alloc__data_center_id` FOREIGN KEY (`data_center_id`) REFERENCES `data_center`(`id`) ON DELETE CASCADE;
|
||||
ALTER TABLE `cloud`.`op_dc_link_local_ip_address_alloc` CHANGE COLUMN `instance_id` `nic_id` bigint unsigned DEFAULT NULL;
|
||||
|
||||
DELETE FROM `sequence` WHERE name='snapshots_seq';
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ public class ExceptionUtil {
|
|||
public static String toString(Throwable th) {
|
||||
return toString(th, true);
|
||||
}
|
||||
|
||||
public static String toString(Throwable th, boolean printStack) {
|
||||
final StringWriter writer = new StringWriter();
|
||||
writer.append("Exception: " + th.getClass().getName() + "\n");
|
||||
|
|
@ -32,8 +31,8 @@ public class ExceptionUtil {
|
|||
writer.append(th.getMessage()).append("\n");
|
||||
|
||||
if(printStack) {
|
||||
writer.append("Stack: ");
|
||||
th.printStackTrace(new PrintWriter(writer));
|
||||
writer.append("Stack: ");
|
||||
th.printStackTrace(new PrintWriter(writer));
|
||||
}
|
||||
return writer.toString();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue