py-libvirt problems with bhyve

2014-06-25 Thread Craig Rodrigues
Hi,

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

conn = libvirt.openReadOnly(None)
if conn == None:
print 'Failed to open connection to the hypervisor'
sys.exit(1)

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


but when I ran the code, I got this error:

[]
libvirt: QEMU Driver error : Domain not found: no domain with matching name
'bhyve'
Failed to find the main domain


Can anyone tell me how to write a py-libvirt program to
start/stop a bhyve VM?

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


Re: libvirt, bhyve, and Jenkins configuration problems

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

 On Sat, Jun 21, 2014 at 6:52 AM, Roman Bogorodskiy no...@freebsd.org
 wrote:
 
 
 
  When you configure the connection in the 'Add a new Cloud' dialog, does
  'test connection' work for you? I don't see a host and credentials
  specified, I'm not sure if jenkins libvirt plugin works with the local
  connection.
 
 
 OK, following your example, I have gotten further along.
 I have updated my setup instructions here:
 
 http://people.freebsd.org/~rodrigc/libvirt/libvirt-bhyve-jenkins.html
 
 In Step 3, when I click on Test Connection, I see
 
  OK: bhyve+ssh://root@localhost:22/system?no_tty=1 version=1100
 
 so that seems to work.
 
 For Step 5, when I enter the Host and Credentials information,
 does this information need to be the IP address and login information
 for the VM that has been spawned, and not the info for libvirt, as
 specified in Step 3?

Correct.

 Does that mean that I need to configure my VM, so that it comes up with a
 known IP, so that
 it can be entered on this configuration page?

Correct.

Though, normally you don't need to perform any special configuration for
the IP address as long as the networking configuration is correct.

The VM just needs to be configured to obtain an IP address via DHCP.
Later on it should be persistent in dnsmasq.

An IP address could be obtained either from the dnsmasq leases file or
from arp cache for example.

 Also, the VM, that is spawned, it must have openjdk installed?  Does that
 mean that
 after libvirt starts the VM, Jenkins will try to SSH into the VM and start
 a Jenkins job
 by invoking java?

Yes, it's true, it starts its agent which does the job.

PS Maybe there are other ways to push Jobs to Jenkins nodes, but I
didn't look close into that.

Roman Bogorodskiy


pgpIUPdF05ZE6.pgp
Description: PGP signature


Re: libvirt, bhyve, and Jenkins configuration problems

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

  Does that mean that I need to configure my VM, so that it comes up with a
  known IP, so that
  it can be entered on this configuration page?

 Correct.

 Though, normally you don't need to perform any special configuration for
 the IP address as long as the networking configuration is correct.

 The VM just needs to be configured to obtain an IP address via DHCP.
 Later on it should be persistent in dnsmasq.


 An IP address could be obtained either from the dnsmasq leases file or
 from arp cache for example.


But how does the Jenkins libvirt plugin know the IP address for the VM,
unless you enter it in this field in the Jenkins UI?



  Also, the VM, that is spawned, it must have openjdk installed?  Does that
  mean that
  after libvirt starts the VM, Jenkins will try to SSH into the VM and
 start
  a Jenkins job
  by invoking java?

 Yes, it's true, it starts its agent which does the job.

 PS Maybe there are other ways to push Jobs to Jenkins nodes, but I
 didn't look close into that.


The easiest way is to have the openjdk installed in the VM, so that Jenkins
can ssh in and run
jobs.  However, there is also the Publish Over SSH Plugin (
https://wiki.jenkins-ci.org/display/JENKINS/Publish+Over+SSH+Plugin )
which allows Jenkins to SSH into a remote host and run different commands,
instead of starting
a full Jenkins job, which requires the openjdk to be available.

--
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