[libvirt] [PATCH] conf: fix no error when set an unsupport string in ./devices/shmem/msi[@ioeventfd]
by Luyao Huang
https://bugzilla.redhat.com/show_bug.cgi?id=1220265
Pass the return value to an enum directly is not safe.
When pass a invalid @ioeventfd and virTristateSwitchTypeFromString
return -1 to def->msi.ioeventfd, and this value transform to
4294967295, so no error when the parse failed.
Instead of define a int variable in virDomainShmemDefParseXML and
use the new defined variable as transition variable. I think
define ioeventfd as an 'int' variable will be better.
Signed-off-by: Luyao Huang <lhuang(a)redhat.com>
---
src/conf/domain_conf.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 087d282..fea9baa 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1610,7 +1610,7 @@ struct _virDomainShmemDef {
struct {
bool enabled;
unsigned vectors;
- virTristateSwitch ioeventfd;
+ int ioeventfd; /* enum virTristateSwitch */
} msi;
virDomainDeviceInfo info;
};
--
1.8.3.1
9 years, 7 months
[libvirt] [PATCH 0/6] Refactor critical section in virDomainListAllDomains and fix qemuConnectGetAllDomainStats
by Peter Krempa
Peter Krempa (6):
util: Make the virDomainListFree helper more universal
conf: Extract code to filter domain list into a separate function
conf: Rename virDomainObjListFilter type to virDomainObjListACLFilter
conf: Refactor domain list collection critical section
conf: Add helper to convert list of virDomains to a list of
virDomainObjs
qemu: Convert qemuConnectGetAllDomainStats to use new helpers
daemon/remote.c | 2 +-
src/conf/domain_conf.c | 258 ++++++++++++++++++++++++++++---------------
src/conf/domain_conf.h | 29 +++--
src/libvirt_private.syms | 5 +-
src/qemu/qemu_driver.c | 86 +++++++--------
src/util/virobject.c | 41 +++++++
src/util/virobject.h | 2 +
tools/virsh-domain-monitor.c | 2 +-
8 files changed, 275 insertions(+), 150 deletions(-)
--
2.3.5
9 years, 7 months
[libvirt] [python PATCH] Post-release version bump to 1.2.16
by Peter Krempa
---
Pushed as trivial.
setup.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.py b/setup.py
index a8e9e86..2571742 100755
--- a/setup.py
+++ b/setup.py
@@ -309,7 +309,7 @@ class my_clean(clean):
_c_modules, _py_modules = get_module_lists()
setup(name = 'libvirt-python',
- version = '1.2.15',
+ version = '1.2.16',
url = 'http://www.libvirt.org',
maintainer = 'Libvirt Maintainers',
maintainer_email = 'libvir-list(a)redhat.com',
--
2.3.5
9 years, 7 months
[libvirt] [PATCH 0/3] Few more memory hotplug related fixes
by Peter Krempa
Peter Krempa (3):
conf: Always truncate balloon size to maximum memory size
conf: Fix up balloon size after removing a memory device from def
qemu: Fix balloon size handling with memory hot(un)plug
src/conf/domain_conf.c | 27 +++++++--------------------
src/qemu/qemu_driver.c | 3 +++
src/qemu/qemu_hotplug.c | 10 ++++++++++
3 files changed, 20 insertions(+), 20 deletions(-)
--
2.3.5
9 years, 7 months
[libvirt] [PATCH] tools: fix the output of blockjob
by Shanzhi Yu
There will be no output when use blockjob with "--raw" option if guest
has no block job. A explicit message should be given just like
with "--info"
Signed-off-by: Shanzhi Yu <shyu(a)redhat.com>
---
tools/virsh-domain.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 14e1e35..7094a43 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -2541,7 +2541,6 @@ cmdBlockJob(vshControl *ctl, const vshCmd *cmd)
}
if (rc == 0) {
- if (!raw)
vshPrint(ctl, _("No current block job for %s"), path);
ret = true;
goto cleanup;
--
2.1.0
9 years, 7 months
[libvirt] [PATCH v2] libxl: include a XLU_Config in _libxlDriverConfig
by Olaf Hering
Upcoming changes for vscsi will use libxlutil.so to prepare the
configuration for libxl. The helpers needs a xlu struct for logging.
Provide one and reuse the existing output as log target.
Signed-off-by: Olaf Hering <olaf(a)aepfle.de>
Cc: Jim Fehlig <jfehlig(a)suse.com>
---
v2:
- call xlu_cfg_destroy, unconditionally
- fix cpp indention in libxl_conf.h
src/libxl/libxl_conf.c | 7 +++++++
src/libxl/libxl_conf.h | 7 +++++++
2 files changed, 14 insertions(+)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index fccada5..e1bc0f6 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -92,6 +92,7 @@ libxlDriverConfigDispose(void *obj)
virObjectUnref(cfg->caps);
libxl_ctx_free(cfg->ctx);
xtl_logger_destroy(cfg->logger);
+ xlu_cfg_destroy(cfg->xlu);
if (cfg->logger_file)
VIR_FORCE_FCLOSE(cfg->logger_file);
@@ -1468,6 +1469,12 @@ libxlDriverConfigNew(void)
goto error;
}
+ cfg->xlu = xlu_cfg_init(cfg->logger_file, "libvirt");
+ if (!cfg->xlu) {
+ VIR_ERROR(_("cannot create xlu for libxenlight, disabling driver"));
+ goto error;
+ }
+
if (libxl_ctx_alloc(&cfg->ctx, LIBXL_VERSION, 0, cfg->logger)) {
VIR_ERROR(_("cannot initialize libxenlight context, probably not "
"running in a Xen Dom0, disabling driver"));
diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
index 0a1c0db..24fa960 100644
--- a/src/libxl/libxl_conf.h
+++ b/src/libxl/libxl_conf.h
@@ -27,6 +27,12 @@
# define LIBXL_CONF_H
# include <libxl.h>
+# ifdef HAVE_LIBXLUTIL_H
+# include <libxlutil.h>
+# else
+typedef struct XLU_Config XLU_Config;
+XLU_Config *xlu_cfg_init(FILE *report, const char *report_filename);
+# endif
# include "internal.h"
# include "libvirt_internal.h"
@@ -92,6 +98,7 @@ struct _libxlDriverConfig {
/* log stream for driver-wide libxl ctx */
FILE *logger_file;
xentoollog_logger *logger;
+ XLU_Config *xlu;
/* libxl ctx for driver wide ops; getVersion, getNodeInfo, ... */
libxl_ctx *ctx;
9 years, 7 months
[libvirt] [PATCH] libxl: support vscsi
by Olaf Hering
This uses the API version of the proposed vscsi support in libxl (v4):
http://lists.xenproject.org/archives/html/xen-devel/2015-04/msg01949.html
Is there anything else that needs to be done in libvirt? Right now libvirt scsi
support is very simple minded, no support at all to describe host devices with
persistant names.
This patch got very little runtime testing up to now...
Signed-off-by: Olaf Hering <olaf(a)aepfle.de>
---
src/libxl/libxl_conf.c | 59 +++++++++++++++++
src/libxl/libxl_conf.h | 1 +
src/libxl/libxl_domain.c | 2 +-
src/libxl/libxl_driver.c | 167 +++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 228 insertions(+), 1 deletion(-)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index f9bb5ed..7964e8b 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -1591,6 +1591,61 @@ libxlMakePCIList(virDomainDefPtr def, libxl_domain_config *d_config)
}
static int
+libxlMakeVscsiList(libxl_ctx *ctx,
+ XLU_Config *xlu,
+ virDomainDefPtr def,
+ libxl_domain_config *d_config)
+{
+ virDomainHostdevDefPtr *l_hostdevs = def->hostdevs;
+ size_t i, nhostdevs = def->nhostdevs;
+ virDomainHostdevDefPtr hostdev;
+ virDomainHostdevSubsysSCSIPtr scsisrc;
+ char *str;
+ int rc = 0;
+
+ if (nhostdevs == 0)
+ return 0;
+
+ for (i = 0; i < nhostdevs; i++) {
+ hostdev = l_hostdevs[i];
+ if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS)
+ continue;
+ if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI)
+ continue;
+ scsisrc = &hostdev->source.subsys.u.scsi;
+ if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
+ continue;
+#if defined(LIBXL_HAVE_VSCSI)
+ if (virAsprintf(&str, "%s:%u:%u:%u,%u:%u:%u:%u%s",
+ scsisrc->u.host.adapter + strlen("scsi_host"),
+ scsisrc->u.host.bus,
+ scsisrc->u.host.target,
+ scsisrc->u.host.unit,
+ hostdev->info->addr.drive.controller,
+ hostdev->info->addr.drive.bus,
+ hostdev->info->addr.drive.target,
+ hostdev->info->addr.drive.unit,
+ scsisrc->rawio == VIR_TRISTATE_BOOL_YES ? ",feature-host" : "") < 0) {
+ goto error;
+ };
+ rc = xlu_vscsi_config_add(xlu, ctx, str, &d_config->num_vscsis, &d_config->vscsis);
+ VIR_FREE(str);
+ if (rc)
+ goto error;
+#else
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("This version of libxenlight does not support vscsi"));
+ goto error;
+#endif
+ }
+
+ return 0;
+
+ error:
+ return -1;
+}
+
+static int
libxlMakeVideo(virDomainDefPtr def, libxl_domain_config *d_config)
{
@@ -1724,6 +1779,7 @@ int
libxlBuildDomainConfig(virPortAllocatorPtr graphicsports,
virDomainDefPtr def,
libxl_ctx *ctx,
+ XLU_Config *xlu,
libxl_domain_config *d_config)
{
libxl_domain_config_init(d_config);
@@ -1746,6 +1802,9 @@ libxlBuildDomainConfig(virPortAllocatorPtr graphicsports,
if (libxlMakePCIList(def, d_config) < 0)
return -1;
+ if (libxlMakeVscsiList(ctx, xlu, def, d_config) < 0)
+ return -1;
+
/*
* Now that any potential VFBs are defined, update the build info with
* the data of the primary display. Some day libxl might implicitely do
diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
index bdc68d4..94a3046 100644
--- a/src/libxl/libxl_conf.h
+++ b/src/libxl/libxl_conf.h
@@ -205,6 +205,7 @@ int
libxlBuildDomainConfig(virPortAllocatorPtr graphicsports,
virDomainDefPtr def,
libxl_ctx *ctx,
+ XLU_Config *xlu,
libxl_domain_config *d_config);
static inline void
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 3039427..537e370 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -950,7 +950,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
}
if (libxlBuildDomainConfig(driver->reservedVNCPorts, vm->def,
- cfg->ctx, &d_config) < 0)
+ cfg->ctx, cfg->xlu, &d_config) < 0)
goto cleanup;
if (cfg->autoballoon && libxlDomainFreeMem(cfg->ctx, &d_config) < 0)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index f915f91..424150f 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -2943,6 +2943,97 @@ libxlDomainAttachHostPCIDevice(libxlDriverPrivatePtr driver,
}
static int
+libxlDomainAttachHostSCSIDevice(libxlDriverPrivatePtr driver,
+ virDomainObjPtr vm,
+ virDomainHostdevDefPtr hostdev)
+{
+#if defined(LIBXL_HAVE_VSCSI)
+ libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
+ libxl_device_vscsi vscsidev;
+ virDomainHostdevDefPtr found;
+ virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
+ virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
+ char *str = NULL;
+ int ret = -1;
+
+ if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
+ return -1;
+
+ libxl_device_vscsi_init(&vscsidev);
+
+ if (virDomainHostdevFind(vm->def, hostdev, &found) >= 0) {
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("target scsi device %u:%u:%u:%u already exists"),
+ hostdev->info->addr.drive.controller,
+ hostdev->info->addr.drive.bus,
+ hostdev->info->addr.drive.target,
+ hostdev->info->addr.drive.unit);
+ goto cleanup;
+ }
+
+ if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1) < 0)
+ goto cleanup;
+
+ if (virHostdevPrepareSCSIDevices(hostdev_mgr, LIBXL_DRIVER_NAME,
+ vm->def->name, &hostdev, 1) < 0)
+ goto cleanup;
+
+ if (virAsprintf(&str, "%s:%u:%u:%u,%u:%u:%u:%u%s",
+ scsisrc->u.host.adapter + strlen("scsi_host"),
+ scsisrc->u.host.bus,
+ scsisrc->u.host.target,
+ scsisrc->u.host.unit,
+ hostdev->info->addr.drive.controller,
+ hostdev->info->addr.drive.bus,
+ hostdev->info->addr.drive.target,
+ hostdev->info->addr.drive.unit,
+ scsisrc->rawio == VIR_TRISTATE_BOOL_YES ?
+ ",feature-host" : "") < 0) {
+ goto error;
+ };
+
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", str);
+
+ if (xlu_vscsi_get_host(cfg->xlu, cfg->ctx, vm->def->id, str, &vscsidev) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("libxutil failed to parse scsi device %u:%u:%u:%u"),
+ hostdev->info->addr.drive.controller,
+ hostdev->info->addr.drive.bus,
+ hostdev->info->addr.drive.target,
+ hostdev->info->addr.drive.unit);
+ }
+
+ if (libxl_device_vscsi_add(cfg->ctx, vm->def->id, &vscsidev, NULL) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("libxenlight failed to attach scsi device %u:%u:%u:%u"),
+ hostdev->info->addr.drive.controller,
+ hostdev->info->addr.drive.bus,
+ hostdev->info->addr.drive.target,
+ hostdev->info->addr.drive.unit);
+ goto error;
+ }
+
+ vm->def->hostdevs[vm->def->nhostdevs++] = hostdev;
+ ret = 0;
+ goto cleanup;
+
+ error:
+ virHostdevReAttachSCSIDevices(hostdev_mgr, LIBXL_DRIVER_NAME,
+ vm->def->name, &hostdev, 1);
+
+ cleanup:
+ VIR_FREE(str);
+ virObjectUnref(cfg);
+ libxl_device_vscsi_dispose(&vscsidev);
+ return ret;
+#else
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("This version of libxenlight does not support vscsi"));
+ return -1;
+#endif
+}
+
+static int
libxlDomainAttachHostDevice(libxlDriverPrivatePtr driver,
virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev)
@@ -2960,6 +3051,11 @@ libxlDomainAttachHostDevice(libxlDriverPrivatePtr driver,
return -1;
break;
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
+ if (libxlDomainAttachHostSCSIDevice(driver, vm, hostdev) < 0)
+ return -1;
+ break;
+
default:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("hostdev subsys type '%s' not supported"),
@@ -3284,6 +3380,74 @@ libxlDomainDetachHostPCIDevice(libxlDriverPrivatePtr driver,
}
static int
+libxlDomainDetachHostSCSIDevice(libxlDriverPrivatePtr driver,
+ virDomainObjPtr vm,
+ virDomainHostdevDefPtr hostdev)
+{
+#if defined(LIBXL_HAVE_VSCSI)
+ libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
+ virDomainHostdevDefPtr detach;
+ int idx;
+ virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
+ virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
+ int ret = -1;
+ char *str = NULL;
+
+ if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
+ return -1;
+
+ idx = virDomainHostdevFind(vm->def, hostdev, &detach);
+ if (idx < 0) {
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("target scsi device %u:%u:%u:%u not found"),
+ hostdev->info->addr.drive.controller,
+ hostdev->info->addr.drive.bus,
+ hostdev->info->addr.drive.target,
+ hostdev->info->addr.drive.unit);
+ goto cleanup;
+ }
+
+ if (virAsprintf(&str, "%u:%u:%u:%u",
+ hostdev->info->addr.drive.controller,
+ hostdev->info->addr.drive.bus,
+ hostdev->info->addr.drive.target,
+ hostdev->info->addr.drive.unit) < 0) {
+ goto error;
+ };
+
+ if (xlu_vscsi_detach(cfg->xlu, cfg->ctx, vm->def->id, str) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("libxenlight failed to detach pci device %u:%u:%u:%u"),
+ hostdev->info->addr.drive.controller,
+ hostdev->info->addr.drive.bus,
+ hostdev->info->addr.drive.target,
+ hostdev->info->addr.drive.unit);
+ goto error;
+ }
+
+
+ virDomainHostdevRemove(vm->def, idx);
+
+ virHostdevReAttachPCIDevices(hostdev_mgr, LIBXL_DRIVER_NAME,
+ vm->def->name, &hostdev, 1, NULL);
+
+ ret = 0;
+
+ error:
+ VIR_FREE(str);
+ virDomainHostdevDefFree(detach);
+
+ cleanup:
+ virObjectUnref(cfg);
+ return ret;
+#else
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("This version of libxenlight does not support vscsi"));
+ return -1;
+#endif
+}
+
+static int
libxlDomainDetachHostDevice(libxlDriverPrivatePtr driver,
virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev)
@@ -3301,6 +3465,9 @@ libxlDomainDetachHostDevice(libxlDriverPrivatePtr driver,
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
return libxlDomainDetachHostPCIDevice(driver, vm, hostdev);
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
+ return libxlDomainDetachHostSCSIDevice(driver, vm, hostdev);
+
default:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected hostdev type %d"), subsys->type);
9 years, 7 months
[libvirt] [PATCH v2] caps: Fix regression defaulting to host arch
by Cole Robinson
My commit 747761a79 (v1.2.15 only) dropped this bit of logic when filling
in a default arch in the XML:
- /* First try to find one matching host arch */
- for (i = 0; i < caps->nguests; i++) {
- if (caps->guests[i]->ostype == ostype) {
- for (j = 0; j < caps->guests[i]->arch.ndomains; j++) {
- if (caps->guests[i]->arch.domains[j]->type == domain &&
- caps->guests[i]->arch.id == caps->host.arch)
- return caps->guests[i]->arch.id;
- }
- }
- }
That attempt to match host.arch is important, otherwise we end up
defaulting to i686 on x86_64 host for KVM, which is not intended.
Duplicate it in the centralized CapsLookup function.
Additionally add some testcases that would have caught this.
https://bugzilla.redhat.com/show_bug.cgi?id=1219191
---
v2:
Tweak subject
add test case for type=qemu as well
src/conf/capabilities.c | 63 +++++++++++++++-------
.../qemuxml2argv-default-kvm-host-arch.args | 4 ++
.../qemuxml2argv-default-kvm-host-arch.xml | 11 ++++
.../qemuxml2argv-default-qemu-host-arch.args | 4 ++
.../qemuxml2argv-default-qemu-host-arch.xml | 11 ++++
tests/qemuxml2argvtest.c | 2 +
.../qemuxml2xmlout-default-kvm-host-arch.xml | 21 ++++++++
.../qemuxml2xmlout-default-qemu-host-arch.xml | 21 ++++++++
tests/qemuxml2xmltest.c | 2 +
tests/testutilsqemu.c | 12 +++++
10 files changed, 132 insertions(+), 19 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-default-kvm-host-arch.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-default-kvm-host-arch.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-default-qemu-host-arch.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-default-qemu-host-arch.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-default-kvm-host-arch.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-default-qemu-host-arch.xml
diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index 922741f..c43bfb3 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -607,25 +607,13 @@ virCapsDomainDataCompare(virCapsGuestPtr guest,
return true;
}
-/**
- * virCapabilitiesDomainDataLookup:
- * @caps: capabilities to query
- * @ostype: guest operating system type, of enum VIR_DOMAIN_OSTYPE
- * @arch: Architecture to search for
- * @domaintype: domain type to search for, of enum VIR_DOMAIN_VIRT
- * @emulator: Emulator path to search for
- * @machinetype: Machine type to search for
- *
- * Search capabilities for the passed values, and if found return
- * virCapabilitiesDomainDataLookup filled in with the default values
- */
-virCapsDomainDataPtr
-virCapabilitiesDomainDataLookup(virCapsPtr caps,
- int ostype,
- virArch arch,
- int domaintype,
- const char *emulator,
- const char *machinetype)
+static virCapsDomainDataPtr
+virCapabilitiesDomainDataLookupInternal(virCapsPtr caps,
+ int ostype,
+ virArch arch,
+ int domaintype,
+ const char *emulator,
+ const char *machinetype)
{
virCapsGuestPtr foundguest = NULL;
virCapsGuestDomainPtr founddomain = NULL;
@@ -730,6 +718,43 @@ virCapabilitiesDomainDataLookup(virCapsPtr caps,
return ret;
}
+/**
+ * virCapabilitiesDomainDataLookup:
+ * @caps: capabilities to query
+ * @ostype: guest operating system type, of enum VIR_DOMAIN_OSTYPE
+ * @arch: Architecture to search for
+ * @domaintype: domain type to search for, of enum VIR_DOMAIN_VIRT
+ * @emulator: Emulator path to search for
+ * @machinetype: Machine type to search for
+ *
+ * Search capabilities for the passed values, and if found return
+ * virCapabilitiesDomainDataLookup filled in with the default values
+ */
+virCapsDomainDataPtr
+virCapabilitiesDomainDataLookup(virCapsPtr caps,
+ int ostype,
+ virArch arch,
+ int domaintype,
+ const char *emulator,
+ const char *machinetype)
+{
+ virCapsDomainDataPtr ret;
+
+ if (arch == VIR_ARCH_NONE) {
+ /* Prefer host arch if its available */
+ ret = virCapabilitiesDomainDataLookupInternal(caps, ostype,
+ caps->host.arch,
+ domaintype,
+ emulator, machinetype);
+ if (ret)
+ return ret;
+ }
+
+ return virCapabilitiesDomainDataLookupInternal(caps, ostype,
+ arch, domaintype,
+ emulator, machinetype);
+}
+
static int
virCapabilitiesFormatNUMATopology(virBufferPtr buf,
size_t ncells,
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-default-kvm-host-arch.args b/tests/qemuxml2argvdata/qemuxml2argv-default-kvm-host-arch.args
new file mode 100644
index 0000000..102691f
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-default-kvm-host-arch.args
@@ -0,0 +1,4 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/kvm -S -machine pc,accel=kvm -m 4096 -smp 4 -nographic \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -net none \
+-serial none -parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-default-kvm-host-arch.xml b/tests/qemuxml2argvdata/qemuxml2argv-default-kvm-host-arch.xml
new file mode 100644
index 0000000..66dead0
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-default-kvm-host-arch.xml
@@ -0,0 +1,11 @@
+<domain type='kvm'>
+ <name>kvm</name>
+ <uuid>d091ea82-29e6-2e34-3005-f02617b36e87</uuid>
+ <memory unit='KiB'>4194304</memory>
+ <currentMemory unit='KiB'>4194304</currentMemory>
+ <vcpu placement='static'>4</vcpu>
+ <os>
+ <type>hvm</type>
+ <boot dev='hd'/>
+ </os>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-default-qemu-host-arch.args b/tests/qemuxml2argvdata/qemuxml2argv-default-qemu-host-arch.args
new file mode 100644
index 0000000..5bd404c
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-default-qemu-host-arch.args
@@ -0,0 +1,4 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-x86_64 -S -machine pc-0.11,accel=tcg -m 4096 -smp 4 \
+-nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-usb -net none -serial none -parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-default-qemu-host-arch.xml b/tests/qemuxml2argvdata/qemuxml2argv-default-qemu-host-arch.xml
new file mode 100644
index 0000000..85ddec5
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-default-qemu-host-arch.xml
@@ -0,0 +1,11 @@
+<domain type='qemu'>
+ <name>qemu-host</name>
+ <uuid>d091ea82-29e6-2e34-3005-f02617b36e87</uuid>
+ <memory unit='KiB'>4194304</memory>
+ <currentMemory unit='KiB'>4194304</currentMemory>
+ <vcpu placement='static'>4</vcpu>
+ <os>
+ <type>hvm</type>
+ <boot dev='hd'/>
+ </os>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 97c7fba..d317c9b 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -599,6 +599,8 @@ mymain(void)
DO_TEST_FAILURE("machine-xen-vmport-opt", QEMU_CAPS_MACHINE_OPT,
QEMU_CAPS_MACHINE_VMPORT_OPT);
DO_TEST("kvm", QEMU_CAPS_MACHINE_OPT);
+ DO_TEST("default-kvm-host-arch", QEMU_CAPS_MACHINE_OPT);
+ DO_TEST("default-qemu-host-arch", QEMU_CAPS_MACHINE_OPT);
DO_TEST("boot-cdrom", NONE);
DO_TEST("boot-network", NONE);
DO_TEST("boot-floppy", NONE);
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-default-kvm-host-arch.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-default-kvm-host-arch.xml
new file mode 100644
index 0000000..30fa66d
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-default-kvm-host-arch.xml
@@ -0,0 +1,21 @@
+<domain type='kvm'>
+ <name>kvm</name>
+ <uuid>d091ea82-29e6-2e34-3005-f02617b36e87</uuid>
+ <memory unit='KiB'>4194304</memory>
+ <currentMemory unit='KiB'>4194304</currentMemory>
+ <vcpu placement='static'>4</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/kvm</emulator>
+ <controller type='usb' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-default-qemu-host-arch.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-default-qemu-host-arch.xml
new file mode 100644
index 0000000..3e65b97
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-default-qemu-host-arch.xml
@@ -0,0 +1,21 @@
+<domain type='qemu'>
+ <name>qemu-host</name>
+ <uuid>d091ea82-29e6-2e34-3005-f02617b36e87</uuid>
+ <memory unit='KiB'>4194304</memory>
+ <currentMemory unit='KiB'>4194304</currentMemory>
+ <vcpu placement='static'>4</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc-0.11'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <controller type='usb' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index b611afd..99f402c 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -346,6 +346,8 @@ mymain(void)
DO_TEST("minimal");
DO_TEST("machine-core-on");
DO_TEST("machine-core-off");
+ DO_TEST_DIFFERENT("default-kvm-host-arch");
+ DO_TEST_DIFFERENT("default-qemu-host-arch");
DO_TEST("boot-cdrom");
DO_TEST("boot-network");
DO_TEST("boot-floppy");
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 14743be..d067bca 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -354,6 +354,18 @@ virCapsPtr testQemuCapsInit(void)
NULL) == NULL)
goto cleanup;
+ if ((machines = testQemuAllocMachines(&nmachines)) == NULL)
+ goto cleanup;
+
+ if (virCapabilitiesAddGuestDomain(guest,
+ VIR_DOMAIN_VIRT_KVM,
+ "/usr/bin/qemu-kvm",
+ NULL,
+ nmachines,
+ machines) == NULL)
+ goto cleanup;
+ machines = NULL;
+
if ((machines = testQemuAllocNewerMachines(&nmachines)) == NULL)
goto cleanup;
--
2.4.0
9 years, 7 months
Re: [libvirt] vmfork in KVM
by Zhi Yong Wu
HI, all guys
Why does vmfork not get supported by KVM project? What is the
drawback? It's very cool if it's used in some scenario, e.g. HPC. It
will be appreciated for your comments, thanks.
On Fri, Oct 24, 2014 at 2:25 AM, Hu Yaohui <loki2441(a)gmail.com> wrote:
> Hi all,
> There are some vmfork features provided by Xen based on shadow page
> table few years ago. I am wondering whether KVM provides the similar
> feature on the same host.
> By triggering vmfork, we can get a child VM which CPU and I/O status
> is the same as the parent, and the memory is CoW shared with parent
> VM.
>
> Thanks,
> Yaohui
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo(a)vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Regards,
Zhi Yong Wu
9 years, 7 months
[libvirt] [PATCH 0/8] virsh: kill blockJobImpl
by Peter Krempa
Move the code to appropriate parts to sanitize control flow.
Peter Krempa (8):
virsh: blockjob: Extract block job info code into a separate function
virsh: cmdBlockJob: Switch to declarative flag interlocking
virsh: blockjob: Split out vshBlockJobSetSpeed from blockJobImpl
virsh: man: Add missing dashes for blockjob --bandwidth
virsh: block job: Support --bytes and scaled integers when setting
speed
virsh: block job: separate abort from blockJobImpl
virsh: Split out block pull implementation from blockJobImpl
virsh: Kill blockJobImpl by moving the final impl into cmdBlockCommit
tools/virsh-domain.c | 314 +++++++++++++++++++++++++++++----------------------
tools/virsh.pod | 14 ++-
2 files changed, 189 insertions(+), 139 deletions(-)
--
2.3.5
9 years, 7 months