]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
9 years agoqemu: Add libvirt version check to refresh capabilities algorithm
John Ferlan [Sat, 23 May 2015 14:19:20 +0000 (10:19 -0400)]
qemu: Add libvirt version check to refresh capabilities algorithm

Rather than an algorithm based solely on libvirtd ctime to refresh the
capabilities add the element of the libvirt build version into the equation.
Since that version wouldn't be there prior to this code being run - don't
fail on reading the capabilities if not found. In this case, the cache
will always be rebuilt when a new libvirt version is installed.

9 years agoqemu: Force capabilities cache refresh if libvirtd date is different
John Ferlan [Wed, 20 May 2015 12:05:17 +0000 (08:05 -0400)]
qemu: Force capabilities cache refresh if libvirtd date is different

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

Original commit id 'cbde3589' indicates that the cache file would be
discarded if either the QEMU binary or libvirtd 'ctime' changes; however,
the code only discarded if the QEMU binary time didn't match or if the
new libvirtd ctime was later than what created the cache file.

Since many factors come into play with 'ctime' adjustments (including
perhaps turning back the hands of time), change the logic to also force
a refresh if the ctime of libvirt is different than what's in the cache.

9 years agodocs: update github project name
Daniel P. Berrange [Tue, 26 May 2015 14:07:18 +0000 (15:07 +0100)]
docs: update github project name

The github project was renamed from libvirtproject to libvirt

9 years agoqemu: Resolve Coverity RESOURCE_LEAK
John Ferlan [Mon, 18 May 2015 13:16:53 +0000 (09:16 -0400)]
qemu: Resolve Coverity RESOURCE_LEAK

Recent changes to the -M/--machine processing code in qemuParseCommandLine
caused Coverity to determine there was a possible resource leak with how
the 'list' is managed. Rather than try to add virStringFreeList calls
everywhere - just promote list to the top of the variables and free it
within the error processing code. Also required a couple of other tweaks
in order to avoid double free's.

9 years agoconf: Resolve Coverity NEGATIVE_RETURNS
John Ferlan [Mon, 18 May 2015 12:42:46 +0000 (08:42 -0400)]
conf: Resolve Coverity NEGATIVE_RETURNS

Commit id '73eda710' added virDomainKeyWrapDefParseXML which uses
virXPathNodeSet, but does not handle a -1 return thus causing a possible
loop condition exit problem later when the return value is used.

Change the logic to return the value from virXPathNodeSet if <= 0

9 years agostorage: fs: Only force directory permissions if required
Cole Robinson [Mon, 27 Apr 2015 20:48:05 +0000 (16:48 -0400)]
storage: fs: Only force directory permissions if required

Only set directory permissions at pool build time, if:

- User explicitly requested a mode via the XML
- The directory needs to be created
- We need to do the crazy NFS root-squash workaround

This allows qemu:///session to call build on an existing directory
like /tmp.

9 years agoconf: storage: Don't emit empty <permissions> block
Cole Robinson [Thu, 21 May 2015 19:15:24 +0000 (15:15 -0400)]
conf: storage: Don't emit empty <permissions> block

9 years agostorage: conf: Don't set any default <mode> in the XML
Cole Robinson [Mon, 27 Apr 2015 20:48:05 +0000 (16:48 -0400)]
storage: conf: Don't set any default <mode> in the XML

The XML parser sets a default <mode> if none is explicitly passed in.
This is then used at pool/vol creation time, and unconditionally reported
in the XML.

The problem with this approach is that it's impossible for other code
to determine if the user explicitly requested a storage mode. There
are some cases where we want to make this distinction, but we currently
can't.

Handle <mode> parsing like we handle <owner>/<group>: if no value is
passed in, set it to -1, and adjust the internal consumers to handle
it.

9 years agodocs: formatstorage: Update <permissions> docs
Cole Robinson [Thu, 21 May 2015 19:29:39 +0000 (15:29 -0400)]
docs: formatstorage: Update <permissions> docs

- Don't redocument the permissions fields for backingstore, just point to
  the volume docs.
- Clarify that owner/group are inherited from the parent directory at
  volume create/pool build time.
- Clarify that <permissions> fields report runtime values too

9 years agoparallels: fix possible crash in case of errors in prlsdkLoadDomain
Maxim Nestratov [Thu, 21 May 2015 13:49:35 +0000 (16:49 +0300)]
parallels: fix possible crash in case of errors in prlsdkLoadDomain

Cleanup code in prlsdkLoadDomain doesn't take into account the fact
if private domain structure along with freeing function is assigned
or not. In case it is, we shouldn't call it manually because
virDomainObjListRemove calls it and frees pdom.
Also, allocated def structure should be freed only if it's not
assigned to domain. Otherwise it will be called twice: one time by
virDomainObjListRemove and the second by prlsdkLoadDomain itself.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agoparallels: move up updating parameter in prlsdkLoadDomain
Maxim Nestratov [Thu, 21 May 2015 13:49:34 +0000 (16:49 +0300)]
parallels: move up updating parameter in prlsdkLoadDomain

It is better to get all necessary parameters and check them on newly
created configuration before actually creating a domain with them or
applying them to an existing domain.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agovirsh: reject negative values for scaled integer
Pavel Hrdina [Fri, 22 May 2015 13:56:57 +0000 (15:56 +0200)]
virsh: reject negative values for scaled integer

Some virsh commands have a size parameter, which is handled as scaled
integer.  We don't have any *feature* that would allow to use '-1' as
maximum size, so it's safe to reject any negative values for those
commands.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agodocs: Document new RO repo mirrors
Michal Privoznik [Sat, 23 May 2015 05:48:37 +0000 (07:48 +0200)]
docs: Document new RO repo mirrors

In the upstream discussion on creating a github mirror [1], it turned
out that there are some read-only mirrors of our repository. Lets
advertise them on our downloads page. But do it wisely and discourage
people in sending a pull requests on GitHub.

1: https://www.redhat.com/archives/libvir-list/2015-May/msg00775.html

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agonetwork: Resolve Coverity FORWARD_NULL
John Ferlan [Wed, 13 May 2015 15:10:47 +0000 (11:10 -0400)]
network: Resolve Coverity FORWARD_NULL

To silence Coverity just add a 'p &&' in front of the check in
networkFindUnusedBridgeName after the strchr() call.  Even though
we know it's not possible to have strchr return NULL since the only
way into the function is if there is a '%' in def->bridge or it's NULL.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoconf: Resolve Coverity FORWARD_NULL
John Ferlan [Wed, 13 May 2015 10:50:48 +0000 (06:50 -0400)]
conf: Resolve Coverity FORWARD_NULL

Even though it's been pointed out they are false positives:

http://www.redhat.com/archives/libvir-list/2015-May/msg00301.html

and

