[libvirt] [RFC 03/12] Add a new controller type 'usb' with optionnal 'model'
Daniel P. Berrange
berrange at redhat.com
Tue Aug 23 15:42:53 UTC 2011
On Sun, Aug 21, 2011 at 10:01:14PM +0300, Marc-André Lureau wrote:
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index dbfc7d9..4168504 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -83,6 +83,24 @@ VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
> "", /* don't support vbox */
> "qxl");
>
> +VIR_ENUM_DECL(qemuControllerModel)
> +
> +VIR_ENUM_IMPL(qemuControllerModel, VIR_DOMAIN_CONTROLLER_MODEL_LAST,
> + "", /* auto */
> + "", /* buslogic don't support */
> + "", /* lsilogic don't support */
> + "", /* lsisas don't support */
> + "", /* vmpvscsi don't support */
> + "piix3-usb-uhci",
> + "piix4-usb-uhci",
> + "usb-ehci",
> + "ich9-usb-ehci1",
> + "ich9-usb-uhci1",
> + "ich9-usb-uhci2",
> + "ich9-usb-uhci3",
> + "vt82c686b-usb-uhci");
If we separate out the model enums per controller type, then we
can avoid the nasty hacks of "" in this declaration.
> +static int
> +qemuBuildUSBControllerDevStr(virDomainControllerDefPtr def,
> + virBitmapPtr qemuCaps,
> + virBuffer *buf)
> +{
> + const char *smodel;
> + int model, caps;
> +
> + model = def->model;
> + if (model == -1 || model == VIR_DOMAIN_CONTROLLER_MODEL_AUTO)
> + model = VIR_DOMAIN_CONTROLLER_MODEL_PIIX3_UHCI;
> +
> + smodel = qemuControllerModelTypeToString(model);
> + caps = qemuControllerModelToCaps(model);
> +
> + if (caps == -1 || !qemuCapsGet(qemuCaps, caps)) {
> + qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> + _("%s not supported in this QEMU binary"), smodel);
> + return -1;
> + }
> +
> + virBufferAsprintf(buf, "%s,id=usb%d", smodel, def->idx);
> + return 0;
> +}
> +
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 :|
More information about the libvir-list
mailing list