Commit Graph

23225 Commits

Author SHA1 Message Date
Peter Krempa
69e0cd3397 virsh: Add command 'guestvcpus' implementing virDomain(GS)etGuestVcpus
Add a straightforward implementation for using the new APIs.
2016-06-22 09:26:08 +02:00
Peter Krempa
3ebf7ca07e lib: Add API to set individual vcpu usage in the guest via guest agent
To allow finer-grained control of vcpu state using guest agent this API
can be used to individually set the state of the vCPU.

This will allow to better control NUMA enabled guests and/or test
various vCPU configurations.
2016-06-22 09:25:47 +02:00
Peter Krempa
800244faf3 lib: Add API to query guest vcpu info using guest agent
Add a rather universal API implemented via typed params that will allow
to query the guest agent for the state and possibly other aspects of
guest vcpus.
2016-06-22 08:16:31 +02:00
Peter Krempa
830f9b624d rpcgen: Add support for generating funcs returning alloc'd typed params
Since it's rather tedious to write the dispatchers for functions that
return an array of typed parameters (which are rather common) let's add
some rpcgen code to generate them.
2016-06-22 08:15:45 +02:00
John Ferlan
f06e45d578 tests: Adjust tests for encrypted storage
Make them work again...  The xml2xml had been working, but the xml2argv
were not working. Making the xml2argv work required a few adjustments to
the xml to update to more recent times.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-21 14:31:19 -04:00
John Ferlan
35f6abef6b storage: Use virSecretGetSecretString
Rather than inline code secret lookup for rbd/iscsi, use the common function.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-21 14:31:19 -04:00
John Ferlan
7df631b66a storage: Create helper to set options for CreateQemuImg code
Create a helper virStorageBackendCreateQemuImgSetOptions to set either
the qemu-img -o options or the previous mechanism using -F

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-21 14:31:19 -04:00
John Ferlan
d12a64f310 storage: Create helper to set backing for CreateQemuImg code
Create a helper virStorageBackendCreateQemuImgSetBacking to perform the
backing store set

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-21 14:31:19 -04:00
John Ferlan
f6a92f8e20 storage: Adjust qemu-img switches check
Since we support QEMU 0.12 and later, checking for support of specific flags
added prior to that isn't necessary.

Thus start with the base of having the "-o options" available for the
qemu-img create option and then determine whether we have the compat
option for qcow2 files (which would be necessary up through qemu 2.0
where the default changes to compat 0.11).

Adjust test to no long check for NONE and FLAG options as well was removing
results of tests that would use that option.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-21 14:31:19 -04:00
Ján Tomko
8b3f0b767e Do not call postParse with ABI_UPDATE when parsing cmdline
So far this is only useful for recalculating NUMA memory size,
which this function cannot parse.

This will let us generate USB addresses based on this flag.
2016-06-21 18:23:56 +02:00
Ján Tomko
f17a49564a Fix USB port in input-usbmouse test
The default USB controller only has two ports.
2016-06-21 18:23:56 +02:00
Ján Tomko
c9c03ea24d test-wrap-argv: add --check parameter
This script can already operate on a list of files.
Add a --check parameter to check if multiple files are wrapped
correctly with a single invocation of the script.
2016-06-21 18:13:07 +02:00
Ján Tomko
f46fb819a9 test-wrap-argv: add --in-place parameter
If --in-place is supplied as the first argument to the script,
replace the file in-place instead of printing to stdout.
2016-06-21 18:13:07 +02:00
Ján Tomko
b0590a53a5 test-wrap-argv: hold a copy of the original file in an array
This will be useful to check if the file is wrapped already.
2016-06-21 18:13:07 +02:00
Ján Tomko
80880fd4af test-wrap-argv: return a string in rewrap_line
Leave the printing up to &rewrap.
2016-06-21 18:13:07 +02:00
Ján Tomko
c8da1cbf13 test-wrap-argv: use map and join instead of a for cycle
We have a list of parameters in @args, that need to be rewrapped
and separated by a space and escaped newline: " \\\n", with the
exception of the last one, which only needs a newline.

Instead of a for cycle, rewrap the individual arguments using map,
and interleave them with escaped newlines by using join.
2016-06-21 18:13:07 +02:00
Ján Tomko
2f071f1fca test-wrap-argv: return a string in rewrap_arg
Do not print anything, let the caller take care of it.
2016-06-21 18:13:07 +02:00
Ján Tomko
5e6185eee6 test-wrap-argv: split out rewrap_arg
Split out the code wrapping the single argument.
2016-06-21 18:13:07 +02:00
Ján Tomko
a615a2fa58 test-wrap-argv: split out rewrap_line
Shorten the rewrap subroutine by splitting out the code
dealing with a single line.

Also remove $file from the warning.
2016-06-21 18:13:07 +02:00
Ján Tomko
8ebf780e08 vsh: remove namespace poisoning
We already have a syntax-check to prohibit direct use of these
allocation functions.
2016-06-21 18:07:25 +02:00
Ján Tomko
d0e5dd376f vbox: remove duplicate macros
There is a definiton of VIR_FROM_THIS just two lines above.

