libvirt/src/util
zhang bo 25df57db73 util: don't fail if no PortData is found while getting migrateData
Introduced by f6a2f97e

Problem Description:
After multiple times of migrating a domain, which has an ovs interface with no portData set,
with non-shared disk, nbd ports got overflowed.

The steps to reproduce the problem:
1 define and start a domain with its network configured as:
    <interface type='bridge'>
          <source bridge='br0'/>
          <virtualport type='openvswitch'>
          </virtualport>
          <model type='virtio'/>
          <driver name='vhost' queues='4'/>
    </interface>
2 do not set the network's portData.
3 migrate(ToURI2) it with flag 91(1011011), which means:
  VIR_MIGRATE_LIVE
  VIR_MIGRATE_PEER2PEER
  VIR_MIGRATE_PERSIST_DEST
  VIR_MIGRATE_UNDEFINE_SOURCE
  VIR_MIGRATE_NON_SHARED_DISK
4 migrate success, but we got an error log in libvirtd.log:
  error : virCommandWait:2423 : internal error: Child process (ovs-vsctl --timeout=5 get Interface
  vnet1 external_ids:PortData) unexpected exit status 1: ovs-vsctl: no key "PortData" in Interface
  record "vnet1" column external_ids
5 migrate it back, migrate it , migrate it back, .......
6 nbd port got overflowed.

