Re: [libvirt] [PATCH]: Add MIGRATE_LIVE definition to ruby-libvirt bindings

2008-07-18 Thread Chris Lalancette
David Lutterkort wrote:
 ACK .. Committed.
 
 (1) Do you need a new ruby-libvirt release for this ?

No, it's fine for now; I'm just hard-coding the 1 in oVirt for now.  At some
future point when you do a new release, though, I'll convert over to this flag.

 (2) How far back has 'enum virDomainMigrateFlags' been around ? IOW, do
 I need to worry about compilation breaking on old libvirt releases ?

Good question.  /me goes to look...according to cvs annotate, that flag was
added to include/libvirt/libvirt.h changeset 1.52 on 21-Aug-07.  From the
Changelog, it looks like that means it was included in libvirt 0.3.2 onwards.
How far back are you looking to make the bindings compatible?

Chris Lalancette

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] cpu usage in OpenVZ

2008-07-18 Thread Evgeniy Sokolov

On Thu, Jul 17, 2008 at 03:04:46PM +0400, Evgeniy Sokolov wrote:

OpenVZ calculate statistics and allow to get them .
Added function for getting cpu usage of container.


Modular some minor comments,  ACK for this patch.


+if (!openvzIsActiveVM(vm)) {
+info-cpuTime = 0;
+} else {
+if (openvzGetProcessInfo((info-cpuTime), dom-id)  0) {
+openvzError(dom-conn, VIR_ERR_OPERATION_FAILED, (cannot read cputime 
for domain));


Need to have a leading '_'  in front of the string to be mark
for translation.


+return -1;
+}
+}
+
 /* TODO These need to be calculated differently for OpenVZ */
 //info-cpuTime =
 //info-maxMem = vm-def-maxmem;
@@ -689,6 +700,48 @@ static int openvzListDefinedDomains(virC
 return got;
 }
 
