[libvirt] [PATCH] [configure] Fix libvirt dependency, and use $VAPIGEN

2011-11-07 Thread nirbheek
This is a rather trivial patch to raise the minimum libvirt dependency; at least
0.9.4 is required. In addition, it fixes the direct usage of `vapigen`, and uses
the result of the AC_PATH_PROG(VAPIGEN ...) call earlier so that the binary to
be used can be overridden as that macro was meant to allow.

Thanks!

 configure.ac |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

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


[libvirt] nwfilter - limit VM traffic to specific mac address

2011-11-07 Thread Shahar Havivi
Hi,

I want to limit VM traffic to a specific MAC address, ie VMs cannot
traffic each other other then a specific gateway.

I am using custom nwfilter name: isolatedprivatevlan-vdsm.xml
located in /etc/libvirt/nwfilter/:

filter name='isolatedprivatevlan-vdsm' chain='root'
filterref filter='clean-traffic'/
rule action='drop' direction='out' priority='500'
mac match='no' dstmacaddr='$GATEWAY_MAC'/
/rule
/filter


VM1 domian xml portion:
interface type=bridge
mac address=00:1a:4a:16:01:53/
model type=virtio/
source bridge=red/
filterref filter=isolatedprivatevlan-vdsm
parameter name=GATEWAY_MAC value=00:00:0c:07:ac:00/
/filterref
/interface


VM2 domian xml portion:
interface type=bridge
mac address=00:1a:4a:16:01:52/
model type=virtio/
source bridge=red/
filterref filter=isolatedprivatevlan-vdsm
parameter name=GATEWAY_MAC value=00:00:0c:07:ac:00/
/filterref
/interface


in each VM (Fedora 15 LiveCD) I assign ip:
# ifconfig eth0 10.35.1.240 netmask 255.255.254.0
# route add default gw 10.35.1.1

vm2:
# ifconfig eth0 10.35.1.241 netmask 255.255.254.0
# route add default gw 10.35.1.1

but the filter is not working,
I can ping the VMs from each other,

Am I missing something?
Thanks,
Shahar Havivi.

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


Re: [libvirt] Failing pool deletion testcase

2011-11-07 Thread Daniel P. Berrange
On Sat, Nov 05, 2011 at 02:41:41PM +0100, Guido Günther wrote:
 Hi,
 when running libvirt-tck I'm seeing this test failure:
 
 #   Failed test 'deleted pool'
 #   at /usr/share/libvirt-tck/tests/storage/110-disk-pool.t line 120.
 # died: Sys::Virt::Error (libvirt error code: 3, message: this function is 
 not supported by the connection driver: pool does not support pool deletion
 # )
 
 because pool deletion isn't supported by the disk storage backend. Since
 the test is there I wonder if there are patches floating around already
 to implement it? If not I guess wiping the partition table followed by a
 blockdev --reread-pt would be the right approach?

Yeah, we just need to blow away the DOS and/or  GPT partition table
signatures and trigger a re-read by the kernel The correct way would
be to use parted to clear it, the quick way would be to just write
zeros over the relevant areas.

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] libvirt-tck: Skip Test when no security model is in use

2011-11-07 Thread Daniel P. Berrange
On Sun, Nov 06, 2011 at 04:30:02PM +0100, Guido Günther wrote:
 Hi,
 if I'm reading this test correctly it's supposed to fail without a
 security model at work.
 
 The file images are always readable/writeable to the libvirt user and
 group without one.
 
 Cheers,
  -- Guido
 
 ---
  scripts/qemu/205-qcow2-double-backing-file.t |9 +++--
  1 files changed, 7 insertions(+), 2 deletions(-)
 
 diff --git a/scripts/qemu/205-qcow2-double-backing-file.t 
 b/scripts/qemu/205-qcow2-double-backing-file.t
 index 7ae278d..d3a5e33 100644
 --- a/scripts/qemu/205-qcow2-double-backing-file.t
 +++ b/scripts/qemu/205-qcow2-double-backing-file.t
 @@ -52,17 +52,22 @@ my $conn = eval { $tck-setup(); };
  BAIL_OUT failed to setup test harness: $@ if $@;
  END { $tck-cleanup if $tck; }
  
 +my $info;
 +eval {
 +$info = $conn-get_node_security_model();
 +};
 +
  SKIP: {
  skip Only relevant to QEMU driver, 26 unless $conn-get_type() eq 
 QEMU;
  skip Only relevant when run as root, 26 unless $ == 0;
  skip Only relevant for system driver, 26 unless
   $conn-get_uri() =~ m/system/;
 -
 +skip Only relevant when using a security model, 26 unless
 + $info  $info-{model};
  
  my $xml = $tck-generic_pool(dir)
   -mode(0755)-as_xml;
  
 -
  diag Defining transient storage pool $xml;
  my $pool;
  ok_pool(sub { $pool = $conn-define_storage_pool($xml) }, define 
 transient storage pool);

ACK


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] [configure] Fix libvirt dependency, and use $VAPIGEN

2011-11-07 Thread Michal Privoznik
On 07.11.2011 10:25, nirbh...@gentoo.org wrote:
 This is a rather trivial patch to raise the minimum libvirt dependency; at 
 least
 0.9.4 is required. In addition, it fixes the direct usage of `vapigen`, and 
 uses
 the result of the AC_PATH_PROG(VAPIGEN ...) call earlier so that the binary to
 be used can be overridden as that macro was meant to allow.
 
 Thanks!
 
  configure.ac |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
 
 --
 libvir-list mailing list
 libvir-list@redhat.com
 https://www.redhat.com/mailman/listinfo/libvir-list

Just for the record, this is for libvirt-glib

Michal

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


Re: [libvirt] bug: try to take disk snapshot for LVM2 Volume

2011-11-07 Thread Daniel P. Berrange
On Mon, Nov 07, 2011 at 01:14:12PM +0900, MATSUDA, Daiki wrote:
 Hi, Eric.
 
  On 09/29/2011 11:26 PM, MATSUDA, Daiki wrote:
  I tried the new snapshot function implemented by Eric Blake.
 
  It works very well for QCOW2 disk image system.
  But I often use LVM2 volume for QEMU virtual machines and tried to take
  disk snapshot by virsh command ( snapshot-create DOMNAME --disk-only).
  So, finally qemu monitor command 'snapshot_blkdev' accepts the LVM2
  volume and create QCOW2 snapshot image. In addition, domain's
  configuration file is replaced to use snapshot disk image instead of
  LVM2 volume.
  
  It sounds like virsh did what it was told, but that you told it so
  little information that it had to fill in the gaps and choose its own
  destination file name (hence the .1317357844 suffix after the action).
  Your situation sounds like a case where you may want a bit more control
  over the destination file name.
 
 I made the patch for the problem to take the snapshot but qcow2. It use
 the 'qemu-img' command, I know that it is not essential solution. But I
 think it is better than to link qemu's libraries.

There is an internal libvirt API for disk formats in src/util/storage_file.h

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] [configure] Fix libvirt dependency, and use $VAPIGEN

2011-11-07 Thread Daniel P. Berrange
On Mon, Nov 07, 2011 at 02:55:01PM +0530, nirbh...@gentoo.org wrote:
 From: Nirbheek Chauhan nirbh...@gentoo.org
 
 libvirt-0.9.4 is needed for at least VIR_DOMAIN_EVENT_SUSPENDED_RESTORED, etc
 from c1ff5dc63dc9d9ec05485bb695cbc66850759ee5 .
 
 $VAPIGEN from AC_PATH_PROG should be used instead of the raw binary `vapigen`
 otherwise it's not possible to override the vapigen binary to be used.
 ---
  configure.ac |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/configure.ac b/configure.ac
 index 0ac7a8f..4f87b37 100644
 --- a/configure.ac
 +++ b/configure.ac
 @@ -10,7 +10,7 @@ AC_CANONICAL_HOST
  
  AM_SILENT_RULES([yes])
  
 -LIBVIRT_REQUIRED=0.5.0
 +LIBVIRT_REQUIRED=0.9.4
  GLIB2_REQUIRED=2.10.0
  GOBJECT2_REQUIRED=2.10.0
  GIO_REQUIRED=2.10.0
 @@ -217,7 +217,7 @@ if test x$enable_introspection = xyes ; then
  fi
  if test x$enable_vala != xno ; then
  AC_MSG_CHECKING([$VAPIGEN support for --metadatadir])
 -vapigen --help | grep metadatadir 1/dev/null 21
 +$VAPIGEN --help | grep metadatadir 1/dev/null 21
  if test $? != 0 ; then
  if test x$enable_vala == xcheck ; then
  enable_vala=no

ACK


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 7/7] Fix default console type setting

2011-11-07 Thread Daniel P. Berrange
On Sat, Nov 05, 2011 at 08:58:59PM +0100, Matthias Bolte wrote:
 2011/10/20 Daniel P. Berrange berra...@redhat.com:
  From: Daniel P. Berrange berra...@redhat.com
 
  The default console type may vary based on the OS type. ie a Xen
  paravirt guests wants a 'xen' console, while a fullvirt guests
  wants a 'serial' console.
 
  A plain integer default console type in the capabilities does
  not suffice. Instead introduce a callback that is passed the
  OS type.
 
  * src/conf/capabilities.h: Use a callback for default console
   type
  * src/conf/domain_conf.c, src/conf/domain_conf.h: Use callback
   for default console type. Add missing LXC/OpenVZ console types.
  * src/esx/esx_driver.c, src/libxl/libxl_conf.c,
   src/lxc/lxc_conf.c, src/openvz/openvz_conf.c,
   src/phyp/phyp_driver.c, src/qemu/qemu_capabilities.c,
   src/uml/uml_conf.c, src/vbox/vbox_tmpl.c,
   src/vmware/vmware_conf.c, src/xen/xen_hypervisor.c,
   src/xenapi/xenapi_driver.c: Set default console type callback
  ---
 
 With this patch virt-aa-helper-test fails on Ubuntu:
 
 FAIL: exited with '1'
   console:  '--dryrun -r -u libvirt-----0123456789ab':
 FAIL: exited with '1'
   console (pty):  '--dryrun -r -u
 libvirt-----0123456789ab':
 FAIL: exited with '1'
   console (pipe):  '--dryrun -r -u
 libvirt-----0123456789ab':
 FAIL: virt-aa-helper-test