http://www.redhat.com/archives/libvir-list/2015-May/msg00302.html

these still show up as Coverity issues. In order to silence Coverity
add an 'sa_assert' prior to check failure.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agostorage: Resolve Coverity FORWARD_NULL
John Ferlan [Wed, 13 May 2015 10:24:50 +0000 (06:24 -0400)]
storage: Resolve Coverity FORWARD_NULL

Coverity points out it's possible for one of the virCommand{Output|Error}*
API's to have not allocated 'output' and/or 'error' in which case the
strstr comparison will cause a NULL deref

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agozfs: fix storagepoolxml2xml test
Roman Bogorodskiy [Sat, 23 May 2015 19:46:35 +0000 (22:46 +0300)]
zfs: fix storagepoolxml2xml test

Commit c4d27bd dropped output of owner/group -1.

Update zfs tests accordingly.

9 years agobhyve: fix build with gcc48
Roman Bogorodskiy [Sat, 23 May 2015 16:56:43 +0000 (19:56 +0300)]
bhyve: fix build with gcc48

Build with gcc 4.8 fails with:

bhyve/bhyve_monitor.c: In function 'bhyveMonitorIO':
bhyve/bhyve_monitor.c:51:18: error: missing initializer for field 'tv_sec' of 'const struct timespec' [-Werror=missing-field-initializers]
     const struct timespec zerowait = {};

Explicitly initialize zerowait to fix the build.

9 years agoAdd missing XDR_FLAGS
Pavel Fedin [Thu, 21 May 2015 16:02:22 +0000 (19:02 +0300)]
Add missing XDR_FLAGS

Fixes build problems on x86_64-cygwin host for aarch64 target:
  CC       lxc/libvirt_driver_lxc_impl_la-lxc_monitor_protocol.lo
In file included from lxc/lxc_monitor_protocol.c:7:0:
lxc/lxc_monitor_protocol.h:9:21: fatal error: rpc/rpc.h: No such file or directory

  CC       rpc/libvirt_setuid_rpc_client_la-virnetmessage.lo
In file included from rpc/virnetmessage.h:24:0,
                 from rpc/virnetmessage.c:26:
rpc/virnetprotocol.h:9:21: fatal error: rpc/rpc.h: No such file or directory

  CC       lxc/libvirt_lxc-lxc_monitor_protocol.o
In file included from lxc/lxc_monitor_protocol.c:7:0:
lxc/lxc_monitor_protocol.h:9:21: fatal error: rpc/rpc.h: No such file or directory

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
9 years agoutil: better error message after failure to initialize firewall backend
Laine Stump [Thu, 21 May 2015 17:36:18 +0000 (13:36 -0400)]
util: better error message after failure to initialize firewall backend

If the firewalld backend wasn't available and libvirt decides to try
setting up a "direct" backend, it checks for the presence of iptables,
ip6tables, and ebtables. If they are not found, a message like this is logged:

  error : virFirewallValidateBackend:193 : direct firewall backend
          requested, but /usr/sbin/ip6tables is not available:
          No such file or directory

But then at a later time if an attempt is made to use the virFirewall
API, failure will be indicated with:

  error : virFirewallApply:936 : out of memory

This patch changes virFirewallApply to first check if a firewall
backend hadn't been successfully setup, and logs a slightly more
informative message in that case:

  error : virFirewallApply:940 : internal error:
          Failed to initialize a valid firewall backend

This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1223876

9 years agointerface: allow multiple IPv4 addresses + dhcp on a single interface
Laine Stump [Thu, 21 May 2015 15:26:52 +0000 (11:26 -0400)]
interface: allow multiple IPv4 addresses + dhcp on a single interface

As of netcf-0.2.8, netcf supports configuring multipl IPv4 addresses,
as well as simultaneously configuring dhcp and static IPv4 addresses,
on a single interface. This patch updates libvirt's interface.rng to
allow such configurations.

This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1223688

9 years agonetdev: fail when setting up an SRIOV VF if PF is offline
Laine Stump [Tue, 5 May 2015 22:27:47 +0000 (18:27 -0400)]
netdev: fail when setting up an SRIOV VF if PF is offline