+static int openvzGetProcessInfo(unsigned long long *cpuTime, int vpsid) {

+int fd;
+char line[PATH_MAX] ;


Best to use something else as the size here - we're not reading
a path  we should try to eliminate uses of PATH_MAX in libvirt,
since  POSIX allows for it to be undefine, or stupidly huge. I
reckon 1024 would do the job for line length in this case.


+if (readvps != vpsid) /*not found*/
+return -1;
+
+/* convert jiffies to nanoseconds */
+*cpuTime = 1000ull * 1000ull * 1000ull * (usertime + nicetime  + systime) 
/ (unsigned long long)sysconf(_SC_CLK_TCK);


Can we break this expression across multiple lines to avoid going
soo far over 80 chars.

Daniel


Thanks! I completely forgot basic rules.

fixed patch is attached.

Index: src/openvz_driver.c
===
RCS file: /data/cvs/libvirt/src/openvz_driver.c,v
retrieving revision 1.31
diff -u -p -r1.31 openvz_driver.c
--- src/openvz_driver.c	16 Jul 2008 20:42:38 -	1.31
+++ src/openvz_driver.c	18 Jul 2008 09:38:44 -
@@ -94,6 +94,8 @@ static int openvzDomainUndefine(virDomai
 static int convCmdbufExec(char cmdbuf[], char *cmdExec[]);
 static void cmdExecFree(char *cmdExec[]);
 
+static int openvzGetProcessInfo(unsigned long long *cpuTime, int vpsid);
+
 struct openvz_driver ovz_driver;
 
 static int convCmdbufExec(char cmdbuf[], char *cmdExec[])
@@ -279,6 +281,16 @@ static int openvzDomainGetInfo(virDomain
 
 info-state = vm-status;
 
+if (!openvzIsActiveVM(vm)) {
+info-cpuTime = 0;
+} else {
+if (openvzGetProcessInfo((info-cpuTime), dom-id)  0) {
+openvzError(dom-conn, VIR_ERR_OPERATION_FAILED,
+_(cannot read cputime for domain %d), dom-id);
+return -1;
+}
+}
+
 /* TODO These need to be calculated differently for OpenVZ */
 //info-cpuTime =
 //info-maxMem = vm-def-maxmem;
@@ -689,6 +701,51 @@ static int openvzListDefinedDomains(virC
 return got;
 }
 
+static int openvzGetProcessInfo(unsigned long long *cpuTime, int vpsid) {
+int fd;
+char line[1024] ;
+unsigned long long usertime, systime, nicetime;
+int readvps = 0, ret;
+
+/* read statistic from /proc/vz/vestat.
+sample:
+Version: 2.2
+  VEID user  nice system uptime idle   other..
+33   78 0   1330   59454597  142650441835148   other..
+55  178 0   5340   59424597  542650441835148   other..
+*/
+
+if ((fd = open(/proc/vz/vestat, O_RDONLY)) == -1)
+return -1;
+
+/*search line with VEID=vpsid*/
+while(1) {
+ret = openvz_readline(fd, line, sizeof(line));
+if(ret = 0)
+break;
+
+if (sscanf(line, %d %llu %llu %llu,
+  readvps, usertime, nicetime, systime) != 4)
+continue;
+
+if (readvps == vpsid)
+break; /*found vpsid*/
+}
+
+close(fd);
+if (ret  0)
+return -1;
+
+if (readvps != vpsid) /*not found*/
+return -1;
+
+/* convert jiffies to nanoseconds */
+*cpuTime = 1000ull * 1000ull * 1000ull * (usertime + nicetime  + systime)
+ / (unsigned long long)sysconf(_SC_CLK_TCK);
+
+return 0;
+}
+
 static int openvzNumDefinedDomains(virConnectPtr conn ATTRIBUTE_UNUSED) {
 return ovz_driver.num_inactive;
 }
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] repeat lookup by name in LookupByID

2008-07-18 Thread Jim Meyering
Daniel P. Berrange [EMAIL PROTECTED] wrote:
 On Thu, Jul 17, 2008 at 01:20:59PM +0400, Evgeniy Sokolov wrote:
...
 Index: virsh.c
 ===
 RCS file: /data/cvs/libvirt/src/virsh.c,v
 retrieving revision 1.155
 diff -u -p -r1.155 virsh.c
 --- virsh.c  29 May 2008 14:56:12 -  1.155
 +++ virsh.c  17 Jul 2008 09:04:17 -
 @@ -978,7 +978,8 @@ cmdUndefine(vshControl * ctl, vshCmd * c
  if (!vshConnectionUsability(ctl, ctl-conn, TRUE))
  return FALSE;

 -if (!(dom = vshCommandOptDomain(ctl, cmd, domain, name)))
 +if (!(dom = vshCommandOptDomainBy(ctl, cmd, domain, name,
 +  VSH_BYNAME|VSH_BYUUID)))

Before this change, we'd get a hint that undefining a running domain
is not possible:

$ virsh -q -c test:///default undefine 1
virsh # libvir: Test error test: internal error Domain is still running
error: Failed to undefine domain 1
virsh #

Now, the hint is gone, and the new diagnostics are misleading,
since domain 1 certainly does exist:

$ ./virsh -q -c test:///default undefine 1
virsh # libvir: Test error : Domain not found
error: failed to get domain '1'
virsh #

With the patch below virsh tells what's wrong:

$ ./virsh -q -c test:///default undefine 1
error: a running domain like 1 cannot be undefined;
to undefine, first shutdown then undefine using its name or UUID
[Exit 1]

My first attempt called vshCommandOptDomainBy-with-BYID only upon failure
of the with-VSH_BYNAME|VSH_BYUUID call, but then you'd still get this
misleading diagnostic:

error: failed to get domain '1'

It also adds a test that essentially does this:

$ ./virsh -q -c test:///default undefine 1
error: a running domain like 1 cannot be undefined;
to undefine, first shutdown then undefine using its name or UUID
[Exit 1]
$ ./virsh -q -c test:///default undefine test
libvir: Test error test: internal error Domain is still running
error: Failed to undefine domain test
[Exit 1]
$ ./virsh -q -c test:///default 'shutdown 1; undefine test'
Domain 1 is being shutdown
Domain test has been undefined

From d8a30f1f4da5db63b0c3cef2a67183a76c7dc989 Mon Sep 17 00:00:00 2001
From: Jim Meyering [EMAIL PROTECTED]
Date: Fri, 18 Jul 2008 10:53:25 +0200
Subject: [PATCH] better diagnostic when failing to undefine a running domain 
via ID

* src/virsh.c (cmdUndefine): Tell user to shutdown and then use name or UUID.
* tests/undefine: New test.  Exercise virsh's undefine command.
* tests/Makefile.am (test_scripts): Add undefine.
---
 src/virsh.c   |   14 +
 tests/Makefile.am |1 +
 tests/undefine|   55 +
 3 files changed, 70 insertions(+), 0 deletions(-)
 create mode 100755 tests/undefine

diff --git a/src/virsh.c b/src/virsh.c
index f1296ec..620f103 100644
--- a/src/virsh.c
+++ b/src/virsh.c
@@ -974,10 +974,24 @@ cmdUndefine(vshControl * ctl, vshCmd * cmd)
 virDomainPtr dom;
 int ret = TRUE;
 char *name;
+int found;
+int id;

 if (!vshConnectionUsability(ctl, ctl-conn, TRUE))
 return FALSE;

+name = vshCommandOptString(cmd, domain, found);
+if (!found)
+return FALSE;
+
+if (name  virStrToLong_i(name, NULL, 10, id) == 0
+ id = 0  (dom = virDomainLookupByID(ctl-conn, id))) {
+vshError(ctl, FALSE, _(a running domain like %s cannot be 
undefined;\n
+   to undefine, first shutdown then undefine
+using its name or UUID), name);
+virDomainFree(dom);
+return FALSE;
+}
 if (!(dom = vshCommandOptDomainBy(ctl, cmd, domain, name,
   VSH_BYNAME|VSH_BYUUID)))
 return FALSE;
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2fc5a2f..5686678 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -51,6 +51,7 @@ test_scripts += \
int-overflow \
read-bufsiz \
read-non-seekable \
+   undefine \
vcpupin
 endif

diff --git a/tests/undefine b/tests/undefine
new file mode 100755
index 000..3936e22
--- /dev/null
+++ b/tests/undefine
@@ -0,0 +1,55 @@
+#!/bin/sh
+# exercise virsh's undefine command
+
+# Copyright (C) 2008 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see 

[libvirt] virStorageVolCreateXML vs virStorageVolCloneXML

2008-07-18 Thread Stefan de Konink
Hi,

There is currently no implementation in the api to clone snapshots or
images. I wonder if we could add an XML node to specify a backed device.
Or add a new function that allows to clone.

Like the create is not supported by all pools, cloning should also be
based on best effort, falling back to cp for non sparse images. (Probably
a good configuration option)


Now the new XML parser is in place I have still the desire to create this
type of configuration:
disk type='pool'
  source pool='netapp' volume='lun-3' /
  target dev='xvda'/
/disk


And it might be a useful source tag for cloning too.



Stefan

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] Libvirtd default.xml (in qemu/networks/autostart) breaks XEN

2008-07-18 Thread Stefan de Konink
The desire to automatically install the autostarted network configuration
of libvirt broke my (and some other users on xen-users) setup. I suggest
to *remove* this network configuration as default and *not* put it into
xenstore as a stateful config.

*It does not work by default*

Worse is that it is almost impossible to debug if you don't know where to
find it.


Stefan

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] enable format-safety checks for virDomainReportError

2008-07-18 Thread Jim Meyering
This enables format-safety checks for virDomainReportError,
so that if you try to print e.g., an int via %s, gcc will
detect it.  The Makefile.maint check ensures that all string
arguments to virDomainReportError are marked for translation
with _(...).

From 65c7fc8bdbf491a02d1d14fcdef429ba1c9e0dea Mon Sep 17 00:00:00 2001
From: Jim Meyering [EMAIL PROTECTED]
Date: Fri, 18 Jul 2008 12:46:38 +0200
Subject: [PATCH] enable format-safety checks for virDomainReportError

* src/domain_conf.c (virDomainReportError): Declare using
ATTRIBUTE_FORMAT(printf, 3, 4).
* Makefile.maint (msg_gen_function): Add virDomainReportError.
---
 Makefile.maint|1 +
 src/domain_conf.c |4 
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/Makefile.maint b/Makefile.maint
index 5da2984..03800f8 100644
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -352,6 +352,7 @@ msg_gen_function += ReportError
 msg_gen_function += qemudReportError
 msg_gen_function += openvzLog
 msg_gen_function += openvzError
+msg_gen_function += virDomainReportError

 # Uncomment the following and run make syntax-check to see diagnostics
 # that are not yet marked for translation, but that need to be rewritten
diff --git a/src/domain_conf.c b/src/domain_conf.c
index 82c0ee6..2ff5d1a 100644
--- a/src/domain_conf.c
+++ b/src/domain_conf.c
@@ -128,6 +128,10 @@ VIR_ENUM_IMPL(virDomainGraphics, 
VIR_DOMAIN_GRAPHICS_TYPE_LAST,

 static void virDomainReportError(virConnectPtr conn,
  int code, const char *fmt, ...)
+  ATTRIBUTE_FORMAT(printf, 3, 4);
+
+static void virDomainReportError(virConnectPtr conn,
+ int code, const char *fmt, ...)
 {
 va_list args;
 char errorMessage[1024];
--
1.5.6.3.440.ge3a8d

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] enable format-safety checks for virDomainReportError

2008-07-18 Thread Daniel Veillard
On Fri, Jul 18, 2008 at 12:49:01PM +0200, Jim Meyering wrote:
 This enables format-safety checks for virDomainReportError,
 so that if you try to print e.g., an int via %s, gcc will
 detect it.  The Makefile.maint check ensures that all string
 arguments to virDomainReportError are marked for translation
 with _(...).
 

  Sounds fine, +1,

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard  | virtualization library  http://libvirt.org/
[EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] enable format-safety checks for virDomainReportError

2008-07-18 Thread Jim Meyering
Daniel Veillard [EMAIL PROTECTED] wrote:
 On Fri, Jul 18, 2008 at 12:49:01PM +0200, Jim Meyering wrote:
 This enables format-safety checks for virDomainReportError,
 so that if you try to print e.g., an int via %s, gcc will
 detect it.  The Makefile.maint check ensures that all string
 arguments to virDomainReportError are marked for translation
 with _(...).


   Sounds fine, +1,

Thanks. committed.

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH]: Add floppy support to xm_internal

2008-07-18 Thread Chris Lalancette
Yes, you read the subject right; add floppy support to xm internal.  Let's just
say I didn't do this by choice.  In any case, there was a cryptic comment in
xenXMParseXMLDisks() that said:

/* Xend (all versions) put the floppy device config
 * under the hvm (image (os)) block
 */

What this actually means is that we shouldn't parse the floppy stuff to put it
in the disks = section of the /etc/xen configuration file, since it doesn't
have meaning there.  Instead, floppy disks go at the top-level of a Xen config
file, like:

fda = '/var/lib/xen/images/floppy.img'
fdb = '/var/lib/xen/images/floppy2.img'

That's exactly what this patch does.  In combination with a couple of other
small patches to virt-install (which I will post to the appropriate list), I was
able to use a floppy disk to hold the kickstart for a fully virtualized Xen
guest install.

Signed-off-by: Chris Lalancette [EMAIL PROTECTED]
Index: src/xm_internal.c
===
RCS file: /data/cvs/libvirt/src/xm_internal.c,v
retrieving revision 1.84
diff -u -r1.84 xm_internal.c
--- src/xm_internal.c	26 Jun 2008 10:56:19 -	1.84
+++ src/xm_internal.c	18 Jul 2008 12:04:47 -
@@ -1639,6 +1639,67 @@
 return ret;
 }
 
