[libvirt] Entering freeze for libvirt-1.2.4

2014-04-28 Thread Daniel Veillard
  As planned on Friday, I tagged the tree earlier today for Release
Candidate 1, the tarball and rpms are available from the usual place:

  ftp://libvirt.org/libvirt/

 Seems to work fine in my limited testing, but distcheck failed
with xsltproc being unable to access ../../ . I don't think anything
changed there on my side so it smells like a new problem.

  Otherwise looks good to me so far, with a bit of luck we can push
1.2.4 end of Friday or sometime next week-end,

Daniel

-- 
Daniel Veillard  | Open Source and Standards, Red Hat
veill...@redhat.com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | virtualization library  http://libvirt.org/

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


Re: [libvirt] [PATCHv2 2/7] nodeinfo: use virDirRead API

2014-04-28 Thread Ján Tomko
On 04/26/2014 03:18 PM, Eric Blake wrote:
 From: Natanael Copa nc...@alpinelinux.org
 
 This makes sure that errno is reset before readdir is called, even if
 the loop does a 'continue'.
 
 This fixes issue with musl libc which sets errno on sscanf. The
 following 'continue' makes the errno be set before calling readdir.
 
 Signed-off-by: Natanael Copa nc...@alpinelinux.org
 Signed-off-by: Eric Blake ebl...@redhat.com
 ---
  src/nodeinfo.c | 31 +--
  1 file changed, 9 insertions(+), 22 deletions(-)

ACK

Jan



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCHv2 1/7] util: introduce virDirRead wrapper for readdir

2014-04-28 Thread Ján Tomko
On 04/26/2014 03:18 PM, Eric Blake wrote:
 From: Natanael Copa nc...@alpinelinux.org
 
 Introduce a wrapper for readdir. This helps us make sure that we always
 set errno before calling readdir and it will make sure errors are
 properly logged.
 
 Signed-off-by: Natanael Copa nc...@alpinelinux.org
 Signed-off-by: Eric Blake ebl...@redhat.com
 ---
  src/libvirt_private.syms |  1 +
  src/util/virfile.c   | 33 +
  src/util/virfile.h   |  4 
  3 files changed, 38 insertions(+)

ACK

Jan



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCHv2 0/7] saner readdir usage

2014-04-28 Thread Ján Tomko
On 04/26/2014 06:14 AM, Eric Blake wrote:
 This extends the work started by Nataneal to cover the entire
 tree.  Basically, readdir() is awkward to use correctly: to
 properly check for (unlikely) errors, one must pre-set errno.
 Forcing everything to go through a wrapper ensures that all
 our uses will be consistent; this also fixes several bugs
 in some of the call sites.
 
 Eric Blake (5):
   conf: use virDirRead API
   util: use virDirRead API
   drivers: use virDirRead API
   storage: use virDirRead API
   enforce sane readdir usage
 
 Natanael Copa (2):
   util: introduce virDirRead wrapper for readdir
   nodeinfo: use virDirRead API
 
  cfg.mk  |  6 +++
  src/conf/domain_conf.c  |  5 ++-
  src/conf/network_conf.c | 11 +++---
  src/conf/nwfilter_conf.c|  6 +--
  src/conf/storage_conf.c |  6 +--
  src/libvirt_private.syms|  1 +
  src/nodeinfo.c  | 31 +--
  src/openvz/openvz_conf.c|  9 +
  src/parallels/parallels_storage.c   | 11 --
  src/qemu/qemu_driver.c  |  5 ++-
  src/qemu/qemu_hostdev.c |  7 ++--
  src/secret/secret_driver.c  |  6 +--
  src/storage/storage_backend.c   |  8 ++--
  src/storage/storage_backend_fs.c|  6 ++-
  src/storage/storage_backend_iscsi.c |  5 ++-
  src/storage/storage_backend_scsi.c  | 10 +++--
  src/util/vircgroup.c| 28 --
  src/util/virfile.c  | 76 
 +++--
  src/util/virfile.h  |  4 ++
  src/util/virnetdevtap.c | 10 +
  src/util/virpci.c   | 20 +-
  src/util/virscsi.c  |  9 +++--
  src/util/virusb.c   |  7 +++-
  src/util/virutil.c  |  4 +-
  src/xen/xen_inotify.c   |  7 +++-
  src/xen/xm_internal.c   |  3 +-
  26 files changed, 170 insertions(+), 131 deletions(-)
 

ACK series if you conver the newly addded readdir call as well:
src/network/bridge_driver.c:487:entry = readdir(dir);
maint.mk: use virDirRead, not readdir
make: *** [sc_prohibit_readdir] Error 1

Jan





signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [RFC PATCH v2 3/3] qemu: memory pre-pinning support for RDMA migration

2014-04-28 Thread Paolo Bonzini

Il 04/04/2014 22:46, Eric Blake ha scritto:


 I'm still not seeing what's wrong with depending on the version
 number since other features are also depending on the version
 number.

Every feature where we have to guess based on version number is due to a
bug in qemu for not providing enough information for libvirt to probe
for the feature's existence.  We hate those features, and I have been
lobbying hard on the qemu list that all NEW features should be
discoverable.  rdma is one such feature - I recall you making changes in
your series there so that it is discoverable in response to my early
review comments - so now please USE that methodology from libvirt.



I think that relied on the QAPI introspection.  The MigrationCapability 
rdma-pin-all will be present only if QEMU supports RDMA migration.


But QAPI introspection is not there yet. :(

Paolo

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


[libvirt] [PATCHv2 6.5/7] network: use virDirRead in networkMigrateStateFiles

2014-04-28 Thread Laine Stump
This attempts to follow the same variable name and usage patterns as
the other conversions to virDirRead().
---
 src/network/bridge_driver.c | 15 ---
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 4e8375d..5233833 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -463,6 +463,7 @@ networkMigrateStateFiles(virNetworkDriverStatePtr driver)
 int ret = -1;
 const char *oldStateDir = LOCALSTATEDIR /lib/libvirt/network;
 DIR *dir;
+int direrr;
 struct dirent *entry;
 char *oldPath = NULL, *newPath = NULL;
 char *contents = NULL;
@@ -482,17 +483,7 @@ networkMigrateStateFiles(virNetworkDriverStatePtr driver)
 goto cleanup;
 }
 
