[libvirt] [PATCH 0/12] Standardized device addressing & SCSI controller/disk hotplug

Mark McLoughlin markmc at redhat.com
Fri Dec 18 14:18:32 UTC 2009


On Fri, 2009-12-18 at 14:07 +0000, Daniel P. Berrange wrote:
> On Fri, Dec 18, 2009 at 11:17:59AM +0000, Mark McLoughlin wrote:
> > On Thu, 2009-12-17 at 09:39 +0000, Daniel P. Berrange wrote:
> > > On Thu, Dec 10, 2009 at 10:22:20PM +0000, Daniel P. Berrange wrote:
> > > > The XML for each address type looks like
> > > > 
> > > >       <address type='pci' mode='static' domain='0x0000' bus='0x1e' slot='0x07' function='0x0'/>
> > > >       <address type='usb' mode='dynamic' bus='007' dev='003'/>
> > > >       <address type='drive' mode='dynamic' controller='1' bus='0' unit='5'/>
> > > > 
> > > > 
> > > > The 'mode' attribute for any of them is allowed to be either
> > > > 'static' or 'dynamic'. A static address is one specified by
> > > > the end user when defining the XML, while a dynamic address is
> > > > one automatically chosen by libvirt/QEMU every time a guest
> > > > boots. The idea of static addresses is to allow management
> > > > apps to guarentee that PCI device & drive numbering never
> > > > changes. This series does not actually implement static
> > > > addressing for PCI yet, because it requires that we change
> > > > the way we generate QEMU command line arguments. It does
> > > > do static addressing for disks.
> > > 
> > > I'm now wondering whether we actually truely need the 'dynamic'
> > > option. It already doesn't really make sense for disks. For PCI
> > > though I'm not sure anyone would ever want the dynamic mode, 
> > > where addresses can change at every boot. I think I should just
> > > remove the 'mode' attribute here, and just have libvirt detect
> > > PCI addresses the first time, and keep them the same thereafter.
> > 
> > Just reading the proposal now and this is the bit that jumps out at me
> > most. I don't think we need the dynamic/static mode split.
> > 
> > For PCI, we really want to just automatically remember assigned PCI
> > addresses and use them forever after - I don't see any obvious use case
> > where you wouldn't want this.
> > 
> > Also, it strikes me that we've done this before - e.g. if you define a
> > guest with an interface with no explicit MAC address, we generate one
> > and save it in the config. Which is pretty much the same thing from the
> > users point of view.
> 
> The thing I'm trying to avoid is having libvirt update the persistent
> config files outside the context of the existing virDefineXML API,

Remind me why are you trying to avoid that

(I've always been a bit dubious about virDefineXML saving a different
config from the one you've supplied, but that's a different matter)

>  and
> updating the live state file only helps for the duration the that VM
> is running. Hence I came up with the static vs dynamic idea, where the
> app would see the dynamic address, dump the XML and re-define it with
> static addresses. 
> 
> The only other option I see is to explicitly assign all PCI addresses
> at time of virDefineXML, and then always pass an address on the command
> line to QEMU for all devices, but this doesn't work for older QEMU where
> we can't set PCI addresses. 

How about during virDefineXML, execing qemu, not starting the guest, but
instead just querying the device assignments and saving them? If we
ignored errors, it wouldn't change the semantics of the API.

Hmm. Even if you go with the 'dynamic' idea, you're kind of changing the
semantics anyway - you're saying the management apps should do 'define,
start, dumpxml, define' where they didn't have to do that before. And if
all apps should do that, we shouldn't 'start' do it automatically?

Cheers,
Mark.




More information about the libvir-list mailing list