Commit Graph

11070 Commits

Author SHA1 Message Date
Ján Tomko
9720cc8195 virsh: check the return value of virStoragePoolGetAutostart
On error, virStoragePoolGetAutostart would return -1 leaving autostart
untouched.

Removed the misleading debug message as well.

Error: CHECKED_RETURN (CWE-252):
libvirt-0.10.2/tools/virsh-pool.c:1386: unchecked_value: No check of the
    return value of "virStoragePoolGetAutostart(pool, &autostart)".
(cherry picked from commit e9d74a7a82)
2012-12-09 16:53:41 -05:00
Ján Tomko
2f4d266d1f conf: fix uninitialized variable in virDomainListSnapshots
If allocation of names fails, list is uninitialized.
(cherry picked from commit 892582f9de)
2012-12-09 16:53:40 -05:00
Ján Tomko
e8d28ec3fa rpc: don't destroy xdr before creating it in virNetMessageEncodeHeader
On OOM, xdr_destroy got called even though it wasn't created yet.

Found by coverity:
Error: UNINIT (CWE-457):
    libvirt-0.10.2/src/rpc/virnetmessage.c:214: var_decl: Declaring
    variable "xdr" without initializer.
    libvirt-0.10.2/src/rpc/virnetmessage.c:219: cond_true: Condition
    "virReallocN(&msg->buffer, 1UL /* sizeof (*msg->buffer) */,
    msg->bufferLength) < 0", taking true branch
    libvirt-0.10.2/src/rpc/virnetmessage.c:221: goto: Jumping to label
    "cleanup"
    libvirt-0.10.2/src/rpc/virnetmessage.c:257: label: Reached label
    "cleanup"
    libvirt-0.10.2/src/rpc/virnetmessage.c:258: uninit_use: Using
    uninitialized value "xdr.x_ops".
(cherry picked from commit 6e1fc35546)
2012-12-09 16:53:40 -05:00
Ján Tomko
caf1377a12 virsh: do timing even for unusable connections
Time values were uninitialized if the connection wasn't usable.
(cherry picked from commit 8b235d4057)
2012-12-09 16:53:40 -05:00
Ján Tomko
a565e20b08 virsh: use correct sizeof when allocating cpumap
Found by coverity:
Error: SIZEOF_MISMATCH (CWE-569):
    libvirt-0.10.2/tools/virsh-domain.c:4754: suspicious_sizeof: Passing
    argument "8UL /* sizeof (cpumap) */" to function
    "_vshCalloc(vshControl *, size_t, size_t, char const *, int)" and
    then casting the return value to "unsigned char *" is suspicious.

Error: SIZEOF_MISMATCH (CWE-569):
    libvirt-0.10.2/tools/virsh-domain.c:4942: suspicious_sizeof: Passing
    argument "8UL /* sizeof (cpumap) */" to function
    "_vshCalloc(vshControl *, size_t, size_t, char const *, int)" and
    then casting the return value to "unsigned char *" is suspicious.
(cherry picked from commit dc04b2a737)
2012-12-09 16:53:40 -05:00
Ján Tomko
e4e5a4d349 util: fix virBitmap allocation in virProcessInfoGetAffinity
Found by coverity:
Error: REVERSE_INULL (CWE-476):
    libvirt-0.10.2/src/util/processinfo.c:141: deref_ptr: Directly
    dereferencing pointer "map".
    libvirt-0.10.2/src/util/processinfo.c:142: check_after_deref:
    Null-checking "map" suggests that it may be null, but it has already
    been dereferenced on all paths leading to the check.
(cherry picked from commit 7730257db3)
2012-12-09 16:53:40 -05:00
Laine Stump
2e7298d718 network: fix crash when portgroup has no name
This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=879473

The name attribute is required for portgroup elements (yes, the RNG
specifies that), and there is code in libvirt that assumes it is
non-null.  Unfortunately, the portgroup parsing function wasn't
checking for lack of portgroup. One adverse result of this was that
attempts to update a network by adding a portgroup with no name would
cause libvirtd to segfault. For example:

   virsh net-update default add portgroup "<portgroup default='yes'/>"