-for (;;) {
-errno = 0;
-entry = readdir(dir);
-if (!entry) {
-if (errno) {
-virReportSystemError(errno, _(failed to read directory '%s'),
- oldStateDir);
-goto cleanup;
-}
-break;
-}
+while ((direrr = virDirRead(dir, entry, oldStateDir))  0) {
 
 if (entry-d_type != DT_REG ||
 STREQ(entry-d_name, .) ||
@@ -520,6 +511,8 @@ networkMigrateStateFiles(virNetworkDriverStatePtr driver)
 VIR_FREE(newPath);
 VIR_FREE(contents);
 }
+if (direrr  0)
+   goto cleanup;
 
 ret = 0;
  cleanup:
-- 
1.9.0

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


Re: [libvirt] [PATCHv2 0/7] saner readdir usage

2014-04-28 Thread Laine Stump
On 04/28/2014 12:23 PM, Ján Tomko wrote:
 On 04/26/2014 06:14 AM, Eric Blake wrote:
 This extends the work started by Nataneal to cover the entire
 tree.  Basically, readdir() is awkward to use correctly: to
 properly check for (unlikely) errors, one must pre-set errno.
 Forcing everything to go through a wrapper ensures that all
 our uses will be consistent; this also fixes several bugs
 in some of the call sites.

 Eric Blake (5):
   conf: use virDirRead API
   util: use virDirRead API
   drivers: use virDirRead API
   storage: use virDirRead API
   enforce sane readdir usage

 Natanael Copa (2):
   util: introduce virDirRead wrapper for readdir
   nodeinfo: use virDirRead API

  cfg.mk  |  6 +++
  src/conf/domain_conf.c  |  5 ++-
  src/conf/network_conf.c | 11 +++---
  src/conf/nwfilter_conf.c|  6 +--
  src/conf/storage_conf.c |  6 +--
  src/libvirt_private.syms|  1 +
  src/nodeinfo.c  | 31 +--
  src/openvz/openvz_conf.c|  9 +
  src/parallels/parallels_storage.c   | 11 --
  src/qemu/qemu_driver.c  |  5 ++-
  src/qemu/qemu_hostdev.c |  7 ++--
  src/secret/secret_driver.c  |  6 +--
  src/storage/storage_backend.c   |  8 ++--
  src/storage/storage_backend_fs.c|  6 ++-
  src/storage/storage_backend_iscsi.c |  5 ++-
  src/storage/storage_backend_scsi.c  | 10 +++--
  src/util/vircgroup.c| 28 --
  src/util/virfile.c  | 76 
 +++--
  src/util/virfile.h  |  4 ++
  src/util/virnetdevtap.c | 10 +
  src/util/virpci.c   | 20 +-
  src/util/virscsi.c  |  9 +++--
  src/util/virusb.c   |  7 +++-
  src/util/virutil.c  |  4 +-
  src/xen/xen_inotify.c   |  7 +++-
  src/xen/xm_internal.c   |  3 +-
  26 files changed, 170 insertions(+), 131 deletions(-)

 ACK series if you conver the newly addded readdir call as well:
 src/network/bridge_driver.c:487:entry = readdir(dir);
 maint.mk: use virDirRead, not readdir
 make: *** [sc_prohibit_readdir] Error 1

To make it easier for Eric (and since it was me that added the new usage
of readdir) I just sent a PATCHv2 6.5/7 to this thread that converts
to virDirRead().

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


[libvirt] [PATCH] nwfilter: Tear down temp. filters when tearing all filters

2014-04-28 Thread Stefan Berger
From: Stefan Berger stef...@linux.vnet.ibm.com

Refactor the ebiptablesTearNewRules function so that the teardown of temporary
filters can also be called by the ebiptablesAllTeardown function.

This fixes a problem that leaves temporary filters behind when a VM shuts down
while its filters are modified.

Signed-off-by: Stefan Berger stef...@linux.vnet.ibm.com
---
 src/nwfilter/nwfilter_ebiptables_driver.c | 24 
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c 
b/src/nwfilter/nwfilter_ebiptables_driver.c
index de07faa..307c153 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -3544,14 +3544,9 @@ ebiptablesApplyNewRules(const char *ifname,
 }
 
 
-static int
-ebiptablesTearNewRules(const char *ifname)
+static void
+ebiptablesTearNewRulesFW(virFirewallPtr fw, const char *ifname)
 {
-virFirewallPtr fw = virFirewallNew();
-int ret = -1;
-
-virFirewallStartTransaction(fw, VIR_FIREWALL_TRANSACTION_IGNORE_ERRORS);
-
 iptablesUnlinkTmpRootChainsFW(fw, VIR_FIREWALL_LAYER_IPV4, ifname);
 iptablesRemoveTmpRootChainsFW(fw, VIR_FIREWALL_LAYER_IPV4, ifname);
 
@@ -3563,13 +3558,24 @@ ebiptablesTearNewRules(const char *ifname)
 ebtablesRemoveTmpSubChainsFW(fw, ifname);
 ebtablesRemoveTmpRootChainFW(fw, true, ifname);
 ebtablesRemoveTmpRootChainFW(fw, false, ifname);
+}
+
+
+static int
+ebiptablesTearNewRules(const char *ifname)
+{
+virFirewallPtr fw = virFirewallNew();
+int ret = -1;
+
+virFirewallStartTransaction(fw, VIR_FIREWALL_TRANSACTION_IGNORE_ERRORS);
+
+ebiptablesTearNewRulesFW(fw, ifname);
 
 ret = virFirewallApply(fw);
 virFirewallFree(fw);
 return ret;
 }
 
-
 static int
 ebiptablesTearOldRules(const char *ifname)
 {
@@ -3616,6 +3622,8 @@ ebiptablesAllTeardown(const char *ifname)
 
 virFirewallStartTransaction(fw, VIR_FIREWALL_TRANSACTION_IGNORE_ERRORS);
 
+ebiptablesTearNewRulesFW(fw, ifname);
+
 iptablesUnlinkRootChainsFW(fw, VIR_FIREWALL_LAYER_IPV4, ifname);
 iptablesClearVirtInPostFW(fw, VIR_FIREWALL_LAYER_IPV4, ifname);
 iptablesRemoveRootChainsFW(fw, VIR_FIREWALL_LAYER_IPV4, ifname);
-- 
1.8.1.4

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


Re: [libvirt] [PATCHv2 6.5/7] network: use virDirRead in networkMigrateStateFiles

2014-04-28 Thread Ján Tomko
On 04/28/2014 12:45 PM, Laine Stump wrote:
 This attempts to follow the same variable name and usage patterns as
 the other conversions to virDirRead().
 ---
  src/network/bridge_driver.c | 15 ---
  1 file changed, 4 insertions(+), 11 deletions(-)

ACK

Jan



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [Xen-devel] [PATCH v2] libxl: Support PV consoles

2014-04-28 Thread Ian Campbell
On Fri, 2014-04-25 at 14:12 -0600, Jim Fehlig wrote:
 I dropped initializing the variable and pushed the patch. 
 Thanks!

Thanks! I rebased to current master (no additional patches on my end)
tried to test and suddenly libvirtd is segfaulting in libxl when I run
virsh create. The fault is at nexus-ev = 0 in osevent_release_nexus.
I haven't changed my Xen and I updated libvirt from
cc92ee32cde8d0ce0092d3ff30aece90af7b1781 + this patch to
eec2f65946388102f8acdd63f13c21a8b9aae806, nothing in that range looks
relevant.

Any ideas?

Ian.


2014-04-28 11:02:44.719+: 3029: info : libvirt version: 1.2.4
2014-04-28 11:02:44.719+: 3029: error : dnsmasqCapsRefreshInternal:726 : 
Cannot check dnsmasq binary dnsmasq: No such file or directory
2014-04-28 11:02:44.723+: 3029: error : virFirewallValidateBackend:156 : 
direct firewall backend requested, but /sbin/ebtables is not available: No such 
file or directory
2014-04-28 11:02:44.753+: 3029: error : virExec:417 : Cannot find 
'pm-is-supported' in path: No such file or directory
2014-04-28 11:02:44.753+: 3029: warning : virQEMUCapsInit:946 : Failed to 
get host power management capabilities
[Thread 0xb1553420 (LWP 3029) exited]
2014-04-28 11:02:45.679+: 3022: error : libxlDomainStart:1189 : internal 
error: libxenlight failed to create new domain 'libvirt-test'

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb5017420 (LWP 3022)]
0xb1706324 in osevent_release_nexus (gc=0xb5016904, nexi_idle=0x2a0b5c74, 
nexus=0x0) at libxl_event.c:119
119 libxl_event.c: No such file or directory.
(gdb) bt
#0  0xb1706324 in osevent_release_nexus (gc=0xb5016904, nexi_idle=0x2a0b5c74, 
nexus=0x0) at libxl_event.c:119
#1  0xb1706e60 in osevent_hook_pre_release (nexus=0x2a0b5ccc, 
nexi_idle=optimized out, ev=0x2a0b5cb8, gc=0xb5016904) at libxl_event.c:149
#2  libxl__ev_fd_deregister (gc=0xb5016904, ev=0x2a0b5cb8) at libxl_event.c:231
#3  0xb16dd2b4 in libxl_ctx_free (ctx=0x2a0b5c00) at libxl.c:156
#4  0xb173cbd6 in libxlDomainObjPrivateDispose () from 
/opt/libvirt/lib/libvirt/connection-driver/libvirt_driver_libxl.so
#5  0xb6c8745a in virObjectUnref () from /opt/libvirt/lib/libvirt.so.0
#6  0xb173cc5a in libxlDomainObjPrivateFree () from 
/opt/libvirt/lib/libvirt/connection-driver/libvirt_driver_libxl.so
#7  0xb6cb39ee in virDomainObjDispose () from /opt/libvirt/lib/libvirt.so.0
#8  0xb6c8745a in virObjectUnref () from /opt/libvirt/lib/libvirt.so.0
#9  0xb6cb4342 in virDomainObjListRemove () from /opt/libvirt/lib/libvirt.so.0
#10 0xb173ffb4 in libxlDomainCreateXML () from 
/opt/libvirt/lib/libvirt/connection-driver/libvirt_driver_libxl.so
#11 0xb6d389d0 in virDomainCreateXML () from /opt/libvirt/lib/libvirt.so.0
#12 0x2a018b8a in remoteDispatchDomainCreateXML ()
#13 0x2a018ac8 in remoteDispatchDomainCreateXMLHelper ()
#14 0x2a054cee in virNetServerProgramDispatchCall ()
#15 0x2a05493a in virNetServerProgramDispatch ()
#16 0x2a04efc8 in virNetServerProcessMsg ()
#17 0x2a04f080 in virNetServerHandleJob ()
#18 0xb6c9d318 in virThreadPoolWorker () from /opt/libvirt/lib/libvirt.so.0
#19 0xb6c9cd9c in virThreadHelper () from /opt/libvirt/lib/libvirt.so.0
#20 0xb6be3ebc in start_thread () from /lib/arm-linux-gnueabihf/libpthread.so.0
#21 0xb6b517f8 in ?? () from /lib/arm-linux-gnueabihf/libc.so.6
#22 0xb6b517f8 in ?? () from /lib/arm-linux-gnueabihf/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)


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


Re: [libvirt] [Xen-devel] [PATCH v2] libxl: Support PV consoles

2014-04-28 Thread Ian Campbell
On Mon, 2014-04-28 at 12:17 +0100, Ian Campbell wrote:
 On Fri, 2014-04-25 at 14:12 -0600, Jim Fehlig wrote:
  I dropped initializing the variable and pushed the patch. 
  Thanks!
 
 Thanks! I rebased to current master (no additional patches on my end)
 tried to test and suddenly libvirtd is segfaulting in libxl when I run
 virsh create. The fault is at nexus-ev = 0 in osevent_release_nexus.
 I haven't changed my Xen and I updated libvirt from
 cc92ee32cde8d0ce0092d3ff30aece90af7b1781 + this patch to
 eec2f65946388102f8acdd63f13c21a8b9aae806, nothing in that range looks
 relevant.
 
 Any ideas?

As soon as a wrote this and moved onto something else I realised that I
had clearer out some cruft from /boot -- including the kernel which my
cfg file was referencing

Fixing that I can now confirm that your modification to my patch was
correct and that consoles work for me on ARM.

Ian.

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


Re: [libvirt] [PATCH] vmware: make version parsing more robust

2014-04-28 Thread Ján Tomko
On 04/09/2014 11:59 AM, Jean-Baptiste Rouault wrote:
 Since commit d69415d4, vmware version is parsed from both stdout and
 stderr. This patch makes version parsing work even if there is garbage
 (libvirt debug messages for example) in the command output.

For libvirt's debug messages, we have virLogProbablyLogMessage that can check
if the message matches libvirt's format.

Should we really ignore all garbage?

Jan



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] Recheck disk backing chains after snapshot

2014-04-28 Thread John Ferlan


On 04/25/2014 09:13 AM, Jiri Denemark wrote:
 When a snapshot operation finishes we have to recheck the backing chain
 of all disks involved in the snapshot. And we need to do that even if
 the operation failed because some of the disks might have changed if
 QEMU did not support transactions.
 
 Signed-off-by: Jiri Denemark jdene...@redhat.com
 ---
 
 Notes:
 - BlockRebase and BlockCommit already recheck the backing chain when we
   get an event about a completed block job (in qemuProcessHandleBlockJob)
 
  src/qemu/qemu_driver.c | 12 
  1 file changed, 12 insertions(+)
 

FYI: This change fixes an issue that virt-test found over my
weekend run in the 'blockpull' test which was caused by 4/4 of
the addressing backing stores by index:

