From: "Daniel P. Berrange" <berrange@xxxxxxxxxx> To avoid confusion between 'virCapsPtr' and 'qemuCapsPtr' do some renaming of various. All instances of 'qemuCapsPtr' are renamed to 'qemuCaps'. To avoid that clashing with the 'qemuCaps' typedef though, rename the latter to virQEMUCaps. --- src/qemu/qemu_capabilities.c | 860 +++++++++++++++++++++---------------------- 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 | 70 ++-- tests/qemuhelptest.c | 32 +- tests/qemuxml2argvtest.c | 32 +- tests/qemuxmlnstest.c | 24 +- 14 files changed, 1076 insertions(+), 1074 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index ceed735..32b8ee2 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,30 +307,30 @@ cleanup: } static virCommandPtr -qemuCapsProbeCommand(const char *qemu, - qemuCapsPtr caps, - qemuCapsHookDataPtr hookData) +virQEMUCapsProbeCommand(const char *qemu, + virQEMUCapsPtr caps, + virQEMUCapsHookDataPtr hookData) { virCommandPtr cmd = virCommandNew(qemu); if (caps) { - if (qemuCapsGet(caps, QEMU_CAPS_NO_USER_CONFIG)) + if (virQEMUCapsGet(caps, QEMU_CAPS_NO_USER_CONFIG)) virCommandAddArg(cmd, "-no-user-config"); - else if (qemuCapsGet(caps, QEMU_CAPS_NODEFCONFIG)) + else if (virQEMUCapsGet(caps, 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 caps, + size_t defIdx) { char *name = caps->machineTypes[defIdx]; char *alias = caps->machineAliases[defIdx]; @@ -349,8 +349,8 @@ qemuSetDefaultMachine(qemuCapsPtr caps, * <machine> <desc> [(default)|(alias of <canonical>)] */ static int -qemuCapsParseMachineTypesStr(const char *output, - qemuCapsPtr caps) +virQEMUCapsParseMachineTypesStr(const char *output, + virQEMUCapsPtr caps) { const char *p = output; const char *next; @@ -406,7 +406,7 @@ qemuCapsParseMachineTypesStr(const char *output, if (defIdx) - qemuSetDefaultMachine(caps, defIdx); + virQEMUCapsSetDefaultMachine(caps, defIdx); return 0; @@ -416,7 +416,7 @@ no_memory: } static int -qemuCapsProbeMachineTypes(qemuCapsPtr caps, qemuCapsHookDataPtr hookData) +virQEMUCapsProbeMachineTypes(virQEMUCapsPtr caps, virQEMUCapsHookDataPtr hookData) { char *output; int ret = -1; @@ -433,7 +433,7 @@ qemuCapsProbeMachineTypes(qemuCapsPtr caps, qemuCapsHookDataPtr hookData) return -1; } - cmd = qemuCapsProbeCommand(caps->binary, caps, hookData); + cmd = virQEMUCapsProbeCommand(caps->binary, caps, 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, caps) < 0) goto cleanup; ret = 0; @@ -455,8 +455,8 @@ cleanup: typedef int -(*qemuCapsParseCPUModels)(const char *output, - qemuCapsPtr caps); +(*virQEMUCapsParseCPUModels)(const char *output, + virQEMUCapsPtr caps); /* Format: * <arch> <model> @@ -464,8 +464,8 @@ typedef int * <arch> [<model>] */ static int -qemuCapsParseX86Models(const char *output, - qemuCapsPtr caps) +virQEMUCapsParseX86Models(const char *output, + virQEMUCapsPtr caps) { const char *p = output; const char *next; @@ -522,8 +522,8 @@ cleanup: * Format : PowerPC <machine> <description> */ static int -qemuCapsParsePPCModels(const char *output, - qemuCapsPtr caps) +virQEMUCapsParsePPCModels(const char *output, + virQEMUCapsPtr caps) { const char *p = output; const char *next; @@ -572,25 +572,25 @@ cleanup: } static int -qemuCapsProbeCPUModels(qemuCapsPtr caps, qemuCapsHookDataPtr hookData) +virQEMUCapsProbeCPUModels(virQEMUCapsPtr caps, 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; + parse = virQEMUCapsParseX86Models; else if (caps->arch == VIR_ARCH_PPC64) - parse = qemuCapsParsePPCModels; + parse = virQEMUCapsParsePPCModels; else { VIR_DEBUG("don't know how to parse %s CPU models", virArchToString(caps->arch)); return 0; } - cmd = qemuCapsProbeCommand(caps->binary, caps, hookData); + cmd = virQEMUCapsProbeCommand(caps->binary, caps, hookData); virCommandAddArgList(cmd, "-cpu", "?", NULL); virCommandSetOutputBuffer(cmd, &output); @@ -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,7 +919,7 @@ 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, + if (virQEMUCapsInitGuest(caps, cache, virArchFromHost(), i) < 0) goto error; @@ -927,7 +927,7 @@ virCapsPtr qemuCapsInit(qemuCapsCachePtr cache) /* 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 caps, + bool check_yajl ATTRIBUTE_UNUSED) { const char *p; const char *fsdev, *netdev; if (strstr(help, "-no-kqemu")) - qemuCapsSet(caps, QEMU_CAPS_KQEMU); + virQEMUCapsSet(caps, QEMU_CAPS_KQEMU); if (strstr(help, "-enable-kqemu")) - qemuCapsSet(caps, QEMU_CAPS_ENABLE_KQEMU); + virQEMUCapsSet(caps, QEMU_CAPS_ENABLE_KQEMU); if (strstr(help, "-no-kvm")) - qemuCapsSet(caps, QEMU_CAPS_KVM); + virQEMUCapsSet(caps, QEMU_CAPS_KVM); if (strstr(help, "-enable-kvm")) - qemuCapsSet(caps, QEMU_CAPS_ENABLE_KVM); + virQEMUCapsSet(caps, QEMU_CAPS_ENABLE_KVM); if (strstr(help, "-no-reboot")) - qemuCapsSet(caps, QEMU_CAPS_NO_REBOOT); + virQEMUCapsSet(caps, QEMU_CAPS_NO_REBOOT); if (strstr(help, "-name")) { - qemuCapsSet(caps, QEMU_CAPS_NAME); + virQEMUCapsSet(caps, QEMU_CAPS_NAME); if (strstr(help, ",process=")) - qemuCapsSet(caps, QEMU_CAPS_NAME_PROCESS); + virQEMUCapsSet(caps, QEMU_CAPS_NAME_PROCESS); } if (strstr(help, "-uuid")) - qemuCapsSet(caps, QEMU_CAPS_UUID); + virQEMUCapsSet(caps, QEMU_CAPS_UUID); if (strstr(help, "-xen-domid")) - qemuCapsSet(caps, QEMU_CAPS_XEN_DOMID); + virQEMUCapsSet(caps, QEMU_CAPS_XEN_DOMID); else if (strstr(help, "-domid")) - qemuCapsSet(caps, QEMU_CAPS_DOMID); + virQEMUCapsSet(caps, QEMU_CAPS_DOMID); if (strstr(help, "-drive")) { const char *cache = strstr(help, "cache="); - qemuCapsSet(caps, QEMU_CAPS_DRIVE); + virQEMUCapsSet(caps, 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(caps, QEMU_CAPS_DRIVE_CACHE_V2); if (memmem(cache, p - cache, "directsync", sizeof("directsync") - 1)) - qemuCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC); + virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC); if (memmem(cache, p - cache, "unsafe", sizeof("unsafe") - 1)) - qemuCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_UNSAFE); + virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_UNSAFE); } if (strstr(help, "format=")) - qemuCapsSet(caps, QEMU_CAPS_DRIVE_FORMAT); + virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_FORMAT); if (strstr(help, "readonly=")) - qemuCapsSet(caps, QEMU_CAPS_DRIVE_READONLY); + virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_READONLY); if (strstr(help, "aio=threads|native")) - qemuCapsSet(caps, QEMU_CAPS_DRIVE_AIO); + virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_AIO); if (strstr(help, "copy-on-read=on|off")) - qemuCapsSet(caps, QEMU_CAPS_DRIVE_COPY_ON_READ); + virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_COPY_ON_READ); if (strstr(help, "bps=")) - qemuCapsSet(caps, QEMU_CAPS_DRIVE_IOTUNE); + virQEMUCapsSet(caps, 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(caps, QEMU_CAPS_VGA); if (strstr(p, "|qxl")) - qemuCapsSet(caps, QEMU_CAPS_VGA_QXL); + virQEMUCapsSet(caps, QEMU_CAPS_VGA_QXL); if ((p = strstr(p, "|none")) && p < nl) - qemuCapsSet(caps, QEMU_CAPS_VGA_NONE); + virQEMUCapsSet(caps, QEMU_CAPS_VGA_NONE); } if (strstr(help, "-spice")) - qemuCapsSet(caps, QEMU_CAPS_SPICE); + virQEMUCapsSet(caps, QEMU_CAPS_SPICE); if (strstr(help, "-vnc")) - qemuCapsSet(caps, QEMU_CAPS_VNC); + virQEMUCapsSet(caps, QEMU_CAPS_VNC); if (strstr(help, "seamless-migration=")) - qemuCapsSet(caps, QEMU_CAPS_SEAMLESS_MIGRATION); + virQEMUCapsSet(caps, QEMU_CAPS_SEAMLESS_MIGRATION); if (strstr(help, "boot=on")) - qemuCapsSet(caps, QEMU_CAPS_DRIVE_BOOT); + virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_BOOT); if (strstr(help, "serial=s")) - qemuCapsSet(caps, QEMU_CAPS_DRIVE_SERIAL); + virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_SERIAL); if (strstr(help, "-pcidevice")) - qemuCapsSet(caps, QEMU_CAPS_PCIDEVICE); + virQEMUCapsSet(caps, QEMU_CAPS_PCIDEVICE); if (strstr(help, "-mem-path")) - qemuCapsSet(caps, QEMU_CAPS_MEM_PATH); + virQEMUCapsSet(caps, QEMU_CAPS_MEM_PATH); if (strstr(help, "-chardev")) { - qemuCapsSet(caps, QEMU_CAPS_CHARDEV); + virQEMUCapsSet(caps, QEMU_CAPS_CHARDEV); if (strstr(help, "-chardev spicevmc")) - qemuCapsSet(caps, QEMU_CAPS_CHARDEV_SPICEVMC); + virQEMUCapsSet(caps, QEMU_CAPS_CHARDEV_SPICEVMC); } if (strstr(help, "-balloon")) - qemuCapsSet(caps, QEMU_CAPS_BALLOON); + virQEMUCapsSet(caps, QEMU_CAPS_BALLOON); if (strstr(help, "-device")) { - qemuCapsSet(caps, QEMU_CAPS_DEVICE); + virQEMUCapsSet(caps, 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(caps, QEMU_CAPS_DRIVE_READONLY); } if (strstr(help, "-nodefconfig")) - qemuCapsSet(caps, QEMU_CAPS_NODEFCONFIG); + virQEMUCapsSet(caps, QEMU_CAPS_NODEFCONFIG); if (strstr(help, "-no-user-config")) - qemuCapsSet(caps, QEMU_CAPS_NO_USER_CONFIG); + virQEMUCapsSet(caps, QEMU_CAPS_NO_USER_CONFIG); /* The trailing ' ' is important to avoid a bogus match */ if (strstr(help, "-rtc ")) - qemuCapsSet(caps, QEMU_CAPS_RTC); + virQEMUCapsSet(caps, QEMU_CAPS_RTC); /* to wit */ if (strstr(help, "-rtc-td-hack")) - qemuCapsSet(caps, QEMU_CAPS_RTC_TD_HACK); + virQEMUCapsSet(caps, QEMU_CAPS_RTC_TD_HACK); if (strstr(help, "-no-hpet")) - qemuCapsSet(caps, QEMU_CAPS_NO_HPET); + virQEMUCapsSet(caps, QEMU_CAPS_NO_HPET); if (strstr(help, "-no-acpi")) - qemuCapsSet(caps, QEMU_CAPS_NO_ACPI); + virQEMUCapsSet(caps, QEMU_CAPS_NO_ACPI); if (strstr(help, "-no-kvm-pit-reinjection")) - qemuCapsSet(caps, QEMU_CAPS_NO_KVM_PIT); + virQEMUCapsSet(caps, QEMU_CAPS_NO_KVM_PIT); if (strstr(help, "-tdf")) - qemuCapsSet(caps, QEMU_CAPS_TDF); + virQEMUCapsSet(caps, QEMU_CAPS_TDF); if (strstr(help, "-enable-nesting")) - qemuCapsSet(caps, QEMU_CAPS_NESTING); + virQEMUCapsSet(caps, QEMU_CAPS_NESTING); if (strstr(help, ",menu=on")) - qemuCapsSet(caps, QEMU_CAPS_BOOT_MENU); + virQEMUCapsSet(caps, QEMU_CAPS_BOOT_MENU); if (strstr(help, ",reboot-timeout=rb_time")) - qemuCapsSet(caps, QEMU_CAPS_REBOOT_TIMEOUT); + virQEMUCapsSet(caps, QEMU_CAPS_REBOOT_TIMEOUT); if ((fsdev = strstr(help, "-fsdev"))) { - qemuCapsSet(caps, QEMU_CAPS_FSDEV); + virQEMUCapsSet(caps, QEMU_CAPS_FSDEV); if (strstr(fsdev, "readonly")) - qemuCapsSet(caps, QEMU_CAPS_FSDEV_READONLY); + virQEMUCapsSet(caps, QEMU_CAPS_FSDEV_READONLY); if (strstr(fsdev, "writeout")) - qemuCapsSet(caps, QEMU_CAPS_FSDEV_WRITEOUT); + virQEMUCapsSet(caps, QEMU_CAPS_FSDEV_WRITEOUT); } if (strstr(help, "-smbios type")) - qemuCapsSet(caps, QEMU_CAPS_SMBIOS_TYPE); + virQEMUCapsSet(caps, QEMU_CAPS_SMBIOS_TYPE); if (strstr(help, "-sandbox")) - qemuCapsSet(caps, QEMU_CAPS_SECCOMP_SANDBOX); + virQEMUCapsSet(caps, 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(caps, QEMU_CAPS_NETDEV_BRIDGE); + virQEMUCapsSet(caps, QEMU_CAPS_NETDEV); } } if (strstr(help, "-sdl")) - qemuCapsSet(caps, QEMU_CAPS_SDL); + virQEMUCapsSet(caps, QEMU_CAPS_SDL); if (strstr(help, "cores=") && strstr(help, "threads=") && strstr(help, "sockets=")) - qemuCapsSet(caps, QEMU_CAPS_SMP_TOPOLOGY); + virQEMUCapsSet(caps, QEMU_CAPS_SMP_TOPOLOGY); if (version >= 9000) - qemuCapsSet(caps, QEMU_CAPS_VNC_COLON); + virQEMUCapsSet(caps, QEMU_CAPS_VNC_COLON); if (is_kvm && (version >= 10000 || kvm_version >= 74)) - qemuCapsSet(caps, QEMU_CAPS_VNET_HDR); + virQEMUCapsSet(caps, QEMU_CAPS_VNET_HDR); if (strstr(help, ",vhost=")) { - qemuCapsSet(caps, QEMU_CAPS_VHOST_NET); + virQEMUCapsSet(caps, 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(caps, QEMU_CAPS_NO_SHUTDOWN); if (strstr(help, "dump-guest-core=on|off")) - qemuCapsSet(caps, QEMU_CAPS_DUMP_GUEST_CORE); + virQEMUCapsSet(caps, 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(caps, QEMU_CAPS_MIGRATE_QEMU_TCP); + virQEMUCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_EXEC); if (version >= 12000) { - qemuCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_UNIX); - qemuCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_FD); + virQEMUCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_UNIX); + virQEMUCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_FD); } } else if (kvm_version >= 79) { - qemuCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_TCP); + virQEMUCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_TCP); if (kvm_version >= 80) - qemuCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_EXEC); + virQEMUCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_EXEC); } else if (kvm_version > 0) { - qemuCapsSet(caps, QEMU_CAPS_MIGRATE_KVM_STDIO); + virQEMUCapsSet(caps, QEMU_CAPS_MIGRATE_KVM_STDIO); } if (version >= 10000) - qemuCapsSet(caps, QEMU_CAPS_0_10); + virQEMUCapsSet(caps, QEMU_CAPS_0_10); if (version >= 11000) - qemuCapsSet(caps, QEMU_CAPS_VIRTIO_BLK_SG_IO); + virQEMUCapsSet(caps, QEMU_CAPS_VIRTIO_BLK_SG_IO); /* While JSON mode was available in 0.12.0, it was too * incomplete to contemplate using. The 0.13.0 release @@ -1150,11 +1150,11 @@ qemuCapsComputeCmdFlags(const char *help, */ #if WITH_YAJL if (version >= 13000) { - qemuCapsSet(caps, QEMU_CAPS_MONITOR_JSON); + virQEMUCapsSet(caps, QEMU_CAPS_MONITOR_JSON); } else if (version >= 12000 && strstr(help, "libvirt")) { - qemuCapsSet(caps, QEMU_CAPS_MONITOR_JSON); - qemuCapsSet(caps, QEMU_CAPS_NETDEV); + virQEMUCapsSet(caps, QEMU_CAPS_MONITOR_JSON); + virQEMUCapsSet(caps, 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(caps, QEMU_CAPS_NETDEV); } #endif if (version >= 13000) - qemuCapsSet(caps, QEMU_CAPS_PCI_MULTIFUNCTION); + virQEMUCapsSet(caps, QEMU_CAPS_PCI_MULTIFUNCTION); /* Although very new versions of qemu advertise the presence of * the rombar option in the output of "qemu -device pci-assign,?", @@ -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(caps, QEMU_CAPS_PCI_ROMBAR); if (version >= 11000) - qemuCapsSet(caps, QEMU_CAPS_CPU_HOST); + virQEMUCapsSet(caps, QEMU_CAPS_CPU_HOST); if (version >= 1002000) - qemuCapsSet(caps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY); + virQEMUCapsSet(caps, 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 caps, + unsigned int *version, + unsigned int *is_kvm, + unsigned int *kvm_version, + bool check_yajl) { unsigned major, minor, micro; const char *p = help; @@ -1287,7 +1287,7 @@ int qemuCapsParseHelpStr(const char *qemu, *version = (major * 1000 * 1000) + (minor * 1000) + micro; - if (qemuCapsComputeCmdFlags(help, *version, *is_kvm, *kvm_version, + if (virQEMUCapsComputeCmdFlags(help, *version, *is_kvm, *kvm_version, caps, check_yajl) < 0) goto cleanup; @@ -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 caps, + 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(caps, 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 caps, 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, + virQEMUCapsProcessStringFlags(caps, + ARRAY_CARDINALITY(virQEMUCapsObjectTypes), + virQEMUCapsObjectTypes, nvalues, values); - qemuCapsFreeStringList(nvalues, values); + virQEMUCapsFreeStringList(nvalues, values); - for (i = 0 ; i < ARRAY_CARDINALITY(qemuCapsObjectProps); i++) { - const char *type = qemuCapsObjectProps[i].type; - if ((nvalues = qemuCapsParseDeviceStrObjectProps(str, + 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, + virQEMUCapsProcessStringFlags(caps, + virQEMUCapsObjectProps[i].nprops, + virQEMUCapsObjectProps[i].props, nvalues, values); - qemuCapsFreeStringList(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(caps, QEMU_CAPS_CHARDEV_SPICEVMC)) + virQEMUCapsClear(caps, QEMU_CAPS_DEVICE_SPICEVMC); return 0; } static int -qemuCapsExtractDeviceStr(const char *qemu, - qemuCapsPtr caps, - qemuCapsHookDataPtr hookData) +virQEMUCapsExtractDeviceStr(const char *qemu, + virQEMUCapsPtr caps, + 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, caps, 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(caps, 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,15 +1673,15 @@ int qemuCapsGetDefaultVersion(virCapsPtr caps, -qemuCapsPtr -qemuCapsNew(void) +virQEMUCapsPtr +virQEMUCapsNew(void) { - qemuCapsPtr caps; + virQEMUCapsPtr caps; - if (qemuCapsInitialize() < 0) + if (virQEMUCapsInitialize() < 0) return NULL; - if (!(caps = virObjectNew(qemuCapsClass))) + if (!(caps = virObjectNew(virQEMUCapsClass))) return NULL; if (!(caps->flags = virBitmapNew(QEMU_CAPS_LAST))) @@ -1696,9 +1696,9 @@ no_memory: } -qemuCapsPtr qemuCapsNewCopy(qemuCapsPtr caps) +virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr caps) { - qemuCapsPtr ret = qemuCapsNew(); + virQEMUCapsPtr ret = virQEMUCapsNew(); size_t i; if (!ret) @@ -1741,9 +1741,9 @@ no_memory: } -void qemuCapsDispose(void *obj) +void virQEMUCapsDispose(void *obj) { - qemuCapsPtr caps = obj; + virQEMUCapsPtr caps = obj; size_t i; for (i = 0 ; i < caps->nmachineTypes ; i++) { @@ -1764,15 +1764,15 @@ void qemuCapsDispose(void *obj) } void -qemuCapsSet(qemuCapsPtr caps, - enum qemuCapsFlags flag) +virQEMUCapsSet(virQEMUCapsPtr caps, + enum virQEMUCapsFlags flag) { ignore_value(virBitmapSetBit(caps->flags, flag)); } void -qemuCapsSetList(qemuCapsPtr caps, ...) +virQEMUCapsSetList(virQEMUCapsPtr caps, ...) { va_list list; int flag; @@ -1785,22 +1785,22 @@ qemuCapsSetList(qemuCapsPtr caps, ...) void -qemuCapsClear(qemuCapsPtr caps, - enum qemuCapsFlags flag) +virQEMUCapsClear(virQEMUCapsPtr caps, + enum virQEMUCapsFlags flag) { ignore_value(virBitmapClearBit(caps->flags, flag)); } -char *qemuCapsFlagsString(qemuCapsPtr caps) +char *virQEMUCapsFlagsString(virQEMUCapsPtr caps) { return virBitmapString(caps->flags); } bool -qemuCapsGet(qemuCapsPtr caps, - enum qemuCapsFlags flag) +virQEMUCapsGet(virQEMUCapsPtr caps, + enum virQEMUCapsFlags flag) { bool b; @@ -1811,31 +1811,31 @@ qemuCapsGet(qemuCapsPtr caps, } -const char *qemuCapsGetBinary(qemuCapsPtr caps) +const char *virQEMUCapsGetBinary(virQEMUCapsPtr caps) { return caps->binary; } -virArch qemuCapsGetArch(qemuCapsPtr caps) +virArch virQEMUCapsGetArch(virQEMUCapsPtr caps) { return caps->arch; } -unsigned int qemuCapsGetVersion(qemuCapsPtr caps) +unsigned int virQEMUCapsGetVersion(virQEMUCapsPtr caps) { return caps->version; } -unsigned int qemuCapsGetKVMVersion(qemuCapsPtr caps) +unsigned int virQEMUCapsGetKVMVersion(virQEMUCapsPtr caps) { return caps->kvmVersion; } -int qemuCapsAddCPUDefinition(qemuCapsPtr caps, - const char *name) +int virQEMUCapsAddCPUDefinition(virQEMUCapsPtr caps, + const char *name) { char *tmp = strdup(name); if (!tmp) { @@ -1852,8 +1852,8 @@ int qemuCapsAddCPUDefinition(qemuCapsPtr caps, } -size_t qemuCapsGetCPUDefinitions(qemuCapsPtr caps, - char ***names) +size_t virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr caps, + char ***names) { if (names) *names = caps->cpuDefinitions; @@ -1861,17 +1861,17 @@ size_t qemuCapsGetCPUDefinitions(qemuCapsPtr caps, } -size_t qemuCapsGetMachineTypes(qemuCapsPtr caps, - char ***names) +size_t virQEMUCapsGetMachineTypes(virQEMUCapsPtr caps, + char ***names) { if (names) *names = caps->machineTypes; return caps->nmachineTypes; } -int qemuCapsGetMachineTypesCaps(qemuCapsPtr caps, - size_t *nmachines, - virCapsGuestMachinePtr **machines) +int virQEMUCapsGetMachineTypesCaps(virQEMUCapsPtr caps, + size_t *nmachines, + virCapsGuestMachinePtr **machines) { size_t i; @@ -1909,8 +1909,8 @@ no_memory: -const char *qemuCapsGetCanonicalMachine(qemuCapsPtr caps, - const char *name) +const char *virQEMUCapsGetCanonicalMachine(virQEMUCapsPtr caps, + const char *name) { size_t i; @@ -1929,8 +1929,8 @@ const char *qemuCapsGetCanonicalMachine(qemuCapsPtr caps, static int -qemuCapsProbeQMPCommands(qemuCapsPtr caps, - qemuMonitorPtr mon) +virQEMUCapsProbeQMPCommands(virQEMUCapsPtr caps, + 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(caps, QEMU_CAPS_WAKEUP); else if (STREQ(name, "transaction")) - qemuCapsSet(caps, QEMU_CAPS_TRANSACTION); + virQEMUCapsSet(caps, QEMU_CAPS_TRANSACTION); else if (STREQ(name, "block_job_cancel")) - qemuCapsSet(caps, QEMU_CAPS_BLOCKJOB_SYNC); + virQEMUCapsSet(caps, QEMU_CAPS_BLOCKJOB_SYNC); else if (STREQ(name, "block-job-cancel")) - qemuCapsSet(caps, QEMU_CAPS_BLOCKJOB_ASYNC); + virQEMUCapsSet(caps, QEMU_CAPS_BLOCKJOB_ASYNC); else if (STREQ(name, "dump-guest-memory")) - qemuCapsSet(caps, QEMU_CAPS_DUMP_GUEST_MEMORY); + virQEMUCapsSet(caps, QEMU_CAPS_DUMP_GUEST_MEMORY); else if (STREQ(name, "query-spice")) - qemuCapsSet(caps, QEMU_CAPS_SPICE); + virQEMUCapsSet(caps, QEMU_CAPS_SPICE); else if (STREQ(name, "query-kvm")) - qemuCapsSet(caps, QEMU_CAPS_KVM); + virQEMUCapsSet(caps, QEMU_CAPS_KVM); else if (STREQ(name, "block-commit")) - qemuCapsSet(caps, QEMU_CAPS_BLOCK_COMMIT); + virQEMUCapsSet(caps, QEMU_CAPS_BLOCK_COMMIT); else if (STREQ(name, "query-vnc")) - qemuCapsSet(caps, QEMU_CAPS_VNC); + virQEMUCapsSet(caps, QEMU_CAPS_VNC); else if (STREQ(name, "drive-mirror")) - qemuCapsSet(caps, QEMU_CAPS_DRIVE_MIRROR); + virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_MIRROR); else if (STREQ(name, "blockdev-snapshot-sync")) - qemuCapsSet(caps, QEMU_CAPS_DISK_SNAPSHOT); + virQEMUCapsSet(caps, QEMU_CAPS_DISK_SNAPSHOT); else if (STREQ(name, "add-fd")) - qemuCapsSet(caps, QEMU_CAPS_ADD_FD); + virQEMUCapsSet(caps, 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(caps, 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(caps, QEMU_CAPS_ADD_FD); VIR_FORCE_CLOSE(fd); } @@ -1990,8 +1990,8 @@ qemuCapsProbeQMPCommands(qemuCapsPtr caps, static int -qemuCapsProbeQMPEvents(qemuCapsPtr caps, - qemuMonitorPtr mon) +virQEMUCapsProbeQMPEvents(virQEMUCapsPtr caps, + 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(caps, QEMU_CAPS_BALLOON_EVENT); if (STREQ(name, "SPICE_MIGRATE_COMPLETED")) - qemuCapsSet(caps, QEMU_CAPS_SEAMLESS_MIGRATION); + virQEMUCapsSet(caps, 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 caps, + 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, + virQEMUCapsProcessStringFlags(caps, + ARRAY_CARDINALITY(virQEMUCapsObjectTypes), + virQEMUCapsObjectTypes, nvalues, values); - qemuCapsFreeStringList(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, + virQEMUCapsProcessStringFlags(caps, + virQEMUCapsObjectProps[i].nprops, + virQEMUCapsObjectProps[i].props, nvalues, values); - qemuCapsFreeStringList(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(caps, QEMU_CAPS_CHARDEV_SPICEVMC)) + virQEMUCapsClear(caps, 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(caps, QEMU_CAPS_DEVICE_QXL)) + virQEMUCapsSet(caps, QEMU_CAPS_VGA_QXL); return 0; } static int -qemuCapsProbeQMPMachineTypes(qemuCapsPtr caps, - qemuMonitorPtr mon) +virQEMUCapsProbeQMPMachineTypes(virQEMUCapsPtr caps, + qemuMonitorPtr mon) { qemuMonitorMachineInfoPtr *machines = NULL; int nmachines = 0; @@ -2094,7 +2094,7 @@ qemuCapsProbeQMPMachineTypes(qemuCapsPtr caps, caps->nmachineTypes = nmachines; if (defIdx) - qemuSetDefaultMachine(caps, defIdx); + virQEMUCapsSetDefaultMachine(caps, defIdx); ret = 0; @@ -2107,8 +2107,8 @@ cleanup: static int -qemuCapsProbeQMPCPUDefinitions(qemuCapsPtr caps, - qemuMonitorPtr mon) +virQEMUCapsProbeQMPCPUDefinitions(virQEMUCapsPtr caps, + qemuMonitorPtr mon) { int ncpuDefinitions; char **cpuDefinitions; @@ -2124,13 +2124,13 @@ qemuCapsProbeQMPCPUDefinitions(qemuCapsPtr caps, static int -qemuCapsProbeQMPKVMState(qemuCapsPtr caps, - qemuMonitorPtr mon) +virQEMUCapsProbeQMPKVMState(virQEMUCapsPtr caps, + qemuMonitorPtr mon) { bool enabled = false; bool present = false; - if (!qemuCapsGet(caps, QEMU_CAPS_KVM)) + if (!virQEMUCapsGet(caps, 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(caps, QEMU_CAPS_KVM); } else if (!enabled) { - qemuCapsClear(caps, QEMU_CAPS_KVM); - qemuCapsSet(caps, QEMU_CAPS_ENABLE_KVM); + virQEMUCapsClear(caps, QEMU_CAPS_KVM); + virQEMUCapsSet(caps, QEMU_CAPS_ENABLE_KVM); } return 0; } -int qemuCapsProbeQMP(qemuCapsPtr caps, - qemuMonitorPtr mon) +int virQEMUCapsProbeQMP(virQEMUCapsPtr caps, + qemuMonitorPtr mon) { VIR_DEBUG("caps=%p mon=%p", caps, mon); if (caps->usedQMP) return 0; - if (qemuCapsProbeQMPCommands(caps, mon) < 0) + if (virQEMUCapsProbeQMPCommands(caps, mon) < 0) return -1; - if (qemuCapsProbeQMPEvents(caps, mon) < 0) + if (virQEMUCapsProbeQMPEvents(caps, mon) < 0) return -1; return 0; @@ -2176,14 +2176,14 @@ int qemuCapsProbeQMP(qemuCapsPtr caps, #define QEMU_SYSTEM_PREFIX "qemu-system-" static int -qemuCapsInitHelp(qemuCapsPtr caps, uid_t runUid, gid_t runGid) +virQEMUCapsInitHelp(virQEMUCapsPtr caps, 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); @@ -2191,21 +2191,21 @@ qemuCapsInitHelp(qemuCapsPtr caps, uid_t runUid, gid_t runGid) if (tmp) { tmp += strlen(QEMU_SYSTEM_PREFIX); - caps->arch = qemuCapsArchFromString(tmp); + caps->arch = virQEMUCapsArchFromString(tmp); } else { caps->arch = virArchFromHost(); } hookData.runUid = runUid; hookData.runGid = runGid; - cmd = qemuCapsProbeCommand(caps->binary, NULL, &hookData); + cmd = virQEMUCapsProbeCommand(caps->binary, NULL, &hookData); virCommandAddArgList(cmd, "-help", NULL); virCommandSetOutputBuffer(cmd, &help); if (virCommandRun(cmd, NULL) < 0) goto cleanup; - if (qemuCapsParseHelpStr(caps->binary, + if (virQEMUCapsParseHelpStr(caps->binary, help, caps, &caps->version, &is_kvm, @@ -2216,24 +2216,24 @@ qemuCapsInitHelp(qemuCapsPtr caps, uid_t runUid, gid_t runGid) /* 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); + virQEMUCapsSet(caps, 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(caps, 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(caps, QEMU_CAPS_DEVICE) && strstr(help, "-device driver,?") && - qemuCapsExtractDeviceStr(caps->binary, caps, &hookData) < 0) + virQEMUCapsExtractDeviceStr(caps->binary, caps, &hookData) < 0) goto cleanup; - if (qemuCapsProbeCPUModels(caps, &hookData) < 0) + if (virQEMUCapsProbeCPUModels(caps, &hookData) < 0) goto cleanup; - if (qemuCapsProbeMachineTypes(caps, &hookData) < 0) + if (virQEMUCapsProbeMachineTypes(caps, &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 caps) { - 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(caps, QEMU_CAPS_VNC_COLON); + virQEMUCapsSet(caps, QEMU_CAPS_NO_REBOOT); + virQEMUCapsSet(caps, QEMU_CAPS_DRIVE); + virQEMUCapsSet(caps, QEMU_CAPS_NAME); + virQEMUCapsSet(caps, QEMU_CAPS_UUID); + virQEMUCapsSet(caps, QEMU_CAPS_VNET_HDR); + virQEMUCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_TCP); + virQEMUCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_EXEC); + virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_V2); + virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_FORMAT); + virQEMUCapsSet(caps, QEMU_CAPS_VGA); + virQEMUCapsSet(caps, QEMU_CAPS_0_10); + virQEMUCapsSet(caps, QEMU_CAPS_MEM_PATH); + virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_SERIAL); + virQEMUCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_UNIX); + virQEMUCapsSet(caps, QEMU_CAPS_CHARDEV); + virQEMUCapsSet(caps, QEMU_CAPS_MONITOR_JSON); + virQEMUCapsSet(caps, QEMU_CAPS_BALLOON); + virQEMUCapsSet(caps, QEMU_CAPS_DEVICE); + virQEMUCapsSet(caps, QEMU_CAPS_SDL); + virQEMUCapsSet(caps, QEMU_CAPS_SMP_TOPOLOGY); + virQEMUCapsSet(caps, QEMU_CAPS_NETDEV); + virQEMUCapsSet(caps, QEMU_CAPS_RTC); + virQEMUCapsSet(caps, QEMU_CAPS_VHOST_NET); + virQEMUCapsSet(caps, QEMU_CAPS_NO_HPET); + virQEMUCapsSet(caps, QEMU_CAPS_NODEFCONFIG); + virQEMUCapsSet(caps, QEMU_CAPS_BOOT_MENU); + virQEMUCapsSet(caps, QEMU_CAPS_FSDEV); + virQEMUCapsSet(caps, QEMU_CAPS_NAME_PROCESS); + virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_READONLY); + virQEMUCapsSet(caps, QEMU_CAPS_SMBIOS_TYPE); + virQEMUCapsSet(caps, QEMU_CAPS_VGA_NONE); + virQEMUCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_FD); + virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_AIO); + virQEMUCapsSet(caps, QEMU_CAPS_CHARDEV_SPICEVMC); + virQEMUCapsSet(caps, QEMU_CAPS_DEVICE_QXL_VGA); + virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC); + virQEMUCapsSet(caps, QEMU_CAPS_NO_SHUTDOWN); + virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_UNSAFE); + virQEMUCapsSet(caps, QEMU_CAPS_FSDEV_READONLY); + virQEMUCapsSet(caps, QEMU_CAPS_VIRTIO_BLK_SG_IO); + virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_COPY_ON_READ); + virQEMUCapsSet(caps, QEMU_CAPS_CPU_HOST); + virQEMUCapsSet(caps, QEMU_CAPS_FSDEV_WRITEOUT); + virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_IOTUNE); + virQEMUCapsSet(caps, QEMU_CAPS_WAKEUP); + virQEMUCapsSet(caps, QEMU_CAPS_NO_USER_CONFIG); + virQEMUCapsSet(caps, QEMU_CAPS_NETDEV_BRIDGE); + virQEMUCapsSet(caps, QEMU_CAPS_SECCOMP_SANDBOX); } static int -qemuCapsInitQMP(qemuCapsPtr caps, - const char *libDir, - uid_t runUid, - gid_t runGid) +virQEMUCapsInitQMP(virQEMUCapsPtr caps, + 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; @@ -2385,7 +2385,7 @@ 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; @@ -2442,12 +2442,12 @@ qemuCapsInitQMP(qemuCapsPtr caps, caps->version = major * 1000000 + minor * 1000 + micro; caps->usedQMP = true; - qemuCapsInitQMPBasic(caps); + virQEMUCapsInitQMPBasic(caps); if (!(archstr = qemuMonitorGetTargetArch(mon))) goto cleanup; - if ((caps->arch = qemuCapsArchFromString(archstr)) == VIR_ARCH_NONE) { + if ((caps->arch = virQEMUCapsArchFromString(archstr)) == VIR_ARCH_NONE) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unknown QEMU arch %s"), archstr); VIR_FREE(archstr); @@ -2458,21 +2458,21 @@ qemuCapsInitQMP(qemuCapsPtr caps, /* 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); + virQEMUCapsSet(caps, QEMU_CAPS_PCI_MULTIBUS); + virQEMUCapsSet(caps, QEMU_CAPS_NO_ACPI); } - if (qemuCapsProbeQMPCommands(caps, mon) < 0) + if (virQEMUCapsProbeQMPCommands(caps, mon) < 0) goto cleanup; - if (qemuCapsProbeQMPEvents(caps, mon) < 0) + if (virQEMUCapsProbeQMPEvents(caps, mon) < 0) goto cleanup; - if (qemuCapsProbeQMPObjects(caps, mon) < 0) + if (virQEMUCapsProbeQMPObjects(caps, mon) < 0) goto cleanup; - if (qemuCapsProbeQMPMachineTypes(caps, mon) < 0) + if (virQEMUCapsProbeQMPMachineTypes(caps, mon) < 0) goto cleanup; - if (qemuCapsProbeQMPCPUDefinitions(caps, mon) < 0) + if (virQEMUCapsProbeQMPCPUDefinitions(caps, mon) < 0) goto cleanup; - if (qemuCapsProbeQMPKVMState(caps, mon) < 0) + if (virQEMUCapsProbeQMPKVMState(caps, mon) < 0) goto cleanup; ret = 0; @@ -2504,12 +2504,12 @@ 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 caps = virQEMUCapsNew(); struct stat sb; int rv; @@ -2535,11 +2535,11 @@ qemuCapsPtr qemuCapsNewForBinary(const char *binary, goto error; } - if ((rv = qemuCapsInitQMP(caps, libDir, runUid, runGid)) < 0) + if ((rv = virQEMUCapsInitQMP(caps, libDir, runUid, runGid)) < 0) goto error; if (!caps->usedQMP && - qemuCapsInitHelp(caps, runUid, runGid) < 0) + virQEMUCapsInitHelp(caps, runUid, runGid) < 0) goto error; return caps; @@ -2553,7 +2553,7 @@ error: } -bool qemuCapsIsValid(qemuCapsPtr caps) +bool virQEMUCapsIsValid(virQEMUCapsPtr caps) { struct stat sb; @@ -2568,18 +2568,18 @@ bool qemuCapsIsValid(qemuCapsPtr caps) 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, +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,7 +2627,7 @@ qemuCapsCacheLookup(qemuCapsCachePtr cache, const char *binary) if (!ret) { VIR_DEBUG("Creating capabilities for %s", binary); - ret = qemuCapsNewForBinary(binary, cache->libDir, + ret = virQEMUCapsNewForBinary(binary, cache->libDir, cache->runUid, cache->runGid); if (ret) { VIR_DEBUG("Caching capabilities %p for %s", @@ -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 caps = virQEMUCapsCacheLookup(cache, binary); + virQEMUCapsPtr ret; if (!caps) return NULL; - ret = qemuCapsNewCopy(caps); + ret = virQEMUCapsNewCopy(caps); virObjectUnref(caps); 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 caps) { return caps->usedQMP; } diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index cb0dad0..6020d0a 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 caps); +virQEMUCapsPtr virQEMUCapsNewForBinary(const char *binary, + const char *libDir, + uid_t runUid, + gid_t runGid); -int qemuCapsProbeQMP(qemuCapsPtr caps, - qemuMonitorPtr mon); +int virQEMUCapsProbeQMP(virQEMUCapsPtr caps, + qemuMonitorPtr mon); -void qemuCapsSet(qemuCapsPtr caps, - enum qemuCapsFlags flag) ATTRIBUTE_NONNULL(1); +void virQEMUCapsSet(virQEMUCapsPtr caps, + enum virQEMUCapsFlags flag) ATTRIBUTE_NONNULL(1); -void qemuCapsSetList(qemuCapsPtr caps, ...) ATTRIBUTE_NONNULL(1); +void virQEMUCapsSetList(virQEMUCapsPtr caps, ...) ATTRIBUTE_NONNULL(1); -void qemuCapsClear(qemuCapsPtr caps, - enum qemuCapsFlags flag) ATTRIBUTE_NONNULL(1); +void virQEMUCapsClear(virQEMUCapsPtr caps, + enum virQEMUCapsFlags flag) ATTRIBUTE_NONNULL(1); -bool qemuCapsGet(qemuCapsPtr caps, - enum qemuCapsFlags flag); +bool virQEMUCapsGet(virQEMUCapsPtr caps, + enum virQEMUCapsFlags flag); -char *qemuCapsFlagsString(qemuCapsPtr caps); +char *virQEMUCapsFlagsString(virQEMUCapsPtr caps); -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 caps); +virArch virQEMUCapsGetArch(virQEMUCapsPtr caps); +unsigned int virQEMUCapsGetVersion(virQEMUCapsPtr caps); +unsigned int virQEMUCapsGetKVMVersion(virQEMUCapsPtr caps); +int virQEMUCapsAddCPUDefinition(virQEMUCapsPtr caps, + const char *name); +size_t virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr caps, + char ***names); +size_t virQEMUCapsGetMachineTypes(virQEMUCapsPtr caps, + char ***names); +const char *virQEMUCapsGetCanonicalMachine(virQEMUCapsPtr caps, + const char *name); -int qemuCapsGetMachineTypesCaps(qemuCapsPtr caps, - size_t *nmachines, - virCapsGuestMachinePtr **machines); +int virQEMUCapsGetMachineTypesCaps(virQEMUCapsPtr caps, + size_t *nmachines, + virCapsGuestMachinePtr **machines); -bool qemuCapsIsValid(qemuCapsPtr caps); +bool virQEMUCapsIsValid(virQEMUCapsPtr caps); -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 caps, + 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 caps, const char *str); -VIR_ENUM_DECL(qemuCaps); +VIR_ENUM_DECL(virQEMUCaps); -bool qemuCapsUsedQMP(qemuCapsPtr caps); +bool virQEMUCapsUsedQMP(virQEMUCapsPtr caps); #endif /* __QEMU_CAPABILITIES_H__*/ diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index fbc5481..ad6c1d8 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; @@ -2232,7 +2232,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); @@ -2311,7 +2311,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", @@ -2397,24 +2397,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) { @@ -2428,13 +2428,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", @@ -2443,7 +2443,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)); @@ -2462,7 +2462,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); @@ -2471,17 +2471,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")); @@ -2497,7 +2497,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 { @@ -2507,7 +2507,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) @@ -2533,7 +2533,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 { @@ -2551,7 +2551,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")); @@ -2604,7 +2604,7 @@ char * qemuBuildDriveDevStr(virDomainDefPtr def, virDomainDiskDefPtr disk, int bootindex, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { virBuffer opt = VIR_BUFFER_INITIALIZER; const char *bus = virDomainDiskQEMUBusTypeToString(disk->bus); @@ -2650,7 +2650,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; @@ -2677,14 +2677,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 @@ -2699,7 +2699,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")); @@ -2708,7 +2708,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")); @@ -2719,7 +2719,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")); @@ -2729,7 +2729,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) { @@ -2743,7 +2743,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 @@ -2758,7 +2758,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 " @@ -2776,7 +2776,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 @@ -2807,7 +2807,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 @@ -2827,13 +2827,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. */ @@ -2841,13 +2841,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: @@ -2857,9 +2857,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); @@ -2891,7 +2891,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); @@ -2930,7 +2930,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", @@ -2943,7 +2943,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", @@ -2968,7 +2968,7 @@ error: char * qemuBuildFSDevStr(virDomainFSDefPtr fs, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { virBuffer opt = VIR_BUFFER_INITIALIZER; @@ -2983,7 +2983,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)) { @@ -3029,7 +3029,7 @@ qemuControllerModelUSBToCaps(int model) static int qemuBuildUSBControllerDevStr(virDomainDefPtr domainDef, virDomainControllerDefPtr def, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, virBuffer *buf) { const char *smodel; @@ -3047,7 +3047,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; @@ -3070,7 +3070,7 @@ qemuBuildUSBControllerDevStr(virDomainDefPtr domainDef, char * qemuBuildControllerDevStr(virDomainDefPtr domainDef, virDomainControllerDefPtr def, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, int *nusbcontroller) { virBuffer buf = VIR_BUFFER_INITIALIZER; @@ -3079,7 +3079,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) { @@ -3130,7 +3130,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) @@ -3147,7 +3147,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)) { @@ -3192,7 +3192,7 @@ char * qemuBuildNicDevStr(virDomainNetDefPtr net, int vlan, int bootindex, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { virBuffer buf = VIR_BUFFER_INITIALIZER; const char *nic; @@ -3214,7 +3214,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: @@ -3239,9 +3239,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)); } @@ -3255,11 +3255,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)) { @@ -3278,7 +3278,7 @@ error: char * qemuBuildHostNetStr(virDomainNetDefPtr net, virQEMUDriverPtr driver, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, char type_sep, int vlan, const char *tapfd, @@ -3306,7 +3306,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 = ','; @@ -3395,7 +3395,7 @@ qemuBuildHostNetStr(virDomainNetDefPtr net, char * qemuBuildWatchdogDevStr(virDomainWatchdogDefPtr dev, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { virBuffer buf = VIR_BUFFER_INITIALIZER; @@ -3407,7 +3407,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)) { @@ -3425,13 +3425,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)) { @@ -3449,7 +3449,7 @@ error: char * qemuBuildUSBInputDevStr(virDomainInputDefPtr dev, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { virBuffer buf = VIR_BUFFER_INITIALIZER; @@ -3457,7 +3457,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)) { @@ -3475,7 +3475,7 @@ error: char * qemuBuildSoundDevStr(virDomainSoundDefPtr sound, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { virBuffer buf = VIR_BUFFER_INITIALIZER; const char *model = virDomainSoundModelTypeToString(sound->model); @@ -3495,7 +3495,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)) { @@ -3528,7 +3528,7 @@ qemuSoundCodecTypeToCaps(int type) static char * qemuBuildSoundCodecStr(virDomainSoundDefPtr sound, virDomainSoundCodecDefPtr codec, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { virBuffer buf = VIR_BUFFER_INITIALIZER; const char *stype; @@ -3538,7 +3538,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; @@ -3556,7 +3556,7 @@ error: static char * qemuBuildDeviceVideoStr(virDomainVideoDefPtr video, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, bool primary) { virBuffer buf = VIR_BUFFER_INITIALIZER; @@ -3577,7 +3577,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; @@ -3609,7 +3609,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)) { @@ -3652,7 +3652,7 @@ qemuOpenPCIConfig(virDomainHostdevDefPtr dev) char * qemuBuildPCIHostdevDevStr(virDomainHostdevDefPtr dev, const char *configfd, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { virBuffer buf = VIR_BUFFER_INITIALIZER; @@ -3666,9 +3666,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)) { @@ -3702,7 +3702,7 @@ qemuBuildPCIHostdevPCIDevStr(virDomainHostdevDefPtr dev) char * qemuBuildRedirdevDevStr(virDomainDefPtr def, virDomainRedirdevDefPtr dev, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { size_t i; virBuffer buf = VIR_BUFFER_INITIALIZER; @@ -3715,7 +3715,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")); @@ -3727,7 +3727,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")); @@ -3765,7 +3765,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")); @@ -3774,7 +3774,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)) { @@ -3791,7 +3791,7 @@ error: char * qemuBuildUSBHostdevDevStr(virDomainHostdevDefPtr dev, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { virBuffer buf = VIR_BUFFER_INITIALIZER; @@ -3813,7 +3813,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)) { @@ -3831,7 +3831,7 @@ error: char * qemuBuildHubDevStr(virDomainHubDefPtr dev, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { virBuffer buf = VIR_BUFFER_INITIALIZER; @@ -3842,7 +3842,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; @@ -3850,7 +3850,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)) { @@ -3898,7 +3898,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; @@ -3977,7 +3977,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; @@ -4098,7 +4098,7 @@ error: static char * qemuBuildVirtioSerialPortDevStr(virDomainChrDefPtr dev, - qemuCapsPtr caps) + virQEMUCapsPtr qemuCaps) { virBuffer buf = VIR_BUFFER_INITIALIZER; switch (dev->deviceType) { @@ -4108,7 +4108,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"); @@ -4151,7 +4151,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) { @@ -4389,7 +4389,7 @@ static int qemuBuildCpuArgStr(const virQEMUDriverPtr driver, const virDomainDefPtr def, const char *emulator, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, virArch hostarch, char **opt, bool *hasHwVirt, @@ -4423,7 +4423,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; @@ -4466,7 +4466,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); @@ -4605,7 +4605,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 @@ -4620,7 +4620,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")); @@ -4642,13 +4642,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 @@ -4718,7 +4718,7 @@ static int qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr cfg, virCommandPtr cmd, virDomainDefPtr def, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, virDomainGraphicsDefPtr graphics) { int i; @@ -4726,7 +4726,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; @@ -4744,7 +4744,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; @@ -4799,7 +4799,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"); @@ -4843,8 +4843,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); @@ -4870,7 +4870,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) { @@ -4883,7 +4883,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; @@ -5015,7 +5015,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 @@ -5061,7 +5061,7 @@ qemuBuildCommandLine(virConnectPtr conn, virDomainDefPtr def, virDomainChrSourceDefPtr monitor_chr, bool monitor_json, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, const char *migrateFrom, int migrateFd, virDomainSnapshotObjPtr snapshot, @@ -5099,10 +5099,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); @@ -5112,25 +5112,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); @@ -5139,12 +5139,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); @@ -5167,10 +5167,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 { @@ -5179,10 +5179,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; @@ -5190,7 +5190,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"); } @@ -5228,7 +5228,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); @@ -5239,7 +5239,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); @@ -5248,15 +5248,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); @@ -5273,7 +5273,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); @@ -5326,23 +5326,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; @@ -5358,11 +5358,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); @@ -5384,7 +5384,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))) @@ -5432,7 +5432,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: @@ -5448,7 +5448,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)) { @@ -5467,13 +5467,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 { @@ -5502,7 +5502,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 { @@ -5517,7 +5517,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"); @@ -5525,16 +5525,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; @@ -5545,7 +5545,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; @@ -5567,15 +5567,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; } @@ -5608,7 +5608,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, ','); @@ -5625,7 +5625,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")); @@ -5674,7 +5674,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]; @@ -5691,7 +5691,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")); @@ -5701,7 +5701,7 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, "-device"); if (!(devstr = qemuBuildControllerDevStr(def, cont, - caps, NULL))) + qemuCaps, NULL))) goto error; virCommandAddArg(cmd, devstr); @@ -5709,7 +5709,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 " @@ -5721,7 +5721,7 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, "-device"); char *devstr; - if (!(devstr = qemuBuildControllerDevStr(def, cont, caps, + if (!(devstr = qemuBuildControllerDevStr(def, cont, qemuCaps, &usbcontroller))) goto error; @@ -5740,17 +5740,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++) { @@ -5778,7 +5778,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); @@ -5814,19 +5814,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); @@ -5856,7 +5856,7 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, "-device"); if (!(optstr = qemuBuildDriveDevStr(def, disk, bootindex, - caps))) + qemuCaps))) goto error; virCommandAddArg(cmd, optstr); VIR_FREE(optstr); @@ -5999,19 +5999,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); @@ -6026,7 +6026,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; @@ -6057,8 +6057,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; @@ -6119,9 +6119,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; @@ -6134,7 +6134,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; @@ -6153,7 +6153,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); @@ -6171,19 +6171,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); @@ -6195,10 +6195,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; @@ -6229,8 +6229,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")); @@ -6241,8 +6241,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")); @@ -6277,8 +6277,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")); @@ -6288,7 +6288,7 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, "-chardev"); if (!(devstr = qemuBuildChrChardevStr(&smartcard->data.passthru, smartcard->info.alias, - caps))) { + qemuCaps))) { virBufferFreeAndReset(&opt); goto error; } @@ -6313,7 +6313,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++) { @@ -6321,18 +6321,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; @@ -6350,7 +6350,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++) { @@ -6358,12 +6358,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); @@ -6390,8 +6390,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; @@ -6400,7 +6400,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); @@ -6419,13 +6419,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 @@ -6435,7 +6435,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); @@ -6443,7 +6443,7 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, "-device"); if (!(devstr = qemuBuildVirtioSerialPortDevStr(channel, - caps))) + qemuCaps))) goto error; virCommandAddArg(cmd, devstr); VIR_FREE(devstr); @@ -6459,12 +6459,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; @@ -6473,7 +6473,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); @@ -6486,7 +6486,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; @@ -6495,14 +6495,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); @@ -6523,10 +6523,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); @@ -6551,7 +6551,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; @@ -6564,37 +6564,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; @@ -6612,8 +6612,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; @@ -6645,7 +6645,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) { @@ -6657,7 +6657,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); @@ -6701,15 +6701,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; @@ -6721,7 +6721,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); @@ -6732,7 +6732,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; } @@ -6745,7 +6745,7 @@ qemuBuildCommandLine(virConnectPtr conn, 0 }; virCommandAddArg(cmd, "-device"); - if (!(codecstr = qemuBuildSoundCodecStr(sound, &codec, caps))) { + if (!(codecstr = qemuBuildSoundCodecStr(sound, &codec, qemuCaps))) { goto error; } @@ -6795,10 +6795,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 { @@ -6837,18 +6837,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); @@ -6870,14 +6870,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")); @@ -6890,9 +6890,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); @@ -6908,9 +6908,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) { @@ -6923,13 +6923,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; @@ -6949,7 +6949,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")); @@ -6957,13 +6957,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 { @@ -6973,7 +6973,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")); @@ -6981,7 +6981,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")); @@ -6990,7 +6990,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")); @@ -7010,7 +7010,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 && @@ -7021,16 +7021,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); } } @@ -7050,7 +7050,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) @@ -7080,7 +7080,7 @@ qemuBuildCommandLine(virConnectPtr conn, */ char * qemuBuildChrDeviceStr(virDomainChrDefPtr serial, - qemuCapsPtr caps, + virQEMUCapsPtr qemuCaps, virArch arch, char *machine) { @@ -7091,7 +7091,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 { @@ -7100,7 +7100,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; @@ -7113,7 +7113,7 @@ qemuBuildChrDeviceStr(virDomainChrDefPtr serial, goto error; } - if (qemuBuildDeviceAddressStr(&cmd, &serial->info, caps) < 0) + if (qemuBuildDeviceAddressStr(&cmd, &serial->info, qemuCaps) < 0) goto error; } } @@ -7378,7 +7378,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) @@ -7714,7 +7714,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); @@ -7775,7 +7775,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) @@ -7909,7 +7909,7 @@ qemuParseCommandLineNet(virCapsPtr caps, } if (genmac) - virCapabilitiesGenerateMac(caps, &def->mac); + virCapabilitiesGenerateMac(qemuCaps, &def->mac); cleanup: for (i = 0 ; i < nkeywords ; i++) { @@ -8472,7 +8472,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, @@ -8551,7 +8551,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-")); @@ -8793,7 +8793,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); @@ -9005,7 +9005,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); @@ -9015,7 +9015,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) @@ -9262,7 +9262,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)); @@ -9335,7 +9335,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 @@ -9360,7 +9360,7 @@ error: } -virDomainDefPtr qemuParseCommandLineString(virCapsPtr caps, +virDomainDefPtr qemuParseCommandLineString(virCapsPtr qemuCaps, const char *args, char **pidfile, virDomainChrSourceDefPtr *monConfig, @@ -9374,7 +9374,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: @@ -9449,7 +9449,7 @@ cleanup: return ret; } -virDomainDefPtr qemuParseCommandLinePid(virCapsPtr caps, +virDomainDefPtr qemuParseCommandLinePid(virCapsPtr qemuCaps, pid_t pid, char **pidfile, virDomainChrSourceDefPtr *monConfig, @@ -9469,7 +9469,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 e15830a..7e52c5d 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 8fada4e..14680b1 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 5bf0ab0..5410ef0 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, " </vcpus>\n"); } - if (priv->caps) { + if (priv->qemuCaps) { int i; virBufferAddLit(buf, " <qemuCaps>\n"); for (i = 0 ; i < QEMU_CAPS_LAST ; i++) { - if (qemuCapsGet(priv->caps, i)) { + if (virQEMUCapsGet(priv->qemuCaps, i)) { virBufferAsprintf(buf, " <flag name='%s'/>\n", - qemuCapsTypeToString(i)); + virQEMUCapsTypeToString(i)); } } virBufferAddLit(buf, " </qemuCaps>\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 68cf295..51cd2dc 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 d1d1ccf..18c4d3c 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) @@ -3207,7 +3207,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; @@ -5219,7 +5219,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 */ @@ -5308,7 +5308,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; @@ -5331,7 +5331,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 @@ -5406,16 +5406,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; @@ -5424,7 +5424,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn, cleanup: qemuDriverUnlock(driver); - virObjectUnref(caps); + virObjectUnref(qemuCaps); virCommandFree(cmd); virDomainDefFree(def); virObjectUnref(cfg); @@ -5593,7 +5593,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); @@ -5606,13 +5606,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, @@ -5668,7 +5668,7 @@ cleanup: virObjectUnlock(vm); if (event) qemuDomainEventQueue(driver, event); - virObjectUnref(caps); + virObjectUnref(qemuCaps); qemuDriverUnlock(driver); virObjectUnref(cfg); return dom; @@ -6122,7 +6122,7 @@ qemuDomainUpdateDeviceLive(virDomainObjPtr vm, } static int -qemuDomainAttachDeviceConfig(qemuCapsPtr caps, +qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps, virDomainDefPtr vmdef, virDomainDeviceDefPtr dev) { @@ -6149,7 +6149,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; @@ -6160,7 +6160,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; @@ -6176,7 +6176,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; @@ -6208,7 +6208,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; @@ -6306,7 +6306,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, } static int -qemuDomainUpdateDeviceConfig(qemuCapsPtr caps, +qemuDomainUpdateDeviceConfig(virQEMUCapsPtr qemuCaps, virDomainDefPtr vmdef, virDomainDeviceDefPtr dev) { @@ -6372,7 +6372,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; @@ -6403,7 +6403,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; @@ -6467,9 +6467,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) { @@ -6482,13 +6482,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, @@ -6548,7 +6548,7 @@ endjob: vm = NULL; cleanup: - virObjectUnref(caps); + virObjectUnref(qemuCaps); virDomainDefFree(vmdef); if (dev != dev_copy) virDomainDeviceDefFree(dev_copy); @@ -10736,7 +10736,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; @@ -10852,7 +10852,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", @@ -11038,12 +11038,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")); @@ -11115,7 +11115,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; @@ -11141,7 +11141,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; @@ -12579,7 +12579,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); @@ -12609,13 +12609,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, @@ -12650,7 +12650,7 @@ endjob: cleanup: virDomainDefFree(def); - virObjectUnref(caps); + virObjectUnref(qemuCaps); virDomainChrSourceDefFree(monConfig); if (vm) virObjectUnlock(vm); @@ -13037,9 +13037,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; @@ -13254,8 +13254,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; @@ -13452,7 +13452,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; @@ -13687,7 +13687,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")); @@ -14491,7 +14491,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", @@ -14578,7 +14578,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 98912bf..4504f0b 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 a75fb4e..82d2699 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 30f923a..e632615 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 caps, virHashTablePtr paths) { - bool chardevfmt = qemuCapsGet(caps, QEMU_CAPS_CHARDEV); + bool chardevfmt = virQEMUCapsGet(caps, 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 caps, 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(caps) && pos != -1) { if ((logfd = qemuDomainOpenLog(driver, vm, pos)) < 0) return -1; @@ -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(caps)) { 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 68efd9c..f5b37d5 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, + 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 c0c720e..dd7262c 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -78,7 +78,7 @@ typedef enum { static int testCompareXMLToArgvFiles(const char *xml, const char *cmdline, - qemuCapsPtr extraFlags, + virQEMUCapsPtr extraFlags, const char *migrateFrom, int migrateFd, virQemuXML2ArgvTestFlags flags) @@ -105,7 +105,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; @@ -115,11 +115,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")) { @@ -128,7 +128,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; @@ -142,7 +142,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) @@ -204,7 +204,7 @@ out: struct testInfo { const char *name; - qemuCapsPtr extraFlags; + virQEMUCapsPtr extraFlags; const char *migrateFrom; int migrateFd; unsigned int flags; @@ -225,7 +225,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, @@ -240,7 +240,7 @@ cleanup: static int -testAddCPUModels(qemuCapsPtr caps, bool skipLegacy) +testAddCPUModels(virQEMUCapsPtr caps, bool skipLegacy) { const char *newModels[] = { "Opteron_G3", "Opteron_G2", "Opteron_G1", @@ -254,13 +254,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; @@ -307,11 +307,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 de80a0f..6dae3f4 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; \ -- 1.8.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list