]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
10 years agotests: avoid dlsym mocking on mingw
Eric Blake [Tue, 20 May 2014 21:04:44 +0000 (15:04 -0600)]
tests: avoid dlsym mocking on mingw

I got a build failure when cross-compiling to mingw with the
mingw64-dbus package installed:

  CC       virmockdbus_la-virmockdbus.lo
../../tests/virmockdbus.c:29:6: error: 'dbus_connection_set_change_sigpipe' redeclared without dllimport attribute: previous dllimport ignored [-Werror=attributes]
 VIR_MOCK_STUB_VOID_ARGS(dbus_connection_set_change_sigpipe,
      ^
../../tests/virmockdbus.c:33:18: error: 'dbus_bus_get' redeclared without dllimport attribute: previous dllimport ignored [-Werror=attributes]
 VIR_MOCK_STUB_RET_ARGS(dbus_bus_get,
...

Well duh - mingw lacks dlopen and friends, even if it can support
dbus.  A similar failure occured in virsystemdtest.c; but in that
file, we know that systemd is a Linux-only concept.

* tests/virmockdbus.c: Cripple on mingw.
* tests/virsystemdtest.c: Cripple on non-Linux.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoqemu: snapshot: Fix return value of external checkpoint with no disks
Peter Krempa [Tue, 20 May 2014 13:22:14 +0000 (15:22 +0200)]
qemu: snapshot: Fix return value of external checkpoint with no disks

When doing an external checkpoint of a VM with no disk selected we'd
return failure but not set error code. This was a result of ret not
being set to 0 during walking of the disk array.

Rework early failure checking and set the error code to success before
iterating the array of disks so that we return success if no disks are
snapshotted.

Fixes the following symptom (or without --diskspec for diskless VMs)

 $ virsh snapshot-create-as snapshot-test  --memspec /tmp/asdf --diskspec hda,snapshot=no
 error: An error occurred, but the cause is unknown

10 years agoqemu: snapshot: Forbid empty snapshots
Peter Krempa [Tue, 20 May 2014 12:22:25 +0000 (14:22 +0200)]
qemu: snapshot: Forbid empty snapshots

If neither disks nor memory are selected for snapshot we'd record
metadata in case of external snapshot and do a disk snapshot in case of
external disk snapshot. Forbid this as it doesn't make much sense.

10 years agoqemu: snapshot: Forbid partial internal snapshots
Peter Krempa [Tue, 20 May 2014 12:04:23 +0000 (14:04 +0200)]
qemu: snapshot: Forbid partial internal snapshots

qemu's savevm command does a snapshot of all non readonly disks of a VM.
Libvirt though allowed disabling snapshot for certain disk of a VM.

10 years agoqemu: snapshot: Use typecasted switch in qemuDomainSnapshotPrepare()
Peter Krempa [Tue, 20 May 2014 08:38:42 +0000 (10:38 +0200)]
qemu: snapshot: Use typecasted switch in qemuDomainSnapshotPrepare()

Convert the switch to a typecasted value so that the compiler tracks
additions for us.

10 years agobhyve: domain events support
Roman Bogorodskiy [Wed, 23 Apr 2014 11:55:05 +0000 (15:55 +0400)]
bhyve: domain events support

Support events for these functions:

 - domainDefineXML
 - domainUndefine
 - domainCreate{WithFlags,XML}
 - domainDestroy

10 years agomigration: add support for migrateURI configuration
Chen Fan [Tue, 20 May 2014 06:08:05 +0000 (14:08 +0800)]
migration: add support for migrateURI configuration

For now, we set the migration URI via command line '--migrate_uri' or
construct the URI by looking up the dest host's hostname which could be
solved by DNS automatically.

But in cases the dest host have two or more NICs to reach, we may need to
send the migration data over a specific NIC which is different from the
automatically resolved one for some reason like performance, security, etc.
Thus we must explicitly specify the migrateuri in command line everytime,
but it is too troublesome if there are many such hosts (and don't forget
virt-manager).

This patch adds a configuration file option on dest host to save the
default value set which can be specified to a migration hostname or
one of this host's addresses used for transferring data, thus user doesn't
have to specify it in command line everytime.

Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agoutil: refactor virNetlinkCommand to fix several bugs / style problems
Laine Stump [Tue, 13 May 2014 11:34:43 +0000 (14:34 +0300)]
util: refactor virNetlinkCommand to fix several bugs / style problems

Inspired by a simpler patch from "Wangrui (K) <moon.wangrui@huawei.com>".

A submitted patch pointed out that virNetlinkCommand() was doing an
improper typecast of the return value from nl_recv() (int to
unsigned), causing it to miss error returns, and that even after
remedying that problem, virNetlinkCommand() was calling VIR_FREE() on
the pointer returned from nl_recv() (*resp) even if nl_recv() had
returned an error, and that in this case the pointer was verifiably
invalid, as it was pointing to memory that had been allocated by
libnl, but then freed prior to returning the error.

While reviewing this patch, I noticed several other problems with this
seemingly simple function (at least one of them as serious as the
problem being reported/fixed by the aforementioned patch), and decided
they all deserved to be fixed. Here is the list:

1) The return value from nl_recv() must be assigned to an int (rather
   than unsigned int) in order to detect failure.

2) When nl_recv() returns an error or 0, the contents of *resp is
   invalid, and should be simply set to 0, *not* VIR_FREE()'d.

3) When nl_recv() returns 0, errno is not set, so the logged error
   message should not reference errno (it *is* an error though).

4) The first error return from virNetlinkCommand returns -EINVAL,
   incorrectly implying that the caller can expect the return value to
   be of the "-errno" variety, which is not true in any other case.

5) The 2nd error return returns directly with garbage in *resp. While
   the caller should never use *resp in this case, it's still good
   practice to set it to NULL.

6) For the next 5 (!!) error conditions, *resp will contain garbage,
   and virNetlinkCommand() will goto it's cleanup code which will
   VIR_FREE(*resp), almost surely leading to a segfault.

In addition to fixing these 6 problems, this patch also makes the
following two changes to make the function conform more closely to the
style of other libvirt code:

1) Change the handling of return code from "named rc and defaulted to
0, but changed to -1 on error" to the more common "named ret and
defaulted to -1, but changed to 0 on success".

2) Rename the "error" label to "cleanup", since the code that follows
is executed in success cases as well as failure.

10 years agobuild: nuke more uses of 'sync'
Eric Blake [Mon, 19 May 2014 23:02:42 +0000 (17:02 -0600)]
build: nuke more uses of 'sync'

Commit d5c86278 was incomplete; other functions also triggered
compiler warnings about collisions in the use of 'sync'.

