Ask Your Question
0

Add -cpu kvm=off flag

asked 2017-01-17 11:09:35 -0500

kvasko gravatar image

updated 2017-01-17 13:38:01 -0500

I am trying to do PCI-Passthrough but I cannot figure out how to add this flag to get consumer grade equipment to work.

I found this link https://gist.github.com/claudiok/890ab6dfe76fa45b30081e58038a9215 (https://gist.github.com/claudiok/890a...) and the "workaround" doesn't work as the -cpu flag isn't in the parameter list. If I append "-cpu kvm=off" to the end of the parameter list I'm given...this error.

"unable to find CPU definition: kvm=off" error

this is the script in question....

#!/usr/bin/python

import os
import sys

new_args = []

# only change the "-cpu" options (inject kvm=off and hv_vendor_id=MyFake_KVM)
for i in range(len(sys.argv)):
    if i<=1: 
        new_args.append(sys.argv[i])
        continue
    if sys.argv[i-1] != "-cpu":
        new_args.append(sys.argv[i])
        continue

    subargs = sys.argv[i].split(",")

    subargs.insert(1,"kvm=off")
    subargs.insert(2,"hv_vendor_id=MyFake_KVM")

    new_arg = ",".join(subargs)

    new_args.append(new_arg)

os.execv('/usr/bin/qemu-system-x86_64.orig', new_args)

The problem is when my python script is called I see "-S -no-user-config -nodefaults -nographic -M none -qmp unix:/var/lib/libvirt/qemu/capabilities.monitor.sock,server,nowait -pidfile /var/lib/libvirt/qemu/capabilties.pidfile -daemonize".

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-01-17 12:44:01 -0500

volenbovsky gravatar image

Hi, -syntax 'cpu kvm=off' does not make sense to me.

I think it should be smth like -cpu host,kvm=off, but most likely you can omit -cpu part (you need just to add kvm=off)

The format -cpu <model>, but doing -cpu host (=use CPU model from host) might be not necessary, as you probably can rely on defaults of QEMU.

SIde note: doing those things via QEMU wrapper script sounds as too much hacking/is not 'sustainable'...

edit flag offensive delete link more

Comments

The script I found here. https://gist.github.com/claudiok/890ab6dfe76fa45b30081e58038a9215 (https://gist.github.com/claudiok/890a...). But yes it is supposed to do the following -cpu <somecpu>,kvm=off (e.g. -cpu Haswell,kvm=off).</somecpu>

I realize this is a hack, but have no idea how to add the kvm=off flag. Do you have a better solution?

kvasko gravatar imagekvasko ( 2017-01-17 13:33:04 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2017-01-17 11:09:35 -0500

Seen: 419 times

Last updated: Jan 17 '17