]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
4 years agovsh: Rework how option to complete is found
Michal Privoznik [Tue, 26 Jan 2021 08:51:27 +0000 (09:51 +0100)]
vsh: Rework how option to complete is found

The way that auto completion works currently is that user's input
is parsed, and then we try to find the first --option (in the
parsed structure) that has the same value as user's input around
where <TAB> was pressed. For instance, for the following input:

  virsh # command --arg1 hello --arg2 world<TAB>

we will see "world" as text that user is trying to autocomplete
(this is affected by rl_basic_word_break_characters which
readline uses internally to break user's input into individual
words) and find that it is --arg2 that user is trying to
autocomplete. So far so good, for this naive approach. But
consider the following example:

  virsh # command --arg1 world --arg2 world<TAB>

Here, both arguments have the same value and because we see
"world" as text that user is trying to autocomplete we would
think that it is --arg1 that user wants to autocomplete. This is
obviously wrong.

Fortunately, readline stores the current position of cursor (into
rl_point) and we can use that when parsing user's input: whenever
we reach a position that matches the cursor then we know that
that is the place where <TAB> was pressed and hence that is the
--option that user wants to autocomplete. Readline stores the
cursor position as offset (numbered from 1) from the beginning of
user's input. We store this input into @parser->pos initially,
but then advance it as we tokenize it. Therefore, what we need is
to store the original position too.

Thanks to Martin who helped me with this.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovshReadlineParse: Escape list of candidates earlier
Michal Privoznik [Tue, 26 Jan 2021 08:23:24 +0000 (09:23 +0100)]
vshReadlineParse: Escape list of candidates earlier

The way our completer callbacks work is that they return all
possible candidates and then vshCompleterFilter() is called to
prune the list of all candidates removing those which don't match
user's input. This allows us to have simpler completer callbacks
as their only job is to fetch all possible candidates.

Anyway, if the completion candidate we're returning contains a
space, it has to be escaped (shell like escaping), unless there
is already a quote character (single quote or double quote).

But ordering is critical. Completer callback returns string
without any escaping, but the filter function sees the user input
escaped. For instance, if user's input is "domain with
space<TAB>" then the filtering function gets "domain\ with\
space" as user's input but completer returns "domain with space".
Since these two strings don't match the filtering function
removes this candidate from the list. What we need to do is to
escape strings before calling the filtering function. This way,
the filtering function will see two same strings.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovshReadlineParse: Rename @buf to @line
Michal Privoznik [Tue, 26 Jan 2021 08:23:10 +0000 (09:23 +0100)]
vshReadlineParse: Rename @buf to @line

In next commit the block that does escaping of returned string
will be brought into this block. But both contain variable @buf
and use it in different contexts. Rename @buf from @state == 0
block to @line which reflects its purpose better.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovshReadlineParse: Use g_auto*()
Michal Privoznik [Tue, 26 Jan 2021 09:23:32 +0000 (10:23 +0100)]
vshReadlineParse: Use g_auto*()

Instead of freeing @partial and @buf explicitly, we can use
g_auto*() to do that automatically.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovshReadlineParse: Bring some variables into !state block
Michal Privoznik [Tue, 26 Jan 2021 08:18:21 +0000 (09:18 +0100)]
vshReadlineParse: Bring some variables into !state block

On readline completion vshReadlineCompletion() is called which
does nothing more than calling rl_completion_matches() with
vshReadlineParse() as a callback. This means, that
vshReadlineParse() is called repeatedly, each time returning next
completion candidate, until it returns NULL which is interpreted
as the end of the list of candidates.

The function takes two parameters: @text which is a portion of
input line around cursor when TAB was pressed, and @state. The
@state is an integer that is zero on the very first call and
non-zero on each subsequent call (in fact, readline does @state++
on each call).

Anyway, the idea is that the callback gets the whole list of
candidates on @state == 0 and returns one candidate at each call.
And this is what vshReadlineParse() is doing but some variables
(@partial, @cmd and @opt) are really used only in the @state == 0
case but declared for whole function. We can limit their scope by
declaring them inside the @state == 0 body which also means that
they don't have to be static anymore.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovsh: Don't break word on backslash
Michal Privoznik [Thu, 7 Jan 2021 16:58:41 +0000 (17:58 +0100)]
vsh: Don't break word on backslash