+static int xenXMParseXMLFloppy(xmlNodePtr node, virConfPtr conf)
+{
+xmlNodePtr cur;
+xmlChar *source = NULL;
+xmlChar *target = NULL;
+xmlChar *type = NULL;
+int typ = 0;
+int ret = -1;
+virConfValuePtr floppy = NULL;
+
+type = xmlGetProp(node, BAD_CAST type);
+if (type != NULL) {
+if (xmlStrEqual(type, BAD_CAST file))
+typ = 0;
+else if (xmlStrEqual(type, BAD_CAST block))
+typ = 1;
+xmlFree(type);
+}
+
+cur = node-children;
+while (cur != NULL) {
+if (cur-type == XML_ELEMENT_NODE) {
+if ((source == NULL) 
+(xmlStrEqual(cur-name, BAD_CAST source))) {
+
+if (typ == 0)
+source = xmlGetProp(cur, BAD_CAST file);
+else
+source = xmlGetProp(cur, BAD_CAST dev);
+} else if ((target == NULL) 
+   (xmlStrEqual(cur-name, BAD_CAST target))) {
+target = xmlGetProp(cur, BAD_CAST dev);
+}
+}
+cur = cur-next;
+}
+
+if (source == NULL || target == NULL)
+goto error;
+
+if (!STREQ((const char *)target, fda)  !STREQ((const char *)target, fdb))
+goto error;
+
+if (VIR_ALLOC(floppy)  0)
+goto error;
+
+floppy-type = VIR_CONF_STRING;
+floppy-str = strdup((const char *)source);
+
+if (virConfSetValue(conf, (const char *)target, floppy)  0)
+goto error;
+
+ret = 0;
+
+error:
+xmlFree(source);
+xmlFree(target);
+
+return ret;
+}
+
 static int xenXMParseXMLDisk(xmlNodePtr node, int hvm, int xendConfigVersion, char **disk) {
 xmlNodePtr cur;
 xmlChar *type = NULL;
@@ -1698,16 +1759,6 @@
 return (-1);
 }
 
