]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
12 years agonodedev: Refactor the helpers
Osier Yang [Mon, 7 Jan 2013 17:05:31 +0000 (01:05 +0800)]
nodedev: Refactor the helpers

This adds two util functions (virIsCapableFCHost and virIsCapableVport),
and rename helper check_fc_host_linux as detect_scsi_host_caps,
check_capable_vport_linux is removed, as it's abstracted to the util
function virIsCapableVport. detect_scsi_host_caps nows detect both
the fc_host and vport_ops capabilities. "stat(2)" is replaced with
"access(2)" for saving.

* src/util/virutil.h:
  - Declare virIsCapableFCHost and virIsCapableVport
* src/util/virutil.c:
  - Implement virIsCapableFCHost and virIsCapableVport
* src/node_device/node_device_linux_sysfs.c:
  - Remove check_capable_vport_linux
  - Rename check_fc_host_linux as detect_scsi_host_caps, and refactor
    it a bit to detect both fc_host and vport_os capabilities
* src/node_device/node_device_driver.h:
  - Change/remove the related declarations
* src/node_device/node_device_udev.c: (Use detect_scsi_host_caps)
* src/node_device/node_device_hal.c: (Likewise)
* src/node_device/node_device_driver.c (Likewise)

12 years agonodedev: Use access instead of stat
Osier Yang [Mon, 7 Jan 2013 17:05:30 +0000 (01:05 +0800)]
nodedev: Use access instead of stat

The use of 'stat' in nodeDeviceVportCreateDelete is only to check
if the file exists or not, it's a bit overkill, and safe to replace
with the wrapper of access(2) (virFileExists).

12 years agoutil: Add one helper virReadFCHost to read the value of fc_host entry
Osier Yang [Mon, 7 Jan 2013 17:05:29 +0000 (01:05 +0800)]
util: Add one helper virReadFCHost to read the value of fc_host entry

"open_wwn_file" in node_device_linux_sysfs.c is redundant, on one
hand it duplicates work of virFileReadAll, on the other hand, it's
waste to use a function for it, as there is no other users of it.
So I don't see why the file opening work cannot be done in
"read_wwn_linux".

"read_wwn_linux" can be abstracted as an util function. As what all
it does is to read the sysfs entry.

So this patch removes "open_wwn_file", and abstract "read_wwn_linux"
as an util function "virReadFCHost" (a more general name, because
after changes, it can read each of the fc_host entry now).

* src/util/virutil.h: (Declare virReadFCHost)
* src/util/virutil.c: (Implement virReadFCHost)
* src/node_device/node_device_linux_sysfs.c: (Remove open_wwn_file,
  and read_wwn_linux)
src/node_device/node_device_driver.h: (Remove the declaration of
  read_wwn_linux, and the related macros)
src/libvirt_private.syms: (Export virReadFCHost)

12 years agonodedev: Introduce two new flags for listAll API
Osier Yang [Mon, 7 Jan 2013 17:05:28 +0000 (01:05 +0800)]
nodedev: Introduce two new flags for listAll API

VIR_CONNECT_LIST_NODE_DEVICES_CAP_FC_HOST to filter the FC HBA,
and VIR_CONNECT_LIST_NODE_DEVICES_CAP_VPORTS to filter the FC HBA
which supports vport.

12 years agonodedev: Remove the unused enum
Osier Yang [Mon, 7 Jan 2013 17:05:27 +0000 (01:05 +0800)]
nodedev: Remove the unused enum

Guess it was created for the fc_host and vports_ops capabilities
purpose, but there is enum virNodeDevScsiHostCapFlags for them,
and enum virNodeDevHBACapType is unused, and actually both
VIR_ENUM_DECL and VIR_ENUM_IMPL use the wrong enum name
"virNodeDevHBACap".

12 years agovirsh: Fix docs for "virsh setmaxmem"
Peter Krempa [Fri, 22 Mar 2013 10:05:36 +0000 (11:05 +0100)]
virsh: Fix docs for "virsh setmaxmem"

The docs assumed the command works always for QEMU and other
hypervisors. As this is done using the balloon mechainism live increase
of the maximum memory limit isn't supported. Fix the docs to mention
this limitation.

12 years agolxc: Prevent shutting down the host
Martin Kletzander [Thu, 21 Mar 2013 14:59:50 +0000 (15:59 +0100)]
lxc: Prevent shutting down the host

When the container has the same '/dev' mount as host (no chroot),
calling domainShutdown(WithFlags) shouldn't shutdown the host it is
running on.

12 years agoEnsure root filesystem is mounted if a file/block mount.
Daniel P. Berrange [Fri, 22 Mar 2013 14:09:41 +0000 (14:09 +0000)]
Ensure root filesystem is mounted if a file/block mount.

For a root filesystem with type=file or type=block, the LXC
container was forgetting to actually mount it, before doing
the pivot root step.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMount temporary devpts on /var/lib/libvirt/lxc/$NAME.devpts
Daniel P. Berrange [Fri, 22 Mar 2013 13:54:12 +0000 (13:54 +0000)]
Mount temporary devpts on /var/lib/libvirt/lxc/$NAME.devpts

Currently the lxc controller sets up the devpts instance on
$rootfsdef->src, but this only works if $rootfsdef is using
type=mount. To support type=block or type=file for the root
filesystem, we must use /var/lib/libvirt/lxc/$NAME.devpts
for the temporary devpts mount in the controller

12 years agoMove FUSE mount to /var/lib/libvirt/lxc/$NAME.fuse
Daniel P. Berrange [Fri, 22 Mar 2013 13:52:55 +0000 (13:52 +0000)]
Move FUSE mount to /var/lib/libvirt/lxc/$NAME.fuse

Instead of using /var/lib/libvirt/lxc/$NAME for the FUSE
filesystem, use /var/lib/libvirt/lxc/$NAME.fuse. This allows
room for other temporary mounts in the same directory

