[libvirt] [PATCH 03/13] Introduce internal QEMU monitor APIs for drive + device hotadd
Daniel Veillard
veillard at redhat.com
Tue Feb 2 14:15:18 UTC 2010
On Mon, Feb 01, 2010 at 06:39:32PM +0000, Daniel P. Berrange wrote:
> The way QEMU is started has been changed to use '-device' and
> the new style '-drive' syntax. This needs to be mirrored in
> the hotplug code, requiring addition of two new APIs.
>
> * src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Define APIs
> qemuMonitorAddDevice() and qemuMonitorAddDrive()
> * src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
> src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h:
> Implement the new monitor APIs
> ---
[...]
> +int qemuMonitorJSONAddDrive(qemuMonitorPtr mon,
> + const char *drivestr)
> +{
> + int ret;
> + virJSONValuePtr cmd;
> + virJSONValuePtr reply = NULL;
> +
> + cmd = qemuMonitorJSONMakeCommand("drive_add",
> + "s:pci_addr", "dummy",
> + "s:opts", drivestr,
> + NULL);
[...]
> +int qemuMonitorTextAddDrive(qemuMonitorPtr mon,
> + const char *drivestr)
> +{
> + char *cmd = NULL;
> + char *reply = NULL;
> + int ret = -1;
> + char *safe_str;
> +
> + safe_str = qemuMonitorEscapeArg(drivestr);
> + if (!safe_str) {
> + virReportOOMError(NULL);
> + return -1;
> + }
> +
> + ret = virAsprintf(&cmd, "drive_add dummy %s", safe_str);
Like Matthias I'm wondering, it seems to be allowed for network and
drive naming, but still a bit surprizing
ACK,
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel at veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
More information about the libvir-list
mailing list