From 5ebcc72c93b2eec92261ce9d523ee09aa9937f4e Mon Sep 17 00:00:00 2001 From: Viktor Ashirov Date: Fri, 6 Feb 2026 08:58:55 +0100 Subject: [PATCH 1/2] Use hvf on macOS instead of falling back to tcg --- kvirt/providers/kvm/__init__.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/kvirt/providers/kvm/__init__.py b/kvirt/providers/kvm/__init__.py index 942feb2b1..e53d22dac 100644 --- a/kvirt/providers/kvm/__init__.py +++ b/kvirt/providers/kvm/__init__.py @@ -179,7 +179,7 @@ def disk_exists(self, pool, name): return False def get_capabilities(self, arch=None): - results = {'kvm': False, 'nestedfeature': None, 'machines': [], 'arch': arch} + results = {'kvm': False, 'hvf': False, 'nestedfeature': None, 'machines': [], 'arch': arch} capabilitiesxml = self.conn.getCapabilities() root = ET.fromstring(capabilitiesxml) cpuxml = '' @@ -200,7 +200,8 @@ def get_capabilities(self, arch=None): for domain in list(guest.iter('domain')): if domain.get('type') == 'kvm': results['kvm'] = True - break + elif domain.get('type') == 'hvf': + results['hvf'] = True for machine in list(guest.iter('machine')): results['machines'].append(machine.text) if 'vmx' in cpuxml: @@ -270,7 +271,7 @@ def create(self, name, virttype=None, profile='kvirt', flavor=None, plan='kvirt' uefi_legacy = overrides.get('uefi_legacy', False) or (uefi and self._rhel_legacy(capabilities['machines'])) iommu_model = 'smmuv3' if arch == 'aarch64' else 'intel' aarch64 = arch == 'aarch64' - aarch64_full = aarch64 and capabilities['kvm'] + aarch64_full = aarch64 and (capabilities['kvm'] or capabilities['hvf']) as390x = arch == 's390x' if aarch64: if custom_emulator is not None: @@ -946,13 +947,15 @@ def create(self, name, virttype=None, profile='kvirt', flavor=None, plan='kvirt' else: cpuxml = f"{cpumodel}" if virttype is None: - if not capabilities['kvm']: + if capabilities['kvm']: + virttype = 'kvm' + elif capabilities['hvf']: + virttype = 'hvf' + else: warning("No acceleration available with this hypervisor") virttype = 'qemu' nested = False - else: - virttype = 'kvm' - elif virttype not in ['qemu', 'kvm', 'xen', 'lxc']: + elif virttype not in ['qemu', 'kvm', 'hvf', 'xen', 'lxc']: msg = f"Incorrect virttype {virttype}" return {'result': 'failure', 'reason': msg} nestedfeature = capabilities['nestedfeature'] From 1d25823fe9871402cca6c1177d391d38f3269e58 Mon Sep 17 00:00:00 2001 From: Viktor Ashirov Date: Sat, 7 Feb 2026 10:20:16 +0100 Subject: [PATCH 2/2] Display userport instead of IP, if it's not available --- kvirt/cli.py | 9 +++++++++ kvirt/kmcp.py | 3 +++ 2 files changed, 12 insertions(+) diff --git a/kvirt/cli.py b/kvirt/cli.py index 01cc19493..8322084b9 100755 --- a/kvirt/cli.py +++ b/kvirt/cli.py @@ -783,6 +783,9 @@ def _parse_vms_list(_list, overrides={}): name = vm.get('name') status = vm.get('status') ip = vm.get('ip', '') + userport = vm.get('userport') + if not ip and userport is not None: + ip = f'127.0.0.1:{userport}' source = vm.get('image', '') plan = vm.get('plan', '') profile = vm.get('profile', '') @@ -813,6 +816,9 @@ def list_vms(args): name = vm.get('name') status = vm.get('status') ip = vm.get('ip', '') + userport = vm.get('userport') + if not ip and userport is not None: + ip = f'127.0.0.1:{userport}' source = vm.get('image', '') plan = vm.get('plan', '') profile = vm.get('profile', '') @@ -833,6 +839,9 @@ def list_vms(args): name = vm.get('name') status = vm.get('status') ip = vm.get('ip', '') + userport = vm.get('userport') + if not ip and userport is not None: + ip = f'127.0.0.1:{userport}' source = vm.get('image', '') plan = vm.get('plan', '') profile = vm.get('profile', '') diff --git a/kvirt/kmcp.py b/kvirt/kmcp.py index 00699db60..bb67648d3 100755 --- a/kvirt/kmcp.py +++ b/kvirt/kmcp.py @@ -31,6 +31,9 @@ def _parse_vms_list(_list, overrides={}): name = vm.get('name') status = vm.get('status') ip = vm.get('ip', '') + userport = vm.get('userport') + if not ip and userport is not None: + ip = f'127.0.0.1:{userport}' source = vm.get('image', '') plan = vm.get('plan', '') profile = vm.get('profile', '')