This patch causes virNetworkPortGroupParseXML to fail if no name is
specified, thus avoiding any later problems.
(cherry picked from commit 012d69dff1)
2012-12-09 16:53:40 -05:00
Daniel P. Berrange
3926d8571b Fix leak of virNetworkPtr in LXC startup failure path
When starting an LXC guest with a virNetwork based NIC device,
if the network was not active, the virNetworkPtr device would
be leaked

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit 509ce9437f)
2012-12-09 16:53:40 -05:00
Daniel P. Berrange
e69aaf2f7e Fix error reporting in virNetDevVethDelete
In virNetDevVethDelete the virRun method will properly report
errors, but when checking the exit status for non-zero exit
code no error is reported

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit 0584d6626b)
2012-12-09 16:53:40 -05:00
Daniel P. Berrange
dd35c8dadd Ensure transient def is removed if LXC start fails
When starting a container, newDef is initialized to a
copy of 'def', but when startup fails newDef is never
removed. This cause later attempts to use 'virDomainDefine'
to lose the new data being defined.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit 9d2bfc1ca7)
2012-12-09 16:53:40 -05:00
Daniel P. Berrange
f928284b85 Ensure failure to create macvtap device aborts LXC start
A mistaken initialization of 'ret' caused failure to create
macvtap devices to be ignored. The libvirt_lxc process
would later fail to start due to missing devices

Also make sure code checks '< 0' and not '!= 0' since only
-1 is considered an error condition

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit 43db9cf4ed)
2012-12-09 16:53:39 -05:00
Daniel P. Berrange
74aa3ffec2 Avoid crash when LXC start fails with no interface target
If the <interface> device did not contain any <target>
element, LXC would crash on a NULL pointer if starting
the container failed

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit 68dceb635d)
2012-12-09 16:53:39 -05:00
Daniel P. Berrange
49ed3cd1f6 Specify name of target interface with macvlan error
When failing to create a macvlan interface, make sure the
error message contains the name of the host interface

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit e11daa2b60)
2012-12-09 16:53:39 -05:00
Daniel P. Berrange
1083e4183f Treat missing driver cgroup as fatal in LXC driver
The LXC driver relies on use of cgroups to kill off LXC processes
in shutdown. If cgroups aren't available, we're unable to kill
off processes, so we must treat lack of cgroups as a fatal startup
error.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit 7c5ba648f7)
2012-12-09 16:53:39 -05:00
Daniel P. Berrange
7e3b1283f1 Ensure LXC container exits if cgroups setup fails
The code setting up LXC cgroups used an 'rc' variable both
for capturing the return value of methods it calls, and
its own return status. The result was that several failures
in setting up cgroups would actually result in success being
returned.

Use a separate 'ret' for tracking return value as per normal
code design in other parts of libvirt

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit 8e1f0c38fa)
2012-12-09 16:53:39 -05:00
Peter Krempa
bf8efc3398 lxc: Don't crash if no security driver is specified in libvirt_lxc
When no security driver is specified libvirt_lxc segfaults as a debug
message tries to access security labels for the container that are not
present.

This problem was introduced in commit 6c3cf57d6c.
(cherry picked from commit 99a388e612)
2012-12-09 16:35:57 -05:00
Peter Krempa
fac1a19dfc lxc: Avoid segfault of libvirt_lxc helper on early cleanup paths
Early jumps to the cleanup label caused a crash of the libvirt_lxc
container helper as the cleanup section called
virLXCControllerDeleteInterfaces(ctrl) without checking the ctrl argument
for NULL. The argument was de-referenced soon after.

$ /usr/libexec/libvirt_lxc
/usr/libexec/libvirt_lxc: missing --name argument for configuration
Segmentation fault
(cherry picked from commit 81efb13b4a)
2012-12-09 16:35:53 -05:00
Ján Tomko
89cecbbecc storage: fix logical volume cloning
Commit 258e06c removed setting of the volume type to
VIR_STORAGE_VOL_BLOCK, which leads to failures in
storageVolumeCreateXMLFrom.

