]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
10 years agohostdev: Introduce virDomainHostdevSubsysSCSIiSCSI
John Ferlan [Wed, 9 Jul 2014 13:31:38 +0000 (09:31 -0400)]
hostdev: Introduce virDomainHostdevSubsysSCSIiSCSI

Create the structures and API's to hold and manage the iSCSI host device.
This extends the 'scsi_host' definitions added in commit id '5c811dce'.
A future patch will add the XML parsing, but that code requires some
infrastructure to be in place first in order to handle the differences
between a 'scsi_host' and an 'iSCSI host' device.

10 years agoAdd virConnectPtr for qemuBuildSCSIHostdevDrvStr
John Ferlan [Thu, 10 Jul 2014 15:16:15 +0000 (11:16 -0400)]
Add virConnectPtr for qemuBuildSCSIHostdevDrvStr

Add a conn for future patches to be able to grab the secret when
authenticating an iSCSI host device

10 years agohostdev: Introduce virDomainHostdevSubsysSCSIHost
John Ferlan [Fri, 20 Jun 2014 15:35:46 +0000 (11:35 -0400)]
hostdev: Introduce virDomainHostdevSubsysSCSIHost

Split virDomainHostdevSubsysSCSI further. In preparation for having
either SCSI or iSCSI data, create a union in virDomainHostdevSubsysSCSI
to contain just a virDomainHostdevSubsysSCSIHost to describe the
'scsi_host' host device

10 years agohostdev: Introduce virDomainHostdevSubsysSCSI
John Ferlan [Thu, 3 Jul 2014 21:01:10 +0000 (17:01 -0400)]
hostdev: Introduce virDomainHostdevSubsysSCSI

Create a separate typedef for the hostdev union data describing SCSI
Then adjust the code to use the new pointer

10 years agohostdev: Introduce virDomainHostdevSubsysPCI
John Ferlan [Thu, 3 Jul 2014 20:31:39 +0000 (16:31 -0400)]
hostdev: Introduce virDomainHostdevSubsysPCI

Create a separate typedef for the hostdev union data describing PCI.
Then adjust the code to use the new pointer

10 years agohostdev: Introduce virDomainHostdevSubsysUSB
John Ferlan [Thu, 3 Jul 2014 19:43:05 +0000 (15:43 -0400)]
hostdev: Introduce virDomainHostdevSubsysUSB

Create a separate typedef for the hostdev union data describing USB.
Then adjust the code to use the new pointer

10 years agoqemu: snapshot: Use storage driver to pre-create snapshot file
Peter Krempa [Mon, 30 Jun 2014 14:46:00 +0000 (16:46 +0200)]
qemu: snapshot: Use storage driver to pre-create snapshot file

Move the last operation done on local files to the storage driver API.

10 years agostorage: Implement virStorageFileCreate for local and gluster files
Peter Krempa [Mon, 30 Jun 2014 13:05:07 +0000 (15:05 +0200)]
storage: Implement virStorageFileCreate for local and gluster files

Add backends for this frontend function so that we can use it in the
snapshot creation code.

10 years agoqemu: Implement DAC driver chown callback to co-operate with storage drv
Peter Krempa [Thu, 10 Jul 2014 13:46:01 +0000 (15:46 +0200)]
qemu: Implement DAC driver chown callback to co-operate with storage drv

Use the storage driver to chown remote images.

10 years agosecurity: DAC: Plumb usage of chown callback
Peter Krempa [Thu, 10 Jul 2014 14:05:07 +0000 (16:05 +0200)]
security: DAC: Plumb usage of chown callback

Use the callback to set disk and storage image labels by modifying the
existing functions and adding wrappers to avoid refactoring a lot of the
code.

10 years agosecurity: DAC: Introduce callback to perform image chown
Peter Krempa [Thu, 10 Jul 2014 12:17:24 +0000 (14:17 +0200)]
security: DAC: Introduce callback to perform image chown

To integrate the security driver with the storage driver we need to
pass a callback for a function that will chown storage volumes.

Introduce and document the callback prototype.

10 years agosecurity: DAC: Remove superfluous link resolution
Peter Krempa [Thu, 10 Jul 2014 13:20:24 +0000 (15:20 +0200)]
security: DAC: Remove superfluous link resolution

When restoring security labels in the dac driver the code would resolve
the file path and use the resolved one to be chown-ed. The setting code
doesn't do that. Remove the unnecessary code.

10 years agostorage: Add witness for checking storage volume use in security driver
Peter Krempa [Wed, 9 Jul 2014 14:52:06 +0000 (16:52 +0200)]
storage: Add witness for checking storage volume use in security driver

With my intended use of storage driver assist to chown files on remote
storage we will need a witness that will tell us whether the given
storage volume supports operations needed by the storage driver.

10 years agostorage: Implement storage driver helper to chown disk images
Peter Krempa [Wed, 9 Jul 2014 14:42:10 +0000 (16:42 +0200)]
storage: Implement storage driver helper to chown disk images

Gluster storage works on a similar principle to NFS where it takes the
uid and gid of the actual process and uses it to access the storage
volume on the remote server. This introduces a need to chown storage
files on gluster via native API.

10 years agoqemuConnectGetDomainCapabilities: Use wiser defaults
Michal Privoznik [Thu, 17 Jul 2014 09:06:09 +0000 (11:06 +0200)]
qemuConnectGetDomainCapabilities: Use wiser defaults

Up to now, users have to pass two arguments at least: domain virt type
('qemu' vs 'kvm') and one of emulatorbin or architecture. This is not
much user friendly. Nowadays users mostly use KVM and share the host
architecture with the guest. So now, the API (and subsequently virsh
command) can be called with all NULLs  (without any arguments).

Before this patch:
 # virsh domcapabilities
 error: failed to get emulator capabilities
 error: virttype_str in qemuConnectGetDomainCapabilities must not be NULL

 # virsh domcapabilities kvm
 error: failed to get emulator capabilities
 error: invalid argument: at least one of emulatorbin or architecture fields must be present

