Skip to content

Commit

Permalink
kvm: use cpu baseline to evaluate nested feature
Browse files Browse the repository at this point in the history
  • Loading branch information
karmab committed Apr 23, 2024
1 parent b8154f8 commit 01ed4bb
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions kvirt/providers/kvm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ def get_capabilities(self, arch=None):
if arch is None:
host = root.find('host')
cpu = host.find('cpu')
cpuxml = self.conn.baselineCPU([ET.tostring(cpu, encoding='unicode')], 1)
arch = cpu.find('arch').text
results['arch'] = arch
for guest in list(root.iter('guest')):
Expand All @@ -198,14 +199,10 @@ def get_capabilities(self, arch=None):
break
for machine in list(guest.iter('machine')):
results['machines'].append(machine.text)
if results['kvm']:
for feature in list(root.iter('feature')):
if feature.get('name') == 'vmx':
results['nestedfeature'] = 'vmx'
break
if feature.get('name') == 'svm':
results['nestedfeature'] = 'svm'
break
if 'vmx' in cpuxml:
results['nestedfeature'] = 'vmx'
elif 'svm' in cpuxml:
results['nestedfeature'] = 'svm'
return results

def create(self, name, virttype=None, profile='kvirt', flavor=None, plan='kvirt', cpumodel='host-model',
Expand Down

0 comments on commit 01ed4bb

Please sign in to comment.