http://www.redhat.com/archives/libvir-list/2014-April/msg00823.html

Essentially the test sets things up via:

/usr/bin/virsh snapshot-create-as virt-tests-vm1 snapshot1 snap1-desc 
--disk-only --atomic --no-metadata 
vda,snapshot=external,file=/home/virt-test/tmp/jeos-20-64.snap1
/usr/bin/virsh snapshot-create-as virt-tests-vm1 snapshot2 snap2-desc 
--disk-only --atomic --no-metadata 
vda,snapshot=external,file=/home/virt-test/tmp/jeos-20-64.snap2
/usr/bin/virsh snapshot-create-as virt-tests-vm1 snapshot3 snap3-desc 
--disk-only --atomic --no-metadata 
vda,snapshot=external,file=/home/virt-test/tmp/jeos-20-64.snap3

Then does (in different passes):

/usr/bin/virsh blockpull virt-tests-vm1 vda --wait --verbose
/usr/bin/virsh blockpull virt-tests-vm1 vda --wait --verbose --base 
/home/virt-test/tmp/jeos-20-64.snap2
/usr/bin/virsh blockpull virt-tests-vm1 vda --wait --verbose --base 
/home/virt-test/tmp/jeos-20-64.snap1
/usr/bin/virsh blockpull virt-tests-vm1 vda --wait --verbose --timeout 1
/usr/bin/virsh blockpull virt-tests-vm1 vda --wait --verbose --timeout 1 --base 
/home/virt-test/tmp/jeos-20-64.snap2
/usr/bin/virsh blockpull virt-tests-vm1 vda --wait --verbose --timeout 1 --base 
/home/virt-test/tmp/jeos-20-64.snap1

Without this patch applied, the blockpull's w/ --base supplied fail
with either:

could not find image '/home/virt-test/tmp/jeos-20-64.snap2' in chain for 
'/home/virt-test/tmp/jeos-20-64.snap3'

or

could not find image '/home/virt-test/tmp/jeos-20-64.snap1' in chain for 
'/home/virt-test/tmp/jeos-20-64.snap3'


John

FWIW: The weekend run I had w/ virt-test against recent upstream
changes was quite successful. There's still an issue or two to
resolve regarding how capacity is checked, but the recent storage 
changes haven't caused regressions.

 diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
 index 67ba487..492fcc1 100644
 --- a/src/qemu/qemu_driver.c
 +++ b/src/qemu/qemu_driver.c
 @@ -12942,6 +12942,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr 
 driver,
  bool persist = false;
  bool reuse = (flags  VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT) != 0;
  virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
 +virErrorPtr orig_err = NULL;
  
  if (!virDomainObjIsActive(vm)) {
  virReportError(VIR_ERR_OPERATION_INVALID,
 @@ -13033,6 +13034,17 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr 
 driver,
  }
  
   cleanup:
 +/* recheck backing chains of all disks involved in the snapshot */
 +orig_err = virSaveLastError();
 +for (i = 0; i  snap-def-ndisks; i++) {
 +if (snap-def-disks[i].snapshot == 
 VIR_DOMAIN_SNAPSHOT_LOCATION_NONE)
 +continue;
 +qemuDomainDetermineDiskChain(driver, vm, vm-def-disks[i], true);
 +}
 +if (orig_err) {
 +virSetError(orig_err);
 +virFreeError(orig_err);
 +}
  
  if (ret == 0 || !virQEMUCapsGet(priv-qemuCaps, QEMU_CAPS_TRANSACTION)) {
  if (virDomainSaveStatus(driver-xmlopt, cfg-stateDir, vm)  0 ||
 

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


[libvirt] [PATCH v2] Don't use SO_REUSEADDR on Win32 platforms

2014-04-28 Thread Daniel P. Berrange
SO_REUSEADDR on Windows is actually akin to SO_REUSEPORT
on Linux/BSD. ie it allows 2 apps to listen to the same
port at once. Thus we must not set it on Win32 platforms

See http://msdn.microsoft.com/en-us/library/windows/desktop/ms740621.aspx

Signed-off-by: Daniel P. Berrange berra...@redhat.com
---
 src/libvirt_private.syms|  1 +
 src/rpc/virnetsocket.c  |  7 ++-
 src/util/virportallocator.c |  4 +---
 src/util/virutil.c  | 23 +++
 src/util/virutil.h  |  1 +
 5 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 5788468..ee2f57b 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2059,6 +2059,7 @@ virSetCloseExec;
 virSetDeviceUnprivSGIO;
 virSetInherit;
 virSetNonBlock;
+virSetSockReuseAddr;
 virSetUIDGID;
 virSetUIDGIDWithCaps;
 virStrIsPrint;
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index 2e94a6c..a7e1783 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -255,8 +255,7 @@ int virNetSocketNewListenTCP(const char *nodename,
 goto error;
 }
 
-int opt = 1;
-if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, opt, sizeof(opt))  0) {
+if (virSetSockReuseAddr(fd)  0) {
 virReportSystemError(errno, %s, _(Unable to enable port 
reuse));
 goto error;
 }
@@ -460,15 +459,13 @@ int virNetSocketNewConnectTCP(const char *nodename,
 
 runp = ai;
 while (runp) {
-int opt = 1;
-
 if ((fd = socket(runp-ai_family, runp-ai_socktype,
  runp-ai_protocol))  0) {
 virReportSystemError(errno, %s, _(Unable to create socket));
 goto error;
 }
 
-if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, opt, sizeof(opt))  0) {
+if (virSetSockReuseAddr(fd)  0) {
 VIR_WARN(Unable to enable port reuse);
 }
 
diff --git a/src/util/virportallocator.c b/src/util/virportallocator.c
index ed7bdc2..b68133a 100644
--- a/src/util/virportallocator.c
+++ b/src/util/virportallocator.c
@@ -116,7 +116,6 @@ static int virPortAllocatorBindToPort(bool *used,
 struct sockaddr* addr;
 size_t addrlen;
 int v6only = 1;
-int reuse = 1;
 int ret = -1;
 int fd = -1;
 bool ipv6 = false;
@@ -143,8 +142,7 @@ static int virPortAllocatorBindToPort(bool *used,
 goto cleanup;
 }
 
-if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void*)reuse,
-   sizeof(reuse))  0) {
+if (virSetSockReuseAddr(fd)  0) {
 virReportSystemError(errno, %s,
  _(Unable to set socket reuse addr flag));
 goto cleanup;
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 9be1590..65b10b8 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -136,6 +136,29 @@ int virSetCloseExec(int fd)
 return virSetInherit(fd, false);
 }
 
+#ifdef WIN32
+int virSetSockReuseAddr(int fd ATTRIBUTE_UNUSED)
+{
+/*
+ * SO_REUSEADDR on Windows is actually akin to SO_REUSEPORT
+ * on Linux/BSD. ie it allows 2 apps to listen to the same
+ * port at once which is certainly not what we want here.
+ *
+ * Win32 sockets have Linux/BSD-like SO_REUSEADDR behaviour
+ * by default, so we can be a no-op.
+ *
+ * http://msdn.microsoft.com/en-us/library/windows/desktop/ms740621.aspx
+ */
+return 0;
+}
+#else
+int virSetSockReuseAddr(int fd)
+{
+int opt = 1;
+return setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, opt, sizeof(opt));
+#endif
+}
+
 int
 virPipeReadUntilEOF(int outfd, int errfd,
 char **outbuf, char **errbuf) {
diff --git a/src/util/virutil.h b/src/util/virutil.h
index 1f2efd5..2bb74e2 100644
--- a/src/util/virutil.h
+++ b/src/util/virutil.h
@@ -42,6 +42,7 @@ int virSetBlocking(int fd, bool blocking) 
ATTRIBUTE_RETURN_CHECK;
 int virSetNonBlock(int fd) ATTRIBUTE_RETURN_CHECK;
 int virSetInherit(int fd, bool inherit) ATTRIBUTE_RETURN_CHECK;
 int virSetCloseExec(int fd) ATTRIBUTE_RETURN_CHECK;
+int virSetSockReuseAddr(int fd) ATTRIBUTE_RETURN_CHECK;
 
 int virPipeReadUntilEOF(int outfd, int errfd,
 char **outbuf, char **errbuf);
-- 
1.9.0

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


Re: [libvirt] [PATCH v2] Don't use SO_REUSEADDR on Win32 platforms

2014-04-28 Thread Daniel P. Berrange
On Mon, Apr 28, 2014 at 02:05:23PM +0100, Daniel P. Berrange wrote:
 SO_REUSEADDR on Windows is actually akin to SO_REUSEPORT
 on Linux/BSD. ie it allows 2 apps to listen to the same
 port at once. Thus we must not set it on Win32 platforms
 
 See http://msdn.microsoft.com/en-us/library/windows/desktop/ms740621.aspx
 
 Signed-off-by: Daniel P. Berrange berra...@redhat.com
 ---
  src/libvirt_private.syms|  1 +
  src/rpc/virnetsocket.c  |  7 ++-
  src/util/virportallocator.c |  4 +---
  src/util/virutil.c  | 23 +++
  src/util/virutil.h  |  1 +
  5 files changed, 28 insertions(+), 8 deletions(-)
 
 diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
 index 5788468..ee2f57b 100644
 --- a/src/libvirt_private.syms
 +++ b/src/libvirt_private.syms
 @@ -2059,6 +2059,7 @@ virSetCloseExec;
  virSetDeviceUnprivSGIO;
  virSetInherit;
  virSetNonBlock;
 +virSetSockReuseAddr;
  virSetUIDGID;
  virSetUIDGIDWithCaps;
  virStrIsPrint;
 diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
 index 2e94a6c..a7e1783 100644
 --- a/src/rpc/virnetsocket.c
 +++ b/src/rpc/virnetsocket.c
 @@ -255,8 +255,7 @@ int virNetSocketNewListenTCP(const char *nodename,
  goto error;
  }
  
 -int opt = 1;
 -if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, opt, sizeof(opt))  0) 
 {
 +if (virSetSockReuseAddr(fd)  0) {
  virReportSystemError(errno, %s, _(Unable to enable port 
 reuse));
  goto error;
  }
 @@ -460,15 +459,13 @@ int virNetSocketNewConnectTCP(const char *nodename,
  
  runp = ai;
  while (runp) {
 -int opt = 1;
 -
  if ((fd = socket(runp-ai_family, runp-ai_socktype,
   runp-ai_protocol))  0) {
  virReportSystemError(errno, %s, _(Unable to create socket));
  goto error;
  }
  
 -if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, opt, sizeof(opt))  0) 
 {
 +if (virSetSockReuseAddr(fd)  0) {
  VIR_WARN(Unable to enable port reuse);
  }
  
 diff --git a/src/util/virportallocator.c b/src/util/virportallocator.c
 index ed7bdc2..b68133a 100644
 --- a/src/util/virportallocator.c
 +++ b/src/util/virportallocator.c
 @@ -116,7 +116,6 @@ static int virPortAllocatorBindToPort(bool *used,
  struct sockaddr* addr;
  size_t addrlen;
  int v6only = 1;
 -int reuse = 1;
  int ret = -1;
  int fd = -1;
  bool ipv6 = false;
 @@ -143,8 +142,7 @@ static int virPortAllocatorBindToPort(bool *used,
  goto cleanup;
  }
  
 -if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void*)reuse,
 -   sizeof(reuse))  0) {
 +if (virSetSockReuseAddr(fd)  0) {
  virReportSystemError(errno, %s,
   _(Unable to set socket reuse addr flag));
  goto cleanup;
 diff --git a/src/util/virutil.c b/src/util/virutil.c
 index 9be1590..65b10b8 100644
 --- a/src/util/virutil.c
 +++ b/src/util/virutil.c
 @@ -136,6 +136,29 @@ int virSetCloseExec(int fd)
  return virSetInherit(fd, false);
  }
  
 +#ifdef WIN32
 +int virSetSockReuseAddr(int fd ATTRIBUTE_UNUSED)
 +{
 +/*
 + * SO_REUSEADDR on Windows is actually akin to SO_REUSEPORT
 + * on Linux/BSD. ie it allows 2 apps to listen to the same
 + * port at once which is certainly not what we want here.
 + *
 + * Win32 sockets have Linux/BSD-like SO_REUSEADDR behaviour
 + * by default, so we can be a no-op.
 + *
 + * http://msdn.microsoft.com/en-us/library/windows/desktop/ms740621.aspx
 + */
 +return 0;
 +}
 +#else
 +int virSetSockReuseAddr(int fd)
 +{
 +int opt = 1;
 +return setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, opt, sizeof(opt));
 +#endif
 +}

