mirror of https://github.com/apache/cloudstack.git
Add element_id for 3.0 upgrade
This commit is contained in:
parent
cc10e01895
commit
46d2b49edf
|
|
@ -84,6 +84,8 @@ public class Upgrade2214to30 implements DbUpgrade {
|
|||
createNetworkServices(conn);
|
||||
//migrate user concentrated deployment planner choice to new global setting
|
||||
migrateUserConcentratedPlannerChoice(conn);
|
||||
// update domain router table for element it;
|
||||
updateRouters(conn);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -672,6 +674,26 @@ public class Upgrade2214to30 implements DbUpgrade {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateRouters(Connection conn) {
|
||||
PreparedStatement pstmt = null;
|
||||
try {
|
||||
s_logger.debug("Updating domain_router table");
|
||||
pstmt = conn
|
||||
.prepareStatement("UPDATE domain_router, virtual_router_providers vrp LEFT JOIN (physical_network_service_providers pnsp INNER JOIN networks ntwk INNER JOIN domain_router vr) ON (vrp.nsp_id = pnsp.id and pnsp.physical_network_id = ntwk.physical_network_id and ntwk.id=vr.network_id) SET vr.element_id=vrp.id;");
|
||||
pstmt.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Unable to update router table. ", e);
|
||||
} finally {
|
||||
try {
|
||||
if (pstmt != null) {
|
||||
pstmt.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Unable to close statement for router table. ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateReduntantRouters(Connection conn) {
|
||||
PreparedStatement pstmt = null;
|
||||
|
|
|
|||
|
|
@ -485,6 +485,8 @@ CREATE TABLE `cloud`.`virtual_router_providers` (
|
|||
CONSTRAINT `uc_virtual_router_providers__uuid` UNIQUE (`uuid`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `cloud`.`domain_router` ADD COLUMN `element_id` bigint unsigned NOT NULL COMMENT 'correlated virtual router provider ID' AFTER id;
|
||||
ALTER TABLE `cloud`.`domain_router` ADD CONSTRAINT `fk_domain_router__element_id` FOREIGN KEY `fk_domain_router__element_id`(`element_id`) REFERENCES `virtual_router_providers`(`id`);
|
||||
|
||||
INSERT INTO `cloud`.`sequence` (name, value) VALUES ('physical_networks_seq', 200);
|
||||
ALTER TABLE `cloud`.`networks` ADD COLUMN `physical_network_id` bigint unsigned COMMENT 'physical network id that this configuration is based on' AFTER network_offering_id;
|
||||
|
|
|
|||
Loading…
Reference in New Issue