* src/qemu/qemu_driver.c (qemuDomainSetTime): Fix another client.
* tools/virsh-domain-monitor.c (cmdDomTime): Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoavoid 'sync' as variable name
Pavel Hrdina [Mon, 19 May 2014 14:36:55 +0000 (16:36 +0200)]
avoid 'sync' as variable name

Old gcc complains about shadowing 'sync' variable:

../../src/qemu/qemu_agent.c: In function 'qemuAgentSetTime':
../../src/qemu/qemu_agent.c:1737: warning: declaration of 'sync'
  shadows a global declaration [-Wshadow]
/usr/include/unistd.h:464: warning: shadowed declaration is here
  [-Wshadow]

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agoReturn error when updating cdrom device
Pavel Hrdina [Mon, 19 May 2014 13:48:43 +0000 (15:48 +0200)]
Return error when updating cdrom device

The commit 84c59ffa improved the way we change ejectable media.
If for any reason the first "eject" didn't open the tray we
should return with error.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agoRevert "maint: prefer enum over int for virstoragefile structs"
Eric Blake [Sat, 17 May 2014 00:50:03 +0000 (18:50 -0600)]
Revert "maint: prefer enum over int for virstoragefile structs"

This partially reverts commits b279e52f7 and ea18f8b2.

It turns out our code base is full of:

if ((struct.member = virBlahFromString(str)) < 0)
    goto error;

Meanwhile, the C standard says it is up to the compiler whether
an enum is signed or unsigned when all of its declared values
happen to be positive.  In my testing (Fedora 20, gcc 4.8.2),
the compiler picked signed, and nothing changed.  But others
testing with gcc 4.7 got compiler warnings, because it picked
the enum to be unsigned, but no unsigned value is less than 0.
Even worse:

if ((struct.member = virBlahFromString(str)) <= 0)
    goto error;

is silently compiled without warning, but incorrectly treats -1
from a bad parse as a large positive number with no warning; and
without the compiler's help to find these instances, it is a
nightmare to maintain correctly.  We could force signed enums
with a dummy negative declaration in each enum, or cast the
result of virBlahFromString back to int after assigning to an
enum value, or use a temporary int for collecting results from
virBlahFromString, but those actions are all uglier than what we
were trying to cure by directly using enum types for struct
values in the first place.  It's better off to just live with int
members, and use 'switch ((virFoo) struct.member)' where we want
the compiler to help, than to track down all the conversions from
string to enum and ensure they don't suffer from type problems.

* src/util/virstorageencryption.h: Revert back to int declarations
with comment about enum usage.
* src/util/virstoragefile.h: Likewise.
* src/conf/domain_conf.c: Restore back to casts in switches.
* src/qemu/qemu_driver.c: Likewise.
* src/qemu/qemu_command.c: Add cast rather than revert.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoFix crash in DAC driver with no seclabels
Ján Tomko [Mon, 19 May 2014 11:50:52 +0000 (13:50 +0200)]
Fix crash in DAC driver with no seclabels

With dynamic_ownership = 1 but no seclabels, RestoreChardevLabel
dereferences the NULL seclabel when checking if norelabel is set.

Remove this check, since it is already done in RestoreSecurityAllLabel
and if norelabel is set, RestoreChardevLabel is never called.

10 years agoparallels: create VMs in the default place
Dmitry Guryanov [Wed, 7 May 2014 18:04:09 +0000 (22:04 +0400)]
parallels: create VMs in the default place

Each VM consists of a set of files in PCS: config, hard
disk images, log file, memory dump. All these files are stored
in a per-vm directory. When we create a new VM, we can ether specify
path to the VM or create the VM in a default path
(<default path>/<vm name>.pvm). This default path can be configured
with command
prlsrvctl user set --def-vm-home <path> command.

Currenty parallels driver creates VM in the same place, where first
hard disk is located. Let's change this logic and create VMs in
the default path. It will be much clearer and allow us to create
VMs without hard disks.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
10 years agoparallels: add disks correctly
Dmitry Guryanov [Wed, 7 May 2014 18:04:08 +0000 (22:04 +0400)]
parallels: add disks correctly

Disks support in this driver was implemented with an assumption,
that disk images can't be created by hand, without VM. So
complex storage driver was implemented with workaround.

This is not true, we can create new disks using ploop tool.
So the first step to reimplement disks support in parallels
driver is to do not use information from the storage driver,
until we will implement VIR_STORAGE_TYPE_VOLUME disks.

So after this patch disks can be added in the same way as
in any other driver: you create a disk image and then add
an entry to the XML definition of the domain with path to that
image file, for example:

<disk type='file' device='disk'>
  <driver type='ploop'/>
  <source file='/storage/harddisk1.hdd'/>
  <target dev='sda' bus='sata'/>
  <address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>

This patch makes parallels storage driver useless, but I'll fix it
later. Now you can create an image by hand, using ploop tool,
and then add it to some domain.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
10 years agoparallels: set file format in virDomainDef
Dmitry Guryanov [Wed, 7 May 2014 18:04:07 +0000 (22:04 +0400)]
parallels: set file format in virDomainDef

Set file format in virDomainDef structure to produce correct
XML in virDomainGetXMLDesc function.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
10 years agoparallels: add VIR_STORAGE_FILE_PLOOP format
Dmitry Guryanov [Wed, 7 May 2014 18:04:06 +0000 (22:04 +0400)]
parallels: add VIR_STORAGE_FILE_PLOOP format

Add VIR_STORAGE_FILE_PLOOP format. This format is used
to store disk images for virtual machines in PCS and containers
in PCS, OpenVZ and also in Parallels Desktop for Mac.

This format is described on OpenVZ site -
https://openvz.org/Ploop (together with ploop devices). It
consists of XML descriptor and one or more image files: base
image and deltas. Format of the image files described here:
https://openvz.org/Ploop/format.

This patch only adds VIR_STORAGE_FILE_PLOOP constant, consequent
patches will use it in parallels driver.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
10 years agovirSecurityDACRestoreSecurityHostdevLabel: Unmark @def as unused
Michal Privoznik [Mon, 19 May 2014 09:15:52 +0000 (11:15 +0200)]
virSecurityDACRestoreSecurityHostdevLabel: Unmark @def as unused

The domain definition is clearly used a few lines
below so there's no need to mark @def as unused.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agodocs: add a serial device with a seclabel example
Ján Tomko [Fri, 16 May 2014 14:52:41 +0000 (16:52 +0200)]
docs: add a serial device with a seclabel example

10 years agoconf: fix seclabels for chardevs
Ján Tomko [Fri, 16 May 2014 12:31:28 +0000 (14:31 +0200)]
conf: fix seclabels for chardevs

We allow a seclabel to be specified in the <source> element
of a chardev:

