Re: [libvirt] [PATCH 03/13] Introduce internal QEMU monitor APIs for drive + device hotadd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 02, 2010 at 03:15:18PM +0100, Daniel Veillard wrote:
> 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

This is a really bizarre bit of QEMU :-)  Normally you would put a
PCI address in that part of the command. In this cae though, we're
not adding a PCI  device, but rather adding a disk on a drive
controller, therefore there is no relevant PCI address & we put
in the placeholder 'dummy'.

Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]