Commit Graph

18601 Commits

Author SHA1 Message Date
Daniel P. Berrange
ee043216e6 parallels: don't override error message when XML parsing fails
The virDomainDefParseString method will report a suitable error
on parsing fail, so don't replace that.
2015-01-13 10:43:07 +00:00
Daniel P. Berrange
70948db22a Fix flags passed to virDomainDefParseString by XenAPI driver
The XenAPI driver was passing the flags for
virDomainCreateXML straight into the virDomainDefParseString
method, even though they expect totally different sets of
flags. It should have been using VIR_DOMAIN_XML_INACTIVE
2015-01-13 10:43:07 +00:00
Daniel P. Berrange
4d6ed1bf0b Don't use VIR_DOMAIN_XML_SECURE when parsing XML
The VIR_DOMAIN_XML_SECURE flag only has effect on the formatting
of XML so should not be passed to virDomainDefParseNode
2015-01-13 10:43:07 +00:00
Daniel P. Berrange
4d2ebc71ce Add stub virDomainDefineXMLFlags impls
Make sure every virt driver implements virDomainDefineXMLFlags
by adding a trivial passthrough from the existing impl with
no flags set.
2015-01-13 10:38:56 +00:00
Daniel P. Berrange
2a5ee95441 Add new virDomainDefineXMLFlags public API
The virDomainDefineXML method is one of the few that still lacks
an 'unsigned int flags' parameter. This will be needed for adding
XML validation to this API. virDomainCreateXML fortunately already
has flags.
2015-01-13 10:35:09 +00:00
Luyao Huang
fba7173f72 conf: fix crash when hotplug a channel chr device with no target
https://bugzilla.redhat.com/show_bug.cgi?id=1181408

When we try to hotplug a channel chr device with no target, we
will get success (which should fail) in virDomainChrDefParseXML,
because we use goto cleanup this place and return an incomplete
definition (with no target). In qemuDomainAttachChrDevice,
we add it to the domain definition, but fail to remove it from
there when chardev-add fails, because virDomainChrRemove
matches chardevices according to the target name.
The device definition is then freed in qemuDomainAttachDeviceFlags,
leaving a stale pointer in the domain definition.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2015-01-13 09:56:56 +01:00
Martin Kletzander
adff345e1e qemu: Allow enabling/disabling features with host-passthrough
QEMU supports feature specification with -cpu host and we just skip
using that.  Since QEMU developers themselves would like to use this
feature, this patch modifies the code to work.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-01-13 08:51:01 +01:00
Jim Fehlig
f7a30375bd Revert "src/xenconfig: Xen-xl parser"
This reverts commit 2c78051a14.

Conflicts:
	src/Makefile.am

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2015-01-12 10:15:13 -07:00
Jim Fehlig
cb4befc748 Revert "tests: Tests for the xen-xl parser"
This reverts commit 6b818d3b09.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2015-01-12 10:15:09 -07:00
Jim Fehlig
4d77c136f8 Revert "libxl: Add support for parsing/formating Xen XL config"
This reverts commit 4f524212ce.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2015-01-12 10:15:04 -07:00
Jim Fehlig
88e34a9479 Revert "src/Makefile.am: fix build breaker for xenconfig"
This reverts commit 703ef9667a.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2015-01-12 10:14:59 -07:00
Jim Fehlig
0f2cd69b5a Revert "build: fix xenconfig VPATH builds"
This reverts commit 1b21d30069.

Conflicts:
	src/Makefile.am

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2015-01-12 10:14:54 -07:00
Jim Fehlig
3ac24305a8 Revert "Revert "src/Makefile.am: fix build breaker for xenconfig""
This reverts commit e662968fd9.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2015-01-12 10:14:48 -07:00
Jim Fehlig
1cb2667c12 Revert "src/Makefile: move the new xen_xl_disk parser code at the correct place"
This reverts commit edacdb3d12.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2015-01-12 10:14:42 -07:00
Jim Fehlig
dc8f62a9f9 Revert "src/Makefile: Fix parallel build after xen_xl_disk parser introduction"
This reverts commit 533349ff43.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2015-01-12 10:14:37 -07:00
Jim Fehlig
d2f80a772f Revert "bootstrap.conf: add check for flex"
This reverts commit cab767831f.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2015-01-12 10:14:30 -07:00
Guido Günther
c1deb7f58c lxc: Move setting ifname_guest_actual to virLXCSetupInterfaces
so it applies to interfaces of type 'direct' too.

