Commit Graph

38901 Commits

Author SHA1 Message Date
Lin Ma
6c74a2e23a virsh: Add vcpu IDs completion to vcpupin command
Signed-off-by: Lin Ma <lma@suse.de>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-09-14 15:52:40 +02:00
Lin Ma
ab4ef5de67 virsh: Add iothread IDs completion to iothread* commands
Signed-off-by: Lin Ma <lma@suse.de>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-09-14 15:52:40 +02:00
Lin Ma
889bdba38d virsh: Add domain uuid completion to domname command
Signed-off-by: Lin Ma <lma@suse.de>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-09-14 15:52:40 +02:00
Lin Ma
f6e69f03e3 virsh: Add network uuid completion to network-name command
Signed-off-by: Lin Ma <lma@suse.de>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-09-14 15:52:40 +02:00
Lin Ma
d9a320bf97 vshReadlineParse: Ignore vshReadlineOptionsGenerator for VSH_OT_INT options
Commit c7151b0 added the completion for VSH_OT_INT options, say '--cellno'
and '--pagesize', So we need to ignore VSH_OT_INT otherwise we get the
incorrect completion.

before:
 # virsh freepages --pagesize <TAB><TAB>
--all     --cellno  1GiB      2MiB      4KiB

after:
 # virsh freepages --pagesize <TAB><TAB>
1GiB  2MiB  4KiB

Signed-off-by: Lin Ma <lma@suse.de>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-09-14 15:52:40 +02:00
Lin Ma
eddd9932ee virsh: Add event completer to --enable/--disable args of perf command
Signed-off-by: Lin Ma <lma@suse.de>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-09-14 15:52:40 +02:00
Lin Ma
a2ab5eb8e1 virsh: checkpoint: Only return domains that have checkpoints
Signed-off-by: Lin Ma <lma@suse.de>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-09-14 15:52:40 +02:00
Lin Ma
89193486dc virsh: managedsave-*: Only return domains that have a managed save image
Signed-off-by: Lin Ma <lma@suse.de>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-09-14 15:52:40 +02:00
Lin Ma
2fcf599bd2 virsh: snapshot: Only return domains that have snapshot images
Signed-off-by: Lin Ma <lma@suse.de>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-09-14 15:52:40 +02:00
Lin Ma
b9f2f44949 virshDomainNameCompleter: Add some of VIR_CONNECT_LIST_DOMAINS_ flags
Commit 3b225256 removed unused VIR_CONNECT_LIST_DOMAINS_* flags, But some
of them will be used in upcoming patches, So add some of them back.

Signed-off-by: Lin Ma <lma@suse.de>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-09-14 15:52:40 +02:00
Ján Tomko
2b6cd85504 util: virNetDevTapCreate: initialize fd to -1
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 95089f481e
2020-09-14 13:02:56 +02:00
Pino Toscano
8c16f81eb9 esx: improve some of the virErrorNumber used
A lot of virReportError() calls use VIR_ERR_INTERNAL_ERROR to represent
the number of the error, even in cases where there is one fitting more.
Hence, replace some of them with better virErrorNumber values.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2020-09-14 10:22:00 +02:00
Pino Toscano
8508799f2d esx: generator: fix free of elements in lists
When a list is freed, we iterate through all the items, invoking the
free function for each; the actual free function called for each element
is the function of the actual type of each element, and thus the @_next
pointer in the element struct has the same type as the element itself.
Currently, the free function gets the parent of the current element
type, and invoke its free function to continue freeing the list.
However, in case the hierarchy of the classes has more than 1 level
(i.e. Class <- SubClass <- SubSubClass), the invoked free function is
only the parent class' one, and not the actual base class of the
hierarchy.

To fix that, change the generator to get the base class of a class, and
invoking that instead.  Also, avoid to set the @_next back, as it is not
needed.

Fixes commits 5cff36e39a and
f76c6dde2e.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2020-09-14 10:21:23 +02:00
Pino Toscano
3c79c08299 esx: implement domainGetHostname
Implement the .domainGetHostname hypervisor driver API to get the
hostname of a running guest (needs VMware Tools).

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
2020-09-14 08:11:43 +02:00
Ian Wienand
d9ee51ef46 network: Only check kernel added routes in virNetDevIPCheckIPv6Forwarding
The original motivation for adding virNetDevIPCheckIPv6Forwarding
(commit 00d28a78b5) was that networking routes would disappear when
ipv6 forwarding was enabled for an interface.

This is a fairly undocumented side-effect of the "accept_ra" sysctl
for an interface.  1 means the interface will accept_ra's if not
forwarding, 2 means always accept_RAs; but it is not explained that
enabling forwarding when accept_ra==1 will also clear any kernel RA
assigned routes, very likely breaking your networking.

