Re: libvirt and bhyve problems

2014-06-17 Thread Craig Rodrigues
On Sun, Jun 15, 2014 at 8:20 AM, Roman Bogorodskiy no...@freebsd.org wrote:

 I have updated the port:

 http://people.freebsd.org/~novel/misc/libvirt_port2.tgz

 Changes are:

  * added RUN_DEPENDS on dnsmasq (required for networking)
  * added installation on network definition files

Hi,

dnsmasq needs to be in BUILD_DEPENDS
*and* RUN_DEPENDS for this port.

I did a test on my system where I deleted the dnsmasq port,
and then built the libvirt port.  During the configure stage of this port,
the #define DNSMASQ variable is expanded and written to a config.h.

If the dnsmasq port is not around during the build stage of  the libvirt port,
then this variable is not expanded properly, and when the libvirt port
is fully built, running libvirtd will not start dnsmasq, because the path
to dnsmasq was not written properly to config.h.

--
Craig
___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
freebsd-virtualization-unsubscr...@freebsd.org


Re: libvirt and bhyve problems

2014-06-16 Thread Roman Bogorodskiy
  Craig Rodrigues wrote:

 On Sun, Jun 15, 2014 at 8:20 AM, Roman Bogorodskiy no...@freebsd.org wrote:
 
  I have updated the port:
 
  http://people.freebsd.org/~novel/misc/libvirt_port2.tgz
 
 
 OK, I deinstall the old port, took your port, built it, and installed it.
 
 When I started libvirtd, I got this:
 
 2014-06-15 18:47:07.236+: 34485605376: info : libvirt version: 1.2.5
 2014-06-15 18:47:07.236+: 34485605376: info :
 dnsmasqCapsSetFromBuffer:685 : dnsmasq version is 2.71, --bind-dynamic
 is present, SO_BINDTODEVICE is in use
 2014-06-15 18:47:07.237+: 34485605376: info :
 networkReloadFirewallRules:1750 : Reloading iptables rules
 2014-06-15 18:47:07.237+: 34485605376: info :
 networkRefreshDaemons:1722 : Refreshing network daemons
 2014-06-15 18:47:07.395+: 34485605376: error : virCommandWait:2426
 : internal error: Child process (/usr/local/sbin/dnsmasq
 --conf-file=/usr/local/var/lib/libvirt/dnsmasq/default.conf)
 unexpected exit status 2:
 dnsmasq: failed to create listening socket for 127.0.0.1: Address already in 
 use
 
 2014-06-15 18:47:07.484+: 34485605376: error : virExec:417 :
 Cannot find 'pm-is-supported' in path: No such file or directory
 2014-06-15 18:47:07.484+: 34485605376: warning :
 virQEMUCapsInit:948 : Failed to get host power management capabilities
 2014-06-15 18:47:07.495+: 34485605376: info :
 virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
 /usr/local/var/run/libvirt/qemu
 2014-06-15 18:47:07.495+: 34485605376: info :
 virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
 /usr/local/etc/libvirt/qemu
 2014-06-15 18:47:07.583+: 34485605376: info :
 virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
 /usr/local/etc/libvirt/bhyve
 2014-06-15 18:47:07.584+: 34485605376: info :
 virDomainObjListLoadAllConfigs:18273 : Loading config file 'bhyve.xml'
 
 
 
 Trying to start bhyve did not work.
 
 After some investigation, I did the following:
 
 service local_unbound stop
 
 
 Then I started libvirtd again:
 
 2014-06-15 18:47:07.236+: 34485605376: info : libvirt version: 1.2.5
 2014-06-15 18:47:07.236+: 34485605376: info :
 dnsmasqCapsSetFromBuffer:685 : dnsmasq version is 2.71, --bind-dynamic
 is present, SO_BINDTODEVICE is in use
 2014-06-15 18:47:07.237+: 34485605376: info :
 networkReloadFirewallRules:1750 : Reloading iptables rules
 2014-06-15 18:47:07.237+: 34485605376: info :
 networkRefreshDaemons:1722 : Refreshing network daemons
 2014-06-15 18:47:07.395+: 34485605376: error : virCommandWait:2426
 : internal error: Child process (/usr/local/sbin/dnsmasq
 --conf-file=/usr/local/var/lib/libvirt/dnsmasq/default.conf)
 unexpected exit status 2:
 dnsmasq: failed to create listening socket for 127.0.0.1: Address already in 
 use
 
 2014-06-15 18:47:07.484+: 34485605376: error : virExec:417 :
 Cannot find 'pm-is-supported' in path: No such file or directory
 2014-06-15 18:47:07.484+: 34485605376: warning :
 virQEMUCapsInit:948 : Failed to get host power management capabilities
 2014-06-15 18:47:07.495+: 34485605376: info :
 virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
 /usr/local/var/run/libvirt/qemu
 2014-06-15 18:47:07.495+: 34485605376: info :
 virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
 /usr/local/etc/libvirt/qemu
 2014-06-15 18:47:07.583+: 34485605376: info :
 virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
 /usr/local/etc/libvirt/bhyve
 2014-06-15 18:47:07.584+: 34485605376: info :
 virDomainObjListLoadAllConfigs:18273 : Loading config file 'bhyve.xml'
 
 
 At this point, I could see the virbr0 device:
 
 virbr0: flags=8843UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST metric 0 mtu 1500
 ether 02:b8:18:5f:0f:00
 inet 192.168.122.1 netmask 0xff00 broadcast 192.168.122.255
 nd6 options=1PERFORMNUD
 id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 4
 maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
 root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
 
 
 I was then able to do:
 
 virsh -c 'bhyve:///system'
 start bhyve
 
 and start a VM.
 This is good progress!
 
 Once thing I observed is that if I killed the libvirtd process,
 it did not clean up the dnsmasq process that it started:
 
 /usr/local/sbin/dnsmasq
 --conf-file=/usr/local/var/lib/libvirt/dnsmasq/default.conf
 
 and a subsequent restart of libvirtd would fail.

I think it's intentional not to kill dnsmasq. There are persistent and
transient objects in libvirt (such as domains and networks), and
persistent objects live forever, while transient objects live until
manually destroyed or host is restarted.

So libvirt doesn't kill persistent VMs and, I guess, it doesn't stop
dnsmasq to keep persistent networks functional.

It should not affect restart. I'll fail to start the network, but as
it's here already, we're fine.

BTW, I'm still yet to write the code to catch up 

Re: libvirt and bhyve problems

2014-06-15 Thread Roman Bogorodskiy
  Craig Rodrigues wrote:

 On Thu, Jun 12, 2014 at 12:00 PM, Roman Bogorodskiy no...@freebsd.org wrote:
 
  Ah. Actually, libvirt manages bridges and taps on its own. So, the
  preferred flow is that libvirt starts its networks on startup
  automatically. By default it has a network with the 'virbr0' device
  which it creates on its own.
 
  Later on it creates vnet devices (which are tap devices) automatically
  as well on VM startup and plugs them to the bridge.
 
  The configuration you have probably confuses it, could you consider
  trying without that?
 
 OK, I removed all autobridge and cloned_interfaces entries
 from my rc.conf and rebooted.  I am still using your version of the
 libvirt port.
 
 I tried the steps again and got this:
 
 2014-06-13 19:09:10.482+: 34485605376: info : libvirt version: 1.2.5
 2014-06-13 19:09:10.482+: 34485605376: error :
 dnsmasqCapsRefreshInternal:726 : Cannot check dnsmasq binary dnsmasq:
 No such file or directory
 2014-06-13 19:09:10.482+: 34485605376: info :
 networkReloadFirewallRules:1750 : Reloading iptables rules
 2014-06-13 19:09:10.482+: 34485605376: info :
 networkRefreshDaemons:1722 : Refreshing network daemons
 2014-06-13 19:09:10.593+: 34485605376: error : virExec:417 :
 Cannot find 'pm-is-supported' in path: No such file or directory
 2014-06-13 19:09:10.593+: 34485605376: warning :
 virQEMUCapsInit:948 : Failed to get host power management capabilities
 2014-06-13 19:09:10.615+: 34485605376: info :
 virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
 /usr/local/var/run/libvirt/qemu
 2014-06-13 19:09:10.615+: 34485605376: info :
 virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
 /usr/local/etc/libvirt/qemu
 2014-06-13 19:09:10.716+: 34485605376: info :
 virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
 /usr/local/etc/libvirt/bhyve
 2014-06-13 19:09:10.716+: 34485605376: info :
 virDomainObjListLoadAllConfigs:18273 : Loading config file 'bhyve.xml'
 2014-06-13 19:09:25.938+: 34485598208: error :
 virNetDevTapCreate:385 : Unable to create tap device: Invalid argument
 2014-06-13 19:09:26.063+: 34485598208: error : virCommandWait:2426
 : internal error: Child process (/usr/sbin/bhyvectl --destroy
 --vm=bhyve) unexpected exit status 255
 
 
 If I do ifconfig, I have no bridge or tap devices.
 
 
 
  Also, do you have working 'net-list' command in virsh with my version of
  port?
 
 I get this:
 virsh # net-list
  Name State  Autostart Persistent
 --
 

I have updated the port:

http://people.freebsd.org/~novel/misc/libvirt_port2.tgz

Changes are:

 * added RUN_DEPENDS on dnsmasq (required for networking)
 * added installation on network definition files

Hopefully this will allow to bring up network on start. When the daemon
starts, virsh should show the following:

virsh # net-list
 Name State  Autostart Persistent
 --
  default  active yes   yes

virsh # 

If that's not the case, then something is still going wrong.

And yes, qemu support should be enabled (networks defs seem to be
installed with qemu support).

Even if it doesn't work, and 'net-list --all' is empty, we could try to
do it manually (but still, if it's the case, then it's something wrong
with the port that needs to be fixed):

in virsh

# net-define /usr/local/etc/libvirt/qemu/networks/default.xml
# net-start default

Roman Bogorodskiy