-/* Xend (all versions) put the floppy device config
- * under the hvm (image (os)) block
- */
-if (hvm 
-device 
-STREQ((const char *)device, floppy)) {
-ret = 0;
-goto cleanup;
-}
-
 /* Xend = 3.0.2 doesn't include cdrom config here */
 if (hvm 
 device 
@@ -2261,22 +2312,32 @@
 for (i = obj-nodesetval-nodeNr -1 ; i = 0 ; i--) {
 virConfValuePtr thisDisk;
 char *disk = NULL;
-if (xenXMParseXMLDisk(obj-nodesetval-nodeTab[i], hvm, priv-xendConfigVersion, disk)  0) {
-virConfFreeValue(disks);
-goto error;
+xmlChar *device;
+
+device = xmlGetProp(obj-nodesetval-nodeTab[i], BAD_CAST device);
+if (hvm  device  STREQ((const char *)device, floppy)) {
+if (xenXMParseXMLFloppy(obj-nodesetval-nodeTab[i], conf)  0)
+goto error;
 }
-if (disk) {
-if (VIR_ALLOC(thisDisk)  0) {
-VIR_FREE(disk);
+else {
+if (xenXMParseXMLDisk(obj-nodesetval-nodeTab[i], hvm, priv-xendConfigVersion, disk)  0) {
 virConfFreeValue(disks);
-xenXMError(conn, VIR_ERR_NO_MEMORY, _(config));
 goto error;
 }
-thisDisk-type = VIR_CONF_STRING;
-thisDisk-str = disk;
-thisDisk-next = disks-list;
-disks-list = thisDisk;
+if (disk) {
+if (VIR_ALLOC(thisDisk)  0) {
+VIR_FREE(disk);
+virConfFreeValue(disks);
+xenXMError(conn, VIR_ERR_NO_MEMORY, _(config));
+goto error;
+}
+thisDisk-type = VIR_CONF_STRING;
+thisDisk-str = disk;
+

Re: [libvirt] [PATCH]: Add floppy support to xm_internal

2008-07-18 Thread Daniel P. Berrange
On Fri, Jul 18, 2008 at 02:05:06PM +0200, Chris Lalancette wrote:
 Yes, you read the subject right; add floppy support to xm internal.  Let's 
 just
 say I didn't do this by choice.  In any case, there was a cryptic comment in
 xenXMParseXMLDisks() that said:
 
 /* Xend (all versions) put the floppy device config
  * under the hvm (image (os)) block
  */
 
 What this actually means is that we shouldn't parse the floppy stuff to put it
 in the disks = section of the /etc/xen configuration file, since it doesn't
 have meaning there.  Instead, floppy disks go at the top-level of a Xen config
 file, like:
 
 fda = '/var/lib/xen/images/floppy.img'
 fdb = '/var/lib/xen/images/floppy2.img'
 
 That's exactly what this patch does.  In combination with a couple of other
 small patches to virt-install (which I will post to the appropriate list), I 
 was
 able to use a floppy disk to hold the kickstart for a fully virtualized Xen
 guest install.

Sorry, this patch is no use - there is a stack of patches pending review
which re-write the XM and XenD driver's XML handling from scratch to use
the new generic domain XML APIs. The floppy stuff will have to stack on
top of that:

  http://www.redhat.com/archives/libvir-list/2008-July/msg00084.html

Regards,
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 :|

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] Libvirtd default.xml (in qemu/networks/autostart) breaks XEN

2008-07-18 Thread Daniel P. Berrange
On Fri, Jul 18, 2008 at 12:33:22PM +0200, Stefan de Konink wrote:
 The desire to automatically install the autostarted network configuration
 of libvirt broke my (and some other users on xen-users) setup. I suggest
 to *remove* this network configuration as default and *not* put it into
 xenstore as a stateful config.
 
 *It does not work by default*

It works just fine by default. If anything is breaking networking it is
XenD.

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

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] virStorageVolCreateXML vs virStorageVolCloneXML

2008-07-18 Thread Daniel P. Berrange
On Fri, Jul 18, 2008 at 12:27:49PM +0200, Stefan de Konink wrote:
 Hi,
 
 There is currently no implementation in the api to clone snapshots or
 images. I wonder if we could add an XML node to specify a backed device.
 Or add a new function that allows to clone.

I think this wants to be done with a new API, taking a source volume,
and destination pool as the arguemnts. Something along the lines of


virStorageVolClone(virStorageVolPtr src,
   virStoragePoolPtr dst,
   unsigned int flags);

Although the common  efficient case will be cloning volumes in the
same pool, allowing a pool to be passed in directly, allows us to 
clone across pools. eg, clone a LVM volume to a NFS file.

 Like the create is not supported by all pools, cloning should also be
 based on best effort, falling back to cp for non sparse images. (Probably
 a good configuration option)

Basically pool which supports 'create' ought to be usable as a destination
pool - at worst we can do a generic 'cp' style clone if the underlying
pool doesn't have a more efficient method.


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

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] attach device on a defined (non-active) vm

2008-07-18 Thread Daniel P. Berrange
On Thu, Jul 17, 2008 at 03:49:01AM +0200, Stefan de Konink wrote:
 It seems that the attach device function really 'attaches' a (live) 
 device to a non-active domain. Is this by design?
 
 Otherwise I would not have a clue how to interpreted this message:
 
 libvir: Xen Daemon error : POST operation failed: (xend.err 'Device 
 /dev/xvdp (51952, tap) is already connected.')
 
 (when I try to start the domain)

This seems like a bug in XenD to me - when attaching a disk we simply
pass the SEXPR config straight into XenD's  device_create RPC call.
If it accepts it without error, that's pretty much where libvirt's
involvement ends. So if it doesn't subsquently start there's something
wrong with XenD - either it failed to reject an invalid config when
libvirt made the device_create call, or it otherwise broke the guest
in some way.

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

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list



Re: [libvirt] [PATCH]: Add floppy support to xm_internal

2008-07-18 Thread Chris Lalancette
Daniel P. Berrange wrote:
 Sorry, this patch is no use - there is a stack of patches pending review
 which re-write the XM and XenD driver's XML handling from scratch to use
 the new generic domain XML APIs. The floppy stuff will have to stack on
 top of that:

That's OK; the same general idea should apply, and I'll need to backport this to
0.3.3 anyway.  I'm just looking to see if the basic idea is sane.

Chris Lalancette

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] Java bindings

2008-07-18 Thread Alejandro Berna Juan
Hi all, I'm Alejandro Berna from i2CAT (a non-profit foundation in
Barcelona, Spain, www.i2cat.net). I'm collaborating in a Europena project
called Federica ( www.fp7-*federica*.eu ). One of the branch of this project
is to permit virtualization of different hosts in the Federica test-bed. We
are doing some studies about the different management interfaces of Xen. Our
objective is to create a software remote client for Xen tool (in java if
it's possible) that can do (general functionalities):
- Create virtual machines assigning virtual interfaces.
- Permit choose the OS assigned to this virtual machine
- Install new applications to be tested in the virtual machines
- Configure a vm to become a router and permit to configure this router as
it was a physical router.

All these actions have to be performed remotelly. I have not found too much
information about libvrt but I think that can be usefull for our achieves.
If you agree that with libvrt we can perform these actions, maybe I can
build the java bindings for libvrt inside the Federica work. I'm waiting for
your opinions, thank you,

-- 
Alejandro Berna Juan
[EMAIL PROTECTED]
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] Java bindings

2008-07-18 Thread Daniel P. Berrange
On Fri, Jul 18, 2008 at 02:55:39PM +0200, Alejandro Berna Juan wrote:
 Hi all, I'm Alejandro Berna from i2CAT (a non-profit foundation in
 Barcelona, Spain, www.i2cat.net). I'm collaborating in a Europena project
 called Federica ( www.fp7-*federica*.eu ). One of the branch of this project
 is to permit virtualization of different hosts in the Federica test-bed. We
 are doing some studies about the different management interfaces of Xen. Our
 objective is to create a software remote client for Xen tool (in java if
 it's possible) that can do (general functionalities):
 - Create virtual machines assigning virtual interfaces.
 - Permit choose the OS assigned to this virtual machine
 - Install new applications to be tested in the virtual machines
 - Configure a vm to become a router and permit to configure this router as
 it was a physical router.
 
 All these actions have to be performed remotelly. I have not found too much
 information about libvrt but I think that can be usefull for our achieves.
 If you agree that with libvrt we can perform these actions, maybe I can
 build the java bindings for libvrt inside the Federica work. I'm waiting for
 your opinions, thank you,

You're in luck - we already have people working on Java bindings for
libvirt  anyone else who has time is more than welcome to contribute
code to improve the Java bindings. There is more information in this
mail:

http://www.redhat.com/archives/libvir-list/2008-June/msg00280.html


We also have full authenticated, encrypted remote access to all our APIs.
Information on this can be found here:

  http://libvirt.org/remote.html
  http://libvirt.org/auth.html

Regards,
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 :|

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] parse container id in separate function

2008-07-18 Thread Evgeniy Sokolov

There were several places with parsing container id from code.
Separate function is used now.
Index: src/openvz_conf.c
===
RCS file: /data/cvs/libvirt/src/openvz_conf.c,v
retrieving revision 1.29
diff -u -p -r1.29 openvz_conf.c
--- src/openvz_conf.c	11 Jul 2008 08:56:16 -	1.29
+++ src/openvz_conf.c	18 Jul 2008 13:21:07 -
@@ -134,9 +134,7 @@ strtoI(const char *str)
 val = (int) strtol(str, endptr, base);
 
 /* Check for various possible errors */
-if ((endptr == str) /* No digits were found */
-||((*endptr != '\0')
- (*endptr != ' ')) /*Name contain characters other than integers */ )
+if (endptr == str) /* No digits were found */
 return 0;
 return val;
 }
Index: src/openvz_driver.c
===
RCS file: /data/cvs/libvirt/src/openvz_driver.c,v
retrieving revision 1.31
diff -u -p -r1.31 openvz_driver.c
--- src/openvz_driver.c	16 Jul 2008 20:42:38 -	1.31
+++ src/openvz_driver.c	18 Jul 2008 13:21:07 -
@@ -437,7 +437,7 @@ openvzDomainCreateLinux(virConnectPtr co
 goto exit;
 }
 
-sscanf(vmdef-name, %d, vm-vpsid);
+vm-vpsid = strtoI(vmdef-name);
 vm-status = VIR_DOMAIN_RUNNING;
 ovz_driver.num_inactive--;
 ovz_driver.num_active++;
@@ -475,7 +475,7 @@ openvzDomainCreate(virDomainPtr dom)
 return -1;
 }
 
