mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
This fixes regression introduced in PR #2295: - Pass assign=true to fetch new public IP - Use wait_until instead of sleep+wait in tests - Loop through list of public IP ranges to match the systemvm gateway - Fix potential NPE seen when adding simulator host(s) - Removes aria2 installation from setup_agent.sh using yum, it's already dependency for cloudstack-agent package Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
e01dd89c93
commit
b0d7844cf0
@ -74,6 +74,11 @@ public class SolidFireHostListener implements HypervisorHostListener {
|
||||
public boolean hostAdded(long hostId) {
|
||||
HostVO host = _hostDao.findById(hostId);
|
||||
|
||||
if (host == null) {
|
||||
s_logger.error("Failed to add host by SolidFireHostListener as host was not found with id=" + hostId);
|
||||
return false;
|
||||
}
|
||||
|
||||
SolidFireUtil.hostAddedToOrRemovedFromCluster(hostId, host.getClusterId(), true, SolidFireUtil.PROVIDER_NAME,
|
||||
_clusterDao, _clusterDetailsDao, _storagePoolDao, _storagePoolDetailsDao, _hostDao);
|
||||
|
||||
|
||||
@ -68,6 +68,11 @@ public class SolidFireSharedHostListener implements HypervisorHostListener {
|
||||
public boolean hostAdded(long hostId) {
|
||||
HostVO host = hostDao.findById(hostId);
|
||||
|
||||
if (host == null) {
|
||||
LOGGER.error("Failed to add host by SolidFireSharedHostListener as host was not found with id=" + hostId);
|
||||
return false;
|
||||
}
|
||||
|
||||
SolidFireUtil.hostAddedToOrRemovedFromCluster(hostId, host.getClusterId(), true, SolidFireUtil.SHARED_PROVIDER_NAME,
|
||||
clusterDao, clusterDetailsDao, storagePoolDao, storagePoolDetailsDao, hostDao);
|
||||
|
||||
|
||||
@ -224,17 +224,5 @@ then
|
||||
setenforce 0
|
||||
fi
|
||||
|
||||
which aria2c
|
||||
if [ $? -gt 0 ]
|
||||
then
|
||||
yum install epel-release -y
|
||||
yum install aria2 -y
|
||||
if [ $? -gt 0 ]
|
||||
then
|
||||
printf "failed to install aria2"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
cloudstack-setup-agent --host=$host --zone=$zone --pod=$pod --cluster=$cluster --guid=$guid $paramters -a > /dev/null
|
||||
#cloud_consoleP_setup $host $zone $pod
|
||||
|
||||
@ -964,13 +964,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
||||
VpcVO vpc = _vpcDao.findById(vpcId);
|
||||
displayIp = vpc.isDisplay();
|
||||
}
|
||||
PublicIp ip = fetchNewPublicIp(dcId, null, null, owner, VlanType.VirtualNetwork, guestNtwkId, isSourceNat, false, null, false, vpcId, displayIp, false);
|
||||
IPAddressVO publicIp = ip.ip();
|
||||
|
||||
markPublicIpAsAllocated(publicIp);
|
||||
_ipAddressDao.update(publicIp.getId(), publicIp);
|
||||
|
||||
return ip;
|
||||
return fetchNewPublicIp(dcId, null, null, owner, VlanType.VirtualNetwork, guestNtwkId, isSourceNat, true, null, false, vpcId, displayIp, false);
|
||||
}
|
||||
});
|
||||
if (ip.getState() != State.Allocated) {
|
||||
|
||||
@ -204,25 +204,24 @@ class TestDedicatePublicIPRange(cloudstackTestCase):
|
||||
ip = self.get_ip_as_number(ip_to_test)
|
||||
return start <= ip and ip <= end
|
||||
|
||||
def wait_for_system_vm_start(self, domain_id, srv_timeout, srv_sleep, systemvmtype):
|
||||
def wait_for_system_vm_start(self, domain_id, systemvmtype):
|
||||
""" Wait until system vm is Running
|
||||
"""
|
||||
timeout = srv_timeout
|
||||
while True:
|
||||
list_systemvm_response = list_ssvms(
|
||||
def checkSystemVMUp():
|
||||
response = list_ssvms(
|
||||
self.apiclient,
|
||||
systemvmtype=systemvmtype,
|
||||
domainid=domain_id
|
||||
)
|
||||
if isinstance(list_systemvm_response, list):
|
||||
if list_systemvm_response[0].state == 'Running':
|
||||
return list_systemvm_response[0].id
|
||||
if timeout == 0:
|
||||
raise Exception("List System VM call failed!")
|
||||
if isinstance(response, list):
|
||||
if response[0].state == 'Running':
|
||||
return True, response[0].id
|
||||
return False, None
|
||||
|
||||
time.sleep(srv_sleep)
|
||||
timeout = timeout - 1
|
||||
return None
|
||||
res, systemvmId = wait_until(3, 100, checkSystemVMUp)
|
||||
if not res:
|
||||
raise Exception("Failed to wait for systemvm to be running")
|
||||
return systemvmId
|
||||
|
||||
def base_system_vm(self, services, systemvmtype):
|
||||
"""
|
||||
@ -264,8 +263,6 @@ class TestDedicatePublicIPRange(cloudstackTestCase):
|
||||
# Wait for CPVM to start
|
||||
systemvm_id = self.wait_for_system_vm_start(
|
||||
public_ip_range.vlan.domainid,
|
||||
self.services["timeout"],
|
||||
self.services["sleep"],
|
||||
systemvmtype
|
||||
)
|
||||
self.assertNotEqual(
|
||||
@ -312,8 +309,6 @@ class TestDedicatePublicIPRange(cloudstackTestCase):
|
||||
# Wait for System VM to start and check System VM public IP
|
||||
systemvm_id = self.wait_for_system_vm_start(
|
||||
domain_id,
|
||||
self.services["timeout"],
|
||||
self.services["sleep"],
|
||||
systemvmtype
|
||||
)
|
||||
list_systemvm_response = list_ssvms(
|
||||
|
||||
@ -348,9 +348,13 @@ class TestSSVMs(cloudstackTestCase):
|
||||
self.apiclient,
|
||||
physicalnetworkid=listphyntwk[0].id),
|
||||
list) is True):
|
||||
self.assertEqual(
|
||||
cpvm.gateway,
|
||||
iprange.gateway,
|
||||
cpvmValidGateway = False
|
||||
for iprange in ipranges_response:
|
||||
if iprange.gateway == cpvm.gateway:
|
||||
cpvmValidGateway = True
|
||||
break
|
||||
self.assertTrue(
|
||||
cpvmValidGateway,
|
||||
"Check gateway with that of corresponding ip range"
|
||||
)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user