Obviously this } should be before the #endif :-)


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] [PATCH] Disable libvirtd by default when building on Win32

2014-04-28 Thread Daniel P. Berrange
We don't support building libvirtd on Win32 since we lack the
fork/exec feature needed for the stateful drivers. Disable this
by default, so users can just do 'mingw32-configure' with no
special args required.

Signed-off-by: Daniel P. Berrange berra...@redhat.com
---
 autobuild.sh | 6 ++
 configure.ac | 6 ++
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/autobuild.sh b/autobuild.sh
index f682b51..4d9f616 100755
--- a/autobuild.sh
+++ b/autobuild.sh
@@ -85,8 +85,7 @@ if test -x /usr/bin/i686-w64-mingw32-gcc ; then
 --host=i686-w64-mingw32 \
 --prefix=$AUTOBUILD_INSTALL_ROOT/i686-w64-mingw32/sys-root/mingw \
 --enable-expensive-tests \
---enable-werror \
---without-libvirtd
+--enable-werror
 
   make
   make install
@@ -105,8 +104,7 @@ if test -x /usr/bin/x86_64-w64-mingw32-gcc ; then
 --host=x86_64-w64-mingw32 \
 --prefix=$AUTOBUILD_INSTALL_ROOT/x86_64-w64-mingw32/sys-root/mingw \
 --enable-expensive-tests \
---enable-werror \
---without-libvirtd
+--enable-werror
 
   make
   make install
diff --git a/configure.ac b/configure.ac
index ea85851..3371b46 100644
--- a/configure.ac
+++ b/configure.ac
@@ -175,6 +175,7 @@ case $host in
   *-*-linux*) with_linux=yes ;;
   *-*-darwin*) with_osx=yes ;;
   *-*-freebsd*) with_freebsd=yes ;;
+  *-*-mingw* | *-*-msvc* ) with_win=yes ;;
 esac
 
 if test $with_linux = no; then
@@ -194,6 +195,11 @@ fi
 AM_CONDITIONAL([WITH_LINUX], [test $with_linux = yes])
 AM_CONDITIONAL([WITH_FREEBSD], [test $with_freebsd = yes])
 
+# We don't support the daemon yet
+if test $with_win = yes ; then
+  with_libvirtd=no
+fi
+
 # The daemon requires remote support.  Likewise, if we are not using
 # RPC, we don't need several libraries.
 if test $with_remote = no ; then
-- 
1.9.0

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


[libvirt] [PATCH] Remove bogus ATTRIBUTE_NONNULL from virFirewallAddRuleFull

2014-04-28 Thread Daniel P. Berrange
The virFirewallAddRuleFull method originally had a single
compulsory virFirewallQueryCallback parameter. During dev
work though the ignoreErrors parameter was added and the
callback parameter made optional. The ATTRIBUTE_NONNULL
annotation was never removed though.

Signed-off-by: Daniel P. Berrange berra...@redhat.com
---
 src/util/virfirewall.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/virfirewall.h b/src/util/virfirewall.h
index 5ca66fa..1129219 100644
--- a/src/util/virfirewall.h
+++ b/src/util/virfirewall.h
@@ -59,7 +59,7 @@ virFirewallRulePtr virFirewallAddRuleFull(virFirewallPtr 
firewall,
   virFirewallQueryCallback cb,
   void *opaque,
   ...)
-ATTRIBUTE_NONNULL(3) ATTRIBUTE_SENTINEL;
+ATTRIBUTE_SENTINEL;
 
 void virFirewallRemoveRule(virFirewallPtr firewall,
virFirewallRulePtr rule);
-- 
1.9.0

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


Re: [libvirt] [PATCH] Remove bogus ATTRIBUTE_NONNULL from virFirewallAddRuleFull

2014-04-28 Thread John Ferlan


On 04/28/2014 09:18 AM, Daniel P. Berrange wrote:
 The virFirewallAddRuleFull method originally had a single
 compulsory virFirewallQueryCallback parameter. During dev
 work though the ignoreErrors parameter was added and the
 callback parameter made optional. The ATTRIBUTE_NONNULL
 annotation was never removed though.
 
 Signed-off-by: Daniel P. Berrange berra...@redhat.com
 ---
  src/util/virfirewall.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 

ACK - this makes coverity build happy again.

John

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


Re: [libvirt] [PATCH v2] Don't use SO_REUSEADDR on Win32 platforms

2014-04-28 Thread Martin Kletzander

On Mon, Apr 28, 2014 at 02:14:39PM +0100, Daniel P. Berrange wrote:

On Mon, Apr 28, 2014 at 02:05:23PM +0100, Daniel P. Berrange wrote:

SO_REUSEADDR on Windows is actually akin to SO_REUSEPORT
on Linux/BSD. ie it allows 2 apps to listen to the same
port at once. Thus we must not set it on Win32 platforms

See http://msdn.microsoft.com/en-us/library/windows/desktop/ms740621.aspx

Signed-off-by: Daniel P. Berrange berra...@redhat.com
---
 src/libvirt_private.syms|  1 +
 src/rpc/virnetsocket.c  |  7 ++-
 src/util/virportallocator.c |  4 +---
 src/util/virutil.c  | 23 +++
 src/util/virutil.h  |  1 +
 5 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 5788468..ee2f57b 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2059,6 +2059,7 @@ virSetCloseExec;
 virSetDeviceUnprivSGIO;
 virSetInherit;
 virSetNonBlock;
+virSetSockReuseAddr;
 virSetUIDGID;
 virSetUIDGIDWithCaps;
 virStrIsPrint;
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index 2e94a6c..a7e1783 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -255,8 +255,7 @@ int virNetSocketNewListenTCP(const char *nodename,
 goto error;
 }

-int opt = 1;
-if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, opt, sizeof(opt))  0) {
+if (virSetSockReuseAddr(fd)  0) {
 virReportSystemError(errno, %s, _(Unable to enable port 
reuse));
 goto error;
 }
@@ -460,15 +459,13 @@ int virNetSocketNewConnectTCP(const char *nodename,

 runp = ai;
 while (runp) {
-int opt = 1;
-
 if ((fd = socket(runp-ai_family, runp-ai_socktype,
  runp-ai_protocol))  0) {
 virReportSystemError(errno, %s, _(Unable to create socket));
 goto error;
 }

-if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, opt, sizeof(opt))  0) {
+if (virSetSockReuseAddr(fd)  0) {
 VIR_WARN(Unable to enable port reuse);
 }

diff --git a/src/util/virportallocator.c b/src/util/virportallocator.c
index ed7bdc2..b68133a 100644
--- a/src/util/virportallocator.c
+++ b/src/util/virportallocator.c
@@ -116,7 +116,6 @@ static int virPortAllocatorBindToPort(bool *used,
 struct sockaddr* addr;
 size_t addrlen;
 int v6only = 1;
-int reuse = 1;
 int ret = -1;
 int fd = -1;
 bool ipv6 = false;
@@ -143,8 +142,7 @@ static int virPortAllocatorBindToPort(bool *used,
 goto cleanup;
 }

-if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void*)reuse,
-   sizeof(reuse))  0) {
+if (virSetSockReuseAddr(fd)  0) {
 virReportSystemError(errno, %s,
  _(Unable to set socket reuse addr flag));
 goto cleanup;
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 9be1590..65b10b8 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -136,6 +136,29 @@ int virSetCloseExec(int fd)
 return virSetInherit(fd, false);
 }

+#ifdef WIN32
+int virSetSockReuseAddr(int fd ATTRIBUTE_UNUSED)
+{
+/*
+ * SO_REUSEADDR on Windows is actually akin to SO_REUSEPORT
+ * on Linux/BSD. ie it allows 2 apps to listen to the same
+ * port at once which is certainly not what we want here.
+ *
+ * Win32 sockets have Linux/BSD-like SO_REUSEADDR behaviour
+ * by default, so we can be a no-op.
+ *
+ * http://msdn.microsoft.com/en-us/library/windows/desktop/ms740621.aspx
+ */
+return 0;
+}
+#else
+int virSetSockReuseAddr(int fd)
+{
+int opt = 1;
+return setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, opt, sizeof(opt));
+#endif
+}