A backslash is the way we escape characters in virsh. For
instance:

  virsh # start domain\ with\ long\ name

For readline completion, we do not want to get four separate
words ("domain", "with", "long", "name").  This means, that we
can't use virBufferEscapeShell() because it doesn't escape spaces
the way we want.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovshCommandStringGetArg: Drop @sz
Michal Privoznik [Thu, 7 Jan 2021 16:59:55 +0000 (17:59 +0100)]
vshCommandStringGetArg: Drop @sz

This variable is unused since introduction of the function in
v0.8.5~150.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agocpu_map: Remove intel-pt from x86 CPU models
Jiri Denemark [Fri, 22 Jan 2021 14:04:42 +0000 (15:04 +0100)]
cpu_map: Remove intel-pt from x86 CPU models

As explained in QEMU commit 4c257911dcc7c4189768e9651755c849ce9db4e8
intel-pt features should never be included in the CPU models as it was
not supported by KVM back then and even once it started to be supported,
users have to enable it by passing pt_mode=1 parameter to kvm_intel
module. The Icelake-* CPU models with intel-pt included were added to
QEMU 3.1.0 and removed right in the following 4.0.0 release (and even in
3.1.1 maintenance release).

In libvirt 6.10.0 I introduced 'removed' attribute for features included
in our CPU model definitions which we can use to drop intel-pt from
Icelake-* CPU models. Back then I explained we can safely do so only for
features which could never be enabled, which is not the case of intel-pt.

Theoretically, it could be possible to create an environment in which
QEMU would enable intel-pt without asking for it explicitly: it would
need to use a new enough kernel (not available at the time of QEMU
3.1.0) and pt_mode KVM parameter in combination with QEMU 3.1.0 running
a domain with q35 machine type and all that on a CPU which didn't really
exist at that time.

Migrating such domain to a host with newer SW stack including libvirt
with this patch applied would result in incompatible guest ABI (the
virtual CPU would lose intel-pt). However, QEMU changed its CPU models
unconditionally and thus migration would not work even without this
patch. That said, it is safe to follow QEMU and remove the feature from
Icelake-* CPU models in our cpu_map.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
4 years agoFix format network dns doc
Cédric Bosdonnat [Mon, 25 Jan 2021 13:56:01 +0000 (14:56 +0100)]
Fix format network dns doc

The code block on the srv name in the formatnetwork page is confusing
since the actual parameter is service. Moving the code block to the
service work makes it better.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
4 years agogitlab: force dwarf4 format for debuginfo in Fedora rawhide
Daniel P. Berrangé [Mon, 25 Jan 2021 18:13:57 +0000 (18:13 +0000)]
gitlab: force dwarf4 format for debuginfo in Fedora rawhide

Fedora 34 rawhide has pulled in a new GCC 11 build which now
defaults to dwarf5 format. This format is not compatible with
the pdwtags program used in our test suite to validate the
RPC files.

We have no need for debuginfo in CI except for pdwtags,
so the simplest short term fix is to force the older dwarf
version in the hope that a fixed dwarves release will
arrive before Fedora 34 is released, or GCC 11 becomes more
widespread. Eventually we might need to figure out a way to
probe for compatibility but for now, we'll hope that any
distro with GCC 11 will be able to have a fixed dwarves too.

https://bugzilla.redhat.com/show_bug.cgi?id=1919965
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoci: Refresh dockerfiles
Andrea Bolognani [Wed, 20 Jan 2021 16:28:03 +0000 (17:28 +0100)]
ci: Refresh dockerfiles

dtrace is now also installed when cross-building.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agomeson: Fix cross-building of dtrace probes
Helmut Grohne [Mon, 18 Jan 2021 23:08:23 +0000 (00:08 +0100)]
meson: Fix cross-building of dtrace probes

dtrace invokes the C compiler, so when cross-building we need
to make sure that $CC is set in the environment and that it
points to the cross-compiler rather than the native one.

Until https://github.com/mesonbuild/meson/issues/266
is addressed, the workaround is to call dtrace via env(1).

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=980334