I've just sent a patch which ought to solve this


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

[libvirt] [PATCH] Add missing defaultConsoleTargetType callback for AppArmour

2011-11-07 Thread Daniel P. Berrange
From: Daniel P. Berrange berra...@redhat.com

Every instance of virCapsPtr must have the defaultConsoleTargetType
field set.

* src/security/virt-aa-helper.c: Add defaultConsoleTargetType to
  virCapsPtr
---
 src/security/virt-aa-helper.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 71a4586..e8e77ba 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -685,6 +685,11 @@ caps_mockup(vahControl * ctl, const char *xmlStr)
 return rc;
 }
 
+static int aaDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED)
+{
+return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
+}
+
 static int
 get_definition(vahControl * ctl, const char *xmlStr)
 {
@@ -703,6 +708,8 @@ get_definition(vahControl * ctl, const char *xmlStr)
 goto exit;
 }
 
+caps-defaultConsoleTargetType = aaDefaultConsoleType;
+
 if ((guest = virCapabilitiesAddGuest(ctl-caps,
  ctl-hvm,
  ctl-arch,
-- 
1.7.6.4

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


Re: [libvirt] [PATCH] qemu: drop driver lock around sleep

2011-11-07 Thread Michal Privoznik
On 05.11.2011 02:49, Eric Blake wrote:
 qemu/THREADS.txt is explicit that the driver lock must not be
 held for long lengths of time, as it blocks all attempts to
 manage any other vms on the same connection.  We were violating
 this by sleep()ing while waiting for a qemu child process to
 finish execution during actions such as destroy.
 
 * src/qemu/qemu_process.h (qemuProcessKill): Alter signature.
 * src/qemu/qemu_process.c (qemuProcessKill): Add parameter.
 (qemuProcessFakeReboot, qemuProcessShutdownOrReboot)
 (qemuProcessStop): Update callers.
 * src/qemu/qemu_driver.c (qemuDomainDestroyFlags): Likewise.
 ---
 
 Without this patch, problems in halting one domain could lock
 out actions on all other domains for more than 3 seconds, which
 is awfully long.
 
 This doesn't solve all the problems - it is still possible to
 have a stuck NFS server being the reason for difficulties in
 stopping a domain, such as an lstat() call while attempting to
 relabel file systems, and those calls are still done while
 the driver lock is held; but I'll be submitting further patches
 as I try and reduce the critical section sizes.
 
 I'm not sure whether this qualifies for 0.9.7 or should wait
 for post-release.

I'd feel more comfortable to take this in after release. Hopefully,
0.9.7 is going to be stable release (at least by features/bug fixes
ratio) even if this is a small and good looking patch.
 
  src/qemu/qemu_driver.c  |2 +-
  src/qemu/qemu_process.c |   35 ---
  src/qemu/qemu_process.h |3 ++-
  3 files changed, 31 insertions(+), 9 deletions(-)
 

ACK

Michal

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


Re: [libvirt] [PATCH] [configure] Fix libvirt dependency, and use $VAPIGEN

2011-11-07 Thread Nirbheek Chauhan
On Mon, Nov 7, 2011 at 3:33 PM, Michal Privoznik mpriv...@redhat.com wrote:
 On 07.11.2011 10:25, nirbh...@gentoo.org wrote:
 This is a rather trivial patch to raise the minimum libvirt dependency; at 
 least
 0.9.4 is required. In addition, it fixes the direct usage of `vapigen`, and 
 uses
 the result of the AC_PATH_PROG(VAPIGEN ...) call earlier so that the binary 
 to
 be used can be overridden as that macro was meant to allow.

 Just for the record, this is for libvirt-glib


Ah yes, I forgot to put that in the subject, didn't I? Sorry about that. :-)

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


Re: [libvirt] [PATCH] qemu: drop driver lock around sleep

2011-11-07 Thread Daniel P. Berrange
On Fri, Nov 04, 2011 at 07:49:51PM -0600, Eric Blake wrote:
 qemu/THREADS.txt is explicit that the driver lock must not be
 held for long lengths of time, as it blocks all attempts to
 manage any other vms on the same connection.  We were violating
 this by sleep()ing while waiting for a qemu child process to
 finish execution during actions such as destroy.
 
 * src/qemu/qemu_process.h (qemuProcessKill): Alter signature.
 * src/qemu/qemu_process.c (qemuProcessKill): Add parameter.
 (qemuProcessFakeReboot, qemuProcessShutdownOrReboot)
 (qemuProcessStop): Update callers.
 * src/qemu/qemu_driver.c (qemuDomainDestroyFlags): Likewise.
 ---
 
 Without this patch, problems in halting one domain could lock
 out actions on all other domains for more than 3 seconds, which
 is awfully long.
 
 This doesn't solve all the problems - it is still possible to
 have a stuck NFS server being the reason for difficulties in
 stopping a domain, such as an lstat() call while attempting to
 relabel file systems, and those calls are still done while
 the driver lock is held; but I'll be submitting further patches
 as I try and reduce the critical section sizes.
 
 I'm not sure whether this qualifies for 0.9.7 or should wait
 for post-release.
 
  src/qemu/qemu_driver.c  |2 +-
  src/qemu/qemu_process.c |   35 ---
  src/qemu/qemu_process.h |3 ++-
  3 files changed, 31 insertions(+), 9 deletions(-)

Post-0.9.7 IMHO, since it doesn't really fix any bug - its just an
optimization.


I think we need to take a bit of a broader look at the way we
are dealing with the driver lock. Originally we intended that
the driver lock would very rarely be held - only when resolving
a virDomainPtr into a virDomainObjPtr, and when adding/removing
virDomainObjPtr instances to/from the domain list. These days
though we seem to be holding it more  more often due to the
growth in the number of stateful objects in qemu_driver. This
is reducing the effectiveness of our per-VM locks, leading to
quite significant serialization, except when we're asleep on
QEMU monitor calls.

While adding more  more places where we lock and unlock the
driver will reduce prolonged lock outs due to sleeping /
slow code, it is not going to really improve our true level
of concurrency.

We need quite a radical change in driver level locking IMHO.
Take a look at the driver struct members, which is what we
are protecting here really:

struct qemud_driver {
virMutex lock;

virThreadPoolPtr workerPool;

int privileged;

uid_t user;
gid_t group;
int dynamicOwnership;

unsigned int qemuVersion;
int nextvmid;

virCgroupPtr cgroup;
int cgroupControllers;
char **cgroupDeviceACL;

virDomainObjList domains;

brControl *brctl;
/* These four directories are ones libvirtd uses (so must be root:root
 * to avoid security risk from QEMU processes */
char *configDir;
char *autostartDir;
char *logDir;
char *stateDir;
/* These two directories are ones QEMU processes use (so must match
 * the QEMU user/group */
char *libDir;
char *cacheDir;
char *saveDir;
char *snapshotDir;
char *qemuImgBinary;
unsigned int vncAutoUnixSocket : 1;
unsigned int vncTLS : 1;
unsigned int vncTLSx509verify : 1;
unsigned int vncSASL : 1;
char *vncTLSx509certdir;
char *vncListen;
char *vncPassword;
char *vncSASLdir;
unsigned int spiceTLS : 1;
char *spiceTLSx509certdir;
char *spiceListen;
char *spicePassword;
char *hugetlbfs_mount;
char *hugepage_path;

unsigned int macFilter : 1;
ebtablesContext *ebtables;
unsigned int relaxedACS : 1;
unsigned int vncAllowHostAudio : 1;
unsigned int clearEmulatorCapabilities : 1;
unsigned int allowDiskFormatProbing : 1;
unsigned int setProcessName : 1;

int maxProcesses;

int max_queued;

virCapsPtr caps;

virDomainEventStatePtr domainEventState;

char *securityDriverName;
virSecurityManagerPtr securityManager;

char *saveImageFormat;
char *dumpImageFormat;

char *autoDumpPath;
bool autoDumpBypassCache;

bool autoStartBypassCache;

pciDeviceList *activePciHostdevs;

virBitmapPtr reservedVNCPorts;

virSysinfoDefPtr hostsysinfo;

virLockManagerPluginPtr lockManager;

/* Mapping of 'char *uuidstr' - virConnectPtr
 * of guests which will be automatically killed
 * when the virConnectPtr is closed*/
virHashTablePtr autodestroy;
};


Looking at those you can say

 - Some are readonly and can never change for the lifetime of libvirtd
   eg, privileged, configDir, autostartDir, stateDir, etc. We should
   not require any locking to access these.

 - Some are loaded from the config file, and while currently readonly,
   could in theory be be changed. eg vnc/spice parameters, save
   image format, etc. We could move these into a 'qemu_driver_config'
   struct and use userspace RCU to access the config 

[libvirt] [PATCH] Add ability to managed save libvirt domains

2011-11-07 Thread Pavel Odintsov
---
 src/libvirt-php.c |   21 +
 src/libvirt-php.h |1 +
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index f590595..1c39e31 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -91,6 +91,7 @@ static function_entry libvirt_functions[] = {
PHP_FE(libvirt_domain_core_dump, NULL)
PHP_FE(libvirt_domain_shutdown, NULL)
PHP_FE(libvirt_domain_suspend, NULL)
+   PHP_FE(libvirt_domain_managedsave, NULL)
PHP_FE(libvirt_domain_undefine, NULL)
PHP_FE(libvirt_domain_reboot, NULL)
PHP_FE(libvirt_domain_define_xml, NULL)
@@ -3625,6 +3626,26 @@ PHP_FUNCTION(libvirt_domain_suspend)
 }
 
 /*
+   Function name:  libvirt_domain_managedsave
+   Since version:  0.4.1(-1)
+   Description:Function is used to managed save the domain (domain was 
unloaded from memory and its state was saved to disk) identified by it's 
resource
+   Arguments:  @res [resource]: libvirt domain resource, e.g. from 
libvirt_domain_lookup_by_*()
+   Returns:TRUE for success, FALSE on error
+*/
+PHP_FUNCTION(libvirt_domain_managedsave)
+{
+   php_libvirt_domain *domain=NULL;
+   zval *zdomain;
+   int retval;
+   
+   GET_DOMAIN_FROM_ARGS(r,zdomain);
+   retval=virDomainManagedSave(domain-domain, 0);
+   DPRINTF(%s: virDomainManagedSave(%p) returned %d\n, PHPFUNC, 
domain-domain, retval);
+   if (retval != 0) RETURN_FALSE;
+   RETURN_TRUE;
+}
+
+/*
Function name:  libvirt_domain_undefine
Since version:  0.4.1(-1)
Description:Function is used to undefine the domain identified by 
it's resource
diff --git a/src/libvirt-php.h b/src/libvirt-php.h
index 2addae2..8a3f4ff 100644
--- a/src/libvirt-php.h
+++ b/src/libvirt-php.h
@@ -237,6 +237,7 @@ PHP_FUNCTION(libvirt_domain_resume);
 PHP_FUNCTION(libvirt_domain_core_dump);
 PHP_FUNCTION(libvirt_domain_shutdown);
 PHP_FUNCTION(libvirt_domain_suspend);
+PHP_FUNCTION(libvirt_domain_managedsave);
 PHP_FUNCTION(libvirt_domain_undefine);
 PHP_FUNCTION(libvirt_domain_reboot);
 PHP_FUNCTION(libvirt_domain_define_xml);
-- 
1.7.2.5

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


Re: [libvirt] [PATCH] libvirt-tck: Skip Test when no security model is in use

2011-11-07 Thread Guido Günther
On Mon, Nov 07, 2011 at 10:00:25AM +, Daniel P. Berrange wrote:
 On Sun, Nov 06, 2011 at 04:30:02PM +0100, Guido Günther wrote:
  Hi,
  if I'm reading this test correctly it's supposed to fail without a
  security model at work.
  
  The file images are always readable/writeable to the libvirt user and
  group without one.
  
  Cheers,
   -- Guido
  
  ---
   scripts/qemu/205-qcow2-double-backing-file.t |9 +++--
   1 files changed, 7 insertions(+), 2 deletions(-)
  
  diff --git a/scripts/qemu/205-qcow2-double-backing-file.t 
  b/scripts/qemu/205-qcow2-double-backing-file.t
  index 7ae278d..d3a5e33 100644
  --- a/scripts/qemu/205-qcow2-double-backing-file.t
  +++ b/scripts/qemu/205-qcow2-double-backing-file.t
  @@ -52,17 +52,22 @@ my $conn = eval { $tck-setup(); };
   BAIL_OUT failed to setup test harness: $@ if $@;
   END { $tck-cleanup if $tck; }
   
  +my $info;
  +eval {
  +$info = $conn-get_node_security_model();
  +};
  +
   SKIP: {
   skip Only relevant to QEMU driver, 26 unless $conn-get_type() eq 
  QEMU;
   skip Only relevant when run as root, 26 unless $ == 0;
   skip Only relevant for system driver, 26 unless
  $conn-get_uri() =~ m/system/;
  -
  +skip Only relevant when using a security model, 26 unless
  +   $info  $info-{model};
   
   my $xml = $tck-generic_pool(dir)
  -mode(0755)-as_xml;
   
  -
   diag Defining transient storage pool $xml;
   my $pool;
   ok_pool(sub { $pool = $conn-define_storage_pool($xml) }, define 
  transient storage pool);
 
 ACK
Pushed. Thanks.
 -- Guido

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


Re: [libvirt] Failing pool deletion testcase

2011-11-07 Thread Guido Günther
Hi Daniel,
On Mon, Nov 07, 2011 at 09:56:39AM +, Daniel P. Berrange wrote:
 On Sat, Nov 05, 2011 at 02:41:41PM +0100, Guido Günther wrote:
  Hi,
  when running libvirt-tck I'm seeing this test failure:
  
  #   Failed test 'deleted pool'
  #   at /usr/share/libvirt-tck/tests/storage/110-disk-pool.t line 120.
  # died: Sys::Virt::Error (libvirt error code: 3, message: this function is 
  not supported by the connection driver: pool does not support pool deletion
  # )
  
  because pool deletion isn't supported by the disk storage backend. Since
  the test is there I wonder if there are patches floating around already
  to implement it? If not I guess wiping the partition table followed by a
  blockdev --reread-pt would be the right approach?
 
 Yeah, we just need to blow away the DOS and/or  GPT partition table
 signatures and trigger a re-read by the kernel The correct way would
 be to use parted to clear it, the quick way would be to just write
 zeros over the relevant areas.

Yes, adding this to parted first makes even more sense. I'll add this to
my TODO list.
Cheers,
 -- Guido

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


Re: [libvirt] [libvirt-glib 01/23] Add helpers in libvirt-gconfig-helpers.[ch]

2011-11-07 Thread Christophe Fergeau
Hi,

On Tue, Oct 18, 2011 at 12:06:50PM +0100, Daniel P. Berrange wrote:
 On Fri, Oct 07, 2011 at 11:40:46AM +0200, Christophe Fergeau wrote:
  These helper functions will be useful later on.
  ---
   examples/Makefile.am  |1 +
   libvirt-gconfig/Makefile.am   |3 +
   libvirt-gconfig/libvirt-gconfig-helpers.c |  179 
  +
   libvirt-gconfig/libvirt-gconfig-helpers.h |   48 
   libvirt-gconfig/libvirt-gconfig-object.c  |   52 -
   libvirt-gconfig/libvirt-gconfig.h |2 +
   libvirt-gconfig/libvirt-gconfig.sym   |1 +
   libvirt-gobject/Makefile.am   |2 +
   8 files changed, 236 insertions(+), 52 deletions(-)
   create mode 100644 libvirt-gconfig/libvirt-gconfig-helpers.c
   create mode 100644 libvirt-gconfig/libvirt-gconfig-helpers.h
  
  diff --git a/libvirt-gconfig/libvirt-gconfig-helpers.h 
  b/libvirt-gconfig/libvirt-gconfig-helpers.h
  new file mode 100644
  index 000..1bdf2d0
  --- /dev/null
  +++ b/libvirt-gconfig/libvirt-gconfig-helpers.h
  @@ -0,0 +1,48 @@
 
  +
  +GQuark gvir_config_object_error_quark(void);
  +#define GVIR_CONFIG_OBJECT_ERROR gvir_config_object_error_quark()
  +
  +GError *gvir_xml_error_new(GQuark domain, gint code,
  +   const gchar *format, ...);
  +xmlNodePtr gvir_config_xml_parse(const char *xml,
  + const char *root_node,
  + GError **err);
  +xmlNode * gvir_config_xml_get_element (xmlNode *node, ...);
  +xmlChar * gvir_config_xml_get_child_element_content (xmlNode*node,
  + const char 
  *child_name);
  +char *gvir_config_xml_get_child_element_content_glib (xmlNode*node,
  +  const char 
  *child_name);
 
 
  diff --git a/libvirt-gconfig/libvirt-gconfig.sym 
  b/libvirt-gconfig/libvirt-gconfig.sym
  index 2d09c37..24407c3 100644
  --- a/libvirt-gconfig/libvirt-gconfig.sym
  +++ b/libvirt-gconfig/libvirt-gconfig.sym
  @@ -22,6 +22,7 @@ LIBVIRT_GOBJECT_0.0.1 {
  gvir_config_node_device_new;
   
  gvir_config_object_get_type;
  +   gvir_config_object_error_quark;
 
 
 Don't we want to also export the rest of those new APIs in
 gconfig-helpers.h ?
 
 
 ACK, if you tell me why they're not required, or if you add them
 before pushing the patch.

At this point, I'm not sure what kind of low-level API we want to make
available to the library user (by low-level, I mean letting people directly
poke at the xmlNode wrapped in a GVirConfigObject instance). That's why I
chose not to export them for now, and to make them public if/once they are
needed.
If you think they should be exported, I'll make the change.

Christophe


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

Re: [libvirt] [libvirt-glib 01/23] Add helpers in libvirt-gconfig-helpers.[ch]

2011-11-07 Thread Daniel P. Berrange
On Mon, Nov 07, 2011 at 02:52:24PM +0100, Christophe Fergeau wrote:
 Hi,
 
 On Tue, Oct 18, 2011 at 12:06:50PM +0100, Daniel P. Berrange wrote:
  On Fri, Oct 07, 2011 at 11:40:46AM +0200, Christophe Fergeau wrote:
   These helper functions will be useful later on.
   ---
examples/Makefile.am  |1 +
libvirt-gconfig/Makefile.am   |3 +
libvirt-gconfig/libvirt-gconfig-helpers.c |  179 
   +
libvirt-gconfig/libvirt-gconfig-helpers.h |   48 
libvirt-gconfig/libvirt-gconfig-object.c  |   52 -
libvirt-gconfig/libvirt-gconfig.h |2 +
libvirt-gconfig/libvirt-gconfig.sym   |1 +
libvirt-gobject/Makefile.am   |2 +
8 files changed, 236 insertions(+), 52 deletions(-)
create mode 100644 libvirt-gconfig/libvirt-gconfig-helpers.c
create mode 100644 libvirt-gconfig/libvirt-gconfig-helpers.h
   
   diff --git a/libvirt-gconfig/libvirt-gconfig-helpers.h 
   b/libvirt-gconfig/libvirt-gconfig-helpers.h
   new file mode 100644
   index 000..1bdf2d0
   --- /dev/null
   +++ b/libvirt-gconfig/libvirt-gconfig-helpers.h
   @@ -0,0 +1,48 @@
  
   +
   +GQuark gvir_config_object_error_quark(void);
   +#define GVIR_CONFIG_OBJECT_ERROR gvir_config_object_error_quark()
   +
   +GError *gvir_xml_error_new(GQuark domain, gint code,
   +   const gchar *format, ...);
   +xmlNodePtr gvir_config_xml_parse(const char *xml,
   + const char *root_node,
   + GError **err);
   +xmlNode * gvir_config_xml_get_element (xmlNode *node, ...);
   +xmlChar * gvir_config_xml_get_child_element_content (xmlNode*node,
   + const char 
   *child_name);
   +char *gvir_config_xml_get_child_element_content_glib (xmlNode*node,
   +  const char 
   *child_name);
  
  
   diff --git a/libvirt-gconfig/libvirt-gconfig.sym 
   b/libvirt-gconfig/libvirt-gconfig.sym
   index 2d09c37..24407c3 100644
   --- a/libvirt-gconfig/libvirt-gconfig.sym
   +++ b/libvirt-gconfig/libvirt-gconfig.sym
   @@ -22,6 +22,7 @@ LIBVIRT_GOBJECT_0.0.1 {
 gvir_config_node_device_new;

 gvir_config_object_get_type;
   + gvir_config_object_error_quark;
  
  
  Don't we want to also export the rest of those new APIs in
  gconfig-helpers.h ?
  
  
  ACK, if you tell me why they're not required, or if you add them
  before pushing the patch.
 
 At this point, I'm not sure what kind of low-level API we want to make
 available to the library user (by low-level, I mean letting people directly
 poke at the xmlNode wrapped in a GVirConfigObject instance). That's why I
 chose not to export them for now, and to make them public if/once they are
 needed.
 If you think they should be exported, I'll make the change.

Personally I'd rather we didn't expose libxml2 data types in our public
API, since it feels like an admission of defeat in our object model.
I just mentioned the  .syms file, because I saw the symbols included
in the libvirt-gconfig/libvirt-gconfig-helpers.h header which presumably
will end up in /usr/include.

So if we want to avoid exposing libxml2 types in our API, we should
ensure the header file in question doesn't get installed in /usr/include
too.

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] Add missing defaultConsoleTargetType callback for AppArmour

2011-11-07 Thread Matthias Bolte
2011/11/7 Daniel P. Berrange berra...@redhat.com:
 From: Daniel P. Berrange berra...@redhat.com

 Every instance of virCapsPtr must have the defaultConsoleTargetType
 field set.

 * src/security/virt-aa-helper.c: Add defaultConsoleTargetType to
  virCapsPtr
 ---
  src/security/virt-aa-helper.c |    7 +++
  1 files changed, 7 insertions(+), 0 deletions(-)

 diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
 index 71a4586..e8e77ba 100644
 --- a/src/security/virt-aa-helper.c
 +++ b/src/security/virt-aa-helper.c
 @@ -685,6 +685,11 @@ caps_mockup(vahControl * ctl, const char *xmlStr)
     return rc;
  }

 +static int aaDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED)
 +{
 +    return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
 +}
 +
  static int
  get_definition(vahControl * ctl, const char *xmlStr)
  {
 @@ -703,6 +708,8 @@ get_definition(vahControl * ctl, const char *xmlStr)
         goto exit;
     }

 +    caps-defaultConsoleTargetType = aaDefaultConsoleType;
 +
     if ((guest = virCapabilitiesAddGuest(ctl-caps,
                                          ctl-hvm,
                                          ctl-arch,

ACK with ctl-caps instead of caps.

I tested it with that fixed and it works.

-- 
Matthias Bolte
http://photron.blogspot.com

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

Re: [libvirt] [PATCHv2] build: fix build on platforms without ptsname_r

2011-11-07 Thread Daniel P. Berrange
On Fri, Nov 04, 2011 at 08:06:05PM -0600, Eric Blake wrote:
 MacOS lacks ptsname_r, and gnulib doesn't (yet) provide it.
 But we can avoid it altogether, by using gnulib openpty()
 instead.  Note that we do _not_ want the pt_chown module;
 all systems that we currently port to can either properly do
 openpty() and/or grantpt(), or lack ptys altogether; we are
 not porting to any system that requires us to deal with the
 hassle of installing a setuid pt_chown helper just to satisfy
 gnulib's ability to provide openpty() on even more platforms.
 
 * .gnulib: Update to latest, for openpty fixes
 * bootstrap.conf (gnulib_modules): Add openpty, ttyname_r.
 (gnulib_tool_option_extras): Exclude pt_chown module.
 * src/util/util.c (virFileOpenTty): Rewrite in terms of openpty
 and ttyname_r.
 * src/util/util.h (virFileOpenTtyAt): Delete dead prototype.
 ---
 
 Alas, this is just complicated enough that I don't feel comfortable
 pushing it under the build-breaker rule, even though I have verified
 that it fixes builds on both FreeBSD and Cygwin, as well as still
 behaves correctly with LXC containers on Linux.  Anyone willing to
 give this a review before 0.9.7 gets released?
 
  .gnulib |2 +-
  bootstrap.conf  |3 ++
  src/util/util.c |   73 --
  src/util/util.h |5 
  4 files changed, 58 insertions(+), 25 deletions(-)

ACK


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] [Qemu-devel] Virtual serial logging server?

2011-11-07 Thread Mulyadi Santosa
On Sun, Nov 6, 2011 at 23:21, Reeted ree...@shiftmail.org wrote:
 Can you suggest a server application to receive all such TCP connections and
 log serial data for many virtual machines at once?

 In particular I would be interested in something with quotas, i.e. something
 that deletes old lines from the logs of a certain VM when the filesystem
 space occupied by the serial logs of such VM gets over a certain amount of
 space. So that the log space for other VMs is not starved in case one of
 them loops.

Are you referring something like remote system logging i.e using
rsyslog combined with logrotate? or something more sophisticated than
that?

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

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


Re: [libvirt] [PATCH 0/3] Guest NUMA topology support - v1

2011-11-07 Thread Eric Blake

On 11/06/2011 06:55 AM, Bharata B Rao wrote:


daemon-conf fails, but it fails even without my patches too. I guess my
patches are really affecting it.

TEST: daemon-conf
   .!!...!!!./daemon-conf: line 98: kill: (7811) - 
No such process
!   34  FAILED



That's a (known) bug in the testsuite; we really need to fix that test 
to skip instead of fail if you don't have the right prereqs installed. 
Basically, you need cyrus-sasl-devel installed for the test to have a 
chance of passing: 
https://www.redhat.com/archives/libvir-list/2010-March/msg00395.html


--
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org

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


Re: [libvirt] bug: try to take disk snapshot for LVM2 Volume

2011-11-07 Thread Eric Blake
On 11/06/2011 09:14 PM, MATSUDA, Daiki wrote:
 I made the patch for the problem to take the snapshot but qcow2. It use
 the 'qemu-img' command, I know that it is not essential solution. But I
 think it is better than to link qemu's libraries.
 
 Regards

 @@ -9002,6 +9021,13 @@ qemuDomainSnapshotCreateSingleDiskActive
   return -1;
   }
 
 +ret = qemuDomainSnapshotCheckSrcQcow2(src-disk);
 +if (ret) {
 +qemuReportError(VIR_ERR_INTERNAL_ERROR,
 +%s, _(src image is not qcow2 format));
 +return ret;
 +}

NACK.  There is nothing inherently wrong with the source file not being
a qcow2 file.  The whole point of creating a runtime snapshot is that
the original file (of _any_ format) becomes the backing file of a new
qcow2 file, so that the original file now serves as the snapshot.
Forbidding a live snapshot of a raw source file interferes with this intent.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org

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


Re: [libvirt] [PATCHv2] build: fix build on platforms without ptsname_r

2011-11-07 Thread Eric Blake

On 11/07/2011 08:18 AM, Daniel P. Berrange wrote:

On Fri, Nov 04, 2011 at 08:06:05PM -0600, Eric Blake wrote:

MacOS lacks ptsname_r, and gnulib doesn't (yet) provide it.
But we can avoid it altogether, by using gnulib openpty()
instead.  Note that we do _not_ want the pt_chown module;
all systems that we currently port to can either properly do
openpty() and/or grantpt(), or lack ptys altogether; we are
not porting to any system that requires us to deal with the
hassle of installing a setuid pt_chown helper just to satisfy
gnulib's ability to provide openpty() on even more platforms.

* .gnulib: Update to latest, for openpty fixes
* bootstrap.conf (gnulib_modules): Add openpty, ttyname_r.
(gnulib_tool_option_extras): Exclude pt_chown module.
* src/util/util.c (virFileOpenTty): Rewrite in terms of openpty
and ttyname_r.
* src/util/util.h (virFileOpenTtyAt): Delete dead prototype.
---



ACK


Thanks; pushed.  I tweaked the commit message slightly to hopefully make 
it a bit clearer that openpty() includes the actions of grantpt() under 
the hood, and that the exclusion of pt_chown only affects platforms that 
lack both openpty() and grantpt().


--
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org

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


Re: [libvirt] [PATCH] [configure] Fix libvirt dependency, and use $VAPIGEN

2011-11-07 Thread Eric Blake

On 11/07/2011 03:03 AM, Michal Privoznik wrote:

On 07.11.2011 10:25, nirbh...@gentoo.org wrote:

This is a rather trivial patch to raise the minimum libvirt dependency; at least
0.9.4 is required. In addition, it fixes the direct usage of `vapigen`, and uses
the result of the AC_PATH_PROG(VAPIGEN ...) call earlier so that the binary to
be used can be overridden as that macro was meant to allow.

Thanks!

  configure.ac |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

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


Just for the record, this is for libvirt-glib


To make it easier for yourself, add this to libvirt-glib/.git/config:

[format]
subjectprefix = libvirt-glib PATCH

(or similarly for any other libvrit-SUB project).  Then your patches 
will automatically be prefixed with designation that it is for a 
subproject and not for the top-level libvirt.git, which will help in 
sorting threads as long as all the subprojects still share the primary 
libvir-list mailing list.


--
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org

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


Re: [libvirt] [libvirt-glib 01/23] Add helpers in libvirt-gconfig-helpers.[ch]

2011-11-07 Thread Christophe Fergeau
On Mon, Nov 07, 2011 at 01:56:42PM +, Daniel P. Berrange wrote:
 On Mon, Nov 07, 2011 at 02:52:24PM +0100, Christophe Fergeau wrote:
  At this point, I'm not sure what kind of low-level API we want to make
  available to the library user (by low-level, I mean letting people directly
  poke at the xmlNode wrapped in a GVirConfigObject instance). That's why I
  chose not to export them for now, and to make them public if/once they are
  needed.
  If you think they should be exported, I'll make the change.
 
 Personally I'd rather we didn't expose libxml2 data types in our public
 API, since it feels like an admission of defeat in our object model.

Actually, while adding a refcounted wrapper around xmlDoc, I've made more
changes/added more helpers which should make it possible to hide these
xmlNodePtr from our public API. We would expose either GVirConfigObject
or GVirConfigXmlNode as a wrapper around xmlNodePtr and provide helpers
to manipulate the xml content they wrap (stuff like new_child,
set_attributes, ...)

 So if we want to avoid exposing libxml2 types in our API, we should
 ensure the header file in question doesn't get installed in /usr/include
 too.

Ah good point, didn't think about this. Time for some noinst_HEADERS in our
Makefile.am. I also need to make sure libvirt-gconfig/libvirt-gconfig.h
doesn't reference it.

Christophe


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

[libvirt] [PATCH] build: drop useless dirent.h includes

2011-11-07 Thread Eric Blake
* .gnulib: Update to latest, for improved syntax-check.
* src/lxc/lxc_container.c (includes): Drop unused include.
* src/network/bridge_driver.c: Likewise.
* src/node_device/node_device_linux_sysfs.c: Likewise.
* src/openvz/openvz_driver.c: Likewise.
* src/qemu/qemu_conf.c: Likewise.
* src/storage/storage_backend_iscsi.c: Likewise.
* src/storage/storage_backend_mpath.c: Likewise.
* src/uml/uml_conf.c: Likewise.
* src/uml/uml_driver.c: Likewise.
---

I'm not sure whether to include this in 0.9.7.  On the one hand,
this is pretty trivial; on the other hand, I hate making more
.gnulib updates than necessary after release candidates have been
posted, in case an unintended regression sneaks in from a
half-baked gnulib change.  But looking at the 22 patches, I'm
not seeing anything likely to impact libvirt besides the new
syntax check rule.

* .gnulib 0031e4f...e56e96f (22):
   maint.mk: silence new syntax check
   Doc about floating-point and math API.
   stdalign tests: Skip the test when compiled by Sun C.
   ansi-c++-opt: Complete the 2011-06-05 change.
   * doc/posix-headers/stdalign.texi (stdalign.h): Mention Sun review ID.
   copysignl: Fix result for zero argument on HP-UX 11 with HP C.
   update from texinfo
   ldexp, ldexpf, ldexpl: Enhance tests.
   math tests: Cosmetics.
   fma*: Simplify test.
   Tests for module 'fmal'.
   New module 'fmal'.
   Tests for module 'fmaf'.
   New module 'fmaf'.
   Tests for module 'fma'.
   New module 'fma'.
   Extend gl_MATHFUNC.
   New modules 'at-internal', 'openat-h', split off from module 'openat'.
   maint.mk: also prohibit inclusion of dirent.h without use
   ldexpl tests: Avoid test failure on MSVC 9.
   New modules 'at-internal', 'openat-h', split off from module 'openat'.
   openat: Include stdbool.h.

 .gnulib   |2 +-
 src/lxc/lxc_container.c   |1 -
 src/network/bridge_driver.c   |1 -
 src/node_device/node_device_linux_sysfs.c |3 +--
 src/openvz/openvz_driver.c|1 -
 src/qemu/qemu_conf.c  |1 -
 src/storage/storage_backend_iscsi.c   |1 -
 src/storage/storage_backend_mpath.c   |3 +--
 src/uml/uml_conf.c|1 -
 src/uml/uml_driver.c  |1 -
 10 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/.gnulib b/.gnulib
index 0031e4f..e56e96f 16
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 0031e4f6353cc7077a9d0dad0c793bd6e3dc7aaa
+Subproject commit e56e96fe20f72586e9ec5c528b9a9a06daa2ecc6
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index c4e5f28..c2484a7 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -35,7 +35,6 @@
 #include sys/stat.h
 #include unistd.h
 #include mntent.h
-#include dirent.h

 /* Yes, we want linux private one, for _syscall2() macro */
 #include linux/unistd.h
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 445c3cb..e897b32 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -25,7 +25,6 @@

 #include sys/types.h
 #include sys/poll.h
-#include dirent.h
 #include limits.h
 #include string.h
 #include stdio.h
diff --git a/src/node_device/node_device_linux_sysfs.c 
b/src/node_device/node_device_linux_sysfs.c
index 844231a..d352800 100644
--- a/src/node_device/node_device_linux_sysfs.c
+++ b/src/node_device/node_device_linux_sysfs.c
@@ -2,7 +2,7 @@
  * node_device_hal_linuc.c: Linux specific code to gather device data
  * not available through HAL.
  *
- * Copyright (C) 2009-2010 Red Hat, Inc.
+ * Copyright (C) 2009-2011 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -32,7 +32,6 @@
 #include memory.h
 #include logging.h
 #include virfile.h
-#include dirent.h

 #define VIR_FROM_THIS VIR_FROM_NODEDEV

diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 69ff444..4eed8ad 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -30,7 +30,6 @@

 #include sys/types.h
 #include sys/poll.h
-#include dirent.h
 #include limits.h
 #include string.h
 #include stdio.h
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index d1bf075..0cf921f 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -23,7 +23,6 @@

 #include config.h

-#include dirent.h
 #include string.h
 #include limits.h
 #include sys/types.h
diff --git a/src/storage/storage_backend_iscsi.c 
b/src/storage/storage_backend_iscsi.c
index 99e69c9..354f99b 100644
--- a/src/storage/storage_backend_iscsi.c
+++ b/src/storage/storage_backend_iscsi.c
@@ -32,7 +32,6 @@
 #include regex.h
 #include fcntl.h
 #include unistd.h
-#include dirent.h
 #include sys/stat.h

 #include virterror_internal.h
diff --git a/src/storage/storage_backend_mpath.c 
b/src/storage/storage_backend_mpath.c
index 4f3add3..f09ce9b 100644
--- a/src/storage/storage_backend_mpath.c
+++ 

Re: [libvirt] [PATCH 2/3] Routine to truncate virBuffer

2011-11-07 Thread Eric Blake

On 11/06/2011 06:58 AM, Bharata B Rao wrote:

Routine to truncate virBuffer

From: Bharata B Raobhar...@linux.vnet.ibm.com

Add a helper to truncate virBuffer.

/**
  * virBufferTruncate:



+++ b/src/util/buf.c
@@ -123,6 +123,31 @@ virBufferGrow(virBufferPtr buf, unsigned int len)
  }

  /**
+ * virBufferTruncate:
+ * @buf:  the buffer
+ * @len:  number of bytes by which the buffer is truncated
+ *
+ * Truncate the buffer by @len bytes.
+ *
+ * Returns zero on success or -1 on error
+ */
+int
+virBufferTruncate(virBufferPtr buf, unsigned int len)


What good is returning an error, given that callers already have to use 
virBufferError for detecting other errors, and given that you aren't 
marking the function as ATTRIBUTE_RETURN_CHECK to require callers to 
respect that error?  One of the points of the virBuffer API is that most 
functions can return void (for example, see virBufferAdjustIndent), 
because the user doesn't care about error checking until the end.



+{
+if (buf-error)
+return -1;
+
+if ((signed)(buf-use - len)  0) {


I tend to write the cast as (int), not (signed), if a cast is even 
needed.  You don't catch all possible overflows, though - if buf-use is 
2, and len is 4294967295 (aka (unsigned)-1), then you've proceeded to 
expand(!) buf-use to 3, skipping an uninitialized byte.  A better 
filter would be:


if (len  buf-use)


+virBufferSetError(buf, -1);
+return -1;
+}
+
+buf-use -= len;
+buf-content[buf-use] = '\0';


This looks correct, once you filter out invalid len first.


+++ b/tests/virbuftest.c
@@ -123,7 +123,8 @@ static int testBufAutoIndent(const void *data 
ATTRIBUTE_UNUSED)
  virBufferAddChar(buf, '\n');
  virBufferEscapeShell(buf,  11);
  virBufferAddChar(buf, '\n');
-
+virBufferAsprintf(buf, %d, 12);
+virBufferTruncate(buf, 4);


That gives no change in the expected output.  I'd almost rather see:

virBufferAsprintf(buf, %d, 123);
virBufferTruncate(buf, 1);

as well as an update to the expected output to see output ending in 12.

You're on the right track, but I don't think it is worth applying this 
until after 0.9.7 is released.


--
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt 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/3] XML definitions for guest NUMA

2011-11-07 Thread Eric Blake

On 11/06/2011 06:57 AM, Bharata B Rao wrote:

XML definitions for guest NUMA and parsing routines.

From: Bharata B Raobhar...@linux.vnet.ibm.com

This patch adds XML definitions for guest NUMA specification and contains
routines to parse the same. The guest NUMA specification looks like this:

cpu
 ...
 topology sockets='2' cores='4' threads='2'/
 numa
 cell cpus='0-7' mems='512000'/
 cell cpus='8-15' mems='512000'/
 /numa
 ...
/cpu

Signed-off-by: Bharata B Raobhar...@linux.vnet.ibm.com
---



+p
+  Guest NUMA topology can be specifed usingcodenuma/code  element.
+span class=sinceSince X.X.X/span


Let's just put 0.9.8 here.  It's easier at feature freeze time to grep 
and replace a concrete 0.9.8 into a different numbering scheme (0.10.0, 
1.0.0, ?) if we decide on something different than 0.9.8, than it is to 
remember to also search for X.X.X.



+/p
+
+pre
+  ...
+lt;cpugt;
+...
+lt;numagt;
+lt;cell cpus='0-3' mems='512000'/gt;
+lt;cell cpus='4-7' mems='512000'/gt;


I understand 'cpus' (a valid word meaning multiple cpu units), but 
'mems' seems odd; I think it would be better naming this attribute 
'memory' to match our memory element at the top level.  Just because 
qemu's command line names the option mems= doesn't mean we should be 
stuck making our XML inconsistent.



+lt;/numagt;
+...
+lt;/cpugt;
+  .../pre
+
+p
+  Eachcodecell/code  element specifies a NUMA cell or a NUMA node.
+codecpus/code  specifies the CPU or range of CPUs that are part of
+  the node.codemems/code  specifies the node memory in kilobytes
+  (i.e. blocks of 1024 bytes). Each cell or node is assigned cellid
+  or nodeid in the increasing order starting from 0.


I agree with doing things in 1024-byte blocks [1], since memory and 
currentMemory are also in that unit.


[1] 1024-byte blocks is technically kibibytes, not kilobytes; but you're 
copying from existing text, so at least we're consistent, not to mention 
fitting right in with the wikipedia complaint that KiB has had slow 
adoption by the computer industry: 
https://secure.wikimedia.org/wikipedia/en/wiki/Kibibyte :)



+/p
+
+p
+  This guest NUMA specification translates tocode-numa/code  command
+  line option for QEMU/KVM. For the above example, the following QEMU
+  command line option is generated:
+code-numa node,nodeid=0,cpus=0-3,mems=512000 -numa 
node,nodeid=1,cpus=4-7,mems=512000/code


This paragraph is not necessary.  We don't need to give one 
hypervisor-specific example of how the XML is translated; it is 
sufficient to simply document the XML semantics in a way that can be 
implemented by any number of hypervisors.



+
+define name=numaCell
+element name=cell
+attribute name=cpus
+ref name=Cellcpus/


Typically, ref names start with a lower case letter.


+/attribute
+attribute name=mems
+ref name=Cellmems/
+/attribute


Is it possible for these attributes to be optional?  That is, on the 
qemu line, can I specify cpus= but not mems=, or mems= but not cpus=? 
If so, then the attributes need to be optional in the schema, and the 
code behave with sane defaults when one of the two attributes is not 
present.



@@ -2745,4 +2767,14 @@
param name=pattern[a-zA-Z0-9_\.:]+/param
  /data
/define
+define name=Cellcpus
+data type=string
+param 
name=pattern([0-9]+(-[0-9]+)?|\^[0-9]+)(,([0-9]+(-[0-9]+)?|\^[0-9]+))*/param


This looks like a repeat of define name=cpuset; if so, let's reuse 
that define instead of making a new one (and if not, why are we 
introducing yet another syntax?).



+/data
+/define
+define name=Cellmems
+data type=unsignedInt
+param name=pattern[0-9]+/param


Likewise, this looks like a repeat of define name=memoryKB, so lets 
reuse that.



@@ -109,6 +114,19 @@ no_memory:
  return NULL;
  }

+static int
+virCPUDefNumaCPUs(virCPUDefPtr def)
+{
+int i, j, ncpus = 0;
+
+for (i = 0; i  def-ncells; i++) {
+for (j = 0; j  VIR_DOMAIN_CPUMASK_LEN; j++) {
+if (def-cells[i].cpumask[j])
+ncpus++;
+}
+}


Can this loop be made any faster by using count_one_bits?


+return ncpus;
+}

  virCPUDefPtr
  virCPUDefParseXML(const xmlNodePtr node,
@@ -289,6 +307,50 @@ virCPUDefParseXML(const xmlNodePtr node,
  def-features[i].policy = policy;
  }

+if (virXPathNode(./numa[1], ctxt)) {
+VIR_FREE(nodes);
+n = virXPathNodeSet(./numa[1]/cell, ctxt,nodes);
+if (n  0 || n == 0) {


This looks a bit funny, compared to if (n = 0).


+for (i = 0 ; i  n ; i++) {
+char *cpus;
+int cpumasklen = VIR_DOMAIN_CPUMASK_LEN;
+unsigned long ul;
+int ret;
+
+def-cells[i].cellid = i;
+cpus = virXMLPropString(nodes[i], cpus);
+
+if (VIR_ALLOC_N(def-cells[i].cpumask, cpumasklen)  0)
+goto no_memory;
+
+if 

Re: [libvirt] [PATCH 3/3] qemu: Generate -numa command line option

2011-11-07 Thread Eric Blake

On 11/06/2011 06:59 AM, Bharata B Rao wrote:

qemu: Generate -numa option

From: Bharata B Raobhar...@linux.vnet.ibm.com

Add routines to generate -numa QEMU command line option based on
numa  .../numa  XML specifications.

Signed-off-by: Bharata B Raobhar...@linux.vnet.ibm.com




+static int
+qemuBuildNumaCPUArgStr(char *cpumask, virBufferPtr buf)
+{
+int i, first, last;
+int cpuSet = 0;
+


What happens if cpumask is all 0?


+for (i = 0; i  VIR_DOMAIN_CPUMASK_LEN; i++) {
+if (cpumask[i]) {


This if branch is skipped,


+if (cpuSet)
+last = i;
+else {
+first = last = i;
+cpuSet = 1;
+}
+} else {
+if (!cpuSet)
+continue;


so this branch always continues,


+if (first == last)
+virBufferAsprintf(buf, %d,, first);
+else
+virBufferAsprintf(buf, %d-%d,, first, last);
+cpuSet = 0;
+   }
+}
+
+if (cpuSet) {


and this if is skipped,


+if (first == last)
+virBufferAsprintf(buf, %d,, first);
+else
+virBufferAsprintf(buf, %d-%d,, first, last);
+}
+
+/* Remove the trailing comma */
+return virBufferTruncate(buf, 1);


meaning that nothing was appended to buf, and you are now stripping 
unknown text, rather than a comma you just added.  Do we need a sanity 
check to ensure that the cpumask specifies at least one cpu?  And if so, 
would that mask be better here, or up front at the xml parsing time?



+}
+
+static int
+qemuBuildNumaArgStr(const virDomainDefPtr def, virCommandPtr cmd)
+{
+int i;
+char *node;
+virBuffer buf = VIR_BUFFER_INITIALIZER;
+
+for (i = 0; i  def-cpu-ncells; i++) {
+virCommandAddArg(cmd, -numa);
+virBufferAsprintf(buf, %s, node);


More efficient as virBufferAddLit(buf, node), or...


+virBufferAsprintf(buf, ,nodeid=%d, def-cpu-cells[i].cellid);


merge these two into a single:

virBufferAsprintf(buf, node,nodeid=%d, ...);


+virBufferAsprintf(buf, ,cpus=);


Again, with no % in the format string, it is more efficient to use 
virBufferAddLit.



+
+if (qemuBuildNumaCPUArgStr(def-cpu-cells[i].cpumask,buf))


Generally, we prefer an explicit  0 comparison when checking for failure.


+goto error;
+
+virBufferAsprintf(buf, ,mems=%d, def-cpu-cells[i].mem);
+


Why do we need to bother with stripping a trailing comma in 
qemuBuildNumaCPUArgStr, if we will just be adding a comma back again 
here as the very next statement?  You could skip all the hassle of 
adding virBufferTruncate by just transferring the comma out of this 
statement and into qemuBuildNumaCPUArgStr (that said, I still think 
virBufferTruncate will be a useful addition in other contexts).



+if (virBufferError(buf))
+goto error;
+
+node = virBufferContentAndReset(buf);
+virCommandAddArg(cmd, node);
+VIR_FREE(node);


It's more efficient to replace these five lines with one:

virCommandAddArgBuffer(cmd, buf);


@@ -3414,6 +3482,9 @@ qemuBuildCommandLine(virConnectPtr conn,
  virCommandAddArg(cmd, smp);
  VIR_FREE(smp);

+if (def-cpu  def-cpu-ncells  qemuBuildNumaArgStr(def, cmd))


Again, explicit  0 check when looking for errors.


+topology sockets=2 cores=4 threads=2/
+numa
+cell cpus=0-7 mems=109550/
+cell cpus=8-15 mems=109550/


Of course, this will need tweaking to match any XML changes made in 1/3, 
but thanks for adding test cases!


Overall, I think we'll need a v3 (you may want to use git send-email 
--subject-prefix=PATCHv3; it wasn't very clear from the subject line 
that this was already a v2 series), but I like where it's heading.


--
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org

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


Re: [libvirt] [PATCH 01/33] Remove 'brControl' object

2011-11-07 Thread Laine Stump

On 11/03/2011 01:29 PM, Daniel P. Berrange wrote:

The bridge management APIs in src/util/bridge.c require a brControl
object to be passed around. This holds the file descriptor for the
control socket. This extra object complicates use of the API for
only a minor efficiency gain, which is in turn entirely offset by
the need to fork/exec the brctl command for STP configuration.

This patch removes the 'brControl' object entirely, instead opening
the control socket  closing it again within the scope of each method.

The parameter names for the APIs are also made to consistently use
'brname' for bridge device name, and 'ifname' for an interface
device name. Finally annotations are added for non-NULL parameters
and return check validation

* src/util/bridge.c, src/util/bridge.h: Remove brControl object
   and update API parameter names  annotations.
* src/lxc/lxc_driver.c, src/network/bridge_driver.c,
   src/uml/uml_conf.h, src/uml/uml_conf.c, src/uml/uml_driver.c,
   src/qemu/qemu_command.c, src/qemu/qemu_conf.h,
   src/qemu/qemu_driver.c: Remove reference to 'brControl' object
---
  src/lxc/lxc_driver.c|   10 +-
  src/network/bridge_driver.c |   41 ++---
  src/qemu/qemu_command.c |8 +-
  src/qemu/qemu_conf.h|1 -
  src/qemu/qemu_driver.c  |3 -
  src/uml/uml_conf.c  |   13 +--
  src/uml/uml_conf.h  |1 -
  src/uml/uml_driver.c|9 +-
  src/util/bridge.c   |  454 +--
  src/util/bridge.h   |  104 +-
  10 files changed, 295 insertions(+), 349 deletions(-)


ACK. Visually checks out, and make  make check  make syntax-check pass.

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


Re: [libvirt] [PATCH v4 04/13] virsh: Always run event loop

2011-11-07 Thread Daniel P. Berrange
On Thu, Oct 27, 2011 at 06:05:40PM +0200, Jiri Denemark wrote:
 Since virsh already implements event loop, it has to also run it. So far
 the event loop was only running during virsh console command.
 ---
 Notes:
 ACKed
 
 Version 4:
 - no changes
 
 Version 3:
 - new patch
 
  tools/console.c |   17 ++---
  tools/virsh.c   |   31 +++
  2 files changed, 45 insertions(+), 3 deletions(-)

ACK

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 v4 03/13] Introduce virConnectSetKeepAlive

2011-11-07 Thread Daniel P. Berrange
On Thu, Oct 27, 2011 at 06:05:39PM +0200, Jiri Denemark wrote:
 virConnectSetKeepAlive public API can be used by a client connecting to
 remote server to start using keepalive protocol. The API is handled
 directly by remote driver and not transmitted over the wire to the
 server.
 ---
 Notes:
 Version 3 ACKed.
 
 Version 4:
 - explicitly document the semantics of interval = 0 and count = 0
 
 Version 3:
 - remove virConnectAllowKeepAlive
 - rename virConnectStartKeepAlive as virConnectSetKeepAlive
 - add a note to virEventRegisterImpl that running the event loop
   is mandatory once registered
 
 Version 2:
 - no change
 
  include/libvirt/libvirt.h.in |4 +++
  src/driver.h |5 +++
  src/libvirt.c|   57 
 ++
  src/libvirt_internal.h   |   10 ++-
  src/libvirt_public.syms  |1 +
  src/util/event.c |6 ++--
  6 files changed, 78 insertions(+), 5 deletions(-)

ACK

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 v4 02/13] Implement common keepalive handling

2011-11-07 Thread Daniel P. Berrange
On Thu, Oct 27, 2011 at 06:05:38PM +0200, Jiri Denemark wrote:
 These APIs are used by both client and server RPC layer to handle
 processing of keepalive messages.
 ---
 Notes:
 Version 3 was ACKed provided I cleare some things up (which I believe I 
 did
 in v4). I also tried to get the bonus points :-)
 
 Version 4:
 - s/KEEPALIVE_VERSION/KEEPALIVE_PROTOCOL_VERSION/
 - always free message in virKeepAliveSend
 - free ka-response in virKeepAliveStop
 - systemtap probes
 
 Version 3:
 - remove ADVERTISE message handling
 
 Version 2:
 - no change
 
  po/POTFILES.in |1 +
  src/Makefile.am|3 +-
  src/probes.d   |   12 ++
  src/rpc/virkeepalive.c |  448 
 
  src/rpc/virkeepalive.h |   56 ++
  5 files changed, 519 insertions(+), 1 deletions(-)
  create mode 100644 src/rpc/virkeepalive.c
  create mode 100644 src/rpc/virkeepalive.h

ACK

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 v4 01/13] Define keepalive protocol

2011-11-07 Thread Daniel P. Berrange
On Thu, Oct 27, 2011 at 06:05:37PM +0200, Jiri Denemark wrote:
 The keepalive program has two procedures: PING, and PONG.
 Both are used only in asynchronous messages and the sender doesn't wait
 for any reply. However, the party which receives PING messages is
 supposed to react by sending PONG message the other party, but no
 explicit binding between PING and PONG messages is made. For backward
 compatibility neither server nor client are allowed to send keepalive
 messages before checking that remote party supports them.
 ---
 Notes:
 Version 3 was ACKed provided I do the following changes:
 
 Version 4:
 - update systemptap functions with the new protocol
 - s/KEEPALIVE_VERSION/KEEPALIVE_PROTOCOL_VERSION/ to make stp generator
   happy
 
 Version 3:
 - remove ADVERTISE message which is no longer used
 
 Version 2:
 - no change
 
  .gitignore |1 +
  src/Makefile.am|   19 ++-
  src/rpc/virkeepaliveprotocol.x |7 +++
  3 files changed, 22 insertions(+), 5 deletions(-)
  create mode 100644 src/rpc/virkeepaliveprotocol.x

ACK

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 v4 05/13] Implement keepalive protocol in libvirt daemon

2011-11-07 Thread Daniel P. Berrange
On Thu, Oct 27, 2011 at 06:05:41PM +0200, Jiri Denemark wrote:
 ---
 Notes:
 ACKed
 
 Version 4:
 - explicitly document the semantics of keepalive_count = 0
 
 Version 3:
 - keepalive_supported configuration option can be used to refuse
   connections from clients that do not support keepalive protocol
 - explain what keepalive_interval = -1 means
 - start up the keepalive protocol when a client asks if we support
   it (clients without keepalive support do not ask for it)
 - add filters to the end of the list so that they are processed
   in the same order they were added (and not in reverse order); as
   a result of that the keepalive filter will always be the first one
   and libvirtd will not send keepalive requests while client is
   sending stream packets
 
 Version 2:
 - no change
 
  daemon/libvirtd.aug  |5 ++
  daemon/libvirtd.c|   15 +
  daemon/libvirtd.conf |   25 +++
  daemon/libvirtd.h|1 +
  daemon/remote.c  |   48 ++-
  src/libvirt_private.syms |2 +
  src/remote/remote_protocol.x |2 +-
  src/rpc/virnetserver.c   |   22 +++
  src/rpc/virnetserver.h   |5 ++
  src/rpc/virnetserverclient.c |  143 ++---
  src/rpc/virnetserverclient.h |7 ++
  11 files changed, 262 insertions(+), 13 deletions(-)

ACK

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 v4 07/13] Add support for async close of client RPC socket

2011-11-07 Thread Daniel P. Berrange
On Thu, Oct 27, 2011 at 06:05:43PM +0200, Jiri Denemark wrote:
 ---
 Notes:
 ACKed
 
 Version 4:
 - no changes
 
 Version 3:
 - no changes
 
 Version 2:
 - no changes
 
  src/rpc/virnetclient.c |   76 
 ++--
  1 files changed, 67 insertions(+), 9 deletions(-)

ACK

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 v4 13/13] qemu: Cancel p2p migration when connection breaks

2011-11-07 Thread Daniel P. Berrange
On Thu, Oct 27, 2011 at 06:05:49PM +0200, Jiri Denemark wrote:
 If a connection to destination host is lost during peer-to-peer
 migration (because keepalive protocol timed out), we won't be able to
 finish the migration and it doesn't make sense to wait for qemu to
 transmit all data. This patch automatically cancels such migration
 without waiting for virDomainAbortJob to be called.
 ---
 Notes:
 ACKed
 
 Version 4:
 - no changes
 
 Version 3:
 - no changes
 
 Version 2:
 - new patch
 
  src/qemu/qemu_migration.c |   39 +--
  1 files changed, 25 insertions(+), 14 deletions(-)

ACK


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 v4 11/13] Add keepalive support into domain-events examples