After:

 # virsh domcapabilities
 <domainCapabilities>
   <path>/usr/bin/qemu-system-x86_64</path>
   <domain>kvm</domain>
   <machine>pc-i440fx-2.1</machine>
   <arch>x86_64</arch>
   <vcpu max='255'/>
 </domainCapabilities>

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agonumatune: finish the split from domain_conf and remove all dependencies
Martin Kletzander [Mon, 21 Jul 2014 09:32:33 +0000 (11:32 +0200)]
numatune: finish the split from domain_conf and remove all dependencies

This patch adds back the virDomainDef typedef into domain_conf and
makes all the numatune_conf functions independent of any virDomainDef
definitions.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoleaseshelper: avoid mem leak after storing lease entries
Nehal J Wani [Wed, 23 Jul 2014 22:05:13 +0000 (03:35 +0530)]
leaseshelper: avoid mem leak after storing lease entries

Contents of existing lease file were being stored in a variable
which was never freed.

10 years agomaint: simplify some syntax check exemptions
Eric Blake [Fri, 18 Jul 2014 21:22:08 +0000 (15:22 -0600)]
maint: simplify some syntax check exemptions

Commit 5028160 accidentally weakened the strtol prohibitions to
skip ALL files under src/util instead of the former situation of
just protecting util/virsexpr.c; even though NONE of the files
in that directory need any protection.

Shorten some long lines while at it.

* cfg.mk (exclude_file_name_regexp--sc_prohibit_strtol): No need
to exclude all of util.
(exclude_file_name_regexp--sc_prohibit_sprintf): Reduce long line.
(exclude_file_name_regexp--sc_prohibit_raw_allocation): Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoconf: avoid memory leaks while parsing seclabel
Eric Blake [Wed, 23 Jul 2014 04:02:56 +0000 (22:02 -0600)]
conf: avoid memory leaks while parsing seclabel

Our seclabel parsing was repeatedly assigning malloc'd data into a
temporary variable, without first freeing the previous use.  Among
other leaks flagged by valgrind:

==9312== 8 bytes in 1 blocks are definitely lost in loss record 88 of 821
==9312==    at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==9312==    by 0x8C40369: strdup (strdup.c:42)
==9312==    by 0x50EA799: virStrdup (virstring.c:676)
==9312==    by 0x50FAEB9: virXPathString (virxml.c:90)
==9312==    by 0x50FAF1E: virXPathStringLimit (virxml.c:112)
==9312==    by 0x510F516: virSecurityLabelDefParseXML (domain_conf.c:4571)
==9312==    by 0x510FB20: virSecurityLabelDefsParseXML (domain_conf.c:4720)

While it was multiple problems, it looks like commit da78351 (thankfully
unreleased) was to blame for all of them.

* src/conf/domain_conf.c (virSecurityLabelDefParseXML): Plug leaks
detected by valgrind.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agonwfilter: plug memory leak with firewall
Eric Blake [Wed, 23 Jul 2014 04:18:07 +0000 (22:18 -0600)]
nwfilter: plug memory leak with firewall

Introduced in commit 70571ccc (v1.2.4). Caught by valgrind:

==9816== 170 (32 direct, 138 indirect) bytes in 1 blocks are definitely lost in loss record 646 of 821
==9816==    at 0x4A081D4: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==9816==    by 0x50836FB: virAlloc (viralloc.c:144)
==9816==    by 0x50AEC2B: virFirewallNew (virfirewall.c:204)
==9816==    by 0x1E2308ED: ebiptablesDriverProbeStateMatch (nwfilter_ebiptables_driver.c:3715)
==9816==    by 0x1E2309AD: ebiptablesDriverInit (nwfilter_ebiptables_driver.c:3742)

* src/nwfilter/nwfilter_ebiptables_driver.c
(ebiptablesDriverProbeStateMatch): Properly clean up.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agometadata: track title edits across libvirtd restart
Eric Blake [Tue, 22 Jul 2014 15:41:05 +0000 (09:41 -0600)]
metadata: track title edits across libvirtd restart

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

Although the edits were changing in-memory XML, it was not flushed
to disk; so unless some other action changes XML, a libvirtd restart
would lose the changed information.

* src/conf/domain_conf.c (virDomainObjSetMetadata): Add parameter,
to save live status across restarts.
(virDomainSaveXML): Allow for test driver.
* src/conf/domain_conf.h (virDomainObjSetMetadata): Adjust
signature.
* src/bhyve/bhyve_driver.c (bhyveDomainSetMetadata): Adjust caller.
* src/lxc/lxc_driver.c (lxcDomainSetMetadata): Likewise.
* src/qemu/qemu_driver.c (qemuDomainSetMetadata): Likewise.
* src/test/test_driver.c (testDomainSetMetadata): Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agodocs: Point to list of valid pool target volume formats
John Ferlan [Wed, 23 Jul 2014 12:36:50 +0000 (08:36 -0400)]
docs: Point to list of valid pool target volume formats

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

Rather than point off to some nefarious "pool-specific docs" page when
describing the "format" field for the target pool provide a link to the
storage driver page which describes the various valid formats for each
pool type.  Also make it a bit more clear that if a valid format isn't
specified, then the type field is ignored.

10 years agospec: Enable sanlock on qemu_kvm_arches for RHEL
Jiri Denemark [Wed, 23 Jul 2014 07:04:22 +0000 (09:04 +0200)]
spec: Enable sanlock on qemu_kvm_arches for RHEL

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agoAdded myself in AUTHORS.in
Cédric Bosdonnat [Wed, 23 Jul 2014 14:23:46 +0000 (16:23 +0200)]
Added myself in AUTHORS.in

10 years agoDocumented VIR_DOMAIN_FEATURE_CAPABILITIES use of virDomainCapabilitesPolicy
Cédric Bosdonnat [Wed, 23 Jul 2014 14:21:59 +0000 (16:21 +0200)]
Documented VIR_DOMAIN_FEATURE_CAPABILITIES use of virDomainCapabilitesPolicy

10 years agoIntroduce virTristateSwitch enum
Ján Tomko [Fri, 27 Jun 2014 15:18:53 +0000 (17:18 +0200)]
Introduce virTristateSwitch enum