Signed-off-by: Helmut Grohne <helmut@subdivi.de>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoutil: Add phys_port_name support on virPCIGetNetName
Dmytro Linkin [Thu, 21 Jan 2021 12:15:22 +0000 (14:15 +0200)]
util: Add phys_port_name support on virPCIGetNetName

virPCIGetNetName is used to get the name of the netdev associated with
a particular PCI device. This is used when we have a VF name, but need
the PF name in order to send a netlink command (e.g. in order to
get/set the MAC address of the VF).

In simple cases there is a single netdev associated with any PCI
device, so it is easy to figure out the PF netdev for a VF - just look
for the PCI device that has the VF listed in its "virtfns" directory;
the only name in the "net" subdirectory of that PCI device's sysfs
directory is the PF netdev that is upstream of the VF in question.

In some cases there can be more than one netdev in a PCI device's net
directory though. In the past, the only case of this was for SR-IOV
NICs that could have multiple PF's per PCI device. In this case, all
PF netdevs associated with a PCI address would be listed in the "net"
subdirectory of the PCI device's directory in sysfs. At the same time,
all VF netdevs and all PF netdevs have a phys_port_id in their sysfs,
so the way to learn the correct PF netdev for a particular VF netdev
is to search through the list of devices in the net subdirectory of
the PF's PCI device, looking for the one netdev with a "phys_port_id"
matching that of the VF netdev.

But starting in kernel 5.8, the NVIDIA Mellanox driver began linking
the VFs' representor netdevs to the PF PCI address [1], and so the VF
representor netdevs would also show up in the net
subdirectory. However, all of the devices that do so also only have a
single PF netdev for any given PCI address.

This means that the net directory of the PCI device can still hold
multiple net devices, but only one of them will be the PF netdev (the
others are VF representors):

$ ls '/sys/bus/pci/devices/0000:82:00.0/net'
ens1f0  eth0  eth1

In this case the way to find the PF device is to look at the
"phys_port_name" attribute of each netdev in sysfs. All PF devices
have a phys_port_name matching a particular regex

  (p[0-9]+$)|(p[0-9]+s[0-9]+$)

Since there can only be one PF in the entire list of devices, once we
match that regex, we've found the PF netdev.

[1] - https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
      commit/?id=123f0f53dd64b67e34142485fe866a8a581f12f1

Co-Authored-by: Moshe Levi <moshele@nvidia.com>
Signed-off-by: Dmytro Linkin <dlinkin@nvidia.com>
Reviewed-by: Adrian Chiris <adrianc@nvidia.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agoutil: add virNetDevGetPhysPortName
Moshe Levi [Thu, 21 Jan 2021 12:15:21 +0000 (14:15 +0200)]
util: add virNetDevGetPhysPortName

This commit add virNetDevGetPhysPortName to read netdevice
phys_port_name from sysfs. It also refactor the code so
virNetDevGetPhysPortName and virNetDevGetPhysPortID will use
same method to read the netdevice sysfs.

Signed-off-by: Moshe Levi <moshele@nvidia.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agodocs: formatdomain: Fix poll-control XML example
Cole Robinson [Sun, 24 Jan 2021 23:40:17 +0000 (18:40 -0500)]
docs: formatdomain: Fix poll-control XML example

Fixes: 3fc4412c6f5
Signed-off-by: Cole Robinson <crobinso@redhat.com>
4 years agospec: Increase meson test timeout 10x
Cole Robinson [Thu, 21 Jan 2021 21:54:45 +0000 (16:54 -0500)]
spec: Increase meson test timeout 10x

