Re: [libvirt] cannot start a qemu64 model on an Intel host

2010-01-06 Thread Jiri Denemark
 If I specify
 
 cpu match=exact
 modelqemu64/model
 /cpu
 
 according to the new cpu schema, I get
 error: internal error guest CPU is not compatible with host CPU
 because qemu64 supports svm, and my host does not.
 
 However, the error remains when I explicitly ask to disable svm with
 feature policy=disable name=svm/
 
 I am not sure if this is a bug or an intended feature, but I'd expect
 cpu_disable taken into account when doing
 x86ModelCompare(host_model, cpu_require)

It is a bug. There's no sense in checking features which will be disabled
anyway.

Thanks for reporting.


Jirka

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


Re: [libvirt] [PATCH] [RFC] xen domctl version 6

2010-01-06 Thread Daniel Veillard
On Wed, Dec 23, 2009 at 10:59:09AM -0700, Jim Fehlig wrote:
 xen-unstable c/s 20685 changed the domctl interface, adding a field to
 xen_domctl_getdomaininfo structure.  This additional field causes stack
 corruption in libvirt.  xen-unstable c/s 20711 rightly bumped the domctl
 interface version so it is at least possible to handle the new field.
 
 The attached patch accounts for shr_pages field added to
 xen_domctl_getdomaininfo structure.  I'm not thrilled about the changes
 to all the macros - suggestions for improvement welcomed.
 
 Tested with domctl version 5 and 6.

  Yeah, we don't really have much choice there I think, but I would
