bug 6432: fixed

status 6432: resolved fixed
This commit is contained in:
anthony 2010-10-06 15:10:24 -07:00
parent ab5adb12c7
commit 12f07e1826
2 changed files with 9 additions and 13 deletions

View File

@ -421,7 +421,7 @@ public class StorageManagerImpl implements StorageManager {
_asyncMgr.updateAsyncJobStatus(job.getId(), BaseCmd.PROGRESS_INSTANCE_CREATED, volumeId);
}
final HashSet<StoragePool> poolsToAvoid = new HashSet<StoragePool>();
StoragePoolVO pool = null;
boolean success = false;
Set<Long> podsToAvoid = new HashSet<Long>();
@ -436,6 +436,7 @@ public class StorageManagerImpl implements StorageManager {
while ((pod = _agentMgr.findPod(null, null, dc, account.getId(), podsToAvoid)) != null) {
podsToAvoid.add(pod.first().getId());
// Determine what storage pool to store the volume in
HashSet<StoragePool> poolsToAvoid = new HashSet<StoragePool>();
while ((pool = findStoragePool(dskCh, dc, pod.first(), null, null, null, null, poolsToAvoid)) != null) {
poolsToAvoid.add(pool);
volumeFolder = pool.getPath();
@ -582,7 +583,7 @@ public class StorageManagerImpl implements StorageManager {
if (createdVolume != null) {
volumeId = createdVolume.getId();
} else {
details = "Creating volue failed due to " + volumeDetails.second();
details = "Creating volume failed due to " + volumeDetails.second();
s_logger.warn(details);
throw new CloudRuntimeException(details);
}
@ -968,7 +969,7 @@ public class StorageManagerImpl implements StorageManager {
_storagePoolAcquisitionWaitSeconds = NumbersUtil.parseInt(configs.get("pool.acquisition.wait.seconds"), 1800);
s_logger.info("pool.acquisition.wait.seconds is configured as " + _storagePoolAcquisitionWaitSeconds + " seconds");
_totalRetries = NumbersUtil.parseInt(configDao.getValue("total.retries"), 4);
_totalRetries = NumbersUtil.parseInt(configDao.getValue("total.retries"), 2);
_pauseInterval = 2*NumbersUtil.parseInt(configDao.getValue("ping.interval"), 60);
_hypervisorType = configDao.getValue("hypervisor.type");
@ -1510,11 +1511,10 @@ public class StorageManagerImpl implements StorageManager {
VolumeVO createdVolume = null;
while ((pod = _agentMgr.findPod(null, null, dc, account.getId(), podsToAvoid)) != null) {
podsToAvoid.add(pod.first().getId());
if ((createdVolume = createVolume(volume, null, null, dc, pod.first(), null, null, diskOffering, poolsToAvoid)) != null) {
break;
} else {
podsToAvoid.add(pod.first().getId());
}
}
}
// Create an event
@ -1677,13 +1677,13 @@ public class StorageManagerImpl implements StorageManager {
}
while ((storagePoolHost = chooseHostForStoragePool(storagePool, hostsToAvoid)) != null && tryCount++ < totalRetries) {
String errMsg = basicErrMsg + " on host: " + hostId + " try: " + tryCount + ", reason: ";
hostsToAvoid.add(hostId);
try {
hostId = storagePoolHost.getHostId();
HostVO hostVO = _hostDao.findById(hostId);
if (shouldBeSnapshotCapable) {
if (hostVO == null || hostVO.getHypervisorType() != Hypervisor.Type.XenServer) {
// Only XenServer hosts are snapshot capable.
hostsToAvoid.add(hostId);
continue;
}
}

View File

@ -2439,10 +2439,10 @@ public class UserVmManagerImpl implements UserVmManager {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Attempting to create direct attached vm in pod " + pod.first().getName());
}
avoids.add(pod.first().getId());
if (!forAccount && !forZone) {
vlansForPod = _vlanDao.listVlansForPodByType(pod.first().getId(), VlanType.DirectAttached);
if (vlansForPod.size() < 1) {
avoids.add(pod.first().getId());
if (s_logger.isDebugEnabled()) {
s_logger.debug("No direct attached vlans available in pod " + pod.first().getName() + " (id:" + pod.first().getId() + "), checking other pods");
}
@ -2459,7 +2459,6 @@ public class UserVmManagerImpl implements UserVmManager {
} else if (rtrs.size() == 0) {
router = _networkMgr.createDhcpServerForDirectlyAttachedGuests(userId, accountId, dc, pod.first(), pod.second(), guestVlan);
if (router == null) {
avoids.add(pod.first().getId());
if (s_logger.isDebugEnabled()) {
s_logger.debug("Unable to create DHCP server in vlan " + guestVlan.getVlanId() + ", pod=" + pod.first().getName() + " (podid:" + pod.first().getId() + "), checking other pods");
}
@ -2503,7 +2502,6 @@ public class UserVmManagerImpl implements UserVmManager {
if (guestIp == null) {
s_logger.debug("No guest IP available in pod id=" + pod.first().getId());
avoids.add(pod.first().getId());
continue;
}
s_logger.debug("Acquired a guest IP, ip=" + guestIp);
@ -2541,7 +2539,6 @@ public class UserVmManagerImpl implements UserVmManager {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Unable to find storage host in pod " + pod.first().getName() + " (id:" + pod.first().getId() + "), checking other pods");
}
avoids.add(pod.first().getId());
continue; // didn't find a storage host in pod, go to the next pod
}
@ -2667,7 +2664,7 @@ public class UserVmManagerImpl implements UserVmManager {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Attempting to create direct attached vm in pod " + pod.first().getName());
}
avoids.add(pod.first().getId());
String guestMacAddress = macAddresses[0];
String externalMacAddress = macAddresses[1];
@ -2708,7 +2705,6 @@ public class UserVmManagerImpl implements UserVmManager {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Unable to find storage host in pod " + pod.first().getName() + " (id:" + pod.first().getId() + "), checking other pods");
}
avoids.add(pod.first().getId());
continue; // didn't find a storage host in pod, go to the next pod
}
break; // if we got here, we found a host and can stop searching the pods