Tests time out when building in slow environments, like emulated
s390x in Fedora copr. Bump up the test timeout

Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
4 years agohyperv: use g_auto for WsXmlDocH in hypervDomainAttachCDROM
Matt Coleman [Thu, 21 Jan 2021 18:51:35 +0000 (13:51 -0500)]
hyperv: use g_auto for WsXmlDocH in hypervDomainAttachCDROM

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_auto for WsXmlDocH in hypervDomainAttachVirtualDisk
Matt Coleman [Thu, 21 Jan 2021 18:51:34 +0000 (13:51 -0500)]
hyperv: use g_auto for WsXmlDocH in hypervDomainAttachVirtualDisk

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use GLib auto-cleanup in hypervCreateInvokeXmlDoc
Matt Coleman [Thu, 21 Jan 2021 18:51:33 +0000 (13:51 -0500)]
hyperv: use GLib auto-cleanup in hypervCreateInvokeXmlDoc

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use GLib auto-cleanup in hypervSerializeEmbeddedParam
Matt Coleman [Thu, 21 Jan 2021 18:51:32 +0000 (13:51 -0500)]
hyperv: use GLib auto-cleanup in hypervSerializeEmbeddedParam

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use GLib auto-cleanup in hypervEnumAndPull
Matt Coleman [Thu, 21 Jan 2021 18:51:31 +0000 (13:51 -0500)]
hyperv: use GLib auto-cleanup in hypervEnumAndPull

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use GLib auto-cleanup in hypervSerializeEprParam
Matt Coleman [Thu, 21 Jan 2021 18:51:30 +0000 (13:51 -0500)]
hyperv: use GLib auto-cleanup in hypervSerializeEprParam

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for WMI classes in hypervDomainAttachDeviceFlags
Matt Coleman [Thu, 21 Jan 2021 18:51:29 +0000 (13:51 -0500)]
hyperv: use g_autoptr for WMI classes in hypervDomainAttachDeviceFlags

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use GLib auto-cleanup in hypervDomainGetXMLDesc
Matt Coleman [Thu, 21 Jan 2021 18:51:28 +0000 (13:51 -0500)]
hyperv: use GLib auto-cleanup in hypervDomainGetXMLDesc

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Win32_OperatingSystem in hypervNodeGetFreeMemory
Matt Coleman [Thu, 21 Jan 2021 18:51:27 +0000 (13:51 -0500)]
hyperv: use g_autoptr for Win32_OperatingSystem in hypervNodeGetFreeMemory

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Win32_PerfRawData_HvStats_HyperVHypervisorVirtualProcessor...
Matt Coleman [Thu, 21 Jan 2021 18:51:26 +0000 (13:51 -0500)]
hyperv: use g_autoptr for Win32_PerfRawData_HvStats_HyperVHypervisorVirtualProcessor in hypervDomainGetVcpus

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use GLib auto-cleanup in hypervMsvmVSMSAddResourceSettings and hypervMsvmVSMS...
Matt Coleman [Thu, 21 Jan 2021 18:51:25 +0000 (13:51 -0500)]
hyperv: use GLib auto-cleanup in hypervMsvmVSMSAddResourceSettings and hypervMsvmVSMSModifyResourceSettings