If an SRIOV PF is offline, the kernel won't complain if you set the
mac address and vlan tag for a VF via this PF, and it will even let
you assign the VF to a guest using PCI device assignment or macvtap
passthrough. But in this case (the PF isn't online), the device won't
be usable in the guest.

Silently setting the PF online would solve the connectivity problem,
but as pointed out by Dan Berrange, when an interface is set online
with no associated config, the kernel will by default turn on IPv6
autoconf, which could create unexpected security problems for the
host. For this reason, this patch instead logs an error and fails the
operation.

This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=893738

Originally filed against RHEL6, but present in every version of
libvirt until today.

9 years agostorage: conf: Don't output owner/group -1
Cole Robinson [Tue, 5 May 2015 15:58:12 +0000 (11:58 -0400)]
storage: conf: Don't output owner/group -1

-1 is just an internal placeholder and is meaningless to output in the XML.

9 years agonode_device: fix libvirt build if WITH_HAL is defined
Maxim Nestratov [Thu, 21 May 2015 17:23:56 +0000 (20:23 +0300)]
node_device: fix libvirt build if WITH_HAL is defined

commit ffc40b63b50ecb changed uniond _virNodeDevCapData into a typedef
named virNodeDevCapData with a struct that contains the union as well
as a type enum. This change necessitated changing every reference to
"caps->type" into "caps->data.type", but the author of that patch
failed to test a build "WITH_HAL". This patch fixes the one place in
the hal backend that needed changing.

9 years agosysinfo: Fix reports on ARM
Michal Privoznik [Tue, 12 May 2015 16:21:18 +0000 (18:21 +0200)]
sysinfo: Fix reports on ARM

Due to a kernel commit (b4b8f770e), cpuinfo format has changed on
ARMs. Firstly, 'Processor: ...' may not be reported, it's
replaced by 'model name: ...'. Secondly, the "Processor" string
may occur in CPU name, e.g. 'ARMv7 Processor rev 5 (v7l)'.
Therefore, we must firstly look for 'model name' and then for
'Processor' if not found.
Moreover, lines in the cpuinfo file are shuffled, so we better
not manipulate the pointer to start of internal buffer as we may
lost some info.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemuDomainDetachChrDevice: Fix chardev hot-unplug
Michal Privoznik [Mon, 11 May 2015 15:05:21 +0000 (17:05 +0200)]
qemuDomainDetachChrDevice: Fix chardev hot-unplug

Not every chardev is plugged onto virtio-serial bus. However, the
code introduced in 89e991a2aa36b04 assumes that. Incorrectly.
With previous patches we have three options where a chardev can
be plugged: virtio-serial, USB and PCI. This commit fixes the
detach part. However, since we are not auto allocating USB
addresses yet, I'm just marking the place where appropriate code
should go.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemuDomainAttachChrDevice: Fix chardev hotplug
Michal Privoznik [Mon, 11 May 2015 13:20:54 +0000 (15:20 +0200)]
qemuDomainAttachChrDevice: Fix chardev hotplug

Not every chardev is plugged onto virtio-serial bus. However, the
code introduced in 89e991a2aa36b04 assumes that. Incorrectly.
With previous patches we have three options where a chardev can
be plugged: virtio-serial, USB and PCI. This commit fixes the
attach part.  However, since we are not auto allocating USB
addresses yet, I'm just marking the place where appropriate code
should go.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemu: Implement pci-serial
Michal Privoznik [Wed, 6 May 2015 15:50:03 +0000 (17:50 +0200)]
qemu: Implement pci-serial

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

Implementation is pretty straight-forward. Of course, not all qemus
out there supports the device, so new capability is introduced and
checked prior each use of the device.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoIntroduce pci-serial
Michal Privoznik [Wed, 6 May 2015 15:42:41 +0000 (17:42 +0200)]
Introduce pci-serial

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

Like usb-serial, the pci-serial device allows a serial device to be
attached to PCI bus. An example XML looks like this:

  <serial type='dev'>
    <source path='/dev/ttyS2'/>
    <target type='pci-serial' port='0'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
  </serial>

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoutil: Avoid shadow of 'ulong' in virMemoryMaxValue
Peter Krempa [Thu, 21 May 2015 14:50:19 +0000 (16:50 +0200)]
util: Avoid shadow of 'ulong' in virMemoryMaxValue

Old compilers whine:
src/util/virutil.c: In function 'virMemoryMaxValue':
src/util/virutil.c:2612: error: declaration of 'ulong' shadows a global declaration [-Wshadow]
/usr/include/sys/types.h:151: error: shadowed declaration is here [-Wshadow]

s/ulong/capped/ to work around the problem

9 years agoqemu: wire up virDomainSetUserPassword
Ján Tomko [Mon, 18 May 2015 10:42:07 +0000 (12:42 +0200)]
qemu: wire up virDomainSetUserPassword

Base-64 encode the password and pass it to the guest agent
via the 'guest-set-user-password' command.

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

9 years agovirsh: add set-user-password command
Ján Tomko [Mon, 18 May 2015 10:37:38 +0000 (12:37 +0200)]
virsh: add set-user-password command

Expose the virDomainSetUserPassword API in virsh:
virsh set-user-password dom user 123456

9 years agoIntroduce virDomainSetUserPassword API
Ján Tomko [Mon, 18 May 2015 08:33:18 +0000 (10:33 +0200)]
Introduce virDomainSetUserPassword API

For setting passwords of users inside the domain.

With the VIR_DOMAIN_PASSWORD_ENCRYPTED flag set, the password
is assumed to be already encrypted by the method required
by the guest OS.

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

9 years agothreadpool: Switch to detached threads
Jiri Denemark [Tue, 5 May 2015 20:07:12 +0000 (22:07 +0200)]
threadpool: Switch to detached threads

Using joinable threads does not help anything, but it can lead to memory
leaks.

When a worker thread exits, it decreases nWorkers or nPrioWorkers and
once both nWorkers and nPrioWorkers are zero (i.e., the last worker is
gone), quit_cond is signaled. When freeing the pool we first tell all
threads to die and then we are waiting for both nWorkers and
nPrioWorkers to become zero. At this point we already know all threads
are gone. So the only reason for calling virThreadJoin of all workers is
to free the memory allocated for joinable threads. If we avoid
allocating this memory, we don't need to take care of freeing it.

Moreover, any memory associated with a worker thread which died before
we asked it to die (e.g., because virCondWait failed in the thread)
would be lost anyway since virThreadPoolFree calls virThreadJoin only
for threads which were running at the time virThreadPoolFree was called.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoUse virDomainDiskByName where appropriate
Jiri Denemark [Thu, 21 May 2015 09:21:51 +0000 (11:21 +0200)]
Use virDomainDiskByName where appropriate

Most virDomainDiskIndexByName callers do not care about the index; what
they really want is a disk def pointer.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoAdd wrappers for virDomainDiskIndexBy*
Jiri Denemark [Thu, 21 May 2015 06:53:40 +0000 (08:53 +0200)]
Add wrappers for virDomainDiskIndexBy*

Sometimes the only thing we need is the pointer to virDomainDiskDef and
having to call virDomainDiskIndexBy* APIs, storing the disk index, and
looking it up in the disks array is ugly. After this patch, we can just
call virDomainDiskBy* and get the pointer in one step.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: Log error if domain uses security driver which is not loaded
Erik Skultety [Tue, 5 May 2015 11:24:41 +0000 (13:24 +0200)]
qemu: Log error if domain uses security driver which is not loaded

When starting a domain, if a domain specifies security drivers we do not have
loaded, we fail. However we don't check for this during
reconnect, so any operation relying on security driver functionality would fail.
If someone e.g. starts a domain with selinux driver loaded, then they change
the security driver to 'none' in config, restart the daemon and call dump/save/..,
QEMU will return an error.
As we shouldn't kill the domain, we should at least log an error to let the
user know that domain reconnect wasn't completely clean.

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

9 years agoconf: Restore the XML parser context in virDomainMemoryDefParseXML
Luyao Huang [Thu, 21 May 2015 05:08:12 +0000 (13:08 +0800)]
conf: Restore the XML parser context in virDomainMemoryDefParseXML

After parsing the memory device XML the function would not restore the
XML parser context causing invalid XPath starting point for the rest of
the elements. This is a regression since 3e4230d2.

The test case addition uses the <idmap> element that is currently unused
by qemu, but parsed after the memory device definition and formatted
always.

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

Signed-off-by: Luyao Huang <lhuang@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
9 years agoconf: Catch memory size overflow earlier
Peter Krempa [Tue, 19 May 2015 14:58:24 +0000 (16:58 +0200)]
conf: Catch memory size overflow earlier

virDomainParseMemory parses the size and then rounds up while converting
it to kibibytes. Since the number is limit-checked before the rounding
it's possible to use a number that would be correctly parsed the first
time, but not the second time. For numbers not limited to 32 bit systems
the magic is 9223372036854775807 bytes. That number then can't be parsed
back in kibibytes.

To solve the issue add a second overflow check for the few values that
would cause the problem. Since virDomainParseMemory is used in config
parsing, this avoids vanishing VMs.

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

9 years agovirDomainNumatuneGetMode: Report if numatune was defined
Michal Privoznik [Tue, 19 May 2015 09:55:26 +0000 (11:55 +0200)]
virDomainNumatuneGetMode: Report if numatune was defined

So far, we are not reporting if numatune was even defined. The
value of zero is blindly returned (which maps onto
VIR_DOMAIN_NUMATUNE_MEM_STRICT). Unfortunately, we are making
decisions based on this value. Instead, we should not only return
the correct value, but report to the caller if the value is valid
at all.

For better viewing of this patch use '-w'.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoTaint domains using cdrom-passthrough
John Ferlan [Tue, 12 May 2015 19:58:31 +0000 (15:58 -0400)]
Taint domains using cdrom-passthrough

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

For a domain configured using the host cdrom, we should taint the domain
due to problems encountered when the host and guest try to control the tray.

9 years agovirfile: virDirCreate: Drop redundant FORCE_PERMS flag
Cole Robinson [Tue, 5 May 2015 16:22:08 +0000 (12:22 -0400)]
virfile: virDirCreate: Drop redundant FORCE_PERMS flag

The only two virDirCreate callers already use it

9 years agovirfile: virDirCreate: Fix ALLOW_EXIST conditional
Cole Robinson [Tue, 5 May 2015 16:34:41 +0000 (12:34 -0400)]
virfile: virDirCreate: Fix ALLOW_EXIST conditional

I screwed this up in the previous (post 1.2.16) commits

9 years agoqemu: Fix numatune nodeset reporting
Martin Kletzander [Mon, 18 May 2015 21:55:10 +0000 (14:55 -0700)]
qemu: Fix numatune nodeset reporting

Since af2a1f0587d88656f2c14265a63fbc11ecbd924e,
qemuDomainGetNumaParameters() returns invalid value for a running
guest.  The problem is that it is getting the information from cgroups,
but the parent cgroup is being left alone since the mentioned commit.
Since the running guest's XML is in sync with cgroups, there is no need
to look into cgroups (unless someone changes the configuration behind
libvirt's back).  Returning the info from the definition fixes a bug and
is also a cleanup.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1221047
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoxenconfig: fix spice mousemode and copypaste
Jim Fehlig [Thu, 23 Apr 2015 23:00:26 +0000 (17:00 -0600)]
xenconfig: fix spice mousemode and copypaste

From xl.cfg950 man page:

spiceagent_mouse=BOOLEAN
Whether SPICE agent is used for client mouse mode. The default is
true (1) (turn on)

spicevdagent=BOOLEAN
Enables spice vdagent. The Spice vdagent is an optional component for
enhancing user experience and performing guest-oriented management
tasks. Its features includes: client mouse mode (no need to grab
mouse by client, no mouse lag), automatic adjustment of screen
resolution, copy and paste (text and image) between client and domU.
It also requires vdagent service installed on domU o.s. to work.
The default is 0.

spice_clipboard_sharing=BOOLEAN
Enables Spice clipboard sharing (copy/paste). It requires spicevdagent
enabled. The default is false (0).

So if spiceagent_mouse is enabled (client mouse mode) or
spice_clipboard_sharing is enabled, spicevdagent must be enabled.
Along with this change, s/spicedvagent/spicevdagent, set
spiceagent_mouse correctly, and add a test for these spice
features.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoxenconfig: fix spicepasswd handling
Jim Fehlig [Thu, 23 Apr 2015 22:00:45 +0000 (16:00 -0600)]
xenconfig: fix spicepasswd handling

The logic related to spicedisable_ticketing and spicepasswd was
inverted.  As per man xl.cfg(5), 'spicedisable_ticketing = 1'
means no passwd is required.  On the other hand, a passwd is
required if 'spicedisable_ticketing = 0'.  Fix the logic and
produce and error if 'spicedisable_ticketing = 0' but spicepasswd
is not provided.  Also fix the spice cfg test file.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoxenconfig: format spice listenAddr when formating ports
Jim Fehlig [Thu, 23 Apr 2015 21:42:50 +0000 (15:42 -0600)]
xenconfig: format spice listenAddr when formating ports

Move formating of spice listenAddr to the section of code
where spice ports are formatted.  It is more logical to
format address and ports together.  Account for the change
in spice cfg test file by moving 'spicehost'.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoxenconfig: use local variable for graphics def
Jim Fehlig [Thu, 23 Apr 2015 21:26:04 +0000 (15:26 -0600)]
xenconfig: use local variable for graphics def

'graphics->' is a bit easier to read and type, and makes for
shorter lines than 'def->graphics[0]->'.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agonode_device: replace duplicated code in hal and udev backends
Laine Stump [Mon, 11 May 2015 17:50:37 +0000 (13:50 -0400)]
node_device: replace duplicated code in hal and udev backends

Both the hal and udev drivers call virPCI*() functions to the the
SRIOV VF/PF info about PCI devices, and the UDEV backend calls
virPCI*() to get IOMMU group info. Since there is now a single
function call in node_device_linux_sysfs.c to do all of this, replace
all that code in the two backends with calls to
nodeDeviceSysfsGetPCIRelatedDevCaps().

Note that this results in the HAL driver (probably) unnecessarily
calling virPCIDevieAddressGetIOMMUGroupNum(), but in the case that the
host doesn't support IOMMU groups, that function turns into a NOP (it
returns -2, which causes the caller to skip the call to
virPCIDeviceAddressGetIOMMUGroupAddresses()). So in the worst case it
is a few extra cycles spent, and in the best case a mythical platform
that supported IOMMU groups but used HAL rather than UDEV would gain
proper reporting of IOMMU group info.

9 years agonode_device: update sriov/iommu info before dumpxml of a device
Laine Stump [Mon, 11 May 2015 17:40:21 +0000 (13:40 -0400)]
node_device: update sriov/iommu info before dumpxml of a device

Because reloading a PF driver with a different number of VFs doesn't
result in any sort of event sent from udev to the libvirt node_device
driver, libvirt's cache of that info can be out of date when a request
arrives for the info about a device. To fix this, we refresh that data
at the time of the dumpxml request, similar to what is already done
for netdev link info and SCSI host capabilities.

Since the same is true for iommu group information (for example, some
other device in the same iommu group could have been detached from the
host), we also create a function to update the iommu group info from
sysfs, and a common function that does both. (a later patch will call
this common function from the udev and hal backends).

This resolves:

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

9 years agonode_device: new functions to get sriov/iommu info from sysfs
Laine Stump [Mon, 11 May 2015 17:35:50 +0000 (13:35 -0400)]
node_device: new functions to get sriov/iommu info from sysfs

The udev and hal drivers both already call the same functions as these
new functions added to node_device_linux_sysfs.c, but 1) we need to
call them from node_device_driver.c, and 2) it would be nice to
eliminate the duplicated code from the hal and udev backends.