pgpZGtuqlk5zW.pgp
Description: PGP signature


Re: libvirt and bhyve problems

2014-06-15 Thread Craig Rodrigues
On Sun, Jun 15, 2014 at 8:20 AM, Roman Bogorodskiy no...@freebsd.org wrote:

 I have updated the port:

 http://people.freebsd.org/~novel/misc/libvirt_port2.tgz


OK, I deinstall the old port, took your port, built it, and installed it.

When I started libvirtd, I got this:

2014-06-15 18:47:07.236+: 34485605376: info : libvirt version: 1.2.5
2014-06-15 18:47:07.236+: 34485605376: info :
dnsmasqCapsSetFromBuffer:685 : dnsmasq version is 2.71, --bind-dynamic
is present, SO_BINDTODEVICE is in use
2014-06-15 18:47:07.237+: 34485605376: info :
networkReloadFirewallRules:1750 : Reloading iptables rules
2014-06-15 18:47:07.237+: 34485605376: info :
networkRefreshDaemons:1722 : Refreshing network daemons
2014-06-15 18:47:07.395+: 34485605376: error : virCommandWait:2426
: internal error: Child process (/usr/local/sbin/dnsmasq
--conf-file=/usr/local/var/lib/libvirt/dnsmasq/default.conf)
unexpected exit status 2:
dnsmasq: failed to create listening socket for 127.0.0.1: Address already in use

2014-06-15 18:47:07.484+: 34485605376: error : virExec:417 :
Cannot find 'pm-is-supported' in path: No such file or directory
2014-06-15 18:47:07.484+: 34485605376: warning :
virQEMUCapsInit:948 : Failed to get host power management capabilities
2014-06-15 18:47:07.495+: 34485605376: info :
virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
/usr/local/var/run/libvirt/qemu
2014-06-15 18:47:07.495+: 34485605376: info :
virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
/usr/local/etc/libvirt/qemu
2014-06-15 18:47:07.583+: 34485605376: info :
virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
/usr/local/etc/libvirt/bhyve
2014-06-15 18:47:07.584+: 34485605376: info :
virDomainObjListLoadAllConfigs:18273 : Loading config file 'bhyve.xml'



Trying to start bhyve did not work.

After some investigation, I did the following:

service local_unbound stop


Then I started libvirtd again:

2014-06-15 18:47:07.236+: 34485605376: info : libvirt version: 1.2.5
2014-06-15 18:47:07.236+: 34485605376: info :
dnsmasqCapsSetFromBuffer:685 : dnsmasq version is 2.71, --bind-dynamic
is present, SO_BINDTODEVICE is in use
2014-06-15 18:47:07.237+: 34485605376: info :
networkReloadFirewallRules:1750 : Reloading iptables rules
2014-06-15 18:47:07.237+: 34485605376: info :
networkRefreshDaemons:1722 : Refreshing network daemons
2014-06-15 18:47:07.395+: 34485605376: error : virCommandWait:2426
: internal error: Child process (/usr/local/sbin/dnsmasq
--conf-file=/usr/local/var/lib/libvirt/dnsmasq/default.conf)
unexpected exit status 2:
dnsmasq: failed to create listening socket for 127.0.0.1: Address already in use

2014-06-15 18:47:07.484+: 34485605376: error : virExec:417 :
Cannot find 'pm-is-supported' in path: No such file or directory
2014-06-15 18:47:07.484+: 34485605376: warning :
virQEMUCapsInit:948 : Failed to get host power management capabilities
2014-06-15 18:47:07.495+: 34485605376: info :
virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
/usr/local/var/run/libvirt/qemu
2014-06-15 18:47:07.495+: 34485605376: info :
virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
/usr/local/etc/libvirt/qemu
2014-06-15 18:47:07.583+: 34485605376: info :
virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
/usr/local/etc/libvirt/bhyve
2014-06-15 18:47:07.584+: 34485605376: info :
virDomainObjListLoadAllConfigs:18273 : Loading config file 'bhyve.xml'


At this point, I could see the virbr0 device:

virbr0: flags=8843UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST metric 0 mtu 1500
ether 02:b8:18:5f:0f:00
inet 192.168.122.1 netmask 0xff00 broadcast 192.168.122.255
nd6 options=1PERFORMNUD
id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 4
maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0


I was then able to do:

virsh -c 'bhyve:///system'
start bhyve

and start a VM.
This is good progress!

Once thing I observed is that if I killed the libvirtd process,
it did not clean up the dnsmasq process that it started:

/usr/local/sbin/dnsmasq
--conf-file=/usr/local/var/lib/libvirt/dnsmasq/default.conf

and a subsequent restart of libvirtd would fail.


The devel/libvirt port is looking a lot better with your changes.
Can you push these changes into the port?

I filed bugs 190767 and 190783, but did not get any response
from the port maintainer, jgh@.

--
Craig
___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
freebsd-virtualization-unsubscr...@freebsd.org


Re: libvirt and bhyve problems

2014-06-13 Thread Willem Jan Withagen

On 2014-06-12 20:33, Craig Rodrigues wrote:

On Thu, Jun 12, 2014 at 11:28 AM, Craig Rodrigues rodr...@freebsd.org wrote:

On Thu, Jun 12, 2014 at 1:00 AM, Roman Bogorodskiy no...@freebsd.org wrote:


http://people.freebsd.org/~novel/misc/libvirt_port_updated.tgz

With this setup, I'm able to get networking (e.g. virsh net-list works)
and updated the fix for the previous problem. I was able to start a VM
with that setup.



I deleted the old port from my system and took your modified port,
built it, and installed it.

I followed my previous steps in:
http://lists.freebsd.org/pipermail/freebsd-virtualization/2014-June/002588.html
and got this:

2014-06-12 18:23:54.328+: 34485605376: info : libvirt version: 1.2.5
2014-06-12 18:23:54.328+: 34485605376: error :
dnsmasqCapsRefreshInternal:726 : Cannot check dnsmasq binary dnsmasq:
No such file or directory
2014-06-12 18:23:54.328+: 34485605376: info :
networkReloadFirewallRules:1750 : Reloading iptables rules
2014-06-12 18:23:54.328+: 34485605376: info :
networkRefreshDaemons:1722 : Refreshing network daemons
2014-06-12 18:23:54.438+: 34485605376: error : virExec:417 :
Cannot find 'pm-is-supported' in path: No such file or directory
2014-06-12 18:23:54.439+: 34485605376: warning :
virQEMUCapsInit:948 : Failed to get host power management capabilities
2014-06-12 18:23:54.460+: 34485605376: info :
virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
/usr/local/var/run/libvirt/qemu
2014-06-12 18:23:54.461+: 34485605376: info :
virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
/usr/local/etc/libvirt/qemu
2014-06-12 18:23:54.560+: 34485605376: info :
virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
/usr/local/etc/libvirt/bhyve
2014-06-12 18:23:54.560+: 34485605376: info :
virDomainObjListLoadAllConfigs:18273 : Loading config file 'bhyve.xml'
2014-06-12 18:24:17.940+: 34485598208: error :
virNetDevBridgeAddPort:399 : Unable to add bridge tap0 port vnet0:
Invalid argument
2014-06-12 18:24:18.056+: 34485598208: error : virCommandWait:2426
: internal error: Child process (/usr/sbin/bhyvectl --destroy
--vm=bhyve) unexpected exit status 255


--
Craig



After the program fails, these are my tap and bridge devices, as shown
by ifconfig:

bridge0: flags=8843UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST metric 0 mtu 1500
 ether 02:29:45:c7:8f:00
 nd6 options=9PERFORMNUD,IFDISABLED
 id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
 maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
 root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
 member: em0 flags=143LEARNING,DISCOVER,AUTOEDGE,AUTOPTP
 ifmaxaddr 0 port 1 priority 128 path cost 2
 member: tap2 flags=143LEARNING,DISCOVER,AUTOEDGE,AUTOPTP
 ifmaxaddr 0 port 7 priority 128 path cost 200
 member: tap1 flags=143LEARNING,DISCOVER,AUTOEDGE,AUTOPTP
 ifmaxaddr 0 port 6 priority 128 path cost 200
 member: tap0 flags=143LEARNING,DISCOVER,AUTOEDGE,AUTOPTP
 ifmaxaddr 0 port 5 priority 128 path cost 200
tap0: flags=8902BROADCAST,PROMISC,SIMPLEX,MULTICAST metric 0 mtu 1500
 options=8LINKSTATE
 ether 00:bd:53:27:00:00
 nd6 options=29PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL
 media: Ethernet autoselect
 status: no carrier
tap1: flags=8902BROADCAST,PROMISC,SIMPLEX,MULTICAST metric 0 mtu
1500
 options=8LINKSTATE
 ether 00:bd:59:27:00:01
 nd6 options=29PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL
 media: Ethernet autoselect
 status: no carrier
tap2: flags=8943UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST
metric 0 mtu 1500
 options=8LINKSTATE
 ether 00:bd:5e:27:00:02
 nd6 options=29PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL
 media: Ethernet autoselect
 status: active
 Opened by PID 1506
vnet0: flags=8802BROADCAST,SIMPLEX,MULTICAST metric 0 mtu 1500
 options=8LINKSTATE
 ether fe:54:00:33:20:8c
 nd6 options=21PERFORMNUD,AUTO_LINKLOCAL
 media: Ethernet autoselect
 status: no carrier


This is in my /etc/rc.conf for creating bridge and tap devices on bootup:

#
# Create tap devices, one tap interface per BHyve VM.
# Add the tap interfaces to bridge0

cloned_interfaces=bridge0 tap0 tap1 tap2

autobridge_interfaces=bridge0
autobridge_bridge0=tap* em0


I claim to know nothing about libvirt.

But in my scripts I need to delay using the tap?? interfaces for 1-2 
secs with a sleep. Because otherwise my bhyve VM fails.

Could be the same here?

--WjW


___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any 

Re: libvirt and bhyve problems