The type (and target.format) of the volume was set to zero. In
virStorageBackendGetBuildVolFromFunction, this gets interpreted as
VIR_STORAGE_FILE_NONE and the qemu-img tool is called with unknown
"none" format.

Bug: https://bugzilla.redhat.com/show_bug.cgi?id=879780
(cherry picked from commit 70f0bbe8e0)
2012-12-09 16:35:30 -05:00
Daniel P. Berrange
1f45a3233c Skip deleted timers when calculting next timeout
It is possible for there to be deleted timers when we
calculate the next timeout, and they must be skipped.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit afbd96678e)
2012-12-09 16:34:58 -05:00
Daniel P. Berrange
9d239b5956 Warn if requesting update to non-existent timer/handle watch
The event code is a no-op if requested to update a non-existent
timer/handle watch. This makes it hard to detect bugs in the
caller who have passed bogus data. Add a VIR_WARN output in
such cases, since the API does not allow for return errors.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit 39064f0ff9)
2012-12-09 16:34:53 -05:00
Daniel P. Berrange
f45dded083 Fix virDiskNameToIndex to actually ignore partition numbers
The docs for virDiskNameToIndex claim it ignores partition
numbers. In actual fact though, a code ordering bug means
that a partition number will cause the code to accidentally
multiply the result by 26.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit 81d6c4defe)
2012-12-09 16:34:41 -05:00
Martin Kletzander
179216680e conf: Report sensible error for invalid disk name
The error "... but the cause is unknown" appeared for XMLs similar to
this:

 <disk type='file' device='cdrom'>
   <driver name='qemu' type='raw'/>
   <source file='/dev/zero'/>
   <target dev='sr0'/>
 </disk>

Notice unsupported disk type (for the driver), but also no address
specified. The first part is not a problem and we should not abort
immediately because of that, but the combination with the address
unknown was causing an unspecified error.

While fixing this, I added an error to one place where this return
value was not managed properly.
(cherry picked from commit 03cd6e4ae8)
2012-12-09 16:34:13 -05:00
Daniel P. Berrange
adc0bc4c1d Use virNetServerRun instead of custom main loop
The LXC controller code currently directly invokes the
libvirt main loop code. The problem is that this misses
the cleanup of virNetServerClient connections that
virNetServerRun takes care of.

The result is that when libvirtd is stopped, the
libvirt_lxc controller process gets stuck in a I/O loop.
When libvirtd is then started again, it fails to connect
to the controller and thus kills off the entire domain.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit f33e43c235)
2012-12-09 16:33:52 -05:00
Osier Yang
8b6567005c storage: Fix bug of fs pool destroying
Regression introduced by commit 258e06c85b, "ret" could be set to 1
or 0 by virStorageBackendFileSystemIsMounted before goto cleanup.
This could mislead the callers (up to the public API
virStoragePoolDestroy) to return success even the underlying umount
command fails.
(cherry picked from commit f4ac06569a)
2012-12-09 16:33:33 -05:00
Ján Tomko
2484fb2ef7 conf: add support for booting from redirected USB devices
Commit a4c19459aa only added the
QEMU capability flag, command line option and added the boot element
for redirdev's in the XML schema.

This patch adds support for parsing and writing the XML with redirdevs
with the boot flag. It also ignores unknown XML elements in redirdev
instead of failing with:
"error: An error occurred, but the cause is unknown"

Bug: https://bugzilla.redhat.com/show_bug.cgi?id=805414
(cherry picked from commit cc244e2441)
2012-12-09 16:32:58 -05:00
Laine Stump
b300c71fbf qemu: allow larger discrepency between memory & currentMemory in domain xml
This resolves:

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

The reported problem is that an attempt to restore a saved domain that
was configured with <currentMemory> and <memory> set to some (same for
both) number that's not a multiple of 4096KiB results in an error like
this:

  error: Failed to start domain libvirt_test_api
  error: XML error: current memory '4001792k' exceeds maximum '4000768k'

(in this case, currentMemory was set to 4000000KiB).

The reason for this failure is:

1) a saved image contains the "live xml" of the domain at the time of
the save.

2) the live xml of a running domain gets its currentMemory
(a.k.a. cur_balloon) directly from the qemu monitor rather than from
the configuration of the domain.

