[PATCH] virsh: Simplify @flags handing in cmdSetmem() and cmdSetmaxmem()
by Michal Privoznik
What code tries to achieve is that if no flags were provided to
either 'setmem' or 'setmaxmem' commands then the old (no flags)
API is called to be able to communicate with older daemons.
Well, the code can be simplified a bit.
Note that with this change the old no flag version of APIs is
used more often. Previously if --current argument was given it
resulted in *Flags() version to be called even though it is not
necessary - VIR_DOMAIN_AFFECT_CURRENT is implied.
Therefore, this change in fact allows virsh to talk with broader
set of daemons.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tools/virsh-domain.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 2bb136333f..9746117bdb 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -9018,9 +9018,6 @@ cmdSetmem(vshControl *ctl, const vshCmd *cmd)
flags |= VIR_DOMAIN_AFFECT_CONFIG;
if (live)
flags |= VIR_DOMAIN_AFFECT_LIVE;
- /* none of the options were specified */
- if (!current && !live && !config)
- flags = -1;
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
return false;
@@ -9037,7 +9034,7 @@ cmdSetmem(vshControl *ctl, const vshCmd *cmd)
}
kibibytes = VIR_DIV_UP(bytes, 1024);
- if (flags == -1) {
+ if (flags == 0) {
if (virDomainSetMemory(dom, kibibytes) != 0)
ret = false;
} else {
@@ -9090,7 +9087,7 @@ cmdSetmaxmem(vshControl *ctl, const vshCmd *cmd)
bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
bool current = vshCommandOptBool(cmd, "current");
- unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT | VIR_DOMAIN_MEM_MAXIMUM;
+ unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
@@ -9099,9 +9096,6 @@ cmdSetmaxmem(vshControl *ctl, const vshCmd *cmd)
flags |= VIR_DOMAIN_AFFECT_CONFIG;
if (live)
flags |= VIR_DOMAIN_AFFECT_LIVE;
- /* none of the options were specified */
- if (!current && !live && !config)
- flags = -1;
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
return false;
@@ -9118,13 +9112,13 @@ cmdSetmaxmem(vshControl *ctl, const vshCmd *cmd)
}
kibibytes = VIR_DIV_UP(bytes, 1024);
- if (flags == -1) {
+ if (flags == 0) {
if (virDomainSetMaxMemory(dom, kibibytes) != 0) {
vshError(ctl, "%s", _("Unable to change MaxMemorySize"));
ret = false;
}
} else {
- if (virDomainSetMemoryFlags(dom, kibibytes, flags) < 0) {
+ if (virDomainSetMemoryFlags(dom, kibibytes, flags | VIR_DOMAIN_MEM_MAXIMUM) < 0) {
vshError(ctl, "%s", _("Unable to change MaxMemorySize"));
ret = false;
}
--
2.26.2
3 years, 10 months
[PATCH 00/12] Hyper-V serial ports, NICs, and screeshots
by Matt Coleman
This patchset makes the following changes to the Hyper-V driver:
* enable XML parsing and creation of serial ports and NICs
* implement several networking APIs
* implement screenshots
Matt Coleman (12):
hyperv: XML parsing of serial ports
hyperv: add support for creating serial devices
hyperv: XML parsing of Ethernet adapters
hyperv: add support for creating network adapters
hyperv: implement connectListAllNetworks and connectNumOfNetworks
hyperv: implement networkLookupByName and networkLookupByUUID
hyperv: implement connectNumOfDefinedNetworks and
connectListDefinedNetworks
hyperv: implement networkGetAutostart, networkIsActive, and
networkIsPersistent
hyperv: implement networkGetXMLDesc
hyperv: implement domainScreenshot
hyperv: provide a more detailed error message for WSMan faults
news: implement new Hyper-V APIs
NEWS.rst | 12 +
po/POTFILES.in | 1 +
src/hyperv/hyperv_driver.c | 620 ++++++++++++++++++++++++++
src/hyperv/hyperv_network_driver.c | 242 ++++++++++
src/hyperv/hyperv_network_driver.h | 26 ++
src/hyperv/hyperv_wmi.c | 45 +-
src/hyperv/hyperv_wmi.h | 12 +
src/hyperv/hyperv_wmi_classes.h | 36 ++
src/hyperv/hyperv_wmi_generator.input | 309 +++++++++++++
src/hyperv/meson.build | 1 +
10 files changed, 1301 insertions(+), 3 deletions(-)
create mode 100644 src/hyperv/hyperv_network_driver.c
create mode 100644 src/hyperv/hyperv_network_driver.h
--
2.30.0
3 years, 10 months
[PATCH] virNetDevOpenvswitchGetVhostuserIfname: Remove a single '\n' from ifname
by Yalei Li
Ovs-vsctl returns a newline result.
Signed-off-by: Yalei Li <liyl43(a)chinatelecom.cn>
---
src/util/virnetdevopenvswitch.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c
index f9b3369b2a..bd840bd3b7 100644
--- a/src/util/virnetdevopenvswitch.c
+++ b/src/util/virnetdevopenvswitch.c
@@ -575,6 +575,7 @@ virNetDevOpenvswitchGetVhostuserIfname(const char *path,
return 0;
}
+ virStringTrimOptionalNewline(*ifname);
if (virNetDevOpenvswitchMaybeUnescapeReply(*ifname) < 0) {
VIR_FREE(*ifname);
return -1;
--
2.27.0
3 years, 10 months
[PATCH] Revert "remote: Add libvirtd dependency to virt-guest-shutdown.target"
by Jim Fehlig
Further testing revealed commit f035f53baa regresses Debian bug 955216
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=955216
Restarting libvirt-guests on libvirtd restart is worse than the original
dependency issue, so revert the commit until a better solution is found.
This reverts commit f035f53baa2e5dc00b8e866e594672a90b4cea78.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
src/remote/virt-guest-shutdown.target | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/remote/virt-guest-shutdown.target b/src/remote/virt-guest-shutdown.target
index e2efa3e63a..25d4aaa267 100644
--- a/src/remote/virt-guest-shutdown.target
+++ b/src/remote/virt-guest-shutdown.target
@@ -1,4 +1,3 @@
[Unit]
Description=Libvirt guests shutdown
-Requires=libvirtd.service
Documentation=https://libvirt.org
--
2.29.2
3 years, 10 months
[PATCH v2] docs: Clarify the documentation of the <css> elements
by Thomas Huth
The channel subsystem elements describe a channel in the I/O subsystem
of a s390x machine, and not a normal device (like a disk or network card).
Reword the documentation here to make it this a little bit clearer.
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1898074
Reviewed-by: Boris Fiuczynski <fiuczy(a)linux.ibm.com>
Signed-off-by: Thomas Huth <thuth(a)redhat.com>
---
v2: "channel" -> "subchannel" as suggested by Cornelia
docs/formatnode.html.in | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/formatnode.html.in b/docs/formatnode.html.in
index 1010a37a3d..5c7286df8a 100644
--- a/docs/formatnode.html.in
+++ b/docs/formatnode.html.in
@@ -396,15 +396,15 @@
</dl>
</dd>
<dt><code>css</code></dt>
- <dd>Describes a Channel SubSystem (CSS) device commonly found on
- the S390 architecture. Sub-elements include:
+ <dd>Describes a subchannel in the Channel SubSystem (CSS) commonly
+ found on the S390 architecture. Sub-elements include:
<dl>
<dt><code>cssid</code></dt>
<dd>The channel subsystem identifier.</dd>
<dt><code>ssid</code></dt>
<dd>The subchannel-set identifier.</dd>
<dt><code>devno</code></dt>
- <dd>The device number.</dd>
+ <dd>The subchannel number.</dd>
<dt><code>capability</code></dt>
<dd>
This optional element can occur multiple times. If it
--
2.27.0
3 years, 10 months
[PATCH] virfile: workaround for when posix_fallocate() is not supported by FS
by Roman Bogorodskiy
posix_fallocate() might be not supported by a filesystem, for example,
it's not supported by ZFS. In that case it fails with
return code 22 (EINVAL), and thus safezero_posix_fallocate() returns -1.
As safezero_posix_fallocate() is the first function tried by safezero()
and it tries other functions only when it returns -2, it fails
immediately without falling back to other methods, such as
safezero_slow().
Fix that by returning -2 if posix_fallocate() returns EINVAL, to give
safezero() a chance to try other functions.
Signed-off-by: Roman Bogorodskiy <bogorodskiy(a)gmail.com>
---
src/util/virfile.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/util/virfile.c b/src/util/virfile.c
index 609cafdd34..67a350deb3 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -1119,6 +1119,16 @@ safezero_posix_fallocate(int fd, off_t offset, off_t len)
int ret = posix_fallocate(fd, offset, len);
if (ret == 0)
return 0;
+ else if (ret == EINVAL)
+ /* EINVAL is returned when either:
+ - Operation is not supported by the underlying filesystem,
+ - offset or len argument values are invalid.
+ Assuming that offset and len are valid, this error means
+ the operation is not supported, and we need to fall back
+ to other methods.
+ */
+ return -2;
+
errno = ret;
return -1;
}
--
2.30.0
3 years, 10 months
[PULL 00/13] Misc patches
by Daniel P. Berrangé
The following changes since commit 5101d00d2f1138a73344dc4833587f76d7a5fa5c:
Merge remote-tracking branch 'remotes/vivier2/tags/trivial-branch-for-6.0-p=
ull-request' into staging (2021-01-29 10:10:43 +0000)
are available in the Git repository at:
https://gitlab.com/berrange/qemu tags/misc-fixes-pull-request
for you to fetch changes up to ecb98f5c7589ba8ecd15c8b1baa2ec7192e47c75:
tests: Replace deprecated ASN1 code (2021-01-29 17:07:53 +0000)
----------------------------------------------------------------
* Replace --enable/disable-git-update with --with-git-submodules
to allow improved control over use of git submodules
* Deprecate the -enable-fips option
* Ensure docs use prefer format for bool options
* Clarify platform support rules
* Misc fixes to keymap conversions
* Fix misc problems on macOS
----------------------------------------------------------------
Dan Streetman (1):
configure: replace --enable/disable-git-update with
--with-git-submodules
Daniel P. Berrang=C3=A9 (5):
os: deprecate the -enable-fips option and QEMU's FIPS enforcement
Prefer 'on' | 'off' over 'yes' | 'no' for bool options
docs: simplify and clarify the platform support rules
docs: fix missing backslash in certtool shell example
ui: update keycodemapdb submodule commit
Kevin Wolf (3):
crypto: Move USER_CREATABLE to secret_common base class
crypto: Forbid broken unloading of secrets
crypto: Fix memory leaks in set_loaded for tls-*
Stefan Weil (2):
tests: Fix runtime error in test-authz-pam
tests: Replace deprecated ASN1 code
shiliyang (2):
crypto: Fix some code style problems, add spaces around operator
crypto: Add spaces around operator
Makefile | 24 ++-----------
configure | 51 +++++++++++++++++++-------
crypto/aes.c | 6 ++--
crypto/desrfb.c | 4 +--
crypto/secret.c | 14 --------
crypto/secret_common.c | 21 +++++++++--
crypto/secret_keyring.c | 14 --------
crypto/tlscredsanon.c | 3 +-
crypto/tlscredspsk.c | 3 +-
crypto/tlscredsx509.c | 5 ++-
docs/system/build-platforms.rst | 63 ++++++++++++---------------------
docs/system/deprecated.rst | 12 +++++++
docs/system/tls.rst | 2 +-
docs/system/vnc-security.rst | 10 +++---
include/authz/listfile.h | 2 +-
os-posix.c | 3 ++
qemu-options.hx | 4 +--
scripts/git-submodule.sh | 34 +++++++++++++-----
tests/crypto-tls-x509-helpers.c | 10 +++---
tests/crypto-tls-x509-helpers.h | 2 +-
tests/pkix_asn1_tab.c | 2 +-
tests/qemu-iotests/233 | 4 +--
tests/test-authz-pam.c | 10 +++++-
ui/keycodemapdb | 2 +-
ui/meson.build | 3 +-
25 files changed, 161 insertions(+), 147 deletions(-)
--=20
2.29.2
3 years, 10 months
[libvirt PATCH 00/19] Overhaul test/commandhelper.c
by Tim Wiederhake
I stumbled upon a buffer overflow / stack smash present in
"test/commandhelper.c" that could be triggered by e.g.
$ ./tests/commandhelper --readfd 0 --readfd 0 --readfd 0 --readfd x
Could not parse fd x
*** stack smashing detected ***: terminated
Aborted (core dumped)
This series cleans up the file, fixes the buffer overflow and converts
(most) memory handling to g_auto*.
Note that it does not touch the "prevent malloc with zero size" issue
discussed in
https://www.redhat.com/archives/libvir-list/2021-January/msg01160.html,
this will be done in the other series.
Please feel free to comment on whether the copyright year in the file's
header should be updated and whether a prefix for the function names
and the new type is required.
Cheers,
Tim
Tim Wiederhake (19):
commandhelper: Remove origenv variable
commandhelper: Remove numpollfds variable
commandhelper: Simplify envsort
commandhelper: Consolidate error paths
commandhelper: Consolidate argument parsing
commandhelper: Split argument parsing and printing
commandhelper: Factor out parseArguments
commandhelper: Factor out printArguments
commandhelper: Factor out printEnvironment
commandhelper: Factor out printFds
commandhelper: Factor out printDaemonization
commandhelper: Factor out printCwd
commandhelper: Factor out printInput
commandhelper: Make number of fds variable in printInput
commandhelper: Make number of fds variable in parseArguments
commandhelper: Convert parseArguments to g_auto*
commandhelper: Convert printEnvironment to g_auto*
commandhelper: Convert printCwd to g_auto*
commandhelper: Convert main to g_auto*
tests/commandhelper.c | 295 +++++++++++++++++++++++++++---------------
1 file changed, 188 insertions(+), 107 deletions(-)
--
2.26.2
3 years, 10 months
[libvirt PATCH v2 0/2] stop using netcf for the interface driver backend
by Laine Stump
V1 here: https://www.redhat.com/archives/libvir-list/2021-January/msg00922.html
A short version of the cover letter from V1: this is a followup to my
proposal to stop using netcf for the interface driver backend in
Fedora/RHEL/CentOS builds and use the udev backend instead (it turns
out Ubuntu already disabled netcf in 2018).
Changes in V2:
* removed the patch that made the default netcf=disabled even when
netcf-devel was found on the host. If someone has netcf-devel
installed and still wants to build without netcf, then can add
"-Dnetcf=disabled" on the meson commandline.
* Made the specfile changes more intelligent:
* instead of hardcoding -Dnetcf=disabled, we now have a variable
%{with_netcf} that is set to 1 for current Fedora (< 34) and current
RHEL (< 9) but will be set to 0 for future Fedora/RHEL. This way the
behavior on current OS releases will remain the same even for future
libvirt.
* it is possible to for netcf support off even in current/older OS
releases by adding "--without netcf" to the rpmbuild commandline.
I think at this point I would be comfortable pushing these patches, unless someone has misgivings about it...
Laine Stump (2):
build: support explicitly disabling netcf
rpm: disable netcf for the interface driver in rpm build on new
targets
libvirt.spec.in | 22 +++++++++++++++++-----
meson.build | 10 ++++++----
2 files changed, 23 insertions(+), 9 deletions(-)
--
2.29.2
3 years, 10 months
[PATCH] Increase timeout for tests and syntax-check
by Michal Privoznik
Since we've switched to meson our tests run with a timeout (meson
uses 30 seconds as the default). However, not every machine that
builds libvirt is fast enough to run every test under 30 seconds
(each test binary has its own timeout, but still). For instance
when building a package for distro on a farm that's under load.
Or on a generally slow ARM hardware. While each developer can
tune their command line for building by adding
--timeout-multiplier=10, this is hard to do for aforementioned
build farms.
It's time to admit that not everybody has the latest, top shelf
CPU and increase the timeout.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Successfully tested on my RasPi 2B, where the top three longest test
were:
qemuxml2argvtest OK 142.43s
virschematest OK 40.82s
virnettlssessiontest OK 38.64s
and syntax-check:
sc_spacing-check OK 50.26
sc_avoid_if_before_free OK 42.30s
sc_prohibit_cross_inclusion OK 40.51s
build-aux/meson.build | 1 +
tests/meson.build | 14 ++++++--------
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/build-aux/meson.build b/build-aux/meson.build
index c506feefd2..e7b2db8759 100644
--- a/build-aux/meson.build
+++ b/build-aux/meson.build
@@ -44,6 +44,7 @@ if git
potfiles_dep,
],
suite: 'syntax-check',
+ timeout: 120,
)
endforeach
endif
diff --git a/tests/meson.build b/tests/meson.build
index 0de0783839..702090d594 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -546,6 +546,10 @@ if conf.has('WITH_YAJL')
]
endif
+# Increase the default timeout because some tests may run longer,
+# esp. on slower systems.
+timeout = 180
+
foreach data : tests
test_sources = '@0@.c'.format(data['name'])
test_bin = executable(
@@ -577,12 +581,6 @@ foreach data : tests
],
export_dynamic: true,
)
- if data['name'] == 'qemuxml2argvtest'
- timeout = 90
- else
- # default meson timeout
- timeout = 30
- endif
test(data['name'], test_bin, env: tests_env, timeout: timeout)
endforeach
@@ -683,7 +681,7 @@ endif
foreach name : test_scripts
script = find_program(name)
- test(name, script, env: tests_env)
+ test(name, script, env: tests_env, timeout: timeout)
endforeach
add_test_setup(
@@ -703,6 +701,6 @@ add_test_setup(
'--suppressions=@0@'.format(meson.current_source_dir() / '.valgrind.supp'),
'--error-exitcode=1',
],
- # default timeout in meson is 30s
+ # Tests take a lot longer when run under Valgrind
timeout_multiplier: 4,
)
--
2.26.2
3 years, 10 months