Create virbr0 for virsh
Solution 1
The reason was insufficient rights to use bridge from non-root user.
Documentation states that:
libvirt defaults to qemu:///session for non-root. So from <youruser> you'll need to do:
$ virsh --connect qemu:///system list --all
It wasn't clear that you have to specify it for installation, and when you would do that. It turns out it's a required command line option for non-root user.
Correct command to install a new VM with networking should include following:
virt-install --connect qemu:///system .......
Or it's also possible to install it directly from root
user
Solution 2
This is how it should work:
# cat /tmp/virt-net-example.xml
<network connections='9'>
<name>some-virt-net</name>
<uuid>530f11c4-617b-447c-bdba-704f34374277</uuid>
<bridge name='virbr42' stp='on' delay='0'/>
<mac address='42:13:37:23:21:87'/>
<ip address='172.20.42.254' netmask='255.255.255.0'>
<dhcp>
<range start='172.20.42.1' end='172.20.42.42'/>
</dhcp>
</ip>
</network>
# virsh net-define /tmp/virt-net-example.xml
# virsh net-start some-virt-net
Network some-virt-net started
# brctl show virbr42
bridge name bridge id STP enabled interfaces
virbr42 8000.421337232187 yes virbr42-nic
# link show virbr42-nic
99: virbr42-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr42 state DOWN mode DEFAULT group default qlen 1000
link/ether 42:13:37:23:21:87 brd ff:ff:ff:ff:ff:ff
Tested just now on FC22 against libvirt 1.2.13
Related videos on Youtube
![Kyle Brown](https://lh3.googleusercontent.com/-AW587V5giuo/AAAAAAAAAAI/AAAAAAAAABE/OmIkGmlwhs8/photo.jpg?sz=256)
Kyle Brown
Updated on September 18, 2022Comments
-
Kyle Brown almost 2 years
Okay so I have an html form in Add.html. When I click submit, I would like the data to be added to my database via php and then return to the same form with "instance added" or "failed blah blah."
The only way I know how is to set the form action to a separate php file and call that - but then the php file renders and I do not return to the same form.
I would like to not have to add a "return to form" button and would prefer to return to the form on submit with a status message.
Any better ways to do this?
-
shaunsantacruz over 8 years
-
-
Kyle Brown over 8 yearsCan you explain, or link an explanation on how to redirect in php? I assume you mean set the form action to a separate file, run the db stuff, then redirect with flash message
-
kingtut007 over 8 yearsare you using a php framework? Its easier on php frameworks. Read up on php.net/manual/en/function.header.php
-
kingtut007 over 8 yearsThis breaks MVC pattern conventions.
-
thepiyush13 over 8 yearscare to explain, please ?
-
kingtut007 over 8 yearsIts not preferable to have template code alongside php code. The following script up there wont work first of all because you indicated that you are running it from an .html file (and not a php file) - so you cant basically parse php syntax in that file. Moreover, by mvc coding standards - it means Model View Controller - you should have the template (view) solely responsible for displaying data given to it from the controller and not mishmashing everything together.
-
thepiyush13 over 8 yearsI agree but on the other hand I did not see OP describing that he is using a MVC framework like CI , in addition if you notice the file name is yourpage.php so it will work just fine, anyway good points, thanks
-
Igor Artamonov over 7 yearsTried, same result, same error. So maybe it's not because of non-existing
virbr0
, but something else related to that bridge? because it works without specifying--network
option. Something is wrong there, butTransport endpoint is not connected
doesn't make it clear -
dyasny over 7 yearsI use this all the time on RHEL, you might be running into a Debian specific bug.
-
Igor Artamonov over 7 yearsDo you know any way to debug it?
virsh
logs/output are non-informative, andTransport endpoint is not connected
doesn't give any clue.-d 0
doesn't provide additional log to that error message -
dyasny over 7 yearstry to simply create a VM with virt-manager and attach it to br0, see if that works. If it does, I'd simply stick to the manual creation way, or if you really need automation, use virt-builder instead of virt-install. It's way less buggy, especially and that's important on non-RH distros that don't really do any quality testing like Debian
-
Igor Artamonov over 7 yearsnot sure what you mean by attach it to br0. I've tried to create simple VM without networking, but if I edit its xml and add bridge network (there's example in the question) it failed to run. I don't know about other way to attach it to br0. I'll try virt-builder, thanks
-
dyasny over 7 yearsThis is probably a bug in your build of libvirt. I am adding an example of a working interface definition you can try yourself. The brctl output seems to be in good order
-
Igor Artamonov over 7 yearsthanks. could you elaborate it a little more? what so you think should be modified in my config to make it working? because it doesn't look like adding mac address will help. so there should be something important in your example, but I don't understand what exactly
-
phg over 7 years“what so you think should be modified in my config” -- not the config, but let libvirt create the bridge. It will do that on its own. In your VM definition you then reference the bridge as
<target dev='vnet42'/>
in the interface section.