[libvirt] Re: [PATCH 10/12] Implement SCSI controller hotplug/unplug for QEMU

Daniel P. Berrange berrange at redhat.com
Tue Dec 15 17:40:25 UTC 2009


On Tue, Dec 15, 2009 at 06:30:30PM +0100, Wolfgang Mauerer wrote:
> Hi,
> 
> Daniel P. Berrange wrote:
> > From: Wolfgang Mauerer <wolfgang.mauerer at siemens.com>
> > 
> > This patch allows for explicit hotplug/unplug of SCSI controllers.
> > Ordinarily this is not required, since QEMU/libvirt will attach
> > a new SCSI controller whenever one is required. Allowing explicit
> > hotplug of controllers though, enables the caller to specify a
> > static PCI address, instead of auto-assigning the next available
> > PCI slot. Or it will when we have static PCI addressing.
> > 
> > This patch is derived from Wolfgang Mauerer's disk controller
> > patch series.
> > 
> > * src/qemu/qemu_driver.c: Support hotplug & unplug of SCSI
> >   controllers
> > * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
> >   src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
> >   src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h: Add
> >   new API for attaching PCI SCSI controllers
> (...)
> > +int qemuMonitorTextAttachPCIDiskController(qemuMonitorPtr mon,
> > +                                           const char *bus,
> > +                                           virDomainDevicePCIAddress *guestAddr)
> > +{
> > +    char *cmd = NULL;
> > +    char *reply = NULL;
> > +    int tryOldSyntax = 0;
> > +    int ret = -1;
> > +
> > +try_command:
> > +    if (virAsprintf(&cmd, "pci_add %s storage if=%s",
> > +                    (tryOldSyntax ? "0": "pci_addr=auto"), bus) < 0) {
> > +        virReportOOMError(NULL);
> > +        goto cleanup;
> > +    }
> 
> I just realised that qemu-kvm HEAD prohibits adding empty SCSI
> controllers currently, they consider this to be a bug. I've asked
> to revert the corresponding patch on qemu-devel, but if this does
> not happen, we will need to devise some other mechanism.

Oh I should mention too that with new QEMU 0.12, we can add controllers
in a different way

  -device lsi

Or in the monitor

   device_add lsi


My other series of patches converts everything over to use -device for
new enough QEMU, so I'll extend that to cover controllers anyway. The
added advantage  of -device is that we can set PCI addresses at startup

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 :|




More information about the libvir-list mailing list