
Hello All, I am currently working on patches for PCI-passthrough of SRIOV VF's and I am facing an issue with the network definition not being persistent. I am using a new forward mode = hostdev and the network xml is as follows: <network> <name>pci-passthrough-network</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a8f</uuid> <forward mode="hostdev"> <pf dev="eth2"/> </forward> </network> Command line used is: # virsh net-define pci_passthrough_network.xml The network is defined successfully and I can use it at this point. But if I restart libvirt after defining the above network, I lose the network definition. After restart libvirt does not possess any knowledge of the above network. This does not happen when I use forward mode="bridge". I have cross referenced the function call path of networkDefine for both the forwarding modes and I can't seem to find the problem. Is there some function I am missing? May I ask for your help to solve this issue? Many Thanks, Regards, Shradha Shah

On 02/20/2012 12:37 PM, Shradha Shah wrote:
Hello All,
I am currently working on patches for PCI-passthrough of SRIOV VF's and I am facing an issue with the network definition not being persistent.
I am using a new forward mode = hostdev and the network xml is as follows: <network> <name>pci-passthrough-network</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a8f</uuid> <forward mode="hostdev"> <pf dev="eth2"/> </forward> </network>
Command line used is: # virsh net-define pci_passthrough_network.xml
The network is defined successfully and I can use it at this point.
But if I restart libvirt after defining the above network, I lose the network definition.
After restart libvirt does not possess any knowledge of the above network.
This does not happen when I use forward mode="bridge".
I have cross referenced the function call path of networkDefine for both the forwarding modes and I can't seem to find the problem.
Is there some function I am missing?
You need to add some logic to networkFindActiveConfigs() to determine if the network is active. (actually this points out that networkFindActiveConfigs() doesn't have any code to determine if the macvtap network types are active. It turns out that there's really no effect to starting one of those types of network, but I should probably do *something* to allow a restarted libvirtd to determine if that type of network is started...)

On 02/20/2012 06:43 PM, Laine Stump wrote:
On 02/20/2012 12:37 PM, Shradha Shah wrote:
Hello All,
I am currently working on patches for PCI-passthrough of SRIOV VF's and I am facing an issue with the network definition not being persistent.
I am using a new forward mode = hostdev and the network xml is as follows: <network> <name>pci-passthrough-network</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a8f</uuid> <forward mode="hostdev"> <pf dev="eth2"/> </forward> </network>
Command line used is: # virsh net-define pci_passthrough_network.xml
The network is defined successfully and I can use it at this point.
But if I restart libvirt after defining the above network, I lose the network definition.
After restart libvirt does not possess any knowledge of the above network.
This does not happen when I use forward mode="bridge".
I have cross referenced the function call path of networkDefine for both the forwarding modes and I can't seem to find the problem.
Is there some function I am missing?
You need to add some logic to networkFindActiveConfigs() to determine if the network is active.
I am not sure if I am missing something but, networkFindActiveConfigs() is called by networkStartup() only. Currently I am not starting any networks but just defining them and then restarting libvirtd, at which point the pci-passthrough-network dissapears. The commands I am using are as follows: # virsh net-define pci_passthrough_network.xml Network pci-passthrough-network defined from pci_passthrough_network.xml # virsh net-define macvtap_bridge_network.xml Network macvtap-bridge-network defined from macvtap_bridge_network.xml # virsh net-list -all Name State Autostart -------------------------------------------------- macvtap-bridge-network inactive no pci-passthrough-network inactive no # service libvirtd restart Stopping libvirtd daemon: [ OK ] Starting libvirtd daemon: [ OK ] # virsh net-list -all Name State Autostart -------------------------------------------------- macvtap-bridge-network inactive no I think its got to do something with the persistent flag of the network object, but I am not sure. Thanks, Shradha
(actually this points out that networkFindActiveConfigs() doesn't have any code to determine if the macvtap network types are active. It turns out that there's really no effect to starting one of those types of network, but I should probably do *something* to allow a restarted libvirtd to determine if that type of network is started...)
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On 02/21/2012 07:33 AM, Shradha Shah wrote:
On 02/20/2012 06:43 PM, Laine Stump wrote:
Hello All,
I am currently working on patches for PCI-passthrough of SRIOV VF's and I am facing an issue with the network definition not being persistent.
I am using a new forward mode = hostdev and the network xml is as follows: <network> <name>pci-passthrough-network</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a8f</uuid> <forward mode="hostdev"> <pf dev="eth2"/> </forward> </network>
Command line used is: # virsh net-define pci_passthrough_network.xml
The network is defined successfully and I can use it at this point.
But if I restart libvirt after defining the above network, I lose the network definition.
After restart libvirt does not possess any knowledge of the above network.
This does not happen when I use forward mode="bridge".
I have cross referenced the function call path of networkDefine for both the forwarding modes and I can't seem to find the problem.
Is there some function I am missing? You need to add some logic to networkFindActiveConfigs() to determine if
On 02/20/2012 12:37 PM, Shradha Shah wrote: the network is active. I am not sure if I am missing something but, networkFindActiveConfigs() is called by networkStartup() only.
Right. And that is called every time libvirtd is restarted. I had read your post too quickly and assumed the problem was that the new network was no longer marked active after restarting libvirtd, in which case this is where you would want to look. But I see from you virsh net-list output that the real problem is that the network is no longer *defined* after a restart.
Currently I am not starting any networks but just defining them and then restarting libvirtd, at which point the pci-passthrough-network dissapears. The commands I am using are as follows:
# virsh net-define pci_passthrough_network.xml Network pci-passthrough-network defined from pci_passthrough_network.xml
# virsh net-define macvtap_bridge_network.xml Network macvtap-bridge-network defined from macvtap_bridge_network.xml
# virsh net-list -all Name State Autostart -------------------------------------------------- macvtap-bridge-network inactive no pci-passthrough-network inactive no
# service libvirtd restart Stopping libvirtd daemon: [ OK ] Starting libvirtd daemon: [ OK ]
# virsh net-list -all Name State Autostart -------------------------------------------------- macvtap-bridge-network inactive no
Before you restart libvirtd, is the xml file in place in /etc/libvirt/qemu/networks/pci-passthrough-network.xml? And is that file still there after libvirtd restarts? If the file is still there but the definition doesn't show up in net-list --all, perhaps there is something in the xml file that is failing the parse - any log messages in libvirtd? Also, does it behave differently if you start the network before restarting libvirtd? Beyond this, it's really not possible to help much more without seeing the code you're working with.
I think its got to do something with the persistent flag of the network object, but I am not sure.
Well, the persistent flag is set unconditionally by networkDefine for all types of networks.