9 years agonode device: prepare node_device_linux_sysfs.c to add more functions
Laine Stump [Wed, 6 May 2015 20:40:39 +0000 (16:40 -0400)]
node device: prepare node_device_linux_sysfs.c to add more functions

This file contains only a single function, detect_scsi_host_caps(),
which is declared in node_device_driver.h and called from both the hal
and udev backends. Other things common to the hal and udev drivers
can be placed in that file though. As a prelude to adding further
functions, this patch renames the existing function to something
closer in line with other internal libvirt function names
(nodeDeviceSysfsGetSCSIHostCaps()), and puts the declarations into a
separate .h file.

9 years agonodedev: change if-else if in update_caps to switch
Laine Stump [Wed, 6 May 2015 17:51:47 +0000 (13:51 -0400)]
nodedev: change if-else if in update_caps to switch

Makes it nicer as update bits are added for different cap types.

9 years agoconf: make virNodeDevCapData an official type
Laine Stump [Fri, 8 May 2015 16:55:00 +0000 (12:55 -0400)]
conf: make virNodeDevCapData an official type

For some reason a union (_virNodeDevCapData) that had only been
declared inside the toplevel struct virNodeDevCapsDef was being used
as an argument to functions all over the place. Since it was only a
union, the "type" attribute wasn't necessarily sent with it. While
this works, it just seems wrong.

