Hide Forgot
Description of problem: In virt-manager , add a virtio interface to a vm , then you'll see the network interface sequence misorder. dumpxml as follows, we found the pci seq of last interface isn't what I want. <interface type='network'> <mac address='52:54:00:74:67:b3'/> <source network='director' bridge='virbr1'/> <target dev='vnet0'/> <model type='virtio'/> <alias name='net0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> <interface type='network'> <mac address='52:54:00:de:20:b5'/> <source network='external' bridge='virbr3'/> <target dev='vnet1'/> <model type='virtio'/> <alias name='net1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/> </interface> <interface type='network'> <mac address='52:54:00:e5:e9:a3'/> <source network='default' bridge='virbr0'/> <target dev='vnet2'/> <model type='virtio'/> <alias name='net2'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/> </interface> <interface type='network'> <mac address='52:54:00:2c:e5:15'/> <source network='management' bridge='virbr2'/> <target dev='vnet3'/> <model type='virtio'/> <alias name='net3'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/> I think the slot number which generated by virt-manager should be greater than previous max slot number. Version-Release number of selected component (if applicable): How reproducible: not always , but 60% reproducible. Steps to Reproduce: 1.install a kvm vm with 3 virtio network interface 2.hot add a virtio network interface 3.reboot. Actual results: you'll find network interface misorder. Expected results: the interface which is hot added should be the last interface. Additional info:
The PCI address is generated by libvirt, virt-manager doesn't do that. Moreover the device is plugged into first available slot, not in order base on other devices of the same type.
(In reply to Pavel Hrdina from comment #2) > The PCI address is generated by libvirt, virt-manager doesn't do that. > Moreover the device is plugged into first available slot, not in order base > on other devices of the same type. ok, libvirt, I think it is possible to generate a bigger pci address, right?
I don't see a point of implementing that. If user wants to put a device into a specific PCI slot he should specify PCI address manually. This isn't possible using virt-manager because virt-manager GUI is only for easy and simple tasks. virt-xml or virsh has to be used to do that. The automatic PCI address generation serves to ease things if you don't care about any specifics and you just want to quickly attach some device into a guest.
(In reply to Pavel Hrdina from comment #4) > I don't see a point of implementing that. If user wants to put a device > into a specific PCI slot he should specify PCI address manually. This isn't > possible using virt-manager because virt-manager GUI is only for easy and > simple tasks. virt-xml or virsh has to be used to do that. > > The automatic PCI address generation serves to ease things if you don't care > about any specifics and you just want to quickly attach some device into a > guest. If the root cause is in libvirt, I can change to libvirt from virt-manager, maybe it needs to collaborate between them for solving this issue. I think open source software can do better than propriety software, why not solve it ? do you need a RFE for it?
(In reply to Jun Hu from comment #5) > (In reply to Pavel Hrdina from comment #4) > > I don't see a point of implementing that. If user wants to put a device > > into a specific PCI slot he should specify PCI address manually. This isn't > > possible using virt-manager because virt-manager GUI is only for easy and > > simple tasks. virt-xml or virsh has to be used to do that. > > > > The automatic PCI address generation serves to ease things if you don't care > > about any specifics and you just want to quickly attach some device into a > > guest. > > If the root cause is in libvirt, I can change to libvirt from virt-manager, > maybe it needs to collaborate between them for solving this issue. I speak also for libvirt as I'm libvirt developer too. > I think open source software can do better than propriety software, why not > solve it ? Yes, I fully support the idea that open source software should be better than proprietary software. There is nothing to solve, there is no bug with the automatic PCI address assignment. The design is that it finds first available slot and plug the device into that slot. I don't see any good reason why the PCI address should be a subsequent of existing device of the same type you are trying to plug in. Libvirt doesn't implement any policy, it's a tool to help you with virtualization. Also the documentation <http://libvirt.org/formatdomain.html#elementsAddress> clearly states that if you want more control of the address layout you need to specify it manually. Another reason why I don't think that this feature is good idea, let's say that a guest has one network device plugged into the last available slot, where would be plugged second network device? Pavel
I agree with Pavel that there is nothing to do here. On the side of virt-manager - virt-manager *by design* doesn't have any facilities to specify PCI addresses. On the side of libvirt - if you don't specify the PCI address you want, then libvirt always uses the lowest numbered unused slot, and the documentation clearly says that if you have any concerns about the exact placement of the device, then you can easily specify the pci address yourself - i.e. libvirt can already do what you want. Along with re-iterating Pavel's point that always putting a new device at a higher address than existing devices of the same type can't be the default mode of operation because it will end up exhausting your address space much more quickly (and push devices onto pci-bridges more quickly), I'll say that making that some type of simple flag-based choice is a policy decision, and libvirt does not and will not make policy decisions (I can say this from a reasonable point of authority, since I recently posted a libvirt patch that would have added a flag for each device to say that device didn't need a hotplug-capable slot, and even that (which in my view is much more useful than what you're suggesting) was strongly rejected) Beyond that, why should it even matter what PCI slot the device is in? Is there actually a good reason to care (other than OCD)?
Per previous comments (comment 6 and comment 7) I am closing this as wontfix. There is nothing what can or should libvirt do about this. In case of existing business justification for manual pci address specification in virt-manager, or if there was customer case we can review, please add a new RFE for virt-manager asking for this new feature. But again, this might be rejected as the virt-manager tends to hide the complexity rather than expose. Thanks.