For the values "default", "on", "off"

Replaces
virDeviceAddressPCIMulti
virDomainFeatureState
virDomainIoEventFd
virDomainVirtioEventIdx
virDomainDiskCopyOnRead
virDomainMemDump
virDomainPCIRombarMode
virDomainGraphicsSpicePlaybackCompression

10 years agoIntroduce virTristateBool enum type
Ján Tomko [Fri, 27 Jun 2014 15:16:54 +0000 (17:16 +0200)]
Introduce virTristateBool enum type

Replace all three-state (default/yes/no) enums with it:
virDomainBIOSUseserial
virDomainBootMenu
virDomainPMState
virDomainGraphicsSpiceClipboardCopypaste
virDomainGraphicsSpiceAgentFileTransfer
virNetworkDNSForwardPlainNames

10 years agoFix build after 47e5b5ae3262f140955abd57bbb13337c65a3497
Peter Krempa [Wed, 23 Jul 2014 08:19:20 +0000 (10:19 +0200)]
Fix build after 47e5b5ae3262f140955abd57bbb13337c65a3497

The patch described above introduced two problems caught by the compiler
and thus breaking the build.

One of the problems was comparison of unsigned with < 0 and the second
one jumped a variable init.

10 years agoLXC: show used memory as 0 when domain is not active
Chen Hanxiao [Thu, 17 Jul 2014 09:28:29 +0000 (17:28 +0800)]
LXC: show used memory as 0 when domain is not active

Before:
virsh # dominfo chx3
State:          shut off
Max memory:     92160 KiB
Used memory:    92160 KiB

After:
virsh # dominfo container1
State:          shut off
Max memory:     92160 KiB
Used memory:    0 KiB

Similar to qemu cases.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
10 years agolxc domain from xml: convert lxc.cap.drop
Cédric Bosdonnat [Fri, 18 Jul 2014 08:02:30 +0000 (10:02 +0200)]
lxc domain from xml: convert lxc.cap.drop

10 years agolxc: allow to keep or drop capabilities
Cédric Bosdonnat [Fri, 18 Jul 2014 08:02:29 +0000 (10:02 +0200)]
lxc: allow to keep or drop capabilities

Added <capabilities> in the <features> section of LXC domains
configuration. This section can contain elements named after the
capabilities like:

  <mknod state="on"/>, keep CAP_MKNOD capability
  <sys_chroot state="off"/> drop CAP_SYS_CHROOT capability

Users can restrict or give more capabilities than the default using
this mechanism.

10 years agoLXC: create a bind mount for sysfs when enable userns but disable netns
Chen Hanxiao [Mon, 14 Jul 2014 10:01:51 +0000 (18:01 +0800)]
LXC: create a bind mount for sysfs when enable userns but disable netns

kernel commit 7dc5dbc879bd0779924b5132a48b731a0bc04a1e
forbid us doing a fresh mount for sysfs
when enable userns but disable netns.
This patch will create a bind mount in this senario.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
10 years agotests: Remove stale scsihostdata dir
Michal Privoznik [Tue, 22 Jul 2014 09:06:21 +0000 (11:06 +0200)]
tests: Remove stale scsihostdata dir

In the fbd91d49 commit, new scsihostdata dir is added to EXTRA_DIST in
the tests/Makefile.am. However, the directory itself is not created
anywhere, nor in the commit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoqemu: snapshot: Forbid taking/reverting snapshots in PMSUSPENDED state
Peter Krempa [Mon, 21 Jul 2014 13:48:35 +0000 (15:48 +0200)]
qemu: snapshot: Forbid taking/reverting snapshots in PMSUSPENDED state

Qemu doesn't currently support them and behaves strangely. Just forbid
them.

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

10 years agoqemu: snapshot: Forbid taking snapshot in invalid state
Peter Krempa [Mon, 21 Jul 2014 13:20:43 +0000 (15:20 +0200)]
qemu: snapshot: Forbid taking snapshot in invalid state

Similarly to 49a3a649a85f9d3d478be355aa8694bce889586a forbid creating
snapshots in domain states impossible to reach in qemu.

10 years agodomtop: Fix build on mingw
Michal Privoznik [Mon, 21 Jul 2014 15:26:57 +0000 (17:26 +0200)]
domtop: Fix build on mingw

Firstly, there's no sigaction() nor struct sigaction on mingw. We have
to use the one implemented by gnulib (and hence link with gnulib).
Then, for some reason one header file from windows defines ERROR
symbol. Yes it does. Sigh.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agobuild: fix build without numactl
Eric Blake [Mon, 21 Jul 2014 17:24:21 +0000 (11:24 -0600)]
build: fix build without numactl

Under ./configure --without-numactl but with numactl-devel installed,
the build fails with:

../../src/util/virnuma.c: In function 'virNumaNodeIsAvailable':
../../src/util/virnuma.c:407:5: error: implicit declaration of function 'numa_bitmask_isbitset' [-Werror=implicit-function-declaration]
     return numa_bitmask_isbitset(numa_nodes_ptr, node);
     ^

and other failures, all because the configure results for particular
functions were used without regard to whether libnuma was even being
linked in.

* src/util/virnuma.c (virNumaGetPages): Fix message typo.
(virNumaNodeIsAvailable): Correct build when not using numactl.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agostorage: logical: drop useless if
Roman Bogorodskiy [Mon, 21 Jul 2014 17:08:58 +0000 (21:08 +0400)]
storage: logical: drop useless if

virStorageBackendLogicalCreateVol contains a piece like:

    if (vol->target.path != NULL) {
        /* A target path passed to CreateVol has no meaning */
        VIR_FREE(vol->target.path);
    }

The 'if' is useless here, but 'syntax-check' doesn't catch that
because of the comment, so drop the 'if'.

10 years agoFix build on non-Linux platforms
Roman Bogorodskiy [Mon, 21 Jul 2014 17:26:00 +0000 (21:26 +0400)]
Fix build on non-Linux platforms

Commit ef48a1b introduced virFindSCSIHostByPCI for Linux and
a stub for other platforms that returns -1 while the function
should return 'char *', so use 'return NULL' instead.

