这篇教程C++ virCapabilitiesAddGuest函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中virCapabilitiesAddGuest函数的典型用法代码示例。如果您正苦于以下问题:C++ virCapabilitiesAddGuest函数的具体用法?C++ virCapabilitiesAddGuest怎么用?C++ virCapabilitiesAddGuest使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了virCapabilitiesAddGuest函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: testCapsInitstatic voidtestCapsInit(void){ virCapsGuestPtr guest = NULL; caps = virCapabilitiesNew(VIR_ARCH_I686, 1, 1); if (caps == NULL) { return; } virCapabilitiesAddHostMigrateTransport(caps, "esx"); /* i686 guest */ guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_I686, NULL, NULL, 0, NULL); if (guest == NULL) { goto failure; } if (virCapabilitiesAddGuestDomain(guest, "vmware", NULL, NULL, 0, NULL) == NULL) { goto failure; } /* x86_64 guest */ guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_X86_64, NULL, NULL, 0, NULL); if (guest == NULL) { goto failure; } if (virCapabilitiesAddGuestDomain(guest, "vmware", NULL, NULL, 0, NULL) == NULL) { goto failure; } return; failure: virObjectUnref(caps); virObjectUnref(xmlopt); caps = NULL;}
开发者ID:kawamuray,项目名称:libvirt,代码行数:51,
示例2: testQemuAddArmGueststatic int testQemuAddArmGuest(virCapsPtr caps){ static const char *machines[] = { "vexpress-a9", "vexpress-a15", "versatilepb" }; virCapsGuestMachinePtr *capsmachines = NULL; virCapsGuestPtr guest; capsmachines = virCapabilitiesAllocMachines(machines, ARRAY_CARDINALITY(machines)); if (!capsmachines) goto error; guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_ARMV7L, "/usr/bin/qemu-system-arm", NULL, ARRAY_CARDINALITY(machines), capsmachines); if (!guest) goto error; if (!virCapabilitiesAddGuestDomain(guest, "qemu", NULL, NULL, 0, NULL)) goto error; return 0; error: virCapabilitiesFreeMachines(capsmachines, ARRAY_CARDINALITY(machines)); return -1;}
开发者ID:ryanmiao,项目名称:libvirt,代码行数:29,
示例3: testQemuAddPPC64LEGueststatic int testQemuAddPPC64LEGuest(virCapsPtr caps){ static const char *machine[] = { "pseries" }; virCapsGuestMachinePtr *machines = NULL; virCapsGuestPtr guest; machines = virCapabilitiesAllocMachines(machine, 1); if (!machines) goto error; guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_PPC64LE, QEMUBinList[TEST_UTILS_QEMU_BIN_PPC64], NULL, 1, machines); if (!guest) goto error; if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL)) goto error; return 0; error: /* No way to free a guest? */ virCapabilitiesFreeMachines(machines, 1); return -1;}
开发者ID:aruiz,项目名称:libvirt,代码行数:26,
示例4: openvzCapsInitvirCapsPtr openvzCapsInit(void){ virCapsPtr caps; virCapsGuestPtr guest; if ((caps = virCapabilitiesNew(virArchFromHost(), false, false)) == NULL) goto no_memory; if (nodeCapsInitNUMA(NULL, caps) < 0) goto no_memory; if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_EXE, caps->host.arch, NULL, NULL, 0, NULL)) == NULL) goto no_memory; if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_OPENVZ, NULL, NULL, 0, NULL) == NULL) goto no_memory; return caps; no_memory: virObjectUnref(caps); return NULL;}
开发者ID:noxdafox,项目名称:libvirt,代码行数:35,
示例5: testQemuAddPPC64Gueststatic int testQemuAddPPC64Guest(virCapsPtr caps){ static const char *machine[] = { "pseries" }; virCapsGuestMachinePtr *machines = NULL; virCapsGuestPtr guest; machines = virCapabilitiesAllocMachines(machine, 1); if (!machines) goto error; guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_PPC64, "/usr/bin/qemu-system-ppc64", NULL, 1, machines); if (!guest) goto error; if (!virCapabilitiesAddGuestDomain(guest, "qemu", NULL, NULL, 0, NULL)) goto error; return 0;error: /* No way to free a guest? */ virCapabilitiesFreeMachines(machines, 1); return -1;}
开发者ID:djs55,项目名称:libvirt,代码行数:26,
示例6: openvzCapsInitvirCapsPtr openvzCapsInit(void){ virCapsPtr caps; virCapsGuestPtr guest; if ((caps = virCapabilitiesNew(virArchFromHost(), false, false)) == NULL) goto no_memory; if (nodeCapsInitNUMA(caps) < 0) goto no_memory; if ((guest = virCapabilitiesAddGuest(caps, "exe", caps->host.arch, NULL, NULL, 0, NULL)) == NULL) goto no_memory; if (virCapabilitiesAddGuestDomain(guest, "openvz", NULL, NULL, 0, NULL) == NULL) goto no_memory; return caps; no_memory: virObjectUnref(caps); return NULL;}
开发者ID:6WIND,项目名称:libvirt,代码行数:35,
示例7: testQemuAddPPCGueststatic int testQemuAddPPCGuest(virCapsPtr caps){ static const char *machine[] = { "g3beige", "mac99", "prep", "ppce500" }; virCapsGuestMachinePtr *machines = NULL; virCapsGuestPtr guest; machines = virCapabilitiesAllocMachines(machine, 1); if (!machines) goto error; guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_PPC, "/usr/bin/qemu-system-ppc", NULL, 1, machines); if (!guest) goto error; if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL)) goto error; return 0; error: /* No way to free a guest? */ virCapabilitiesFreeMachines(machines, 1); return -1;}
开发者ID:feli5,项目名称:libvirt,代码行数:29,
示例8: virBhyveCapsBuildvirCapsPtrvirBhyveCapsBuild(void){ virCapsPtr caps; virCapsGuestPtr guest; if ((caps = virCapabilitiesNew(virArchFromHost(), false, false)) == NULL) return NULL; if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_X86_64, "bhyve", NULL, 0, NULL)) == NULL) goto error; if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_BHYVE, NULL, NULL, 0, NULL) == NULL) goto error; if (virBhyveCapsInitCPU(caps, virArchFromHost()) < 0) VIR_WARN("Failed to get host CPU: %s", virGetLastErrorMessage()); return caps; error: virObjectUnref(caps); return NULL;}
开发者ID:JGulic,项目名称:libvirt,代码行数:29,
示例9: testQemuAddS390Gueststatic int testQemuAddS390Guest(virCapsPtr caps){ static const char *s390_machines[] = { "s390-virtio", "s390-ccw-virtio" }; virCapsGuestMachinePtr *machines = NULL; virCapsGuestPtr guest; machines = virCapabilitiesAllocMachines(s390_machines, ARRAY_CARDINALITY(s390_machines)); if (!machines) goto error; guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_S390X, "/usr/bin/qemu-system-s390x", NULL, ARRAY_CARDINALITY(s390_machines), machines); if (!guest) goto error; if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL)) goto error; return 0; error: virCapabilitiesFreeMachines(machines, ARRAY_CARDINALITY(s390_machines)); return -1;}
开发者ID:feli5,项目名称:libvirt,代码行数:28,
示例10: testQemuAddAARCH64Gueststatic int testQemuAddAARCH64Guest(virCapsPtr caps){ static const char *machines[] = { "virt"}; virCapsGuestMachinePtr *capsmachines = NULL; virCapsGuestPtr guest; capsmachines = virCapabilitiesAllocMachines(machines, ARRAY_CARDINALITY(machines)); if (!capsmachines) goto error; guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_AARCH64, "/usr/bin/qemu-system-aarch64", NULL, ARRAY_CARDINALITY(machines), capsmachines); if (!guest) goto error; if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL)) goto error; return 0; error: virCapabilitiesFreeMachines(capsmachines, ARRAY_CARDINALITY(machines)); return -1;}
开发者ID:feli5,项目名称:libvirt,代码行数:27,
示例11: testQemuAddArmGueststatic int testQemuAddArmGuest(virCapsPtr caps){ static const char *machines[] = { "vexpress-a9", "vexpress-a15", "versatilepb" }; virCapsGuestMachinePtr *capsmachines = NULL; virCapsGuestPtr guest; capsmachines = virCapabilitiesAllocMachines(machines, ARRAY_CARDINALITY(machines)); if (!capsmachines) goto error; guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_ARMV7L, QEMUBinList[TEST_UTILS_QEMU_BIN_ARM], NULL, ARRAY_CARDINALITY(machines), capsmachines); if (!guest) goto error; if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL)) goto error; return 0; error: virCapabilitiesFreeMachines(capsmachines, ARRAY_CARDINALITY(machines)); return -1;}
开发者ID:aruiz,项目名称:libvirt,代码行数:30,
示例12: testQemuAddX86_64Gueststatic inttestQemuAddX86_64Guest(virCapsPtr caps){ int nmachines = 0; virCapsGuestMachinePtr *machines = NULL; virCapsGuestPtr guest; if (!(machines = testQemuAllocNewerMachines(&nmachines))) goto error; if (!(guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_X86_64, QEMUBinList[TEST_UTILS_QEMU_BIN_X86_64], NULL, nmachines, machines))) goto error; if (!virCapabilitiesAddGuestFeature(guest, "cpuselection", true, false)) goto error; machines = NULL; if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL)) goto error; if (!(machines = testQemuAllocMachines(&nmachines))) goto error; if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, QEMUBinList[TEST_UTILS_QEMU_BIN_X86_64], NULL, nmachines, machines)) goto error; machines = NULL; if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, QEMUBinList[TEST_UTILS_QEMU_BIN_X86_64], NULL, 0, NULL)) goto error; return 0; error: virCapabilitiesFreeMachines(machines, nmachines); return -1;}
开发者ID:aruiz,项目名称:libvirt,代码行数:59,
示例13: testCapsInitstatic voidtestCapsInit(void){ virCapsGuestPtr guest = NULL; caps = virCapabilitiesNew(VIR_ARCH_I686, true, true); if (caps == NULL) return; virCapabilitiesAddHostMigrateTransport(caps, "esx"); /* i686 guest */ guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_I686, NULL, NULL, 0, NULL); if (guest == NULL) goto failure; if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_VMWARE, NULL, NULL, 0, NULL) == NULL) { goto failure; } /* x86_64 guest */ guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_X86_64, NULL, NULL, 0, NULL); if (guest == NULL) goto failure; if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_VMWARE, NULL, NULL, 0, NULL) == NULL) { goto failure; } return; failure: virObjectUnref(caps); caps = NULL;}
开发者ID:carriercomm,项目名称:libvirt,代码行数:46,
示例14: umlCapsInitvirCapsPtr umlCapsInit(void) { struct utsname utsname; virCapsPtr caps; virCapsGuestPtr guest; /* Really, this never fails - look at the man-page. */ uname (&utsname); if ((caps = virCapabilitiesNew(utsname.machine, 0, 0)) == NULL) goto error; /* Some machines have problematic NUMA toplogy causing * unexpected failures. We don't want to break the QEMU * driver in this scenario, so log errors & carry on */ if (nodeCapsInitNUMA(caps) < 0) { virCapabilitiesFreeNUMAInfo(caps); VIR_WARN("Failed to query host NUMA topology, disabling NUMA capabilities"); } if (virGetHostUUID(caps->host.host_uuid)) { umlReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("cannot get the host uuid")); goto error; } if ((guest = virCapabilitiesAddGuest(caps, "uml", utsname.machine, STREQ(utsname.machine, "x86_64") ? 64 : 32, NULL, NULL, 0, NULL)) == NULL) goto error; if (virCapabilitiesAddGuestDomain(guest, "uml", NULL, NULL, 0, NULL) == NULL) goto error; caps->defaultConsoleTargetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_UML; return caps; error: virCapabilitiesFree(caps); return NULL;}
开发者ID:hw-claudio,项目名称:libvirt,代码行数:53,
示例15: umlCapsInitvirCapsPtr umlCapsInit(void){ virCapsPtr caps; virCapsGuestPtr guest; if ((caps = virCapabilitiesNew(virArchFromHost(), false, false)) == NULL) goto error; /* Some machines have problematic NUMA toplogy causing * unexpected failures. We don't want to break the QEMU * driver in this scenario, so log errors & carry on */ if (virCapabilitiesInitNUMA(caps) < 0) { virCapabilitiesFreeNUMAInfo(caps); VIR_WARN("Failed to query host NUMA topology, disabling NUMA capabilities"); } if (virCapabilitiesInitCaches(caps) < 0) VIR_WARN("Failed to get host CPU cache info"); if (virNodeSuspendGetTargetMask(&caps->host.powerMgmt) < 0) VIR_WARN("Failed to get host power management capabilities"); if (virGetHostUUID(caps->host.host_uuid)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("cannot get the host uuid")); goto error; } if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_UML, caps->host.arch, NULL, NULL, 0, NULL)) == NULL) goto error; if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_UML, NULL, NULL, 0, NULL) == NULL) goto error; return caps; error: virObjectUnref(caps); return NULL;}
开发者ID:Antique,项目名称:libvirt,代码行数:53,
示例16: vzCapsAddGuestDomainstatic intvzCapsAddGuestDomain(virCapsPtr caps, virDomainOSType ostype, virArch arch, const char * emulator, virDomainVirtType virt_type){ virCapsGuestPtr guest; if ((guest = virCapabilitiesAddGuest(caps, ostype, arch, emulator, NULL, 0, NULL)) == NULL) return -1; if (virCapabilitiesAddGuestDomain(guest, virt_type, NULL, NULL, 0, NULL) == NULL) return -1; return 0;}
开发者ID:cloehle,项目名称:libvirt,代码行数:20,
示例17: lxctoolsCapabilitiesInitvirCapsPtr lxctoolsCapabilitiesInit(void){ virCapsPtr caps; virCapsGuestPtr guest; if ((caps = virCapabilitiesNew(virArchFromHost(), true, true)) == NULL) goto no_memory; if (virCapabilitiesInitNUMA(caps) < 0) goto no_memory; if (virCapabilitiesAddHostMigrateTransport(caps, "tcp") < 0) goto no_memory; if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_EXE, caps->host.arch, NULL, NULL, 0, NULL)) == NULL) goto no_memory; if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_LXCTOOLS, NULL, NULL, 0, NULL) == NULL) goto no_memory; return caps; no_memory: virObjectUnref(caps); return NULL;}
开发者ID:RWTH-OS,项目名称:libvirt,代码行数:40,
示例18: libxlCapsInitGuests//.........这里部分代码省略......... guest_archs[i].hvm == hvm) break; } /* Too many arch flavours - highly unlikely ! */ if (i >= ARRAY_CARDINALITY(guest_archs)) continue; /* Didn't find a match, so create a new one */ if (i == nr_guest_archs) nr_guest_archs++; guest_archs[i].arch = arch; guest_archs[i].hvm = hvm; /* Careful not to overwrite a previous positive setting with a negative one here - some archs can do both pae & non-pae, but Xen reports separately capabilities so we're merging archs */ if (pae) guest_archs[i].pae = pae; if (nonpae) guest_archs[i].nonpae = nonpae; if (ia64_be) guest_archs[i].ia64_be = ia64_be; } } regfree(®ex); for (i = 0; i < nr_guest_archs; ++i) { virCapsGuestPtr guest; char const *const xen_machines[] = {guest_archs[i].hvm ? "xenfv" : "xenpv"}; virCapsGuestMachinePtr *machines; if ((machines = virCapabilitiesAllocMachines(xen_machines, 1)) == NULL) return -1; if ((guest = virCapabilitiesAddGuest(caps, guest_archs[i].hvm ? "hvm" : "xen", guest_archs[i].arch, "qemu-dm", (guest_archs[i].hvm ? "hvmloader" : NULL), 1, machines)) == NULL) { virCapabilitiesFreeMachines(machines, 1); return -1; } machines = NULL; if (virCapabilitiesAddGuestDomain(guest, "xen", NULL, NULL, 0, NULL) == NULL) return -1; if (guest_archs[i].pae && virCapabilitiesAddGuestFeature(guest, "pae", 1, 0) == NULL) return -1; if (guest_archs[i].nonpae && virCapabilitiesAddGuestFeature(guest, "nonpae", 1, 0) == NULL) return -1; if (guest_archs[i].ia64_be && virCapabilitiesAddGuestFeature(guest, "ia64_be", 1, 0) == NULL) return -1; if (guest_archs[i].hvm) { if (virCapabilitiesAddGuestFeature(guest, "acpi", 1, 1) == NULL) return -1; if (virCapabilitiesAddGuestFeature(guest, "apic", 1, 0) == NULL) return -1; if (virCapabilitiesAddGuestFeature(guest, "hap", 0, 1) == NULL) return -1; } } return 0;}
开发者ID:dmitryilyin,项目名称:libvirt,代码行数:101,
示例19: qemuCapsInitGuest//.........这里部分代码省略......... virCapsGuestMachinePtr machine; if (VIR_ALLOC(machine) < 0) { goto no_memory; } if (!(machine->name = strdup(info->machine))) { VIR_FREE(machine); goto no_memory; } nmachines = 1; if (VIR_ALLOC_N(machines, nmachines) < 0) { VIR_FREE(machine->name); VIR_FREE(machine); goto no_memory; } machines[0] = machine; } else { int probe = 1; if (old_caps && binary_mtime) probe = !qemuCapsGetOldMachines(hvm ? "hvm" : "xen", info->arch, info->wordsize, binary, binary_mtime, old_caps, &machines, &nmachines); if (probe && qemuCapsProbeMachineTypes(binary, &machines, &nmachines) < 0) goto error; } /* We register kvm as the base emulator too, since we can * just give -no-kvm to disable acceleration if required */ if ((guest = virCapabilitiesAddGuest(caps, hvm ? "hvm" : "xen", info->arch, info->wordsize, binary, NULL, nmachines, machines)) == NULL) goto error; machines = NULL; nmachines = 0; guest->arch.defaultInfo.emulator_mtime = binary_mtime; if (caps->host.cpu && qemuCapsProbeCPUModels(binary, NULL, info->arch, &ncpus, NULL) == 0 && ncpus > 0 && !virCapabilitiesAddGuestFeature(guest, "cpuselection", 1, 0)) goto error; if (qemuCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX) && !virCapabilitiesAddGuestFeature(guest, "deviceboot", 1, 0)) goto error; if (hvm) { if (virCapabilitiesAddGuestDomain(guest, "qemu", NULL, NULL, 0, NULL) == NULL) goto error;
开发者ID:kthguru,项目名称:libvirt,代码行数:67,
示例20: testQemuCapsInitvirCapsPtr testQemuCapsInit(void){ virCapsPtr caps; virCapsGuestPtr guest; virCapsGuestMachinePtr *machines = NULL; int nmachines = 0; if (!(caps = virCapabilitiesNew(VIR_ARCH_X86_64, false, false))) return NULL; /* Add dummy 'none' security_driver. This is equal to setting * security_driver = "none" in qemu.conf. */ if (VIR_ALLOC_N(caps->host.secModels, 1) < 0) goto cleanup; caps->host.nsecModels = 1; if (VIR_STRDUP(caps->host.secModels[0].model, "none") < 0 || VIR_STRDUP(caps->host.secModels[0].doi, "0") < 0) goto cleanup; if (!(cpuDefault = virCPUDefCopy(&cpuDefaultData)) || !(cpuHaswell = virCPUDefCopy(&cpuHaswellData))) goto cleanup; caps->host.cpu = cpuDefault; caps->host.nnumaCell_max = 4; if ((machines = testQemuAllocMachines(&nmachines)) == NULL) goto cleanup; if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_I686, "/usr/bin/qemu", NULL, nmachines, machines)) == NULL || !virCapabilitiesAddGuestFeature(guest, "cpuselection", true, false)) goto cleanup; machines = NULL; if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL) == NULL) goto cleanup; if ((machines = testQemuAllocMachines(&nmachines)) == NULL) goto cleanup; if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, "/usr/bin/qemu-kvm", NULL, nmachines, machines) == NULL) goto cleanup; machines = NULL; if ((machines = testQemuAllocNewerMachines(&nmachines)) == NULL) goto cleanup; if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_X86_64, "/usr/bin/qemu-system-x86_64", NULL, nmachines, machines)) == NULL || !virCapabilitiesAddGuestFeature(guest, "cpuselection", true, false)) goto cleanup; machines = NULL; if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL) == NULL) goto cleanup; if ((machines = testQemuAllocMachines(&nmachines)) == NULL) goto cleanup; if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, "/usr/bin/kvm", NULL, nmachines, machines) == NULL) goto cleanup; machines = NULL; if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, "/usr/bin/kvm", NULL, 0, NULL) == NULL) goto cleanup; if (testQemuAddPPC64Guest(caps)) goto cleanup; if (testQemuAddPPC64LEGuest(caps))//.........这里部分代码省略.........
开发者ID:feli5,项目名称:libvirt,代码行数:101,
示例21: testQemuCapsInitvirCapsPtr testQemuCapsInit(void) { struct utsname utsname; virCapsPtr caps; virCapsGuestPtr guest; virCapsGuestMachinePtr *machines = NULL; int nmachines = 0; static const char *const xen_machines[] = { "xenner" }; static virCPUFeatureDef host_cpu_features[] = { { (char *) "lahf_lm", -1 }, { (char *) "xtpr", -1 }, { (char *) "cx16", -1 }, { (char *) "tm2", -1 }, { (char *) "est", -1 }, { (char *) "vmx", -1 }, { (char *) "ds_cpl", -1 }, { (char *) "pbe", -1 }, { (char *) "tm", -1 }, { (char *) "ht", -1 }, { (char *) "ss", -1 }, { (char *) "acpi", -1 }, { (char *) "ds", -1 } }; static virCPUDef host_cpu = { VIR_CPU_TYPE_HOST, /* type */ 0, /* match */ (char *) "x86_64", /* arch */ (char *) "core2duo", /* model */ (char *) "Intel", /* vendor */ 1, /* sockets */ 2, /* cores */ 1, /* threads */ ARRAY_CARDINALITY(host_cpu_features), /* nfeatures */ host_cpu_features /* features */ }; uname (&utsname); if ((caps = virCapabilitiesNew(utsname.machine, 0, 0)) == NULL) return NULL; if ((caps->host.cpu = virCPUDefCopy(&host_cpu)) == NULL || (machines = testQemuAllocMachines(&nmachines)) == NULL) goto cleanup; caps->ns.parse = qemuDomainDefNamespaceParse; caps->ns.free = qemuDomainDefNamespaceFree; caps->ns.format = qemuDomainDefNamespaceFormatXML; caps->ns.href = qemuDomainDefNamespaceHref; if ((guest = virCapabilitiesAddGuest(caps, "hvm", "i686", 32, "/usr/bin/qemu", NULL, nmachines, machines)) == NULL) goto cleanup; machines = NULL; if (virCapabilitiesAddGuestDomain(guest, "qemu", NULL, NULL, 0, NULL) == NULL) goto cleanup; if ((machines = testQemuAllocNewerMachines(&nmachines)) == NULL) goto cleanup; if ((guest = virCapabilitiesAddGuest(caps, "hvm", "x86_64", 64, "/usr/bin/qemu-system-x86_64", NULL, nmachines, machines)) == NULL) goto cleanup; machines = NULL; if (virCapabilitiesAddGuestDomain(guest, "qemu", NULL, NULL, 0, NULL) == NULL) goto cleanup; if ((machines = testQemuAllocMachines(&nmachines)) == NULL) goto cleanup; if (virCapabilitiesAddGuestDomain(guest, "kvm", "/usr/bin/kvm", NULL, nmachines, machines) == NULL) goto cleanup; machines = NULL; nmachines = ARRAY_CARDINALITY(xen_machines); if ((machines = virCapabilitiesAllocMachines(xen_machines, nmachines)) == NULL) goto cleanup; if ((guest = virCapabilitiesAddGuest(caps, "xen", "x86_64", 64, "/usr/bin/xenner", NULL,//.........这里部分代码省略.........
开发者ID:amery,项目名称:libvirt-vserver,代码行数:101,
示例22: virLXCDriverCapsInit/* Functions */virCapsPtr virLXCDriverCapsInit(virLXCDriverPtr driver){ virCapsPtr caps; virCapsGuestPtr guest; virArch altArch; char *lxc_path = NULL; if ((caps = virCapabilitiesNew(virArchFromHost(), false, false)) == NULL) goto error; /* Some machines have problematic NUMA toplogy causing * unexpected failures. We don't want to break the lxc * driver in this scenario, so log errors & carry on */ if (nodeCapsInitNUMA(caps) < 0) { virCapabilitiesFreeNUMAInfo(caps); VIR_WARN("Failed to query host NUMA topology, disabling NUMA capabilities"); } /* Only probe for power management capabilities in the driver, * not in the emulator */ if (driver && virNodeSuspendGetTargetMask(&caps->host.powerMgmt) < 0) VIR_WARN("Failed to get host power management capabilities"); if (virGetHostUUID(caps->host.host_uuid)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("cannot get the host uuid")); goto error; } if (!(lxc_path = virFileFindResource("libvirt_lxc", abs_topbuilddir "/src", LIBEXECDIR))) goto error; if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_EXE, caps->host.arch, lxc_path, NULL, 0, NULL)) == NULL) goto error; if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_LXC, NULL, NULL, 0, NULL) == NULL) goto error; /* On 64-bit hosts, we can use personality() to request a 32bit process */ if ((altArch = lxcContainerGetAlt32bitArch(caps->host.arch)) != VIR_ARCH_NONE) { if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_EXE, altArch, lxc_path, NULL, 0, NULL)) == NULL) goto error; if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_LXC, NULL, NULL, 0, NULL) == NULL) goto error; } VIR_FREE(lxc_path); if (driver) { /* Security driver data */ const char *doi, *model, *label, *type; doi = virSecurityManagerGetDOI(driver->securityManager); model = virSecurityManagerGetModel(driver->securityManager); label = virSecurityManagerGetBaseLabel(driver->securityManager, VIR_DOMAIN_VIRT_LXC); type = virDomainVirtTypeToString(VIR_DOMAIN_VIRT_LXC); /* Allocate the primary security driver for LXC. */ if (VIR_ALLOC(caps->host.secModels) < 0) goto error; caps->host.nsecModels = 1; if (VIR_STRDUP(caps->host.secModels[0].model, model) < 0) goto error; if (VIR_STRDUP(caps->host.secModels[0].doi, doi) < 0) goto error; if (label && virCapabilitiesHostSecModelAddBaseLabel(&caps->host.secModels[0], type, label) < 0) goto error; VIR_DEBUG("Initialized caps for security driver /"%s/" with "//.........这里部分代码省略.........
开发者ID:Archer-sys,项目名称:libvirt,代码行数:101,
示例23: vmwareCapsInitvirCapsPtrvmwareCapsInit(void){ virCapsPtr caps = NULL; virCapsGuestPtr guest = NULL; virCPUDefPtr cpu = NULL; virCPUDataPtr data = NULL; if ((caps = virCapabilitiesNew(virArchFromHost(), 0, 0)) == NULL) goto error; if (nodeCapsInitNUMA(caps) < 0) goto error; /* i686 guests are always supported */ if ((guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_I686, NULL, NULL, 0, NULL)) == NULL) goto error; if (virCapabilitiesAddGuestDomain(guest, "vmware", NULL, NULL, 0, NULL) == NULL) goto error; if (VIR_ALLOC(cpu) < 0) goto error; cpu->arch = caps->host.arch; cpu->type = VIR_CPU_TYPE_HOST; if (!(data = cpuNodeData(cpu->arch)) || cpuDecode(cpu, data, NULL, 0, NULL) < 0) { goto error; } /* x86_64 guests are supported if * - Host arch is x86_64 * Or * - Host CPU is x86_64 with virtualization extensions */ if (caps->host.arch == VIR_ARCH_X86_64 || (cpuHasFeature(data, "lm") && (cpuHasFeature(data, "vmx") || cpuHasFeature(data, "svm")))) { if ((guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_X86_64, NULL, NULL, 0, NULL)) == NULL) goto error; if (virCapabilitiesAddGuestDomain(guest, "vmware", NULL, NULL, 0, NULL) == NULL) goto error; }cleanup: virCPUDefFree(cpu); cpuDataFree(data); return caps;error: virObjectUnref(caps); goto cleanup;}
开发者ID:hzguanqiang,项目名称:libvirt,代码行数:70,
示例24: parallelsBuildCapabilitiesstatic virCapsPtrparallelsBuildCapabilities(void){ virCapsPtr caps = NULL; virCPUDefPtr cpu = NULL; virCPUDataPtr data = NULL; virCapsGuestPtr guest; virNodeInfo nodeinfo; if ((caps = virCapabilitiesNew(virArchFromHost(), false, false)) == NULL) return NULL; if (nodeCapsInitNUMA(caps) < 0) goto error; if ((guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_X86_64, "parallels", NULL, 0, NULL)) == NULL) goto error; if ((guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_I686, "parallels", NULL, 0, NULL)) == NULL) goto error; if (virCapabilitiesAddGuestDomain(guest, "parallels", NULL, NULL, 0, NULL) == NULL) goto error; if ((guest = virCapabilitiesAddGuest(caps, "exe", VIR_ARCH_X86_64, "parallels", NULL, 0, NULL)) == NULL) goto error; if (virCapabilitiesAddGuestDomain(guest, "parallels", NULL, NULL, 0, NULL) == NULL) goto error; if (nodeGetInfo(&nodeinfo)) goto error; if (VIR_ALLOC(cpu) < 0) goto error; cpu->arch = caps->host.arch; cpu->type = VIR_CPU_TYPE_HOST; cpu->sockets = nodeinfo.sockets; cpu->cores = nodeinfo.cores; cpu->threads = nodeinfo.threads; caps->host.cpu = cpu; if (!(data = cpuNodeData(cpu->arch)) || cpuDecode(cpu, data, NULL, 0, NULL) < 0) { goto cleanup; } cleanup: cpuDataFree(data); return caps; error: virObjectUnref(caps); goto cleanup;}
开发者ID:SvenDowideit,项目名称:clearlinux,代码行数:70,
示例25: virCapabilitiesNew virCapsGuestPtr guest = NULL; caps = virCapabilitiesNew("i686", 1, 1); if (caps == NULL) { return; } virCapabilitiesSetMacPrefix(caps, (unsigned char[]){ 0x00, 0x0c, 0x29 }); virCapabilitiesAddHostMigrateTransport(caps, "esx"); caps->hasWideScsiBus = true; /* i686 guest */ guest = virCapabilitiesAddGuest(caps, "hvm", "i686", 32, NULL, NULL, 0, NULL); if (guest == NULL) { goto failure; } if (virCapabilitiesAddGuestDomain(guest, "vmware", NULL, NULL, 0, NULL) == NULL) { goto failure; } /* x86_64 guest */ guest = virCapabilitiesAddGuest(caps, "hvm", "x86_64", 64, NULL, NULL, 0, NULL); if (guest == NULL) {
开发者ID:amery,项目名称:libvirt-vserver,代码行数:31,
示例26: testQemuCapsInitvirCapsPtr testQemuCapsInit(void) { virCapsPtr caps; virCapsGuestPtr guest; virCapsGuestMachinePtr *machines = NULL; int nmachines = 0; static const char *const xen_machines[] = { "xenner" }; static virCPUFeatureDef host_cpu_features[] = { { (char *) "lahf_lm", -1 }, { (char *) "xtpr", -1 }, { (char *) "cx16", -1 }, { (char *) "tm2", -1 }, { (char *) "est", -1 }, { (char *) "vmx", -1 }, { (char *) "ds_cpl", -1 }, { (char *) "pbe", -1 }, { (char *) "tm", -1 }, { (char *) "ht", -1 }, { (char *) "ss", -1 }, { (char *) "acpi", -1 }, { (char *) "ds", -1 } }; static virCPUDef host_cpu = { VIR_CPU_TYPE_HOST, /* type */ 0, /* mode */ 0, /* match */ VIR_ARCH_X86_64, /* arch */ (char *) "core2duo", /* model */ NULL, /* vendor_id */ 0, /* fallback */ (char *) "Intel", /* vendor */ 1, /* sockets */ 2, /* cores */ 1, /* threads */ ARRAY_CARDINALITY(host_cpu_features), /* nfeatures */ ARRAY_CARDINALITY(host_cpu_features), /* nfeatures_max */ host_cpu_features, /* features */ 0, /* ncells */ 0, /* ncells_max */ NULL, /* cells */ 0, /* cells_cpus */ }; if ((caps = virCapabilitiesNew(host_cpu.arch, 0, 0)) == NULL) return NULL; if ((caps->host.cpu = virCPUDefCopy(&host_cpu)) == NULL || (machines = testQemuAllocMachines(&nmachines)) == NULL) goto cleanup; if ((guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_I686, "/usr/bin/qemu", NULL, nmachines, machines)) == NULL || !virCapabilitiesAddGuestFeature(guest, "cpuselection", 1, 0)) goto cleanup; machines = NULL; if (virCapabilitiesAddGuestDomain(guest, "qemu", NULL, NULL, 0, NULL) == NULL) goto cleanup; if ((machines = testQemuAllocNewerMachines(&nmachines)) == NULL) goto cleanup; if ((guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_X86_64, "/usr/bin/qemu-system-x86_64", NULL, nmachines, machines)) == NULL || !virCapabilitiesAddGuestFeature(guest, "cpuselection", 1, 0)) goto cleanup; machines = NULL; if (virCapabilitiesAddGuestDomain(guest, "qemu", NULL, NULL, 0, NULL) == NULL) goto cleanup; if ((machines = testQemuAllocMachines(&nmachines)) == NULL) goto cleanup; if (virCapabilitiesAddGuestDomain(guest, "kvm", "/usr/bin/kvm", NULL, nmachines, machines) == NULL) goto cleanup; machines = NULL; nmachines = ARRAY_CARDINALITY(xen_machines); if ((machines = virCapabilitiesAllocMachines(xen_machines, nmachines)) == NULL) goto cleanup;//.........这里部分代码省略.........
开发者ID:djs55,项目名称:libvirt,代码行数:101,
示例27: lxcCapsInit/* Functions */virCapsPtr lxcCapsInit(virLXCDriverPtr driver){ virCapsPtr caps; virCapsGuestPtr guest; virArch altArch; if ((caps = virCapabilitiesNew(virArchFromHost(), 0, 0)) == NULL) goto error; /* Some machines have problematic NUMA toplogy causing * unexpected failures. We don't want to break the QEMU * driver in this scenario, so log errors & carry on */ if (nodeCapsInitNUMA(caps) < 0) { virCapabilitiesFreeNUMAInfo(caps); VIR_WARN("Failed to query host NUMA topology, disabling NUMA capabilities"); } if (virNodeSuspendGetTargetMask(&caps->host.powerMgmt) < 0) VIR_WARN("Failed to get host power management capabilities"); if (virGetHostUUID(caps->host.host_uuid)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("cannot get the host uuid")); goto error; } if ((guest = virCapabilitiesAddGuest(caps, "exe", caps->host.arch, LIBEXECDIR "/libvirt_lxc", NULL, 0, NULL)) == NULL) goto error; if (virCapabilitiesAddGuestDomain(guest, "lxc", NULL, NULL, 0, NULL) == NULL) goto error; /* On 64-bit hosts, we can use personality() to request a 32bit process */ if ((altArch = lxcContainerGetAlt32bitArch(caps->host.arch)) != VIR_ARCH_NONE) { if ((guest = virCapabilitiesAddGuest(caps, "exe", altArch, LIBEXECDIR "/libvirt_lxc", NULL, 0, NULL)) == NULL) goto error; if (virCapabilitiesAddGuestDomain(guest, "lxc", NULL, NULL, 0, NULL) == NULL) goto error; } if (driver) { /* Security driver data */ const char *doi, *model; doi = virSecurityManagerGetDOI(driver->securityManager); model = virSecurityManagerGetModel(driver->securityManager); if (STRNEQ(model, "none")) { /* Allocate just the primary security driver for LXC. */ if (VIR_ALLOC(caps->host.secModels) < 0) goto no_memory; caps->host.nsecModels = 1; if (VIR_STRDUP(caps->host.secModels[0].model, model) < 0) goto error; if (VIR_STRDUP(caps->host.secModels[0].doi, doi) < 0) goto error; } VIR_DEBUG("Initialized caps for security driver /"%s/" with " "DOI /"%s/"", model, doi); } else { VIR_INFO("No driver, not initializing security driver"); } return caps;no_memory: virReportOOMError();error: virObjectUnref(caps); return NULL;}
开发者ID:djs55,项目名称:libvirt,代码行数:98,
注:本文中的virCapabilitiesAddGuest函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ virCheckFlags函数代码示例 C++ virBufferFreeAndReset函数代码示例 |