[libvirt] [PATCH] qemu: Make sure preferredMachines is not missing any entry
by Andrea Bolognani
With the current implementation, adding a new architecture
and not updating preferredMachines accordingly will not
cause a build failure, making it very likely that subtle
bugs will be introduced in the process. Rework the code
so that such issues will be caught by the compiler.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 84 ++++++++++++++++++------------------
1 file changed, 43 insertions(+), 41 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 8a44d32c59..230beeab8c 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2266,49 +2266,51 @@ virQEMUCapsProbeQMPDevices(virQEMUCapsPtr qemuCaps,
* that we're not vulnerable to changes in QEMU defaults or machine
* list ordering.
*/
-static const char *preferredMachines[VIR_ARCH_LAST] =
+static const char *preferredMachines[] =
{
- [VIR_ARCH_ALPHA] = "clipper",
- [VIR_ARCH_ARMV6L] = NULL, /* No QEMU impl */
- [VIR_ARCH_ARMV7L] = "integratorcp",
- [VIR_ARCH_ARMV7B] = "integratorcp",
-
- [VIR_ARCH_AARCH64] = "integratorcp",
- [VIR_ARCH_CRIS] = "axis-dev88",
- [VIR_ARCH_I686] = "pc",
- [VIR_ARCH_ITANIUM] = NULL, /* doesn't exist in QEMU any more */
- [VIR_ARCH_LM32] = "lm32-evr",
-
- [VIR_ARCH_M68K] = "mcf5208evb",
- [VIR_ARCH_MICROBLAZE] = "petalogix-s3adsp1800",
- [VIR_ARCH_MICROBLAZEEL] = "petalogix-s3adsp1800",
- [VIR_ARCH_MIPS] = "malta",
- [VIR_ARCH_MIPSEL] = "malta",
-
- [VIR_ARCH_MIPS64] = "malta",
- [VIR_ARCH_MIPS64EL] = "malta",
- [VIR_ARCH_OR32] = "or1k-sim",
- [VIR_ARCH_PARISC] = NULL, /* No QEMU impl */
- [VIR_ARCH_PARISC64] = NULL, /* No QEMU impl */
-
- [VIR_ARCH_PPC] = "g3beige",
- [VIR_ARCH_PPCLE] = "g3beige",
- [VIR_ARCH_PPC64] = "pseries",
- [VIR_ARCH_PPC64LE] = "pseries",
- [VIR_ARCH_PPCEMB] = "bamboo",
-
- [VIR_ARCH_S390] = NULL, /* No QEMU impl*/
- [VIR_ARCH_S390X] = "s390-ccw-virtio",
- [VIR_ARCH_SH4] = "shix",
- [VIR_ARCH_SH4EB] = "shix",
- [VIR_ARCH_SPARC] = "SS-5",
-
- [VIR_ARCH_SPARC64] = "sun4u",
- [VIR_ARCH_UNICORE32] = "puv3",
- [VIR_ARCH_X86_64] = "pc",
- [VIR_ARCH_XTENSA] = "sim",
- [VIR_ARCH_XTENSAEB] = "sim",
+ NULL, /* VIR_ARCH_NONE (not a real arch :) */
+ "clipper", /* VIR_ARCH_ALPHA */
+ NULL, /* VIR_ARCH_ARMV6L (no QEMU impl) */
+ "integratorcp", /* VIR_ARCH_ARMV7L */
+ "integratorcp", /* VIR_ARCH_ARMV7B */
+
+ "integratorcp", /* VIR_ARCH_AARCH64 */
+ "axis-dev88", /* VIR_ARCH_CRIS */
+ "pc", /* VIR_ARCH_I686 */
+ NULL, /* VIR_ARCH_ITANIUM (doesn't exist in QEMU any more) */
+ "lm32-evr", /* VIR_ARCH_LM32 */
+
+ "mcf5208evb", /* VIR_ARCH_M68K */
+ "petalogix-s3adsp1800", /* VIR_ARCH_MICROBLAZE */
+ "petalogix-s3adsp1800", /* VIR_ARCH_MICROBLAZEEL */
+ "malta", /* VIR_ARCH_MIPS */
+ "malta", /* VIR_ARCH_MIPSEL */
+
+ "malta", /* VIR_ARCH_MIPS64 */
+ "malta", /* VIR_ARCH_MIPS64EL */
+ "or1k-sim", /* VIR_ARCH_OR32 */
+ NULL, /* VIR_ARCH_PARISC (no QEMU impl) */
+ NULL, /* VIR_ARCH_PARISC64 (no QEMU impl) */
+
+ "g3beige", /* VIR_ARCH_PPC */
+ "g3beige", /* VIR_ARCH_PPCLE */
+ "pseries", /* VIR_ARCH_PPC64 */
+ "pseries", /* VIR_ARCH_PPC64LE */
+ "bamboo", /* VIR_ARCH_PPCEMB */
+
+ NULL, /* VIR_ARCH_S390 (no QEMU impl) */
+ "s390-ccw-virtio", /* VIR_ARCH_S390X */
+ "shix", /* VIR_ARCH_SH4 */
+ "shix", /* VIR_ARCH_SH4EB */
+ "SS-5", /* VIR_ARCH_SPARC */
+
+ "sun4u", /* VIR_ARCH_SPARC64 */
+ "puv3", /* VIR_ARCH_UNICORE32 */
+ "pc", /* VIR_ARCH_X86_64 */
+ "sim", /* VIR_ARCH_XTENSA */
+ "sim", /* VIR_ARCH_XTENSAEB */
};
+verify(ARRAY_CARDINALITY(preferredMachines) == VIR_ARCH_LAST);
static int
--
2.17.1
6 years, 4 months
[libvirt] [PATCH v3 00/12] PCI passthrough support on s390
by Yi Min Zhao
Abstract
========
The PCI representation in QEMU has recently been extended for S390
allowing configuration of zPCI attributes like uid (user-defined
identifier) and fid (PCI function identifier).
The details can be found here:
https://lists.gnu.org/archive/html/qemu-devel/2016-06/msg07262.html
To support the new zPCI feature of the S390 platform, two new XML
attributes, @uid and @fid, are introduced for device addresses of type
'pci', i.e.:
<hostdev mode='subsystem' type='pci'>
<driver name='vfio'/>
<source>
<address domain='0x0001' bus='0x00' slot='0x00' function='0x0'/>
</source>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'
uid='0x0003' fid='0x00000027'/>
</hostdev>
uid and fid are optional attributes. If they are defined by the user,
unique values within the guest domain must be used. If they are not
specified and the architecture requires them, they are automatically
generated with non-conflicting values.
Current implementation is the most seamless one for the user as it
unites the address specific data of a PCI device on one XML element.
It could accommodate both specifying our special parameters (uid and fid)
and re-using standard statements (domain, bus, slot and function) for
PCI devices. User can still specify bus/slot/function for the virtualized
PCI devices in the XML.
Thus uid/fid act as an extension to the PCI address and are stored in
a new structure 'virZPCIDeviceAddress' which is a member of common PCI
Address structure. Additionally, two hashtables are used for assignment
and reservation of uid/fid.
In support of extending the PCI address, a new PCI address extension flag is
introduced. This extension flag allows is not only dedicated for the S390
platform but also other architectures needing certain extensions to PCI
address space.
Code Base
=========
commit in master:
087de2f5a3: docs: formatdomain: fix spacing before parentheses
Change Log
==========
v2->v3:
1. Revise code style.
2. Update test cases.
3. Introduce qemuDomainCollectPCIAddressExtension() to collect PCI
extension addresses.
4. Introduce virDeviceInfoPCIAddressExtensionPresent() to check if zPCI
address exists.
5. Optimize zPCI address check logic.
6. Optimize passed parameters of zPCI addr alloc/release/reserve functions.
7. Report enum range error in qemuDomainDeviceSupportZPCI().
8. Update commit messages.
v1->v2:
1. Separate test commit and merge testcases into corresponding commits that
introduce the functionalities firstly.
2. Spare some checks for zpci device.
3. Add vsock and controller support.
4. Add uin32 type schema.
5. Rename zpciuid and zpcifid to zpci_uid and zpci_fid.
6. Always return multibus support on S390.
Yi Min Zhao (12):
conf: Add definitions for 'uid' and 'fid' PCI address attributes
qemu: Introduce zPCI capability
conf: Introduce a new PCI address extension flag
qemu: Enable PCI multi bus for S390 guests
qemu: Auto add pci-root for s390/s390x guests
conf: Introduce address caching for PCI extensions
conf: Introduce parser, formatter for uid and fid
conf: Allocate/release 'uid' and 'fid' in PCI address
qemu: Generate and use zPCI device in QEMU command line
qemu: Add hotpluging support for PCI devices on S390 guests
docs: Add 'uid' and 'fid' information
news: Update news for PCI address extension attributes
docs/formatdomain.html.in | 9 +-
docs/news.xml | 11 +
docs/schemas/basictypes.rng | 23 ++
docs/schemas/domaincommon.rng | 1 +
src/conf/device_conf.c | 78 +++++
src/conf/device_conf.h | 8 +
src/conf/domain_addr.c | 379 +++++++++++++++++++++
src/conf/domain_addr.h | 29 ++
src/conf/domain_conf.c | 6 +
src/libvirt_private.syms | 4 +
src/qemu/qemu_capabilities.c | 6 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 114 +++++++
src/qemu/qemu_command.h | 4 +
src/qemu/qemu_domain.c | 1 +
src/qemu/qemu_domain_address.c | 204 ++++++++++-
src/qemu/qemu_hotplug.c | 155 ++++++++-
src/util/virpci.h | 13 +
tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml | 1 +
tests/qemuxml2argvdata/disk-virtio-s390-zpci.args | 27 ++
tests/qemuxml2argvdata/disk-virtio-s390-zpci.xml | 17 +
.../hostdev-vfio-zpci-autogenerate.args | 26 ++
.../hostdev-vfio-zpci-autogenerate.xml | 18 +
.../hostdev-vfio-zpci-boundaries.args | 30 ++
.../hostdev-vfio-zpci-boundaries.xml | 26 ++
.../hostdev-vfio-zpci-multidomain-many.args | 40 +++
.../hostdev-vfio-zpci-multidomain-many.xml | 67 ++++
tests/qemuxml2argvdata/hostdev-vfio-zpci.args | 26 ++
tests/qemuxml2argvdata/hostdev-vfio-zpci.xml | 19 ++
tests/qemuxml2argvtest.c | 17 +
tests/qemuxml2xmloutdata/disk-virtio-s390-zpci.xml | 29 ++
.../hostdev-vfio-zpci-autogenerate.xml | 30 ++
.../hostdev-vfio-zpci-boundaries.xml | 42 +++
.../hostdev-vfio-zpci-multidomain-many.xml | 79 +++++
tests/qemuxml2xmloutdata/hostdev-vfio-zpci.xml | 30 ++
tests/qemuxml2xmltest.c | 14 +
41 files changed, 1575 insertions(+), 14 deletions(-)
create mode 100644 tests/qemuxml2argvdata/disk-virtio-s390-zpci.args
create mode 100644 tests/qemuxml2argvdata/disk-virtio-s390-zpci.xml
create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate.args
create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate.xml
create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-boundaries.args
create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-boundaries.xml
create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-multidomain-many.args
create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-multidomain-many.xml
create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci.args
create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci.xml
create mode 100644 tests/qemuxml2xmloutdata/disk-virtio-s390-zpci.xml
create mode 100644 tests/qemuxml2xmloutdata/hostdev-vfio-zpci-autogenerate.xml
create mode 100644 tests/qemuxml2xmloutdata/hostdev-vfio-zpci-boundaries.xml
create mode 100644 tests/qemuxml2xmloutdata/hostdev-vfio-zpci-multidomain-many.xml
create mode 100644 tests/qemuxml2xmloutdata/hostdev-vfio-zpci.xml
--
Yi Min
6 years, 4 months
[libvirt] [PATCH] storage: fix the error message when encrypted raw volume resize
by Shivaprasad G Bhat
The vol-dumpxml shows the volume target format type as raw for
encrypted volumes. The error message when attempting to resize
with prealloc is confusing here.
Signed-off-by: Shivaprasad G Bhat <sbhat(a)linux.vnet.ibm.com>
---
src/storage/storage_util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index 42a9b6abf0..2abedb24b0 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -2343,7 +2343,7 @@ virStorageBackendVolResizeLocal(virStoragePoolObjPtr pool,
} else if (vol->target.format == VIR_STORAGE_FILE_RAW && vol->target.encryption) {
if (pre_allocate) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
- _("preallocate is only supported for raw "
+ _("preallocate is only supported for unencrypted raw "
"type volume"));
return -1;
}
6 years, 4 months
[libvirt] [PATCH v4 0/3] vsh: Introduce new API for printing tables
by Simon Kobyda
Created new API for priting tables, mainly to solve alignment problems.
Implemented these test to virsh list. In the future, API may be
everywhere in virsh and virt-admin.
Also wrote basic tests for the new API, and corrected tests in virshtest
which are influenced by implementation of the API in virsh list.
Changes in v4:
- fixed width calculation for zero-width, nonprintable and combined
character. (pulled some code from linux-util)
- added tests for cases mentioned above
- changed usage of vshControl variables. From now on PrintToStdout calls
PrintToString and then prints returned string to stdout
Changes in v3:
- changed encoding of 3/3 patch, otherwise it cannot be applied
Changes in v2:
- added tests
- fixed alignment for unicode character which span more spaces
- moved ncolumns check to vshTableRowAppend
- changed arguments for functions vshTablePrint, vshTablePrintToStdout,
vshTablePrintToString
Simon Kobyda (3):
vsh: Add API for printing tables.
virsh: Implement new table API for virsh list
vsh: Added tests
tests/Makefile.am | 8 +
tests/virshtest.c | 14 +-
tests/vshtabletest.c | 393 ++++++++++++++++++++++++++++
tools/Makefile.am | 4 +-
tools/virsh-domain-monitor.c | 43 ++--
tools/vsh-table.c | 483 +++++++++++++++++++++++++++++++++++
tools/vsh-table.h | 42 +++
7 files changed, 960 insertions(+), 27 deletions(-)
create mode 100644 tests/vshtabletest.c
create mode 100644 tools/vsh-table.c
create mode 100644 tools/vsh-table.h
--
2.17.1
6 years, 4 months
[libvirt] [PATCH 0/5] docs: api_extension: Clean up and modernize
by Peter Krempa
Drop the old patches which don't make a good example any more and
freshen up some facts.
Peter Krempa (5):
docs: api_extension: Remove links to the stale example patches
docs: api_extension: Remove example patches
docs: api_extension: Don't encourage other tools than git
docs: api_extension: Remove note to extend libvirt-TCK
docs: api_extension: Freshen up paths
docs/Makefile.am | 4 +-
docs/api_extension.html.in | 111 +---
docs/api_extension/0001-add-to-xml.patch | 145 ----
docs/api_extension/0002-add-new-public-API.patch | 62 --
.../0003-define-internal-driver-API.patch | 222 -------
.../0004-implement-the-public-APIs.patch | 188 ------
.../0005-implement-the-remote-protocol.patch | 421 ------------
...06-make-old-API-trivially-wrap-to-new-API.patch | 735 ---------------------
docs/api_extension/0007-add-virsh-support.patch | 388 -----------
docs/api_extension/0008-support-new-xml.patch | 519 ---------------
.../0009-support-all-flags-in-test-driver.patch | 197 ------
...improve-vcpu-support-in-qemu-command-line.patch | 122 ----
...0011-complete-vcpu-support-in-qemu-driver.patch | 169 -----
...-improve-vcpu-support-in-xen-command-line.patch | 294 ---------
.../0013-improve-getting-xen-vcpu-counts.patch | 216 ------
.../0014-improve-setting-xen-vcpu-counts.patch | 342 ----------
docs/api_extension/0015-remove-dead-xen-code.patch | 228 -------
17 files changed, 25 insertions(+), 4338 deletions(-)
delete mode 100644 docs/api_extension/0001-add-to-xml.patch
delete mode 100644 docs/api_extension/0002-add-new-public-API.patch
delete mode 100644 docs/api_extension/0003-define-internal-driver-API.patch
delete mode 100644 docs/api_extension/0004-implement-the-public-APIs.patch
delete mode 100644 docs/api_extension/0005-implement-the-remote-protocol.patch
delete mode 100644 docs/api_extension/0006-make-old-API-trivially-wrap-to-new-API.patch
delete mode 100644 docs/api_extension/0007-add-virsh-support.patch
delete mode 100644 docs/api_extension/0008-support-new-xml.patch
delete mode 100644 docs/api_extension/0009-support-all-flags-in-test-driver.patch
delete mode 100644 docs/api_extension/0010-improve-vcpu-support-in-qemu-command-line.patch
delete mode 100644 docs/api_extension/0011-complete-vcpu-support-in-qemu-driver.patch
delete mode 100644 docs/api_extension/0012-improve-vcpu-support-in-xen-command-line.patch
delete mode 100644 docs/api_extension/0013-improve-getting-xen-vcpu-counts.patch
delete mode 100644 docs/api_extension/0014-improve-setting-xen-vcpu-counts.patch
delete mode 100644 docs/api_extension/0015-remove-dead-xen-code.patch
--
2.16.2
6 years, 4 months
[libvirt] [PATCH v2 0/3] ui: remove deprecated UI frontends
by Daniel P. Berrangé
We deprecated GTK2 and SDL1.2 in the 2.12.0 release, so they are able to
be removed entirely in the 3.1.0 release. The min GTK3 version can also
be bumped up based the distros we aim to support.
Note that before this can merge, the openbsd VM test image needs to be
updated to have SDL2, as openbsd build mandates SDL availability.
The freebsd & netbsd images should also be updated, but they are not
build blockers as they automatically disable SDL
Changed in v2:
- Rebased to resolve conflicts
Daniel P. Berrangé (3):
ui: remove support for GTK2 in favour of GTK3
ui: increase min required GTK3 version to 3.14.0
ui: remove support for SDL1.2 in favour of SDL2
configure | 111 +----
include/ui/gtk.h | 9 -
qemu-deprecated.texi | 16 -
ui/Makefile.objs | 5 -
ui/gtk-egl.c | 10 +-
ui/gtk.c | 202 +-------
ui/sdl.c | 1027 ----------------------------------------
ui/sdl_zoom.c | 93 ----
ui/sdl_zoom.h | 25 -
ui/sdl_zoom_template.h | 219 ---------
10 files changed, 33 insertions(+), 1684 deletions(-)
delete mode 100644 ui/sdl.c
delete mode 100644 ui/sdl_zoom.c
delete mode 100644 ui/sdl_zoom.h
delete mode 100644 ui/sdl_zoom_template.h
--
2.17.1
6 years, 4 months
[libvirt] [PULL 00/12] Ui 20180821 v2 patches
by Gerd Hoffmann
The following changes since commit d0092d90eb546a8bbe9e9120426c189474123797:
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20180820' into staging (2018-08-20 17:41:18 +0100)
are available in the git repository at:
git://git.kraxel.org/qemu tags/ui-20180821-v2-pull-request
for you to fetch changes up to 37bdff33227c3248ab9af784246da5b6c08111ea:
util: promote qemu_egl_rendernode_open() to libqemuutil (2018-08-21 14:01:48 +0200)
----------------------------------------------------------------
ui: misc ui fixed which piled up during 3.0 release freeze.
----------------------------------------------------------------
Daniel P. Berrangé (2):
doc: switch to modern syntax for VNC TLS setup
vnc: remove support for deprecated tls, x509, x509verify options
Marc-André Lureau (3):
ui: use enum to string helpers
dmabuf: add y0_top, pass it to spice
util: promote qemu_egl_rendernode_open() to libqemuutil
Paolo Bonzini (2):
spice-display: access ptr_x/ptr_y under Mutex
spice-display: fix qemu_spice_cursor_refresh_bh locking
Peter Wu (1):
vnc: fix memleak of the "vnc-worker-output" name
Philippe Mathieu-Daudé (1):
ui/vnc: Remove useless parenthesis around DIV_ROUND_UP macro
Tao Wu via Qemu-devel (1):
sdl2: redraw correctly when scanout_mode enabled.
Thomas Huth (2):
ui/sdl2: Remove the obsolete SDL_INIT_NOPARACHUTE flag
ui/sdl2: Fix broken -full-screen CLI option
include/qemu/drm.h | 6 ++++
include/ui/console.h | 1 +
qemu-keymap.c | 2 +-
ui/console.c | 6 ++--
ui/egl-helpers.c | 51 ++--------------------------
ui/sdl2-gl.c | 5 +++
ui/sdl2.c | 13 +++-----
ui/spice-display.c | 42 +++++++++++++++--------
ui/vnc-enc-tight.c | 2 +-
ui/vnc-jobs.c | 3 +-
ui/vnc.c | 94 ++--------------------------------------------------
util/drm.c | 66 ++++++++++++++++++++++++++++++++++++
MAINTAINERS | 1 +
qemu-deprecated.texi | 20 -----------
qemu-doc.texi | 20 ++++++++---
qemu-options.hx | 43 ------------------------
util/Makefile.objs | 1 +
17 files changed, 139 insertions(+), 237 deletions(-)
create mode 100644 include/qemu/drm.h
create mode 100644 util/drm.c
--
2.9.3
6 years, 4 months
[libvirt] libvirt and virt-manager - Unable to complete install: 'internal error: unsupported input bus usb'
by Eduardo Lúcio Amorim Costa
I'm trying create a virtual machine using Xen as hypervisor and
virt-manager (libvirt) as the management module. When trying to create the
virtual machine I am getting the following error:
"
Unable to complete install: 'internal error: unsupported input bus usb'
"
ERROR DETAILS:
Unable to complete install: 'internal error: unsupported input bus usb'
Traceback (most recent call last):
File "/usr/share/virt-manager/virtManager/asyncjob.py", line 75, in
cb_wrapper
callback(asyncjob, *args, **kwargs)
File "/usr/share/virt-manager/virtManager/create.py", line 2276, in
_do_async_install
guest.start_install(meter=meter)
File "/usr/share/virt-manager/virtinst/guest.py", line 461, in
start_install
doboot, transient)
File "/usr/share/virt-manager/virtinst/guest.py", line 397, in
_create_guest
domain = self.conn.createXML(install_xml or final_xml, 0)
File "/usr/lib/python3.7/site-packages/libvirt.py", line 3717, in
createXML
if ret is None:raise libvirtError('virDomainCreateXML() failed',
conn=self)
libvirt.libvirtError: internal error: unsupported input bus usb
NOTE I: The deploy process follows the instructions here
https://www.youtube.com/watch?v=BwkmDM-Gpzc and here
https://wiki.centos.org/HowTos/Xen/Xen4QuickStart .
NOTE II: Xen Hypervisor uses a CentOS 7 as "domu".
MORE INFORMATION ABOUT THE PROBLEM HERE:
https://unix.stackexchange.com/q/464186/61742
Thanks! =D
6 years, 4 months
[libvirt] proposal: file renames for consistency
by Eric Blake
We have an inconsistent mix of multi-word file names that use dash vs.
underscore to separate those words.
$ git ls-files '**/*_*' | wc
2497 2497 146485
$ git ls-files '**/*-*' | wc
8147 8147 444426
Some of those are overlaps (meaning we can't make up our minds), such as:
docs/api_extension/0001-add-to-xml.patch
However, my personal preference is to use dash everywhere (or at least
on all the .[ch] files), for at least several reasons:
1. dash is easier to type (at least on US keyboards), as it does not
require the shift key [I find it easier to edit files in tools/ than in
src/qemu/ for example, because I don't have to worry about shift]
2. include/ uses only dash, not underscore; if our public interface
favors that spelling, our internal files should too
3. underscore is easier to miss visually when other markup like
underline is being applied (for example, when viewing the git repository
online and hovering over a filename). Granted, you can still often tell
that an underscore is present vs. a space (or in general, realize that
we avoid spaces in file names in our git tree, so it must be an
underscore); but I still find dash much easier to pick out.
Since git rename detection does a good job at tracking history by
content over file renames, a mass rename wouldn't even be that invasive
to git archaeology or patch backporting.
If you're worried about finger memory typing the wrong form, but you use
bash, it's possible to configure bash to treat '-' and '_'
interchangeably during TAB-completion (similar to case insensitive tab
completion), which reduces some of the pain, but it doesn't solve
everything.
So, would anyone like a beginner's project of consistently renaming
files, and/or would anyone object if I submitted some patches along
those lines?
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
6 years, 4 months
[libvirt] [PATCH] util: eventpoll: Survive EBADF on macOS
by Roman Bolshakov
Fixes:
https://www.redhat.com/archives/libvir-list/2017-January/msg00978.html
QEMU is probed through monitor fd to check capabilities during libvirtd init.
The monitor fd is closed after probing by virQEMUCapsInitQMPCommandFree
that calls virQEMUCapsInitQMPCommandAbort that calls qemuMonitorClose,
the latter one notifies the event loop via an interrupt handle in
qemuMonitorUnregister and after then closes monitor fd.
There could be a case when interrupt is sent after eventLoop is unlocked
but before virEventPollRunOnce blocks in poll, shortly before file
descriptor is closed by qemuMonitorClose. Then poll receives closed monitor
fd in fdset and returns EBADF.
EBADF is not mentioned as a valid errno on macOS poll man-page but such
behaviour can appear release-to-release, according to cpython:
https://github.com/python/cpython/blob/master/Modules/selectmodule.c#L1161
The change also fixes the issue in qemucapabilitiestest. It returns
Bad file descriptor message 25 times without the fix.
Signed-off-by: Roman Bolshakov <r.bolshakov(a)yadro.com>
---
src/util/vireventpoll.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/util/vireventpoll.c b/src/util/vireventpoll.c
index 13d278df13..6d19374c52 100644
--- a/src/util/vireventpoll.c
+++ b/src/util/vireventpoll.c
@@ -643,10 +643,18 @@ int virEventPollRunOnce(void)
EVENT_DEBUG("Poll got error event %d", errno);
if (errno == EINTR || errno == EAGAIN)
goto retry;
+#ifdef __APPLE__
+ if (errno == EBADF) {
+ ret = 0;
+ goto dispatch;
+ }
+#endif
virReportSystemError(errno, "%s",
_("Unable to poll on file handles"));
return -1;
}
+
+ dispatch:
EVENT_DEBUG("Poll got %d event(s)", ret);
virMutexLock(&eventLoop.lock);
--
2.15.2 (Apple Git-101.1)
6 years, 4 months