如何更改qemu默认机器?

Ant*_*ioK 5 kvm qemu

我使用带有 qemu-kvm 的 Kubuntu 14.04 (x86_64 3.13.0-43-generic #72-Ubuntu)。

$ kvm --version
QEMU emulator version 2.0.0 (Debian 2.0.0+dfsg-2ubuntu1.9)
Run Code Online (Sandbox Code Playgroud)

我怎样才能更改“默认”机器(现在它是pc-i440fx-trusty下面看到的开箱即用值)?

$ qemu-system-x86_64 -machine help
Supported machines are:    
pc-0.13              Standard PC (i440FX + PIIX, 1996)
pc-i440fx-2.0        Standard PC (i440FX + PIIX, 1996)
pc-1.0-qemu-kvm      Standard PC (i440FX + PIIX, 1996) (alias of pc-1.0)
pc-1.0               Standard PC (i440FX + PIIX, 1996)
pc-q35-1.7           Standard PC (Q35 + ICH9, 2009)
pc-1.1               Standard PC (i440FX + PIIX, 1996)
q35                  Standard PC (Q35 + ICH9, 2009) (alias of pc-q35-2.0)
pc-q35-2.0           Standard PC (Q35 + ICH9, 2009)
pc-i440fx-1.4        Standard PC (i440FX + PIIX, 1996)
pc-i440fx-1.5        Standard PC (i440FX + PIIX, 1996)
pc-0.14              Standard PC (i440FX + PIIX, 1996)
pc-0.15              Standard PC (i440FX + PIIX, 1996)
xenfv                Xen Fully-virtualized PC
pc-q35-1.4           Standard PC (Q35 + ICH9, 2009)
isapc                ISA-only PC
pc-0.10              Standard PC (i440FX + PIIX, 1996)
pc                   Ubuntu 14.04 PC (i440FX + PIIX, 1996) (alias of pc-i440fx-trusty)
pc-i440fx-trusty     Ubuntu 14.04 PC (i440FX + PIIX, 1996) (default)
pc-1.2               Standard PC (i440FX + PIIX, 1996)
pc-0.11              Standard PC (i440FX + PIIX, 1996)
pc-i440fx-1.7        Standard PC (i440FX + PIIX, 1996)
pc-i440fx-1.6        Standard PC (i440FX + PIIX, 1996)
none                 empty machine
xenpv                Xen Para-virtualized PC
pc-q35-1.5           Standard PC (Q35 + ICH9, 2009)
pc-1.0-precise       Standard PC (i440FX + PIIX, 1996) (alias of pc-1.0-qemu-kvm)
pc-1.0-qemu-kvm      Standard PC (i440FX + PIIX, 1996)
pc-q35-1.6           Standard PC (Q35 + ICH9, 2009)
pc-0.12              Standard PC (i440FX + PIIX, 1996)
pc-1.3               Standard PC (i440FX + PIIX, 1996)
Run Code Online (Sandbox Code Playgroud)

我在 qemu_2.0.0~rc1 diff 中发现了这个:

++/* Ubuntu machine types */
++
++static QEMUMachine pc_machine_trusty = {
++ PC_DEFAULT_MACHINE_OPTIONS,
++ .default_machine_opts = "firmware=bios-256k.bin",
++ .hot_add_cpu = pc_hot_add_cpu,
++ .name = "pc-i440fx-trusty",
++ .alias = "pc",
++ .desc = "Ubuntu 14.04 PC (i440FX + PIIX, 1996)", 
++ .init = pc_init_pci,
++ .is_default = 1,
++};
Run Code Online (Sandbox Code Playgroud)

- 所以我应该假设这个值是硬编码的并且不能改变而不处理源代码和重新编译 qemu?

Lek*_*eyn 4

可以使用以下选项覆盖默认计算机-machine

qemu-system-x86_64 -machine pc ...
Run Code Online (Sandbox Code Playgroud)

相应地更换pc

  • @AntonioK那么在这种情况下你有两个选择:重新编译 QEMU 或创建一个包装脚本,添加 `-machine FOO` 选项 (`#!/bin/sh` `exec qemu-system-x86.bin -machine pc "$ @“`)。也许您可以向一些 Openstack 资源询问一个配置选项,您不必修改 Q​​EMU,这似乎是您真正的问题。 (4认同)