Reported and patch provided by Bastian Blank at

    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=769600
2015-01-12 18:01:46 +01:00
Michal Privoznik
d776e995e3 qemuxml2argvtest: Fix test after change of qxl vgamem_mb default
Well, apparently it's possible for a patch to sneak in through
review process and break 'make check'. It happened just lately
with 0e502466ac which changed the default of vgamem_mb for
qxl device. However, there were left some domain XMLs within our
test suite relying on the old default. These should be updated to
match the change.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-01-12 15:47:52 +01:00
Daniel Hansel
5940301889 cpu: Bugfix for s390 CPU driver to return a host CPU model
The curent libvirt CPU driver for s390 does not return a host CPU model.
This patch returns 'host' according to the other platforms that would
not decode any CPU model.
This is an intermediate bugfix due to a discussion on OpenStack mailing
list. The final patch introducing the CPU model support for s390x will
exchange the hard-coded decode method.

Signed-off-by: Daniel Hansel <daniel.hansel@linux.vnet.ibm.com>
2015-01-12 15:08:29 +01:00
John Ferlan
b789db36ae virconf: Resolve a possible memory leak in virConfSetValue
Found this one by inspection... The API claims to "own" the input
value even in the case of error.  However, in the initial entry
to the API if the value exists, was STRING, but without a str value
it just returned without freeing the 'value' which it claims to now
own.  So I added the virConfFreeValue() call in order to resolve.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2015-01-12 08:59:55 -05:00
John Ferlan
a267f01532 openvz: Check errors from virSocketAddrFormat
Commit id 'a4e86390' modified the command line to allow --ipadd multiple
times; however, it did not account for the condition where a NULL is
returned which will could lead to some interesting errors with multiple
--ipadd's without parameters.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2015-01-12 08:59:55 -05:00
John Ferlan
21160a7ac9 openvz: Resolve Coverity RESOURCE_LEAK
Commit id 'a4e86390' modified the command line to allow --ipadd multiple
times, which caused Coverity to notice a latent memory leak with the
'ipAddr' string not being VIR_FREE()'d

Signed-off-by: John Ferlan <jferlan@redhat.com>
2015-01-12 08:59:54 -05:00
Pavel Hrdina
0e502466ac qxl: change the default value for vgamem_mb to 16 MiB
The default value should be 16 MiB instead of 8 MiB. Only really old
version of upstream QEMU used the 8 MiB as default for vga framebuffer.

Without this change if you update your libvirt where we introduced the
"vgamem" attribute for QXL video device the value will be set to 8 MiB,
but previously your guest had 16 MiB because we didn't pass any value to
QEMU command line which means QEMU used its own 16 MiB as default.

This will affect all users with guest's display resolution higher than
1920x1080.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-01-12 14:51:13 +01:00
Michal Privoznik
241ab97d7e docs: Document some -boot option limitations on UEFI
It was brought to my attention that some -boot options may not
work with UEFI. For instance, rebootTimeout is very SeaBIOS
specific,splash logo is not implemented yet on OVMF, and so on.
We should document this limitation at least.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-01-12 14:32:17 +01:00
Hao Liu
a0670aef37 virsh: Emit error for VSH_OT_DATA without VSH_OFLAG_REQ
Commit 6b9964 enforces checking invalid use of VSH_OT_STRING with
VSH_OFLAG_REQ. This commit tries to do the same thing to stop using
VSH_OT_DATA without VSH_OFLAG_REQ and also fix existing misuse.

