[libvirt] [PATCH] util: Use virReportSystemError for system error in pci.c

2012-11-23 Thread Osier Yang
---
 src/util/pci.c |   14 ++
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/util/pci.c b/src/util/pci.c
index d1ad121..191f99d 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -1860,10 +1860,9 @@ pciGetPciConfigAddressFromSysfsDeviceLink(const char 
*device_link,
 device_path = canonicalize_file_name(device_link);
 if (device_path == NULL) {
 memset(errbuf, '\0', sizeof(errbuf));
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _(Failed to resolve device link '%s': '%s'),
-   device_link, virStrerror(errno, errbuf,
-   sizeof(errbuf)));
+virReportSystemError(errno,
+ _(Failed to resolve device link '%s'),
+ device_link);
 return ret;
 }
 
@@ -1941,10 +1940,9 @@ pciGetVirtualFunctions(const char *sysfs_path,
 dir = opendir(sysfs_path);
 if (dir == NULL) {
 memset(errbuf, '\0', sizeof(errbuf));
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _(Failed to open dir '%s': '%s'),
-   sysfs_path, virStrerror(errno, errbuf,
-   sizeof(errbuf)));
+virReportSystemError(errno,
+ _(Failed to open dir '%s'),
+ sysfs_path);
 return ret;
 }
 
-- 
1.7.7.6

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


Re: [libvirt] [PATCH 1/6] Fix virDiskNameToIndex to actually ignore partition numbers

2012-11-23 Thread Martin Kletzander
On 11/22/2012 05:48 PM, Daniel P. Berrange wrote:
 From: Daniel P. Berrange berra...@redhat.com
 
 The docs for virDiskNameToIndex claim it ignores partition
 numbers. In actual fact though, a code ordering buy means

