Re: [libvirt] [PATCH] fix compilation for MinGW (with LXC)

2008-07-28 Thread Richard W.M. Jones
On Fri, Jun 27, 2008 at 11:25:59AM +0900, Atsushi SAKAI wrote:
 May I commit this patch for MinGW compilation?

I'm trying to get a MinGW cross-compiler into Fedora.  This
should help matters in two ways: firstly it means we can do
automated nightly builds which should find problems like this
early, and secondly it means we'll be able to offer Windows
binaries on the site.

If anyone is interested, please express your interest here:

http://fedoraproject.org/wiki/SIGs/MinGW

There are some packages here:

http://hg.et.redhat.com/misc/fedora-mingw--devel/

Rich.

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


Re: [libvirt] [PATCH]: qemu_driver: convert uuid to string in error messages

2008-07-28 Thread Daniel Veillard
On Fri, Jul 25, 2008 at 04:09:31PM -0400, Guido Günther wrote:
 [PATCH] also check domain uuid on create
 
 and don't care if domain is active or not - it confuses users both ways

  Okay, that looks reasonnable to me, applied and commited,

   thanks !

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] OpenVZ xml refactoring

2008-07-28 Thread Evgeniy Sokolov



On Fri, Jul 25, 2008 at 04:44:09PM +0400, Evgeniy Sokolov wrote:

Patch switch OpenVZ XML format to generic.
main changes:
- I used generic virDomainNetDef to define network in container.
  And wrote function to apply virDomainNetDef for container.
  Method virDomainNetDefParseXML is public now.
- tag container is changed to devices
- changed format of tag filesystem
- added processing vcpu tag.


  Generally looks fine to me, just a few remarks