This patch creates a toplevel typedef for virNodeDevCapData and
virNodeDevCapDataPtr, making it a struct that has the type attribute
as a member, along with an anonymous union of everything that used to
be in union _virNodeDevCapData. This way we only have to change the
following:

  s/union _virNodeDevCapData */virNodeDevCapDataPtr /

and

  s/caps->type/caps->data.type/

This will make me feel less guilty when adding functions that need a
pointer to one of these.

9 years agovirsh: Improve handling of send-process-signal --pid.
Andrea Bolognani [Fri, 15 May 2015 16:14:41 +0000 (18:14 +0200)]
virsh: Improve handling of send-process-signal --pid.

Use vshCommandOptLongLong() instead of retrieving the value as a
string and converting it to a number manually.

9 years agovirsh: Fix dommemstat --period option type.
Andrea Bolognani [Fri, 15 May 2015 16:14:40 +0000 (18:14 +0200)]
virsh: Fix dommemstat --period option type.

The option didn't have VSH_OT_INT type even thought it's expected
to be numeric, as shown by the fact that vshCommandOptInt() is later
used to retrieve its value.

9 years agovirsh: Improve error message on integer value parsing failure.
Andrea Bolognani [Fri, 15 May 2015 16:14:39 +0000 (18:14 +0200)]
virsh: Improve error message on integer value parsing failure.

Replace more than 30 ad-hoc error messages with a single, generic one
that contains the name of the option being processed and some hints
to help the user understand what could have gone wrong.

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

9 years agolibvirt: tests: test protected key mgmt ops support
Tony Krowiak [Mon, 27 Apr 2015 21:57:30 +0000 (17:57 -0400)]
libvirt: tests: test protected key mgmt ops support

Test the support for enabling/disabling CPACF protected key management
operations for a guest.

Signed-off-by: Tony Krowiak <akrowiak@linux.vnet.ibm.com>
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agolibvirt: qemu: enable/disable protected key management ops
Tony Krowiak [Mon, 27 Apr 2015 21:57:29 +0000 (17:57 -0400)]
libvirt: qemu: enable/disable protected key management ops

Introduces two new -machine option parameters to the QEMU command to
enable/disable the CPACF protected key management operations for a guest:

    aes-key-wrap='on|off'
    dea-key-wrap='on|off'

The QEMU code maps the corresponding domain configuration elements to the
QEMU -machine option parameters to create the QEMU command:

    <cipher name='aes' state='on'>   --> aes-key-wrap=on
    <cipher name='aes' state='off'>  --> aes-key-wrap=off
    <cipher name='dea' state='on'>   --> dea-key-wrap=on
    <cipher name='dea' state='off'>  --> dea-key-wrap=off

Signed-off-by: Tony Krowiak <akrowiak@linux.vnet.ibm.com>
Signed-off-by: Daniel Hansel <daniel.hansel@linux.vnet.ibm.com>
Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agolibvirt: Introduce protected key mgmt ops
Tony Krowiak [Mon, 27 Apr 2015 21:57:27 +0000 (17:57 -0400)]
libvirt: Introduce protected key mgmt ops

Two new domain configuration XML elements are added to enable/disable
the protected key management operations for a guest:

    <domain>
      ...
      <keywrap>
        <cipher name='aes|dea' state='on|off'/>
      </keywrap>
      ...
    </domain>

Signed-off-by: Tony Krowiak <akrowiak@linux.vnet.ibm.com>
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
Signed-off-by: Daniel Hansel <daniel.hansel@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agolibxl: provide impl for nodeGetSecurityModel
Jim Fehlig [Fri, 15 May 2015 18:26:30 +0000 (12:26 -0600)]
libxl: provide impl for nodeGetSecurityModel

Currently, the libxl driver does not support any security drivers.
When the qemu driver has no security driver configued,
nodeGetSecurityModel succeeds but returns an empty virSecurityModel
object.  Do the same in the libxl driver instead of reporting

this function is not supported by the connection driver:
virNodeGetSecurityModel

9 years agoqemu: log error when domain has an unsupported IDE controller
Laine Stump [Thu, 30 Apr 2015 20:59:04 +0000 (16:59 -0400)]
qemu: log error when domain has an unsupported IDE controller

We have previously effectively ignored all <controller type='ide'>
elements in a domain definition.

