13050 Commits

Author SHA1 Message Date
Ján Tomko
a717d7ba0f qemu: check if block I/O limits fit into long long
We can only pass values up to LLONG_MAX through JSON
and QEMU checks if the int64_t number is not negative
at startup since 1.5.0.

https://bugzilla.redhat.com/show_bug.cgi?id=974010
(cherry picked from commit d3c87884927e6b745d0a5680e6d94a40c4f484f7)
2013-07-11 17:48:44 -04:00
Laine Stump
22d9d9a28f network: increase max number of routes
This fixes the problem reported in:

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

When checking for a collision of a new libvirt network's subnet with
any existing routes, we read all of /proc/net/route into memory, then
parse all the entries. The function that we use to read this file
requires a "maximum length" parameter, which had previously been set
to 64*1024. As each line in /proc/net/route is 128 bytes, this would
allow for a maximum of 512 entries in the routing table.

This patch increases that number to 128 * 100000, which allows for
100,000 routing table entries. This means that it's possible that 12MB
would be allocated, but that would only happen if there really were
100,000 route table entries on the system, it's only held for a very
short time.

Since there is no method of specifying and unlimited max (and that
would create a potential denial of service anyway) hopefully this
limit is large enough to accomodate everyone.

(cherry picked from commit 2bdf548f5f0f709c9dec8ba1872e4fcaf8c25fbf)
2013-07-11 17:47:58 -04:00
Ján Tomko
0943603d9e qemu: allow restore with non-migratable XML input
Convert input XML to migratable before using it in
qemuDomainSaveImageOpen.

XML in the save image is migratable, i.e. doesn't contain implicit
controllers. If these controllers were in a non-default order in the
input XML, the ABI check would fail. Removing and re-adding these
controllers fixes it.

https://bugzilla.redhat.com/show_bug.cgi?id=834196
(cherry picked from commit 07966f6a8b5ccb5bb4c716b25deb8ba2e572cc67)
2013-07-11 17:47:39 -04:00
Michal Privoznik
ca305a756d qemu_migrate: Dispose listen address if set from config
https://bugzilla.redhat.com/show_bug.cgi?id=971485

As of d7f9d827531bc843b7c5aa9d3e8c08738a1de248 we copy the listen
address from the qemu.conf config file in case none has been provided
via XML. But later, when migrating, we should not include such listen
address in the migratable XML as it is something autogenerated, not
requested by user. Moreover, the binding to the listen address will
likely fail, unless the address is '0.0.0.0' or its IPv6 equivalent.
This patch introduces a new boolean attribute to virDomainGraphicsListenDef
to distinguish autofilled listen addresses. However, we must keep the
attribute over libvirtd restarts, so it must be kept within status XML.

(cherry picked from commit 6546017c50c104d0b9867137b64ab1f4a312e436)
2013-07-11 17:47:18 -04:00
Ján Tomko
3b6bc5eda6 iscsi: pass hostnames to iscsiadm instead of resolving them
iscsiadm now supports specifying hostnames in the portal argument [1]

Instead of resolving the hostname to a single IPv4 address, pass the
hostname to isciadm, allowing IPv6 targets to work.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=624437

(cherry picked from commit cbdb3c7326f7298d57233d835a5966df2e359d99)
2013-07-11 17:46:53 -04:00
Osier Yang
818a933141 qemu: Report the offset from host UTC for RTC_CHANGE event
https://bugzilla.redhat.com/show_bug.cgi?id=964177

Though both libvirt and QEMU's document say RTC_CHANGE returns
the offset from the host UTC, qemu actually returns the offset
from the specified date instead when specific date is provided
(-rtc base=$date).

It's not safe for qemu to fix it in code, it worked like that
for 3 years, changing it now may break other QEMU use cases.
What qemu tries to do is to fix the document:

http://lists.gnu.org/archive/html/qemu-devel/2013-05/msg04782.html