2014-06-13 Thread Craig Rodrigues
On Thu, Jun 12, 2014 at 12:00 PM, Roman Bogorodskiy no...@freebsd.org wrote:

 Ah. Actually, libvirt manages bridges and taps on its own. So, the
 preferred flow is that libvirt starts its networks on startup
 automatically. By default it has a network with the 'virbr0' device
 which it creates on its own.

 Later on it creates vnet devices (which are tap devices) automatically
 as well on VM startup and plugs them to the bridge.

 The configuration you have probably confuses it, could you consider
 trying without that?

OK, I removed all autobridge and cloned_interfaces entries
from my rc.conf and rebooted.  I am still using your version of the
libvirt port.

I tried the steps again and got this:

2014-06-13 19:09:10.482+: 34485605376: info : libvirt version: 1.2.5
2014-06-13 19:09:10.482+: 34485605376: error :
dnsmasqCapsRefreshInternal:726 : Cannot check dnsmasq binary dnsmasq:
No such file or directory
2014-06-13 19:09:10.482+: 34485605376: info :
networkReloadFirewallRules:1750 : Reloading iptables rules
2014-06-13 19:09:10.482+: 34485605376: info :
networkRefreshDaemons:1722 : Refreshing network daemons
2014-06-13 19:09:10.593+: 34485605376: error : virExec:417 :
Cannot find 'pm-is-supported' in path: No such file or directory
2014-06-13 19:09:10.593+: 34485605376: warning :
virQEMUCapsInit:948 : Failed to get host power management capabilities
2014-06-13 19:09:10.615+: 34485605376: info :
virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
/usr/local/var/run/libvirt/qemu
2014-06-13 19:09:10.615+: 34485605376: info :
virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
/usr/local/etc/libvirt/qemu
2014-06-13 19:09:10.716+: 34485605376: info :
virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
/usr/local/etc/libvirt/bhyve
2014-06-13 19:09:10.716+: 34485605376: info :
virDomainObjListLoadAllConfigs:18273 : Loading config file 'bhyve.xml'
2014-06-13 19:09:25.938+: 34485598208: error :
virNetDevTapCreate:385 : Unable to create tap device: Invalid argument
2014-06-13 19:09:26.063+: 34485598208: error : virCommandWait:2426
: internal error: Child process (/usr/sbin/bhyvectl --destroy
--vm=bhyve) unexpected exit status 255


If I do ifconfig, I have no bridge or tap devices.



 Also, do you have working 'net-list' command in virsh with my version of
 port?

I get this:
virsh # net-list
 Name State  Autostart Persistent
--





 PS If you're available for some real-time conversation such as on IRC, I
 think some kind of things would be faster to discuss there.


You can private mail me some times when you are available.  I am busy
the next few days,
but might have a few hours on Sunday.
--
Craig
___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
freebsd-virtualization-unsubscr...@freebsd.org


Re: libvirt and bhyve problems

2014-06-12 Thread Roman Bogorodskiy
  Craig Rodrigues wrote:

 On Wed, Jun 11, 2014 at 12:25 PM, Roman Bogorodskiy no...@freebsd.org wrote:
  I've attached a patch which should fix the segfault. Could you please
  let me know if it fixes the problem?
 
 I have incorporated your patch into the libvirt port, and provided a tarball
 of the port here:
 
 http://people.freebsd.org/~rodrigc/libvirt_port.tgz
 
 I can confirm that your patch eliminates the coredump for me.
 
 So now I can do the following:
 
 (1)  Start libvirtd:
 /usr/local/sbin/libvirtd
 
 (2)  Start virsh:
 virsh -c bhyve:///system
 
 (3)  Execute following inside virsh:
define bhyve.xml
start bhyve
 
( using bhyve.xml file from
 http://lists.freebsd.org/pipermail/freebsd-virtualization/2014-June/002588.html
 )
 
 In the libvirtd console, I see this:
 
 2014-06-11 22:47:16.357+: 34485605376: info : libvirt version: 1.2.5
 2014-06-11 22:47:16.357+: 34485605376: error : virExec:417 :
 Cannot find 'pm-is-supported' in path: No such file or directory
 2014-06-11 22:47:16.357+: 34485605376: warning :
 virQEMUCapsInit:948 : Failed to get host power management capabilities
 2014-06-11 22:47:21.050+: 34485605376: info :
 virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
 /usr/local/var/run/libvirt/qemu
 2014-06-11 22:47:21.063+: 34485605376: info :
 virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
 /usr/local/etc/libvirt/qemu
 2014-06-11 22:47:21.168+: 34485605376: info :
 virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
 /usr/local/etc/libvirt/bhyve
 2014-06-11 22:47:21.168+: 34485605376: info :
 virDomainObjListLoadAllConfigs:18273 : Loading config file 'bhyve.xml'
 2014-06-11 22:47:43.469+: 34485598208: error :
 virNetDevBridgeAddPort:399 : Unable to add bridge tap0 port vnet18:
 Invalid argument
 2014-06-11 22:47:43.573+: 34485598208: error : virCommandWait:2426
 : internal error: Child process (/usr/sbin/bhyvectl --destroy
 --vm=bhyve) unexpected exit status 255
 
 
 
 For the last line, it looks like it is trying to do bhyvectl --destroy
 --vm=bhyve
 on a VM which doesn't exist, i.e. there is no entry in /dev/vmm/bhyve
 
 It should ignore the error at this point and try to spawn the VM, but it 
 fails.

This actually happens because it fails to spawn a VM (because there's no
bridge) and tries to make sure to unload previously loaded VM in order
not to leave it in a stale state.

I have adjusted the port:

http://people.freebsd.org/~novel/misc/libvirt_port_updated.tgz

With this setup, I'm able to get networking (e.g. virsh net-list works)
and updated the fix for the previous problem. I was able to start a VM
with that setup.

Roman Bogorodskiy


pgpfn5YmLJaTs.pgp
Description: PGP signature


Re: libvirt and bhyve problems

2014-06-12 Thread Craig Rodrigues
On Thu, Jun 12, 2014 at 1:00 AM, Roman Bogorodskiy no...@freebsd.org wrote:

 http://people.freebsd.org/~novel/misc/libvirt_port_updated.tgz

 With this setup, I'm able to get networking (e.g. virsh net-list works)
 and updated the fix for the previous problem. I was able to start a VM
 with that setup.


I deleted the old port from my system and took your modified port,
built it, and installed it.

I followed my previous steps in:
http://lists.freebsd.org/pipermail/freebsd-virtualization/2014-June/002588.html
and got this:

2014-06-12 18:23:54.328+: 34485605376: info : libvirt version: 1.2.5
2014-06-12 18:23:54.328+: 34485605376: error :
dnsmasqCapsRefreshInternal:726 : Cannot check dnsmasq binary dnsmasq:
No such file or directory
2014-06-12 18:23:54.328+: 34485605376: info :
networkReloadFirewallRules:1750 : Reloading iptables rules
2014-06-12 18:23:54.328+: 34485605376: info :
networkRefreshDaemons:1722 : Refreshing network daemons
2014-06-12 18:23:54.438+: 34485605376: error : virExec:417 :
Cannot find 'pm-is-supported' in path: No such file or directory
2014-06-12 18:23:54.439+: 34485605376: warning :
virQEMUCapsInit:948 : Failed to get host power management capabilities
2014-06-12 18:23:54.460+: 34485605376: info :
virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
/usr/local/var/run/libvirt/qemu
2014-06-12 18:23:54.461+: 34485605376: info :
virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
/usr/local/etc/libvirt/qemu
2014-06-12 18:23:54.560+: 34485605376: info :
virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
/usr/local/etc/libvirt/bhyve
2014-06-12 18:23:54.560+: 34485605376: info :
virDomainObjListLoadAllConfigs:18273 : Loading config file 'bhyve.xml'
2014-06-12 18:24:17.940+: 34485598208: error :
virNetDevBridgeAddPort:399 : Unable to add bridge tap0 port vnet0:
Invalid argument
2014-06-12 18:24:18.056+: 34485598208: error : virCommandWait:2426
: internal error: Child process (/usr/sbin/bhyvectl --destroy
--vm=bhyve) unexpected exit status 255


--
Craig
___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
freebsd-virtualization-unsubscr...@freebsd.org


Re: libvirt and bhyve problems

2014-06-12 Thread Craig Rodrigues
On Thu, Jun 12, 2014 at 11:28 AM, Craig Rodrigues rodr...@freebsd.org wrote:
 On Thu, Jun 12, 2014 at 1:00 AM, Roman Bogorodskiy no...@freebsd.org wrote:

 http://people.freebsd.org/~novel/misc/libvirt_port_updated.tgz

 With this setup, I'm able to get networking (e.g. virsh net-list works)
 and updated the fix for the previous problem. I was able to start a VM
 with that setup.


 I deleted the old port from my system and took your modified port,
 built it, and installed it.

 I followed my previous steps in:
 http://lists.freebsd.org/pipermail/freebsd-virtualization/2014-June/002588.html
 and got this:

 2014-06-12 18:23:54.328+: 34485605376: info : libvirt version: 1.2.5
 2014-06-12 18:23:54.328+: 34485605376: error :
 dnsmasqCapsRefreshInternal:726 : Cannot check dnsmasq binary dnsmasq:
 No such file or directory
 2014-06-12 18:23:54.328+: 34485605376: info :
 networkReloadFirewallRules:1750 : Reloading iptables rules
 2014-06-12 18:23:54.328+: 34485605376: info :
 networkRefreshDaemons:1722 : Refreshing network daemons
 2014-06-12 18:23:54.438+: 34485605376: error : virExec:417 :
 Cannot find 'pm-is-supported' in path: No such file or directory
 2014-06-12 18:23:54.439+: 34485605376: warning :
 virQEMUCapsInit:948 : Failed to get host power management capabilities
 2014-06-12 18:23:54.460+: 34485605376: info :
 virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
 /usr/local/var/run/libvirt/qemu
 2014-06-12 18:23:54.461+: 34485605376: info :
 virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
 /usr/local/etc/libvirt/qemu
 2014-06-12 18:23:54.560+: 34485605376: info :
 virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
 /usr/local/etc/libvirt/bhyve
 2014-06-12 18:23:54.560+: 34485605376: info :
 virDomainObjListLoadAllConfigs:18273 : Loading config file 'bhyve.xml'
 2014-06-12 18:24:17.940+: 34485598208: error :
 virNetDevBridgeAddPort:399 : Unable to add bridge tap0 port vnet0:
 Invalid argument
 2014-06-12 18:24:18.056+: 34485598208: error : virCommandWait:2426
 : internal error: Child process (/usr/sbin/bhyvectl --destroy
 --vm=bhyve) unexpected exit status 255


 --
 Craig


