Merge "Improved resources validation for Murano OSTF tests"
This commit is contained in:
commit
3e8e28c84f
|
@ -171,6 +171,7 @@ class FuelTestAssertMixin(object):
|
|||
:msg: message that will be displayed if an exception occurs;
|
||||
:action: action that is performed by the method.
|
||||
"""
|
||||
LOG.info("STEP:{0}, verify action: '{1}'".format(step, action))
|
||||
try:
|
||||
with timeout(secs, action):
|
||||
result = func(*args, **kwargs)
|
||||
|
|
|
@ -914,6 +914,29 @@ class PlatformServicesBaseClass(NovaNetworkScenarioTest):
|
|||
|
||||
return max_free_ram_mb
|
||||
|
||||
def get_info_about_available_resources(self, min_ram, min_hdd, min_vcpus):
|
||||
"""This function allows to get the information about resources.
|
||||
|
||||
We need to collect the information about available RAM, HDD and vCPUs
|
||||
on all compute nodes for cases when we will create more than 1 VM.
|
||||
|
||||
This function returns the count of VMs with required parameters which
|
||||
we can successfully run on existing cloud.
|
||||
"""
|
||||
vms_count = 0
|
||||
for hypervisor in self.compute_client.hypervisors.list():
|
||||
if hypervisor.free_ram_mb >= min_ram:
|
||||
if hypervisor.free_disk_gb >= min_hdd:
|
||||
if hypervisor.vcpus - hypervisor.vcpus_used >= min_vcpus:
|
||||
# We need to determine how many VMs we can run
|
||||
# on this hypervisor
|
||||
free_cpu = hypervisor.vcpus - hypervisor.vcpus_used
|
||||
k1 = int(hypervisor.free_ram_mb / min_ram)
|
||||
k2 = int(hypervisor.free_disk_gb / min_hdd)
|
||||
k3 = int(free_cpu / min_vcpus)
|
||||
vms_count += min(k1, k2, k3)
|
||||
return vms_count
|
||||
|
||||
# Methods for finding and checking Sahara images.
|
||||
def find_and_check_image(self, tag_plugin, tag_version):
|
||||
"""This method finds a correctly registered image for Sahara platform
|
||||
|
|
|
@ -41,24 +41,15 @@ class MuranoDeployLinuxServicesTests(muranomanager.MuranoTest):
|
|||
'fuel-{0}/user-guide.html#platform-tests-'
|
||||
'description'.format(self.config.fuel.fuel_version))
|
||||
|
||||
max_free_ram_mb = (
|
||||
self.get_max_free_compute_node_ram(self.min_required_ram_mb))
|
||||
if max_free_ram_mb < self.min_required_ram_mb:
|
||||
msg = ('This test requires more hardware resources of your '
|
||||
'OpenStack cluster: at least one of the compute nodes '
|
||||
'must have >= {0} MB of free RAM, but you have only '
|
||||
'{1} MB on most appropriate compute node.'
|
||||
.format(self.min_required_ram_mb, max_free_ram_mb))
|
||||
LOG.debug(msg)
|
||||
self.skipTest(msg)
|
||||
|
||||
self.image = self.find_murano_image('linux')
|
||||
|
||||
self.dummy_fqdn = 'io.murano.apps.Simple'
|
||||
|
||||
# Flavor with 2 vCPU and 40Gb HDD will allow to sucessfully
|
||||
# deploy all Murano applications.
|
||||
self.flavor_name = rand_name("ostf_test_Murano_flavor")
|
||||
flavor = self.compute_client.flavors.create(
|
||||
self.flavor_name, disk=60, ram=self.min_required_ram_mb, vcpus=1)
|
||||
self.flavor_name, disk=40, ram=self.min_required_ram_mb, vcpus=2)
|
||||
self.addCleanup(self.compute_client.flavors.delete, flavor.id)
|
||||
|
||||
def tearDown(self):
|
||||
|
@ -85,6 +76,18 @@ class MuranoDeployLinuxServicesTests(muranomanager.MuranoTest):
|
|||
Available since release: 2014.2-6.1
|
||||
"""
|
||||
|
||||
vms_count = self.get_info_about_available_resources(
|
||||
self.min_required_ram_mb, 40, 2)
|
||||
if vms_count < 1:
|
||||
msg = ('This test requires more hardware resources of your '
|
||||
'OpenStack cluster: your cloud should allow to create '
|
||||
'at least 1 VM with {0} MB of RAM, {1} HDD and {2} vCPUs. '
|
||||
'You need to remove some resources or add compute nodes '
|
||||
'to have an ability to run this OSTF test.'
|
||||
.format(self.min_required_ram_mb, 40, 2))
|
||||
LOG.debug(msg)
|
||||
self.skipTest(msg)
|
||||
|
||||
if self.package_exists(self.dummy_fqdn):
|
||||
package = self.get_package_by_fqdn(self.dummy_fqdn)
|
||||
self.delete_package(package["id"])
|
||||
|
@ -181,6 +184,18 @@ class MuranoDeployLinuxServicesTests(muranomanager.MuranoTest):
|
|||
Available since release: 2014.2-6.0
|
||||
"""
|
||||
|
||||
vms_count = self.get_info_about_available_resources(
|
||||
self.min_required_ram_mb, 40, 2)
|
||||
if vms_count < 1:
|
||||
msg = ('This test requires more hardware resources of your '
|
||||
'OpenStack cluster: your cloud should allow to create '
|
||||
'at least 1 VM with {0} MB of RAM, {1} HDD and {2} vCPUs. '
|
||||
'You need to remove some resources or add compute nodes '
|
||||
'to have an ability to run this OSTF test.'
|
||||
.format(self.min_required_ram_mb, 40, 2))
|
||||
LOG.debug(msg)
|
||||
self.skipTest(msg)
|
||||
|
||||
if not self.image:
|
||||
msg = ('Murano image was not properly registered or was not '
|
||||
'uploaded at all. Please refer to the Mirantis OpenStack '
|
||||
|
@ -278,6 +293,18 @@ class MuranoDeployLinuxServicesTests(muranomanager.MuranoTest):
|
|||
Available since release: 2014.2-6.1
|
||||
"""
|
||||
|
||||
vms_count = self.get_info_about_available_resources(
|
||||
self.min_required_ram_mb, 40, 2)
|
||||
if vms_count < 2:
|
||||
msg = ('This test requires more hardware resources of your '
|
||||
'OpenStack cluster: your cloud should allow to create '
|
||||
'at least 2 VMs with {0} MB of RAM, {1} HDD and {2} vCPUs.'
|
||||
' You need to remove some resources or add compute nodes '
|
||||
'to have an ability to run this OSTF test.'
|
||||
.format(self.min_required_ram_mb, 40, 2))
|
||||
LOG.debug(msg)
|
||||
self.skipTest(msg)
|
||||
|
||||
if not self.image:
|
||||
msg = ('Murano image was not properly registered or was not '
|
||||
'uploaded at all. Please refer to the Mirantis OpenStack '
|
||||
|
@ -390,7 +417,7 @@ class MuranoDeployLinuxServicesTests(muranomanager.MuranoTest):
|
|||
self.environment.id, session.id)
|
||||
|
||||
fail_msg = "Deployment was not completed correctly. "
|
||||
self.environment = self.verify(1800, self.deploy_check,
|
||||
self.environment = self.verify(2400, self.deploy_check,
|
||||
7, fail_msg, 'deployment is going',
|
||||
self.environment)
|
||||
|
||||
|
@ -407,12 +434,12 @@ class MuranoDeployLinuxServicesTests(muranomanager.MuranoTest):
|
|||
[self.mysql['instance']['name'], 22, 3306]])
|
||||
|
||||
fail_msg = "Path to WordPress unavailable"
|
||||
self.verify(10, self.check_path, 10, fail_msg,
|
||||
self.verify(30, self.check_path, 10, fail_msg,
|
||||
'checking path availability',
|
||||
self.environment, "wordpress",
|
||||
self.apache['instance']['name'])
|
||||
|
||||
fail_msg = "Can't delete environment. "
|
||||
self.verify(5, self.delete_environment,
|
||||
self.verify(10, self.delete_environment,
|
||||
11, fail_msg, "deleting environment",
|
||||
self.environment.id)
|
||||
|
|
Loading…
Reference in New Issue