Signed-off-by: Hao Liu <hliu@redhat.com>
2015-01-12 13:38:42 +01:00
Guido Günther
906a116586 lxc: Don't crash on NULL ifname_guest_actual
Reported and patch provided by Bastian Blank at

    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=769600
2015-01-12 10:40:20 +01:00
Luyao Huang
97fac17c77 conf: Correctly format controller's driver
https://bugzilla.redhat.com/show_bug.cgi?id=1179684

The way that we currently generate the <driver/> for <controller/> is
just madness:

    <controller type='scsi' index='0' model='virtio-scsi'>
      <driver queues='12'/>
      <driver cmd_per_lun='123'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </controller>

It's obvious that we should be aiming at the following:

    <controller type='scsi' index='0' model='virtio-scsi'>
      <driver queues='12' cmd_per_lun='123'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </controller>

Signed-off-by: Luyao Huang <lhuang@redhat.com>
2015-01-09 16:01:55 +01:00
Ján Tomko
1390c26847 safezero: fall back to writing zeroes even when resizing
Remove the resize flag and use the same code path for all callers.
This flag was added by commit 18f0316 to allow virStorageFileResize
use 'safezero' while preserving the behavior.

Explicitly return -2 when a fallback to a different method should
be done, to make the code path more obvious.

Fail immediately when ftruncate fails in the mmap method,
as we did before commit 18f0316.
2015-01-09 13:48:23 +01:00
John Ferlan
a4b0040353 virsh.pod: Update description
The 'pool-build' command description for --overwrite and --no-overwrite
indicated usage for only 'filesystem' pools; however, the 'disk' pool
also supports the flags as of commit id 'afa1029a'. So add a description
for that usage.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2015-01-09 13:43:17 +01:00
Eric Blake
76777f4863 maint: in src/Makefile.am, $(top_srcdir)/src is verbose
I noticed this while working on a previous commit.  Why should
we be calling out '../src/' when it is sufficient to refer to just
'./'?  Blind copy-and-paste runs rampant in this file :)

* src/Makefile.am (INCLUDES, *_CFLAGS): Shorten to $(srcdir).

Signed-off-by: Eric Blake <eblake@redhat.com>
2015-01-08 14:46:37 -07:00
Pavel Hrdina
cab767831f bootstrap.conf: add check for flex
We need the flex to generate new xen_xl_disk parser.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-01-08 17:23:57 +01:00
Pavel Hrdina
533349ff43 src/Makefile: Fix parallel build after xen_xl_disk parser introduction
Well, the parallel build doesn't work as there are not dependencies
set correctly. When running 'make -j' I see this error:

make[2]: Entering directory '/home/zippy/work/libvirt/libvirt.git/src'
  GEN      util/virkeymaps.h
  GEN      locking/lock_protocol.h
make[2]: *** No rule to make target 'xenconfig/xen_xl_disk.h', needed by 'all'.  Stop.
make[2]: *** Waiting for unfinished jobs....
  GEN      lxc/lxc_controller_dispatch.h

The fix is to correctly set dependencies by letting make know that .c
and .h are to be generated from .l. Moreover, the section is moved
closer to the other section which uses it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-01-08 14:36:49 +01:00
Pavel Hrdina
edacdb3d12 src/Makefile: move the new xen_xl_disk parser code at the correct place
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-01-08 14:36:31 +01:00
Pavel Hrdina
e662968fd9 Revert "src/Makefile.am: fix build breaker for xenconfig"
This reverts commit 703ef9667a.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-01-08 14:34:59 +01:00
Geoff Hickey
bb072e8a38 vmx: Fix a VMX parsing problem
VMware ESX does not always set the "serialX.fileType" tag in VMX files. The
default value for this tag is "device", and when adding a new serial port
of this type VMware will omit the fileType tag. This caused libvirt to
fail to parse the VMX file. Fixed by making this tag optional and using
"device" as a default value. Also updated vmx2xmltest to test for this
case.

