From 32803ba4095384624fe1c317459ba3125bb1be00 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Fri, 1 Feb 2013 13:48:58 +0000 Subject: [PATCH] Rename 'qemuCapsXXX' to 'virQEMUCapsXXX' To avoid confusion between 'virCapsPtr' and 'qemuCapsPtr' do some renaming of various fucntions/variables. All instances of 'qemuCapsPtr' are renamed to 'qemuCaps'. To avoid that clashing with the 'qemuCaps' typedef though, rename the latter to virQEMUCaps. Signed-off-by: Daniel P. Berrange --- src/qemu/qemu_capabilities.c | 1134 +++++++++++++++++----------------- src/qemu/qemu_capabilities.h | 114 ++-- src/qemu/qemu_command.c | 648 +++++++++---------- src/qemu/qemu_command.h | 60 +- src/qemu/qemu_conf.h | 2 +- src/qemu/qemu_domain.c | 20 +- src/qemu/qemu_domain.h | 2 +- src/qemu/qemu_driver.c | 130 ++-- src/qemu/qemu_hotplug.c | 138 ++--- src/qemu/qemu_migration.c | 18 +- src/qemu/qemu_process.c | 72 +-- tests/qemuhelptest.c | 34 +- tests/qemuxml2argvtest.c | 32 +- tests/qemuxmlnstest.c | 24 +- 14 files changed, 1215 insertions(+), 1213 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index ceed735af8..4efe052aeb 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -51,7 +51,7 @@ * are used in domain status files which are read on * daemon restarts */ -VIR_ENUM_IMPL(qemuCaps, QEMU_CAPS_LAST, +VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "kqemu", /* 0 */ "vnc-colon", "no-reboot", @@ -208,7 +208,7 @@ VIR_ENUM_IMPL(qemuCaps, QEMU_CAPS_LAST, ); -struct _qemuCaps { +struct _virQEMUCaps { virObject object; bool usedQMP; @@ -231,7 +231,7 @@ struct _qemuCaps { char **machineAliases; }; -struct _qemuCapsCache { +struct _virQEMUCapsCache { virMutex lock; virHashTablePtr binaries; char *libDir; @@ -241,23 +241,23 @@ struct _qemuCapsCache { }; -static virClassPtr qemuCapsClass; -static void qemuCapsDispose(void *obj); +static virClassPtr virQEMUCapsClass; +static void virQEMUCapsDispose(void *obj); -static int qemuCapsOnceInit(void) +static int virQEMUCapsOnceInit(void) { - if (!(qemuCapsClass = virClassNew(virClassForObject(), - "qemuCaps", - sizeof(qemuCaps), - qemuCapsDispose))) + if (!(virQEMUCapsClass = virClassNew(virClassForObject(), + "virQEMUCaps", + sizeof(virQEMUCaps), + virQEMUCapsDispose))) return -1; return 0; } -VIR_ONCE_GLOBAL_INIT(qemuCaps) +VIR_ONCE_GLOBAL_INIT(virQEMUCaps) -static virArch qemuCapsArchFromString(const char *arch) +static virArch virQEMUCapsArchFromString(const char *arch) { if (STREQ(arch, "i386")) return VIR_ARCH_I686; @@ -268,7 +268,7 @@ static virArch qemuCapsArchFromString(const char *arch) } -static const char *qemuCapsArchToString(virArch arch) +static const char *virQEMUCapsArchToString(virArch arch) { if (arch == VIR_ARCH_I686) return "i386"; @@ -279,17 +279,17 @@ static const char *qemuCapsArchToString(virArch arch) } -struct _qemuCapsHookData { +struct _virQEMUCapsHookData { uid_t runUid; gid_t runGid; }; -typedef struct _qemuCapsHookData qemuCapsHookData; -typedef qemuCapsHookData *qemuCapsHookDataPtr; +typedef struct _virQEMUCapsHookData virQEMUCapsHookData; +typedef virQEMUCapsHookData *virQEMUCapsHookDataPtr; -static int qemuCapsHook(void * data) +static int virQEMUCapsHook(void * data) { int ret; - qemuCapsHookDataPtr hookData = data; + virQEMUCapsHookDataPtr hookData = data; if (!hookData) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -307,50 +307,50 @@ cleanup: } static virCommandPtr -qemuCapsProbeCommand(const char *qemu, - qemuCapsPtr caps, - qemuCapsHookDataPtr hookData) +virQEMUCapsProbeCommand(const char *qemu, + virQEMUCapsPtr qemuCaps, + virQEMUCapsHookDataPtr hookData) { virCommandPtr cmd = virCommandNew(qemu); - if (caps) { - if (qemuCapsGet(caps, QEMU_CAPS_NO_USER_CONFIG)) + if (qemuCaps) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_USER_CONFIG)) virCommandAddArg(cmd, "-no-user-config"); - else if (qemuCapsGet(caps, QEMU_CAPS_NODEFCONFIG)) + else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NODEFCONFIG)) virCommandAddArg(cmd, "-nodefconfig"); } virCommandAddEnvPassCommon(cmd); virCommandClearCaps(cmd); - virCommandSetPreExecHook(cmd, qemuCapsHook, hookData); + virCommandSetPreExecHook(cmd, virQEMUCapsHook, hookData); return cmd; } static void -qemuSetDefaultMachine(qemuCapsPtr caps, - size_t defIdx) +virQEMUCapsSetDefaultMachine(virQEMUCapsPtr qemuCaps, + size_t defIdx) { - char *name = caps->machineTypes[defIdx]; - char *alias = caps->machineAliases[defIdx]; + char *name = qemuCaps->machineTypes[defIdx]; + char *alias = qemuCaps->machineAliases[defIdx]; - memmove(caps->machineTypes + 1, - caps->machineTypes, - sizeof(caps->machineTypes[0]) * defIdx); - memmove(caps->machineAliases + 1, - caps->machineAliases, - sizeof(caps->machineAliases[0]) * defIdx); - caps->machineTypes[0] = name; - caps->machineAliases[0] = alias; + memmove(qemuCaps->machineTypes + 1, + qemuCaps->machineTypes, + sizeof(qemuCaps->machineTypes[0]) * defIdx); + memmove(qemuCaps->machineAliases + 1, + qemuCaps->machineAliases, + sizeof(qemuCaps->machineAliases[0]) * defIdx); + qemuCaps->machineTypes[0] = name; + qemuCaps->machineAliases[0] = alias; } /* Format is: * [(default)|(alias of )] */ static int -qemuCapsParseMachineTypesStr(const char *output, - qemuCapsPtr caps) +virQEMUCapsParseMachineTypesStr(const char *output, + virQEMUCapsPtr qemuCaps) { const char *p = output; const char *next; @@ -375,7 +375,7 @@ qemuCapsParseMachineTypesStr(const char *output, p = t; if ((t = strstr(p, "(default)")) && (!next || t < next)) - defIdx = caps->nmachineTypes; + defIdx = qemuCaps->nmachineTypes; if ((t = strstr(p, "(alias of ")) && (!next || t < next)) { p = t + strlen("(alias of "); @@ -388,25 +388,25 @@ qemuCapsParseMachineTypesStr(const char *output, } } - if (VIR_REALLOC_N(caps->machineTypes, caps->nmachineTypes + 1) < 0 || - VIR_REALLOC_N(caps->machineAliases, caps->nmachineTypes + 1) < 0) { + if (VIR_REALLOC_N(qemuCaps->machineTypes, qemuCaps->nmachineTypes + 1) < 0 || + VIR_REALLOC_N(qemuCaps->machineAliases, qemuCaps->nmachineTypes + 1) < 0) { VIR_FREE(name); VIR_FREE(canonical); goto no_memory; } - caps->nmachineTypes++; + qemuCaps->nmachineTypes++; if (canonical) { - caps->machineTypes[caps->nmachineTypes-1] = canonical; - caps->machineAliases[caps->nmachineTypes-1] = name; + qemuCaps->machineTypes[qemuCaps->nmachineTypes-1] = canonical; + qemuCaps->machineAliases[qemuCaps->nmachineTypes-1] = name; } else { - caps->machineTypes[caps->nmachineTypes-1] = name; - caps->machineAliases[caps->nmachineTypes-1] = NULL; + qemuCaps->machineTypes[qemuCaps->nmachineTypes-1] = name; + qemuCaps->machineAliases[qemuCaps->nmachineTypes-1] = NULL; } } while ((p = next)); if (defIdx) - qemuSetDefaultMachine(caps, defIdx); + virQEMUCapsSetDefaultMachine(qemuCaps, defIdx); return 0; @@ -416,7 +416,7 @@ no_memory: } static int -qemuCapsProbeMachineTypes(qemuCapsPtr caps, qemuCapsHookDataPtr hookData) +virQEMUCapsProbeMachineTypes(virQEMUCapsPtr qemuCaps, virQEMUCapsHookDataPtr hookData) { char *output; int ret = -1; @@ -427,13 +427,13 @@ qemuCapsProbeMachineTypes(qemuCapsPtr caps, qemuCapsHookDataPtr hookData) * Technically we could catch the exec() failure, but that's * in a sub-process so it's hard to feed back a useful error. */ - if (!virFileIsExecutable(caps->binary)) { + if (!virFileIsExecutable(qemuCaps->binary)) { virReportSystemError(errno, _("Cannot find QEMU binary %s"), - caps->binary); + qemuCaps->binary); return -1; } - cmd = qemuCapsProbeCommand(caps->binary, caps, hookData); + cmd = virQEMUCapsProbeCommand(qemuCaps->binary, qemuCaps, hookData); virCommandAddArgList(cmd, "-M", "?", NULL); virCommandSetOutputBuffer(cmd, &output); @@ -441,7 +441,7 @@ qemuCapsProbeMachineTypes(qemuCapsPtr caps, qemuCapsHookDataPtr hookData) if (virCommandRun(cmd, &status) < 0) goto cleanup; - if (qemuCapsParseMachineTypesStr(output, caps) < 0) + if (virQEMUCapsParseMachineTypesStr(output, qemuCaps) < 0) goto cleanup; ret = 0; @@ -455,8 +455,8 @@ cleanup: typedef int -(*qemuCapsParseCPUModels)(const char *output, - qemuCapsPtr caps); +(*virQEMUCapsParseCPUModels)(const char *output, + virQEMUCapsPtr qemuCaps); /* Format: * @@ -464,8 +464,8 @@ typedef int * [] */ static int -qemuCapsParseX86Models(const char *output, - qemuCapsPtr caps) +virQEMUCapsParseX86Models(const char *output, + virQEMUCapsPtr qemuCaps) { const char *p = output; const char *next; @@ -491,7 +491,7 @@ qemuCapsParseX86Models(const char *output, if (*p == '\0' || *p == '\n') continue; - if (VIR_EXPAND_N(caps->cpuDefinitions, caps->ncpuDefinitions, 1) < 0) { + if (VIR_EXPAND_N(qemuCaps->cpuDefinitions, qemuCaps->ncpuDefinitions, 1) < 0) { virReportOOMError(); goto cleanup; } @@ -506,7 +506,7 @@ qemuCapsParseX86Models(const char *output, len -= 2; } - if (!(caps->cpuDefinitions[caps->ncpuDefinitions - 1] = strndup(p, len))) { + if (!(qemuCaps->cpuDefinitions[qemuCaps->ncpuDefinitions - 1] = strndup(p, len))) { virReportOOMError(); goto cleanup; } @@ -522,8 +522,8 @@ cleanup: * Format : PowerPC */ static int -qemuCapsParsePPCModels(const char *output, - qemuCapsPtr caps) +virQEMUCapsParsePPCModels(const char *output, + virQEMUCapsPtr qemuCaps) { const char *p = output; const char *next; @@ -552,14 +552,14 @@ qemuCapsParsePPCModels(const char *output, if (*p == '\n') continue; - if (VIR_EXPAND_N(caps->cpuDefinitions, caps->ncpuDefinitions, 1) < 0) { + if (VIR_EXPAND_N(qemuCaps->cpuDefinitions, qemuCaps->ncpuDefinitions, 1) < 0) { virReportOOMError(); goto cleanup; } len = t - p - 1; - if (!(caps->cpuDefinitions[caps->ncpuDefinitions - 1] = strndup(p, len))) { + if (!(qemuCaps->cpuDefinitions[qemuCaps->ncpuDefinitions - 1] = strndup(p, len))) { virReportOOMError(); goto cleanup; } @@ -572,32 +572,32 @@ cleanup: } static int -qemuCapsProbeCPUModels(qemuCapsPtr caps, qemuCapsHookDataPtr hookData) +virQEMUCapsProbeCPUModels(virQEMUCapsPtr qemuCaps, virQEMUCapsHookDataPtr hookData) { char *output = NULL; int ret = -1; - qemuCapsParseCPUModels parse; + virQEMUCapsParseCPUModels parse; virCommandPtr cmd; - if (caps->arch == VIR_ARCH_I686 || - caps->arch == VIR_ARCH_X86_64) - parse = qemuCapsParseX86Models; - else if (caps->arch == VIR_ARCH_PPC64) - parse = qemuCapsParsePPCModels; + if (qemuCaps->arch == VIR_ARCH_I686 || + qemuCaps->arch == VIR_ARCH_X86_64) + parse = virQEMUCapsParseX86Models; + else if (qemuCaps->arch == VIR_ARCH_PPC64) + parse = virQEMUCapsParsePPCModels; else { VIR_DEBUG("don't know how to parse %s CPU models", - virArchToString(caps->arch)); + virArchToString(qemuCaps->arch)); return 0; } - cmd = qemuCapsProbeCommand(caps->binary, caps, hookData); + cmd = virQEMUCapsProbeCommand(qemuCaps->binary, qemuCaps, hookData); virCommandAddArgList(cmd, "-cpu", "?", NULL); virCommandSetOutputBuffer(cmd, &output); if (virCommandRun(cmd, NULL) < 0) goto cleanup; - if (parse(output, caps) < 0) + if (parse(output, qemuCaps) < 0) goto cleanup; ret = 0; @@ -611,11 +611,11 @@ cleanup: static char * -qemuCapsFindBinaryForArch(virArch hostarch, - virArch guestarch) +virQEMUCapsFindBinaryForArch(virArch hostarch, + virArch guestarch) { char *ret; - const char *archstr = qemuCapsArchToString(guestarch); + const char *archstr = virQEMUCapsArchToString(guestarch); char *binary; if (virAsprintf(&binary, "qemu-system-%s", archstr) < 0) { @@ -648,8 +648,8 @@ qemuCapsFindBinaryForArch(virArch hostarch, static bool -qemuCapsIsValidForKVM(virArch hostarch, - virArch guestarch) +virQEMUCapsIsValidForKVM(virArch hostarch, + virArch guestarch) { if (hostarch == guestarch) return true; @@ -660,10 +660,10 @@ qemuCapsIsValidForKVM(virArch hostarch, } static int -qemuCapsInitGuest(virCapsPtr caps, - qemuCapsCachePtr cache, - virArch hostarch, - virArch guestarch) +virQEMUCapsInitGuest(virCapsPtr caps, + virQEMUCapsCachePtr cache, + virArch hostarch, + virArch guestarch) { virCapsGuestPtr guest; int i; @@ -673,18 +673,18 @@ qemuCapsInitGuest(virCapsPtr caps, char *binary = NULL; virCapsGuestMachinePtr *machines = NULL; size_t nmachines = 0; - qemuCapsPtr qemubinCaps = NULL; - qemuCapsPtr kvmbinCaps = NULL; + virQEMUCapsPtr qemubinCaps = NULL; + virQEMUCapsPtr kvmbinCaps = NULL; int ret = -1; /* Check for existence of base emulator, or alternate base * which can be used with magic cpu choice */ - binary = qemuCapsFindBinaryForArch(hostarch, guestarch); + binary = virQEMUCapsFindBinaryForArch(hostarch, guestarch); /* Ignore binary if extracting version info fails */ if (binary) { - if (!(qemubinCaps = qemuCapsCacheLookup(cache, binary))) { + if (!(qemubinCaps = virQEMUCapsCacheLookup(cache, binary))) { virResetLastError(); VIR_FREE(binary); } @@ -696,7 +696,7 @@ qemuCapsInitGuest(virCapsPtr caps, * - hostarch is x86_64 and guest arch is i686 * The latter simply needs "-cpu qemu32" */ - if (qemuCapsIsValidForKVM(hostarch, guestarch)) { + if (virQEMUCapsIsValidForKVM(hostarch, guestarch)) { const char *const kvmbins[] = { "/usr/libexec/qemu-kvm", /* RHEL */ "qemu-kvm", /* Fedora */ "kvm" }; /* Upstream .spec */ @@ -707,7 +707,7 @@ qemuCapsInitGuest(virCapsPtr caps, if (!kvmbin) continue; - if (!(kvmbinCaps = qemuCapsCacheLookup(cache, kvmbin))) { + if (!(kvmbinCaps = virQEMUCapsCacheLookup(cache, kvmbin))) { virResetLastError(); VIR_FREE(kvmbin); continue; @@ -727,16 +727,16 @@ qemuCapsInitGuest(virCapsPtr caps, return 0; if (access("/dev/kvm", F_OK) == 0 && - (qemuCapsGet(qemubinCaps, QEMU_CAPS_KVM) || - qemuCapsGet(qemubinCaps, QEMU_CAPS_ENABLE_KVM) || + (virQEMUCapsGet(qemubinCaps, QEMU_CAPS_KVM) || + virQEMUCapsGet(qemubinCaps, QEMU_CAPS_ENABLE_KVM) || kvmbin)) haskvm = 1; if (access("/dev/kqemu", F_OK) == 0 && - qemuCapsGet(qemubinCaps, QEMU_CAPS_KQEMU)) + virQEMUCapsGet(qemubinCaps, QEMU_CAPS_KQEMU)) haskqemu = 1; - if (qemuCapsGetMachineTypesCaps(qemubinCaps, &nmachines, &machines) < 0) + if (virQEMUCapsGetMachineTypesCaps(qemubinCaps, &nmachines, &machines) < 0) goto error; /* We register kvm as the base emulator too, since we can @@ -755,11 +755,11 @@ qemuCapsInitGuest(virCapsPtr caps, if (caps->host.cpu && caps->host.cpu->model && - qemuCapsGetCPUDefinitions(qemubinCaps, NULL) > 0 && + virQEMUCapsGetCPUDefinitions(qemubinCaps, NULL) > 0 && !virCapabilitiesAddGuestFeature(guest, "cpuselection", 1, 0)) goto error; - if (qemuCapsGet(qemubinCaps, QEMU_CAPS_BOOTINDEX) && + if (virQEMUCapsGet(qemubinCaps, QEMU_CAPS_BOOTINDEX) && !virCapabilitiesAddGuestFeature(guest, "deviceboot", 1, 0)) goto error; @@ -784,7 +784,7 @@ qemuCapsInitGuest(virCapsPtr caps, virCapsGuestDomainPtr dom; if (kvmbin && - qemuCapsGetMachineTypesCaps(kvmbinCaps, &nmachines, &machines) < 0) + virQEMUCapsGetMachineTypesCaps(kvmbinCaps, &nmachines, &machines) < 0) goto error; if ((dom = virCapabilitiesAddGuestDomain(guest, @@ -830,8 +830,8 @@ error: static int -qemuCapsInitCPU(virCapsPtr caps, - virArch arch) +virQEMUCapsInitCPU(virCapsPtr caps, + virArch arch) { virCPUDefPtr cpu = NULL; union cpuData *data = NULL; @@ -871,8 +871,8 @@ error: } -static int qemuDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED, - virArch arch) +static int virQEMUCapsDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED, + virArch arch) { if (arch == VIR_ARCH_S390 || arch == VIR_ARCH_S390X) @@ -882,7 +882,7 @@ static int qemuDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED, } -virCapsPtr qemuCapsInit(qemuCapsCachePtr cache) +virCapsPtr virQEMUCapsInit(virQEMUCapsCachePtr cache) { virCapsPtr caps; int i; @@ -903,7 +903,7 @@ virCapsPtr qemuCapsInit(qemuCapsCachePtr cache) VIR_WARN("Failed to query host NUMA topology, disabling NUMA capabilities"); } - if (qemuCapsInitCPU(caps, virArchFromHost()) < 0) + if (virQEMUCapsInitCPU(caps, virArchFromHost()) < 0) VIR_WARN("Failed to get host CPU"); /* Add the power management features of the host */ @@ -919,15 +919,15 @@ virCapsPtr qemuCapsInit(qemuCapsCachePtr cache) * if a qemu-system-$ARCH binary can't be found */ for (i = 0 ; i < VIR_ARCH_LAST ; i++) - if (qemuCapsInitGuest(caps, cache, - virArchFromHost(), - i) < 0) + if (virQEMUCapsInitGuest(caps, cache, + virArchFromHost(), + i) < 0) goto error; /* QEMU Requires an emulator in the XML */ virCapabilitiesSetEmulatorRequired(caps); - caps->defaultConsoleTargetType = qemuDefaultConsoleType; + caps->defaultConsoleTargetType = virQEMUCapsDefaultConsoleType; return caps; @@ -938,134 +938,134 @@ error: static int -qemuCapsComputeCmdFlags(const char *help, - unsigned int version, - unsigned int is_kvm, - unsigned int kvm_version, - qemuCapsPtr caps, - bool check_yajl ATTRIBUTE_UNUSED) +virQEMUCapsComputeCmdFlags(const char *help, + unsigned int version, + unsigned int is_kvm, + unsigned int kvm_version, + virQEMUCapsPtr qemuCaps, + bool check_yajl ATTRIBUTE_UNUSED) { const char *p; const char *fsdev, *netdev; if (strstr(help, "-no-kqemu")) - qemuCapsSet(caps, QEMU_CAPS_KQEMU); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_KQEMU); if (strstr(help, "-enable-kqemu")) - qemuCapsSet(caps, QEMU_CAPS_ENABLE_KQEMU); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_ENABLE_KQEMU); if (strstr(help, "-no-kvm")) - qemuCapsSet(caps, QEMU_CAPS_KVM); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_KVM); if (strstr(help, "-enable-kvm")) - qemuCapsSet(caps, QEMU_CAPS_ENABLE_KVM); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_ENABLE_KVM); if (strstr(help, "-no-reboot")) - qemuCapsSet(caps, QEMU_CAPS_NO_REBOOT); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_REBOOT); if (strstr(help, "-name")) { - qemuCapsSet(caps, QEMU_CAPS_NAME); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NAME); if (strstr(help, ",process=")) - qemuCapsSet(caps, QEMU_CAPS_NAME_PROCESS); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NAME_PROCESS); } if (strstr(help, "-uuid")) - qemuCapsSet(caps, QEMU_CAPS_UUID); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_UUID); if (strstr(help, "-xen-domid")) - qemuCapsSet(caps, QEMU_CAPS_XEN_DOMID); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_XEN_DOMID); else if (strstr(help, "-domid")) - qemuCapsSet(caps, QEMU_CAPS_DOMID); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DOMID); if (strstr(help, "-drive")) { const char *cache = strstr(help, "cache="); - qemuCapsSet(caps, QEMU_CAPS_DRIVE); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE); if (cache && (p = strchr(cache, ']'))) { if (memmem(cache, p - cache, "on|off", sizeof("on|off") - 1) == NULL) - qemuCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_V2); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_CACHE_V2); if (memmem(cache, p - cache, "directsync", sizeof("directsync") - 1)) - qemuCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC); if (memmem(cache, p - cache, "unsafe", sizeof("unsafe") - 1)) - qemuCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_UNSAFE); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_CACHE_UNSAFE); } if (strstr(help, "format=")) - qemuCapsSet(caps, QEMU_CAPS_DRIVE_FORMAT); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_FORMAT); if (strstr(help, "readonly=")) - qemuCapsSet(caps, QEMU_CAPS_DRIVE_READONLY); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_READONLY); if (strstr(help, "aio=threads|native")) - qemuCapsSet(caps, QEMU_CAPS_DRIVE_AIO); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_AIO); if (strstr(help, "copy-on-read=on|off")) - qemuCapsSet(caps, QEMU_CAPS_DRIVE_COPY_ON_READ); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_COPY_ON_READ); if (strstr(help, "bps=")) - qemuCapsSet(caps, QEMU_CAPS_DRIVE_IOTUNE); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE); } if ((p = strstr(help, "-vga")) && !strstr(help, "-std-vga")) { const char *nl = strstr(p, "\n"); - qemuCapsSet(caps, QEMU_CAPS_VGA); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VGA); if (strstr(p, "|qxl")) - qemuCapsSet(caps, QEMU_CAPS_VGA_QXL); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VGA_QXL); if ((p = strstr(p, "|none")) && p < nl) - qemuCapsSet(caps, QEMU_CAPS_VGA_NONE); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VGA_NONE); } if (strstr(help, "-spice")) - qemuCapsSet(caps, QEMU_CAPS_SPICE); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_SPICE); if (strstr(help, "-vnc")) - qemuCapsSet(caps, QEMU_CAPS_VNC); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC); if (strstr(help, "seamless-migration=")) - qemuCapsSet(caps, QEMU_CAPS_SEAMLESS_MIGRATION); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_SEAMLESS_MIGRATION); if (strstr(help, "boot=on")) - qemuCapsSet(caps, QEMU_CAPS_DRIVE_BOOT); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_BOOT); if (strstr(help, "serial=s")) - qemuCapsSet(caps, QEMU_CAPS_DRIVE_SERIAL); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_SERIAL); if (strstr(help, "-pcidevice")) - qemuCapsSet(caps, QEMU_CAPS_PCIDEVICE); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCIDEVICE); if (strstr(help, "-mem-path")) - qemuCapsSet(caps, QEMU_CAPS_MEM_PATH); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MEM_PATH); if (strstr(help, "-chardev")) { - qemuCapsSet(caps, QEMU_CAPS_CHARDEV); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_CHARDEV); if (strstr(help, "-chardev spicevmc")) - qemuCapsSet(caps, QEMU_CAPS_CHARDEV_SPICEVMC); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_CHARDEV_SPICEVMC); } if (strstr(help, "-balloon")) - qemuCapsSet(caps, QEMU_CAPS_BALLOON); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_BALLOON); if (strstr(help, "-device")) { - qemuCapsSet(caps, QEMU_CAPS_DEVICE); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE); /* * When -device was introduced, qemu already supported drive's * readonly option but didn't advertise that. */ - qemuCapsSet(caps, QEMU_CAPS_DRIVE_READONLY); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_READONLY); } if (strstr(help, "-nodefconfig")) - qemuCapsSet(caps, QEMU_CAPS_NODEFCONFIG); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NODEFCONFIG); if (strstr(help, "-no-user-config")) - qemuCapsSet(caps, QEMU_CAPS_NO_USER_CONFIG); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_USER_CONFIG); /* The trailing ' ' is important to avoid a bogus match */ if (strstr(help, "-rtc ")) - qemuCapsSet(caps, QEMU_CAPS_RTC); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_RTC); /* to wit */ if (strstr(help, "-rtc-td-hack")) - qemuCapsSet(caps, QEMU_CAPS_RTC_TD_HACK); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_RTC_TD_HACK); if (strstr(help, "-no-hpet")) - qemuCapsSet(caps, QEMU_CAPS_NO_HPET); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_HPET); if (strstr(help, "-no-acpi")) - qemuCapsSet(caps, QEMU_CAPS_NO_ACPI); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_ACPI); if (strstr(help, "-no-kvm-pit-reinjection")) - qemuCapsSet(caps, QEMU_CAPS_NO_KVM_PIT); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_KVM_PIT); if (strstr(help, "-tdf")) - qemuCapsSet(caps, QEMU_CAPS_TDF); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_TDF); if (strstr(help, "-enable-nesting")) - qemuCapsSet(caps, QEMU_CAPS_NESTING); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NESTING); if (strstr(help, ",menu=on")) - qemuCapsSet(caps, QEMU_CAPS_BOOT_MENU); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_BOOT_MENU); if (strstr(help, ",reboot-timeout=rb_time")) - qemuCapsSet(caps, QEMU_CAPS_REBOOT_TIMEOUT); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_REBOOT_TIMEOUT); if ((fsdev = strstr(help, "-fsdev"))) { - qemuCapsSet(caps, QEMU_CAPS_FSDEV); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_FSDEV); if (strstr(fsdev, "readonly")) - qemuCapsSet(caps, QEMU_CAPS_FSDEV_READONLY); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_FSDEV_READONLY); if (strstr(fsdev, "writeout")) - qemuCapsSet(caps, QEMU_CAPS_FSDEV_WRITEOUT); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_FSDEV_WRITEOUT); } if (strstr(help, "-smbios type")) - qemuCapsSet(caps, QEMU_CAPS_SMBIOS_TYPE); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_SMBIOS_TYPE); if (strstr(help, "-sandbox")) - qemuCapsSet(caps, QEMU_CAPS_SECCOMP_SANDBOX); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_SECCOMP_SANDBOX); if ((netdev = strstr(help, "-netdev"))) { /* Disable -netdev on 0.12 since although it exists, @@ -1074,26 +1074,26 @@ qemuCapsComputeCmdFlags(const char *help, * But see below about RHEL build. */ if (version >= 13000) { if (strstr(netdev, "bridge")) - qemuCapsSet(caps, QEMU_CAPS_NETDEV_BRIDGE); - qemuCapsSet(caps, QEMU_CAPS_NETDEV); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV_BRIDGE); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV); } } if (strstr(help, "-sdl")) - qemuCapsSet(caps, QEMU_CAPS_SDL); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_SDL); if (strstr(help, "cores=") && strstr(help, "threads=") && strstr(help, "sockets=")) - qemuCapsSet(caps, QEMU_CAPS_SMP_TOPOLOGY); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_SMP_TOPOLOGY); if (version >= 9000) - qemuCapsSet(caps, QEMU_CAPS_VNC_COLON); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC_COLON); if (is_kvm && (version >= 10000 || kvm_version >= 74)) - qemuCapsSet(caps, QEMU_CAPS_VNET_HDR); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNET_HDR); if (strstr(help, ",vhost=")) { - qemuCapsSet(caps, QEMU_CAPS_VHOST_NET); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VHOST_NET); } /* Do not use -no-shutdown if qemu doesn't support it or SIGTERM handling @@ -1101,10 +1101,10 @@ qemuCapsComputeCmdFlags(const char *help, * 0.14.* and 0.15.0) */ if (strstr(help, "-no-shutdown") && (version < 14000 || version > 15000)) - qemuCapsSet(caps, QEMU_CAPS_NO_SHUTDOWN); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_SHUTDOWN); if (strstr(help, "dump-guest-core=on|off")) - qemuCapsSet(caps, QEMU_CAPS_DUMP_GUEST_CORE); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DUMP_GUEST_CORE); /* * Handling of -incoming arg with varying features @@ -1119,25 +1119,25 @@ qemuCapsComputeCmdFlags(const char *help, * while waiting for data, so pretend it doesn't exist */ if (version >= 10000) { - qemuCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_TCP); - qemuCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_EXEC); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_TCP); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_EXEC); if (version >= 12000) { - qemuCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_UNIX); - qemuCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_FD); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_UNIX); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD); } } else if (kvm_version >= 79) { - qemuCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_TCP); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_TCP); if (kvm_version >= 80) - qemuCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_EXEC); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_EXEC); } else if (kvm_version > 0) { - qemuCapsSet(caps, QEMU_CAPS_MIGRATE_KVM_STDIO); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MIGRATE_KVM_STDIO); } if (version >= 10000) - qemuCapsSet(caps, QEMU_CAPS_0_10); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_0_10); if (version >= 11000) - qemuCapsSet(caps, QEMU_CAPS_VIRTIO_BLK_SG_IO); + virQEMUCapsSet(qemuCaps, 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 @@ -1150,11 +1150,11 @@ qemuCapsComputeCmdFlags(const char *help, */ #if WITH_YAJL if (version >= 13000) { - qemuCapsSet(caps, QEMU_CAPS_MONITOR_JSON); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MONITOR_JSON); } else if (version >= 12000 && strstr(help, "libvirt")) { - qemuCapsSet(caps, QEMU_CAPS_MONITOR_JSON); - qemuCapsSet(caps, QEMU_CAPS_NETDEV); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MONITOR_JSON); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV); } #else /* Starting with qemu 0.15 and newer, upstream qemu no longer @@ -1173,12 +1173,12 @@ qemuCapsComputeCmdFlags(const char *help, "compiled with yajl")); return -1; } - qemuCapsSet(caps, QEMU_CAPS_NETDEV); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV); } #endif if (version >= 13000) - qemuCapsSet(caps, QEMU_CAPS_PCI_MULTIFUNCTION); + virQEMUCapsSet(qemuCaps, 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,?", @@ -1191,13 +1191,13 @@ qemuCapsComputeCmdFlags(const char *help, * log and refuse to start, so it would be immediately obvious). */ if (version >= 12000) - qemuCapsSet(caps, QEMU_CAPS_PCI_ROMBAR); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCI_ROMBAR); if (version >= 11000) - qemuCapsSet(caps, QEMU_CAPS_CPU_HOST); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_HOST); if (version >= 1002000) - qemuCapsSet(caps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY); return 0; } @@ -1225,13 +1225,13 @@ qemuCapsComputeCmdFlags(const char *help, #define SKIP_BLANKS(p) do { while ((*(p) == ' ') || (*(p) == '\t')) (p)++; } while (0) -int qemuCapsParseHelpStr(const char *qemu, - const char *help, - qemuCapsPtr caps, - unsigned int *version, - unsigned int *is_kvm, - unsigned int *kvm_version, - bool check_yajl) +int virQEMUCapsParseHelpStr(const char *qemu, + const char *help, + virQEMUCapsPtr qemuCaps, + unsigned int *version, + unsigned int *is_kvm, + unsigned int *kvm_version, + bool check_yajl) { unsigned major, minor, micro; const char *p = help; @@ -1287,11 +1287,11 @@ int qemuCapsParseHelpStr(const char *qemu, *version = (major * 1000 * 1000) + (minor * 1000) + micro; - if (qemuCapsComputeCmdFlags(help, *version, *is_kvm, *kvm_version, - caps, check_yajl) < 0) + if (virQEMUCapsComputeCmdFlags(help, *version, *is_kvm, *kvm_version, + qemuCaps, check_yajl) < 0) goto cleanup; - strflags = virBitmapString(caps->flags); + strflags = virBitmapString(qemuCaps->flags); VIR_DEBUG("Version %u.%u.%u, cooked version %u, flags %s", major, minor, micro, *version, NULLSTR(strflags)); VIR_FREE(strflags); @@ -1317,13 +1317,13 @@ cleanup: } -struct qemuCapsStringFlags { +struct virQEMUCapsStringFlags { const char *value; int flag; }; -struct qemuCapsStringFlags qemuCapsObjectTypes[] = { +struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = { { "hda-duplex", QEMU_CAPS_HDA_DUPLEX }, { "hda-micro", QEMU_CAPS_HDA_MICRO }, { "ccid-card-emulated", QEMU_CAPS_CCID_EMULATED }, @@ -1357,7 +1357,7 @@ struct qemuCapsStringFlags qemuCapsObjectTypes[] = { }; -static struct qemuCapsStringFlags qemuCapsObjectPropsVirtioBlk[] = { +static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBlk[] = { { "multifunction", QEMU_CAPS_PCI_MULTIFUNCTION }, { "bootindex", QEMU_CAPS_BOOTINDEX }, { "ioeventfd", QEMU_CAPS_VIRTIO_IOEVENTFD }, @@ -1366,84 +1366,84 @@ static struct qemuCapsStringFlags qemuCapsObjectPropsVirtioBlk[] = { { "logical_block_size", QEMU_CAPS_BLOCKIO }, }; -static struct qemuCapsStringFlags qemuCapsObjectPropsVirtioNet[] = { +static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioNet[] = { { "tx", QEMU_CAPS_VIRTIO_TX_ALG }, { "event_idx", QEMU_CAPS_VIRTIO_NET_EVENT_IDX }, }; -static struct qemuCapsStringFlags qemuCapsObjectPropsPciAssign[] = { +static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsPciAssign[] = { { "rombar", QEMU_CAPS_PCI_ROMBAR }, { "configfd", QEMU_CAPS_PCI_CONFIGFD }, { "bootindex", QEMU_CAPS_PCI_BOOTINDEX }, }; -static struct qemuCapsStringFlags qemuCapsObjectPropsScsiDisk[] = { +static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsScsiDisk[] = { { "channel", QEMU_CAPS_SCSI_DISK_CHANNEL }, { "wwn", QEMU_CAPS_SCSI_DISK_WWN }, }; -static struct qemuCapsStringFlags qemuCapsObjectPropsIDEDrive[] = { +static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsIDEDrive[] = { { "wwn", QEMU_CAPS_IDE_DRIVE_WWN }, }; -static struct qemuCapsStringFlags qemuCapsObjectPropsPixx4PM[] = { +static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsPixx4PM[] = { { "disable_s3", QEMU_CAPS_DISABLE_S3 }, { "disable_s4", QEMU_CAPS_DISABLE_S4 }, }; -static struct qemuCapsStringFlags qemuCapsObjectPropsUsbRedir[] = { +static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsUsbRedir[] = { { "filter", QEMU_CAPS_USB_REDIR_FILTER }, { "bootindex", QEMU_CAPS_USB_REDIR_BOOTINDEX }, }; -static struct qemuCapsStringFlags qemuCapsObjectPropsUsbHost[] = { +static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsUsbHost[] = { { "bootindex", QEMU_CAPS_USB_HOST_BOOTINDEX }, }; -struct qemuCapsObjectTypeProps { +struct virQEMUCapsObjectTypeProps { const char *type; - struct qemuCapsStringFlags *props; + struct virQEMUCapsStringFlags *props; size_t nprops; }; -static struct qemuCapsObjectTypeProps qemuCapsObjectProps[] = { - { "virtio-blk-pci", qemuCapsObjectPropsVirtioBlk, - ARRAY_CARDINALITY(qemuCapsObjectPropsVirtioBlk) }, - { "virtio-net-pci", qemuCapsObjectPropsVirtioNet, - ARRAY_CARDINALITY(qemuCapsObjectPropsVirtioNet) }, - { "virtio-blk-s390", qemuCapsObjectPropsVirtioBlk, - ARRAY_CARDINALITY(qemuCapsObjectPropsVirtioBlk) }, - { "virtio-net-s390", qemuCapsObjectPropsVirtioNet, - ARRAY_CARDINALITY(qemuCapsObjectPropsVirtioNet) }, - { "pci-assign", qemuCapsObjectPropsPciAssign, - ARRAY_CARDINALITY(qemuCapsObjectPropsPciAssign) }, - { "kvm-pci-assign", qemuCapsObjectPropsPciAssign, - ARRAY_CARDINALITY(qemuCapsObjectPropsPciAssign) }, - { "scsi-disk", qemuCapsObjectPropsScsiDisk, - ARRAY_CARDINALITY(qemuCapsObjectPropsScsiDisk) }, - { "ide-drive", qemuCapsObjectPropsIDEDrive, - ARRAY_CARDINALITY(qemuCapsObjectPropsIDEDrive) }, - { "PIIX4_PM", qemuCapsObjectPropsPixx4PM, - ARRAY_CARDINALITY(qemuCapsObjectPropsPixx4PM) }, - { "usb-redir", qemuCapsObjectPropsUsbRedir, - ARRAY_CARDINALITY(qemuCapsObjectPropsUsbRedir) }, - { "usb-host", qemuCapsObjectPropsUsbHost, - ARRAY_CARDINALITY(qemuCapsObjectPropsUsbHost) }, +static struct virQEMUCapsObjectTypeProps virQEMUCapsObjectProps[] = { + { "virtio-blk-pci", virQEMUCapsObjectPropsVirtioBlk, + ARRAY_CARDINALITY(virQEMUCapsObjectPropsVirtioBlk) }, + { "virtio-net-pci", virQEMUCapsObjectPropsVirtioNet, + ARRAY_CARDINALITY(virQEMUCapsObjectPropsVirtioNet) }, + { "virtio-blk-s390", virQEMUCapsObjectPropsVirtioBlk, + ARRAY_CARDINALITY(virQEMUCapsObjectPropsVirtioBlk) }, + { "virtio-net-s390", virQEMUCapsObjectPropsVirtioNet, + ARRAY_CARDINALITY(virQEMUCapsObjectPropsVirtioNet) }, + { "pci-assign", virQEMUCapsObjectPropsPciAssign, + ARRAY_CARDINALITY(virQEMUCapsObjectPropsPciAssign) }, + { "kvm-pci-assign", virQEMUCapsObjectPropsPciAssign, + ARRAY_CARDINALITY(virQEMUCapsObjectPropsPciAssign) }, + { "scsi-disk", virQEMUCapsObjectPropsScsiDisk, + ARRAY_CARDINALITY(virQEMUCapsObjectPropsScsiDisk) }, + { "ide-drive", virQEMUCapsObjectPropsIDEDrive, + ARRAY_CARDINALITY(virQEMUCapsObjectPropsIDEDrive) }, + { "PIIX4_PM", virQEMUCapsObjectPropsPixx4PM, + ARRAY_CARDINALITY(virQEMUCapsObjectPropsPixx4PM) }, + { "usb-redir", virQEMUCapsObjectPropsUsbRedir, + ARRAY_CARDINALITY(virQEMUCapsObjectPropsUsbRedir) }, + { "usb-host", virQEMUCapsObjectPropsUsbHost, + ARRAY_CARDINALITY(virQEMUCapsObjectPropsUsbHost) }, }; static void -qemuCapsProcessStringFlags(qemuCapsPtr caps, - size_t nflags, - struct qemuCapsStringFlags *flags, - size_t nvalues, - char *const*values) +virQEMUCapsProcessStringFlags(virQEMUCapsPtr qemuCaps, + size_t nflags, + struct virQEMUCapsStringFlags *flags, + size_t nvalues, + char *const*values) { size_t i, j; for (i = 0 ; i < nflags ; i++) { for (j = 0 ; j < nvalues ; j++) { if (STREQ(values[j], flags[i].value)) { - qemuCapsSet(caps, flags[i].flag); + virQEMUCapsSet(qemuCaps, flags[i].flag); break; } } @@ -1452,8 +1452,8 @@ qemuCapsProcessStringFlags(qemuCapsPtr caps, static void -qemuCapsFreeStringList(size_t len, - char **values) +virQEMUCapsFreeStringList(size_t len, + char **values) { size_t i; for (i = 0 ; i < len ; i++) @@ -1465,8 +1465,8 @@ qemuCapsFreeStringList(size_t len, #define OBJECT_TYPE_PREFIX "name \"" static int -qemuCapsParseDeviceStrObjectTypes(const char *str, - char ***types) +virQEMUCapsParseDeviceStrObjectTypes(const char *str, + char ***types) { const char *tmp = str; int ret = -1; @@ -1500,15 +1500,15 @@ qemuCapsParseDeviceStrObjectTypes(const char *str, cleanup: if (ret < 0) - qemuCapsFreeStringList(ntypelist, typelist); + virQEMUCapsFreeStringList(ntypelist, typelist); return ret; } static int -qemuCapsParseDeviceStrObjectProps(const char *str, - const char *type, - char ***props) +virQEMUCapsParseDeviceStrObjectProps(const char *str, + const char *type, + char ***props) { const char *tmp = str; int ret = -1; @@ -1557,51 +1557,51 @@ qemuCapsParseDeviceStrObjectProps(const char *str, cleanup: if (ret < 0) - qemuCapsFreeStringList(nproplist, proplist); + virQEMUCapsFreeStringList(nproplist, proplist); return ret; } int -qemuCapsParseDeviceStr(qemuCapsPtr caps, const char *str) +virQEMUCapsParseDeviceStr(virQEMUCapsPtr qemuCaps, const char *str) { int nvalues; char **values; size_t i; - if ((nvalues = qemuCapsParseDeviceStrObjectTypes(str, &values)) < 0) + if ((nvalues = virQEMUCapsParseDeviceStrObjectTypes(str, &values)) < 0) return -1; - qemuCapsProcessStringFlags(caps, - ARRAY_CARDINALITY(qemuCapsObjectTypes), - qemuCapsObjectTypes, - nvalues, values); - qemuCapsFreeStringList(nvalues, values); + virQEMUCapsProcessStringFlags(qemuCaps, + ARRAY_CARDINALITY(virQEMUCapsObjectTypes), + virQEMUCapsObjectTypes, + nvalues, values); + virQEMUCapsFreeStringList(nvalues, values); - for (i = 0 ; i < ARRAY_CARDINALITY(qemuCapsObjectProps); i++) { - const char *type = qemuCapsObjectProps[i].type; - if ((nvalues = qemuCapsParseDeviceStrObjectProps(str, - type, - &values)) < 0) + for (i = 0 ; i < ARRAY_CARDINALITY(virQEMUCapsObjectProps); i++) { + const char *type = virQEMUCapsObjectProps[i].type; + if ((nvalues = virQEMUCapsParseDeviceStrObjectProps(str, + type, + &values)) < 0) return -1; - qemuCapsProcessStringFlags(caps, - qemuCapsObjectProps[i].nprops, - qemuCapsObjectProps[i].props, - nvalues, values); - qemuCapsFreeStringList(nvalues, values); + virQEMUCapsProcessStringFlags(qemuCaps, + virQEMUCapsObjectProps[i].nprops, + virQEMUCapsObjectProps[i].props, + nvalues, values); + virQEMUCapsFreeStringList(nvalues, values); } /* Prefer -chardev spicevmc (detected earlier) over -device spicevmc */ - if (qemuCapsGet(caps, QEMU_CAPS_CHARDEV_SPICEVMC)) - qemuCapsClear(caps, QEMU_CAPS_DEVICE_SPICEVMC); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV_SPICEVMC)) + virQEMUCapsClear(qemuCaps, QEMU_CAPS_DEVICE_SPICEVMC); return 0; } static int -qemuCapsExtractDeviceStr(const char *qemu, - qemuCapsPtr caps, - qemuCapsHookDataPtr hookData) +virQEMUCapsExtractDeviceStr(const char *qemu, + virQEMUCapsPtr qemuCaps, + virQEMUCapsHookDataPtr hookData) { char *output = NULL; virCommandPtr cmd; @@ -1615,7 +1615,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, caps, hookData); + cmd = virQEMUCapsProbeCommand(qemu, qemuCaps, hookData); virCommandAddArgList(cmd, "-device", "?", "-device", "pci-assign,?", @@ -1633,7 +1633,7 @@ qemuCapsExtractDeviceStr(const char *qemu, if (virCommandRun(cmd, NULL) < 0) goto cleanup; - ret = qemuCapsParseDeviceStr(caps, output); + ret = virQEMUCapsParseDeviceStr(qemuCaps, output); cleanup: VIR_FREE(output); @@ -1642,12 +1642,12 @@ cleanup: } -int qemuCapsGetDefaultVersion(virCapsPtr caps, - qemuCapsCachePtr capsCache, - unsigned int *version) +int virQEMUCapsGetDefaultVersion(virCapsPtr caps, + virQEMUCapsCachePtr capsCache, + unsigned int *version) { const char *binary; - qemuCapsPtr qemucaps; + virQEMUCapsPtr qemucaps; if (*version > 0) return 0; @@ -1662,10 +1662,10 @@ int qemuCapsGetDefaultVersion(virCapsPtr caps, return -1; } - if (!(qemucaps = qemuCapsCacheLookup(capsCache, binary))) + if (!(qemucaps = virQEMUCapsCacheLookup(capsCache, binary))) return -1; - *version = qemuCapsGetVersion(qemucaps); + *version = virQEMUCapsGetVersion(qemucaps); virObjectUnref(qemucaps); return 0; } @@ -1673,62 +1673,62 @@ int qemuCapsGetDefaultVersion(virCapsPtr caps, -qemuCapsPtr -qemuCapsNew(void) +virQEMUCapsPtr +virQEMUCapsNew(void) { - qemuCapsPtr caps; + virQEMUCapsPtr qemuCaps; - if (qemuCapsInitialize() < 0) + if (virQEMUCapsInitialize() < 0) return NULL; - if (!(caps = virObjectNew(qemuCapsClass))) + if (!(qemuCaps = virObjectNew(virQEMUCapsClass))) return NULL; - if (!(caps->flags = virBitmapNew(QEMU_CAPS_LAST))) + if (!(qemuCaps->flags = virBitmapNew(QEMU_CAPS_LAST))) goto no_memory; - return caps; + return qemuCaps; no_memory: virReportOOMError(); - virObjectUnref(caps); + virObjectUnref(qemuCaps); return NULL; } -qemuCapsPtr qemuCapsNewCopy(qemuCapsPtr caps) +virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps) { - qemuCapsPtr ret = qemuCapsNew(); + virQEMUCapsPtr ret = virQEMUCapsNew(); size_t i; if (!ret) return NULL; - virBitmapCopy(ret->flags, caps->flags); + virBitmapCopy(ret->flags, qemuCaps->flags); - ret->usedQMP = caps->usedQMP; - ret->version = caps->version; - ret->kvmVersion = caps->kvmVersion; - ret->arch = caps->arch; + ret->usedQMP = qemuCaps->usedQMP; + ret->version = qemuCaps->version; + ret->kvmVersion = qemuCaps->kvmVersion; + ret->arch = qemuCaps->arch; - if (VIR_ALLOC_N(ret->cpuDefinitions, caps->ncpuDefinitions) < 0) + if (VIR_ALLOC_N(ret->cpuDefinitions, qemuCaps->ncpuDefinitions) < 0) goto no_memory; - ret->ncpuDefinitions = caps->ncpuDefinitions; - for (i = 0 ; i < caps->ncpuDefinitions ; i++) { - if (!(ret->cpuDefinitions[i] = strdup(caps->cpuDefinitions[i]))) + ret->ncpuDefinitions = qemuCaps->ncpuDefinitions; + for (i = 0 ; i < qemuCaps->ncpuDefinitions ; i++) { + if (!(ret->cpuDefinitions[i] = strdup(qemuCaps->cpuDefinitions[i]))) goto no_memory; } - if (VIR_ALLOC_N(ret->machineTypes, caps->nmachineTypes) < 0) + if (VIR_ALLOC_N(ret->machineTypes, qemuCaps->nmachineTypes) < 0) goto no_memory; - if (VIR_ALLOC_N(ret->machineAliases, caps->nmachineTypes) < 0) + if (VIR_ALLOC_N(ret->machineAliases, qemuCaps->nmachineTypes) < 0) goto no_memory; - ret->nmachineTypes = caps->nmachineTypes; - for (i = 0 ; i < caps->nmachineTypes ; i++) { - if (!(ret->machineTypes[i] = strdup(caps->machineTypes[i]))) + ret->nmachineTypes = qemuCaps->nmachineTypes; + for (i = 0 ; i < qemuCaps->nmachineTypes ; i++) { + if (!(ret->machineTypes[i] = strdup(qemuCaps->machineTypes[i]))) goto no_memory; - if (caps->machineAliases[i] && - !(ret->machineAliases[i] = strdup(caps->machineAliases[i]))) + if (qemuCaps->machineAliases[i] && + !(ret->machineAliases[i] = strdup(qemuCaps->machineAliases[i]))) goto no_memory; } @@ -1741,157 +1741,157 @@ no_memory: } -void qemuCapsDispose(void *obj) +void virQEMUCapsDispose(void *obj) { - qemuCapsPtr caps = obj; + virQEMUCapsPtr qemuCaps = obj; size_t i; - for (i = 0 ; i < caps->nmachineTypes ; i++) { - VIR_FREE(caps->machineTypes[i]); - VIR_FREE(caps->machineAliases[i]); + for (i = 0 ; i < qemuCaps->nmachineTypes ; i++) { + VIR_FREE(qemuCaps->machineTypes[i]); + VIR_FREE(qemuCaps->machineAliases[i]); } - VIR_FREE(caps->machineTypes); - VIR_FREE(caps->machineAliases); + VIR_FREE(qemuCaps->machineTypes); + VIR_FREE(qemuCaps->machineAliases); - for (i = 0 ; i < caps->ncpuDefinitions ; i++) { - VIR_FREE(caps->cpuDefinitions[i]); + for (i = 0 ; i < qemuCaps->ncpuDefinitions ; i++) { + VIR_FREE(qemuCaps->cpuDefinitions[i]); } - VIR_FREE(caps->cpuDefinitions); + VIR_FREE(qemuCaps->cpuDefinitions); - virBitmapFree(caps->flags); + virBitmapFree(qemuCaps->flags); - VIR_FREE(caps->binary); + VIR_FREE(qemuCaps->binary); } void -qemuCapsSet(qemuCapsPtr caps, - enum qemuCapsFlags flag) +virQEMUCapsSet(virQEMUCapsPtr qemuCaps, + enum virQEMUCapsFlags flag) { - ignore_value(virBitmapSetBit(caps->flags, flag)); + ignore_value(virBitmapSetBit(qemuCaps->flags, flag)); } void -qemuCapsSetList(qemuCapsPtr caps, ...) +virQEMUCapsSetList(virQEMUCapsPtr qemuCaps, ...) { va_list list; int flag; - va_start(list, caps); + va_start(list, qemuCaps); while ((flag = va_arg(list, int)) < QEMU_CAPS_LAST) - ignore_value(virBitmapSetBit(caps->flags, flag)); + ignore_value(virBitmapSetBit(qemuCaps->flags, flag)); va_end(list); } void -qemuCapsClear(qemuCapsPtr caps, - enum qemuCapsFlags flag) +virQEMUCapsClear(virQEMUCapsPtr qemuCaps, + enum virQEMUCapsFlags flag) { - ignore_value(virBitmapClearBit(caps->flags, flag)); + ignore_value(virBitmapClearBit(qemuCaps->flags, flag)); } -char *qemuCapsFlagsString(qemuCapsPtr caps) +char *virQEMUCapsFlagsString(virQEMUCapsPtr qemuCaps) { - return virBitmapString(caps->flags); + return virBitmapString(qemuCaps->flags); } bool -qemuCapsGet(qemuCapsPtr caps, - enum qemuCapsFlags flag) +virQEMUCapsGet(virQEMUCapsPtr qemuCaps, + enum virQEMUCapsFlags flag) { bool b; - if (!caps || virBitmapGetBit(caps->flags, flag, &b) < 0) + if (!qemuCaps || virBitmapGetBit(qemuCaps->flags, flag, &b) < 0) return false; else return b; } -const char *qemuCapsGetBinary(qemuCapsPtr caps) +const char *virQEMUCapsGetBinary(virQEMUCapsPtr qemuCaps) { - return caps->binary; + return qemuCaps->binary; } -virArch qemuCapsGetArch(qemuCapsPtr caps) +virArch virQEMUCapsGetArch(virQEMUCapsPtr qemuCaps) { - return caps->arch; + return qemuCaps->arch; } -unsigned int qemuCapsGetVersion(qemuCapsPtr caps) +unsigned int virQEMUCapsGetVersion(virQEMUCapsPtr qemuCaps) { - return caps->version; + return qemuCaps->version; } -unsigned int qemuCapsGetKVMVersion(qemuCapsPtr caps) +unsigned int virQEMUCapsGetKVMVersion(virQEMUCapsPtr qemuCaps) { - return caps->kvmVersion; + return qemuCaps->kvmVersion; } -int qemuCapsAddCPUDefinition(qemuCapsPtr caps, - const char *name) +int virQEMUCapsAddCPUDefinition(virQEMUCapsPtr qemuCaps, + const char *name) { char *tmp = strdup(name); if (!tmp) { virReportOOMError(); return -1; } - if (VIR_EXPAND_N(caps->cpuDefinitions, caps->ncpuDefinitions, 1) < 0) { + if (VIR_EXPAND_N(qemuCaps->cpuDefinitions, qemuCaps->ncpuDefinitions, 1) < 0) { VIR_FREE(tmp); virReportOOMError(); return -1; } - caps->cpuDefinitions[caps->ncpuDefinitions-1] = tmp; + qemuCaps->cpuDefinitions[qemuCaps->ncpuDefinitions-1] = tmp; return 0; } -size_t qemuCapsGetCPUDefinitions(qemuCapsPtr caps, - char ***names) +size_t virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr qemuCaps, + char ***names) { if (names) - *names = caps->cpuDefinitions; - return caps->ncpuDefinitions; + *names = qemuCaps->cpuDefinitions; + return qemuCaps->ncpuDefinitions; } -size_t qemuCapsGetMachineTypes(qemuCapsPtr caps, - char ***names) +size_t virQEMUCapsGetMachineTypes(virQEMUCapsPtr qemuCaps, + char ***names) { if (names) - *names = caps->machineTypes; - return caps->nmachineTypes; + *names = qemuCaps->machineTypes; + return qemuCaps->nmachineTypes; } -int qemuCapsGetMachineTypesCaps(qemuCapsPtr caps, - size_t *nmachines, - virCapsGuestMachinePtr **machines) +int virQEMUCapsGetMachineTypesCaps(virQEMUCapsPtr qemuCaps, + size_t *nmachines, + virCapsGuestMachinePtr **machines) { size_t i; *nmachines = 0; *machines = NULL; - if (VIR_ALLOC_N(*machines, caps->nmachineTypes) < 0) + if (VIR_ALLOC_N(*machines, qemuCaps->nmachineTypes) < 0) goto no_memory; - *nmachines = caps->nmachineTypes; + *nmachines = qemuCaps->nmachineTypes; - for (i = 0 ; i < caps->nmachineTypes ; i++) { + for (i = 0 ; i < qemuCaps->nmachineTypes ; i++) { virCapsGuestMachinePtr mach; if (VIR_ALLOC(mach) < 0) goto no_memory; - if (caps->machineAliases[i]) { - if (!(mach->name = strdup(caps->machineAliases[i]))) + if (qemuCaps->machineAliases[i]) { + if (!(mach->name = strdup(qemuCaps->machineAliases[i]))) goto no_memory; - if (!(mach->canonical = strdup(caps->machineTypes[i]))) + if (!(mach->canonical = strdup(qemuCaps->machineTypes[i]))) goto no_memory; } else { - if (!(mach->name = strdup(caps->machineTypes[i]))) + if (!(mach->name = strdup(qemuCaps->machineTypes[i]))) goto no_memory; } (*machines)[i] = mach; @@ -1909,19 +1909,19 @@ no_memory: -const char *qemuCapsGetCanonicalMachine(qemuCapsPtr caps, - const char *name) +const char *virQEMUCapsGetCanonicalMachine(virQEMUCapsPtr qemuCaps, + const char *name) { size_t i; if (!name) return NULL; - for (i = 0 ; i < caps->nmachineTypes ; i++) { - if (!caps->machineAliases[i]) + for (i = 0 ; i < qemuCaps->nmachineTypes ; i++) { + if (!qemuCaps->machineAliases[i]) continue; - if (STREQ(caps->machineAliases[i], name)) - return caps->machineTypes[i]; + if (STREQ(qemuCaps->machineAliases[i], name)) + return qemuCaps->machineTypes[i]; } return name; @@ -1929,8 +1929,8 @@ const char *qemuCapsGetCanonicalMachine(qemuCapsPtr caps, static int -qemuCapsProbeQMPCommands(qemuCapsPtr caps, - qemuMonitorPtr mon) +virQEMUCapsProbeQMPCommands(virQEMUCapsPtr qemuCaps, + qemuMonitorPtr mon) { char **commands = NULL; int ncommands; @@ -1942,29 +1942,29 @@ qemuCapsProbeQMPCommands(qemuCapsPtr caps, for (i = 0 ; i < ncommands ; i++) { char *name = commands[i]; if (STREQ(name, "system_wakeup")) - qemuCapsSet(caps, QEMU_CAPS_WAKEUP); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_WAKEUP); else if (STREQ(name, "transaction")) - qemuCapsSet(caps, QEMU_CAPS_TRANSACTION); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_TRANSACTION); else if (STREQ(name, "block_job_cancel")) - qemuCapsSet(caps, QEMU_CAPS_BLOCKJOB_SYNC); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_BLOCKJOB_SYNC); else if (STREQ(name, "block-job-cancel")) - qemuCapsSet(caps, QEMU_CAPS_BLOCKJOB_ASYNC); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_BLOCKJOB_ASYNC); else if (STREQ(name, "dump-guest-memory")) - qemuCapsSet(caps, QEMU_CAPS_DUMP_GUEST_MEMORY); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DUMP_GUEST_MEMORY); else if (STREQ(name, "query-spice")) - qemuCapsSet(caps, QEMU_CAPS_SPICE); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_SPICE); else if (STREQ(name, "query-kvm")) - qemuCapsSet(caps, QEMU_CAPS_KVM); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_KVM); else if (STREQ(name, "block-commit")) - qemuCapsSet(caps, QEMU_CAPS_BLOCK_COMMIT); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_BLOCK_COMMIT); else if (STREQ(name, "query-vnc")) - qemuCapsSet(caps, QEMU_CAPS_VNC); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC); else if (STREQ(name, "drive-mirror")) - qemuCapsSet(caps, QEMU_CAPS_DRIVE_MIRROR); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_MIRROR); else if (STREQ(name, "blockdev-snapshot-sync")) - qemuCapsSet(caps, QEMU_CAPS_DISK_SNAPSHOT); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DISK_SNAPSHOT); else if (STREQ(name, "add-fd")) - qemuCapsSet(caps, QEMU_CAPS_ADD_FD); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_ADD_FD); VIR_FREE(name); } VIR_FREE(commands); @@ -1973,7 +1973,7 @@ qemuCapsProbeQMPCommands(qemuCapsPtr caps, * management control of set numbering, and did not have a * counterpart -add-fd command line option. We require the * add-fd features from 1.3 or later. */ - if (qemuCapsGet(caps, QEMU_CAPS_ADD_FD)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_ADD_FD)) { int fd = open("/dev/null", O_RDONLY); if (fd < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -1981,7 +1981,7 @@ qemuCapsProbeQMPCommands(qemuCapsPtr caps, return -1; } if (qemuMonitorAddFd(mon, 0, fd, "/dev/null") < 0) - qemuCapsClear(caps, QEMU_CAPS_ADD_FD); + virQEMUCapsClear(qemuCaps, QEMU_CAPS_ADD_FD); VIR_FORCE_CLOSE(fd); } @@ -1990,8 +1990,8 @@ qemuCapsProbeQMPCommands(qemuCapsPtr caps, static int -qemuCapsProbeQMPEvents(qemuCapsPtr caps, - qemuMonitorPtr mon) +virQEMUCapsProbeQMPEvents(virQEMUCapsPtr qemuCaps, + qemuMonitorPtr mon) { char **events = NULL; int nevents; @@ -2004,9 +2004,9 @@ qemuCapsProbeQMPEvents(qemuCapsPtr caps, char *name = events[i]; if (STREQ(name, "BALLOON_CHANGE")) - qemuCapsSet(caps, QEMU_CAPS_BALLOON_EVENT); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_BALLOON_EVENT); if (STREQ(name, "SPICE_MIGRATE_COMPLETED")) - qemuCapsSet(caps, QEMU_CAPS_SEAMLESS_MIGRATION); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_SEAMLESS_MIGRATION); VIR_FREE(name); } VIR_FREE(events); @@ -2016,8 +2016,8 @@ qemuCapsProbeQMPEvents(qemuCapsPtr caps, static int -qemuCapsProbeQMPObjects(qemuCapsPtr caps, - qemuMonitorPtr mon) +virQEMUCapsProbeQMPObjects(virQEMUCapsPtr qemuCaps, + qemuMonitorPtr mon) { int nvalues; char **values; @@ -2025,39 +2025,39 @@ qemuCapsProbeQMPObjects(qemuCapsPtr caps, if ((nvalues = qemuMonitorGetObjectTypes(mon, &values)) < 0) return -1; - qemuCapsProcessStringFlags(caps, - ARRAY_CARDINALITY(qemuCapsObjectTypes), - qemuCapsObjectTypes, - nvalues, values); - qemuCapsFreeStringList(nvalues, values); + virQEMUCapsProcessStringFlags(qemuCaps, + ARRAY_CARDINALITY(virQEMUCapsObjectTypes), + virQEMUCapsObjectTypes, + nvalues, values); + virQEMUCapsFreeStringList(nvalues, values); - for (i = 0 ; i < ARRAY_CARDINALITY(qemuCapsObjectProps); i++) { - const char *type = qemuCapsObjectProps[i].type; + for (i = 0 ; i < ARRAY_CARDINALITY(virQEMUCapsObjectProps); i++) { + const char *type = virQEMUCapsObjectProps[i].type; if ((nvalues = qemuMonitorGetObjectProps(mon, type, &values)) < 0) return -1; - qemuCapsProcessStringFlags(caps, - qemuCapsObjectProps[i].nprops, - qemuCapsObjectProps[i].props, - nvalues, values); - qemuCapsFreeStringList(nvalues, values); + virQEMUCapsProcessStringFlags(qemuCaps, + virQEMUCapsObjectProps[i].nprops, + virQEMUCapsObjectProps[i].props, + nvalues, values); + virQEMUCapsFreeStringList(nvalues, values); } /* Prefer -chardev spicevmc (detected earlier) over -device spicevmc */ - if (qemuCapsGet(caps, QEMU_CAPS_CHARDEV_SPICEVMC)) - qemuCapsClear(caps, QEMU_CAPS_DEVICE_SPICEVMC); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV_SPICEVMC)) + virQEMUCapsClear(qemuCaps, QEMU_CAPS_DEVICE_SPICEVMC); /* If qemu supports newer -device qxl it supports -vga qxl as well */ - if (qemuCapsGet(caps, QEMU_CAPS_DEVICE_QXL)) - qemuCapsSet(caps, QEMU_CAPS_VGA_QXL); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL)) + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VGA_QXL); return 0; } static int -qemuCapsProbeQMPMachineTypes(qemuCapsPtr caps, - qemuMonitorPtr mon) +virQEMUCapsProbeQMPMachineTypes(virQEMUCapsPtr qemuCaps, + qemuMonitorPtr mon) { qemuMonitorMachineInfoPtr *machines = NULL; int nmachines = 0; @@ -2068,33 +2068,33 @@ qemuCapsProbeQMPMachineTypes(qemuCapsPtr caps, if ((nmachines = qemuMonitorGetMachines(mon, &machines)) < 0) goto cleanup; - if (VIR_ALLOC_N(caps->machineTypes, nmachines) < 0) { + if (VIR_ALLOC_N(qemuCaps->machineTypes, nmachines) < 0) { virReportOOMError(); goto cleanup; } - if (VIR_ALLOC_N(caps->machineAliases, nmachines) < 0) { + if (VIR_ALLOC_N(qemuCaps->machineAliases, nmachines) < 0) { virReportOOMError(); goto cleanup; } for (i = 0 ; i < nmachines ; i++) { if (machines[i]->alias) { - if (!(caps->machineAliases[i] = strdup(machines[i]->alias))) { + if (!(qemuCaps->machineAliases[i] = strdup(machines[i]->alias))) { virReportOOMError(); goto cleanup; } } - if (!(caps->machineTypes[i] = strdup(machines[i]->name))) { + if (!(qemuCaps->machineTypes[i] = strdup(machines[i]->name))) { virReportOOMError(); goto cleanup; } if (machines[i]->isDefault) defIdx = i; } - caps->nmachineTypes = nmachines; + qemuCaps->nmachineTypes = nmachines; if (defIdx) - qemuSetDefaultMachine(caps, defIdx); + virQEMUCapsSetDefaultMachine(qemuCaps, defIdx); ret = 0; @@ -2107,8 +2107,8 @@ cleanup: static int -qemuCapsProbeQMPCPUDefinitions(qemuCapsPtr caps, - qemuMonitorPtr mon) +virQEMUCapsProbeQMPCPUDefinitions(virQEMUCapsPtr qemuCaps, + qemuMonitorPtr mon) { int ncpuDefinitions; char **cpuDefinitions; @@ -2116,21 +2116,21 @@ qemuCapsProbeQMPCPUDefinitions(qemuCapsPtr caps, if ((ncpuDefinitions = qemuMonitorGetCPUDefinitions(mon, &cpuDefinitions)) < 0) return -1; - caps->ncpuDefinitions = ncpuDefinitions; - caps->cpuDefinitions = cpuDefinitions; + qemuCaps->ncpuDefinitions = ncpuDefinitions; + qemuCaps->cpuDefinitions = cpuDefinitions; return 0; } static int -qemuCapsProbeQMPKVMState(qemuCapsPtr caps, - qemuMonitorPtr mon) +virQEMUCapsProbeQMPKVMState(virQEMUCapsPtr qemuCaps, + qemuMonitorPtr mon) { bool enabled = false; bool present = false; - if (!qemuCapsGet(caps, QEMU_CAPS_KVM)) + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) return 0; if (qemuMonitorGetKVMState(mon, &enabled, &present) < 0) @@ -2145,28 +2145,28 @@ qemuCapsProbeQMPKVMState(qemuCapsPtr caps, * not enabled by default we need to change the flag. */ if (!present) { - qemuCapsClear(caps, QEMU_CAPS_KVM); + virQEMUCapsClear(qemuCaps, QEMU_CAPS_KVM); } else if (!enabled) { - qemuCapsClear(caps, QEMU_CAPS_KVM); - qemuCapsSet(caps, QEMU_CAPS_ENABLE_KVM); + virQEMUCapsClear(qemuCaps, QEMU_CAPS_KVM); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_ENABLE_KVM); } return 0; } -int qemuCapsProbeQMP(qemuCapsPtr caps, - qemuMonitorPtr mon) +int virQEMUCapsProbeQMP(virQEMUCapsPtr qemuCaps, + qemuMonitorPtr mon) { - VIR_DEBUG("caps=%p mon=%p", caps, mon); + VIR_DEBUG("qemuCaps=%p mon=%p", qemuCaps, mon); - if (caps->usedQMP) + if (qemuCaps->usedQMP) return 0; - if (qemuCapsProbeQMPCommands(caps, mon) < 0) + if (virQEMUCapsProbeQMPCommands(qemuCaps, mon) < 0) return -1; - if (qemuCapsProbeQMPEvents(caps, mon) < 0) + if (virQEMUCapsProbeQMPEvents(qemuCaps, mon) < 0) return -1; return 0; @@ -2176,64 +2176,64 @@ int qemuCapsProbeQMP(qemuCapsPtr caps, #define QEMU_SYSTEM_PREFIX "qemu-system-" static int -qemuCapsInitHelp(qemuCapsPtr caps, uid_t runUid, gid_t runGid) +virQEMUCapsInitHelp(virQEMUCapsPtr qemuCaps, uid_t runUid, gid_t runGid) { virCommandPtr cmd = NULL; unsigned int is_kvm; char *help = NULL; int ret = -1; const char *tmp; - qemuCapsHookData hookData; + virQEMUCapsHookData hookData; - VIR_DEBUG("caps=%p", caps); + VIR_DEBUG("qemuCaps=%p", qemuCaps); - tmp = strstr(caps->binary, QEMU_SYSTEM_PREFIX); + tmp = strstr(qemuCaps->binary, QEMU_SYSTEM_PREFIX); if (tmp) { tmp += strlen(QEMU_SYSTEM_PREFIX); - caps->arch = qemuCapsArchFromString(tmp); + qemuCaps->arch = virQEMUCapsArchFromString(tmp); } else { - caps->arch = virArchFromHost(); + qemuCaps->arch = virArchFromHost(); } hookData.runUid = runUid; hookData.runGid = runGid; - cmd = qemuCapsProbeCommand(caps->binary, NULL, &hookData); + cmd = virQEMUCapsProbeCommand(qemuCaps->binary, NULL, &hookData); virCommandAddArgList(cmd, "-help", NULL); virCommandSetOutputBuffer(cmd, &help); if (virCommandRun(cmd, NULL) < 0) goto cleanup; - if (qemuCapsParseHelpStr(caps->binary, - help, caps, - &caps->version, - &is_kvm, - &caps->kvmVersion, - false) < 0) + if (virQEMUCapsParseHelpStr(qemuCaps->binary, + help, qemuCaps, + &qemuCaps->version, + &is_kvm, + &qemuCaps->kvmVersion, + false) < 0) goto cleanup; /* Currently only x86_64 and i686 support PCI-multibus. */ - if (caps->arch == VIR_ARCH_X86_64 || - caps->arch == VIR_ARCH_I686) { - qemuCapsSet(caps, QEMU_CAPS_PCI_MULTIBUS); + if (qemuCaps->arch == VIR_ARCH_X86_64 || + qemuCaps->arch == VIR_ARCH_I686) { + virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCI_MULTIBUS); } else { /* -no-acpi is not supported on other archs * even if qemu reports it in -help */ - qemuCapsClear(caps, QEMU_CAPS_NO_ACPI); + virQEMUCapsClear(qemuCaps, QEMU_CAPS_NO_ACPI); } - /* qemuCapsExtractDeviceStr will only set additional caps if qemu + /* virQEMUCapsExtractDeviceStr will only set additional caps if qemu * understands the 0.13.0+ notion of "-device driver,". */ - if (qemuCapsGet(caps, QEMU_CAPS_DEVICE) && + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE) && strstr(help, "-device driver,?") && - qemuCapsExtractDeviceStr(caps->binary, caps, &hookData) < 0) + virQEMUCapsExtractDeviceStr(qemuCaps->binary, qemuCaps, &hookData) < 0) goto cleanup; - if (qemuCapsProbeCPUModels(caps, &hookData) < 0) + if (virQEMUCapsProbeCPUModels(qemuCaps, &hookData) < 0) goto cleanup; - if (qemuCapsProbeMachineTypes(caps, &hookData) < 0) + if (virQEMUCapsProbeMachineTypes(qemuCaps, &hookData) < 0) goto cleanup; ret = 0; @@ -2244,14 +2244,14 @@ cleanup: } -static void qemuCapsMonitorNotify(qemuMonitorPtr mon ATTRIBUTE_UNUSED, - virDomainObjPtr vm ATTRIBUTE_UNUSED) +static void virQEMUCapsMonitorNotify(qemuMonitorPtr mon ATTRIBUTE_UNUSED, + virDomainObjPtr vm ATTRIBUTE_UNUSED) { } static qemuMonitorCallbacks callbacks = { - .eofNotify = qemuCapsMonitorNotify, - .errorNotify = qemuCapsMonitorNotify, + .eofNotify = virQEMUCapsMonitorNotify, + .errorNotify = virQEMUCapsMonitorNotify, }; @@ -2259,65 +2259,65 @@ static qemuMonitorCallbacks callbacks = { * for QEMU >= 1.2.0 */ static void -qemuCapsInitQMPBasic(qemuCapsPtr caps) +virQEMUCapsInitQMPBasic(virQEMUCapsPtr qemuCaps) { - qemuCapsSet(caps, QEMU_CAPS_VNC_COLON); - qemuCapsSet(caps, QEMU_CAPS_NO_REBOOT); - qemuCapsSet(caps, QEMU_CAPS_DRIVE); - qemuCapsSet(caps, QEMU_CAPS_NAME); - qemuCapsSet(caps, QEMU_CAPS_UUID); - qemuCapsSet(caps, QEMU_CAPS_VNET_HDR); - qemuCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_TCP); - qemuCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_EXEC); - qemuCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_V2); - qemuCapsSet(caps, QEMU_CAPS_DRIVE_FORMAT); - qemuCapsSet(caps, QEMU_CAPS_VGA); - qemuCapsSet(caps, QEMU_CAPS_0_10); - qemuCapsSet(caps, QEMU_CAPS_MEM_PATH); - qemuCapsSet(caps, QEMU_CAPS_DRIVE_SERIAL); - qemuCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_UNIX); - qemuCapsSet(caps, QEMU_CAPS_CHARDEV); - qemuCapsSet(caps, QEMU_CAPS_MONITOR_JSON); - qemuCapsSet(caps, QEMU_CAPS_BALLOON); - qemuCapsSet(caps, QEMU_CAPS_DEVICE); - qemuCapsSet(caps, QEMU_CAPS_SDL); - qemuCapsSet(caps, QEMU_CAPS_SMP_TOPOLOGY); - qemuCapsSet(caps, QEMU_CAPS_NETDEV); - qemuCapsSet(caps, QEMU_CAPS_RTC); - qemuCapsSet(caps, QEMU_CAPS_VHOST_NET); - qemuCapsSet(caps, QEMU_CAPS_NO_HPET); - qemuCapsSet(caps, QEMU_CAPS_NODEFCONFIG); - qemuCapsSet(caps, QEMU_CAPS_BOOT_MENU); - qemuCapsSet(caps, QEMU_CAPS_FSDEV); - qemuCapsSet(caps, QEMU_CAPS_NAME_PROCESS); - qemuCapsSet(caps, QEMU_CAPS_DRIVE_READONLY); - qemuCapsSet(caps, QEMU_CAPS_SMBIOS_TYPE); - qemuCapsSet(caps, QEMU_CAPS_VGA_NONE); - qemuCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_FD); - qemuCapsSet(caps, QEMU_CAPS_DRIVE_AIO); - qemuCapsSet(caps, QEMU_CAPS_CHARDEV_SPICEVMC); - qemuCapsSet(caps, QEMU_CAPS_DEVICE_QXL_VGA); - qemuCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC); - qemuCapsSet(caps, QEMU_CAPS_NO_SHUTDOWN); - qemuCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_UNSAFE); - qemuCapsSet(caps, QEMU_CAPS_FSDEV_READONLY); - qemuCapsSet(caps, QEMU_CAPS_VIRTIO_BLK_SG_IO); - qemuCapsSet(caps, QEMU_CAPS_DRIVE_COPY_ON_READ); - qemuCapsSet(caps, QEMU_CAPS_CPU_HOST); - qemuCapsSet(caps, QEMU_CAPS_FSDEV_WRITEOUT); - qemuCapsSet(caps, QEMU_CAPS_DRIVE_IOTUNE); - qemuCapsSet(caps, QEMU_CAPS_WAKEUP); - qemuCapsSet(caps, QEMU_CAPS_NO_USER_CONFIG); - qemuCapsSet(caps, QEMU_CAPS_NETDEV_BRIDGE); - qemuCapsSet(caps, QEMU_CAPS_SECCOMP_SANDBOX); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC_COLON); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_REBOOT); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NAME); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_UUID); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNET_HDR); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_TCP); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_EXEC); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_CACHE_V2); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_FORMAT); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VGA); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_0_10); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MEM_PATH); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_SERIAL); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_UNIX); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_CHARDEV); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MONITOR_JSON); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_BALLOON); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_SDL); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_SMP_TOPOLOGY); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_RTC); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VHOST_NET); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_HPET); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NODEFCONFIG); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_BOOT_MENU); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_FSDEV); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NAME_PROCESS); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_READONLY); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_SMBIOS_TYPE); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VGA_NONE); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_AIO); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_CHARDEV_SPICEVMC); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_QXL_VGA); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_SHUTDOWN); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_CACHE_UNSAFE); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_FSDEV_READONLY); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_SG_IO); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_COPY_ON_READ); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_HOST); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_FSDEV_WRITEOUT); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_WAKEUP); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_USER_CONFIG); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV_BRIDGE); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_SECCOMP_SANDBOX); } static int -qemuCapsInitQMP(qemuCapsPtr caps, - const char *libDir, - uid_t runUid, - gid_t runGid) +virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps, + const char *libDir, + uid_t runUid, + gid_t runGid) { int ret = -1; virCommandPtr cmd = NULL; @@ -2329,7 +2329,7 @@ qemuCapsInitQMP(qemuCapsPtr caps, char *monarg = NULL; char *monpath = NULL; char *pidfile = NULL; - qemuCapsHookData hookData; + virQEMUCapsHookData hookData; char *archstr; pid_t pid = 0; virDomainObj vm; @@ -2362,7 +2362,7 @@ qemuCapsInitQMP(qemuCapsPtr caps, config.data.nix.path = monpath; config.data.nix.listen = false; - VIR_DEBUG("Try to get caps via QMP caps=%p", caps); + VIR_DEBUG("Try to get caps via QMP qemuCaps=%p", qemuCaps); /* * We explicitly need to use -daemonize here, rather than @@ -2371,7 +2371,7 @@ qemuCapsInitQMP(qemuCapsPtr caps, * daemonize guarantees control won't return to libvirt * until the socket is present. */ - cmd = virCommandNewArgList(caps->binary, + cmd = virCommandNewArgList(qemuCaps->binary, "-S", "-no-user-config", "-nodefaults", @@ -2385,14 +2385,14 @@ qemuCapsInitQMP(qemuCapsPtr caps, virCommandClearCaps(cmd); hookData.runUid = runUid; hookData.runGid = runGid; - virCommandSetPreExecHook(cmd, qemuCapsHook, &hookData); + virCommandSetPreExecHook(cmd, virQEMUCapsHook, &hookData); if (virCommandRun(cmd, &status) < 0) goto cleanup; if (status != 0) { ret = 0; - VIR_DEBUG("QEMU %s exited with status %d", caps->binary, status); + VIR_DEBUG("QEMU %s exited with status %d", qemuCaps->binary, status); goto cleanup; } @@ -2439,15 +2439,15 @@ qemuCapsInitQMP(qemuCapsPtr caps, goto cleanup; } - caps->version = major * 1000000 + minor * 1000 + micro; - caps->usedQMP = true; + qemuCaps->version = major * 1000000 + minor * 1000 + micro; + qemuCaps->usedQMP = true; - qemuCapsInitQMPBasic(caps); + virQEMUCapsInitQMPBasic(qemuCaps); if (!(archstr = qemuMonitorGetTargetArch(mon))) goto cleanup; - if ((caps->arch = qemuCapsArchFromString(archstr)) == VIR_ARCH_NONE) { + if ((qemuCaps->arch = virQEMUCapsArchFromString(archstr)) == VIR_ARCH_NONE) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unknown QEMU arch %s"), archstr); VIR_FREE(archstr); @@ -2456,23 +2456,23 @@ qemuCapsInitQMP(qemuCapsPtr caps, VIR_FREE(archstr); /* Currently only x86_64 and i686 support PCI-multibus and -no-acpi. */ - if (caps->arch == VIR_ARCH_X86_64 || - caps->arch == VIR_ARCH_I686) { - qemuCapsSet(caps, QEMU_CAPS_PCI_MULTIBUS); - qemuCapsSet(caps, QEMU_CAPS_NO_ACPI); + if (qemuCaps->arch == VIR_ARCH_X86_64 || + qemuCaps->arch == VIR_ARCH_I686) { + virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCI_MULTIBUS); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_ACPI); } - if (qemuCapsProbeQMPCommands(caps, mon) < 0) + if (virQEMUCapsProbeQMPCommands(qemuCaps, mon) < 0) goto cleanup; - if (qemuCapsProbeQMPEvents(caps, mon) < 0) + if (virQEMUCapsProbeQMPEvents(qemuCaps, mon) < 0) goto cleanup; - if (qemuCapsProbeQMPObjects(caps, mon) < 0) + if (virQEMUCapsProbeQMPObjects(qemuCaps, mon) < 0) goto cleanup; - if (qemuCapsProbeQMPMachineTypes(caps, mon) < 0) + if (virQEMUCapsProbeQMPMachineTypes(qemuCaps, mon) < 0) goto cleanup; - if (qemuCapsProbeQMPCPUDefinitions(caps, mon) < 0) + if (virQEMUCapsProbeQMPCPUDefinitions(qemuCaps, mon) < 0) goto cleanup; - if (qemuCapsProbeQMPKVMState(caps, mon) < 0) + if (virQEMUCapsProbeQMPKVMState(qemuCaps, mon) < 0) goto cleanup; ret = 0; @@ -2504,16 +2504,16 @@ cleanup: } -qemuCapsPtr qemuCapsNewForBinary(const char *binary, - const char *libDir, - uid_t runUid, - gid_t runGid) +virQEMUCapsPtr virQEMUCapsNewForBinary(const char *binary, + const char *libDir, + uid_t runUid, + gid_t runGid) { - qemuCapsPtr caps = qemuCapsNew(); + virQEMUCapsPtr qemuCaps = virQEMUCapsNew(); struct stat sb; int rv; - if (!(caps->binary = strdup(binary))) + if (!(qemuCaps->binary = strdup(binary))) goto no_memory; /* We would also want to check faccessat if we cared about ACLs, @@ -2523,7 +2523,7 @@ qemuCapsPtr qemuCapsNewForBinary(const char *binary, binary); goto error; } - caps->mtime = sb.st_mtime; + qemuCaps->mtime = sb.st_mtime; /* Make sure the binary we are about to try exec'ing exists. * Technically we could catch the exec() failure, but that's @@ -2535,51 +2535,51 @@ qemuCapsPtr qemuCapsNewForBinary(const char *binary, goto error; } - if ((rv = qemuCapsInitQMP(caps, libDir, runUid, runGid)) < 0) + if ((rv = virQEMUCapsInitQMP(qemuCaps, libDir, runUid, runGid)) < 0) goto error; - if (!caps->usedQMP && - qemuCapsInitHelp(caps, runUid, runGid) < 0) + if (!qemuCaps->usedQMP && + virQEMUCapsInitHelp(qemuCaps, runUid, runGid) < 0) goto error; - return caps; + return qemuCaps; no_memory: virReportOOMError(); error: - virObjectUnref(caps); - caps = NULL; + virObjectUnref(qemuCaps); + qemuCaps = NULL; return NULL; } -bool qemuCapsIsValid(qemuCapsPtr caps) +bool virQEMUCapsIsValid(virQEMUCapsPtr qemuCaps) { struct stat sb; - if (!caps->binary) + if (!qemuCaps->binary) return true; - if (stat(caps->binary, &sb) < 0) + if (stat(qemuCaps->binary, &sb) < 0) return false; - return sb.st_mtime == caps->mtime; + return sb.st_mtime == qemuCaps->mtime; } static void -qemuCapsHashDataFree(void *payload, const void *key ATTRIBUTE_UNUSED) +virQEMUCapsHashDataFree(void *payload, const void *key ATTRIBUTE_UNUSED) { virObjectUnref(payload); } -qemuCapsCachePtr -qemuCapsCacheNew(const char *libDir, - uid_t runUid, - gid_t runGid) +virQEMUCapsCachePtr +virQEMUCapsCacheNew(const char *libDir, + uid_t runUid, + gid_t runGid) { - qemuCapsCachePtr cache; + virQEMUCapsCachePtr cache; if (VIR_ALLOC(cache) < 0) { virReportOOMError(); @@ -2593,7 +2593,7 @@ qemuCapsCacheNew(const char *libDir, return NULL; } - if (!(cache->binaries = virHashCreate(10, qemuCapsHashDataFree))) + if (!(cache->binaries = virHashCreate(10, virQEMUCapsHashDataFree))) goto error; if (!(cache->libDir = strdup(libDir))) { virReportOOMError(); @@ -2606,19 +2606,19 @@ qemuCapsCacheNew(const char *libDir, return cache; error: - qemuCapsCacheFree(cache); + virQEMUCapsCacheFree(cache); return NULL; } -qemuCapsPtr -qemuCapsCacheLookup(qemuCapsCachePtr cache, const char *binary) +virQEMUCapsPtr +virQEMUCapsCacheLookup(virQEMUCapsCachePtr cache, const char *binary) { - qemuCapsPtr ret = NULL; + virQEMUCapsPtr ret = NULL; virMutexLock(&cache->lock); ret = virHashLookup(cache->binaries, binary); if (ret && - !qemuCapsIsValid(ret)) { + !virQEMUCapsIsValid(ret)) { VIR_DEBUG("Cached capabilities %p no longer valid for %s", ret, binary); virHashRemoveEntry(cache->binaries, binary); @@ -2627,8 +2627,8 @@ qemuCapsCacheLookup(qemuCapsCachePtr cache, const char *binary) if (!ret) { VIR_DEBUG("Creating capabilities for %s", binary); - ret = qemuCapsNewForBinary(binary, cache->libDir, - cache->runUid, cache->runGid); + ret = virQEMUCapsNewForBinary(binary, cache->libDir, + cache->runUid, cache->runGid); if (ret) { VIR_DEBUG("Caching capabilities %p for %s", ret, binary); @@ -2645,23 +2645,23 @@ qemuCapsCacheLookup(qemuCapsCachePtr cache, const char *binary) } -qemuCapsPtr -qemuCapsCacheLookupCopy(qemuCapsCachePtr cache, const char *binary) +virQEMUCapsPtr +virQEMUCapsCacheLookupCopy(virQEMUCapsCachePtr cache, const char *binary) { - qemuCapsPtr caps = qemuCapsCacheLookup(cache, binary); - qemuCapsPtr ret; + virQEMUCapsPtr qemuCaps = virQEMUCapsCacheLookup(cache, binary); + virQEMUCapsPtr ret; - if (!caps) + if (!qemuCaps) return NULL; - ret = qemuCapsNewCopy(caps); - virObjectUnref(caps); + ret = virQEMUCapsNewCopy(qemuCaps); + virObjectUnref(qemuCaps); return ret; } void -qemuCapsCacheFree(qemuCapsCachePtr cache) +virQEMUCapsCacheFree(virQEMUCapsCachePtr cache) { if (!cache) return; @@ -2673,7 +2673,7 @@ qemuCapsCacheFree(qemuCapsCachePtr cache) } bool -qemuCapsUsedQMP(qemuCapsPtr caps) +virQEMUCapsUsedQMP(virQEMUCapsPtr qemuCaps) { - return caps->usedQMP; + return qemuCaps->usedQMP; } diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index cb0dad0706..e69d558e24 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -31,7 +31,7 @@ # include "qemu_monitor.h" /* Internal flags to keep track of qemu command line capabilities */ -enum qemuCapsFlags { +enum virQEMUCapsFlags { QEMU_CAPS_KQEMU = 0, /* Whether KQEMU is compiled in */ QEMU_CAPS_VNC_COLON = 1, /* VNC takes or address + display */ QEMU_CAPS_NO_REBOOT = 2, /* Is the -no-reboot flag available */ @@ -170,79 +170,81 @@ enum qemuCapsFlags { QEMU_CAPS_LAST, /* this must always be the last item */ }; -typedef struct _qemuCaps qemuCaps; -typedef qemuCaps *qemuCapsPtr; +typedef struct _virQEMUCaps virQEMUCaps; +typedef virQEMUCaps *virQEMUCapsPtr; -typedef struct _qemuCapsCache qemuCapsCache; -typedef qemuCapsCache *qemuCapsCachePtr; +typedef struct _virQEMUCapsCache virQEMUCapsCache; +typedef virQEMUCapsCache *virQEMUCapsCachePtr; -qemuCapsPtr qemuCapsNew(void); -qemuCapsPtr qemuCapsNewCopy(qemuCapsPtr caps); -qemuCapsPtr qemuCapsNewForBinary(const char *binary, - const char *libDir, - uid_t runUid, - gid_t runGid); +virQEMUCapsPtr virQEMUCapsNew(void); +virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps); +virQEMUCapsPtr virQEMUCapsNewForBinary(const char *binary, + const char *libDir, + uid_t runUid, + gid_t runGid); -int qemuCapsProbeQMP(qemuCapsPtr caps, - qemuMonitorPtr mon); +int virQEMUCapsProbeQMP(virQEMUCapsPtr qemuCaps, + qemuMonitorPtr mon); -void qemuCapsSet(qemuCapsPtr caps, - enum qemuCapsFlags flag) ATTRIBUTE_NONNULL(1); +void virQEMUCapsSet(virQEMUCapsPtr qemuCaps, + enum virQEMUCapsFlags flag) ATTRIBUTE_NONNULL(1); -void qemuCapsSetList(qemuCapsPtr caps, ...) ATTRIBUTE_NONNULL(1); +void virQEMUCapsSetList(virQEMUCapsPtr qemuCaps, ...) ATTRIBUTE_NONNULL(1); -void qemuCapsClear(qemuCapsPtr caps, - enum qemuCapsFlags flag) ATTRIBUTE_NONNULL(1); +void virQEMUCapsClear(virQEMUCapsPtr qemuCaps, + enum virQEMUCapsFlags flag) ATTRIBUTE_NONNULL(1); -bool qemuCapsGet(qemuCapsPtr caps, - enum qemuCapsFlags flag); +bool virQEMUCapsGet(virQEMUCapsPtr qemuCaps, + enum virQEMUCapsFlags flag); -char *qemuCapsFlagsString(qemuCapsPtr caps); +char *virQEMUCapsFlagsString(virQEMUCapsPtr qemuCaps); -const char *qemuCapsGetBinary(qemuCapsPtr caps); -virArch qemuCapsGetArch(qemuCapsPtr caps); -unsigned int qemuCapsGetVersion(qemuCapsPtr caps); -unsigned int qemuCapsGetKVMVersion(qemuCapsPtr caps); -int qemuCapsAddCPUDefinition(qemuCapsPtr caps, - const char *name); -size_t qemuCapsGetCPUDefinitions(qemuCapsPtr caps, - char ***names); -size_t qemuCapsGetMachineTypes(qemuCapsPtr caps, - char ***names); -const char *qemuCapsGetCanonicalMachine(qemuCapsPtr caps, - const char *name); +const char *virQEMUCapsGetBinary(virQEMUCapsPtr qemuCaps); +virArch virQEMUCapsGetArch(virQEMUCapsPtr qemuCaps); +unsigned int virQEMUCapsGetVersion(virQEMUCapsPtr qemuCaps); +unsigned int virQEMUCapsGetKVMVersion(virQEMUCapsPtr qemuCaps); +int virQEMUCapsAddCPUDefinition(virQEMUCapsPtr qemuCaps, + const char *name); +size_t virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr qemuCaps, + char ***names); +size_t virQEMUCapsGetMachineTypes(virQEMUCapsPtr qemuCaps, + char ***names); +const char *virQEMUCapsGetCanonicalMachine(virQEMUCapsPtr qemuCaps, + const char *name); -int qemuCapsGetMachineTypesCaps(qemuCapsPtr caps, - size_t *nmachines, - virCapsGuestMachinePtr **machines); +int virQEMUCapsGetMachineTypesCaps(virQEMUCapsPtr qemuCaps, + size_t *nmachines, + virCapsGuestMachinePtr **machines); -bool qemuCapsIsValid(qemuCapsPtr caps); +bool virQEMUCapsIsValid(virQEMUCapsPtr qemuCaps); -qemuCapsCachePtr qemuCapsCacheNew(const char *libDir, - uid_t uid, gid_t gid); -qemuCapsPtr qemuCapsCacheLookup(qemuCapsCachePtr cache, const char *binary); -qemuCapsPtr qemuCapsCacheLookupCopy(qemuCapsCachePtr cache, const char *binary); -void qemuCapsCacheFree(qemuCapsCachePtr cache); +virQEMUCapsCachePtr virQEMUCapsCacheNew(const char *libDir, + uid_t uid, gid_t gid); +virQEMUCapsPtr virQEMUCapsCacheLookup(virQEMUCapsCachePtr cache, + const char *binary); +virQEMUCapsPtr virQEMUCapsCacheLookupCopy(virQEMUCapsCachePtr cache, + const char *binary); +void virQEMUCapsCacheFree(virQEMUCapsCachePtr cache); -virCapsPtr qemuCapsInit(qemuCapsCachePtr cache); +virCapsPtr virQEMUCapsInit(virQEMUCapsCachePtr cache); -int qemuCapsGetDefaultVersion(virCapsPtr caps, - qemuCapsCachePtr capsCache, - unsigned int *version); +int virQEMUCapsGetDefaultVersion(virCapsPtr caps, + virQEMUCapsCachePtr capsCache, + unsigned int *version); /* Only for use by test suite */ -int qemuCapsParseHelpStr(const char *qemu, - const char *str, - qemuCapsPtr caps, - unsigned int *version, - unsigned int *is_kvm, - unsigned int *kvm_version, - bool check_yajl); +int virQEMUCapsParseHelpStr(const char *qemu, + const char *str, + virQEMUCapsPtr qemuCaps, + unsigned int *version, + unsigned int *is_kvm, + unsigned int *kvm_version, + bool check_yajl); /* Only for use by test suite */ -int qemuCapsParseDeviceStr(qemuCapsPtr caps, const char *str); +int virQEMUCapsParseDeviceStr(virQEMUCapsPtr qemuCaps, const char *str); -VIR_ENUM_DECL(qemuCaps); +VIR_ENUM_DECL(virQEMUCaps); -bool qemuCapsUsedQMP(qemuCapsPtr caps); +bool virQEMUCapsUsedQMP(virQEMUCapsPtr qemuCaps); #endif /* __QEMU_CAPABILITIES_H__*/ diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 8a92d04e38..e82d2e491e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -146,7 +146,7 @@ int qemuPhysIfaceConnect(virDomainDefPtr def, virQEMUDriverPtr driver, virDomainNetDefPtr net, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, enum virNetDevVPortProfileOp vmop) { int rc; @@ -154,7 +154,7 @@ qemuPhysIfaceConnect(virDomainDefPtr def, int vnet_hdr = 0; virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); - if (qemuCapsGet(caps, QEMU_CAPS_VNET_HDR) && + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VNET_HDR) && net->model && STREQ(net->model, "virtio")) vnet_hdr = 1; @@ -198,7 +198,7 @@ qemuNetworkIfaceConnect(virDomainDefPtr def, virConnectPtr conn, virQEMUDriverPtr driver, virDomainNetDefPtr net, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { char *brname = NULL; int err; @@ -265,7 +265,7 @@ qemuNetworkIfaceConnect(virDomainDefPtr def, template_ifname = true; } - if (qemuCapsGet(caps, QEMU_CAPS_VNET_HDR) && + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VNET_HDR) && net->model && STREQ(net->model, "virtio")) { tap_create_flags |= VIR_NETDEV_TAP_CREATE_VNET_HDR; } @@ -319,7 +319,7 @@ cleanup: int qemuOpenVhostNet(virDomainDefPtr def, virDomainNetDefPtr net, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, int *vhostfd) { *vhostfd = -1; /* assume we won't use vhost */ @@ -332,9 +332,9 @@ qemuOpenVhostNet(virDomainDefPtr def, /* If qemu doesn't support vhost-net mode (including the -netdev command * option), don't try to open the device. */ - if (!(qemuCapsGet(caps, QEMU_CAPS_VHOST_NET) && - qemuCapsGet(caps, QEMU_CAPS_NETDEV) && - qemuCapsGet(caps, QEMU_CAPS_DEVICE))) { + if (!(virQEMUCapsGet(qemuCaps, QEMU_CAPS_VHOST_NET) && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV) && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))) { if (net->driver.virtio.name == VIR_DOMAIN_NET_BACKEND_TYPE_VHOST) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("vhost-net is not supported with " @@ -417,11 +417,11 @@ static int qemuAssignDeviceDiskAliasLegacy(virDomainDiskDefPtr disk) char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { char *ret; - if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { if (virAsprintf(&ret, "%s%s", QEMU_DRIVE_HOST_PREFIX, disk->info.alias) < 0) { virReportOOMError(); return NULL; @@ -491,13 +491,13 @@ static int qemuAssignDeviceDiskAliasFixed(virDomainDiskDefPtr disk) static int qemuSetScsiControllerModel(virDomainDefPtr def, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, int *model) { if (*model > 0) { switch (*model) { case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC: - if (!qemuCapsGet(caps, QEMU_CAPS_SCSI_LSI)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("This QEMU doesn't support " "lsi scsi controller")); @@ -505,7 +505,7 @@ qemuSetScsiControllerModel(virDomainDefPtr def, } break; case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI: - if (!qemuCapsGet(caps, QEMU_CAPS_VIRTIO_SCSI_PCI)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_SCSI_PCI)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("This QEMU doesn't support " "virtio scsi controller")); @@ -525,7 +525,7 @@ qemuSetScsiControllerModel(virDomainDefPtr def, if ((def->os.arch == VIR_ARCH_PPC64) && STREQ(def->os.machine, "pseries")) { *model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI; - } else if (qemuCapsGet(caps, QEMU_CAPS_SCSI_LSI)) { + } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI)) { *model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC; } else { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -541,7 +541,7 @@ qemuSetScsiControllerModel(virDomainDefPtr def, static int qemuAssignDeviceDiskAliasCustom(virDomainDefPtr def, virDomainDiskDefPtr disk, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { const char *prefix = virDomainDiskBusTypeToString(disk->bus); int controllerModel = -1; @@ -552,7 +552,7 @@ qemuAssignDeviceDiskAliasCustom(virDomainDefPtr def, virDomainDiskFindControllerModel(def, disk, VIR_DOMAIN_CONTROLLER_TYPE_SCSI); - if ((qemuSetScsiControllerModel(def, caps, &controllerModel)) < 0) + if ((qemuSetScsiControllerModel(def, qemuCaps, &controllerModel)) < 0) return -1; } @@ -588,11 +588,11 @@ no_memory: int qemuAssignDeviceDiskAlias(virDomainDefPtr vmdef, virDomainDiskDefPtr def, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { - if (qemuCapsGet(caps, QEMU_CAPS_DRIVE)) { - if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) - return qemuAssignDeviceDiskAliasCustom(vmdef, def, caps); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) + return qemuAssignDeviceDiskAliasCustom(vmdef, def, qemuCaps); else return qemuAssignDeviceDiskAliasFixed(def); } else { @@ -703,16 +703,16 @@ qemuAssignDeviceControllerAlias(virDomainControllerDefPtr controller) int -qemuAssignDeviceAliases(virDomainDefPtr def, qemuCapsPtr caps) +qemuAssignDeviceAliases(virDomainDefPtr def, virQEMUCapsPtr qemuCaps) { int i; for (i = 0; i < def->ndisks ; i++) { - if (qemuAssignDeviceDiskAlias(def, def->disks[i], caps) < 0) + if (qemuAssignDeviceDiskAlias(def, def->disks[i], qemuCaps) < 0) return -1; } - if (qemuCapsGet(caps, QEMU_CAPS_NET_NAME) || - qemuCapsGet(caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NET_NAME) || + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { for (i = 0; i < def->nnets ; i++) { /* type='hostdev' interfaces are also on the hostdevs list, * and will have their alias assigned with other hostdevs. @@ -724,7 +724,7 @@ qemuAssignDeviceAliases(virDomainDefPtr def, qemuCapsPtr caps) } } - if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE)) + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) return 0; for (i = 0; i < def->nfss ; i++) { @@ -838,10 +838,10 @@ qemuDomainPrimeS390VirtioDevices(virDomainDefPtr def, } static void -qemuDomainAssignS390Addresses(virDomainDefPtr def, qemuCapsPtr caps) +qemuDomainAssignS390Addresses(virDomainDefPtr def, virQEMUCapsPtr qemuCaps) { /* deal with legacy virtio-s390 */ - if (qemuCapsGet(caps, QEMU_CAPS_VIRTIO_S390)) + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390)) qemuDomainPrimeS390VirtioDevices( def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390); } @@ -900,7 +900,7 @@ qemuAssignSpaprVIOAddress(virDomainDefPtr def, virDomainDeviceInfoPtr info, } int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { int i, ret = -1; int model; @@ -919,7 +919,7 @@ int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def, for (i = 0 ; i < def->ncontrollers; i++) { model = def->controllers[i]->model; if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) { - if (qemuSetScsiControllerModel(def, caps, &model) < 0) + if (qemuSetScsiControllerModel(def, qemuCaps, &model) < 0) goto cleanup; } @@ -1057,18 +1057,18 @@ cleanup: int qemuDomainAssignPCIAddresses(virDomainDefPtr def, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, virDomainObjPtr obj) { int ret = -1; qemuDomainPCIAddressSetPtr addrs = NULL; qemuDomainObjPrivatePtr priv = NULL; - if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { if (!(addrs = qemuDomainPCIAddressSetCreate(def))) goto cleanup; - if (qemuAssignDevicePCISlots(def, caps, addrs) < 0) + if (qemuAssignDevicePCISlots(def, qemuCaps, addrs) < 0) goto cleanup; } @@ -1094,18 +1094,18 @@ cleanup: } int qemuDomainAssignAddresses(virDomainDefPtr def, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, virDomainObjPtr obj) { int rc; - rc = qemuDomainAssignSpaprVIOAddresses(def, caps); + rc = qemuDomainAssignSpaprVIOAddresses(def, qemuCaps); if (rc) return rc; - qemuDomainAssignS390Addresses(def, caps); + qemuDomainAssignS390Addresses(def, qemuCaps); - return qemuDomainAssignPCIAddresses(def, caps, obj); + return qemuDomainAssignPCIAddresses(def, qemuCaps, obj); } static void @@ -1427,14 +1427,14 @@ int qemuDomainPCIAddressSetNextAddr(qemuDomainPCIAddressSetPtr addrs, */ int qemuAssignDevicePCISlots(virDomainDefPtr def, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, qemuDomainPCIAddressSetPtr addrs) { size_t i, j; bool reservedIDE = false; bool reservedUSB = false; int function; - bool qemuDeviceVideoUsable = qemuCapsGet(caps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY); + bool qemuDeviceVideoUsable = virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY); /* Host bridge */ if (qemuDomainPCIAddressReserveSlot(addrs, 0) < 0) @@ -1755,7 +1755,7 @@ qemuUsbId(virBufferPtr buf, int idx) static int qemuBuildDeviceAddressStr(virBufferPtr buf, virDomainDeviceInfoPtr info, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { if (info->addr.pci.domain != 0) { @@ -1768,7 +1768,7 @@ qemuBuildDeviceAddressStr(virBufferPtr buf, _("Only PCI device addresses with bus=0 are supported")); return -1; } - if (qemuCapsGet(caps, QEMU_CAPS_PCI_MULTIFUNCTION)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_MULTIFUNCTION)) { if (info->addr.pci.function > 7) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("The function of PCI device addresses must " @@ -1796,7 +1796,7 @@ qemuBuildDeviceAddressStr(virBufferPtr buf, * When QEMU grows support for > 1 PCI domain, then pci.0 change * to pciNN.0 where NN is the domain number */ - if (qemuCapsGet(caps, QEMU_CAPS_PCI_MULTIBUS)) + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_MULTIBUS)) virBufferAsprintf(buf, ",bus=pci.0"); else virBufferAsprintf(buf, ",bus=pci"); @@ -1822,7 +1822,7 @@ qemuBuildDeviceAddressStr(virBufferPtr buf, static int qemuBuildRomStr(virBufferPtr buf, virDomainDeviceInfoPtr info, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { if (info->rombar || info->romfile) { if (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { @@ -1830,7 +1830,7 @@ qemuBuildRomStr(virBufferPtr buf, "%s", _("rombar and romfile are supported only for PCI devices")); return -1; } - if (!qemuCapsGet(caps, QEMU_CAPS_PCI_ROMBAR)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_ROMBAR)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("rombar and romfile not supported in this QEMU binary")); return -1; @@ -1855,9 +1855,9 @@ qemuBuildRomStr(virBufferPtr buf, static int qemuBuildIoEventFdStr(virBufferPtr buf, enum virDomainIoEventFd use, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { - if (use && qemuCapsGet(caps, QEMU_CAPS_VIRTIO_IOEVENTFD)) + if (use && virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_IOEVENTFD)) virBufferAsprintf(buf, ",ioeventfd=%s", virDomainIoEventFdTypeToString(use)); return 0; @@ -2233,7 +2233,7 @@ char * qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, virDomainDiskDefPtr disk, bool bootable, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { virBuffer opt = VIR_BUFFER_INITIALIZER; const char *bus = virDomainDiskQEMUBusTypeToString(disk->bus); @@ -2312,7 +2312,7 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, break; case VIR_DOMAIN_DISK_BUS_VIRTIO: - if (qemuCapsGet(caps, QEMU_CAPS_VIRTIO_S390) && + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390) && (disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390)) { /* Paranoia - leave in here for now */ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -2398,24 +2398,24 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, virBufferEscape(&opt, ',', ",", "file=%s,", disk->src); } } - if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) virBufferAddLit(&opt, "if=none"); else virBufferAsprintf(&opt, "if=%s", bus); if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM) { if ((disk->bus == VIR_DOMAIN_DISK_BUS_SCSI)) { - if (!qemuCapsGet(caps, QEMU_CAPS_SCSI_CD)) + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_CD)) virBufferAddLit(&opt, ",media=cdrom"); } else if (disk->bus == VIR_DOMAIN_DISK_BUS_IDE) { - if (!qemuCapsGet(caps, QEMU_CAPS_IDE_CD)) + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_IDE_CD)) virBufferAddLit(&opt, ",media=cdrom"); } else { virBufferAddLit(&opt, ",media=cdrom"); } } - if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { virBufferAsprintf(&opt, ",id=%s%s", QEMU_DRIVE_HOST_PREFIX, disk->info.alias); } else { if (busid == -1 && unitid == -1) { @@ -2429,13 +2429,13 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, } } if (bootable && - qemuCapsGet(caps, QEMU_CAPS_DRIVE_BOOT) && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_BOOT) && (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK || disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) && disk->bus != VIR_DOMAIN_DISK_BUS_IDE) virBufferAddLit(&opt, ",boot=on"); if (disk->readonly && - qemuCapsGet(caps, QEMU_CAPS_DRIVE_READONLY)) + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_READONLY)) virBufferAddLit(&opt, ",readonly=on"); if (disk->transient) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -2444,7 +2444,7 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, } if (disk->format > 0 && disk->type != VIR_DOMAIN_DISK_TYPE_DIR && - qemuCapsGet(caps, QEMU_CAPS_DRIVE_FORMAT)) + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_FORMAT)) virBufferAsprintf(&opt, ",format=%s", virStorageFileFormatTypeToString(disk->format)); @@ -2463,7 +2463,7 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, } if (disk->serial && - qemuCapsGet(caps, QEMU_CAPS_DRIVE_SERIAL)) { + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_SERIAL)) { if (qemuSafeSerialParamValue(disk->serial) < 0) goto error; virBufferAsprintf(&opt, ",serial=%s", disk->serial); @@ -2472,17 +2472,17 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, if (disk->cachemode) { const char *mode = NULL; - if (qemuCapsGet(caps, QEMU_CAPS_DRIVE_CACHE_V2)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_CACHE_V2)) { mode = qemuDiskCacheV2TypeToString(disk->cachemode); if (disk->cachemode == VIR_DOMAIN_DISK_CACHE_DIRECTSYNC && - !qemuCapsGet(caps, QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC)) { + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("disk cache mode 'directsync' is not " "supported by this QEMU")); goto error; } else if (disk->cachemode == VIR_DOMAIN_DISK_CACHE_UNSAFE && - !qemuCapsGet(caps, QEMU_CAPS_DRIVE_CACHE_UNSAFE)) { + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_CACHE_UNSAFE)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("disk cache mode 'unsafe' is not " "supported by this QEMU")); @@ -2498,7 +2498,7 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, } if (disk->copy_on_read) { - if (qemuCapsGet(caps, QEMU_CAPS_DRIVE_COPY_ON_READ)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_COPY_ON_READ)) { virBufferAsprintf(&opt, ",copy-on-read=%s", virDomainDiskCopyOnReadTypeToString(disk->copy_on_read)); } else { @@ -2508,7 +2508,7 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, } } - if (qemuCapsGet(caps, QEMU_CAPS_MONITOR_JSON)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MONITOR_JSON)) { const char *wpolicy = NULL, *rpolicy = NULL; if (disk->error_policy) @@ -2534,7 +2534,7 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, } if (disk->iomode) { - if (qemuCapsGet(caps, QEMU_CAPS_DRIVE_AIO)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_AIO)) { virBufferAsprintf(&opt, ",aio=%s", virDomainDiskIoTypeToString(disk->iomode)); } else { @@ -2552,7 +2552,7 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, disk->blkdeviotune.total_iops_sec || disk->blkdeviotune.read_iops_sec || disk->blkdeviotune.write_iops_sec) && - !qemuCapsGet(caps, QEMU_CAPS_DRIVE_IOTUNE)) { + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("block I/O throttling not supported with this " "QEMU binary")); @@ -2605,7 +2605,7 @@ char * qemuBuildDriveDevStr(virDomainDefPtr def, virDomainDiskDefPtr disk, int bootindex, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { virBuffer opt = VIR_BUFFER_INITIALIZER; const char *bus = virDomainDiskQEMUBusTypeToString(disk->bus); @@ -2651,7 +2651,7 @@ qemuBuildDriveDevStr(virDomainDefPtr def, virDomainDiskTypeToString(disk->type)); goto error; } - if (!qemuCapsGet(caps, QEMU_CAPS_VIRTIO_BLK_SG_IO)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_SG_IO)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("disk device='lun' is not supported by this QEMU")); goto error; @@ -2678,14 +2678,14 @@ qemuBuildDriveDevStr(virDomainDefPtr def, } if (disk->wwn && - !qemuCapsGet(caps, QEMU_CAPS_IDE_DRIVE_WWN)) { + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_IDE_DRIVE_WWN)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Setting wwn for ide disk is not supported " "by this QEMU")); goto error; } - if (qemuCapsGet(caps, QEMU_CAPS_IDE_CD)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_IDE_CD)) { if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM) virBufferAddLit(&opt, "ide-cd"); else @@ -2700,7 +2700,7 @@ qemuBuildDriveDevStr(virDomainDefPtr def, break; case VIR_DOMAIN_DISK_BUS_SCSI: if (disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) { - if (!qemuCapsGet(caps, QEMU_CAPS_SCSI_BLOCK)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_BLOCK)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("This QEMU doesn't support scsi-block for " "lun passthrough")); @@ -2709,7 +2709,7 @@ qemuBuildDriveDevStr(virDomainDefPtr def, } if (disk->wwn && - !qemuCapsGet(caps, QEMU_CAPS_SCSI_DISK_WWN)) { + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_DISK_WWN)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Setting wwn for scsi disk is not supported " "by this QEMU")); @@ -2720,7 +2720,7 @@ qemuBuildDriveDevStr(virDomainDefPtr def, * same QEMU release (1.2.0). */ if ((disk->vendor || disk->product) && - !qemuCapsGet(caps, QEMU_CAPS_SCSI_DISK_WWN)) { + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_DISK_WWN)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Setting vendor or product for scsi disk is not " "supported by this QEMU")); @@ -2730,7 +2730,7 @@ qemuBuildDriveDevStr(virDomainDefPtr def, controllerModel = virDomainDiskFindControllerModel(def, disk, VIR_DOMAIN_CONTROLLER_TYPE_SCSI); - if ((qemuSetScsiControllerModel(def, caps, &controllerModel)) < 0) + if ((qemuSetScsiControllerModel(def, qemuCaps, &controllerModel)) < 0) goto error; if (controllerModel == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC) { @@ -2744,7 +2744,7 @@ qemuBuildDriveDevStr(virDomainDefPtr def, if (disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) { virBufferAddLit(&opt, "scsi-block"); } else { - if (qemuCapsGet(caps, QEMU_CAPS_SCSI_CD)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_CD)) { if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM) virBufferAddLit(&opt, "scsi-cd"); else @@ -2759,7 +2759,7 @@ qemuBuildDriveDevStr(virDomainDefPtr def, disk->info.addr.drive.bus, disk->info.addr.drive.unit); } else { - if (!qemuCapsGet(caps, QEMU_CAPS_SCSI_DISK_CHANNEL)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_DISK_CHANNEL)) { if (disk->info.addr.drive.target > 7) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("This QEMU doesn't support target " @@ -2777,7 +2777,7 @@ qemuBuildDriveDevStr(virDomainDefPtr def, } if (disk->device != VIR_DOMAIN_DISK_DEVICE_LUN) { - if (qemuCapsGet(caps, QEMU_CAPS_SCSI_CD)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_CD)) { if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM) virBufferAddLit(&opt, "scsi-cd"); else @@ -2808,7 +2808,7 @@ qemuBuildDriveDevStr(virDomainDefPtr def, goto error; } - if (qemuCapsGet(caps, QEMU_CAPS_IDE_CD)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_IDE_CD)) { if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM) virBufferAddLit(&opt, "ide-cd"); else @@ -2828,13 +2828,13 @@ qemuBuildDriveDevStr(virDomainDefPtr def, } else { virBufferAddLit(&opt, "virtio-blk-pci"); } - qemuBuildIoEventFdStr(&opt, disk->ioeventfd, caps); + qemuBuildIoEventFdStr(&opt, disk->ioeventfd, qemuCaps); if (disk->event_idx && - qemuCapsGet(caps, QEMU_CAPS_VIRTIO_BLK_EVENT_IDX)) { + virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_EVENT_IDX)) { virBufferAsprintf(&opt, ",event_idx=%s", virDomainVirtioEventIdxTypeToString(disk->event_idx)); } - if (qemuCapsGet(caps, QEMU_CAPS_VIRTIO_BLK_SCSI)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_SCSI)) { /* if sg_io is true but the scsi option isn't supported, * that means it's just always on in this version of qemu. */ @@ -2842,13 +2842,13 @@ qemuBuildDriveDevStr(virDomainDefPtr def, (disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) ? "on" : "off"); } - if (qemuBuildDeviceAddressStr(&opt, &disk->info, caps) < 0) + if (qemuBuildDeviceAddressStr(&opt, &disk->info, qemuCaps) < 0) goto error; break; case VIR_DOMAIN_DISK_BUS_USB: virBufferAddLit(&opt, "usb-storage"); - if (qemuBuildDeviceAddressStr(&opt, &disk->info, caps) < 0) + if (qemuBuildDeviceAddressStr(&opt, &disk->info, qemuCaps) < 0) goto error; break; default: @@ -2858,9 +2858,9 @@ qemuBuildDriveDevStr(virDomainDefPtr def, } virBufferAsprintf(&opt, ",drive=%s%s", QEMU_DRIVE_HOST_PREFIX, disk->info.alias); virBufferAsprintf(&opt, ",id=%s", disk->info.alias); - if (bootindex && qemuCapsGet(caps, QEMU_CAPS_BOOTINDEX)) + if (bootindex && virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX)) virBufferAsprintf(&opt, ",bootindex=%d", bootindex); - if (qemuCapsGet(caps, QEMU_CAPS_BLOCKIO)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKIO)) { if (disk->blockio.logical_block_size > 0) virBufferAsprintf(&opt, ",logical_block_size=%u", disk->blockio.logical_block_size); @@ -2892,7 +2892,7 @@ error: char *qemuBuildFSStr(virDomainFSDefPtr fs, - qemuCapsPtr caps ATTRIBUTE_UNUSED) + virQEMUCapsPtr qemuCaps ATTRIBUTE_UNUSED) { virBuffer opt = VIR_BUFFER_INITIALIZER; const char *driver = qemuDomainFSDriverTypeToString(fs->fsdriver); @@ -2931,7 +2931,7 @@ char *qemuBuildFSStr(virDomainFSDefPtr fs, } if (fs->wrpolicy) { - if (qemuCapsGet(caps, QEMU_CAPS_FSDEV_WRITEOUT)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_FSDEV_WRITEOUT)) { virBufferAsprintf(&opt, ",writeout=%s", wrpolicy); } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -2944,7 +2944,7 @@ char *qemuBuildFSStr(virDomainFSDefPtr fs, virBufferAsprintf(&opt, ",path=%s", fs->src); if (fs->readonly) { - if (qemuCapsGet(caps, QEMU_CAPS_FSDEV_READONLY)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_FSDEV_READONLY)) { virBufferAddLit(&opt, ",readonly"); } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -2969,7 +2969,7 @@ error: char * qemuBuildFSDevStr(virDomainFSDefPtr fs, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { virBuffer opt = VIR_BUFFER_INITIALIZER; @@ -2984,7 +2984,7 @@ qemuBuildFSDevStr(virDomainFSDefPtr fs, virBufferAsprintf(&opt, ",fsdev=%s%s", QEMU_FSDEV_HOST_PREFIX, fs->info.alias); virBufferAsprintf(&opt, ",mount_tag=%s", fs->dst); - if (qemuBuildDeviceAddressStr(&opt, &fs->info, caps) < 0) + if (qemuBuildDeviceAddressStr(&opt, &fs->info, qemuCaps) < 0) goto error; if (virBufferError(&opt)) { @@ -3030,7 +3030,7 @@ qemuControllerModelUSBToCaps(int model) static int qemuBuildUSBControllerDevStr(virDomainDefPtr domainDef, virDomainControllerDefPtr def, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, virBuffer *buf) { const char *smodel; @@ -3048,7 +3048,7 @@ qemuBuildUSBControllerDevStr(virDomainDefPtr domainDef, smodel = qemuControllerModelUSBTypeToString(model); flags = qemuControllerModelUSBToCaps(model); - if (flags == -1 || !qemuCapsGet(caps, flags)) { + if (flags == -1 || !virQEMUCapsGet(qemuCaps, flags)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("%s not supported in this QEMU binary"), smodel); return -1; @@ -3071,7 +3071,7 @@ qemuBuildUSBControllerDevStr(virDomainDefPtr domainDef, char * qemuBuildControllerDevStr(virDomainDefPtr domainDef, virDomainControllerDefPtr def, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, int *nusbcontroller) { virBuffer buf = VIR_BUFFER_INITIALIZER; @@ -3080,7 +3080,7 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef, switch (def->type) { case VIR_DOMAIN_CONTROLLER_TYPE_SCSI: model = def->model; - if ((qemuSetScsiControllerModel(domainDef, caps, &model)) < 0) + if ((qemuSetScsiControllerModel(domainDef, qemuCaps, &model)) < 0) return NULL; switch (model) { @@ -3131,7 +3131,7 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef, break; case VIR_DOMAIN_CONTROLLER_TYPE_USB: - if (qemuBuildUSBControllerDevStr(domainDef, def, caps, &buf) == -1) + if (qemuBuildUSBControllerDevStr(domainDef, def, qemuCaps, &buf) == -1) goto error; if (nusbcontroller) @@ -3148,7 +3148,7 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef, goto error; } - if (qemuBuildDeviceAddressStr(&buf, &def->info, caps) < 0) + if (qemuBuildDeviceAddressStr(&buf, &def->info, qemuCaps) < 0) goto error; if (virBufferError(&buf)) { @@ -3193,7 +3193,7 @@ char * qemuBuildNicDevStr(virDomainNetDefPtr net, int vlan, int bootindex, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { virBuffer buf = VIR_BUFFER_INITIALIZER; const char *nic; @@ -3215,7 +3215,7 @@ qemuBuildNicDevStr(virDomainNetDefPtr net, virBufferAdd(&buf, nic, strlen(nic)); if (usingVirtio && net->driver.virtio.txmode) { - if (qemuCapsGet(caps, QEMU_CAPS_VIRTIO_TX_ALG)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_TX_ALG)) { virBufferAddLit(&buf, ",tx="); switch (net->driver.virtio.txmode) { case VIR_DOMAIN_NET_VIRTIO_TX_MODE_IOTHREAD: @@ -3240,9 +3240,9 @@ qemuBuildNicDevStr(virDomainNetDefPtr net, } } if (usingVirtio) { - qemuBuildIoEventFdStr(&buf, net->driver.virtio.ioeventfd, caps); + qemuBuildIoEventFdStr(&buf, net->driver.virtio.ioeventfd, qemuCaps); if (net->driver.virtio.event_idx && - qemuCapsGet(caps, QEMU_CAPS_VIRTIO_NET_EVENT_IDX)) { + virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_EVENT_IDX)) { virBufferAsprintf(&buf, ",event_idx=%s", virDomainVirtioEventIdxTypeToString(net->driver.virtio.event_idx)); } @@ -3256,11 +3256,11 @@ qemuBuildNicDevStr(virDomainNetDefPtr net, net->mac.addr[0], net->mac.addr[1], net->mac.addr[2], net->mac.addr[3], net->mac.addr[4], net->mac.addr[5]); - if (qemuBuildDeviceAddressStr(&buf, &net->info, caps) < 0) + if (qemuBuildDeviceAddressStr(&buf, &net->info, qemuCaps) < 0) goto error; - if (qemuBuildRomStr(&buf, &net->info, caps) < 0) + if (qemuBuildRomStr(&buf, &net->info, qemuCaps) < 0) goto error; - if (bootindex && qemuCapsGet(caps, QEMU_CAPS_BOOTINDEX)) + if (bootindex && virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX)) virBufferAsprintf(&buf, ",bootindex=%d", bootindex); if (virBufferError(&buf)) { @@ -3279,7 +3279,7 @@ error: char * qemuBuildHostNetStr(virDomainNetDefPtr net, virQEMUDriverPtr driver, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, char type_sep, int vlan, const char *tapfd, @@ -3307,7 +3307,7 @@ qemuBuildHostNetStr(virDomainNetDefPtr net, */ case VIR_DOMAIN_NET_TYPE_BRIDGE: if (!cfg->privileged && - qemuCapsGet(caps, QEMU_CAPS_NETDEV_BRIDGE)) { + virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV_BRIDGE)) { brname = virDomainNetGetActualBridgeName(net); virBufferAsprintf(&buf, "bridge%cbr=%s", type_sep, brname); type_sep = ','; @@ -3396,7 +3396,7 @@ qemuBuildHostNetStr(virDomainNetDefPtr net, char * qemuBuildWatchdogDevStr(virDomainWatchdogDefPtr dev, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { virBuffer buf = VIR_BUFFER_INITIALIZER; @@ -3408,7 +3408,7 @@ qemuBuildWatchdogDevStr(virDomainWatchdogDefPtr dev, } virBufferAsprintf(&buf, "%s,id=%s", model, dev->info.alias); - if (qemuBuildDeviceAddressStr(&buf, &dev->info, caps) < 0) + if (qemuBuildDeviceAddressStr(&buf, &dev->info, qemuCaps) < 0) goto error; if (virBufferError(&buf)) { @@ -3426,13 +3426,13 @@ error: char * qemuBuildMemballoonDevStr(virDomainMemballoonDefPtr dev, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { virBuffer buf = VIR_BUFFER_INITIALIZER; virBufferAddLit(&buf, "virtio-balloon-pci"); virBufferAsprintf(&buf, ",id=%s", dev->info.alias); - if (qemuBuildDeviceAddressStr(&buf, &dev->info, caps) < 0) + if (qemuBuildDeviceAddressStr(&buf, &dev->info, qemuCaps) < 0) goto error; if (virBufferError(&buf)) { @@ -3450,7 +3450,7 @@ error: char * qemuBuildUSBInputDevStr(virDomainInputDefPtr dev, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { virBuffer buf = VIR_BUFFER_INITIALIZER; @@ -3458,7 +3458,7 @@ qemuBuildUSBInputDevStr(virDomainInputDefPtr dev, dev->type == VIR_DOMAIN_INPUT_TYPE_MOUSE ? "usb-mouse" : "usb-tablet", dev->info.alias); - if (qemuBuildDeviceAddressStr(&buf, &dev->info, caps) < 0) + if (qemuBuildDeviceAddressStr(&buf, &dev->info, qemuCaps) < 0) goto error; if (virBufferError(&buf)) { @@ -3476,7 +3476,7 @@ error: char * qemuBuildSoundDevStr(virDomainSoundDefPtr sound, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { virBuffer buf = VIR_BUFFER_INITIALIZER; const char *model = virDomainSoundModelTypeToString(sound->model); @@ -3496,7 +3496,7 @@ qemuBuildSoundDevStr(virDomainSoundDefPtr sound, model = "intel-hda"; virBufferAsprintf(&buf, "%s,id=%s", model, sound->info.alias); - if (qemuBuildDeviceAddressStr(&buf, &sound->info, caps) < 0) + if (qemuBuildDeviceAddressStr(&buf, &sound->info, qemuCaps) < 0) goto error; if (virBufferError(&buf)) { @@ -3529,7 +3529,7 @@ qemuSoundCodecTypeToCaps(int type) static char * qemuBuildSoundCodecStr(virDomainSoundDefPtr sound, virDomainSoundCodecDefPtr codec, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { virBuffer buf = VIR_BUFFER_INITIALIZER; const char *stype; @@ -3539,7 +3539,7 @@ qemuBuildSoundCodecStr(virDomainSoundDefPtr sound, stype = qemuSoundCodecTypeToString(type); flags = qemuSoundCodecTypeToCaps(type); - if (flags == -1 || !qemuCapsGet(caps, flags)) { + if (flags == -1 || !virQEMUCapsGet(qemuCaps, flags)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("%s not supported in this QEMU binary"), stype); goto error; @@ -3557,7 +3557,7 @@ error: static char * qemuBuildDeviceVideoStr(virDomainVideoDefPtr video, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, bool primary) { virBuffer buf = VIR_BUFFER_INITIALIZER; @@ -3578,7 +3578,7 @@ qemuBuildDeviceVideoStr(virDomainVideoDefPtr video, goto error; } - if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE_QXL)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("only one video card is currently supported")); goto error; @@ -3610,7 +3610,7 @@ qemuBuildDeviceVideoStr(virDomainVideoDefPtr video, virBufferAsprintf(&buf, ",vram_size=%u", video->vram * 1024); } - if (qemuBuildDeviceAddressStr(&buf, &video->info, caps) < 0) + if (qemuBuildDeviceAddressStr(&buf, &video->info, qemuCaps) < 0) goto error; if (virBufferError(&buf)) { @@ -3653,7 +3653,7 @@ qemuOpenPCIConfig(virDomainHostdevDefPtr dev) char * qemuBuildPCIHostdevDevStr(virDomainHostdevDefPtr dev, const char *configfd, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { virBuffer buf = VIR_BUFFER_INITIALIZER; @@ -3667,9 +3667,9 @@ qemuBuildPCIHostdevDevStr(virDomainHostdevDefPtr dev, const char *configfd, virBufferAsprintf(&buf, ",configfd=%s", configfd); if (dev->info->bootIndex) virBufferAsprintf(&buf, ",bootindex=%d", dev->info->bootIndex); - if (qemuBuildDeviceAddressStr(&buf, dev->info, caps) < 0) + if (qemuBuildDeviceAddressStr(&buf, dev->info, qemuCaps) < 0) goto error; - if (qemuBuildRomStr(&buf, dev->info, caps) < 0) + if (qemuBuildRomStr(&buf, dev->info, qemuCaps) < 0) goto error; if (virBufferError(&buf)) { @@ -3703,7 +3703,7 @@ qemuBuildPCIHostdevPCIDevStr(virDomainHostdevDefPtr dev) char * qemuBuildRedirdevDevStr(virDomainDefPtr def, virDomainRedirdevDefPtr dev, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { size_t i; virBuffer buf = VIR_BUFFER_INITIALIZER; @@ -3716,7 +3716,7 @@ qemuBuildRedirdevDevStr(virDomainDefPtr def, goto error; } - if (!qemuCapsGet(caps, QEMU_CAPS_USB_REDIR)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_USB_REDIR)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("USB redirection is not supported " "by this version of QEMU")); @@ -3728,7 +3728,7 @@ qemuBuildRedirdevDevStr(virDomainDefPtr def, dev->info.alias); if (redirfilter && redirfilter->nusbdevs) { - if (!qemuCapsGet(caps, QEMU_CAPS_USB_REDIR_FILTER)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_USB_REDIR_FILTER)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("USB redirection filter is not " "supported by this version of QEMU")); @@ -3766,7 +3766,7 @@ qemuBuildRedirdevDevStr(virDomainDefPtr def, } if (dev->info.bootIndex) { - if (!qemuCapsGet(caps, QEMU_CAPS_USB_REDIR_BOOTINDEX)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_USB_REDIR_BOOTINDEX)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("USB redirection booting is not " "supported by this version of QEMU")); @@ -3775,7 +3775,7 @@ qemuBuildRedirdevDevStr(virDomainDefPtr def, virBufferAsprintf(&buf, ",bootindex=%d", dev->info.bootIndex); } - if (qemuBuildDeviceAddressStr(&buf, &dev->info, caps) < 0) + if (qemuBuildDeviceAddressStr(&buf, &dev->info, qemuCaps) < 0) goto error; if (virBufferError(&buf)) { @@ -3792,7 +3792,7 @@ error: char * qemuBuildUSBHostdevDevStr(virDomainHostdevDefPtr dev, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { virBuffer buf = VIR_BUFFER_INITIALIZER; @@ -3814,7 +3814,7 @@ qemuBuildUSBHostdevDevStr(virDomainHostdevDefPtr dev, if (dev->info->bootIndex) virBufferAsprintf(&buf, ",bootindex=%d", dev->info->bootIndex); - if (qemuBuildDeviceAddressStr(&buf, dev->info, caps) < 0) + if (qemuBuildDeviceAddressStr(&buf, dev->info, qemuCaps) < 0) goto error; if (virBufferError(&buf)) { @@ -3832,7 +3832,7 @@ error: char * qemuBuildHubDevStr(virDomainHubDefPtr dev, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { virBuffer buf = VIR_BUFFER_INITIALIZER; @@ -3843,7 +3843,7 @@ qemuBuildHubDevStr(virDomainHubDefPtr dev, goto error; } - if (!qemuCapsGet(caps, QEMU_CAPS_USB_HUB)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_USB_HUB)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("usb-hub not supported by QEMU binary")); goto error; @@ -3851,7 +3851,7 @@ qemuBuildHubDevStr(virDomainHubDefPtr dev, virBufferAddLit(&buf, "usb-hub"); virBufferAsprintf(&buf, ",id=%s", dev->info.alias); - if (qemuBuildDeviceAddressStr(&buf, &dev->info, caps) < 0) + if (qemuBuildDeviceAddressStr(&buf, &dev->info, qemuCaps) < 0) goto error; if (virBufferError(&buf)) { @@ -3899,7 +3899,7 @@ qemuBuildUSBHostdevUsbDevStr(virDomainHostdevDefPtr dev) * host side of the character device */ static char * qemuBuildChrChardevStr(virDomainChrSourceDefPtr dev, const char *alias, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { virBuffer buf = VIR_BUFFER_INITIALIZER; bool telnet; @@ -3978,7 +3978,7 @@ qemuBuildChrChardevStr(virDomainChrSourceDefPtr dev, const char *alias, break; case VIR_DOMAIN_CHR_TYPE_SPICEVMC: - if (!qemuCapsGet(caps, QEMU_CAPS_CHARDEV_SPICEVMC)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV_SPICEVMC)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("spicevmc not supported in this QEMU binary")); goto error; @@ -4099,7 +4099,7 @@ error: static char * qemuBuildVirtioSerialPortDevStr(virDomainChrDefPtr dev, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { virBuffer buf = VIR_BUFFER_INITIALIZER; switch (dev->deviceType) { @@ -4109,7 +4109,7 @@ qemuBuildVirtioSerialPortDevStr(virDomainChrDefPtr dev, case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL: /* Legacy syntax '-device spicevmc' */ if (dev->source.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC && - qemuCapsGet(caps, QEMU_CAPS_DEVICE_SPICEVMC)) { + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPICEVMC)) { virBufferAddLit(&buf, "spicevmc"); } else { virBufferAddLit(&buf, "virtserialport"); @@ -4152,7 +4152,7 @@ qemuBuildVirtioSerialPortDevStr(virDomainChrDefPtr dev, if (!(dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL && dev->source.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC && - qemuCapsGet(caps, QEMU_CAPS_DEVICE_SPICEVMC))) { + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPICEVMC))) { virBufferAsprintf(&buf, ",chardev=char%s,id=%s", dev->info.alias, dev->info.alias); if (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL) { @@ -4390,7 +4390,7 @@ static int qemuBuildCpuArgStr(const virQEMUDriverPtr driver, const virDomainDefPtr def, const char *emulator, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, virArch hostarch, char **opt, bool *hasHwVirt, @@ -4424,7 +4424,7 @@ qemuBuildCpuArgStr(const virQEMUDriverPtr driver, if (!host || !host->model || - (ncpus = qemuCapsGetCPUDefinitions(caps, &cpus)) == 0) { + (ncpus = virQEMUCapsGetCPUDefinitions(qemuCaps, &cpus)) == 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("CPU specification not supported by hypervisor")); goto cleanup; @@ -4467,7 +4467,7 @@ qemuBuildCpuArgStr(const virQEMUDriverPtr driver, if (cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH) { const char *mode = virCPUModeTypeToString(cpu->mode); - if (!qemuCapsGet(caps, QEMU_CAPS_CPU_HOST)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_HOST)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("CPU mode '%s' is not supported by QEMU" " binary"), mode); @@ -4606,7 +4606,7 @@ no_memory: static int qemuBuildMachineArgStr(virCommandPtr cmd, const virDomainDefPtr def, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { /* This should *never* be NULL, since we always provide * a machine in the capabilities data for QEMU. So this @@ -4621,7 +4621,7 @@ qemuBuildMachineArgStr(virCommandPtr cmd, */ virCommandAddArgList(cmd, "-M", def->os.machine, NULL); } else { - if (!qemuCapsGet(caps, QEMU_CAPS_DUMP_GUEST_CORE)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DUMP_GUEST_CORE)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("dump-guest-core is not available " " with this QEMU binary")); @@ -4643,13 +4643,13 @@ qemuBuildMachineArgStr(virCommandPtr cmd, static char * qemuBuildSmpArgStr(const virDomainDefPtr def, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { virBuffer buf = VIR_BUFFER_INITIALIZER; virBufferAsprintf(&buf, "%u", def->vcpus); - if (qemuCapsGet(caps, QEMU_CAPS_SMP_TOPOLOGY)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SMP_TOPOLOGY)) { if (def->vcpus != def->maxvcpus) virBufferAsprintf(&buf, ",maxcpus=%u", def->maxvcpus); /* sockets, cores, and threads are either all zero @@ -4719,7 +4719,7 @@ static int qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr cfg, virCommandPtr cmd, virDomainDefPtr def, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, virDomainGraphicsDefPtr graphics) { int i; @@ -4727,7 +4727,7 @@ qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr cfg, if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) { virBuffer opt = VIR_BUFFER_INITIALIZER; - if (!qemuCapsGet(caps, QEMU_CAPS_VNC)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VNC)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("vnc graphics are not supported with this QEMU")); goto error; @@ -4745,7 +4745,7 @@ qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr cfg, virBufferAsprintf(&opt, "unix:%s", graphics->data.vnc.socket); - } else if (qemuCapsGet(caps, QEMU_CAPS_VNC_COLON)) { + } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VNC_COLON)) { const char *listenNetwork; const char *listenAddr = NULL; char *netAddr = NULL; @@ -4800,7 +4800,7 @@ qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr cfg, graphics->data.vnc.port - 5900); } - if (qemuCapsGet(caps, QEMU_CAPS_VNC_COLON)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VNC_COLON)) { if (graphics->data.vnc.auth.passwd || cfg->vncPassword) virBufferAddLit(&opt, ",password"); @@ -4844,8 +4844,8 @@ qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr cfg, virCommandAddEnvString(cmd, "QEMU_AUDIO_DRV=none"); } } else if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) { - if (qemuCapsGet(caps, QEMU_CAPS_0_10) && - !qemuCapsGet(caps, QEMU_CAPS_SDL)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_0_10) && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_SDL)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("sdl not supported by '%s'"), def->emulator); @@ -4871,7 +4871,7 @@ qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr cfg, /* New QEMU has this flag to let us explicitly ask for * SDL graphics. This is better than relying on the * default, since the default changes :-( */ - if (qemuCapsGet(caps, QEMU_CAPS_SDL)) + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SDL)) virCommandAddArg(cmd, "-sdl"); } else if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { @@ -4884,7 +4884,7 @@ qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr cfg, int port = graphics->data.spice.port; int tlsPort = graphics->data.spice.tlsPort; - if (!qemuCapsGet(caps, QEMU_CAPS_SPICE)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("spice graphics are not supported with this QEMU")); goto error; @@ -5016,7 +5016,7 @@ qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr cfg, if (graphics->data.spice.copypaste == VIR_DOMAIN_GRAPHICS_SPICE_CLIPBOARD_COPYPASTE_NO) virBufferAddLit(&opt, ",disable-copy-paste"); - if (qemuCapsGet(caps, QEMU_CAPS_SEAMLESS_MIGRATION)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEAMLESS_MIGRATION)) { /* If qemu supports seamless migration turn it * unconditionally on. If migration destination * doesn't support it, it fallbacks to previous @@ -5062,7 +5062,7 @@ qemuBuildCommandLine(virConnectPtr conn, virDomainDefPtr def, virDomainChrSourceDefPtr monitor_chr, bool monitor_json, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, const char *migrateFrom, int migrateFd, virDomainSnapshotObjPtr snapshot, @@ -5100,10 +5100,10 @@ qemuBuildCommandLine(virConnectPtr conn, virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); VIR_DEBUG("conn=%p driver=%p def=%p mon=%p json=%d " - "caps=%p migrateFrom=%s migrateFD=%d " + "qemuCaps=%p migrateFrom=%s migrateFD=%d " "snapshot=%p vmop=%d", conn, driver, def, monitor_chr, monitor_json, - caps, migrateFrom, migrateFd, snapshot, vmop); + qemuCaps, migrateFrom, migrateFd, snapshot, vmop); virUUIDFormat(def->uuid, uuid); @@ -5113,25 +5113,25 @@ qemuBuildCommandLine(virConnectPtr conn, * do not use boot=on for drives when not using KVM since this * is not supported at all in upstream QEmu. */ - if (qemuCapsGet(caps, QEMU_CAPS_KVM) && + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM) && (def->virtType == VIR_DOMAIN_VIRT_QEMU)) - qemuCapsClear(caps, QEMU_CAPS_DRIVE_BOOT); + virQEMUCapsClear(qemuCaps, QEMU_CAPS_DRIVE_BOOT); switch (def->virtType) { case VIR_DOMAIN_VIRT_QEMU: - if (qemuCapsGet(caps, QEMU_CAPS_KQEMU)) + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KQEMU)) disableKQEMU = 1; - if (qemuCapsGet(caps, QEMU_CAPS_KVM)) + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) disableKVM = 1; break; case VIR_DOMAIN_VIRT_KQEMU: - if (qemuCapsGet(caps, QEMU_CAPS_KVM)) + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) disableKVM = 1; - if (qemuCapsGet(caps, QEMU_CAPS_ENABLE_KQEMU)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_ENABLE_KQEMU)) { enableKQEMU = 1; - } else if (!qemuCapsGet(caps, QEMU_CAPS_KQEMU)) { + } else if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_KQEMU)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("the QEMU binary %s does not support kqemu"), emulator); @@ -5140,12 +5140,12 @@ qemuBuildCommandLine(virConnectPtr conn, break; case VIR_DOMAIN_VIRT_KVM: - if (qemuCapsGet(caps, QEMU_CAPS_KQEMU)) + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KQEMU)) disableKQEMU = 1; - if (qemuCapsGet(caps, QEMU_CAPS_ENABLE_KVM)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_ENABLE_KVM)) { enableKVM = 1; - } else if (!qemuCapsGet(caps, QEMU_CAPS_KVM)) { + } else if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("the QEMU binary %s does not support kvm"), emulator); @@ -5168,10 +5168,10 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddEnvPassCommon(cmd); - if (qemuCapsGet(caps, QEMU_CAPS_NAME)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NAME)) { virCommandAddArg(cmd, "-name"); if (cfg->setProcessName && - qemuCapsGet(caps, QEMU_CAPS_NAME_PROCESS)) { + virQEMUCapsGet(qemuCaps, QEMU_CAPS_NAME_PROCESS)) { virCommandAddArgFormat(cmd, "%s,process=qemu:%s", def->name, def->name); } else { @@ -5180,10 +5180,10 @@ qemuBuildCommandLine(virConnectPtr conn, } virCommandAddArg(cmd, "-S"); /* freeze CPU */ - if (qemuBuildMachineArgStr(cmd, def, caps) < 0) + if (qemuBuildMachineArgStr(cmd, def, qemuCaps) < 0) goto error; - if (qemuBuildCpuArgStr(driver, def, emulator, caps, + if (qemuBuildCpuArgStr(driver, def, emulator, qemuCaps, hostarch, &cpu, &hasHwVirt, !!migrateFrom) < 0) goto error; @@ -5191,7 +5191,7 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArgList(cmd, "-cpu", cpu, NULL); VIR_FREE(cpu); - if (qemuCapsGet(caps, QEMU_CAPS_NESTING) && + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NESTING) && hasHwVirt) virCommandAddArg(cmd, "-enable-nesting"); } @@ -5229,7 +5229,7 @@ qemuBuildCommandLine(virConnectPtr conn, "%s", _("hugepages are disabled by administrator config")); goto error; } - if (!qemuCapsGet(caps, QEMU_CAPS_MEM_PATH)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MEM_PATH)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("hugepage backing not supported by '%s'"), def->emulator); @@ -5240,7 +5240,7 @@ qemuBuildCommandLine(virConnectPtr conn, } virCommandAddArg(cmd, "-smp"); - if (!(smp = qemuBuildSmpArgStr(def, caps))) + if (!(smp = qemuBuildSmpArgStr(def, qemuCaps))) goto error; virCommandAddArg(cmd, smp); VIR_FREE(smp); @@ -5249,15 +5249,15 @@ qemuBuildCommandLine(virConnectPtr conn, if (qemuBuildNumaArgStr(def, cmd) < 0) goto error; - if (qemuCapsGet(caps, QEMU_CAPS_UUID)) + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_UUID)) virCommandAddArgList(cmd, "-uuid", uuid, NULL); if (def->virtType == VIR_DOMAIN_VIRT_XEN || STREQ(def->os.type, "xen") || STREQ(def->os.type, "linux")) { - if (qemuCapsGet(caps, QEMU_CAPS_DOMID)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DOMID)) { virCommandAddArg(cmd, "-domid"); virCommandAddArgFormat(cmd, "%d", def->id); - } else if (qemuCapsGet(caps, QEMU_CAPS_XEN_DOMID)) { + } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_XEN_DOMID)) { virCommandAddArg(cmd, "-xen-attach"); virCommandAddArg(cmd, "-xen-domid"); virCommandAddArgFormat(cmd, "%d", def->id); @@ -5274,7 +5274,7 @@ qemuBuildCommandLine(virConnectPtr conn, virSysinfoDefPtr source = NULL; bool skip_uuid = false; - if (!qemuCapsGet(caps, QEMU_CAPS_SMBIOS_TYPE)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SMBIOS_TYPE)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("the QEMU binary %s does not support smbios settings"), emulator); @@ -5327,23 +5327,23 @@ qemuBuildCommandLine(virConnectPtr conn, if (!def->graphics) virCommandAddArg(cmd, "-nographic"); - if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { /* Disable global config files and default devices */ - if (qemuCapsGet(caps, QEMU_CAPS_NO_USER_CONFIG)) + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_USER_CONFIG)) virCommandAddArg(cmd, "-no-user-config"); - else if (qemuCapsGet(caps, QEMU_CAPS_NODEFCONFIG)) + else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NODEFCONFIG)) virCommandAddArg(cmd, "-nodefconfig"); virCommandAddArg(cmd, "-nodefaults"); } /* Serial graphics adapter */ if (def->os.bios.useserial == VIR_DOMAIN_BIOS_USESERIAL_YES) { - if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("qemu does not support -device")); goto error; } - if (!qemuCapsGet(caps, QEMU_CAPS_SGA)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SGA)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("qemu does not support SGA")); goto error; @@ -5359,11 +5359,11 @@ qemuBuildCommandLine(virConnectPtr conn, if (monitor_chr) { char *chrdev; /* Use -chardev if it's available */ - if (qemuCapsGet(caps, QEMU_CAPS_CHARDEV)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV)) { virCommandAddArg(cmd, "-chardev"); if (!(chrdev = qemuBuildChrChardevStr(monitor_chr, "monitor", - caps))) + qemuCaps))) goto error; virCommandAddArg(cmd, chrdev); VIR_FREE(chrdev); @@ -5385,7 +5385,7 @@ qemuBuildCommandLine(virConnectPtr conn, } } - if (qemuCapsGet(caps, QEMU_CAPS_RTC)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_RTC)) { const char *rtcopt; virCommandAddArg(cmd, "-rtc"); if (!(rtcopt = qemuBuildClockArgStr(&def->clock))) @@ -5433,7 +5433,7 @@ qemuBuildCommandLine(virConnectPtr conn, /* This has already been taken care of (in qemuBuildClockArgStr) if QEMU_CAPS_RTC is set (mutually exclusive with QEMUD_FLAG_RTC_TD_HACK) */ - if (qemuCapsGet(caps, QEMU_CAPS_RTC_TD_HACK)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_RTC_TD_HACK)) { switch (def->clock.timers[i]->tickpolicy) { case -1: case VIR_DOMAIN_TIMER_TICKPOLICY_DELAY: @@ -5449,7 +5449,7 @@ qemuBuildCommandLine(virConnectPtr conn, virDomainTimerTickpolicyTypeToString(def->clock.timers[i]->tickpolicy)); goto error; } - } else if (!qemuCapsGet(caps, QEMU_CAPS_RTC) + } else if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_RTC) && (def->clock.timers[i]->tickpolicy != VIR_DOMAIN_TIMER_TICKPOLICY_DELAY) && (def->clock.timers[i]->tickpolicy != -1)) { @@ -5468,13 +5468,13 @@ qemuBuildCommandLine(virConnectPtr conn, case VIR_DOMAIN_TIMER_TICKPOLICY_DELAY: /* delay is the default if we don't have kernel (-no-kvm-pit), otherwise, the default is catchup. */ - if (qemuCapsGet(caps, QEMU_CAPS_NO_KVM_PIT)) + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_KVM_PIT)) virCommandAddArg(cmd, "-no-kvm-pit-reinjection"); break; case VIR_DOMAIN_TIMER_TICKPOLICY_CATCHUP: - if (qemuCapsGet(caps, QEMU_CAPS_NO_KVM_PIT)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_KVM_PIT)) { /* do nothing - this is default for kvm-pit */ - } else if (qemuCapsGet(caps, QEMU_CAPS_TDF)) { + } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_TDF)) { /* -tdf switches to 'catchup' with userspace pit. */ virCommandAddArg(cmd, "-tdf"); } else { @@ -5503,7 +5503,7 @@ qemuBuildCommandLine(virConnectPtr conn, * and when -no-hpet doesn't exist is "no". "confusing"? * "yes"! */ - if (qemuCapsGet(caps, QEMU_CAPS_NO_HPET)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_HPET)) { if (def->clock.timers[i]->present == 0) virCommandAddArg(cmd, "-no-hpet"); } else { @@ -5518,7 +5518,7 @@ qemuBuildCommandLine(virConnectPtr conn, } } - if (qemuCapsGet(caps, QEMU_CAPS_NO_REBOOT) && + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_REBOOT) && def->onReboot != VIR_DOMAIN_LIFECYCLE_RESTART) virCommandAddArg(cmd, "-no-reboot"); @@ -5526,16 +5526,16 @@ qemuBuildCommandLine(virConnectPtr conn, * when QEMU stops. If we use no-shutdown, then we can * watch for this event and do a soft/warm reboot. */ - if (monitor_json && qemuCapsGet(caps, QEMU_CAPS_NO_SHUTDOWN)) + if (monitor_json && virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_SHUTDOWN)) virCommandAddArg(cmd, "-no-shutdown"); - if (qemuCapsGet(caps, QEMU_CAPS_NO_ACPI)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_ACPI)) { if (!(def->features & (1 << VIR_DOMAIN_FEATURE_ACPI))) virCommandAddArg(cmd, "-no-acpi"); } if (def->pm.s3) { - if (!qemuCapsGet(caps, QEMU_CAPS_DISABLE_S3)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DISABLE_S3)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("setting ACPI S3 not supported")); goto error; @@ -5546,7 +5546,7 @@ qemuBuildCommandLine(virConnectPtr conn, } if (def->pm.s4) { - if (!qemuCapsGet(caps, QEMU_CAPS_DISABLE_S4)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DISABLE_S4)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("setting ACPI S4 not supported")); goto error; @@ -5568,15 +5568,15 @@ qemuBuildCommandLine(virConnectPtr conn, /* def->os.nBootDevs is guaranteed to be > 0 unless per-device boot * configuration is used */ - if (!qemuCapsGet(caps, QEMU_CAPS_BOOTINDEX)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("hypervisor lacks deviceboot feature")); goto error; } emitBootindex = true; - } else if (qemuCapsGet(caps, QEMU_CAPS_BOOTINDEX) && + } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX) && (def->os.bootmenu != VIR_DOMAIN_BOOT_MENU_ENABLED || - !qemuCapsGet(caps, QEMU_CAPS_BOOT_MENU))) { + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOT_MENU))) { emitBootindex = true; } @@ -5609,7 +5609,7 @@ qemuBuildCommandLine(virConnectPtr conn, } if (def->os.bootmenu) { - if (qemuCapsGet(caps, QEMU_CAPS_BOOT_MENU)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOT_MENU)) { if (boot_nparams++) virBufferAddChar(&boot_buf, ','); @@ -5626,7 +5626,7 @@ qemuBuildCommandLine(virConnectPtr conn, } if (def->os.bios.rt_set) { - if (!qemuCapsGet(caps, QEMU_CAPS_REBOOT_TIMEOUT)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_REBOOT_TIMEOUT)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("reboot timeout is not supported " "by this QEMU binary")); @@ -5679,7 +5679,7 @@ qemuBuildCommandLine(virConnectPtr conn, } } - if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { for (j = 0; j < ARRAY_CARDINALITY(contOrder); j++) { for (i = 0; i < def->ncontrollers; i++) { virDomainControllerDefPtr cont = def->controllers[i]; @@ -5696,7 +5696,7 @@ qemuBuildCommandLine(virConnectPtr conn, /* Only recent QEMU implements a SATA (AHCI) controller */ if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA) { - if (!qemuCapsGet(caps, QEMU_CAPS_ICH9_AHCI)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_AHCI)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("SATA is not supported with this " "QEMU binary")); @@ -5706,7 +5706,7 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, "-device"); if (!(devstr = qemuBuildControllerDevStr(def, cont, - caps, NULL))) + qemuCaps, NULL))) goto error; virCommandAddArg(cmd, devstr); @@ -5714,7 +5714,7 @@ qemuBuildCommandLine(virConnectPtr conn, } } else if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB && cont->model == -1 && - !qemuCapsGet(caps, QEMU_CAPS_PIIX3_USB_UHCI)) { + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) { if (usblegacy) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Multiple legacy USB controllers are " @@ -5726,7 +5726,7 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, "-device"); char *devstr; - if (!(devstr = qemuBuildControllerDevStr(def, cont, caps, + if (!(devstr = qemuBuildControllerDevStr(def, cont, qemuCaps, &usbcontroller))) goto error; @@ -5745,17 +5745,17 @@ qemuBuildCommandLine(virConnectPtr conn, char *optstr; virCommandAddArg(cmd, "-device"); - if (!(optstr = qemuBuildHubDevStr(hub, caps))) + if (!(optstr = qemuBuildHubDevStr(hub, qemuCaps))) goto error; virCommandAddArg(cmd, optstr); VIR_FREE(optstr); } /* If QEMU supports -drive param instead of old -hda, -hdb, -cdrom .. */ - if (qemuCapsGet(caps, QEMU_CAPS_DRIVE)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE)) { int bootCD = 0, bootFloppy = 0, bootDisk = 0; - if ((qemuCapsGet(caps, QEMU_CAPS_DRIVE_BOOT) || emitBootindex)) { + if ((virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_BOOT) || emitBootindex)) { /* bootDevs will get translated into either bootindex=N or boot=on * depending on what qemu supports */ for (i = 0 ; i < def->os.nBootDevs ; i++) { @@ -5783,7 +5783,7 @@ qemuBuildCommandLine(virConnectPtr conn, /* Unless we have -device, then USB disks need special handling */ if ((disk->bus == VIR_DOMAIN_DISK_BUS_USB) && - !qemuCapsGet(caps, QEMU_CAPS_DEVICE)) { + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK) { virCommandAddArg(cmd, "-usbdevice"); virCommandAddArgFormat(cmd, "disk:%s", disk->src); @@ -5819,19 +5819,19 @@ qemuBuildCommandLine(virConnectPtr conn, devices. Fortunately, those don't need static PCI addresses, so we don't really care that we can't use -device */ - if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { if (disk->bus != VIR_DOMAIN_DISK_BUS_XEN) { withDeviceArg = 1; } else { - qemuCapsClear(caps, QEMU_CAPS_DEVICE); + virQEMUCapsClear(qemuCaps, QEMU_CAPS_DEVICE); deviceFlagMasked = true; } } optstr = qemuBuildDriveStr(conn, disk, emitBootindex ? false : !!bootindex, - caps); + qemuCaps); if (deviceFlagMasked) - qemuCapsSet(caps, QEMU_CAPS_DEVICE); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE); if (!optstr) goto error; virCommandAddArg(cmd, optstr); @@ -5861,7 +5861,7 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, "-device"); if (!(optstr = qemuBuildDriveDevStr(def, disk, bootindex, - caps))) + qemuCaps))) goto error; virCommandAddArg(cmd, optstr); VIR_FREE(optstr); @@ -6004,19 +6004,19 @@ qemuBuildCommandLine(virConnectPtr conn, } } - if (qemuCapsGet(caps, QEMU_CAPS_FSDEV)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_FSDEV)) { for (i = 0 ; i < def->nfss ; i++) { char *optstr; virDomainFSDefPtr fs = def->fss[i]; virCommandAddArg(cmd, "-fsdev"); - if (!(optstr = qemuBuildFSStr(fs, caps))) + if (!(optstr = qemuBuildFSStr(fs, qemuCaps))) goto error; virCommandAddArg(cmd, optstr); VIR_FREE(optstr); virCommandAddArg(cmd, "-device"); - if (!(optstr = qemuBuildFSDevStr(fs, caps))) + if (!(optstr = qemuBuildFSDevStr(fs, qemuCaps))) goto error; virCommandAddArg(cmd, optstr); VIR_FREE(optstr); @@ -6031,7 +6031,7 @@ qemuBuildCommandLine(virConnectPtr conn, if (!def->nnets) { /* If we have -device, then we set -nodefault already */ - if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE)) + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) virCommandAddArgList(cmd, "-net", "none", NULL); } else { int bootNet = 0; @@ -6062,8 +6062,8 @@ qemuBuildCommandLine(virConnectPtr conn, bootindex = net->info.bootIndex; /* VLANs are not used with -netdev, so don't record them */ - if (qemuCapsGet(caps, QEMU_CAPS_NETDEV) && - qemuCapsGet(caps, QEMU_CAPS_DEVICE)) + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV) && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) vlan = -1; else vlan = i; @@ -6124,9 +6124,9 @@ qemuBuildCommandLine(virConnectPtr conn, */ if (actualType == VIR_DOMAIN_NET_TYPE_NETWORK || cfg->privileged || - (!qemuCapsGet(caps, QEMU_CAPS_NETDEV_BRIDGE))) { + (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV_BRIDGE))) { int tapfd = qemuNetworkIfaceConnect(def, conn, driver, net, - caps); + qemuCaps); if (tapfd < 0) goto error; @@ -6139,7 +6139,7 @@ qemuBuildCommandLine(virConnectPtr conn, } } else if (actualType == VIR_DOMAIN_NET_TYPE_DIRECT) { int tapfd = qemuPhysIfaceConnect(def, driver, net, - caps, vmop); + qemuCaps, vmop); if (tapfd < 0) goto error; @@ -6158,7 +6158,7 @@ qemuBuildCommandLine(virConnectPtr conn, network device */ int vhostfd; - if (qemuOpenVhostNet(def, net, caps, &vhostfd) < 0) + if (qemuOpenVhostNet(def, net, qemuCaps, &vhostfd) < 0) goto error; if (vhostfd >= 0) { virCommandTransferFD(cmd, vhostfd); @@ -6176,19 +6176,19 @@ qemuBuildCommandLine(virConnectPtr conn, * * NB, no support for -netdev without use of -device */ - if (qemuCapsGet(caps, QEMU_CAPS_NETDEV) && - qemuCapsGet(caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV) && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { virCommandAddArg(cmd, "-netdev"); - if (!(host = qemuBuildHostNetStr(net, driver, caps, + if (!(host = qemuBuildHostNetStr(net, driver, qemuCaps, ',', vlan, tapfd_name, vhostfd_name))) goto error; virCommandAddArg(cmd, host); VIR_FREE(host); } - if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { virCommandAddArg(cmd, "-device"); - nic = qemuBuildNicDevStr(net, vlan, bootindex, caps); + nic = qemuBuildNicDevStr(net, vlan, bootindex, qemuCaps); if (!nic) goto error; virCommandAddArg(cmd, nic); @@ -6200,10 +6200,10 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, nic); VIR_FREE(nic); } - if (!(qemuCapsGet(caps, QEMU_CAPS_NETDEV) && - qemuCapsGet(caps, QEMU_CAPS_DEVICE))) { + if (!(virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV) && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))) { virCommandAddArg(cmd, "-net"); - if (!(host = qemuBuildHostNetStr(net, driver, caps, + if (!(host = qemuBuildHostNetStr(net, driver, qemuCaps, ',', vlan, tapfd_name, vhostfd_name))) goto error; @@ -6234,8 +6234,8 @@ qemuBuildCommandLine(virConnectPtr conn, switch (smartcard->type) { case VIR_DOMAIN_SMARTCARD_TYPE_HOST: - if (!qemuCapsGet(caps, QEMU_CAPS_CHARDEV) || - !qemuCapsGet(caps, QEMU_CAPS_CCID_EMULATED)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) || + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_CCID_EMULATED)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("this QEMU binary lacks smartcard host " "mode support")); @@ -6246,8 +6246,8 @@ qemuBuildCommandLine(virConnectPtr conn, break; case VIR_DOMAIN_SMARTCARD_TYPE_HOST_CERTIFICATES: - if (!qemuCapsGet(caps, QEMU_CAPS_CHARDEV) || - !qemuCapsGet(caps, QEMU_CAPS_CCID_EMULATED)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) || + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_CCID_EMULATED)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("this QEMU binary lacks smartcard host " "mode support")); @@ -6282,8 +6282,8 @@ qemuBuildCommandLine(virConnectPtr conn, break; case VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH: - if (!qemuCapsGet(caps, QEMU_CAPS_CHARDEV) || - !qemuCapsGet(caps, QEMU_CAPS_CCID_PASSTHRU)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) || + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_CCID_PASSTHRU)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("this QEMU binary lacks smartcard " "passthrough mode support")); @@ -6293,7 +6293,7 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, "-chardev"); if (!(devstr = qemuBuildChrChardevStr(&smartcard->data.passthru, smartcard->info.alias, - caps))) { + qemuCaps))) { virBufferFreeAndReset(&opt); goto error; } @@ -6318,7 +6318,7 @@ qemuBuildCommandLine(virConnectPtr conn, if (!def->nserials) { /* If we have -device, then we set -nodefault already */ - if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE)) + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) virCommandAddArgList(cmd, "-serial", "none", NULL); } else { for (i = 0 ; i < def->nserials ; i++) { @@ -6326,18 +6326,18 @@ qemuBuildCommandLine(virConnectPtr conn, char *devstr; /* Use -chardev with -device if they are available */ - if (qemuCapsGet(caps, QEMU_CAPS_CHARDEV) && - qemuCapsGet(caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { virCommandAddArg(cmd, "-chardev"); if (!(devstr = qemuBuildChrChardevStr(&serial->source, serial->info.alias, - caps))) + qemuCaps))) goto error; virCommandAddArg(cmd, devstr); VIR_FREE(devstr); virCommandAddArg(cmd, "-device"); - if (!(devstr = qemuBuildChrDeviceStr(serial, caps, + if (!(devstr = qemuBuildChrDeviceStr(serial, qemuCaps, def->os.arch, def->os.machine))) goto error; @@ -6355,7 +6355,7 @@ qemuBuildCommandLine(virConnectPtr conn, if (!def->nparallels) { /* If we have -device, then we set -nodefault already */ - if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE)) + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) virCommandAddArgList(cmd, "-parallel", "none", NULL); } else { for (i = 0 ; i < def->nparallels ; i++) { @@ -6363,12 +6363,12 @@ qemuBuildCommandLine(virConnectPtr conn, char *devstr; /* Use -chardev with -device if they are available */ - if (qemuCapsGet(caps, QEMU_CAPS_CHARDEV) && - qemuCapsGet(caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { virCommandAddArg(cmd, "-chardev"); if (!(devstr = qemuBuildChrChardevStr(¶llel->source, parallel->info.alias, - caps))) + qemuCaps))) goto error; virCommandAddArg(cmd, devstr); VIR_FREE(devstr); @@ -6395,8 +6395,8 @@ qemuBuildCommandLine(virConnectPtr conn, switch (channel->targetType) { case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD: - if (!qemuCapsGet(caps, QEMU_CAPS_CHARDEV) || - !qemuCapsGet(caps, QEMU_CAPS_DEVICE)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) || + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("guestfwd requires QEMU to support -chardev & -device")); goto error; @@ -6405,7 +6405,7 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, "-chardev"); if (!(devstr = qemuBuildChrChardevStr(&channel->source, channel->info.alias, - caps))) + qemuCaps))) goto error; virCommandAddArg(cmd, devstr); VIR_FREE(devstr); @@ -6424,13 +6424,13 @@ qemuBuildCommandLine(virConnectPtr conn, break; case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO: - if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("virtio channel requires QEMU to support -device")); goto error; } - if (qemuCapsGet(caps, QEMU_CAPS_DEVICE_SPICEVMC) && + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPICEVMC) && channel->source.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC) { /* spicevmc was originally introduced via a -device * with a backend internal to qemu; although we prefer @@ -6440,7 +6440,7 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, "-chardev"); if (!(devstr = qemuBuildChrChardevStr(&channel->source, channel->info.alias, - caps))) + qemuCaps))) goto error; virCommandAddArg(cmd, devstr); VIR_FREE(devstr); @@ -6448,7 +6448,7 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, "-device"); if (!(devstr = qemuBuildVirtioSerialPortDevStr(channel, - caps))) + qemuCaps))) goto error; virCommandAddArg(cmd, devstr); VIR_FREE(devstr); @@ -6464,12 +6464,12 @@ qemuBuildCommandLine(virConnectPtr conn, switch (console->targetType) { case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLP: case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLPLM: - if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("sclp console requires QEMU to support -device")); goto error; } - if (!qemuCapsGet(caps, QEMU_CAPS_SCLP_S390)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCLP_S390)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("sclp console requires QEMU to support s390-sclp")); goto error; @@ -6478,7 +6478,7 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, "-chardev"); if (!(devstr = qemuBuildChrChardevStr(&console->source, console->info.alias, - caps))) + qemuCaps))) goto error; virCommandAddArg(cmd, devstr); VIR_FREE(devstr); @@ -6491,7 +6491,7 @@ qemuBuildCommandLine(virConnectPtr conn, break; case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO: - if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("virtio channel requires QEMU to support -device")); goto error; @@ -6500,14 +6500,14 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, "-chardev"); if (!(devstr = qemuBuildChrChardevStr(&console->source, console->info.alias, - caps))) + qemuCaps))) goto error; virCommandAddArg(cmd, devstr); VIR_FREE(devstr); virCommandAddArg(cmd, "-device"); if (!(devstr = qemuBuildVirtioSerialPortDevStr(console, - caps))) + qemuCaps))) goto error; virCommandAddArg(cmd, devstr); VIR_FREE(devstr); @@ -6528,10 +6528,10 @@ qemuBuildCommandLine(virConnectPtr conn, virDomainInputDefPtr input = def->inputs[i]; if (input->bus == VIR_DOMAIN_INPUT_BUS_USB) { - if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { char *optstr; virCommandAddArg(cmd, "-device"); - if (!(optstr = qemuBuildUSBInputDevStr(input, caps))) + if (!(optstr = qemuBuildUSBInputDevStr(input, qemuCaps))) goto error; virCommandAddArg(cmd, optstr); VIR_FREE(optstr); @@ -6556,7 +6556,7 @@ qemuBuildCommandLine(virConnectPtr conn, break; } } - if (!qemuCapsGet(caps, QEMU_CAPS_0_10) && sdl + vnc + spice > 1) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_0_10) && sdl + vnc + spice > 1) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("only 1 graphics device is supported")); goto error; @@ -6569,37 +6569,37 @@ qemuBuildCommandLine(virConnectPtr conn, } for (i = 0 ; i < def->ngraphics ; ++i) { - if (qemuBuildGraphicsCommandLine(cfg, cmd, def, caps, + if (qemuBuildGraphicsCommandLine(cfg, cmd, def, qemuCaps, def->graphics[i]) < 0) goto error; } if (def->nvideos > 0) { int primaryVideoType = def->videos[0]->type; - if (qemuCapsGet(caps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY) && + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY) && ((primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_VGA && - qemuCapsGet(caps, QEMU_CAPS_DEVICE_VGA)) || + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VGA)) || (primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_CIRRUS && - qemuCapsGet(caps, QEMU_CAPS_DEVICE_CIRRUS_VGA)) || + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_CIRRUS_VGA)) || (primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_VMVGA && - qemuCapsGet(caps, QEMU_CAPS_DEVICE_VMWARE_SVGA)) || + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VMWARE_SVGA)) || (primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_QXL && - qemuCapsGet(caps, QEMU_CAPS_DEVICE_QXL_VGA))) + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL_VGA))) ) { for (i = 0 ; i < def->nvideos ; i++) { char *str; virCommandAddArg(cmd, "-device"); - if (!(str = qemuBuildDeviceVideoStr(def->videos[i], caps, !i))) + if (!(str = qemuBuildDeviceVideoStr(def->videos[i], qemuCaps, !i))) goto error; virCommandAddArg(cmd, str); VIR_FREE(str); } - } else if (qemuCapsGet(caps, QEMU_CAPS_VGA)) { + } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VGA)) { if (primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_XEN) { /* nothing - vga has no effect on Xen pvfb */ } else { if ((primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_QXL) && - !qemuCapsGet(caps, QEMU_CAPS_VGA_QXL)) { + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VGA_QXL)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("This QEMU does not support QXL graphics adapters")); goto error; @@ -6617,8 +6617,8 @@ qemuBuildCommandLine(virConnectPtr conn, if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_QXL && (def->videos[0]->vram || def->videos[0]->ram) && - qemuCapsGet(caps, QEMU_CAPS_DEVICE)) { - const char *dev = (qemuCapsGet(caps, QEMU_CAPS_DEVICE_QXL_VGA) + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { + const char *dev = (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL_VGA) ? "qxl-vga" : "qxl"); int ram = def->videos[0]->ram; int vram = def->videos[0]->vram; @@ -6650,7 +6650,7 @@ qemuBuildCommandLine(virConnectPtr conn, } if (def->nvideos > 1) { - if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { for (i = 1 ; i < def->nvideos ; i++) { char *str; if (def->videos[i]->type != VIR_DOMAIN_VIDEO_TYPE_QXL) { @@ -6662,7 +6662,7 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, "-device"); - if (!(str = qemuBuildDeviceVideoStr(def->videos[i], caps, false))) + if (!(str = qemuBuildDeviceVideoStr(def->videos[i], qemuCaps, false))) goto error; virCommandAddArg(cmd, str); @@ -6706,15 +6706,15 @@ qemuBuildCommandLine(virConnectPtr conn, } else { /* If we have -device, then we set -nodefault already */ - if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE) && - qemuCapsGet(caps, QEMU_CAPS_VGA) && - qemuCapsGet(caps, QEMU_CAPS_VGA_NONE)) + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE) && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_VGA) && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_VGA_NONE)) virCommandAddArgList(cmd, "-vga", "none", NULL); } /* Add sound hardware */ if (def->nsounds) { - if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { for (i = 0 ; i < def->nsounds ; i++) { virDomainSoundDefPtr sound = def->sounds[i]; char *str = NULL; @@ -6726,7 +6726,7 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArgList(cmd, "-soundhw", "pcspk", NULL); } else { virCommandAddArg(cmd, "-device"); - if (!(str = qemuBuildSoundDevStr(sound, caps))) + if (!(str = qemuBuildSoundDevStr(sound, qemuCaps))) goto error; virCommandAddArg(cmd, str); @@ -6737,7 +6737,7 @@ qemuBuildCommandLine(virConnectPtr conn, for (ii = 0 ; ii < sound->ncodecs ; ii++) { virCommandAddArg(cmd, "-device"); - if (!(codecstr = qemuBuildSoundCodecStr(sound, sound->codecs[ii], caps))) { + if (!(codecstr = qemuBuildSoundCodecStr(sound, sound->codecs[ii], qemuCaps))) { goto error; } @@ -6750,7 +6750,7 @@ qemuBuildCommandLine(virConnectPtr conn, 0 }; virCommandAddArg(cmd, "-device"); - if (!(codecstr = qemuBuildSoundCodecStr(sound, &codec, caps))) { + if (!(codecstr = qemuBuildSoundCodecStr(sound, &codec, qemuCaps))) { goto error; } @@ -6800,10 +6800,10 @@ qemuBuildCommandLine(virConnectPtr conn, virDomainWatchdogDefPtr watchdog = def->watchdog; char *optstr; - if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { virCommandAddArg(cmd, "-device"); - optstr = qemuBuildWatchdogDevStr(watchdog, caps); + optstr = qemuBuildWatchdogDevStr(watchdog, qemuCaps); if (!optstr) goto error; } else { @@ -6842,18 +6842,18 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, "-chardev"); if (!(devstr = qemuBuildChrChardevStr(&redirdev->source.chr, redirdev->info.alias, - caps))) { + qemuCaps))) { goto error; } virCommandAddArg(cmd, devstr); VIR_FREE(devstr); - if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE)) + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) goto error; virCommandAddArg(cmd, "-device"); - if (!(devstr = qemuBuildRedirdevDevStr(def, redirdev, caps))) + if (!(devstr = qemuBuildRedirdevDevStr(def, redirdev, qemuCaps))) goto error; virCommandAddArg(cmd, devstr); VIR_FREE(devstr); @@ -6875,14 +6875,14 @@ qemuBuildCommandLine(virConnectPtr conn, goto error; } else { if (hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI && - !qemuCapsGet(caps, QEMU_CAPS_PCI_BOOTINDEX)) { + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_BOOTINDEX)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("booting from assigned PCI devices is not" " supported with this version of qemu")); goto error; } if (hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB && - !qemuCapsGet(caps, QEMU_CAPS_USB_HOST_BOOTINDEX)) { + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_USB_HOST_BOOTINDEX)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("booting from assigned USB devices is not" " supported with this version of qemu")); @@ -6895,9 +6895,9 @@ qemuBuildCommandLine(virConnectPtr conn, if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS && hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB) { - if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { virCommandAddArg(cmd, "-device"); - if (!(devstr = qemuBuildUSBHostdevDevStr(hostdev, caps))) + if (!(devstr = qemuBuildUSBHostdevDevStr(hostdev, qemuCaps))) goto error; virCommandAddArg(cmd, devstr); VIR_FREE(devstr); @@ -6913,9 +6913,9 @@ qemuBuildCommandLine(virConnectPtr conn, /* PCI */ if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS && hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) { - if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { char *configfd_name = NULL; - if (qemuCapsGet(caps, QEMU_CAPS_PCI_CONFIGFD)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_CONFIGFD)) { int configfd = qemuOpenPCIConfig(hostdev); if (configfd >= 0) { @@ -6928,13 +6928,13 @@ qemuBuildCommandLine(virConnectPtr conn, } } virCommandAddArg(cmd, "-device"); - devstr = qemuBuildPCIHostdevDevStr(hostdev, configfd_name, caps); + devstr = qemuBuildPCIHostdevDevStr(hostdev, configfd_name, qemuCaps); VIR_FREE(configfd_name); if (!devstr) goto error; virCommandAddArg(cmd, devstr); VIR_FREE(devstr); - } else if (qemuCapsGet(caps, QEMU_CAPS_PCIDEVICE)) { + } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCIDEVICE)) { virCommandAddArg(cmd, "-pcidevice"); if (!(devstr = qemuBuildPCIHostdevPCIDevStr(hostdev))) goto error; @@ -6954,7 +6954,7 @@ qemuBuildCommandLine(virConnectPtr conn, if (migrateFrom) { virCommandAddArg(cmd, "-incoming"); if (STRPREFIX(migrateFrom, "tcp")) { - if (!qemuCapsGet(caps, QEMU_CAPS_MIGRATE_QEMU_TCP)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_TCP)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("TCP migration is not supported with " "this QEMU binary")); @@ -6962,13 +6962,13 @@ qemuBuildCommandLine(virConnectPtr conn, } virCommandAddArg(cmd, migrateFrom); } else if (STREQ(migrateFrom, "stdio")) { - if (qemuCapsGet(caps, QEMU_CAPS_MIGRATE_QEMU_FD)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD)) { virCommandAddArgFormat(cmd, "fd:%d", migrateFd); virCommandPreserveFD(cmd, migrateFd); - } else if (qemuCapsGet(caps, QEMU_CAPS_MIGRATE_QEMU_EXEC)) { + } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_EXEC)) { virCommandAddArg(cmd, "exec:cat"); virCommandSetInputFD(cmd, migrateFd); - } else if (qemuCapsGet(caps, QEMU_CAPS_MIGRATE_KVM_STDIO)) { + } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MIGRATE_KVM_STDIO)) { virCommandAddArg(cmd, migrateFrom); virCommandSetInputFD(cmd, migrateFd); } else { @@ -6978,7 +6978,7 @@ qemuBuildCommandLine(virConnectPtr conn, goto error; } } else if (STRPREFIX(migrateFrom, "exec")) { - if (!qemuCapsGet(caps, QEMU_CAPS_MIGRATE_QEMU_EXEC)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_EXEC)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("EXEC migration is not supported " "with this QEMU binary")); @@ -6986,7 +6986,7 @@ qemuBuildCommandLine(virConnectPtr conn, } virCommandAddArg(cmd, migrateFrom); } else if (STRPREFIX(migrateFrom, "fd")) { - if (!qemuCapsGet(caps, QEMU_CAPS_MIGRATE_QEMU_FD)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("FD migration is not supported " "with this QEMU binary")); @@ -6995,7 +6995,7 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, migrateFrom); virCommandPreserveFD(cmd, migrateFd); } else if (STRPREFIX(migrateFrom, "unix")) { - if (!qemuCapsGet(caps, QEMU_CAPS_MIGRATE_QEMU_UNIX)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_UNIX)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("UNIX migration is not supported " "with this QEMU binary")); @@ -7015,7 +7015,7 @@ qemuBuildCommandLine(virConnectPtr conn, * NB: Earlier we declared that VirtIO balloon will always be in * slot 0x3 on bus 0x0 */ - if (qemuCapsGet(caps, QEMU_CAPS_VIRTIO_S390) && def->memballoon) + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390) && def->memballoon) def->memballoon->model = VIR_DOMAIN_MEMBALLOON_MODEL_NONE; if (def->memballoon && @@ -7026,16 +7026,16 @@ qemuBuildCommandLine(virConnectPtr conn, virDomainMemballoonModelTypeToString(def->memballoon->model)); goto error; } - if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { char *optstr; virCommandAddArg(cmd, "-device"); - optstr = qemuBuildMemballoonDevStr(def->memballoon, caps); + optstr = qemuBuildMemballoonDevStr(def->memballoon, qemuCaps); if (!optstr) goto error; virCommandAddArg(cmd, optstr); VIR_FREE(optstr); - } else if (qemuCapsGet(caps, QEMU_CAPS_BALLOON)) { + } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BALLOON)) { virCommandAddArgList(cmd, "-balloon", "virtio", NULL); } } @@ -7055,7 +7055,7 @@ qemuBuildCommandLine(virConnectPtr conn, ? qemucmd->env_value[i] : ""); } - if (qemuCapsGet(caps, QEMU_CAPS_SECCOMP_SANDBOX)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SECCOMP_SANDBOX)) { if (cfg->seccompSandbox == 0) virCommandAddArgList(cmd, "-sandbox", "off", NULL); else if (cfg->seccompSandbox > 0) @@ -7085,7 +7085,7 @@ qemuBuildCommandLine(virConnectPtr conn, */ char * qemuBuildChrDeviceStr(virDomainChrDefPtr serial, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, virArch arch, char *machine) { @@ -7096,7 +7096,7 @@ qemuBuildChrDeviceStr(virDomainChrDefPtr serial, serial->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) { virBufferAsprintf(&cmd, "spapr-vty,chardev=char%s", serial->info.alias); - if (qemuBuildDeviceAddressStr(&cmd, &serial->info, caps) < 0) + if (qemuBuildDeviceAddressStr(&cmd, &serial->info, qemuCaps) < 0) goto error; } } else { @@ -7105,7 +7105,7 @@ qemuBuildChrDeviceStr(virDomainChrDefPtr serial, serial->info.alias, serial->info.alias); if (serial->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB) { - if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE_USB_SERIAL)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_USB_SERIAL)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("usb-serial is not supported in this QEMU binary")); goto error; @@ -7118,7 +7118,7 @@ qemuBuildChrDeviceStr(virDomainChrDefPtr serial, goto error; } - if (qemuBuildDeviceAddressStr(&cmd, &serial->info, caps) < 0) + if (qemuBuildDeviceAddressStr(&cmd, &serial->info, qemuCaps) < 0) goto error; } } @@ -7383,7 +7383,7 @@ error: * Will fail if not using the 'index' keyword */ static virDomainDiskDefPtr -qemuParseCommandLineDisk(virCapsPtr caps, +qemuParseCommandLineDisk(virCapsPtr qemuCaps, const char *val, int nvirtiodisk, bool old_style_ceph_args) @@ -7703,7 +7703,7 @@ qemuParseCommandLineDisk(virCapsPtr caps, else def->dst[2] = 'a' + idx; - if (virDomainDiskDefAssignAddress(caps, def) < 0) { + if (virDomainDiskDefAssignAddress(qemuCaps, def) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("invalid device name '%s'"), def->dst); virDomainDiskDefFree(def); @@ -7769,7 +7769,7 @@ qemuFindNICForVLAN(int nnics, * match up against. Horribly complicated stuff */ static virDomainNetDefPtr -qemuParseCommandLineNet(virCapsPtr caps, +qemuParseCommandLineNet(virCapsPtr qemuCaps, const char *val, int nnics, const char **nics) @@ -7903,7 +7903,7 @@ qemuParseCommandLineNet(virCapsPtr caps, } if (genmac) - virCapabilitiesGenerateMac(caps, &def->mac); + virCapabilitiesGenerateMac(qemuCaps, &def->mac); cleanup: for (i = 0 ; i < nkeywords ; i++) { @@ -8466,7 +8466,7 @@ qemuParseCommandLineBootDevs(virDomainDefPtr def, const char *str) { * virDomainDefPtr representing these settings as closely * as is practical. This is not an exact science.... */ -virDomainDefPtr qemuParseCommandLine(virCapsPtr caps, +virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps, const char **progenv, const char **progargv, char **pidfile, @@ -8545,7 +8545,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps, else path = strstr(def->emulator, "qemu"); if (def->virtType == VIR_DOMAIN_VIRT_KVM) - def->os.arch = caps->host.arch; + def->os.arch = qemuCaps->host.arch; else if (path && STRPREFIX(path, "qemu-system-")) def->os.arch = virArchFromString(path + strlen("qemu-system-")); @@ -8787,7 +8787,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps, !disk->dst) goto no_memory; - if (virDomainDiskDefAssignAddress(caps, disk) < 0) { + if (virDomainDiskDefAssignAddress(qemuCaps, disk) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Cannot assign address for device name '%s'"), disk->dst); @@ -8999,7 +8999,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps, WANT_VALUE(); if (!STRPREFIX(val, "nic") && STRNEQ(val, "none")) { virDomainNetDefPtr net; - if (!(net = qemuParseCommandLineNet(caps, val, nnics, nics))) + if (!(net = qemuParseCommandLineNet(qemuCaps, val, nnics, nics))) goto error; if (VIR_REALLOC_N(def->nets, def->nnets+1) < 0) { virDomainNetDefFree(net); @@ -9009,7 +9009,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps, } } else if (STREQ(arg, "-drive")) { WANT_VALUE(); - if (!(disk = qemuParseCommandLineDisk(caps, val, nvirtiodisk, + if (!(disk = qemuParseCommandLineDisk(qemuCaps, val, nvirtiodisk, ceph_args != NULL))) goto error; if (VIR_REALLOC_N(def->disks, def->ndisks+1) < 0) @@ -9256,7 +9256,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps, if (!def->os.machine) { const char *defaultMachine = - virCapabilitiesDefaultGuestMachine(caps, + virCapabilitiesDefaultGuestMachine(qemuCaps, def->os.type, def->os.arch, virDomainVirtTypeToString(def->virtType)); @@ -9329,7 +9329,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps, goto error; if (cmd->num_args || cmd->num_env) { - def->ns = caps->ns; + def->ns = qemuCaps->ns; def->namespaceData = cmd; } else @@ -9354,7 +9354,7 @@ error: } -virDomainDefPtr qemuParseCommandLineString(virCapsPtr caps, +virDomainDefPtr qemuParseCommandLineString(virCapsPtr qemuCaps, const char *args, char **pidfile, virDomainChrSourceDefPtr *monConfig, @@ -9368,7 +9368,7 @@ virDomainDefPtr qemuParseCommandLineString(virCapsPtr caps, if (qemuStringToArgvEnv(args, &progenv, &progargv) < 0) goto cleanup; - def = qemuParseCommandLine(caps, progenv, progargv, + def = qemuParseCommandLine(qemuCaps, progenv, progargv, pidfile, monConfig, monJSON); cleanup: @@ -9443,7 +9443,7 @@ cleanup: return ret; } -virDomainDefPtr qemuParseCommandLinePid(virCapsPtr caps, +virDomainDefPtr qemuParseCommandLinePid(virCapsPtr qemuCaps, pid_t pid, char **pidfile, virDomainChrSourceDefPtr *monConfig, @@ -9463,7 +9463,7 @@ virDomainDefPtr qemuParseCommandLinePid(virCapsPtr caps, qemuParseProcFileStrings(pid, "environ", &progenv) < 0) goto cleanup; - if (!(def = qemuParseCommandLine(caps, progenv, progargv, + if (!(def = qemuParseCommandLine(qemuCaps, progenv, progargv, pidfile, monConfig, monJSON))) goto cleanup; diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index e15830a7f5..7e52c5df8d 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -54,7 +54,7 @@ virCommandPtr qemuBuildCommandLine(virConnectPtr conn, virDomainDefPtr def, virDomainChrSourceDefPtr monitor_chr, bool monitor_json, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, const char *migrateFrom, int migrateFd, virDomainSnapshotObjPtr current_snapshot, @@ -64,14 +64,14 @@ virCommandPtr qemuBuildCommandLine(virConnectPtr conn, /* Generate string for arch-specific '-device' parameter */ char * qemuBuildChrDeviceStr (virDomainChrDefPtr serial, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, virArch arch, char *machine); /* With vlan == -1, use netdev syntax, else old hostnet */ char * qemuBuildHostNetStr(virDomainNetDefPtr net, virQEMUDriverPtr driver, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, char type_sep, int vlan, const char *tapfd, @@ -86,50 +86,50 @@ char * qemuBuildNicStr(virDomainNetDefPtr net, char * qemuBuildNicDevStr(virDomainNetDefPtr net, int vlan, int bootindex, - qemuCapsPtr caps); + virQEMUCapsPtr qemuCaps); char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk, - qemuCapsPtr caps); + virQEMUCapsPtr qemuCaps); /* Both legacy & current support */ char *qemuBuildDriveStr(virConnectPtr conn, virDomainDiskDefPtr disk, bool bootable, - qemuCapsPtr caps); + virQEMUCapsPtr qemuCaps); char *qemuBuildFSStr(virDomainFSDefPtr fs, - qemuCapsPtr caps); + virQEMUCapsPtr qemuCaps); /* Current, best practice */ char * qemuBuildDriveDevStr(virDomainDefPtr def, virDomainDiskDefPtr disk, int bootindex, - qemuCapsPtr caps); + virQEMUCapsPtr qemuCaps); char * qemuBuildFSDevStr(virDomainFSDefPtr fs, - qemuCapsPtr caps); + virQEMUCapsPtr qemuCaps); /* Current, best practice */ char * qemuBuildControllerDevStr(virDomainDefPtr domainDef, virDomainControllerDefPtr def, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, int *nusbcontroller); char * qemuBuildWatchdogDevStr(virDomainWatchdogDefPtr dev, - qemuCapsPtr caps); + virQEMUCapsPtr qemuCaps); char * qemuBuildMemballoonDevStr(virDomainMemballoonDefPtr dev, - qemuCapsPtr caps); + virQEMUCapsPtr qemuCaps); char * qemuBuildUSBInputDevStr(virDomainInputDefPtr dev, - qemuCapsPtr caps); + virQEMUCapsPtr qemuCaps); char * qemuBuildSoundDevStr(virDomainSoundDefPtr sound, - qemuCapsPtr caps); + virQEMUCapsPtr qemuCaps); /* Legacy, pre device support */ char * qemuBuildPCIHostdevPCIDevStr(virDomainHostdevDefPtr dev); /* Current, best practice */ char * qemuBuildPCIHostdevDevStr(virDomainHostdevDefPtr dev, const char *configfd, - qemuCapsPtr caps); + virQEMUCapsPtr qemuCaps); int qemuOpenPCIConfig(virDomainHostdevDefPtr dev); @@ -137,61 +137,61 @@ int qemuOpenPCIConfig(virDomainHostdevDefPtr dev); char * qemuBuildUSBHostdevUsbDevStr(virDomainHostdevDefPtr dev); /* Current, best practice */ char * qemuBuildUSBHostdevDevStr(virDomainHostdevDefPtr dev, - qemuCapsPtr caps); + virQEMUCapsPtr qemuCaps); -char * qemuBuildHubDevStr(virDomainHubDefPtr dev, qemuCapsPtr caps); +char * qemuBuildHubDevStr(virDomainHubDefPtr dev, virQEMUCapsPtr qemuCaps); char * qemuBuildRedirdevDevStr(virDomainDefPtr def, virDomainRedirdevDefPtr dev, - qemuCapsPtr caps); + virQEMUCapsPtr qemuCaps); int qemuNetworkIfaceConnect(virDomainDefPtr def, virConnectPtr conn, virQEMUDriverPtr driver, virDomainNetDefPtr net, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) ATTRIBUTE_NONNULL(2); int qemuPhysIfaceConnect(virDomainDefPtr def, virQEMUDriverPtr driver, virDomainNetDefPtr net, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, enum virNetDevVPortProfileOp vmop); int qemuOpenVhostNet(virDomainDefPtr def, virDomainNetDefPtr net, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, int *vhostfd); /* * NB: def->name can be NULL upon return and the caller * *must* decide how to fill in a name in this case */ -virDomainDefPtr qemuParseCommandLine(virCapsPtr caps, +virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps, const char **progenv, const char **progargv, char **pidfile, virDomainChrSourceDefPtr *monConfig, bool *monJSON); -virDomainDefPtr qemuParseCommandLineString(virCapsPtr caps, +virDomainDefPtr qemuParseCommandLineString(virCapsPtr qemuCaps, const char *args, char **pidfile, virDomainChrSourceDefPtr *monConfig, bool *monJSON); -virDomainDefPtr qemuParseCommandLinePid(virCapsPtr caps, +virDomainDefPtr qemuParseCommandLinePid(virCapsPtr qemuCaps, pid_t pid, char **pidfile, virDomainChrSourceDefPtr *monConfig, bool *monJSON); int qemuDomainAssignAddresses(virDomainDefPtr def, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, virDomainObjPtr obj) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def, - qemuCapsPtr caps); + virQEMUCapsPtr qemuCaps); int qemuDomainAssignPCIAddresses(virDomainDefPtr def, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, virDomainObjPtr obj); qemuDomainPCIAddressSetPtr qemuDomainPCIAddressSetCreate(virDomainDefPtr def); int qemuDomainPCIAddressReserveFunction(qemuDomainPCIAddressSetPtr addrs, @@ -212,15 +212,15 @@ int qemuDomainPCIAddressReleaseSlot(qemuDomainPCIAddressSetPtr addrs, int slot); void qemuDomainPCIAddressSetFree(qemuDomainPCIAddressSetPtr addrs); int qemuAssignDevicePCISlots(virDomainDefPtr def, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, qemuDomainPCIAddressSetPtr addrs); -int qemuAssignDeviceAliases(virDomainDefPtr def, qemuCapsPtr caps); +int qemuAssignDeviceAliases(virDomainDefPtr def, virQEMUCapsPtr qemuCaps); int qemuDomainNetVLAN(virDomainNetDefPtr def); int qemuAssignDeviceNetAlias(virDomainDefPtr def, virDomainNetDefPtr net, int idx); int qemuAssignDeviceDiskAlias(virDomainDefPtr vmdef, virDomainDiskDefPtr def, - qemuCapsPtr caps); + virQEMUCapsPtr qemuCaps); int qemuAssignDeviceHostdevAlias(virDomainDefPtr def, virDomainHostdevDefPtr hostdev, int idx); int qemuAssignDeviceControllerAlias(virDomainControllerDefPtr controller); int qemuAssignDeviceRedirdevAlias(virDomainDefPtr def, virDomainRedirdevDefPtr redirdev, int idx); diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index 8fada4e706..14680b194f 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -187,7 +187,7 @@ struct _virQEMUDriver { virCapsPtr caps; /* Immutable pointer, self-locking APIs */ - qemuCapsCachePtr capsCache; + virQEMUCapsCachePtr qemuCapsCache; /* Immutable pointer, self-locking APIs */ virDomainEventStatePtr domainEventState; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 46c22e18b7..b31cc16b34 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -231,7 +231,7 @@ static void qemuDomainObjPrivateFree(void *data) { qemuDomainObjPrivatePtr priv = data; - virObjectUnref(priv->caps); + virObjectUnref(priv->qemuCaps); qemuDomainPCIAddressSetFree(priv->pciaddrs); virDomainChrSourceDefFree(priv->monConfig); @@ -291,13 +291,13 @@ static int qemuDomainObjPrivateXMLFormat(virBufferPtr buf, void *data) virBufferAddLit(buf, " \n"); } - if (priv->caps) { + if (priv->qemuCaps) { int i; virBufferAddLit(buf, " \n"); for (i = 0 ; i < QEMU_CAPS_LAST ; i++) { - if (qemuCapsGet(priv->caps, i)) { + if (virQEMUCapsGet(priv->qemuCaps, i)) { virBufferAsprintf(buf, " \n", - qemuCapsTypeToString(i)); + virQEMUCapsTypeToString(i)); } } virBufferAddLit(buf, " \n"); @@ -336,7 +336,7 @@ static int qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data) char *tmp; int n, i; xmlNodePtr *nodes = NULL; - qemuCapsPtr caps = NULL; + virQEMUCapsPtr qemuCaps = NULL; if (VIR_ALLOC(priv->monConfig) < 0) { virReportOOMError(); @@ -408,13 +408,13 @@ static int qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data) goto error; } if (n > 0) { - if (!(caps = qemuCapsNew())) + if (!(qemuCaps = virQEMUCapsNew())) goto error; for (i = 0 ; i < n ; i++) { char *str = virXMLPropString(nodes[i], "name"); if (str) { - int flag = qemuCapsTypeFromString(str); + int flag = virQEMUCapsTypeFromString(str); if (flag < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unknown qemu capabilities flag %s"), str); @@ -422,11 +422,11 @@ static int qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data) goto error; } VIR_FREE(str); - qemuCapsSet(caps, flag); + virQEMUCapsSet(qemuCaps, flag); } } - priv->caps = caps; + priv->qemuCaps = qemuCaps; } VIR_FREE(nodes); @@ -477,7 +477,7 @@ error: virDomainChrSourceDefFree(priv->monConfig); priv->monConfig = NULL; VIR_FREE(nodes); - virObjectUnref(caps); + virObjectUnref(qemuCaps); return -1; } diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 68cf295c86..51cd2dc20e 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -145,7 +145,7 @@ struct _qemuDomainObjPrivate { qemuDomainPCIAddressSetPtr pciaddrs; int persistentAddrs; - qemuCapsPtr caps; + virQEMUCapsPtr qemuCaps; char *lockState; bool fakeReboot; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 52cf25a3dc..4243cada21 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -427,7 +427,7 @@ qemuCreateCapabilities(virQEMUDriverPtr driver) virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); /* Basic host arch / guest machine capabilities */ - if (!(caps = qemuCapsInit(driver->capsCache))) { + if (!(caps = virQEMUCapsInit(driver->qemuCapsCache))) { virReportOOMError(); virObjectUnref(cfg); return NULL; @@ -816,10 +816,10 @@ qemuStartup(bool privileged, } } - qemu_driver->capsCache = qemuCapsCacheNew(cfg->libDir, - cfg->user, - cfg->group); - if (!qemu_driver->capsCache) + qemu_driver->qemuCapsCache = virQEMUCapsCacheNew(cfg->libDir, + cfg->user, + cfg->group); + if (!qemu_driver->qemuCapsCache) goto error; if ((qemu_driver->caps = qemuCreateCapabilities(qemu_driver)) == NULL) @@ -1055,7 +1055,7 @@ qemuShutdown(void) { virObjectUnref(qemu_driver->activeUsbHostdevs); virHashFree(qemu_driver->sharedDisks); virObjectUnref(qemu_driver->caps); - qemuCapsCacheFree(qemu_driver->capsCache); + virQEMUCapsCacheFree(qemu_driver->qemuCapsCache); virObjectUnref(qemu_driver->domains); virObjectUnref(qemu_driver->remotePorts); @@ -1505,9 +1505,9 @@ static int qemuGetVersion(virConnectPtr conn, unsigned long *version) { unsigned int qemuVersion; qemuDriverLock(driver); - if (qemuCapsGetDefaultVersion(driver->caps, - driver->capsCache, - &qemuVersion) < 0) + if (virQEMUCapsGetDefaultVersion(driver->caps, + driver->qemuCapsCache, + &qemuVersion) < 0) goto cleanup; *version = qemuVersion; @@ -1542,11 +1542,11 @@ static int qemuNumDomains(virConnectPtr conn) { static int -qemuCanonicalizeMachine(virDomainDefPtr def, qemuCapsPtr caps) +qemuCanonicalizeMachine(virDomainDefPtr def, virQEMUCapsPtr qemuCaps) { const char *canon; - if (!(canon = qemuCapsGetCanonicalMachine(caps, def->os.machine))) + if (!(canon = virQEMUCapsGetCanonicalMachine(qemuCaps, def->os.machine))) return 0; if (STRNEQ(canon, def->os.machine)) { @@ -1572,7 +1572,7 @@ static virDomainPtr qemuDomainCreate(virConnectPtr conn, const char *xml, virDomainEventPtr event = NULL; virDomainEventPtr event2 = NULL; unsigned int start_flags = VIR_QEMU_PROCESS_START_COLD; - qemuCapsPtr caps = NULL; + virQEMUCapsPtr qemuCaps = NULL; virCheckFlags(VIR_DOMAIN_START_PAUSED | VIR_DOMAIN_START_AUTODESTROY, NULL); @@ -1591,13 +1591,13 @@ static virDomainPtr qemuDomainCreate(virConnectPtr conn, const char *xml, if (virSecurityManagerVerify(driver->securityManager, def) < 0) goto cleanup; - if (!(caps = qemuCapsCacheLookup(driver->capsCache, def->emulator))) + if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, def->emulator))) goto cleanup; - if (qemuCanonicalizeMachine(def, caps) < 0) + if (qemuCanonicalizeMachine(def, qemuCaps) < 0) goto cleanup; - if (qemuDomainAssignAddresses(def, caps, NULL) < 0) + if (qemuDomainAssignAddresses(def, qemuCaps, NULL) < 0) goto cleanup; if (!(vm = virDomainObjListAdd(driver->domains, @@ -1653,7 +1653,7 @@ cleanup: if (event2) qemuDomainEventQueue(driver, event2); } - virObjectUnref(caps); + virObjectUnref(qemuCaps); qemuDriverUnlock(driver); return dom; } @@ -1934,8 +1934,8 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags) } } else { #if WITH_YAJL - if (qemuCapsGet(priv->caps, QEMU_CAPS_MONITOR_JSON)) { - if (!qemuCapsGet(priv->caps, QEMU_CAPS_NO_SHUTDOWN)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MONITOR_JSON)) { + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NO_SHUTDOWN)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Reboot is not supported with this QEMU binary")); goto cleanup; @@ -2412,7 +2412,7 @@ static int qemuDomainGetInfo(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->caps, QEMU_CAPS_BALLOON_EVENT)) { + } else if (virQEMUCapsGet(priv->qemuCaps, 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) @@ -3206,7 +3206,7 @@ static int qemuDumpToFd(virQEMUDriverPtr driver, virDomainObjPtr vm, qemuDomainObjPrivatePtr priv = vm->privateData; int ret = -1; - if (!qemuCapsGet(priv->caps, QEMU_CAPS_DUMP_GUEST_MEMORY)) { + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DUMP_GUEST_MEMORY)) { virReportError(VIR_ERR_NO_SUPPORT, "%s", _("dump-guest-memory is not supported")); return -1; @@ -5216,7 +5216,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->caps, QEMU_CAPS_BALLOON_EVENT) && + !virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BALLOON_EVENT) && (virDomainObjIsActive(vm))) { /* Don't delay if someone's using the monitor, just use * existing most recent data instead */ @@ -5305,7 +5305,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn, virQEMUDriverPtr driver = conn->privateData; virDomainDefPtr def = NULL; virDomainChrSourceDef monConfig; - qemuCapsPtr caps = NULL; + virQEMUCapsPtr qemuCaps = NULL; bool monitor_json = false; virCommandPtr cmd = NULL; char *ret = NULL; @@ -5328,7 +5328,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn, if (!def) goto cleanup; - if (!(caps = qemuCapsCacheLookup(driver->capsCache, def->emulator))) + if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, def->emulator))) goto cleanup; /* Since we're just exporting args, we can't do bridge/network/direct @@ -5403,16 +5403,16 @@ static char *qemuDomainXMLToNative(virConnectPtr conn, net->model = model; } - monitor_json = qemuCapsGet(caps, QEMU_CAPS_MONITOR_JSON); + monitor_json = virQEMUCapsGet(qemuCaps, QEMU_CAPS_MONITOR_JSON); if (qemuProcessPrepareMonitorChr(cfg, &monConfig, def->name) < 0) goto cleanup; - if (qemuAssignDeviceAliases(def, caps) < 0) + if (qemuAssignDeviceAliases(def, qemuCaps) < 0) goto cleanup; if (!(cmd = qemuBuildCommandLine(conn, driver, def, - &monConfig, monitor_json, caps, + &monConfig, monitor_json, qemuCaps, NULL, -1, NULL, VIR_NETDEV_VPORT_PROFILE_OP_NO_OP))) goto cleanup; @@ -5421,7 +5421,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn, cleanup: qemuDriverUnlock(driver); - virObjectUnref(caps); + virObjectUnref(qemuCaps); virCommandFree(cmd); virDomainDefFree(def); virObjectUnref(cfg); @@ -5590,7 +5590,7 @@ static virDomainPtr qemuDomainDefine(virConnectPtr conn, const char *xml) { virDomainObjPtr vm = NULL; virDomainPtr dom = NULL; virDomainEventPtr event = NULL; - qemuCapsPtr caps = NULL; + virQEMUCapsPtr qemuCaps = NULL; virQEMUDriverConfigPtr cfg; qemuDriverLock(driver); @@ -5603,13 +5603,13 @@ static virDomainPtr qemuDomainDefine(virConnectPtr conn, const char *xml) { if (virSecurityManagerVerify(driver->securityManager, def) < 0) goto cleanup; - if (!(caps = qemuCapsCacheLookup(driver->capsCache, def->emulator))) + if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, def->emulator))) goto cleanup; - if (qemuCanonicalizeMachine(def, caps) < 0) + if (qemuCanonicalizeMachine(def, qemuCaps) < 0) goto cleanup; - if (qemuDomainAssignAddresses(def, caps, NULL) < 0) + if (qemuDomainAssignAddresses(def, qemuCaps, NULL) < 0) goto cleanup; if (!(vm = virDomainObjListAdd(driver->domains, @@ -5665,7 +5665,7 @@ cleanup: virObjectUnlock(vm); if (event) qemuDomainEventQueue(driver, event); - virObjectUnref(caps); + virObjectUnref(qemuCaps); qemuDriverUnlock(driver); virObjectUnref(cfg); return dom; @@ -6119,7 +6119,7 @@ qemuDomainUpdateDeviceLive(virDomainObjPtr vm, } static int -qemuDomainAttachDeviceConfig(qemuCapsPtr caps, +qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps, virDomainDefPtr vmdef, virDomainDeviceDefPtr dev) { @@ -6146,7 +6146,7 @@ qemuDomainAttachDeviceConfig(qemuCapsPtr caps, if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) if (virDomainDefAddImplicitControllers(vmdef) < 0) return -1; - if (qemuDomainAssignAddresses(vmdef, caps, NULL) < 0) + if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) return -1; break; @@ -6157,7 +6157,7 @@ qemuDomainAttachDeviceConfig(qemuCapsPtr caps, return -1; } dev->data.net = NULL; - if (qemuDomainAssignAddresses(vmdef, caps, NULL) < 0) + if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) return -1; break; @@ -6173,7 +6173,7 @@ qemuDomainAttachDeviceConfig(qemuCapsPtr caps, return -1; } dev->data.hostdev = NULL; - if (qemuDomainAssignAddresses(vmdef, caps, NULL) < 0) + if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) return -1; break; @@ -6205,7 +6205,7 @@ qemuDomainAttachDeviceConfig(qemuCapsPtr caps, return -1; dev->data.controller = NULL; - if (qemuDomainAssignAddresses(vmdef, caps, NULL) < 0) + if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) return -1; break; @@ -6303,7 +6303,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, } static int -qemuDomainUpdateDeviceConfig(qemuCapsPtr caps, +qemuDomainUpdateDeviceConfig(virQEMUCapsPtr qemuCaps, virDomainDefPtr vmdef, virDomainDeviceDefPtr dev) { @@ -6369,7 +6369,7 @@ qemuDomainUpdateDeviceConfig(qemuCapsPtr caps, vmdef->nets[pos] = net; dev->data.net = NULL; - if (qemuDomainAssignAddresses(vmdef, caps, NULL) < 0) + if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) return -1; break; @@ -6400,7 +6400,7 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml, bool force = (flags & VIR_DOMAIN_DEVICE_MODIFY_FORCE) != 0; int ret = -1; unsigned int affect; - qemuCapsPtr caps = NULL; + virQEMUCapsPtr qemuCaps = NULL; qemuDomainObjPrivatePtr priv; virQEMUDriverConfigPtr cfg = NULL; @@ -6464,9 +6464,9 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml, goto endjob; } - if (priv->caps) - caps = virObjectRef(priv->caps); - else if (!(caps = qemuCapsCacheLookup(driver->capsCache, vm->def->emulator))) + if (priv->qemuCaps) + qemuCaps = virObjectRef(priv->qemuCaps); + else if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, vm->def->emulator))) goto cleanup; if (flags & VIR_DOMAIN_AFFECT_CONFIG) { @@ -6479,13 +6479,13 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml, goto endjob; switch (action) { case QEMU_DEVICE_ATTACH: - ret = qemuDomainAttachDeviceConfig(caps, vmdef, dev); + ret = qemuDomainAttachDeviceConfig(qemuCaps, vmdef, dev); break; case QEMU_DEVICE_DETACH: ret = qemuDomainDetachDeviceConfig(vmdef, dev); break; case QEMU_DEVICE_UPDATE: - ret = qemuDomainUpdateDeviceConfig(caps, vmdef, dev); + ret = qemuDomainUpdateDeviceConfig(qemuCaps, vmdef, dev); break; default: virReportError(VIR_ERR_INTERNAL_ERROR, @@ -6545,7 +6545,7 @@ endjob: vm = NULL; cleanup: - virObjectUnref(caps); + virObjectUnref(qemuCaps); virDomainDefFree(vmdef); if (dev != dev_copy) virDomainDeviceDefFree(dev_copy); @@ -10733,7 +10733,7 @@ qemuDomainSnapshotPrepare(virDomainObjPtr vm, virDomainSnapshotDefPtr def, qemuDomainObjPrivatePtr priv = vm->privateData; if (def->state == VIR_DOMAIN_DISK_SNAPSHOT && - reuse && !qemuCapsGet(priv->caps, QEMU_CAPS_TRANSACTION)) { + reuse && !virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("reuse is not supported with this QEMU binary")); goto cleanup; @@ -10849,7 +10849,7 @@ qemuDomainSnapshotPrepare(virDomainObjPtr vm, virDomainSnapshotDefPtr def, if (def->state != VIR_DOMAIN_DISK_SNAPSHOT && active) { if (external == 1 || - qemuCapsGet(priv->caps, QEMU_CAPS_TRANSACTION)) { + virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION)) { *flags |= VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC; } else if (atomic && external > 1) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -11035,12 +11035,12 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver, } /* 'cgroup' is still NULL if cgroups are disabled. */ - if (qemuCapsGet(priv->caps, QEMU_CAPS_TRANSACTION)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION)) { if (!(actions = virJSONValueNewArray())) { virReportOOMError(); goto cleanup; } - } else if (!qemuCapsGet(priv->caps, QEMU_CAPS_DISK_SNAPSHOT)) { + } else if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DISK_SNAPSHOT)) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("live disk snapshot not supported with this " "QEMU binary")); @@ -11112,7 +11112,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver, cleanup: virCgroupFree(&cgroup); - if (ret == 0 || !qemuCapsGet(priv->caps, QEMU_CAPS_TRANSACTION)) { + if (ret == 0 || !virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION)) { if (virDomainSaveStatus(driver->caps, cfg->stateDir, vm) < 0 || (persist && virDomainSaveConfig(cfg->configDir, vm->newDef) < 0)) ret = -1; @@ -11138,7 +11138,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn, bool memory = snap->def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL; bool memory_unlink = false; bool atomic = !!(flags & VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC); - bool transaction = qemuCapsGet(priv->caps, QEMU_CAPS_TRANSACTION); + bool transaction = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION); int thaw = 0; /* 1 if freeze succeeded, -1 if freeze failed */ bool pmsuspended = false; @@ -12576,7 +12576,7 @@ static virDomainPtr qemuDomainAttach(virConnectPtr conn, bool monJSON = false; pid_t pid = pid_value; char *pidfile = NULL; - qemuCapsPtr caps = NULL; + virQEMUCapsPtr qemuCaps = NULL; virCheckFlags(0, NULL); @@ -12606,13 +12606,13 @@ static virDomainPtr qemuDomainAttach(virConnectPtr conn, goto cleanup; } - if (!(caps = qemuCapsCacheLookup(driver->capsCache, def->emulator))) + if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, def->emulator))) goto cleanup; - if (qemuCanonicalizeMachine(def, caps) < 0) + if (qemuCanonicalizeMachine(def, qemuCaps) < 0) goto cleanup; - if (qemuDomainAssignAddresses(def, caps, NULL) < 0) + if (qemuDomainAssignAddresses(def, qemuCaps, NULL) < 0) goto cleanup; if (!(vm = virDomainObjListAdd(driver->domains, @@ -12647,7 +12647,7 @@ endjob: cleanup: virDomainDefFree(def); - virObjectUnref(caps); + virObjectUnref(qemuCaps); virDomainChrSourceDefFree(monConfig); if (vm) virObjectUnlock(vm); @@ -13034,9 +13034,9 @@ qemuDomainBlockJobImpl(virDomainPtr dom, const char *path, const char *base, } priv = vm->privateData; - if (qemuCapsGet(priv->caps, QEMU_CAPS_BLOCKJOB_ASYNC)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKJOB_ASYNC)) { async = true; - } else if (!qemuCapsGet(priv->caps, QEMU_CAPS_BLOCKJOB_SYNC)) { + } else if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKJOB_SYNC)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("block jobs not supported with this QEMU binary")); goto cleanup; @@ -13251,8 +13251,8 @@ qemuDomainBlockCopy(virDomainPtr dom, const char *path, goto cleanup; } - if (!(qemuCapsGet(priv->caps, QEMU_CAPS_DRIVE_MIRROR) && - qemuCapsGet(priv->caps, QEMU_CAPS_BLOCKJOB_ASYNC))) { + if (!(virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DRIVE_MIRROR) && + virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKJOB_ASYNC))) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("block copy is not supported with this QEMU binary")); goto cleanup; @@ -13449,7 +13449,7 @@ qemuDomainBlockCommit(virDomainPtr dom, const char *path, const char *base, "%s", _("domain is not running")); goto endjob; } - if (!qemuCapsGet(priv->caps, QEMU_CAPS_BLOCK_COMMIT)) { + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCK_COMMIT)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("online commit not supported with this QEMU binary")); goto endjob; @@ -13684,7 +13684,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, priv = vm->privateData; cfg = virQEMUDriverGetConfig(driver); - if (!qemuCapsGet(priv->caps, QEMU_CAPS_DRIVE_IOTUNE)) { + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DRIVE_IOTUNE)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("block I/O throttling not supported with this " "QEMU binary")); @@ -14488,7 +14488,7 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom, goto cleanup; } - if (!qemuCapsGet(priv->caps, QEMU_CAPS_WAKEUP) && + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_WAKEUP) && (target == VIR_NODE_SUSPEND_TARGET_MEM || target == VIR_NODE_SUSPEND_TARGET_HYBRID)) { virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", @@ -14575,7 +14575,7 @@ qemuDomainPMWakeup(virDomainPtr dom, priv = vm->privateData; - if (!qemuCapsGet(priv->caps, QEMU_CAPS_WAKEUP)) { + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_WAKEUP)) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Unable to wake up domain due to " "missing system_wakeup monitor command")); diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 98912bf311..4504f0b8b8 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -104,7 +104,7 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver, goto cleanup; } - if (!(driveAlias = qemuDeviceDriveHostAlias(origdisk, priv->caps))) + if (!(driveAlias = qemuDeviceDriveHostAlias(origdisk, priv->qemuCaps))) goto error; qemuDomainObjEnterMonitorWithDriver(driver, vm); @@ -257,17 +257,17 @@ int qemuDomainAttachPciDiskDevice(virConnectPtr conn, goto cleanup; } - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { if (qemuDomainPCIAddressEnsureAddr(priv->pciaddrs, &disk->info) < 0) goto error; releaseaddr = true; - if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->caps) < 0) + if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->qemuCaps) < 0) goto error; - if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->caps))) + if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->qemuCaps))) goto error; - if (!(devstr = qemuBuildDriveDevStr(NULL, disk, 0, priv->caps))) + if (!(devstr = qemuBuildDriveDevStr(NULL, disk, 0, priv->qemuCaps))) goto error; } @@ -277,7 +277,7 @@ int qemuDomainAttachPciDiskDevice(virConnectPtr conn, } qemuDomainObjEnterMonitorWithDriver(driver, vm); - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { ret = qemuMonitorAddDrive(priv->mon, drivestr); if (ret == 0) { ret = qemuMonitorAddDevice(priv->mon, devstr); @@ -321,7 +321,7 @@ cleanup: return ret; error: - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) && + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) && (disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) && releaseaddr && qemuDomainPCIAddressReleaseSlot(priv->pciaddrs, @@ -356,7 +356,7 @@ int qemuDomainAttachPciControllerDevice(virQEMUDriverPtr driver, return -1; } - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { if (qemuDomainPCIAddressEnsureAddr(priv->pciaddrs, &controller->info) < 0) goto cleanup; releaseaddr = true; @@ -365,13 +365,13 @@ int qemuDomainAttachPciControllerDevice(virQEMUDriverPtr driver, if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_USB && controller->model == -1 && - !qemuCapsGet(priv->caps, QEMU_CAPS_PIIX3_USB_UHCI)) { + !virQEMUCapsGet(priv->qemuCaps, 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->caps, NULL))) { + if (!(devstr = qemuBuildControllerDevStr(vm->def, controller, priv->qemuCaps, NULL))) { goto cleanup; } } @@ -382,7 +382,7 @@ int qemuDomainAttachPciControllerDevice(virQEMUDriverPtr driver, } qemuDomainObjEnterMonitorWithDriver(driver, vm); - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { ret = qemuMonitorAddDevice(priv->mon, devstr); } else { ret = qemuMonitorAttachPCIDiskController(priv->mon, @@ -398,7 +398,7 @@ int qemuDomainAttachPciControllerDevice(virQEMUDriverPtr driver, cleanup: if ((ret != 0) && - qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) && + virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) && (controller->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) && releaseaddr && qemuDomainPCIAddressReleaseSlot(priv->pciaddrs, @@ -497,14 +497,14 @@ int qemuDomainAttachSCSIDisk(virConnectPtr conn, goto error; } - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { - if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->caps) < 0) + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { + if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->qemuCaps) < 0) goto error; - if (!(devstr = qemuBuildDriveDevStr(vm->def, disk, 0, priv->caps))) + if (!(devstr = qemuBuildDriveDevStr(vm->def, disk, 0, priv->qemuCaps))) goto error; } - if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->caps))) + if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->qemuCaps))) goto error; for (i = 0 ; i <= disk->info.addr.drive.controller ; i++) { @@ -530,7 +530,7 @@ int qemuDomainAttachSCSIDisk(virConnectPtr conn, } qemuDomainObjEnterMonitorWithDriver(driver, vm); - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { ret = qemuMonitorAddDrive(priv->mon, drivestr); if (ret == 0) { ret = qemuMonitorAddDevice(priv->mon, devstr); @@ -619,12 +619,12 @@ int qemuDomainAttachUsbMassstorageDevice(virConnectPtr conn, goto error; } - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { - if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->caps) < 0) + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { + if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->qemuCaps) < 0) goto error; - if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->caps))) + if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->qemuCaps))) goto error; - if (!(devstr = qemuBuildDriveDevStr(NULL, disk, 0, priv->caps))) + if (!(devstr = qemuBuildDriveDevStr(NULL, disk, 0, priv->qemuCaps))) goto error; } @@ -634,7 +634,7 @@ int qemuDomainAttachUsbMassstorageDevice(virConnectPtr conn, } qemuDomainObjEnterMonitorWithDriver(driver, vm); - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { ret = qemuMonitorAddDrive(priv->mon, drivestr); if (ret == 0) { ret = qemuMonitorAddDevice(priv->mon, devstr); @@ -723,7 +723,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn, goto cleanup; } - if (!qemuCapsGet(priv->caps, QEMU_CAPS_HOST_NET_ADD)) { + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_HOST_NET_ADD)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("installed qemu version does not support host_net_add")); goto cleanup; @@ -738,38 +738,38 @@ int qemuDomainAttachNetDevice(virConnectPtr conn, */ if (actualType == VIR_DOMAIN_NET_TYPE_NETWORK || cfg->privileged || - (!qemuCapsGet(priv->caps, QEMU_CAPS_NETDEV_BRIDGE))) { + (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV_BRIDGE))) { if ((tapfd = qemuNetworkIfaceConnect(vm->def, conn, driver, net, - priv->caps)) < 0) + priv->qemuCaps)) < 0) goto cleanup; iface_connected = true; - if (qemuOpenVhostNet(vm->def, net, priv->caps, &vhostfd) < 0) + if (qemuOpenVhostNet(vm->def, net, priv->qemuCaps, &vhostfd) < 0) goto cleanup; } } else if (actualType == VIR_DOMAIN_NET_TYPE_DIRECT) { if ((tapfd = qemuPhysIfaceConnect(vm->def, driver, net, - priv->caps, + priv->qemuCaps, VIR_NETDEV_VPORT_PROFILE_OP_CREATE)) < 0) goto cleanup; iface_connected = true; - if (qemuOpenVhostNet(vm->def, net, priv->caps, &vhostfd) < 0) + if (qemuOpenVhostNet(vm->def, net, priv->qemuCaps, &vhostfd) < 0) goto cleanup; } - if (qemuCapsGet(priv->caps, QEMU_CAPS_NET_NAME) || - qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NET_NAME) || + virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { if (qemuAssignDeviceNetAlias(vm->def, net, -1) < 0) goto cleanup; } - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) && + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) && qemuDomainPCIAddressEnsureAddr(priv->pciaddrs, &net->info) < 0) goto cleanup; releaseaddr = true; - if (qemuCapsGet(priv->caps, QEMU_CAPS_NETDEV) && - qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV) && + virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { vlan = -1; } else { vlan = qemuDomainNetVLAN(net); @@ -791,22 +791,22 @@ int qemuDomainAttachNetDevice(virConnectPtr conn, goto no_memory; } - if (qemuCapsGet(priv->caps, QEMU_CAPS_NETDEV) && - qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { - if (!(netstr = qemuBuildHostNetStr(net, driver, priv->caps, + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV) && + virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { + if (!(netstr = qemuBuildHostNetStr(net, driver, priv->qemuCaps, ',', -1, tapfd_name, vhostfd_name))) goto cleanup; } else { - if (!(netstr = qemuBuildHostNetStr(net, driver, priv->caps, + if (!(netstr = qemuBuildHostNetStr(net, driver, priv->qemuCaps, ' ', vlan, tapfd_name, vhostfd_name))) goto cleanup; } qemuDomainObjEnterMonitorWithDriver(driver, vm); - if (qemuCapsGet(priv->caps, QEMU_CAPS_NETDEV) && - qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV) && + virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { if (qemuMonitorAddNetdev(priv->mon, netstr, tapfd, tapfd_name, vhostfd, vhostfd_name) < 0) { qemuDomainObjExitMonitorWithDriver(driver, vm); @@ -832,8 +832,8 @@ int qemuDomainAttachNetDevice(virConnectPtr conn, goto cleanup; } - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { - if (!(nicstr = qemuBuildNicDevStr(net, vlan, 0, priv->caps))) + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { + if (!(nicstr = qemuBuildNicDevStr(net, vlan, 0, priv->qemuCaps))) goto try_remove; } else { if (!(nicstr = qemuBuildNicStr(net, NULL, vlan))) @@ -841,7 +841,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn, } qemuDomainObjEnterMonitorWithDriver(driver, vm); - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { if (qemuMonitorAddDevice(priv->mon, nicstr) < 0) { qemuDomainObjExitMonitorWithDriver(driver, vm); virDomainAuditNet(vm, NULL, net, "attach", false); @@ -868,7 +868,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn, } else { qemuDomainObjEnterMonitorWithDriver(driver, vm); - if (qemuCapsGet(priv->caps, QEMU_CAPS_NETDEV)) { + if (virQEMUCapsGet(priv->qemuCaps, 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); @@ -892,7 +892,7 @@ cleanup: if (!ret) { vm->def->nets[vm->def->nnets++] = net; } else { - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) && + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) && (net->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) && releaseaddr && qemuDomainPCIAddressReleaseSlot(priv->pciaddrs, @@ -926,8 +926,8 @@ try_remove: goto cleanup; if (vlan < 0) { - if (qemuCapsGet(priv->caps, QEMU_CAPS_NETDEV) && - qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV) && + virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { char *netdev_name; if (virAsprintf(&netdev_name, "host%s", net->info.alias) < 0) goto no_memory; @@ -979,13 +979,13 @@ int qemuDomainAttachHostPciDevice(virQEMUDriverPtr driver, &hostdev, 1) < 0) return -1; - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(priv->qemuCaps, 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->caps, QEMU_CAPS_PCI_CONFIGFD)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_PCI_CONFIGFD)) { configfd = qemuOpenPCIConfig(hostdev); if (configfd >= 0) { if (virAsprintf(&configfd_name, "fd-%s", @@ -1003,7 +1003,7 @@ int qemuDomainAttachHostPciDevice(virQEMUDriverPtr driver, } if (!(devstr = qemuBuildPCIHostdevDevStr(hostdev, configfd_name, - priv->caps))) + priv->qemuCaps))) goto error; qemuDomainObjEnterMonitorWithDriver(driver, vm); @@ -1035,7 +1035,7 @@ int qemuDomainAttachHostPciDevice(virQEMUDriverPtr driver, return 0; error: - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) && + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) && (hostdev->info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) && releaseaddr && qemuDomainPCIAddressReleaseSlot(priv->pciaddrs, @@ -1061,10 +1061,10 @@ int qemuDomainAttachRedirdevDevice(virQEMUDriverPtr driver, virDomainDefPtr def = vm->def; char *devstr = NULL; - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { if (qemuAssignDeviceRedirdevAlias(vm->def, redirdev, -1) < 0) goto error; - if (!(devstr = qemuBuildRedirdevDevStr(def, redirdev, priv->caps))) + if (!(devstr = qemuBuildRedirdevDevStr(def, redirdev, priv->qemuCaps))) goto error; } @@ -1074,7 +1074,7 @@ int qemuDomainAttachRedirdevDevice(virQEMUDriverPtr driver, } qemuDomainObjEnterMonitorWithDriver(driver, vm); - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) ret = qemuMonitorAddDevice(priv->mon, devstr); else goto error; @@ -1104,10 +1104,10 @@ int qemuDomainAttachHostUsbDevice(virQEMUDriverPtr driver, qemuDomainObjPrivatePtr priv = vm->privateData; char *devstr = NULL; - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { if (qemuAssignDeviceHostdevAlias(vm->def, hostdev, -1) < 0) goto error; - if (!(devstr = qemuBuildUSBHostdevDevStr(hostdev, priv->caps))) + if (!(devstr = qemuBuildUSBHostdevDevStr(hostdev, priv->qemuCaps))) goto error; } @@ -1144,7 +1144,7 @@ int qemuDomainAttachHostUsbDevice(virQEMUDriverPtr driver, } qemuDomainObjEnterMonitorWithDriver(driver, vm); - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) ret = qemuMonitorAddDevice(priv->mon, devstr); else ret = qemuMonitorAddUSBDeviceExact(priv->mon, @@ -2057,7 +2057,7 @@ int qemuDomainDetachPciDiskDevice(virQEMUDriverPtr driver, } qemuDomainObjEnterMonitorWithDriver(driver, vm); - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) { qemuDomainObjExitMonitorWithDriver(driver, vm); virDomainAuditDisk(vm, detach->src, NULL, "detach", false); @@ -2079,7 +2079,7 @@ int qemuDomainDetachPciDiskDevice(virQEMUDriverPtr driver, virDomainAuditDisk(vm, detach->src, NULL, "detach", true); - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) && + if (virQEMUCapsGet(priv->qemuCaps, 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); @@ -2129,7 +2129,7 @@ int qemuDomainDetachDiskDevice(virQEMUDriverPtr driver, goto cleanup; } - if (!qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { virReportError(VIR_ERR_OPERATION_FAILED, _("Underlying qemu does not support %s disk removal"), virDomainDiskBusTypeToString(dev->data.disk->bus)); @@ -2293,13 +2293,13 @@ int qemuDomainDetachPciControllerDevice(virQEMUDriverPtr driver, goto cleanup; } - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { if (qemuAssignDeviceControllerAlias(detach) < 0) goto cleanup; } qemuDomainObjEnterMonitorWithDriver(driver, vm); - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { if (qemuMonitorDelDevice(priv->mon, detach->info.alias)) { qemuDomainObjExitMonitorWithDriver(driver, vm); goto cleanup; @@ -2316,7 +2316,7 @@ int qemuDomainDetachPciControllerDevice(virQEMUDriverPtr driver, virDomainControllerRemove(vm->def, idx); virDomainControllerDefFree(detach); - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) && + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) && qemuDomainPCIAddressReleaseSlot(priv->pciaddrs, detach->info.addr.pci.slot) < 0) VIR_WARN("Unable to release PCI address on controller"); @@ -2355,7 +2355,7 @@ qemuDomainDetachHostPciDevice(virQEMUDriverPtr driver, } qemuDomainObjEnterMonitorWithDriver(driver, vm); - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { rv = qemuMonitorDelDevice(priv->mon, detach->info->alias); } else { rv = qemuMonitorRemovePCIDevice(priv->mon, &detach->info->addr.pci); @@ -2392,7 +2392,7 @@ qemuDomainDetachHostPciDevice(virQEMUDriverPtr driver, virObjectUnlock(driver->activePciHostdevs); virObjectUnlock(driver->inactivePciHostdevs); - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) && + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) && qemuDomainPCIAddressReleaseSlot(priv->pciaddrs, detach->info->addr.pci.slot) < 0) VIR_WARN("Unable to release PCI address on host device"); @@ -2418,7 +2418,7 @@ qemuDomainDetachHostUsbDevice(virQEMUDriverPtr driver, return -1; } - if (!qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("device cannot be detached with this QEMU version")); return -1; @@ -2611,7 +2611,7 @@ qemuDomainDetachNetDevice(virQEMUDriverPtr driver, } qemuDomainObjEnterMonitorWithDriver(driver, vm); - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) { qemuDomainObjExitMonitorWithDriver(driver, vm); virDomainAuditNet(vm, detach, NULL, "detach", false); @@ -2626,8 +2626,8 @@ qemuDomainDetachNetDevice(virQEMUDriverPtr driver, } } - if (qemuCapsGet(priv->caps, QEMU_CAPS_NETDEV) && - qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV) && + virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { if (qemuMonitorRemoveNetdev(priv->mon, hostnet_name) < 0) { qemuDomainObjExitMonitorWithDriver(driver, vm); virDomainAuditNet(vm, detach, NULL, "detach", false); @@ -2644,7 +2644,7 @@ qemuDomainDetachNetDevice(virQEMUDriverPtr driver, virDomainAuditNet(vm, detach, NULL, "detach", true); - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) && + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) && qemuDomainPCIAddressReleaseSlot(priv->pciaddrs, detach->info.addr.pci.slot) < 0) VIR_WARN("Unable to release PCI address on NIC"); diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index a75fb4ef5c..82d269924a 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1162,7 +1162,7 @@ qemuMigrationUpdateJobStatus(virQEMUDriverPtr driver, * migration finish until SPICE server transfers its data */ if (vm->def->ngraphics == 1 && vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE && - qemuCapsGet(priv->caps, QEMU_CAPS_SEAMLESS_MIGRATION)) + virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_SEAMLESS_MIGRATION)) wait_for_spice = true; ret = qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob); @@ -2286,7 +2286,7 @@ qemuMigrationRun(virQEMUDriverPtr driver, break; case MIGRATION_DEST_UNIX: - if (qemuCapsGet(priv->caps, QEMU_CAPS_MIGRATE_QEMU_UNIX)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_UNIX)) { ret = qemuMonitorMigrateToUnix(priv->mon, migrate_flags, spec->dest.unix_socket.file); } else { @@ -2441,7 +2441,7 @@ static int doNativeMigrate(virQEMUDriverPtr driver, if (!uribits) return -1; - if (qemuCapsGet(priv->caps, QEMU_CAPS_MIGRATE_QEMU_FD)) + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD)) spec.destType = MIGRATION_DEST_CONNECT_HOST; else spec.destType = MIGRATION_DEST_HOST; @@ -2483,9 +2483,9 @@ static int doTunnelMigrate(virQEMUDriverPtr driver, driver, vm, st, NULLSTR(cookiein), cookieinlen, cookieout, cookieoutlen, flags, resource); - 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)) { + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD) && + !virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_UNIX) && + !virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_EXEC)) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("Source qemu is too old to support tunnelled migration")); virObjectUnref(cfg); @@ -2495,7 +2495,7 @@ static int doTunnelMigrate(virQEMUDriverPtr driver, spec.fwdType = MIGRATION_FWD_STREAM; spec.fwd.stream = st; - if (qemuCapsGet(priv->caps, QEMU_CAPS_MIGRATE_QEMU_FD)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD)) { int fds[2]; spec.destType = MIGRATION_DEST_FD; @@ -3623,7 +3623,7 @@ qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm, qemuDomainObjExitMonitorWithDriver(driver, vm); } - if (qemuCapsGet(priv->caps, QEMU_CAPS_MIGRATE_QEMU_FD) && + if (virQEMUCapsGet(priv->qemuCaps, 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 @@ -3674,7 +3674,7 @@ qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm, if (!compressor) { const char *args[] = { "cat", NULL }; - if (qemuCapsGet(priv->caps, QEMU_CAPS_MIGRATE_QEMU_FD) && + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD) && priv->monConfig->type == VIR_DOMAIN_CHR_TYPE_UNIX) { rc = qemuMonitorMigrateToFd(priv->mon, QEMU_MONITOR_MIGRATE_BACKGROUND, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 30f923ab92..8e7c09cb31 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -1414,8 +1414,8 @@ qemuConnectMonitor(virQEMUDriverPtr driver, virDomainObjPtr vm) qemuDomainObjEnterMonitorWithDriver(driver, vm); ret = qemuMonitorSetCapabilities(priv->mon); if (ret == 0 && - qemuCapsGet(priv->caps, QEMU_CAPS_MONITOR_JSON)) - ret = qemuCapsProbeQMP(priv->caps, priv->mon); + virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MONITOR_JSON)) + ret = virQEMUCapsProbeQMP(priv->qemuCaps, priv->mon); qemuDomainObjExitMonitorWithDriver(driver, vm); error: @@ -1625,10 +1625,10 @@ qemuProcessLookupPTYs(virDomainChrDefPtr *devices, static int qemuProcessFindCharDevicePTYsMonitor(virDomainObjPtr vm, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, virHashTablePtr paths) { - bool chardevfmt = qemuCapsGet(caps, QEMU_CAPS_CHARDEV); + bool chardevfmt = virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV); int i = 0; if (qemuProcessLookupPTYs(vm->def->serials, vm->def->nserials, @@ -1753,7 +1753,7 @@ qemuProcessReadLogFD(int logfd, char *buf, int maxlen, int off) static int qemuProcessWaitForMonitor(virQEMUDriverPtr driver, virDomainObjPtr vm, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, off_t pos) { char *buf = NULL; @@ -1763,7 +1763,7 @@ qemuProcessWaitForMonitor(virQEMUDriverPtr driver, virHashTablePtr paths = NULL; qemuDomainObjPrivatePtr priv; - if (!qemuCapsUsedQMP(caps) && pos != -1) { + if (!virQEMUCapsUsedQMP(qemuCaps) && pos != -1) { if ((logfd = qemuDomainOpenLog(driver, vm, pos)) < 0) return -1; @@ -1798,7 +1798,7 @@ qemuProcessWaitForMonitor(virQEMUDriverPtr driver, VIR_DEBUG("qemuMonitorGetPtyPaths returned %i", ret); if (ret == 0) - ret = qemuProcessFindCharDevicePTYsMonitor(vm, caps, paths); + ret = qemuProcessFindCharDevicePTYsMonitor(vm, qemuCaps, paths); cleanup: virHashFree(paths); @@ -1806,7 +1806,7 @@ cleanup: if (pos != -1 && kill(vm->pid, 0) == -1 && errno == ESRCH) { /* VM is dead, any other error raised in the interim is probably * not as important as the qemu cmdline output */ - if (qemuCapsUsedQMP(caps)) { + if (virQEMUCapsUsedQMP(qemuCaps)) { if ((logfd = qemuDomainOpenLog(driver, vm, pos)) < 0) return -1; @@ -2124,7 +2124,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->caps, QEMU_CAPS_NETDEV)) { + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV)) { virReportError(VIR_ERR_NO_SUPPORT, "%s", _("Setting of link state is not supported by this qemu")); return -1; @@ -2225,7 +2225,7 @@ qemuProcessInitPasswords(virConnectPtr conn, if (ret < 0) goto cleanup; - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { for (i = 0 ; i < vm->def->ndisks ; i++) { char *secret; size_t secretLen; @@ -3237,14 +3237,14 @@ 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->caps && - !(priv->caps = qemuCapsCacheLookupCopy(driver->capsCache, - obj->def->emulator))) + if (!priv->qemuCaps && + !(priv->qemuCaps = virQEMUCapsCacheLookupCopy(driver->qemuCapsCache, + obj->def->emulator))) goto error; /* In case the domain shutdown while we were not running, * we need to finish the shutdown process. And we need to do it after - * we have qemuCaps filled in. + * we have virQEMUCaps filled in. */ if (state == VIR_DOMAIN_SHUTDOWN || (state == VIR_DOMAIN_PAUSED && @@ -3255,8 +3255,8 @@ qemuProcessReconnect(void *opaque) goto endjob; } - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) - if ((qemuDomainAssignAddresses(obj->def, priv->caps, obj)) < 0) + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) + if ((qemuDomainAssignAddresses(obj->def, priv->qemuCaps, obj)) < 0) goto error; if (virSecurityManagerReserveLabel(driver->securityManager, obj->def, obj->pid) < 0) @@ -3330,7 +3330,7 @@ error: * to remove danger of it ending up running twice if * user tries to start it again later */ - if (qemuCapsGet(priv->caps, QEMU_CAPS_NO_SHUTDOWN)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NO_SHUTDOWN)) { /* If we couldn't get the monitor and qemu supports * no-shutdown, we can safely say that the domain * crashed ... */ @@ -3732,12 +3732,12 @@ int qemuProcessStart(virConnectPtr conn, } VIR_DEBUG("Determining emulator version"); - virObjectUnref(priv->caps); - if (!(priv->caps = qemuCapsCacheLookupCopy(driver->capsCache, - vm->def->emulator))) + virObjectUnref(priv->qemuCaps); + if (!(priv->qemuCaps = virQEMUCapsCacheLookupCopy(driver->qemuCapsCache, + vm->def->emulator))) goto cleanup; - if (qemuAssignDeviceAliases(vm->def, priv->caps) < 0) + if (qemuAssignDeviceAliases(vm->def, priv->qemuCaps) < 0) goto cleanup; VIR_DEBUG("Checking for CDROM and floppy presence"); @@ -3777,7 +3777,7 @@ int qemuProcessStart(virConnectPtr conn, if (qemuProcessPrepareMonitorChr(cfg, priv->monConfig, vm->def->name) < 0) goto cleanup; - if (qemuCapsGet(priv->caps, QEMU_CAPS_MONITOR_JSON)) + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MONITOR_JSON)) priv->monJSON = 1; else priv->monJSON = 0; @@ -3808,15 +3808,15 @@ int qemuProcessStart(virConnectPtr conn, * we also need to populate the PCi address set cache for later * use in hotplug */ - if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { VIR_DEBUG("Assigning domain PCI addresses"); - if ((qemuDomainAssignAddresses(vm->def, priv->caps, vm)) < 0) + if ((qemuDomainAssignAddresses(vm->def, priv->qemuCaps, vm)) < 0) goto cleanup; } VIR_DEBUG("Building emulator command line"); if (!(cmd = qemuBuildCommandLine(conn, driver, vm->def, priv->monConfig, - priv->monJSON != 0, priv->caps, + priv->monJSON != 0, priv->qemuCaps, migrateFrom, stdin_fd, snapshot, vmop))) goto cleanup; @@ -3979,7 +3979,7 @@ int qemuProcessStart(virConnectPtr conn, goto cleanup; VIR_DEBUG("Waiting for monitor to show up"); - if (qemuProcessWaitForMonitor(driver, vm, priv->caps, pos) < 0) + if (qemuProcessWaitForMonitor(driver, vm, priv->qemuCaps, pos) < 0) goto cleanup; /* Failure to connect to agent shouldn't be fatal */ @@ -4016,7 +4016,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->caps, QEMU_CAPS_DEVICE)) { + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { VIR_DEBUG("Determining domain device PCI addresses"); if (qemuProcessInitPCIAddresses(driver, vm) < 0) goto cleanup; @@ -4370,8 +4370,8 @@ retry: virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF, reason); VIR_FREE(priv->vcpupids); priv->nvcpupids = 0; - virObjectUnref(priv->caps); - priv->caps = NULL; + virObjectUnref(priv->qemuCaps); + priv->qemuCaps = NULL; VIR_FREE(priv->pidfile); /* The "release" hook cleans up additional resources */ @@ -4488,9 +4488,9 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED, goto cleanup; VIR_DEBUG("Determining emulator version"); - virObjectUnref(priv->caps); - if (!(priv->caps = qemuCapsCacheLookupCopy(driver->capsCache, - vm->def->emulator))) + virObjectUnref(priv->qemuCaps); + if (!(priv->qemuCaps = virQEMUCapsCacheLookupCopy(driver->qemuCapsCache, + vm->def->emulator))) goto cleanup; VIR_DEBUG("Preparing monitor state"); @@ -4507,9 +4507,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->caps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { VIR_DEBUG("Assigning domain PCI addresses"); - if ((qemuDomainAssignAddresses(vm->def, priv->caps, vm)) < 0) + if ((qemuDomainAssignAddresses(vm->def, priv->qemuCaps, vm)) < 0) goto cleanup; } @@ -4531,7 +4531,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED, vm->pid = pid; VIR_DEBUG("Waiting for monitor to show up"); - if (qemuProcessWaitForMonitor(driver, vm, priv->caps, -1) < 0) + if (qemuProcessWaitForMonitor(driver, vm, priv->qemuCaps, -1) < 0) goto cleanup; /* Failure to connect to agent shouldn't be fatal */ @@ -4548,7 +4548,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->caps, QEMU_CAPS_DEVICE)) { + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { VIR_DEBUG("Determining domain device PCI addresses"); if (qemuProcessInitPCIAddresses(driver, vm) < 0) goto cleanup; diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c index 68efd9c779..720a188580 100644 --- a/tests/qemuhelptest.c +++ b/tests/qemuhelptest.c @@ -11,20 +11,20 @@ struct testInfo { const char *name; - qemuCapsPtr flags; + virQEMUCapsPtr flags; unsigned int version; unsigned int is_kvm; unsigned int kvm_version; }; -static void printMismatchedFlags(qemuCapsPtr got, - qemuCapsPtr expect) +static void printMismatchedFlags(virQEMUCapsPtr got, + virQEMUCapsPtr expect) { int i; for (i = 0 ; i < QEMU_CAPS_LAST ; i++) { - bool gotFlag = qemuCapsGet(got, i); - bool expectFlag = qemuCapsGet(expect, i); + bool gotFlag = virQEMUCapsGet(got, i); + bool expectFlag = virQEMUCapsGet(expect, i); if (gotFlag && !expectFlag) fprintf(stderr, "Extra flag %i\n", i); if (!gotFlag && expectFlag) @@ -38,7 +38,7 @@ static int testHelpStrParsing(const void *data) char *path = NULL; char *help = NULL; unsigned int version, is_kvm, kvm_version; - qemuCapsPtr flags = NULL; + virQEMUCapsPtr flags = NULL; int ret = -1; char *got = NULL; char *expected = NULL; @@ -49,19 +49,19 @@ static int testHelpStrParsing(const void *data) if (virtTestLoadFile(path, &help) < 0) goto cleanup; - if (!(flags = qemuCapsNew())) + if (!(flags = virQEMUCapsNew())) goto cleanup; - if (qemuCapsParseHelpStr("QEMU", help, flags, - &version, &is_kvm, &kvm_version, false) == -1) + if (virQEMUCapsParseHelpStr("QEMU", help, flags, + &version, &is_kvm, &kvm_version, false) == -1) goto cleanup; # ifndef WITH_YAJL - if (qemuCapsGet(info->flags, QEMU_CAPS_MONITOR_JSON)) - qemuCapsSet(flags, QEMU_CAPS_MONITOR_JSON); + if (virQEMUCapsGet(info->flags, QEMU_CAPS_MONITOR_JSON)) + virQEMUCapsSet(flags, QEMU_CAPS_MONITOR_JSON); # endif - if (qemuCapsGet(info->flags, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(info->flags, QEMU_CAPS_DEVICE)) { VIR_FREE(path); VIR_FREE(help); if (virAsprintf(&path, "%s/qemuhelpdata/%s-device", abs_srcdir, @@ -71,12 +71,12 @@ static int testHelpStrParsing(const void *data) if (virtTestLoadFile(path, &help) < 0) goto cleanup; - if (qemuCapsParseDeviceStr(flags, help) < 0) + if (virQEMUCapsParseDeviceStr(flags, help) < 0) goto cleanup; } - got = qemuCapsFlagsString(flags); - expected = qemuCapsFlagsString(info->flags); + got = virQEMUCapsFlagsString(flags); + expected = virQEMUCapsFlagsString(info->flags); if (!got || !expected) goto cleanup; @@ -132,9 +132,9 @@ mymain(void) struct testInfo info = { \ name, NULL, version, is_kvm, kvm_version \ }; \ - if (!(info.flags = qemuCapsNew())) \ + if (!(info.flags = virQEMUCapsNew())) \ return EXIT_FAILURE; \ - qemuCapsSetList(info.flags, __VA_ARGS__, QEMU_CAPS_LAST); \ + virQEMUCapsSetList(info.flags, __VA_ARGS__, QEMU_CAPS_LAST); \ if (virtTestRun("QEMU Help String Parsing " name, \ 1, testHelpStrParsing, &info) < 0) \ ret = -1; \ diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index a1815047be..43570689cf 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -81,7 +81,7 @@ typedef enum { static int testCompareXMLToArgvFiles(const char *xml, const char *cmdline, - qemuCapsPtr extraFlags, + virQEMUCapsPtr extraFlags, const char *migrateFrom, int migrateFd, virQemuXML2ArgvTestFlags flags) @@ -108,7 +108,7 @@ static int testCompareXMLToArgvFiles(const char *xml, goto out; } - if (qemuCapsGet(extraFlags, QEMU_CAPS_DOMID)) + if (virQEMUCapsGet(extraFlags, QEMU_CAPS_DOMID)) vmdef->id = 6; else vmdef->id = -1; @@ -118,11 +118,11 @@ static int testCompareXMLToArgvFiles(const char *xml, monitor_chr.data.nix.path = (char *)"/tmp/test-monitor"; monitor_chr.data.nix.listen = true; - qemuCapsSetList(extraFlags, - QEMU_CAPS_VNC_COLON, - QEMU_CAPS_NO_REBOOT, - QEMU_CAPS_NO_ACPI, - QEMU_CAPS_LAST); + virQEMUCapsSetList(extraFlags, + QEMU_CAPS_VNC_COLON, + QEMU_CAPS_NO_REBOOT, + QEMU_CAPS_NO_ACPI, + QEMU_CAPS_LAST); if (STREQ(vmdef->os.machine, "pc") && STREQ(vmdef->emulator, "/usr/bin/qemu-system-x86_64")) { @@ -131,7 +131,7 @@ static int testCompareXMLToArgvFiles(const char *xml, goto out; } - if (qemuCapsGet(extraFlags, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(extraFlags, QEMU_CAPS_DEVICE)) { if (qemuDomainAssignAddresses(vmdef, extraFlags, NULL)) { if (flags & FLAG_EXPECT_ERROR) goto ok; @@ -145,7 +145,7 @@ static int testCompareXMLToArgvFiles(const char *xml, if (vmdef->os.arch == VIR_ARCH_X86_64 || vmdef->os.arch == VIR_ARCH_I686) { - qemuCapsSet(extraFlags, QEMU_CAPS_PCI_MULTIBUS); + virQEMUCapsSet(extraFlags, QEMU_CAPS_PCI_MULTIBUS); } if (qemuAssignDeviceAliases(vmdef, extraFlags) < 0) @@ -207,7 +207,7 @@ out: struct testInfo { const char *name; - qemuCapsPtr extraFlags; + virQEMUCapsPtr extraFlags; const char *migrateFrom; int migrateFd; unsigned int flags; @@ -228,7 +228,7 @@ testCompareXMLToArgvHelper(const void *data) abs_srcdir, info->name) < 0) goto cleanup; - if (qemuCapsGet(info->extraFlags, QEMU_CAPS_MONITOR_JSON)) + if (virQEMUCapsGet(info->extraFlags, QEMU_CAPS_MONITOR_JSON)) flags |= FLAG_JSON; result = testCompareXMLToArgvFiles(xml, args, info->extraFlags, @@ -243,7 +243,7 @@ cleanup: static int -testAddCPUModels(qemuCapsPtr caps, bool skipLegacy) +testAddCPUModels(virQEMUCapsPtr caps, bool skipLegacy) { const char *newModels[] = { "Opteron_G3", "Opteron_G2", "Opteron_G1", @@ -257,13 +257,13 @@ testAddCPUModels(qemuCapsPtr caps, bool skipLegacy) size_t i; for (i = 0 ; i < ARRAY_CARDINALITY(newModels) ; i++) { - if (qemuCapsAddCPUDefinition(caps, newModels[i]) < 0) + if (virQEMUCapsAddCPUDefinition(caps, newModels[i]) < 0) return -1; } if (skipLegacy) return 0; for (i = 0 ; i < ARRAY_CARDINALITY(legacyModels) ; i++) { - if (qemuCapsAddCPUDefinition(caps, legacyModels[i]) < 0) + if (virQEMUCapsAddCPUDefinition(caps, legacyModels[i]) < 0) return -1; } return 0; @@ -317,11 +317,11 @@ mymain(void) static struct testInfo info = { \ name, NULL, migrateFrom, migrateFd, (flags) \ }; \ - if (!(info.extraFlags = qemuCapsNew())) \ + if (!(info.extraFlags = virQEMUCapsNew())) \ return EXIT_FAILURE; \ if (testAddCPUModels(info.extraFlags, skipLegacyCPUs) < 0) \ return EXIT_FAILURE; \ - qemuCapsSetList(info.extraFlags, __VA_ARGS__, QEMU_CAPS_LAST); \ + virQEMUCapsSetList(info.extraFlags, __VA_ARGS__, QEMU_CAPS_LAST);\ if (virtTestRun("QEMU XML-2-ARGV " name, \ 1, testCompareXMLToArgvHelper, &info) < 0) \ ret = -1; \ diff --git a/tests/qemuxmlnstest.c b/tests/qemuxmlnstest.c index de80a0f558..6dae3f4a9e 100644 --- a/tests/qemuxmlnstest.c +++ b/tests/qemuxmlnstest.c @@ -25,7 +25,7 @@ static virQEMUDriver driver; static int testCompareXMLToArgvFiles(const char *xml, const char *cmdline, - qemuCapsPtr extraFlags, + virQEMUCapsPtr extraFlags, const char *migrateFrom, int migrateFd, bool json, @@ -76,7 +76,7 @@ static int testCompareXMLToArgvFiles(const char *xml, goto fail; } - if (qemuCapsGet(extraFlags, QEMU_CAPS_DOMID)) + if (virQEMUCapsGet(extraFlags, QEMU_CAPS_DOMID)) vmdef->id = 6; else vmdef->id = -1; @@ -86,13 +86,13 @@ static int testCompareXMLToArgvFiles(const char *xml, monitor_chr.data.nix.path = (char *)"/tmp/test-monitor"; monitor_chr.data.nix.listen = true; - qemuCapsSetList(extraFlags, - QEMU_CAPS_VNC_COLON, - QEMU_CAPS_NO_REBOOT, - QEMU_CAPS_NO_ACPI, - QEMU_CAPS_LAST); + virQEMUCapsSetList(extraFlags, + QEMU_CAPS_VNC_COLON, + QEMU_CAPS_NO_REBOOT, + QEMU_CAPS_NO_ACPI, + QEMU_CAPS_LAST); - if (qemuCapsGet(extraFlags, QEMU_CAPS_DEVICE)) + if (virQEMUCapsGet(extraFlags, QEMU_CAPS_DEVICE)) qemuDomainAssignAddresses(vmdef, extraFlags, NULL); log = virtTestLogContentAndReset(); @@ -101,7 +101,7 @@ static int testCompareXMLToArgvFiles(const char *xml, if (vmdef->os.arch == VIR_ARCH_X86_64 || vmdef->os.arch == VIR_ARCH_I686) { - qemuCapsSet(extraFlags, QEMU_CAPS_PCI_MULTIBUS); + virQEMUCapsSet(extraFlags, QEMU_CAPS_PCI_MULTIBUS); } if (qemuAssignDeviceAliases(vmdef, extraFlags) < 0) @@ -157,7 +157,7 @@ static int testCompareXMLToArgvFiles(const char *xml, struct testInfo { const char *name; - qemuCapsPtr extraFlags; + virQEMUCapsPtr extraFlags; const char *migrateFrom; int migrateFd; bool json; @@ -215,9 +215,9 @@ mymain(void) struct testInfo info = { \ name, NULL, migrateFrom, migrateFd, json, expectError \ }; \ - if (!(info.extraFlags = qemuCapsNew())) \ + if (!(info.extraFlags = virQEMUCapsNew())) \ return EXIT_FAILURE; \ - qemuCapsSetList(info.extraFlags, __VA_ARGS__, QEMU_CAPS_LAST); \ + virQEMUCapsSetList(info.extraFlags, __VA_ARGS__, QEMU_CAPS_LAST);\ if (virtTestRun("QEMU XML-2-ARGV " name, \ 1, testCompareXMLToArgvHelper, &info) < 0) \ ret = -1; \