Obviously this } should be before the #endif :-)



ACK with that changed :-)

Martin



Regards,
Daniel


signature.asc
Description: Digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] Disable libvirtd by default when building on Win32

2014-04-28 Thread Martin Kletzander

On Mon, Apr 28, 2014 at 02:16:16PM +0100, Daniel P. Berrange wrote:

We don't support building libvirtd on Win32 since we lack the
fork/exec feature needed for the stateful drivers. Disable this
by default, so users can just do 'mingw32-configure' with no
special args required.

Signed-off-by: Daniel P. Berrange berra...@redhat.com
---
autobuild.sh | 6 ++
configure.ac | 6 ++
2 files changed, 8 insertions(+), 4 deletions(-)



Makes sense, ACK.

Martin


signature.asc
Description: Digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH] tests: remove hostdevmgr directory on cleanup

2014-04-28 Thread Martin Kletzander
Signed-off-by: Martin Kletzander mklet...@redhat.com
---
 tests/virhostdevtest.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c
index 089014e..de4cdde 100644
--- a/tests/virhostdevtest.c
+++ b/tests/virhostdevtest.c
@@ -65,6 +65,9 @@ myCleanup(void)
 }

 if (mgr) {
+if (mgr-stateDir  !getenv(LIBVIRT_SKIP_CLEANUP))
+virFileDeleteTree(mgr-stateDir);
+
 virObjectUnref(mgr-activePCIHostdevs);
 virObjectUnref(mgr-inactivePCIHostdevs);
 virObjectUnref(mgr-activeUSBHostdevs);
-- 
1.9.2

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


[libvirt] [PATCH V4] libxl: add migration support

2014-04-28 Thread Jim Fehlig
This patch adds initial migration support to the libxl driver,
using the VIR_DRV_FEATURE_MIGRATION_PARAMS family of migration
functions.

Signed-off-by: Jim Fehlig jfeh...@suse.com
---

V3 here
  https://www.redhat.com/archives/libvir-list/2014-April/msg00968.html

In V4:
- Code cleanup
- Improved error handling

Although this patch has been floating around for a long time, not sure
if it is 1.2.4 material since it brings a new feature to the libxl
driver.

 po/POTFILES.in  |   1 +
 src/Makefile.am |   3 +-
 src/libxl/libxl_conf.h  |   6 +
 src/libxl/libxl_domain.h|   1 +
 src/libxl/libxl_driver.c| 224 ++
 src/libxl/libxl_migration.c | 978 
 src/libxl/libxl_migration.h |  78 
 7 files changed, 1290 insertions(+), 1 deletion(-)

diff --git a/po/POTFILES.in b/po/POTFILES.in
index e35eb82..a72dc1e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -73,6 +73,7 @@ src/lxc/lxc_process.c
 src/libxl/libxl_domain.c
 src/libxl/libxl_driver.c
 src/libxl/libxl_conf.c
+src/libxl/libxl_migration.c
 src/network/bridge_driver.c
 src/network/bridge_driver_linux.c
 src/node_device/node_device_driver.c
diff --git a/src/Makefile.am b/src/Makefile.am
index e9dc9e0..0dbda7f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -706,7 +706,8 @@ XENAPI_DRIVER_SOURCES = 
\
 LIBXL_DRIVER_SOURCES = \
libxl/libxl_conf.c libxl/libxl_conf.h   \
libxl/libxl_domain.c libxl/libxl_domain.h   \
-   libxl/libxl_driver.c libxl/libxl_driver.h
+   libxl/libxl_driver.c libxl/libxl_driver.h   \
+   libxl/libxl_migration.c libxl/libxl_migration.h
 
 UML_DRIVER_SOURCES =   \
uml/uml_conf.c uml/uml_conf.h   \
diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
index 24e1720..b798567 100644
--- a/src/libxl/libxl_conf.h
+++ b/src/libxl/libxl_conf.h
@@ -43,6 +43,9 @@
 # define LIBXL_VNC_PORT_MIN  5900
 # define LIBXL_VNC_PORT_MAX  65535
 
+# define LIBXL_MIGRATION_PORT_MIN  49152
+# define LIBXL_MIGRATION_PORT_MAX  49216
+
 # define LIBXL_CONFIG_DIR SYSCONFDIR /libvirt/libxl
 # define LIBXL_AUTOSTART_DIR LIBXL_CONFIG_DIR /autostart
 # define LIBXL_STATE_DIR LOCALSTATEDIR /run/libvirt/libxl
@@ -115,6 +118,9 @@ struct _libxlDriverPrivate {
 /* Immutable pointer, self-locking APIs */
 virPortAllocatorPtr reservedVNCPorts;
 
+/* Immutable pointer, self-locking APIs */
+virPortAllocatorPtr migrationPorts;
+
 /* Immutable pointer, lockless APIs*/
 virSysinfoDefPtr hostsysinfo;
 };
diff --git a/src/libxl/libxl_domain.h b/src/libxl/libxl_domain.h
index 979ce2a..9d48049 100644
--- a/src/libxl/libxl_domain.h
+++ b/src/libxl/libxl_domain.h
@@ -69,6 +69,7 @@ struct _libxlDomainObjPrivate {
 virChrdevsPtr devs;
 libxl_evgen_domain_death *deathW;
 libxlDriverPrivatePtr driver;
+unsigned short migrationPort;
 
 struct libxlDomainJobObj job;
 };
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index e5ed0f2..2359f71 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -45,6 +45,7 @@
 #include libxl_domain.h
 #include libxl_driver.h
 #include libxl_conf.h
+#include libxl_migration.h
 #include xen_xm.h
 #include xen_sxpr.h
 #include virtypedparam.h
@@ -209,6 +210,7 @@ libxlStateCleanup(void)
 virObjectUnref(libxl_driver-xmlopt);
 virObjectUnref(libxl_driver-domains);
 virObjectUnref(libxl_driver-reservedVNCPorts);
+virObjectUnref(libxl_driver-migrationPorts);
 
 virObjectEventStateFree(libxl_driver-domainEventState);
 virSysinfoDefFree(libxl_driver-hostsysinfo);
@@ -296,6 +298,13 @@ libxlStateInitialize(bool privileged,
   LIBXL_VNC_PORT_MAX)))
 goto error;
 
+/* Allocate bitmap for migration port reservation */
+if (!(libxl_driver-migrationPorts =
+  virPortAllocatorNew(_(migration),
+  LIBXL_MIGRATION_PORT_MIN,
+  LIBXL_MIGRATION_PORT_MAX)))
+goto error;
+
 if (!(libxl_driver-domains = virDomainObjListNew()))
 goto error;
 
@@ -4126,6 +4135,7 @@ libxlConnectSupportsFeature(virConnectPtr conn, int 
feature)
 
 switch (feature) {
 case VIR_DRV_FEATURE_TYPED_PARAM_STRING:
+case VIR_DRV_FEATURE_MIGRATION_PARAMS:
 return 1;
 default:
 return 0;
@@ -4304,6 +4314,215 @@ libxlNodeDeviceReset(virNodeDevicePtr dev)
 return ret;
 }
 
+static char *
+libxlDomainMigrateBegin3Params(virDomainPtr domain,
+   virTypedParameterPtr params,
+   int nparams,
+   char **cookieout ATTRIBUTE_UNUSED,
+   int *cookieoutlen ATTRIBUTE_UNUSED,
+   unsigned int 

Re: [libvirt] Entering freeze for libvirt-1.2.4

2014-04-28 Thread Guido Günther
Hi,
On Mon, Apr 28, 2014 at 03:38:40PM +0800, Daniel Veillard wrote:
   As planned on Friday, I tagged the tree earlier today for Release
 Candidate 1, the tarball and rpms are available from the usual place:
 
   ftp://libvirt.org/libvirt/
 
  Seems to work fine in my limited testing, but distcheck failed
 with xsltproc being unable to access ../../ . I don't think anything
 changed there on my side so it smells like a new problem.
 
   Otherwise looks good to me so far, with a bit of luck we can push
 1.2.4 end of Friday or sometime next week-end,

I'm currently seeing some test failures on i386 Debian wheezy:

virstoragetest
--

97) Chain lookup 27 ... index: expected 0, got 4294967295 FAILED

qemucaps2xmltest


TEST: qemucaps2xmltest
 1) all_1.6.0-1
... 
Offset 295
Expect [  domain type='kvm'
emulator/usr/bin/qemu-system-i386/emulator
  /domain
]
Actual []
  ...  
FAILED
 2) nodisksnapshot_1.6.0-1
... 
Offset 295
Expect [  domain type='kvm'
emulator/usr/bin/qemu-system-i386/emulator
  /domain
]
Actual []
  ...  
FAILED
The full log is at:

 http://honk.sigxcpu.org:8001/job/libvirt-check/2232/consoleFull

I won't be able to investigate myself in the near future so I thought I
at least report it.
Cheers,
 -- Guido

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


Re: [libvirt] [Xen-devel] [PATCH] libxl: support ACPI shutdown flag

2014-04-28 Thread Jim Fehlig
Any comments on this small patch?  If possible, I'd like to push it for
the 1.2.4 release.

Thanks!
Jim