And in libvirt side, instead of replying on the value from qemu,
this converts the offset returned from qemu to the offset from
host UTC, by:

  /*
   * a: the offset from qemu RTC_CHANGE event
   * b: The specified date (-rtc base=$date)
   * c: the host date when libvirt gets the RTC_CHANGE event
   * offset: What libvirt will report
   */

  offset = a + (b - c);

The specified date (-rtc base=$date) is recorded in clock's def as
an internal only member (may be useful to exposed outside?).

Internal only XML tag "basetime" is introduced to not lose the
guest's basetime after libvirt restarting/reloading:

<clock offset='variable' adjustment='304' basis='utc' basetime='1370423588'/>

(cherry picked from commit e31b5cf393857a6ca78d148c19393e28dfb39de1)
2013-07-11 17:46:45 -04:00
Peter Krempa
44758cea54 storage: Provide better error message if metadata pre-alloc is unsupported
Instead of a unknown flag error report that metadata pre-allocation is
not supported with the requested volume creation method.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=969982
(cherry picked from commit 77e7f69c3b88ae0a7364fa88334a483a247d7200)
2013-07-11 17:46:32 -04:00
Martin Kletzander
ffe68a85c9 usb: don't spoil decimal addresses
For USB devices, dev->name gets formated as %.3o:%.3o even though the
numbers are decimal.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=967712
(cherry picked from commit dc0c7915697a902d6edc5820f5930653b7684c3c)
2013-07-11 17:45:55 -04:00
John Ferlan
e01eedf9bf Check for existence of interface prior to setting terminate flag
https://bugzilla.redhat.com/show_bug.cgi?id=903480

During domain destruction it's possible that the learnIPAddressThread has
already removed the interface prior to the teardown filter path being run.
The teardown code would only be telling the thread to terminate.

(cherry picked from commit 64919d978e4cc910a4475f77c0f04b866051935d)
2013-07-11 17:45:32 -04:00
Peter Krempa
b14ced3932 qemu: snapshot: Don't kill access to disk if snapshot creation fails
If snapshot creation failed for example due to invalid use of the
"REUSE_EXTERNAL" flag, libvirt killed access to the original image file
instead of the new image file. On machines with selinux this kills the
whole VM as the selinux context is enforced immediately.

* qemu_driver.c:qemuDomainSnapshotUndoSingleDiskActive():
    - Kill access to the new image file instead of the old one.

Partially resolves: https://bugzilla.redhat.com/show_bug.cgi?id=906639

(cherry picked from commit 177046753fa427609f217c319dba6fa465a4add4)
2013-07-11 17:45:22 -04:00
Martin Kletzander
b2c2dd60f1 Fix blkdeviotune for shutoff domain
Function qemuDomainSetBlockIoTune() was checking QEMU capabilities
even when !(flags & VIR_DOMAIN_AFFECT_LIVE) and the domain was
shutoff, resulting in the following problem:

 virsh # domstate asdf; blkdeviotune asdf vda --write-bytes-sec 100
 shut off

 error: Unable to change block I/O throttle
 error: unsupported configuration: block I/O throttling not supported with this QEMU binary

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=965016
(cherry picked from commit 5af3ce827767707097affc5e001eab8cbabc28a7)
2013-07-11 17:45:08 -04:00
Daniel P. Berrange
1a6333f842 Ensure non-root can read /proc/meminfo file in LXC containers
By default files in a FUSE mount can only be accessed by the
user which created them, even if the file permissions would
otherwise allow it. To allow other users to access the FUSE
mount the 'allow_other' mount option must be used. This bug
prevented non-root users in an LXC container from reading
the /proc/meminfo file.

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

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit 922ebe4ead4a30a6a94731d31b980d0eae113894)
2013-07-11 17:42:26 -04:00
Richard Weinberger
17cdc298ac LXC: Create /dev/tty within a container
Many applications use /dev/tty to read from stdin.
e.g. zypper on openSUSE.

Let's create this device node to unbreak those applications.
As /dev/tty is a synonym for the current controlling terminal
it cannot harm the host or any other containers.