Commit fbd91d4 introduced virReadSCSIUniqueId with the third
argument 'int *result', however the stub for non-Linux patform
uses 'unsigned int *result', so change it to 'int *result'.

Pushed under the build breaker rule.

10 years agogetAdapterName: Lookup stable scsi_host
John Ferlan [Mon, 9 Jun 2014 16:19:16 +0000 (12:19 -0400)]
getAdapterName: Lookup stable scsi_host

If a parentaddr was provided in the XML, have getAdapterName lookup
the stable address.  This allows virStorageBackendSCSICheckPool() and
virStorageBackendSCSIRefreshPool() to automagically find the scsi_host
by its PCI address and unique_id

10 years agoscsi_host: Introduce virFindSCSIHostByPCI
John Ferlan [Tue, 10 Jun 2014 11:47:12 +0000 (07:47 -0400)]
scsi_host: Introduce virFindSCSIHostByPCI

Introduce a new function to parse the provided scsi_host parent address
and unique_id value in order to find the /sys/class/scsi_host directory
which will allow a stable SCSI host address

Add a test to scsihosttest to lookup the host# name by using the PCI address
and unique_id value

10 years agoAdd unique_id to nodedev output
John Ferlan [Thu, 5 Jun 2014 17:17:05 +0000 (13:17 -0400)]
Add unique_id to nodedev output

Add an optional unique_id parameter to nodedev.  Allows for easier lookup
and display of the unique_id value in order to document for use with
scsi_host code.

10 years agovirutil: Introduce virReadSCSIUniqueId
John Ferlan [Tue, 10 Jun 2014 15:09:20 +0000 (11:09 -0400)]
virutil: Introduce virReadSCSIUniqueId

Introduce a new function to read the current scsi_host entry and return
the value found in the 'unique_id' file.

Add a 'scsihosttest' test (similar to the fchosttest, but incorporating some
of the concepts of the mocked pci test library) in order to read the
unique_id file like would be found in the /sys/class/scsi_host tree.

10 years agoscsi_backend: Use existing LINUX_SYSFS_SCSI_HOST_PREFIX definition
John Ferlan [Mon, 9 Jun 2014 16:41:04 +0000 (12:41 -0400)]
scsi_backend: Use existing LINUX_SYSFS_SCSI_HOST_PREFIX definition

Rather than supplying the path again in the formatting of the sysfs
scsi_host directory.

10 years agostorage: Introduce parentaddr into virStoragePoolSourceAdapter
Osier Yang [Tue, 4 Mar 2014 03:15:13 +0000 (22:15 -0500)]
storage: Introduce parentaddr into virStoragePoolSourceAdapter

Between reboots and kernel reloads, the SCSI host number used for SCSI
storage pools may change requiring modification to the storage pool XML
in order to use a specific SCSI host adapter.

This patch introduces the "parentaddr" element and "unique_id" attribute
for the SCSI host adapter in order to uniquely identify the adapter
between reboots and kernel reloads. For now the goal is to only parse
and format the XML. Both will be required to be provided in order to
uniquely identify the desired SCSI host.

The new XML is expected to be as follows:

  <adapter type='scsi_host'>
    <parentaddr unique_id='3'>
      <address domain='0x0000' bus='0x00' slot='0x1f' func='0x2'/>
    </parentaddr>
  </adapter>

where "parentaddr" is the parent device of the SCSI host using the PCI
address on which the device resides and the value from the unique_id file
for the device. Both the PCI address and unique_id values will be used
to traverse the /sys/class/scsi_host/ directories looking at each link
to match the PCI address reformatted to the directory link format where
"domain:bus:slot:function" is found.  Then for each matching directory
the unique_id file for the scsi_host will be used to match the unique_id
value in the xml.

For a PCI address listed above, this will be formatted to "0000:00:1f.2"
and the links in /sys/class/scsi_host will be used to find the host#
to be used for the 'scsi_host' device. Each entry is a link to the
/sys/bus/pci/devices directories, e.g.:

%  ls -al /sys/class/scsi_host/host2
lrwxrwxrwx. 1 root root 0 Jun  1 00:22 /sys/class/scsi_host/host2 -> ../../devices/pci0000:00/0000:00:1f.2/ata3/host2/scsi_host/host2

% cat /sys/class/scsi_host/host2/unique_id
3

The "parentaddr" and "name" attributes are mutually exclusive to identify
the SCSI host number. Use of the "parentaddr" element will be the preferred
mechanism.

This patch only supports to parse and format the XMLs. Later patches will
add code to find out the scsi host number.

10 years agovirStoragePoolSourceAdapter: Refine the SCSI_HOST adapter name
Osier Yang [Mon, 3 Mar 2014 20:04:17 +0000 (15:04 -0500)]
virStoragePoolSourceAdapter: Refine the SCSI_HOST adapter name

Preparation for future patches by creating a scsi_host union. For now,
just the 'name' will be present.

10 years agogetAdapterName: check for SCSI_HOST
John Ferlan [Mon, 3 Mar 2014 19:57:50 +0000 (14:57 -0500)]
getAdapterName: check for SCSI_HOST

Rather than assume that NOT FC_HOST is SCSI_HOST, let's call them out
specifically. Makes it easier to find SCSI_HOST code/structs and ensures
something isn't missed in the future

10 years agoschema: pool: netfs: Don't enforce slash in glusterfs pool source
Peter Krempa [Wed, 28 May 2014 13:47:38 +0000 (15:47 +0200)]
schema: pool: netfs: Don't enforce slash in glusterfs pool source

Gluster volumes don't start with a leading slash. Our schema for netfs
gluster pools enforces it though. Luckily mount.glusterfs skips it.
Allow a slashless volume name for glusterfs netfs mounts in the schema.

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

10 years agodoc: Explicitly specify how to override spice channel mode
Peter Krempa [Mon, 21 Jul 2014 15:12:51 +0000 (17:12 +0200)]
doc: Explicitly specify how to override spice channel mode

Be more clear that the "<channel mode=" attribute overrides the default
set by "defaultMode".

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