12 years agoFix thread safety in LXC callback handling
Daniel P. Berrange [Fri, 22 Mar 2013 12:10:39 +0000 (12:10 +0000)]
Fix thread safety in LXC callback handling

Some of the LXC callbacks did not lock the virDomainObjPtr
instance. This caused transient errors like

error: Failed to start domain busy-mount
error: cannot rename file '/var/run/libvirt/lxc/busy-mount.xml.new' as '/var/run/libvirt/lxc/busy-mount.xml': No such file or directory

as 2 threads tried to update the status file concurrently

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRemove bogus filtering from virDomainGetRootFilesystem
Daniel P. Berrange [Fri, 22 Mar 2013 12:09:39 +0000 (12:09 +0000)]
Remove bogus filtering from virDomainGetRootFilesystem

The virDomainGetRootFilesystem was only returning filesystems
with type=mount. This is bogus - any type of filesystem is
valid as the root, if dst=/.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix parsing of bond interface XML
Jim Fehlig [Thu, 21 Mar 2013 21:44:11 +0000 (15:44 -0600)]
Fix parsing of bond interface XML

Noticed that parsing bond interface XML containing the miimon element
fails

  <interface type="bond" name="bond0">
    ...
    <bond mode="active-backup">
      <miimon freq="100" carrier="netif"/>
      ...
    </bond>
  </interface>