Jim Fehlig wrote:
 Add support for VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN flag in
 libxlDomainShutdownFlags().  Inspired by similar functionality
 in the Xen xl client.

 Signed-off-by: Jim Fehlig jfeh...@suse.com
 ---

 I considered invoking libxl_send_trigger() immediately when
 VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN flag is specified, but in the
 end decided to only honor the flag if a normal shutdown request
 failed.  This behavior is similar to xl and conforms to the
 virDomainShutdownFlags() docs

 If @flags is set to zero, then the hypervisor will choose the method
 of shutdown it considers best. To have greater control pass one or
 more of the virDomainShutdownFlagValues. The order in which the
 hypervisor tries each shutdown method is undefined, and a hypervisor
 is not required to support all methods.

 I'm certainly receptive to only invoking libxl_send_trigger() when
 VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN is specified if folks think that
 is a better approach.

  src/libxl/libxl_driver.c | 26 ++
  1 file changed, 22 insertions(+), 4 deletions(-)

 diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
 index b3f8df6..2b30c08 100644
 --- a/src/libxl/libxl_driver.c
 +++ b/src/libxl/libxl_driver.c
 @@ -868,7 +868,7 @@ libxlDomainShutdownFlags(virDomainPtr dom, unsigned int 
 flags)
  int ret = -1;
  libxlDomainObjPrivatePtr priv;
  
 -virCheckFlags(0, -1);
 +virCheckFlags(VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN, -1);
  
  if (!(vm = libxlDomObjFromDomain(dom)))
  goto cleanup;
 @@ -883,17 +883,35 @@ libxlDomainShutdownFlags(virDomainPtr dom, unsigned int 
 flags)
  }
  
  priv = vm-privateData;
 -if (libxl_domain_shutdown(priv-ctx, vm-def-id) != 0) {
 +ret = libxl_domain_shutdown(priv-ctx, vm-def-id);
 +if (ret == ERROR_NOPARAVIRT) {
 +if (flags  VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN) {
 +VIR_DEBUG(PV control interface not available, 
 +  sending ACPI power button event.);
 +ret = libxl_send_trigger(priv-ctx, vm-def-id,
 + LIBXL_TRIGGER_POWER, 0);
 +} else {
 +virReportError(VIR_ERR_OPERATION_INVALID,
 +   %s, _(PV control interface not available, 
 +   preventing external graceful shutdown. 
 +   Consider using an ACPI power event.));
 +ret = -1;
 +goto cleanup;
 +}
 +}
 +
 +if (ret != 0) {
  virReportError(VIR_ERR_INTERNAL_ERROR,
 _(Failed to shutdown domain '%d' with libxenlight),
 vm-def-id);
 +ret = -1;
  goto cleanup;
  }
  
 -/* vm is marked shutoff (or removed from domains list if not persistent)
 +/* ret == 0 == successful shutdown request
 + * vm is marked shutoff (or removed from domains list if not persistent)
   * in shutdown event handler.
   */
 -ret = 0;
  
   cleanup:
  if (vm)
   

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


Re: [libvirt] [RFC PATCH v2 3/3] qemu: memory pre-pinning support for RDMA migration

2014-04-28 Thread Eric Blake
On 04/28/2014 03:38 AM, Paolo Bonzini wrote:
 Il 04/04/2014 22:46, Eric Blake ha scritto:
 
  I'm still not seeing what's wrong with depending on the version
  number since other features are also depending on the version
  number.
 Every feature where we have to guess based on version number is due to a
 bug in qemu for not providing enough information for libvirt to probe
 for the feature's existence.  We hate those features, and I have been
 lobbying hard on the qemu list that all NEW features should be
 discoverable.  rdma is one such feature - I recall you making changes in
 your series there so that it is discoverable in response to my early
 review comments - so now please USE that methodology from libvirt.

 
 I think that relied on the QAPI introspection.  The MigrationCapability
 rdma-pin-all will be present only if QEMU supports RDMA migration.
 
 But QAPI introspection is not there yet. :(

I know that qapi introspection is not there yet, but
'query-migrate-capabilities' IS there, and the presence or absence of
rdma-pin-all in the set of queried capabilities IS a reliable witness of
whether rdma support is available.


-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] tests: remove hostdevmgr directory on cleanup

2014-04-28 Thread Eric Blake
On 04/28/2014 08:00 AM, Martin Kletzander wrote:
 Signed-off-by: Martin Kletzander mklet...@redhat.com
 ---
  tests/virhostdevtest.c | 3 +++
  1 file changed, 3 insertions(+)
 
 diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c
 index 089014e..de4cdde 100644
 --- a/tests/virhostdevtest.c
 +++ b/tests/virhostdevtest.c
 @@ -65,6 +65,9 @@ myCleanup(void)
  }
 
  if (mgr) {
 +if (mgr-stateDir  !getenv(LIBVIRT_SKIP_CLEANUP))
 +virFileDeleteTree(mgr-stateDir);
 +

ACK.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH] xen: ensure /usr/sbin/xend exists before checking status

2014-04-28 Thread Jim Fehlig
With xend on the way out, installations may not even have
/usr/sbin/xend, which results in the following error when the
drivers are probed

2014-04-28 18:21:19.271+: 22129: error : virCommandWait:2426 :
internal error: Child process (/usr/sbin/xend status) unexpected exit
status 127: libvirt:  error : cannot execute binary /usr/sbin/xend:
No such file or directory

Check for existence of /usr/sbin/xend before trying to run it with
the 'status' option.

