restarting domr is close to working

This commit is contained in:
Alex Huang 2011-03-21 17:55:53 -07:00
parent 405f56c87a
commit 109c4eae0e
7 changed files with 51 additions and 51 deletions

View File

@ -668,7 +668,9 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
if(tmpltStoredOn != null && answer != null && (answer instanceof CreateAnswer) && ((CreateAnswer)answer).templateReloadRequested()) {
if(!_tmpltMgr.resetTemplateDownloadStateOnPool(tmpltStoredOn.getId()))
break; // break out of template-redeploy retry loop
{
break; // break out of template-redeploy retry loop
}
} else {
break;
}
@ -678,8 +680,9 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
}
}
if(created != null)
break;
if(created != null) {
break;
}
s_logger.debug("Retrying the create because it failed on pool " + pool);
}
@ -1371,12 +1374,6 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
String destPrimaryStorageVolumePath = cvAnswer.getVolumePath();
String destPrimaryStorageVolumeFolder = cvAnswer.getVolumeFolder();
try {
destroyVolume(volume);
} catch (ConcurrentOperationException e) {
s_logger.warn("Concurrent Operation", e);
}
expungeVolume(volume);
volume.setPath(destPrimaryStorageVolumePath);
@ -2575,7 +2572,9 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
} else {
if(tmpltStoredOn != null && (answer instanceof CreateAnswer) && ((CreateAnswer)answer).templateReloadRequested()) {
if(!_tmpltMgr.resetTemplateDownloadStateOnPool(tmpltStoredOn.getId()))
break; // break out of template-redeploy retry loop
{
break; // break out of template-redeploy retry loop
}
} else {
break;
}
@ -2742,8 +2741,9 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
List<CapacityVO> capacities = new LinkedList<CapacityVO>();
for (HostVO host : hosts){
StorageStats stats = ApiDBUtils.getSecondaryStorageStatistics(host.getId());
if (stats == null)
continue;
if (stats == null) {
continue;
}
CapacityVO capacity = new CapacityVO(host.getId(), host.getDataCenterId(), host.getPodId(),
host.getClusterId(), stats.getByteUsed(), stats.getCapacityBytes(), Capacity.CAPACITY_TYPE_SECONDARY_STORAGE);
@ -2777,8 +2777,9 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
for (StoragePoolVO storagePool : pools){
StorageStats stats = ApiDBUtils.getStoragePoolStatistics(storagePool.getId());
if (stats == null)
continue;
if (stats == null) {
continue;
}
CapacityVO capacity = new CapacityVO(storagePool.getId(), storagePool.getDataCenterId(), storagePool.getPodId(), storagePool.getClusterId(),
stats.getByteUsed(), stats.getCapacityBytes(), CapacityVO.CAPACITY_TYPE_STORAGE);

View File

@ -60,12 +60,10 @@ import com.cloud.utils.Pair;
import com.cloud.utils.component.AdapterBase;
import com.cloud.utils.component.Inject;
import com.cloud.vm.DiskProfile;
import com.cloud.vm.VMInstanceVO;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
public abstract class AbstractStoragePoolAllocator extends AdapterBase implements StoragePoolAllocator {
private static final Logger s_logger = Logger.getLogger(FirstFitStoragePoolAllocator.class);
private static final Logger s_logger = Logger.getLogger(AbstractStoragePoolAllocator.class);
@Inject TemplateManager _tmpltMgr;
@Inject StorageManager _storageMgr;
@Inject StoragePoolDao _storagePoolDao;

View File

@ -226,7 +226,7 @@ public class Upgrade217to22 implements DbUpgrade {
} 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, guestNetworkId, domrId, running, guestMac, guestIp, guestNetmask, "Start", null, vnet, "GuestNetworkGuru", false, 0, "Static", null);
insertNic(conn, guestNetworkId, domrId, running, guestMac, guestIp, guestNetmask, "Start", null, vnet, "ExternalGuestNetworkGuru", false, 0, "Static", null);
}
@ -363,7 +363,7 @@ public class Upgrade217to22 implements DbUpgrade {
running = true;
}
insertNic(conn, networkId, (Long)vm[0], running, (String)vm[1], (String)vm[2], (String)vm[3], "Start", gateway, vnet, "GuestNetworkGuru", true, 0, "Dhcp", null);
insertNic(conn, networkId, (Long)vm[0], running, (String)vm[1], (String)vm[2], (String)vm[3], "Start", gateway, vnet, "ExternalGuestNetworkGuru", true, 0, "Dhcp", null);
}
}
@ -803,7 +803,7 @@ public class Upgrade217to22 implements DbUpgrade {
reservationId = dcId + "-" + vnet;
state = "Implemented";
}
long virtualNetworkId = insertNetwork(conn, "VirtualNetwork" + router[0], "Virtual Network for " + router[0], "Guest", "Vlan", "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", "vlan://" + vnet, (String)router[3], (String)dc[1], "Dhcp", 6, dcId, "ExternalGuestNetworkGuru", 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, virtualNetworkId);
pstmt.setLong(2, (Long)router[0]);