3) the value reported by qemu is (sometimes) not exactly what was
originally given to qemu when the domain was started, but is rounded
up to [some indeterminate granularity] - in some versions of qemu that
granularity is apparently 1MiB, and in others it is 4MiB.

4) When the XML is parsed to setup the state of the restored domain,
the XML parser for <currentMemory> compares it to <memory> (which is
the maximum allowed memory size for the domain) and if <currentMemory>
is greater than the next 1024KiB boundary above <memory>, it spits out
an error and fails.

For example (from the BZ) if you start qemu on RHEL6 with both
<currentMemory> and <memory> of 4000000 (this number is in KiB),
libvirt's dominfo or dumpxml will report "4001792" back (rounded up to
next 4MiB) for 10-20 seconds after the start, then revert to reporting
"4000000". On Fedora 16 (which uses qemu-1.0), it will instead report
"4000768" (rounded up to next 1MiB). On Fedora 17 (qemu-1.2), it seems
to always report "4000000". ("4000000" is of course okay, and
"4000768" is also okay since that's the next 1024KiB boundary above
"4000000" and the parser was already allowing for that. But "4001792
is *not* okay and produces the error message.)

This patch solves the problem by changing the allowed "fudge factor"
when parsing from 1024KiB to 4096KiB to match the maximum up-rounding
that could be done in qemu.

(I had earlier thought to fix this by up-rounding <memory> in the
dumpxml that's put into the saved image, but that wouldn't have fixed
the case where the save image was produced by an "unfixed"
libvirtd.)
(cherry picked from commit 89204fca7f)
2012-12-09 16:31:42 -05:00
Eric Blake
ddf4a85db8 nodeinfo: support kernels that lack socket information
On RHEL 5, I was getting a segfault trying to start libvirtd,
because we were failing virNodeParseSocket but not checking
for errors, and then calling CPU_SET(-1, &sock_map) as a result.
But if you don't have a topology/physical_package_id file,
then you can just assume that the cpu belongs to socket 0.

* src/nodeinfo.c (virNodeGetCpuValue): Change bool into
default_value.
(virNodeParseSocket): Allow for default value when file is missing,
different from fatal error on reading file.
(virNodeParseNode): Update call sites to fail on error.
(cherry picked from commit 47976b484c)
2012-12-09 16:30:08 -05:00
Ján Tomko
ec48fd7d93 virsh: save: report an error if XML file can't be read
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=876868
(cherry picked from commit 58110b4887)
2012-12-09 16:29:38 -05:00
Daniel Veillard
c18efc8e6e Doug Goldstein gained commit capability
(cherry picked from commit bf60b6b33f)
2012-12-09 16:28:00 -05:00
Eric Blake
74aaec03eb build: rerun bootstrap if AUTHORS is missing
Ever since commit 7b21981c started generating AUTHORS, we now have
the situation that if you flip between two branches in the same
git repository that cross that commit boundary, then 'make' will
fail due to automake complaining about AUTHORS not existing.  The
simplest solution is to realize that if AUTHORS does not exist,
then we flipped branches so we will need to rerun bootstrap
anyways; and rerunning bootstrap ensures AUTHORS will exist in time.