<serial type='file'>
  <source path='/tmp/serial.file'>
    <seclabel model='dac' relabel='no'/>
  </source>
</serial>

But we format it outside the source:

<serial type='file'>
  <source path='/tmp/serial.file'/>
  <target port='0'/>
    <seclabel model='dac' relabel='no'/>
</serial>

Move the formatting inside the source to fix this to make the
seclabel persistent across XML format->parse.

Introduced by commit f8b08d0 'Add <seclabel> to character devices.'

10 years agoRename virDomainDiskSourceDefFormatSeclabel
Ján Tomko [Fri, 16 May 2014 12:55:17 +0000 (14:55 +0200)]
Rename virDomainDiskSourceDefFormatSeclabel

Drop the 'Disk' from the name, as there is nothing disk-specific
about the function.

10 years agosecurity_dac: honor relabel='no' in chardev config
Jim Fehlig [Thu, 15 May 2014 22:24:43 +0000 (16:24 -0600)]
security_dac: honor relabel='no' in chardev config

The DAC driver ignores the relabel='no' attribute in chardev config

  <serial type='file'>
    <source path='/tmp/jim/test.file'>
      <seclabel model='dac' relabel='no'/>
    </source>
    <target port='0'/>
  </serial>

This patch avoids labeling chardevs when relabel='no' is specified.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agosecurity_dac: avoid relabeling hostdevs when relabel='no'
Jim Fehlig [Thu, 15 May 2014 21:58:04 +0000 (15:58 -0600)]
security_dac: avoid relabeling hostdevs when relabel='no'

When relabel='no' at the domain level, there is no need to call
the hostdev relabeling functions.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agosecurity_dac: honor relabel='no' in disk config
Jim Fehlig [Thu, 15 May 2014 21:30:26 +0000 (15:30 -0600)]
security_dac: honor relabel='no' in disk config

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

The DAC driver ignores the relabel='no' attribute in disk config

  <disk type='file' device='floppy'>
    <driver name='qemu' type='raw'/>
    <source file='/some/path/floppy.img'>
      <seclabel model='dac' relabel='no'/>
    </source>
    <target dev='fda' bus='fdc'/>
    <readonly/>
  </disk>

This patch avoid labeling disks when relabel='no' is specified.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agosecurity_dac: avoid relabeling when relabel='no'
Jim Fehlig [Thu, 15 May 2014 22:38:01 +0000 (16:38 -0600)]
security_dac: avoid relabeling when relabel='no'

If relabel='no' at the domain level, no need to attempt relabeling
in virSecurityDAC{Set,Restore}SecurityAllLabel().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agosecurity_dac: rework callback parameter passing
Jim Fehlig [Thu, 15 May 2014 18:15:01 +0000 (12:15 -0600)]
security_dac: rework callback parameter passing

Currently, the DAC security driver passes callback data as

    void params[2];
    params[0] = mgr;
    params[1] = def;

Clean this up by defining a structure for passing the callback
data.  Moreover, there's no need to pass the whole virDomainDef
in the callback as the only thing needed in the callbacks is
virSecurityLabelDefPtr.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agosecurity_dac: cleanup use of enum types
Jim Fehlig [Thu, 15 May 2014 17:35:15 +0000 (11:35 -0600)]
security_dac: cleanup use of enum types

In switch statements, use enum types since it is safer when
adding new items to the enum.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agosecurity_dac: annotate some functions with ATTRIBUTE_NONNULL
Jim Fehlig [Tue, 13 May 2014 21:38:00 +0000 (15:38 -0600)]
security_dac: annotate some functions with ATTRIBUTE_NONNULL

Annotate some static function parameters with ATTRIBUTE_NONNULL
and remove checks for NULL inputs.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agomaint: fix typos related to disk name resolution
Eric Blake [Fri, 16 May 2014 17:12:20 +0000 (11:12 -0600)]
maint: fix typos related to disk name resolution

In a number of APIs, the text implied that a user might have
<target dev='xvda'/> - but common convention is to use "vda",
not "xvda".  For example, virDomainGetDiskErrors was correct,
while virDomainBlockStats was confusing.

* src/libvirt.c: Make examples consistent.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoutil: fix memory leak in failure path of virCgroupKillRecursiveInternal
Chen Hanxiao [Tue, 13 May 2014 08:01:16 +0000 (16:01 +0800)]
util: fix memory leak in failure path of virCgroupKillRecursiveInternal

Don't leak keypath when we fail to kill a process

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
10 years agomaint: prefer enum over int for virstoragefile structs
Eric Blake [Wed, 14 May 2014 22:40:33 +0000 (16:40 -0600)]
maint: prefer enum over int for virstoragefile structs

For internal structs, we might as well be type-safe and let the
compiler help us with less typing required on our part (getting
rid of casts is always nice).  In trying to use enums directly,
I noticed two problems in virstoragefile.h that can't be fixed
without more invasive refactoring: virStorageSource.format is
used as more of a union of multiple enums in storage volume
code (so it has to remain an int), and virStorageSourcePoolDef
refers to pooltype whose enum is declared in src/conf, but where
src/util can't pull in headers from src/conf.

* src/util/virstoragefile.h (virStorageNetHostDef)
(virStorageSourcePoolDef, virStorageSource): Use enums instead of
int for fields of internal types.
* src/qemu/qemu_command.c (qemuParseCommandLine): Cover all values.
* src/conf/domain_conf.c (virDomainDiskSourceParse)
(virDomainDiskSourceFormat): Simplify clients.
* src/qemu/qemu_driver.c
(qemuDomainSnapshotCreateSingleDiskActive)
(qemuDomainSnapshotPrepareDiskExternalBackingInactive)
(qemuDomainSnapshotPrepareDiskExternalOverlayActive)
(qemuDomainSnapshotPrepareDiskInternal): Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agomaint: shorten 'TypeType' function names
Eric Blake [Wed, 14 May 2014 19:48:15 +0000 (13:48 -0600)]
maint: shorten 'TypeType' function names

The VIR_ENUM_DECL/VIR_ENUM_IMPL helper macros already append 'Type'
to the enum name being converted; it looks silly to have functions
with 'TypeType' in their name.  Even though some of our enums have
to have a 'Type' suffix, the corresponding string conversion
functions do not.

