mirror of https://gitee.com/openkylin/libvirt.git
Turn QEMU capabilities object into a full virObjectPtr
The current qemu capabilities are stored in a virBitmapPtr object, whose type is exposed to callers. We want to store more data besides just the flags, so we need to move to a struct type. This object will also need to be reference counted, since we'll be maintaining a cache of data per binary. This change introduces a 'qemuCapsPtr' virObject class. Most of the change is just renaming types and variables in all the callers Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
f4780c12dc
commit
beac09fd68
|
@ -179,6 +179,28 @@ VIR_ENUM_IMPL(qemuCaps, QEMU_CAPS_LAST,
|
|||
"usb-redir.filter",
|
||||
);
|
||||
|
||||
struct _qemuCaps {
|
||||
virObject object;
|
||||
|
||||
virBitmapPtr flags;
|
||||
};
|
||||
|
||||
|
||||
static virClassPtr qemuCapsClass;
|
||||
static void qemuCapsDispose(void *obj);
|
||||
|
||||
static int qemuCapsOnceInit(void)
|
||||
{
|
||||
if (!(qemuCapsClass = virClassNew("qemuCaps",
|
||||
sizeof(qemuCaps),
|
||||
qemuCapsDispose)))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
VIR_ONCE_GLOBAL_INIT(qemuCaps)
|
||||
|
||||
struct qemu_feature_flags {
|
||||
const char *name;
|
||||
const int default_on;
|
||||
|
@ -305,7 +327,7 @@ qemuCapsParseMachineTypesStr(const char *output,
|
|||
|
||||
int
|
||||
qemuCapsProbeMachineTypes(const char *binary,
|
||||
virBitmapPtr qemuCaps,
|
||||
qemuCapsPtr caps,
|
||||
virCapsGuestMachinePtr **machines,
|
||||
int *nmachines)
|
||||
{
|
||||
|
@ -323,7 +345,7 @@ qemuCapsProbeMachineTypes(const char *binary,
|
|||
return -1;
|
||||
}
|
||||
|
||||
cmd = qemuCapsProbeCommand(binary, qemuCaps);
|
||||
cmd = qemuCapsProbeCommand(binary, caps);
|
||||
virCommandAddArgList(cmd, "-M", "?", NULL);
|
||||
virCommandSetOutputBuffer(cmd, &output);
|
||||
|
||||
|
@ -591,7 +613,7 @@ cleanup:
|
|||
|
||||
int
|
||||
qemuCapsProbeCPUModels(const char *qemu,
|
||||
virBitmapPtr qemuCaps,
|
||||
qemuCapsPtr caps,
|
||||
const char *arch,
|
||||
unsigned int *count,
|
||||
const char ***cpus)
|
||||
|
@ -615,7 +637,7 @@ qemuCapsProbeCPUModels(const char *qemu,
|
|||
return 0;
|
||||
}
|
||||
|
||||
cmd = qemuCapsProbeCommand(qemu, qemuCaps);
|
||||
cmd = qemuCapsProbeCommand(qemu, caps);
|
||||
virCommandAddArgList(cmd, "-cpu", "?", NULL);
|
||||
virCommandSetOutputBuffer(cmd, &output);
|
||||
|
||||
|
@ -653,8 +675,8 @@ qemuCapsInitGuest(virCapsPtr caps,
|
|||
int nmachines = 0;
|
||||
struct stat st;
|
||||
unsigned int ncpus;
|
||||
virBitmapPtr qemuCaps = NULL;
|
||||
virBitmapPtr kvmCaps = NULL;
|
||||
qemuCapsPtr qemubinCaps = NULL;
|
||||
qemuCapsPtr kvmbinCaps = NULL;
|
||||
int ret = -1;
|
||||
|
||||
/* Check for existance of base emulator, or alternate base
|
||||
|
@ -670,7 +692,7 @@ qemuCapsInitGuest(virCapsPtr caps,
|
|||
/* Ignore binary if extracting version info fails */
|
||||
if (binary &&
|
||||
qemuCapsExtractVersionInfo(binary, info->arch,
|
||||
false, NULL, &qemuCaps) < 0)
|
||||
false, NULL, &qemubinCaps) < 0)
|
||||
VIR_FREE(binary);
|
||||
|
||||
/* qemu-kvm/kvm binaries can only be used if
|
||||
|
@ -693,16 +715,16 @@ qemuCapsInitGuest(virCapsPtr caps,
|
|||
|
||||
if (qemuCapsExtractVersionInfo(kvmbin, info->arch,
|
||||
false, NULL,
|
||||
&kvmCaps) < 0) {
|
||||
&kvmbinCaps) < 0) {
|
||||
VIR_FREE(kvmbin);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!binary) {
|
||||
binary = kvmbin;
|
||||
qemuCaps = kvmCaps;
|
||||
qemubinCaps = kvmbinCaps;
|
||||
kvmbin = NULL;
|
||||
kvmCaps = NULL;
|
||||
kvmbinCaps = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -712,13 +734,13 @@ qemuCapsInitGuest(virCapsPtr caps,
|
|||
return 0;
|
||||
|
||||
if (access("/dev/kvm", F_OK) == 0 &&
|
||||
(qemuCapsGet(qemuCaps, QEMU_CAPS_KVM) ||
|
||||
qemuCapsGet(qemuCaps, QEMU_CAPS_ENABLE_KVM) ||
|
||||
(qemuCapsGet(qemubinCaps, QEMU_CAPS_KVM) ||
|
||||
qemuCapsGet(qemubinCaps, QEMU_CAPS_ENABLE_KVM) ||
|
||||
kvmbin))
|
||||
haskvm = 1;
|
||||
|
||||
if (access("/dev/kqemu", F_OK) == 0 &&
|
||||
qemuCapsGet(qemuCaps, QEMU_CAPS_KQEMU))
|
||||
qemuCapsGet(qemubinCaps, QEMU_CAPS_KQEMU))
|
||||
haskqemu = 1;
|
||||
|
||||
if (stat(binary, &st) == 0) {
|
||||
|
@ -758,7 +780,7 @@ qemuCapsInitGuest(virCapsPtr caps,
|
|||
info->wordsize, binary, binary_mtime,
|
||||
old_caps, &machines, &nmachines);
|
||||
if (probe &&
|
||||
qemuCapsProbeMachineTypes(binary, qemuCaps,
|
||||
qemuCapsProbeMachineTypes(binary, qemubinCaps,
|
||||
&machines, &nmachines) < 0)
|
||||
goto error;
|
||||
}
|
||||
|
@ -786,7 +808,7 @@ qemuCapsInitGuest(virCapsPtr caps,
|
|||
!virCapabilitiesAddGuestFeature(guest, "cpuselection", 1, 0))
|
||||
goto error;
|
||||
|
||||
if (qemuCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX) &&
|
||||
if (qemuCapsGet(qemubinCaps, QEMU_CAPS_BOOTINDEX) &&
|
||||
!virCapabilitiesAddGuestFeature(guest, "deviceboot", 1, 0))
|
||||
goto error;
|
||||
|
||||
|
@ -829,7 +851,7 @@ qemuCapsInitGuest(virCapsPtr caps,
|
|||
binary_mtime, old_caps,
|
||||
&machines, &nmachines);
|
||||
if (probe &&
|
||||
qemuCapsProbeMachineTypes(kvmbin, qemuCaps,
|
||||
qemuCapsProbeMachineTypes(kvmbin, kvmbinCaps,
|
||||
&machines, &nmachines) < 0)
|
||||
goto error;
|
||||
}
|
||||
|
@ -873,8 +895,8 @@ qemuCapsInitGuest(virCapsPtr caps,
|
|||
cleanup:
|
||||
VIR_FREE(binary);
|
||||
VIR_FREE(kvmbin);
|
||||
qemuCapsFree(qemuCaps);
|
||||
qemuCapsFree(kvmCaps);
|
||||
virObjectUnref(qemubinCaps);
|
||||
virObjectUnref(kvmbinCaps);
|
||||
|
||||
return ret;
|
||||
|
||||
|
@ -1024,122 +1046,122 @@ qemuCapsComputeCmdFlags(const char *help,
|
|||
unsigned int version,
|
||||
unsigned int is_kvm,
|
||||
unsigned int kvm_version,
|
||||
virBitmapPtr flags,
|
||||
qemuCapsPtr caps,
|
||||
bool check_yajl ATTRIBUTE_UNUSED)
|
||||
{
|
||||
const char *p;
|
||||
const char *fsdev, *netdev;
|
||||
|
||||
if (strstr(help, "-no-kqemu"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_KQEMU);
|
||||
qemuCapsSet(caps, QEMU_CAPS_KQEMU);
|
||||
if (strstr(help, "-enable-kqemu"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_ENABLE_KQEMU);
|
||||
qemuCapsSet(caps, QEMU_CAPS_ENABLE_KQEMU);
|
||||
if (strstr(help, "-no-kvm"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_KVM);
|
||||
qemuCapsSet(caps, QEMU_CAPS_KVM);
|
||||
if (strstr(help, "-enable-kvm"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_ENABLE_KVM);
|
||||
qemuCapsSet(caps, QEMU_CAPS_ENABLE_KVM);
|
||||
if (strstr(help, "-no-reboot"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_NO_REBOOT);
|
||||
qemuCapsSet(caps, QEMU_CAPS_NO_REBOOT);
|
||||
if (strstr(help, "-name")) {
|
||||
qemuCapsSet(flags, QEMU_CAPS_NAME);
|
||||
qemuCapsSet(caps, QEMU_CAPS_NAME);
|
||||
if (strstr(help, ",process="))
|
||||
qemuCapsSet(flags, QEMU_CAPS_NAME_PROCESS);
|
||||
qemuCapsSet(caps, QEMU_CAPS_NAME_PROCESS);
|
||||
}
|
||||
if (strstr(help, "-uuid"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_UUID);
|
||||
qemuCapsSet(caps, QEMU_CAPS_UUID);
|
||||
if (strstr(help, "-xen-domid"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_XEN_DOMID);
|
||||
qemuCapsSet(caps, QEMU_CAPS_XEN_DOMID);
|
||||
else if (strstr(help, "-domid"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_DOMID);
|
||||
qemuCapsSet(caps, QEMU_CAPS_DOMID);
|
||||
if (strstr(help, "-drive")) {
|
||||
const char *cache = strstr(help, "cache=");
|
||||
|
||||
qemuCapsSet(flags, QEMU_CAPS_DRIVE);
|
||||
qemuCapsSet(caps, QEMU_CAPS_DRIVE);
|
||||
if (cache && (p = strchr(cache, ']'))) {
|
||||
if (memmem(cache, p - cache, "on|off", sizeof("on|off") - 1) == NULL)
|
||||
qemuCapsSet(flags, QEMU_CAPS_DRIVE_CACHE_V2);
|
||||
qemuCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_V2);
|
||||
if (memmem(cache, p - cache, "directsync", sizeof("directsync") - 1))
|
||||
qemuCapsSet(flags, QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC);
|
||||
qemuCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC);
|
||||
if (memmem(cache, p - cache, "unsafe", sizeof("unsafe") - 1))
|
||||
qemuCapsSet(flags, QEMU_CAPS_DRIVE_CACHE_UNSAFE);
|
||||
qemuCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_UNSAFE);
|
||||
}
|
||||
if (strstr(help, "format="))
|
||||
qemuCapsSet(flags, QEMU_CAPS_DRIVE_FORMAT);
|
||||
qemuCapsSet(caps, QEMU_CAPS_DRIVE_FORMAT);
|
||||
if (strstr(help, "readonly="))
|
||||
qemuCapsSet(flags, QEMU_CAPS_DRIVE_READONLY);
|
||||
qemuCapsSet(caps, QEMU_CAPS_DRIVE_READONLY);
|
||||
if (strstr(help, "aio=threads|native"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_DRIVE_AIO);
|
||||
qemuCapsSet(caps, QEMU_CAPS_DRIVE_AIO);
|
||||
if (strstr(help, "copy-on-read=on|off"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_DRIVE_COPY_ON_READ);
|
||||
qemuCapsSet(caps, QEMU_CAPS_DRIVE_COPY_ON_READ);
|
||||
if (strstr(help, "bps="))
|
||||
qemuCapsSet(flags, QEMU_CAPS_DRIVE_IOTUNE);
|
||||
qemuCapsSet(caps, QEMU_CAPS_DRIVE_IOTUNE);
|
||||
}
|
||||
if ((p = strstr(help, "-vga")) && !strstr(help, "-std-vga")) {
|
||||
const char *nl = strstr(p, "\n");
|
||||
|
||||
qemuCapsSet(flags, QEMU_CAPS_VGA);
|
||||
qemuCapsSet(caps, QEMU_CAPS_VGA);
|
||||
|
||||
if (strstr(p, "|qxl"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_VGA_QXL);
|
||||
qemuCapsSet(caps, QEMU_CAPS_VGA_QXL);
|
||||
if ((p = strstr(p, "|none")) && p < nl)
|
||||
qemuCapsSet(flags, QEMU_CAPS_VGA_NONE);
|
||||
qemuCapsSet(caps, QEMU_CAPS_VGA_NONE);
|
||||
}
|
||||
if (strstr(help, "-spice"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_SPICE);
|
||||
qemuCapsSet(caps, QEMU_CAPS_SPICE);
|
||||
if (strstr(help, "boot=on"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_DRIVE_BOOT);
|
||||
qemuCapsSet(caps, QEMU_CAPS_DRIVE_BOOT);
|
||||
if (strstr(help, "serial=s"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_DRIVE_SERIAL);
|
||||
qemuCapsSet(caps, QEMU_CAPS_DRIVE_SERIAL);
|
||||
if (strstr(help, "-pcidevice"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_PCIDEVICE);
|
||||
qemuCapsSet(caps, QEMU_CAPS_PCIDEVICE);
|
||||
if (strstr(help, "-mem-path"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_MEM_PATH);
|
||||
qemuCapsSet(caps, QEMU_CAPS_MEM_PATH);
|
||||
if (strstr(help, "-chardev")) {
|
||||
qemuCapsSet(flags, QEMU_CAPS_CHARDEV);
|
||||
qemuCapsSet(caps, QEMU_CAPS_CHARDEV);
|
||||
if (strstr(help, "-chardev spicevmc"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_CHARDEV_SPICEVMC);
|
||||
qemuCapsSet(caps, QEMU_CAPS_CHARDEV_SPICEVMC);
|
||||
}
|
||||
if (strstr(help, "-balloon"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_BALLOON);
|
||||
qemuCapsSet(caps, QEMU_CAPS_BALLOON);
|
||||
if (strstr(help, "-device")) {
|
||||
qemuCapsSet(flags, QEMU_CAPS_DEVICE);
|
||||
qemuCapsSet(caps, QEMU_CAPS_DEVICE);
|
||||
/*
|
||||
* When -device was introduced, qemu already supported drive's
|
||||
* readonly option but didn't advertise that.
|
||||
*/
|
||||
qemuCapsSet(flags, QEMU_CAPS_DRIVE_READONLY);
|
||||
qemuCapsSet(caps, QEMU_CAPS_DRIVE_READONLY);
|
||||
}
|
||||
if (strstr(help, "-nodefconfig"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_NODEFCONFIG);
|
||||
qemuCapsSet(caps, QEMU_CAPS_NODEFCONFIG);
|
||||
if (strstr(help, "-no-user-config"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_NO_USER_CONFIG);
|
||||
qemuCapsSet(caps, QEMU_CAPS_NO_USER_CONFIG);
|
||||
/* The trailing ' ' is important to avoid a bogus match */
|
||||
if (strstr(help, "-rtc "))
|
||||
qemuCapsSet(flags, QEMU_CAPS_RTC);
|
||||
qemuCapsSet(caps, QEMU_CAPS_RTC);
|
||||
/* to wit */
|
||||
if (strstr(help, "-rtc-td-hack"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_RTC_TD_HACK);
|
||||
qemuCapsSet(caps, QEMU_CAPS_RTC_TD_HACK);
|
||||
if (strstr(help, "-no-hpet"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_NO_HPET);
|
||||
qemuCapsSet(caps, QEMU_CAPS_NO_HPET);
|
||||
if (strstr(help, "-no-acpi"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_NO_ACPI);
|
||||
qemuCapsSet(caps, QEMU_CAPS_NO_ACPI);
|
||||
if (strstr(help, "-no-kvm-pit-reinjection"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_NO_KVM_PIT);
|
||||
qemuCapsSet(caps, QEMU_CAPS_NO_KVM_PIT);
|
||||
if (strstr(help, "-tdf"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_TDF);
|
||||
qemuCapsSet(caps, QEMU_CAPS_TDF);
|
||||
if (strstr(help, "-enable-nesting"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_NESTING);
|
||||
qemuCapsSet(caps, QEMU_CAPS_NESTING);
|
||||
if (strstr(help, ",menu=on"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_BOOT_MENU);
|
||||
qemuCapsSet(caps, QEMU_CAPS_BOOT_MENU);
|
||||
if ((fsdev = strstr(help, "-fsdev"))) {
|
||||
qemuCapsSet(flags, QEMU_CAPS_FSDEV);
|
||||
qemuCapsSet(caps, QEMU_CAPS_FSDEV);
|
||||
if (strstr(fsdev, "readonly"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_FSDEV_READONLY);
|
||||
qemuCapsSet(caps, QEMU_CAPS_FSDEV_READONLY);
|
||||
if (strstr(fsdev, "writeout"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_FSDEV_WRITEOUT);
|
||||
qemuCapsSet(caps, QEMU_CAPS_FSDEV_WRITEOUT);
|
||||
}
|
||||
if (strstr(help, "-smbios type"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_SMBIOS_TYPE);
|
||||
qemuCapsSet(caps, QEMU_CAPS_SMBIOS_TYPE);
|
||||
|
||||
if ((netdev = strstr(help, "-netdev"))) {
|
||||
/* Disable -netdev on 0.12 since although it exists,
|
||||
|
@ -1148,26 +1170,26 @@ qemuCapsComputeCmdFlags(const char *help,
|
|||
* But see below about RHEL build. */
|
||||
if (version >= 13000) {
|
||||
if (strstr(netdev, "bridge"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_NETDEV_BRIDGE);
|
||||
qemuCapsSet(flags, QEMU_CAPS_NETDEV);
|
||||
qemuCapsSet(caps, QEMU_CAPS_NETDEV_BRIDGE);
|
||||
qemuCapsSet(caps, QEMU_CAPS_NETDEV);
|
||||
}
|
||||
}
|
||||
|
||||
if (strstr(help, "-sdl"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_SDL);
|
||||
qemuCapsSet(caps, QEMU_CAPS_SDL);
|
||||
if (strstr(help, "cores=") &&
|
||||
strstr(help, "threads=") &&
|
||||
strstr(help, "sockets="))
|
||||
qemuCapsSet(flags, QEMU_CAPS_SMP_TOPOLOGY);
|
||||
qemuCapsSet(caps, QEMU_CAPS_SMP_TOPOLOGY);
|
||||
|
||||
if (version >= 9000)
|
||||
qemuCapsSet(flags, QEMU_CAPS_VNC_COLON);
|
||||
qemuCapsSet(caps, QEMU_CAPS_VNC_COLON);
|
||||
|
||||
if (is_kvm && (version >= 10000 || kvm_version >= 74))
|
||||
qemuCapsSet(flags, QEMU_CAPS_VNET_HDR);
|
||||
qemuCapsSet(caps, QEMU_CAPS_VNET_HDR);
|
||||
|
||||
if (strstr(help, ",vhost=")) {
|
||||
qemuCapsSet(flags, QEMU_CAPS_VHOST_NET);
|
||||
qemuCapsSet(caps, QEMU_CAPS_VHOST_NET);
|
||||
}
|
||||
|
||||
/* Do not use -no-shutdown if qemu doesn't support it or SIGTERM handling
|
||||
|
@ -1175,7 +1197,7 @@ qemuCapsComputeCmdFlags(const char *help,
|
|||
* 0.14.* and 0.15.0)
|
||||
*/
|
||||
if (strstr(help, "-no-shutdown") && (version < 14000 || version > 15000))
|
||||
qemuCapsSet(flags, QEMU_CAPS_NO_SHUTDOWN);
|
||||
qemuCapsSet(caps, QEMU_CAPS_NO_SHUTDOWN);
|
||||
|
||||
/*
|
||||
* Handling of -incoming arg with varying features
|
||||
|
@ -1190,25 +1212,25 @@ qemuCapsComputeCmdFlags(const char *help,
|
|||
* while waiting for data, so pretend it doesn't exist
|
||||
*/
|
||||
if (version >= 10000) {
|
||||
qemuCapsSet(flags, QEMU_CAPS_MIGRATE_QEMU_TCP);
|
||||
qemuCapsSet(flags, QEMU_CAPS_MIGRATE_QEMU_EXEC);
|
||||
qemuCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_TCP);
|
||||
qemuCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_EXEC);
|
||||
if (version >= 12000) {
|
||||
qemuCapsSet(flags, QEMU_CAPS_MIGRATE_QEMU_UNIX);
|
||||
qemuCapsSet(flags, QEMU_CAPS_MIGRATE_QEMU_FD);
|
||||
qemuCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_UNIX);
|
||||
qemuCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_FD);
|
||||
}
|
||||
} else if (kvm_version >= 79) {
|
||||
qemuCapsSet(flags, QEMU_CAPS_MIGRATE_QEMU_TCP);
|
||||
qemuCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_TCP);
|
||||
if (kvm_version >= 80)
|
||||
qemuCapsSet(flags, QEMU_CAPS_MIGRATE_QEMU_EXEC);
|
||||
qemuCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_EXEC);
|
||||
} else if (kvm_version > 0) {
|
||||
qemuCapsSet(flags, QEMU_CAPS_MIGRATE_KVM_STDIO);
|
||||
qemuCapsSet(caps, QEMU_CAPS_MIGRATE_KVM_STDIO);
|
||||
}
|
||||
|
||||
if (version >= 10000)
|
||||
qemuCapsSet(flags, QEMU_CAPS_0_10);
|
||||
qemuCapsSet(caps, QEMU_CAPS_0_10);
|
||||
|
||||
if (version >= 11000)
|
||||
qemuCapsSet(flags, QEMU_CAPS_VIRTIO_BLK_SG_IO);
|
||||
qemuCapsSet(caps, QEMU_CAPS_VIRTIO_BLK_SG_IO);
|
||||
|
||||
/* While JSON mode was available in 0.12.0, it was too
|
||||
* incomplete to contemplate using. The 0.13.0 release
|
||||
|
@ -1221,11 +1243,11 @@ qemuCapsComputeCmdFlags(const char *help,
|
|||
*/
|
||||
#if HAVE_YAJL
|
||||
if (version >= 13000) {
|
||||
qemuCapsSet(flags, QEMU_CAPS_MONITOR_JSON);
|
||||
qemuCapsSet(caps, QEMU_CAPS_MONITOR_JSON);
|
||||
} else if (version >= 12000 &&
|
||||
strstr(help, "libvirt")) {
|
||||
qemuCapsSet(flags, QEMU_CAPS_MONITOR_JSON);
|
||||
qemuCapsSet(flags, QEMU_CAPS_NETDEV);
|
||||
qemuCapsSet(caps, QEMU_CAPS_MONITOR_JSON);
|
||||
qemuCapsSet(caps, QEMU_CAPS_NETDEV);
|
||||
}
|
||||
#else
|
||||
/* Starting with qemu 0.15 and newer, upstream qemu no longer
|
||||
|
@ -1244,12 +1266,12 @@ qemuCapsComputeCmdFlags(const char *help,
|
|||
"compiled with yajl"));
|
||||
return -1;
|
||||
}
|
||||
qemuCapsSet(flags, QEMU_CAPS_NETDEV);
|
||||
qemuCapsSet(caps, QEMU_CAPS_NETDEV);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (version >= 13000)
|
||||
qemuCapsSet(flags, QEMU_CAPS_PCI_MULTIFUNCTION);
|
||||
qemuCapsSet(caps, QEMU_CAPS_PCI_MULTIFUNCTION);
|
||||
|
||||
/* Although very new versions of qemu advertise the presence of
|
||||
* the rombar option in the output of "qemu -device pci-assign,?",
|
||||
|
@ -1262,10 +1284,10 @@ qemuCapsComputeCmdFlags(const char *help,
|
|||
* log and refuse to start, so it would be immediately obvious).
|
||||
*/
|
||||
if (version >= 12000)
|
||||
qemuCapsSet(flags, QEMU_CAPS_PCI_ROMBAR);
|
||||
qemuCapsSet(caps, QEMU_CAPS_PCI_ROMBAR);
|
||||
|
||||
if (version >= 11000)
|
||||
qemuCapsSet(flags, QEMU_CAPS_CPU_HOST);
|
||||
qemuCapsSet(caps, QEMU_CAPS_CPU_HOST);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1295,7 +1317,7 @@ qemuCapsComputeCmdFlags(const char *help,
|
|||
|
||||
int qemuCapsParseHelpStr(const char *qemu,
|
||||
const char *help,
|
||||
virBitmapPtr flags,
|
||||
qemuCapsPtr caps,
|
||||
unsigned int *version,
|
||||
unsigned int *is_kvm,
|
||||
unsigned int *kvm_version,
|
||||
|
@ -1356,10 +1378,10 @@ int qemuCapsParseHelpStr(const char *qemu,
|
|||
*version = (major * 1000 * 1000) + (minor * 1000) + micro;
|
||||
|
||||
if (qemuCapsComputeCmdFlags(help, *version, *is_kvm, *kvm_version,
|
||||
flags, check_yajl) < 0)
|
||||
caps, check_yajl) < 0)
|
||||
goto cleanup;
|
||||
|
||||
strflags = virBitmapString(flags);
|
||||
strflags = virBitmapString(caps->flags);
|
||||
VIR_DEBUG("Version %u.%u.%u, cooked version %u, flags %s",
|
||||
major, minor, micro, *version, NULLSTR(strflags));
|
||||
VIR_FREE(strflags);
|
||||
|
@ -1386,7 +1408,7 @@ cleanup:
|
|||
|
||||
static int
|
||||
qemuCapsExtractDeviceStr(const char *qemu,
|
||||
virBitmapPtr flags)
|
||||
qemuCapsPtr caps)
|
||||
{
|
||||
char *output = NULL;
|
||||
virCommandPtr cmd;
|
||||
|
@ -1400,7 +1422,7 @@ qemuCapsExtractDeviceStr(const char *qemu,
|
|||
* understand '-device name,?', and always exits with status 1 for
|
||||
* the simpler '-device ?', so this function is really only useful
|
||||
* if -help includes "device driver,?". */
|
||||
cmd = qemuCapsProbeCommand(qemu, flags);
|
||||
cmd = qemuCapsProbeCommand(qemu, caps);
|
||||
virCommandAddArgList(cmd,
|
||||
"-device", "?",
|
||||
"-device", "pci-assign,?",
|
||||
|
@ -1416,7 +1438,7 @@ qemuCapsExtractDeviceStr(const char *qemu,
|
|||
if (virCommandRun(cmd, NULL) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = qemuCapsParseDeviceStr(output, flags);
|
||||
ret = qemuCapsParseDeviceStr(output, caps);
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(output);
|
||||
|
@ -1426,87 +1448,87 @@ cleanup:
|
|||
|
||||
|
||||
int
|
||||
qemuCapsParseDeviceStr(const char *str, virBitmapPtr flags)
|
||||
qemuCapsParseDeviceStr(const char *str, qemuCapsPtr caps)
|
||||
{
|
||||
/* Which devices exist. */
|
||||
if (strstr(str, "name \"hda-duplex\""))
|
||||
qemuCapsSet(flags, QEMU_CAPS_HDA_DUPLEX);
|
||||
qemuCapsSet(caps, QEMU_CAPS_HDA_DUPLEX);
|
||||
if (strstr(str, "name \"hda-micro\""))
|
||||
qemuCapsSet(flags, QEMU_CAPS_HDA_MICRO);
|
||||
qemuCapsSet(caps, QEMU_CAPS_HDA_MICRO);
|
||||
if (strstr(str, "name \"ccid-card-emulated\""))
|
||||
qemuCapsSet(flags, QEMU_CAPS_CCID_EMULATED);
|
||||
qemuCapsSet(caps, QEMU_CAPS_CCID_EMULATED);
|
||||
if (strstr(str, "name \"ccid-card-passthru\""))
|
||||
qemuCapsSet(flags, QEMU_CAPS_CCID_PASSTHRU);
|
||||
qemuCapsSet(caps, QEMU_CAPS_CCID_PASSTHRU);
|
||||
|
||||
if (strstr(str, "name \"piix3-usb-uhci\""))
|
||||
qemuCapsSet(flags, QEMU_CAPS_PIIX3_USB_UHCI);
|
||||
qemuCapsSet(caps, QEMU_CAPS_PIIX3_USB_UHCI);
|
||||
if (strstr(str, "name \"piix4-usb-uhci\""))
|
||||
qemuCapsSet(flags, QEMU_CAPS_PIIX4_USB_UHCI);
|
||||
qemuCapsSet(caps, QEMU_CAPS_PIIX4_USB_UHCI);
|
||||
if (strstr(str, "name \"usb-ehci\""))
|
||||
qemuCapsSet(flags, QEMU_CAPS_USB_EHCI);
|
||||
qemuCapsSet(caps, QEMU_CAPS_USB_EHCI);
|
||||
if (strstr(str, "name \"ich9-usb-ehci1\""))
|
||||
qemuCapsSet(flags, QEMU_CAPS_ICH9_USB_EHCI1);
|
||||
qemuCapsSet(caps, QEMU_CAPS_ICH9_USB_EHCI1);
|
||||
if (strstr(str, "name \"vt82c686b-usb-uhci\""))
|
||||
qemuCapsSet(flags, QEMU_CAPS_VT82C686B_USB_UHCI);
|
||||
qemuCapsSet(caps, QEMU_CAPS_VT82C686B_USB_UHCI);
|
||||
if (strstr(str, "name \"pci-ohci\""))
|
||||
qemuCapsSet(flags, QEMU_CAPS_PCI_OHCI);
|
||||
qemuCapsSet(caps, QEMU_CAPS_PCI_OHCI);
|
||||
if (strstr(str, "name \"nec-usb-xhci\""))
|
||||
qemuCapsSet(flags, QEMU_CAPS_NEC_USB_XHCI);
|
||||
qemuCapsSet(caps, QEMU_CAPS_NEC_USB_XHCI);
|
||||
if (strstr(str, "name \"usb-redir\""))
|
||||
qemuCapsSet(flags, QEMU_CAPS_USB_REDIR);
|
||||
qemuCapsSet(caps, QEMU_CAPS_USB_REDIR);
|
||||
if (strstr(str, "usb-redir.filter"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_USB_REDIR_FILTER);
|
||||
qemuCapsSet(caps, QEMU_CAPS_USB_REDIR_FILTER);
|
||||
if (strstr(str, "name \"usb-hub\""))
|
||||
qemuCapsSet(flags, QEMU_CAPS_USB_HUB);
|
||||
qemuCapsSet(caps, QEMU_CAPS_USB_HUB);
|
||||
if (strstr(str, "name \"ich9-ahci\""))
|
||||
qemuCapsSet(flags, QEMU_CAPS_ICH9_AHCI);
|
||||
qemuCapsSet(caps, QEMU_CAPS_ICH9_AHCI);
|
||||
if (strstr(str, "name \"virtio-blk-s390\"") ||
|
||||
strstr(str, "name \"virtio-net-s390\"") ||
|
||||
strstr(str, "name \"virtio-serial-s390\""))
|
||||
qemuCapsSet(flags, QEMU_CAPS_VIRTIO_S390);
|
||||
qemuCapsSet(caps, QEMU_CAPS_VIRTIO_S390);
|
||||
|
||||
if (strstr(str, "name \"lsi53c895a\""))
|
||||
qemuCapsSet(flags, QEMU_CAPS_SCSI_LSI);
|
||||
qemuCapsSet(caps, QEMU_CAPS_SCSI_LSI);
|
||||
if (strstr(str, "name \"virtio-scsi-pci\""))
|
||||
qemuCapsSet(flags, QEMU_CAPS_VIRTIO_SCSI_PCI);
|
||||
qemuCapsSet(caps, QEMU_CAPS_VIRTIO_SCSI_PCI);
|
||||
|
||||
/* Prefer -chardev spicevmc (detected earlier) over -device spicevmc */
|
||||
if (!qemuCapsGet(flags, QEMU_CAPS_CHARDEV_SPICEVMC) &&
|
||||
if (!qemuCapsGet(caps, QEMU_CAPS_CHARDEV_SPICEVMC) &&
|
||||
strstr(str, "name \"spicevmc\""))
|
||||
qemuCapsSet(flags, QEMU_CAPS_DEVICE_SPICEVMC);
|
||||
qemuCapsSet(caps, QEMU_CAPS_DEVICE_SPICEVMC);
|
||||
|
||||
/* Features of given devices. */
|
||||
if (strstr(str, "pci-assign.configfd"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_PCI_CONFIGFD);
|
||||
qemuCapsSet(caps, QEMU_CAPS_PCI_CONFIGFD);
|
||||
if (strstr(str, "virtio-blk-pci.multifunction"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_PCI_MULTIFUNCTION);
|
||||
qemuCapsSet(caps, QEMU_CAPS_PCI_MULTIFUNCTION);
|
||||
if (strstr(str, "virtio-blk-pci.bootindex")) {
|
||||
qemuCapsSet(flags, QEMU_CAPS_BOOTINDEX);
|
||||
qemuCapsSet(caps, QEMU_CAPS_BOOTINDEX);
|
||||
if (strstr(str, "pci-assign.bootindex"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_PCI_BOOTINDEX);
|
||||
qemuCapsSet(caps, QEMU_CAPS_PCI_BOOTINDEX);
|
||||
}
|
||||
if (strstr(str, "virtio-net-pci.tx="))
|
||||
qemuCapsSet(flags, QEMU_CAPS_VIRTIO_TX_ALG);
|
||||
qemuCapsSet(caps, QEMU_CAPS_VIRTIO_TX_ALG);
|
||||
if (strstr(str, "name \"qxl-vga\""))
|
||||
qemuCapsSet(flags, QEMU_CAPS_DEVICE_QXL_VGA);
|
||||
qemuCapsSet(caps, QEMU_CAPS_DEVICE_QXL_VGA);
|
||||
if (strstr(str, "virtio-blk-pci.ioeventfd"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_VIRTIO_IOEVENTFD);
|
||||
qemuCapsSet(caps, QEMU_CAPS_VIRTIO_IOEVENTFD);
|
||||
if (strstr(str, "name \"sga\""))
|
||||
qemuCapsSet(flags, QEMU_CAPS_SGA);
|
||||
qemuCapsSet(caps, QEMU_CAPS_SGA);
|
||||
if (strstr(str, "virtio-blk-pci.event_idx"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_VIRTIO_BLK_EVENT_IDX);
|
||||
qemuCapsSet(caps, QEMU_CAPS_VIRTIO_BLK_EVENT_IDX);
|
||||
if (strstr(str, "virtio-net-pci.event_idx"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_VIRTIO_NET_EVENT_IDX);
|
||||
qemuCapsSet(caps, QEMU_CAPS_VIRTIO_NET_EVENT_IDX);
|
||||
if (strstr(str, "virtio-blk-pci.scsi"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_VIRTIO_BLK_SCSI);
|
||||
qemuCapsSet(caps, QEMU_CAPS_VIRTIO_BLK_SCSI);
|
||||
if (strstr(str, "scsi-disk.channel"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_SCSI_DISK_CHANNEL);
|
||||
qemuCapsSet(caps, QEMU_CAPS_SCSI_DISK_CHANNEL);
|
||||
if (strstr(str, "scsi-block"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_SCSI_BLOCK);
|
||||
qemuCapsSet(caps, QEMU_CAPS_SCSI_BLOCK);
|
||||
if (strstr(str, "scsi-cd"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_SCSI_CD);
|
||||
qemuCapsSet(caps, QEMU_CAPS_SCSI_CD);
|
||||
if (strstr(str, "ide-cd"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_IDE_CD);
|
||||
qemuCapsSet(caps, QEMU_CAPS_IDE_CD);
|
||||
/*
|
||||
* the iolimit detection is not really straight forward:
|
||||
* in qemu this is a capability of the block layer, if
|
||||
|
@ -1516,11 +1538,11 @@ qemuCapsParseDeviceStr(const char *str, virBitmapPtr flags)
|
|||
*/
|
||||
if (strstr(str, ".logical_block_size") &&
|
||||
strstr(str, ".physical_block_size"))
|
||||
qemuCapsSet(flags, QEMU_CAPS_BLOCKIO);
|
||||
qemuCapsSet(caps, QEMU_CAPS_BLOCKIO);
|
||||
if (strstr(str, "PIIX4_PM.disable_s3="))
|
||||
qemuCapsSet(flags, QEMU_CAPS_DISABLE_S3);
|
||||
qemuCapsSet(caps, QEMU_CAPS_DISABLE_S3);
|
||||
if (strstr(str, "PIIX4_PM.disable_s4="))
|
||||
qemuCapsSet(flags, QEMU_CAPS_DISABLE_S4);
|
||||
qemuCapsSet(caps, QEMU_CAPS_DISABLE_S4);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1529,16 +1551,16 @@ int qemuCapsExtractVersionInfo(const char *qemu,
|
|||
const char *arch,
|
||||
bool check_yajl,
|
||||
unsigned int *retversion,
|
||||
virBitmapPtr *retflags)
|
||||
qemuCapsPtr *retcaps)
|
||||
{
|
||||
int ret = -1;
|
||||
unsigned int version, is_kvm, kvm_version;
|
||||
virBitmapPtr flags = NULL;
|
||||
qemuCapsPtr caps = NULL;
|
||||
char *help = NULL;
|
||||
virCommandPtr cmd;
|
||||
|
||||
if (retflags)
|
||||
*retflags = NULL;
|
||||
if (retcaps)
|
||||
*retcaps = NULL;
|
||||
if (retversion)
|
||||
*retversion = 0;
|
||||
|
||||
|
@ -1558,8 +1580,8 @@ int qemuCapsExtractVersionInfo(const char *qemu,
|
|||
if (virCommandRun(cmd, NULL) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!(flags = qemuCapsNew()) ||
|
||||
qemuCapsParseHelpStr(qemu, help, flags,
|
||||
if (!(caps = qemuCapsNew()) ||
|
||||
qemuCapsParseHelpStr(qemu, help, caps,
|
||||
&version, &is_kvm, &kvm_version,
|
||||
check_yajl) == -1)
|
||||
goto cleanup;
|
||||
|
@ -1567,26 +1589,26 @@ int qemuCapsExtractVersionInfo(const char *qemu,
|
|||
/* Currently only x86_64 and i686 support PCI-multibus. */
|
||||
if (STREQLEN(arch, "x86_64", 6) ||
|
||||
STREQLEN(arch, "i686", 4)) {
|
||||
qemuCapsSet(flags, QEMU_CAPS_PCI_MULTIBUS);
|
||||
qemuCapsSet(caps, QEMU_CAPS_PCI_MULTIBUS);
|
||||
}
|
||||
|
||||
/* S390 and probably other archs do not support no-acpi -
|
||||
maybe the qemu option parsing should be re-thought. */
|
||||
if (STRPREFIX(arch, "s390"))
|
||||
qemuCapsClear(flags, QEMU_CAPS_NO_ACPI);
|
||||
qemuCapsClear(caps, QEMU_CAPS_NO_ACPI);
|
||||
|
||||
/* qemuCapsExtractDeviceStr will only set additional flags if qemu
|
||||
/* qemuCapsExtractDeviceStr will only set additional caps if qemu
|
||||
* understands the 0.13.0+ notion of "-device driver,". */
|
||||
if (qemuCapsGet(flags, QEMU_CAPS_DEVICE) &&
|
||||
if (qemuCapsGet(caps, QEMU_CAPS_DEVICE) &&
|
||||
strstr(help, "-device driver,?") &&
|
||||
qemuCapsExtractDeviceStr(qemu, flags) < 0)
|
||||
qemuCapsExtractDeviceStr(qemu, caps) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (retversion)
|
||||
*retversion = version;
|
||||
if (retflags) {
|
||||
*retflags = flags;
|
||||
flags = NULL;
|
||||
if (retcaps) {
|
||||
*retcaps = caps;
|
||||
caps = NULL;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
@ -1594,7 +1616,7 @@ int qemuCapsExtractVersionInfo(const char *qemu,
|
|||
cleanup:
|
||||
VIR_FREE(help);
|
||||
virCommandFree(cmd);
|
||||
qemuCapsFree(flags);
|
||||
virObjectUnref(caps);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -1648,54 +1670,80 @@ int qemuCapsExtractVersion(virCapsPtr caps,
|
|||
}
|
||||
|
||||
|
||||
virBitmapPtr
|
||||
|
||||
|
||||
qemuCapsPtr
|
||||
qemuCapsNew(void)
|
||||
{
|
||||
virBitmapPtr caps;
|
||||
qemuCapsPtr caps;
|
||||
|
||||
if (!(caps = virBitmapAlloc(QEMU_CAPS_LAST)))
|
||||
virReportOOMError();
|
||||
if (qemuCapsInitialize() < 0)
|
||||
return NULL;
|
||||
|
||||
if (!(caps = virObjectNew(qemuCapsClass)))
|
||||
return NULL;
|
||||
|
||||
if (!(caps->flags = virBitmapAlloc(QEMU_CAPS_LAST)))
|
||||
goto no_memory;
|
||||
|
||||
return caps;
|
||||
|
||||
no_memory:
|
||||
virReportOOMError();
|
||||
virObjectUnref(caps);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void qemuCapsDispose(void *obj)
|
||||
{
|
||||
qemuCapsPtr caps = obj;
|
||||
|
||||
virBitmapFree(caps->flags);
|
||||
}
|
||||
|
||||
void
|
||||
qemuCapsSet(virBitmapPtr caps,
|
||||
qemuCapsSet(qemuCapsPtr caps,
|
||||
enum qemuCapsFlags flag)
|
||||
{
|
||||
ignore_value(virBitmapSetBit(caps, flag));
|
||||
ignore_value(virBitmapSetBit(caps->flags, flag));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
qemuCapsSetList(virBitmapPtr caps, ...)
|
||||
qemuCapsSetList(qemuCapsPtr caps, ...)
|
||||
{
|
||||
va_list list;
|
||||
int flag;
|
||||
|
||||
va_start(list, caps);
|
||||
while ((flag = va_arg(list, int)) < QEMU_CAPS_LAST)
|
||||
ignore_value(virBitmapSetBit(caps, flag));
|
||||
ignore_value(virBitmapSetBit(caps->flags, flag));
|
||||
va_end(list);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
qemuCapsClear(virBitmapPtr caps,
|
||||
qemuCapsClear(qemuCapsPtr caps,
|
||||
enum qemuCapsFlags flag)
|
||||
{
|
||||
ignore_value(virBitmapClearBit(caps, flag));
|
||||
ignore_value(virBitmapClearBit(caps->flags, flag));
|
||||
}
|
||||
|
||||
|
||||
char *qemuCapsFlagsString(qemuCapsPtr caps)
|
||||
{
|
||||
return virBitmapString(caps->flags);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
qemuCapsGet(virBitmapPtr caps,
|
||||
qemuCapsGet(qemuCapsPtr caps,
|
||||
enum qemuCapsFlags flag)
|
||||
{
|
||||
bool b;
|
||||
|
||||
if (!caps || virBitmapGetBit(caps, flag, &b) < 0)
|
||||
if (!caps || virBitmapGetBit(caps->flags, flag, &b) < 0)
|
||||
return false;
|
||||
else
|
||||
return b;
|
||||
|
@ -1704,14 +1752,14 @@ qemuCapsGet(virBitmapPtr caps,
|
|||
|
||||
virCommandPtr
|
||||
qemuCapsProbeCommand(const char *qemu,
|
||||
virBitmapPtr qemuCaps)
|
||||
qemuCapsPtr caps)
|
||||
{
|
||||
virCommandPtr cmd = virCommandNew(qemu);
|
||||
|
||||
if (qemuCaps) {
|
||||
if (qemuCapsGet(qemuCaps, QEMU_CAPS_NO_USER_CONFIG))
|
||||
if (caps) {
|
||||
if (qemuCapsGet(caps, QEMU_CAPS_NO_USER_CONFIG))
|
||||
virCommandAddArg(cmd, "-no-user-config");
|
||||
else if (qemuCapsGet(qemuCaps, QEMU_CAPS_NODEFCONFIG))
|
||||
else if (qemuCapsGet(caps, QEMU_CAPS_NODEFCONFIG))
|
||||
virCommandAddArg(cmd, "-nodefconfig");
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#ifndef __QEMU_CAPABILITIES_H__
|
||||
# define __QEMU_CAPABILITIES_H__
|
||||
|
||||
# include "bitmap.h"
|
||||
# include "virobject.h"
|
||||
# include "capabilities.h"
|
||||
# include "command.h"
|
||||
|
||||
|
@ -146,30 +146,33 @@ enum qemuCapsFlags {
|
|||
QEMU_CAPS_LAST, /* this must always be the last item */
|
||||
};
|
||||
|
||||
virBitmapPtr qemuCapsNew(void);
|
||||
typedef struct _qemuCaps qemuCaps;
|
||||
typedef qemuCaps *qemuCapsPtr;
|
||||
|
||||
# define qemuCapsFree(caps) virBitmapFree(caps)
|
||||
qemuCapsPtr qemuCapsNew(void);
|
||||
|
||||
void qemuCapsSet(virBitmapPtr caps,
|
||||
void qemuCapsSet(qemuCapsPtr caps,
|
||||
enum qemuCapsFlags flag) ATTRIBUTE_NONNULL(1);
|
||||
|
||||
void qemuCapsSetList(virBitmapPtr caps, ...) ATTRIBUTE_NONNULL(1);
|
||||
void qemuCapsSetList(qemuCapsPtr caps, ...) ATTRIBUTE_NONNULL(1);
|
||||
|
||||
void qemuCapsClear(virBitmapPtr caps,
|
||||
void qemuCapsClear(qemuCapsPtr caps,
|
||||
enum qemuCapsFlags flag) ATTRIBUTE_NONNULL(1);
|
||||
|
||||
bool qemuCapsGet(virBitmapPtr caps,
|
||||
bool qemuCapsGet(qemuCapsPtr caps,
|
||||
enum qemuCapsFlags flag);
|
||||
|
||||
char *qemuCapsFlagsString(qemuCapsPtr caps);
|
||||
|
||||
virCapsPtr qemuCapsInit(virCapsPtr old_caps);
|
||||
|
||||
int qemuCapsProbeMachineTypes(const char *binary,
|
||||
virBitmapPtr qemuCaps,
|
||||
qemuCapsPtr caps,
|
||||
virCapsGuestMachinePtr **machines,
|
||||
int *nmachines);
|
||||
|
||||
int qemuCapsProbeCPUModels(const char *qemu,
|
||||
virBitmapPtr qemuCaps,
|
||||
qemuCapsPtr caps,
|
||||
const char *arch,
|
||||
unsigned int *count,
|
||||
const char ***cpus);
|
||||
|
@ -180,20 +183,20 @@ int qemuCapsExtractVersionInfo(const char *qemu,
|
|||
const char *arch,
|
||||
bool check_yajl,
|
||||
unsigned int *version,
|
||||
virBitmapPtr *qemuCaps);
|
||||
qemuCapsPtr *retcaps);
|
||||
|
||||
int qemuCapsParseHelpStr(const char *qemu,
|
||||
const char *str,
|
||||
virBitmapPtr qemuCaps,
|
||||
qemuCapsPtr caps,
|
||||
unsigned int *version,
|
||||
unsigned int *is_kvm,
|
||||
unsigned int *kvm_version,
|
||||
bool check_yajl);
|
||||
int qemuCapsParseDeviceStr(const char *str,
|
||||
virBitmapPtr qemuCaps);
|
||||
qemuCapsPtr caps);
|
||||
|
||||
virCommandPtr qemuCapsProbeCommand(const char *qemu,
|
||||
virBitmapPtr qemuCaps);
|
||||
qemuCapsPtr caps);
|
||||
|
||||
VIR_ENUM_DECL(qemuCaps);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -29,6 +29,7 @@
|
|||
# include "capabilities.h"
|
||||
# include "qemu_conf.h"
|
||||
# include "qemu_domain.h"
|
||||
# include "qemu_capabilities.h"
|
||||
|
||||
/* Config type for XML import/export conversions */
|
||||
# define QEMU_CONFIG_FORMAT_ARGV "qemu-argv"
|
||||
|
@ -53,7 +54,7 @@ virCommandPtr qemuBuildCommandLine(virConnectPtr conn,
|
|||
virDomainDefPtr def,
|
||||
virDomainChrSourceDefPtr monitor_chr,
|
||||
bool monitor_json,
|
||||
virBitmapPtr qemuCaps,
|
||||
qemuCapsPtr caps,
|
||||
const char *migrateFrom,
|
||||
int migrateFd,
|
||||
virDomainSnapshotObjPtr current_snapshot,
|
||||
|
@ -63,14 +64,14 @@ virCommandPtr qemuBuildCommandLine(virConnectPtr conn,
|
|||
/* Generate string for arch-specific '-device' parameter */
|
||||
char *
|
||||
qemuBuildChrDeviceStr (virDomainChrDefPtr serial,
|
||||
virBitmapPtr qemuCaps,
|
||||
qemuCapsPtr caps,
|
||||
char *os_arch,
|
||||
char *machine);
|
||||
|
||||
/* With vlan == -1, use netdev syntax, else old hostnet */
|
||||
char * qemuBuildHostNetStr(virDomainNetDefPtr net,
|
||||
struct qemud_driver *driver,
|
||||
virBitmapPtr qemuCaps,
|
||||
qemuCapsPtr caps,
|
||||
char type_sep,
|
||||
int vlan,
|
||||
const char *tapfd,
|
||||
|
@ -85,50 +86,50 @@ char * qemuBuildNicStr(virDomainNetDefPtr net,
|
|||
char * qemuBuildNicDevStr(virDomainNetDefPtr net,
|
||||
int vlan,
|
||||
int bootindex,
|
||||
virBitmapPtr qemuCaps);
|
||||
qemuCapsPtr caps);
|
||||
|
||||
char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk,
|
||||
virBitmapPtr qemuCaps);
|
||||
qemuCapsPtr caps);
|
||||
|
||||
/* Both legacy & current support */
|
||||
char *qemuBuildDriveStr(virConnectPtr conn,
|
||||
virDomainDiskDefPtr disk,
|
||||
bool bootable,
|
||||
virBitmapPtr qemuCaps);
|
||||
qemuCapsPtr caps);
|
||||
char *qemuBuildFSStr(virDomainFSDefPtr fs,
|
||||
virBitmapPtr qemuCaps);
|
||||
qemuCapsPtr caps);
|
||||
|
||||
/* Current, best practice */
|
||||
char * qemuBuildDriveDevStr(virDomainDefPtr def,
|
||||
virDomainDiskDefPtr disk,
|
||||
int bootindex,
|
||||
virBitmapPtr qemuCaps);
|
||||
qemuCapsPtr caps);
|
||||
char * qemuBuildFSDevStr(virDomainFSDefPtr fs,
|
||||
virBitmapPtr qemuCaps);
|
||||
qemuCapsPtr caps);
|
||||
/* Current, best practice */
|
||||
char * qemuBuildControllerDevStr(virDomainDefPtr domainDef,
|
||||
virDomainControllerDefPtr def,
|
||||
virBitmapPtr qemuCaps,
|
||||
qemuCapsPtr caps,
|
||||
int *nusbcontroller);
|
||||
|
||||
char * qemuBuildWatchdogDevStr(virDomainWatchdogDefPtr dev,
|
||||
virBitmapPtr qemuCaps);
|
||||
qemuCapsPtr caps);
|
||||
|
||||
char * qemuBuildMemballoonDevStr(virDomainMemballoonDefPtr dev,
|
||||
virBitmapPtr qemuCaps);
|
||||
qemuCapsPtr caps);
|
||||
|
||||
char * qemuBuildUSBInputDevStr(virDomainInputDefPtr dev,
|
||||
virBitmapPtr qemuCaps);
|
||||
qemuCapsPtr caps);
|
||||
|
||||
char * qemuBuildSoundDevStr(virDomainSoundDefPtr sound,
|
||||
virBitmapPtr qemuCaps);
|
||||
qemuCapsPtr caps);
|
||||
|
||||
/* Legacy, pre device support */
|
||||
char * qemuBuildPCIHostdevPCIDevStr(virDomainHostdevDefPtr dev);
|
||||
/* Current, best practice */
|
||||
char * qemuBuildPCIHostdevDevStr(virDomainHostdevDefPtr dev,
|
||||
const char *configfd,
|
||||
virBitmapPtr qemuCaps);
|
||||
qemuCapsPtr caps);
|
||||
|
||||
int qemuOpenPCIConfig(virDomainHostdevDefPtr dev);
|
||||
|
||||
|
@ -136,29 +137,29 @@ int qemuOpenPCIConfig(virDomainHostdevDefPtr dev);
|
|||
char * qemuBuildUSBHostdevUsbDevStr(virDomainHostdevDefPtr dev);
|
||||
/* Current, best practice */
|
||||
char * qemuBuildUSBHostdevDevStr(virDomainHostdevDefPtr dev,
|
||||
virBitmapPtr qemuCaps);
|
||||
qemuCapsPtr caps);
|
||||
|
||||
char * qemuBuildHubDevStr(virDomainHubDefPtr dev, virBitmapPtr qemuCaps);
|
||||
char * qemuBuildHubDevStr(virDomainHubDefPtr dev, qemuCapsPtr caps);
|
||||
char * qemuBuildRedirdevDevStr(virDomainDefPtr def,
|
||||
virDomainRedirdevDefPtr dev,
|
||||
virBitmapPtr qemuCaps);
|
||||
qemuCapsPtr caps);
|
||||
|
||||
int qemuNetworkIfaceConnect(virDomainDefPtr def,
|
||||
virConnectPtr conn,
|
||||
struct qemud_driver *driver,
|
||||
virDomainNetDefPtr net,
|
||||
virBitmapPtr qemuCaps)
|
||||
qemuCapsPtr caps)
|
||||
ATTRIBUTE_NONNULL(2);
|
||||
|
||||
int qemuPhysIfaceConnect(virDomainDefPtr def,
|
||||
struct qemud_driver *driver,
|
||||
virDomainNetDefPtr net,
|
||||
virBitmapPtr qemuCaps,
|
||||
qemuCapsPtr caps,
|
||||
enum virNetDevVPortProfileOp vmop);
|
||||
|
||||
int qemuOpenVhostNet(virDomainDefPtr def,
|
||||
virDomainNetDefPtr net,
|
||||
virBitmapPtr qemuCaps,
|
||||
qemuCapsPtr caps,
|
||||
int *vhostfd);
|
||||
|
||||
int qemudCanonicalizeMachine(struct qemud_driver *driver,
|
||||
|
@ -186,13 +187,13 @@ virDomainDefPtr qemuParseCommandLinePid(virCapsPtr caps,
|
|||
bool *monJSON);
|
||||
|
||||
int qemuDomainAssignAddresses(virDomainDefPtr def,
|
||||
virBitmapPtr qemuCaps,
|
||||
qemuCapsPtr caps,
|
||||
virDomainObjPtr);
|
||||
int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def,
|
||||
virBitmapPtr qemuCaps);
|
||||
qemuCapsPtr caps);
|
||||
|
||||
int qemuDomainAssignPCIAddresses(virDomainDefPtr def,
|
||||
virBitmapPtr qemuCaps,
|
||||
qemuCapsPtr caps,
|
||||
virDomainObjPtr obj);
|
||||
qemuDomainPCIAddressSetPtr qemuDomainPCIAddressSetCreate(virDomainDefPtr def);
|
||||
int qemuDomainPCIAddressReserveFunction(qemuDomainPCIAddressSetPtr addrs,
|
||||
|
@ -214,12 +215,12 @@ int qemuDomainPCIAddressReleaseSlot(qemuDomainPCIAddressSetPtr addrs, int slot);
|
|||
void qemuDomainPCIAddressSetFree(qemuDomainPCIAddressSetPtr addrs);
|
||||
int qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs);
|
||||
|
||||
int qemuAssignDeviceAliases(virDomainDefPtr def, virBitmapPtr qemuCaps);
|
||||
int qemuAssignDeviceAliases(virDomainDefPtr def, qemuCapsPtr caps);
|
||||
int qemuDomainNetVLAN(virDomainNetDefPtr def);
|
||||
int qemuAssignDeviceNetAlias(virDomainDefPtr def, virDomainNetDefPtr net, int idx);
|
||||
int qemuAssignDeviceDiskAlias(virDomainDefPtr vmdef,
|
||||
virDomainDiskDefPtr def,
|
||||
virBitmapPtr qemuCaps);
|
||||
qemuCapsPtr caps);
|
||||
int qemuAssignDeviceHostdevAlias(virDomainDefPtr def, virDomainHostdevDefPtr hostdev, int idx);
|
||||
int qemuAssignDeviceControllerAlias(virDomainControllerDefPtr controller);
|
||||
int qemuAssignDeviceRedirdevAlias(virDomainDefPtr def, virDomainRedirdevDefPtr redirdev, int idx);
|
||||
|
|
|
@ -230,7 +230,7 @@ static void qemuDomainObjPrivateFree(void *data)
|
|||
{
|
||||
qemuDomainObjPrivatePtr priv = data;
|
||||
|
||||
qemuCapsFree(priv->qemuCaps);
|
||||
virObjectUnref(priv->caps);
|
||||
|
||||
qemuDomainPCIAddressSetFree(priv->pciaddrs);
|
||||
virDomainChrSourceDefFree(priv->monConfig);
|
||||
|
@ -290,11 +290,11 @@ static int qemuDomainObjPrivateXMLFormat(virBufferPtr buf, void *data)
|
|||
virBufferAddLit(buf, " </vcpus>\n");
|
||||
}
|
||||
|
||||
if (priv->qemuCaps) {
|
||||
if (priv->caps) {
|
||||
int i;
|
||||
virBufferAddLit(buf, " <qemuCaps>\n");
|
||||
for (i = 0 ; i < QEMU_CAPS_LAST ; i++) {
|
||||
if (qemuCapsGet(priv->qemuCaps, i)) {
|
||||
if (qemuCapsGet(priv->caps, i)) {
|
||||
virBufferAsprintf(buf, " <flag name='%s'/>\n",
|
||||
qemuCapsTypeToString(i));
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ static int qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data)
|
|||
char *tmp;
|
||||
int n, i;
|
||||
xmlNodePtr *nodes = NULL;
|
||||
virBitmapPtr qemuCaps = NULL;
|
||||
qemuCapsPtr caps = NULL;
|
||||
|
||||
if (VIR_ALLOC(priv->monConfig) < 0) {
|
||||
virReportOOMError();
|
||||
|
@ -407,7 +407,7 @@ static int qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data)
|
|||
goto error;
|
||||
}
|
||||
if (n > 0) {
|
||||
if (!(qemuCaps = qemuCapsNew()))
|
||||
if (!(caps = qemuCapsNew()))
|
||||
goto error;
|
||||
|
||||
for (i = 0 ; i < n ; i++) {
|
||||
|
@ -421,11 +421,11 @@ static int qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data)
|
|||
goto error;
|
||||
}
|
||||
VIR_FREE(str);
|
||||
qemuCapsSet(qemuCaps, flag);
|
||||
qemuCapsSet(caps, flag);
|
||||
}
|
||||
}
|
||||
|
||||
priv->qemuCaps = qemuCaps;
|
||||
priv->caps = caps;
|
||||
}
|
||||
VIR_FREE(nodes);
|
||||
|
||||
|
@ -476,7 +476,7 @@ error:
|
|||
virDomainChrSourceDefFree(priv->monConfig);
|
||||
priv->monConfig = NULL;
|
||||
VIR_FREE(nodes);
|
||||
qemuCapsFree(qemuCaps);
|
||||
virObjectUnref(caps);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
# include "qemu_monitor.h"
|
||||
# include "qemu_agent.h"
|
||||
# include "qemu_conf.h"
|
||||
# include "bitmap.h"
|
||||
# include "qemu_capabilities.h"
|
||||
# include "virconsole.h"
|
||||
|
||||
# define QEMU_EXPECTED_VIRT_TYPES \
|
||||
|
@ -139,7 +139,7 @@ struct _qemuDomainObjPrivate {
|
|||
qemuDomainPCIAddressSetPtr pciaddrs;
|
||||
int persistentAddrs;
|
||||
|
||||
virBitmapPtr qemuCaps;
|
||||
qemuCapsPtr caps;
|
||||
char *lockState;
|
||||
|
||||
bool fakeReboot;
|
||||
|
|
|
@ -1805,8 +1805,8 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags)
|
|||
}
|
||||
} else {
|
||||
#if HAVE_YAJL
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MONITOR_JSON)) {
|
||||
if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NO_SHUTDOWN)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_MONITOR_JSON)) {
|
||||
if (!qemuCapsGet(priv->caps, QEMU_CAPS_NO_SHUTDOWN)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Reboot is not supported with this QEMU binary"));
|
||||
goto cleanup;
|
||||
|
@ -2328,7 +2328,7 @@ static int qemudDomainGetInfo(virDomainPtr dom,
|
|||
if ((vm->def->memballoon != NULL) &&
|
||||
(vm->def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_NONE)) {
|
||||
info->memory = vm->def->mem.max_balloon;
|
||||
} else if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_BALLOON_EVENT)) {
|
||||
} else if (qemuCapsGet(priv->caps, QEMU_CAPS_BALLOON_EVENT)) {
|
||||
info->memory = vm->def->mem.cur_balloon;
|
||||
} else if (qemuDomainJobAllowed(priv, QEMU_JOB_QUERY)) {
|
||||
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
|
||||
|
@ -3116,7 +3116,7 @@ static int qemuDumpToFd(struct qemud_driver *driver, virDomainObjPtr vm,
|
|||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
int ret = -1;
|
||||
|
||||
if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DUMP_GUEST_MEMORY)) {
|
||||
if (!qemuCapsGet(priv->caps, QEMU_CAPS_DUMP_GUEST_MEMORY)) {
|
||||
virReportError(VIR_ERR_NO_SUPPORT, "%s",
|
||||
_("dump-guest-memory is not supported"));
|
||||
return -1;
|
||||
|
@ -5047,7 +5047,7 @@ static char *qemuDomainGetXMLDesc(virDomainPtr dom,
|
|||
/* Refresh current memory based on balloon info if supported */
|
||||
if ((vm->def->memballoon != NULL) &&
|
||||
(vm->def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_NONE) &&
|
||||
!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_BALLOON_EVENT) &&
|
||||
!qemuCapsGet(priv->caps, QEMU_CAPS_BALLOON_EVENT) &&
|
||||
(virDomainObjIsActive(vm))) {
|
||||
/* Don't delay if someone's using the monitor, just use
|
||||
* existing most recent data instead */
|
||||
|
@ -5133,7 +5133,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
|
|||
struct qemud_driver *driver = conn->privateData;
|
||||
virDomainDefPtr def = NULL;
|
||||
virDomainChrSourceDef monConfig;
|
||||
virBitmapPtr qemuCaps = NULL;
|
||||
qemuCapsPtr caps = NULL;
|
||||
bool monitor_json = false;
|
||||
virCommandPtr cmd = NULL;
|
||||
char *ret = NULL;
|
||||
|
@ -5225,19 +5225,19 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
|
|||
if (qemuCapsExtractVersionInfo(def->emulator, def->os.arch,
|
||||
false,
|
||||
NULL,
|
||||
&qemuCaps) < 0)
|
||||
&caps) < 0)
|
||||
goto cleanup;
|
||||
|
||||
monitor_json = qemuCapsGet(qemuCaps, QEMU_CAPS_MONITOR_JSON);
|
||||
monitor_json = qemuCapsGet(caps, QEMU_CAPS_MONITOR_JSON);
|
||||
|
||||
if (qemuProcessPrepareMonitorChr(driver, &monConfig, def->name) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuAssignDeviceAliases(def, qemuCaps) < 0)
|
||||
if (qemuAssignDeviceAliases(def, caps) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!(cmd = qemuBuildCommandLine(conn, driver, def,
|
||||
&monConfig, monitor_json, qemuCaps,
|
||||
&monConfig, monitor_json, caps,
|
||||
NULL, -1, NULL, VIR_NETDEV_VPORT_PROFILE_OP_NO_OP)))
|
||||
goto cleanup;
|
||||
|
||||
|
@ -5246,7 +5246,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
|
|||
cleanup:
|
||||
qemuDriverUnlock(driver);
|
||||
|
||||
qemuCapsFree(qemuCaps);
|
||||
virObjectUnref(caps);
|
||||
virCommandFree(cmd);
|
||||
virDomainDefFree(def);
|
||||
return ret;
|
||||
|
@ -10580,7 +10580,7 @@ qemuDomainSnapshotDiskPrepare(virDomainObjPtr vm, virDomainSnapshotDefPtr def,
|
|||
int external = 0;
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
|
||||
if (allow_reuse && !qemuCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION)) {
|
||||
if (allow_reuse && !qemuCapsGet(priv->caps, QEMU_CAPS_TRANSACTION)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("reuse is not supported with this QEMU binary"));
|
||||
goto cleanup;
|
||||
|
@ -10661,7 +10661,7 @@ qemuDomainSnapshotDiskPrepare(virDomainObjPtr vm, virDomainSnapshotDefPtr def,
|
|||
}
|
||||
if (active) {
|
||||
if (external == 1 ||
|
||||
qemuCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION)) {
|
||||
qemuCapsGet(priv->caps, QEMU_CAPS_TRANSACTION)) {
|
||||
*flags |= VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC;
|
||||
} else if (atomic && external > 1) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
|
@ -10934,7 +10934,7 @@ qemuDomainSnapshotCreateDiskActive(virConnectPtr conn,
|
|||
goto cleanup;
|
||||
}
|
||||
}
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_TRANSACTION)) {
|
||||
actions = virJSONValueNewArray();
|
||||
if (!actions) {
|
||||
virReportOOMError();
|
||||
|
@ -11034,7 +11034,7 @@ cleanup:
|
|||
}
|
||||
|
||||
if (vm && (ret == 0 ||
|
||||
!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION))) {
|
||||
!qemuCapsGet(priv->caps, QEMU_CAPS_TRANSACTION))) {
|
||||
if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0 ||
|
||||
(persist &&
|
||||
virDomainSaveConfig(driver->configDir, vm->newDef) < 0))
|
||||
|
@ -12616,9 +12616,9 @@ qemuDomainBlockJobImpl(virDomainPtr dom, const char *path, const char *base,
|
|||
}
|
||||
|
||||
priv = vm->privateData;
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKJOB_ASYNC)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_BLOCKJOB_ASYNC)) {
|
||||
async = true;
|
||||
} else if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKJOB_SYNC)) {
|
||||
} else if (!qemuCapsGet(priv->caps, QEMU_CAPS_BLOCKJOB_SYNC)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("block jobs not supported with this QEMU binary"));
|
||||
goto cleanup;
|
||||
|
@ -12880,7 +12880,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
|
|||
goto cleanup;
|
||||
}
|
||||
priv = vm->privateData;
|
||||
if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DRIVE_IOTUNE)) {
|
||||
if (!qemuCapsGet(priv->caps, QEMU_CAPS_DRIVE_IOTUNE)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("block I/O throttling not supported with this "
|
||||
"QEMU binary"));
|
||||
|
@ -13733,7 +13733,7 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom,
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_WAKEUP) &&
|
||||
if (!qemuCapsGet(priv->caps, QEMU_CAPS_WAKEUP) &&
|
||||
(target == VIR_NODE_SUSPEND_TARGET_MEM ||
|
||||
target == VIR_NODE_SUSPEND_TARGET_HYBRID)) {
|
||||
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
|
||||
|
@ -13829,7 +13829,7 @@ qemuDomainPMWakeup(virDomainPtr dom,
|
|||
|
||||
priv = vm->privateData;
|
||||
|
||||
if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_WAKEUP)) {
|
||||
if (!qemuCapsGet(priv->caps, QEMU_CAPS_WAKEUP)) {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("Unable to wake up domain due to "
|
||||
"missing system_wakeup monitor command"));
|
||||
|
|
|
@ -98,7 +98,7 @@ int qemuDomainChangeEjectableMedia(struct qemud_driver *driver,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (!(driveAlias = qemuDeviceDriveHostAlias(origdisk, priv->qemuCaps)))
|
||||
if (!(driveAlias = qemuDeviceDriveHostAlias(origdisk, priv->caps)))
|
||||
goto error;
|
||||
|
||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
|
@ -227,17 +227,17 @@ int qemuDomainAttachPciDiskDevice(virConnectPtr conn,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuDomainPCIAddressEnsureAddr(priv->pciaddrs, &disk->info) < 0)
|
||||
goto error;
|
||||
releaseaddr = true;
|
||||
if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->qemuCaps) < 0)
|
||||
if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->caps) < 0)
|
||||
goto error;
|
||||
|
||||
if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->qemuCaps)))
|
||||
if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->caps)))
|
||||
goto error;
|
||||
|
||||
if (!(devstr = qemuBuildDriveDevStr(NULL, disk, 0, priv->qemuCaps)))
|
||||
if (!(devstr = qemuBuildDriveDevStr(NULL, disk, 0, priv->caps)))
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ int qemuDomainAttachPciDiskDevice(virConnectPtr conn,
|
|||
}
|
||||
|
||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
ret = qemuMonitorAddDrive(priv->mon, drivestr);
|
||||
if (ret == 0) {
|
||||
ret = qemuMonitorAddDevice(priv->mon, devstr);
|
||||
|
@ -287,7 +287,7 @@ error:
|
|||
VIR_FREE(devstr);
|
||||
VIR_FREE(drivestr);
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) &&
|
||||
(disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) &&
|
||||
releaseaddr &&
|
||||
qemuDomainPCIAddressReleaseSlot(priv->pciaddrs,
|
||||
|
@ -322,7 +322,7 @@ int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuDomainPCIAddressEnsureAddr(priv->pciaddrs, &controller->info) < 0)
|
||||
goto cleanup;
|
||||
releaseaddr = true;
|
||||
|
@ -331,13 +331,13 @@ int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver,
|
|||
|
||||
if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
|
||||
controller->model == -1 &&
|
||||
!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) {
|
||||
!qemuCapsGet(priv->caps, QEMU_CAPS_PIIX3_USB_UHCI)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("USB controller hotplug unsupported in this QEMU binary"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(devstr = qemuBuildControllerDevStr(vm->def, controller, priv->qemuCaps, NULL))) {
|
||||
if (!(devstr = qemuBuildControllerDevStr(vm->def, controller, priv->caps, NULL))) {
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver,
|
|||
}
|
||||
|
||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
ret = qemuMonitorAddDevice(priv->mon, devstr);
|
||||
} else {
|
||||
ret = qemuMonitorAttachPCIDiskController(priv->mon,
|
||||
|
@ -364,7 +364,7 @@ int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver,
|
|||
|
||||
cleanup:
|
||||
if ((ret != 0) &&
|
||||
qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
|
||||
qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) &&
|
||||
(controller->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) &&
|
||||
releaseaddr &&
|
||||
qemuDomainPCIAddressReleaseSlot(priv->pciaddrs,
|
||||
|
@ -461,14 +461,14 @@ int qemuDomainAttachSCSIDisk(virConnectPtr conn,
|
|||
goto error;
|
||||
}
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->qemuCaps) < 0)
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->caps) < 0)
|
||||
goto error;
|
||||
if (!(devstr = qemuBuildDriveDevStr(vm->def, disk, 0, priv->qemuCaps)))
|
||||
if (!(devstr = qemuBuildDriveDevStr(vm->def, disk, 0, priv->caps)))
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->qemuCaps)))
|
||||
if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->caps)))
|
||||
goto error;
|
||||
|
||||
for (i = 0 ; i <= disk->info.addr.drive.controller ; i++) {
|
||||
|
@ -494,7 +494,7 @@ int qemuDomainAttachSCSIDisk(virConnectPtr conn,
|
|||
}
|
||||
|
||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
ret = qemuMonitorAddDrive(priv->mon, drivestr);
|
||||
if (ret == 0) {
|
||||
ret = qemuMonitorAddDevice(priv->mon, devstr);
|
||||
|
@ -583,12 +583,12 @@ int qemuDomainAttachUsbMassstorageDevice(virConnectPtr conn,
|
|||
goto error;
|
||||
}
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->qemuCaps) < 0)
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->caps) < 0)
|
||||
goto error;
|
||||
if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->qemuCaps)))
|
||||
if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->caps)))
|
||||
goto error;
|
||||
if (!(devstr = qemuBuildDriveDevStr(NULL, disk, 0, priv->qemuCaps)))
|
||||
if (!(devstr = qemuBuildDriveDevStr(NULL, disk, 0, priv->caps)))
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -598,7 +598,7 @@ int qemuDomainAttachUsbMassstorageDevice(virConnectPtr conn,
|
|||
}
|
||||
|
||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
ret = qemuMonitorAddDrive(priv->mon, drivestr);
|
||||
if (ret == 0) {
|
||||
ret = qemuMonitorAddDevice(priv->mon, devstr);
|
||||
|
@ -688,7 +688,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_HOST_NET_ADD)) {
|
||||
if (!qemuCapsGet(priv->caps, QEMU_CAPS_HOST_NET_ADD)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("installed qemu version does not support host_net_add"));
|
||||
goto cleanup;
|
||||
|
@ -703,38 +703,38 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
|
|||
*/
|
||||
if (actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
|
||||
driver->privileged ||
|
||||
(!qemuCapsGet (priv->qemuCaps, QEMU_CAPS_NETDEV_BRIDGE))) {
|
||||
(!qemuCapsGet (priv->caps, QEMU_CAPS_NETDEV_BRIDGE))) {
|
||||
if ((tapfd = qemuNetworkIfaceConnect(vm->def, conn, driver, net,
|
||||
priv->qemuCaps)) < 0)
|
||||
priv->caps)) < 0)
|
||||
goto cleanup;
|
||||
iface_connected = true;
|
||||
if (qemuOpenVhostNet(vm->def, net, priv->qemuCaps, &vhostfd) < 0)
|
||||
if (qemuOpenVhostNet(vm->def, net, priv->caps, &vhostfd) < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
} else if (actualType == VIR_DOMAIN_NET_TYPE_DIRECT) {
|
||||
if ((tapfd = qemuPhysIfaceConnect(vm->def, driver, net,
|
||||
priv->qemuCaps,
|
||||
priv->caps,
|
||||
VIR_NETDEV_VPORT_PROFILE_OP_CREATE)) < 0)
|
||||
goto cleanup;
|
||||
iface_connected = true;
|
||||
if (qemuOpenVhostNet(vm->def, net, priv->qemuCaps, &vhostfd) < 0)
|
||||
if (qemuOpenVhostNet(vm->def, net, priv->caps, &vhostfd) < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NET_NAME) ||
|
||||
qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_NET_NAME) ||
|
||||
qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuAssignDeviceNetAlias(vm->def, net, -1) < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) &&
|
||||
qemuDomainPCIAddressEnsureAddr(priv->pciaddrs, &net->info) < 0)
|
||||
goto cleanup;
|
||||
|
||||
releaseaddr = true;
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV) &&
|
||||
qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_NETDEV) &&
|
||||
qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
vlan = -1;
|
||||
} else {
|
||||
vlan = qemuDomainNetVLAN(net);
|
||||
|
@ -756,22 +756,22 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
|
|||
goto no_memory;
|
||||
}
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV) &&
|
||||
qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (!(netstr = qemuBuildHostNetStr(net, driver, priv->qemuCaps,
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_NETDEV) &&
|
||||
qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
if (!(netstr = qemuBuildHostNetStr(net, driver, priv->caps,
|
||||
',', -1, tapfd_name,
|
||||
vhostfd_name)))
|
||||
goto cleanup;
|
||||
} else {
|
||||
if (!(netstr = qemuBuildHostNetStr(net, driver, priv->qemuCaps,
|
||||
if (!(netstr = qemuBuildHostNetStr(net, driver, priv->caps,
|
||||
' ', vlan, tapfd_name,
|
||||
vhostfd_name)))
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV) &&
|
||||
qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_NETDEV) &&
|
||||
qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuMonitorAddNetdev(priv->mon, netstr, tapfd, tapfd_name,
|
||||
vhostfd, vhostfd_name) < 0) {
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
|
@ -797,8 +797,8 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (!(nicstr = qemuBuildNicDevStr(net, vlan, 0, priv->qemuCaps)))
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
if (!(nicstr = qemuBuildNicDevStr(net, vlan, 0, priv->caps)))
|
||||
goto try_remove;
|
||||
} else {
|
||||
if (!(nicstr = qemuBuildNicStr(net, NULL, vlan)))
|
||||
|
@ -806,7 +806,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
|
|||
}
|
||||
|
||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuMonitorAddDevice(priv->mon, nicstr) < 0) {
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
virDomainAuditNet(vm, NULL, net, "attach", false);
|
||||
|
@ -833,7 +833,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
|
|||
} else {
|
||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_NETDEV)) {
|
||||
if (qemuMonitorSetLink(priv->mon, net->info.alias, VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN) < 0) {
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
virDomainAuditNet(vm, NULL, net, "attach", false);
|
||||
|
@ -857,7 +857,7 @@ cleanup:
|
|||
if (!ret) {
|
||||
vm->def->nets[vm->def->nnets++] = net;
|
||||
} else {
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) &&
|
||||
(net->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) &&
|
||||
releaseaddr &&
|
||||
qemuDomainPCIAddressReleaseSlot(priv->pciaddrs,
|
||||
|
@ -890,8 +890,8 @@ try_remove:
|
|||
goto cleanup;
|
||||
|
||||
if (vlan < 0) {
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV) &&
|
||||
qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_NETDEV) &&
|
||||
qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
char *netdev_name;
|
||||
if (virAsprintf(&netdev_name, "host%s", net->info.alias) < 0)
|
||||
goto no_memory;
|
||||
|
@ -943,13 +943,13 @@ int qemuDomainAttachHostPciDevice(struct qemud_driver *driver,
|
|||
&hostdev, 1) < 0)
|
||||
return -1;
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuAssignDeviceHostdevAlias(vm->def, hostdev, -1) < 0)
|
||||
goto error;
|
||||
if (qemuDomainPCIAddressEnsureAddr(priv->pciaddrs, hostdev->info) < 0)
|
||||
goto error;
|
||||
releaseaddr = true;
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_PCI_CONFIGFD)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_PCI_CONFIGFD)) {
|
||||
configfd = qemuOpenPCIConfig(hostdev);
|
||||
if (configfd >= 0) {
|
||||
if (virAsprintf(&configfd_name, "fd-%s",
|
||||
|
@ -967,7 +967,7 @@ int qemuDomainAttachHostPciDevice(struct qemud_driver *driver,
|
|||
}
|
||||
|
||||
if (!(devstr = qemuBuildPCIHostdevDevStr(hostdev, configfd_name,
|
||||
priv->qemuCaps)))
|
||||
priv->caps)))
|
||||
goto error;
|
||||
|
||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
|
@ -999,7 +999,7 @@ int qemuDomainAttachHostPciDevice(struct qemud_driver *driver,
|
|||
return 0;
|
||||
|
||||
error:
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) &&
|
||||
(hostdev->info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) &&
|
||||
releaseaddr &&
|
||||
qemuDomainPCIAddressReleaseSlot(priv->pciaddrs,
|
||||
|
@ -1025,10 +1025,10 @@ int qemuDomainAttachRedirdevDevice(struct qemud_driver *driver,
|
|||
virDomainDefPtr def = vm->def;
|
||||
char *devstr = NULL;
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuAssignDeviceRedirdevAlias(vm->def, redirdev, -1) < 0)
|
||||
goto error;
|
||||
if (!(devstr = qemuBuildRedirdevDevStr(def, redirdev, priv->qemuCaps)))
|
||||
if (!(devstr = qemuBuildRedirdevDevStr(def, redirdev, priv->caps)))
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -1038,7 +1038,7 @@ int qemuDomainAttachRedirdevDevice(struct qemud_driver *driver,
|
|||
}
|
||||
|
||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE))
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE))
|
||||
ret = qemuMonitorAddDevice(priv->mon, devstr);
|
||||
else
|
||||
goto error;
|
||||
|
@ -1068,10 +1068,10 @@ int qemuDomainAttachHostUsbDevice(struct qemud_driver *driver,
|
|||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
char *devstr = NULL;
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuAssignDeviceHostdevAlias(vm->def, hostdev, -1) < 0)
|
||||
goto error;
|
||||
if (!(devstr = qemuBuildUSBHostdevDevStr(hostdev, priv->qemuCaps)))
|
||||
if (!(devstr = qemuBuildUSBHostdevDevStr(hostdev, priv->caps)))
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -1103,7 +1103,7 @@ int qemuDomainAttachHostUsbDevice(struct qemud_driver *driver,
|
|||
}
|
||||
|
||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE))
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE))
|
||||
ret = qemuMonitorAddDevice(priv->mon, devstr);
|
||||
else
|
||||
ret = qemuMonitorAddUSBDeviceExact(priv->mon,
|
||||
|
@ -1697,7 +1697,7 @@ int qemuDomainDetachPciDiskDevice(struct qemud_driver *driver,
|
|||
}
|
||||
|
||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) {
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
virDomainAuditDisk(vm, detach->src, NULL, "detach", false);
|
||||
|
@ -1719,7 +1719,7 @@ int qemuDomainDetachPciDiskDevice(struct qemud_driver *driver,
|
|||
|
||||
virDomainAuditDisk(vm, detach->src, NULL, "detach", true);
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) &&
|
||||
qemuDomainPCIAddressReleaseSlot(priv->pciaddrs,
|
||||
detach->info.addr.pci.slot) < 0)
|
||||
VIR_WARN("Unable to release PCI address on %s", dev->data.disk->src);
|
||||
|
@ -1767,7 +1767,7 @@ int qemuDomainDetachDiskDevice(struct qemud_driver *driver,
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (!qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("Underlying qemu does not support %s disk removal"),
|
||||
virDomainDiskBusTypeToString(dev->data.disk->bus));
|
||||
|
@ -1922,13 +1922,13 @@ int qemuDomainDetachPciControllerDevice(struct qemud_driver *driver,
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuAssignDeviceControllerAlias(detach) < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuMonitorDelDevice(priv->mon, detach->info.alias)) {
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
goto cleanup;
|
||||
|
@ -1945,7 +1945,7 @@ int qemuDomainDetachPciControllerDevice(struct qemud_driver *driver,
|
|||
virDomainControllerRemove(vm->def, idx);
|
||||
virDomainControllerDefFree(detach);
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) &&
|
||||
qemuDomainPCIAddressReleaseSlot(priv->pciaddrs,
|
||||
detach->info.addr.pci.slot) < 0)
|
||||
VIR_WARN("Unable to release PCI address on controller");
|
||||
|
@ -1983,7 +1983,7 @@ qemuDomainDetachHostPciDevice(struct qemud_driver *driver,
|
|||
}
|
||||
|
||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
ret = qemuMonitorDelDevice(priv->mon, detach->info->alias);
|
||||
} else {
|
||||
ret = qemuMonitorRemovePCIDevice(priv->mon, &detach->info->addr.pci);
|
||||
|
@ -2018,7 +2018,7 @@ qemuDomainDetachHostPciDevice(struct qemud_driver *driver,
|
|||
ret = -1;
|
||||
}
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) &&
|
||||
qemuDomainPCIAddressReleaseSlot(priv->pciaddrs,
|
||||
detach->info->addr.pci.slot) < 0)
|
||||
VIR_WARN("Unable to release PCI address on host device");
|
||||
|
@ -2042,7 +2042,7 @@ qemuDomainDetachHostUsbDevice(struct qemud_driver *driver,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (!qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("device cannot be detached with this QEMU version"));
|
||||
return -1;
|
||||
|
@ -2233,7 +2233,7 @@ qemuDomainDetachNetDevice(struct qemud_driver *driver,
|
|||
}
|
||||
|
||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) {
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
virDomainAuditNet(vm, detach, NULL, "detach", false);
|
||||
|
@ -2248,8 +2248,8 @@ qemuDomainDetachNetDevice(struct qemud_driver *driver,
|
|||
}
|
||||
}
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV) &&
|
||||
qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_NETDEV) &&
|
||||
qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuMonitorRemoveNetdev(priv->mon, hostnet_name) < 0) {
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
virDomainAuditNet(vm, detach, NULL, "detach", false);
|
||||
|
@ -2266,7 +2266,7 @@ qemuDomainDetachNetDevice(struct qemud_driver *driver,
|
|||
|
||||
virDomainAuditNet(vm, detach, NULL, "detach", true);
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) &&
|
||||
qemuDomainPCIAddressReleaseSlot(priv->pciaddrs,
|
||||
detach->info.addr.pci.slot) < 0)
|
||||
VIR_WARN("Unable to release PCI address on NIC");
|
||||
|
|
|
@ -1905,7 +1905,7 @@ qemuMigrationRun(struct qemud_driver *driver,
|
|||
break;
|
||||
|
||||
case MIGRATION_DEST_UNIX:
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_UNIX)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_MIGRATE_QEMU_UNIX)) {
|
||||
ret = qemuMonitorMigrateToUnix(priv->mon, migrate_flags,
|
||||
spec->dest.unix_socket.file);
|
||||
} else {
|
||||
|
@ -2058,7 +2058,7 @@ static int doNativeMigrate(struct qemud_driver *driver,
|
|||
if (!uribits)
|
||||
return -1;
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD))
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_MIGRATE_QEMU_FD))
|
||||
spec.destType = MIGRATION_DEST_CONNECT_HOST;
|
||||
else
|
||||
spec.destType = MIGRATION_DEST_HOST;
|
||||
|
@ -2099,9 +2099,9 @@ static int doTunnelMigrate(struct qemud_driver *driver,
|
|||
driver, vm, st, NULLSTR(cookiein), cookieinlen,
|
||||
cookieout, cookieoutlen, flags, resource);
|
||||
|
||||
if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD) &&
|
||||
!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_UNIX) &&
|
||||
!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_EXEC)) {
|
||||
if (!qemuCapsGet(priv->caps, QEMU_CAPS_MIGRATE_QEMU_FD) &&
|
||||
!qemuCapsGet(priv->caps, QEMU_CAPS_MIGRATE_QEMU_UNIX) &&
|
||||
!qemuCapsGet(priv->caps, QEMU_CAPS_MIGRATE_QEMU_EXEC)) {
|
||||
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
|
||||
_("Source qemu is too old to support tunnelled migration"));
|
||||
return -1;
|
||||
|
@ -2110,7 +2110,7 @@ static int doTunnelMigrate(struct qemud_driver *driver,
|
|||
spec.fwdType = MIGRATION_FWD_STREAM;
|
||||
spec.fwd.stream = st;
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_MIGRATE_QEMU_FD)) {
|
||||
int fds[2];
|
||||
|
||||
spec.destType = MIGRATION_DEST_FD;
|
||||
|
@ -3192,7 +3192,7 @@ qemuMigrationToFile(struct qemud_driver *driver, virDomainObjPtr vm,
|
|||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
}
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD) &&
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_MIGRATE_QEMU_FD) &&
|
||||
(!compressor || pipe(pipeFD) == 0)) {
|
||||
/* All right! We can use fd migration, which means that qemu
|
||||
* doesn't have to open() the file, so while we still have to
|
||||
|
@ -3243,7 +3243,7 @@ qemuMigrationToFile(struct qemud_driver *driver, virDomainObjPtr vm,
|
|||
if (!compressor) {
|
||||
const char *args[] = { "cat", NULL };
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD) &&
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_MIGRATE_QEMU_FD) &&
|
||||
priv->monConfig->type == VIR_DOMAIN_CHR_TYPE_UNIX) {
|
||||
rc = qemuMonitorMigrateToFd(priv->mon,
|
||||
QEMU_MONITOR_MIGRATE_BACKGROUND,
|
||||
|
|
|
@ -1128,7 +1128,7 @@ int qemuMonitorEmitBalloonChange(qemuMonitorPtr mon,
|
|||
|
||||
|
||||
int qemuMonitorSetCapabilities(qemuMonitorPtr mon,
|
||||
virBitmapPtr qemuCaps)
|
||||
qemuCapsPtr caps)
|
||||
{
|
||||
int ret;
|
||||
int json_hmp;
|
||||
|
@ -1145,12 +1145,12 @@ int qemuMonitorSetCapabilities(qemuMonitorPtr mon,
|
|||
if (ret < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = qemuMonitorJSONCheckCommands(mon, qemuCaps, &json_hmp);
|
||||
ret = qemuMonitorJSONCheckCommands(mon, caps, &json_hmp);
|
||||
if (ret < 0)
|
||||
goto cleanup;
|
||||
mon->json_hmp = json_hmp > 0;
|
||||
|
||||
ret = qemuMonitorJSONCheckEvents(mon, qemuCaps);
|
||||
ret = qemuMonitorJSONCheckEvents(mon, caps);
|
||||
if (ret < 0)
|
||||
goto cleanup;
|
||||
} else {
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
# include "internal.h"
|
||||
|
||||
# include "qemu_capabilities.h"
|
||||
# include "domain_conf.h"
|
||||
# include "qemu_conf.h"
|
||||
# include "bitmap.h"
|
||||
|
@ -156,7 +157,7 @@ qemuMonitorPtr qemuMonitorOpenFD(virDomainObjPtr vm,
|
|||
void qemuMonitorClose(qemuMonitorPtr mon);
|
||||
|
||||
int qemuMonitorSetCapabilities(qemuMonitorPtr mon,
|
||||
virBitmapPtr qemuCaps);
|
||||
qemuCapsPtr caps);
|
||||
|
||||
int qemuMonitorCheckHMP(qemuMonitorPtr mon, const char *cmd);
|
||||
|
||||
|
|
|
@ -967,7 +967,7 @@ qemuMonitorJSONSetCapabilities(qemuMonitorPtr mon)
|
|||
*/
|
||||
int
|
||||
qemuMonitorJSONCheckCommands(qemuMonitorPtr mon,
|
||||
virBitmapPtr qemuCaps,
|
||||
qemuCapsPtr caps,
|
||||
int *json_hmp)
|
||||
{
|
||||
int ret = -1;
|
||||
|
@ -999,15 +999,15 @@ qemuMonitorJSONCheckCommands(qemuMonitorPtr mon,
|
|||
if (STREQ(name, "human-monitor-command"))
|
||||
*json_hmp = 1;
|
||||
else if (STREQ(name, "system_wakeup"))
|
||||
qemuCapsSet(qemuCaps, QEMU_CAPS_WAKEUP);
|
||||
qemuCapsSet(caps, QEMU_CAPS_WAKEUP);
|
||||
else if (STREQ(name, "transaction"))
|
||||
qemuCapsSet(qemuCaps, QEMU_CAPS_TRANSACTION);
|
||||
qemuCapsSet(caps, QEMU_CAPS_TRANSACTION);
|
||||
else if (STREQ(name, "block_job_cancel"))
|
||||
qemuCapsSet(qemuCaps, QEMU_CAPS_BLOCKJOB_SYNC);
|
||||
qemuCapsSet(caps, QEMU_CAPS_BLOCKJOB_SYNC);
|
||||
else if (STREQ(name, "block-job-cancel"))
|
||||
qemuCapsSet(qemuCaps, QEMU_CAPS_BLOCKJOB_ASYNC);
|
||||
qemuCapsSet(caps, QEMU_CAPS_BLOCKJOB_ASYNC);
|
||||
else if (STREQ(name, "dump-guest-memory"))
|
||||
qemuCapsSet(qemuCaps, QEMU_CAPS_DUMP_GUEST_MEMORY);
|
||||
qemuCapsSet(caps, QEMU_CAPS_DUMP_GUEST_MEMORY);
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
@ -1021,7 +1021,7 @@ cleanup:
|
|||
|
||||
int
|
||||
qemuMonitorJSONCheckEvents(qemuMonitorPtr mon,
|
||||
virBitmapPtr qemuCaps)
|
||||
qemuCapsPtr caps)
|
||||
{
|
||||
int ret = -1;
|
||||
virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("query-events", NULL);
|
||||
|
@ -1057,7 +1057,7 @@ qemuMonitorJSONCheckEvents(qemuMonitorPtr mon,
|
|||
goto cleanup;
|
||||
|
||||
if (STREQ(name, "BALLOON_CHANGE"))
|
||||
qemuCapsSet(qemuCaps, QEMU_CAPS_BALLOON_EVENT);
|
||||
qemuCapsSet(caps, QEMU_CAPS_BALLOON_EVENT);
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
|
|
@ -43,10 +43,10 @@ int qemuMonitorJSONHumanCommandWithFd(qemuMonitorPtr mon,
|
|||
int qemuMonitorJSONSetCapabilities(qemuMonitorPtr mon);
|
||||
|
||||
int qemuMonitorJSONCheckCommands(qemuMonitorPtr mon,
|
||||
virBitmapPtr qemuCaps,
|
||||
qemuCapsPtr caps,
|
||||
int *json_hmp);
|
||||
int qemuMonitorJSONCheckEvents(qemuMonitorPtr mon,
|
||||
virBitmapPtr qemuCaps);
|
||||
qemuCapsPtr caps);
|
||||
|
||||
int qemuMonitorJSONStartCPUs(qemuMonitorPtr mon,
|
||||
virConnectPtr conn);
|
||||
|
|
|
@ -1262,7 +1262,7 @@ qemuConnectMonitor(struct qemud_driver *driver, virDomainObjPtr vm)
|
|||
|
||||
|
||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
ret = qemuMonitorSetCapabilities(priv->mon, priv->qemuCaps);
|
||||
ret = qemuMonitorSetCapabilities(priv->mon, priv->caps);
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
|
||||
error:
|
||||
|
@ -1472,10 +1472,10 @@ qemuProcessLookupPTYs(virDomainChrDefPtr *devices,
|
|||
|
||||
static int
|
||||
qemuProcessFindCharDevicePTYsMonitor(virDomainObjPtr vm,
|
||||
virBitmapPtr qemuCaps,
|
||||
qemuCapsPtr caps,
|
||||
virHashTablePtr paths)
|
||||
{
|
||||
bool chardevfmt = qemuCapsGet(qemuCaps, QEMU_CAPS_CHARDEV);
|
||||
bool chardevfmt = qemuCapsGet(caps, QEMU_CAPS_CHARDEV);
|
||||
|
||||
if (qemuProcessLookupPTYs(vm->def->serials, vm->def->nserials,
|
||||
paths, chardevfmt) < 0)
|
||||
|
@ -1584,7 +1584,7 @@ qemuProcessReadLogFD(int logfd, char *buf, int maxlen, int off)
|
|||
static int
|
||||
qemuProcessWaitForMonitor(struct qemud_driver* driver,
|
||||
virDomainObjPtr vm,
|
||||
virBitmapPtr qemuCaps,
|
||||
qemuCapsPtr caps,
|
||||
off_t pos)
|
||||
{
|
||||
char *buf = NULL;
|
||||
|
@ -1629,7 +1629,7 @@ qemuProcessWaitForMonitor(struct qemud_driver* driver,
|
|||
|
||||
VIR_DEBUG("qemuMonitorGetPtyPaths returned %i", ret);
|
||||
if (ret == 0)
|
||||
ret = qemuProcessFindCharDevicePTYsMonitor(vm, qemuCaps, paths);
|
||||
ret = qemuProcessFindCharDevicePTYsMonitor(vm, caps, paths);
|
||||
|
||||
cleanup:
|
||||
virHashFree(paths);
|
||||
|
@ -1930,7 +1930,7 @@ qemuProcessSetLinkStates(virDomainObjPtr vm)
|
|||
if (def->nets[i]->linkstate == VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN) {
|
||||
VIR_DEBUG("Setting link state: %s", def->nets[i]->info.alias);
|
||||
|
||||
if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV)) {
|
||||
if (!qemuCapsGet(priv->caps, QEMU_CAPS_NETDEV)) {
|
||||
virReportError(VIR_ERR_NO_SUPPORT, "%s",
|
||||
_("Setting of link state is not supported by this qemu"));
|
||||
return -1;
|
||||
|
@ -2091,7 +2091,7 @@ qemuProcessInitPasswords(virConnectPtr conn,
|
|||
if (ret < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i < vm->def->ndisks ; i++) {
|
||||
|
@ -3163,11 +3163,11 @@ qemuProcessReconnect(void *opaque)
|
|||
/* If upgrading from old libvirtd we won't have found any
|
||||
* caps in the domain status, so re-query them
|
||||
*/
|
||||
if (!priv->qemuCaps &&
|
||||
if (!priv->caps &&
|
||||
qemuCapsExtractVersionInfo(obj->def->emulator, obj->def->os.arch,
|
||||
false,
|
||||
NULL,
|
||||
&priv->qemuCaps) < 0)
|
||||
&priv->caps) < 0)
|
||||
goto error;
|
||||
|
||||
/* In case the domain shutdown while we were not running,
|
||||
|
@ -3183,8 +3183,8 @@ qemuProcessReconnect(void *opaque)
|
|||
goto endjob;
|
||||
}
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE))
|
||||
if ((qemuDomainAssignAddresses(obj->def, priv->qemuCaps, obj)) < 0)
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE))
|
||||
if ((qemuDomainAssignAddresses(obj->def, priv->caps, obj)) < 0)
|
||||
goto error;
|
||||
|
||||
if (virSecurityManagerReserveLabel(driver->securityManager, obj->def, obj->pid) < 0)
|
||||
|
@ -3256,7 +3256,7 @@ error:
|
|||
* to remove danger of it ending up running twice if
|
||||
* user tries to start it again later
|
||||
*/
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NO_SHUTDOWN)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_NO_SHUTDOWN)) {
|
||||
/* If we couldn't get the monitor and qemu supports
|
||||
* no-shutdown, we can safely say that the domain
|
||||
* crashed ... */
|
||||
|
@ -3563,15 +3563,15 @@ int qemuProcessStart(virConnectPtr conn,
|
|||
}
|
||||
|
||||
VIR_DEBUG("Determining emulator version");
|
||||
qemuCapsFree(priv->qemuCaps);
|
||||
priv->qemuCaps = NULL;
|
||||
virObjectUnref(priv->caps);
|
||||
priv->caps = NULL;
|
||||
if (qemuCapsExtractVersionInfo(vm->def->emulator, vm->def->os.arch,
|
||||
true,
|
||||
NULL,
|
||||
&priv->qemuCaps) < 0)
|
||||
&priv->caps) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuAssignDeviceAliases(vm->def, priv->qemuCaps) < 0)
|
||||
if (qemuAssignDeviceAliases(vm->def, priv->caps) < 0)
|
||||
goto cleanup;
|
||||
|
||||
VIR_DEBUG("Checking for CDROM and floppy presence");
|
||||
|
@ -3616,7 +3616,7 @@ int qemuProcessStart(virConnectPtr conn,
|
|||
if (qemuProcessPrepareMonitorChr(driver, priv->monConfig, vm->def->name) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MONITOR_JSON))
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_MONITOR_JSON))
|
||||
priv->monJSON = 1;
|
||||
else
|
||||
priv->monJSON = 0;
|
||||
|
@ -3647,15 +3647,15 @@ int qemuProcessStart(virConnectPtr conn,
|
|||
* we also need to populate the PCi address set cache for later
|
||||
* use in hotplug
|
||||
*/
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
VIR_DEBUG("Assigning domain PCI addresses");
|
||||
if ((qemuDomainAssignAddresses(vm->def, priv->qemuCaps, vm)) < 0)
|
||||
if ((qemuDomainAssignAddresses(vm->def, priv->caps, vm)) < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
VIR_DEBUG("Building emulator command line");
|
||||
if (!(cmd = qemuBuildCommandLine(conn, driver, vm->def, priv->monConfig,
|
||||
priv->monJSON != 0, priv->qemuCaps,
|
||||
priv->monJSON != 0, priv->caps,
|
||||
migrateFrom, stdin_fd, snapshot, vmop)))
|
||||
goto cleanup;
|
||||
|
||||
|
@ -3800,7 +3800,7 @@ int qemuProcessStart(virConnectPtr conn,
|
|||
goto cleanup;
|
||||
|
||||
VIR_DEBUG("Waiting for monitor to show up");
|
||||
if (qemuProcessWaitForMonitor(driver, vm, priv->qemuCaps, pos) < 0)
|
||||
if (qemuProcessWaitForMonitor(driver, vm, priv->caps, pos) < 0)
|
||||
goto cleanup;
|
||||
|
||||
/* Failure to connect to agent shouldn't be fatal */
|
||||
|
@ -3837,7 +3837,7 @@ int qemuProcessStart(virConnectPtr conn,
|
|||
|
||||
/* If we have -device, then addresses are assigned explicitly.
|
||||
* If not, then we have to detect dynamic ones here */
|
||||
if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (!qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
VIR_DEBUG("Determining domain device PCI addresses");
|
||||
if (qemuProcessInitPCIAddresses(driver, vm) < 0)
|
||||
goto cleanup;
|
||||
|
@ -4222,8 +4222,8 @@ retry:
|
|||
virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF, reason);
|
||||
VIR_FREE(priv->vcpupids);
|
||||
priv->nvcpupids = 0;
|
||||
qemuCapsFree(priv->qemuCaps);
|
||||
priv->qemuCaps = NULL;
|
||||
virObjectUnref(priv->caps);
|
||||
priv->caps = NULL;
|
||||
VIR_FREE(priv->pidfile);
|
||||
|
||||
/* The "release" hook cleans up additional resources */
|
||||
|
@ -4333,13 +4333,13 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||
goto cleanup;
|
||||
|
||||
VIR_DEBUG("Determining emulator version");
|
||||
qemuCapsFree(priv->qemuCaps);
|
||||
priv->qemuCaps = NULL;
|
||||
virObjectUnref(priv->caps);
|
||||
priv->caps = NULL;
|
||||
if (qemuCapsExtractVersionInfo(vm->def->emulator,
|
||||
vm->def->os.arch,
|
||||
false,
|
||||
NULL,
|
||||
&priv->qemuCaps) < 0)
|
||||
&priv->caps) < 0)
|
||||
goto cleanup;
|
||||
|
||||
VIR_DEBUG("Preparing monitor state");
|
||||
|
@ -4356,9 +4356,9 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||
* we also need to populate the PCi address set cache for later
|
||||
* use in hotplug
|
||||
*/
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
VIR_DEBUG("Assigning domain PCI addresses");
|
||||
if ((qemuDomainAssignAddresses(vm->def, priv->qemuCaps, vm)) < 0)
|
||||
if ((qemuDomainAssignAddresses(vm->def, priv->caps, vm)) < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -4380,7 +4380,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||
vm->pid = pid;
|
||||
|
||||
VIR_DEBUG("Waiting for monitor to show up");
|
||||
if (qemuProcessWaitForMonitor(driver, vm, priv->qemuCaps, -1) < 0)
|
||||
if (qemuProcessWaitForMonitor(driver, vm, priv->caps, -1) < 0)
|
||||
goto cleanup;
|
||||
|
||||
/* Failure to connect to agent shouldn't be fatal */
|
||||
|
@ -4397,7 +4397,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||
|
||||
/* If we have -device, then addresses are assigned explicitly.
|
||||
* If not, then we have to detect dynamic ones here */
|
||||
if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (!qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||
VIR_DEBUG("Determining domain device PCI addresses");
|
||||
if (qemuProcessInitPCIAddresses(driver, vm) < 0)
|
||||
goto cleanup;
|
||||
|
|
|
@ -11,14 +11,14 @@
|
|||
|
||||
struct testInfo {
|
||||
const char *name;
|
||||
virBitmapPtr flags;
|
||||
qemuCapsPtr flags;
|
||||
unsigned int version;
|
||||
unsigned int is_kvm;
|
||||
unsigned int kvm_version;
|
||||
};
|
||||
|
||||
static void printMismatchedFlags(virBitmapPtr got,
|
||||
virBitmapPtr expect)
|
||||
static void printMismatchedFlags(qemuCapsPtr got,
|
||||
qemuCapsPtr expect)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -38,7 +38,7 @@ static int testHelpStrParsing(const void *data)
|
|||
char *path = NULL;
|
||||
char *help = NULL;
|
||||
unsigned int version, is_kvm, kvm_version;
|
||||
virBitmapPtr flags = NULL;
|
||||
qemuCapsPtr flags = NULL;
|
||||
int ret = -1;
|
||||
char *got = NULL;
|
||||
char *expected = NULL;
|
||||
|
@ -75,8 +75,8 @@ static int testHelpStrParsing(const void *data)
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
got = virBitmapString(flags);
|
||||
expected = virBitmapString(info->flags);
|
||||
got = qemuCapsFlagsString(flags);
|
||||
expected = qemuCapsFlagsString(info->flags);
|
||||
if (!got || !expected)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -116,7 +116,7 @@ static int testHelpStrParsing(const void *data)
|
|||
cleanup:
|
||||
VIR_FREE(path);
|
||||
VIR_FREE(help);
|
||||
qemuCapsFree(flags);
|
||||
virObjectUnref(flags);
|
||||
VIR_FREE(got);
|
||||
VIR_FREE(expected);
|
||||
return ret;
|
||||
|
@ -138,7 +138,7 @@ mymain(void)
|
|||
if (virtTestRun("QEMU Help String Parsing " name, \
|
||||
1, testHelpStrParsing, &info) < 0) \
|
||||
ret = -1; \
|
||||
qemuCapsFree(info.flags); \
|
||||
virObjectUnref(info.flags); \
|
||||
} while (0)
|
||||
|
||||
DO_TEST("qemu-0.9.1", 9001, 0, 0,
|
||||
|
|
|
@ -78,7 +78,7 @@ typedef enum {
|
|||
|
||||
static int testCompareXMLToArgvFiles(const char *xml,
|
||||
const char *cmdline,
|
||||
virBitmapPtr extraFlags,
|
||||
qemuCapsPtr extraFlags,
|
||||
const char *migrateFrom,
|
||||
int migrateFd,
|
||||
virQemuXML2ArgvTestFlags flags)
|
||||
|
@ -235,7 +235,7 @@ out:
|
|||
|
||||
struct testInfo {
|
||||
const char *name;
|
||||
virBitmapPtr extraFlags;
|
||||
qemuCapsPtr extraFlags;
|
||||
const char *migrateFrom;
|
||||
int migrateFd;
|
||||
unsigned int flags;
|
||||
|
@ -311,7 +311,7 @@ mymain(void)
|
|||
if (virtTestRun("QEMU XML-2-ARGV " name, \
|
||||
1, testCompareXMLToArgvHelper, &info) < 0) \
|
||||
ret = -1; \
|
||||
qemuCapsFree(info.extraFlags); \
|
||||
virObjectUnref(info.extraFlags); \
|
||||
} while (0)
|
||||
|
||||
# define DO_TEST(name, ...) \
|
||||
|
|
|
@ -25,7 +25,7 @@ static struct qemud_driver driver;
|
|||
|
||||
static int testCompareXMLToArgvFiles(const char *xml,
|
||||
const char *cmdline,
|
||||
virBitmapPtr extraFlags,
|
||||
qemuCapsPtr extraFlags,
|
||||
const char *migrateFrom,
|
||||
int migrateFd,
|
||||
bool json,
|
||||
|
@ -164,7 +164,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
|||
|
||||
struct testInfo {
|
||||
const char *name;
|
||||
virBitmapPtr extraFlags;
|
||||
qemuCapsPtr extraFlags;
|
||||
const char *migrateFrom;
|
||||
int migrateFd;
|
||||
bool json;
|
||||
|
@ -238,7 +238,7 @@ mymain(void)
|
|||
if (virtTestRun("QEMU XML-2-ARGV " name, \
|
||||
1, testCompareXMLToArgvHelper, &info) < 0) \
|
||||
ret = -1; \
|
||||
qemuCapsFree(info.extraFlags); \
|
||||
virObjectUnref(info.extraFlags); \
|
||||
} while (0)
|
||||
|
||||
# define DO_TEST(name, expectError, ...) \
|
||||
|
|
Loading…
Reference in New Issue