On 02/21/2012 03:59 PM, Laine Stump wrote:
On 02/21/2012 07:33 AM, Shradha Shah wrote:
On 02/20/2012 06:43 PM, Laine Stump wrote:
Hello All,
I am currently working on patches for PCI-passthrough of SRIOV VF's and I am facing an issue with the network definition not being persistent.
I am using a new forward mode = hostdev and the network xml is as follows: <network> <name>pci-passthrough-network</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a8f</uuid> <forward mode="hostdev"> <pf dev="eth2"/> </forward> </network>
Command line used is: # virsh net-define pci_passthrough_network.xml
The network is defined successfully and I can use it at this point.
But if I restart libvirt after defining the above network, I lose the network definition.
After restart libvirt does not possess any knowledge of the above network.
This does not happen when I use forward mode="bridge".
I have cross referenced the function call path of networkDefine for both the forwarding modes and I can't seem to find the problem.
Is there some function I am missing? You need to add some logic to networkFindActiveConfigs() to determine if
On 02/20/2012 12:37 PM, Shradha Shah wrote: the network is active. I am not sure if I am missing something but, networkFindActiveConfigs() is called by networkStartup() only.
Right. And that is called every time libvirtd is restarted. I had read your post too quickly and assumed the problem was that the new network was no longer marked active after restarting libvirtd, in which case this is where you would want to look. But I see from you virsh net-list output that the real problem is that the network is no longer *defined* after a restart.
Currently I am not starting any networks but just defining them and then restarting libvirtd, at which point the pci-passthrough-network dissapears. The commands I am using are as follows:
# virsh net-define pci_passthrough_network.xml Network pci-passthrough-network defined from pci_passthrough_network.xml
# virsh net-define macvtap_bridge_network.xml Network macvtap-bridge-network defined from macvtap_bridge_network.xml
# virsh net-list -all Name State Autostart -------------------------------------------------- macvtap-bridge-network inactive no pci-passthrough-network inactive no
# service libvirtd restart Stopping libvirtd daemon: [ OK ] Starting libvirtd daemon: [ OK ]
# virsh net-list -all Name State Autostart -------------------------------------------------- macvtap-bridge-network inactive no
Before you restart libvirtd, is the xml file in place in /etc/libvirt/qemu/networks/pci-passthrough-network.xml? And is that file still there after libvirtd restarts? If the file is still there but the definition doesn't show up in net-list --all, perhaps there is something in the xml file that is failing the parse - any log messages in libvirtd?
This was indeed the case. Libvirt was failing to parse the forwarddev on restart. Bit of a mistake in my code. Now resolved. Many Thanks, Regards, Shradha
Also, does it behave differently if you start the network before restarting libvirtd?
Beyond this, it's really not possible to help much more without seeing the code you're working with.
I think its got to do something with the persistent flag of the network object, but I am not sure.
Well, the persistent flag is set unconditionally by networkDefine for all types of networks.

On 02/21/2012 09:32 AM, Shradha Shah wrote:
Before you restart libvirtd, is the xml file in place in /etc/libvirt/qemu/networks/pci-passthrough-network.xml? And is that file still there after libvirtd restarts? If the file is still there but the definition doesn't show up in net-list --all, perhaps there is something in the xml file that is failing the parse - any log messages in libvirtd?
This was indeed the case. Libvirt was failing to parse the forwarddev on restart. Bit of a mistake in my code. Now resolved.
Guess what - that argues that when we commit your code, we should also commit an xml file somewhere under the tests directory that stresses this particular usage of forwarddev, to make sure that we don't repeat the problem later :) -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (3)
-
Eric Blake
-
Laine Stump
-
Shradha Shah