* src/conf/secret_conf.h (VIR_ENUM_DECL): Rename virSecretUsageType.
* src/conf/storage_conf.h (VIR_ENUM_DECL): Rename
virStoragePoolAuthType, virStoragePoolSourceAdapterType,
virStoragePartedFsType.
* src/conf/domain_conf.c (virDomainDiskDefParseXML)
(virDomainFSDefParseXML, virDomainFSDefFormat): Update callers.
* src/conf/secret_conf.c (virSecretDefParseUsage)
(virSecretDefFormatUsage): Likewise.
* src/conf/storage_conf.c (virStoragePoolDefParseAuth)
(virStoragePoolDefParseSource, virStoragePoolSourceFormat):
Likewise.
* src/lxc/lxc_controller.c (virLXCControllerSetupLoopDevices):
Likewise.
* src/storage/storage_backend_disk.c
(virStorageBackendDiskPartFormat): Likewise.
* src/util/virstorageencryption.c (virStorageEncryptionSecretParse)
(virStorageEncryptionSecretFormat): Likewise.
* tools/virsh-secret.c (cmdSecretList): Likewise.
* src/libvirt_private.syms (secret_conf.h, storage_conf.h): Export
corrected names.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agomaint: use enum typedef for virstorageencryption.h
Eric Blake [Wed, 14 May 2014 19:36:56 +0000 (13:36 -0600)]
maint: use enum typedef for virstorageencryption.h

Continuing the work of consistent enum cleanups; this time in
virstorageencryption.h.

* src/util/virstorageencryption.h (virStorageEncryptionFormat):
Convert to typedef, renaming to avoid collision with function.
(virStorageEncryptionSecret, virStorageEncryption): Directly use
enums.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agovbox: fix stale comment about vdi storage type
Eric Blake [Wed, 14 May 2014 19:26:28 +0000 (13:26 -0600)]
vbox: fix stale comment about vdi storage type

The code had some todo's about adding 'vdi' to the list of
virStorageType, but we've already done that.

* src/vbox/vbox_tmpl.c (vboxStorageVolCreateXML)
(vboxStorageVolGetXMLDesc): Use enum value for vdi type.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoqemu: Implement virDomain{Get,Set}Time
Michal Privoznik [Wed, 2 Apr 2014 17:05:42 +0000 (19:05 +0200)]
qemu: Implement virDomain{Get,Set}Time

One caveat though, qemu-ga is expecting time and returning time
in nanoseconds. With all the buffering and propagation delay, the
time is already wrong once it gets to the qemu-ga, but there's
nothing we can do about it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agovirsh: Expose virDomain{Get,Set}Time
Michal Privoznik [Wed, 2 Apr 2014 16:50:12 +0000 (18:50 +0200)]
virsh: Expose virDomain{Get,Set}Time

These APIs are exposed under new virsh command 'domtime' which both gets
and sets (not at the same time of course :)).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoIntroduce virDomain{Get,Set}Time APIs
Michal Privoznik [Wed, 2 Apr 2014 16:25:07 +0000 (18:25 +0200)]
Introduce virDomain{Get,Set}Time APIs

These APIs allow users to get or set time in a domain, which may come
handy if the domain has been resumed just recently and NTP is not
configured or hasn't kicked in yet and the guest is running
something time critical. In addition, NTP may refuse to re-set the clock
if the skew is too big.

In addition, new ACL attribute is introduced 'set_time'.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoqemu: Avoid leak in qemuDomainCheckRemoveOptionalDisk
Jiri Denemark [Thu, 15 May 2014 11:11:12 +0000 (13:11 +0200)]
qemu: Avoid leak in qemuDomainCheckRemoveOptionalDisk

Coverity complains about event being leaked in
qemuDomainCheckRemoveOptionalDisk. The best fix for it is to remove the
disk directly since we already know its index.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agosecurity_dac: Fix indentation
Jim Fehlig [Wed, 14 May 2014 17:38:53 +0000 (11:38 -0600)]
security_dac: Fix indentation

10 years agosecurity_dac: Remove unnecessary curly braces
Jim Fehlig [Wed, 14 May 2014 17:37:27 +0000 (11:37 -0600)]
security_dac: Remove unnecessary curly braces

10 years agosecurity_dac: Remove unnecessary ATTRIBUTE_UNUSED
Jim Fehlig [Wed, 14 May 2014 17:30:53 +0000 (11:30 -0600)]
security_dac: Remove unnecessary ATTRIBUTE_UNUSED

Remove ATTRIBUTE_UNUSED on several function parameters that are
actually used.

10 years agovirsh: reject undefine --wipe-storage without also naming storage
Li Yang [Wed, 14 May 2014 06:15:37 +0000 (02:15 -0400)]
virsh: reject undefine --wipe-storage without also naming storage

For now, if only '--wipe-storage' is assigned, user can undefine a
domain normally. But actually '--wipe-storage' doesn't do anything,
and this may confuse user. Better is to require that '--wipe-storage'
only works if the user specifies volumes to be removed.

Before:
$ virsh undefine virt-tests-vm1 --wipe-storage
Domain virt-tests-vm1 has been undefined

After:
$ virsh undefine virt-tests-vm1 --wipe-storage
error: '--wipe-storage' requires '--storage <string>' or '--remove-all-storage'

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoconf: use typedefs for enums in "src/conf/snapshot_conf.h"
Julio Faracco [Sun, 11 May 2014 15:08:51 +0000 (12:08 -0300)]
conf: use typedefs for enums in "src/conf/snapshot_conf.h"

In "src/conf/" there are many enumeration (enum) declarations.
Similar to the recent cleanup to "src/util" directory, it's
better to use a typedef for variable types, function types and
other usages. Other enumeration and folders will be changed to
typedef's in the future. Most of the files changed in this
commit are related to snapshot (snapshot_conf) enums.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoconf: use typedefs for enums in "src/conf/storage_conf.h"
Julio Faracco [Sun, 11 May 2014 15:08:50 +0000 (12:08 -0300)]
conf: use typedefs for enums in "src/conf/storage_conf.h"

In "src/conf/" there are many enumeration (enum) declarations.
Similar to the recent cleanup to "src/util" directory, it's
better to use a typedef for variable types, function types and
other usages. Other enumeration and folders will be changed to
typedef's in the future. Most of the files changed in this
commit are related to storage (storage_conf) enums.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoconf: use typedefs for enums in "src/conf/nwfilter_conf.h"
Julio Faracco [Sun, 11 May 2014 15:08:49 +0000 (12:08 -0300)]
conf: use typedefs for enums in "src/conf/nwfilter_conf.h"

In "src/conf/" there are many enumeration (enum) declarations.
Similar to the recent cleanup to "src/util" directory, it's better
to use a typedef for variable types, function types and other
usages. Other enumeration and folders will be changed to typedef's
in the future. Most of the files changed in this commit are related
to network filter (nwfilter_conf) enums.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoqemu: Ignore temporary job errors when checking migration status
Jiri Denemark [Tue, 13 May 2014 12:45:31 +0000 (14:45 +0200)]
qemu: Ignore temporary job errors when checking migration status