The check to warn about this currently uses netlink to go through all
the routes and then look at the accept_ra status of the interfaces.

However, it has been noticed that this problem does not affect systems
where IPv6 RA configuration is handled in userspace, e.g. via tools
such as NetworkManager.  In this case, the error message from libvirt
is spurious, and modifying the forwarding state will not affect the RA
state or disable your networking.

If you refer to the function rt6_purge_dflt_routers() in the kernel,
we can see that the routes being purged are only those with the
kernel's RTF_ADDRCONF flag set; that is, routes added by the kernel's
RA handling.  Why does it do this?  I think this is a Linux
implementation decision; it has always been like that and there are
some comments suggesting that it is because a router should be
statically configured, rather than accepting external configurations.

The solution implemented here is to convert the existing check into a
walk of /proc/net/ipv6_route (because RTF_ADDRCONF is apparently not
exposed in netlink) and look for routes with this flag set.  We then
check the accept_ra status for the interface, and if enabling
forwarding would break things raise an error.

This should hopefully avoid "interactive" users, who are likely to be
using NetworkManager and the like, having false warnings when enabling
IPv6, but retain the error check for users relying on kernel-based
IPv6 interface auto-configuration.

Signed-off-by: Ian Wienand <iwienand@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
Reviewed-by: Cedric Bosdonnat <CBosdonnat@suse.com>
2020-09-13 13:35:05 -04:00
Lin Ma
0bdd5299a0 docs: virsh: Drop duplicate spelling for dompmwakeup
Signed-off-by: Lin Ma <lma@suse.de>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-12 12:49:32 +02:00
Lin Ma
1619c87eea virsh: pool-list: options --all and --inactive are mutually exclusive
Signed-off-by: Lin Ma <lma@suse.de>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-12 12:49:32 +02:00
Lin Ma
b34c571e25 virsh: iface-list: options --all and --inactive are mutually exclusive
Signed-off-by: Lin Ma <lma@suse.de>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-12 12:49:31 +02:00
Lin Ma
b7b53c651a virsh: domdisplay: options --all and --type are mutually exclusive
Signed-off-by: Lin Ma <lma@suse.de>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-12 12:49:31 +02:00
Lin Ma
dfdacbeb39 virsh: domblkinfo: options --all and --device are mutually exclusive
Signed-off-by: Lin Ma <lma@suse.de>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-12 12:49:31 +02:00
Lin Ma
10841b6cb6 qemu: Return perf status that affect next boot for shutoff domains
While we set up perf events for a shutoff domain and check the settings,
All of perf events are reported as 'disabled', unless we add --config,
This is redundant for a shutoff domain.

 # virsh domstate $GUEST
shut off

 # virsh perf --domain $GUEST
cmt            : disabled
mbmt           : disabled
mbml           : disabled
......

 # virsh perf --domain $GUEST --enable mbmt
mbmt           : enabled

 # virsh perf --domain $GUEST
cmt            : disabled
mbmt           : disabled
mbml           : disabled
......

Use virDomainObjGetOneDefState instead of virDomainObjGetOneDef to fix
the issue. After patch, The perf event status of a shutoff domain is
reported correctly:

 # virsh domstate $GUEST
shut off

 # virsh perf --domain $GUEST
cmt            : disabled
mbmt           : disabled
mbml           : disabled
......

 # virsh perf --domain $GUEST --enable mbmt
mbmt           : enabled

 # virsh perf --domain $GUEST
cmt            : disabled
mbmt           : enabled
mbml           : disabled
......

Signed-off-by: Lin Ma <lma@suse.de>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-12 12:49:31 +02:00
Lin Ma
308ec831bb qemu: qemuDomainPMSuspendForDuration: Check availability of agent
It requires a guest agent configured and running in the domain's guest
OS, So check qemu agent during qemuDomainPMSuspendForDuration().