View File

@ -64,30 +64,26 @@ public class InstanceGroup217To224UpgradeTest extends TestCase {
if (!version.equals("2.1.7")) {
s_logger.error("Version returned is not 2.1.7 but " + version);
} else {
s_logger.debug("Instance group test version is " + version);
s_logger.debug("Basic zone test version is " + version);
}
Long groupNumberVmInstance = 0L;
ArrayList<Object[]> groups = new ArrayList<Object[]>();
ArrayList<Object[]> groupVmMaps = new ArrayList<Object[]>();
Connection conn = Transaction.getStandaloneConnection();
try {
//Check that correct number of instance groups were created
pstmt = conn.prepareStatement("SELECT DISTINCT v.group, u.account_id from vm_instance v, user_vm u where v.group is not null and u.id=v.id");
s_logger.debug("Query is " + pstmt);
pstmt = conn.prepareStatement("SELECT DISTINCT v.group, v.account_id from vm_instance v where v.group is not null");
rs = pstmt.executeQuery();
while (rs.next()) {
groupNumberVmInstance++;
}
s_logger.debug("Found " + groupNumberVmInstance);
rs.close();
pstmt.close();
//For each instance group from vm_instance table check that 1) entry was created in the instance_group table 2) vm to group map exists in instance_group_vm_map table
//Check 1)
pstmt = conn.prepareStatement("SELECT DISTINCT v.group, u.account_id from vm_instance v, user_vm u where v.group is not null and u.id=v.id");
pstmt = conn.prepareStatement("SELECT DISTINCT v.group, v.account_id from vm_instance v where v.group is not null");
rs = pstmt.executeQuery();
while (rs.next()) {
Object[] group = new Object[10];
@ -97,24 +93,7 @@ public class InstanceGroup217To224UpgradeTest extends TestCase {
}
rs.close();
pstmt.close();
//Check 2)
pstmt = conn.prepareStatement("SELECT g.id, v.id from vm_instance v, instance_group g, user_vm u where g.name=v.group and g.account_id=u.account_id and u.id=v.id and v.group is not null");
rs = pstmt.executeQuery();
while (rs.next()) {
Object[] groupMaps = new Object[10];
groupMaps[0] = rs.getLong(1); // vmId
groupMaps[1] = rs.getLong(2); // groupId
groupVmMaps.add(groupMaps);
}
rs.close();
pstmt.close();
} catch (Exception ex) {
s_logger.error("Instance group test failed due to ", ex);
}finally {
} finally {
conn.close();
}
@ -165,6 +144,19 @@ public class InstanceGroup217To224UpgradeTest extends TestCase {
rs.close();
pstmt.close();
//Check 2)
pstmt = conn.prepareStatement("SELECT g.id, v.id from vm_instance v, instance_group g where g.name=v.group and g.account_id=v.account_id and v.group is not null");
rs = pstmt.executeQuery();
ArrayList<Object[]> groupVmMaps = new ArrayList<Object[]>();
while (rs.next()) {
Object[] groupMaps = new Object[10];
groupMaps[0] = rs.getLong(1); // vmId
groupMaps[1] = rs.getLong(2); // groupId
groupVmMaps.add(groupMaps);
}
rs.close();
pstmt.close();
for (Object[] groupMap : groupVmMaps) {
Long groupId = (Long)groupMap[0];
Long instanceId = (Long)groupMap[1];
@ -179,9 +171,7 @@ public class InstanceGroup217To224UpgradeTest extends TestCase {
s_logger.debug("Instance group upgrade test is passed");
} catch (Exception ex) {
s_logger.debug("Instance group test failed due to ", ex);
}finally {
} finally {
conn.close();
}
}

View File

@ -86,7 +86,7 @@ ALTER TABLE `cloud`.`secondary_storage_vm` DROP COLUMN `guest_netmask`;
ALTER TABLE `cloud`.`secondary_storage_vm` DROP COLUMN `vlan_db_id`;
ALTER TABLE `cloud`.`secondary_storage_vm` DROP COLUMN `vlan_id`;
ALTER TABLE `cloud`.`secondary_storage_vm` DROP COLUMN `ram_size`;
ALTER TABLE `cloud`.`secondary_storage_vm` DROP COLUMN `guid`;
#ALTER TABLE `cloud`.`secondary_storage_vm` DROP COLUMN `guid`;
#ALTER TABLE `cloud`.`vlan` ADD CONSTRAINT `fk_vlan__network_id` FOREIGN KEY `fk_vlan__network_id`(`network_id`) REFERENCES `networks`(`id`);

View File

@ -302,12 +302,19 @@ ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `domain_id` bigint unsigned NOT NUL
UPDATE vm_instance inner join user_vm on user_vm.id=vm_instance.id set vm_instance.service_offering_id=user_vm.service_offering_id, vm_instance.account_id=user_vm.account_id, vm_instance.domain_id=user_vm.domain_id where vm_instance.id = user_vm.id and vm_instance.type='User';
UPDATE vm_instance inner join domain_router on vm_instance.id=domain_router.id set vm_instance.account_id=domain_router.account_id, vm_instance.domain_id=domain_router.domain_id where vm_instance.type='DomainRouter';
UPDATE vm_instance SET service_offering_id=(SELECT id FROM disk_offering WHERE unique_name='Cloud.Com-SoftwareRouter') WHERE type='DomainRouter';
UPDATE vm_instance SET service_offering_id=(SELECT id FROM disk_offering WHERE unique_name='Cloud.Com-ConsoleProxy') WHERE type='ConsoleProxy';
UPDATE vm_instance SET service_offering_id=(SELECT id FROM disk_offering WHERE unique_name='Cloud.Com-SecondaryStorage') WHERE type='SecondaryStorageVm';
ALTER TABLE `cloud`.`user_vm` ADD COLUMN `iso_id` bigint unsigned;
ALTER TABLE `cloud`.`user_vm` ADD COLUMN `display_name` varchar(255);
UPDATE user_vm inner join vm_instance on user_vm.id=vm_instance.id set user_vm.iso_id=vm_instance.iso_id, user_vm.display_name=vm_instance.display_name where vm_instance.type='User';
ALTER TABLE `cloud`.`template_host_ref` ADD COLUMN `physical_size` bigint unsigned DEFAULT 0;
UPDATE template_host_ref INNER JOIN template_spool_ref ON template_host_ref.template_id=template_spool_ref.template_id SET template_host_ref.physical_size=template_spool_ref.template_size;
CREATE TABLE `cloud`.`user_vm_details` (
`id` bigint unsigned NOT NULL auto_increment,
`vm_id` bigint unsigned NOT NULL COMMENT 'vm id',
@ -338,8 +345,6 @@ CREATE TABLE `cloud`.`upload` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
ALTER TABLE `cloud`.`template_host_ref` ADD COLUMN `physical size` bigint unsigned DEFAULT 0;
ALTER TABLE `cloud`.`console_proxy` MODIFY COLUMN `public_mac_address` varchar(17);
ALTER TABLE `cloud`.`secondary_storage_vm` MODIFY COLUMN `public_mac_address` varchar(17);
@ -355,6 +360,10 @@ ALTER TABLE `cloud`.`disk_offering` ADD COLUMN `customized` tinyint(1) unsigned
update `cloud`.`disk_offering` set system_use=1, removed=null WHERE unique_name like 'Cloud.Com-%';
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;
ALTER TABLE `cloud`.`user_statistics` ADD COLUMN `device_type` varchar(32) NOT NULL;
CREATE TABLE `cloud`.`remote_access_vpn` (
`vpn_server_addr_id` bigint unsigned UNIQUE NOT NULL,
`account_id` bigint unsigned NOT NULL,
@ -546,6 +555,8 @@ CREATE TABLE `cloud`.`storage_pool_work` (
UNIQUE (pool_id,vm_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
UPDATE vm_instance set hypervisor_type=(SELECT value FROM configuration WHERE name='hypervisor.type');
-- Insert stuff?;
INSERT INTO `cloud`.`sequence` (name, value) VALUES ('volume_seq', (SELECT max(id) + 1 or 200 from volumes));
INSERT INTO `cloud`.`sequence` (name, value) VALUES ('networks_seq', 200);