2011-11-07 Thread Daniel P. Berrange
On Thu, Oct 27, 2011 at 06:05:47PM +0200, Jiri Denemark wrote:
 ---
 Notes:
 ACKed
 
 Version 4:
 - no changes
 
 Version 3:
 - update to client API changes (virConnectAllowKeepAlive dropped
   and virConnectStartKeepAlive renamed as virConnectSetKeepAlive)
 
 Version 2:
 - automatically exit when a connection is closed because of
   keepalive timeout
 
  examples/domain-events/events-c/event-test.c   |9 -
  examples/domain-events/events-python/event-test.py |4 +++-
  2 files changed, 11 insertions(+), 2 deletions(-)

ACK

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 v4 12/13] qemu: Add support for keepalive messages during p2p migration

2011-11-07 Thread Daniel P. Berrange
On Thu, Oct 27, 2011 at 06:05:48PM +0200, Jiri Denemark wrote:
 ---
 Notes:
 ACKed
 
 Version 4:
 - document the semantics of keepalive_count = 0
 
 Version 3:
 - explain what keepalive_interval = -1 means
 - update to client API changes (virConnectAllowKeepAlive dropped
   and virConnectStartKeepAlive renamed as virConnectSetKeepAlive)
 
 Version 2:
 - no changes
 
  src/qemu/libvirtd_qemu.aug  |2 ++
  src/qemu/qemu.conf  |   22 ++
  src/qemu/qemu_conf.c|   11 +++
  src/qemu/qemu_conf.h|3 +++
  src/qemu/qemu_migration.c   |4 
  src/qemu/test_libvirtd_qemu.aug |6 ++
  6 files changed, 48 insertions(+), 0 deletions(-)