Signed-off-by: Eric Blake <eblake@redhat.com>
2015-01-07 17:17:00 -07:00
Eric Blake
1b21d30069 build: fix xenconfig VPATH builds
Ever since commit 2c78051 split out a helper library for the sake of
changing CFLAGS, a VPATH build with xenconfig enabled has failed:

  CC       xenconfig/libvirt_xenxldiskparser_la-xen_xl_disk.lo
  ../../src/xenconfig/xen_xl_disk.l:37:21: fatal error: xen_xl.h: No such file or directory
   # include "xen_xl.h"
             ^
  compilation terminated.
  Makefile:9462: recipe for target 'xenconfig/libvirt_xenxldiskparser_la-xen_xl_disk.lo' failed

The solution is to tell the build to look for xen_xl.h relative
to $(srcdir), since we keep that file under version control.

[Not fixed here - the raw use of -Wno-unused-parameter in CFLAGS
is NOT portable; ideally, we should be doing a configure test
and only supplying that argument when we know the compiler supports
-Wunused-parameter; but that's a patch for another day]

[Not fixed here - there are still issues with parallel builds hitting
a race between generating the files and trying to compile/distribute
them]

* src/Makefile.am (libvirt_xenxldiskparser_la_CFLAGS): Add another
include directory.

Signed-off-by: Eric Blake <eblake@redhat.com>
2015-01-07 16:57:40 -07:00
Michal Privoznik
732586d979 qemu: Fix system pages handling in <memoryBacking/>
In one of my previous commits (311b4a67) I've tried to allow to
pass regular system pages to <hugepages>. However, there was a
little bug that wasn't caught. If domain has guest NUMA topology
defined, qemuBuildNumaArgStr() function takes care of generating
corresponding command line. The hugepages backing for guest NUMA
nodes is handled there too. And here comes the bug: the hugepages
setting from XML is stored in KiB internally, however, the system
pages size was queried and stored in Bytes. So the check whether
these two are equal was failing even if it shouldn't.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-01-07 18:32:07 +01:00
Stefan Berger
3a3b3691d1 nwfilter: Add support for icmpv6 filtering
Make use of the ebtables functionality to be able to filter certain
parameters of icmpv6 packets. Extend the XML parser for icmpv6 types,
type ranges, codes, and code ranges. Extend the nwfilter documentation,
schema, and test cases.

Being able to filter icmpv6 types and codes helps extending the DHCP
snooper for IPv6 and filtering at least some parameters of IPv6's NDP
(Neighbor Discovery Protocol) packets. However, the filtering will not
be as good as the filtering of ARP packets since we cannot
check on IP addresses in the payload of the NDP packets.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-01-07 11:41:49 -05:00
Ján Tomko
b073179085 Indentation 2015-01-07 16:35:18 +01:00
Peter Krempa
79bb49a83d qemu: Don't unref domain after exit from nested async job
In commit 540c339a25 the whole domain
reference counting was refactored in the qemu driver. Domain jobs now
don't need to reference the domain object as they now expect the
reference from the calling function.

However, the patch forgot to remove the unref call in case we exit the
monitor when we were acquiring a nested job. This caused the daemon to
crash on a subsequent access to the domain object once we've done an
operation requiring a nested job for a monitor access.

An easy reproducer case:

1) Start a vm with qcow disks
2) virsh snapshot-create-as DOMNAME
3) virsh dumpxml DOMNAME
4) daemon crashes in a semi-random spot while accessing a now-removed VM
object.

Fortunately, the commit wasn't released yet, so there are no security
implications.

Reported-by: Shanzi Yu <shyu@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2015-01-07 13:47:31 +01:00
Luyao Huang
db19a4a3c6 conf: Don't format actual network definition in migratable XML
https://bugzilla.redhat.com/show_bug.cgi?id=1177194

When migrate a vm, we will generate a xml via qemuDomainDefFormatLive and
pass this xml to target libvirtd. Libvirt will use the current network
state in def->data.network.actual to generate the xml, this will make
migrate failed when we set a network type guest interface use a macvtap
network as a source in a vm then migrate vm to another host(which has the
different macvtap network settings: different interface name, bridge name...)