Fixes a memory leak when hypervCreateInvokeParamsList() fails.

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use GLib auto-cleanup in hypervInvokeMsvmComputerSystemRequestStateChange
Matt Coleman [Thu, 21 Jan 2021 18:51:24 +0000 (13:51 -0500)]
hyperv: use GLib auto-cleanup in hypervInvokeMsvmComputerSystemRequestStateChange

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use GLib auto-cleanup in hypervInvokeMethod
Matt Coleman [Thu, 21 Jan 2021 18:51:23 +0000 (13:51 -0500)]
hyperv: use GLib auto-cleanup in hypervInvokeMethod

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use GLib auto-cleanup in hypervDomainSendKey
Matt Coleman [Thu, 21 Jan 2021 18:51:22 +0000 (13:51 -0500)]
hyperv: use GLib auto-cleanup in hypervDomainSendKey

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Msvm_ComputerSystem in hypervConnectListAllDomains
Matt Coleman [Thu, 21 Jan 2021 18:51:21 +0000 (13:51 -0500)]
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervConnectListAllDomains

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainManagedSaveRemove
Matt Coleman [Thu, 21 Jan 2021 18:51:20 +0000 (13:51 -0500)]
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainManagedSaveRemove

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainHasManagedSaveImage
Matt Coleman [Thu, 21 Jan 2021 18:51:19 +0000 (13:51 -0500)]
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainHasManagedSaveImage

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainManagedSave
Matt Coleman [Thu, 21 Jan 2021 18:51:18 +0000 (13:51 -0500)]
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainManagedSave

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainIsActive
Matt Coleman [Thu, 21 Jan 2021 18:51:17 +0000 (13:51 -0500)]
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainIsActive

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for WMI classes in hypervDomainGetSchedulerParametersFlags
Matt Coleman [Thu, 21 Jan 2021 18:51:16 +0000 (13:51 -0500)]
hyperv: use g_autoptr for WMI classes in hypervDomainGetSchedulerParametersFlags

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Msvm_VirtualSystemSettingData in hypervDomainSetAutostart
Matt Coleman [Thu, 21 Jan 2021 18:51:15 +0000 (13:51 -0500)]
hyperv: use g_autoptr for Msvm_VirtualSystemSettingData in hypervDomainSetAutostart

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Msvm_VirtualSystemSettingData in hypervDomainGetAutostart
Matt Coleman [Thu, 21 Jan 2021 18:51:14 +0000 (13:51 -0500)]
hyperv: use g_autoptr for Msvm_VirtualSystemSettingData in hypervDomainGetAutostart

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainCreateWithFlags
Matt Coleman [Thu, 21 Jan 2021 18:51:13 +0000 (13:51 -0500)]
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainCreateWithFlags

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Msvm_ComputerSystem in hypervConnectNumOfDefinedDomains
Matt Coleman [Thu, 21 Jan 2021 18:51:12 +0000 (13:51 -0500)]
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervConnectNumOfDefinedDomains

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Msvm_ComputerSystem in hypervConnectListDefinedDomains
Matt Coleman [Thu, 21 Jan 2021 18:51:11 +0000 (13:51 -0500)]
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervConnectListDefinedDomains

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for WMI classes in hypervDomainGetVcpusFlags
Matt Coleman [Thu, 21 Jan 2021 18:51:10 +0000 (13:51 -0500)]
hyperv: use g_autoptr for WMI classes in hypervDomainGetVcpusFlags

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for WMI classes in hypervDomainSetVcpusFlags
Matt Coleman [Thu, 21 Jan 2021 18:51:09 +0000 (13:51 -0500)]
hyperv: use g_autoptr for WMI classes in hypervDomainSetVcpusFlags

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainGetState
Matt Coleman [Thu, 21 Jan 2021 18:51:08 +0000 (13:51 -0500)]
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainGetState

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for WMI classes in hypervDomainGetInfo
Matt Coleman [Thu, 21 Jan 2021 18:51:07 +0000 (13:51 -0500)]
hyperv: use g_autoptr for WMI classes in hypervDomainGetInfo

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Msvm_DiskDrive in hypervDomainDefParsePhysicalDisk
Matt Coleman [Thu, 21 Jan 2021 18:51:06 +0000 (13:51 -0500)]
hyperv: use g_autoptr for Msvm_DiskDrive in hypervDomainDefParsePhysicalDisk

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for WMI classes in hypervDomainAttachStorage
Matt Coleman [Thu, 21 Jan 2021 18:51:05 +0000 (13:51 -0500)]
hyperv: use g_autoptr for WMI classes in hypervDomainAttachStorage

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Msvm_ResourceAllocationSettingData in hypervDomainAttachPhy...
Matt Coleman [Thu, 21 Jan 2021 18:51:04 +0000 (13:51 -0500)]
hyperv: use g_autoptr for Msvm_ResourceAllocationSettingData in hypervDomainAttachPhysicalDisk

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Win32_ComputerSystemProduct in hypervLookupHostSystemBiosUuid
Matt Coleman [Thu, 21 Jan 2021 18:51:03 +0000 (13:51 -0500)]
hyperv: use g_autoptr for Win32_ComputerSystemProduct in hypervLookupHostSystemBiosUuid

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Msvm_ComputerSystem in hypervRequestStateChange
Matt Coleman [Thu, 21 Jan 2021 18:51:02 +0000 (13:51 -0500)]
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervRequestStateChange

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for WMI classes in hypervDomainSetMemoryProperty
Matt Coleman [Thu, 21 Jan 2021 18:51:01 +0000 (13:51 -0500)]
hyperv: use g_autoptr for WMI classes in hypervDomainSetMemoryProperty

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for WMI classes in hypervDomainGetMaxMemory
Matt Coleman [Thu, 21 Jan 2021 18:51:00 +0000 (13:51 -0500)]
hyperv: use g_autoptr for WMI classes in hypervDomainGetMaxMemory

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainDestroyFlags
Matt Coleman [Thu, 21 Jan 2021 18:50:59 +0000 (13:50 -0500)]
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainDestroyFlags

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for WMI classes in hypervDomainShutdownFlags
Matt Coleman [Thu, 21 Jan 2021 18:50:58 +0000 (13:50 -0500)]
hyperv: use g_autoptr for WMI classes in hypervDomainShutdownFlags

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainResume
Matt Coleman [Thu, 21 Jan 2021 18:50:57 +0000 (13:50 -0500)]
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainResume

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainLookupByName
Matt Coleman [Thu, 21 Jan 2021 18:50:56 +0000 (13:50 -0500)]
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainLookupByName

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainLookupByUUID
Matt Coleman [Thu, 21 Jan 2021 18:50:55 +0000 (13:50 -0500)]
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainLookupByUUID

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainLookupByID
Matt Coleman [Thu, 21 Jan 2021 18:50:54 +0000 (13:50 -0500)]
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainLookupByID

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Msvm_ComputerSystem in hypervConnectListDomains
Matt Coleman [Thu, 21 Jan 2021 18:50:53 +0000 (13:50 -0500)]
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervConnectListDomains

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Msvm_ComputerSystem in hypervConnectNumOfDomains
Matt Coleman [Thu, 21 Jan 2021 18:50:52 +0000 (13:50 -0500)]
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervConnectNumOfDomains

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for WMI classes in hypervNodeGetInfo
Matt Coleman [Thu, 21 Jan 2021 18:50:51 +0000 (13:50 -0500)]
hyperv: use g_autoptr for WMI classes in hypervNodeGetInfo

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Msvm_ProcessorSettingData in hypervConnectGetMaxVcpus
Matt Coleman [Thu, 21 Jan 2021 18:50:50 +0000 (13:50 -0500)]
hyperv: use g_autoptr for Msvm_ProcessorSettingData in hypervConnectGetMaxVcpus

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Win32_ComputerSystem in hypervConnectGetHostname
Matt Coleman [Thu, 21 Jan 2021 18:50:49 +0000 (13:50 -0500)]
hyperv: use g_autoptr for Win32_ComputerSystem in hypervConnectGetHostname

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: use g_autoptr for Win32_OperatingSystem in hypervConnectOpen
Matt Coleman [Thu, 21 Jan 2021 18:50:48 +0000 (13:50 -0500)]
hyperv: use g_autoptr for Win32_OperatingSystem in hypervConnectOpen

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: enable automatic cleanup for OpenWSMAN types
Matt Coleman [Thu, 21 Jan 2021 18:50:47 +0000 (13:50 -0500)]
hyperv: enable automatic cleanup for OpenWSMAN types

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: enable use of g_autoptr for the rest of the CIM/WMI classes
Matt Coleman [Thu, 21 Jan 2021 18:50:46 +0000 (13:50 -0500)]
hyperv: enable use of g_autoptr for the rest of the CIM/WMI classes

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: enable use of g_autoptr for hypervObject
Matt Coleman [Thu, 21 Jan 2021 18:50:45 +0000 (13:50 -0500)]
hyperv: enable use of g_autoptr for hypervObject

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: store hypervPrivate in hypervObject
Matt Coleman [Thu, 21 Jan 2021 18:50:44 +0000 (13:50 -0500)]
hyperv: store hypervPrivate in hypervObject

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: add inheritance to the WMI generator
Matt Coleman [Thu, 21 Jan 2021 18:50:43 +0000 (13:50 -0500)]
hyperv: add inheritance to the WMI generator