Signed-off-by: Jim Fehlig jfeh...@suse.com
---
 src/libxl/libxl_driver.c | 19 ---
 src/xen/xen_driver.c | 13 -
 2 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index e5ed0f2..8ee61c7 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -223,7 +223,6 @@ static bool
 libxlDriverShouldLoad(bool privileged)
 {
 bool ret = false;
-virCommandPtr cmd;
 int status;
 char *output = NULL;
 
@@ -236,7 +235,7 @@ libxlDriverShouldLoad(bool privileged)
 if (!virFileExists(HYPERVISOR_CAPABILITIES)) {
 VIR_INFO(Disabling driver as  HYPERVISOR_CAPABILITIES
   does not exist);
-return false;
+return ret;
 }
 /*
  * Don't load if not running on a Xen control domain (dom0). It is not
@@ -256,14 +255,20 @@ libxlDriverShouldLoad(bool privileged)
 }
 
 /* Don't load if legacy xen toolstack (xend) is in use */
-cmd = virCommandNewArgList(/usr/sbin/xend, status, NULL);
-if (virCommandRun(cmd, status) == 0  status == 0) {
-VIR_INFO(Legacy xen tool stack seems to be in use, disabling 
-  libxenlight driver.);
+if (virFileExists(/usr/sbin/xend)) {
+virCommandPtr cmd;
+
+cmd = virCommandNewArgList(/usr/sbin/xend, status, NULL);
+if (virCommandRun(cmd, status) == 0  status == 0) {
+VIR_INFO(Legacy xen tool stack seems to be in use, disabling 
+ libxenlight driver.);
+} else {
+ret = true;
+}
+virCommandFree(cmd);
 } else {
 ret = true;
 }
-virCommandFree(cmd);
 
 return ret;
 }
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 2ffb06b..bd51909 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -315,13 +315,16 @@ xenUnifiedProbe(void)
 static bool
 xenUnifiedXendProbe(void)
 {
-virCommandPtr cmd;
 bool ret = false;
 
-cmd = virCommandNewArgList(/usr/sbin/xend, status, NULL);
-if (virCommandRun(cmd, NULL) == 0)
-ret = true;
-virCommandFree(cmd);
+if (virFileExists(/usr/sbin/xend)) {
+virCommandPtr cmd;
+
+cmd = virCommandNewArgList(/usr/sbin/xend, status, NULL);
+if (virCommandRun(cmd, NULL) == 0)
+ret = true;
+virCommandFree(cmd);
+}
 
 return ret;
 }
-- 
1.8.1.4

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


Re: [libvirt] [PATCH] xen: ensure /usr/sbin/xend exists before checking status

2014-04-28 Thread Eric Blake
On 04/28/2014 12:42 PM, Jim Fehlig wrote:
 With xend on the way out, installations may not even have
 /usr/sbin/xend, which results in the following error when the
 drivers are probed
 
 2014-04-28 18:21:19.271+: 22129: error : virCommandWait:2426 :
 internal error: Child process (/usr/sbin/xend status) unexpected exit
 status 127: libvirt:  error : cannot execute binary /usr/sbin/xend:
 No such file or directory
 
 Check for existence of /usr/sbin/xend before trying to run it with
 the 'status' option.
 
 Signed-off-by: Jim Fehlig jfeh...@suse.com
 ---
  src/libxl/libxl_driver.c | 19 ---
  src/xen/xen_driver.c | 13 -
  2 files changed, 20 insertions(+), 12 deletions(-)


 @@ -256,14 +255,20 @@ libxlDriverShouldLoad(bool privileged)
  }
  
  /* Don't load if legacy xen toolstack (xend) is in use */
 -cmd = virCommandNewArgList(/usr/sbin/xend, status, NULL);
 -if (virCommandRun(cmd, status) == 0  status == 0) {
 -VIR_INFO(Legacy xen tool stack seems to be in use, disabling 
 -  libxenlight driver.);
 +if (virFileExists(/usr/sbin/xend)) {
 +virCommandPtr cmd;
 +
 +cmd = virCommandNewArgList(/usr/sbin/xend, status, NULL);
 +if (virCommandRun(cmd, status) == 0  status == 0) {

Pre-patch, passing status to virCommandRun had the effect of avoiding a
log message if the command ran with non-zero status.  But now that we
are requiring the file to exist, and in particular, since we are already
using NULL later on...

 +++ b/src/xen/xen_driver.c
 @@ -315,13 +315,16 @@ xenUnifiedProbe(void)
  static bool
  xenUnifiedXendProbe(void)
  {
 -virCommandPtr cmd;
  bool ret = false;
  
 -cmd = virCommandNewArgList(/usr/sbin/xend, status, NULL);
 -if (virCommandRun(cmd, NULL) == 0)
 -ret = true;
 -virCommandFree(cmd);
 +if (virFileExists(/usr/sbin/xend)) {
 +virCommandPtr cmd;
 +
 +cmd = virCommandNewArgList(/usr/sbin/xend, status, NULL);
 +if (virCommandRun(cmd, NULL) == 0)

...here, would it make sense to use virCommandRun(cmd, NULL) instead of
checking status ourselves?  If the intent is still to avoid a logged
message when the status is non-zero, a comment in the code might be
useful (for example, see how virStorageBackendQEMUImgBackingFormat in
storage_backend.c has a comment).

ACK with either the code simplification or the added comment.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] xen: ensure /usr/sbin/xend exists before checking status

2014-04-28 Thread Jim Fehlig
Eric Blake wrote:
 On 04/28/2014 12:42 PM, Jim Fehlig wrote:
   
 With xend on the way out, installations may not even have
 /usr/sbin/xend, which results in the following error when the
 drivers are probed

 2014-04-28 18:21:19.271+: 22129: error : virCommandWait:2426 :
 internal error: Child process (/usr/sbin/xend status) unexpected exit
 status 127: libvirt:  error : cannot execute binary /usr/sbin/xend:
 No such file or directory

 Check for existence of /usr/sbin/xend before trying to run it with
 the 'status' option.

 Signed-off-by: Jim Fehlig jfeh...@suse.com
 ---
  src/libxl/libxl_driver.c | 19 ---
  src/xen/xen_driver.c | 13 -
  2 files changed, 20 insertions(+), 12 deletions(-)
 


   
 @@ -256,14 +255,20 @@ libxlDriverShouldLoad(bool privileged)
  }
  
  /* Don't load if legacy xen toolstack (xend) is in use */
 -cmd = virCommandNewArgList(/usr/sbin/xend, status, NULL);
 -if (virCommandRun(cmd, status) == 0  status == 0) {
 -VIR_INFO(Legacy xen tool stack seems to be in use, disabling 
 -  libxenlight driver.);
 +if (virFileExists(/usr/sbin/xend)) {
 +virCommandPtr cmd;
 +
 +cmd = virCommandNewArgList(/usr/sbin/xend, status, NULL);
 +if (virCommandRun(cmd, status) == 0  status == 0) {
 

 Pre-patch, passing status to virCommandRun had the effect of avoiding a
 log message if the command ran with non-zero status.  But now that we
 are requiring the file to exist, and in particular, since we are already
 using NULL later on...

   
 +++ b/src/xen/xen_driver.c
 @@ -315,13 +315,16 @@ xenUnifiedProbe(void)
  static bool
  xenUnifiedXendProbe(void)
  {
 -virCommandPtr cmd;
  bool ret = false;
  
 -cmd = virCommandNewArgList(/usr/sbin/xend, status, NULL);
 -if (virCommandRun(cmd, NULL) == 0)
 -ret = true;
 -virCommandFree(cmd);
 +if (virFileExists(/usr/sbin/xend)) {
 +virCommandPtr cmd;
 +
 +cmd = virCommandNewArgList(/usr/sbin/xend, status, NULL);
 +if (virCommandRun(cmd, NULL) == 0)
 

 ...here, would it make sense to use virCommandRun(cmd, NULL) instead of
 checking status ourselves?

Yes, I think so.  No harm in a log message from virCommandRun on
non-zero exit.

   If the intent is still to avoid a logged
 message when the status is non-zero, a comment in the code might be
 useful (for example, see how virStorageBackendQEMUImgBackingFormat in
 storage_backend.c has a comment).

 ACK with either the code simplification or the added comment.
   

Code simplified and pushed.  Thanks for the review.

Regards,
Jim

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


Re: [libvirt] [PATCHv2 0/7] saner readdir usage

2014-04-28 Thread Eric Blake
On 04/28/2014 03:23 AM, Ján Tomko wrote:
 On 04/26/2014 06:14 AM, Eric Blake wrote:
 This extends the work started by Nataneal to cover the entire
 tree.  Basically, readdir() is awkward to use correctly: to
 properly check for (unlikely) errors, one must pre-set errno.
 Forcing everything to go through a wrapper ensures that all
 our uses will be consistent; this also fixes several bugs
 in some of the call sites.

 Eric Blake (5):
   conf: use virDirRead API
   util: use virDirRead API
   drivers: use virDirRead API
   storage: use virDirRead API
   enforce sane readdir usage

 Natanael Copa (2):
   util: introduce virDirRead wrapper for readdir
   nodeinfo: use virDirRead API


 
 ACK series if you conver the newly addded readdir call as well:
 src/network/bridge_driver.c:487:entry = readdir(dir);
 maint.mk: use virDirRead, not readdir
 make: *** [sc_prohibit_readdir] Error 1

I've pushed the series, including Laine's addition.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 1/2] virsh: Replace list element to defined variable

2014-04-28 Thread Li Yang
Signed-off-by: Li Yang liyang.f...@cn.fujitsu.com
---
 tools/virsh-secret.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c
index 47974fe..e996c72 100644
--- a/tools/virsh-secret.c
+++ b/tools/virsh-secret.c
@@ -558,7 +558,7 @@ cmdSecretList(vshControl *ctl, const vshCmd *cmd 
ATTRIBUTE_UNUSED)
 const char *usageStr = virSecretUsageTypeTypeToString(usageType);
 char uuid[VIR_UUID_STRING_BUFLEN];
 
-if (virSecretGetUUIDString(list-secrets[i], uuid)  0) {
+if (virSecretGetUUIDString(sec, uuid)  0) {
 vshError(ctl, %s, _(Failed to get uuid of secret));
 goto cleanup;
 }
-- 
1.7.1

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


[libvirt] [PATCH 2/2] datatypes: Fix comment of secret uuid

2014-04-28 Thread Li Yang
Signed-off-by: Li Yang liyang.f...@cn.fujitsu.com
---
 src/datatypes.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/datatypes.h b/src/datatypes.h
index 9621c55..3bc2420 100644
--- a/src/datatypes.h
+++ b/src/datatypes.h
@@ -469,7 +469,7 @@ struct _virNodeDevice {
 struct _virSecret {
 virObject object;
 virConnectPtr conn;  /* pointer back to the connection */
-unsigned char uuid[VIR_UUID_BUFLEN]; /* the domain unique identifier */
+unsigned char uuid[VIR_UUID_BUFLEN]; /* the secret unique identifier */
 int usageType;   /* the type of usage */
 char *usageID;   /* the usage's unique identifier */
 };
-- 
1.7.1

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


Re: [libvirt] [PATCH] docs: update docs for setting the QEMU BIOS file path

2014-04-28 Thread chenhanx...@cn.fujitsu.com


 -Original Message-
 From: Nehal J Wani [mailto:nehaljw.k...@gmail.com]
 Sent: Monday, April 28, 2014 1:07 PM
 To: Chen, Hanxiao/陈 晗霄
 Cc: libvir-list
 Subject: Re: [libvirt] [PATCH] docs: update docs for setting the QEMU BIOS 
 file
 path
 
 ddThe optional codeloader/code tag refers to a firmware blob
   used to assist the domain creation process. At this time, it is
   only needed by Xen fully virtualized
 
 Is the sentence only needed by Xen fully virtualized valid even now?

I'm not familiar with XEN...

Anyone can help?

Thanks,
- Chen

 For example, the support for UEFI firmware has also been introduced,
 which can be easily used by extracting bios.bin from
 http://download.opensuse.org/repositories/home:/jejb1:/UEFI/openSUSE_12.2
 /x86_64/OVMF-0.1+r14742-1.1.x86_64.rpm
 and passing  its path under the loader option.
 
 --
 Nehal J Wani

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

[libvirt] [PATCH] storage_backend_rbd: Correct argument order to rbd_create3

2014-04-28 Thread Steven McDonald
The stripe_unit and stripe_count arguments are passed to rbd_create3 in
the wrong order, resulting in a stripe size of 1 byte with 4194304
stripes on newly created RBD volumes.

https://bugzilla.redhat.com/show_bug.cgi?id=1092208
Signed-off-by: Steven McDonald steven.mcdon...@anchor.net.au
---
 src/storage/storage_backend_rbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/storage/storage_backend_rbd.c 
b/src/storage/storage_backend_rbd.c
index 029d2f0..5d4ef79 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -492,7 +492,7 @@ static int virStorageBackendRBDCreateImage(rados_ioctx_t io,
 uint64_t stripe_unit = 4194304;
 
 if (rbd_create3(io, name, capacity, features, order,
-stripe_count, stripe_unit)  0) {
+stripe_unit, stripe_count)  0) {
 #else
 if (rbd_create(io, name, capacity, order)  0) {
 #endif
-- 
2.0.0.rc0

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


[libvirt] [PATCH 0/2] virstoragefile cleanups

2014-04-28 Thread Eric Blake
I found these cleanups while trying to solve the regression
that John identified, where we are losing the correct
capacity read from a qcow2 header when it comes time to
dump a volume's xml.  I still plan to get that regression
fixed before 1.2.4 goes out the door, but this was worth
posting in the meantime.

Eric Blake (2):
  conf: avoid null deref during storage probe
  conf: drop extra storage probe

 src/libvirt_private.syms  |  1 -
 src/storage/storage_backend_fs.c  |  8 
 src/storage/storage_backend_gluster.c |  5 -
 src/util/virstoragefile.c | 37 ---
 src/util/virstoragefile.h |  7 ++-
 5 files changed, 19 insertions(+), 39 deletions(-)

-- 
1.9.0

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


[libvirt] [PATCH 2/2] conf: drop extra storage probe

2014-04-28 Thread Eric Blake
All callers of virStorageFileGetMetadataFromBuf were first calling
virStorageFileProbeFormatFromBuf, to learn what format to pass in.
But this function is already wired to do the exact same probe if
the incoming format is VIR_STORAGE_FILE_AUTO, so it's simpler to
just refactor the probing into the central function.

* src/util/virstoragefile.h (virStorageFileGetMetadataFromBuf):
Drop parameter.
(virStorageFileProbeFormatFromBuf): Drop declaration.
* src/util/virstoragefile.c (virStorageFileGetMetadataFromBuf):
Do probe here instead of in callers.
(virStorageFileProbeFormatFromBuf): Make static.
* src/libvirt_private.syms (virstoragefile.h): Drop function.
* src/storage/storage_backend_fs.c (virStorageBackendProbeTarget):
Update caller.
* src/storage/storage_backend_gluster.c
(virStorageBackendGlusterRefreshVol): Likewise.

Signed-off-by: Eric Blake ebl...@redhat.com
---
 src/libvirt_private.syms  |  1 -
 src/storage/storage_backend_fs.c  |  8 
 src/storage/storage_backend_gluster.c |  5 -
 src/util/virstoragefile.c | 17 +++--
 src/util/virstoragefile.h |  7 ++-
 5 files changed, 9 insertions(+), 29 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 8bbe6e7..c95fa73 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1854,7 +1854,6 @@ virStorageFileGetSCSIKey;
 virStorageFileIsClusterFS;
 virStorageFileParseChainIndex;
 virStorageFileProbeFormat;
-virStorageFileProbeFormatFromBuf;
 virStorageFileResize;
 virStorageIsFile;
 virStorageNetHostDefClear;
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 0f98853..f18fafe 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -97,16 +97,8 @@ virStorageBackendProbeTarget(virStorageSourcePtr target,
 goto error;
 }

-target-format = virStorageFileProbeFormatFromBuf(target-path,
-  header, len);
-if (target-format  0) {
-ret = -1;
-goto error;
-}
-
 if (!(meta = virStorageFileGetMetadataFromBuf(target-path,
   header, len,
-  target-format,
   backingStore,
   backingStoreFormat))) {
 ret = -1;
diff --git a/src/storage/storage_backend_gluster.c 
b/src/storage/storage_backend_gluster.c
index 5ab1e7e..20fb63e 100644
--- a/src/storage/storage_backend_gluster.c
+++ b/src/storage/storage_backend_gluster.c
@@ -293,12 +293,7 @@ 
virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state,
 if ((len = virStorageBackendGlusterReadHeader(fd, name, len, header))  0)
 goto cleanup;

-if ((vol-target.format = virStorageFileProbeFormatFromBuf(name,
-   header,
-   len))  0)
-goto cleanup;
 if (!(meta = virStorageFileGetMetadataFromBuf(name, header, len,
-  vol-target.format,
   vol-backingStore.path,
   vol-backingStore.format)))
 goto cleanup;
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index dcce1ef..5dbb6f0 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -713,7 +713,8 @@ virStorageIsFile(const char *backing)
 return true;
 }

-int
+
+static int
 virStorageFileProbeFormatFromBuf(const char *path,
  char *buf,
  size_t buflen)
@@ -971,16 +972,13 @@ virStorageFileMetadataNew(const char *path,
  * @path: name of file, for error messages
  * @buf: header bytes from @path
  * @len: length of @buf
- * @format: expected image format
  * @backing: output malloc'd name of backing image, if any
  * @backingFormat: format of @backing
  *
- * Extract metadata about the storage volume with the specified
- * image format. If image format is VIR_STORAGE_FILE_AUTO, it
- * will probe to automatically identify the format.  Does not recurse.
- *
- * Callers are advised never to use VIR_STORAGE_FILE_AUTO as a
- * format, since a malicious guest can turn a raw file into any
+ * Extract metadata about the storage volume, including probing its
+ * format.  Does not recurse.  Callers are advised not to trust the
+ * learned format if a guest has ever used the volume when it was
+ * raw, since a malicious guest can turn a raw file into any
  * other non-raw format at will.
  *
  * If the returned @backingFormat is VIR_STORAGE_FILE_AUTO
@@ -994,14 +992,13 @@ virStorageSourcePtr
 virStorageFileGetMetadataFromBuf(const char *path,
  

[libvirt] [PATCH 1/2] conf: avoid null deref during storage probe

2014-04-28 Thread Eric Blake
Commit 5c43e2e introduced a NULL deref if there is a failure
in virStorageFileGetMetadataInternal.

* src/util/virstoragefile.c (virStorageFileGetMetadataFromBuf):
Fix error handling.

Signed-off-by: Eric Blake ebl...@redhat.com
---
 src/util/virstoragefile.c | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 1ce0fa1..dcce1ef 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -999,21 +999,21 @@ virStorageFileGetMetadataFromBuf(const char *path,
  int *backingFormat)
 {
 virStorageSourcePtr ret = NULL;
+virStorageSourcePtr meta = NULL;

-if (!(ret = virStorageFileMetadataNew(path, format)))
+if (!(meta = virStorageFileMetadataNew(path, format)))
 return NULL;

-if (virStorageFileGetMetadataInternal(ret, buf, len,
-  backingFormat)  0) {
-virStorageSourceFree(ret);
-ret = NULL;
-}
-
-if (VIR_STRDUP(*backing, ret-backingStoreRaw)  0) {
-virStorageSourceFree(ret);
-ret = NULL;
-}
+if (virStorageFileGetMetadataInternal(meta, buf, len,
+  backingFormat)  0)
+goto cleanup;
+if (VIR_STRDUP(*backing, meta-backingStoreRaw)  0)
+goto cleanup;

+ret = meta;
+meta = NULL;
+ cleanup:
+virStorageSourceFree(meta);
 return ret;
 }

-- 
1.9.0

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


Re: [libvirt] [PATCH] Restore skipping of setting capacity

2014-04-28 Thread Eric Blake
On 04/24/2014 02:11 AM, Daniel P. Berrange wrote:
 On Wed, Apr 23, 2014 at 11:58:44AM -0600, Eric Blake wrote:
 On 04/23/2014 07:28 AM, John Ferlan wrote:
 Commit id 'ac9a0963' refactored out the 'withCapacity' for the
 virStorageBackendUpdateVolInfo() API.  See:

 Fortunately, we haven't released this regression of mine :)


 However, I'm still a bit worried that we are just attacking the
 symptoms, instead of addressing things correctly.  It seems like we
 should be smarter in storage_backend_* to not override a capacity that
 was already set when probing the file metadata.  There's a pretty
 telling comment in virStorageFileGetMetadataInternal:

 /* XXX we should consider moving virStorageBackendUpdateVolInfo
  * code into this method, for non-magic files
  */

 where I think that being a bit smarter about tracing which pieces of
 information are gathered in which order, and then prioritizing them so
 that metadata information takes priority over stat() information, could
 avoid the need to pass an updateCapacity flag through quite so many
 layers of function calls.

After more searching, I've learned that when the storage volume is first
populated, we are getting things right (all volumes went through
virStorageBackendProbeTarget which populated capacity first from the
file system then updated it from the metadata); but later when it is
time for virsh vol-dumpxml, virStorageBackendUpdateVolTargetInfo is
called to refresh the data but does not look at the metadata, thus
overwriting things back to the file size.  If a volume has been resized
by 'virsh vol-resize' in the meantime, neither the original capacity,
nor the the file size capacity are correct - the only correct solution
is to have the backend once again read the metadata.  I'm still trying
to figure out the best way to do that, but posted a couple patches along
the way while still working on the issue.


 We may still go with your patch, but let's wait a day or two to see if I
 can come up with something more elegant...
 
 Can we get a unit test for this disk probing scenario so we can catch
 any future regression too.

The existing tests/virstoragetest.c validated that we are getting
capacity correct when probing; where it failed was that it doesn't test
that the higher level vol-dumpxml refresh uses the information vs.
throwing it away.  Yes, I plan to enhance the testsuite to ensure this
case gets covered.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] storage_backend_rbd: Correct argument order to rbd_create3

2014-04-28 Thread Eric Blake
On 04/28/2014 08:19 PM, Steven McDonald wrote:
 The stripe_unit and stripe_count arguments are passed to rbd_create3 in
 the wrong order, resulting in a stripe size of 1 byte with 4194304
 stripes on newly created RBD volumes.
 
 https://bugzilla.redhat.com/show_bug.cgi?id=1092208
 Signed-off-by: Steven McDonald steven.mcdon...@anchor.net.au
 ---
  src/storage/storage_backend_rbd.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/src/storage/storage_backend_rbd.c 
 b/src/storage/storage_backend_rbd.c
 index 029d2f0..5d4ef79 100644
 --- a/src/storage/storage_backend_rbd.c
 +++ b/src/storage/storage_backend_rbd.c
 @@ -492,7 +492,7 @@ static int virStorageBackendRBDCreateImage(rados_ioctx_t 
 io,
  uint64_t stripe_unit = 4194304;
  
  if (rbd_create3(io, name, capacity, features, order,
 -stripe_count, stripe_unit)  0) {
 +stripe_unit, stripe_count)  0) {

Thanks.  ACK and pushed, and congrats on your first libvirt patch.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] docs: update docs for setting the QEMU BIOS file path

2014-04-28 Thread Jim Fehlig
chenhanx...@cn.fujitsu.com wrote:
   
 -Original Message-
 From: Nehal J Wani [mailto:nehaljw.k...@gmail.com]
 Sent: Monday, April 28, 2014 1:07 PM
 To: Chen, Hanxiao/陈 晗霄
 Cc: libvir-list
 Subject: Re: [libvirt] [PATCH] docs: update docs for setting the QEMU BIOS 
 file
 path

 
ddThe optional codeloader/code tag refers to a firmware blob
  used to assist the domain creation process. At this time, it is
  only needed by Xen fully virtualized
   
 Is the sentence only needed by Xen fully virtualized valid even now?
 

 I'm not familiar with XEN...

 Anyone can help?
   

There is certainly a lot of Xen fully virtualized config with
loader/usr/lib/xen/boot/hvmloader/loader.  But it sounds like your
change makes the only needed by part invalid.  I.e. loader is used
by Xen fully virtualized domains as well as setting the QEMU BIOS file
path for QEMU/KVM domains.

Regards,
Jim

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