On the i440fx-based machinetypes there is an IDE controller that is
included in the chipset and can't be removed (which is the ide
controller with index='0'>), so it makes sense to ignore that one
controller. However, if an i440fx domain definition has a 2nd
controller, nothing catches this error (unless you also have a disk
attached to it, in which case qemu will complain that you're trying to
use the ide controller named "ide1", which doesn't exist), and if any
other type of domain has even a single controller defined, it will be
incorrectly ignored.

Ignoring a bogus controller definition isn't such a big problem, as
long as an error is logged when any disk is attached to that
non-existent controller. But in the case of q35-based machinetypes,
the hardcoded id ("alias" in libvirt terms) of its builtin SATA
controller is "ide", which happens to be the same id as the builtin
IDE controller on i440fx machinetypes. So libvirt creates a
commandline believing that it is connecting the disk to the builtin
(but actually nonexistent) IDE controller, qemu thinks that libvirt
wanted that disk connected to the builtin SATA controller, and
everybody is happy.

Until you try to connect a 2nd disk to the IDE controller. Then qemu
will complain that you're trying to set unit=1 on a controller that
requires unit=0 (SATA controllers are organized differently than IDE
controllers).

After this patch, if a domain has an IDE controller defined for a
machinetype that has no IDE controllers, libvirt will log an error
about the controller itself as it is building the qemu commandline
(rather than a (possible) error from qemu about disks attached to that
controller). This is done by adding IDE to the list of controller
types that are handled in the loop that creates controller command
strings in qemuBuildCommandline() (previously it would *always* skip
IDE controllers). Then qemuBuildControllerDevStr() is modified to log
an appropriate error in the case of IDE controllers.

In the future, if we add support for extra IDE controllers (piix3-ide
and/or piix4-ide) we can just add it into the IDE case in
qemuBuildControllerDevStr(). For now, nobody seems anxious to add
extra support for an aging and very slow controller, when there are so
many better options available.

Resolves:

https://bugzilla.redhat.com/show_bug.cgi?id=1176071 (Fedora)

9 years agoqemu: clean up qemuBuildCommandline loop that builds controller args
Laine Stump [Thu, 14 May 2015 15:10:22 +0000 (11:10 -0400)]
qemu: clean up qemuBuildCommandline loop that builds controller args

Reorganize the loop that builds controller args to remove unnecessary
duplicated code and superfluous else clauses. No functional change.

9 years agoqemu: remove test for allowing ide controller in s390, rename usb tests
Laine Stump [Tue, 5 May 2015 17:09:42 +0000 (13:09 -0400)]
qemu: remove test for allowing ide controller in s390, rename usb tests

Back in 2013, commit 877bc089 added in some tests that made sure no
error was generated on a domain definition that had an automatically
added usb controller if that domain didn't have a PCI bus to attach
the usb controller to. This was done because, at that time, libvirt
was automatically adding a usb controller to *any* domain definition
that didn't have one.  Along with permitting the controller, two
s390-specific tests were added to ensure this behavior was maintained
- one with <controller type='usb' model='none'/> and another (called
"s390-piix-controllers") that had both usb and ide controllers, but
nothing attached to them.

Then in February of this year, commit 09ab9dcc eliminated the annoying
auto-adding of a usb device for s390 and s390x machines, stating:

 "Since s390 does not support usb the default creation of a usb
  controller for a domain should not occur."

Although, as verified here, the s390 doesn't support usb, and usb
controllers aren't currently added to s390 domain definitions
automatically, there are likely still some domain definitions in the
wild that have a usb controller (which was added *by libvirt*, not by
the user), so we will keep the tests verifying that behavior for
now. But this patch changes the names of the tests to reflect that
they don't actually contain a valid s390 config; this way future
developers won't propagate the incorrect idea that an s390 virtual
machine can have a USB (or IDE) bus.

In the case of the IDE controller, though, libvirt has never
automatically added an IDE controller unless a user added an IDE disk
(which itself would have caused an error), and we specifically *do*
want to begin generating an error when someone tries to add an IDE
controller to a domain that can't support one. For that reason, while
renaming the sz390-piix-controllers patch, this patch removes the
<controller type='ide'...> from it (otherwise the upcoming patch would
break make check)

9 years agoqemu: use controller alias when constructing device/controller args
Laine Stump [Thu, 30 Apr 2015 17:19:10 +0000 (13:19 -0400)]
qemu: use controller alias when constructing device/controller args

This makes sure that that the commandlines generated for devices and
controller devices are all using the alias that has been set in the
controller's object as the id of the controller, rather than
hardcoding a printf (or worse, encoding exceptions to the standard
${controller}${index} into the logic)

Since this "fixes" the controller name used for the sata controller,
the commandline arg for the sata controller in the sata test case had
to be adjusted to be "sata0" instead of "ahci0". All other tests
remain unchanged, verifying that the patch causes no other functional
change.

Because the function that finds a controller alias based on a device
def requires a pointer to the full domainDef in order to get the list
of controllers, the arglist of a few functions had to have this added.

9 years agoqemu: fix exceptions in qemuAssignDeviceControllerAlias
Laine Stump [Tue, 12 May 2015 00:51:52 +0000 (20:51 -0400)]
qemu: fix exceptions in qemuAssignDeviceControllerAlias

There are a few extra exceptions that weren't being accounted for when
creating the alias for a controller. This resulted in 1) incorrect
status XML, and 2) exceptions/printfs of what *should* have been
directly available in the controller alias when constructing device
commandline arguments:

1) The primary (and only) IDE controller on a 440FX machinetype is
hardcoded to be "ide" in qemu.

2) The primary SATA controller on a 440FX machinetype is also
hardcoded to be "ide" in qemu.

3) On machinetypes that don't support multiple PCI buses, the PCI bus
is hardcoded in qemu to have the name "pci".

4) The first usb master controller is "usb", all others are the normal
"usb%d". (note that usb controllers that are not a "master" will have
the same index, and thus alias, as the master).

We needed to pass in the full domainDef and qemuCaps in order to
properly make the decisions about these exceptions.

9 years agoconf: utility to return alias of a controller based on type/index
Laine Stump [Wed, 29 Apr 2015 19:37:20 +0000 (15:37 -0400)]
conf: utility to return alias of a controller based on type/index

Because there are multiple potential reasons for an error, this
function logs any errors before returning NULL (since the caller won't
have the information needed to determine which was the reason for
failure).

9 years agoqemu: Don't give up on first error in qemuMigrationCancelDriverMirror
Jiri Denemark [Mon, 11 May 2015 18:15:43 +0000 (20:15 +0200)]
qemu: Don't give up on first error in qemuMigrationCancelDriverMirror

When cancelling drive mirror, always try to do that for all disks even
if it fails for some of them. Report the first error we saw.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: Keep track of what disks are being migrated
Jiri Denemark [Mon, 11 May 2015 18:10:06 +0000 (20:10 +0200)]
qemu: Keep track of what disks are being migrated

Instead of redoing the same filtering over and over everytime we need to
walk through all disks which are being migrated.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoMove QEMU-only fields from virDomainDiskDef into privateData
Jiri Denemark [Wed, 13 May 2015 09:20:36 +0000 (11:20 +0200)]
Move QEMU-only fields from virDomainDiskDef into privateData

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoRename virDomainHasBlockjob as qemuDomainHasBlockjob
Jiri Denemark [Wed, 13 May 2015 07:47:21 +0000 (09:47 +0200)]
Rename virDomainHasBlockjob as qemuDomainHasBlockjob

And move it to qemu_domain.[ch] because this API is QEMU-only.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoAdd privateData to virDomainDiskDef
Jiri Denemark [Wed, 13 May 2015 07:00:02 +0000 (09:00 +0200)]
Add privateData to virDomainDiskDef

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoreject out of range memory in SetMemory APIs
Ján Tomko [Tue, 5 May 2015 15:58:49 +0000 (17:58 +0200)]
reject out of range memory in SetMemory APIs

The APIs take the memory value in KiB and we store it in KiB
internally, but we cannot parse the whole ULONG_MAX range
on 64-bit systems, because virDomainParseScaledValue
needs to fit the value in bytes in an unsigned long long.

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