This enables casting subtypes to their parent.

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: store the Hyper-V version when connecting
Matt Coleman [Thu, 21 Jan 2021 18:50:42 +0000 (13:50 -0500)]
hyperv: store the Hyper-V version when connecting

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agohyperv: add a macro for retrieving setting data
Matt Coleman [Thu, 21 Jan 2021 18:50:41 +0000 (13:50 -0500)]
hyperv: add a macro for retrieving setting data

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agostorage_source: use virStorageSource prefix for all functions
Pavel Hrdina [Thu, 21 Jan 2021 15:46:14 +0000 (16:46 +0100)]
storage_source: use virStorageSource prefix for all functions

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoutil: move virStorageEncryption code into conf
Pavel Hrdina [Tue, 8 Dec 2020 15:54:30 +0000 (16:54 +0100)]
util: move virStorageEncryption code into conf

The code handles XML bits and internal definition and should be
in conf directory.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoutil: move virStorageSource code into conf
Pavel Hrdina [Thu, 21 Jan 2021 14:44:53 +0000 (15:44 +0100)]
util: move virStorageSource code into conf

The code handles XML bits and internal definition and should be
in conf directory.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoutil: move virStorageFileProbe code into storage_file
Pavel Hrdina [Fri, 22 Jan 2021 09:39:10 +0000 (10:39 +0100)]
util: move virStorageFileProbe code into storage_file