* cfg.mk (_update_required): Also depend on AUTHORS.
(cherry picked from commit 71d125620d)
2012-12-09 16:27:53 -05:00
Daniel P. Berrange
caea712245 Fix uninitialized variable in virLXCControllerSetupDevPTS
The lack of initialization of 'opts' caused a SEGV in the
cleanup: path if the root->src directory did not exist
(cherry picked from commit 3782814d4a)
2012-12-09 16:27:38 -05:00
Michal Privoznik
3186eb057c qemu: Don't force port=0 for SPICE
If domain uses only TLS port we don't want to add
'port=0' explicitly to command line.
(cherry picked from commit 9f87247235)
2012-12-09 16:27:30 -05:00
Guido Günther
d070eee1b2 Fix "virsh create" example
We require a file and don't accept standard input:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=692322
(cherry picked from commit d49adae2e2)
2012-12-09 16:26:15 -05:00
Martin Kletzander
245c8135fe esx: Yet another connection fix for 5.1
After the connection to ESX 5.1 being broken since g1e7cd39, the fix
in bab7752c helped a bit, but still missed a spot, so the connection
is now successful, but some APIs (for example defineXML) don't work.
Two cases missing are added in this patch to avoid that.
(cherry picked from commit 9c294e6f9a)
2012-12-09 16:25:24 -05:00
Michal Privoznik
e1cb1c06ec qemu: Add controllers in specified order
qemu is sensitive to the order of arguments passed. Hence, if a
device requires a controller, the controller cmd string must
precede device cmd string. The same apply for controllers, when
for instance ccid controller requires usb controller. So
controllers create partial ordering in which they should be added
to qemu cmd line.
(cherry picked from commit 0f720ab35a)
2012-12-09 16:25:19 -05:00
Michal Privoznik
a2e51ac038 qemu: Wrap controllers code into dummy loop
which just re-indent code and prepare it for next patch.
(cherry picked from commit 77b93dbc3e)
2012-12-09 16:25:17 -05:00
Václav Pavlín
77b780f581 spec: replace scriptlets with new systemd macros
https://bugzilla.redhat.com/850186

I added %with_systemd_macros so it should now work in F17 with old
scriptlets and in F18+/RHEL7+ with systemd macros
(see https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd)

I missed libvirt-guests.service because there is no systemctl call for
it. So I only added systemd macros calls.
(cherry picked from commit ec02d49dfd)
2012-12-09 16:24:09 -05:00
Michal Privoznik
b222c47b53 iohelper: Don't report errors on special FDs
Some FDs may not implement fdatasync() functionality,
e.g.  pipes. In that case EINVAL or EROFS is returned.
We don't want to fail then nor report any error.

Reported-by: Christophe Fergeau <cfergeau@redhat.com>
(cherry picked from commit 46325e5131)
2012-12-09 16:23:46 -05:00
Peter Krempa
beb086f638 qemu: Fix possible race when pausing guest
When pausing the guest while migration is running (to speed up
convergence) the virDomainSuspend API checks if the migration job is
active before entering the job. This could cause a possible race if the
virDomainSuspend is called while the job is active but ends before the
Suspend API enters the job (this would require that the migration is
aborted). This would cause a incorrect event to be emitted.
(cherry picked from commit d0fc6dc831)
2012-12-09 16:22:48 -05:00
Peter Krempa
d3fd617699 net: Remove dnsmasq and radvd files also when destroying transient nets
The network driver didn't care about config files when a network was
destroyed, just when it was undefined leaving behind files for transient
networks.

This patch splits out the cleanup code to a helper function that handles
the cleanup if the inactive network object is being removed and re-uses
this code when getting rid of inactive networks.
(cherry picked from commit e87af617fc)
2012-12-09 16:21:32 -05:00
Peter Krempa
b16a4ca98b net: Move creation of dnsmasq hosts file to function starting dnsmasq
The hosts file was created in the network definition function. This
patch moves the place the file is being created to the point where
dnsmasq is being started.
(cherry picked from commit 23ae3fe425)
2012-12-09 16:21:18 -05:00
Peter Krempa
2d49ed5d18 conf: net: Fix deadlock if assignment of network def fails
When the assignment fails, the network object is not unlocked and next
call that would use it deadlocks.
(cherry picked from commit f823089124)
2012-12-09 16:20:57 -05:00
Peter Krempa
43995ddcc4 conf: net: Fix helper for applying new network definition
When there's no new definition the helper overwrote the old one with
NULL.
(cherry picked from commit 947230fb56)
2012-12-09 16:20:52 -05:00
Dan Walsh
9a5430414d Linux Containers are not allowed to create device nodes.
This needs to be done before the container starts. Turning
off the mknod capability is noticed by systemd, which will
no longer attempt to create device nodes.