-sscanf(vm-vmdef-name, %d, vm-vpsid);
+vm-vpsid = strtoI(vm-vmdef-name);
 vm-status = VIR_DOMAIN_RUNNING;
 ovz_driver.num_inactive --;
 ovz_driver.num_active ++;
@@ -648,7 +648,7 @@ static int openvzListDomains(virConnectP
 while(got  nids){
 ret = openvz_readline(outfd, buf, 32);
 if(!ret) break;
-sscanf(buf, %d, veid);
+veid = strtoI(buf);
 ids[got] = veid;
 got ++;
 }
@@ -680,7 +680,7 @@ static int openvzListDefinedDomains(virC
 while(got  nnames){
 ret = openvz_readline(outfd, buf, 32);
 if(!ret) break;
-sscanf(buf, %d\n, veid);
+veid = strtoI(buf);
 sprintf(vpsname, %d, veid);
 names[got] = strdup(vpsname);
 got ++;
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] Java bindings

2008-07-18 Thread Daniel Veillard
On Fri, Jul 18, 2008 at 02:00:53PM +0100, Daniel P. Berrange wrote:
 On Fri, Jul 18, 2008 at 02:55:39PM +0200, Alejandro Berna Juan wrote:
  Hi all, I'm Alejandro Berna from i2CAT (a non-profit foundation in
  Barcelona, Spain, www.i2cat.net). I'm collaborating in a Europena project
  called Federica ( www.fp7-*federica*.eu ). One of the branch of this project
  is to permit virtualization of different hosts in the Federica test-bed. We
  are doing some studies about the different management interfaces of Xen. Our
  objective is to create a software remote client for Xen tool (in java if
  it's possible) that can do (general functionalities):
  - Create virtual machines assigning virtual interfaces.
  - Permit choose the OS assigned to this virtual machine
  - Install new applications to be tested in the virtual machines
  - Configure a vm to become a router and permit to configure this router as
  it was a physical router.
  
  All these actions have to be performed remotelly. I have not found too much
  information about libvrt but I think that can be usefull for our achieves.
  If you agree that with libvrt we can perform these actions, maybe I can
  build the java bindings for libvrt inside the Federica work. I'm waiting for
  your opinions, thank you,

  I saw your post to the Xen-API list, don't be desesperate we have a simpler
alternative, I was just waiting for you to show up here :-)

 You're in luck - we already have people working on Java bindings for
 libvirt  anyone else who has time is more than welcome to contribute
 code to improve the Java bindings. There is more information in this
 mail:
 
 http://www.redhat.com/archives/libvir-list/2008-June/msg00280.html
 
 
 We also have full authenticated, encrypted remote access to all our APIs.
 Information on this can be found here:
 
   http://libvirt.org/remote.html
   http://libvirt.org/auth.html

  I'm in the middle of preparing a 0.2.0 libvirt-java release with the
cleanup of the API. That versions should be ready for consumption, and
I will push it for example for Fedora-9 .

  Give me just 2 more hours, it should show up at
  ftp://libvirt.org/libvirt/java/

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard  | virtualization library  http://libvirt.org/
[EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] RFC? finding potential storage pool resources

2008-07-18 Thread David Lively
On Thu, 2008-07-17 at 22:42 +0100, Daniel P. Berrange wrote:
 You're not missing anything - this is a TODO item. When I wrote the
 original storage APIs, I had a prototype
 
   http://www.redhat.com/archives/libvir-list/2008-February/msg00107.html
   http://www.redhat.com/archives/libvir-list/2008-February/msg00108.html
 
  int virConnectDiscoverStoragePools(virConnectPtr conn,
   const char *hostname,
   const char *type,
   unsigned int flags,
   char ***xmlDesc);
 
 Which was intended to probe for available storage of the requested type
 (eg, LVM, vs disks, vs iSCSI targets, etc, etc), and return a list of XML
 documents describing each discovered object. This could be fed into the
 API virStoragePoolDefineXML.
 
 I didn't include this in the end, because I wasn't happy with the 
 API contract. For example, it only allows a hostname to be specified
 as metadata, but it may be desirable to include a port number as well
 for network based storage.

Thanks for the pointers.  I like your proposal, but I agree the API
contract isn't general enough (what about possible future driver
types??)  Perhaps your hostname parameter could be replaced with a
source_spec parameter which is an XML document consisting of a storage
pool source element (with entries appropriate to the given storage
pool type)?

