Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Jun 2014 12:05:04 -0700
From:      Craig Rodrigues <rodrigc@FreeBSD.org>
To:        Roman Bogorodskiy <novel@freebsd.org>
Cc:        "freebsd-virtualization@freebsd.org" <freebsd-virtualization@freebsd.org>, freebsd-python@freebsd.org
Subject:   Re: py-libvirt problems with bhyve
Message-ID:  <CAG=rPVfN-8uBx-UMF=90jevkP%2BOt=i9OL3=rKCBy9B7mfMqr0w@mail.gmail.com>
In-Reply-To: <20140625180116.GA1304@kloomba>
References:  <CAG=rPVdYf%2BaYP72owuaiecKxM7MHoDAioNpMGFJPu1G_S5fUZA@mail.gmail.com> <20140625180116.GA1304@kloomba>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jun 25, 2014 at 11:01 AM, Roman Bogorodskiy <novel@freebsd.org>
wrote:

>   Craig Rodrigues wrote:
>
> >
> > conn = libvirt.openReadOnly(None)
>                               ^^^
>
> I think here the URI should be 'bhyve:///system'.


> Or you could tweak libvirt.conf and assign the bhyve url value to the
> 'uri_default' parameter.
>
> http://libvirt.org/uri.html#URI_default
>
>

Hi

OK, I changed my steps a little bit.
I did the following:

(1)  Set up libvirt, taking Roman's latest port, and configuring bhyve
support:

      http://people.freebsd.org/~rodrigc/libvirt/libvirt-bhyve.html

(2)  Installed the py-libvirt port.


I wrote this code:

import libvirt
import sys

# Note we need to specify the URL here
conn = libvirt.openReadOnly("bhyve:///system")
if conn == None:
    print 'Failed to open connection to the hypervisor'
    sys.exit(1)

try:
    print("All domains: ",conn.listAllDomains())
    print("Defined domains: ", conn.listDefinedDomains())
    #print dir(conn)
    dom0 = conn.lookupByName("bhyve")
except:
    print 'Failed to find the main domain'
    sys.exit(1)

print("Domain 0: id %d running" % (dom0.ID()))
print(dom0.info())



I got this:

('All domains: ', [<libvirt.virDomain object at 0x801f50550>])
('Defined domains: ', ['bhyve'])
Domain 0: id -1 running
('Domain info: ', [5, 2147483L, 0L, 1, 0L])


So that's an improvement.


I started reading this tutorial on libvirt and KVM scripting:

https://www.ibm.com/developerworks/linux/library/os-python-kvm-scripting1/

In that tutorial, they give an example where it is possible
to configure the MAC and IP address of the VM in an XML config file.

Is it possible to do that with libvirt and bhyve?

Thanks.
--
Craig



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG=rPVfN-8uBx-UMF=90jevkP%2BOt=i9OL3=rKCBy9B7mfMqr0w>