make the macros a bit more forward optimistic, i.e replacing

  (dom_interface_version == 6 ?

with

  (dom_interface_version = 6 ?

if there is a new bump, the call should not fail because we didn't
updated all the macros.

  otherwise looks fine, ACK to a new patch with this,

Daniel

 Index: libvirt-0.7.4/src/xen/xen_hypervisor.c
 ===
 --- libvirt-0.7.4.orig/src/xen/xen_hypervisor.c
 +++ libvirt-0.7.4/src/xen/xen_hypervisor.c
 @@ -215,10 +215,26 @@ struct xen_v2d5_getdomaininfo {
  };
  typedef struct xen_v2d5_getdomaininfo xen_v2d5_getdomaininfo;
  
 +struct xen_v2d6_getdomaininfo {
 +domid_t  domain; /* the domain number */
 +uint32_t flags;  /* flags, see before */
 +uint64_t tot_pages ALIGN_64; /* total number of pages used */
 +uint64_t max_pages ALIGN_64; /* maximum number of pages allowed */
 +uint64_t shr_pages ALIGN_64;/* number of shared pages */
 +uint64_t shared_info_frame ALIGN_64; /* MFN of shared_info struct */
 +uint64_t cpu_time ALIGN_64;  /* CPU time used */
 +uint32_t nr_online_vcpus;  /* Number of VCPUs currently online. */
 +uint32_t max_vcpu_id; /* Maximum VCPUID in use by this domain. */
 +uint32_t ssidref;
 +xen_domain_handle_t handle;
 +};
 +typedef struct xen_v2d6_getdomaininfo xen_v2d6_getdomaininfo;
 +
  union xen_getdomaininfo {
  struct xen_v0_getdomaininfo v0;
  struct xen_v2_getdomaininfo v2;
  struct xen_v2d5_getdomaininfo v2d5;
 +struct xen_v2d6_getdomaininfo v2d6;
  };
  typedef union xen_getdomaininfo xen_getdomaininfo;
  
 @@ -226,6 +242,7 @@ union xen_getdomaininfolist {
  struct xen_v0_getdomaininfo *v0;
  struct xen_v2_getdomaininfo *v2;
  struct xen_v2d5_getdomaininfo *v2d5;
 +struct xen_v2d6_getdomaininfo *v2d6;
  };
  typedef union xen_getdomaininfolist xen_getdomaininfolist;
  
 @@ -263,114 +280,147 @@ typedef struct xen_v2s5_availheap  xen_v
  #define XEN_GETDOMAININFOLIST_ALLOC(domlist, size)  \
  (hypervisor_version  2 ?   \
   (VIR_ALLOC_N(domlist.v0, (size)) == 0) :   \
 - (dom_interface_version  5 ?   \
 -  (VIR_ALLOC_N(domlist.v2, (size)) == 0) :  \
 -  (VIR_ALLOC_N(domlist.v2d5, (size)) == 0)))
 + (dom_interface_version == 6 ?  \
 +  (VIR_ALLOC_N(domlist.v2d6, (size)) == 0) :\
 + (dom_interface_version == 5 ?  \
 +  (VIR_ALLOC_N(domlist.v2d5, (size)) == 0) :\
 +  (VIR_ALLOC_N(domlist.v2, (size)) == 0
  
  #define XEN_GETDOMAININFOLIST_FREE(domlist)\
  (hypervisor_version  2 ?  \
   VIR_FREE(domlist.v0) :\
 - (dom_interface_version  5 ?  \
 -  VIR_FREE(domlist.v2) :   \
 -  VIR_FREE(domlist.v2d5)))
 + (dom_interface_version == 6 ? \
 +  VIR_FREE(domlist.v2d6) : \
 + (dom_interface_version == 5 ? \
 +  VIR_FREE(domlist.v2d5) : \
 +  VIR_FREE(domlist.v2
  
  #define XEN_GETDOMAININFOLIST_CLEAR(domlist, size)\
  (hypervisor_version  2 ? \
   memset(domlist.v0, 0, sizeof(*domlist.v0) * size) :  \
 - (dom_interface_version  5 ? \
 -  memset(domlist.v2, 0, sizeof(*domlist.v2) * size) : \
 -  memset(domlist.v2d5, 0, sizeof(*domlist.v2d5) * size)))
 + (dom_interface_version == 6 ?\
 +  memset(domlist.v2d6, 0, sizeof(*domlist.v2d6) * size) : \
 + (dom_interface_version == 5 ?\
 +  memset(domlist.v2d5, 0, sizeof(*domlist.v2d5) * size) : \
 +  memset(domlist.v2, 0, sizeof(*domlist.v2) * size
  
  #define XEN_GETDOMAININFOLIST_DOMAIN(domlist, n)\
  (hypervisor_version  2 ?   \
   domlist.v0[n].domain : \
 - (dom_interface_version  5 ?   \
 -  domlist.v2[n].domain :  

[libvirt] iptables rules location

2010-01-06 Thread Mihamina Rakotomandimby
Manao ahoana, Hello, Bonjour,

When starting libvirt there are some iptables  rules setup.
I would like to know where are they stored (and the filename, I use
ubuntu package, need to 'find' or 'locate'). 

Misaotra, Thanks, Merci.

-- 
   Architecte Informatique chez Blueline/Gulfsat:
Administration Systeme, Recherche  Developpement
+261 34 29 155 34 / +261 33 11 207 36

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


Re: [libvirt] iptables rules location

2010-01-06 Thread Daniel P. Berrange
On Wed, Jan 06, 2010 at 01:21:49PM +0300, Mihamina Rakotomandimby wrote:
 Manao ahoana, Hello, Bonjour,
 
 When starting libvirt there are some iptables  rules setup.
 I would like to know where are they stored (and the filename, I use
 ubuntu package, need to 'find' or 'locate'). 

They're not stored anywhere - they're adding when starting a libvirt
virtual network

If you do 'virsh net-list' you'll see which network was responsible
to adding the ones you currently see.  'virsh net-destroy' stops a
network, and removes the iptables rules, while 'virsh net-start'
starts a network, adding the rules

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] don't test res == NULL after we've already dereferenced it

2010-01-06 Thread Jim Meyering
As the log says, once we've dereferenced it,
there's no point in comparing to NULL.

From 463eaf1027a154e71839a67eca85b3ada8b817ff Mon Sep 17 00:00:00 2001
From: Jim Meyering meyer...@redhat.com
Date: Wed, 6 Jan 2010 12:45:07 +0100
Subject: [PATCH] don't test res == NULL after we've already dereferenced it

* src/xen/proxy_internal.c (xenProxyCommand): It is known to be
non-NULL at that point, so remove the ret == NULL guard, and
instead add an assert(ret != NULL), in case future code changes
cause the condition to becomes false.
Include assert.h.
---
 src/xen/proxy_internal.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/xen/proxy_internal.c b/src/xen/proxy_internal.c
index ec4522b..42b6e91 100644
--- a/src/xen/proxy_internal.c
+++ b/src/xen/proxy_internal.c
@@ -1,7 +1,7 @@
 /*
  * proxy_client.c: client side of the communication with the libvirt proxy.
  *
- * Copyright (C) 2006, 2008, 2009 Red Hat, Inc.
+ * Copyright (C) 2006, 2008, 2009, 2010 Red Hat, Inc.
  *
  * See COPYING.LIB for the License of this software
  *
@@ -11,6 +11,7 @@
 #include config.h

 #include stdio.h
+#include assert.h
 #include stdlib.h
 #include unistd.h
 #include errno.h
@@ -444,7 +445,8 @@ retry:
 /*
  * do more checks on the incoming packet.
  */
-if ((res == NULL) || (res-version != PROXY_PROTO_VERSION) ||
+assert (res != NULL);
+if ((res-version != PROXY_PROTO_VERSION) ||
 (res-len  sizeof(virProxyPacket))) {
 virProxyError(conn, VIR_ERR_INTERNAL_ERROR, %s,
   _(Communication error with proxy: malformed packet\n));
--
1.6.6.387.g2649b1

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


[libvirt] [PATCH] xend_internal: don't let invalid input provoke NULL dereference

2010-01-06 Thread Jim Meyering
If there's a good reason to test for NULL conn, then
we certainly must not dereference conn before that point.

This assumes we do want to retain the NULL test.
Note that many other functions perform this same test.

From 2c7b628728efcb5a59c1e7aa1cba763f5ef0045a Mon Sep 17 00:00:00 2001
From: Jim Meyering meyer...@redhat.com
Date: Wed, 6 Jan 2010 12:59:21 +0100
Subject: [PATCH] xend_internal: don't let invalid input provoke NULL dereference

* src/xen/xend_internal.c (xenDaemonOpen_unix): Do not dereference
a NULL conn.  Move first deref to follow the conn == NULL test.
---
 src/xen/xend_internal.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index 827aac4..be033f5 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -748,11 +748,12 @@ int
 xenDaemonOpen_unix(virConnectPtr conn, const char *path)
 {
 struct sockaddr_un *addr;
-xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) conn-privateData;
+xenUnifiedPrivatePtr priv;

 if ((conn == NULL) || (path == NULL))
 return (-1);

+priv = (xenUnifiedPrivatePtr) conn-privateData;
 memset(priv-addr, 0, sizeof(priv-addr));
 priv-addrfamily = AF_UNIX;
 /*
--
1.6.6.387.g2649b1

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


[libvirt] [ PATCH ] fix multiple veth problem for OpenVZ

2010-01-06 Thread Yuji NISHIDA
Dear all

This is to fix multiple veth problem.
NETIF setting was overwritten after first CT because any CT could not be found 
by character name.


---
 src/openvz/openvz_conf.c   |   38 ++
 src/openvz/openvz_conf.h   |1 +
 src/openvz/openvz_driver.c |2 +-
 3 files changed, 40 insertions(+), 1 deletions(-)

diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index 43bbaf2..9fb9f7e 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -948,3 +948,41 @@ static int openvzAssignUUIDs(void)
 VIR_FREE(conf_dir);
 return 0;
 }
+
+
+/*
+ * Return CTID from name
+ *
+ */
+
+int openvzGetVEID(char *name) {
+
+char cmd[64];
+int veid;
+FILE *fp;
+
+strcpy( cmd, VZLIST );
+strcat( cmd,   );
+strcat( cmd, name );
+strcat( cmd,  -ovpsid -H );
+
+if ((fp = popen(cmd, r)) == NULL) {
+openvzError(NULL, VIR_ERR_INTERNAL_ERROR, %s, _(popen failed));
+return -1;
+}
+
+if (fscanf(fp, %d\n, veid ) != 1) {
+if (feof(fp))
+return -1;
+
+openvzError(NULL, VIR_ERR_INTERNAL_ERROR,
+%s, _(Failed to parse vzlist output));
+goto cleanup;
+}
+
+return veid;
+
+ cleanup:
+fclose(fp);
+return -1;
+}
diff --git a/src/openvz/openvz_conf.h b/src/openvz/openvz_conf.h
index 00e18b4..518c267 100644
--- a/src/openvz/openvz_conf.h
+++ b/src/openvz/openvz_conf.h
@@ -66,5 +66,6 @@ void openvzFreeDriver(struct openvz_driver *driver);
 int strtoI(const char *str);
 int openvzSetDefinedUUID(int vpsid, unsigned char *uuid);
 unsigned int openvzGetNodeCPUs(void);
+int openvzGetVEID(char *name);
 
 #endif /* OPENVZ_CONF_H */
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 196fd8c..879b5d0 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -667,7 +667,7 @@ openvzDomainSetNetwork(virConnectPtr conn, const char 
*vpsid,
 if (net-type == VIR_DOMAIN_NET_TYPE_BRIDGE) {
 virBuffer buf = VIR_BUFFER_INITIALIZER;
 char *dev_name_ve;
-int veid = strtoI(vpsid);
+int veid = openvzGetVEID(vpsid);
 
 //--netif_add ifname[,mac,host_ifname,host_mac]
 ADD_ARG_LIT(--netif_add) ;
-- 
1.5.2.2

-
Yuji Nishida
nish...@nict.go.jp


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


Re: [libvirt] [virt-tools-list] Questions about virt-manager running on Arch of Itanium 64

2010-01-06 Thread Cole Robinson
On 01/04/2010 08:27 PM, Dustin Xiong wrote:
 
 
  
 
 Date: Mon, 4 Jan 2010 11:46:06 -0500
 From: crobi...@redhat.com
 To: x_k_...@hotmail.com
 CC: berra...@redhat.com; libvirt-l...@redhat.com
 Subject: Re: [libvirt] [virt-tools-list] Questions about virt-manager 
 running on Arch of Itanium 64

 On 12/25/2009 03:48 AM, Dustin Xiong wrote:

 If i want to update qemu_conf.c to handle ia64 , which files or 
 datastruct needs to update ? Only the qemu_conf.c ?

 If you search for the table 

 static const struct qemu_arch_info const arch_info_hvm[] = {

 It is probably (hopefully?) sufficient to just add 

 { ia64, 64, NULL, /usr/bin/qemu-system-ia64, NULL, NULL, 0 },

 The key test is that when you later run

 virsh capabilities

 it should show the /usr/bin/qemu-system-ia64 binary, and also report that
 KVM is present. 

 I have a feeling you might also need to add code to the src/nodeinfo.c
 file, since I think that /proc/cpuinfo on ia64 is in a different format
 to that on x86_64. ie, change the linuxNodeInfoCPUPopulate() method so
 it can also parse the ia64 format. This is used by the command

 virsh nodeinfo


 So once 'capabilities' and 'nodeinfo' are working on ia64, then it should
 be possible to use virt-manager properly

 I modify the src, and build it to rpm. The libvirt could work.

 And as you said, i add ia64 info into the qemu_conf.c. The result as below:



 [r...@kvm bin]# virsh capabilities
 capabilities

 host
 cpu
 archia64/arch
 /cpu
 topology
 cells num='1'
 cell id='0'
 cpus num='16'
 cpu id='0'/
 cpu id='1'/
 cpu id='2'/
 cpu id='3'/
 cpu id='4'/
 cpu id='5'/
 cpu id='6'/
 cpu id='7'/
 cpu id='8'/
 cpu id='9'/
 cpu id='10'/
 cpu id='11'/
 cpu id='12'/
 cpu id='13'/
 cpu id='14'/
 cpu id='15'/
 /cpus
 /cell
 /cells
 /topology
 /host

 guest
 os_typehvm/os_type
 arch name='ia64'
 wordsize64/wordsize
 emulator/usr/bin/qemu-system-ia64/emulator
 machineia64/machine
 machinexenner/machine
 domain type='qemu'
 /domain
 domain type='kvm'
 emulator/usr/bin/kvm/emulator
 /domain
 /arch
 features
 acpi default='on' toggle='yes'/
 apic default='on' toggle='no'/
 /features
 /guest

 /capabilities



 [r...@kvm bin]# virsh nodeinfo
 CPU model: ia64
 CPU(s): 16
 CPU frequency: 1330 MHz
 CPU socket(s): 16
 Core(s) per socket: 1
 Thread(s) per core: 1
 NUMA cell(s): 1
 Memory size: 8252480 kB



 But the virt-manager still can't work. When i create a new vm. 

 The error as below:



 Unable to complete install 'libvirt.libvirtError internal error Domain ad 
 didn't show up

 Traceback (most recent call last):
 File /usr/share/virt-manager/virtManager/create.py, line 718, in 
 do_install
 dom = guest.start_install(False, meter = meter)
 File /usr/lib/python2.4/site-packages/virtinst/Guest.py, line 660, in 
 start_install
 return self._do_install(consolecb, meter, removeOld, wait)
 File /usr/lib/python2.4/site-packages/virtinst/Guest.py, line 758, in 
 _do_install
 self.domain = self.conn.createLinux(install_xml, 0)
 File /usr/lib/python2.4/site-packages/libvirt.py, line 974, in createLinux
 if ret is None:raise libvirtError('virDomainCreateLinux() failed', 
 conn=self)
 libvirtError: internal error Domain ad didn't show up


 I don't know how to resolve this error.

 Thank you for your advice.


 What is the output in /var/log/libvirt/qemu/$vmname.log ?
 
 
 The output in /var/log/libvirt/qemu/vm10.log is :
 
 LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin HOME=/ /usr/bin/kvm -S -M ia64 -m 
 512 -smp 1 -name vm10 -uuid 8adb1d1d-147f-710a-6d13-c71ba185f811 -monitor pty 
 -pidfile /var/run/libvirt/qemu//vm10.pid -no-reboot -boot d -drive 
 file=/var/lib/libvirt/images/vm10.img,if=ide,index=0,format=raw -drive 
 file=/var/lib/libvirt/images/rhel-server-5.4-ia64-disc1.iso,if=ide,media=cdrom,index=2,format=raw
  -net nic,macaddr=52:54:00:59:bb:26,vlan=0 -net 
 tap,fd=16,script=,vlan=0,ifname=vnet0 -serial pty -parallel none -usb -vnc 
 127.0.0.1:0 -k en-us 
 Supported machines are:
 itaniumItanium Platform (default)
 
  
 
 -dustin
 

Hmm, not sure why libvirt is passing '-M ia64' when the kvm binary only
expects '-M itanium'. Can you attach the diff you applied to the code?
Make sure you are building the latest code (either from tar.gz or git
checkout).

What's the output of 'kvm -M ?' and 'qemu-system-ia64 -M ?'

- Cole

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


[libvirt] libvirt 0.7.5 vs qemu 0.12.1 imcompatability?

2010-01-06 Thread Tom Hughes
The update from qemu 0.11.0 to qemu 0.12.1 in the virt-preview 
repository seems to have broken things. Starting a VM now just gives me 
a blank screen and a log which says:


Option 'ipv4': Use 'on' or 'off'
Failed to parse yes for dummy.ipv4

I assume libvirt is sending a it a command on the monitor interface that 
it no longer understands...


Tom

--
Tom Hughes (t...@compton.nu)
http://www.compton.nu/

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


Re: [libvirt] libvirt 0.7.5 vs qemu 0.12.1 imcompatability?

2010-01-06 Thread Daniel P. Berrange
On Wed, Jan 06, 2010 at 03:38:29PM +, Tom Hughes wrote:
 The update from qemu 0.11.0 to qemu 0.12.1 in the virt-preview 
 repository seems to have broken things. Starting a VM now just gives me 
 a blank screen and a log which says:
 
 Option 'ipv4': Use 'on' or 'off'
 Failed to parse yes for dummy.ipv4
 
 I assume libvirt is sending a it a command on the monitor interface that 
 it no longer understands...

That warning message should be harmless - all my VMs show that and
they work ok. It is not actually something libirt sets - its a internal
QEMU default setting which is wrong

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 parsing of 'info chardev' line endings

2010-01-06 Thread Daniel Veillard
On Tue, Jan 05, 2010 at 11:21:01AM +, Daniel P. Berrange wrote:
 On Mon, Dec 14, 2009 at 03:31:12PM +, Matthew Booth wrote:
  This change makes the 'info chardev' parser ignore any trailing whitespace 
  on a
  line. This fixes a specific problem handling a '\r\n' line ending.
  
  * src/qemu/qemu_monitor_text.c: Ignore trailing whitespace in 'info chardev'
output.
  ---
   src/qemu/qemu_monitor_text.c |   26 +-
   1 files changed, 17 insertions(+), 9 deletions(-)
  
  diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
  index 0cb9ea6..4fd8c4a 100644
  --- a/src/qemu/qemu_monitor_text.c
  +++ b/src/qemu/qemu_monitor_text.c
  @@ -1622,15 +1622,26 @@ int qemuMonitorTextGetPtyPaths(qemuMonitorPtr mon,
   goto cleanup;
   }
   
  -char *pos = reply;  /* The current start of searching 
  */
  -char *end = pos + strlen(reply);/* The end of the reply string */
  +char *pos;  /* The current start of searching 
  */
  +char *next = reply; /* The start of the next line */
   char *eol;   /* The character which ends the current 
  line */
  +char *end = reply + strlen(reply);  /* The end of the reply string */
  +
  +while (next) {
  +pos = next;
   
  -while (pos  end) {
   /* Split the output into lines */
   eol = memchr(pos, '\n', end - pos);
  -if (eol == NULL)
  +if (eol == NULL) {
   eol = end;
  +next = NULL;
  +} else {
  +next = eol + 1;
  +}
  +
  +/* Ignore all whitespace immediately before eol */
  +while (eol  pos  c_isspace(*(eol-1)))
  +eol -= 1;
   
   /* Look for 'filename=pty:' */
   #define NEEDLE filename=pty:
  @@ -1638,13 +1649,13 @@ int qemuMonitorTextGetPtyPaths(qemuMonitorPtr mon,
   
   /* If it's not there we can ignore this line */
   if (!needle)
  -goto next;
  +continue;
   
   /* id is everthing from the beginning of the line to the ':'
* find ':' and turn it into a terminator */
   char *colon = memchr(pos, ':', needle - pos);
   if (colon == NULL)
  -goto next;
  +continue;
   *colon = '\0';
   char *id = pos;
   
  @@ -1664,9 +1675,6 @@ int qemuMonitorTextGetPtyPaths(qemuMonitorPtr mon,
   goto cleanup;
   }
   #undef NEEDLE
  -
  -next:
  -pos = eol + 1;
   }
   
   ret = 0;
 
 
 ACK, seems this patch got missed which is unfortunate, since it results
 in XML containining \r in an attribute

  Argh, okay, pushed,

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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


Re: [libvirt] libvirt 0.7.5 vs qemu 0.12.1 imcompatability?

2010-01-06 Thread Tom Hughes

On 06/01/10 15:53, Daniel P. Berrange wrote:

On Wed, Jan 06, 2010 at 03:38:29PM +, Tom Hughes wrote:

The update from qemu 0.11.0 to qemu 0.12.1 in the virt-preview
repository seems to have broken things. Starting a VM now just gives me
a blank screen and a log which says:

Option 'ipv4': Use 'on' or 'off'
Failed to parse yes for dummy.ipv4

I assume libvirt is sending a it a command on the monitor interface that
it no longer understands...


That warning message should be harmless - all my VMs show that and
they work ok. It is not actually something libirt sets - its a internal
QEMU default setting which is wrong


Hmm... Well something is wrong because I just get a black screen. I 
don't even get the BIOS messages since I updated this morning.


Downgrading back to the fedora-updates version of qemu makes it work again.

BTW the trigger for that warning seems to be that I have 
listen='0.0.0.0' set on the vnc adaptor to allow connections from remote 
machines, which causes libvirt to build a qemu command line with -vnc 
0.0.0.0:0.


Tom

--
Tom Hughes (t...@compton.nu)
http://www.compton.nu/

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


Re: [libvirt] [PATCH] Disable building of static Python module.

2010-01-06 Thread Daniel Veillard
On Wed, Dec 23, 2009 at 07:07:48PM +0100, Diego Elio Pettenò wrote:
 Python modules are loaded at runtime so the static version of it is not
 really needed, this avoids duplicating the build for the PIC and non-PIC
 cases.
 ---
  python/Makefile.am |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/python/Makefile.am b/python/Makefile.am
 index 04342b7..58c6729 100644
 --- a/python/Makefile.am
 +++ b/python/Makefile.am
 @@ -39,7 +39,7 @@ libvirtmod_la_SOURCES = libvirt-override.c typewrappers.c 
 libvirt.c libvirt.h
  # need extra flags here
  libvirtmod_la_CFLAGS = @WARN_PYTHON_CFLAGS@
  
 -libvirtmod_la_LDFLAGS = -module -avoid-version -L$(top_builddir)/src/.libs \
 +libvirtmod_la_LDFLAGS = -module -avoid-version -shared 
 -L$(top_builddir)/src/.libs \
   @CYGWIN_EXTRA_LDFLAGS@
  libvirtmod_la_LIBADD = $(mylibs) \
   @CYGWIN_EXTRA_LIBADD@ @CYGWIN_EXTRA_PYTHON_LIBADD@

  Okay, makes sense to me, applied,

   thanks !

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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


Re: [libvirt] [PATCH 1/1] Don't update vol details after build

2010-01-06 Thread Daniel Veillard
On Mon, Jan 04, 2010 at 11:46:37AM -0500, Cole Robinson wrote:
 On 12/23/2009 04:56 PM, David Allan wrote:
  * This patch removes the call to vol update after the volume build 
  completes.  The update call is currently meaningless anyway because the vol 
  build is passed a copy of the definition, so the update result is thrown 
  away.  More importantly, if the user specified a selinux label for the 
  volume, the update call results in a double free of the label.
  ---
   src/storage/storage_backend_fs.c |8 
   1 files changed, 0 insertions(+), 8 deletions(-)
  
  diff --git a/src/storage/storage_backend_fs.c 
  b/src/storage/storage_backend_fs.c
  index b7d4bd6..4fe40b3 100644
  --- a/src/storage/storage_backend_fs.c
  +++ b/src/storage/storage_backend_fs.c
  @@ -822,14 +822,6 @@ _virStorageBackendFileSystemVolBuild(virConnectPtr 
  conn,
   return -1;
   }
  
  -/* Refresh allocation / permissions info, but not capacity */
  -if (virStorageBackendUpdateVolTargetInfoFD(conn, vol-target, fd,
  -   vol-allocation,
  -   NULL)  0) {
  -close(fd);
  -return -1;
  -}
  -
   if (close(fd)  0) {
   virReportSystemError(conn, errno,
_(cannot close file '%s'),
 
 ACK

  Okay, pushed,

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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


Re: [libvirt] [PATCH] qemu: Update qemuhelpdata test with new flag

2010-01-06 Thread Daniel Veillard
On Tue, Jan 05, 2010 at 08:27:42AM -0600, Adam Litke wrote:
 The test suite needs a small fixup with the qemu balloon patch applied.
 
 This patch applies on top of:
 qemu: Always enable the virtio balloon driver
 
 A small update to the qemuhelpdata test is required.  It must be told about 
 the
 new QEMUD_CMD_FLAG_BALLOON flag that will be turned on for 
 qemu-kvm-0.11.0-rc2.
 
 Signed-off-by: Adam Litke a...@us.ibm.com
 
 diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
 index a747da7..0a78b05 100644
 --- a/tests/qemuhelptest.c
 +++ b/tests/qemuhelptest.c
 @@ -179,7 +179,8 @@ mymain(int argc, char **argv)
  QEMUD_CMD_FLAG_0_10 |
  QEMUD_CMD_FLAG_PCIDEVICE |
  QEMUD_CMD_FLAG_MEM_PATH |
 -QEMUD_CMD_FLAG_ENABLE_KVM,
 +QEMUD_CMD_FLAG_ENABLE_KVM |
 +QEMUD_CMD_FLAG_BALLOON,
  10092, 1,  0);
  
  return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;

  Okay, I have pushed both patches together,

thanks,

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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


Re: [libvirt] [PATCH] Don't free an uninitalized pointer in update_driver_name()

2010-01-06 Thread Daniel Veillard
On Sun, Jan 03, 2010 at 08:33:03PM +0100, Matthias Bolte wrote:
 This invalid free results in heap corruption. Some symptoms I saw
 because of this were libvirtd crashing and virt-manager hanging
 while trying to enumerate devices.
 ---
  src/node_device/node_device_driver.c |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/src/node_device/node_device_driver.c 
 b/src/node_device/node_device_driver.c
 index ecbac0f..fbadfca 100644
 --- a/src/node_device/node_device_driver.c
 +++ b/src/node_device/node_device_driver.c
 @@ -78,7 +78,7 @@ static int update_driver_name(virConnectPtr conn,
virNodeDeviceObjPtr dev)
  {
  char *driver_link = NULL;
 -char *devpath;
 +char *devpath = NULL;
  char *p;
  int ret = -1;
  
 @@ -114,7 +114,7 @@ static int update_driver_name(virConnectPtr conn,
  
  cleanup:
  VIR_FREE(driver_link);
 -free(devpath);
 +VIR_FREE(devpath);
  return ret;
  }
  #else

  ACK, thanks :-)

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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


Re: [libvirt] [PATCH] esx: Also allow virtualHW version 4 for ESX 4.0

2010-01-06 Thread Daniel Veillard
On Sun, Jan 03, 2010 at 08:38:17PM +0100, Matthias Bolte wrote:
 A domain with virtualHW version 4 is allowed on an ESX 4.0 server.
 If a domain is migrated from an ESX 3.5 server to an ESX 4.0 server
 then the virtualHW version stays the same. So a ESX 4.0 server can
 host domains with virtualHW version 4.
 ---
  src/esx/esx_vmx.c |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/src/esx/esx_vmx.c b/src/esx/esx_vmx.c
 index 9aad592..d3cad1d 100644
 --- a/src/esx/esx_vmx.c
 +++ b/src/esx/esx_vmx.c
 @@ -780,9 +780,9 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context 
 *ctx, const char *vmx,
  break;
  
case esxVI_APIVersion_40:
 -if (virtualHW_version != 7) {
 +if (virtualHW_version != 4  virtualHW_version != 7) {
  ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
 -  Expecting VMX entry 'virtualHW.version' to be 7 for 
 +  Expecting VMX entry 'virtualHW.version' to be 4 or 7 
 for 
VI API version 4.0 but found %lld, 
 virtualHW_version);
  goto failure;
  }

  ACK,

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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


Re: [libvirt] [PATCH] esx: Don't warn about an empty URI path

2010-01-06 Thread Daniel Veillard
On Sun, Jan 03, 2010 at 08:38:41PM +0100, Matthias Bolte wrote:
 ---
  src/esx/esx_driver.c |3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)
 
 diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
 index 5cdadfd..30e21e0 100644
 --- a/src/esx/esx_driver.c
 +++ b/src/esx/esx_driver.c
 @@ -293,7 +293,8 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int 
 flags ATTRIBUTE_UNUSED)
  return VIR_DRV_OPEN_DECLINED;
  }
  
 -if (conn-uri-path != NULL  STRNEQ(conn-uri-path, /)) {
 +if (conn-uri-path != NULL  STRNEQ(conn-uri-path, ) 
 +STRNEQ(conn-uri-path, /)) {
  VIR_WARN(Ignoring unexpected path '%s' in URI, conn-uri-path);
  }
  

  ACK, IIRC we added the / test recently,

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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


Re: [libvirt] [PATCH] esx: Fix and improve the libcurl debug callback

2010-01-06 Thread Daniel Veillard
On Sun, Jan 03, 2010 at 08:40:15PM +0100, Matthias Bolte wrote:
 The data passed to the callback is not guaranteed to be zero terminated,
 take care of that by coping the data and adding a zero terminator.
 
 Also dump the data for other types than CURLINFO_TEXT.
 
 Set CURLOPT_VERBOSE to 1 so the debug callback is called when enabled.
 ---
  src/esx/esx_vi.c |   43 ++-
  1 files changed, 34 insertions(+), 9 deletions(-)
 
 diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
 index a7498f0..bad987c 100644
 --- a/src/esx/esx_vi.c
 +++ b/src/esx/esx_vi.c
 @@ -181,27 +181,50 @@ static int
  esxVI_CURL_Debug(CURL *curl ATTRIBUTE_UNUSED, curl_infotype type,
   char *info, size_t size, void *data ATTRIBUTE_UNUSED)
  {
 +char *buffer = NULL;
 +
 +/*
 + * The libcurl documentation says:
 + *
 + *The data pointed to by the char * passed to this function WILL NOT
 + *be zero terminated, but will be exactly of the size as told by the
 + *size_t argument.
 + *
 + * To handle this properly in order to pass the info string to VIR_DEBUG
 + * a zero terminated copy of the info string has to be allocated.
 + */
 +if (VIR_ALLOC_N(buffer, size + 1)  0) {
 +return 0;
 +}
 +
 +if (virStrncpy(buffer, info, size, size + 1) == NULL) {
 +VIR_FREE(buffer);
 +return 0;
 +}
 +
  switch (type) {
case CURLINFO_TEXT:
 -VIR_DEBUG0(CURLINFO_TEXT);
 -fwrite(info, 1, size, stderr);
 -printf(\n\n);
 +if (size  0  buffer[size - 1] == '\n') {
 +buffer[size - 1] = '\0';
 +}
 +
 +VIR_DEBUG(CURLINFO_TEXT %s, buffer);
  break;
  
case CURLINFO_HEADER_IN:
 -VIR_DEBUG0(CURLINFO_HEADER_IN);
 +VIR_DEBUG(CURLINFO_HEADER_IN %s, buffer);
  break;
  
case CURLINFO_HEADER_OUT:
 -VIR_DEBUG0(CURLINFO_HEADER_OUT);
 +VIR_DEBUG(CURLINFO_HEADER_OUT %s, buffer);
  break;
  
case CURLINFO_DATA_IN:
 -VIR_DEBUG0(CURLINFO_DATA_IN);
 +VIR_DEBUG(CURLINFO_DATA_IN %s, buffer);
  break;
  
case CURLINFO_DATA_OUT:
 -VIR_DEBUG0(CURLINFO_DATA_OUT);
 +VIR_DEBUG(CURLINFO_DATA_OUT %s, buffer);
  break;
  
default:
 @@ -209,6 +232,8 @@ esxVI_CURL_Debug(CURL *curl ATTRIBUTE_UNUSED, 
 curl_infotype type,
  break;
  }
  
 +VIR_FREE(buffer);
 +
  return 0;
  }
  #endif
 @@ -338,8 +363,8 @@ esxVI_Context_Connect(virConnectPtr conn, esxVI_Context 
 *ctx, const char *url,
  curl_easy_setopt(ctx-curl_handle, CURLOPT_WRITEFUNCTION,
   esxVI_CURL_WriteBuffer);
  #if ESX_VI__CURL__ENABLE_DEBUG_OUTPUT
 -curl_easy_setopt(ctx-curl_handle, CURLOPT_DEBUGFUNCTION,
 - esxVI_CURL_Debug);
 +curl_easy_setopt(ctx-curl_handle, CURLOPT_DEBUGFUNCTION, 
 esxVI_CURL_Debug);
 +curl_easy_setopt(ctx-curl_handle, CURLOPT_VERBOSE, 1);
  #endif
  
  if (virMutexInit(ctx-curl_lock)  0) {

  ACK, but isn't   a bit heavy ;-) ?

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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


Re: [libvirt] [PATCH] esx: Fix deserialization for VI API calls CancelTask and UnregisterVM

2010-01-06 Thread Daniel Veillard
On Sun, Jan 03, 2010 at 08:40:50PM +0100, Matthias Bolte wrote:
 ---
  src/esx/esx_vi_methods.c |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/src/esx/esx_vi_methods.c b/src/esx/esx_vi_methods.c
 index be21112..7925f26 100644
 --- a/src/esx/esx_vi_methods.c
 +++ b/src/esx/esx_vi_methods.c
 @@ -601,7 +601,7 @@ esxVI_CancelTask(virConnectPtr conn, esxVI_Context *ctx,
  
  request = virBufferContentAndReset(buffer);
  
 -if (esxVI_Context_Execute(conn, ctx, UnregisterVM, request, response,
 +if (esxVI_Context_Execute(conn, ctx, CancelTask, request, response,
esxVI_Occurrence_None)  0) {
  goto failure;
  }
 @@ -652,7 +652,7 @@ esxVI_UnregisterVM(virConnectPtr conn, esxVI_Context *ctx,
  
  request = virBufferContentAndReset(buffer);
  
 -if (esxVI_Context_Execute(conn, ctx, AnswerVM, request, response,
 +if (esxVI_Context_Execute(conn, ctx, UnregisterVM, request, response,
esxVI_Occurrence_None)  0) {
  goto failure;
  }

  ACK, seems things got mixed up

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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


Re: [libvirt] [PATCH] esx: Fix 'vpx' MAC address range and allow arbitrary MAC addresses

2010-01-06 Thread Daniel Veillard
On Sun, Jan 03, 2010 at 08:42:12PM +0100, Matthias Bolte wrote:
 The MAC addresses with 00:50:56 prefix are split into several ranges:
 
   00:50:56:00:00:00 - 00:50:56:3f:ff:ff  'static' range (manually assigned)
   00:50:56:80:00:00 - 00:50:56:bf:ff:ff  'vpx' range (assigned by a VI Client)
 
 Erroneously the 'vpx' range was assumed to be larger and to occupy the
 remaining addresses of the 00:50:56 prefix that are not part of the 'static'
 range.
 
 00:50:56 was used as prefix for generated MAC addresses, this is not possible
 anymore, because there are gaps in the allowed ranges. Therefore, change the
 prefix to 00:0c:29 which is the prefix for auto generated MAC addresses 
 anyway.
 
 Allow arbitrary MAC addresses to be used and set the checkMACAddress VMX 
 option
 to false in case the MAC address doesn't fall into any predefined range.
 
 * docs/drvesx.html.in: update website accordingly
 * src/esx/esx_driver.c: set the auto generation prefix to 00:0c:29
 * src/esx/esx_vmx.c: fix MAC address range handling and allow arbitrary MAC
   addresses
 * tests/vmx2xml*, tests/xml2vmx*: add some basic MAC address range tests

  ACK,

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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


Re: [libvirt] [PATCH] virsh: Use VIR_FREE instead of free

2010-01-06 Thread Daniel Veillard
On Sun, Jan 03, 2010 at 08:43:15PM +0100, Matthias Bolte wrote:
 virsh uses other parts of the internal API already, so use VIR_FREE also.
 ---
  tools/virsh.c |  297 
 -
  1 files changed, 146 insertions(+), 151 deletions(-)

  I really though it was not available there, but if it's possible, nice !

  ACK

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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


Re: [libvirt] [PATCH] virsh: Add persistent history using libreadline

2010-01-06 Thread Daniel Veillard
On Mon, Jan 04, 2010 at 12:06:29AM +0100, Matthias Bolte wrote:
 2010/1/3 Laine Stump la...@laine.org:
  On 01/03/2010 02:42 PM, Matthias Bolte wrote:
 
  +    if (virAsprintf(ctl-historyfile, %s/histroy, ctl-historydir)
   0) {
 
 
  A minor typo in the format string ;-)
 
 
 Fixed, thanks.

  ACK, if using libreadline GPL trojan horse as I have seen it called
recently :-) then we should use it to the full extend, and saving the
history really does help !

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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


Re: [libvirt] libvirt 0.7.5 vs qemu 0.12.1 imcompatability?

2010-01-06 Thread Thomas Treutner
On Wednesday 06 January 2010 17:11:17 Tom Hughes wrote:
 On 06/01/10 15:53, Daniel P. Berrange wrote:
  On Wed, Jan 06, 2010 at 03:38:29PM +, Tom Hughes wrote:
  The update from qemu 0.11.0 to qemu 0.12.1 in the virt-preview
  repository seems to have broken things. Starting a VM now just gives me
  a blank screen and a log which says:
 
  Option 'ipv4': Use 'on' or 'off'
  Failed to parse yes for dummy.ipv4
 
  I assume libvirt is sending a it a command on the monitor interface that
  it no longer understands...
 
  That warning message should be harmless - all my VMs show that and
  they work ok. It is not actually something libirt sets - its a internal
  QEMU default setting which is wrong

 Hmm... Well something is wrong because I just get a black screen. I
 don't even get the BIOS messages since I updated this morning.

If you start your VM with -kernel $image, there's a bug in qemu-0.12.1(.1?), 
which is fixed in 0.12.1.2. 


 Downgrading back to the fedora-updates version of qemu makes it work again.

 BTW the trigger for that warning seems to be that I have
 listen='0.0.0.0' set on the vnc adaptor to allow connections from remote
 machines, which causes libvirt to build a qemu command line with -vnc
 0.0.0.0:0.

 Tom



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


Re: [libvirt] [PATCH] xend_internal: don't let invalid input provoke NULL dereference

2010-01-06 Thread Daniel Veillard
On Wed, Jan 06, 2010 at 01:02:01PM +0100, Jim Meyering wrote:
 If there's a good reason to test for NULL conn, then
 we certainly must not dereference conn before that point.
 
 This assumes we do want to retain the NULL test.
 Note that many other functions perform this same test.
 
 From 2c7b628728efcb5a59c1e7aa1cba763f5ef0045a Mon Sep 17 00:00:00 2001
 From: Jim Meyering meyer...@redhat.com
 Date: Wed, 6 Jan 2010 12:59:21 +0100
 Subject: [PATCH] xend_internal: don't let invalid input provoke NULL 
 dereference
 
 * src/xen/xend_internal.c (xenDaemonOpen_unix): Do not dereference
 a NULL conn.  Move first deref to follow the conn == NULL test.
 ---
  src/xen/xend_internal.c |3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)
 
 diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
 index 827aac4..be033f5 100644
 --- a/src/xen/xend_internal.c
 +++ b/src/xen/xend_internal.c
 @@ -748,11 +748,12 @@ int
  xenDaemonOpen_unix(virConnectPtr conn, const char *path)
  {
  struct sockaddr_un *addr;
 -xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) conn-privateData;
 +xenUnifiedPrivatePtr priv;
 
  if ((conn == NULL) || (path == NULL))
  return (-1);
 
 +priv = (xenUnifiedPrivatePtr) conn-privateData;
  memset(priv-addr, 0, sizeof(priv-addr));
  priv-addrfamily = AF_UNIX;
  /*

  ACK, clearly an oversight, thanks !

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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


Re: [libvirt] libvirt 0.7.5 vs qemu 0.12.1 imcompatability?

2010-01-06 Thread Tom Hughes

On 06/01/10 17:32, Thomas Treutner wrote:

On Wednesday 06 January 2010 17:11:17 Tom Hughes wrote:


Hmm... Well something is wrong because I just get a black screen. I
don't even get the BIOS messages since I updated this morning.


If you start your VM with -kernel $image, there's a bug in qemu-0.12.1(.1?),
which is fixed in 0.12.1.2.


It's a windows VM, so no. The qemu command libvirt is using is:

/usr/bin/qemu-kvm -S -M pc-0.11 -enable-kvm -m 1024 -smp 2 -name 
windows_xp_64 -uuid bb4c089d-1a5e-b349-07fe-4098efdf5fe0 -monitor 
unix:/var/lib/libvirt/qemu/windows_xp_64.monitor,server,nowait 
-localtime -boot c -drive 
file=/var/lib/libvirt/images/windows_xp_64.img,if=virtio,index=0,boot=on 
-drive if=ide,media=cdrom,index=2 -net 
nic,macaddr=00:16:3e:12:4a:56,vlan=0,model=virtio,name=virtio.0 -net 
tap,fd=27,vlan=0,name=tap.0 -serial pty -parallel none -usb -usbdevice 
tablet -vnc 0.0.0.0:0 -k en-gb -vga std -soundhw es1370


That said, I've tried stripping most of that out and still get nothing 
so I think something more fundamental is wrong.


Tom

--
Tom Hughes (t...@compton.nu)
http://www.compton.nu/

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


Re: [libvirt] [PATCH] don't test res == NULL after we've already dereferenced it

2010-01-06 Thread Daniel Veillard
On Wed, Jan 06, 2010 at 12:46:11PM +0100, Jim Meyering wrote:
 As the log says, once we've dereferenced it,
 there's no point in comparing to NULL.
 
 From 463eaf1027a154e71839a67eca85b3ada8b817ff Mon Sep 17 00:00:00 2001
 From: Jim Meyering meyer...@redhat.com
 Date: Wed, 6 Jan 2010 12:45:07 +0100
 Subject: [PATCH] don't test res == NULL after we've already dereferenced it
 
 * src/xen/proxy_internal.c (xenProxyCommand): It is known to be
 non-NULL at that point, so remove the ret == NULL guard, and
 instead add an assert(ret != NULL), in case future code changes
 cause the condition to becomes false.
 Include assert.h.
 ---
  src/xen/proxy_internal.c |6 --
  1 files changed, 4 insertions(+), 2 deletions(-)
 
 diff --git a/src/xen/proxy_internal.c b/src/xen/proxy_internal.c
 index ec4522b..42b6e91 100644
 --- a/src/xen/proxy_internal.c
 +++ b/src/xen/proxy_internal.c
 @@ -1,7 +1,7 @@
  /*
   * proxy_client.c: client side of the communication with the libvirt proxy.
   *
 - * Copyright (C) 2006, 2008, 2009 Red Hat, Inc.
 + * Copyright (C) 2006, 2008, 2009, 2010 Red Hat, Inc.
   *
   * See COPYING.LIB for the License of this software
   *
 @@ -11,6 +11,7 @@
  #include config.h
 
  #include stdio.h
 +#include assert.h
  #include stdlib.h
  #include unistd.h
  #include errno.h
 @@ -444,7 +445,8 @@ retry:
  /*
   * do more checks on the incoming packet.
   */
 -if ((res == NULL) || (res-version != PROXY_PROTO_VERSION) ||
 +assert (res != NULL);
 +if ((res-version != PROXY_PROTO_VERSION) ||
  (res-len  sizeof(virProxyPacket))) {
  virProxyError(conn, VIR_ERR_INTERNAL_ERROR, %s,
_(Communication error with proxy: malformed 
 packet\n));

  I'm not too fond of adding an assert, res should not be null there or
we should already have crashed. 

  ACK to the change without the new assert line.

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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


Re: [libvirt] libvirt 0.7.5 vs qemu 0.12.1 imcompatability?

2010-01-06 Thread Nikola Ciprich
Hi Tom,
I've had similar trouble with old bios images. Once I replaced them with
those built with qemu-kvm, things started working...
regards
nik

On Wed, Jan 06, 2010 at 05:34:57PM +, Tom Hughes wrote:
 On 06/01/10 17:32, Thomas Treutner wrote:
 On Wednesday 06 January 2010 17:11:17 Tom Hughes wrote:
 
 Hmm... Well something is wrong because I just get a black screen. I
 don't even get the BIOS messages since I updated this morning.
 
 If you start your VM with -kernel $image, there's a bug in qemu-0.12.1(.1?),
 which is fixed in 0.12.1.2.
 
 It's a windows VM, so no. The qemu command libvirt is using is:
 
 /usr/bin/qemu-kvm -S -M pc-0.11 -enable-kvm -m 1024 -smp 2 -name
 windows_xp_64 -uuid bb4c089d-1a5e-b349-07fe-4098efdf5fe0 -monitor
 unix:/var/lib/libvirt/qemu/windows_xp_64.monitor,server,nowait
 -localtime -boot c -drive 
 file=/var/lib/libvirt/images/windows_xp_64.img,if=virtio,index=0,boot=on
 -drive if=ide,media=cdrom,index=2 -net
 nic,macaddr=00:16:3e:12:4a:56,vlan=0,model=virtio,name=virtio.0 -net
 tap,fd=27,vlan=0,name=tap.0 -serial pty -parallel none -usb
 -usbdevice tablet -vnc 0.0.0.0:0 -k en-gb -vga std -soundhw es1370
 
 That said, I've tried stripping most of that out and still get
 nothing so I think something more fundamental is wrong.
 
 Tom
 
 -- 
 Tom Hughes (t...@compton.nu)
 http://www.compton.nu/
 
 --
 Libvir-list mailing list
 Libvir-list@redhat.com
 https://www.redhat.com/mailman/listinfo/libvir-list
 

-- 
-
Nikola CIPRICH
LinuxBox.cz, s.r.o.
28. rijna 168, 709 01 Ostrava

tel.:   +420 596 603 142
fax:+420 596 621 273
mobil:  +420 777 093 799

www.linuxbox.cz

mobil servis: +420 737 238 656
email servis: ser...@linuxbox.cz
-

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


Re: [libvirt] [PATCH] xend_internal: don't let invalid input provoke NULL dereference

2010-01-06 Thread Jim Meyering
Daniel Veillard wrote:
 Subject: [PATCH] xend_internal: don't let invalid input provoke NULL 
 dereference
 * src/xen/xend_internal.c (xenDaemonOpen_unix): Do not dereference
 a NULL conn.  Move first deref to follow the conn == NULL test.

   ACK, clearly an oversight, thanks !

Thanks.  Pushing shortly.

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


Re: [libvirt] [PATCH] don't test res == NULL after we've already dereferenced it

2010-01-06 Thread Jim Meyering
Daniel Veillard wrote:

 On Wed, Jan 06, 2010 at 12:46:11PM +0100, Jim Meyering wrote:
 As the log says, once we've dereferenced it,
 there's no point in comparing to NULL.

 From 463eaf1027a154e71839a67eca85b3ada8b817ff Mon Sep 17 00:00:00 2001
 From: Jim Meyering meyer...@redhat.com
 Date: Wed, 6 Jan 2010 12:45:07 +0100
 Subject: [PATCH] don't test res == NULL after we've already dereferenced it

 * src/xen/proxy_internal.c (xenProxyCommand): It is known to be
 non-NULL at that point, so remove the ret == NULL guard, and
 instead add an assert(ret != NULL), in case future code changes
 cause the condition to becomes false.
 Include assert.h.
 ---
  src/xen/proxy_internal.c |6 --
  1 files changed, 4 insertions(+), 2 deletions(-)

 diff --git a/src/xen/proxy_internal.c b/src/xen/proxy_internal.c
 index ec4522b..42b6e91 100644
 --- a/src/xen/proxy_internal.c
 +++ b/src/xen/proxy_internal.c
 @@ -1,7 +1,7 @@
  /*
   * proxy_client.c: client side of the communication with the libvirt proxy.
   *
 - * Copyright (C) 2006, 2008, 2009 Red Hat, Inc.
 + * Copyright (C) 2006, 2008, 2009, 2010 Red Hat, Inc.
   *
   * See COPYING.LIB for the License of this software
   *
 @@ -11,6 +11,7 @@
  #include config.h

  #include stdio.h
 +#include assert.h
  #include stdlib.h
  #include unistd.h
  #include errno.h
 @@ -444,7 +445,8 @@ retry:
  /*
   * do more checks on the incoming packet.
   */
 -if ((res == NULL) || (res-version != PROXY_PROTO_VERSION) ||
 +assert (res != NULL);
 +if ((res-version != PROXY_PROTO_VERSION) ||
  (res-len  sizeof(virProxyPacket))) {
  virProxyError(conn, VIR_ERR_INTERNAL_ERROR, %s,
_(Communication error with proxy: malformed 
 packet\n));

   I'm not too fond of adding an assert, res should not be null there or
 we should already have crashed.

   ACK to the change without the new assert line.

Considering that this is in the daemon and that bad things
have been known to happen via NULL derefs, some would
argue that an assertion failure is preferable.

In addition, there's enough logic that it's not trivial
to inspect the preceding code to be sure that res cannot
be NULL -- hence it'd be easy for someone to change it without
realizing they're causing trouble.

Confirm that that's what you really want, and I'll remove
the assert business and adjust the log message.

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


Re: [libvirt] [PATCH] [RFC] xen domctl version 6

2010-01-06 Thread Jim Fehlig
Daniel Veillard wrote:
 On Wed, Dec 23, 2009 at 10:59:09AM -0700, Jim Fehlig wrote:
   
 xen-unstable c/s 20685 changed the domctl interface, adding a field to
 xen_domctl_getdomaininfo structure.  This additional field causes stack
 corruption in libvirt.  xen-unstable c/s 20711 rightly bumped the domctl
 interface version so it is at least possible to handle the new field.

 The attached patch accounts for shr_pages field added to
 xen_domctl_getdomaininfo structure.  I'm not thrilled about the changes
 to all the macros - suggestions for improvement welcomed.

 Tested with domctl version 5 and 6.
 

   Yeah, we don't really have much choice there I think, but I would
 make the macros a bit more forward optimistic, i.e replacing

   (dom_interface_version == 6 ?

 with

   (dom_interface_version = 6 ?

 if there is a new bump, the call should not fail because we didn't
 updated all the macros.
   

Yes, good idea.  Revised patch attached.

Regards,
Jim

commit 66363353ce4db1ed07c18f8191bfd26906bddaec
Author: Jim Fehlig jfeh...@novell.com
Date:   Wed Jan 6 14:41:24 2010 -0700

xen hypervisor: xen domctl version 6

xen-unstable c/s 20685 changed the domctl interface, adding a field to
xen_domctl_getdomaininfo structure.  This additional field causes stack
corruption in libvirt.  xen-unstable c/s 20711 rightly bumped the domctl
interface version so it is at least possible to handle the new field.
This change accounts for shr_pages field added to xen_domctl_getdomaininfo
structure.

diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 8279a74..6d8accc 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -215,10 +215,26 @@ struct xen_v2d5_getdomaininfo {
 };
 typedef struct xen_v2d5_getdomaininfo xen_v2d5_getdomaininfo;
 
+struct xen_v2d6_getdomaininfo {
+domid_t  domain;	/* the domain number */
+uint32_t flags;	/* flags, see before */
+uint64_t tot_pages ALIGN_64;	/* total number of pages used */
+uint64_t max_pages ALIGN_64;	/* maximum number of pages allowed */
+uint64_t shr_pages ALIGN_64;/* number of shared pages */
+uint64_t shared_info_frame ALIGN_64; /* MFN of shared_info struct */
+uint64_t cpu_time ALIGN_64;  /* CPU time used */
+uint32_t nr_online_vcpus;  /* Number of VCPUs currently online. */
+uint32_t max_vcpu_id; /* Maximum VCPUID in use by this domain. */
+uint32_t ssidref;
+xen_domain_handle_t handle;
+};
+typedef struct xen_v2d6_getdomaininfo xen_v2d6_getdomaininfo;
+
 union xen_getdomaininfo {
 struct xen_v0_getdomaininfo v0;
 struct xen_v2_getdomaininfo v2;
 struct xen_v2d5_getdomaininfo v2d5;
+struct xen_v2d6_getdomaininfo v2d6;
 };
 typedef union xen_getdomaininfo xen_getdomaininfo;
 
@@ -226,6 +242,7 @@ union xen_getdomaininfolist {
 struct xen_v0_getdomaininfo *v0;
 struct xen_v2_getdomaininfo *v2;
 struct xen_v2d5_getdomaininfo *v2d5;
+struct xen_v2d6_getdomaininfo *v2d6;
 };
 typedef union xen_getdomaininfolist xen_getdomaininfolist;
 
@@ -263,114 +280,147 @@ typedef struct xen_v2s5_availheap  xen_v2s5_availheap;
 #define XEN_GETDOMAININFOLIST_ALLOC(domlist, size)  \
 (hypervisor_version  2 ?   \
  (VIR_ALLOC_N(domlist.v0, (size)) == 0) :   \
- (dom_interface_version  5 ?   \
-  (VIR_ALLOC_N(domlist.v2, (size)) == 0) :  \
-  (VIR_ALLOC_N(domlist.v2d5, (size)) == 0)))
+ (dom_interface_version = 6 ?  \
+  (VIR_ALLOC_N(domlist.v2d6, (size)) == 0) :\
+ (dom_interface_version == 5 ?  \
+  (VIR_ALLOC_N(domlist.v2d5, (size)) == 0) :\
+  (VIR_ALLOC_N(domlist.v2, (size)) == 0
 
 #define XEN_GETDOMAININFOLIST_FREE(domlist)\
 (hypervisor_version  2 ?  \
  VIR_FREE(domlist.v0) :\
- (dom_interface_version  5 ?  \
-  VIR_FREE(domlist.v2) :   \
-  VIR_FREE(domlist.v2d5)))
+ (dom_interface_version = 6 ? \
+  VIR_FREE(domlist.v2d6) : \
+ (dom_interface_version == 5 ? \
+  VIR_FREE(domlist.v2d5) : \
+  VIR_FREE(domlist.v2
 
 #define XEN_GETDOMAININFOLIST_CLEAR(domlist, size)\
 (hypervisor_version  2 ? \
  memset(domlist.v0, 0, sizeof(*domlist.v0) * size) :  \
- (dom_interface_version  5 ? \
-  memset(domlist.v2, 0, sizeof(*domlist.v2) * size) : \
-  memset(domlist.v2d5, 0, sizeof(*domlist.v2d5) * size)))
+ (dom_interface_version = 6 ?\
+  memset(domlist.v2d6, 0, 

[libvirt] [PATCH] Fix free of invalid pointer in node_device_driver

2010-01-06 Thread Jim Fehlig
If device does not have a driver, an uninitialized pointer was being
free()'d in node_device_driver.  Here's a small patch to fix it.

Regards,
Jim
commit 49d8d703e4ac3253155871f97350bec10a15dfaf
Author: Jim Fehlig jfeh...@novell.com
Date:   Wed Jan 6 17:17:08 2010 -0700

Fix free of invalid pointer in node_device_driver

When using HAL, it is possible to free an invalid pointer in
node_device_driver, e.g. when driver_link does not exist.

diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index ecbac0f..7e2b299 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -78,7 +78,7 @@ static int update_driver_name(virConnectPtr conn,
   virNodeDeviceObjPtr dev)
 {
 char *driver_link = NULL;
-char *devpath;
+char *devpath = NULL;
 char *p;
 int ret = -1;
 
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] Fix free of invalid pointer in node_device_driver

2010-01-06 Thread Matthias Bolte
2010/1/7 Jim Fehlig jfeh...@novell.com:
 If device does not have a driver, an uninitialized pointer was being
 free()'d in node_device_driver.  Here's a small patch to fix it.

 Regards,
 Jim


I posted the same patch 3 days ago and DV ACKed it today. Haven't
pushed it yet, but I'll do so now.

Matthias

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

Re: [libvirt] [PATCH] virsh: Use VIR_FREE instead of free

2010-01-06 Thread Matthias Bolte
2010/1/6 Daniel Veillard veill...@redhat.com:
 On Sun, Jan 03, 2010 at 08:43:15PM +0100, Matthias Bolte wrote:
 virsh uses other parts of the internal API already, so use VIR_FREE also.
 ---
  tools/virsh.c |  297 
 -
  1 files changed, 146 insertions(+), 151 deletions(-)

  I really though it was not available there, but if it's possible, nice !

  ACK

 Daniel


Pushed the 8 ACKed patches.

Matthias

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

Re: [libvirt] [PATCH] Fix free of invalid pointer in node_device_driver

2010-01-06 Thread Jim Fehlig
Matthias Bolte wrote:
 2010/1/7 Jim Fehlig jfeh...@novell.com:
   
 If device does not have a driver, an uninitialized pointer was being
 free()'d in node_device_driver.  Here's a small patch to fix it.

 Regards,
 Jim

 

 I posted the same patch 3 days ago and DV ACKed it today. Haven't
 pushed it yet, but I'll do so now.
   

Oh, I missed it - sorry.  Thanks for pushing!

Regards,
Jim

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