Re: >>: [libvirt] OpenVZ capabilites in LibVIRT
by Ivan Vovk
Hi, Anton.
> You can specify an IP address and a netmask like this:
>> http://libvirt.org/formatnetwork.html#elementsAddress
>> Such bridge will be automatically set up.
>>
>
- thanks for the hint. I assigned 0.0.0.0 as I don't need IP on bridges at
the moment.
> 2) there is a default network "Default" with enabled 'Autostart'. Is
>>> there any way to remove this network completely?
>>>
>> Yes,
>> # virsh net-destroy defaul
>>
> correct answer is
> # virsh net-undefine default
>
- you were correct in both cases: you can't undefine active network so it
should be destroyed and after that undefine. So it worked!
> Short answer: it doesn't work now. Wait for nex libvirt release
> (libvirt-4.6-alt2). I will try to make it as soon as possible.
> For details see
> http://www.redhat.com/archives/libvir-list/2008-October/msg00323.html
>
- yeah, i've already read that thread and known it was a bug. Just needed a
confirmation that it was going to be fixed in next release. So may be my
question will be a bit indelicate, but is there a hope to see this release
by the end of november?
> 5) Is there any way to destroy domain completely like it can be done via
>> 'vzctl destroy <ID>'?
>>
> Yes,
> # virsh destroy <domain-name>
>
>> And here too, if domain was previously defined, command must be:
> # virsh undefine <domain-name>
>
- got the idea. And noticed the following:
virsh # define ovz.xml
Domain 3005 defined from ovz.xml
virsh # start 3005
Domain 3005 started
virsh # shutdown 3005
Domain 3005 is being shutdown
virsh # undefine 3005
libvir: OpenVZ error : Domain not found
Domain 3005 has been undefined
It really removes domain from file system, but why does it throw that error
message?
6) Where does libvirt store info about already created domains? I can't
>> create a new domain with ID 3005 after I completely destroy previous one via
>> 'vzctl destroy 3005'.
>>
> And what does it saying?
>
- if i simply destroy domain via vzctl (without undefining it via virsh):
[root@alt-03 ~]# vzctl destroy 3005
Destroying container private area: /var/lib/vz/private/3005
Container private area was destroyed
- and then try to create another one (this time via virsh)
virsh # create ovz.xml
libvir: OpenVZ error : operation failed: Already an OPENVZ VM defined with
the id '3005'
error: Failed to create domain from ovz.xml
It seems domain is still defined from LibVirt's point of view but actually
it doesn't exist any more. It was removed via native OpenVZ tool. In case I
try to undefine it:
virsh # undefine 3005
libvir: OpenVZ error : Domain not found
libvir: error : vzctl exited with non-zero status 14 and signal 0
libvir: OpenVZ error : internal error Could not exec vzctl
error: Failed to undefine domain 3005
And from this moment it is imposible to create domain with ID 3005. So how
can I obtain a list of already defined domains? And how can it be purged?
7) Is there any way to publish domain's console on a host system so that I
> can connect via telnet to HW node on some TCP/4567 and get into domain's
> console?
>
vzctl enter <domain ID>
>
- yeah, that for sure is true wheh you are on HW node itself. But I need to
organize access into domain's consoles from remote mashines. In my case
there is no network connectivity between real lan and domains. I believed,
this XML definition could help me:
http://libvirt.org/formatdomain.html#elementsCharTCP - "*The character
device acts as a TCP client connecting to a remote server, or as a server
waiting for a client connection*", so when you connect to HW node on some
TCP port you get into domain's console. But it seems I got it in a wrong way
because is didn't work in case of OpenVZ.
P.S. You can ask ALT-specific questions to me directly.
>
- thanks, will keep that in mind.
___________
Best regards,
Ivan V.
16 years, 1 month
[libvirt] Weird permissions error
by Darryl Pierce
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I have a startup script that runs a second script to do some work on the
system. This second script calls:
virsh -c qemu:///system --readonly nodeinfo
and then scrapes from that the amount of free memory.
When I run this from my init script, I get:
libvir: Remote error : unable to connect to
'/var/run/libvirt/libvirt-sock-ro': Permission denied
But if I run the second script itself directly (outside of the init
script) it works correctly.
Any ideas?
- --
Darryl L. Pierce <dpierce(a)redhat.com> : GPG KEYID: 6C4E7F1B
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
iEYEARECAAYFAkkYsEEACgkQjaT4DmxOfxuwzACgzYNQ7ku5P0YGr4jdHaDzf6Pq
MicAoJ5nB7e+TSwE2Vfd9YrCgiahKXwo
=01FA
-----END PGP SIGNATURE-----
16 years, 1 month
[libvirt] OpenVZ capabilites in LibVIRT
by Anton Protopopov
Hi!
>
> I faced with several difficulties / misunderstandings and I hope someone
> could clarify me (at the moment I use 'virsh' for testing).
>
> 1) after creating network via 'virsh # net-create network.xml' i get vzbr0
> bridge in down state and have to make ip up manually. Is there any way to
> automatically make it up?
>
You can specify an IP address and a netmask like this:
http://libvirt.org/formatnetwork.html#elementsAddress
Such bridge will be automatically set up.
> 2) there is a default network "Default" with enabled 'Autostart'. Is there
> any way to remove this network completely?
>
Yes,
# virsh net-destroy defaul
> 3) after creating domain via 'virsh # create ovz.xml' i get a new
> container, but it doesn't work as it should do:
> - at first, it has 'vzbr0' veth interface inside and its pair on a HW node
> is added into default bridge vmbr0. I believed tag <source bridge='vzbr0'/>
> should point to a bridge name on a HW node, but instead it created veth
> interface with such name. In openvz config file for created domain i see
> this:
> [root@alt-03 ~]# cat /etc/vz/conf/3005.conf | grep NETIF
>
> NETIF="ifname=vzbr0,mac=52:54:00:35:10:6D,host_ifname=veth3005.0,host_mac=52:54:00:35:10:6D"
>
Short answer: it doesn't work now. Wait for nex libvirt release
(libvirt-4.6-alt2). I will try to make it as soon as possible.
For details see
http://www.redhat.com/archives/libvir-list/2008-October/msg00323.html
> 4) Is there any way to specify config file for created domain like it can
> be done via 'vzctl create <ID> --oostemplate <templname> --config
> <confname>'?
>
No
> 5) Is there any way to destroy domain completely like it can be done via
> 'vzctl destroy <ID>'?
>
Yes,
# virsh destroy <domain-name>
> 6) Where does libvirt store info about already created domains? I can't
> create a new domain with ID 3005 after I completely destroy previous one via
> 'vzctl destroy 3005'.
>
And what does it saying?
7) Is there any way to publish domain's console on a host system so that I
> can connect via telnet to HW node on some TCP/4567 and get into domain's
> console?
>
vzctl enter <domain ID>
> 8) Does libvirt use some OpenVZ bindings or simply executes vzctl and other
> stuff?
>
simply executes vzctl and reading/writing <veid>.conf
P.S. You can ask ALT-specific questions to me directly.
16 years, 1 month
[libvirt] OpenVZ capabilites in LibVIRT
by Ivan Vovk
Hello!
I'm trying to link OpenVZ with LibVirt in my test environment. There are:
[root@alt-03 /]# uname -r
2.6.18-ovz-smp-alt23.M40.3
[root@alt-03 /]# vzctl --version
vzctl version 3.0.23
[root@alt-03 /]# rpm -qa | grep libvirt
libvirt-0.4.6-alt1
libvirt-python-0.4.6-alt1
libvirt-devel-0.4.6-alt1
The task is to create several isolate virtual networks with several domains inside, like:
ve-01 --- vzrb0 -- ve-02
|
|
ve-03
ve-11 --- vzbr1 -- ve-12
|
|
ve-13
and so on ...
Here is XML definition for 1st network:
<network>
<name>Private</name>
<bridge name="vzbr0" stp='off' forwardDelay='0'/>
</network>
and the following one for 1st domain:
<domain type="openvz" id="3005">
<name>3005</name>
<memory>131072</memory>
<currentMemory>131072</currentMemory>
<vcpu>1</vcpu>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<os>
<type>exe</type>
</os>
<devices>
<filesystem type="template">
<source name="altlinux-4.0"/>
<target dir="/"/>
<quota type="size" max="10000"/>
<quota type="inodes" max="200000"/>
</filesystem>
<interface type='bridge'>
<source bridge='vzbr0'/>
</interface>
</devices>
</domain>
I faced with several difficulties / misunderstandings and I hope someone could clarify me (at the moment I use 'virsh' for testing).
1) after creating network via 'virsh # net-create network.xml' i get vzbr0 bridge in down state and have to make ip up manually. Is there any way to automatically make it up?
2) there is a default network "Default" with enabled 'Autostart'. Is there any way to remove this network completely?
3) after creating domain via 'virsh # create ovz.xml' i get a new container, but it doesn't work as it should do:
- at first, it has 'vzbr0' veth interface inside and its pair on a HW node is added into default bridge vmbr0. I believed tag <source bridge='vzbr0'/> should point to a bridge name on a HW node, but instead it created veth interface with such name. In openvz config file for created domain i see this:
[root@alt-03 ~]# cat /etc/vz/conf/3005.conf | grep NETIF
NETIF="ifname=vzbr0,mac=52:54:00:35:10:6D,host_ifname=veth3005.0,host_mac=52:54:00:35:10:6D"
There is no any info about bridge. So by default veth3005.0 links with vmbr0.
- secondly, if you look at that NETIF string, you will see, that 'host_mac' is equal to 'mac'. Because of this two domains cannot contact with each other via the same bridge.
Is there any way to point veth interfaces to correct bridge, assign them corrects macs and names?
4) Is there any way to specify config file for created domain like it can be done via 'vzctl create <ID> --oostemplate <templname> --config <confname>'?
5) Is there any way to destroy domain completely like it can be done via 'vzctl destroy <ID>'?
6) Where does libvirt store info about already created domains? I can't create a new domain with ID 3005 after I completely destroy previous one via 'vzctl destroy 3005'.
7) Is there any way to publish domain's console on a host system so that I can connect via telnet to HW node on some TCP/4567 and get into domain's console?
8) Does libvirt use some OpenVZ bindings or simply executes vzctl and other stuff?
Thanks in advance!
________________________________
This message (including attachments) is private and confidential. If you have received this message in error, please notify us and remove it from your system.
16 years, 1 month
[libvirt] [PATCH] always compile iptables.c
by Jim Meyering
This is slightly different from the previous version.
The new part is the addition of the virRun stub to prevent
a mingw link failure when building with shared libraries.
Now, configured like this, it builds without error:
/usr/bin/mingw32-configure --without-sasl --without-avahi \
--without-polkit --without-python --without-xen --without-qemu \
--without-lxc --without-openvz --without-libvirtd \
--prefix=/tmp/libvirt-inst --enable-compile-warnings=maximum
>From 0b35049f3cd10dbfd650aae692c553e940409805 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Thu, 6 Nov 2008 08:42:33 +0100
Subject: [PATCH 1/3] always compile iptables.c
Avoid a build error when configuring --without-xen --without-qemu.
* src/iptables.c [WITH_QEMU]: Don't #ifdef-out.
* src/iptables.h [WITH_QEMU]: Don't #ifdef-out.
* src/util.c (virRun) [__MINGW32__]: Define a stub that always fails.
---
src/iptables.c | 4 ----
src/iptables.h | 6 +-----
src/util.c | 12 ++++++++++++
3 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/iptables.c b/src/iptables.c
index 53e0f41..ad7fddf 100644
--- a/src/iptables.c
+++ b/src/iptables.c
@@ -21,8 +21,6 @@
#include <config.h>
-#if WITH_QEMU
-
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
@@ -1120,5 +1118,3 @@ iptablesRemoveForwardMasquerade(iptablesContext *ctx,
{
return iptablesForwardMasquerade(ctx, network, physdev, REMOVE);
}
-
-#endif /* WITH_QEMU */
diff --git a/src/iptables.h b/src/iptables.h
index 95f07de..fbe9b5d 100644
--- a/src/iptables.h
+++ b/src/iptables.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 Red Hat, Inc.
+ * Copyright (C) 2007, 2008 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -22,8 +22,6 @@
#ifndef __QEMUD_IPTABLES_H__
#define __QEMUD_IPTABLES_H__
-#if WITH_QEMU
-
typedef struct _iptablesContext iptablesContext;
iptablesContext *iptablesContextNew (void);
@@ -95,6 +93,4 @@ int iptablesRemoveForwardMasquerade (iptablesContext *ctx,
const char *network,
const char *physdev);
-#endif /* WITH_QEMU */
-
#endif /* __QEMUD_IPTABLES_H__ */
diff --git a/src/util.c b/src/util.c
index abc86d6..6141847 100644
--- a/src/util.c
+++ b/src/util.c
@@ -580,6 +580,18 @@ virRun(virConnectPtr conn,
#else /* __MINGW32__ */
int
+virRun(virConnectPtr conn,
+ const char *const *argv ATTRIBUTE_UNUSED,
+ int *status)
+{
+ if (status)
+ *status = ENOTSUP;
+ else
+ ReportError (conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__);
+ return -1;
+}
+
+int
virExec(virConnectPtr conn,
const char *const*argv ATTRIBUTE_UNUSED,
const char *const*envp ATTRIBUTE_UNUSED,
--
1.6.0.3.756.gb776d
16 years, 1 month
[libvirt] PATCH: Misc fixes to events code
by Daniel P. Berrange
I'm trying out the new events code with virt-manager and stumbled on some
minor bugs
- The python binding forgot to call LIBVIRT_BEGIN_ALLOW_THREADS,
LIBVIRT_END_ALLOW_THREADS, LIBVIRT_ENSURE_THREAD_STATE or
LIBVIRT_RELEASE_THREAD_STATE which meant virt-manager crashed
and burned in a heap of python interpretor state corruption [1]
- The API docs extracted assumes that enums without explicit value
assignements started from 1 instead of 0. This caused an off-by-1
error for all the VIR_DOMAIN_EVENT_* constants in the generated python
code.
I briefly toyed with fixing docs/apibuild.py enum handling but then instead
decided to just change libvirt.h to give explicit values.
With these two fixes and some hacks to virt-manager, I've got the
events triggering display state refreshes.
A couple more things I've not fixed but are on the todo list
- THe QEMU driver doesn't emit the ADDED or REMOVED events for VMs
which virt-manager requires in order to fully avoid polling.
- The VIR_EVENT_* constants aren't included in python, because the
API docs can't cope with enum value asignments looking like
(1 << 0) (ie fails to parse the left-shifts)
Regards,
Daniel
[1] FYI, i'm using the libvirt-glib python binding in virt-manager
http://libvirt.org/hg/libvirt-glib/ which is slightly bad too
by not doing glib thread locking calls, but we're lucky because
libvirt.so doesn't invoke any glib calls itself from the event
callback context.
Index: python/libvir.c
===================================================================
RCS file: /data/cvs/libvirt/python/libvir.c,v
retrieving revision 1.43
diff -u -p -r1.43 libvir.c
--- python/libvir.c 31 Oct 2008 10:13:45 -0000 1.43
+++ python/libvir.c 4 Nov 2008 19:45:42 -0000
@@ -1537,29 +1537,33 @@ libvirt_virConnectDomainEventCallback(vi
PyObject *pyobj_ret;
PyObject *pyobj_conn_inst = (PyObject*)opaque;
- PyObject *pyobj_dom = libvirt_virDomainPtrWrap(dom);
+ PyObject *pyobj_dom;
PyObject *pyobj_dom_args;
PyObject *pyobj_dom_inst;
PyObject *dom_class;
+ int ret = -1;
+
+ LIBVIRT_ENSURE_THREAD_STATE;
/* Create a python instance of this virDomainPtr */
+ pyobj_dom = libvirt_virDomainPtrWrap(dom);
pyobj_dom_args = PyTuple_New(2);
if(PyTuple_SetItem(pyobj_dom_args, 0, pyobj_conn_inst)!=0) {
printf("%s error creating tuple",__FUNCTION__);
- return -1;
+ goto cleanup;
}
if(PyTuple_SetItem(pyobj_dom_args, 1, pyobj_dom)!=0) {
printf("%s error creating tuple",__FUNCTION__);
- return -1;
+ goto cleanup;
}
Py_INCREF(pyobj_conn_inst);
dom_class = getLibvirtDomainClassObject();
if(!PyClass_Check(dom_class)) {
printf("%s dom_class is not a class!\n", __FUNCTION__);
- return -1;
+ goto cleanup;
}
pyobj_dom_inst = PyInstance_New(dom_class,
@@ -1571,7 +1575,7 @@ libvirt_virConnectDomainEventCallback(vi
if(!pyobj_dom_inst) {
printf("%s Error creating a python instance of virDomain\n", __FUNCTION__);
PyErr_Print();
- return -1;
+ goto cleanup;
}
/* Call the Callback Dispatcher */
@@ -1586,12 +1590,15 @@ libvirt_virConnectDomainEventCallback(vi
if(!pyobj_ret) {
printf("%s - ret:%p\n", __FUNCTION__, pyobj_ret);
PyErr_Print();
- return -1;
} else {
Py_DECREF(pyobj_ret);
- return 0;
+ ret = 0;
}
+
+cleanup:
+ LIBVIRT_RELEASE_THREAD_STATE;
+ return -1;
}
static PyObject *
@@ -1620,10 +1627,14 @@ libvirt_virConnectDomainEventRegister(AT
Py_INCREF(pyobj_conn_inst);
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+
ret = virConnectDomainEventRegister(conn,
libvirt_virConnectDomainEventCallback,
(void *)pyobj_conn_inst);
+ LIBVIRT_END_ALLOW_THREADS;
+
py_retval = libvirt_intWrap(ret);
return (py_retval);
}
@@ -1650,8 +1661,12 @@ libvirt_virConnectDomainEventDeregister(
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+
ret = virConnectDomainEventDeregister(conn, libvirt_virConnectDomainEventCallback);
+ LIBVIRT_END_ALLOW_THREADS;
+
Py_DECREF(pyobj_conn_inst);
py_retval = libvirt_intWrap(ret);
return (py_retval);
@@ -1679,13 +1694,15 @@ libvirt_virEventAddHandleFunc (int fd A
PyObject *cb_args;
PyObject *pyobj_args;
+ LIBVIRT_ENSURE_THREAD_STATE;
+
/* Lookup the python callback */
python_cb = PyDict_GetItemString(getLibvirtDictObject(),
"eventInvokeHandleCallback");
if(!python_cb) {
printf("%s Error finding eventInvokeHandleCallback\n", __FUNCTION__);
PyErr_Print();
- return -1;
+ goto cleanup;
}
Py_INCREF(python_cb);
@@ -1708,6 +1725,10 @@ libvirt_virEventAddHandleFunc (int fd A
Py_XDECREF(result);
Py_DECREF(pyobj_args);
+
+cleanup:
+ LIBVIRT_RELEASE_THREAD_STATE;
+
return 0;
}
@@ -1715,7 +1736,11 @@ static void
libvirt_virEventUpdateHandleFunc(int fd, int event)
{
PyObject *result = NULL;
- PyObject *pyobj_args = PyTuple_New(2);
+ PyObject *pyobj_args;
+
+ LIBVIRT_ENSURE_THREAD_STATE;
+
+ pyobj_args = PyTuple_New(2);
PyTuple_SetItem(pyobj_args, 0, libvirt_intWrap(fd));
PyTuple_SetItem(pyobj_args, 1, libvirt_intWrap(event));
@@ -1724,13 +1749,20 @@ libvirt_virEventUpdateHandleFunc(int fd,
Py_XDECREF(result);
Py_DECREF(pyobj_args);
+
+ LIBVIRT_RELEASE_THREAD_STATE;
}
+
static int
libvirt_virEventRemoveHandleFunc(int fd)
{
PyObject *result = NULL;
- PyObject *pyobj_args = PyTuple_New(1);
+ PyObject *pyobj_args;
+
+ LIBVIRT_ENSURE_THREAD_STATE;
+
+ pyobj_args = PyTuple_New(1);
PyTuple_SetItem(pyobj_args, 0, libvirt_intWrap(fd));
if(removeHandleObj && PyCallable_Check(removeHandleObj))
@@ -1738,6 +1770,9 @@ libvirt_virEventRemoveHandleFunc(int fd)
Py_XDECREF(result);
Py_DECREF(pyobj_args);
+
+ LIBVIRT_RELEASE_THREAD_STATE;
+
return 0;
}
@@ -1754,13 +1789,15 @@ libvirt_virEventAddTimeoutFunc(int timeo
PyObject *cb_args;
PyObject *pyobj_args;
+ LIBVIRT_ENSURE_THREAD_STATE;
+
/* Lookup the python callback */
python_cb = PyDict_GetItemString(getLibvirtDictObject(),
"eventInvokeTimeoutCallback");
if(!python_cb) {
printf("%s Error finding eventInvokeTimeoutCallback\n", __FUNCTION__);
PyErr_Print();
- return -1;
+ goto cleanup;
}
Py_INCREF(python_cb);
@@ -1783,6 +1820,9 @@ libvirt_virEventAddTimeoutFunc(int timeo
Py_XDECREF(result);
Py_DECREF(pyobj_args);
+
+cleanup:
+ LIBVIRT_RELEASE_THREAD_STATE;
return 0;
}
@@ -1790,7 +1830,11 @@ static void
libvirt_virEventUpdateTimeoutFunc(int timer, int timeout)
{
PyObject *result = NULL;
- PyObject *pyobj_args = PyTuple_New(2);
+ PyObject *pyobj_args;
+
+ LIBVIRT_ENSURE_THREAD_STATE;
+
+ pyobj_args = PyTuple_New(2);
PyTuple_SetItem(pyobj_args, 0, libvirt_intWrap(timer));
PyTuple_SetItem(pyobj_args, 1, libvirt_intWrap(timeout));
@@ -1799,13 +1843,19 @@ libvirt_virEventUpdateTimeoutFunc(int ti
Py_XDECREF(result);
Py_DECREF(pyobj_args);
+
+ LIBVIRT_RELEASE_THREAD_STATE;
}
static int
libvirt_virEventRemoveTimeoutFunc(int timer)
{
PyObject *result = NULL;
- PyObject *pyobj_args = PyTuple_New(1);
+ PyObject *pyobj_args;
+
+ LIBVIRT_ENSURE_THREAD_STATE;
+
+ pyobj_args = PyTuple_New(1);
PyTuple_SetItem(pyobj_args, 0, libvirt_intWrap(timer));
if(updateTimeoutObj && PyCallable_Check(updateTimeoutObj))
@@ -1813,6 +1863,9 @@ libvirt_virEventRemoveTimeoutFunc(int ti
Py_XDECREF(result);
Py_DECREF(pyobj_args);
+
+ LIBVIRT_RELEASE_THREAD_STATE;
+
return 0;
}
@@ -1845,6 +1898,8 @@ libvirt_virEventRegisterImpl(ATTRIBUTE_U
Py_INCREF(updateTimeoutObj);
Py_INCREF(removeTimeoutObj);
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+
virEventRegisterImpl(libvirt_virEventAddHandleFunc,
libvirt_virEventUpdateHandleFunc,
libvirt_virEventRemoveHandleFunc,
@@ -1852,6 +1907,8 @@ libvirt_virEventRegisterImpl(ATTRIBUTE_U
libvirt_virEventUpdateTimeoutFunc,
libvirt_virEventRemoveTimeoutFunc);
+ LIBVIRT_END_ALLOW_THREADS;
+
return VIR_PY_INT_SUCCESS;
}
Index: include/libvirt/libvirt.h.in
===================================================================
RCS file: /data/cvs/libvirt/include/libvirt/libvirt.h.in,v
retrieving revision 1.57
diff -u -p -r1.57 libvirt.h.in
--- include/libvirt/libvirt.h.in 24 Oct 2008 12:05:39 -0000 1.57
+++ include/libvirt/libvirt.h.in 4 Nov 2008 19:45:42 -0000
@@ -1004,14 +1004,14 @@ virDomainPtr virDomainCreateL
* a virDomainEventType is emitted during domain lifecycle events
*/
typedef enum {
- VIR_DOMAIN_EVENT_ADDED,
- VIR_DOMAIN_EVENT_REMOVED,
- VIR_DOMAIN_EVENT_STARTED,
- VIR_DOMAIN_EVENT_SUSPENDED,
- VIR_DOMAIN_EVENT_RESUMED,
- VIR_DOMAIN_EVENT_STOPPED,
- VIR_DOMAIN_EVENT_SAVED,
- VIR_DOMAIN_EVENT_RESTORED,
+ VIR_DOMAIN_EVENT_ADDED = 0,
+ VIR_DOMAIN_EVENT_REMOVED = 1,
+ VIR_DOMAIN_EVENT_STARTED = 2,
+ VIR_DOMAIN_EVENT_SUSPENDED = 3,
+ VIR_DOMAIN_EVENT_RESUMED = 4,
+ VIR_DOMAIN_EVENT_STOPPED = 5,
+ VIR_DOMAIN_EVENT_SAVED = 6,
+ VIR_DOMAIN_EVENT_RESTORED = 7,
} virDomainEventType;
/**
--
|: 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, 1 month
[libvirt] _lstat link failure on mingw
by Jim Meyering
This fixes a problem spotted by Rich Jones yesterday:
>From 5d5042ad904f8da6ffff93c1a5e392cd4d9b86a1 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Thu, 6 Nov 2008 20:46:46 +0100
Subject: [PATCH] tweak lstat.c to avoid mingw link failure
* gnulib/lib/lstat.c: Include <sys/stat.h> *before* the
use of stat in orig_stat. Otherwise, on mingw (which lacks lstat),
any program using the lstat module would not get the redefinition-
to-stat provided by gnulib's sys/stat.h.
---
gnulib/lib/lstat.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/gnulib/lib/lstat.c b/gnulib/lib/lstat.c
index 3d1bca8..aa5e8c4 100644
--- a/gnulib/lib/lstat.c
+++ b/gnulib/lib/lstat.c
@@ -25,15 +25,15 @@
#include <sys/stat.h>
#undef __need_system_sys_stat_h
+/* Specification. */
+#include <sys/stat.h>
+
static inline int
orig_lstat (const char *filename, struct stat *buf)
{
return lstat (filename, buf);
}
-/* Specification. */
-#include <sys/stat.h>
-
#include <string.h>
#include <errno.h>
--
1.6.0.3.756.gb776d
16 years, 1 month
[libvirt] [PATCH] mark a few diagnostics for translation
by Jim Meyering
FYI.
This is trivial, so I'll push it soon unless someone objects.
>From d5d9bc7e5473ea3ce40c4af70a2085c316023723 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Thu, 6 Nov 2008 20:41:34 +0100
Subject: [PATCH] mark a few diagnostics for translation
* src/lxc_conf.c (lxcLoadDriverConfig): Mark a diagnostic.
* src/lxc_driver.c (lxcDomainStart): Likewise.
* po/POTFILES.in: Add src/lxc_conf.c.
* Makefile.maint (msg_gen_function): Add virReportErrorHelper
and lxcError.
---
Makefile.maint | 3 ++-
po/POTFILES.in | 1 +
src/lxc_conf.c | 5 ++---
src/lxc_driver.c | 2 +-
4 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/Makefile.maint b/Makefile.maint
index d856469..28b1c3f 100644
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -353,6 +353,8 @@ msg_gen_function += qemudReportError
msg_gen_function += openvzLog
msg_gen_function += openvzError
msg_gen_function += virDomainReportError
+msg_gen_function += virReportErrorHelper
+msg_gen_function += lxcError
# Uncomment the following and run "make syntax-check" to see diagnostics
# that are not yet marked for translation, but that need to be rewritten
@@ -360,7 +362,6 @@ msg_gen_function += virDomainReportError
# msg_gen_function += error
# msg_gen_function += virXenError
# msg_gen_function += testError
-# msg_gen_function += lxcError
func_or := $(shell printf '$(msg_gen_function)'|tr -s '[[:space:]]' '|')
func_re := ($(func_or))
diff --git a/po/POTFILES.in b/po/POTFILES.in
index fdb34b5..3f8fdd2 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -7,6 +7,7 @@ src/datatypes.c
src/domain_conf.c
src/iptables.c
src/libvirt.c
+src/lxc_conf.c
src/lxc_container.c
src/lxc_controller.c
src/lxc_driver.c
diff --git a/src/lxc_conf.c b/src/lxc_conf.c
index 76f4e9d..0db9bb5 100644
--- a/src/lxc_conf.c
+++ b/src/lxc_conf.c
@@ -83,8 +83,7 @@ int lxcLoadDriverConfig(lxc_driver_t *driver)
return 0;
no_memory:
- lxcError(NULL, NULL, VIR_ERR_NO_MEMORY, "configDir");
+ lxcError(NULL, NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("while loading LXC driver config"));
return -1;
}
-
-
diff --git a/src/lxc_driver.c b/src/lxc_driver.c
index 8bfd27d..583c4ff 100644
--- a/src/lxc_driver.c
+++ b/src/lxc_driver.c
@@ -857,7 +857,7 @@ static int lxcDomainStart(virDomainPtr dom)
if (!vm) {
lxcError(conn, dom, VIR_ERR_INVALID_DOMAIN,
- "no domain with uuid");
+ _("no domain named %s"), dom->name);
goto cleanup;
}
--
1.6.0.3.756.gb776d
16 years, 1 month
[libvirt] RFC: Domain events add DEFINED and UNDEFINED events
by Daniel P. Berrange
We currently have the following list of events for domains:
VIR_DOMAIN_EVENT_ADDED,
VIR_DOMAIN_EVENT_REMOVED,
VIR_DOMAIN_EVENT_STARTED,
VIR_DOMAIN_EVENT_SUSPENDED,
VIR_DOMAIN_EVENT_RESUMED,
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_SAVED,
VIR_DOMAIN_EVENT_RESTORED,
The QEMU driver supports all of them, except for ADDED and REMOVED. I
was looking at adding these and wondering how exactly we should define
the semantics
Originally I was just going to emit 'ADDED' from virDomainDefine() driver
impl and 'REMOVED' from virDomainUndefine().
This does not, however, take into account that there are two sorts of
domains, so called 'persistent' and 'transient' domains.
With a transient domain, there is no config file, so the first time you
know about the domain is when it is booted via virDomainCreateXML(),
and all trace of it disappears when it shuts down, or migrates, or is
saved. With a persistent domain though, it is visible before it is
booted, and remains visible after shutdown/migrate/save etc.
The current set of events does not allow applications to get this level
of visibility. eg when receiving a VIR_DOMAIN_EVENT_STOPPED event, there
is no way to know wether the domain was transient / persistent, and thus
whether to remove it from your list of VMs, or simply mark it shutoff.
So, I'd like to propose that we do the following:
- Clarify the semantics for
* VIR_DOMAIN_EVENT_ADDED
Emitted when a domain comes into existance, by which I mean a
previously known inactive domain is defined, or a transient
domain is booted. This is emited before any other events for
a domain with that UUID/name.
* VIR_DOMAIN_EVENT_REMOVED
Emitted when a domains goes out of existance, by which I mean
a transient domain shuts down / migrates / is saved, or a
persistent domain is undefined. This is the last event ever to
be emitted for a domain with that UUID/name.
- Create two more events
* VIR_DOMAIN_EVENT_DEFINED
Emitted whenenever a domain's config file is created. This can
be when a peristent domain is first defined, when it is later
re-defined, or when an transient domain gains a confi file,
becoming persistent.
* VIR_DOMAIN_EVENT_UNDEFINED
Emitted when a domain's config file is removed.
With this complete set of events, virt-manager is able to track domains
without ever having to poll for the domain listing.
I think we also need to provide some way for an application to determine
what set of events a hypervisor backend supports. eg, if it only supports
the STARTED/STOPPED events, virt-manager would still need to do polling to
find out about defined/undefined domains.
Daniel
--
|: 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, 1 month
[libvirt] [PATCH] Xen events
by Ben Guthro
The following patch implements a framework for emitting events from the Xen driver, via monitoring xenstore.
Currently, this only emits the STARTED, and STOPPED events, as this is all that seems to be available via monitoring xenstore.
xen_unified.c | 162 +++++++++++++++++++++++
xen_unified.h | 38 +++++
xs_internal.c | 408 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
xs_internal.h | 51 +++++++
4 files changed, 657 insertions(+), 2 deletions(-)
16 years, 1 month