So for network storage, you'd pass a source_spec (a string) like:
   source
 host name=foo.bar.com port=123 /
   /source

source_spec would be optional for some storage pool types, like disk
and logical.  (And if specified, it could restrict the discovery to
those sources listed??  There are scalability issues as SANs
proliferate ... even on hosts with a single HBA )

Using the storage pool source element here should essentially
guarantee this is general enough to support all storage drivers.  (If a
future storage driver requires the source XML to be extended, the
discovery API is extended in the same way.)

(I like your later hardware device enumeration API proposal too.  I'm
ignoring it for now for the sake of simplicity ...)

Dave


--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] fix lookup

2008-07-18 Thread Evgeniy Sokolov

I am often catching error related with that stoped VM has ID = -1.

1. If I create/define VM with existing ID of stoped VM. Creation failed, 
but error message is wrong. Detection is fixed.
2. Dominfo command may show info about some another VM. And report error 
that can't get autostart state.


Current patch shoud fix problems.
Index: src/openvz_driver.c
===
RCS file: /data/cvs/libvirt/src/openvz_driver.c,v
retrieving revision 1.31
diff -u -p -r1.31 openvz_driver.c
--- src/openvz_driver.c	16 Jul 2008 20:42:38 -	1.31
+++ src/openvz_driver.c	18 Jul 2008 14:41:44 -
@@ -289,7 +289,7 @@ static int openvzDomainGetInfo(virDomain
 
 static int openvzDomainShutdown(virDomainPtr dom) {
 struct openvz_driver *driver = (struct openvz_driver *)dom-conn-privateData;
-struct openvz_vm *vm = openvzFindVMByID(driver, dom-id);
+struct openvz_vm *vm = openvzFindVMByUUID(driver, dom-uuid);
 const char *prog[] = {VZCTL, --quiet, stop, vm-vmdef-name, NULL};
 
 if (!vm) {
@@ -321,7 +321,7 @@ static int openvzDomainShutdown(virDomai
 static int openvzDomainReboot(virDomainPtr dom,
   unsigned int flags ATTRIBUTE_UNUSED) {
 struct openvz_driver *driver = (struct openvz_driver *)dom-conn-privateData;
-struct openvz_vm *vm = openvzFindVMByID(driver, dom-id);
+struct openvz_vm *vm = openvzFindVMByUUID(driver, dom-uuid);
 const char *prog[] = {VZCTL, --quiet, restart, vm-vmdef-name, NULL};
 
 if (!vm) {
@@ -358,7 +358,7 @@ openvzDomainDefineXML(virConnectPtr conn
 if ((vmdef = openvzParseVMDef(conn, xml, NULL)) == NULL)
 return NULL;
 
-vm = openvzFindVMByID(driver, strtoI(vmdef-name));
+vm = openvzFindVMByName(driver, vmdef-name);
 if (vm) {
 openvzLog(OPENVZ_ERR, _(Already an OPENVZ VM active with the id '%s'),
   vmdef-name);
@@ -404,7 +404,7 @@ openvzDomainCreateLinux(virConnectPtr co
 if (!(vmdef = openvzParseVMDef(conn, xml, NULL)))
 return NULL;
 
-vm = openvzFindVMByID(driver, strtoI(vmdef-name));
+vm = openvzFindVMByName(driver, vmdef-name);
 if (vm) {
 openvzFreeVMDef(vmdef);
 openvzLog(OPENVZ_ERR,
@@ -547,7 +547,7 @@ openvzDomainGetAutostart(virDomainPtr do
 return -1;
 }
 
-if (openvzReadConfigParam(vm-vpsid , ONBOOT, value, sizeof(value))  0) {
+if (openvzReadConfigParam(strtoI(vm-vmdef-name), ONBOOT, value, sizeof(value))  0) {
 openvzError(conn, VIR_ERR_INTERNAL_ERROR, _(Cound not read container config));
 return -1;
 }
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] Release of libvirt-java-0.2.0

2008-07-18 Thread Daniel Veillard
  Okay I made a new release with the API renaming changes we discussed
previously. It is available at the usual place:
  ftp://libvirt.org/libvirt/java/

I also built it for Fedora-9, it should be available for testing there
soon too.
There is still a few issues, for example I get an out of bound exception
error when running the test.java, looks like a pointer/integer conversion
error when using the authentification callbacks (I realize i may have left
a couple of debug statement in the JNI C file there). In general I'm not sure
the jlong VDP cast trick will always work, it looks a bit unsafe but that's
an implementation detail it should not affect the API.
I tried to incorporate some solaris fixes from John Levon, but i can't
garantee it's all fixed (well not the warnings due to the VDP cast)

  So this is a good version for testing, feedback, patches and expertise
much welcome, as I'm sort of a Java newbie !

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard  | virtualization library  http://libvirt.org/
[EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] PATCH: 3/14: Generic domain XML parser/formatter

2008-07-18 Thread Jim Meyering
...
 +static virDomainChrDefPtr
 +virDomainChrDefParseXML(virConnectPtr conn,
 +xmlNodePtr node) {
 +xmlNodePtr cur;
 +char *type = NULL;
 +char *bindHost = NULL;
 +char *bindService = NULL;
 +char *connectHost = NULL;
 +char *connectService = NULL;
 +char *path = NULL;
 +char *mode = NULL;
 +char *protocol = NULL;
 +virDomainChrDefPtr def;
 +
 +if (VIR_ALLOC(def)  0) {
 +virDomainReportError(conn, VIR_ERR_NO_MEMORY, NULL);
 +return NULL;
 +}
 +
 +def-type = VIR_DOMAIN_CHR_TYPE_PTY;
 +type = virXMLPropString(node, type);
 +if (type != NULL) {

Looks like this can be replaced with virDomainChrTypeFromString.

 +if (STREQ(type, null))
 +def-type = VIR_DOMAIN_CHR_TYPE_NULL;
 +else if (STREQ(type, vc))
 +def-type = VIR_DOMAIN_CHR_TYPE_VC;
 +else if (STREQ(type, pty))
 +def-type = VIR_DOMAIN_CHR_TYPE_PTY;
 +else if (STREQ(type, dev))
 +def-type = VIR_DOMAIN_CHR_TYPE_DEV;
 +else if (STREQ(type, file))
 +def-type = VIR_DOMAIN_CHR_TYPE_FILE;
 +else if (STREQ(type, pipe))
 +def-type = VIR_DOMAIN_CHR_TYPE_PIPE;
 +else if (STREQ(type, stdio))
 +def-type = VIR_DOMAIN_CHR_TYPE_STDIO;
 +else if (STREQ(type, udp))
 +def-type = VIR_DOMAIN_CHR_TYPE_UDP;
 +else if (STREQ(type, tcp))
 +def-type = VIR_DOMAIN_CHR_TYPE_TCP;
 +else if (STREQ(type, unix))
 +def-type = VIR_DOMAIN_CHR_TYPE_UNIX;
 +else
 +def-type = VIR_DOMAIN_CHR_TYPE_NULL;
 +}

Otherwise, all looks good.

ACK

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH]: Add floppy support to xm_internal

2008-07-18 Thread John Levon
On Fri, Jul 18, 2008 at 02:05:06PM +0200, Chris Lalancette wrote:

 What this actually means is that we shouldn't parse the floppy stuff to put it
 in the disks = section of the /etc/xen configuration file, since it doesn't
 have meaning there.  Instead, floppy disks go at the top-level of a Xen config
 file, like:

Hmm, is your patch so complicated just because you have to support
/etc/xen .py style output on your old Xen versions?

Our version of this patch is just:

diff --git a/src/xml.c b/src/xml.c
--- libvirt-0.4.0/src/xml.c
+++ libvirt-0.4.0/src/xml.c
@@ -1292,8 +1292,20 @@ virDomainParseXMLDiskDesc(virConnectPtr 
 
 /* Xend (all versions) put the floppy device config
  * under the hvm (image (os)) block
+ *
+ *  (image
+ *  (hvm
+ *  (fda file)
+ *  )
+ *  )
  */
 if (hvm  device  !strcmp((const char *) device, floppy)) {
+virBufferAdd(buf, (image , 7);
+virBufferAdd(buf, (hvm , 5);
+virBufferVSprintf(buf, (%s %s), (const char *) target,
+(const char *) source);
+virBufferAdd(buf, ), 1);
+virBufferAdd(buf, ), 1);
 goto cleanup;
 }
 

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH]: Add floppy support to xm_internal

2008-07-18 Thread Daniel P. Berrange
On Fri, Jul 18, 2008 at 05:31:27PM +0100, John Levon wrote:
 On Fri, Jul 18, 2008 at 02:05:06PM +0200, Chris Lalancette wrote:
 
  What this actually means is that we shouldn't parse the floppy stuff to put 
  it
  in the disks = section of the /etc/xen configuration file, since it 
  doesn't
  have meaning there.  Instead, floppy disks go at the top-level of a Xen 
  config
  file, like:
 
 Hmm, is your patch so complicated just because you have to support
 /etc/xen .py style output on your old Xen versions?

Yep, we need both cases in fact - the SEXPR stuff you show below
for creating live domains, or inactive domains on Xen  3.0.4. Or
the stuff Chris does is just for inactive domains on Xen  3.0.4
in /etc/xen style format.

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

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] Libvirtd default.xml (in qemu/networks/autostart) breaks XEN

2008-07-18 Thread Daniel P. Berrange
On Fri, Jul 18, 2008 at 01:13:30PM +0100, Daniel P. Berrange wrote:
 On Fri, Jul 18, 2008 at 12:33:22PM +0200, Stefan de Konink wrote:
  The desire to automatically install the autostarted network configuration
  of libvirt broke my (and some other users on xen-users) setup. I suggest
  to *remove* this network configuration as default and *not* put it into
  xenstore as a stateful config.
  
  *It does not work by default*
 
 It works just fine by default. If anything is breaking networking it is
 XenD.

You don't mention which version of Xen you have, but make sure you have
this changeset in it..

[quote]
changeset:   16625:44a98411d230
user:Keir Fraser [EMAIL PROTECTED]
date:Sat Dec 15 18:26:52 2007 +
files:   tools/python/xen/xend/XendNetwork.py
description:
xend: Prevent XenD touching externally managed bridges

With current XenD 3.0.4 or later try the following:

brctl addbr demo
ifconfig demo up

/etc/init.d/xend start
/etc/init.d/xend stop

ifconfig demo down
brctl delbr demo

Now, start XenD again

/etc/init.d/xend start

And watch in horror as it re-creates your 'demo' bridge.

The problem is that the 'XendNetwork' class does not distinguish
between bridge devices that it is managing (ie those created via
XenAPI) and those which it does not manage (ie those created by OS
distro init scripts, or by apps like  libvirt).

While initially I thought I could just make XenD ignore
externally-managed bridges completely, it seems to needs to know about
them otherwise it can't hook up guest VIFs to them correctly. So the
attached patch adds a 'managed' flag to the XendNetwork
class. Externally managed bridges have this set to False. At startup
XenD will now only re-create bridge devices which have the 'managed'
flag set to 'True'  - ie those created via XenAPI.

Signed-off-by: Daniel P. Berrange [EMAIL PROTECTED]
[/quote]


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

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] parse container id in separate function

2008-07-18 Thread Daniel P. Berrange
On Fri, Jul 18, 2008 at 06:02:00PM +0400, Evgeniy Sokolov wrote:
 There were several places with parsing container id from code.
 Separate function is used now.

 Index: src/openvz_conf.c
 ===
 RCS file: /data/cvs/libvirt/src/openvz_conf.c,v
 retrieving revision 1.29
 diff -u -p -r1.29 openvz_conf.c
 --- src/openvz_conf.c 11 Jul 2008 08:56:16 -  1.29
 +++ src/openvz_conf.c 18 Jul 2008 13:21:07 -
 @@ -134,9 +134,7 @@ strtoI(const char *str)
  val = (int) strtol(str, endptr, base);
  
  /* Check for various possible errors */
 -if ((endptr == str) /* No digits were found */
 -||((*endptr != '\0')
 - (*endptr != ' ')) /*Name contain characters other than 
 integers */ )
 +if (endptr == str) /* No digits were found */
  return 0;
  return val;
  }

I'd not noticed this function before, but it looks like you could
probably just call virStrToLong_i() from the util.h file.

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

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] fix lookup

2008-07-18 Thread Daniel P. Berrange
On Fri, Jul 18, 2008 at 07:01:33PM +0400, Evgeniy Sokolov wrote:
 I am often catching error related with that stoped VM has ID = -1.
 
 1. If I create/define VM with existing ID of stoped VM. Creation failed, 
 but error message is wrong. Detection is fixed.
 2. Dominfo command may show info about some another VM. And report error 
 that can't get autostart state.
 
 Current patch shoud fix problems.

ACK looks OK to me.

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

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] virStorageVolCreateXML vs virStorageVolCloneXML

2008-07-18 Thread Stefan de Konink

Daniel P. Berrange schreef:

On Fri, Jul 18, 2008 at 12:27:49PM +0200, Stefan de Konink wrote:

Hi,

There is currently no implementation in the api to clone snapshots or
images. I wonder if we could add an XML node to specify a backed device.
Or add a new function that allows to clone.


I think this wants to be done with a new API, taking a source volume,
and destination pool as the arguemnts. Something along the lines of


virStorageVolClone(virStorageVolPtr src,
   virStoragePoolPtr dst,
   unsigned int flags);


It looks pretty indeed. I'll try if I can implement this.


Stefan

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] Libvirtd default.xml (in qemu/networks/autostart) breaks XEN

2008-07-18 Thread Daniel P. Berrange
On Fri, Jul 18, 2008 at 08:15:20PM +0200, Stefan de Konink wrote:
 Daniel P. Berrange schreef:
 On Fri, Jul 18, 2008 at 12:33:22PM +0200, Stefan de Konink wrote:
 The desire to automatically install the autostarted network configuration
 of libvirt broke my (and some other users on xen-users) setup. I suggest
 to *remove* this network configuration as default and *not* put it into
 xenstore as a stateful config.
 
 *It does not work by default*
 
 It works just fine by default. If anything is breaking networking it is
 XenD.
 
 The default is xenbr0... and since xend is still required for all 
 operations, it is a bit strange to claim it breaks itself...

The 'default' is whatever your management app decides is the default
(if any), which has nothing todo with what XenD creates  by default.
virt-install will default to the bridge associated with the default
route, if none is found it'll use the first libvirt virtual network
it finds. Fedora does not create 'xenbr0' in a standard install so
the virbr0 will always be used unless the admin has configured full
bridging. Even if the admin has got bridging configured, the prescence
of virbr0 does not impact that functionality.

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

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] configure.in: make --with-xen-distdir work for 64bit xen too

2008-07-18 Thread David Lively
Currently running autogen.sh with --with-xen-distdir=something fails to
find libxenstore if there's only a 64-bit version, and subsequently
fails to enable xen support (i.e., ends up with WITH_XEN=0).  This
one-line patch fixes that by telling it to search both lib and lib64.

I guess it would be better to search only the appropriate directory (lib
OR lib64) rather than both, but I'm not sure (being an autoconf-dummy)
how to ask about the target architecture.

Dave

 configure.in |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


[diffs: repository libvirt]
diff --git a/configure.in b/configure.in
index 4b9669f..8e04f14 100644
--- a/configure.in
+++ b/configure.in
@@ -235,7 +235,7 @@ AC_ARG_WITH([xen-distdir], [AC_HELP_STRING([--with-xen-distdir=path],
 if test x$with_xen_distdir != x
 then
 CPPFLAGS=$CPPFLAGS -I$withval/install/usr/include
-LDFLAGS=$LDFLAGS -L$withval/install/usr/lib
+LDFLAGS=$LDFLAGS -L$withval/install/usr/lib -L$withval/install/usr/lib64
 fi
 
 LIBVIRT_FEATURES=
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] ruby-libvirt on debian based systems

2008-07-18 Thread Tom Verhaeghe
Hello

I don't know if ruby-libvirt can work in a debian-based environment.  I
installed kvm, libvirt, RoR, etc on Ubuntu and it all works fine.

I pasted the output when installing the gem below.  I think the problem
could be that libvirt is called differently in Ubuntu or stored on a
different location.  Is there a way to get around?

Thanks in advance

Tom

Building native extensions.  This could take a while...
ERROR:  While executing gem ... (RuntimeError)
Error instaling ruby-libvirt-0.0.7.gem:
ERROR: Failed to build gem native extension.

ruby extconf.rb install ruby-libvirt-0.0.7.gem
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby1.8
--with-_libvirt-dir
--without-_libvirt-dir
--with-_libvirt-include
--without-_libvirt-include=${_libvirt-dir}/include
--with-_libvirt-lib
--without-_libvirt-lib=${_libvirt-dir}/lib
--with-libvirt-config
--without-libvirt-config
--with-pkg-config
--without-pkg-config
extconf.rb:16: libvirt not found (RuntimeError)


Gem files will remain installed in /var/lib/gems/1.8/gems/ruby-libvirt-0.0.7
for inspection.
Results logged to
/var/lib/gems/1.8/gems/ruby-libvirt-0.0.7/ext/libvirt/gem_make.out
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list