The reasons for the problem is :
1 virNetDevOpenvswitchGetMigrateData() takes it as wrong if no portData is available for  the ovs
 interface of a domain. (We think it's not appropriate, as portData is just OPTIONAL)
2 in func qemuMigrationBakeCookie(), it fails in qemuMigrationCookieAddNetwork(), and returns with -1.
 qemuMigrationCookieAddNBD() is not called thereafter, and mig->nbd is still NULL.
3 However, qemuMigrationRun() just *WARN* if qemuMigrationBakeCookie() fails, migration still successes.
 cookie is NULL, it's not baked on the src side.
4 On the destination side, it would alloc a port first and then free the nbd port in COOKIE.
 But the cookie is NULL due to qemuMigrationCookieAddNetwork() failure at src side. thus the nbd port
 is not freed.

In this patch, we add "--if-exists" option to make ovs-vsctl not raise error if there's no portData available.
Further more, because portData may be NULL in the cookie at the dest side, check it before setting portData.

Signed-off-by: Zhou Yimin <zhouyimin@huawei.com>
Signed-off-by: Zhang Bo <oscar.zhangbo@huawei.com>
2015-03-13 22:43:08 -04:00
..
iohelper.c Indent top-level labels by one space in src/util/ 2014-03-25 14:58:40 +01:00
keymaps.csv
viralloc.c maint: avoid static zero init in core files 2014-10-29 09:55:09 -06:00
viralloc.h util: forbid freeing const pointers 2014-07-16 06:48:53 -06:00
virarch.c Add virLogSource variables to all source files 2014-03-18 14:29:22 +00:00
virarch.h Cpu: Add support for Power LE Architecture. 2014-11-07 09:16:37 +01:00
viratomic.c Change file names in comments to match the files they are in 2014-03-10 14:26:04 +01:00
viratomic.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
viraudit.c audit: use bool for audit log choice 2014-10-29 09:55:09 -06:00
viraudit.h audit: use bool for audit log choice 2014-10-29 09:55:09 -06:00
virauth.c Remove unnecessary curly brackets in src/util/ 2014-11-14 17:13:35 +01:00
virauth.h virAuth: Don't require virConnectPtr to retrieve authentication creds 2013-07-12 09:22:38 +02:00
virauthconfig.c Indent top-level labels by one space in src/util/ 2014-03-25 14:58:40 +01:00
virauthconfig.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
virbitmap.c Introduce virBitmapIsBitSet 2015-03-13 15:31:33 +01:00
virbitmap.h Introduce virBitmapIsBitSet 2015-03-13 15:31:33 +01:00
virbuffer.c util: Introduce virBufferAddBuffer 2015-02-25 09:23:42 +01:00
virbuffer.h util: Introduce virBufferAddBuffer 2015-02-25 09:23:42 +01:00
vircgroup.c Introduce virBitmapIsBitSet 2015-03-13 15:31:33 +01:00
vircgroup.h Add support for systemd-machined CreateMachineWithNetwork 2015-01-15 11:07:07 +00:00
vircgrouppriv.h Track symlinks for co-mounted cgroup controllers 2013-04-15 17:35:32 +01:00
virclosecallbacks.c qemu: completely rework reference counting 2014-12-21 10:48:56 +01:00
virclosecallbacks.h lxc: switch to virCloseCallbacks API 2013-07-18 14:16:54 +02:00
vircommand.c utils: Implement virCommandPassFDGetFDIndex 2015-03-05 18:57:06 -05:00
vircommand.h utils: Implement virCommandPassFDGetFDIndex 2015-03-05 18:57:06 -05:00
vircommandpriv.h Add ability to register callback for virCommand dry run 2014-03-19 10:47:58 +00:00
virconf.c virconf: Resolve a possible memory leak in virConfSetValue 2015-01-12 08:59:55 -05:00
virconf.h virconf: Introduce VIR_CONF_ULONG 2014-12-15 10:34:18 +01:00
vircrypto.c vircrypto: fix Invalid write in virCryptoHashString() 2014-03-12 16:01:30 -06:00
vircrypto.h Add helper APIs for generating cryptographic hashes 2014-03-10 16:39:18 +00:00
virdbus.c systemd: avoid string comparisons on dbus error messages 2015-01-26 09:14:04 +00:00
virdbus.h systemd: avoid string comparisons on dbus error messages 2015-01-26 09:14:04 +00:00
virdbuspriv.h build: fix build when not using dbus 2014-11-20 08:48:19 -07:00
virdnsmasq.c Introduce virBitmapIsBitSet 2015-03-13 15:31:33 +01:00
virdnsmasq.h use client id for IPv6 DHCP host definition 2013-02-25 02:49:06 -05:00
virebtables.c Convert ebtables code over to use firewall APIs 2014-04-25 15:44:09 +01:00
virebtables.h Remove unused ebtablesRemoveForwardPolicyReject method 2014-03-11 11:01:52 +00:00
virendian.h util: add virendian.h macros 2013-02-12 09:00:15 -07:00
virerror.c systemd: fix build without dbus 2015-01-26 09:14:04 +00:00
virerror.h systemd: fix build without dbus 2015-01-26 09:14:04 +00:00
virevent.c maint: avoid static zero init in core files 2014-10-29 09:55:09 -06:00
virevent.h Rename event.{c,h} to virevent.{c,h} 2012-12-21 11:17:13 +00:00
vireventpoll.c Remove unnecessary curly brackets in src/util/ 2014-11-14 17:13:35 +01:00
vireventpoll.h Change file names in comments to match the files they are in 2014-03-10 14:26:04 +01:00
virfile.c Search for schemas and cpu_map.xml in source tree 2015-02-19 15:25:04 +01:00
virfile.h safezero: fall back to writing zeroes even when resizing 2015-01-09 13:48:23 +01:00
virfirewall.c systemd: fix build without dbus 2015-01-26 09:14:04 +00:00
virfirewall.h test: fix nwfilter tests following changes in virfirewall.c 2014-12-22 16:57:21 -05:00
virfirewallpriv.h Introduce an object for managing firewall rulesets 2014-04-25 15:44:09 +01:00
virhash.c hash: add common utility functions 2014-04-07 06:14:45 -06:00
virhash.h hash: add common utility functions 2014-04-07 06:14:45 -06:00
virhashcode.c maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
virhashcode.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
virhook.c virhook: Resolve Coverity NULL_RETURNS 2014-12-01 11:07:31 -05:00
virhook.h qemu: hook: Provide hook when restoring a domain save image 2014-09-22 17:11:56 +02:00
virhostdev.c check IOMMU group devices usage when preparing device for vfio passthrough 2015-01-14 18:01:06 +01:00
virhostdev.h virhostdev.h: remove ATTRIBUTE_NONNULL from oldStateDir 2014-03-19 10:05:31 +01:00
viridentity.c Convert callers to use typesafe APIs for setting identity attrs 2014-09-24 15:29:22 +01:00
viridentity.h Add typesafe APIs for virIdentity attributes 2014-09-24 15:29:22 +01:00
virinitctl.c Add support for /run/initctl 2014-10-22 13:09:49 +01:00
virinitctl.h util: use typedefs for enums in "src/util/" directory 2014-05-05 14:30:01 -06:00
viriptables.c Re-add use of locking with iptables/ip6tables/ebtables 2014-11-14 15:15:16 +00:00
viriptables.h Convert bridge driver over to use new firewall APIs 2014-04-25 15:44:09 +01:00
viriscsi.c viriscsi: Need to sendtargets on Initiator IQN 2014-12-10 06:58:37 -05:00
viriscsi.h util: Sanitize ATTRIBUTE_NONNULL use in viriscsi.h 2014-03-25 08:26:39 +01:00
virjson.c util: json: add helper to iterate JSON object key=value pairs 2015-01-31 08:53:21 +01:00
virjson.h util: json: add helper to iterate JSON object key=value pairs 2015-01-31 08:53:21 +01:00
virkeycode-mapgen.py virkeycode: Allow ANSI_A 2013-12-24 17:36:47 +01:00
virkeycode.c virkeycode: Allow ANSI_A 2013-12-24 17:36:47 +01:00
virkeycode.h cleanup: Don't include libvirt/libvirt.h 2013-04-17 15:50:53 +08:00
virkeyfile.c hash: add common utility functions 2014-04-07 06:14:45 -06:00
virkeyfile.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
virkmod.c Indent top-level labels by one space in src/util/ 2014-03-25 14:58:40 +01:00
virkmod.h utils: Introduce functions for kernel module manipulation 2014-02-04 08:52:27 -05:00
virlockspace.c Remove unnecessary curly brackets in src/util/ 2014-11-14 17:13:35 +01:00
virlockspace.h Rename json.{c,h} to virjson.{c,h} 2012-12-21 11:17:13 +00:00
virlog.c qemu: include libvirt & QEMU versions in QEMU log files 2015-02-06 10:22:07 +00:00
virlog.h qemu: include libvirt & QEMU versions in QEMU log files 2015-02-06 10:22:07 +00:00
virmacaddr.c util: Functions to update host network device's multicast filter 2014-10-28 14:14:25 -04:00
virmacaddr.h util: Functions to update host network device's multicast filter 2014-10-28 14:14:25 -04:00
virnetdev.c virnetdev: fix build with old kernel 2015-03-12 17:48:02 +01:00
virnetdev.h Fix build on mingw 2015-03-05 12:04:11 +01:00
virnetdevbandwidth.c util: check for null ifname inside virNetDevBandwidthSet() 2015-02-25 13:10:34 -05:00
virnetdevbandwidth.h util: check for null ifname inside virNetDevBandwidthSet() 2015-02-25 13:10:34 -05:00
virnetdevbridge.c define NTF_{SELF,MASTER} if undefined 2014-12-09 19:14:57 +01:00
virnetdevbridge.h util: functions to manage bridge fdb (forwarding database) 2014-12-08 14:39:12 -05:00
virnetdevmacvlan.c Fix syntax-check 2015-01-29 14:39:12 +01:00
virnetdevmacvlan.h network: Bring netdevs online later 2014-12-10 15:09:01 -05:00
virnetdevopenvswitch.c util: don't fail if no PortData is found while getting migrateData 2015-03-13 22:43:08 -04:00
virnetdevopenvswitch.h maint: avoid 'const fooPtr' in virnet files 2013-10-14 13:05:34 -06:00
virnetdevtap.c Change int to size_t in size var for tap/vhost FDs 2015-01-15 11:07:13 +00:00
virnetdevtap.h Change int to size_t in size var for tap/vhost FDs 2015-01-15 11:07:13 +00:00
virnetdevveth.c Revert "ip link needs 'name' in 3.16 to create the veth pair" 2014-11-27 11:17:56 +01:00
virnetdevveth.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
virnetdevvlan.c maint: avoid 'const fooPtr' in virnet files 2013-10-14 13:05:34 -06:00
virnetdevvlan.h maint: avoid 'const fooPtr' in virnet files 2013-10-14 13:05:34 -06:00
virnetdevvportprofile.c util: eliminate "use after free" in callers of virNetDevLinkDump 2014-10-26 12:23:23 -04:00
virnetdevvportprofile.h util: use typedefs for enums in "src/util/" directory 2014-05-05 14:30:01 -06:00
virnetlink.c virnetlink: fix build on non-Linux 2015-01-05 16:38:25 -07:00
virnetlink.h virNetDevSetIPv4Address: libnl implementation 2015-01-05 20:24:03 +01:00
virnodesuspend.c build: Don't use code with dbus_message_unref when built without dbus 2014-04-14 18:19:36 +02:00
virnodesuspend.h Separate internal node suspend APIs from public API 2013-05-08 10:47:47 +01:00
virnuma.c Make tests independant of system page size 2015-02-02 20:27:43 +00:00
virnuma.h util: Add virNumaGetHostNodeset 2014-12-16 11:15:27 +01:00
virobject.c Fix usage of virReportSystemError 2014-11-28 09:42:13 +01:00
virobject.h hash: add common utility functions 2014-04-07 06:14:45 -06:00
virpci.c virpci: Implement virPCIDeviceGetAddress function 2015-01-14 18:01:06 +01:00
virpci.h virpci: Implement virPCIDeviceGetAddress function 2015-01-14 18:01:06 +01:00
virpidfile.c util: fix releasing pidfile in cleanup 2014-11-04 12:06:38 +01:00
virpidfile.h util: Introduce virPidFileForceCleanupPath 2014-11-03 16:43:23 +01:00
virpolkit.c virdbus: don't force users to pass int for bool values 2014-11-19 08:20:39 -07:00
virpolkit.h Add common API for doing polkit authentication 2014-09-24 15:29:22 +01:00
virportallocator.c Introduce virBitmapIsBitSet 2015-03-13 15:31:33 +01:00
virportallocator.h util: Allow port allocator to skip bind() check 2014-09-11 15:40:14 -06:00
virprobe.h Log dtrace/systemd probes at INFO level instead of DEBUG 2015-01-15 11:07:13 +00:00
virprocess.c Introduce virBitmapIsBitSet 2015-03-13 15:31:33 +01:00
virprocess.h util: Add virProcessSetScheduler() function for scheduler settings 2015-02-11 17:30:06 +01:00
virrandom.c Use a static initializer for static mutexes 2014-04-08 13:46:29 +01:00
virrandom.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
virscsi.c Do not call closedir with NULL argument 2014-06-23 14:16:23 +02:00
virscsi.h add 'driver' info to used_by 2014-03-04 12:24:13 +00:00
virseclabel.c virseclabel: Resolve Coverity FORWARD_NULL issue 2014-07-14 05:44:20 -04:00
virseclabel.h virSecurityDeviceLabelDef: substitute 'norelabel' with 'relabel' 2014-07-11 10:36:02 +02:00
virsexpr.c Remove unnecessary curly brackets in src/util/ 2014-11-14 17:13:35 +01:00
virsexpr.h Rename sexpr.{c,h} to virsexpr.{c,h} 2012-12-21 11:19:48 +00:00
virsocketaddr.c Coverity fix: properly check for 0 ipv6 address. 2015-01-16 17:28:14 +01:00
virsocketaddr.h Domain network devices can now have a <route> element 2015-01-05 20:24:17 +01:00
virstats.c maint: clean up _virDomainInterfaceStats 2014-09-17 11:28:48 -06:00
virstats.h maint: clean up _virDomainInterfaceStats 2014-09-17 11:28:48 -06:00
virstorageencryption.c Remove unnecessary curly brackets in src/util/ 2014-11-14 17:13:35 +01:00
virstorageencryption.h storage: encryption: Add deep copy function for storage encryption 2014-06-20 09:14:46 +02:00
virstoragefile.c util: storage: Fix error type in virStorageSourceParseBackingURI 2015-02-26 11:50:38 +01:00
virstoragefile.h qemu: let blockinfo reuse virStorageSource 2014-12-16 16:05:47 -07:00
virstring.c util: string: Add helper to check whether string is empty 2014-10-22 17:51:18 +02:00
virstring.h util: string: Add helper to check whether string is empty 2014-10-22 17:51:18 +02:00
virsysinfo.c Buffer size too small when reading sysinfo 2014-12-17 17:00:58 -07:00
virsysinfo.h util: use typedefs for enums in "src/util/" directory 2014-05-05 14:30:01 -06:00
virsystemd.c systemd: don't report an error if the guest is already terminated 2015-01-27 13:57:02 +00:00
virsystemd.h Add support for systemd-machined CreateMachineWithNetwork 2015-01-15 11:07:07 +00:00
virthread.c Indent top-level labels by one space in src/util/ 2014-03-25 14:58:40 +01:00
virthread.h maint: avoid static zero init in core files 2014-10-29 09:55:09 -06:00
virthreadpool.c Remove unnecessary curly brackets in src/util/ 2014-11-14 17:13:35 +01:00
virthreadpool.h Rename threadpool.{c,h} to virthreadpool.{c,h} 2012-12-21 11:19:48 +00:00
virtime.c Renamed internal __mon_yday into mon_yday to avoid conflicts 2014-10-28 14:44:18 -06:00
virtime.h util: virTimeFieldsThenRaw never returns negative 2014-07-25 12:06:07 +02:00
virtpm.c Indent top-level labels by one space in src/util/ 2014-03-25 14:58:40 +01:00
virtpm.h Helper functions for host TPM support 2013-04-12 16:55:45 -04:00
virtypedparam.c maint: use hanging curly braces 2014-09-04 15:18:43 -06:00
virtypedparam.h Introduce virTypedParamsCopy internal API 2013-06-25 00:38:25 +02:00
viruri.c Introduce virStringStripIPv6Brackets 2014-10-15 09:25:33 +02:00
viruri.h Fix crash accessing a NULL URI when looking up auth credentials 2012-09-21 10:13:53 +01:00
virusb.c usb: Remove redundant comment 2014-07-03 10:41:15 +02:00
virusb.h add 'driver' info to used_by 2014-03-04 12:24:13 +00:00
virutil.c memtune: change the way how we store unlimited value 2015-03-06 11:52:24 +01:00
virutil.h memtune: change the way how we store unlimited value 2015-03-06 11:52:24 +01:00
viruuid.c Use K&R style for curly braces in src/util/ 2014-03-20 17:16:18 +01:00
viruuid.h maint: improve debug of libvirt-{qemu,lxc} apis 2014-01-02 22:17:11 -07:00
virxml.c Add virXMLValidateAgainstSchema helper method 2015-01-15 14:02:50 +00:00
virxml.h Add virXMLValidateAgainstSchema helper method 2015-01-15 14:02:50 +00:00