When qemu driver is polling for migration to finish (in
qemuMigrationWaitForCompletion), it may happen that another job allowed
during migration is running and if it does not finish within 30 seconds,
migration would be cancelled because of that. However, we can just
ignore the timeout and let the waiting loop try again later.

If an event fired at the end of migration is ever implemented in QEMU,
we can just wait for the event instead of polling for migration status
and libvirt will behave consistently, i.e., migration won't be cancelled
in case another job started during migration takes long time to finish.

For bug https://bugzilla.redhat.com/show_bug.cgi?id=1083238

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agoqemu: Make qemuProcess{Start,Stop}CPUs easier to follow
Jiri Denemark [Wed, 14 May 2014 11:22:34 +0000 (13:22 +0200)]
qemu: Make qemuProcess{Start,Stop}CPUs easier to follow

As a side effect, the return value of qemuDomainObjEnterMonitorAsync is
not directly used as the return value of qemuProcess{Start,Stop}CPUs.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agoqemuDomainObjBeginNestedJob: Return -2 for temporary failures
Jiri Denemark [Tue, 13 May 2014 12:39:35 +0000 (14:39 +0200)]
qemuDomainObjBeginNestedJob: Return -2 for temporary failures

If job queue is full or waiting for a job times out, the function
returns -2 so that it can be handled in a different way by callers.

The change is safe since all existing callers of
qemuDomainObjBeginNestedJob check the return value to be less than zero.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agoqemu: Make qemuDomainObjBeginNestedJob static
Jiri Denemark [Tue, 13 May 2014 12:34:55 +0000 (14:34 +0200)]
qemu: Make qemuDomainObjBeginNestedJob static

It's only used within qemu_domain.c.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agoqemu: snapshot: Terminate job when memory compression program isn't found
Peter Krempa [Wed, 14 May 2014 07:43:52 +0000 (09:43 +0200)]
qemu: snapshot: Terminate job when memory compression program isn't found

If the compression program for external snapshot memory image isn't
found we exitted the function without terminating the domain job. This
caused the domain to be unusable.

The problem was introduced in commit 7df5093f.

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

10 years agoqemu: extract common PCI handling functions
Roman Bogorodskiy [Tue, 13 May 2014 16:10:40 +0000 (20:10 +0400)]
qemu: extract common PCI handling functions

Move sharable PCI handling functions to domain_addr.[ch], and
change theirs prefix from 'qemu' to 'vir':

 - virDomainPCIAddressAsString;
 - virDomainPCIAddressBusSetModel;
 - virDomainPCIAddressEnsureAddr;
 - virDomainPCIAddressFlagsCompatible;
 - virDomainPCIAddressGetNextSlot;
 - virDomainPCIAddressReleaseSlot;
 - virDomainPCIAddressReserveAddr;
 - virDomainPCIAddressReserveNextSlot;
 - virDomainPCIAddressReserveSlot;
 - virDomainPCIAddressSetFree;
 - virDomainPCIAddressSetGrow;
 - virDomainPCIAddressSlotInUse;
 - virDomainPCIAddressValidate;

The only change here is function names, the implementation itself
stays untouched.

Extract common allocation code from DomainPCIAddressSetCreate
into virDomainPCIAddressSetAlloc.

10 years agoqemu: extract PCI handling structs
Roman Bogorodskiy [Sat, 10 May 2014 16:35:24 +0000 (20:35 +0400)]
qemu: extract PCI handling structs

Introduce new files (domain_addr.[ch]) to provide
an API for domain device handling that could be
shared across the drivers.

A list of data types were extracted and moved there:

 qemuDomainPCIAddressBus -> virDomainPCIAddressBus
 qemuDomainPCIAddressBusPtr -> virDomainPCIAddressBusPtr
 _qemuDomainPCIAddressSet -> virDomainPCIAddressSet
 qemuDomainPCIAddressSetPtr -> virDomainPCIAddressSetPtr
 qemuDomainPCIConnectFlags -> virDomainPCIConnectFlags

Also, move the related definitions and macros.

10 years agosanlock: avoid leak in acquire()
Martin Kletzander [Tue, 13 May 2014 11:40:38 +0000 (13:40 +0200)]
sanlock: avoid leak in acquire()

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemu: Adjust size for qcow2/qed if not on sector boundary
John Ferlan [Mon, 12 May 2014 14:21:09 +0000 (10:21 -0400)]
qemu: Adjust size for qcow2/qed if not on sector boundary

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

If qemuDomainBlockResize() is passed a size not on a KiB boundary - that
is passed a size based in bytes (VIR_DOMAIN_BLOCK_RESIZE_BYTES), then
depending on the source format (qcow2 or qed), the value passed must
be on a sector (or 512 byte) boundary. Since other libvirt code quietly
adjusts the capacity values, then do so here as well.

10 years agoRevert "qemu: Adjust size for qcow2/qed if not on sector boundary"
John Ferlan [Mon, 12 May 2014 14:10:11 +0000 (10:10 -0400)]
Revert "qemu: Adjust size for qcow2/qed if not on sector boundary"

This reverts commit e3d66229a1026cd33319714c0ededf650cd261c2.

10 years agovirsh: domain: Fix output of the VNC display number for domdisplay
Peter Krempa [Tue, 13 May 2014 09:26:28 +0000 (11:26 +0200)]
virsh: domain: Fix output of the VNC display number for domdisplay

Commit 9976c4b9a665f10ab0d2071954efb7f432d194eb broke the output for VNC
displays as the port number is converted to VNC display number by
subtracting 5900. This yields port 0 for the first display and thus the
output would be skipped.

Before:
 $ virsh domdisplay VM
 vnc://localhost

After:
 $ tools/virsh domdisplay VM
 vnc://localhost:0

10 years agosanlock: don't fail with unregistered domains
Martin Kletzander [Mon, 12 May 2014 09:38:47 +0000 (11:38 +0200)]
sanlock: don't fail with unregistered domains

When a domain was started without registration in sanlock, but libvirt
was restarted after that, most of the operations failed due to
contacting sanlock about that process.  E.g. migration could not be
performed because the locks couldn't be released (or inquired before a
release).

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agosanlock: code movement in virLockManagerSanlockAcquire
Martin Kletzander [Mon, 12 May 2014 09:38:08 +0000 (11:38 +0200)]
sanlock: code movement in virLockManagerSanlockAcquire

Just move some code around for future patches to ease the review.
With this patch there is no need for drastic cleanup path later.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoapibuild: Disallow 'returns' return description
Michal Privoznik [Mon, 12 May 2014 12:23:18 +0000 (14:23 +0200)]
apibuild: Disallow 'returns' return description