Add a flag check in virDomainNetDefFormat, if we set a VIR_DOMAIN_XML_MIGRATABLE
flag when call virDomainNetDefFormat, we won't get the current vm interface
state.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-01-07 13:11:02 +01:00
Alexander Burluka
95170a3085 Parallels: Add VNC hostname setup
Add missing VNC setup via Parallels SDK.
Parallels Cloud Server starts one VNC server per domain,
so we could process only one VNC server definition.
Network-based listening currently is unimplemented.

Signed-off-by: Alexander Burluka <aburluka@parallels.com>
2015-01-07 09:58:18 +01:00
Luyao Huang
565d049fd1 qemu: Restore old bandwidth rules when setting new fails
https://bugzilla.redhat.com/show_bug.cgi?id=1177723

When setting new bandwidth limits via
virDomainSetInterfaceParameters, the old ones are cleared first.
However, if setting the new ones fails, the old are already gone
and interface is left in inconsistent state.  Therefore, right
before failing we ought to try to restore the old bandwidth.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
2015-01-06 13:27:43 +01:00
Luyao Huang
a791599cc6 qemu: fix miss goto cleanup in qemuDomainAttachNetDevice
This place have a wrong logic, maybe forget goto cleanup.
Also fix some small things.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
2015-01-06 11:07:13 +01:00
Nehal J Wani
18ec863d19 networkGetDHCPLeases: Remove unnecessary error reporting
Lack of a lease (whether mac is given or not) is a normal expected
scenario, since we are already filling in rv with nleases (which is
okay as 0 if there is no lease).  There is no need to raise an error.

This fixes:

> virsh # net-dhcp-leases --mac 00:50:56:c0:00:01  default
> error: Failed to get leases info for default
> error: internal error: no lease with matching MAC address: 00:50:56:c0:00:01

Signed-off-by: Nehal J Wani <nehaljw.kkd1@gmail.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2015-01-05 16:58:18 -07:00
Luyao Huang
39449f70b9 qemu: use a wrong name for guest panic status
https://bugzilla.redhat.com/show_bug.cgi?id=1178652

We will get a warning when we have a guest in paused
status (caused by kernel panic) and restart libvirtd,
warning message like this:

Qemu reported unknown VM status: 'guest-panicked'

and this seems because we set a wrong status name in
qemu_monitor.c, and from qemu qapi-schema.json file
we know this status should named 'guest-panicked'.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2015-01-05 16:55:35 -07:00
Eric Blake
96a87e11f7 maint: update to latest gnulib
Another update is required to pick up today's gnulib fix for mingw
builds (now that gnulib turns on mingw's replacement printf that
understands %lld, it must also tell the compiler to respect the
improved definition of PRIdMAX and friends).

* .gnulib: Update to latest.

Signed-off-by: Eric Blake <eblake@redhat.com>
2015-01-05 16:38:50 -07:00
Eric Blake
08eb2821f5 virnetlink: fix build on non-Linux
Commit 4dc04d3a added virNetlinkGetErrorCode, but forgot to provide
a fallback, which kills the build on mingw (among others):

  CCLD     libvirt.la
  Cannot export virNetlinkGetErrorCode: symbol not defined
  collect2: error: ld returned 1 exit status

* src/util/virnetlink.c (virNetlinkGetErrorCode): Provide fallback.

Signed-off-by: Eric Blake <eblake@redhat.com>
2015-01-05 16:38:25 -07:00
Cédric Bosdonnat
e85df0901d Report error if a driver can't handle multiple IP addresses
Drivers supporting one and only one IP address raise an error if more IP
addresses are configured.
2015-01-05 20:24:18 +01:00
Cédric Bosdonnat
a4e8639068 Openvz --ipadd can be provided multiple times
Vzctl man page says that --ipadd can be provided multiple times to add
several IP addresses. Looping over the configured ip addresses to add
one --ipadd for each. This would even handle the multiple IPs handled
by openvz_conf.c
2015-01-05 20:24:17 +01:00