From owner-freebsd-python@FreeBSD.ORG Thu Jun 26 19:05:08 2014 Return-Path: Delivered-To: freebsd-python@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 13273B75; Thu, 26 Jun 2014 19:05:08 +0000 (UTC) Received: from mail-lb0-x230.google.com (mail-lb0-x230.google.com [IPv6:2a00:1450:4010:c04::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 131152CD0; Thu, 26 Jun 2014 19:05:06 +0000 (UTC) Received: by mail-lb0-f176.google.com with SMTP id w7so3293831lbi.35 for ; Thu, 26 Jun 2014 12:05:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=tXfKyRGZe4z/JIVa65QQEzSUkViPuwEG973qZ9HBuaI=; b=wgd+WZYr23n35+bzQl450Gndyr8MnkQ2a1sprrm90B/y2krWK0YNWBsOYkylw99hdD XSJ3mbIajrIltd3wrn2q86VWrKbZSb2YHZFzr53EsoQaEnkSV+xqSKk7z/+0h2H77wf9 RrT4lp7OpgYKDlq8gBCzQH0P2kfF1Z/1U+d6AhI0/fgyxTkcSEk51rOcZsGYz2RNz1qq v6zDuzs8g/vwc0Q2DpoHFIbi7TYMeQWoSHzHhTf/DTnX441RaXevS0ExBgeecUOSHNVv v2LNwPjWTJSx0MCQMqtSGoyQGiU7hjYA2FwjR8iehrb9cOrEeonei6X/t6b+tfVm4rrg N3vQ== MIME-Version: 1.0 X-Received: by 10.152.23.6 with SMTP id i6mr12889999laf.24.1403809504933; Thu, 26 Jun 2014 12:05:04 -0700 (PDT) Sender: crodr001@gmail.com Received: by 10.112.67.71 with HTTP; Thu, 26 Jun 2014 12:05:04 -0700 (PDT) In-Reply-To: <20140625180116.GA1304@kloomba> References: <20140625180116.GA1304@kloomba> Date: Thu, 26 Jun 2014 12:05:04 -0700 X-Google-Sender-Auth: E17_fAuOIOB-VmbQng4lL9-yGRA Message-ID: Subject: Re: py-libvirt problems with bhyve From: Craig Rodrigues To: Roman Bogorodskiy Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.18 Cc: "freebsd-virtualization@freebsd.org" , freebsd-python@freebsd.org X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jun 2014 19:05:08 -0000 On Wed, Jun 25, 2014 at 11:01 AM, Roman Bogorodskiy 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: ', []) ('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