Our documentation generator is a bit messy, to say the least. For
instance, the description to return values of a function is
searched within C comment. Currently, all lines that start with
'returns' or 'Returns' are viewed as return value description.
However, there are some valid uses where the 'returns' word is in
the middle of a sentence describing function behavior not the
return value. And there are no places where 'returns' is used to
describe return values.  For instance:
virDomainDetachDeviceFlags, virConnectNetworkEventRegisterAny and
virDomainGetDiskErrors. This leads to HTML documemtation being
generated incorrectly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoqemu: Support mountpoints option of guest-fsfreeze-freeze
Tomoki Sekiyama [Fri, 2 May 2014 00:06:19 +0000 (20:06 -0400)]
qemu: Support mountpoints option of guest-fsfreeze-freeze

With this patch, virDomainFSFreeze will pass the mountpoints argument
to qemu guest agent. For example,

  virDomainFSFreeze(dom, {"/mnt/vol1", "/mnt/vol2"}, 2, 0)

will issue qemu guest agent command:

  {"execute":"guest-fsfreeze-freeze",
   "arguments":{"mountpoints":["/mnt/vol1","/mnt/vol2"]}}

Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
Acked-by: Daniel P. Berrange <berrange@redhat.com>
10 years agovirsh: Expose new virDomainFSFreeze and virDomainFSThaw API
Tomoki Sekiyama [Fri, 2 May 2014 00:06:13 +0000 (20:06 -0400)]
virsh: Expose new virDomainFSFreeze and virDomainFSThaw API

These are exposed under domfsfreeze command and domfsthaw command.

Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
10 years agoqemu: Implement virDomainFSFreeze and virDomainFSThaw
Tomoki Sekiyama [Fri, 2 May 2014 00:06:07 +0000 (20:06 -0400)]
qemu: Implement virDomainFSFreeze and virDomainFSThaw

Use qemuDomainSnapshotFSFreeze() and qemuDomainSnapshotFSFThaw() which are
already implemented for snapshot quiescing.

Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
10 years agomaint: fix typos related to 'frozen'
Eric Blake [Tue, 13 May 2014 02:15:50 +0000 (20:15 -0600)]
maint: fix typos related to 'frozen'

"Freezed" is not an English word.

* src/lxc/lxc_driver.c (lxcFreezeContainer): Fix typo.
* src/qemu/qemu_driver.c (qemuDomainSnapshotFSFreeze): Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoconf: use typedefs for enums in node_device_conf, nwfilter_params
Julio Faracco [Sun, 11 May 2014 15:08:48 +0000 (12:08 -0300)]
conf: use typedefs for enums in node_device_conf, nwfilter_params

In "src/conf/" there are many enumeration (enum) declarations. Similar
to the recent cleanup to "src/util" directory, it's better to use a
typedef for variable types, function types and other usages. Other
enumeration and folders will be changed to typedef's in the future.
Most of the files changed in this commit are reltaed to Node and
Network (node_device_conf.h and nwfilter_params.*) enums.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agodocs: mention vagrant-libvirt in apps.html
James Shubin [Sun, 11 May 2014 04:24:10 +0000 (00:24 -0400)]
docs: mention vagrant-libvirt in apps.html

Doc patch for apps.html as per: http://libvirt.org/apps.html#add

Disclaimer: I've contributed patches to the project that this commit
adds.

Vagrant-Libvirt is an excellent way to use vagrant with libvirt. This
way you can benefit from the vagrant features, while not loosing access
to the familiar (and useful) tools such as virsh and virt-manager.

Development currently at:

https://github.com/pradels/vagrant-libvirt/

although recent contributors include:

https://github.com/sciurus/vagrant-libvirt/

and:

https://github.com/purpleidea/vagrant-libvirt/

see git log for more details.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoupdate documentation of <interface type='hostdev'>
Chunyan Liu [Thu, 8 May 2014 06:44:05 +0000 (14:44 +0800)]
update documentation of <interface type='hostdev'>

<interface type='hostdev' managed='yes'> is supported, but
nowhere mentions 'managed' in <interface type='hostdev'> syntax.
Update documentation to cover it.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
10 years agolibxl: fix support for <interface type="hostdev"> syntax
Chunyan Liu [Thu, 8 May 2014 06:44:04 +0000 (14:44 +0800)]
libxl: fix support for <interface type="hostdev"> syntax

A VIR_DOMAIN_NET_TYPE_HOSTDEV interface device is really a hostdev
device, which is created by the libxl driver in libxlMakePCIList().
There is no need to create a libxl_device_nic for such hostdev
devices, so skip interfaces of type VIR_DOMAIN_NET_TYPE_HOSTDEV in
libxlMakeNicList().

Signed-off-by: Chunyan Liu <cyliu@suse.com>
10 years agomaint: use $(SED) instead of sed for syntax-check
Roman Bogorodskiy [Sun, 11 May 2014 08:25:44 +0000 (12:25 +0400)]
maint: use $(SED) instead of sed for syntax-check

Some syntax-check rules use GNU sed specific regexps, so make
sure we're using $(SED) instead of sed, which might not be a
GNU sed.

10 years agobhyve: implement connectGetSysinfo
Roman Bogorodskiy [Wed, 23 Apr 2014 09:24:05 +0000 (13:24 +0400)]
bhyve: implement connectGetSysinfo

10 years agoqemu: Implement a stub cpuArchDriver.compare() handler for arm and aarch64
Oleg Strikov [Wed, 7 May 2014 16:38:10 +0000 (20:38 +0400)]
qemu: Implement a stub cpuArchDriver.compare() handler for arm and aarch64

Libvirt calls cpuArchDriver.compare() while doing guest migration.
We don't have any logic to distinguish between different arm and
aarch64 models that's why this patch allows migration to any host.

Signed-off-by: Oleg Strikov <oleg.strikov@canonical.com>
10 years agoESX: add virStorageVolGetInfo in iSCSI backend.
Dawid Zamirski [Fri, 25 Apr 2014 18:20:41 +0000 (14:20 -0400)]
ESX: add virStorageVolGetInfo in iSCSI backend.

Since the ESX storage implements VMFS and iSCSI storage backends and
chooses relevant backend dynamically at runtime, there was a segfault
when issuing vol-info on iSCSI volume due to unimplemented
virStorageGetInfo function. This patch implements that function that was
missing in iSCSI backend and returns expected result without a segfault.

11 years agostorage: Resolve issues in failure path
John Ferlan [Tue, 6 May 2014 18:16:48 +0000 (14:16 -0400)]
storage: Resolve issues in failure path

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

Refactoring in commit id '0c2305b3' resulted in the wrong storage
volume object being passed to the new storageVolDeleteInternal().
It should have passed 'voldef' which is the address found in the
pool->volumes.objs[i] array.  By passing 'voldef', the DeleteInternal
code will find and remove the voldef from the volumes.objs[] list.