After the program fails, these are my tap and bridge devices, as shown
by ifconfig:

bridge0: flags=8843UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST metric 0 mtu 1500
ether 02:29:45:c7:8f:00
nd6 options=9PERFORMNUD,IFDISABLED
id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
member: em0 flags=143LEARNING,DISCOVER,AUTOEDGE,AUTOPTP
ifmaxaddr 0 port 1 priority 128 path cost 2
member: tap2 flags=143LEARNING,DISCOVER,AUTOEDGE,AUTOPTP
ifmaxaddr 0 port 7 priority 128 path cost 200
member: tap1 flags=143LEARNING,DISCOVER,AUTOEDGE,AUTOPTP
ifmaxaddr 0 port 6 priority 128 path cost 200
member: tap0 flags=143LEARNING,DISCOVER,AUTOEDGE,AUTOPTP
ifmaxaddr 0 port 5 priority 128 path cost 200
tap0: flags=8902BROADCAST,PROMISC,SIMPLEX,MULTICAST metric 0 mtu 1500
options=8LINKSTATE
ether 00:bd:53:27:00:00
nd6 options=29PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL
media: Ethernet autoselect
status: no carrier
tap1: flags=8902BROADCAST,PROMISC,SIMPLEX,MULTICAST metric 0 mtu
1500
options=8LINKSTATE
ether 00:bd:59:27:00:01
nd6 options=29PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL
media: Ethernet autoselect
status: no carrier
tap2: flags=8943UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST
metric 0 mtu 1500
options=8LINKSTATE
ether 00:bd:5e:27:00:02
nd6 options=29PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL
media: Ethernet autoselect
status: active
Opened by PID 1506
vnet0: flags=8802BROADCAST,SIMPLEX,MULTICAST metric 0 mtu 1500
options=8LINKSTATE
ether fe:54:00:33:20:8c
nd6 options=21PERFORMNUD,AUTO_LINKLOCAL
media: Ethernet autoselect
status: no carrier


This is in my /etc/rc.conf for creating bridge and tap devices on bootup:

#
# Create tap devices, one tap interface per BHyve VM.
# Add the tap interfaces to bridge0

cloned_interfaces=bridge0 tap0 tap1 tap2

autobridge_interfaces=bridge0
autobridge_bridge0=tap* em0

--
Craig
___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
freebsd-virtualization-unsubscr...@freebsd.org


Re: libvirt and bhyve problems

2014-06-12 Thread Roman Bogorodskiy
  Craig Rodrigues wrote:

 On Thu, Jun 12, 2014 at 11:28 AM, Craig Rodrigues rodr...@freebsd.org wrote:
  On Thu, Jun 12, 2014 at 1:00 AM, Roman Bogorodskiy no...@freebsd.org 
  wrote:
 
  http://people.freebsd.org/~novel/misc/libvirt_port_updated.tgz
 
  With this setup, I'm able to get networking (e.g. virsh net-list works)
  and updated the fix for the previous problem. I was able to start a VM
  with that setup.
 
 
  I deleted the old port from my system and took your modified port,
  built it, and installed it.
 
  I followed my previous steps in:
  http://lists.freebsd.org/pipermail/freebsd-virtualization/2014-June/002588.html
  and got this:
 
  2014-06-12 18:23:54.328+: 34485605376: info : libvirt version: 1.2.5
  2014-06-12 18:23:54.328+: 34485605376: error :
  dnsmasqCapsRefreshInternal:726 : Cannot check dnsmasq binary dnsmasq:
  No such file or directory
  2014-06-12 18:23:54.328+: 34485605376: info :
  networkReloadFirewallRules:1750 : Reloading iptables rules
  2014-06-12 18:23:54.328+: 34485605376: info :
  networkRefreshDaemons:1722 : Refreshing network daemons
  2014-06-12 18:23:54.438+: 34485605376: error : virExec:417 :
  Cannot find 'pm-is-supported' in path: No such file or directory
  2014-06-12 18:23:54.439+: 34485605376: warning :
  virQEMUCapsInit:948 : Failed to get host power management capabilities
  2014-06-12 18:23:54.460+: 34485605376: info :
  virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
  /usr/local/var/run/libvirt/qemu
  2014-06-12 18:23:54.461+: 34485605376: info :
  virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
  /usr/local/etc/libvirt/qemu
  2014-06-12 18:23:54.560+: 34485605376: info :
  virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
  /usr/local/etc/libvirt/bhyve
  2014-06-12 18:23:54.560+: 34485605376: info :
  virDomainObjListLoadAllConfigs:18273 : Loading config file 'bhyve.xml'
  2014-06-12 18:24:17.940+: 34485598208: error :
  virNetDevBridgeAddPort:399 : Unable to add bridge tap0 port vnet0:
  Invalid argument
  2014-06-12 18:24:18.056+: 34485598208: error : virCommandWait:2426
  : internal error: Child process (/usr/sbin/bhyvectl --destroy
  --vm=bhyve) unexpected exit status 255
 
 
  --
  Craig
 
 
 After the program fails, these are my tap and bridge devices, as shown
 by ifconfig:
 
 bridge0: flags=8843UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST metric 0 mtu 1500
 ether 02:29:45:c7:8f:00
 nd6 options=9PERFORMNUD,IFDISABLED
 id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
 maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
 root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
 member: em0 flags=143LEARNING,DISCOVER,AUTOEDGE,AUTOPTP
 ifmaxaddr 0 port 1 priority 128 path cost 2
 member: tap2 flags=143LEARNING,DISCOVER,AUTOEDGE,AUTOPTP
 ifmaxaddr 0 port 7 priority 128 path cost 200
 member: tap1 flags=143LEARNING,DISCOVER,AUTOEDGE,AUTOPTP
 ifmaxaddr 0 port 6 priority 128 path cost 200
 member: tap0 flags=143LEARNING,DISCOVER,AUTOEDGE,AUTOPTP
 ifmaxaddr 0 port 5 priority 128 path cost 200
 tap0: flags=8902BROADCAST,PROMISC,SIMPLEX,MULTICAST metric 0 mtu 1500
 options=8LINKSTATE
 ether 00:bd:53:27:00:00
 nd6 options=29PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL
 media: Ethernet autoselect
 status: no carrier
 tap1: flags=8902BROADCAST,PROMISC,SIMPLEX,MULTICAST metric 0 mtu
 1500
 options=8LINKSTATE
 ether 00:bd:59:27:00:01
 nd6 options=29PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL
 media: Ethernet autoselect
 status: no carrier
 tap2: flags=8943UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST
 metric 0 mtu 1500
 options=8LINKSTATE
 ether 00:bd:5e:27:00:02
 nd6 options=29PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL
 media: Ethernet autoselect
 status: active
 Opened by PID 1506
 vnet0: flags=8802BROADCAST,SIMPLEX,MULTICAST metric 0 mtu 1500
 options=8LINKSTATE
 ether fe:54:00:33:20:8c
 nd6 options=21PERFORMNUD,AUTO_LINKLOCAL
 media: Ethernet autoselect
 status: no carrier
 
 
 This is in my /etc/rc.conf for creating bridge and tap devices on bootup:
 
 #
 # Create tap devices, one tap interface per BHyve VM.
 # Add the tap interfaces to bridge0
 
 cloned_interfaces=bridge0 tap0 tap1 tap2
 
 autobridge_interfaces=bridge0
 autobridge_bridge0=tap* em0

Ah. Actually, libvirt manages bridges and taps on its own. So, the
preferred flow is that libvirt starts its networks on startup
automatically. By default it has a network with the 'virbr0' device
which it creates on its own.

Later on it creates vnet devices (which are tap devices) 

Re: libvirt and bhyve problems