10 years agonode_device: HAL: Ignore return value of virStrToLong_ui
Peter Krempa [Mon, 21 Jul 2014 14:32:53 +0000 (16:32 +0200)]
node_device: HAL: Ignore return value of virStrToLong_ui

Commit 5df813177c3b609a8cf5db26ae94b26d4a40063d forgot to adjust a few
callers of virStrToLong_ui to ignore the returned value in some ancient
parts of the code.

10 years agoutil: Check return value from virStrToLong* functions
Peter Krempa [Mon, 21 Jul 2014 08:17:02 +0000 (10:17 +0200)]
util: Check return value from virStrToLong* functions

We do so in the vast majority of places, so there's no problem of adding
the attribute to enforce it by the complier and fix a few leftover
places.

This was originally pointed out by Coverity as a recent change triggered
it's warning that our code checked the vast majority of returns from
virStrToLong_ui.

10 years agoexamples: domtop: Avoid leaking memory
Peter Krempa [Mon, 21 Jul 2014 07:53:17 +0000 (09:53 +0200)]
examples: domtop: Avoid leaking memory

Use the virTypedParamsFree unconditionally as it handles NULL well and
has the benefit of freeing a typed parameter array even if it wasn't yet
assigned, but only allocated.

10 years agoexamples: domtop: Fix uninitialized variable use
Peter Krempa [Mon, 21 Jul 2014 07:52:02 +0000 (09:52 +0200)]
examples: domtop: Fix uninitialized variable use

max_id could be used uninitialized in the cleanup section after the
domain wasn't found.

Discovered by Coverity.

10 years agoqemu: snapshot: Reject revertion from clearly bad states
Peter Krempa [Fri, 18 Jul 2014 13:38:48 +0000 (15:38 +0200)]
qemu: snapshot: Reject revertion from clearly bad states

Report errors on some states snapshots done by qemu should never reach

10 years agoqemu: snapshot: Convert if-else switch to switch statement
Peter Krempa [Fri, 18 Jul 2014 13:25:59 +0000 (15:25 +0200)]
qemu: snapshot: Convert if-else switch to switch statement

Convert the target snapshot state selector to a switch statement
enumerating all possible values. This points out a few mistakes in the
original selector.

The logic of the code is preserved until later patches.

10 years agobhyve: reconnect to domains after libvirtd restart
Roman Bogorodskiy [Sun, 29 Jun 2014 15:52:35 +0000 (19:52 +0400)]
bhyve: reconnect to domains after libvirtd restart

Try to reconnect to the running domains after libvirtd restart. To
achieve that, do:

 * Save domain state
  - Modify virBhyveProcessStart() to save domain state to the state
    dir
  - Modify virBhyveProcessStop() to cleanup the pidfile and the state

 * Detect if the state information loaded from the driver's state
   dir matches the actual state. Consider domain active if:
    - PID it points to exist
    - Process title of this PID matches the expected one with the
      domain name

   Otherwise, mark the domain as shut off.

Note: earlier development bhyve versions before FreeBSD 10.0-RELEASE
didn't set proctitle we expect, so the current code will not detect
it. I don't plan adding support for this unless somebody requests
this.

10 years agodoc: add domain to address of hostdev pci
Hu Tao [Fri, 18 Jul 2014 07:59:22 +0000 (15:59 +0800)]
doc: add domain to address of hostdev pci

libvirt supports pci domain already, so update the documentation.
Otherwise users who lookup the documentation for how to use hostdev may
miss the domain and encounter error when pass-through a pci device in a
domain other than 0.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
10 years agoqemu: snapshot: Forbid snapshots of iSCSI passthrough devices
Peter Krempa [Fri, 18 Jul 2014 09:07:01 +0000 (11:07 +0200)]
qemu: snapshot: Forbid snapshots of iSCSI passthrough devices

As with the local SCSI passthrough devicesm qemu can't support snapshots
on those as the block ops are handled by the device. This is also true
for iSCSI backing of the disk. Remove the check for the local block
device and just forbid snapshot when the disk is of type 'lun'.

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

10 years agodoc: domain: Clarify that disk type 'lun' works with iSCSI too
Peter Krempa [Fri, 18 Jul 2014 09:05:08 +0000 (11:05 +0200)]
doc: domain: Clarify that disk type 'lun' works with iSCSI too

Disk type 'lun' enables SCSI command passthrough for a disk. We stated
that it works only with "block" disks. Qemu supports it also when using
the iSCSI protocol.

10 years agoexamples: Introduce domtop
Michal Privoznik [Mon, 14 Jul 2014 13:09:51 +0000 (15:09 +0200)]
examples: Introduce domtop

There's this question on the list that is asked over and over again.
How do I get {cpu, memory, ...} usage in percentage? Or its modified
version: How do I plot nice graphs like virt-manager does?

It would be nice if we have an example to inspire people. And that's
what domtop should do. Yes, it could be written in different ways, but
I've chosen this one as I think it show explicitly what users need to
implement in order to imitate virt-manager's graphing.

Note: The usage is displayed from host perspective. That is, how much
host CPUs the domain is using. But it should be fairly simple to
switch do just guest CPU usage if needed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoKill last strto{l,ll,d} scouts
Michal Privoznik [Fri, 18 Jul 2014 07:46:39 +0000 (09:46 +0200)]
Kill last strto{l,ll,d} scouts

There's no need to use it since we have this shiny functions
that even checks for conversion and overflow errors.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agolxc conf2xml: convert lxc.network.name for veth networks
Cédric Bosdonnat [Wed, 2 Jul 2014 13:13:40 +0000 (15:13 +0200)]
lxc conf2xml: convert lxc.network.name for veth networks

10 years agolxc network configuration allows setting target container NIC name
Cédric Bosdonnat [Fri, 27 Jun 2014 08:41:22 +0000 (10:41 +0200)]
lxc network configuration allows setting target container NIC name

LXC network devices can now be assigned a custom NIC device name on the
container side. For example, this is configured with:

    <interface type='network'>
      <source network='default'/>
      <guest dev="eth1"/>
    </interface>

In this example the network card will appear as eth1 in the guest.

