On Mon, Dec 09, 2013 at 05:11:15PM +0800, Hu Tao wrote: > Signed-off-by: Hu Tao <hutao@xxxxxxxxxxxxxx> > --- > src/qemu/qemu_capabilities.c | 3 +++ > src/qemu/qemu_capabilities.h | 2 ++ > src/qemu/qemu_command.c | 16 ++++++++++++++++ > tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 1 + > tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 1 + > tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 1 + > 6 files changed, 24 insertions(+) > > diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c > index 548b988..b532dbb 100644 > --- a/src/qemu/qemu_capabilities.c > +++ b/src/qemu/qemu_capabilities.c > @@ -243,6 +243,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, > "virtio-mmio", > "ich9-intel-hda", > "kvm-pit-lost-tick-policy", > + > + "pvpanic", /* 160 */ > ); > > struct _virQEMUCaps { > @@ -1394,6 +1396,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = { > { "usb-storage", QEMU_CAPS_DEVICE_USB_STORAGE }, > { "virtio-mmio", QEMU_CAPS_DEVICE_VIRTIO_MMIO }, > { "ich9-intel-hda", QEMU_CAPS_DEVICE_ICH9_INTEL_HDA }, > + { "pvpanic", QEMU_CAPS_DEVICE_PANIC }, > }; > > static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBlk[] = { > diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h > index 02d47c6..1aedbf9 100644 > --- a/src/qemu/qemu_capabilities.h > +++ b/src/qemu/qemu_capabilities.h > @@ -199,6 +199,8 @@ enum virQEMUCapsFlags { > QEMU_CAPS_DEVICE_ICH9_INTEL_HDA = 158, /* -device ich9-intel-hda */ > QEMU_CAPS_KVM_PIT_TICK_POLICY = 159, /* kvm-pit.lost_tick_policy */ > > + QEMU_CAPS_DEVICE_PANIC = 160, /* -device pvpanic */ > + > QEMU_CAPS_LAST, /* this must always be the last item */ > }; > > diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c > index 763417f..8487356 100644 > --- a/src/qemu/qemu_command.c > +++ b/src/qemu/qemu_command.c > @@ -9588,6 +9588,22 @@ qemuBuildCommandLine(virConnectPtr conn, > goto error; > } > > + if (def->panic) { > + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PANIC)) { > + if (def->panic->info.addr.isa.iobase > 0) { > + virCommandAddArg(cmd, "-device"); > + virCommandAddArgFormat(cmd, "pvpanic,ioport=%d", > + def->panic->info.addr.isa.iobase); > + } else { > + virCommandAddArgList(cmd, "-device", "pvpanic", NULL); > + } > + } else { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", > + _("your QEMU is too old to support pvpanic")); > + goto error; > + } > + } > + > if (mlock) { > unsigned long long memKB; > > diff --git a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps > index 09cf657..1c84ce2 100644 > --- a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps > +++ b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps > @@ -131,4 +131,5 @@ > <flag name='usb-storage.removable'/> > <flag name='ich9-intel-hda'/> > <flag name='kvm-pit-lost-tick-policy'/> > + <flag name='pvpanic'/> > </qemuCaps> > diff --git a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps > index 33ee73b..3b1b456 100644 > --- a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps > +++ b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps > @@ -135,4 +135,5 @@ > <flag name='virtio-mmio'/> > <flag name='ich9-intel-hda'/> > <flag name='kvm-pit-lost-tick-policy'/> > + <flag name='pvpanic'/> > </qemuCaps> > diff --git a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps > index a66034a..fc9e034 100644 > --- a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps > +++ b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps > @@ -134,4 +134,5 @@ > <flag name='virtio-mmio'/> > <flag name='ich9-intel-hda'/> > <flag name='kvm-pit-lost-tick-policy'/> > + <flag name='pvpanic'/> > </qemuCaps> ACK Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list