2014-06-11 Thread Roman Bogorodskiy
  Craig Rodrigues wrote:

 On Tue, Jun 10, 2014 at 1:54 PM, Craig Rodrigues rodr...@freebsd.org wrote:
  On Tue, Jun 10, 2014 at 12:25 PM, Craig Rodrigues rodr...@freebsd.org 
  wrote:
  lldb /usr/local/sbin/libvirtd libvirtd.core
 
  (lldb) bt
  * thread #1: tid = 0, 0x000801aa8513
  libvirt.so.1002`virNetDevTapCreateInBridgePort(brname=0x00080a4211c8,
  ifname=0x00080a88d1e0, macaddr=0x00080a88d144,
  vmuuid=0x00080a81b808, tapfd=0x, tapfdSize=1,
  virtPortProfile=0x, virtVlan=0x,
  flags=9) + 547 at virnetdevtap.c:583, name = 'libvirtd', stop reason =
  signal SIGSEGV
* frame #0: 0x000801aa8513
  libvirt.so.1002`virNetDevTapCreateInBridgePort(brname=0x00080a4211c8,
  ifname=0x00080a88d1e0, macaddr=0x00080a88d144,
  vmuuid=0x00080a81b808, tapfd=0x, tapfdSize=1,
  virtPortProfile=0x, virtVlan=0x,
  flags=9) + 547 at virnetdevtap.c:583
  frame #1: 0x000809e20569
  libvirt_driver_bhyve.so`bhyveBuildNetArgStr(def=0x00080a81b800,
  cmd=0x00080a4db200, dryRun=false) + 841 at bhyve_command.c:82
  frame #2: 0x000809e20196
  libvirt_driver_bhyve.so`virBhyveProcessBuildBhyveCmd(driver=0x00080a48a040,
  def=0x00080a81b800, dryRun=false) + 310 at bhyve_command.c:248
  frame #3: 0x000809e24d6a
  libvirt_driver_bhyve.so`virBhyveProcessStart(conn=0x00080a4db100,
  driver=0x00080a48a040, vm=0x00080a48b0f0,
  reason=VIR_DOMAIN_RUNNING_BOOTED, flags=0) + 746 at
  bhyve_process.c:134
  frame #4: 0x000809e2334a
  libvirt_driver_bhyve.so`bhyveDomainCreateWithFlags(dom=0x00080a48a280,
  flags=0) + 490 at bhyve_driver.c:847
  frame #5: 0x000809e2315a
  libvirt_driver_bhyve.so`bhyveDomainCreate(dom=0x00080a48a280) + 26
  at bhyve_driver.c:867
  frame #6: 0x000801b96aad
  libvirt.so.1002`virDomainCreate(domain=0x00080a48a280) + 637 at
  libvirt.c:8968
  frame #7: 0x01075427
  libvirtd`remoteDispatchDomainCreate(server=0x00080781c400,
  client=0x0008078df480, msg=0x0008078791d0,
  rerr=0x7f9fcc30, args=0x000807934340) + 231 at
  remote_dispatch.h:3048
  frame #8: 0x0103b84e
  libvirtd`remoteDispatchDomainCreateHelper(server=0x00080781c400,
  client=0x0008078df480, msg=0x0008078791d0,
  rerr=0x7f9fcc30, args=0x000807934340,
  ret=0x00080a421058) + 254 at remote_dispatch.h:3026
  frame #9: 0x000801c26b20
  libvirt.so.1002`virNetServerProgramDispatchCall(prog=0x00080790f400,
  server=0x00080781c400, client=0x0008078df480,
  msg=0x0008078791d0) + 784 at virnetserverprogram.c:437
  frame #10: 0x000801c26641
  libvirt.so.1002`virNetServerProgramDispatch(prog=0x00080790f400,
  server=0x00080781c400, client=0x0008078df480,
  msg=0x0008078791d0) + 705 at virnetserverprogram.c:307
  frame #11: 0x0108f97c
  libvirtd`virNetServerProcessMsg(srv=0x00080781c400,
  client=0x0008078df480, prog=0x00080790f400,
  msg=0x0008078791d0) + 332 at virnetserver.c:172
  frame #12: 0x0108cd9c
  libvirtd`virNetServerHandleJob(jobOpaque=0x000807934360,
  opaque=0x00080781c400) + 204 at virnetserver.c:193
  frame #13: 0x000801ac84b8
  libvirt.so.1002`virThreadPoolWorker(opaque=0x000807901d60) + 680
  at virthreadpool.c:145
  frame #14: 0x000801ac7b9b
  libvirt.so.1002`virThreadHelper(data=0x00080781b520) + 75 at
  virthread.c:197
  frame #15: 0x000803c614f5 libthr.so.3`??? + 277
 
  --
  Craig
 
 
 
 OK, I think I found the problem.
 
 In this file: 
 http://libvirt.org/git/?p=libvirt.git;a=blob_plain;f=src/bhyve/bhyve_command.c;hb=HEAD
 
 We have:
 
 static int
 bhyveBuildNetArgStr(const virDomainDef *def, virCommandPtr cmd, bool dryRun)
 {
 virDomainNetDefPtr net = NULL;
 char *brname = NULL;
 char *realifname = NULL;
 int *tapfd = NULL;
 
 
 tapfd is never initialized after this.
 
 
 In the same function, we have this:
 
 if (!dryRun)
 if (virNetDevTapCreateInBridgePort(brname, net-ifname, 
 net-mac,
def-uuid, tapfd, 1,
 
 virDomainNetGetActualVirtPortProfile(net),
virDomainNetGetActualVlan(net),
 
 VIR_NETDEV_TAP_CREATE_IFUP | VIR_NETDEV_TAP_CREATE_PERSIST)  0) {
 VIR_FREE(net-ifname);
 VIR_FREE(brname);
 return -1;
 }
 
 
 
 virNetDevTapCreateinBridgePort() is being passed a NULL tapfd, but the
 next parameter is 1 instead of 0.
 
 
 
 Then further along in this file:
 http://libvirt.org/git/?p=libvirt.git;a=blob_plain;f=src/util/virnetdevtap.c;hb=HEAD
 we have:
 
  error:
 for (i = 0; i  tapfdSize  tapfd[i] = 0; i++)
 VIR_FORCE_CLOSE(tapfd[i]);
 
 
 tapfd is NULL, but tapfdSize is 1, so the coredump happens here.
 
 What is the 

Re: libvirt and bhyve problems

2014-06-11 Thread Craig Rodrigues
On Wed, Jun 11, 2014 at 11:21 AM, Roman Bogorodskiy no...@freebsd.org wrote:

 Thanks for the analysis! I'll think what would be a proper fix for that
 problem.

 Also, while thinking how to reproduce it, I did 'kldunload if_bridge'
 and started to see the same problem. So, as a temporary fix, could you
 check if you have bridge support available (in kernel or via module)?

 Bridges are needed to get networking anyway.


Hi,

My output of kldstat is:

 1   29 0x8020 19d6218  kernel
 21 0x81bd7000 2e44b0   zfs.ko
 32 0x81ebc000 8208 opensolaris.ko
 41 0x81ec5000 4d68 nmdm.ko
 51 0x81eca000 1a2110   vmm.ko
 61 0x82211000 53e7 fdescfs.ko
 71 0x82217000 9aff if_bridge.ko
 81 0x82221000 5851 bridgestp.ko
 91 0x82227000 5673 if_tap.ko
101 0x8222d000 2a94 uhid.ko
111 0x8223 3592 ums.ko


so I do have if_bridge.ko loaded.

If you are doing development on CURRENT, make sure that you have
WITH_LLDB=yes in /etc/src.conf when you rebuild the system.
Looks like gdb in base cannot debug the cores.

--
Craig
___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
freebsd-virtualization-unsubscr...@freebsd.org


Re: libvirt and bhyve problems

2014-06-11 Thread Roman Bogorodskiy
  Craig Rodrigues wrote:

 On Wed, Jun 11, 2014 at 11:21 AM, Roman Bogorodskiy no...@freebsd.org wrote:
 
  Thanks for the analysis! I'll think what would be a proper fix for that
  problem.
 
  Also, while thinking how to reproduce it, I did 'kldunload if_bridge'
  and started to see the same problem. So, as a temporary fix, could you
  check if you have bridge support available (in kernel or via module)?
 
  Bridges are needed to get networking anyway.
 
 
 Hi,
 
 My output of kldstat is:
 
  1   29 0x8020 19d6218  kernel
  21 0x81bd7000 2e44b0   zfs.ko
  32 0x81ebc000 8208 opensolaris.ko
  41 0x81ec5000 4d68 nmdm.ko
  51 0x81eca000 1a2110   vmm.ko
  61 0x82211000 53e7 fdescfs.ko
  71 0x82217000 9aff if_bridge.ko
  81 0x82221000 5851 bridgestp.ko
  91 0x82227000 5673 if_tap.ko
 101 0x8222d000 2a94 uhid.ko
 111 0x8223 3592 ums.ko
 
 
 so I do have if_bridge.ko loaded.

I've attached a patch which should fix the segfault. Could you please
let me know if it fixes the problem?

However, we still need to figure out why networking is not being
enabled. The root cause of that is that libvirt should start the default
network when the daemon starts up. This network should create a bridge
device (virbr0).

Later on, when one starts a guest, it should create tap device and add
it to the bridge. Obviously, it fails at this step as there's no bridge
device.

Could you please send me config.log file and also a port directory with
your fixes so I could test it as well?

As for your previous question on my setup, I'm using master branch of the
libvirt git repo and my configure args are:

$ ./configure --with-bhyve --without-polkit --with-hal \
  CFLAGS=-g -O0 -I/usr/local/include LDFLAGS=-L/usr/local/lib \
  --with-xml-catalog-file=/usr/local/share/xml/catalog

I'm working on 10-STABLE.

However, it's really bad if it works only this way. :-( I would love to
fix the port.

 If you are doing development on CURRENT, make sure that you have
 WITH_LLDB=yes in /etc/src.conf when you rebuild the system.
 Looks like gdb in base cannot debug the cores.

Thanks for the hint!

Roman Bogorodskiy


pgpqI5uoZ_yOU.pgp
Description: PGP signature


Re: libvirt and bhyve problems

2014-06-11 Thread Craig Rodrigues
On Wed, Jun 11, 2014 at 12:25 PM, Roman Bogorodskiy no...@freebsd.org wrote:
 I've attached a patch which should fix the segfault. Could you please
 let me know if it fixes the problem?

I have incorporated your patch into the libvirt port, and provided a tarball
of the port here:

http://people.freebsd.org/~rodrigc/libvirt_port.tgz

I can confirm that your patch eliminates the coredump for me.

So now I can do the following:

(1)  Start libvirtd:
/usr/local/sbin/libvirtd

(2)  Start virsh:
virsh -c bhyve:///system

(3)  Execute following inside virsh:
   define bhyve.xml
   start bhyve

   ( using bhyve.xml file from
http://lists.freebsd.org/pipermail/freebsd-virtualization/2014-June/002588.html
)

In the libvirtd console, I see this:

2014-06-11 22:47:16.357+: 34485605376: info : libvirt version: 1.2.5
2014-06-11 22:47:16.357+: 34485605376: error : virExec:417 :
Cannot find 'pm-is-supported' in path: No such file or directory
2014-06-11 22:47:16.357+: 34485605376: warning :
virQEMUCapsInit:948 : Failed to get host power management capabilities
2014-06-11 22:47:21.050+: 34485605376: info :
virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
/usr/local/var/run/libvirt/qemu
2014-06-11 22:47:21.063+: 34485605376: info :
virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
/usr/local/etc/libvirt/qemu
2014-06-11 22:47:21.168+: 34485605376: info :
virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
/usr/local/etc/libvirt/bhyve
2014-06-11 22:47:21.168+: 34485605376: info :
virDomainObjListLoadAllConfigs:18273 : Loading config file 'bhyve.xml'
2014-06-11 22:47:43.469+: 34485598208: error :
virNetDevBridgeAddPort:399 : Unable to add bridge tap0 port vnet18:
Invalid argument
2014-06-11 22:47:43.573+: 34485598208: error : virCommandWait:2426
: internal error: Child process (/usr/sbin/bhyvectl --destroy
--vm=bhyve) unexpected exit status 255



For the last line, it looks like it is trying to do bhyvectl --destroy
--vm=bhyve
on a VM which doesn't exist, i.e. there is no entry in /dev/vmm/bhyve

It should ignore the error at this point and try to spawn the VM, but it fails.

--
Craig
___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
freebsd-virtualization-unsubscr...@freebsd.org


Re: libvirt and bhyve problems

2014-06-10 Thread Craig Rodrigues
On Tue, Jun 10, 2014 at 4:43 AM, Roman Bogorodskiy no...@freebsd.org wrote:
 Hi Craig,

 It's a little unfortunate that there's no stacktrace, though we can try
 to see what's going on without it.

 Could you please edit libvirtd.conf (should be something like
 /usr/local/etc/libvirtd.conf if installed from port) to add:

 log_level = 2

 then run libvirtd by hand in foreground:

OK, I added log_level = 2 to /usr/local/etc/libvirt/libvirtd.conf
and ran libvirtd in the foreground:

2014-06-10 15:53:26.846+: 34485593088: info : libvirt version: 1.2.5
2014-06-10 15:53:26.846+: 34485593088: warning :
virDriverLoadModule:63 : Module
/usr/local/lib/libvirt/connection-driver/libvirt_driver_uml.so not
accessible
2014-06-10 15:53:27.023+: 34485605376: error : virExec:417 :
Cannot find 'pm-is-supported' in path: No such file or directory
2014-06-10 15:53:27.023+: 34485605376: warning :
virQEMUCapsInit:948 : Failed to get host power management capabilities
2014-06-10 15:53:27.034+: 34485605376: info :
virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
/usr/local/var/run/libvirt/qemu
2014-06-10 15:53:27.034+: 34485605376: info :
virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
/usr/local/etc/libvirt/qemu
2014-06-10 15:53:27.130+: 34485605376: info :
virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
/usr/local/etc/libvirt/bhyve
2014-06-10 15:53:53.668+: 34485598208: error : virNetDevGetMTU:404
: Cannot get interface MTU on 'virbr0': Device not configured
Segmentation fault (core dumped)



I got that coredump after doing:

virsh -c 'bhyve:///system'
virsh # define /tmp/bhyve.xml
virsh # start bhyve
___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
freebsd-virtualization-unsubscr...@freebsd.org


Re: libvirt and bhyve problems

2014-06-10 Thread Craig Rodrigues
On Tue, Jun 10, 2014 at 8:58 AM, Craig Rodrigues rodr...@freebsd.org wrote:
 On Tue, Jun 10, 2014 at 4:43 AM, Roman Bogorodskiy no...@freebsd.org wrote:
 Hi Craig,

 It's a little unfortunate that there's no stacktrace, though we can try
 to see what's going on without it.

 Could you please edit libvirtd.conf (should be something like
 /usr/local/etc/libvirtd.conf if installed from port) to add:

 log_level = 2

 then run libvirtd by hand in foreground:

 OK, I added log_level = 2 to /usr/local/etc/libvirt/libvirtd.conf
 and ran libvirtd in the foreground:

 2014-06-10 15:53:26.846+: 34485593088: info : libvirt version: 1.2.5
 2014-06-10 15:53:26.846+: 34485593088: warning :
 virDriverLoadModule:63 : Module
 /usr/local/lib/libvirt/connection-driver/libvirt_driver_uml.so not
 accessible

I saw the above warning, so I tried patching the port with this:

--- pkg-plist.orig  2014-06-10 10:36:22.084757789 -0700
+++ pkg-plist   2014-06-10 09:27:25.280043239 -0700
@@ -274,6 +274,8 @@
 lib/libvirt/connection-driver/libvirt_driver_secret.la
 lib/libvirt/connection-driver/libvirt_driver_storage.so
 lib/libvirt/connection-driver/libvirt_driver_storage.la
+lib/libvirt/connection-driver/libvirt_driver_uml.so
+lib/libvirt/connection-driver/libvirt_driver_uml.la
 lib/libvirt/connection-driver/libvirt_driver_vbox.so
 lib/libvirt/connection-driver/libvirt_driver_vbox.la



However, when I restarted libvirtd, I got different errors:

2014-06-10 17:38:50.269+: 34485593088: info : libvirt version: 1.2.5
2014-06-10 17:38:50.269+: 34485593088: error :
virDriverLoadModule:71 : failed to load module
/usr/local/lib/libvirt/connection-driver/libvirt_driver_uml.so
/usr/local/lib/libvirt/connection-driver/libvirt_driver_uml.so:
Undefined symbol inotify_add_watch
2014-06-10 17:38:50.563+: 34485605376: error : virExec:417 :
Cannot find 'pm-is-supported' in path: No such file or directory
2014-06-10 17:38:50.563+: 34485605376: warning :
virQEMUCapsInit:948 : Failed to get host power management capabilities
2014-06-10 17:38:50.575+: 34485605376: info :
virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
/usr/local/var/run/libvirt/qemu
2014-06-10 17:38:50.575+: 34485605376: info :
virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
/usr/local/etc/libvirt/qemu
2014-06-10 17:38:50.663+: 34485605376: info :
virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
/usr/local/etc/libvirt/bhyve
2014-06-10 17:38:50.663+: 34485605376: info :
virDomainObjListLoadAllConfigs:18273 : Loading config file 'bhyve.xml'


--
Craig
___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
freebsd-virtualization-unsubscr...@freebsd.org


Re: libvirt and bhyve problems

2014-06-10 Thread Roman Bogorodskiy
  Craig Rodrigues wrote:

 On Tue, Jun 10, 2014 at 8:58 AM, Craig Rodrigues rodr...@freebsd.org wrote:
  On Tue, Jun 10, 2014 at 4:43 AM, Roman Bogorodskiy no...@freebsd.org 
  wrote:
  Hi Craig,
 
  It's a little unfortunate that there's no stacktrace, though we can try
  to see what's going on without it.
 
  Could you please edit libvirtd.conf (should be something like
  /usr/local/etc/libvirtd.conf if installed from port) to add:
 
  log_level = 2
 
  then run libvirtd by hand in foreground:
 
  OK, I added log_level = 2 to /usr/local/etc/libvirt/libvirtd.conf
  and ran libvirtd in the foreground:
 
  2014-06-10 15:53:26.846+: 34485593088: info : libvirt version: 1.2.5
  2014-06-10 15:53:26.846+: 34485593088: warning :
  virDriverLoadModule:63 : Module
  /usr/local/lib/libvirt/connection-driver/libvirt_driver_uml.so not
  accessible
 
 I saw the above warning, so I tried patching the port with this:
 
 --- pkg-plist.orig  2014-06-10 10:36:22.084757789 -0700
 +++ pkg-plist   2014-06-10 09:27:25.280043239 -0700
 @@ -274,6 +274,8 @@
  lib/libvirt/connection-driver/libvirt_driver_secret.la
  lib/libvirt/connection-driver/libvirt_driver_storage.so
  lib/libvirt/connection-driver/libvirt_driver_storage.la
 +lib/libvirt/connection-driver/libvirt_driver_uml.so
 +lib/libvirt/connection-driver/libvirt_driver_uml.la
  lib/libvirt/connection-driver/libvirt_driver_vbox.so
  lib/libvirt/connection-driver/libvirt_driver_vbox.la

This warning is not critical. Actually, UML should not be built on
FreeBSD and I would need to disable it by default. For now I think the
proper fix is to configure with '--without-uml' flag.

As for the segfault, I think I have a guess.

Could you please drop '--without-network' from CONFIGURE_ARGS in the
port's Makefile and try to rebuild?

Roman Bogorodskiy


pgpzBHVhXENdD.pgp
Description: PGP signature


Re: libvirt and bhyve problems

2014-06-10 Thread Craig Rodrigues
On Tue, Jun 10, 2014 at 10:54 AM, Roman Bogorodskiy no...@freebsd.org wrote:
 This warning is not critical. Actually, UML should not be built on
 FreeBSD and I would need to disable it by default. For now I think the
 proper fix is to configure with '--without-uml' flag.

 As for the segfault, I think I have a guess.

 Could you please drop '--without-network' from CONFIGURE_ARGS in the
 port's Makefile and try to rebuild?

 Roman Bogorodskiy

OK, I dropped --without-network from CONFIGURE_ARGS and rebuilt the port.
I am still getting the coredump, but am getting different errors:

2014-06-10 18:59:22.713+: 34485593088: info : libvirt version: 1.2.5
2014-06-10 18:59:22.713+: 34485593088: warning :
virDriverLoadModule:63 : Module
/usr/local/lib/libvirt/connection-driver/libvirt_driver_network.so not
accessible
2014-06-10 18:59:22.715+: 34485593088: error :
virDriverLoadModule:71 : failed to load module
/usr/local/lib/libvirt/connection-driver/libvirt_driver_qemu.so
/usr/local/lib/libvirt/connection-driver/libvirt_driver_qemu.so:
Undefined symbol networkAllocateActualDevice
2014-06-10 18:59:22.716+: 34485593088: error :
virDriverLoadModule:71 : failed to load module
/usr/local/lib/libvirt/connection-driver/libvirt_driver_uml.so
/usr/local/lib/libvirt/connection-driver/libvirt_driver_uml.so:
Undefined symbol inotify_add_watch
2014-06-10 18:59:22.845+: 34485605376: info :
virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
/usr/local/etc/libvirt/bhyve
2014-06-10 18:59:22.845+: 34485605376: info :
virDomainObjListLoadAllConfigs:18273 : Loading config file 'bhyve.xml'
2014-06-10 18:59:22.847+: 34485605376: error : do_open:1166 : no
connection driver available for qemu:///system
2014-06-10 18:59:42.273+: 34485598208: error :
virNetDevBridgeAddPort:399 : Unable to add bridge tap0 port vnet7:
Invalid argument
Segmentation fault (core dumped)
___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
freebsd-virtualization-unsubscr...@freebsd.org


Re: libvirt and bhyve problems

2014-06-10 Thread Roman Bogorodskiy
  Craig Rodrigues wrote:

 On Tue, Jun 10, 2014 at 10:54 AM, Roman Bogorodskiy no...@freebsd.org wrote:
  This warning is not critical. Actually, UML should not be built on
  FreeBSD and I would need to disable it by default. For now I think the
  proper fix is to configure with '--without-uml' flag.
 
  As for the segfault, I think I have a guess.
 
  Could you please drop '--without-network' from CONFIGURE_ARGS in the
  port's Makefile and try to rebuild?
 
  Roman Bogorodskiy
 
 OK, I dropped --without-network from CONFIGURE_ARGS and rebuilt the port.
 I am still getting the coredump, but am getting different errors:
 
 2014-06-10 18:59:22.713+: 34485593088: info : libvirt version: 1.2.5
 2014-06-10 18:59:22.713+: 34485593088: warning :
 virDriverLoadModule:63 : Module
 /usr/local/lib/libvirt/connection-driver/libvirt_driver_network.so not
 accessible


Hmmm, this sounds weird.

I think I need to try the port version myself to see if I could
reproduce it this way (I'm usually using git version of libvirt instead
of port).

In the meantime, I'd really appreciate if you could build the port with
WITH_DEBUG flag and try to get a stacktrace.

 2014-06-10 18:59:22.715+: 34485593088: error :
 virDriverLoadModule:71 : failed to load module
 /usr/local/lib/libvirt/connection-driver/libvirt_driver_qemu.so
 /usr/local/lib/libvirt/connection-driver/libvirt_driver_qemu.so:
 Undefined symbol networkAllocateActualDevice
 2014-06-10 18:59:22.716+: 34485593088: error :
 virDriverLoadModule:71 : failed to load module
 /usr/local/lib/libvirt/connection-driver/libvirt_driver_uml.so
 /usr/local/lib/libvirt/connection-driver/libvirt_driver_uml.so:
 Undefined symbol inotify_add_watch
 2014-06-10 18:59:22.845+: 34485605376: info :
 virDomainObjListLoadAllConfigs:18249 : Scanning for configs in
 /usr/local/etc/libvirt/bhyve
 2014-06-10 18:59:22.845+: 34485605376: info :
 virDomainObjListLoadAllConfigs:18273 : Loading config file 'bhyve.xml'
 2014-06-10 18:59:22.847+: 34485605376: error : do_open:1166 : no
 connection driver available for qemu:///system
 2014-06-10 18:59:42.273+: 34485598208: error :
 virNetDevBridgeAddPort:399 : Unable to add bridge tap0 port vnet7:
 Invalid argument

This last line also sounds strange.

I'm wondering if you execute 'net-list --all' will you see the 'default'
network? And if it's there, will 'net-show default' should that
Autostart is enabled for it?

 Segmentation fault (core dumped)

Thanks,

Roman Bogorodskiy


pgp0SZ86gpFPj.pgp
Description: PGP signature


Re: libvirt and bhyve problems

2014-06-10 Thread Craig Rodrigues
On Tue, Jun 10, 2014 at 12:15 PM, Roman Bogorodskiy no...@freebsd.org wrote:

 This last line also sounds strange.

 I'm wondering if you execute 'net-list --all' will you see the 'default'
 network? And if it's there, will 'net-show default' should that
 Autostart is enabled for it?


If I do:
# virsh -c 'bhyve:///system'
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
   'quit' to quit

virsh # net-list --all
error: Failed to get the number of active networks
error: this function is not supported by the connection driver:
virConnectNumOfNetworks


The past few times, I have been compiling the port using WITH_DEBUG=yes.

However, I am not getting useful stacktraces:

/usr/ports/devel/libvirt/work/libvirt-1.2.5]# file /usr/local/sbin/libvirtd
/usr/local/sbin/libvirtd: ELF 64-bit LSB shared object, x86-64,
version 1 (FreeBSD), dynamically linked (uses shared libs), for
FreeBSD 11.0 (1100022), not stripped


