[libvirt] [PATCH v3 00/18] Converge Storage Pool vHBA logic with Node Device
by John Ferlan
v2: http://www.redhat.com/archives/libvir-list/2017-March/msg00161.html
Changes since v2:
- Pushed the former patch1 after a slight adjustment replace a spurrious
lost line
- [NEW] Patch 1 - Fixes an existing bug - details in patch
- [UPD] Patch 2 - Split out what Jano noted about new checks into it's own
- [UPD] Patch 3->14 - Rework the former patch2 to split out the step by step
details it took to get to patch2.
- [No Change] Patch 15-18
-> Patch15->16 ACKed in v1, but I just left these in the order I had
-> Patch17->18 Unchanged - same comment as v2 (copied so as to not force
someone would go back to v2):
Even though there is concern over usage of API's in this manner
(e.g. calling virNodeDeviceLookupSCSIHostByWWN as well as
virNodeDeviceCreateXML) - the "purpose" of the exercise is
a means to have the StoragePool code use the same algorithms
as the node device code instead of what could be a potentially
long slow journey through the sysfs file system. The key piece
being the replication of the API's that find the parent in the
node device object list. I suppose it would be possible to add
even more API's to get that answer, but I'm not sure it'd be
worthwhile at this point. As for the concern about deadlock -
I understand it, but since the whole purpose of the API is
to essentially utilize the nodedev create algorithm there'd
be no reason for nodedev to call it.
If it doesn't get ACK'd - that's OK - I can hold onto it and
reconsider some other means at some point in time in the future
(probably distant future too).
John Ferlan (18):
conf: Ensure both parent_wwnn/parent_wwpn provided
conf: Add missing validate for fchost search fields
conf: Split out storage pool source adapter helpers
conf: Rework parsing in virStoragePoolDefParseSourceAdapter
conf: Introduce storage_adapter_conf
conf: Rename API's in storage_adapter_conf
conf: Extract FCHost adapter type processing into their own helpers
conf: Extract SCSI adapter type processing into their own helpers
conf: Split up virStoragePoolSourceAdapter
conf: Rework storage_adapter_conf to use adapter specific typedefs
conf: Rework storage_conf to use adapter specific typedefs
storage: Rework getAdapterName to use adapter specific typedefs
storage: Rework createVport and deleteVport
conf: Convert virStoragePoolSourceAdapter to virStorageAdapter
util: Rename virFileWaitForDevices
conf: Move/rename createVport and deleteVport
util: Alter virNodeDevice{Create|Delete}Vport to use nodedev APIs
tests: Add more storage pool vHBA tests
po/POTFILES.in | 1 +
src/Makefile.am | 1 +
src/conf/node_device_conf.c | 332 ++++++++++++++++++++++++++++++++
src/conf/node_device_conf.h | 9 +
src/conf/storage_adapter_conf.c | 330 ++++++++++++++++++++++++++++++++
src/conf/storage_adapter_conf.h | 84 ++++++++
src/conf/storage_conf.c | 348 ++++++++--------------------------
src/conf/storage_conf.h | 36 +---
src/libvirt_private.syms | 13 +-
src/node_device/node_device_driver.c | 2 +-
src/phyp/phyp_driver.c | 3 +-
src/storage/storage_backend_disk.c | 6 +-
src/storage/storage_backend_iscsi.c | 2 +-
src/storage/storage_backend_logical.c | 4 +-
src/storage/storage_backend_mpath.c | 2 +-
src/storage/storage_backend_scsi.c | 267 +++++---------------------
src/storage/storage_util.c | 2 +-
src/test/test_driver.c | 11 +-
src/util/virfile.h | 2 -
src/util/virutil.c | 4 +-
src/util/virutil.h | 2 +
tests/fchosttest.c | 47 +++++
22 files changed, 968 insertions(+), 540 deletions(-)
create mode 100644 src/conf/storage_adapter_conf.c
create mode 100644 src/conf/storage_adapter_conf.h
--
2.9.3
7 years, 9 months
[libvirt] [PATCH v3 00/17] Introduce NVDIMM support
by Michal Privoznik
NVDIMMs are new type of ultra fast storage that's plugged into DIMM slot and
can hold the stored info throughout reboots. After all, NV stands for
non-volatile. In virtualization world, this has an awesome advantage - less
VM_EXITs on 'disk' IO.
https://nvdimm.wiki.kernel.org/
How to test this feature?
$ > /tmp/nvdimm
$ truncate --size 512M /tmp/nvdimm
$ virsh edit $mydom
<memory model='nvdimm' access='shared'>
<source>
<path>/tmp/nvdimm</path>
</source>
<target>
<size unit='MiB'>512</size>
<node>0</node>
<label>
<size unit='KiB'>128</size>
</label>
</target>
<address type='dimm' slot='0'/>
</memory>
$ virsh start $mydom
$ ssh $mydom "echo \"Hello world\" > /dev/pmem0"
$ hexdump -C /tmp/nvdimm
00000000 48 65 6c 6c 6f 20 77 6f 72 6c 64 0a 00 00 00 00 |Hello world.....|
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
20000000
diff to v2:
- John's review points worked in
- Couple of more patches to clean up qemuBuildMemoryBackendStr
Michal Privoznik (17):
qemuBuildMemoryBackendStr: Don't overwrite @force
qemuBuildMemoryBackendStr: Check for @memAccess properly
qemuBuildMemoryBackendStr: Pass virDomainMemoryDefPtr
qemuBuildMemoryBackendStr: Reorder args and update comment
Introduce NVDIMM memory model
qemu: Introduce QEMU_CAPS_DEVICE_NVDIMM
qemu: Implement NVDIMM
conf: Introduce @access to <memory/>
qemu: Implement @access for <memory/> banks
qemu: Introduce label-size for NVDIMMs
security_dac: Label host side of NVDIMM
security_selinux: Label host side of NVDIMM
security: Introduce internal APIs for memdev labelling
secdrivers: Implement memdev relabel APIs
qemu_hotplug: Relabel memdev
qemu: Allow nvdimm in devices CGroups
qemu: Namespaces for NVDIMM
docs/formatdomain.html.in | 83 ++++++++--
docs/schemas/domaincommon.rng | 47 ++++--
src/conf/domain_conf.c | 146 +++++++++++++----
src/conf/domain_conf.h | 5 +
src/libvirt_private.syms | 2 +
src/qemu/qemu_alias.c | 10 +-
src/qemu/qemu_capabilities.c | 9 ++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_cgroup.c | 49 ++++++
src/qemu/qemu_cgroup.h | 4 +
src/qemu/qemu_command.c | 172 +++++++++++++--------
src/qemu/qemu_command.h | 15 +-
src/qemu/qemu_domain.c | 113 +++++++++++++-
src/qemu/qemu_domain.h | 8 +
src/qemu/qemu_hotplug.c | 40 ++++-
src/qemu/qemu_security.c | 56 +++++++
src/qemu/qemu_security.h | 8 +
src/security/security_dac.c | 76 +++++++++
src/security/security_driver.h | 9 ++
src/security/security_manager.c | 56 +++++++
src/security/security_manager.h | 7 +
src/security/security_nop.c | 19 +++
src/security/security_selinux.c | 69 +++++++++
src/security/security_stack.c | 38 +++++
.../qemuxml2argv-memory-hotplug-nvdimm-access.args | 26 ++++
.../qemuxml2argv-memory-hotplug-nvdimm-access.xml | 56 +++++++
.../qemuxml2argv-memory-hotplug-nvdimm-label.args | 26 ++++
.../qemuxml2argv-memory-hotplug-nvdimm-label.xml | 59 +++++++
.../qemuxml2argv-memory-hotplug-nvdimm.args | 26 ++++
.../qemuxml2argv-memory-hotplug-nvdimm.xml | 56 +++++++
tests/qemuxml2argvtest.c | 8 +-
...qemuxml2xmlout-memory-hotplug-nvdimm-access.xml | 1 +
.../qemuxml2xmlout-memory-hotplug-nvdimm-label.xml | 1 +
.../qemuxml2xmlout-memory-hotplug-nvdimm.xml | 1 +
tests/qemuxml2xmltest.c | 3 +
35 files changed, 1164 insertions(+), 141 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm-access.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm-access.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm-label.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm-label.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm.xml
create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug-nvdimm-access.xml
create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug-nvdimm-label.xml
create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug-nvdimm.xml
--
2.11.0
7 years, 9 months
[libvirt] libvirt and dmesg
by Michel Pierre-Jacques
Hi all, il try to find the way to obtain the same use as in the
lxc config file lxc.kmsg=0
how to do that, with the xml of a lxc domain, i make lot of try without
success .
is there another way to deny access to the dmesg for a libvirt lxc
domain ?
---
Kogitae AE
Infogérance Linux / Administrateur Système
le Domaine Picard
21-23 rue de la cornée
70800 Anjeux
--------------------------
Tel : +33 (0)3 68 33 53 64
IRC : http://kogitae.fr/irc
------------------------------------
9h-12h & 14h-18h / Lundi au Vendredi
Sur RDV en dehors
7 years, 9 months
[libvirt] 1GB huge pages and incompatible VM memory size
by Jim Fehlig
Hi All,
Matt encountered the following issue when using 1GB huge pages with libvirt
> This problem turned out to be entirely my fault because I didn't round
> the VM's memory size to a 1G multiple, and the kernel tried to split
> the VMA at the end of the region, triggering this code in the kernel
> do_mbind() path,
>
> static int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma,
> unsigned long addr, int new_below)
> {
> struct vm_area_struct *new;
> int err;
>
> if (is_vm_hugetlb_page(vma) && (addr &
> ~(huge_page_mask(hstate_vma(vma)))))
> return -EINVAL;
>
> I have no idea how a less fortunate developer without access to MM
> experts would have figured this out. It's a shame virsh didn't error
> out when I initially setup 1G hugepages with an incompatible VM memory
> size.
What do folks think about improving libvirt to warn or error when using a VM
memory size that is not compatible with the host hugepage configuration?
Regards,
Jim
7 years, 9 months
[libvirt] [PATCH] bhyve: add config file support
by Roman Bogorodskiy
Introduce config file support for the bhyve driver. The only available
setting at present is 'firmware_dir' for specifying a directory with
UEFI firmware files.
---
src/Makefile.am | 25 +++++++-
src/bhyve/bhyve.conf | 7 +++
src/bhyve/bhyve_capabilities.c | 9 ++-
src/bhyve/bhyve_capabilities.h | 5 +-
src/bhyve/bhyve_conf.c | 112 +++++++++++++++++++++++++++++++++++
src/bhyve/bhyve_conf.h | 32 ++++++++++
src/bhyve/bhyve_driver.c | 11 +++-
src/bhyve/bhyve_utils.h | 12 ++++
src/bhyve/libvirtd_bhyve.aug | 39 ++++++++++++
src/bhyve/test_libvirtd_bhyve.aug.in | 5 ++
10 files changed, 252 insertions(+), 5 deletions(-)
create mode 100644 src/bhyve/bhyve.conf
create mode 100644 src/bhyve/bhyve_conf.c
create mode 100644 src/bhyve/bhyve_conf.h
create mode 100644 src/bhyve/libvirtd_bhyve.aug
create mode 100644 src/bhyve/test_libvirtd_bhyve.aug.in
diff --git a/src/Makefile.am b/src/Makefile.am
index 02579659a..f0d8efe50 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -930,6 +930,8 @@ BHYVE_DRIVER_SOURCES = \
bhyve/bhyve_capabilities.h \
bhyve/bhyve_command.c \
bhyve/bhyve_command.h \
+ bhyve/bhyve_conf.c \
+ bhyve/bhyve_conf.h \
bhyve/bhyve_parse_command.c \
bhyve/bhyve_parse_command.h \
bhyve/bhyve_device.c \
@@ -1575,7 +1577,14 @@ libvirt_driver_bhyve_impl_la_CFLAGS = \
$(AM_CFLAGS)
libvirt_driver_bhyve_impl_la_LDFLAGS = $(AM_LDFLAGS)
libvirt_driver_bhyve_impl_la_SOURCES = $(BHYVE_DRIVER_SOURCES)
+
+conf_DATA += bhyve/bhyve.conf
+augeas_DATA += bhyve/libvirtd_bhyve.aug
+augeastest_DATA += test_libvirtd_bhyve.aug
endif WITH_BHYVE
+EXTRA_DIST += bhyve/bhyve.conf \
+ bhyve/libvirtd_bhyve.aug \
+ bhyve/test_libvirtd_bhyve.aug.in
if WITH_NETWORK
noinst_LTLIBRARIES += libvirt_driver_network_impl.la
@@ -2125,11 +2134,12 @@ check-local: check-augeas
check-augeas-sanlock \
check-augeas-lockd \
check-augeas-libxl \
+ check-augeas-bhyve \
$(NULL)
check-augeas: check-augeas-qemu check-augeas-lxc check-augeas-sanlock \
check-augeas-lockd check-augeas-virtlockd check-augeas-libxl \
- check-augeas-virtlogd
+ check-augeas-bhyve check-augeas-virtlogd
AUG_GENTEST = $(PERL) $(top_srcdir)/build-aux/augeas-gentest.pl
EXTRA_DIST += $(top_srcdir)/build-aux/augeas-gentest.pl
@@ -2212,6 +2222,19 @@ else ! WITH_LIBXL
check-augeas-libxl:
endif ! WITH_LIBXL
+if WITH_BHYVE
+test_libvirtd_bhyve.aug: bhyve/test_libvirtd_bhyve.aug.in \
+ $(srcdir)/bhyve/bhyve.conf $(AUG_GENTEST)
+ $(AM_V_GEN)$(AUG_GENTEST) $(srcdir)/bhyve/bhyve.conf $< $@
+
+check-augeas-bhyve: test_libvirtd_bhyve.aug
+ $(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
+ '$(AUGPARSE)' -I $(srcdir)/bhyve test_libvirtd_bhyve.aug; \
+ fi
+else ! WITH_BHYVE
+check-augeas-bhyve:
+endif ! WITH_BHYVE
+
test_virtlogd.aug: logging/test_virtlogd.aug.in \
logging/virtlogd.conf $(AUG_GENTEST)
$(AM_V_GEN)$(AUG_GENTEST) $(srcdir)/logging/virtlogd.conf $< $@
diff --git a/src/bhyve/bhyve.conf b/src/bhyve/bhyve.conf
new file mode 100644
index 000000000..2a8baacff
--- /dev/null
+++ b/src/bhyve/bhyve.conf
@@ -0,0 +1,7 @@
+# Master configuration file for the bhyve driver.
+# All settings described here are optional - if omitted, sensible
+# defaults are used.
+
+# Path to a directory with firmware files. By default it's pointing
+# to the directory that sysutils/bhyve-firmware installs files into.
+#firmware_dir = "/usr/local/share/uefi-firmware"
diff --git a/src/bhyve/bhyve_capabilities.c b/src/bhyve/bhyve_capabilities.c
index 5e6094e3c..da06ba711 100644
--- a/src/bhyve/bhyve_capabilities.c
+++ b/src/bhyve/bhyve_capabilities.c
@@ -111,7 +111,8 @@ virBhyveCapsBuild(void)
}
virDomainCapsPtr
-virBhyveDomainCapsBuild(const char *emulatorbin,
+virBhyveDomainCapsBuild(bhyveConnPtr conn,
+ const char *emulatorbin,
const char *machine,
virArch arch,
virDomainVirtType virttype)
@@ -120,8 +121,9 @@ virBhyveDomainCapsBuild(const char *emulatorbin,
unsigned int bhyve_caps = 0;
DIR *dir;
struct dirent *entry;
- const char *firmware_dir = "/usr/local/share/uefi-firmware";
size_t firmwares_alloc = 0;
+ virBhyveDriverConfigPtr cfg = virBhyveDriverGetConfig(conn);
+ const char *firmware_dir = cfg->firmwareDir;
if (!(caps = virDomainCapsNew(emulatorbin, machine, arch, virttype)))
goto cleanup;
@@ -152,7 +154,10 @@ virBhyveDomainCapsBuild(const char *emulatorbin,
caps->os.loader.values.nvalues++;
}
+ } else {
+ VIR_WARN("Cannot open firmware directory %s", firmware_dir);
}
+
caps->disk.supported = true;
VIR_DOMAIN_CAPS_ENUM_SET(caps->disk.diskDevice,
VIR_DOMAIN_DISK_DEVICE_DISK,
diff --git a/src/bhyve/bhyve_capabilities.h b/src/bhyve/bhyve_capabilities.h
index 8fb97d730..3d8edb490 100644
--- a/src/bhyve/bhyve_capabilities.h
+++ b/src/bhyve/bhyve_capabilities.h
@@ -25,8 +25,11 @@
# include "capabilities.h"
# include "conf/domain_capabilities.h"
+# include "bhyve_conf.h"
+
virCapsPtr virBhyveCapsBuild(void);
-virDomainCapsPtr virBhyveDomainCapsBuild(const char *emulatorbin,
+virDomainCapsPtr virBhyveDomainCapsBuild(bhyveConnPtr,
+ const char *emulatorbin,
const char *machine,
virArch arch,
virDomainVirtType virttype);
diff --git a/src/bhyve/bhyve_conf.c b/src/bhyve/bhyve_conf.c
new file mode 100644
index 000000000..b0b40c575
--- /dev/null
+++ b/src/bhyve/bhyve_conf.c
@@ -0,0 +1,112 @@
+/*
+ * bhyve_conf.c: bhyve config file
+ *
+ * Copyright (C) 2017 Roman Bogorodskiy
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <config.h>
+
+#include "viralloc.h"
+#include "virlog.h"
+#include "virstring.h"
+#include "bhyve_conf.h"
+#include "configmake.h"
+
+#define VIR_FROM_THIS VIR_FROM_BHYVE
+
+VIR_LOG_INIT("bhyve.bhyve_conf");
+
+static virClassPtr virBhyveDriverConfigClass;
+static void virBhyveDriverConfigDispose(void *obj);
+
+static int virBhyveConfigOnceInit(void)
+{
+ if (!(virBhyveDriverConfigClass = virClassNew(virClassForObject(),
+ "virBhyveDriverConfig",
+ sizeof(virBhyveDriverConfig),
+ virBhyveDriverConfigDispose)))
+ return -1;
+
+ return 0;
+}
+
+VIR_ONCE_GLOBAL_INIT(virBhyveConfig)
+
+virBhyveDriverConfigPtr
+virBhyveDriverConfigNew(void)
+{
+ virBhyveDriverConfigPtr cfg;
+
+ if (virBhyveConfigInitialize() < 0)
+ return NULL;
+
+ if (!(cfg = virObjectNew(virBhyveDriverConfigClass)))
+ return NULL;
+
+ if (VIR_STRDUP(cfg->firmwareDir, DATADIR "/uefi-firmware") < 0)
+ goto error;
+
+ return cfg;
+
+ error:
+ virObjectUnref(cfg);
+ return NULL;
+}
+
+int
+virBhyveLoadDriverConfig(virBhyveDriverConfigPtr cfg,
+ const char *filename)
+{
+ virConfPtr conf;
+ int ret = -1;
+
+ if (access(filename, R_OK) == -1) {
+ VIR_INFO("Could not read bhyve config file %s", filename);
+ return 0;
+ }
+
+ if (!(conf = virConfReadFile(filename, 0)))
+ return -1;
+
+ if (virConfGetValueString(conf, "firmware_dir",
+ &cfg->firmwareDir) < 0)
+ goto cleanup;
+
+ ret = 0;
+ cleanup:
+ virConfFree(conf);
+ return ret;
+}
+
+virBhyveDriverConfigPtr
+virBhyveDriverGetConfig(bhyveConnPtr driver)
+{
+ virBhyveDriverConfigPtr cfg;
+ bhyveDriverLock(driver);
+ cfg = virObjectRef(driver->config);
+ bhyveDriverUnlock(driver);
+ return cfg;
+}
+
+static void
+virBhyveDriverConfigDispose(void *obj)
+{
+ virBhyveDriverConfigPtr cfg = obj;
+
+ VIR_FREE(cfg->firmwareDir);
+}
diff --git a/src/bhyve/bhyve_conf.h b/src/bhyve/bhyve_conf.h
new file mode 100644
index 000000000..3f105ace1
--- /dev/null
+++ b/src/bhyve/bhyve_conf.h
@@ -0,0 +1,32 @@
+/*
+ * bhyve_conf.h: bhyve config file
+ *
+ * Copyright (C) 2017 Roman Bogorodskiy
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef BHYVE_CONF_H
+# define BHYVE_CONF_H
+
+# include "bhyve_utils.h"
+
+virBhyveDriverConfigPtr virBhyveDriverConfigNew(void);
+virBhyveDriverConfigPtr virBhyveDriverGetConfig(bhyveConnPtr driver);
+int virBhyveLoadDriverConfig(virBhyveDriverConfigPtr cfg,
+ const char *filename);
+
+#endif /* BHYVE_CONF_H */
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 759825c28..3258c2720 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -55,6 +55,7 @@
#include "virhostmem.h"
#include "conf/domain_capabilities.h"
+#include "bhyve_conf.h"
#include "bhyve_device.h"
#include "bhyve_driver.h"
#include "bhyve_command.h"
@@ -1228,6 +1229,7 @@ bhyveStateCleanup(void)
virSysinfoDefFree(bhyve_driver->hostsysinfo);
virObjectUnref(bhyve_driver->closeCallbacks);
virObjectUnref(bhyve_driver->domainEventState);
+ virObjectUnref(bhyve_driver->config);
virMutexDestroy(&bhyve_driver->lock);
VIR_FREE(bhyve_driver);
@@ -1276,6 +1278,12 @@ bhyveStateInitialize(bool privileged,
bhyve_driver->hostsysinfo = virSysinfoRead();
+ if (!(bhyve_driver->config = virBhyveDriverConfigNew()))
+ goto cleanup;
+
+ if (virBhyveLoadDriverConfig(bhyve_driver->config, SYSCONFDIR "/libvirt/bhyve.conf") < 0)
+ goto cleanup;
+
if (virFileMakePath(BHYVE_LOG_DIR) < 0) {
virReportSystemError(errno,
_("Failed to mkdir %s"),
@@ -1657,7 +1665,8 @@ bhyveConnectGetDomainCapabilities(virConnectPtr conn,
goto cleanup;
}
- if (!(caps = virBhyveDomainCapsBuild(emulatorbin, machine, arch, virttype)))
+ if (!(caps = virBhyveDomainCapsBuild(conn->privateData, emulatorbin,
+ machine, arch, virttype)))
goto cleanup;
ret = virDomainCapsFormat(caps);
diff --git a/src/bhyve/bhyve_utils.h b/src/bhyve/bhyve_utils.h
index 9a911608c..db50e012a 100644
--- a/src/bhyve/bhyve_utils.h
+++ b/src/bhyve/bhyve_utils.h
@@ -34,8 +34,20 @@
# define BHYVE_STATE_DIR LOCALSTATEDIR "/run/libvirt/bhyve"
# define BHYVE_LOG_DIR LOCALSTATEDIR "/log/libvirt/bhyve"
+typedef struct _virBhyveDriverConfig virBhyveDriverConfig;
+typedef struct _virBhyveDriverConfig *virBhyveDriverConfigPtr;
+
+struct _virBhyveDriverConfig {
+ virObject parent;
+
+ char *firmwareDir;
+};
+
struct _bhyveConn {
virMutex lock;
+
+ virBhyveDriverConfigPtr config;
+
virDomainObjListPtr domains;
virCapsPtr caps;
virDomainXMLOptionPtr xmlopt;
diff --git a/src/bhyve/libvirtd_bhyve.aug b/src/bhyve/libvirtd_bhyve.aug
new file mode 100644
index 000000000..66079376c
--- /dev/null
+++ b/src/bhyve/libvirtd_bhyve.aug
@@ -0,0 +1,39 @@
+(* /etc/libvirt/bhyve.conf *)
+
+module Libvirtd_bhyve =
+ autoload xfm
+
+ let eol = del /[ \t]*\n/ "\n"
+ let value_sep = del /[ \t]*=[ \t]*/ " = "
+ let indent = del /[ \t]*/ ""
+
+ let array_sep = del /,[ \t\n]*/ ", "
+ let array_start = del /\[[ \t\n]*/ "[ "
+ let array_end = del /\]/ "]"
+
+ let str_val = del /\"/ "\"" . store /[^\"]*/ . del /\"/ "\""
+ let bool_val = store /0|1/
+ let int_val = store /[0-9]+/
+ let str_array_element = [ seq "el" . str_val ] . del /[ \t\n]*/ ""
+ let str_array_val = counter "el" . array_start . ( str_array_element . ( array_sep . str_array_element ) * ) ? . array_end
+
+ let str_entry (kw:string) = [ key kw . value_sep . str_val ]
+ let bool_entry (kw:string) = [ key kw . value_sep . bool_val ]
+ let int_entry (kw:string) = [ key kw . value_sep . int_val ]
+ let str_array_entry (kw:string) = [ key kw . value_sep . str_array_val ]
+
+ let log_entry = str_entry "firmware_dir"
+
+ (* Each enty in the config is one of the following three ... *)
+ let entry = log_entry
+ let comment = [ label "#comment" . del /#[ \t]*/ "# " . store /([^ \t\n][^\n]*)?/ . del /\n/ "\n" ]
+ let empty = [ label "#empty" . eol ]
+
+ let record = indent . entry . eol
+
+ let lns = ( record | comment | empty ) *
+
+ let filter = incl "/etc/libvirt/bhyve.conf"
+ . Util.stdexcl
+
+ let xfm = transform lns filter
diff --git a/src/bhyve/test_libvirtd_bhyve.aug.in b/src/bhyve/test_libvirtd_bhyve.aug.in
new file mode 100644
index 000000000..f28e58614
--- /dev/null
+++ b/src/bhyve/test_libvirtd_bhyve.aug.in
@@ -0,0 +1,5 @@
+module Test_libvirtd_bhyve =
+ ::CONFIG::
+
+ test Libvirtd_bhyve.lns get conf =
+{ "firmware_dir" = "/usr/local/share/uefi-firmware" }
--
2.11.0
7 years, 9 months
[libvirt] [PATCH] docs: moved 'timestamps' and 'encryption' sub-element description in formatstorage doc
by Alexander Vasilenko
---
docs/formatstorage.html.in | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/docs/formatstorage.html.in b/docs/formatstorage.html.in
index c787a059d..225e19000 100644
--- a/docs/formatstorage.html.in
+++ b/docs/formatstorage.html.in
@@ -456,24 +456,6 @@
will be filled with the values used by the existing directory.
<span class="since">Since 1.2.16</span>
</dd>
- <dt><code>timestamps</code></dt>
- <dd>Provides timing information about the volume. Up to four
- sub-elements are present,
- where <code>atime</code>, <code>btime</code>, <code>ctime</code>
- and <code>mtime</code> hold the access, birth, change and
- modification time of the volume, where known. The used time
- format is <seconds>.<nanoseconds> since the
- beginning of the epoch (1 Jan 1970). If nanosecond resolution
- is 0 or otherwise unsupported by the host OS or filesystem,
- then the nanoseconds part is omitted. This is a readonly
- attribute and is ignored when creating a volume.
- <span class="since">Since 0.10.0</span>
- </dd>
- <dt><code>encryption</code></dt>
- <dd>If present, specifies how the volume is encrypted. See
- the <a href="formatstorageencryption.html">Storage Encryption</a> page
- for more information.
- </dd>
</dl>
<h3><a name="StoragePoolExtents">Device extents</a></h3>
@@ -658,6 +640,24 @@
will be filled with the values used by the existing file.
<span class="since">Since 0.4.1</span>
</dd>
+ <dt><code>timestamps</code></dt>
+ <dd>Provides timing information about the volume. Up to four
+ sub-elements are present,
+ where <code>atime</code>, <code>btime</code>, <code>ctime</code>
+ and <code>mtime</code> hold the access, birth, change and
+ modification time of the volume, where known. The used time
+ format is <seconds>.<nanoseconds> since the
+ beginning of the epoch (1 Jan 1970). If nanosecond resolution
+ is 0 or otherwise unsupported by the host OS or filesystem,
+ then the nanoseconds part is omitted. This is a readonly
+ attribute and is ignored when creating a volume.
+ <span class="since">Since 0.10.0</span>
+ </dd>
+ <dt><code>encryption</code></dt>
+ <dd>If present, specifies how the volume is encrypted. See
+ the <a href="formatstorageencryption.html">Storage Encryption</a> page
+ for more information.
+ </dd>
<dt><code>compat</code></dt>
<dd>Specify compatibility level. So far, this is only used for
<code>type='qcow2'</code> volumes. Valid values are <code>0.10</code>
--
2.12.0
7 years, 9 months
[libvirt] [PATCH] virtperf: Revert PERF_COUNT_HW_REF_CPU_CYCLES conditional
by Olaf Hering
All PERF_* names are enmus. Enums are ordinary code for CPP.
An ifdef does not trigger.
Fixes 1d29c889a ("Make use of PERF_COUNT_HW_REF_CPU_CYCLES conditional")
Signed-off-by: Olaf Hering <olaf(a)aepfle.de>
---
src/util/virperf.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/src/util/virperf.c b/src/util/virperf.c
index e39cebbe0..33039544a 100644
--- a/src/util/virperf.c
+++ b/src/util/virperf.c
@@ -108,13 +108,8 @@ static struct virPerfEventAttr attrs[] = {
.attrType = PERF_TYPE_HARDWARE,
.attrConfig = PERF_COUNT_HW_STALLED_CYCLES_BACKEND},
{.type = VIR_PERF_EVENT_REF_CPU_CYCLES,
-# ifdef PERF_COUNT_HW_REF_CPU_CYCLES
.attrType = PERF_TYPE_HARDWARE,
.attrConfig = PERF_COUNT_HW_REF_CPU_CYCLES
-# else
- .attrType = 0,
- .attrConfig = 0,
-# endif
},
{.type = VIR_PERF_EVENT_CPU_CLOCK,
.attrType = PERF_TYPE_SOFTWARE,
7 years, 9 months
[libvirt] [PATCH] [Changelog]:If there is a process with a client which registers event callbacks, and it calls libvirt's API which uses the same virConnectPtr in that callback function. When this process exit abnormally lead to client disconnect, there is a possibility that the libvirtd's main thread is use virServerClient to send event just after the virServerClient been freed by job thread. Following is backtrace:
by xinhua.Cao
#0 0x00007fda223d66d8 in virClassIsDerivedFrom (klass=0xdeadbeef, parent=0x7fda24c81b40) at util/virobject.c:169
#1 0x00007fda223d6a1e in virObjectIsClass (anyobj=anyobj@entry=0x7fd9e575b400, klass=<optimized out>) at util/virobject.c:365
#2 0x00007fda223d6a44 in virObjectLock (anyobj=0x7fd9e575b400) at util/virobject.c:317
#3 0x00007fda22507f71 in virNetServerClientSendMessage (client=client@entry=0x7fd9e575b400, msg=msg@entry=0x7fd9ec30de90)
at rpc/virnetserverclient.c:1422
#4 0x00007fda230d714d in remoteDispatchObjectEventSend (client=0x7fd9e575b400, program=0x7fda24c844e0, procnr=348,
proc=0x7fda2310e5e0 <xdr_remote_domain_event_callback_tunable_msg>, data=0x7ffc3857fdb0) at remote.c:3803
#5 0x00007fda230dd71b in remoteRelayDomainEventTunable (conn=<optimized out>, dom=0x7fda27cd7660, params=0x7fda27f3aae0, nparams=1,opaque=0x7fd9e6c99e00) at remote.c:1033
#6 0x00007fda224484cb in virDomainEventDispatchDefaultFunc (conn=0x7fda27cd0120, event=0x7fda2736ea00,
cb=0x7fda230dd610 <remoteRelayDomainEventTunable>, cbopaque=0x7fd9e6c99e00) at conf/domain_event.c:1910
#7 0x00007fda22446871 in virObjectEventStateDispatchCallbacks (callbacks=<optimized out>, callbacks=<optimized out>, event=0x7fda2736ea00,state=0x7fda24ca3960) at conf/object_event.c:722
#8 virObjectEventStateQueueDispatch (callbacks=0x7fda24c65800, queue=0x7ffc3857fe90, state=0x7fda24ca3960) at conf/object_event.c:736
#9 virObjectEventStateFlush (state=0x7fda24ca3960) at conf/object_event.c:814
#10 virObjectEventTimer (timer=<optimized out>, opaque=0x7fda24ca3960) at conf/object_event.c:560
#11 0x00007fda223ae8b9 in virEventPollDispatchTimeouts () at util/vireventpoll.c:458
#12 virEventPollRunOnce () at util/vireventpoll.c:654
#13 0x00007fda223ad1d2 in virEventRunDefaultImpl () at util/virevent.c:314
#14 0x00007fda225046cd in virNetDaemonRun (dmn=0x7fda24c775c0) at rpc/virnetdaemon.c:818
#15 0x00007fda230d6351 in main (argc=<optimized out>, argv=<optimized out>) at libvirtd.c:1623
Let's clean all event callback when client close.
Signed-off-by: xinhua.Cao <caoxinhua(a)huawei.com>
this patch resolved the bug which reported by Wang King. and the prior patch link is http://www.redhat.com/archives/libvir-list/2017-February/msg00452.html
---
daemon/remote.c | 60 +++++++++++++++++++++++++++------------------------------
1 file changed, 28 insertions(+), 32 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index 4aa43c223..22330307f 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -100,6 +100,7 @@ static void make_nonnull_node_device(remote_nonnull_node_device *dev_dst, virNod
static void make_nonnull_secret(remote_nonnull_secret *secret_dst, virSecretPtr secret_src);
static void make_nonnull_nwfilter(remote_nonnull_nwfilter *net_dst, virNWFilterPtr nwfilter_src);
static void make_nonnull_domain_snapshot(remote_nonnull_domain_snapshot *snapshot_dst, virDomainSnapshotPtr snapshot_src);
+static void remoteClientCleanEventCallbacks(struct daemonClientPrivate *priv);
static int
remoteSerializeDomainDiskErrors(virDomainDiskErrorPtr errors,
@@ -1389,24 +1390,15 @@ void remoteRelayConnectionClosedEvent(virConnectPtr conn ATTRIBUTE_UNUSED, int r
&msg);
}
-/*
- * You must hold lock for at least the client
- * We don't free stuff here, merely disconnect the client's
- * network socket & resources.
- * We keep the libvirt connection open until any async
- * jobs have finished, then clean it up elsewhere
- */
-void remoteClientFreeFunc(void *data)
+static void remoteClientCleanEventCallbacks(struct daemonClientPrivate *priv)
{
- struct daemonClientPrivate *priv = data;
-
/* Deregister event delivery callback */
- if (priv->conn) {
- virIdentityPtr sysident = virIdentityGetSystem();
+ if (priv && priv->conn) {
size_t i;
-
+ virIdentityPtr sysident = virIdentityGetSystem();
virIdentitySetCurrent(sysident);
+ virMutexLock(&priv->lock);
for (i = 0; i < priv->ndomainEventCallbacks; i++) {
int callbackID = priv->domainEventCallbacks[i]->callbackID;
if (callbackID < 0) {
@@ -1420,6 +1412,7 @@ void remoteClientFreeFunc(void *data)
VIR_WARN("unexpected domain event deregister failure");
}
VIR_FREE(priv->domainEventCallbacks);
+ priv->ndomainEventCallbacks = 0;
for (i = 0; i < priv->nnetworkEventCallbacks; i++) {
int callbackID = priv->networkEventCallbacks[i]->callbackID;
@@ -1435,21 +1428,7 @@ void remoteClientFreeFunc(void *data)
VIR_WARN("unexpected network event deregister failure");
}
VIR_FREE(priv->networkEventCallbacks);
-
- for (i = 0; i < priv->nstorageEventCallbacks; i++) {
- int callbackID = priv->storageEventCallbacks[i]->callbackID;
- if (callbackID < 0) {
- VIR_WARN("unexpected incomplete storage pool callback %zu", i);
- continue;
- }
- VIR_DEBUG("Deregistering remote storage pool event relay %d",
- callbackID);
- priv->storageEventCallbacks[i]->callbackID = -1;
- if (virConnectStoragePoolEventDeregisterAny(priv->conn,
- callbackID) < 0)
- VIR_WARN("unexpected storage pool event deregister failure");
- }
- VIR_FREE(priv->storageEventCallbacks);
+ priv->nnetworkEventCallbacks = 0;
for (i = 0; i < priv->nqemuEventCallbacks; i++) {
int callbackID = priv->qemuEventCallbacks[i]->callbackID;
@@ -1465,28 +1444,45 @@ void remoteClientFreeFunc(void *data)
VIR_WARN("unexpected qemu monitor event deregister failure");
}
VIR_FREE(priv->qemuEventCallbacks);
+ priv->nqemuEventCallbacks = 0;
if (priv->closeRegistered) {
if (virConnectUnregisterCloseCallback(priv->conn,
remoteRelayConnectionClosedEvent) < 0)
VIR_WARN("unexpected close callback event deregister failure");
}
-
- virConnectClose(priv->conn);
-
+ virMutexUnlock(&priv->lock);
virIdentitySetCurrent(NULL);
virObjectUnref(sysident);
}
+}
+
+
+/*
+ * You must hold lock for at least the client
+ * We don't free stuff here, merely disconnect the client's
+ * network socket & resources.
+ * We keep the libvirt connection open until any async
+ * jobs have finished, then clean it up elsewhere
+ */
+void remoteClientFreeFunc(void *data)
+{
+ struct daemonClientPrivate *priv = data;
+ if (!priv || !priv->conn)
+ return;
+
+ remoteClientCleanEventCallbacks(priv);
+ virConnectClose(priv->conn);
VIR_FREE(priv);
}
-
static void remoteClientCloseFunc(virNetServerClientPtr client)
{
struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client);
daemonRemoveAllClientStreams(priv->streams);
+ remoteClientCleanEventCallbacks(priv);
}
--
2.12.0.windows.1
7 years, 9 months
[libvirt] [PATCH 0/4] Prevent loosing IPv6 routes due to forwarding
by Cédric Bosdonnat
Hi all,
When enabling IPv6 forwarding on hosts getting Router Advertised routes,
the host looses the RA routes. To prevent this, check if the host has
such routes. In case there are some, check that the accept_ra is set
to 2 before bringing the network up.
Cédric Bosdonnat (4):
util: extract the request sending code from virNetlinkCommand()
util: add virNetlinkDumpCommand()
bridge_driver.c: more uses of SYSCTL_PATH
network: check accept_ra before enabling ipv6 forwarding
src/libvirt_private.syms | 1 +
src/network/bridge_driver.c | 187 +++++++++++++++++++++++++++++++++++++++++---
src/util/virnetlink.c | 145 +++++++++++++++++++++++++---------
src/util/virnetlink.h | 9 +++
4 files changed, 298 insertions(+), 44 deletions(-)
--
2.11.0
7 years, 9 months
[libvirt] [PATCH] docs: document virt-host-validate bhyve support
by Roman Bogorodskiy
Add an entry about virt-host-validate bhyve support and
update the driver's page.
---
docs/drvbhyve.html.in | 13 ++++++++++++-
docs/news.xml | 10 +++++++++-
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/docs/drvbhyve.html.in b/docs/drvbhyve.html.in
index da6f1e0b2..64a1ff694 100644
--- a/docs/drvbhyve.html.in
+++ b/docs/drvbhyve.html.in
@@ -13,9 +13,20 @@ of bhyve are supported.
In order to enable bhyve on your FreeBSD host, you'll need to load the <code>vmm</code>
kernel module. Additionally, <code>if_tap</code> and <code>if_bridge</code> modules
-should be loaded for networking support.
+should be loaded for networking support. Also, <span class="since">since 3.2.0</span> the
+<code>virt-host-validate(1)</code> supports the bhyve host validation and could be
+used like this:
</p>
+<pre>
+$ virt-host-validate bhyve
+ BHYVE: Checking for vmm module : PASS
+ BHYVE: Checking for if_tap module : PASS
+ BHYVE: Checking for if_bridge module : PASS
+ BHYVE: Checking for nmdm module : PASS
+$
+</pre>
+
<p>
Additional information on bhyve could be obtained on <a href="http://bhyve.org/">bhyve.org</a>.
</p>
diff --git a/docs/news.xml b/docs/news.xml
index 951539575..57fafebb8 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -12,7 +12,15 @@
<libvirt>
<release version="v3.2.0" date="unreleased">
<section title="New features">
- <change/>
+ <change>
+ <summary>
+ virt-host-validate: Add bhyve support
+ </summary>
+ <description>
+ Add support for validation of the bhyve hypervisor hosts
+ using the virt-host-validate tool.
+ </description>
+ </change>
</section>
<section title="Improvements">
<change>
--
2.11.0
7 years, 9 months