10 years agospec: Consolidate with_qemu* definitions
Jiri Denemark [Thu, 17 Jul 2014 13:48:37 +0000 (15:48 +0200)]
spec: Consolidate with_qemu* definitions

Decisions whether qemu driver and libvirt-daemon-{qemu,kvm} packages
should be built on various OS/arch combinations were scattered around
the spec file. Let's make it easier to see where qemu driver is going to
be built.

10 years agostorage: Disallow vol_wipe for sparse logical volumes
John Ferlan [Thu, 17 Jul 2014 16:41:43 +0000 (12:41 -0400)]
storage: Disallow vol_wipe for sparse logical volumes

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

Add a new boolean 'sparse'.  This will be used by the logical backend
storage driver to determine whether the target volume is sparse or not
(also known by a snapshot or thin logical volume). Although setting sparse
to true at creation could be seen as duplicitous to setting during
virStorageBackendLogicalMakeVol() in case there are ever other code paths
between Create and FindLVs that need to know about the volume be sparse.

Use the 'sparse' in a new virStorageBackendLogicalVolWipe() to decide whether
to attempt to wipe the logical volume or not. For now, I have found no
means to wipe the volume without writing to it. Writing to the sparse
volume causes it to be filled. A sparse logical volume is not completely
writeable as there exists metadata which if overwritten will cause the
sparse lv to go INACTIVE which means pool-refresh will not find it.
Access to whatever lvm uses to manage data blocks is not provided by
any API I could find.

10 years agostorage: Convert 'building' into a bool
John Ferlan [Thu, 17 Jul 2014 16:41:21 +0000 (12:41 -0400)]
storage: Convert 'building' into a bool

Rather than a unsigned int, use a 'bool' since that's how it was used.

10 years agoesx: Fix a comment about VSphere versions
Geoff Hickey [Wed, 16 Jul 2014 22:25:14 +0000 (18:25 -0400)]
esx: Fix a comment about VSphere versions

Update the VSphere version comment in esx_vi.c for ESX 5.1 and 5.5.

10 years agoFix build by dropping redefined typedefs
Roman Bogorodskiy [Thu, 17 Jul 2014 17:50:16 +0000 (21:50 +0400)]
Fix build by dropping redefined typedefs

Commit 93e82727 introduced numatune_conf.h file that contains
typedefs already defined in domain_conf.h, such as:

 - virDomainNumatune
 - virDomainNumatunePtr
 - virDomainDef
 - virDomainDefPtr

As numatune_conf.h is included by domain_conf.h, clang
complains about redefinition of typedef and the build fails.

In order to fix it, drop typedefs already defined by numatume_conf.h
from domain_conf.h.

10 years agovirsh: Document bandwidth maximum more clearly
John Ferlan [Tue, 15 Jul 2014 12:35:50 +0000 (08:35 -0400)]
virsh: Document bandwidth maximum more clearly

Commit id '0e2d7305' modified the code to allow a negative value to be
supplied for the bandwidth argument of the various block virsh commands
and the migrate-setspeed; however, it failed to update the man page to
describe the "feature" whereby a very large value could be interpreted
by the hypervisor to mean maximum value allowed. Although initially
designed to handle a -1 value, the reality is just about any negative
value could be provided and essentially perform the same feature.

10 years agovirsh vol-upload/download disallow negative offset
John Ferlan [Tue, 15 Jul 2014 12:26:28 +0000 (08:26 -0400)]
virsh vol-upload/download disallow negative offset

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

Commit id 'c6212539' explicitly allowed a negative value to be used for
offset and length as a shorthand for the largest value after commit id
'f18c02ec' modified virStrToLong_ui() to essentially disallow a negative
value.

However, allowing a negative value for offset ONLY worked if the negative
value was -1 since the eventual lseek() does allow a -1 to mean the end
of the file.  Providing other negative values resulted in errors such as:

$ virsh vol-download --pool default qcow3-vol2 /home/vm-images/raw \
  --offset -2 --length -1000
error: cannot download from volume qcow3-vol2
error: Unable to seek /home/vm-images/qcow3-vol2 to 18446744073709551614: Invalid argument

$

Thus, it seems unreasonable to expect or allow a negative value for offset
since the only benefit is to lseek() to the end of the file and then only
take advantage of how the OS would handle such a seek. For the purposes of
upload or download of volume data, that seems to be a no-op.  Therefore,
disallow a negative value for offset.

Additionally, modify the man page for vol-upload and vol-download to provide
more details regarding the valid values for both offset and length.

10 years agotest: metadata: Improve test coverage
Peter Krempa [Thu, 17 Jul 2014 14:24:23 +0000 (16:24 +0200)]
test: metadata: Improve test coverage

Test also the TITLE and DESCRIPTION metadata types.

10 years agoLog an error when we fail to set the COW attribute
Ján Tomko [Thu, 17 Jul 2014 10:18:56 +0000 (12:18 +0200)]
Log an error when we fail to set the COW attribute

Coverity complains about the return value of ioctl not being checked.

Even though we carry on when this fails (just like qemu-img does),
we can log an error.

10 years agostorage: Split out volume wiping as separate backend function
Peter Krempa [Mon, 7 Jul 2014 14:50:11 +0000 (16:50 +0200)]
storage: Split out volume wiping as separate backend function

For non-local storage drivers we can't expect to use the "scrub" tool to
wipe the volume. Split the code into a separate backend function so that
we can add protocol specific code later.

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

10 years agostorage: wipe: Move helper code into storage backend
Peter Krempa [Mon, 7 Jul 2014 13:41:33 +0000 (15:41 +0200)]
storage: wipe: Move helper code into storage backend

The next patch will move the storage volume wiping code into the
individual backends. This patch splits out the common code to wipe a
local volume into a separate backend helper so that the next patch is
simpler.

10 years agoschema: put interleave at correct level
Eric Blake [Wed, 16 Jul 2014 20:53:32 +0000 (14:53 -0600)]
schema: put interleave at correct level

The previous commit 09d4d26 put the interleave at the wrong point;
it didn't allow interleaving with <memory>.