11 years agoparallels: add a set of trivial functions
Dmitry Guryanov [Wed, 23 Apr 2014 14:35:03 +0000 (18:35 +0400)]
parallels: add a set of trivial functions

Add functions parallelsIsAlive, parallelsIsEncrypted,
parallelsIsSecure which are very simple to implement, but
may be required by some libvirt users. Almost all other
drivers have these functions.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
11 years agoparallels: don't add domain to the list twice
Dmitry Guryanov [Wed, 23 Apr 2014 14:35:02 +0000 (18:35 +0400)]
parallels: don't add domain to the list twice

There is a problem with function parallelsDomainDefineXML. If we
are defining a new domain, then we need to do 2 things: aclually
create a VM in PCS and add new domain to the cached list of domains
_parallelsConn.domains.

This is done in the function parallelsLoadDomains. So call to
virDomainObjListAdd will return a error, because a domain
with the same name and id will already be in the list.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
11 years agoparallels: don't enable VNC when we define a new domain
Dmitry Guryanov [Wed, 23 Apr 2014 14:35:01 +0000 (18:35 +0400)]
parallels: don't enable VNC when we define a new domain

I added this code year ago, instead of implementing ability
to change VNC configuration, which was not trivial, I added
extra call to prlctl, which sets up VNC with auto port, despite
VNC configuration given by a user.

Let's remove this hack, because, first, it doesn't work on the
latest Parallels Cloud Server release (you have to either specify
--vnc-nopasswd option or password). And also has problem with
error handling. If second call to prlctl fails, VM, created by
first call to prlctl, will not be removed.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
11 years agoparallels: fix virDomainDef.features comparison
Dmitry Guryanov [Wed, 23 Apr 2014 14:35:00 +0000 (18:35 +0400)]
parallels: fix virDomainDef.features comparison

virDomainDef.features became an array, so now we can't simply
compare one features variable to another. We need to compare
each each element from the array.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
11 years agoqemu: Adjust size for qcow2/qed if not on sector boundary
John Ferlan [Tue, 8 Apr 2014 14:59:09 +0000 (10:59 -0400)]
qemu: Adjust size for qcow2/qed if not on sector boundary

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

If qemuDomainBlockResize() is passed a size not on a KiB boundary - that
is passed a size based in bytes (VIR_DOMAIN_BLOCK_RESIZE_BYTES), then
depending on the source format (qcow2 or qed), the value passed must
be on a sector (or 512 byte) boundary. Since other libvirt code quietly
adjusts the capacity values, then do so here as well - of course ensuring
that adjustment still fits.

Signed-off-by: John Ferlan <jferlan@redhat.com>
11 years agoAdd support for timestamping QEMU logs
Ján Tomko [Wed, 9 Apr 2014 13:23:45 +0000 (15:23 +0200)]
Add support for timestamping QEMU logs

QEMU commit 5e2ac51 added a boolean '-msg timestamp=[on|off]'
option, which can enable timestamps on errors:
$ qemu-system-x86_64 -msg timestamp=on zghhdorf
2014-04-09T13:25:46.779484Z qemu-system-x86_64: -msg timestamp=on: could
not open disk image zghhdorf: Could not open 'zghhdorf': No such file or
directory

Enable this timestamp if the QEMU binary supports it.

Add a 'log_timestamp' option to qemu.conf for disabling this behavior.

11 years agoqemu: track quiesced status in qemuDomainSnapshotFSFreeze
Tomoki Sekiyama [Fri, 2 May 2014 00:06:01 +0000 (20:06 -0400)]
qemu: track quiesced status in qemuDomainSnapshotFSFreeze

Adds 'quiesced' status into qemuDomainObjPrivate that tracks whether
FSFreeze is requested in the domain.

It modifies error code from qemuDomainSnapshotFSFreeze and
qemuDomainSnapshotFSThaw, so that a caller can know whether the command is
actually sent to the guest agent. If the error is caused before sending a
freeze command, a counterpart thaw command shouldn't be sent either, not to
confuse fsfreeze status tracking.

Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoremote: Implement virDomainFSFreeze and virDomainFSThaw
Tomoki Sekiyama [Fri, 2 May 2014 00:05:54 +0000 (20:05 -0400)]
remote: Implement virDomainFSFreeze and virDomainFSThaw

New rules are added in fixup_name in gendispatch.pl to keep the name
FSFreeze and FSThaw. This adds a new ACL permission 'fs_freeze',
which is also applied to VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE flag.

Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
Acked-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoIntroduce virDomainFSFreeze() and virDomainFSThaw() public API
Tomoki Sekiyama [Fri, 2 May 2014 00:05:48 +0000 (20:05 -0400)]
Introduce virDomainFSFreeze() and virDomainFSThaw() public API

These will freeze and thaw filesystems within guest specified by
@mountpoints parameters. The parameters can be NULL and 0, then all
mounted filesystems are frozen or thawed. @flags parameter, which are
currently not used, is for future extensions.

Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoudev: consider the device a CDROM when ID_CDROM=1
Giuseppe Scrivano [Wed, 23 Apr 2014 10:42:01 +0000 (12:42 +0200)]
udev: consider the device a CDROM when ID_CDROM=1

Some CDROM devices are reported by udev to have an ID_TYPE="generic"
thus it is necessary to check if ID_CDROM is present.

As a side effect, treating ID_TYPE="generic" as a missing ID_TYPE will
enable checks for ID_DRIVE_FLASH_SD and ID_DRIVE_FLOPPY and the
udevKludgeStorageType heuristic.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agodocs: update README-hacking
Chen Hanxiao [Tue, 6 May 2014 07:02:29 +0000 (15:02 +0800)]
docs: update README-hacking

We don't have a "README-valgrind" file.
So remove related description.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agovirdbus: Make virDBusCall static
Cole Robinson [Sat, 3 May 2014 19:28:08 +0000 (15:28 -0400)]
virdbus: Make virDBusCall static

11 years agovirerror: Fix an error message typo
Cole Robinson [Sat, 3 May 2014 19:36:15 +0000 (15:36 -0400)]
virerror: Fix an error message typo

11 years agoLSN-2014-0003: Don't expand entities when parsing XML
Daniel P. Berrange [Tue, 15 Apr 2014 10:20:29 +0000 (11:20 +0100)]
LSN-2014-0003: Don't expand entities when parsing XML

If the XML_PARSE_NOENT flag is passed to libxml2, then any
entities in the input document will be fully expanded. This
allows the user to read arbitrary files on the host machine
by creating an entity pointing to a local file. Removing
the XML_PARSE_NOENT flag means that any entities are left
unchanged by the parser, or expanded to "" by the XPath
APIs.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agospec: Don't install nonexistent test_libvirt_lockd.aug
Jiri Denemark [Tue, 6 May 2014 07:40:49 +0000 (09:40 +0200)]
spec: Don't install nonexistent test_libvirt_lockd.aug