Signed-off-by: Richard Weinberger <richard@nod.at>
(cherry picked from commit 9a0ac6d9c21b914f887d2a1e0051b5beffa81bd7)

Conflicts:
	src/lxc/lxc_controller.c
2013-07-11 17:38:47 -04:00
Peter Krempa
6cdff51fb3 qemu: Implement new QMP command for cpu hotplug
This patch implements support for the "cpu-add" QMP command that plugs
CPUs into a live guest. The "cpu-add" command was introduced in QEMU
1.5. For the hotplug to work machine type "pc-i440fx-1.5" is required.

(cherry picked from commit c12b2be5169298708cf727ed9ccd42e9d89a9737)
2013-07-11 17:29:48 -04:00
Ján Tomko
ad02b24871 udev: fix crash in libudev logging
Call virLogVMessage instead of virLogMessage, since libudev
called us with a va_list object, not a list of arguments.

Honor message priority and strip the trailing newline.

https://bugzilla.redhat.com/show_bug.cgi?id=969152
(cherry picked from commit f753dd62f951cc62e164421d0c6491f39e4c68ad)
2013-07-11 17:29:33 -04:00
Daniel P. Berrange
647156870e Don't mount selinux fs in LXC if selinux is disabled
Before trying to mount the selinux filesystem in a container
use is_selinux_enabled() to check if the machine actually
has selinux support (eg not booted with selinux=0)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit 95c6cc344bec8405636d2a59fc0c34e0581001ab)
2013-07-11 10:52:04 -06:00
Daniel P. Berrange
269dfa0e08 Re-add selinux/selinux.h to lxc_container.c
Re-add the selinux header to lxc_container.c since other
functions now use it, beyond the patch that was just
reverted.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit 63ea1e5432b27861c116988336b688bbfae03048)
2013-07-11 10:51:32 -06:00
Daniel P. Berrange
0616172bdf Fix failure to detect missing cgroup partitions
Change bbe97ae968eba60b71e0066d49f9fc909966d9d6 caused the
QEMU driver to ignore ENOENT errors from cgroups, in order
to cope with missing /proc/cgroups. This is not good though
because many other things can cause ENOENT and should not
be ignored. The callers expect to see ENXIO when cgroups
are not present, so adjust the code to report that errno
when /proc/cgroups is missing

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit c2cf5f1c2abc81d607abe34bf5dc4c615a9b8b4d)
2013-07-11 10:39:45 -06:00
Jim Fehlig
68d92eea16 Fix starting domains when kernel has no cgroups support
Found that I was unable to start existing domains after updating
to a kernel with no cgroups support

  # zgrep CGROUP /proc/config.gz
  # CONFIG_CGROUPS is not set
  # virsh start test
  error: Failed to start domain test
  error: Unable to initialize /machine cgroup: Cannot allocate memory

virCgroupPartitionNeedsEscaping() correctly returns errno (ENOENT) when
attempting to open /proc/cgroups on such a system, but it was being
dropped in virCgroupSetPartitionSuffix().

Change virCgroupSetPartitionSuffix() to propagate errors returned by
its callees.  Also check for ENOENT in qemuInitCgroup() when determining
if cgroups support is available.
(cherry picked from commit bbe97ae968eba60b71e0066d49f9fc909966d9d6)
2013-07-11 10:38:45 -06:00
Daniel P. Berrange
e0dd41e564 Escaping leading '.' in cgroup names
Escaping a leading '.' with '_' in the cgroup names

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit 0ced83dcfbb19af1201202e1af0a7073c338aabd)
2013-07-11 10:37:49 -06:00
Daniel P. Berrange
fdaa5c825c Add docs about cgroups layout and usage
Describe the new cgroups layout, how to customize placement
of guests and what virsh commands are used to access the
parameters.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit 486a86eb184c008c5957fb68c63f163289f3344b)
2013-07-11 10:37:09 -06:00
Daniel P. Berrange
4769d2ae9f Cope with missing swap cgroup controls
It is possible to build a kernel without swap cgroup controls
present. This causes a fatal error when querying memory
parameters. Treat missing swap controls as meaning "unlimited".
The fatal error remains if the user tries to actually change
the limit.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit f493d83fbd3257453e63f2f32ee90a216fd531c1)
2013-07-11 10:36:17 -06:00
Jim Fehlig
8c4faa9044 libxl: fix build with Xen4.3
Xen 4.3 fixes a mistake in the libxl event handler signature where the
event owned by the application was defined as const.  Detect this and
define the libvirt libxl event handler signature appropriately.
(cherry picked from commit 43b0ff5b1eb7fbcdc348b2a53088a7db939d5e48)
2013-07-11 10:27:35 -06:00
Ján Tomko
233a616bda qemu: fix return value of qemuDomainBlockPivot on errors
If qemuMonitorBlockJob returned 0, qemuDomainBlockPivot
might return 0 even if an error occured.

