Beispiel #1
0
def detect_openstack():
    """Return True when a potential OpenStack platform is detected."""
    if not util.is_x86():
        return True  # Non-Intel cpus don't properly report dmi product names
    product_name = util.read_dmi_data('system-product-name')
    if product_name in VALID_DMI_PRODUCT_NAMES:
        return True
    elif util.read_dmi_data('chassis-asset-tag') in VALID_DMI_ASSET_TAGS:
        return True
    elif util.get_proc_env(1).get('product_name') == DMI_PRODUCT_NOVA:
        return True
    return False
def detect_openstack(accept_oracle=False):
    """Return True when a potential OpenStack platform is detected."""
    if not util.is_x86():
        return True  # Non-Intel cpus don't properly report dmi product names
    product_name = util.read_dmi_data('system-product-name')
    if product_name in VALID_DMI_PRODUCT_NAMES:
        return True
    elif util.read_dmi_data('chassis-asset-tag') in VALID_DMI_ASSET_TAGS:
        return True
    elif accept_oracle and oracle._is_platform_viable():
        return True
    elif util.get_proc_env(1).get('product_name') == DMI_PRODUCT_NOVA:
        return True
    return False
Beispiel #3
0
def detect_openstack(accept_oracle=False):
    """Return True when a potential OpenStack platform is detected."""
    if not util.is_x86():
        return True  # Non-Intel cpus don't properly report dmi product names
    product_name = dmi.read_dmi_data("system-product-name")
    if product_name in VALID_DMI_PRODUCT_NAMES:
        return True
    elif dmi.read_dmi_data("chassis-asset-tag") in VALID_DMI_ASSET_TAGS:
        return True
    elif accept_oracle and oracle._is_platform_viable():
        return True
    elif util.get_proc_env(1).get("product_name") == DMI_PRODUCT_NOVA:
        return True
    return False
Beispiel #4
0
 def test_is_x86_calls_uname_for_architecture(self, m_uname):
     """is_x86 returns True if platform from uname matches."""
     m_uname.return_value = [0, 1, 2, 3, 'x86_64']
     self.assertTrue(util.is_x86())
Beispiel #5
0
 def test_is_x86_unmatched_types(self):
     """is_x86 returns Fale on non-intel x86 architectures."""
     unmatched_arches = ['ia64', '9000/800', 'arm64v71']
     for arch in unmatched_arches:
         self.assertFalse(
             util.is_x86(arch), 'Expected not is_x86 for arch "%s"' % arch)
Beispiel #6
0
 def test_is_x86_matches_x86_types(self):
     """is_x86 returns True if CPU architecture matches."""
     matched_arches = ['x86_64', 'i386', 'i586', 'i686']
     for arch in matched_arches:
         self.assertTrue(
             util.is_x86(arch), 'Expected is_x86 for arch "%s"' % arch)
Beispiel #7
0
 def test_is_x86_calls_uname_for_architecture(self, m_uname):
     """is_x86 returns True if platform from uname matches."""
     m_uname.return_value = [0, 1, 2, 3, 'x86_64']
     self.assertTrue(util.is_x86())
Beispiel #8
0
 def test_is_x86_unmatched_types(self):
     """is_x86 returns Fale on non-intel x86 architectures."""
     unmatched_arches = ['ia64', '9000/800', 'arm64v71']
     for arch in unmatched_arches:
         self.assertFalse(
             util.is_x86(arch), 'Expected not is_x86 for arch "%s"' % arch)
Beispiel #9
0
 def test_is_x86_matches_x86_types(self):
     """is_x86 returns True if CPU architecture matches."""
     matched_arches = ['x86_64', 'i386', 'i586', 'i686']
     for arch in matched_arches:
         self.assertTrue(
             util.is_x86(arch), 'Expected is_x86 for arch "%s"' % arch)