Signed-off-by: Lin Ma <lma@suse.de>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-12 12:49:31 +02:00
Jim Fehlig
6de6d6c771 daemon: Fix a comment typo in libvirtd.conf.in
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2020-09-11 14:55:59 -06:00
Tim Wiederhake
f4debada70 util: Remove VIR_REALLOC_N_QUIET
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-11 18:19:59 +02:00
Tim Wiederhake
569fcd6e2e util: Use glib memory functions in virFileGetXAttrQuiet
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-11 18:19:59 +02:00
Tim Wiederhake
b668054209 tools: Use glib memory functions in vshCompleterFilter
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-11 18:19:59 +02:00
Tim Wiederhake
d91faa4fc3 tests: Use glib memory functions in pci_driver_new
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-11 18:19:59 +02:00
Tim Wiederhake
f3bfebb0b4 tests: Use glib memory functions in add_fd
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-11 18:19:59 +02:00
Tim Wiederhake
caf5a88e59 qemu: Use glib memory functions in qemuProcessReadLog
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-11 18:19:58 +02:00
Tim Wiederhake
3e60deeed3 qemu: Use glib memory functions in qemuDomainLogContextRead
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-11 18:19:58 +02:00
Tim Wiederhake
42459f0b01 qemu: Use glib memory functions in qemuDomainMasterKeyReadFile
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-11 18:19:58 +02:00
Tim Wiederhake
e5c2b25075 util: Use glib memory functions in virDevMapperGetTargetsImpl
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-11 18:19:58 +02:00
Tim Wiederhake
85e4418502 util: Use glib memory functions in virThreadCreateFull
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-11 18:19:58 +02:00
Tim Wiederhake
51b97132b1 util: Use glib memory functions in virLogFilterNew
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-11 18:19:58 +02:00
Tim Wiederhake
38f7fdfdb4 util: Use glib memory functions in virSaveLastError
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-11 18:19:58 +02:00
Tim Wiederhake
18216abcfe util: Use glib memory functions in virBitmapNewQuiet
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-11 18:19:58 +02:00
Tim Wiederhake
a922e72756 rpc: Use glib memory functions in virNetMessageSaveError
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-11 18:19:58 +02:00
Tim Wiederhake
e228d6b92a tests: Use glib memory functions in virpcimock.c
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-11 18:19:58 +02:00
Tim Wiederhake
603b97cb32 cpu: Replace VIR_FREE with g_free
Note the use of g_clear_pointer(..., g_free) in ppc64DataClear and virCPUx86Baseline.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-11 15:33:55 +02:00
Tim Wiederhake
eb67d83100 cpu: Replace VIR_ALLOC_N with g_new0
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-11 15:33:55 +02:00
Tim Wiederhake
ed83c6d9e9 cpu: Replace VIR_ALLOC with g_new0
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-11 15:33:55 +02:00
Tim Wiederhake
535b4a56d2 cpu_map: Remove unnecessary variable in loadData
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-11 15:33:55 +02:00
Tim Wiederhake
af7ffa4834 cpu_x86: Use g_auto* in virX86CpuIncompatible
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-11 15:33:55 +02:00
Tim Wiederhake
ffa6dc0519 cpu_map: Use g_auto* in loadIncludes
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-11 15:33:55 +02:00
Tim Wiederhake
fc8e0cad0c cpu_map: Use g_auto* in loadData
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-11 15:33:55 +02:00
Tim Wiederhake
43250af8dd cpu_ppc64: Use g_auto* in ppc64MakeCPUData
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-09-11 15:33:55 +02:00
Erik Skultety
9824a82198 qemu: qemuDomainPMSuspendAgent: Don't assign to 'ret' in a conditional
When the guest agent isn't running, we still report success on a PM
suspend action even though we logged an error correctly, this is because
we poisoned the 'ret' value a few lines above.

Fixes: a663a86081

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2020-09-11 14:48:40 +02:00
Michal Privoznik
551fb778f5 virnuma: Use numa_nodes_ptr when checking available NUMA nodes
In v6.7.0-rc1~86 I've tried to fix a problem where we were not
detecting NUMA nodes properly because we misused behaviour of a
libnuma API and as it turned out the behaviour was correct for
hosts with 64 CPUs in one NUMA node. So I changed the code to use
nodemask_isset(&numa_all_nodes, ..) instead and it fixed the
problem on such hosts. However, what I did not realize is that
numa_all_nodes does not reflect all NUMA nodes visible to
userspace, it contains only those nodes that the process
(libvirtd) an allocate memory from, which can be only a subset of
all NUMA nodes. The bitmask that contains all NUMA nodes visible
to userspace and which one I should have used is: numa_nodes_ptr.
For curious ones:

4a22f22382

And as I was fixing virNumaGetNodeCPUs() I came to realize that
we already have a function that wraps the correct bitmask:
virNumaNodeIsAvailable().

Fixes: 24d7d85208
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1876956
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-09-11 13:57:29 +02:00
Michal Privoznik
a2df82b621 virnuma: Assume numa_bitmask_isbitset() exists
This function was introduced in the 2.0.6 release which happened
in December 2010. I think it is safe to assume that all libnuma
we deal with have the function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-09-11 13:57:21 +02:00
Yi Li
b1f10ed031 tools: virsh-domain: Remove redundant conditional before virshDomainFree
virshDomainFree handles NULL pointers gracefully, so there's no need to
check the pointer before the call.

Signed-off-by: Yi Li <yili@winhong.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2020-09-11 10:12:09 +02:00