https://bugzilla.redhat.com/show_bug.cgi?id=977678
(cherry picked from commit c34107dfd3a25232255e6d6f559b1306ef99bb3b)
2013-07-11 14:34:16 +02:00
Ján Tomko
14ce155a3a storage: return -1 when fs pool can't be mounted
Don't reuse the return value of virStorageBackendFileSystemIsMounted.
If it's 0, we'd return it even if the mount command failed.

Also, don't report another error if it's -1, since one has already
been reported.

Introduced by 258e06c.

https://bugzilla.redhat.com/show_bug.cgi?id=981251
(cherry picked from commit 13fde7ceab556804dc6cfb3e56938fb948ffe83d)
2013-07-11 14:33:44 +02:00
Dennis Chen
4d21d84532 Fix vPort management: FC vHBA creation
When creating a virtual FC HBA with virsh/libvirt API, an error message
will be returned: "error: Node device not found",
also the 'nodedev-dumpxml' shows wrong information of wwpn & wwnn
for the new created device.

Signed-off-by: xschen@tnsoft.com.cn

This reverts f90af69 which switched wwpn & wwwn in the wrong place.

https://www.kernel.org/doc/Documentation/scsi/scsi_fc_transport.txt
(cherry picked from commit 3c0d5e224c71cd85b123cd938eeb360502503cb0)
2013-07-01 11:54:22 +02:00
Ján Tomko
0347e778ca bridge: don't crash on bandwidth unplug with no bandwidth
If networkUnplugBandwidth is called on a network which has
no bandwidth defined, print a warning instead of crashing.

This can happen when destroying a domain with bandwidth if
bandwidth was removed from the network after the domain was
started.

https://bugzilla.redhat.com/show_bug.cgi?id=975359
(cherry picked from commit 658c932ab4aec2222b0ce3840a96748e73b39b3f)
2013-07-01 11:54:11 +02:00
Ján Tomko
1b4cd1e5f0 Fix invalid read in virCgroupGetValueStr
Don't check for '\n' at the end of file if zero bytes were read.

Found by valgrind:
==404== Invalid read of size 1
==404==    at 0x529B09F: virCgroupGetValueStr (vircgroup.c:540)
==404==    by 0x529AF64: virCgroupMoveTask (vircgroup.c:1079)
==404==    by 0x1EB475: qemuSetupCgroupForEmulator (qemu_cgroup.c:1061)
==404==    by 0x1D9489: qemuProcessStart (qemu_process.c:3801)
==404==    by 0x18557E: qemuDomainObjStart (qemu_driver.c:5787)
==404==    by 0x190FA4: qemuDomainCreateWithFlags (qemu_driver.c:5839)

Introduced by 0d0b409.

https://bugzilla.redhat.com/show_bug.cgi?id=978356
(cherry picked from commit 306c49ffd56a1c72b1892d50f2a75531c62f4a1d)
2013-06-26 17:31:28 +02:00
Ján Tomko
c93aef4946 virsh: edit: don't leak XML string on reedit or redefine
Free the old XML strings before overwriting them if the user
has chosen to reedit the file or force the redefinition.

