def test_host(self, mock_uname): os.uname.return_value = ( 'Linux', 'localhost.localdomain', '3.14.8-200.fc20.x86_64', '#1 SMP Mon Jun 16 21:57:53 UTC 2014', 'i686' ) self.assertEqual(arch.I686, arch.from_host())
def get_arch(image_meta): """Determine the architecture of the guest (or host). This method determines the CPU architecture that must be supported by the hypervisor. It gets the (guest) arch info from image_meta properties, and it will fallback to the patron-compute (host) arch if no architecture info is provided in image_meta. :param image_meta: the metadata associated with the instance image :returns: guest (or host) architecture """ if image_meta: image_arch = image_meta.get('properties', {}).get('architecture') if image_arch is not None: return arch.canonicalize(image_arch) return arch.from_host()
def test_host(self, mock_uname): os.uname.return_value = ('Linux', 'localhost.localdomain', '3.14.8-200.fc20.x86_64', '#1 SMP Mon Jun 16 21:57:53 UTC 2014', 'i686') self.assertEqual(arch.I686, arch.from_host())