The rest is defined in vbox_common.h.
2016-06-21 18:07:25 +02:00
Ján Tomko
8ddf58f5a1 Remove unused SOL_NETLINK macro
Introduced by commit d575679, unused at the time.
2016-06-21 18:07:11 +02:00
Laine Stump
df2fb9bfff conf: limit chassisNr, and busNr to a minimum value of 1, not 0
In the case of chassisNr (used to set chassis_nr of a pci-bridge
controller), 0 is reserved for / used by the pci[e]-root bus. In the
base of busNr, a value of 0 would mean that the root bus had no places
available to plug in new buses, including the pxb itself (the
documentation I wrote for pxb even noted the limit of busNr as 1.254).

NB: oddly, the "chassis" attribute, which is used for pcie-root-port
and pcie-switch-downstream-port *can* be set to 0, since it's the
combination of {chassis, slot} that needs to be unique, not chassis by
itself (and slot 0 of pcie-root is reserved, while pcie-*-port can use
*only* slot 0).

This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1342962
2016-06-21 11:54:46 -04:00
Andrea Bolognani
f83ab972bc qemu: Fix typo pci-extender-bus -> pci-expander-bus 2016-06-21 12:48:02 +02:00
Jiri Denemark
c61360e15b virsh migrate: Fix positional parameters
Thanks to our smart option parser which automatically assigns positional
parameters the following (previously working) command fails:

    virsh migrate test qemu+ssh://1.2.3.4/system tcp://1.2.3.4/
    error: invalid argument: Unsupported compression method
    'tcp://1.2.3.4/'

We need to make sure new options are added at the end of the list rather
than where they logically belong.

Reported by Brian Rak.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-21 10:11:03 +02:00
Ján Tomko
a1e1679c8a Mark virsh-optparse as expensive 2016-06-20 18:16:50 +02:00
Ján Tomko
031b477b16 Drop virrandomtest
This test only checks if mocking of virRandomBytes works correctly.

Drop it to avoid infinite recursion by testing the test suite.
2016-06-20 18:16:50 +02:00
Ján Tomko
79d3fc855c Remove virsh-synopsis
This tests checks that the first word after SYNOPSIS
in virsh help ${command} output is ${command}.

This was only good to check that the command option structures
are valid, which is now served by 'virsh self-test'.
2016-06-20 18:16:50 +02:00
Ján Tomko
920ab8bdce Introduce virsh self-test
A new hidden command for virsh that will iterate over
all command groups and commands and print help for every single one.

This involves running vshCmddefOptParse so we can get an error if
one of the command's option structure is invalid.
2016-06-20 18:16:33 +02:00
Ján Tomko
743bda062b tests: mock gnutls_dh_params_generate2
This function generates some big random numbers.

Cache the result and supply it to any subsequent generate2 calls.
2016-06-20 18:12:53 +02:00
Ján Tomko
9f95593d60 Remove virsh-all
Since e8ac4a7 this test wastes some CPU cycles by blindly trying to
run almost every virsh command, blindly throwing away the output
and the return value and returning success if 'virsh help' successfully
returned at least one command.

Drop it completely.
2016-06-20 18:04:44 +02:00
Peter Krempa
832f160247 util: Make failure to get supplementary group list for a uid non-fatal
Since introduction of the DAC security driver we've documented that
seclabels with a leading + can be used with numerical uid. This would
not work though with the rest of libvirt if the uid was not actually
used in the system as we'd fail when trying to get a list of
supplementary groups for the given uid. Since a uid without entry in
/etc/passwd (or other user database) will not have any supplementary
groups we can treat the failure to obtain them as such.

This patch modifies virGetGroupList to not report the error for missing
users and makes it return an empty list or just the group specified in
@gid.

All callers will grant less permissions to a user in case of failure of
this function and thus this change is safe.
2016-06-20 17:35:55 +02:00
Peter Krempa
c674dcccf1 util: Add option not to report errors in virGetUserEnt
In some cases it will be necessary to ignore errors reported from this
function. This allows suppressing them to avoid spamming logs.
2016-06-20 16:51:10 +02:00
Peter Krempa
e29f557515 tools: virt-login-shell: Fix cut'n'paste mistake in error message
Whine about 'allowed_users' having wrong format rather than 'shell'
2016-06-20 16:51:10 +02:00
Peter Krempa
94f93d7071 tools: virt-login-shell: Fix group list bounds checking
The list certainly isn't zero terminated and it would disallow usage of
group 'root'. Pass in the array size and match against it.
2016-06-20 16:48:55 +02:00
Peter Krempa
0a07bf3dc5 conf: Fix label name in virDomainGraphicsListensParseXML
Use 'cleanup' since it's also used on success.
2016-06-20 16:34:43 +02:00
Peter Krempa
9982758cc5 conf: Fix memory leak in graphics XML parser
When loading status XMLs with following graphics definition:

  <graphics type='spice' port='5900' autoport='yes' listen='127.0.0.1'>
    <listen type='address' address='127.0.0.1' fromConfig='1'/>
    <image compression='off'/>
  </graphics>