Found by Alex Jia trying to reproduce another bug:
https://bugzilla.redhat.com/show_bug.cgi?id=977430#c3
(cherry picked from commit 1e3a252974c8e5c650f1d84dc2b167f0ae8cee3c)
2013-06-26 17:31:16 +02:00
John Ferlan
f1e454457d lxc: Resolve issue with GetScheduler APIs for non running domain
Cherry-picked from 38ada092d1ad5f27a24e511173308d568b6b085f

As a consequence of the cgroup layout changes from commit 'cfed9ad4', the
lxcDomainGetSchedulerParameters[Flags]()' and lxcGetSchedulerType() APIs
failed to return data for a non running domain.  This can be seen through
a 'virsh schedinfo <domain>' command which returns:

Scheduler      : Unknown
error: Requested operation is not valid: cgroup CPU controller is not mounted

Prior to that change a non running domain would return:

Scheduler      : posix
cpu_shares     : 0
vcpu_period    : 0
vcpu_quota     : 0
emulator_period: 0
emulator_quota : 0

This patch will restore the capability to return configuration only data
for a non running domain regardless of whether cgroups are available.

NOTE: Needed to change the VIR_STRDUP(ret, "posix"); to ret = strdup("posix");
      and added the virReportOOMError(); on failure.
2013-06-20 09:38:51 -04:00
John Ferlan
f1729409fb qemu: Resolve issue with GetScheduler APIs for non running domain
Cherry-picked from b23754534193fb7a1e31306d94ae5f09759a0aa4

As a consequence of the cgroup layout changes from commit '632f78ca', the
qemuDomainGetSchedulerParameters[Flags]()' and qemuGetSchedulerType() APIs
failed to return data for a non running domain.  This can be seen through
a 'virsh schedinfo <domain>' command which returns:

Scheduler      : Unknown
error: Requested operation is not valid: cgroup CPU controller is not mounted

Prior to that change a non running domain would return:

Scheduler      : posix
cpu_shares     : 0
vcpu_period    : 0
vcpu_quota     : 0
emulator_period: 0
emulator_quota : 0

This patch will restore the capability to return configuration only data
for a non running domain regardless of whether cgroups are available.

NOTE: Needed to change the VIR_STRDUP(ret, "posix"); to ret = strdup("posix");
      and added the virReportOOMError(); on failure.
2013-06-20 09:37:54 -04:00
Ján Tomko
a06bf7b287 conf: fix use after free in virChrdevOpen
Don't free the stream on error if we've successfully added it
to the hash table, since it will be freed by virChrdevHashEntryFree
callback.

Preserve the error message before calling virStreamFree, since it
resets the error.

Introduced by 4716138, crashing since 6921892.

Reported by Sergey Fionov on libvir-list.
(cherry picked from commit a32b41746c4e1a44fb998a93da99c72f6586b359)
2013-06-18 15:30:23 +02:00
Jiri Denemark
067e9988a2 qemu: Avoid leaking uri in qemuMigrationPrepareDirect
(cherry picked from commit ddf8ad82eb5f638d6153f4b1869af17dca572e67)
2013-06-18 15:30:03 +02:00
Ján Tomko
1fc28a4743 virtlockd: fix socket path
Change the socket path to match the one used by lockd driver.

https://bugzilla.redhat.com/show_bug.cgi?id=968128
(cherry picked from commit 70fe129546545f9683ce57e6946dd80a08b54d2b)
2013-06-18 15:29:54 +02:00
Ján Tomko
7e0b15f2f0 nodedev: fix vport detection for FC HBA
Use the host number as the host number when constructing the sysfs path
instead of the variable we are trying to fill.