+/* Parse filesystem section
+Sample:
+filesystem type=template
+  source name=fedora-core-5-i386/
+  quota type=size max=1/
+  quota type=inodes max=100/
+/filesystem
+*/
+static int openvzParseDomainFS(virConnectPtr conn,
+   struct openvz_fs_def *fs,
+   xmlXPathContextPtr ctxt)
+{
+xmlNodePtr cur, obj;
+char *type;
+
+obj = virXPathNode(/domain/devices/filesystem[1], ctxt);
+if (obj == NULL) {
+openvzError(conn, VIR_ERR_INTERNAL_ERROR,
+   _(missing filesystem tag));
+return -1;
+}


  hum, maybe use virXPathNodeSet and checking you won't get more than one ?

good idea! done



 /* Extract domain uuid */
-obj = xmlXPathEval(BAD_CAST string(/domain/uuid[1]), ctxt);
-if ((obj == NULL) || (obj-type != XPATH_STRING) ||
-(obj-stringval == NULL) || (obj-stringval[0] == 0)) {
+prop = virXPathString(string(./uuid[1]), ctxt);
+if (!prop) {
 int err;


  Hum, if you start using relative XPath queries like that it's a good idea
to make sure ctxt-node is set to the node you're starting the lookup from
I don't see that in the patch, maybe I missed it...

Yes, you found bug. Fixed now. Thanks!



+} else {
+if (virUUIDParse(prop, def-uuid)  0) {
+openvzError(conn, VIR_ERR_INTERNAL_ERROR,
+_(malformed uuid element));
+goto bail_out;
+}
+VIR_FREE(prop);


[...]

+//TODO: processing NAT and phisical device


  typo physical :-)

  In general that looks way cleaner to me,
I will give it a few nmore days and apply, unless you suggest another version,


fixed patch is attached.

Index: src/domain_conf.c
===
RCS file: /data/cvs/libvirt/src/domain_conf.c,v
retrieving revision 1.5
diff -u -p -r1.5 domain_conf.c
--- src/domain_conf.c	19 Jul 2008 07:42:34 -	1.5
+++ src/domain_conf.c	28 Jul 2008 13:20:10 -
@@ -633,7 +633,7 @@ static void virDomainNetRandomMAC(virDom
  * @param node XML nodeset to parse for net definition
  * @return 0 on success, -1 on failure
  */
-static virDomainNetDefPtr
+virDomainNetDefPtr
 virDomainNetDefParseXML(virConnectPtr conn,
 xmlNodePtr node) {
 virDomainNetDefPtr def;
Index: src/domain_conf.h
===
RCS file: /data/cvs/libvirt/src/domain_conf.h,v
retrieving revision 1.1
diff -u -p -r1.1 domain_conf.h
--- src/domain_conf.h	11 Jul 2008 16:23:36 -	1.1
+++ src/domain_conf.h	28 Jul 2008 13:20:10 -
@@ -472,6 +472,9 @@ int virDomainLoadAllConfigs(virConnectPt
 int virDomainDeleteConfig(virConnectPtr conn,
   virDomainObjPtr dom);
 
+virDomainNetDefPtr virDomainNetDefParseXML(virConnectPtr conn,
+xmlNodePtr node);
+
 VIR_ENUM_DECL(virDomainVirt)
 VIR_ENUM_DECL(virDomainBoot)
 VIR_ENUM_DECL(virDomainFeature)
Index: src/openvz_conf.c
===
RCS file: /data/cvs/libvirt/src/openvz_conf.c,v
retrieving revision 1.30
diff -u -p -r1.30 openvz_conf.c
--- src/openvz_conf.c	21 Jul 2008 13:34:19 -	1.30
+++ src/openvz_conf.c	28 Jul 2008 13:20:12 -
@@ -56,6 +56,8 @@
 #include buf.h
 #include memory.h
 #include util.h
+#include xml.h
+#include domain_conf.h
 
 static char *openvzLocateConfDir(void);
 static struct openvz_vm_def *openvzParseXML(virConnectPtr conn, xmlDocPtr xml);
@@ -136,6 +138,34 @@ strtoI(const char *str)
 return val;
 }
 
+/* function checks MAC address is empty
+   return 0 - empty
+  1 - not
+*/
+int openvzCheckEmptyMac(const unsigned char *mac)
+{
+int i;
+for (i = 0; i  VIR_DOMAIN_NET_MAC_SIZE; i++)
+if (mac[i] != 0x00)
+return 1;
+
+return 0;
+}
+
+/* convert mac address to string
+   return pointer to string or NULL
+*/
+char *openvzMacToString(const unsigned char *mac)
+{
+char str[20];
+if (snprintf(str, 18, %02X:%02X:%02X:%02X:%02X:%02X,
+  mac[0], mac[1], mac[2],
+  mac[3], mac[4], mac[5]) = 18)
+return NULL;
+
+return strdup(str);
+}
+
 void
 openvzRemoveInactiveVM(struct openvz_driver *driver, struct openvz_vm *vm)
 {
@@ -148,30 +178,7 @@ void
 openvzFreeVMDef(struct openvz_vm_def *def)
 {
 if (def) {
-struct ovz_quota *quota = def-fs.quota;
-struct ovz_ip *ip = def-net.ips;
- 

Re: [libvirt] [PATCH] OpenVZ xml refactoring

2008-07-28 Thread Daniel Veillard
On Mon, Jul 28, 2008 at 05:38:47PM +0400, Evgeniy Sokolov wrote:
 
 On Fri, Jul 25, 2008 at 04:44:09PM +0400, Evgeniy Sokolov wrote:
   In general that looks way cleaner to me,
 I will give it a few nmore days and apply, unless you suggest another 
 version,
 
 fixed patch is attached.

  Okay, I applied and commited this because it enforces the transition to
the new XML format for OpenVZ and any such change should be done as soon
as possible. But Dan's point remain, we need to transition to the new 
reading routines, and virDomainNetDefParseXML will have to be made static
again when done. But as I understand you agree with this so it's just an
intermediate state of the code :-) 

  thanks a lot !

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


[libvirt] [PATCH] Fix logical storage pool operation on SLES10-SP2

2008-07-28 Thread David Lively
The attached patch adjusts for a difference in behavior in the LVM
utilities 'lvs' and 'vgs'.  The SLES10-SP2 versions of these (and
presumably others) append a trailing separator.  This patch simply
adjusts the regexps to allow (but not require) this.

I thought just adding the :? to the regexps would do this, but this
was leaving the trailing separator in the last group match, so I ended
up tweaking the preceding group pattern as well.

Dave

commit 021470f5cfa0e770f09c73cf8a2fc270121378f6
Author: David Lively [EMAIL PROTECTED]
Date:   Mon Jul 28 15:05:30 2008 -0400

Some distros' (e.g. SLES10-SP2) lvm utilities (lvs, vgs) put the specified
separator at the end of each input line.  Adjusted the regexes used by the
logical storage backend to allow this.

Signed-off-by: David Lively [EMAIL PROTECTED]

diff --git a/src/storage_backend_logical.c b/src/storage_backend_logical.c
index 674a74f..52e645b 100644
--- a/src/storage_backend_logical.c
+++ b/src/storage_backend_logical.c
@@ -201,9 +201,11 @@ virStorageBackendLogicalFindLVs(virConnectPtr conn,
  * Pull out name  uuid, device, device extent start #, segment size, extent size.
  *
  * NB can be multiple rows per volume if they have many extents
+ *
+ * NB lvs from some distros (e.g. SLES10 SP2) outputs trailing : on each line
  */
 const char *regexes[] = {
-^\\s*(\\S+):(\\S+):(\\S+)\\((\\S+)\\):(\\S+):(\\S+)\\s*$
+^\\s*(\\S+):(\\S+):(\\S+)\\((\\S+)\\):(\\S+):([0-9]+):?\\s*$
 };
 int vars[] = {
 6
@@ -442,9 +444,11 @@ virStorageBackendLogicalRefreshPool(virConnectPtr conn,
  *10603200512:4328521728
  *
  * Pull out size  free
+ *
+ * NB vgs from some distros (e.g. SLES10 SP2) outputs trailing : on each line
  */
 const char *regexes[] = {
-^\\s*(\\S+):(\\S+)\\s*$
+^\\s*(\\S+):([0-9]+):?\\s*$
 };
 int vars[] = {
 2
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] Libvir on Hardy: file a bug or not?

2008-07-28 Thread Mihamina Rakotomandimby (R12y)

Hi,
I am using Ubuntu Hardy up to date.

When defining a domain with:
domain type='kvm' id='1'
  namexp/name
  uuiddd4618e5-1c48-a481-0671-d75f38f59037/uuid
  memory524288/memory
  currentMemory524288/currentMemory
  vcpu1/vcpu
  os
type arch='x86_64' machine='pc'hvm/type
boot dev='hd'/
  /os
  clock offset='localtime'/
  on_poweroffdestroy/on_poweroff
  on_rebootdestroy/on_reboot
  on_crashdestroy/on_crash
  devices
emulator/usr/bin/qemu-system-x86_64/emulator
disk type='file' device='cdrom'
  source file='/home/mihamina/xpjohnny.iso'/
  target dev='hdc' bus='ide'/
  readonly/
/disk
disk type='file' device='disk'
  source file='/home/mihamina/xp.img'/
  target dev='hda' bus='ide'/
/disk
interface type='bridge'
  mac address='00:16:3e:1e:b2:22'/
  source bridge='br0'/
  target dev='vnet1'/
/interface
input type='tablet' bus='usb'/
input type='mouse' bus='ps2'/
graphics type='vnc' port='5900' listen='127.0.0.1'/
  /devices
/domain

I get:

 virsh # start xp
 libvir: QEMU error : QEMU quit during console startup
 qemu: unknowm parameter 'boot' in
'file=/home/mihamina/xp.img,if=ide,boot=on'
 error: Failed to start domain xp

If I change the domain type with qemu, I have no error (and the
virtual machine starts without any problem.

This is my installed things:

$ dpkg -l | awk '/(virt|qemu|kvm)/{print $2,$3}'
kvm 1:62+dfsg-0ubuntu8
libvirt-bin 0.4.0-2ubuntu8
libvirt0 0.4.0-2ubuntu8
python-libvirt 0.4.0-2ubuntu8
python-virtinst 0.300.2-0ubuntu6
python-virtkey 0.50ubuntu0.1
qemu 0.9.1-1ubuntu1
virt-manager 0.5.3-0ubuntu10
virt-viewer 0.0.2-1ubuntu1

Is it an upstream bug or a distribution bug?
Who is supposed to be noticed? The packager or the upstream (where please)?

PS: I wrote because I saw
http://www.mail-archive.com/libvir-list@redhat.com/msg06109.html


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