test_libvirt_lockd.aug is only generated when qemu driver is enabled.

11 years agospec: sanlock is x86_64 only on RHEL
Jiri Denemark [Tue, 6 May 2014 07:39:18 +0000 (09:39 +0200)]
spec: sanlock is x86_64 only on RHEL

11 years agoqemu: specify domain in host-side PCI addresses when needed/supported
Laine Stump [Wed, 30 Apr 2014 11:32:19 +0000 (14:32 +0300)]
qemu: specify domain in host-side PCI addresses when needed/supported

This uses the new QEMU_CAPS_HOST_PCI_MULTIDOMAIN capability when
present, for -devivce pci-assign, -device vfio-pci, and -pcidevice.

While creating tests for this new functionality, I noticed that the
xmls for two existing tests had erroneously specified an
until-now-ignored domain="0x0002", so I corrected those two tests, and
also added two failure tests to be sure that we alert users who
attempt to use a non-zero domain with a qemu that doesn't support it.

11 years agoqemu: add host-pci-multidomain capability
Laine Stump [Tue, 29 Apr 2014 15:11:45 +0000 (18:11 +0300)]
qemu: add host-pci-multidomain capability

Quite a long time ago, (apparently between qemu 0.12 and 0.13) qemu
quietly began supporting the optional specification of a domain in the
host-side address of all pci passthrough commands (by simply
prepending it to the bus:slot.function format, as
"dddd:bb:ss.f"). Since machines with multiple PCI domains are very
rare, this never came up in practice, so libvirt was never updated to
support it.

This patch takes the first step to supporting specification of a non-0
domain in the host-side address of PCI devices being assigned to a
domain, by adding a capability bit to indicate support
"QEMU_CAPS_HOST_PCI_MULTIDOMAIN", and detect it. Since this support
was added in a version prior to the minimum version required for
QMP-style capabilities detection, the capability is always enabled for
any qemu that uses QMP for capabilities detection. For older qemus,
the only clue that a domain can be specified in the host pci address
is the presence of the string "[seg:]" in the help string for
-pcidevice. (Ironically, libvirt will not be modified to support
specification of domain for -pcidevice, since any qemu new enough for
us to care about also supports "-device pci-assign" or "-device
vfio-pci", which are greatly preferred).

11 years agostorageVolCreateXMLFrom: Allow multiple accesses to origvol
Michal Privoznik [Wed, 16 Apr 2014 13:16:20 +0000 (15:16 +0200)]
storageVolCreateXMLFrom: Allow multiple accesses to origvol

When creating a new volume, it is possible to copy data into it from
another already existing volume (referred to as @origvol). Obviously,
the read-only access to @origvol is required, which is thread safe
(probably not performance-wise though). However, with current code
both @newvol and @origvol are marked as building for the time of
copying data from the @origvol to @newvol. The rationale behind
is to disallow some operations on both @origvol and @newvol, e.g.
vol-wipe, vol-delete, vol-download. While it makes sense to not allow
such operations on partly copied mirror, but it doesn't make sense to
disallow vol-create or vol-download on the source (@origvol).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoFix build wihout macvtap or virtualport
Ján Tomko [Tue, 6 May 2014 07:14:05 +0000 (09:14 +0200)]
Fix build wihout macvtap or virtualport

Commit 1b14c44 broke the build on FreeBSD by changing
the signature of a few functions without updating the
corresponding stubs that are used when WITH_MACVTAP
or WITH_VIRTUALPORT is not defined.

11 years agodocs: fix a typo in formatdomain
Chen Hanxiao [Tue, 6 May 2014 03:13:23 +0000 (11:13 +0800)]
docs: fix a typo in formatdomain

s/virual/virtual

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
11 years agoconf: use typedefs for enums in "src/conf/{network,interface}_conf.h"
Julio Faracco [Mon, 28 Apr 2014 00:15:22 +0000 (21:15 -0300)]
conf: use typedefs for enums in "src/conf/{network,interface}_conf.h"

In "src/conf/" there are many enumeration (enum) declarations.
Similar to the recent cleanup to "src/util" directory, it's
better to use a typedef for variable types, function types and
other usages. Other enumeration and folders will be changed to
typedef's in the future. Most of the files changed in this commit
are reltaed to Network (network_conf.* and interface_conf.*) enums.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoconf: use typedefs for enums in "src/conf/cpu_conf.h"
Julio Faracco [Mon, 28 Apr 2014 00:15:21 +0000 (21:15 -0300)]
conf: use typedefs for enums in "src/conf/cpu_conf.h"

In "src/conf/" there are many enumeration (enum) declarations.
Similar to the recent cleanup to "src/util" directory, it's
better to use a typedef for variable types, function types and
other usages. Other enumeration and folders will be changed to
typedef's in the future. Most of the files changed in this commit
are related to CPU (cpu_conf) enums.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoutil: use typedefs for enums in "src/util/" directory
Julio Faracco [Sun, 27 Apr 2014 00:15:22 +0000 (21:15 -0300)]
util: use typedefs for enums in "src/util/" directory

In "src/util/" there are many enumeration (enum) declarations.
Sometimes, it's better using a typedef for variable types,
function types and other usages. Other enumeration will be
changed to typedef's in the future.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agovirsh: Replace list element to defined variable
Li Yang [Tue, 29 Apr 2014 02:10:18 +0000 (22:10 -0400)]
virsh: Replace list element to defined variable

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
11 years agolibxl: support PARAVIRT reboot flag
Jim Fehlig [Thu, 1 May 2014 21:00:47 +0000 (15:00 -0600)]
libxl: support PARAVIRT reboot flag

Add support for the VIR_DOMAIN_REBOOT_PARAVIRT flag in
libxlDomainReboot().

11 years agolibxl: support PARAVIRT and ACPI shutdown flags
Jim Fehlig [Thu, 1 May 2014 18:11:51 +0000 (12:11 -0600)]
libxl: support PARAVIRT and ACPI shutdown flags

Add support for VIR_DOMAIN_SHUTDOWN_PARAVIRT and
VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN flags in
libxlDomainShutdownFlags().

11 years agoIntroduce a new flag for controlling shutdown/reboot
Jim Fehlig [Thu, 1 May 2014 17:42:54 +0000 (11:42 -0600)]
Introduce a new flag for controlling shutdown/reboot

Add a new flag to virDomain{Reboot,Shutdown}FlagValues to allow
shutting down and rebooting a domain via the Xen paravirt control
interface.