https://bugzilla.redhat.com/show_bug.cgi?id=973543
(cherry picked from commit 371c15517c919e9d7d2ea3f66e490bd49b6db384)
2013-06-18 15:29:42 +02:00
Cole Robinson
419605b3a0 Prep for release 1.0.5.2 v1.0.5.2 2013-06-12 16:50:01 -04:00
Cole Robinson
feb2d3375c virsh: migrate: Don't disallow --p2p and --migrateuri
Because it's a valid combination. p2p still uses a separate channel
for qemu migration, so there's value in letting the user specify a manual
migrate URI for overriding auto-port, or libvirt's FQDN lookup.

What _isn't_ allowed is --migrateuri and TUNNELLED, since there is
no separate migration channel. Disallow that instead
(cherry picked from commit 5e1de4fcdd86aceba610e9b77f6e62fc6525883b)
2013-06-12 16:37:55 -04:00
Cole Robinson
12b0af5905 qemu: migration: error if tunnelled + storage specified
Since as the code indicates it doesn't work yet, so let's be
explicit about it.
(cherry picked from commit 98bbda00cfa58c3fb73220e4a7c5d33938c0cb74)
2013-06-12 16:37:55 -04:00
Cole Robinson
69de4ce80d qemu: migration: Improve p2p error if we can't open conn
By actually showing the Open() error to the user
(cherry picked from commit 5751fc4f4efe25e6abb158fc86c61230303ce280)
2013-06-12 16:37:55 -04:00
Daniel P. Berrange
9b3455cb78 Add a virGetLastErrorMessage() function
Apps using libvirt will often have code like

   if (virXXXX() < 0) {
      virErrorPtr err = virGetLastError();
      fprintf(stderr, "Something failed: %s\n",
              err && err->message ? err->message :
              "unknown error");
      return -1;
   }

Checking for a NULL error object or message leads to very
verbose code. A virGetLastErrorMessage() helper from libvirt
can simplify this to

   if (virXXXX() < 0) {
      fprintf(stderr, "Something failed: %s\n",
              virGetLastErrorMessage());
      return -1;
   }

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit 69c6a58a1d3906fdb3ee7929a03ce9b59f33e1c3)
2013-06-12 16:37:55 -04:00
Cole Robinson
bdb5808173 qemu: Don't report error on successful media eject
If we are just ejecting media, ret == -1 even after the retry loop
determines that the tray is open, as requested. This means media
disconnect always report's error.

Fix it, and fix some other mini issues:

- Don't overwrite the 'eject' error message if the retry loop fails
- Move the retries decrement inside the loop, otherwise the final loop
  might succeed, yet retries == 0 and we will raise error
- Setting ret = -1 in the disk->src check is unneeded
- Fix comment typos

cc: mprivozn@redhat.com
(cherry picked from commit 406d8a980973cfd4caebbc886f5b283233409a64)
2013-06-12 15:25:08 -04:00
Michal Privoznik
dc0efacb6f qemuDomainChangeEjectableMedia: Unlock domain while waiting for event
In 84c59ffa I've tried to fix changing ejectable media process. The
process should go like this:

1) we need to call 'eject' on the monitor
2) we should wait for 'DEVICE_TRAY_MOVED' event
3) now we can issue 'change' command

However, while waiting in step 2) the domain monitor was locked. So
even if qemu reported the desired event, the proper callback was not
called immediately. The monitor handling code needs to lock the
monitor in order to read the event. So that's the first lock we must
not hold while waiting. The second one is the domain lock. When
monitor handling code reads an event, the appropriate callback is
called then. The first thing that each callback does is locking the
corresponding domain as a domain or its device is about to change
state. So we need to unlock both monitor and VM lock. Well, holding
any lock while sleep()-ing is not the best thing to do anyway.
(cherry picked from commit 543af79a14f06cd16844c28887210bbb93a455fa)
2013-06-12 15:24:44 -04:00
Christophe Fergeau
0e6aa8fcd2 storage: Ensure 'qemu-img resize' size arg is a 512 multiple
qemu-img resize will fail with "The new size must be a multiple of 512"
if libvirt doesn't round it first.
This fixes rhbz#951495

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
(cherry picked from commit 9a8f39d097448b2b43c4a05d0edc213eacfc9ea6)
2013-06-12 15:11:50 -04:00
Stefan Berger
12f18158c7 nwfilter: grab driver lock earlier during init (bz96649)
This patch is in relation to Bug 966449:

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

