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.
Maybe there are two things to distinguish: If you read "dynamic" in the sense of "I don't care which address the device/disk/whatever uses, and I don't want to specify it explicitely", then having the option is reasonable . I agree that it does not make any sense to have dynamic in the sense "explicitely assign new addresses every time system boots", but that would not happen any way: Given the same set of devices, the underlying hypervisor should assign the same addresses. Your suggestion would essentially imply that an initial "dynamic" specification is converted into a static one after the first boot. You are only referring to the in-memory configuration of libvirt when you talk about subsequent boots, or are you also thinking about modifying the persistent configuration?
The second thought is whether we should put the <address> data inside a <device> element, so it looked like
<device type='pci'> <address domain='0x0000' bus='0x1e' slot='0x07' function='0x0'/> </device>
The reason being, that I think it might be interesting to also add in the vendor / product info at a later date
<device type='pci'> <vendor id='0x8086'/> <product id='0x1234'/> <address domain='0x0000' bus='0x1e' slot='0x07' function='0x0'/> </device>
Can't certainly do any harm to keep the format extensible. Regards, Wolfgang