added user ip address upgrade

This commit is contained in:
Alex Huang 2011-03-07 17:53:31 -08:00
parent 20045b3664
commit 35275c1615
4 changed files with 20 additions and 19 deletions

View File

@ -42,7 +42,6 @@ import com.cloud.service.ServiceOfferingVO;
import com.cloud.storage.DiskOfferingVO;
import com.cloud.storage.GuestOSVO;
import com.cloud.storage.StoragePoolVO;
import com.cloud.storage.StorageStats;
import com.cloud.storage.VMTemplateVO;
import com.cloud.storage.VolumeStats;
import com.cloud.storage.VolumeVO;
@ -112,14 +111,6 @@ public interface ManagementServer extends ManagementService {
*/
Account getAccount(long accountId);
/**
* Gets Storage statistics for a given host
*
* @param hostId
* @return StorageStats
*/
StorageStats getStorageStatistics(long hostId);;
/**
* Gets Volume statistics. The array returned will contain VolumeStats in the same order
* as the array of volumes requested.

View File

@ -204,7 +204,6 @@ import com.cloud.storage.StorageManager;
import com.cloud.storage.StoragePoolHostVO;
import com.cloud.storage.StoragePoolStatus;
import com.cloud.storage.StoragePoolVO;
import com.cloud.storage.StorageStats;
import com.cloud.storage.Upload;
import com.cloud.storage.Upload.Mode;
import com.cloud.storage.UploadVO;
@ -443,11 +442,6 @@ public class ManagementServerImpl implements ManagementServer {
return _configs;
}
@Override
public StorageStats getStorageStatistics(long hostId) {
return _statsCollector.getStorageStats(hostId);
}
@Override
public VolumeStats[] getVolumeStatistics(long[] volIds) {
return _statsCollector.getVolumeStats(volIds);

View File

@ -141,6 +141,20 @@ public class Upgrade217to22 implements DbUpgrade {
}
}
protected void upgradeUserIpAddress(Connection conn, long dcId, long networkId) throws SQLException {
PreparedStatement pstmt = conn.prepareStatement("UPDATE user_ip_address INNER JOIN vlan ON user_ip_address.vlan_db_id=vlan.id SET source_network_id=? WHERE user_ip_address.data_center_id=? AND vlan.vlan_type='VirtualNetwork'");
pstmt.setLong(1, networkId);
pstmt.setLong(2, dcId);
pstmt.executeUpdate();
pstmt.close();
pstmt = conn.prepareStatement("UPDATE vlan SET network_id = ? WHERE data_center_id=? AND vlan_type='VirtualNetwork'");
pstmt.setLong(1, networkId);
pstmt.setLong(2, dcId);
pstmt.executeUpdate();
pstmt.close();
}
protected void upgradeDataCenter(Connection conn) {
PreparedStatement pstmt;
try {
@ -237,7 +251,7 @@ public class Upgrade217to22 implements DbUpgrade {
} else {
for (Object[] dc : dcs) {
Long dcId = (Long)dc[0];
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", "Native", 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);
@ -267,13 +281,15 @@ public class Upgrade217to22 implements DbUpgrade {
vnet = "vlan://" + vnet;
state = "Implemented";
}
long networkId = insertNetwork(conn, "VirtualNetwork" + router[0], "Virtual Network for " + router[0], "Guest", "Vlan", vnet, (String)router[3], (String)dc[1], "Dhcp", 6, dcId, "GuestNetworkGuru", state, (Long)router[1], (Long)router[2], (String)router[5], (String)router[6], "Virtual", false, (String)router[4], true, reservationId);
long virtualNetworkId = insertNetwork(conn, "VirtualNetwork" + router[0], "Virtual Network for " + router[0], "Guest", "Vlan", vnet, (String)router[3], (String)dc[1], "Dhcp", 6, dcId, "GuestNetworkGuru", state, (Long)router[1], (Long)router[2], (String)router[5], (String)router[6], "Virtual", false, (String)router[4], true, reservationId);
pstmt = conn.prepareStatement("UPDATE domain_router SET network_id = ? wHERE id = ? ");
pstmt.setLong(1, networkId);
pstmt.setLong(1, virtualNetworkId);
pstmt.setLong(2, (Long)router[0]);
pstmt.executeUpdate();
pstmt.close();
}
upgradeUserIpAddress(conn, dcId, publicNetworkId);
}
}

View File

@ -192,7 +192,7 @@ ALTER TABLE `cloud`.`user_ip_address` ADD COLUMN `mac_address` bigint unsigned N
ALTER TABLE `cloud`.`user_ip_address` ADD COLUMN `source_network_id` bigint unsigned NOT NULL;
ALTER TABLE `cloud`.`user_ip_address` ADD COLUMN `network_id` bigint unsigned;
UPDATE `cloud`.`user_ip_address` set state=`Allocated` WHERE allocated IS NOT NULL;
UPDATE `cloud`.`user_ip_address` set state='Allocated' WHERE allocated IS NOT NULL;
CREATE TABLE `cloud`.`firewall_rules` (
`id` bigint unsigned NOT NULL auto_increment COMMENT 'id',