9 years agoSome alignment fixes in lxc_controller and jsontest
Martin Kletzander [Tue, 12 May 2015 12:40:34 +0000 (14:40 +0200)]
Some alignment fixes in lxc_controller and jsontest

Again, a clean-up for which we don't have proper syntax-check.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agogendispatch: Don't generate long lines
Martin Kletzander [Thu, 7 May 2015 08:02:32 +0000 (10:02 +0200)]
gendispatch: Don't generate long lines

We don't allow it in normal code, why would it need to be in the
generated one.  IT also splits the line in perl code so it's readable.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agovirnetserver: Remove unnecessary double space
Martin Kletzander [Thu, 7 May 2015 08:01:50 +0000 (10:01 +0200)]
virnetserver: Remove unnecessary double space

Since we don't have syntax-check for this, it has to be checked
manually.  Let's hope this is the only place it happened.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agorpc: Don't mix max_clients and max_workers in PostExecRestart
Martin Kletzander [Thu, 7 May 2015 08:01:32 +0000 (10:01 +0200)]
rpc: Don't mix max_clients and max_workers in PostExecRestart

This only affected the servers that re-exec themselves, which is only
virtlockd and it didn't do any mess, so this is mostly a clenaup.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoqemu: Clear autofil fill flag when pinning iothread
John Ferlan [Wed, 6 May 2015 14:19:30 +0000 (10:19 -0400)]
qemu: Clear autofil fill flag when pinning iothread

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

Treat pinning an IOThread via API as if someone added an IOThread to
ensure the iothreadid doesn't cause the guest to disappear

9 years agoconf: Expose iothreadids when delete non sequential iothreadids
John Ferlan [Wed, 6 May 2015 14:13:54 +0000 (10:13 -0400)]
conf: Expose iothreadids when delete non sequential iothreadids

Since 'autofill'd iothreadid entries are not written during XML format
processing, it is possible that if an iothreadid in the middle of an
autofilled list would then change it's id on a subsequent restart.

Thus during the iothreadid deletion, if we determine the delete is not
the "last" thread, then clear the autofill bit for all iothreadid's
following the one being deleted (either the first or one in the middle).
This way, iothreadid's will be printed/saved.

9 years agovirsh: Report an error when cpulist parsing fails
Luyao Huang [Mon, 11 May 2015 08:25:19 +0000 (16:25 +0800)]
virsh: Report an error when cpulist parsing fails

When parsing a cpulist, the virBitmapParse is used. On an invalid
bitmap an error is reported, but the error gets cleared
immediately by subsequent public APIs call, e.g. virDomainFree().
Moreover, we don't check whether bitmap fits into maximal CPU ID
on the host. Therefore the following examples failed without any
error:

 # virsh vcpupin test3 1 aaa

 # virsh vcpupin test3 1 1000

Signed-off-by: Luyao Huang <lhuang@redhat.com>
9 years agoparallels: remove connection wide wait timeout
Nikolay Shirokovskiy [Wed, 13 May 2015 14:23:00 +0000 (17:23 +0300)]
parallels: remove connection wide wait timeout

We have a lot of passing arguments code just to pass connection
object cause it holds jobTimeout. Taking into account that
right now this value is defined at compile time let's just
get rid of it and make arguments list more clear in many
places.

In case we later need some runtime configurable timeout
value we can provide this value through arguments
function already operate such as a parallels domain
object etc as this timeouts are operation( and thus
object) specific in practice.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@parallels.com>
9 years agoqemuMigrationPrepareAny: Drop useless variable @now
zhang bo [Wed, 13 May 2015 05:56:00 +0000 (13:56 +0800)]
qemuMigrationPrepareAny: Drop useless variable @now

As of eeb008dbfcf31 the variable is not used anymore. Drop it.

Signed-off-by: Wang Yufei <james.wangyufei@huawei.com>
Signed-off-by: Zhang Bo <oscar.zhangbo@huawei.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agomaint: Ignore Vim swap files
Andrea Bolognani [Tue, 5 May 2015 11:34:06 +0000 (13:34 +0200)]
maint: Ignore Vim swap files

This removes some noise when you're working on the repository
and also have a bunch of source files open in Vim in another
terminal.

9 years agoFix build --without-network
Martin Kletzander [Mon, 27 Apr 2015 11:25:51 +0000 (13:25 +0200)]
Fix build --without-network

In order not to bring in any link dependencies, bridge driver doesn't
use the usual stubs as other conditionally-built code does.  However,
having the function as a macro imposes a problem with possibly unused
variables if just defined as "0".  This was worked around by using
(dom=dom, iface=iface, 0) which should act like a 0 if used in a
condition.  However, gcc still bugs about that, so I came up with
another way how to fix that.

Using static inline functions in the header won't collide with anything,
it fixes the bug and does one thing that the macro didn't do.  It checks
whenther passed variables are pointers of compatible type.  It has only
one downside, and that is that we need to either a) define it with
ATTRIBUTE_UNUSED, which needs an exception in cfg.mk or b) do something
like ignore_value(variable); in the function body.  I went with the
first variant.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoAssign virtio-serial addresses after coldplugging a device
Ján Tomko [Thu, 7 May 2015 11:15:06 +0000 (13:15 +0200)]
Assign virtio-serial addresses after coldplugging a device

Otherwise we might allow coldplugging a device
that uses an address that is already occupied, creating
an unstartable domain.

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

9 years agoqemu: vnc: error out for invalid port number
Pavel Hrdina [Tue, 12 May 2015 16:18:14 +0000 (18:18 +0200)]
qemu: vnc: error out for invalid port number

In the XML we have the vnc port number, but QEMU takes on command line
a vnc screen number, it's port-5900.  We should fail with error message
that only ports in range [5900,65535] are valid.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agovirSysinfoParseProcessor: Drop useless check for NULL
Michal Privoznik [Tue, 12 May 2015 15:49:59 +0000 (17:49 +0200)]
virSysinfoParseProcessor: Drop useless check for NULL

VIR_STRDUP plays nicely with NULLs. Theres no need to guard its
call with check for non-NULL.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agolibxl: support VNC passwd
Jim Fehlig [Tue, 28 Apr 2015 00:20:30 +0000 (18:20 -0600)]
libxl: support VNC passwd

While implementing support for SPICE, I noticed VNC passwd was
never copied to libxl_device_vfb's vnc.passwd field.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoconf: Remove source host name check for iSCSI
John Ferlan [Mon, 11 May 2015 17:51:04 +0000 (13:51 -0400)]
conf: Remove source host name check for iSCSI

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

Remove the check for the source host name for iSCSI source XML processing
declaring duplicate sources when the source device path and if present the
initiator of a proposed storage pool matches an existing storage pool.