s/buy/bug/

 that a partition number will cause the code to accidentally
 multiply the result by 26.
 
 Signed-off-by: Daniel P. Berrange berra...@redhat.com
 ---
  src/util/util.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
 
 diff --git a/src/util/util.c b/src/util/util.c
 index 75b18c1..2fd0f2c 100644
 --- a/src/util/util.c
 +++ b/src/util/util.c
 @@ -2193,11 +2193,10 @@ int virDiskNameToIndex(const char *name) {
  return -1;
  
  for (i = 0; *ptr; i++) {
 -idx = (idx + (i  1 ? 0 : 1)) * 26;
 -
  if (!c_islower(*ptr))
  break;
  
 +idx = (idx + (i  1 ? 0 : 1)) * 26;
  idx += *ptr - 'a';
  ptr++;
  }
 

ACK,

Martin

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


Re: [libvirt] [PATCH] cpu: Add Intel Haswell cpu model

2012-11-23 Thread Martin Kletzander
On 11/22/2012 04:48 PM, Peter Krempa wrote:
 On 11/22/12 15:52, Martin Kletzander wrote:
 On 11/22/2012 03:05 PM, Peter Krempa wrote:
[...]
 According to the qemu patch, the model should be only adding features,
 but I see rdtscp disappeared between SandyBridge and Haswell.  The
 question is whether this is QEMU bug or not, do you have any info on
 that?  If not, maybe we should cross-post ask in qemu-devel.

 We also include 'sep' and 'fpu' on top of these things, but I recall
 some conversation about qemu dropping 'sep' from some models lately, but
 I have no idea about 'fpu' flag handling there either.
 
 Thanks for pointing that out on the qemu-devel list:
 
 https://lists.gnu.org/archive/html/qemu-devel/2012-11/msg02400.html
 

I think we can safely assume the patch will make it in a few days, but
to be sure I'm giving you an ACK for when the patch gets into qemu's
upstream.

Martin

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


[libvirt] FYI: Upgrade from pc-0.12 / pc-014 vs. savevm section kvmclock

2012-11-23 Thread Philipp Hahn
Hello,

I'm using libvirt to manage my KVM instances. I created a VM with 
qemu-kvm-0.12, later upgraded to qemu-kvm-0.14 and took a snapshot using 
libvirt. As the original VM was created with qemu-kvm-0.12, libvirt 
stored pc-0.12 with its XML data. Now I upgraded to qemu-kvm-1.1.2, where 
reverting to that snapshot fails with a the message
   Unknown savevm section or instance 'kvmclock' 0
   load of migration failed

I tracked that down to hw/pc_piix.c:590 where 
 static QEMUMachine pc_machine_v0_12 = {
 .name = pc-0.12,
 .desc = Standard PC,
 .init = pc_init_pci_no_kvmclock,
is defined. If I change .init to pc_init_pci, I'm able to load the old 
snapshot.

I think this is because kvm-0.14 always created the kvmclock device, while 
that was only later changed (0ec329da) to be created on demand for pc-0.14s 
onward. So the snapshot is no longer a pure pc-0.12, but some 
pc-0.12+something, which qemu-kvm-1.1.2 refuses to load.

Now that I know what the problem is I just want to inform others, who might 
experience the same problem. My workaround is a patched qemu-kvm, where I 
changed that .init mentioned above, since an additional enabled kvmclock does 
not seem to do any harm.
If someone has a better fix, I'm open to suggestions.

Sincerely
Philipp
-- 
Philipp Hahn   Open Source Software Engineer  h...@univention.de
Univention GmbHbe open.   fon: +49 421 22 232- 0
Mary-Somerville-Str.1  D-28359 Bremen fax: +49 421 22 232-99
   http://www.univention.de/


signature.asc
Description: This is a digitally signed message part.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 4/6] Fix exiting of libvirt_lxc program on container quit

2012-11-23 Thread Martin Kletzander
On 11/22/2012 05:48 PM, Daniel P. Berrange wrote:
 From: Daniel P. Berrange berra...@redhat.com
 
 The virLXCControllerClientCloseHook method was mistakenly
 assuming that the private data associated with the network
 client was the virLXCControllerPtr. In fact it was just a
 dummy int, so we were derefencing a bogus struct. The
 frequent result of this was that we would never quit, because
 we tried to arm a non-existant timer.
 
 Fix the code by removing the dummy private data and just
 using the virLXCControllerPtr instance as private data
 
 Signed-off-by: Daniel P. Berrange berra...@redhat.com
 ---
  src/lxc/lxc_controller.c | 13 -
  1 file changed, 4 insertions(+), 9 deletions(-)
 
 diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
 index 6fffd68..a9d2d40 100644
 --- a/src/lxc/lxc_controller.c
 +++ b/src/lxc/lxc_controller.c
 @@ -578,19 +578,14 @@ static void 
 virLXCControllerClientCloseHook(virNetServerClientPtr client)
  
  static void virLXCControllerClientPrivateFree(void *data)
  {
 -VIR_FREE(data);
 +virLXCControllerPtr ctrl = data;
 +VIR_DEBUG(Got private data free %p, ctrl);
  }
  
  static void *virLXCControllerClientPrivateNew(virNetServerClientPtr client,
void *opaque)
  {
  virLXCControllerPtr ctrl = opaque;
 -int *dummy;
 -
 -if (VIR_ALLOC(dummy)  0) {
 -virReportOOMError();
 -return NULL;
 -}
  
  virNetServerClientSetCloseHook(client, virLXCControllerClientCloseHook);
  VIR_DEBUG(Got new client %p, client);
 @@ -600,7 +595,7 @@ static void 
 *virLXCControllerClientPrivateNew(virNetServerClientPtr client,
  virLXCControllerEventSendInit(ctrl, ctrl-initpid);
  ctrl-firstClient = false;
  
 -return dummy;
 +return ctrl;
  }
  
  
 @@ -1327,7 +1322,7 @@ virLXCControllerEventSendExit(virLXCControllerPtr ctrl,
  {
  virLXCProtocolExitEventMsg msg;
  
 -VIR_DEBUG(Exit status %d, exitstatus);
 +VIR_DEBUG(Exit status %d (client=%p), exitstatus, ctrl-client);
  memset(msg, 0, sizeof(msg));
  switch (exitstatus) {
  case 0:
 

ACK,

Martin

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


Re: [libvirt] [PATCH] util: Use virReportSystemError for system error in pci.c

2012-11-23 Thread Martin Kletzander
On 11/23/2012 09:02 AM, Osier Yang wrote:
 ---
  src/util/pci.c |   14 ++
  1 files changed, 6 insertions(+), 8 deletions(-)
 
 diff --git a/src/util/pci.c b/src/util/pci.c
 index d1ad121..191f99d 100644
 --- a/src/util/pci.c
 +++ b/src/util/pci.c
 @@ -1860,10 +1860,9 @@ pciGetPciConfigAddressFromSysfsDeviceLink(const char 
 *device_link,
  device_path = canonicalize_file_name(device_link);
  if (device_path == NULL) {
  memset(errbuf, '\0', sizeof(errbuf));
 -virReportError(VIR_ERR_INTERNAL_ERROR,
 -   _(Failed to resolve device link '%s': '%s'),
 -   device_link, virStrerror(errno, errbuf,
 -   sizeof(errbuf)));
 +virReportSystemError(errno,
 + _(Failed to resolve device link '%s'),
 + device_link);
  return ret;
  }
  
 @@ -1941,10 +1940,9 @@ pciGetVirtualFunctions(const char *sysfs_path,
  dir = opendir(sysfs_path);
  if (dir == NULL) {
  memset(errbuf, '\0', sizeof(errbuf));
 -virReportError(VIR_ERR_INTERNAL_ERROR,
 -   _(Failed to open dir '%s': '%s'),
 -   sysfs_path, virStrerror(errno, errbuf,
 -   sizeof(errbuf)));
 +virReportSystemError(errno,
 + _(Failed to open dir '%s'),
 + sysfs_path);
  return ret;
  }
  
 

These are system errors indeed. ACK,

Martin

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


Re: [libvirt] [PATCH 3/6] Skip deleted timers when calculting next timeout

2012-11-23 Thread Martin Kletzander
On 11/22/2012 05:48 PM, Daniel P. Berrange wrote:
 From: Daniel P. Berrange berra...@redhat.com
 
 It is possible for there to be deleted timers when we
 calculate the next timeout, and they must be skipped.
 
 Signed-off-by: Daniel P. Berrange berra...@redhat.com
 ---
  src/util/event_poll.c | 2 ++
  1 file changed, 2 insertions(+)
 
 diff --git a/src/util/event_poll.c b/src/util/event_poll.c
 index 2ffa94b..53b9c6c 100644
 --- a/src/util/event_poll.c
 +++ b/src/util/event_poll.c
 @@ -332,6 +332,8 @@ static int virEventPollCalculateTimeout(int *timeout) {
  EVENT_DEBUG(Calculate expiry of %zu timers, eventLoop.timeoutsCount);
  /* Figure out if we need a timeout */
  for (i = 0 ; i  eventLoop.timeoutsCount ; i++) {
 +if (eventLoop.timeouts[i].deleted)
 +continue;
  if (eventLoop.timeouts[i].frequency  0)
  continue;
  
 

ACK,

Martin

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


Re: [libvirt] [PATCH] Correct include-password option for domdisplay

2012-11-23 Thread Christophe Fergeau
On Thu, Nov 22, 2012 at 11:32:38AM +0100, Ján Tomko wrote:
 On 11/22/12 11:03, Martin Kletzander wrote:
  
  I'll rework it to make it as URI as possible then.  Just one question,
  though (for anyone, I guess); why do we append port as a parameter for
  spice scheme?
  
  Martin
  
 
 I think it's because of what spicy supported initially (since v0.1.0):
 http://cgit.freedesktop.org/spice/spice-gtk/commit/?id=f0693b9f949ba
 
 spice://host:port is supported since v0.8
 http://cgit.freedesktop.org/spice/spice-gtk/commit/?id=b4c72ece9ca3b
 
 and spice://host:port/ (with the trailing slash) since v0.12
 http://cgit.freedesktop.org/spice/spice-gtk/commit/?id=50add15ef69cd

Another thing to keep in mind is that you can have both a port and a secure
port (over which data will transit through SSL).

Christophe


pgpWUa4VXBGk6.pgp
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] Correct include-password option for domdisplay

2012-11-23 Thread Martin Kletzander
On 11/23/2012 09:20 AM, Christophe Fergeau wrote:
 On Thu, Nov 22, 2012 at 11:32:38AM +0100, Ján Tomko wrote:
 On 11/22/12 11:03, Martin Kletzander wrote:

 I'll rework it to make it as URI as possible then.  Just one question,
 though (for anyone, I guess); why do we append port as a parameter for
 spice scheme?

 Martin


 I think it's because of what spicy supported initially (since v0.1.0):
 http://cgit.freedesktop.org/spice/spice-gtk/commit/?id=f0693b9f949ba

 spice://host:port is supported since v0.8
 http://cgit.freedesktop.org/spice/spice-gtk/commit/?id=b4c72ece9ca3b

 and spice://host:port/ (with the trailing slash) since v0.12
 http://cgit.freedesktop.org/spice/spice-gtk/commit/?id=50add15ef69cd
 
 Another thing to keep in mind is that you can have both a port and a secure
 port (over which data will transit through SSL).
 
 Christophe
 

I'm keeping that in the parameter as there will be both port and tlsPort
available in this case.  I also modified it so we have a vnc version and
spice version of the output, which can be seen in v2 (rewrite
cmdDomDisplay).

Martin

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


Re: [libvirt] QMP Capability Detection Issues with GIT version of QEMU

2012-11-23 Thread Daniel P. Berrange
On Thu, Nov 22, 2012 at 06:35:52PM +0100, Viktor Mihajlovski wrote:
 On 11/22/2012 05:50 PM, Daniel P. Berrange wrote:
 
 3. Run the QMP QEMU under the configured qemu
 user. This would be my favorite.
 
 Yep, this seems like the right thing todo.
 
 OK, I'll go for it :-).
 /me tries to understand why I didn't see this problem myself.
 
 Daniel
 
 This happens probably only for an RPM-installed libvirt
 (I build my own RPMs). With a default local configure/
 make/install the QEMU user is root:root - which would
 not expose the issue.

Yeah, but I usually have user=qemu set in qemu.conf to
deal with that. Oh well, at least we know now.


Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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


Re: [libvirt] Remote connection to KVM hypervisor failed using libvirt 0.10.2

2012-11-23 Thread Daniel P. Berrange
On Fri, Nov 23, 2012 at 07:43:12AM +0200, Ido Levy wrote:
 Hello,
 
 I compiled libvirt 0.10.2 from source providing extra parameters to the 
 configure procedure to support phyp and hyper-v driver support, and python 
 binding.
 When running virsh from the tools directory (libvirt-0.10.2/tools) and 
 trying to connect to remote KVM hypervisor using connect 
 qemu+ssh://user@hostname/system
 I got the following error
 error: Failed to connect to the hypervisor
 error: End of file while reading data: : Input/output error
 
 The same scenario working without any issue using virsh tool that is 
 shipped with RHEL distribution.
 
 Any advise how can I figure out how to resolve this.

What are the full args you passed to 'configure' ?

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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


Re: [libvirt] [PATCH] bitmap: fix typo to use UL type of integer constant in virBitmapIsAllSet

2012-11-23 Thread Daniel P. Berrange
On Fri, Nov 23, 2012 at 02:51:33PM +0800, Guannan Ren wrote:
 This bug leads to get incorrect vcpupin information via
 qemudDomainGetVcpuPinInfo() API when the number of maximum
 cpu on a host falls into a scope such as 31  ncpus  64.
 
 gcc warning:
 left shift count = width of type
 
 The following bug is such a case
 https://bugzilla.redhat.com/show_bug.cgi?id=876415
 ---
  src/util/bitmap.c |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/src/util/bitmap.c b/src/util/bitmap.c
 index 5ec5440..c29f5f3 100644
 --- a/src/util/bitmap.c
 +++ b/src/util/bitmap.c
 @@ -574,8 +574,8 @@ bool virBitmapIsAllSet(virBitmapPtr bitmap)
  return false;
  
  if (unusedBits  0) {
 -if ((bitmap-map[sz]  ((1U  (VIR_BITMAP_BITS_PER_UNIT - 
 unusedBits)) - 1))
 -!= ((1U  (VIR_BITMAP_BITS_PER_UNIT - unusedBits)) - 1))
 +if ((bitmap-map[sz]  ((1UL  (VIR_BITMAP_BITS_PER_UNIT - 
 unusedBits)) - 1))
 +!= ((1UL  (VIR_BITMAP_BITS_PER_UNIT - unusedBits)) - 1))
  return false;
  }

Please add a test case to test/virbitmaptest.c which exposes the flaw
that this is fixing.

Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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


Re: [libvirt] [PATCH 0/4] qemu: add boot order support for redirected and host USB devices

2012-11-23 Thread Michal Privoznik
On 21.11.2012 18:53, Eric Blake wrote:
 On 11/21/2012 10:43 AM, Michal Privoznik wrote:
 On 20.11.2012 19:47, Ján Tomko wrote:
 Commit a4c19459aa8634c43b51e8138fb1d7eec4c17824 missed the functionality
 for redirected USB devices (fixed in 1/4), documentation and tests.

 https://bugzilla.redhat.com/show_bug.cgi?id=805414



 I went ahead, ACKed and pushed this. However, meanwhile I've:
 -split 2/4 patch into two smaller ones
 -split huge line in 3/4
 -fixed space at EOL in 4/4
 
 I think you should undo this fix, and match actual qemu output (even if
 it DOES have a trailing space), as that particular file should be exempt
 from whitespace enforcement.  (If git gives you problems for pushing a
 trailing space, ping me on IRC, and I'll help you figure out what to tweak).
 

Okay, I've fixed it. Surprisingly, there was no problem pushing the
previous version. In fact, we don't run the syntax-check rule on
tests/qemuhelpdata/* as I learned after digging into things.

Anyway, I've proposed patch on qemu upstream list:

http://lists.nongnu.org/archive/html/qemu-devel/2012-11/msg02525.html

Michal

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

Re: [libvirt] [PATCH] bitmap: fix typo to use UL type of integer constant in virBitmapIsAllSet

2012-11-23 Thread Guannan Ren

On 11/23/2012 05:00 PM, Daniel P. Berrange wrote:

On Fri, Nov 23, 2012 at 02:51:33PM +0800, Guannan Ren wrote:

This bug leads to get incorrect vcpupin information via
qemudDomainGetVcpuPinInfo() API when the number of maximum
cpu on a host falls into a scope such as 31  ncpus  64.

gcc warning:
left shift count = width of type

The following bug is such a case
https://bugzilla.redhat.com/show_bug.cgi?id=876415
---
  src/util/bitmap.c |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/bitmap.c b/src/util/bitmap.c
index 5ec5440..c29f5f3 100644
--- a/src/util/bitmap.c
+++ b/src/util/bitmap.c
@@ -574,8 +574,8 @@ bool virBitmapIsAllSet(virBitmapPtr bitmap)
  return false;
  
  if (unusedBits  0) {

-if ((bitmap-map[sz]  ((1U  (VIR_BITMAP_BITS_PER_UNIT - 
unusedBits)) - 1))
-!= ((1U  (VIR_BITMAP_BITS_PER_UNIT - unusedBits)) - 1))
+if ((bitmap-map[sz]  ((1UL  (VIR_BITMAP_BITS_PER_UNIT - 
unusedBits)) - 1))
+!= ((1UL  (VIR_BITMAP_BITS_PER_UNIT - unusedBits)) - 1))
  return false;
  }

Please add a test case to test/virbitmaptest.c which exposes the flaw
that this is fixing.

Regards,
Daniel


okay, I will send v2 with testcase in it.

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


Re: [libvirt] Remote connection to KVM hypervisor failed using libvirt 0.10.2

2012-11-23 Thread Daniel P. Berrange
On Fri, Nov 23, 2012 at 11:13:58AM +0200, Ido Levy wrote:
  From: Daniel P. Berrange berra...@redhat.com
  To: Ido Levy/Haifa/IBM@IBMIL, 
  Cc: libvir-list@redhat.com
  Date: 23/11/2012 10:59 AM
  Subject: Re: [libvirt] Remote connection to KVM hypervisor failed 
  using libvirt 0.10.2
  
  On Fri, Nov 23, 2012 at 07:43:12AM +0200, Ido Levy wrote:
   Hello,
   
   I compiled libvirt 0.10.2 from source providing extra parameters to 
 the 
   configure procedure to support phyp and hyper-v driver support, and 
 python 
   binding.
   When running virsh from the tools directory (libvirt-0.10.2/tools) and 
 
   trying to connect to remote KVM hypervisor using connect 
   qemu+ssh://user@hostname/system
   I got the following error
   error: Failed to connect to the hypervisor
   error: End of file while reading data: : Input/output error
   
   The same scenario working without any issue using virsh tool that is 
   shipped with RHEL distribution.
   
   Any advise how can I figure out how to resolve this.
  
  What are the full args you passed to 'configure' ?
  
  Daniel
 
  ./configure --with-python --with-phyp --with-hyperv

Ok, that's the problem. If you want your build to be able to connect
to the RPM based build, you need to make it use the same paths. For
this you need to pass   

   ./configure --with-python --with-phyp --with-hyperv \
   --prefix=/usr --sysconfdir=/etc --localstatedir=/var

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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


Re: [libvirt] Remote connection to KVM hypervisor failed using libvirt 0.10.2

2012-11-23 Thread Ido Levy
 From: Daniel P. Berrange berra...@redhat.com
 To: Ido Levy/Haifa/IBM@IBMIL, 
 Cc: libvir-list@redhat.com
 Date: 23/11/2012 12:04 PM
 Subject: Re: [libvirt] Remote connection to KVM hypervisor failed 
 using libvirt 0.10.2
 
 On Fri, Nov 23, 2012 at 11:13:58AM +0200, Ido Levy wrote:
   From: Daniel P. Berrange berra...@redhat.com
   To: Ido Levy/Haifa/IBM@IBMIL, 
   Cc: libvir-list@redhat.com
   Date: 23/11/2012 10:59 AM
   Subject: Re: [libvirt] Remote connection to KVM hypervisor failed 
   using libvirt 0.10.2
   
   On Fri, Nov 23, 2012 at 07:43:12AM +0200, Ido Levy wrote:
Hello,

I compiled libvirt 0.10.2 from source providing extra parameters 
to 
  the 
configure procedure to support phyp and hyper-v driver support, 
and 
  python 
binding.
When running virsh from the tools directory (libvirt-0.10.2/tools) 
and 
  
trying to connect to remote KVM hypervisor using connect 
qemu+ssh://user@hostname/system
I got the following error
error: Failed to connect to the hypervisor
error: End of file while reading data: : Input/output error

The same scenario working without any issue using virsh tool that 
is 
shipped with RHEL distribution.

Any advise how can I figure out how to resolve this.
   
   What are the full args you passed to 'configure' ?
   
   Daniel
  
   ./configure --with-python --with-phyp --with-hyperv
 
 Ok, that's the problem. If you want your build to be able to connect
 to the RPM based build, you need to make it use the same paths. For
 this you need to pass 
 
./configure --with-python --with-phyp --with-hyperv \
--prefix=/usr --sysconfdir=/etc --localstatedir=/var
 

Thank Much !

Will try it

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

Re: [libvirt] Remote connection to KVM hypervisor failed using libvirt 0.10.2

2012-11-23 Thread Ido Levy
 From: Daniel P. Berrange berra...@redhat.com
 To: Ido Levy/Haifa/IBM@IBMIL, 
 Cc: libvir-list@redhat.com
 Date: 23/11/2012 12:04 PM
 Subject: Re: [libvirt] Remote connection to KVM hypervisor failed 
 using libvirt 0.10.2
 
 On Fri, Nov 23, 2012 at 11:13:58AM +0200, Ido Levy wrote:
   From: Daniel P. Berrange berra...@redhat.com
   To: Ido Levy/Haifa/IBM@IBMIL, 
   Cc: libvir-list@redhat.com
   Date: 23/11/2012 10:59 AM
   Subject: Re: [libvirt] Remote connection to KVM hypervisor failed 
   using libvirt 0.10.2
   
   On Fri, Nov 23, 2012 at 07:43:12AM +0200, Ido Levy wrote:
Hello,

I compiled libvirt 0.10.2 from source providing extra parameters 
to 
  the 
configure procedure to support phyp and hyper-v driver support, 
and 
  python 
binding.
When running virsh from the tools directory (libvirt-0.10.2/tools) 
and 
  
trying to connect to remote KVM hypervisor using connect 
qemu+ssh://user@hostname/system
I got the following error
error: Failed to connect to the hypervisor
error: End of file while reading data: : Input/output error

The same scenario working without any issue using virsh tool that 
is 
shipped with RHEL distribution.

Any advise how can I figure out how to resolve this.
   
   What are the full args you passed to 'configure' ?
   
   Daniel
  
   ./configure --with-python --with-phyp --with-hyperv
 
 Ok, that's the problem. If you want your build to be able to connect
 to the RPM based build, you need to make it use the same paths. For
 this you need to pass 
 
./configure --with-python --with-phyp --with-hyperv \
--prefix=/usr --sysconfdir=/etc --localstatedir=/var


Thanks ! it solved the problem of qemu+ssh remote connection.
I still get errors while trying to connect to HMC and Hyper-v

virsh # connect hyperv://hyperv-server/system
Enter username for hyperv-server [administrator]: domain\user
Enter domain\user password for hyperv-server:
2012-11-23 09:24:49.452+: 26342: error : hypervDebugHandler:1443 : 
openwsman error: NULL response
error: Failed to connect to the hypervisor
error: internal error Transport error during enumeration: Could not 
connect (7)


virsh # connect phyp://user@hmc/system
Enter user's password for hmc:
error: Failed to connect to the hypervisor
error: An error occurred, but the cause is unknown


I would appreciate your advise, I didn't find any logs I can look at.

Thanks,

Ido

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

Re: [libvirt] [PATCH 3/3] network: use dnsmasq --bind-dynamic when available

2012-11-23 Thread Gene Czarcinski

On 11/21/2012 09:55 PM, Laine Stump wrote:

This bug resolves CVE-2012-3411, which is described in the following
bugzilla report:

   https://bugzilla.redhat.com/show_bug.cgi?id=833033

The following report is specifically for libvirt on Fedora:

   https://bugzilla.redhat.com/show_bug.cgi?id=874702

In short, a dnsmasq instance run with the intention of listening for
DHCP/DNS requests only on a libvirt virtual network (which is
constructed using a Linux host bridge) would also answer queries sent
from outside the virtualization host.

This patch takes advantage of a new dnsmasq option --bind-dynamic,
which will cause the listening socket to be setup such that it will
only receive those requests that actually come in via the bridge
interface. In order for this behavior to actually occur, not only must
--bind-interfaces be replaced with --bind-dynamic, but also all
--listen-address options must be replaced with a single
--interface option. Fully:

--bind-interfaces --except-interface lo --listen-address x.x.x.x ...

(with --listen-address possibly repeated) is replaced with:

--bind-dynamic --interface virbrX

I have some questions about this change.

1.  If I correctly understand the problem being addressed (not a given), 
a dnsmasq instance providing a dns service to a virtual network 
interface was responding to queries on other network interfaces (virtual 
or real).  Obviously (to me) this is not desired and should be 
considered a security problem.  This series of patches is intended to 
address this problem while continuing to support older versions of 
dnsmasq which do not support bind-dynamic.


[If I understand correctly then, while this is a problem for IPv4, it 
could be even more critical for IPv6.]


2.  I assume that this change still supports queries originating on the 
virtualization host and directed to the virtual network interface.


3.  I assume that dnsmasq's support of DHCP continues as before.

[I will be implementing this update and testing it over the next couple 
of days.  For one thing, I need to integrate my DHCPv6, etc. patches 
with this.  For one thing, I need to pick up the dnsmasq version 
implemented by this patch.]


4.  What about the situation where an Internet publically available 
service is implemented on a virtual (guest) system.  I assume that the 
dnsmasq instance for the virtual network interface will not be directly 
available for external queries.  How about if the virtualization host is 
running yet another instance of dnsmasq (not started by libvirt) which 
forwards queries to the dnsmasq instance started by libvirt (the query 
would be sent to an address on the virtual network interface).


5.  I assume dnsmasq will respond to queries on any IPv4 or IPv6 
(gateway) address defined on a virtual network interface.


6.  I assume that, if no IPv4 or IPv6 (gateway) addresses are defined on 
an interface, dnsmasq will not be started for that interface.


7.  Are there any conditions where bind-interface would still be 
preferable to bind-dynamic?  [Maybe I need to ask Simon Kelley this 
question.]


Comment:  You sure did put a lot of effort into making sure that libvirt 
would still work with older versions of dnsmasq which did not support 
bind-dynamic.


Gene

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


Re: [libvirt] [PATCHv2] virsh: Report error when taking a snapshot with empty --memspec argument

2012-11-23 Thread Martin Kletzander
On 11/22/2012 02:41 PM, Peter Krempa wrote:
 When the value of memspec was empty taking of a snapshot failed without
 reporting an error.
 ---
  tools/virsh-snapshot.c | 14 --
  1 file changed, 8 insertions(+), 6 deletions(-)
 
 diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
 index 398730c..8ec6456 100644
 --- a/tools/virsh-snapshot.c
 +++ b/tools/virsh-snapshot.c
 @@ -358,18 +358,19 @@ cmdSnapshotCreateAs(vshControl *ctl, const vshCmd *cmd)
  if (desc)
  virBufferEscapeString(buf,   description%s/description\n, 
 desc);
 
 -if (vshCommandOptString(cmd, memspec, memspec)  0 ||
 -vshParseSnapshotMemspec(ctl, buf, memspec)  0) {
 -virBufferFreeAndReset(buf);
 +if (vshCommandOptString(cmd, memspec, memspec)  0) {
 +vshError(ctl, _(memspec argument must not be empty));
  goto cleanup;
  }
 +
 +if (memspec  vshParseSnapshotMemspec(ctl, buf, memspec)  0)
 +goto cleanup;
 +
  if (vshCommandOptBool(cmd, diskspec)) {
  virBufferAddLit(buf,   disks\n);
  while ((opt = vshCommandOptArgv(cmd, opt))) {
 -if (vshParseSnapshotDiskspec(ctl, buf, opt-data)  0) {
 -virBufferFreeAndReset(buf);
 +if (vshParseSnapshotDiskspec(ctl, buf, opt-data)  0)
  goto cleanup;
 -}
  }
  virBufferAddLit(buf,   /disks\n);
  }
 @@ -390,6 +391,7 @@ cmdSnapshotCreateAs(vshControl *ctl, const vshCmd *cmd)
  ret = vshSnapshotCreate(ctl, dom, buffer, flags, NULL);
 
  cleanup:
 +virBufferFreeAndReset(buf);
  VIR_FREE(buffer);
  if (dom)
  virDomainFree(dom);
 

I've missed the leak in the first version, thanks for finding that out.
 I double-checked this one and it seems alright, so ACK.

Martin

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


Re: [libvirt] [PATCHv2] virsh: Report error when taking a snapshot with empty --memspec argument

2012-11-23 Thread Peter Krempa

On 11/23/12 13:47, Martin Kletzander wrote:

On 11/22/2012 02:41 PM, Peter Krempa wrote:

When the value of memspec was empty taking of a snapshot failed without
reporting an error.
---
  tools/virsh-snapshot.c | 14 --
  1 file changed, 8 insertions(+), 6 deletions(-)


...



I've missed the leak in the first version, thanks for finding that out.
  I double-checked this one and it seems alright, so ACK.

Martin



Pushed; Thanks.

Peter

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


[libvirt] [BUG] storage.xml: owner|group=-1 → 2^32-1 on 32 Bit

2012-11-23 Thread Philipp Hahn
Hello,

when you install and use libvirt in a 32 bit environment, the handling of 
owner and group in /etc/libvirt/storage/*.xml is broken: The initial -1 is 
printed as an unsigned int and is thus converted to +(2^32-1):
 # cat /etc/libvirt/storage/default.xml
 !--
 WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
 OVERWRITTEN AND LOST. Changes to this xml configuration should be made
 using: virsh pool-edit default
 or other application using the libvirt API.
 --

 pool type='dir'
   namedefault/name
   uuid4e2670b8-9dc3-528e-6fc2-58268e99f44f/uuid
   capacity unit='bytes'0/capacity
   allocation unit='bytes'0/allocation
   available unit='bytes'0/available
   source
   /source
   target
 path/var/lib/libvirt/images/path
 permissions
   mode0700/mode
   owner4294967295/owner
   group4294967295/group
 /permissions
   /target
 /pool

When you next restart libvirtd virStorageDefParsePerms() tries to parse that 
as an signed int, which fails in virXPathLongBase() because of
 182 if (*value != obj-floatval) {
 (gdb) print *value
 $11 = -2147483648
 (gdb) print obj-floatval
 $12 = 4294967295
 (gdb) print /x *value
 $13 = 0x8000
 (gdb) print /x obj-floatval
 $14 = 0x

This then prints the following error messages:
 2012-11-23 14:03:18.877+: 25536: error : virStorageDefParsePerms:613 :
 XML error: malformed owner element
 2012-11-23 14:03:19.581+:  25529: error : 
storagePoolSetAutostart:1056 : Failed to create symlink
 '/etc/libvirt/storage/autostart/default.xml' to '/etc/libvirt/storage/def

The change to print owner and group as %d instead of %u was introdeces in 
commit 37a10129:
 Update xml schemas according to libvirt source
...
 storage_conf: Print uid_t and gid_t as signed to storage pool XML.

Care to revert that change? Patch is attached.

Sincerely
Philipp
-- 
Philipp Hahn   Open Source Software Engineer  h...@univention.de
Univention GmbHbe open.   fon: +49 421 22 232- 0
Mary-Somerville-Str.1  D-28359 Bremen fax: +49 421 22 232-99
   http://www.univention.de/
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 7944555..b07a7aa 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1036,10 +1036,10 @@ virStoragePoolDefFormat(virStoragePoolDefPtr def) {
 virBufferAddLit(buf,permissions\n);
 virBufferAsprintf(buf,  mode0%o/mode\n,
   def-target.perms.mode);
-virBufferAsprintf(buf,  owner%d/owner\n,
-  (int) def-target.perms.uid);
-virBufferAsprintf(buf,  group%d/group\n,
-  (int) def-target.perms.gid);
+virBufferAsprintf(buf,  owner%u/owner\n,
+  (unsigned int) def-target.perms.uid);
+virBufferAsprintf(buf,  group%u/group\n,
+  (unsigned int) def-target.perms.gid);
 


signature.asc
Description: This is a digitally signed message part.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [BUG] storage.xml: owner|group=-1 → 2^32-1 on 32 Bit

2012-11-23 Thread Ján Tomko
On 11/23/12 15:17, Philipp Hahn wrote:
 Hello,
 
 when you install and use libvirt in a 32 bit environment, the handling of 
 owner and group in /etc/libvirt/storage/*.xml is broken: The initial -1 is 
 printed as an unsigned int and is thus converted to +(2^32-1):
...
 
 When you next restart libvirtd virStorageDefParsePerms() tries to parse that 
 as an signed int, which fails in virXPathLongBase() because of
 182 if (*value != obj-floatval) {
 (gdb) print *value
 $11 = -2147483648
 (gdb) print obj-floatval
 $12 = 4294967295
 (gdb) print /x *value
 $13 = 0x8000
 (gdb) print /x obj-floatval
 $14 = 0x
 
 This then prints the following error messages:
 2012-11-23 14:03:18.877+: 25536: error : virStorageDefParsePerms:613 :
 XML error: malformed owner element
 2012-11-23 14:03:19.581+:  25529: error : 
 storagePoolSetAutostart:1056 : Failed to create symlink
 '/etc/libvirt/storage/autostart/default.xml' to '/etc/libvirt/storage/def
 
 The change to print owner and group as %d instead of %u was introdeces in 
 commit 37a10129:
 Update xml schemas according to libvirt source
 ...
 storage_conf: Print uid_t and gid_t as signed to storage pool XML.
 
 Care to revert that change? Patch is attached.
 
 Sincerely
 Philipp
 
 
 
 --
 libvir-list mailing list
 libvir-list@redhat.com
 https://www.redhat.com/mailman/listinfo/libvir-list

Hello,

originally the type and owner were stored in an int and printed as a
signed int (%d). Commit 3e2c3d8 changed the type to uid_t/gid_t, commit
8768149 (both pre-0.9.11) changed the printing format to unsigned (%u).

The change you asked to revert (part of 37a10129, pre-0.10.1) changed
the format back to %d, to prevent writing 2^32-1 instead of -1.

Jan

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


Re: [libvirt] Proposal: no dnsmasq (no dhcp and no dns) and no radvd option

2012-11-23 Thread Gene Czarcinski

On 11/20/2012 05:29 PM, Laine Stump wrote:

On 11/20/2012 02:36 PM, Gene Czarcinski wrote:

Laine mentioned something yesterday that got me to thinking: being
able to specify that dnsmasq is not to be started for an interface.

Let me expand that by saying that libvirt would not start dnsmasq for
either dns or dhcp and also would not start radvd.  However, the IPv4
and IPv6 gateway addresses would be defined on the virtual network
interface and the usual iptables and ip6tables rules would be in force.

This would allow a user to configure dnsmasq to meet any user desires
or use something completely different instead of dnsmasq.

Questions:  Useful?  Worth the time and effort?

That was already determined before I mentioned it to you - it's been
requested several times, and I've told some people it was going to
happen, although didn't say when:-).


OK, color this almost done (doc and schemas need updating).

Three new parameters are added:
  network disableDnsmasq='yes'  logDnsQueries='yes' logDhcp='yes' 

If nothing is specified, then the default is no, no, no so that things 
work as they do now.  Currently, if the boolean value is 'no' or false, 
then that parameter is not written out.  I could easily change that 
depending on what others want to do.


Laine, I changed this to be disableDnsmasq because that is the real 
result.  If this is specified, then starting radvd will also be 
suppressed.  It is as if no IPv4 or IPv6 addresses were specified. 
However, the iptables and ip6tables rules will remain the same since it 
is assumed that gateway addresses will be specified.


I have scratched an itch of mine by providing a way to specify that 
dns-queries and dhcp activity should be logged and that this is 
specified separately for each virtual network interface.


Dan suggested that a user might still want to run dnsmasq's dns service 
even if no IP addresses are specified.  However, in that case I am not 
sure what dnsmasq is suppose to monitor for queries ... it needs some 
kind of address or we will have the problems which the bind-dynamic 
update is suppose to fix.


I have not integrated this with the bind-dynamic update but plan to 
before I submit it.  I will be submitting this patch with the IPV6 
enhancement, DHCPv6, etc. series since it is yet again messing with the 
same code.


If any of the series get rejected rather than accepted, it will not be 
too much of a problem to rework them.


Gene

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