# gdb /usr/local/sbin/libvirtd libvirtd.core
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type show copying to see the conditions.
There is absolutely no warranty for GDB.  Type show warranty for details.
This GDB was configured as amd64-marcel-freebsd...
Core was generated by `libvirtd'.
Program terminated with signal 11, Segmentation fault.
#0  0x000801aa8513 in ?? ()
(gdb) where
#0  0x000801aa8513 in ?? ()
#1  0x00180008 in ?? ()
#2  0x7f3f9330 in ?? ()
#3  0x000809e5510c in ?? ()
#4  0x0007 in ?? ()
#5  0x000809e5531b in ?? ()
#6  0x in ?? ()


BTW, can you give me:
  (1)  exact git command to checkout libvirt
  (2)  configure command you typed
  (3)  make command you typed

I want to get a working setup like you have.  It looks like the port
needs some fixing before
it can be used fully.
--
Craig
___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
freebsd-virtualization-unsubscr...@freebsd.org


Re: libvirt and bhyve problems

2014-06-10 Thread Craig Rodrigues
On Tue, Jun 10, 2014 at 12:25 PM, Craig Rodrigues rodr...@freebsd.org wrote:


 # gdb /usr/local/sbin/libvirtd libvirtd.core
 GNU gdb 6.1.1 [FreeBSD]
 Copyright 2004 Free Software Foundation, Inc.
 GDB is free software, covered by the GNU General Public License, and you are
 welcome to change it and/or distribute copies of it under certain conditions.
 Type show copying to see the conditions.
 There is absolutely no warranty for GDB.  Type show warranty for details.
 This GDB was configured as amd64-marcel-freebsd...
 Core was generated by `libvirtd'.
 Program terminated with signal 11, Segmentation fault.
 #0  0x000801aa8513 in ?? ()
 (gdb) where
 #0  0x000801aa8513 in ?? ()
 #1  0x00180008 in ?? ()
 #2  0x7f3f9330 in ?? ()
 #3  0x000809e5510c in ?? ()
 #4  0x0007 in ?? ()
 #5  0x000809e5531b in ?? ()
 #6  0x in ?? ()


