[libvirt] [PATCH v2] qemu: enable user-defined cache bypassing while invoking
by fuweiwei
in the previous version, I mentioned the scenario of long-term pause while
writing external memory checkpoints:
v1: https://www.redhat.com/archives/libvir-list/2016-August/msg01194.html
Daniel suggested not to hardcode the flag, but wire this upto the API. When
the user invokes the snapshot they can request the
VIR_DOMAIN_SAVE_BYPASS_CACHE flag explicitly. So in this version I
introduce the --bypass-cache option in libvirt snapshot API. When invoking
an external VM snapshots, we may use the command like this:
virsh snapshot-create-as VM snap --memspec /path/to/memsnap --live
--bypass-cache
The VM snapshot can be done with inapparent VM suspend now. Without
"--bypass-cache" flag, one may experience long-term VM suspend (so that the
implication of "--live" option is not significant), provided that the VM
has a large amount of dirty pages to save.
Signed-off-by: fuweiwei <fuweiwei2(a)huawei.com>
---
include/libvirt/libvirt-domain-snapshot.h | 3 +++
src/qemu/qemu_driver.c | 20 ++++++++++++++++++--
tools/virsh-snapshot.c | 12 ++++++++++++
3 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/include/libvirt/libvirt-domain-snapshot.h b/include/libvirt/libvirt-domain-snapshot.h
index 0f73f24..aeff665 100644
--- a/include/libvirt/libvirt-domain-snapshot.h
+++ b/include/libvirt/libvirt-domain-snapshot.h
@@ -70,6 +70,9 @@ typedef enum {
VIR_DOMAIN_SNAPSHOT_CREATE_LIVE = (1 << 8), /* create the snapshot
while the guest is
running */
+ VIR_DOMAIN_SNAPSHOT_CREATE_BYPASS_CACHE = (1 << 9), i/* Bypass cache
+ while writing external
+ checkpoint files. */
} virDomainSnapshotCreateFlags;
/* Take a snapshot of the current VM state */
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 2089359..d5f441f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14036,6 +14036,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn,
bool pmsuspended = false;
virQEMUDriverConfigPtr cfg = NULL;
int compressed = QEMU_SAVE_FORMAT_RAW;
+ unsigned int save_memory_flag = 0;
/* If quiesce was requested, then issue a freeze command, and a
* counterpart thaw command when it is actually sent to agent.
@@ -14116,8 +14117,12 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn,
if (!(xml = qemuDomainDefFormatLive(driver, vm->def, true, true)))
goto cleanup;
+ if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_BYPASS_CACHE)
+ save_memory_flag |= VIR_DOMAIN_SAVE_BYPASS_CACHE;
+
if ((ret = qemuDomainSaveMemory(driver, vm, snap->def->file,
- xml, compressed, resume, 0,
+ xml, compressed, resume,
+ save_memory_flag,
QEMU_ASYNC_JOB_SNAPSHOT)) < 0)
goto cleanup;
@@ -14224,7 +14229,8 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT |
VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE |
VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC |
- VIR_DOMAIN_SNAPSHOT_CREATE_LIVE, NULL);
+ VIR_DOMAIN_SNAPSHOT_CREATE_LIVE |
+ VIR_DOMAIN_SNAPSHOT_CREATE_BYPASS_CACHE, NULL);
VIR_REQUIRE_FLAG_RET(VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE,
VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY,
@@ -14297,6 +14303,16 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
goto cleanup;
}
+ /* the option of bypass cache is only supported for external checkpoints */
+ if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_BYPASS_CACHE &&
+ (def->memory != VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL ||
+ redefine)) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("only external memory snapshots support "
+ "cache bypass."));
+ goto cleanup;
+ }
+
/* allow snapshots only in certain states */
switch ((virDomainState) vm->state.state) {
/* valid states */
diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index f879e7a..0627baf 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -160,6 +160,10 @@ static const vshCmdOptDef opts_snapshot_create[] = {
.type = VSH_OT_BOOL,
.help = N_("require atomic operation")
},
+ {.name = "bypass-cache",
+ .type = VSH_OT_BOOL,
+ .help = N_("bypass system cache while writing external checkpoints")
+ },
VIRSH_COMMON_OPT_LIVE(N_("take a live snapshot")),
{.name = NULL}
};
@@ -191,6 +195,8 @@ cmdSnapshotCreate(vshControl *ctl, const vshCmd *cmd)
flags |= VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC;
if (vshCommandOptBool(cmd, "live"))
flags |= VIR_DOMAIN_SNAPSHOT_CREATE_LIVE;
+ if (vshCommandOptBool(cmd, "bypass-cache"))
+ flags |= VIR_DOMAIN_SNAPSHOT_CREATE_BYPASS_CACHE;
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
goto cleanup;
@@ -358,6 +364,10 @@ static const vshCmdOptDef opts_snapshot_create_as[] = {
.type = VSH_OT_BOOL,
.help = N_("require atomic operation")
},
+ {.name = "bypass-cache",
+ .type = VSH_OT_BOOL,
+ .help = N_("bypass system cache while writing external checkpoints")
+ },
VIRSH_COMMON_OPT_LIVE(N_("take a live snapshot")),
{.name = "memspec",
.type = VSH_OT_STRING,
@@ -404,6 +414,8 @@ cmdSnapshotCreateAs(vshControl *ctl, const vshCmd *cmd)
flags |= VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC;
if (vshCommandOptBool(cmd, "live"))
flags |= VIR_DOMAIN_SNAPSHOT_CREATE_LIVE;
+ if (vshCommandOptBool(cmd, "bypass-cache"))
+ flags |= VIR_DOMAIN_SNAPSHOT_CREATE_BYPASS_CACHE;
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
return false;
--
1.9.5.msysgit.1
8 years, 3 months
[libvirt] [PATCH 0/9] Couple of migration fixes
by Michal Privoznik
Looks like nobody tried migrations lately. I just did and found
interesting bug. On the destination qemu binary was at different
path. So I've dumped domain XML I was trying ti migrate and just
changed the emulator path. All of a sudden I observed plenty of
errors. Problem is that whilst parsing the user provided
migration XML (and doing other operations on it), because of
parse callbacks we need qemuCaps for the binary. However, we just
take the def->emulator and expect it to exist. Well, it doesn't.
Michal Privoznik (9):
conf: Introduce virDomainDefPostParseOpaque
conf: Introduce virDomainDefParseStringOpaque
qemuDomainDefPostParse: Fetch qemuCaps from domain object
conf: Extend virDomainDeviceDefPostParse for parseOpaque
qemuDomainDeviceDefPostParse: Fetch caps from domain object
conf: Extend virDomainDefAssignAddressesCallback for parseOpaque
qemuDomainDefAssignAddresses: Fetch caps from domain object
domain_conf: Introduce VIR_DOMAIN_DEF_PARSE_SKIP_POST_PARSE
conf: Skip post parse callbacks when creating copy
src/bhyve/bhyve_domain.c | 6 ++--
src/conf/domain_conf.c | 80 +++++++++++++++++++++++++++++++++++++---------
src/conf/domain_conf.h | 43 +++++++++++++++++++++----
src/libvirt_private.syms | 3 ++
src/libxl/libxl_domain.c | 6 ++--
src/lxc/lxc_domain.c | 6 ++--
src/openvz/openvz_driver.c | 6 ++--
src/phyp/phyp_driver.c | 6 ++--
src/qemu/qemu_domain.c | 50 ++++++++++++++++++++++-------
src/qemu/qemu_migration.c | 6 ++--
src/uml/uml_driver.c | 6 ++--
src/vbox/vbox_common.c | 6 ++--
src/vmware/vmware_driver.c | 6 ++--
src/vmx/vmx.c | 6 ++--
src/vz/vz_driver.c | 6 ++--
src/xen/xen_driver.c | 6 ++--
src/xenapi/xenapi_driver.c | 6 ++--
17 files changed, 195 insertions(+), 59 deletions(-)
--
2.8.4
8 years, 3 months
[libvirt] [PATCH v2 00/45] Enhance guest CPU configuration code
by Jiri Denemark
Version 2:
- review comments addressed; see individual patches for details
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 usable='no'>Broadwell</model>
<model usable='yes'>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).
Jiri Denemark (45):
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
testutilsqemu: Add default CPU for PPC64 architectures
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 virCPUDefStealModel
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: Rename cpuHasFeature to virCPUDataCheckFeature
cpu: Rework virCPUDataCheckFeature
cpu: Introduce virCPUCheckFeature
cpu: Document missing parameters for cpuCompare*
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 | 21 +
src/conf/domain_capabilities.c | 198 +++++++++
src/conf/domain_capabilities.h | 47 +++
src/cpu/cpu.c | 264 +++++++++---
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/libxl/libxl_driver.c | 14 +-
src/qemu/qemu_capabilities.c | 394 +++++++++++++-----
src/qemu/qemu_capabilities.h | 24 +-
src/qemu/qemu_capspriv.h | 13 +-
src/qemu/qemu_command.c | 216 +++-------
src/qemu/qemu_domain.c | 37 +-
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 | 128 ++++--
tests/testutilsqemu.h | 11 +-
tools/virsh-host.c | 10 +-
80 files changed, 2473 insertions(+), 1137 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.10.0
8 years, 3 months
[libvirt] [libvirt-php][PATCH 0/2] Couple of example fixes
by Michal Privoznik
Pushed under "I'm the PHP master" rule.
Michal Privoznik (2):
examples: Sort domains
examples: Die early if getting a screenshot fails
examples/index.php | 2 +-
examples/libvirt.php | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
--
2.8.4
8 years, 3 months
[libvirt] [PATCH] qemu: fix libvirtd crash in migration after vm shutdown
by weifuqiang
[PATCH] qemu: fix libvirtd crash in migration after vm shutdown
If we shutdown a guest, then migrate it without the arg XML, libvirtd will get crashed.
The reason is that:
1 during shutdown callback, qemuProcessStop() , it points vm->def to vm->newDef
2 during migration, it frees persistentDef, which points to vm->newDef when the arg XML is NULL.
However, because vm->newDef is now vm->def, what we IN FACT freed is vm->def.
3 it will refer to vm->def after step2, thus invalid read/write causes libvirtd crash
We needn't to free persistentDef if persist_xml is NULL, because no extra def was alloced if persistent_xml is NULL.
---
src/qemu/qemu_migration.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 6a683f7..3636c93 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -4915,7 +4915,7 @@ qemuMigrationRun(virQEMUDriverPtr driver,
VIR_WARN("Unable to encode migration cookie");
}
- if (persistDef != vm->newDef)
+ if (persist_xml && persistDef)
virDomainDefFree(persistDef);
qemuMigrationCookieFree(mig);
--
1.9.5.msysgit.1
8 years, 3 months
[libvirt] [PATCH 0/7] IVSHMEM round two, this time with cookies
by Martin Kletzander
Actually just migration cookie flag. Also this version dropped the
role and model to make everything more sunshine-n-unicorns.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1347049
Martin Kletzander (7):
conf: Fix virDomainShmemDefFind
qemu: Add capabilities for ivshmem-{plain,doorbell}
qemu: Save various defaults for shmem
qemu: Add qemuDomainSupportsNonLegacyShmem
qemu: Disable migration with legacy ivshmem
qemu: Support newer ivshmem device variants
qemu: Add support for hot/cold-(un)plug of shmem devices
docs/formatdomain.html.in | 6 +-
src/conf/domain_conf.c | 4 +-
src/qemu/qemu_capabilities.c | 4 +
src/qemu/qemu_capabilities.h | 2 +
src/qemu/qemu_command.c | 109 +++++++++-
src/qemu/qemu_command.h | 10 +
src/qemu/qemu_domain.c | 24 +++
src/qemu/qemu_domain.h | 3 +
src/qemu/qemu_driver.c | 39 +++-
src/qemu/qemu_hotplug.c | 231 ++++++++++++++++++++-
src/qemu/qemu_hotplug.h | 6 +
src/qemu/qemu_migration.c | 27 ++-
.../caps_2.6.0-gicv2.aarch64.xml | 2 +
.../caps_2.6.0-gicv3.aarch64.xml | 2 +
tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml | 2 +
tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml | 2 +
tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml | 2 +
tests/qemuhotplugtest.c | 21 ++
.../qemuhotplug-ivshmem-doorbell-detach.xml | 6 +
.../qemuhotplug-ivshmem-doorbell.xml | 3 +
.../qemuhotplug-ivshmem-plain-detach.xml | 5 +
.../qemuhotplug-ivshmem-plain.xml | 1 +
...muhotplug-base-live+ivshmem-doorbell-detach.xml | 1 +
.../qemuhotplug-base-live+ivshmem-doorbell.xml | 63 ++++++
.../qemuhotplug-base-live+ivshmem-plain-detach.xml | 1 +
.../qemuhotplug-base-live+ivshmem-plain.xml | 57 +++++
.../qemuxml2argv-shmem-plain-doorbell.args | 46 ++++
.../qemuxml2argv-shmem-plain-doorbell.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-shmem.args | 18 +-
tests/qemuxml2argvtest.c | 3 +
tests/qemuxml2xmloutdata/qemuxml2xmlout-shmem.xml | 10 +-
31 files changed, 685 insertions(+), 26 deletions(-)
create mode 100644 tests/qemuhotplugtestdevices/qemuhotplug-ivshmem-doorbell-detach.xml
create mode 100644 tests/qemuhotplugtestdevices/qemuhotplug-ivshmem-doorbell.xml
create mode 100644 tests/qemuhotplugtestdevices/qemuhotplug-ivshmem-plain-detach.xml
create mode 100644 tests/qemuhotplugtestdevices/qemuhotplug-ivshmem-plain.xml
create mode 120000 tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-doorbell-detach.xml
create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-doorbell.xml
create mode 120000 tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-plain-detach.xml
create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-plain.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-shmem-plain-doorbell.args
create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-shmem-plain-doorbell.xml
--
2.10.0
8 years, 3 months
[libvirt] [PATCH 0/7] Fix some typos.
by Nitesh Konkar
*** BLURB HERE ***
Nitesh Konkar (7):
domain_conf.c:fix a typo
domain_conf.h:fix a typo
domain_conf.c:fix a typo
storage_conf.c:fix a typo
interface_backend_udev.c:fix a typo
esx_driver.c:fix a typo
esx_driver.c:fix a typo
src/conf/domain_conf.c | 4 ++--
src/conf/domain_conf.h | 2 +-
src/conf/storage_conf.c | 2 +-
src/esx/esx_driver.c | 4 ++--
src/interface/interface_backend_udev.c | 2 +-
5 files changed, 7 insertions(+), 7 deletions(-)
--
2.1.0
8 years, 3 months
[libvirt] [PATCH 0/4] fix some libvirtd cleanup leaks and crashes
by Nikolay Shirokovskiy
Crash situation of last 2 patches can easily simulated, just
patch libvirt:
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 30a2830..f6b71d6 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4515,6 +4515,8 @@ processMonitorEOFEvent(virQEMUDriverPtr driver,
unsigned int stopFlags = 0;
virObjectEventPtr event = NULL;
+ sleep(3);
+
if (qemuProcessBeginStopJob(driver, vm, QEMU_JOB_DESTROY, true) < 0)
return;
then when it is up and running and there is also a qemu domain running:
kill -9 $QEMU_DOMAIN && kill libvirtd
If first 2 patches are not applied yet then make sure there is no admin
server clients present.
Nikolay Shirokovskiy (4):
daemon: break cyclic deps between admin clients and daemon
daemon: call free callbacks synchronously in event loop impl
daemon: keep daemon until all hypervisors drivers are cleaned up
qemu: first wait all workers finish on state cleanup
daemon/libvirtd.c | 7 ++++-
src/qemu/qemu_driver.c | 2 +-
src/rpc/virnetdaemon.c | 1 +
src/rpc/virnetsocket.c | 70 ++++++++++++++++++++++---------------------------
src/util/vireventpoll.c | 24 +++++++----------
5 files changed, 50 insertions(+), 54 deletions(-)
--
1.8.3.1
8 years, 3 months
Re: [libvirt] [RFC v2] libvirt vGPU QEMU integration
by Tian, Kevin
> From: Tian, Kevin
> Sent: Thursday, September 22, 2016 10:33 AM
>
> >
> > > Another example is class-specific attributes such
> > > as 'resolution', etc. which you listed under 'display class'. All those
> > > attributes should be moved to mdev directory. Only class ID is
> > > required under each type.
> >
> > Can you elaborate on what you're proposing here? If we don't have
> > attributes like 'resolution' under the type-id then we can't describe
> > to the user the features of the mdev before we create it. I don't
> > think anybody wants a 'create it and find out' type of interface.
> > Thanks,
> >
>
> I think such way would be racy. What about two clients creating mdev
> devices simultaneously? How to guarantee their configuration of class
> specific attributes not mutual-impacted since before creation any such
> configuration would be global under that type?
>
> My feeling is that we'd better keep create simple - just write a UUID
> to "type-id/create". Any class-specific attribute, if we really want to
> support, should be able to be individually configured with required
> resource allocated incrementally on top of basic resources allocated
> at create stage. Then libvirt can set those attributes between create
> and open a mdev device. If this direction is accepted, then naturally
> such attributes should be put under mdev directory. Possibly we
> don't need a class description under type-id. libvirt just checks directly
> whether any known class represented in each mdev directory (vendor
> driver will expose it on demand), and then operate attributes under
> that class.
>
Have a better understanding of your concern now. User needs to know
and set a list of attributes before requesting to create a new mdev
device. From this angle all attributes should be enumerated per type-id.
But as I explained above, writing multiple sysfs nodes to create a
mdev device is racy. We either need a way to guarantee transactional
operations on those nodes, or having type-id directory to only expose
supported attributes while programming those attributes has to be
through per-mdev directory after mdev device is created...
Thanks
Kevin
8 years, 3 months
[libvirt] [PATCHv2] qemu: agent: Fix QEMU guest agent is not available due to an error
by Xiubo Li
These days, we experienced one qemu guest agent is not available
error. Then the guest agent couldn't be used forever before rebooting
the libvirtd daemon or reboot the qemu-guest-agent in the VM(you can
also reboot the VM) to clear the priv->agentError.
This is one bug for a long time in many verisons of libvirtd:
https://bugzilla.redhat.com/show_bug.cgi?id=1090551
And there is one python script to reproduce this bug from the bugzilla:
https://github.com/aspirer/study/blob/master/qemu-guest-agent/test2.py
Just set the timeout to 0 at Line26, you can reproduce it very quickly:
rsp = libvirt_qemu.qemuAgentCommand(dom, cmd, 1, 0) // 1 -> 0
The reason why this could happen is that:
In case we received something like {"return": {}} for example, it is
likely that somebody:
1) Started GA thread which sent one "guest-ping" command with seconds
equals to VIR_DOMAIN_QEMU_AGENT_COMMAND_NOWAIT(0) makes this function
return immediately without waiting, but after updating the events, it
will sleep in virCondWait() or virCondWaitUntil().
2) While in AgentIO thread the "guest-ping" command is sent successfully,
with updating the events it will wait for reply.
3) Then the GA thread is woken up and the mon->msg is set to NULL and exit.
4) At last the AgentIO thread receives the reply of "guest-ping" command
with the mon->msg == NULL.
This case could be adapt to all the GA commands, including guest-sync, etc.
This patch will check if this is the case and don't report an error but
return silently.
Signed-off-by: Xiubo Li <lixiubo(a)cmss.chinamobile.com>
Signed-off-by: Zhuoyu Zhang <zhangzhuoyu(a)cmss.chinamobile.com>
Signed-off-by: Wei Tang <tangwei(a)cmss.chinamobile.com>
Signed-off-by: Yaowei Bai <baiyaowei(a)cmss.chinamobile.com>
Signed-off-by: Qide Chen <chenqide(a)cmss.chinamobile.com>
---
Changes in V2:
- check value type instead of object type.
src/qemu/qemu_agent.c | 37 ++++++++++++++++++++++++++++---------
src/util/virjson.h | 7 +++++++
2 files changed, 35 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index eeede6b..f5408cc 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -308,7 +308,6 @@ qemuAgentIOProcessLine(qemuAgentPtr mon,
{
virJSONValuePtr obj = NULL;
int ret = -1;
- unsigned long long id;
VIR_DEBUG("Line [%s]", line);
@@ -333,16 +332,36 @@ qemuAgentIOProcessLine(qemuAgentPtr mon,
obj = NULL;
ret = 0;
} else {
- /* If we've received something like:
- * {"return": 1234}
- * it is likely that somebody started GA
- * which is now processing our previous
- * guest-sync commands. Check if this is
- * the case and don't report an error but
+ virJSONValuePtr val;
+
+ /* In case we received something like:
+ * {"return": {}} for example,
+ * it is likely that somebody:
+ *
+ * 1) Started GA thread which sent one "guest-ping" command
+ * with seconds equals to VIR_DOMAIN_QEMU_AGENT_COMMAND_NOWAIT(0)
+ * makes this function return immediately without waiting, but
+ * after updating the events, it will sleep in virCondWait() or
+ * virCondWaitUntil().
+ *
+ * 2) While in AgentIO thread the "guest-ping" command is sent
+ * successfully, with updating the events it will wait for reply.
+ *
+ * 3) Then the GA thread is woken up and the mon->msg is set
+ * to NULL and exit.
+ *
+ * 4) At last the AgentIO thread receives the reply of "guest-ping"
+ * command with the mon->msg == NULL.
+ *
+ * This case could be adapt to all the GA commands, including
+ * guest-sync, etc.
+ *
+ * Check if this is the case and don't report an error but
* return silently.
*/
- if (virJSONValueObjectGetNumberUlong(obj, "return", &id) == 0) {
- VIR_DEBUG("Ignoring delayed reply to guest-sync: %llu", id);
+ val = virJSONValueObjectGet(obj, "return");
+ if (val && virJSONValueTypeIsValid(val)) {
+ VIR_DEBUG("Ignoring delayed command reply");
ret = 0;
goto cleanup;
}
diff --git a/src/util/virjson.h b/src/util/virjson.h
index 66ed48a..cb1d973 100644
--- a/src/util/virjson.h
+++ b/src/util/virjson.h
@@ -80,6 +80,13 @@ struct _virJSONValue {
} data;
};
+static inline bool
+virJSONValueTypeIsValid(virJSONValuePtr value)
+{
+ return ((value->type >= VIR_JSON_TYPE_OBJECT) &&
+ (value->type <= VIR_JSON_TYPE_BOOLEAN));
+}
+
void virJSONValueFree(virJSONValuePtr value);
int virJSONValueObjectCreate(virJSONValuePtr *obj, ...)
--
1.8.3.1
8 years, 3 months