This configuration does not contain the optional updelay and downdelay
attributes, but parsing will fail due to returning the result of
virXPathULong (a -1 when the attribute doesn't exist) from
virInterfaceDefParseBond after examining the updelay attribute.

While fixing this bug, cleanup the function to use virXPathInt instead
of virXPathULong, and store the result directly instead of using a tmp
variable.  Using virXPathInt actually fixes a potential silent
truncation bug noted by Eric Blake.

Also, there is no cleanup in the error label.  Remove the label,
returning failure where failure occurs and success if the end of the
function is reached.

12 years agoutil: fix virAllocVar's comment
Ján Tomko [Fri, 22 Mar 2013 11:59:31 +0000 (12:59 +0100)]
util: fix virAllocVar's comment

12 years agovirsh: don't print --(null) in vol-name and vol-pool
Ján Tomko [Fri, 22 Mar 2013 11:32:32 +0000 (12:32 +0100)]
virsh: don't print --(null) in vol-name and vol-pool

Don't print the pool option name if it's null.

Before:
virsh # vol-name vol
error: failed to get vol 'vol', specifying --(null) might help
error: Storage volume not found: no storage vol with matching path vol

After:

virsh # vol-name vol
error: failed to get vol 'vol'
error: Storage volume not found: no storage vol with matching path vol

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

12 years agoviralloc: Export virAllocTest*
Michal Privoznik [Fri, 22 Mar 2013 09:18:48 +0000 (10:18 +0100)]
viralloc: Export virAllocTest*

If users build with --enable-test-oom configure option,
they get this error saying, virAllocTest* functions are
not defined within tests/testutils.c.

12 years agoFix free of uninitialized value in LXC numad setup
Daniel P. Berrange [Fri, 22 Mar 2013 11:44:00 +0000 (11:44 +0000)]
Fix free of uninitialized value in LXC numad setup

The 'nodeset' variable was never initialized, causing a later
VIR_FREE(nodeset) to free uninitialized memory.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoqemu: add support for LSI MegaRAID SAS1078 (aka megasas) SCSI controller
Paolo Bonzini [Thu, 21 Mar 2013 14:11:39 +0000 (15:11 +0100)]
qemu: add support for LSI MegaRAID SAS1078 (aka megasas) SCSI controller

This does nothing more than adding the new device and capability.
The device is present since QEMU 1.2.0.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu: pass iscsi authorization credentials
Paolo Bonzini [Thu, 21 Mar 2013 11:53:54 +0000 (12:53 +0100)]
qemu: pass iscsi authorization credentials

A better way to do this would be to use a configuration file like

   [iscsi "target-name"]
   user = name
   password = pwd

and pass it via -readconfig.  This would remove the username and password
from the "ps" output.  For now, however, keep this solution.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agodomain: parse XML for iscsi authorization credentials
Paolo Bonzini [Thu, 21 Mar 2013 11:53:53 +0000 (12:53 +0100)]
domain: parse XML for iscsi authorization credentials

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agosecret: add iscsi to possible usage types
Paolo Bonzini [Thu, 21 Mar 2013 11:53:52 +0000 (12:53 +0100)]
secret: add iscsi to possible usage types

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agodomain: make port optional for network disks
Paolo Bonzini [Thu, 21 Mar 2013 11:53:51 +0000 (12:53 +0100)]
domain: make port optional for network disks

Only sheepdog actually required it in the code, and we can use 7000 as the
default---the same value that QEMU uses for the simple "sheepdog:VOLUME"
syntax.  With this change, the schema can be fixed to allow no port.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu: support passthrough for iscsi disks
Paolo Bonzini [Thu, 21 Mar 2013 11:53:50 +0000 (12:53 +0100)]
qemu: support passthrough for iscsi disks

This enables usage of commands like persistent reservations.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu: add support for libiscsi
Paolo Bonzini [Thu, 21 Mar 2013 11:53:49 +0000 (12:53 +0100)]
qemu: add support for libiscsi

libiscsi provides a userspace iSCSI initiator.

The main advantage over the kernel initiator is that it is very
easy to provide different initiator names for VMs on the same host.
Thus libiscsi supports usage of persistent reservations in the VM,
which otherwise would only be possible with NPIV.

libiscsi uses "iscsi" as the scheme, not "iscsi+tcp".  We can change
this in the tests (while remaining backwards-compatible manner, because
QEMU uses TCP as the default transport for both Gluster and NBD).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agopython:remove semicolon in python code
Guannan Ren [Fri, 22 Mar 2013 04:08:20 +0000 (12:08 +0800)]
python:remove semicolon in python code

This breaked "make syntax-check" testing

Pushed under trivial rule

12 years agomake: regenerate bindings when <classname>.py changes
Guannan Ren [Fri, 22 Mar 2013 03:51:48 +0000 (11:51 +0800)]
make: regenerate bindings when <classname>.py changes

12 years agopython: treat flags as default argument with value 0
Guannan Ren [Thu, 21 Mar 2013 08:27:09 +0000 (16:27 +0800)]
python: treat flags as default argument with value 0

The following four functions have not changed because default arguments
have to come after positional arguments. Changing them will break the
the binding APIs.

migrate(self, dconn, flags, dname, uri, bandwidth):
migrate2(self, dconn, dxml, flags, dname, uri, bandwidth):
migrateToURI(self, duri, flags, dname, bandwidth):
migrateToURI2(self, dconnuri, miguri, dxml, flags, dname, bandwidth):

12 years agoCorrect invalid RNG schemas
Martin Kletzander [Tue, 19 Mar 2013 11:26:02 +0000 (12:26 +0100)]
Correct invalid RNG schemas

The 'trang' utility, which is able to transform '.rng' files into
'.rnc' files, reported some errors in our schemas that weren't caught
by the tools we use in the build.  I haven't added a test for this,
but the validity can be checked by the following command:

trang -I rng -O rnc domain.rng domain.rnc

There were unescaped minuses in regular expressions and we were
constraining int (which is by default in the range of [-2^31;2^31-1]
to maximum of 2^32.  But what we wanted was exactly an unsignedInt.

12 years agovirsh-snapshot: Simplify cleanup path in cmdSnapshotEdit
Peter Krempa [Thu, 7 Mar 2013 10:18:18 +0000 (11:18 +0100)]
virsh-snapshot: Simplify cleanup path in cmdSnapshotEdit

12 years agovirsh-snapshot: Use the mutually exclusive params macro in cmdSnapshotEdit
Peter Krempa [Thu, 7 Mar 2013 10:17:48 +0000 (11:17 +0100)]
virsh-snapshot: Use the mutually exclusive params macro in cmdSnapshotEdit

12 years agovirsh-snapshot: Refactor cmdSnapshotCurrent
Peter Krempa [Thu, 7 Mar 2013 10:07:03 +0000 (11:07 +0100)]
virsh-snapshot: Refactor cmdSnapshotCurrent

Use the exclusive parameter checker and touch up some parts to simplify
code.

12 years agovirsh-domain: Fix flag name in error message to match the check
Peter Krempa [Thu, 7 Mar 2013 09:51:01 +0000 (10:51 +0100)]
virsh-domain: Fix flag name in error message to match the check

The check is done on the "--paused" flag but the error message stated
"--saved"

12 years agovirsh-host: Refactor cmdFreecell
Peter Krempa [Thu, 7 Mar 2013 09:36:08 +0000 (10:36 +0100)]
virsh-host: Refactor cmdFreecell

Use the new helpers to determine mutually exclusive options and touch up
some parts to simplify the code.

12 years agovirsh-snapshot: Refactor virsh snapshot-list
Peter Krempa [Fri, 1 Mar 2013 15:27:04 +0000 (16:27 +0100)]
virsh-snapshot: Refactor virsh snapshot-list

Simplify error handling and mutually exclusive option checking.

12 years agovirsh: Introduce macros to reject mutually exclusive arguments
Peter Krempa [Thu, 7 Mar 2013 09:16:20 +0000 (10:16 +0100)]
virsh: Introduce macros to reject mutually exclusive arguments

This patch adds three macros to the virsh source tree that help to
easily check for mutually exclusive parameters.

VSH_EXCLUSIVE_OPTIONS_EXPR has four arguments, two expressions to check
and two names of the parameters to print in the message.

VSH_EXCLUSIVE_OPTIONS is more specific and check the command structure
for the parameters using vshCommandOptBool.

VSH_EXCLUSIVE_OPTIONS_VAR is meant to check boolean variables with the
same name as the parameters.

12 years agopython: Fix emulatorpin API bindings
Peter Krempa [Wed, 20 Mar 2013 10:43:41 +0000 (11:43 +0100)]
python: Fix emulatorpin API bindings

The addition of emulator pinning APIs didn't think of doing the right
job with python APIs for them. The default generator produced unusable
code for this.

This patch switches to proper code as in the case of domain Vcpu pining.
This change can be classified as a python API-breaker but in the state
the code was before I doubt anyone was able to use it successfully.

12 years agoqemu: Un-mark volume as mirrored/copied if blockjob copy fails
Peter Krempa [Wed, 20 Mar 2013 15:48:23 +0000 (16:48 +0100)]
qemu: Un-mark volume as mirrored/copied if blockjob copy fails

When the blockjob fails for some reason an event is emitted but the disk
wasn't unmarked as being part of a active block copy operation.

12 years agoFix initialization of virIdentityPtr thread locals
Daniel P. Berrange [Thu, 21 Mar 2013 10:58:15 +0000 (10:58 +0000)]
Fix initialization of virIdentityPtr thread locals

Some code mistakenly called virIdentityOnceInit directly
instead of virIdentityInitialize(). This meant that one-time
initializer was run many times with predictably bad results.

12 years agoqemu: s/VIR_ERR_NO_SUPPORT/VIR_ERR_OPERATION_UNSUPPORTED
Michal Privoznik [Wed, 20 Mar 2013 15:57:08 +0000 (16:57 +0100)]
qemu: s/VIR_ERR_NO_SUPPORT/VIR_ERR_OPERATION_UNSUPPORTED

The VIR_ERR_NO_SUPPORT error code is reserved for cases where an
API is not implemented in a driver. It definitely should not be
used when an API execution fails due to unsupported operation.

12 years agoFix linkage of virt-aa-helper with numa library
Daniel P. Berrange [Wed, 20 Mar 2013 15:02:34 +0000 (15:02 +0000)]
Fix linkage of virt-aa-helper with numa library

The recent commit moved some of the use of libnuma out of the
driver code, and into src/util/. It did not, however, update
libvirt_util.la to link against libnuma. This caused linkage
failure with virt-aa-helper, since nothing else caused libnuma
to be pulled onto the linker command line.

The fix removes all reference to NUMACTL_LIBS/CFLAGS from the
various modules in src/Makefile.am and just adds them to the
libvirt_util.la module, which everything else depends on.

Technically a build-breaker fix, but wanted to wait for feedback
on this

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoqemu: Add the new disk src into shared disk table when updating disk
Osier Yang [Mon, 18 Mar 2013 13:52:04 +0000 (21:52 +0800)]
qemu: Add the new disk src into shared disk table when updating disk

We should record the new disk src in the shared disk table for
updating disk (CD-ROM or Floppy) API. Fortunately, we only allow
to update the disk source now, otherwise we might also want to
set the unpriv_sgio setting.

12 years agopython: fix bindings that don't raise an exception
Guannan Ren [Thu, 21 Mar 2013 03:24:49 +0000 (11:24 +0800)]
python: fix bindings that don't raise an exception

For example:
 >>> dom.memoryStats()
 libvir: QEMU Driver error : Requested operation is not valid:\
         domain is not running

There are six such python API functions like so.
The root reason is that generator.py script checks the type of return
value of a python stub function defined in libvirt-api.xml or
libvirt-override-api.xml to see whether to add the raise clause or not
in python wrapper code in libvirt.py.

The type of return value is supposed to be C types.
For those stub functions which return python non-integer data type like
string, list, tuple, dictionary, the existing type in functions varies
from each other which leads problem like this.

Currently, in generator.py, it maintains a buggy whitelist for stub functions
returning a list type. I think it is easy to forget adding new function name
in the whitelist.

This patch makes the value of type consistent with C type "char *"
in libvirt-override-api.xml. For python, any of types could be printed
as string, so I choose "char *" in this case. And the comment in xml
could explain it when adding new function definition.

      <function name='virNodeGetCPUStats' file='python'>
        ...
 -      <return type='virNodeCPUStats' info='...'/>
 +      <return type='char *' info='...'/>
        ...
      </function>

12 years agodomain: add support for iscsi network disks
Paolo Bonzini [Mon, 25 Feb 2013 17:44:26 +0000 (18:44 +0100)]
domain: add support for iscsi network disks

This plumbs in the XML description of iSCSI shares.  The next patches
will add support for the libiscsi userspace initiator.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoClean redundant code about VCPU string checking
Li Zhang [Mon, 18 Mar 2013 09:57:14 +0000 (17:57 +0800)]
Clean redundant code about VCPU string checking

Now that VCPU number are removed from qemu_monitor_text.c
(commit cc78d7ba), VCPU string checking also should be removed.

Report-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
12 years agocgroup: export virCgroupRemoveRecursively
Gao feng [Wed, 20 Mar 2013 08:14:23 +0000 (16:14 +0800)]
cgroup: export virCgroupRemoveRecursively

We will use virCgroupRemoveRecursively to remove cgroup
directories in the coming patch.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
12 years agoDon't fail if SELinux is diabled
Guido Günther [Wed, 20 Mar 2013 19:01:18 +0000 (20:01 +0100)]
Don't fail if SELinux is diabled

but libvirt is built with --with-selinux. In this case getpeercon
returns ENOPROTOOPT so don't return an error in that case but simply
don't set seccon.

12 years agoclarify virsh net commands
Gene Czarcinski [Sat, 16 Mar 2013 17:36:32 +0000 (13:36 -0400)]
clarify virsh net commands

Clarify that net-create deals with a transient virtual
network whereas net-define defines a persistent virtual
network definition and will create the network (xml)
definition file.

Clarify that net-destroy works with both transient and
persistent virtual networks.

Signed-off-by: Gene Czarcinski <gene@czarc.net>
12 years agodoc/schema: disk storage volume formats
Philipp Hahn [Wed, 20 Mar 2013 11:53:32 +0000 (12:53 +0100)]
doc/schema: disk storage volume formats

The storage volume formats supported by the disk storage pool are
missing from the allowed values.

Add partition types.

Signed-off-by: Philipp Hahn <hahn@univention.de>
12 years agodoc: storage: Fix grammar
Philipp Hahn [Wed, 20 Mar 2013 11:42:35 +0000 (12:42 +0100)]
doc: storage: Fix grammar

Remove 'are' before 'have'.

Signed-off-by: Philipp Hahn <hahn@univention.de>
12 years agodoc/schema: Support iqn for storage pools
Philipp Hahn [Wed, 20 Mar 2013 10:45:29 +0000 (11:45 +0100)]
doc/schema: Support iqn for storage pools

iSCSI qualified names (iqn) from RFC3721 may contain colons (':'), which
neither matches the absFilePath nor genericName:

 $ virsh pool-dumpxml myiscsipool
 <pool type='iscsi'>
 ...
   <source>
 ...
     <device path='iqn.2003-01.org.linux-iscsi.phahn-sid93.x8664:sn.8a3daa0d4efd'/>
   </source>
 ...
 </pool>

Add IscsiQualifiedName type and allow its use in sourceiscsi.

Signed-off-by: Philipp Hahn <hahn@univention.de>
12 years agodoc/schema: add ocfs2 for disk vol
Philipp Hahn [Tue, 26 Feb 2013 12:41:21 +0000 (13:41 +0100)]
doc/schema: add ocfs2 for disk vol

Add ocfs2 for disk vol.

Signed-off-by: Philipp Hahn <hahn@univention.de>
12 years agoFix typos s/HAVE_SELINUX/WITH_SELINUX/
Daniel P. Berrange [Wed, 20 Mar 2013 13:06:04 +0000 (13:06 +0000)]
Fix typos s/HAVE_SELINUX/WITH_SELINUX/

The virNetSocket & virIdentity classes accidentally got some
conditionals using HAVE_SELINUX instead of WITH_SELINUX.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoLXC: add cpuset cgroup support for lxc
Gao feng [Wed, 20 Mar 2013 03:35:09 +0000 (11:35 +0800)]
LXC: add cpuset cgroup support for lxc

This patch adds cpuset cgroup support for LXC.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
12 years agoNUMA: cleanup for numa related codes
Gao feng [Wed, 20 Mar 2013 03:35:08 +0000 (11:35 +0800)]
NUMA: cleanup for numa related codes

Intend to reduce the redundant code,use virNumaSetupMemoryPolicy
to replace virLXCControllerSetupNUMAPolicy and
qemuProcessInitNumaMemoryPolicy.

This patch also moves the numa related codes to the
file virnuma.c and virnuma.h

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
12 years agofix TLS error with virNetServerClientCreateIdentity
Olivia Yin [Wed, 20 Mar 2013 02:13:27 +0000 (10:13 +0800)]
fix TLS error with virNetServerClientCreateIdentity

Compilation error when WITH_GNUTLS is 0, introduced in commit d5e83ad.

12 years agoLXC: allow uses advisory nodeset from querying numad
Gao feng [Mon, 18 Mar 2013 09:04:02 +0000 (17:04 +0800)]
LXC: allow uses advisory nodeset from querying numad

Allow lxc using the advisory nodeset from querying numad,
this means if user doesn't specify the numa nodes that
the lxc domain should assign to, libvirt will automatically
bind the lxc domain to the advisory nodeset which queried from
numad.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
12 years agorename qemuGetNumadAdvice to virNumaGetAutoPlacementAdvice
Gao feng [Mon, 18 Mar 2013 09:04:01 +0000 (17:04 +0800)]
rename qemuGetNumadAdvice to virNumaGetAutoPlacementAdvice

qemuGetNumadAdvice will be used by LXC driver, rename
it to virNumaGetAutoPlacementAdvice and move it to virnuma.c

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
12 years agoselinux: deal with dtb file
Olivia Yin [Thu, 14 Mar 2013 04:49:44 +0000 (12:49 +0800)]
selinux: deal with dtb file

12 years agoqemu: add dtb option support
Olivia Yin [Thu, 14 Mar 2013 04:49:43 +0000 (12:49 +0800)]
qemu: add dtb option support

The "dtb" option sets the filename for the device tree.
If without this option support, "-dtb file" will be converted into
<qemu:commandline> in domain XML file.
For example, '-dtb /media/ram/test.dtb' will be converted into
  <qemu:commandline>
    <qemu:arg value='-dtb'/>
    <qemu:arg value='/media/ram/test.dtb'/>
  </qemu:commandline>

This is not very friendly.
This patchset add special <dtb> tag like <kernel> and <initrd>
which is easier for user to write domain XML file.
  <os>
    <type arch='ppc' machine='ppce500v2'>hvm</type>
    <kernel>/media/ram/uImage</kernel>
    <initrd>/media/ram/ramdisk</initrd>
    <dtb>/media/ram/test.dtb</dtb>
    <cmdline>root=/dev/ram rw console=ttyS0,115200</cmdline>
  </os>

Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agoconf: support <dtb> tag in XML domain file
Olivia Yin [Thu, 14 Mar 2013 04:49:42 +0000 (12:49 +0800)]
conf: support <dtb> tag in XML domain file

12 years agoFix --without-libvirtd builds
Doug Goldstein [Sun, 17 Mar 2013 01:57:55 +0000 (20:57 -0500)]
Fix --without-libvirtd builds

When building with --without-libvirtd and udev support is detected we
will fail to build with the following error:
    node_device/node_device_udev.c:1608:37: error: unknown type name
        'virStateInhibitCallback'

12 years agorename tests/conftest.c
Gene Czarcinski [Tue, 19 Mar 2013 18:36:28 +0000 (14:36 -0400)]
rename tests/conftest.c

To prevent confusion with configure's popular name
for a file, rename conftest.c to test_conf.c which
is consistent with the invoking test_conf.sh
Signed-off-by: Gene Czarcinski <gene@czarc.net>
12 years agostorage: fix unlikely memory leak in rbd backend
Laine Stump [Mon, 18 Mar 2013 20:04:11 +0000 (16:04 -0400)]
storage: fix unlikely memory leak in rbd backend

virStorageBackendRBDRefreshPool() first allocates an array big enough
to hold 1024 names, then calls rbd_list(), which returns ERANGE if the
array isn't big enough. When that happens, the VIR_ALLOC_N is called
again with a larger size. Unfortunately, the original array isn't
freed before allocating a new one.

12 years agoFix /pool/storage/name documentation
Christophe Fergeau [Tue, 19 Mar 2013 11:43:20 +0000 (12:43 +0100)]
Fix /pool/storage/name documentation

There was a 2 word sentence 'remote server' which is a left-over
from copy and paste.

12 years agoFix /pool/storage/directory@path documentation
Christophe Fergeau [Tue, 19 Mar 2013 11:43:20 +0000 (12:43 +0100)]
Fix /pool/storage/directory@path documentation

Because of a wrong copy and paste, the documentation was saying that
'path' is the path to a block device node while it's a path to a
directory.

12 years agoDo not prematurely close loop devices in LXC controller
Daniel P. Berrange [Fri, 15 Mar 2013 15:07:13 +0000 (15:07 +0000)]
Do not prematurely close loop devices in LXC controller

The LXC controller is closing loop devices as soon as the
container has started. This is fine if the loop device
was setup as a mounted filesystem, but if we're just passing
through the loop device as a disk, nothing else is keeping
it open. Thus we must keep the loop device FDs open for as
long the libvirt_lxc process is running.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoSetup LXC cgroups in two phases
Daniel P. Berrange [Thu, 14 Mar 2013 12:47:28 +0000 (12:47 +0000)]
Setup LXC cgroups in two phases

Currently the LXC controller creates the cgroup, configures the
resources and adds the task all in one go. This is not sufficiently
flexible for the forthcoming NBD integration. We need to make sure
the NBD process gets into the right cgroup immediately, but we can
not have limits (in particular the device ACL) applied at the point
where we start qemu-nbd. So create a virLXCCgroupCreate method
which creates the cgroup and adds the current task to be called
early, and leave virLXCCgroupSetup to only do resource config.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoSet the current client identity during API call dispatch
Daniel P. Berrange [Mon, 23 Jan 2012 15:07:15 +0000 (15:07 +0000)]
Set the current client identity during API call dispatch

When dispatching an RPC API call, setup the current identity to
hold the identity of the network client associated with the
RPC message being dispatched. The setting is thread-local, so
only affects the API call in this thread

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd ability to get a virIdentity from a virNetServerClientPtr
Daniel P. Berrange [Mon, 23 Jan 2012 15:05:01 +0000 (15:05 +0000)]
Add ability to get a virIdentity from a virNetServerClientPtr

Add APIs which allow creation of a virIdentity from the info
associated with a virNetServerClientPtr instance. This is done
based on the results of client authentication processes like
TLS, x509, SASL, SO_PEERCRED

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd API to get the system identity
Daniel P. Berrange [Wed, 6 Mar 2013 11:00:16 +0000 (11:00 +0000)]
Add API to get the system identity

If no user identity is available, some operations may wish to
use the system identity. ie the identity of the current process
itself. Add an API to get such an identity.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd APIs for associating a virIdentityPtr with the current thread
Daniel P. Berrange [Wed, 6 Mar 2013 10:53:47 +0000 (10:53 +0000)]
Add APIs for associating a virIdentityPtr with the current thread

To allow any internal API to get the current identity, add APIs
to associate a virIdentityPtr with the current thread, via a
thread local

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoDefine internal APIs for managing identities
Daniel P. Berrange [Fri, 20 Jan 2012 17:49:32 +0000 (17:49 +0000)]
Define internal APIs for managing identities

Introduce a local object virIdentity for managing security
attributes used to form a client application's identity.
Instances of this object are intended to be used as if they
were immutable, once created & populated with attributes

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd APIs to get at more client security data
Daniel P. Berrange [Fri, 20 Jan 2012 17:18:28 +0000 (17:18 +0000)]
Add APIs to get at more client security data

A socket object has various pieces of security data associated
with it, such as the SELinux context, the SASL username and
the x509 distinguished name. Add new APIs to virNetServerClient
and related modules to access this data.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoqemu: Fix startupPolicy regression
Jiri Denemark [Mon, 18 Mar 2013 13:11:58 +0000 (14:11 +0100)]
qemu: Fix startupPolicy regression

Commit 82d5fe543720da6d83c1d6bfa1c347d7d9fda278

    qemu: check backing chains even when cgroup is omitted

added backing file checks just before the code that removes optional
disks if they are not present. However, the backing chain code fails in
case the disk file does not exist, which makes qemuProcessStart fail
regardless on configured startupPolicy.

Note that startupPolicy implementation is still wrong after this patch
since it only check the first file in a possible chain. It should rather
check the complete backing chain. But this is an existing limitation
that can be solved later. After all, startupPolicy is most useful for
CDROM images and they won't make use of backing files in most cases.

12 years agoqemu: support URI syntax for NBD
Paolo Bonzini [Mon, 25 Feb 2013 17:44:25 +0000 (18:44 +0100)]
qemu: support URI syntax for NBD

QEMU 1.3 and newer support an alternative URI-based syntax to specify
the location of an NBD server.  Libvirt can keep on using the old
syntax in general, but only the URI syntax supports IPv6 addresses.

The URI syntax also supports relative paths to Unix sockets.  These
should never be used but aren't explicitly blocked either by the parser,
so support it just in case.

The URI syntax is intentionally compatible with Gluster's, and the
code can be reused.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agoqemu: support NBD with Unix sockets
Paolo Bonzini [Mon, 25 Feb 2013 17:44:24 +0000 (18:44 +0100)]
qemu: support NBD with Unix sockets

This reuses the XML format that was introduced for Gluster.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agoqemu: support named nbd exports
Paolo Bonzini [Mon, 25 Feb 2013 17:44:23 +0000 (18:44 +0100)]
qemu: support named nbd exports

These are supported by nbd-server and by the NBD server that QEMU
embeds for live image access.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agoqemu: rewrite NBD command-line builder and parser
Paolo Bonzini [Mon, 25 Feb 2013 17:44:22 +0000 (18:44 +0100)]
qemu: rewrite NBD command-line builder and parser

Move the code to an external function, and structure it to prepare
the addition of new features in the next few patches.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agoqemu: test NBD command-line builder and parser
Paolo Bonzini [Mon, 25 Feb 2013 17:44:22 +0000 (18:44 +0100)]
qemu: test NBD command-line builder and parser

Enable more testing of NBD parsing, to ensure rewrites work.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agoutil: portably check for unchanged uid
Eric Blake [Thu, 14 Mar 2013 22:28:29 +0000 (16:28 -0600)]
util: portably check for unchanged uid

We've already scrubbed for comparisons of 'uid_t == -1' (which fail
on platforms where uid_t is a u16), but another one snuck in.

* src/util/virutil.c (virSetUIDGIDWithCaps): Correct uid comparison.
* cfg.mk (sc_prohibit_risky_id_promotion): New rule.

12 years agoqemu: do not support non-network disks without -drive
Paolo Bonzini [Mon, 25 Feb 2013 17:44:21 +0000 (18:44 +0100)]
qemu: do not support non-network disks without -drive

QEMU added -drive in 2007, and NBD in 2008.  Both appeared first in
release 0.10.0.  Thus the code to support network disks without -drive
is dead, and in fact it incorrectly escapes commas.  Drop it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoCleanup useless flags specifications
Martin Kletzander [Tue, 12 Mar 2013 15:35:30 +0000 (16:35 +0100)]
Cleanup useless flags specifications

After we switched to C99 initialization, I noticed there were many
places where the specification of .flags parameter differed.  After
going through many options and deciding whether to unify the
initialization to be '.flags = 0' or '.flags = VSH_OFLAG_NONE', I
realized both can be removed and it makes the code easier to go
through.

12 years agoFix snapshot-create-as syntax in help output
Martin Kletzander [Tue, 12 Mar 2013 15:34:31 +0000 (16:34 +0100)]
Fix snapshot-create-as syntax in help output

According to the man page, the memspec parameter should have the
'--memspec' option mandatory and this is as close as we can get to
that.  What this change does is explained below.

man virsh:

snapshot-create-as ... [[--live] [--memspec memspec]]

virsh help snapshot-create-as before this patch:

  SYNOPSIS
    snapshot-create-as ... [<memspec>] ...
...
  OPTIONS
    [--memspec] <string> ...

virsh help snapshot-create-as after this patch:

  SYNOPSIS
    snapshot-create-as ... [--memspec <string>] ...
...
  OPTIONS
    --memspec <string> ...

12 years agoMake vshDebug work when parsing parameters
Martin Kletzander [Wed, 13 Mar 2013 08:03:34 +0000 (09:03 +0100)]
Make vshDebug work when parsing parameters

The vshInit initializes ctl->debug by which vshDebug (which is also
called in vshParseArgv) decides whether to print out the message or
not.

12 years agoRemove contiguous CPU indexes assumption
Li Zhang [Fri, 15 Mar 2013 09:25:09 +0000 (17:25 +0800)]
Remove contiguous CPU indexes assumption

When getting CPUs' information, it assumes that CPU indexes
are not contiguous. But for ppc64 platform, CPU indexes are not
contiguous because SMT is needed to be disabled, so CPU information
is not right on ppc64 and vpuinfo, vcpupin can't work corretly.

This patch is to remove the assumption to be compatible with ppc64.

Test:
   4 vcpus are assigned to one VM and execute vcpuinfo command.

   Without patch: There is only one vcpu informaion can be listed.
   With patch: All vcpus' information can be listed correctly.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
12 years agoUpdate to COPYING.LIB to latest LGPLv2.1 copy
Christophe Fergeau [Mon, 11 Mar 2013 11:40:35 +0000 (12:40 +0100)]
Update to COPYING.LIB to latest LGPLv2.1 copy

The text version
of LGPLv2.1 available at
http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt is slightly
different from COPYING.LIB:
- several paragraphs were rewrapped
- the FSF address has changed, so the license has been changed to
  indicate the newer address

I've checked that there are no changes in the license text apart from
the updated address, which is what I want to fix with this commit.

12 years agoFix a copy & paste error for virsh dump help
Yanbing Du [Fri, 15 Mar 2013 07:40:18 +0000 (15:40 +0800)]
Fix a copy & paste error for virsh dump help

Signed-off-by: Yanbing Du <ydu@redhat.com>
12 years agoaudit: Audit resources used by VirtIO RNG
Peter Krempa [Mon, 11 Mar 2013 16:09:19 +0000 (17:09 +0100)]
audit: Audit resources used by VirtIO RNG

This patch adds auditing of resources used by Virtio RNG devices. Only
resources on the local filesystems are audited.

The audit logs look like:

For the 'random' backend:
type=VIRT_RESOURCE msg=audit(1363099126.643:31): pid=995252 uid=0 auid=4294967295 ses=4294967295 msg='virt=kvm resrc=rng reason=start vm="qcow-test" uuid=118733ed-b658-3e22-a2cb-4fe5cb3ddf79 old-rng="?" new-rng="/dev/random": exe="/home/pipo/libvirt/daemon/.libs/libvirtd" hostname=? addr=? terminal=pts/0 res=success'

For local character device source:
type=VIRT_RESOURCE msg=audit(1363100164.240:96): pid=995252 uid=0 auid=4294967295 ses=4294967295 msg='virt=kvm resrc=rng reason=start vm="qcow-test" uuid=118733ed-b658-3e22-a2cb-4fe5cb3ddf79 old-rng="?" new-rng="/tmp/unix.sock": exe="/home/pipo/libvirt/daemon/.libs/libvirtd" hostname=? addr=? terminal=pts/0 res=success'

12 years agoS390: Testcases for virtio-scsi and virtio-rng
Viktor Mihajlovski [Thu, 14 Mar 2013 18:32:26 +0000 (19:32 +0100)]
S390: Testcases for virtio-scsi and virtio-rng

Adding test cases for virtio-scsi and virtio-rng. Since ccw is covering
the superset of the s390 bus handling, these are deemed to be sufficient.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoS390: Enable virtio-scsi and virtio-rng
Viktor Mihajlovski [Thu, 14 Mar 2013 18:32:25 +0000 (19:32 +0100)]
S390: Enable virtio-scsi and virtio-rng

Newer versions of QEMU support virtio-scsi and virtio-rng devices
on the virtio-s390 and ccw buses. Adding capability detection,
address assignment and command line generation for that.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoqemu: Rename virtio-scsi capability
Viktor Mihajlovski [Thu, 14 Mar 2013 18:32:24 +0000 (19:32 +0100)]
qemu: Rename virtio-scsi capability

QEMU_CAPS_VIRTIO_SCSI_PCI implies that virtio-scsi is only supported
for the PCI bus, which is not the case. Remove the _PCI suffix.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoutil: fix clear_emulator_capabilities=0
Laine Stump [Wed, 13 Mar 2013 19:26:35 +0000 (15:26 -0400)]
util: fix clear_emulator_capabilities=0

My commit 7a2e845a865dc7fa82d2393ea2a770cfc8cf00b4 (and its
prerequisites) managed to effectively ignore the
clear_emulator_capabilities setting in qemu.conf (visible in the code
as the VIR_EXEC_CLEAR_CAPS flag when qemu is being exec'ed), with the
result that the capabilities are always cleared regardless of the
qemu.conf setting. This patch fixes it by passing the flag through to
virSetUIDGIDWithCaps(), which uses it to decide whether or not to
clear existing capabilities before adding in those that were
requested.

Note that the existing capabilities are *always* cleared if the new
process is going to run as non-root, since the whole point of running
non-root is to have the capabilities removed (it's still possible to
maintain individual capabilities as needed using the capBits argument
though).

12 years agoqemu: detect multi-head qxl via more than version check
Eric Blake [Thu, 14 Mar 2013 00:41:22 +0000 (18:41 -0600)]
qemu: detect multi-head qxl via more than version check

Multi-head QXL support is so useful that distros have started to
backport it to qemu earlier than 1.2.  After discussion with
Alon Levy, we determined that the existence of the qxl-vga.surfaces
property is a reliable indicator of whether '-device qxl-vga' works,
or whether we have to stick to the older '-vga qxl'.  I'm leaving
in the existing check for QEMU_CAPS_DEVICE_VIDEO_PRIMARY tied to
qemu 1.2 and newer (in case qemu is built without qxl support),
but for those distros that backport qxl, this additional capability
check will allow the correct command line for both RHEL 6.3 (which
lacks the feature) and RHEL 6.4 (where qemu still claims to be
version 0.12.2.x, but has backported multi-head qxl).

* src/qemu/qemu_capabilities.c (virQEMUCapsObjectPropsQxlVga): New
property test.
(virQEMUCapsExtractDeviceStr): Probe for backport of new
capability to qemu earlier than 1.2.
* tests/qemuhelpdata/qemu-kvm-1.2.0-device: Update test.
* tests/qemuhelpdata/qemu-1.2.0-device: Likewise.
* tests/qemuhelpdata/qemu-kvm-0.12.1.2-rhel62-beta-device:
Likewise.

12 years agoFix deps for generating RPC dispatch code
Daniel P. Berrange [Thu, 14 Mar 2013 14:54:09 +0000 (14:54 +0000)]
Fix deps for generating RPC dispatch code

The src/lxc/lxc_*_dispatch.h files only had deps on the
RPC generator script & the XDR definition file. So when
the Makefile.am args passed to the generator were change,
the disaptch code was not re-generated. This caused a
build failure

  CC       libvirt_lxc-lxc_controller.o
lxc/lxc_controller.c: In function 'virLXCControllerSetupServer':
lxc/lxc_controller.c:718:47: error: 'virLXCMonitorProcs' undeclared (first use in this function)
lxc/lxc_controller.c:718:47: note: each undeclared identifier is reported only once for each function it appears in
lxc/lxc_controller.c:719:47: error: 'virLXCMonitorNProcs' undeclared (first use in this function)
make[3]: *** [libvirt_lxc-lxc_controller.o] Error 1

For added fun, the generated files were not listed in
CLEANFILES, so only a 'git clean -f' would fix the build

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix size probing for VDI images
Ján Tomko [Thu, 14 Mar 2013 12:24:03 +0000 (13:24 +0100)]
Fix size probing for VDI images

Commit 027bf2ea used the wrong offset: the text field at the start
of the header has 64 bytes, not 68. [1]

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

[1] https://forums.virtualbox.org/viewtopic.php?p=29267#p29267

12 years agoFix generation of systemtap probes for RPC protocols
Daniel P. Berrange [Wed, 13 Mar 2013 19:19:22 +0000 (19:19 +0000)]
Fix generation of systemtap probes for RPC protocols

The naming used in the RPC protocols for the LXC monitor and
lock daemon confused the script used to generate systemtap
helper functions. Rename the LXC monitor protocol symbols to
reduce confusion. Adapt the gensystemtap.pl script to cope
with the LXC monitor / lock daemon naming conversions.

This has no functional impact on RPC wire protocol, since
names are only used in the C layer

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRe-add DTrace probes on 'dispose' functions
Daniel P. Berrange [Wed, 13 Mar 2013 19:17:32 +0000 (19:17 +0000)]
Re-add DTrace probes on 'dispose' functions

When converting to virObject, the probes on the 'Free' functions
were removed on the basis that there is a probe on virObjectFree
that suffices. This puts a burden on people writing probe scripts
to identify which object is being dispose. This adds back probes
in the 'Dispose' functions and updates the rpc monitor systemtap
example to use them

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix parsing of SELinux ranges without a category
Daniel P. Berrange [Wed, 13 Mar 2013 17:58:26 +0000 (17:58 +0000)]
Fix parsing of SELinux ranges without a category

Normally libvirtd should run with a SELinux label

  system_u:system_r:virtd_t:s0-s0:c0.c1023

If a user manually runs libvirtd though, it is sometimes
possible to get into a situation where it is running

  system_u:system_r:init_t:s0

The SELinux security driver isn't expecting this and can't
parse the security label since it lacks the ':c0.c1023' part
causing it to complain

  internal error Cannot parse sensitivity level in s0

This updates the parser to cope with this, so if no category
is present, libvirtd will hardcode the equivalent of c0.c1023.

Now this won't work if SELinux is in Enforcing mode, but that's
not an issue, because the user can only get into this problem
if in Permissive mode. This means they can now start VMs in
Permissive mode without hitting that parsing error

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoSeparate MCS range parsing from MCS range checking
Daniel P. Berrange [Wed, 13 Mar 2013 17:41:19 +0000 (17:41 +0000)]
Separate MCS range parsing from MCS range checking

Pull the code which parses the current process MCS range
out of virSecuritySELinuxMCSFind and into a new method
virSecuritySELinuxMCSGetProcessRange.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix memory leak on OOM in virSecuritySELinuxMCSFind
Daniel P. Berrange [Wed, 13 Mar 2013 17:39:52 +0000 (17:39 +0000)]
Fix memory leak on OOM in virSecuritySELinuxMCSFind

The body of the loop in virSecuritySELinuxMCSFind would
directly 'return NULL' on OOM, instead of jumping to the
cleanup label. This caused a leak of several local vars.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>