libvirtd would leak a few bytes:

10 bytes in 1 blocks are definitely lost in loss record 71 of 1,127
   at 0x4C2C000: malloc (vg_replace_malloc.c:299)
   by 0x6789298: xmlStrndup (in /usr/lib64/libxml2.so.2.9.4)
   by 0x552AB0A: virXMLPropString (virxml.c:479)
   by 0x5539536: virDomainGraphicsListensParseXML (domain_conf.c:11171)
   by 0x553DD5E: virDomainGraphicsDefParseXMLSpice (domain_conf.c:11414)
   by 0x553DD5E: virDomainGraphicsDefParseXML (domain_conf.c:11749)
   by 0x5566061: virDomainDefParseXML (domain_conf.c:16939)
   by 0x556953F: virDomainObjParseXML (domain_conf.c:17348)
   by 0x556953F: virDomainObjParseNode (domain_conf.c:17513)
   by 0x5569902: virDomainObjParseFile (domain_conf.c:17532)
   by 0x5571E02: virDomainObjListLoadStatus (virdomainobjlist.c:514)
   by 0x5571E02: virDomainObjListLoadAllConfigs (virdomainobjlist.c:596)
   by 0x26E0BDC8: qemuStateInitialize (qemu_driver.c:911)
   by 0x55B1FDB: virStateInitialize (libvirt.c:770)
   by 0x122039: daemonRunStateInit (libvirtd.c:960)
2016-06-20 16:34:43 +02:00
Chen Hanxiao
a7822ba3f6 util: fix a typo
s/succcess/success

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
2016-06-20 15:20:09 +02:00
Jaroslav Suchanek
dd14032b39 docs: virsh: Added note for the dump command
Crash dump in a old kvmdump format is being obsolete and cannot be loaded and
processed by crash utility since its version 6.1.0. A --memory-only option is
required in order to produce valid ELF file which can be later processed by the
crash utility. A new note is added to the dump command description.
2016-06-20 14:37:02 +02:00
Ján Tomko
0cd5a726e3 Allow disjunct ranges in VIR_TEST_RANGE
Use virBitmapParseUnlimited to parse the env variable.
2016-06-20 12:09:52 +02:00
Ján Tomko
dc56b3a7ce Introduce virBitmapParseUnlimited
For parsing a bitmap of an unknown size.
2016-06-20 12:09:52 +02:00
Ján Tomko
ff52e9d43a Remove separator argument from virBitmapParse
Most the callers pass 0 in one form or another, including
vircapstest which used VIR_ARCH_NONE.
2016-06-20 12:09:52 +02:00
Ján Tomko
d728689d9b Introduce virBitmapParseSeparator
This will be used for the caller that needs to specify a separator.
Currently identical to virBitmapParse.

Also change one test case to use the new function.
2016-06-20 12:09:39 +02:00
Ján Tomko
ba7c026dab Do not return number of set bits in virBitmapParse
This is only used by one caller.
2016-06-20 12:07:16 +02:00
Andrea Bolognani
dc5821d743 qemu: Don't use legacy USB for aarch64 mach-virt guests
The '-usb' option doesn't have any effect for aarch64 mach-virt
guests, so the fact that it's currently enabled by default is not
really causing any issue.

However, that might change in the future (although unlikely), and
having it as part of the QEMU command line can cause confusion to
someone looking through the process list.

Avoid it completely, like it's already happening for q35.
2016-06-20 09:58:48 +02:00
Tomasz Flendrich
ec3f07f0a7 qemu_hotplug: Use a helper variable consistently 2016-06-19 15:55:37 +02:00
Jovanka Gulicoska
eac167e261 virsh: Introduce pool-event command
Similar to 'event' and 'net-event', this prints info about incoming
storage pool events.
2016-06-18 11:15:31 -04:00
Jim Fehlig
8bab1e7c05 libxl: add USB to hostdev domcapabilities
Commit 2a58ed0b added support for creating guests with USB
hostdevs. Commit fc21d10 later added support for hotplut of
USB hostdevs. Advertise support for USB hostdevs in the
domcapabilities.

In addition add the appropriate caps for USB support on
domaincapstest when libvirt is built on a Xen with
LIBXL_HAVE_PVUSB. Otherwise domaincapstest would fail i.e.
testing the wrong domain capabilities.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
2016-06-17 14:25:02 -06:00
Ján Tomko
22d262c9b0 qemu: restore non-pci hostdev labels after detach
Commit 409de00 changed the logic to only match PCI devices
while moving this before Remove*HostDevice calls.

https://bugzilla.redhat.com/show_bug.cgi?id=1342874
2016-06-17 19:43:22 +02:00
Ján Tomko
d41d18bcdc Remove stray space in cmdHelp 2016-06-17 19:39:25 +02:00