mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 14:57:42 +00:00
qemuValidateDomainDeviceDefDiskTransient: Validate that qemu doesn't terminate early
Setup of a disk with <transient shareBacking='yes'/> option issues a reset of qemu. In cases when QEMU didn't yet support the 'set-action' QMP libvirt would in certain cases setup the commandline without '-no-shutdown' which caused qemu to exit during startup. Forbid this specific scenario. Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
a2e6039cca
commit
131fddd429
@ -24,6 +24,7 @@
|
||||
#include "qemu_block.h"
|
||||
#include "qemu_command.h"
|
||||
#include "qemu_domain.h"
|
||||
#include "qemu_process.h"
|
||||
#include "domain_conf.h"
|
||||
#include "virlog.h"
|
||||
#include "virutil.h"
|
||||
@ -2991,6 +2992,7 @@ qemuValidateDomainDeviceDefDiskBlkdeviotune(const virDomainDiskDef *disk,
|
||||
|
||||
static int
|
||||
qemuValidateDomainDeviceDefDiskTransient(const virDomainDiskDef *disk,
|
||||
const virDomainDef *def,
|
||||
virQEMUCaps *qemuCaps)
|
||||
|
||||
{
|
||||
@ -3033,6 +3035,13 @@ qemuValidateDomainDeviceDefDiskTransient(const virDomainDiskDef *disk,
|
||||
}
|
||||
|
||||
if (disk->transientShareBacking == VIR_TRISTATE_BOOL_YES) {
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SET_ACTION) &&
|
||||
!qemuProcessRebootAllowed(def)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("transient disk backing image sharing with destroy action of lifecycle isn't supported by this QEMU binary"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* sharing the backing file requires hotplug of the disk in the qemu driver */
|
||||
switch (disk->bus) {
|
||||
case VIR_DOMAIN_DISK_BUS_USB:
|
||||
@ -3077,7 +3086,7 @@ qemuValidateDomainDeviceDefDisk(const virDomainDiskDef *disk,
|
||||
if (qemuValidateDomainDeviceDefDiskBlkdeviotune(disk, def) < 0)
|
||||
return -1;
|
||||
|
||||
if (qemuValidateDomainDeviceDefDiskTransient(disk, qemuCaps) < 0)
|
||||
if (qemuValidateDomainDeviceDefDiskTransient(disk, def, qemuCaps) < 0)
|
||||
return -1;
|
||||
|
||||
if (disk->src->shared && !disk->src->readonly &&
|
||||
|
Loading…
Reference in New Issue
Block a user