[libvirt] PATCH: Add libvirt_lxc to specfile
by Daniel P. Berrange
FYI, just committed this change to fix the broken build last night
Daniel
Index: libvirt.spec.in
===================================================================
RCS file: /data/cvs/libvirt/libvirt.spec.in,v
retrieving revision 1.90
diff -u -p -r1.90 libvirt.spec.in
--- libvirt.spec.in 20 Aug 2008 13:16:29 -0000 1.90
+++ libvirt.spec.in 21 Aug 2008 08:50:24 -0000
@@ -3,6 +3,8 @@
%define with_xen 1
%define with_xen_proxy 1
%define with_qemu 1
+%define with_openvz 1
+%define with_lxc 1
%define with_polkit 0
# Xen is available only on i386 x86_64 ia64
@@ -152,8 +154,18 @@ of recent versions of Linux (and other O
%define _without_qemu --without-qemu
%endif
+%if ! %{with_openvz}
+%define _without_openvz --without-openvz
+%endif
+
+%if ! %{with_lxc}
+%define _without_lxc --without-lxc
+%endif
+
%configure %{?_without_xen} \
%{?_without_qemu} \
+ %{?_without_openvz} \
+ %{?_without_lxc} \
--with-init-script=redhat \
--with-qemud-pid-file=%{_localstatedir}/run/libvirt_qemud.pid \
--with-remote-file=%{_localstatedir}/run/libvirtd.pid
@@ -248,6 +260,9 @@ fi
%attr(4755, root, root) %{_libexecdir}/libvirt_proxy
%endif
%attr(0755, root, root) %{_libexecdir}/libvirt_parthelper
+%if %{with_openvz}
+%attr(0755, root, root) %{_libexecdir}/libvirt_lxc
+%endif
%attr(0755, root, root) %{_sbindir}/libvirtd
%doc docs/*.rng
%doc docs/*.xml
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
16 years, 3 months
[libvirt] virsh/virt-install for dummies
by Jun Koi
Hi,
I am frustrated searching for a quick-start documentation for virsh,
just to no avail. Any help is greatly appreciated!
Here is what I did:
- Compile and install libvirt, virt-manager, virt-install and
virt-viewer from source code. This is done (on Ubuntu 8.04).
- Now I want to do install a new VM with QEMU or KVM. I got the below
error with virt-install:
# virt-install -c qemu:///system --name jeos2 --ram 500 --file
img.jeos2 --cdrom jeos-8.04.1-jeos-i386.iso
Fri, 15 Aug 2008 19:19:10 ERROR virConnectOpen() failed
Traceback (most recent call last):
File "/usr/bin/virt-install", line 496, in <module>
main()
File "/usr/bin/virt-install", line 345, in main
conn = cli.getConnection(options.connect)
File "/usr/lib/python2.5/site-packages/virtinst/cli.py", line 92, in
getConnection
return libvirt.open(connect)
File "/usr/lib/python2.5/site-packages/libvirt.py", line 139, in open
if ret is None:raise libvirtError('virConnectOpen() failed')
libvirtError: virConnectOpen() failed
How to fix this? Perhaps I need to run libvirtd before using virsh???
What frustrates me is that there seems no documentation about this
process at libvirt.org at all (?).
Final question: I have an old QEMU image. How to "import" it to virsh
script? Is there any easy way to do that?
Thanks,
Jun
16 years, 3 months
[libvirt] Libvirt Xen daemon interaction in Red Hat Enterprise with virtualization
by vaibhav chugh
Hi,
I am new to libvirt and I am trying to figure out that how libvert connects
to Xend in Red Hat Enterprise with virtualization. I read a few posts but
was not able to find this out.
The eariler versions of Xen were using xen_session_login_with_password()
function call to connect to Xen daemon but I am not able to find anything
similar to this in libvirt.
Please help me with the functions or the area of source code which are being
used by libvirt to make the connections.
Thanks
Vaibhav
16 years, 3 months
RE: [libvirt] Using Xen config files
by Matthew Donovan
Thanks for the quick reply!
I set the LIBVIRT_DEBUG flag to 1 and ran it again. (The output is below.)
One other thing I can think to mention is that I'm using version 0.4.4-2,
installed with yum. Maybe I should try compiling and installing from
source?
Thanks again!
-matthew
[root@grape ~]$ gcc -g virt_test.c -lvirt && ./a.out
DEBUG: libvirt.c: virInitialize (register drivers)
DEBUG: xen_internal.c: xenHypervisorInit (Using new hypervisor call: 30001
)
DEBUG: xen_internal.c: xenHypervisorInit (Using hypervisor call v2, sys ver3
dom ver5
)
DEBUG: libvirt.c: virConnectOpen (name=xen:///)
DEBUG: libvirt.c: do_open (name "xen:///" to URI components:
scheme xen
opaque (null)
authority (null)
server (null)
user (null)
port 0
path /
)
DEBUG: libvirt.c: do_open (trying driver 0 (Test) ...)
DEBUG: libvirt.c: do_open (driver 0 Test returned DECLINED)
DEBUG: libvirt.c: do_open (trying driver 1 (QEMU) ...)
DEBUG: libvirt.c: do_open (driver 1 QEMU returned DECLINED)
DEBUG: libvirt.c: do_open (trying driver 2 (Xen) ...)
DEBUG: xen_unified.c: xenUnifiedOpen (Trying hypervisor sub-driver)
DEBUG: xen_unified.c: xenUnifiedOpen (Activated hypervisor sub-driver)
DEBUG: xen_unified.c: xenUnifiedOpen (Trying XenD sub-driver)
DEBUG: xen_unified.c: xenUnifiedOpen (Activated XenD sub-driver)
DEBUG: xen_unified.c: xenUnifiedOpen (Trying XS sub-driver)
DEBUG: xen_unified.c: xenUnifiedOpen (Activated XS sub-driver)
DEBUG: libvirt.c: do_open (driver 2 Xen returned SUCCESS)
DEBUG: libvirt.c: do_open (network driver 0 Test returned DECLINED)
DEBUG: libvirt.c: do_open (network driver 1 QEMU returned DECLINED)
DEBUG: remote_internal.c: doRemoteOpen (proceeding with name = xen:///)
DEBUG: libvirt.c: do_open (network driver 2 remote returned SUCCESS)
DEBUG: libvirt.c: do_open (storage driver 0 Test returned DECLINED)
DEBUG: libvirt.c: do_open (storage driver 1 storage returned DECLINED)
DEBUG: libvirt.c: do_open (storage driver 2 remote returned SUCCESS)
DEBUG: libvirt.c: virDomainDefineXML (conn=0x96fe478, xml=<domain
type='xen'><name>fc8.conf</name><os><type>hvm</type><loader>/usr/lib/xen/boo
t/hvmloader</loader><boot
dev='hd'/></os><memory>1024</memory><vcpu>1</vcpu><on_poweroff>destroy</on_p
oweroff><on_reboot>restart</on_reboot><on_crash>restart</on_crash><features>
<pae/><acpi/><apic/></features><clock
sync="localtime"/><devices><emulator>/usr/lib/xen/bin/qemu-dm</emulator><int
erface type='bridge'><source bridge='xenbr0'/><script
path='vif-bridge'/></interface><disk type='block'><source
dev='/dev/vgvms/fc8'/><target dev='hda'/></disk><disk type='block'
device='cdrom'><source dev='/dev/cdrom'/><target
dev='hdc'/><readonly/></disk><graphics type='vnc'/></devices></domain>)
DEBUG: libvirt.c: virDomainLookupByName (conn=0x96fe478, name=fc8.conf)
DEBUG: hash.c: __virGetDomain (New hash entry 0x9702a18)
DEBUG: libvirt.c: virDomainCreate (domain=0x9702a18)
DEBUG: libvirt.c: virDomainGetInfo (domain=0x9702a18, info=0xbfa2b658)
state = 0
DEBUG: libvirt.c: virConnectClose (conn=0x96fe478)
DEBUG: hash.c: virUnrefConnect (unref connection 0x96fe478 xen:/// 2)
> -----Original Message-----
> From: Richard W.M. Jones [mailto:rjones@redhat.com]
> Sent: Wednesday, August 20, 2008 9:49 AM
> To: Matthew Donovan
> Cc: libvir-list(a)redhat.com
> Subject: Re: [libvirt] Using Xen config files
>
> On Wed, Aug 20, 2008 at 08:35:46AM -0400, Matthew Donovan wrote:
> > I am trying to programmatically start Xen guest VMs (HVM)
> with libvirt (on
> > Fedora Core 8) and I'm having some trouble with it. I've
> included my code
> > below. Essentially, the domain seems to get created
> correctly but it
> > doesn't seem to run.
> >
> > I don't receive any error messages from the libvirt
> > functions but the VM does not get any CPU time (as shown
> with "xm list").
> >
> > [root@grape ~]$ xm list
> > Name ID Mem VCPUs
> State
> > Time(s)
> > Domain-0 0 1462 2
> r-----
> > 1313.5
> > fc8.conf 7 128 1
> ------
> > 0.0
> >
> > Can someone explain what I'm doing wrong here? I've tried
> to get this
> > working with linux and windows guests with the same results.
>
> That's really strange. Your program looks correct to me (but see my
> comment about error handling below). One thing you can do is to run
> your program after first setting the environment variable
> LIBVIRT_DEBUG=1 which will cause all calls to libvirt to be printed
> out. Just to make sure you are actually calling the functions that
> you think you are calling.
>
> > I've seen references on this mailing list to libvirt's
> ability to handle Xen
> > configuration files but I haven't seen anything in the API
> documentation or
> > public header files that refer to it. Is there a public
> interface to
> > specifying a configuration file?
>
> No there isn't. This ability refers to old versions of Xen which used
> /etc/xen. We have a driver that can parse files from here and present
> those as inactive ("defined" but not running) domains, eg. when you
> do "virsh list".
>
> For all other uses, use the libvirt XML configuration format. The
> advantage is that it will keep working with other types of
> virtualization.
>
> > domain = virDomainDefineXML (con, fedora);
> > if (!domain) {
> > virErrorPtr err = virGetLastError ();
> > printf ("virDomainDefineXML failed: %s\n",
> > err->message);
>
> By the way, this error reporting is wrong. Confusingly there are two
> levels of errors stored by virterror, a global error and a
> per-connection error. The global error is only used where you don't
> have a virConnectPtr object (almost the only time is just after
> virConnectOpen fails, when conn == NULL). The rest of the time you
> should use virConnGetLastError:
>
> http://libvirt.org/html/libvirt-virterror.html#virConnGetLastError
>
> Rich.
>
> --
> Richard Jones, Emerging Technologies, Red Hat
> http://et.redhat.com/~rjones
> virt-top is 'top' for virtual machines. Tiny program with many
> powerful monitoring features, net stats, disk stats, logging, etc.
> http://et.redhat.com/~rjones/virt-top
>
16 years, 3 months
[libvirt] libvirt-java: change org.libvirt.Error implementing Serializable
by Daniel Schwager
Hi java-api-team (-:
could you please let org.libvirt.Error implements the serializable interface ?
Exceptions (and the content like org.libvirt.Error) should be serializable.
I got an exception on my host system connected via RMI to the client-system
running libvirt-java (libvirt-java, cvs-snapshot 2008-08-18) like this:
------------------------------------------------
...
cause:java.rmi.UnmarshalException: Error unmarshaling return; nested exception is:
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.libvirt.Error
package org.libvirt;
------------------------------------------------
public class Error {
VIR_FROM_NONE,
/**
* Error at Xen hypervisor layer
*/
VIR_FROM_XEN,
------------------------------------------------
thank you very much
regards
Danny
-------------------------------------------------------------------
DT Netsolution GmbH - Taläckerstr. 30 - D-70437 Stuttgart
Geschäftsführer: Daniel Schwager, Stefan Hörz - HRB Stuttgart 19870
Tel: +49-711-849910-32, Fax: -932 - Mailto:daniel.schwager@dtnet.de
16 years, 3 months
RE: [libvirt] Using Xen config files
by Matthew Donovan
Found it! I added serial and console devices to the XML and it appears to
be running. It's not working completely as expcted but it's doing more than
it was.
Thanks for your help.
-matthew
> -----Original Message-----
> From: Richard W.M. Jones [mailto:rjones@redhat.com]
> Sent: Wednesday, August 20, 2008 11:44 AM
> To: Matthew Donovan
> Cc: libvir-list(a)redhat.com
> Subject: Re: [libvirt] Using Xen config files
>
> On Wed, Aug 20, 2008 at 11:35:17AM -0400, Matthew Donovan wrote:
> > Thanks for the quick reply!
> >
> > I set the LIBVIRT_DEBUG flag to 1 and ran it again. (The
> output is below.)
> [...]
> > [root@grape ~]$ gcc -g virt_test.c -lvirt && ./a.out
> > DEBUG: libvirt.c: virInitialize (register drivers)
> > DEBUG: xen_internal.c: xenHypervisorInit (Using new
> hypervisor call: 30001
> > )
> > DEBUG: xen_internal.c: xenHypervisorInit (Using hypervisor
> call v2, sys ver3
> > dom ver5
> > )
> > DEBUG: libvirt.c: virConnectOpen (name=xen:///)
> > DEBUG: libvirt.c: do_open (name "xen:///" to URI components:
> > scheme xen
> > opaque (null)
> > authority (null)
> > server (null)
> > user (null)
> > port 0
> > path /
> > )
> > DEBUG: libvirt.c: do_open (trying driver 0 (Test) ...)
> > DEBUG: libvirt.c: do_open (driver 0 Test returned DECLINED)
> > DEBUG: libvirt.c: do_open (trying driver 1 (QEMU) ...)
> > DEBUG: libvirt.c: do_open (driver 1 QEMU returned DECLINED)
> > DEBUG: libvirt.c: do_open (trying driver 2 (Xen) ...)
> > DEBUG: xen_unified.c: xenUnifiedOpen (Trying hypervisor sub-driver)
> > DEBUG: xen_unified.c: xenUnifiedOpen (Activated hypervisor
> sub-driver)
> > DEBUG: xen_unified.c: xenUnifiedOpen (Trying XenD sub-driver)
> > DEBUG: xen_unified.c: xenUnifiedOpen (Activated XenD sub-driver)
> > DEBUG: xen_unified.c: xenUnifiedOpen (Trying XS sub-driver)
> > DEBUG: xen_unified.c: xenUnifiedOpen (Activated XS sub-driver)
> > DEBUG: libvirt.c: do_open (driver 2 Xen returned SUCCESS)
> > DEBUG: libvirt.c: do_open (network driver 0 Test returned DECLINED)
> > DEBUG: libvirt.c: do_open (network driver 1 QEMU returned DECLINED)
> > DEBUG: remote_internal.c: doRemoteOpen (proceeding with
> name = xen:///)
> > DEBUG: libvirt.c: do_open (network driver 2 remote returned SUCCESS)
> > DEBUG: libvirt.c: do_open (storage driver 0 Test returned DECLINED)
> > DEBUG: libvirt.c: do_open (storage driver 1 storage
> returned DECLINED)
> > DEBUG: libvirt.c: do_open (storage driver 2 remote returned SUCCESS)
> > DEBUG: libvirt.c: virDomainDefineXML (conn=0x96fe478, xml=<domain
> >
> type='xen'><name>fc8.conf</name><os><type>hvm</type><loader>/u
> sr/lib/xen/boo
> > t/hvmloader</loader><boot
> >
> dev='hd'/></os><memory>1024</memory><vcpu>1</vcpu><on_poweroff
> >destroy</on_p
> >
> oweroff><on_reboot>restart</on_reboot><on_crash>restart</on_cr
> ash><features>
> > <pae/><acpi/><apic/></features><clock
> >
> sync="localtime"/><devices><emulator>/usr/lib/xen/bin/qemu-dm<
> /emulator><int
> > erface type='bridge'><source bridge='xenbr0'/><script
> > path='vif-bridge'/></interface><disk type='block'><source
> > dev='/dev/vgvms/fc8'/><target dev='hda'/></disk><disk type='block'
> > device='cdrom'><source dev='/dev/cdrom'/><target
> > dev='hdc'/><readonly/></disk><graphics
> type='vnc'/></devices></domain>)
> > DEBUG: libvirt.c: virDomainLookupByName (conn=0x96fe478,
> name=fc8.conf)
> > DEBUG: hash.c: __virGetDomain (New hash entry 0x9702a18)
> > DEBUG: libvirt.c: virDomainCreate (domain=0x9702a18)
> > DEBUG: libvirt.c: virDomainGetInfo (domain=0x9702a18,
> info=0xbfa2b658)
> > state = 0
> > DEBUG: libvirt.c: virConnectClose (conn=0x96fe478)
> > DEBUG: hash.c: virUnrefConnect (unref connection 0x96fe478
> xen:/// 2)
>
> It certainly looks OK, and it seems like the domain should run after
> virDomainCreate. Have you tried adding a delay of 30 seconds just to
> check if the domain is starting up slowly?
>
> Dan & Dan, any ideas?
>
> Rich.
>
> --
> Richard Jones, Emerging Technologies, Red Hat
> http://et.redhat.com/~rjones
> virt-df lists disk usage of guests without needing to install any
> software inside the virtual machine. Supports Linux and Windows.
> http://et.redhat.com/~rjones/virt-df/
>
16 years, 3 months
[libvirt] networking
by James Bardin
Hello,
I'm having trouble digging up some documentation on libvirt's network
config.
I'm not sure where to set this up, but I have a bridged device br0 that
I would like to have available in virt-manager/virsh.
Right now, I can edit the VM's xml interface element manually to use
br0. Virt-manager has an option for shared physical device, but it's
empty, and I can't figure out how to see it from virsh.
thanks
-jim
16 years, 3 months
[libvirt] Using Xen config files
by Matthew Donovan
I am trying to programmatically start Xen guest VMs (HVM) with libvirt (on
Fedora Core 8) and I'm having some trouble with it. I've included my code
below. Essentially, the domain seems to get created correctly but it
doesn't seem to run. I don't receive any error messages from the libvirt
functions but the VM does not get any CPU time (as shown with "xm list").
[root@grape ~]$ xm list
Name ID Mem VCPUs State
Time(s)
Domain-0 0 1462 2 r-----
1313.5
fc8.conf 7 128 1 ------
0.0
Can someone explain what I'm doing wrong here? I've tried to get this
working with linux and windows guests with the same results.
I've seen references on this mailing list to libvirt's ability to handle Xen
configuration files but I haven't seen anything in the API documentation or
public header files that refer to it. Is there a public interface to
specifying a configuration file?
Thanks
-matthew
CODE:
#include <stdio.h>
#include <libvirt/libvirt.h>
#include <libvirt/virterror.h>
//"<!--<mac address='00:16:3e:5d:c7:9e'/>-->"
//"<graphics type='vnc' port='5904'/>"
const char* fedora =
"<domain type='xen'>"
"<name>fc8.conf</name>"
"<os>"
"<type>hvm</type>"
"<loader>/usr/lib/xen/boot/hvmloader</loader>"
"<boot dev='hd'/>"
"</os>"
"<memory>1024</memory>"
"<vcpu>1</vcpu>"
"<on_poweroff>destroy</on_poweroff>"
"<on_reboot>restart</on_reboot>"
"<on_crash>restart</on_crash>"
"<features>"
"<pae/>"
"<acpi/>"
"<apic/>"
"</features>"
"<clock sync=\"localtime\"/>"
"<devices>"
"<emulator>/usr/lib/xen/bin/qemu-dm</emulator>"
"<interface type='bridge'>"
"<source bridge='xenbr0'/>"
"<script path='vif-bridge'/>"
"</interface>"
"<disk type='block'>"
"<source dev='/dev/vgvms/fc8'/>"
"<target dev='hda'/>"
"</disk>"
"<disk type='block' device='cdrom'>"
"<source dev='/dev/cdrom'/>"
"<target dev='hdc'/>"
"<readonly/>"
"</disk>"
"<graphics type='vnc'/>"
"</devices>"
"</domain>";
int main (int argc, char** argv)
{
virConnectPtr con; /* connection to the Xen hypervisor */
virDomainPtr domain;
virInitialize();
con = virConnectOpen ("xen:///");
if (!con) {
virErrorPtr err = virGetLastError ();
printf ("virConnectOpen failed: %s\n",
err->message);
return -1;
}
domain = virDomainDefineXML (con, fedora);
if (!domain) {
virErrorPtr err = virGetLastError ();
printf ("virDomainDefineXML failed: %s\n",
err->message);
} else {
if (virDomainCreate (domain) < 0) {
virErrorPtr err = virGetLastError ();
printf ("virDomainCreate failed: %s\n",
err->message);
} else {
virDomainInfo info = {0};
virDomainGetInfo (domain, &info);
printf ("state = %d\n", info.state);
}
}
virConnectClose (con);
return 0;
}
16 years, 3 months
[libvirt] [PATCH] manage number of virtual CPUs
by Evgeniy Sokolov
OpenVZ containers use all CPUs available in system by default.
Limitations may be caused only by Linux kernel limitation.
There is way to artificially limit number of CPUs.
patch add cpu management functionality to OpenVZ driver.
16 years, 3 months
[libvirt] [PATCH] Ignore specified target path when creating logical vol
by Cole Robinson
Specifying a target path when creating a storage
volume has no effect, since volumes only really use
the pool's target path and 'name' field to
establish the volume's target. Logical volumes
expect a target path to be passed, and it can
only cause problems.
The attached patch erases the passed target volume
and fills it in with the one generated from the
create operation.
Thanks,
Cole
16 years, 3 months