* docs/schema/domaincommon.rng (numatune): Fix interleave location.
* tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode.xml: Adjust test.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoesx: Fix a bug in the XML code for storage pools
Geoff Hickey [Wed, 16 Jul 2014 21:50:21 +0000 (17:50 -0400)]
esx: Fix a bug in the XML code for storage pools

For ESX, the code that builds XML descriptions for attached storage pools was
not setting the host count to anything when it returned a host name.

10 years agoschema: add interleave inside numatune
Martin Kletzander [Wed, 16 Jul 2014 18:35:58 +0000 (20:35 +0200)]
schema: add interleave inside numatune

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemu: leave restricting cpuset.mems after initialization
Martin Kletzander [Tue, 8 Jul 2014 07:59:49 +0000 (09:59 +0200)]
qemu: leave restricting cpuset.mems after initialization

When domain is started with numatune memory mode strict and the
nodeset does not include host NUMA node with DMA and DMA32 zones, KVM
initialization fails.  This is because cgroup restrict even kernel
allocations.  We are already doing numa_set_membind() which does the
same thing, only it does not restrict kernel allocations.

This patch leaves the userspace numa_set_membind() in place and moves
the cpuset.mems setting after the point where monitor comes up, but
before vcpu and emulator sub-groups are created.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemu: split out cpuset.mems setting
Martin Kletzander [Tue, 8 Jul 2014 07:53:06 +0000 (09:53 +0200)]
qemu: split out cpuset.mems setting

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemu: pass numa node binding preferences to qemu
Martin Kletzander [Wed, 2 Jul 2014 09:15:45 +0000 (11:15 +0200)]
qemu: pass numa node binding preferences to qemu

Currently, we only bind the whole QEMU domain to memory nodes
specified in nodemask altogether.  That, however, doesn't make much
sense when one wants to control from where the memory for particular
guest nodes should be allocated.  QEMU allows us to do that by
specifying 'host-nodes' parameter for the 'memory-backend-ram' object,
so let's use that.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemu: enable disjoint numa cpu ranges
Martin Kletzander [Tue, 17 Jun 2014 12:16:59 +0000 (14:16 +0200)]
qemu: enable disjoint numa cpu ranges

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemu: newer -numa parameter capability probing
Martin Kletzander [Tue, 17 Jun 2014 11:43:19 +0000 (13:43 +0200)]
qemu: newer -numa parameter capability probing

When qemu switched to using OptsVisitor for -numa parameter, it did
two things in the same patch.  One of them is that the numa parameter
is now visible in "query-command-line-options", the second one is that
it enabled using disjoint cpu ranges for -numa specification.  This
will be used in later patch.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemu: memory-backend-ram capability probing
Martin Kletzander [Wed, 7 May 2014 15:20:15 +0000 (17:20 +0200)]
qemu: memory-backend-ram capability probing

The numa patch series in qemu adds "memory-backend-ram" object type by
which we can tell whether we can use such objects.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemu: allow qmp probing for cmdline options without params
Martin Kletzander [Tue, 17 Jun 2014 11:41:16 +0000 (13:41 +0200)]
qemu: allow qmp probing for cmdline options without params

That can be lately achieved with by having .param == NULL in the
virQEMUCapsCommandLineProps struct.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agonumatune: add support for per-node memory bindings in private APIs
Martin Kletzander [Thu, 26 Jun 2014 17:46:45 +0000 (19:46 +0200)]
numatune: add support for per-node memory bindings in private APIs

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoconf, schema: add support for memnode elements
Martin Kletzander [Tue, 15 Jul 2014 09:39:44 +0000 (11:39 +0200)]
conf, schema: add support for memnode elements

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agonumatune: Encapsulate numatune configuration in order to unify results
Martin Kletzander [Mon, 9 Jun 2014 13:00:22 +0000 (15:00 +0200)]
numatune: Encapsulate numatune configuration in order to unify results