The backend iSCSI storage driver uses 'iscsiadm --mode session' to query
available iscsid target sessions. The output displayed is the IP address
and the IQN (target path) of known targets. The displayed IP address
is a resolved address based on the session --login. Additionally, iscsid
keeps track of the various ways to define the host name (IPv4 Address,
IPv6 Address, /etc/hosts, etc.) for that IQN (see output of an 'iscsiadm
--mode node'). If an incoming IQN matches and the host name provided by
libvirt is resolved to the existing IQN, then iscsid will "reuse" the
session. Although libvirt could do the same name resolution, if there
is a difference, iscsid could still declare two seemingly different sources
to be the same and not create a new session which means libvirt now has
two storage pools looking at the same source. Thus to avoid any strange
host name resolution issues, just rely on iscsid for that and do not
allow multiple pools on the same host to use the same device path (IQN).

9 years agoconf: Adjust duplicate source host port check
John Ferlan [Mon, 11 May 2015 14:19:39 +0000 (10:19 -0400)]
conf: Adjust duplicate source host port check

Only perform the port number check if the incoming definition actually
provides it. Since the port number is optional we could erroneously pass
a duplicate source host check since some storage pool backends which fill
in the default port number (e.g., iSCSI and sheepdog) for the started pool.

9 years agoqemu: fix double free when RNG cold-plug fails
Luyao Huang [Tue, 12 May 2015 13:55:05 +0000 (21:55 +0800)]
qemu: fix double free when RNG cold-plug fails

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

When cold-plugging an RNG device but something fails in
qemuDomainAssignAddresses, we will double free the RNG device.
Once a device is plugged into the domain, we should set the
device pointer to NULL to fix this issue.

...
5  0x00007fb7d180ac8a in virFree at util/viralloc.c:582
6  0x00007fb7d1895cdd in virDomainRNGDefFree at conf/domain_conf.c:19786
7  0x00007fb7d1895d99 in virDomainDeviceDefFree at conf/domain_conf.c:2022
8  0x00007fb7b92b8baf in qemuDomainAttachDeviceFlags at qemu/qemu_driver.c:8785
9  0x00007fb7d190c5d7 in virDomainAttachDeviceFlags at libvirt-domain.c:8488
10 0x00007fb7d23af9d2 in remoteDispatchDomainAttachDeviceFlags at remote_dispatch.h:2842
...

Signed-off-by: Luyao Huang <lhuang@redhat.com>
9 years agodaemon: Suppress logging of VIR_ERR_NO_DOMAIN_METADATA
Peter Krempa [Tue, 12 May 2015 11:55:30 +0000 (13:55 +0200)]
daemon: Suppress logging of VIR_ERR_NO_DOMAIN_METADATA

Similarly to other error codes that notify the user that the object does
not exist lower the priority of VIR_ERR_NO_DOMAIN_METADATA to
VIR_LOG_DEBUG when writing the log entry.

9 years agoconf_capabilities: fix wrong indentation
Pavel Hrdina [Tue, 12 May 2015 10:12:58 +0000 (12:12 +0200)]
conf_capabilities: fix wrong indentation

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoXML: escape strings where we should do it
Pavel Hrdina [Tue, 5 May 2015 14:52:46 +0000 (16:52 +0200)]
XML: escape strings where we should do it

There is a lot of places, were it's pretty easy for user to enter some
characters that we need to escape to create a valid XML description.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoDocument that virNodeGetInfo can return mhz == 0.
Richard W.M. Jones [Mon, 11 May 2015 20:24:36 +0000 (21:24 +0100)]
Document that virNodeGetInfo can return mhz == 0.

On the s/390x architecture, libvirt may already return 0 in the
node_info->mhz field (see src/nodeinfo.c:linuxNodeInfoCPUPopulate).

We may also want to return this on aarch64 in future, because
calculating the proper value requires SMBIOS, which is not available
on non-server-class systems (specifically on systems which don't
adhere to the SBSA standard).

Therefore this change documents the existing behaviour and provides a
valid path for aarch64.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Bug-URL: https://bugzilla.redhat.com/1206353

9 years agolibvirt-guests: Initialize SYNC_TIME
Michal Privoznik [Mon, 11 May 2015 16:18:39 +0000 (18:18 +0200)]
libvirt-guests: Initialize SYNC_TIME

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

Since 0fa15b19 we have this variable SYNC_TIME which allows users to
synchronize time on domain resume. However, despite what documentation
says, it's by default on because it's never initialized. Fix this by
setting it to zero at the beginning of the libvirt-guests script.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemu: eliminate duplicated code in qemuBuildDriveDevStr()
Laine Stump [Thu, 30 Apr 2015 16:51:51 +0000 (12:51 -0400)]
qemu: eliminate duplicated code in qemuBuildDriveDevStr()

The code to add device type to the commandline was identical for lsi
and other models of SCSI controllers, but was duplicated (with the
exception of a minor ordering difference of the if-else clauses) for
the two cases. This patch replaces those two with a single instance of
the code just before the if().

9 years agoqemu: use qemuDomainMachineIsI440FX() in appropriate place
Laine Stump [Wed, 29 Apr 2015 16:23:02 +0000 (12:23 -0400)]
qemu: use qemuDomainMachineIsI440FX() in appropriate place

This patch makes qemuValideDevicePCISlotsChipsets() more consistent in
appearance by replacing several clauses of an if with the equivalent
call to qemuDomainMachineIsI440FX. The if was checking exactly the
same items, just in a slightly different order.

9 years agomaint: extend PIE support check
Roman Bogorodskiy [Sat, 9 May 2015 16:06:36 +0000 (19:06 +0300)]
maint: extend PIE support check

GCC installed from FreeBSD ports doesn't support building PIE executables
and fails with:

/usr/local/bin/ld: /usr/lib/crt1.o: relocation R_X86_64_32 against
`_DYNAMIC' can not be used when making a shared object; recompile with
-fPIC
/usr/lib/crt1.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status

However, the configure check for '-fPIC -DPIC' doesn't catch that. In
order to catch this case, add '-pie' to CFLAGS in m4/virt-compile-pie.m4
so it could detect lack of PIE support on configure time and don't fail
the build.

9 years agobhyve: fix bhyvexml2argvtest build with gcc
Roman Bogorodskiy [Sat, 9 May 2015 15:10:50 +0000 (18:10 +0300)]
bhyve: fix bhyvexml2argvtest build with gcc

gcc5 reports an error like this:

bhyvexml2argvtest.c: In function 'testCompareXMLToArgvFiles':
bhyvexml2argvtest.c:24:18: error: variable 'vm' set but not used
[-Werror=unused-but-set-variable]
     virDomainObj vm;
                  ^
cc1: all warnings being treated as errors

Fix by dropping this variable.