OK, so it looks like in CURRENT, at least for the devel/libvirt port,
the gdb in base, and also gdb in ports cannot debug libvirtd.core.

I enabled WITH_LLDB=yes in /etc/src.conf and recompiled
to install lldb.  I am not so familiar with lldb, but at least I can
get a stacktrace with it.

lldb /usr/local/sbin/libvirtd libvirtd.core

(lldb) bt
* thread #1: tid = 0, 0x000801aa8513
libvirt.so.1002`virNetDevTapCreateInBridgePort(brname=0x00080a4211c8,
ifname=0x00080a88d1e0, macaddr=0x00080a88d144,
vmuuid=0x00080a81b808, tapfd=0x, tapfdSize=1,
virtPortProfile=0x, virtVlan=0x,
flags=9) + 547 at virnetdevtap.c:583, name = 'libvirtd', stop reason =
signal SIGSEGV
  * frame #0: 0x000801aa8513
libvirt.so.1002`virNetDevTapCreateInBridgePort(brname=0x00080a4211c8,
ifname=0x00080a88d1e0, macaddr=0x00080a88d144,
vmuuid=0x00080a81b808, tapfd=0x, tapfdSize=1,
virtPortProfile=0x, virtVlan=0x,
flags=9) + 547 at virnetdevtap.c:583
frame #1: 0x000809e20569
libvirt_driver_bhyve.so`bhyveBuildNetArgStr(def=0x00080a81b800,
cmd=0x00080a4db200, dryRun=false) + 841 at bhyve_command.c:82
frame #2: 0x000809e20196
libvirt_driver_bhyve.so`virBhyveProcessBuildBhyveCmd(driver=0x00080a48a040,
def=0x00080a81b800, dryRun=false) + 310 at bhyve_command.c:248
frame #3: 0x000809e24d6a
libvirt_driver_bhyve.so`virBhyveProcessStart(conn=0x00080a4db100,
driver=0x00080a48a040, vm=0x00080a48b0f0,
reason=VIR_DOMAIN_RUNNING_BOOTED, flags=0) + 746 at
bhyve_process.c:134
frame #4: 0x000809e2334a
libvirt_driver_bhyve.so`bhyveDomainCreateWithFlags(dom=0x00080a48a280,
flags=0) + 490 at bhyve_driver.c:847
frame #5: 0x000809e2315a
libvirt_driver_bhyve.so`bhyveDomainCreate(dom=0x00080a48a280) + 26
at bhyve_driver.c:867
frame #6: 0x000801b96aad
libvirt.so.1002`virDomainCreate(domain=0x00080a48a280) + 637 at
libvirt.c:8968
frame #7: 0x01075427
libvirtd`remoteDispatchDomainCreate(server=0x00080781c400,
client=0x0008078df480, msg=0x0008078791d0,
rerr=0x7f9fcc30, args=0x000807934340) + 231 at
remote_dispatch.h:3048
frame #8: 0x0103b84e
libvirtd`remoteDispatchDomainCreateHelper(server=0x00080781c400,
client=0x0008078df480, msg=0x0008078791d0,
rerr=0x7f9fcc30, args=0x000807934340,
ret=0x00080a421058) + 254 at remote_dispatch.h:3026
frame #9: 0x000801c26b20
libvirt.so.1002`virNetServerProgramDispatchCall(prog=0x00080790f400,
server=0x00080781c400, client=0x0008078df480,
msg=0x0008078791d0) + 784 at virnetserverprogram.c:437
frame #10: 0x000801c26641
libvirt.so.1002`virNetServerProgramDispatch(prog=0x00080790f400,
server=0x00080781c400, client=0x0008078df480,
msg=0x0008078791d0) + 705 at virnetserverprogram.c:307
frame #11: 0x0108f97c
libvirtd`virNetServerProcessMsg(srv=0x00080781c400,
client=0x0008078df480, prog=0x00080790f400,
msg=0x0008078791d0) + 332 at virnetserver.c:172
frame #12: 0x0108cd9c
libvirtd`virNetServerHandleJob(jobOpaque=0x000807934360,
opaque=0x00080781c400) + 204 at virnetserver.c:193
frame #13: 0x000801ac84b8
libvirt.so.1002`virThreadPoolWorker(opaque=0x000807901d60) + 680
at virthreadpool.c:145
frame #14: 0x000801ac7b9b
libvirt.so.1002`virThreadHelper(data=0x00080781b520) + 75 at
virthread.c:197
frame #15: 0x000803c614f5 libthr.so.3`??? + 277