Same as virStorageFileBackend, it doesn't belong into util directory.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoutil: move virStorageFileBackend code into storage_file
Pavel Hrdina [Fri, 22 Jan 2021 09:37:33 +0000 (10:37 +0100)]
util: move virStorageFileBackend code into storage_file

It's used only by storage file code so it doesn't make sense to have
it in util directory.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoutil: extract virStorageFile code into storage_source
Pavel Hrdina [Fri, 22 Jan 2021 09:36:21 +0000 (10:36 +0100)]
util: extract virStorageFile code into storage_source

Up until now we had a runtime code and XML related code in the same
source file inside util directory.

This patch takes the runtime part and extracts it into the new
storage_file directory.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoutil: extract storage file probe code into virtstoragefileprobe.c
Pavel Hrdina [Thu, 21 Jan 2021 16:03:12 +0000 (17:03 +0100)]
util: extract storage file probe code into virtstoragefileprobe.c

This code is not directly relevant to virStorageSource so move it to
separate file.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoutil: move virStorageSourceFindByNodeName into qemu_domain
Pavel Hrdina [Fri, 15 Jan 2021 19:52:00 +0000 (20:52 +0100)]
util: move virStorageSourceFindByNodeName into qemu_domain

It's only relevant for QEMU driver.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agostorage: move storage file sources to separate directory
Pavel Hrdina [Wed, 2 Dec 2020 12:10:59 +0000 (13:10 +0100)]
storage: move storage file sources to separate directory

Introduce a new storage_file directory where we will keep storage file
related code. Add a backend prefix to the file name to separate it from
other future files with 'storage_file' prefix.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirstoragefile: change virStorageSource->drv to void pointer
Pavel Hrdina [Tue, 8 Dec 2020 14:22:57 +0000 (15:22 +0100)]
virstoragefile: change virStorageSource->drv to void pointer

This will allow following patches to move virStorageSource into conf
directory and virStorageDriverData into a new storage_file directory.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirstoragefile: properly include virstoragefile.h header
Pavel Hrdina [Thu, 21 Jan 2021 15:47:52 +0000 (16:47 +0100)]
virstoragefile: properly include virstoragefile.h header

It was indirectly included by virstoragefilebackend.h.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agosrc: add missing virstoragefile.h includes
Pavel Hrdina [Thu, 21 Jan 2021 14:34:45 +0000 (15:34 +0100)]
src: add missing virstoragefile.h includes

These files are using functions from virstoragefile.h but are missing
explicit include.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirsh: Fix XPATH in virshDomainDeviceAliasCompleter()
Michal Privoznik [Fri, 22 Jan 2021 08:29:54 +0000 (09:29 +0100)]
virsh: Fix XPATH in virshDomainDeviceAliasCompleter()

The way this completer works is that it dumps XML of specified
domain and then tries to look for @name attribute of <alias/>
element. However, the XPATH it uses is not correct which results
in no aliases returned by the completer.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirNetworkDHCPLeaseTimeDefParseXML: Output error when 'expiry' can't be parsed
Peter Krempa [Thu, 21 Jan 2021 16:35:12 +0000 (17:35 +0100)]
virNetworkDHCPLeaseTimeDefParseXML: Output error when 'expiry' can't be parsed

