[libvirt] [PATCH 1/2] libxl: add support for PVH
by Marek Marczykowski-Górecki
Since this is something between PV and HVM, it makes sense to put the
setting in place where domain type is specified.
To enable it, use <os><type machine="xenpvh">...</type></os>. It is
also included in capabilities.xml, for every supported HVM guest type - it
doesn't seems to be any other requirement (besides new enough Xen).
Signed-off-by: Marek Marczykowski-Górecki <marmarek(a)invisiblethingslab.com>
---
src/libxl/libxl_capabilities.c | 40 +++++++++++++++++++++++++++++++---------
src/libxl/libxl_conf.c | 2 ++
src/libxl/libxl_driver.c | 6 ++++--
3 files changed, 37 insertions(+), 11 deletions(-)
diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c
index 0145116..c443353 100644
--- a/src/libxl/libxl_capabilities.c
+++ b/src/libxl/libxl_capabilities.c
@@ -45,11 +45,16 @@ VIR_LOG_INIT("libxl.libxl_capabilities");
/* see xen-unstable.hg/xen/include/asm-x86/cpufeature.h */
#define LIBXL_X86_FEATURE_PAE_MASK 0x40
+enum machine_type {
+ machine_hvm,
+ machine_pvh,
+ machine_pv,
+};
struct guest_arch {
virArch arch;
int bits;
- int hvm;
+ enum machine_type machine;
int pae;
int nonpae;
int ia64_be;
@@ -296,7 +301,7 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps)
/* Search for existing matching (model,hvm) tuple */
for (i = 0; i < nr_guest_archs; i++) {
if ((guest_archs[i].arch == arch) &&
- guest_archs[i].hvm == hvm)
+ guest_archs[i].machine == (hvm ? machine_hvm : machine_pv))
break;
}
@@ -308,7 +313,7 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps)
nr_guest_archs++;
guest_archs[i].arch = arch;
- guest_archs[i].hvm = hvm;
+ guest_archs[i].machine = hvm ? machine_hvm : machine_pv;
/* Careful not to overwrite a previous positive
setting with a negative one here - some archs
@@ -320,23 +325,40 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps)
guest_archs[i].nonpae = nonpae;
if (ia64_be)
guest_archs[i].ia64_be = ia64_be;
+
+ /* On Xen >= 4.4 add PVH for each HVM guest, and do it only once */
+ if ((ver_info->xen_version_major > 4 ||
+ (ver_info->xen_version_major == 4 &&
+ ver_info->xen_version_minor >= 4)) &&
+ hvm && i == nr_guest_archs-1) {
+ i = nr_guest_archs;
+ /* Too many arch flavours - highly unlikely ! */
+ if (i >= ARRAY_CARDINALITY(guest_archs))
+ continue;
+ nr_guest_archs++;
+ guest_archs[i].arch = arch;
+ guest_archs[i].machine = machine_pvh;
+ }
}
}
regfree(®ex);
for (i = 0; i < nr_guest_archs; ++i) {
virCapsGuestPtr guest;
- char const *const xen_machines[] = {guest_archs[i].hvm ? "xenfv" : "xenpv"};
+ char const *const xen_machines[] = {
+ guest_archs[i].machine == machine_hvm ? "xenfv" :
+ (guest_archs[i].machine == machine_pvh ? "xenpvh" : "xenpv")};
virCapsGuestMachinePtr *machines;
if ((machines = virCapabilitiesAllocMachines(xen_machines, 1)) == NULL)
return -1;
if ((guest = virCapabilitiesAddGuest(caps,
- guest_archs[i].hvm ? VIR_DOMAIN_OSTYPE_HVM : VIR_DOMAIN_OSTYPE_XEN,
+ guest_archs[i].machine == machine_hvm ?
+ VIR_DOMAIN_OSTYPE_HVM : VIR_DOMAIN_OSTYPE_XEN,
guest_archs[i].arch,
LIBXL_EXECBIN_DIR "/qemu-system-i386",
- (guest_archs[i].hvm ?
+ (guest_archs[i].machine == machine_hvm ?
LIBXL_FIRMWARE_DIR "/hvmloader" :
NULL),
1,
@@ -375,7 +397,7 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps)
0) == NULL)
return -1;
- if (guest_archs[i].hvm) {
+ if (guest_archs[i].machine != machine_pv) {
if (virCapabilitiesAddGuestFeature(guest,
"acpi",
1,
@@ -390,7 +412,7 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps)
if (virCapabilitiesAddGuestFeature(guest,
"hap",
1,
- 1) == NULL)
+ guest_archs[i].machine == machine_hvm) == NULL)
return -1;
}
}
@@ -409,7 +431,7 @@ libxlMakeDomainOSCaps(const char *machine,
os->supported = true;
- if (STREQ(machine, "xenpv"))
+ if (STREQ(machine, "xenpv") || STREQ(machine, "xenpvh"))
return 0;
capsLoader->supported = true;
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 5202ca1..aa06586 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -173,6 +173,8 @@ libxlMakeDomCreateInfo(libxl_ctx *ctx,
}
} else {
c_info->type = LIBXL_DOMAIN_TYPE_PV;
+ if (STREQ(def->os.machine, "xenpvh"))
+ libxl_defbool_set(&c_info->pvh, true);
}
if (VIR_STRDUP(c_info->name, def->name) < 0)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 4957072..fa58346 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -6321,9 +6321,11 @@ libxlConnectGetDomainCapabilities(virConnectPtr conn,
emulatorbin = "/usr/bin/qemu-system-x86_64";
if (machine) {
- if (STRNEQ(machine, "xenpv") && STRNEQ(machine, "xenfv")) {
+ if (STRNEQ(machine, "xenpv") &&
+ STRNEQ(machine, "xenpvh") &&
+ STRNEQ(machine, "xenfv")) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
- _("Xen only supports 'xenpv' and 'xenfv' machines"));
+ _("Xen only supports 'xenpv', 'xenpvh' and 'xenfv' machines"));
goto cleanup;
}
} else {
--
2.5.5
>From marmarek(a)invisiblethingslab.com Fri Aug 5 20:06:26 2016
From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= <marmarek(a)invisiblethingslab.com>
To: libvir-list(a)redhat.com
Cc: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= <marmarek(a)invisiblethingslab.com>
Subject: [PATCH 2/2] libxl: set shadow memory for any guest type, not only HVM
Date: Fri, 5 Aug 2016 20:05:44 +0200
Message-Id: <1470420344-7693-2-git-send-email-marmarek(a)invisiblethingslab.com>
X-Mailer: git-send-email 2.5.5
In-Reply-To: <1470420344-7693-1-git-send-email-marmarek(a)invisiblethingslab.com>
References: <1470420344-7693-1-git-send-email-marmarek(a)invisiblethingslab.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Organization: Invisible Things Lab
Content-Transfer-Encoding: 8bit
Otherwise starting PVH guest will result in "arch_setup_bootlate:
mapping shared_info failed (pfn=..., rc=-1, errno: 12): Internal error".
After this change the behaviour is the same as in `xl`.
Signed-off-by: Marek Marczykowski-Górecki <marmarek(a)invisiblethingslab.com>
---
src/libxl/libxl_conf.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index aa06586..155934c 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -494,11 +494,6 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
}
}
}
-
- /* Allow libxl to calculate shadow memory requirements */
- b_info->shadow_memkb =
- libxl_get_required_shadow_memory(b_info->max_memkb,
- b_info->max_vcpus);
} else {
/*
* For compatibility with the legacy xen toolstack, default to pygrub
@@ -528,6 +523,11 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
return -1;
}
+ /* Allow libxl to calculate shadow memory requirements */
+ b_info->shadow_memkb =
+ libxl_get_required_shadow_memory(b_info->max_memkb,
+ b_info->max_vcpus);
+
return 0;
}
--
2.5.5
8 years, 2 months
[libvirt] [PATCH 00/41] Enhance guest CPU configuration code
by Jiri Denemark
This patch series does several things:
- fixes tests to avoid relying on bugs in our code
- adds support for advertising supported CPU modes and models in domain
capabilities
- starts adding better and higher level APIs to our cpu driver (the old
low level APIs will be removed once this process is over)
- prepares qemu driver for asking QEMU what a host CPU looks like and
what CPU models can be run on it
- makes QEMU CPU command line builder build command line and nothing
else
The added part of domain capabilities XML looks like this:
<cpu>
<mode name='host-passthrough' supported='yes'/>
<mode name='host-model' supported='yes'>
<model fallback='allow'>Broadwell</model>
<vendor>Intel</vendor>
<feature policy='disable' name='aes'/>
<feature policy='require' name='vmx'/>
</mode>
<mode name='custom' supported='yes'>
<model>Broadwell</model>
<model>Broadwell-noTSX</model>
...
</mode>
</cpu>
and host-passthrough is only advertised as supported for KVM domains,
host-model is only supported when guest architecture is compatible with
host and overall it should just work the way one would expect (in
contrast to the current state of the code).
Big thanks for any comments and review in advance and...
Enjoy my PTO :-)
Jiri Denemark (41):
cpuGetModels: Switch to virArch
domcaps: Add support for listing supported CPU models
qemu: Use virDomainCapsCPUModels for cpuDefinitions
qemuxml2argvtest: Rename extraFlags as qemuCaps
qemuxml2argvtest: Rename "out" labels as "cleanup"
qemuxml2argvtest: Get rid of testCompareXMLToArgvHelper
qemuxml2argvtest: Reorder functions
qemuxml2argvtest: Update qemuCaps after parsing domain XML
qemuxml2argvtest: Properly initialize qemuCaps->arch
testutilsqemu: Helpers for changing host CPU and arch
qemu: Separate guest CPU validation from command line creation
qemuxml2argvtest: Properly setup CPU models in qemuCaps
qemuxml2argvtest: Set correct architecture for KVM guests
qemuxml2argvtest: Reorder CPU features
qemu: Introduce virQEMUCapsGuestIsNative
qemu: Fill in CPU domain capabilities
cpu: Special case models == NULL in cpuGetModels
cpu: Don't overwrite errors in cpuGetModels
domcaps: Show only CPU models supported by libvirt
domcaps: Add CPU usable flag
schema: Separate CPU related definitions into cputypes.rng
qemu: Propagate virCapsPtr to virQEMUCapsNewForBinaryInternal
conf: Introduce virCPUDefCopyWithoutModel
conf: Introduce virCPUDefMoveModel
conf: Introduce virCPUDefCopyModelFilter
qemu: Store host-model CPU in qemu capabilities
cpu: Drop false support for ARM cpu-model
Show host model in domain capabilities
qemu: Introduce virQEMUCapsGetHostModel
qemu: Introduce virQEMUCapsIsCPUModeSupported
cpu: Make x86ModelFromCPU easier to read
cpu: Make x86ModelFromCPU a bit smarter
cpu: Report error for unknown features in x86HasFeature
cpu: Add x86FeatureInData
cpu: Rework cpuUpdate
cpu: Set nfeatures_max correctly in x86Decode
cpu: Introduce virCPUTranslate
cpu: Rework cpuHasFeature
cpu: Rework cpuCompare* APIs
qemu: Update guest CPU def in live XML
Move CMT feature filtering to QEMU driver
docs/formatdomaincaps.html.in | 65 +++
docs/schemas/cputypes.rng | 135 ++++++
docs/schemas/domaincaps.rng | 60 +++
docs/schemas/domaincommon.rng | 129 +-----
po/POTFILES.in | 1 +
src/conf/cpu_conf.c | 64 ++-
src/conf/cpu_conf.h | 19 +
src/conf/domain_capabilities.c | 209 ++++++++++
src/conf/domain_capabilities.h | 47 +++
src/cpu/cpu.c | 247 ++++++++---
src/cpu/cpu.h | 72 +++-
src/cpu/cpu_arm.c | 79 ++--
src/cpu/cpu_ppc64.c | 48 ++-
src/cpu/cpu_s390.c | 1 -
src/cpu/cpu_x86.c | 463 +++++++++++++--------
src/driver-hypervisor.h | 2 +-
src/libvirt-host.c | 3 +-
src/libvirt_private.syms | 20 +-
src/qemu/qemu_capabilities.c | 387 ++++++++++++-----
src/qemu/qemu_capabilities.h | 24 +-
src/qemu/qemu_capspriv.h | 13 +-
src/qemu/qemu_command.c | 216 +++-------
src/qemu/qemu_domain.c | 32 +-
src/qemu/qemu_driver.c | 41 +-
src/qemu/qemu_monitor.c | 12 +-
src/qemu/qemu_monitor.h | 10 +-
src/qemu/qemu_monitor_json.c | 24 +-
src/qemu/qemu_monitor_json.h | 2 +-
src/qemu/qemu_parse_command.c | 2 +-
src/qemu/qemu_process.c | 95 ++++-
src/test/test_driver.c | 12 +-
src/vmware/vmware_conf.c | 6 +-
tests/cputest.c | 24 +-
.../cputestdata/x86-host+host-model-nofallback.xml | 2 +-
tests/cputestdata/x86-host+host-model.xml | 2 +-
.../x86-host+host-passthrough-features.xml | 4 +
tests/cputestdata/x86-host+host-passthrough.xml | 19 +-
tests/cputestdata/x86-host+min.xml | 27 +-
tests/cputestdata/x86-host+pentium3.xml | 39 +-
tests/cputestdata/x86-host-invtsc+host-model.xml | 2 +-
.../cputestdata/x86-host-passthrough-features.xml | 4 +
tests/domaincapsschemadata/basic.xml | 5 +
tests/domaincapsschemadata/full.xml | 12 +
tests/domaincapsschemadata/libxl-xenfv-usb.xml | 5 +
tests/domaincapsschemadata/libxl-xenfv.xml | 5 +
tests/domaincapsschemadata/libxl-xenpv-usb.xml | 5 +
tests/domaincapsschemadata/libxl-xenpv.xml | 5 +
tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml | 32 ++
.../qemu_2.6.0-gicv2-virt.aarch64.xml | 36 ++
.../qemu_2.6.0-gicv3-virt.aarch64.xml | 36 ++
tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml | 36 ++
tests/domaincapsschemadata/qemu_2.6.0.ppc64le.xml | 10 +
tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml | 36 ++
tests/domaincapstest.c | 78 +++-
tests/qemucapabilitiestest.c | 2 +-
tests/qemucapsprobe.c | 2 +-
tests/qemumonitorjsontest.c | 8 +-
.../qemuxml2argvdata/qemuxml2argv-cpu-Haswell2.xml | 2 +-
.../qemuxml2argv-cpu-Haswell3.args | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.xml | 12 +-
.../qemuxml2argv-cpu-exact2-nofallback.args | 3 +-
.../qemuxml2argv-cpu-exact2-nofallback.xml | 14 +-
.../qemuxml2argvdata/qemuxml2argv-cpu-exact2.args | 3 +-
tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.xml | 14 +-
.../qemuxml2argv-cpu-fallback.args | 2 +-
.../qemuxml2argv-cpu-host-model-cmt.args | 2 +-
.../qemuxml2argv-cpu-host-model-fallback.args | 2 +-
.../qemuxml2argv-cpu-minimum2.args | 2 +-
.../qemuxml2argvdata/qemuxml2argv-cpu-minimum2.xml | 6 +-
.../qemuxml2argvdata/qemuxml2argv-cpu-strict1.args | 3 +-
.../qemuxml2argvdata/qemuxml2argv-cpu-strict1.xml | 20 +-
.../qemuxml2argv-graphics-spice-timeout.xml | 24 +-
.../qemuxml2argv-pseries-cpu-exact.args | 2 +-
.../qemuxml2argv-pseries-cpu-exact.xml | 2 +-
tests/qemuxml2argvtest.c | 312 +++++++-------
.../qemuxml2xmlout-graphics-spice-timeout.xml | 24 +-
tests/testutilsqemu.c | 126 ++++--
tests/testutilsqemu.h | 11 +-
tools/virsh-host.c | 10 +-
79 files changed, 2455 insertions(+), 1119 deletions(-)
create mode 100644 docs/schemas/cputypes.rng
create mode 100644 tests/cputestdata/x86-host+host-passthrough-features.xml
create mode 100644 tests/cputestdata/x86-host-passthrough-features.xml
--
2.9.2
8 years, 2 months
[libvirt] [PATCH v1 0/4] libxl: host cpu element in capabilities
by Joao Martins
Hey,
This small series implements host cpu description in caps, by getting
topology and xen hwcaps parsing done, followed by having
cpu-{compare,baseline} APIs implemented. Last thing missing I think it
would be to libxl_cpuid_set the features to enable/disable whichever
format we choose plus the appropriate XML convertion to/from XM and XL
config formats.
Note that since RFC[0] I removed the Get CPU model names API since it
would make more sense having it exported once we do support guest
cpu model/features setting. Changelog included in individual patches
(only second patch got changed)
Cheers,
Joao
[0] http://www.redhat.com/archives/libvir-list/2016-July/msg00245.html
Joao Martins (4):
libxl: describe host topology in capabilities
libxl: describe host cpu features based on hwcaps
libxl: implement virConnectCompareCPU
libxl: implement virConnectBaselineCPU
src/libxl/libxl_capabilities.c | 168 ++++++++++++++++++++++++++++++++++++++---
src/libxl/libxl_driver.c | 60 +++++++++++++++
2 files changed, 218 insertions(+), 10 deletions(-)
--
2.1.4
8 years, 2 months
[libvirt] [PATCH 00/16] Hyper-V: Improve 2008, Introduce 2012
by Jason Miesionczek
The following patches include work originally done by Yves Vinter back
in 2014. The last patch introduces support for Hyper-V 2012, while still
supporting 2008. I am not sure that the method I used to include the 2012
support is the best approach, mainly due to code duplication, but I am
open to suggestions on how to do this better.
Jason Miesionczek (16):
hyperv: additional server 2008 wmi classes
hyperv: add cim types support to code generator
hyperv: add get capabilities
hyperv: implement connectGetVersion
hyperv: implement vcpu functions
hyperv: implement nodeGetFreeMemory
hyperv: implement ability to send xml soap requests
hyperv: introduce basic network driver
hyperv: add domain shutdown function
hyperv: add get scheduler functions
hyperv: add set memory functions
hyperv: set vpcu functions
hyperv: domain undefine functions
hyperv: domain define and associated functions
hyperv: network list functions
hyperv: introduce 2012 support
src/Makefile.am | 2 +
src/hyperv/hyperv_driver.c | 1989 ++++++++++++++++++++++++++++++++-
src/hyperv/hyperv_driver_2012.c | 299 +++++
src/hyperv/hyperv_driver_2012.h | 55 +
src/hyperv/hyperv_network_driver.c | 280 +++++
src/hyperv/hyperv_network_driver.h | 30 +
src/hyperv/hyperv_private.h | 8 +
src/hyperv/hyperv_wmi.c | 709 +++++++++++-
src/hyperv/hyperv_wmi.h | 78 ++
src/hyperv/hyperv_wmi_generator.input | 518 ++++++++-
src/hyperv/hyperv_wmi_generator.py | 68 +-
src/hyperv/openwsman.h | 4 +
12 files changed, 3989 insertions(+), 51 deletions(-)
create mode 100644 src/hyperv/hyperv_driver_2012.c
create mode 100644 src/hyperv/hyperv_driver_2012.h
create mode 100644 src/hyperv/hyperv_network_driver.c
create mode 100644 src/hyperv/hyperv_network_driver.h
--
2.7.4
8 years, 2 months
[libvirt] [PATCH 0/3] docs/Makefile.am cleanups
by Ján Tomko
The effect of 2/3 will be more apparent after apibuild.py speedups
(to be written).
Ján Tomko (3):
docs/Makefile.am: remove redundant variables
docs/Makefile.am: build hvsupport.html earlier
docs: drop todo.html
.gitignore | 1 -
docs/Makefile.am | 44 +++---------------
docs/sitemap.html.in | 4 --
docs/todo.cfg-example | 26 -----------
docs/todo.pl | 125 --------------------------------------------------
5 files changed, 7 insertions(+), 193 deletions(-)
delete mode 100644 docs/todo.cfg-example
delete mode 100755 docs/todo.pl
--
2.7.3
8 years, 2 months
[libvirt] [PATCH] qemu_driver: pass path of compress prog directly
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)gmail.com>
We check compress prog in qemuCompressProgramAvailable,
then check it again in virExec.
This path will pass compress prog's path directly.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)gmail.com>
---
src/qemu/qemu_driver.c | 42 ++++++++++++++++++++++++++----------------
1 file changed, 26 insertions(+), 16 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 97e2ffc..9f4e593 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3037,6 +3037,7 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver,
const char *path,
const char *domXML,
int compressed,
+ const char *compressed_path,
bool was_running,
unsigned int flags,
qemuDomainAsyncJob asyncJob)
@@ -3084,7 +3085,7 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver,
goto cleanup;
/* Perform the migration */
- if (qemuMigrationToFile(driver, vm, fd, qemuCompressProgramName(compressed),
+ if (qemuMigrationToFile(driver, vm, fd, compressed_path,
asyncJob) < 0)
goto cleanup;
@@ -3137,7 +3138,8 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver,
static int
qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom,
virDomainObjPtr vm, const char *path,
- int compressed, const char *xmlin, unsigned int flags)
+ int compressed, const char *compressed_path,
+ const char *xmlin, unsigned int flags)
{
char *xml = NULL;
bool was_running = false;
@@ -3209,7 +3211,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom,
goto endjob;
}
- ret = qemuDomainSaveMemory(driver, vm, path, xml, compressed,
+ ret = qemuDomainSaveMemory(driver, vm, path, xml, compressed, compressed_path,
was_running, flags, QEMU_ASYNC_JOB_SAVE);
if (ret < 0)
goto endjob;
@@ -3250,17 +3252,16 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom,
/* Returns true if a compression program is available in PATH */
static bool
-qemuCompressProgramAvailable(virQEMUSaveFormat compress)
+qemuCompressProgramAvailable(virQEMUSaveFormat compress, char **compressed_path)
{
- char *path;
-
- if (compress == QEMU_SAVE_FORMAT_RAW)
+ if (compress == QEMU_SAVE_FORMAT_RAW) {
+ *compressed_path = NULL;
return true;
+ }
- if (!(path = virFindFileInPath(qemuSaveCompressionTypeToString(compress))))
+ if (!(*compressed_path = virFindFileInPath(qemuSaveCompressionTypeToString(compress))))
return false;
- VIR_FREE(path);
return true;
}
@@ -3270,6 +3271,7 @@ qemuDomainSaveFlags(virDomainPtr dom, const char *path, const char *dxml,
{
virQEMUDriverPtr driver = dom->conn->privateData;
int compressed = QEMU_SAVE_FORMAT_RAW;
+ char *compressed_path = NULL;
int ret = -1;
virDomainObjPtr vm = NULL;
virQEMUDriverConfigPtr cfg = NULL;
@@ -3287,7 +3289,7 @@ qemuDomainSaveFlags(virDomainPtr dom, const char *path, const char *dxml,
"in configuration file"));
goto cleanup;
}
- if (!qemuCompressProgramAvailable(compressed)) {
+ if (!qemuCompressProgramAvailable(compressed, &compressed_path)) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("Compression program for image format "
"in configuration file isn't available"));
@@ -3308,11 +3310,12 @@ qemuDomainSaveFlags(virDomainPtr dom, const char *path, const char *dxml,
}
ret = qemuDomainSaveInternal(driver, dom, vm, path, compressed,
- dxml, flags);
+ compressed_path, dxml, flags);
cleanup:
virDomainObjEndAPI(&vm);
virObjectUnref(cfg);
+ VIR_FREE(compressed_path);
return ret;
}
@@ -3343,6 +3346,7 @@ qemuDomainManagedSave(virDomainPtr dom, unsigned int flags)
virQEMUDriverPtr driver = dom->conn->privateData;
virQEMUDriverConfigPtr cfg = NULL;
int compressed = QEMU_SAVE_FORMAT_RAW;
+ char *compressed_path = NULL;
virDomainObjPtr vm;
char *name = NULL;
int ret = -1;
@@ -3377,7 +3381,7 @@ qemuDomainManagedSave(virDomainPtr dom, unsigned int flags)
"in configuration file"));
goto cleanup;
}
- if (!qemuCompressProgramAvailable(compressed)) {
+ if (!qemuCompressProgramAvailable(compressed, &compressed_path)) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("Compression program for image format "
"in configuration file isn't available"));
@@ -3391,13 +3395,14 @@ qemuDomainManagedSave(virDomainPtr dom, unsigned int flags)
VIR_INFO("Saving state of domain '%s' to '%s'", vm->def->name, name);
ret = qemuDomainSaveInternal(driver, dom, vm, name,
- compressed, NULL, flags);
+ compressed, compressed_path, NULL, flags);
if (ret == 0)
vm->hasManagedSave = true;
cleanup:
virDomainObjEndAPI(&vm);
VIR_FREE(name);
+ VIR_FREE(compressed_path);
virObjectUnref(cfg);
return ret;
@@ -3617,6 +3622,7 @@ static virQEMUSaveFormat
getCompressionType(virQEMUDriverPtr driver)
{
int ret = QEMU_SAVE_FORMAT_RAW;
+ char *compressed_path = NULL;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
/*
@@ -3634,7 +3640,7 @@ getCompressionType(virQEMUDriverPtr driver)
ret = QEMU_SAVE_FORMAT_RAW;
goto cleanup;
}
- if (!qemuCompressProgramAvailable(ret)) {
+ if (!qemuCompressProgramAvailable(ret, &compressed_path)) {
VIR_WARN("%s", _("Compression program for dump image format "
"in configuration file isn't available, "
"using raw"));
@@ -3644,6 +3650,7 @@ getCompressionType(virQEMUDriverPtr driver)
}
cleanup:
virObjectUnref(cfg);
+ VIR_FREE(compressed_path);
return ret;
}
@@ -14308,6 +14315,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn,
bool pmsuspended = false;
virQEMUDriverConfigPtr cfg = NULL;
int compressed = QEMU_SAVE_FORMAT_RAW;
+ char *compressed_path = NULL;
/* If quiesce was requested, then issue a freeze command, and a
* counterpart thaw command when it is actually sent to agent.
@@ -14377,7 +14385,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn,
goto cleanup;
}
- if (!qemuCompressProgramAvailable(compressed)) {
+ if (!qemuCompressProgramAvailable(compressed, &compressed_path)) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("Compression program for image format "
"in configuration file isn't available"));
@@ -14389,7 +14397,8 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn,
goto cleanup;
if ((ret = qemuDomainSaveMemory(driver, vm, snap->def->file,
- xml, compressed, resume, 0,
+ xml, compressed, compressed_path,
+ resume, 0,
QEMU_ASYNC_JOB_SNAPSHOT)) < 0)
goto cleanup;
@@ -14459,6 +14468,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn,
}
VIR_FREE(xml);
+ VIR_FREE(compressed_path);
virObjectUnref(cfg);
if (memory_unlink && ret < 0)
unlink(snap->def->file);
--
1.8.3.1
8 years, 2 months
[libvirt] qemu: migration: shall we abort migration while the guest is rebooting?
by Zhangbo (Oscar)
Hi all:
Here's the steps we produce the problem:
1 reboot guest with the flag of VIR_DOMAIN_REBOOT_ACPI_POWER_BTN
2 sleep 1 second (so that the guest is still rebooting, although the API already returned.)
3 migrate the guest
The problem is that : the guest failed to migrate to the dest, and crashed on source side.
We don't bother to dig further into the problem, the root cause we think is that we migrate a guest while it's rebooting.
So, shall we
1 make the reboot JOB LOCK longer enough until the guest has already rebooted(got monitor message from qemu)?
2 let openstack do the mutex work ? (has openstack already done this?)
(I checked openstack codes, and found that openstack uses shutdown and create APIs rather than REBOOT to do the reboot work. So it seems that openstack doesn't take care of this problem nowadays. Am I right? --- see: nova/virt/libvirt/driver.py: _soft_reboot)
Thanks in advance.
Zhang Bo (Oscar)
8 years, 2 months
[libvirt] [PATCH 0/3] add option to keep nvram file on undefine
by Nikolay Shirokovskiy
There is already a patch [1] on this topic with a different approach - keep
nvram file by default. There is also some discussion there. To sum up keeping
nvram on undefine could be useful in some usecases so there should be an option
to do it. On the other hand there is a danger of leaving domain assets after
its undefine and unsing them unintentionally on defining domain with the same
name.
AFAIU keeping nvram by default was motivated by domain disks behaviour.
I think there is a difference as libvirt never create disks for domain as
opposed to nvram and managed save and without disks domain will not start so
user is quite aware of disks files. On the other hand one can start using nvram
file solely putting <nvram> in config and managed save is created on daemon
shutdown. So user is much less aware of nvram and managed save existence. Thus
one can easily mess up by unaware define $name/using/undefine/define $name again
usecase. Thus I vote for keeping said assets only if it is specified explicitly
so user knows what he is doing.
Adding option to undefine is best solution I come up with. The other options
are add checks on define or start and both are impossible. Such a check should
be done without any extra flags for it to be useful but this way we break
existing users.
As this a proof of concept this series does not add extra flag for managed save.
[1] https://www.redhat.com/archives/libvir-list/2015-February/msg00915.html
Nikolay Shirokovskiy (3):
api: add VIR_DOMAIN_UNDEFINE_KEEP_NVRAM flag
qemu: add VIR_DOMAIN_UNDEFINE_KEEP_NVRAM support
virsh: add --keep-nvram option to undefine command
include/libvirt/libvirt-domain.h | 1 +
src/qemu/qemu_driver.c | 26 +++++++++++++++++---------
tools/virsh-domain.c | 8 ++++++++
tools/virsh.pod | 6 +++---
4 files changed, 29 insertions(+), 12 deletions(-)
--
1.8.3.1
8 years, 2 months
[libvirt] [gconfig v2 0/6] Add support for changing listen address
by Visarion Alexandru
From: Visarion Alexandru <viorel.visarion(a)gmail.com>
libvirt-domain-graphics-listen defines an abstract class used
to represent one listen node.
libvirt-domain-graphics-liste-address defines a class that
represents a listen node of type 'address', for the
graphics device.
We have to first remove the 'listen' attribute of the
graphics device before adding child 'listen' nodes,
to avoid inconsistencies check.
I added a test for the new API which uses a SPICE graphics (I
noticed that generally APIs aren't tested on both SPICE and VNC)
Visarion Alexandru (6):
libvirt-gconfig: Include GIO dependency
Introduce libvirt-domain-graphics-listen
Introduce libvirt-gconfig-domain-graphics-listen-address
config: Add vnc listen getter/setter
config: Add spice listen getter/setter
tests: Add test for GVirConfigDomainGraphicsListenAddress
configure.ac | 2 +
libvirt-gconfig-1.0.pc.in | 2 +-
libvirt-gconfig/Makefile.am | 10 +-
...ibvirt-gconfig-domain-graphics-listen-address.c | 128 +++++++++++++++++++++
...ibvirt-gconfig-domain-graphics-listen-address.h | 78 +++++++++++++
.../libvirt-gconfig-domain-graphics-listen.c | 49 ++++++++
.../libvirt-gconfig-domain-graphics-listen.h | 65 +++++++++++
.../libvirt-gconfig-domain-graphics-spice.c | 84 ++++++++++++++
.../libvirt-gconfig-domain-graphics-spice.h | 4 +
.../libvirt-gconfig-domain-graphics-vnc.c | 84 ++++++++++++++
.../libvirt-gconfig-domain-graphics-vnc.h | 4 +
libvirt-gconfig/libvirt-gconfig.h | 2 +
libvirt-gconfig/libvirt-gconfig.sym | 12 ++
tests/test-gconfig.c | 36 ++++++
.../xml/gconfig-domain-device-graphics-listen.xml | 7 ++
vapi/Makefile.am | 1 +
16 files changed, 565 insertions(+), 3 deletions(-)
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.h
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.c
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.h
create mode 100644 tests/xml/gconfig-domain-device-graphics-listen.xml
--
2.7.4
8 years, 2 months
[libvirt] [PATCH v2 00/10] Introduce NVDIMM support
by Michal Privoznik
This is v2 of:
https://www.redhat.com/archives/libvir-list/2016-August/msg00055.html
diff to v1:
- Rebase to the latest HEAD
- Introduced relabeling for host side of NVDIMM
Michal Privoznik (10):
Introduce NVDIMM memory model
qemu: Introduce QEMU_CAPS_DEVICE_NVDIMM
qemu: Implement NVDIMM
conf: Introduce memAccess to <memory/>
qemu: Implement memAccess for <memory/> banks
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
docs/formatdomain.html.in | 41 ++++++--
docs/schemas/domaincommon.rng | 51 ++++++----
src/conf/domain_conf.c | 112 ++++++++++++++++-----
src/conf/domain_conf.h | 4 +
src/libvirt_private.syms | 4 +
src/qemu/qemu_alias.c | 12 ++-
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 87 +++++++++++-----
src/qemu/qemu_command.h | 2 +
src/qemu/qemu_domain.c | 29 ++++--
src/qemu/qemu_hotplug.c | 17 +++-
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 +++++++
tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml | 1 +
.../qemuxml2argv-hugepages-numa.args | 5 +-
.../qemuxml2argv-hugepages-pages.args | 24 ++---
.../qemuxml2argv-hugepages-pages2.args | 8 +-
.../qemuxml2argv-hugepages-pages3.args | 4 +-
.../qemuxml2argv-hugepages-shared.args | 22 ++--
.../qemuxml2argv-memory-hotplug-dimm-addr.args | 5 +-
.../qemuxml2argv-memory-hotplug-dimm.args | 5 +-
...muxml2argv-memory-hotplug-nvdimm-memAccess.args | 26 +++++
...emuxml2argv-memory-hotplug-nvdimm-memAccess.xml | 49 +++++++++
.../qemuxml2argv-memory-hotplug-nvdimm.args | 25 +++++
.../qemuxml2argv-memory-hotplug-nvdimm.xml | 49 +++++++++
tests/qemuxml2argvtest.c | 6 +-
33 files changed, 743 insertions(+), 123 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm-memAccess.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm-memAccess.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm.xml
--
2.8.4
8 years, 2 months