--
Craig
___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
freebsd-virtualization-unsubscr...@freebsd.org


Re: libvirt and bhyve problems

2014-06-10 Thread Craig Rodrigues
On Tue, Jun 10, 2014 at 1:54 PM, Craig Rodrigues rodr...@freebsd.org wrote:
 On Tue, Jun 10, 2014 at 12:25 PM, Craig Rodrigues rodr...@freebsd.org wrote:
 lldb /usr/local/sbin/libvirtd libvirtd.core

 (lldb) bt
 * thread #1: tid = 0, 0x000801aa8513
 libvirt.so.1002`virNetDevTapCreateInBridgePort(brname=0x00080a4211c8,
 ifname=0x00080a88d1e0, macaddr=0x00080a88d144,
 vmuuid=0x00080a81b808, tapfd=0x, tapfdSize=1,
 virtPortProfile=0x, virtVlan=0x,
 flags=9) + 547 at virnetdevtap.c:583, name = 'libvirtd', stop reason =
 signal SIGSEGV
   * frame #0: 0x000801aa8513
 libvirt.so.1002`virNetDevTapCreateInBridgePort(brname=0x00080a4211c8,
 ifname=0x00080a88d1e0, macaddr=0x00080a88d144,
 vmuuid=0x00080a81b808, tapfd=0x, tapfdSize=1,
 virtPortProfile=0x, virtVlan=0x,
 flags=9) + 547 at virnetdevtap.c:583
 frame #1: 0x000809e20569
 libvirt_driver_bhyve.so`bhyveBuildNetArgStr(def=0x00080a81b800,
 cmd=0x00080a4db200, dryRun=false) + 841 at bhyve_command.c:82
 frame #2: 0x000809e20196
 libvirt_driver_bhyve.so`virBhyveProcessBuildBhyveCmd(driver=0x00080a48a040,
 def=0x00080a81b800, dryRun=false) + 310 at bhyve_command.c:248
 frame #3: 0x000809e24d6a
 libvirt_driver_bhyve.so`virBhyveProcessStart(conn=0x00080a4db100,
 driver=0x00080a48a040, vm=0x00080a48b0f0,
 reason=VIR_DOMAIN_RUNNING_BOOTED, flags=0) + 746 at
 bhyve_process.c:134
 frame #4: 0x000809e2334a
 libvirt_driver_bhyve.so`bhyveDomainCreateWithFlags(dom=0x00080a48a280,
 flags=0) + 490 at bhyve_driver.c:847
 frame #5: 0x000809e2315a
 libvirt_driver_bhyve.so`bhyveDomainCreate(dom=0x00080a48a280) + 26
 at bhyve_driver.c:867
 frame #6: 0x000801b96aad
 libvirt.so.1002`virDomainCreate(domain=0x00080a48a280) + 637 at
 libvirt.c:8968
 frame #7: 0x01075427
 libvirtd`remoteDispatchDomainCreate(server=0x00080781c400,
 client=0x0008078df480, msg=0x0008078791d0,
 rerr=0x7f9fcc30, args=0x000807934340) + 231 at
 remote_dispatch.h:3048
 frame #8: 0x0103b84e
 libvirtd`remoteDispatchDomainCreateHelper(server=0x00080781c400,
 client=0x0008078df480, msg=0x0008078791d0,
 rerr=0x7f9fcc30, args=0x000807934340,
 ret=0x00080a421058) + 254 at remote_dispatch.h:3026
 frame #9: 0x000801c26b20
 libvirt.so.1002`virNetServerProgramDispatchCall(prog=0x00080790f400,
 server=0x00080781c400, client=0x0008078df480,
 msg=0x0008078791d0) + 784 at virnetserverprogram.c:437
 frame #10: 0x000801c26641
 libvirt.so.1002`virNetServerProgramDispatch(prog=0x00080790f400,
 server=0x00080781c400, client=0x0008078df480,
 msg=0x0008078791d0) + 705 at virnetserverprogram.c:307
 frame #11: 0x0108f97c
 libvirtd`virNetServerProcessMsg(srv=0x00080781c400,
 client=0x0008078df480, prog=0x00080790f400,
 msg=0x0008078791d0) + 332 at virnetserver.c:172
 frame #12: 0x0108cd9c
 libvirtd`virNetServerHandleJob(jobOpaque=0x000807934360,
 opaque=0x00080781c400) + 204 at virnetserver.c:193
 frame #13: 0x000801ac84b8
 libvirt.so.1002`virThreadPoolWorker(opaque=0x000807901d60) + 680
 at virthreadpool.c:145
 frame #14: 0x000801ac7b9b
 libvirt.so.1002`virThreadHelper(data=0x00080781b520) + 75 at
 virthread.c:197
 frame #15: 0x000803c614f5 libthr.so.3`??? + 277

 --
 Craig



OK, I think I found the problem.

In this file: 
http://libvirt.org/git/?p=libvirt.git;a=blob_plain;f=src/bhyve/bhyve_command.c;hb=HEAD

We have:

static int
bhyveBuildNetArgStr(const virDomainDef *def, virCommandPtr cmd, bool dryRun)
{
virDomainNetDefPtr net = NULL;
char *brname = NULL;
char *realifname = NULL;
int *tapfd = NULL;


tapfd is never initialized after this.


In the same function, we have this:

if (!dryRun)
if (virNetDevTapCreateInBridgePort(brname, net-ifname, net-mac,
   def-uuid, tapfd, 1,

virDomainNetGetActualVirtPortProfile(net),
   virDomainNetGetActualVlan(net),

VIR_NETDEV_TAP_CREATE_IFUP | VIR_NETDEV_TAP_CREATE_PERSIST)  0) {
VIR_FREE(net-ifname);
VIR_FREE(brname);
return -1;
}



virNetDevTapCreateinBridgePort() is being passed a NULL tapfd, but the
next parameter is 1 instead of 0.



Then further along in this file:
http://libvirt.org/git/?p=libvirt.git;a=blob_plain;f=src/util/virnetdevtap.c;hb=HEAD
we have:

 error:
for (i = 0; i  tapfdSize  tapfd[i] = 0; i++)
VIR_FORCE_CLOSE(tapfd[i]);


tapfd is NULL, but tapfdSize is 1, so the coredump happens here.

What is the best way to fix this?

--
Craig
___
freebsd-virtualization@freebsd.org mailing list

libvirt and bhyve problems

2014-06-09 Thread Craig Rodrigues
Roman,

I have been reading your blog posts on using libvirt + bhyve
here:

http://empt1e.blogspot.com/

and the libvirt bhyve documentation here:
http://libvirt.org/drvbhyve.html

but am having problems reproducing the steps.

I have a machine running:
FreeBSD  11.0-CURRENT FreeBSD 11.0-CURRENT #6 r266934M: Sat May 31
20:24:37 PDT 2014
r...@crodrigues.org:/usr/obj/opt2/branches/head/sys/GENERIC  amd64


I applied the following patches to the devel/libvirt port to fix
compilation problems for bhyve support:

http://lists.freebsd.org/pipermail/freebsd-virtualization/2014-June/002586.html

I then did the following:

BUILD AND CONFIGURE
===
cd /usr/ports/devel/libport
make config
(I made sure bhyve and QEMU support were enabled
make
make install


LIBVIRT CONFIG
==

I created the following /tmp/bhyve.xml file:


domain type='bhyve'
  namebhyve/name
  uuiddf3be7e7-a104-11e3-aeb0-50e5492bd3dc/uuid
memory219136/memory
currentMemory219136/currentMemory
vcpu1/vcpu
os
   typehvm/type
/os
features
  apic/
  acpi/
/features
clock offset='utc'/
devices
  disk type='file'
driver name='file' type='raw'/
source file='/tmp/some_disk.img'/
target dev='hda' bus='sata'/
  /disk
  interface type='bridge'
model type='virtio'/
source bridge=virbr0/
  /interface
/devices
/domain


RUNNING


I did the following as root:

service libvirtd restart
virsh -c 'bhyve:///system'

Then I ran these commands from the virsh prompt:

virsh # define /tmp/bhyve.xml
Domain bhyve defined from /tmp/bhyve.xml

virsh # start bhyve
error: Failed to start domain bhyve
error: End of file while reading data: Input/output error
error: Failed to reconnect to the hypervisor


At this point libvirtd process crashed with a /libvirtd.core process ,
but for some reason I could not get a valid stacktrace.

Can you provide assistance to get this working?

Ultimately, I want to get the Jenkins libvirt plugin (
https://wiki.jenkins-ci.org/display/JENKINS/Libvirt+Slaves+Plugin )
to work.

Thanks.

--
Craig
___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
freebsd-virtualization-unsubscr...@freebsd.org