There were numerous places where numatune configuration (and thus
domain config as well) was changed in different ways.  On some
places this even resulted in persistent domain definition not to be
stable (it would change with daemon's restart).

In order to uniformly change how numatune config is dealt with, all
the internals are now accessible directly only in numatune_conf.c and
outside this file accessors must be used.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agonumatune: unify numatune struct and enum names
Martin Kletzander [Sun, 8 Jun 2014 17:15:42 +0000 (19:15 +0200)]
numatune: unify numatune struct and enum names

Since there was already public virDomainNumatune*, I changed the
private virNumaTune to match the same, so all the uses are unified and
public API is kept:

s/vir\(Domain\)\?Numa[tT]une/virDomainNumatune/g

then shrunk long lines, and mainly functions, that were created after
that:

sed -i 's/virDomainNumatuneMemPlacementMode/virDomainNumatunePlacement/g'

And to cope with the enum name, I haad to change the constants as
well:

s/VIR_NUMA_TUNE_MEM_PLACEMENT_MODE/VIR_DOMAIN_NUMATUNE_PLACEMENT/g

Last thing I did was at least a little shortening of already long
name:

s/virDomainNumatuneDef/virDomainNumatune/g

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agonumatune: create new module for numatune
Martin Kletzander [Fri, 6 Jun 2014 14:50:39 +0000 (16:50 +0200)]
numatune: create new module for numatune

There are many places with numatune-related code that should be put
into special numatune_conf and this patch creates a basis for that.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoconf, schema: add 'id' field for cells
Martin Kletzander [Thu, 22 May 2014 07:13:05 +0000 (09:13 +0200)]
conf, schema: add 'id' field for cells

In XML format, by definition, order of fields should not matter, so
order of parsing the elements doesn't affect the end result.  When
specifying guest NUMA cells, we depend only on the order of the 'cell'
elements.  With this patch all older domain XMLs are parsed as before,
but with the 'id' attribute they are parsed and formatted according to
that field.  This will be useful when we have tuning settings for
particular guest NUMA node.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoconf: purely a code movement
Martin Kletzander [Thu, 12 Jun 2014 06:54:50 +0000 (08:54 +0200)]
conf: purely a code movement

to ease the review of commits to follow.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemu: remove useless error check
Martin Kletzander [Wed, 2 Jul 2014 15:07:03 +0000 (17:07 +0200)]
qemu: remove useless error check

Excerpt from the virCommandAddArgBuffer() description: "Correctly
transfers memory errors or contents from buf to cmd."

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemu: purely a code movement
Martin Kletzander [Wed, 7 May 2014 13:10:47 +0000 (15:10 +0200)]
qemu: purely a code movement

to ease the review of commits to follow.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agosupport for QEMU vhost-user
Michele Paolino [Fri, 11 Jul 2014 17:47:31 +0000 (19:47 +0200)]
support for QEMU vhost-user

This patch adds support for the QEMU vhost-user feature to libvirt.
vhost-user enables the communication between a QEMU virtual machine
and other userspace process using the Virtio transport protocol.
It uses a char dev (e.g. Unix socket) for the control plane,
while the data plane based on shared memory.

The XML looks like:

<interface type='vhostuser'>
    <mac address='52:54:00:3b:83:1a'/>
    <source type='unix' path='/tmp/vhost.sock' mode='server'/>
    <model type='virtio'/>
</interface>

Signed-off-by: Michele Paolino <m.paolino@virtualopensystems.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoblockjob: wait for pivot to complete
Eric Blake [Mon, 14 Jul 2014 16:13:18 +0000 (10:13 -0600)]
blockjob: wait for pivot to complete

https://bugzilla.redhat.com/show_bug.cgi?id=1119173 documents that
commit eaba79d was flawed in the implementation of the
VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC flag when it comes to completing
a blockcopy.  Basically, the qemu pivot action is async (the QMP
command returns immediately, but the user must wait for the
BLOCK_JOB_COMPLETE event to know that all I/O related to the job
has finally been flushed), but the libvirt command was documented
as synchronous by default.  As active block commit will also be
using this code, it is worth fixing now.

* src/qemu/qemu_driver.c (qemuDomainBlockJobImpl): Don't skip wait
loop after pivot.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoutil: forbid freeing const pointers
Eric Blake [Tue, 15 Jul 2014 19:44:26 +0000 (13:44 -0600)]
util: forbid freeing const pointers

Now that we've finally fixed all the violators, it's time to
enforce that any pointer to a const object is never freed (it
is aliasing some other memory, where the non-const original
should be freed instead).  Alas, the code still needs a normal
vs. Coverity version, but at least we are still guaranteeing
that the macro call evaluates its argument exactly once.

I verified that we still get the following compiler warnings,
which in turn halts the build thanks to -Werror on gcc (hmm,
gcc 4.8.3's placement of the ^ for ?: type mismatch is a bit
off, but that's not our problem):

    int oops1 = 0;
    VIR_FREE(oops1);
    const char *oops2 = NULL;
    VIR_FREE(oops2);
    struct blah { int dummy; } oops3;
    VIR_FREE(oops3);

util/virauthconfig.c:159:35: error: pointer/integer type mismatch in conditional expression [-Werror]
     VIR_FREE(oops1);
                                   ^
util/virauthconfig.c:161:5: error: passing argument 1 of 'virFree' discards 'const' qualifier from pointer target type [-Werror]
     VIR_FREE(oops2);
     ^
In file included from util/virauthconfig.c:28:0:
util/viralloc.h:79:6: note: expected 'void *' but argument is of type 'const void *'
 void virFree(void *ptrptr) ATTRIBUTE_NONNULL(1);
      ^
util/virauthconfig.c:163:35: error: type mismatch in conditional expression
     VIR_FREE(oops3);
                                   ^

* src/util/viralloc.h (VIR_FREE): No longer cast away const.
* src/xenapi/xenapi_utils.c (xenSessionFree): Work around bogus
header.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoadd nocow test case
Chunyan Liu [Tue, 15 Jul 2014 08:49:47 +0000 (16:49 +0800)]
add nocow test case

Add file in storagevolxml2xmlin and storagevolxml2xmlout, let
storagevolxml2xmltest and storagevolschematest cover 'nocow'.
Add test case to storagevolxml2argvtest to cover 'nocow'.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
10 years agostoragevol: add nocow to vol xml
Chunyan Liu [Tue, 15 Jul 2014 08:49:46 +0000 (16:49 +0800)]
storagevol: add nocow to vol xml

Add 'nocow' to storage volume xml so that user can have an option
to set NOCOW flag to the newly created volume. It's useful on btrfs
file system to enhance performance.

Btrfs has low performance when hosting VM images, even more when the guest
in those VM are also using btrfs as file system. One way to mitigate this
bad performance is to turn off COW attributes on VM files. Generally, there
are two ways to turn off COW on btrfs: a) by mounting fs with nodatacow,
then all newly created files will be NOCOW. b) per file. Add the NOCOW file
attribute. It could only be done to empty or new files.

This patch tries the second way, according to 'nocow' option, it could set
NOCOW flag per file:
for raw file images, handle 'nocow' in libvirt code; for non-raw file images,
pass 'nocow=on' option to qemu-img, and let qemu-img to handle that (requires
qemu-img version >= 2.1).

Signed-off-by: Chunyan Liu <cyliu@suse.com>
10 years agoFix const correctness
Michal Privoznik [Tue, 15 Jul 2014 11:36:00 +0000 (13:36 +0200)]
Fix const correctness

In many places we define a variable as a 'const char *' when in fact
we modify it just a few lines below. Or even free it. We should not do
that.

There's one exception though, in xenSessionFree() xenapi_utils.c. We
are freeing the xen_session structure which is defined in
xen/api/xen_common.h public header. The structure contains session_id
which is type of 'const char *' when in fact it should have been just
'char *'. So I'm leaving this unmodified, just noticing the fact in
comment.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agostorage: fs: Don't fail volume update if backing store isn't accessible
Peter Krempa [Tue, 15 Jul 2014 12:41:58 +0000 (14:41 +0200)]
storage: fs: Don't fail volume update if backing store isn't accessible

When the backing store of a volume wasn't accessible while updating the
volume definition the call would fail altogether. In cases where we
currently (incorrectly) treat remote backing stores as local one this
might lead to strange errors.

Ignore the opening errors until we figure out how to track proper volume
metadata.