virStrToLong_ul doesn't report it's own error.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1918674
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agoapparmor: let image label setting loop over backing files
Christian Ehrhardt [Wed, 13 Jan 2021 11:32:18 +0000 (12:32 +0100)]
apparmor: let image label setting loop over backing files

When adding a rule for an image file and that image file has a chain
of backing files then we need to add a rule for each of those files.

To get that iterate over the backing file chain the same way as
dac/selinux already do and add a label for each.

Fixes: https://gitlab.com/libvirt/libvirt/-/issues/118
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
4 years agoNEWS: Document virtio-pmem model
Michal Privoznik [Thu, 21 Jan 2021 12:21:35 +0000 (13:21 +0100)]
NEWS: Document virtio-pmem model

A few commits ago I've implemented virtio-pmem memory model.
Mention it in the news file.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agohyperv: implement domainAttachDevice and domainAttachDeviceFlags
Matt Coleman [Thu, 14 Jan 2021 13:03:41 +0000 (08:03 -0500)]
hyperv: implement domainAttachDevice and domainAttachDeviceFlags

Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: attach floppy disks when defining domains
Matt Coleman [Thu, 14 Jan 2021 13:03:40 +0000 (08:03 -0500)]
hyperv: attach floppy disks when defining domains

Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: attach virtual optical disks when defining domains
Matt Coleman [Thu, 14 Jan 2021 13:03:39 +0000 (08:03 -0500)]
hyperv: attach virtual optical disks when defining domains

Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: attach physical disks when defining domains
Matt Coleman [Thu, 14 Jan 2021 13:03:38 +0000 (08:03 -0500)]
hyperv: attach physical disks when defining domains

Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: attach virtual disks when defining domains
Matt Coleman [Thu, 14 Jan 2021 13:03:37 +0000 (08:03 -0500)]
hyperv: attach virtual disks when defining domains

Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: create SCSI controllers when defining domains
Matt Coleman [Thu, 14 Jan 2021 13:03:36 +0000 (08:03 -0500)]
hyperv: create SCSI controllers when defining domains

Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: add hypervMsvmVSMSAddResourceSettings
Matt Coleman [Thu, 14 Jan 2021 13:03:35 +0000 (08:03 -0500)]
hyperv: add hypervMsvmVSMSAddResourceSettings

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: implement domainDefineXML
Matt Coleman [Thu, 14 Jan 2021 13:03:34 +0000 (08:03 -0500)]
hyperv: implement domainDefineXML

Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: implement domainUndefine and domainUndefineFlags
Matt Coleman [Thu, 14 Jan 2021 13:03:33 +0000 (08:03 -0500)]
hyperv: implement domainUndefine and domainUndefineFlags

Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: ambiguous VM names will throw an error
Matt Coleman [Thu, 14 Jan 2021 13:03:32 +0000 (08:03 -0500)]
hyperv: ambiguous VM names will throw an error

Since Hyper-V allows multiple VMs to be created with the same name,
some commands produce unpredictable results due to
hypervDomainLookupByName's WMI query selecting the wrong domain.

For example, this prevents `virsh dumpxml` from outputting XML for the
wrong domain.

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoci: Drop openSUSE Leap 15.1
Erik Skultety [Wed, 20 Jan 2021 07:06:35 +0000 (08:06 +0100)]
ci: Drop openSUSE Leap 15.1

Leap 15.1 will reach EOL on January 31st 2021, so we should not test on
it during the current development cycle ending on March 1st.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoci: Add openSUSE Leap 15.2
Erik Skultety [Tue, 19 Jan 2021 07:28:42 +0000 (08:28 +0100)]
ci: Add openSUSE Leap 15.2

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoci: Refresh Dockerfiles
Erik Skultety [Tue, 19 Jan 2021 07:21:26 +0000 (08:21 +0100)]
ci: Refresh Dockerfiles

In this refresh CentOS 7 now uses docker.io registry and the PowerTools
repo name regression was fixed for CentOS Stream this time.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>