This is a patch addressing the coredump.

Thread 1 must be calling  nwfilterDriverRemoveDBusMatches(). It does so with
nwfilterDriverLock held. In the patch below I am now moving the
nwfilterDriverLock(driverState) further up so that the initialization, which
seems to either take a long time or is entirely stuck, occurs with the lock
held and the shutdown cannot occur at the same time.

Remove the lock in virNWFilterDriverIsWatchingFirewallD to avoid
double-locking.

(cherry picked from commit 0ec376c20a42b9eb365c1f9a5596366023c20c35)
2013-06-11 18:40:43 -04:00
Doug Goldstein
ab7e3039e0 Fix use of VIR_STRDUP vs strdup
Commit 894f784948a93760629de3cb195c69ef4f4b831f broke the v1.0.5-maint
branch because VIR_STRDUP() didn't exist in the v1.0.5 release so the
resulting build is missing that symbol.

This patch is only for the v1.0.5-maint branch.
2013-06-10 09:36:06 -04:00
Viktor Mihajlovski
dc200aa851 qemu: Fix crash in migration of graphics-less guests.
Commit 7f15ebc7a2b599ab10dbc15bca6f823591213e67 introduced a bug
happening when guests without a <graphics> element are migrated.
The initialization of listenAddress happens unconditionally
from the cookie even if the cookie->graphics pointer was NULL.
Moved the initialization to where it is safe.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
(cherry picked from commit 9684bb11fd3832582308d0bcdb649041fd6584e2)
2013-05-31 22:36:32 +02:00
Laine Stump
2f2ed992c0 qemu: prevent termination of guests w/hostdev on driver reconnect
This should resolve:

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

The problem was that qemuUpdateActivePciHostdevs was returning 0
(success) when no hostdevs were present, but would otherwise return -1
(failure) even when it completed successfully. It is only called from
qemuProcessReconnect(), and when qemuProcessReconnect got back an
error, it would not only stop reconnecting, but would terminate the
guest qemu process "to remove danger of it ending up running twice if
user tries to start it again later".

(This bug was introduced in commit 011cf7ad, which was pushed between
v1.0.2 and v1.0.3, so all maintenance branches from v1.0.3 up to 1.0.5
will need this one line patch applied.)
(cherry picked from commit 2ea45647bcde23cff5da48f725561ff5ba3fba39)
2013-05-31 15:16:06 -04:00
Ján Tomko
894f784948 qemu: escape literal IPv6 address in NBD migration
A literal IPv6 must be escaped, otherwise migration fails with:
unable to execute QEMU command 'drive-mirror': address resolution failed
for f0::0d:5901: Servname not supported for ai_socktype
since QEMU treats everything after the first ':' as the port.
(cherry picked from commit 2136327e23a7c87e7a75e4fd69faa5b2e8771d38)
2013-05-31 17:28:31 +02:00
Eric Blake
0ecc5ad70d build: fix build with older gcc
gcc 4.1.2 (hello, RHEL 5!) fails to build on 32-bit platforms with:

conf/domain_conf.c: In function 'virDomainDefParseXML':
conf/domain_conf.c:10581: warning: integer constant is too large for 'long' type

Problem introduced in commit f8e3221f9.

* src/conf/domain_conf.c (virDomainDefParseXML): Mark large constants.

Signed-off-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit f6817c70b430c1cfdbdc7795cf09626c1fa810d8)
2013-05-28 20:21:50 -06:00
Ján Tomko
3accd7eb25 qemu: fix NBD migration to hosts with IPv6 enabled
Since f03dcc5 we use [::] as the listening address both on qemu
command line in -incoming and in nbd-server-start QMP command.
However the latter requires just :: without the braces.
(cherry picked from commit 2326006410a921bba38c0ce67a367cd1ea88cc33)
2013-05-25 16:55:19 -04:00