This eliminates SELinux AVC messages and ugly failure messages in the journal.
(cherry picked from commit 2e03b08ead)
2012-12-09 16:12:35 -05:00
Michal Privoznik
d676b742ca net-update docs: s/domain/network/
A leftover from copy paste.
(cherry picked from commit d1236faa17)
2012-12-09 16:11:13 -05:00
Michal Privoznik
8a95078f98 iohelper: fdatasync() at the end
Currently, when we are doing (managed) save, we insert the
iohelper between the qemu and OS. The pipe is created, the
writing end is passed to qemu and the reading end to the
iohelper. It reads data and write them into given file. However,
with write() being asynchronous data may still be in OS
caches and hence in some (corner) cases, all migration data
may have been read and written (not physically though). So
qemu will report success, as well as iohelper. However, with
some non local filesystems, where ENOSPACE is polled every X
time units, we may get into situation where all operations
succeeded but data hasn't reached the disk. And in fact will
never do. Therefore we ought sync caches to make sure data
has reached the block device on remote host.
(cherry picked from commit f32e3a2dd6)
2012-12-09 16:11:09 -05:00
Martin Kletzander
ec3f5cad8e qemu: Fix EmulatorPinInfo without emulatorpin
https://bugzilla.redhat.com/show_bug.cgi?id=871312

Recent fixes made almost all the right steps to make emulator pinned
to the cpuset of the whole domain in case <emulatorpin> isn't
specified, but qemudDomainGetEmulatorPinInfo still reports all the
CPUs even when cpuset is specified.  This patch fixes that.
(cherry picked from commit 10c5212b10)
2012-12-09 16:08:08 -05:00
Gene Czarcinski
c3cc4c1835 bugfix: ip6tables rule removal
Three FORWARD chain rules are added and two INPUT chain rules
are added when a network is started but only the FORWARD chain
rules are removed when the network is destroyed.
(cherry picked from commit adaa7ab653)
2012-12-09 16:07:39 -05:00
Guido Günther
0004a11879 Create temporary dir for socket
to avoid ENAMETOOLONG:

https://buildd.debian.org/status/fetch.php?pkg=libvirt&arch=amd64&ver=1.0.0~rc1-1&stamp=1351453521
(cherry picked from commit 0e7fd31fb5)
2012-12-09 16:07:09 -05:00
Laine Stump
58320848d2 util: do a better job of matching up pids with their binaries
This patch resolves: https://bugzilla.redhat.com/show_bug.cgi?id=871201

If libvirt is restarted after updating the dnsmasq or radvd packages,
a subsequent "virsh net-destroy" will fail to kill the dnsmasq/radvd
process.

The problem is that when libvirtd restarts, it re-reads the dnsmasq
and radvd pidfiles, then does a sanity check on each pid it finds,
including checking that the symbolic link in /proc/$pid/exe actually
points to the same file as the path used by libvirt to execute the
binary in the first place. If this fails, libvirt assumes that the
process is no longer alive.

But if the original binary has been replaced, the link in /proc is set
to "$binarypath (deleted)" (it literally has the string " (deleted)"
appended to the link text stored in the filesystem), so even if a new
binary exists in the same location, attempts to resolve the link will
fail.

In the end, not only is the old dnsmasq/radvd not terminated when the
network is stopped, but a new dnsmasq can't be started when the
network is later restarted (because the original process is still
listening on the ports that the new process wants).

The solution is, when the initial "use stat to check for identical
inodes" check for identity between /proc/$pid/exe and $binpath fails,
to check /proc/$pid/exe for a link ending with " (deleted)" and if so,
truncate that part of the link and compare what's left with the
original binarypath.

A twist to this problem is that on systems with "merged" /sbin and
/usr/sbin (i.e. /sbin is really just a symlink to /usr/sbin; Fedora
17+ is an example of this), libvirt may have started the process using
one path, but /proc/$pid/exe lists a different path (indeed, on F17
this is the case - libvirtd uses /sbin/dnsmasq, but /proc/$pid/exe
shows "/usr/sbin/dnsmasq"). The further bit of code to resolve this is
to call virFileResolveAllLinks() on both the original binarypath and
on the truncated link we read from /proc/$pid/exe, and compare the
results.

The resulting code still succeeds in all the same cases it did before,
but also succeeds if the binary was deleted or replaced after it was
started.
(cherry picked from commit 7bafe009d9)
2012-12-09 16:07:04 -05:00