ACK

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 v4 08/13] Implement keepalive protocol in remote driver

2011-11-07 Thread Daniel P. Berrange
On Thu, Oct 27, 2011 at 06:05:44PM +0200, Jiri Denemark wrote:
 ---
 Notes:
 ACKed
 
 Version 4:
 - no changes
 
 Version 3:
 - remoteStartKeepAlive renamed as remoteSetKeepAlive
 - clients that implement event loop are required to run it, thus
   keepalive is enabled if event loop implementation is found without
   the need to call remoteAllowKeepAlive (which was dropped)
 - keepalive support is advertised to a server implicitly by asking for
   keepalive support between authentication and virConnectOpen
 
 Version 2:
 - no changes
 
  src/remote/remote_driver.c |   52 +++
  src/rpc/virnetclient.c |   83 +--
  src/rpc/virnetclient.h |5 +++
  3 files changed, 136 insertions(+), 4 deletions(-)

ACK

 @@ -663,6 +665,26 @@ doRemoteOpen (virConnectPtr conn,
  if (remoteAuthenticate(conn, priv, auth, authtype) == -1)
  goto failed;
  
 +if (virNetClientKeepAliveIsSupported(priv-client)) {
 +remote_supports_feature_args args =
 +{ VIR_DRV_FEATURE_PROGRAM_KEEPALIVE };
 +remote_supports_feature_ret ret = { 0 };
 +int rc;
 +
 +rc = call(conn, priv, 0, REMOTE_PROC_SUPPORTS_FEATURE,
 +  (xdrproc_t)xdr_remote_supports_feature_args, (char *) 
 args,
 +  (xdrproc_t)xdr_remote_supports_feature_ret, (char *) ret);
 +if (rc == -1)
 +goto failed;
 +
 +if (ret.supported) {
 +priv-serverKeepAlive = true;
 +} else {
 +VIR_WARN(Disabling keepalive protocol since it is not supported
 +  by the server);

Hmm, won't this cause new clients to always issue a warning when talking to
old servers ? Can probably be dropped to VIR_INFO

ACK

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 v4 10/13] Implement virConnectIsAlive in all drivers

2011-11-07 Thread Daniel P. Berrange
On Thu, Oct 27, 2011 at 06:05:46PM +0200, Jiri Denemark wrote:
 ---
 Notes:
 ACKed except for esx driver
 
 Version 4:
 - fix esx implementation
 
 Version 3:
 - no changes
 
 Version 2:
 - new patch
 
  src/esx/esx_driver.c   |   18 ++
  src/hyperv/hyperv_driver.c |   18 ++
  src/libxl/libxl_driver.c   |8 
  src/lxc/lxc_driver.c   |7 +++
  src/openvz/openvz_driver.c |7 +++
  src/phyp/phyp_driver.c |   18 ++
  src/qemu/qemu_driver.c |6 ++
  src/remote/remote_driver.c |   18 ++
  src/rpc/virnetclient.c |   14 ++
  src/rpc/virnetclient.h |1 +
  src/test/test_driver.c |6 ++
  src/uml/uml_driver.c   |7 +++
  src/vbox/vbox_tmpl.c   |6 ++
  src/vmware/vmware_driver.c |7 +++
  src/xen/xen_driver.c   |8 
  src/xenapi/xenapi_driver.c |   12 
  16 files changed, 161 insertions(+), 0 deletions(-)


ACK, if changing 0.9.7  to 0.9.8 throughout


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 v4 09/13] Introduce virConnectIsAlive API

2011-11-07 Thread Daniel P. Berrange
On Thu, Oct 27, 2011 at 06:05:45PM +0200, Jiri Denemark wrote:
 This API can be used to check if the socket associated with
 virConnectPtr is still open or it was closed (probably because keepalive
 protocol timed out). If there the connection is local (i.e., no socket
 is associated with the connection, it is trivially always alive.
 ---
 Notes:
 ACKed
 
 Version 4:
 - no changes
 
 Version 3:
 - no changes
 
 Version 2:
 - new patch
 
  include/libvirt/libvirt.h.in |1 +
  src/driver.h |3 +++
  src/libvirt.c|   36 
  src/libvirt_public.syms  |1 +
  4 files changed, 41 insertions(+), 0 deletions(-)
 
 diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
 index 8ce4335..50e5b89 100644
 --- a/include/libvirt/libvirt.h.in
 +++ b/include/libvirt/libvirt.h.in
 @@ -2553,6 +2553,7 @@ int virInterfaceIsActive(virInterfacePtr iface);
  
  int virConnectIsEncrypted(virConnectPtr conn);
  int virConnectIsSecure(virConnectPtr conn);
 +int virConnectIsAlive(virConnectPtr conn);
  
  /*
   * CPU specification API
 diff --git a/src/driver.h b/src/driver.h
 index c1223c1..a23f05b 100644
 --- a/src/driver.h
 +++ b/src/driver.h
 @@ -509,6 +509,8 @@ typedef int
  typedef int
  (*virDrvConnectIsSecure)(virConnectPtr conn);
  typedef int
 +(*virDrvConnectIsAlive)(virConnectPtr conn);
 +typedef int
  (*virDrvDomainIsActive)(virDomainPtr dom);
  typedef int
  (*virDrvDomainIsPersistent)(virDomainPtr dom);
 @@ -898,6 +900,7 @@ struct _virDriver {
  virDrvDomainBlockJobSetSpeed domainBlockJobSetSpeed;
  virDrvDomainBlockPull domainBlockPull;
  virDrvSetKeepAlive setKeepAlive;
 +virDrvConnectIsAlive isAlive;
  };
  
  typedef int
 diff --git a/src/libvirt.c b/src/libvirt.c
 index 0c33da1..580b29a 100644
 --- a/src/libvirt.c
 +++ b/src/libvirt.c
 @@ -17021,3 +17021,39 @@ error:
  virDispatchError(conn);
  return -1;
  }
 +
 +/**
 + * virConnectIsAlive:
 + * @conn: pointer to the connection object
 + *
 + * Determine if the connection to the hypervisor is still alive
 + *
 + * A connection will be classed as alive if it is either local, or running
 + * over a channel (TCP or UNIX socket) which is not closed.
 + *
 + * Returns 1 if alive, 0 if dead, -1 on error
 + */
 +int virConnectIsAlive(virConnectPtr conn)
 +{
 +VIR_DEBUG(conn=%p, conn);
 +
 +virResetLastError();
 +
 +if (!VIR_IS_CONNECT(conn)) {
 +virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__);
 +virDispatchError(NULL);
 +return -1;
 +}
 +if (conn-driver-isAlive) {
 +int ret;
 +ret = conn-driver-isAlive(conn);
 +if (ret  0)
 +goto error;
 +return ret;
 +}
 +
 +virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
 +error:
 +virDispatchError(conn);
 +return -1;
 +}
 diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
 index 468e28a..f1de89d 100644
 --- a/src/libvirt_public.syms
 +++ b/src/libvirt_public.syms
 @@ -491,6 +491,7 @@ LIBVIRT_0.9.5 {
  
  LIBVIRT_0.9.7 {
  global:
 +virConnectIsAlive;
  virConnectSetKeepAlive;
  virDomainReset;
  virDomainSnapshotGetParent;

ACK, with update of syms file to 0.9.8 of course


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 v5 06/13] Add support for non-blocking calls in client RPC

2011-11-07 Thread Daniel P. Berrange
On Thu, Nov 03, 2011 at 11:03:13AM +0100, Jiri Denemark wrote:
 When a client wants to send a keepalive message it needs to do so in a
 non-blocking way to avoid blocking its event loop. This patch adds
 dontBlock flag which says that the call should be processed without
 blocking. Such calls do not have a thread waiting for the result
 associated with them. This means, that sending such call fails if no
 thread is dispatching and writing to the socket would block. In case
 there is a thread waiting for its (normal) call to finish, sending
 non-blocking call just pushes it into the queue and lets the dispatching
 thread send it. The thread which has the buck tries to send all
 non-blocking calls in the queue in a best effort way---if sending them
 would block or there's an error on the socket, non-blocking calls are
 simply removed from the queue and discarded.  In case a non-blocking
 call is partially sent but sending the rest of it would block, it is
 moved into client's unfinishedCall and left for future delivery.  Every
 sending attempt first sends the rest of unfinishedCall and than
 continues with other queued calls.
 ---
 Notes:
 Version 5:
 - partially sent non-blocking calls now work even for SASL (or other
   transports that cache data internally)
 - fixed several other bugs in that area
 
 Version 4:
 - correctly handle partially sent non-blocking calls that would block
 
 Version 3:
 - no changes
 
 Version 2:
 - no changes
 
  src/rpc/virnetclient.c |  285 
 ++--
  1 files changed, 229 insertions(+), 56 deletions(-)

I started reviewing this patch, but I'm finding the changes somewhat
confusing. I think there might be a different way to go about it, so
I'm hacking up a proof of concept counter-proposal for non-blocking
I/O. We sort of needed this already for the streams code, but we
rather ignored it because it was rarely important in practice.

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


[libvirt] make rpm failing with git head on RHEL6

2011-11-07 Thread Justin Clift
Hi guys,

Just tried make rpm with git head, on RHEL 6.x.

It gave the following failure:

  make[1]: Leaving directory `/home/jc/git_repos/libvirt'
  make[1]: Entering directory `/home/jc/git_repos/libvirt'
  { test ! -d libvirt-0.9.6 || { find libvirt-0.9.6 -type d ! -perm -200 
-exec chmod u+w {} ';'  rm -fr libvirt-0.9.6; }; }
  test -d libvirt-0.9.6 || mkdir libvirt-0.9.6
  cp: cannot stat `./NEWS': No such file or directory
  make[1]: *** [distdir] Error 1
  make[1]: Leaving directory `/home/jc/git_repos/libvirt'
  make: *** [rpm] Error 2

Anyone want to fix it prior to 0.9.7? :)

Regards and best wishes,

Justin Clift

--
Aeolus Community Manager
http://www.aeolusproject.org



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


Re: [libvirt] make rpm failing with git head on RHEL6

2011-11-07 Thread Justin Clift
On 08/11/2011, at 5:17 PM, Justin Clift wrote:
 Hi guys,
 
 Just tried make rpm with git head, on RHEL 6.x.
 
 It gave the following failure:
 
  make[1]: Leaving directory `/home/jc/git_repos/libvirt'
  make[1]: Entering directory `/home/jc/git_repos/libvirt'
  { test ! -d libvirt-0.9.6 || { find libvirt-0.9.6 -type d ! -perm -200 
 -exec chmod u+w {} ';'  rm -fr libvirt-0.9.6; }; }
  test -d libvirt-0.9.6 || mkdir libvirt-0.9.6
  cp: cannot stat `./NEWS': No such file or directory
  make[1]: *** [distdir] Error 1
  make[1]: Leaving directory `/home/jc/git_repos/libvirt'
  make: *** [rpm] Error 2
 
 Anyone want to fix it prior to 0.9.7? :)

