You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

__init__.py 820B

1234567891011121314151617181920212223242526272829303132333435
  1. # QEMU library
  2. #
  3. # Copyright (C) 2015-2016 Red Hat Inc.
  4. # Copyright (C) 2012 IBM Corp.
  5. #
  6. # Authors:
  7. # Fam Zheng <famz@redhat.com>
  8. #
  9. # This work is licensed under the terms of the GNU GPL, version 2. See
  10. # the COPYING file in the top-level directory.
  11. #
  12. # Based on qmp.py.
  13. #
  14. import logging
  15. import os
  16. from . import qmp
  17. from . import machine
  18. LOG = logging.getLogger(__name__)
  19. # Mapping host architecture to any additional architectures it can
  20. # support which often includes its 32 bit cousin.
  21. ADDITIONAL_ARCHES = {
  22. "x86_64" : "i386",
  23. "aarch64" : "armhf"
  24. }
  25. def kvm_available(target_arch=None):
  26. host_arch = os.uname()[4]
  27. if target_arch and target_arch != host_arch:
  28. if target_arch != ADDITIONAL_ARCHES.get(host_arch):
  29. return False
  30. return os.access("/dev/kvm", os.R_OK | os.W_OK)