コード例 #1
0
ファイル: test_arch.py プロジェクト: hsluoyz/patron
    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())
コード例 #2
0
ファイル: utils.py プロジェクト: 2Exception/patron
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()
コード例 #3
0
ファイル: utils.py プロジェクト: hsluoyz/patron
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()
コード例 #4
0
ファイル: test_arch.py プロジェクト: 2Exception/patron
    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())