As additional info, after doing a touch NEWS just to get it
past this point, it then fails with:

  make[2]: Leaving directory `/home/jc/git_repos/libvirt/include'
  (cd src  make  top_distdir=../libvirt-0.9.6 distdir=../libvirt-0.9.6/src \
 am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)
  make[2]: Entering directory `/home/jc/git_repos/libvirt/src'
  make[2]: *** No rule to make target `probes.h', needed by `distdir'.  Stop.
  make[2]: Leaving directory `/home/jc/git_repos/libvirt/src'
  make[1]: *** [distdir] Error 1
  make[1]: Leaving directory `/home/jc/git_repos/libvirt'
  make: *** [rpm] Error 2

This is a newly setup RHEL 6.1 x64 VM, with the Development Tools yum
package group installed, plus minimal -devel packages to let configure
succeed.

Any ideas?

Regards and best wishes,

Justin Clift

--
Aeolus Community Manager
http://www.aeolusproject.org



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


[libvirt] [PATCH] virsh: Add VSH_OFLAG_EMPTY_OK for attach-disk command

2011-11-07 Thread Xu He Jie
As the description of removing CDROM media from 
  http://wiki.libvirt.org/page/QEMUSwitchToLibvirt#eject_DEV

Add flag 'VSH_OFLAG_EMPTY_OK' to the option 'source' of attach-disk

Signed-off-by: Xu He Jie x...@linux.vnet.ibm.com
---
 tools/virsh.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index 5544a41..e7eae74 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -11569,7 +11569,7 @@ static const vshCmdInfo info_attach_disk[] = {
 
 static const vshCmdOptDef opts_attach_disk[] = {
 {domain,  VSH_OT_DATA, VSH_OFLAG_REQ, N_(domain name, id or uuid)},
-{source,  VSH_OT_DATA, VSH_OFLAG_REQ, N_(source of disk device)},
+{source,  VSH_OT_DATA, VSH_OFLAG_REQ | VSH_OFLAG_EMPTY_OK, N_(source of 
disk device)},
 {target,  VSH_OT_DATA, VSH_OFLAG_REQ, N_(target of disk device)},
 {driver,VSH_OT_STRING, 0, N_(driver of disk device)},
 {subdriver, VSH_OT_STRING, 0, N_(subdriver of disk device)},
-- 
1.7.5.4

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