Port-xen archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: libvirt status with Xen (netbsd 6.1.2 amd64) ?
giannidaprile writes:
- libvirt is compiled with only qemu backend by default. Pkgsrc doesn't
- currently have any buildlink glue for xen so this is not trivial. Sure
- would be nice to have.
I took a wag at doing this a week or so ago. It turns out the
xen hypervisor interfaces in the libvirt edition in pkgsrc have
more linux-ism's and other strangeness to keep the patches
reasonable. The xen hypervisor interface could be re-written
using solely xen API calls (through libxc) and it would be much
cleaner and easier to maintain. However, I didn't feel like
refactoring the entire source file as a patch, so it's going
back onto the back burner.
However, I did make up a patch that can be applied to the pkgsrc
tree to allow someone else to try and wack this into shape.
Enjoy,
Eric
--
Eric Schnoebelen eric%cirr.com@localhost
http://www.cirr.com
"Remember amateurs built the ark
-- professionals built the Titanic." - Unknown
Index: sysutils/libvirt/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/libvirt/Makefile,v
retrieving revision 1.22
diff -b -u -w -r1.22 Makefile
--- sysutils/libvirt/Makefile 9 May 2014 07:37:19 -0000 1.22
+++ sysutils/libvirt/Makefile 26 May 2014 21:59:04 -0000
@@ -38,6 +38,8 @@
AUTO_MKDIRS= yes
RCD_SCRIPTS= libvirtd
+.include "options.mk"
+
.include "../../lang/python/application.mk"
.include "../../lang/python/extension.mk"
Index: sysutils/libvirt/distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/libvirt/distinfo,v
retrieving revision 1.4
diff -b -u -w -r1.4 distinfo
--- sysutils/libvirt/distinfo 7 Mar 2014 00:30:11 -0000 1.4
+++ sysutils/libvirt/distinfo 26 May 2014 21:59:04 -0000
@@ -3,10 +3,13 @@
SHA1 (libvirt-1.2.2.tar.gz) = d24735b135617983edbfd80c75a1b9925f996e3b
RMD160 (libvirt-1.2.2.tar.gz) = f5c7242b4f6399ddaa03df586ebf8595356e4079
Size (libvirt-1.2.2.tar.gz) = 28340039 bytes
-SHA1 (patch-configure) = d01bd0cf7336d4c0ec0050301095ae0cfac26b7c
+SHA1 (patch-config.h.in) = a71a28bc5cce1e43d045ef9f36585623615bc0ac
+SHA1 (patch-configure) = eb7e11f4c3a2b2230719ef805aaab4b89cd02819
+SHA1 (patch-configure.ac) = a65bbc7cba2332eb315ba3558b42e090ff8cfcf8
SHA1 (patch-gnulib-lib-base64.h) = 7b7f3738fbeb52ba8e8c5ef2b8926008a4585c4b
SHA1 (patch-gnulib-lib-fflush.c) = abfd289afd87d993bbf13cc815443f938cacf7ef
SHA1 (patch-gnulib-lib-fseeko.c) = 1dc0c761d3285da5a418690bfc2e37de90f0e870
SHA1 (patch-src-rpc-virnetmessage.c) = 5a09402a71c1f7082d775503ce3ef17e7c41424c
SHA1 (patch-src-util-virutil.c) = 64710144c4e1c7e1d9f5ca84c47be6f8b01a70f8
+SHA1 (patch-src-xen-xen_hypervisor.c) =
31b69a973071bc3d4aede848c04ae91f23c2d25c
SHA1 (patch-tools--virsh-secret.c) = 424f53edabf535be73e08addea3b4310de08cf8e
Index: sysutils/libvirt/options.mk
===================================================================
RCS file: sysutils/libvirt/options.mk
diff -N sysutils/libvirt/options.mk
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ sysutils/libvirt/options.mk 26 May 2014 21:59:04 -0000
@@ -0,0 +1,37 @@
+# $NetBSD: options.mk,v 1.10 2013/12/13 12:42:12 jperkin Exp $
+
+PKG_OPTIONS_VAR= PKG_OPTIONS.libvirt
+
+# Common options.
+# PKG_SUPPORTED_OPTIONS+=xen3 xen33 xen41 xen42
+PKG_SUPPORTED_OPTIONS+= xen
+PKG_SUGGESTED_OPTIONS=
+
+.include "../../mk/bsd.options.mk"
+
+# xentools42 is the only version to install
+# the include files
+.if !empty(PKG_OPTIONS:Mxen)
+CONFIGURE_ARGS+= --with-xen=${BUILDLINK_PREFIX.xentools42}
+. include "../../sysutils/xentools42/buildlink3.mk"
+.endif
+
+# .if !empty(PKG_OPTIONS:Mxen3)
+# CONFIGURE_ARGS+= --with-xen=yes
+# . include "../../sysutils/xentools3/buildlink3.mk"
+# .endif
+#
+# .if !empty(PKG_OPTIONS:Mxen33)
+# CONFIGURE_ARGS+= --with-xen=yes
+# . include "../../sysutils/xentools33/buildlink3.mk"
+# .endif
+#
+# .if !empty(PKG_OPTIONS:Mxen41)
+# CONFIGURE_ARGS+= --with-xen=yes
+# . include "../../sysutils/xentools41/buildlink3.mk"
+# .endif
+#
+# .if !empty(PKG_OPTIONS:Mxen42)
+# CONFIGURE_ARGS+= --with-xen=yes
+# . include "../../sysutils/xentools42/buildlink3.mk"
+# .endif
Index: sysutils/libvirt/patches/patch-config.h.in
===================================================================
RCS file: sysutils/libvirt/patches/patch-config.h.in
diff -N sysutils/libvirt/patches/patch-config.h.in
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ sysutils/libvirt/patches/patch-config.h.in 26 May 2014 21:59:04 -0000
@@ -0,0 +1,16 @@
+$NetBSD$
+
+Add a new required header file.
+
+--- config.h.in.orig 2014-03-02 14:42:11.000000000 +0000
++++ config.h.in
+@@ -1883,6 +1883,9 @@
+ /* Define to 1 if you have the <xenstore.h> header file. */
+ #undef HAVE_XENSTORE_H
+
++/* Define to 1 if you have the <xenctrl.h> header file. */
++#undef HAVE_XENCTRL_H
++
+ /* Define to 1 if you have the <xen/dom0_ops.h> header file. */
+ #undef HAVE_XEN_DOM0_OPS_H
+
Index: sysutils/libvirt/patches/patch-configure
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/libvirt/patches/patch-configure,v
retrieving revision 1.1
diff -b -u -w -r1.1 patch-configure
--- sysutils/libvirt/patches/patch-configure 28 Jan 2014 18:00:41 -0000
1.1
+++ sysutils/libvirt/patches/patch-configure 26 May 2014 21:59:04 -0000
@@ -1,10 +1,28 @@
$NetBSD: patch-configure,v 1.1 2014/01/28 18:00:41 agc Exp $
Portability bug - test should use '=' for string equality
+Add logic to search for xenctrl.h
---- configure 2014/01/25 02:05:59 1.1
-+++ configure 2014/01/25 02:06:27
-@@ -62681,7 +62681,7 @@
+--- configure.orig 2014-03-02 14:42:09.000000000 +0000
++++ configure
+@@ -54709,6 +54709,7 @@ case $host in
+ *-*-linux*) with_linux=yes ;;
+ *-*-darwin*) with_osx=yes ;;
+ *-*-freebsd*) with_freebsd=yes ;;
++ *-*-netbsd*) with_freebsd=yes ;;
+ esac
+
+ if test $with_linux = no; then
+@@ -62049,7 +62050,7 @@ fi
+
+ done
+
+- for ac_header in xen/xen.h xen/version.h xen/dom0_ops.h
++ for ac_header in xenctrl.h xen/xen.h xen/version.h xen/dom0_ops.h
+ do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "#include
<stdio.h>
+@@ -63376,7 +63377,7 @@ fi
if test "x$with_firewalld" = "xcheck" ; then
with_firewalld=$with_dbus
fi
Index: sysutils/libvirt/patches/patch-configure.ac
===================================================================
RCS file: sysutils/libvirt/patches/patch-configure.ac
diff -N sysutils/libvirt/patches/patch-configure.ac
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ sysutils/libvirt/patches/patch-configure.ac 26 May 2014 21:59:04 -0000
@@ -0,0 +1,21 @@
+$NetBSD$
+
+--- configure.ac.orig 2014-02-26 03:09:50.000000000 +0000
++++ configure.ac
+@@ -175,6 +175,7 @@ case $host in
+ *-*-linux*) with_linux=yes ;;
+ *-*-darwin*) with_osx=yes ;;
+ *-*-freebsd*) with_freebsd=yes ;;
++ *-*-netbsd*) with_freebsd=yes ;;
+ esac
+
+ if test $with_linux = no; then
+@@ -915,7 +916,7 @@ fi
+ if test "$with_xen" != "no" ; then
+ dnl In Xen 4.2, xs.h is deprecated in favor of xenstore.h.
+ AC_CHECK_HEADERS([xenstore.h])
+- AC_CHECK_HEADERS([xen/xen.h xen/version.h xen/dom0_ops.h],,[
++ AC_CHECK_HEADERS([xenctl.h xen/xen.h xen/version.h xen/dom0_ops.h],,[
+ if test "$with_xen" = "yes"; then
+ fail=1
+ fi
Index: sysutils/libvirt/patches/patch-src-xen-xen_hypervisor.c
===================================================================
RCS file: sysutils/libvirt/patches/patch-src-xen-xen_hypervisor.c
diff -N sysutils/libvirt/patches/patch-src-xen-xen_hypervisor.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ sysutils/libvirt/patches/patch-src-xen-xen_hypervisor.c 26 May 2014
21:59:04 -0000
@@ -0,0 +1,410 @@
+$NetBSD$
+
+--- src/xen/xen_hypervisor.c.orig 2013-09-12 09:18:15.000000000 +0000
++++ src/xen/xen_hypervisor.c
+@@ -61,6 +61,11 @@
+ /* required for shutdown flags */
+ #include <xen/sched.h>
+
++#ifdef HAVE_XENCTRL_H
++/* required for xc_physinfo, and xc_version */
++# include <xenctrl.h>
++#endif
++
+ #include "virerror.h"
+ #include "virlog.h"
+ #include "datatypes.h"
+@@ -105,7 +110,7 @@ typedef struct v1_hypercall_struct
+ # define XEN_V1_IOCTL_HYPERCALL_CMD \
+ _IOC(_IOC_NONE, 'P', 0, sizeof(v1_hypercall_t))
+ typedef v1_hypercall_t hypercall_t;
+-#elif defined(__sun)
++#elif defined(__sun) || defined(__NetBSD__)
+ typedef privcmd_hypercall_t hypercall_t;
+ #else
+ # error "unsupported platform"
+@@ -587,7 +592,7 @@ typedef struct xen_v2s5_availheap xen_v
+ static int
+ lock_pages(void *addr, size_t len)
+ {
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+ if (mlock(addr, len) < 0) {
+ virReportSystemError(errno,
+ _("Unable to lock %zu bytes of memory"),
+@@ -603,7 +608,7 @@ lock_pages(void *addr, size_t len)
+ static int
+ unlock_pages(void *addr, size_t len)
+ {
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+ if (munlock(addr, len) < 0) {
+ virReportSystemError(errno,
+ _("Unable to unlock %zu bytes of memory"),
+@@ -897,6 +902,8 @@ typedef struct xen_op_v2_dom xen_op_v2_d
+ # define HYPERVISOR_CAPABILITIES
"/sys/hypervisor/properties/capabilities"
+ #elif defined(__sun)
+ # define XEN_HYPERVISOR_SOCKET "/dev/xen/privcmd"
++#elif defined(__NetBSD__)
++# define XEN_HYPERVISOR_SOCKET "/kern/xen/privcmd"
+ #else
+ # error "unsupported platform"
+ #endif
+@@ -1839,7 +1846,7 @@ xenHypervisorInit(struct xenHypervisorVe
+ goto detect_v2;
+ }
+
+-#ifndef __sun
++#ifdef __linux__
+ /*
+ * check if the old hypercall are actually working
+ */
+@@ -2334,18 +2341,21 @@ xenHypervisorMakeCapabilitiesSunOS(virCo
+ #endif /* __sun */
+
+ /**
+- * xenHypervisorMakeCapabilitiesInternal:
++ * makeVirCapabilitiesFrom XenCapabilities
+ * @conn: pointer to the connection block
+- * @cpuinfo: file handle containing /proc/cpuinfo data, or NULL
+- * @capabilities: file handle containing
/sys/hypervisor/properties/capabilities data, or NULL
++ * @hostarch: the host architecture
++ * @host_pae: does the host support PAE
++ * @hvm_type: what time of HVM is supported? (vmx, svm, hvm)?
++ * @capabilities: string containing the Xen capabilities
+ *
+- * Return the capabilities of this hypervisor.
++ * returns a pointer to a libvirt capabilities structure
+ */
+ virCapsPtr
+-xenHypervisorMakeCapabilitiesInternal(virConnectPtr conn,
+- virArch hostarch,
+- FILE *cpuinfo,
+- FILE *capabilities)
++makeVirCapabilitiesFromXenCapabilities(virConnectPtr conn,
++ virArch hostarch,
++ int host_pae,
++ char *hvm_type,
++ char *capabilities)
+ {
+ char line[1024], *str, *token;
+ regmatch_t subs[4];
+@@ -2353,33 +2363,15 @@ xenHypervisorMakeCapabilitiesInternal(vi
+ size_t i;
+
+ char hvm_type[4] = ""; /* "vmx" or "svm" (or "" if not in CPU). */
+- int host_pae = 0;
+ struct guest_arch guest_archs[32];
+ int nr_guest_archs = 0;
+ virCapsPtr caps = NULL;
+
+ memset(guest_archs, 0, sizeof(guest_archs));
+
+- /* /proc/cpuinfo: flags: Intel calls HVM "vmx", AMD calls it "svm".
+- * It's not clear if this will work on IA64, let alone other
+- * architectures and non-Linux. (XXX)
+- */
+- if (cpuinfo) {
+- while (fgets(line, sizeof(line), cpuinfo)) {
+- if (regexec(&flags_hvm_rec, line,
sizeof(subs)/sizeof(regmatch_t), subs, 0) == 0
+- && subs[0].rm_so != -1) {
+- if (virStrncpy(hvm_type,
+- &line[subs[1].rm_so],
+- subs[1].rm_eo-subs[1].rm_so,
+- sizeof(hvm_type)) == NULL)
+- goto no_memory;
+- } else if (regexec(&flags_pae_rec, line, 0, NULL, 0) == 0)
+- host_pae = 1;
+- }
+- }
+-
+- /* Most of the useful info is in /sys/hypervisor/properties/capabilities
+- * which is documented in the code in
xen-unstable.hg/xen/arch/.../setup.c.
++ /* Most of the useful info is in XENVER_capabilities, (also available
++ * as /sys/hypervisor/properties/capabilities on Linux) which is
++ * documented in the code in xen-unstable.hg/xen/arch/.../setup.c.
+ *
+ * It is a space-separated list of supported guest architectures.
+ *
+@@ -2402,76 +2394,73 @@ xenHypervisorMakeCapabilitiesInternal(vi
+ * +--------------- "xen" or "hvm" for para or full virt respectively
+ */
+
+- /* Expecting one line in this file - ignore any more. */
+- if ((capabilities) && (fgets(line, sizeof(line), capabilities))) {
+- /* Split the line into tokens. strtok_r is OK here because we "own"
+- * this buffer. Parse out the features from each token.
+- */
+- for (str = line, nr_guest_archs = 0;
+- nr_guest_archs < sizeof(guest_archs) / sizeof(guest_archs[0])
+- && (token = strtok_r(str, " ", &saveptr)) != NULL;
+- str = NULL) {
+-
+- if (regexec(&xen_cap_rec, token, sizeof(subs) / sizeof(subs[0]),
+- subs, 0) == 0) {
+- int hvm = STRPREFIX(&token[subs[1].rm_so], "hvm");
+- int pae = 0, nonpae = 0, ia64_be = 0;
+- virArch arch;
+-
+- if (STRPREFIX(&token[subs[2].rm_so], "x86_32")) {
+- arch = VIR_ARCH_I686;
+- if (subs[3].rm_so != -1 &&
+- STRPREFIX(&token[subs[3].rm_so], "p"))
+- pae = 1;
+- else
+- nonpae = 1;
+- }
+- else if (STRPREFIX(&token[subs[2].rm_so], "x86_64")) {
+- arch = VIR_ARCH_X86_64;
+- }
+- else if (STRPREFIX(&token[subs[2].rm_so], "ia64")) {
+- arch = VIR_ARCH_ITANIUM;
+- if (subs[3].rm_so != -1 &&
+- STRPREFIX(&token[subs[3].rm_so], "be"))
+- ia64_be = 1;
+- }
+- else if (STRPREFIX(&token[subs[2].rm_so], "powerpc64")) {
+- arch = VIR_ARCH_PPC64;
+- } else {
+- /* XXX surely no other Xen archs exist. Arrrrrrrrrm */
+- continue;
+- }
+-
+- /* Search for existing matching (model,hvm) tuple */
+- for (i = 0; i < nr_guest_archs; i++) {
+- if (guest_archs[i].arch == arch &&
+- 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;
+- }
+- }
++ /* Split the line into tokens. strtok_r is OK here because we "own"
++ * this buffer. Parse out the features from each token.
++ */
++ for (str = line, nr_guest_archs = 0;
++ nr_guest_archs < sizeof(guest_archs) / sizeof(guest_archs[0])
++ && (token = strtok_r(str, " ", &saveptr)) != NULL;
++ str = NULL) {
++
++ if (regexec(&xen_cap_rec, token, sizeof(subs) / sizeof(subs[0]),
++ subs, 0) == 0) {
++ int hvm = STRPREFIX(&token[subs[1].rm_so], "hvm");
++ int pae = 0, nonpae = 0, ia64_be = 0;
++ virArch arch;
++
++ if (STRPREFIX(&token[subs[2].rm_so], "x86_32")) {
++ arch = VIR_ARCH_I686;
++ if (subs[3].rm_so != -1 &&
++ STRPREFIX(&token[subs[3].rm_so], "p"))
++ pae = 1;
++ else
++ nonpae = 1;
++ }
++ else if (STRPREFIX(&token[subs[2].rm_so], "x86_64")) {
++ arch = VIR_ARCH_X86_64;
++ }
++ else if (STRPREFIX(&token[subs[2].rm_so], "ia64")) {
++ arch = VIR_ARCH_ITANIUM;
++ if (subs[3].rm_so != -1 &&
++ STRPREFIX(&token[subs[3].rm_so], "be"))
++ ia64_be = 1;
++ }
++ else if (STRPREFIX(&token[subs[2].rm_so], "powerpc64")) {
++ arch = VIR_ARCH_PPC64;
++ } else {
++ /* XXX surely no other Xen archs exist. Arrrrrrrrrm */
++ continue;
++ }
++
++ /* Search for existing matching (model,hvm) tuple */
++ for (i = 0; i < nr_guest_archs; i++) {
++ if (guest_archs[i].arch == arch &&
++ 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;
++ }
+ }
+
+ if ((caps = xenHypervisorBuildCapabilities(conn,
+@@ -2489,6 +2478,117 @@ xenHypervisorMakeCapabilitiesInternal(vi
+ return NULL;
+ }
+
++
++#if defined(HAVE_XENCTRL_H)
++/**
++ * xenHypervisorMakeCapabitiesXenCtrl:
++ * @conn: pointer to connecting block
++ *
++ * return the capabilities of the hypervisor, gathering the
++ * information directly from the hypervisor.
++ *
++ * cribbed heavily from libxl and the xl command in Xen 4.2
++ * Eric Schnoebelen (eric%cirr.com@localhost) 2014-05-24
++ */
++static virCapsPtr
++xenHypervisorMakeCapabilitiesXenCtrl(conn)
++{
++ xc_interface *xc; /* connection to the hypervisor */
++ xc_physinfo_t physinfo = { 0 }; /* attributes of the host hardware */
++ xen_capabilities_info_t capabilities; /* xen capabilities */
++ int hvm; /* is the host hvm capable? */
++ int host_pae; /* does the host support PAE */
++ int rc;
++
++ /* open the connection to the hypervisor, NULL for logging goes to stderr
*/
++ xc = xc_interface_open(NULL, NULL, 0);
++
++ /*
++ * call the _xen_version hypervisor call family,
++ * with an opcode for the capabilities list
++ */
++ xc_version(xc, XENVER_capabilities, &capabilities);
++
++ /*
++ * get the physical characteristics for the host while we're at it
++ */
++ rc = xc_physinfo(xc, &physinfo);
++ if (rc != 0) {
++ /* what shall we do?? */
++ }
++
++ /* look for the HVM physical capability */
++ hvm = ((physinfo.capabilities & XEN_SYSCTL_PHYSCAP_hvm) ==
++ XEN_SYSCTL_PHYSCAP_hvm);
++
++ /* look at the feature flags from physinfo.hw_caps, looking for PAE */
++ /* 0x40 is the feature flag in %edx, aka hw_cap[0], for PAE */
++ host_pae = ((physinfo.hw_cap[0] & 0x40) == 0x40);
++
++ /* clean up the connection to the hypervisor */
++ xc_interface_close(xc);
++
++ /* Make the capabilities */
++ return makeVirCapabilitiesFromXenCapabilities(conn,
++ virArchFromHost(),
++ host_pae,
++ (hvm ? "hvm" : ""),
++ capabilities);
++
++}
++
++#endif /* HAVE_XENCTRL_H */
++
++
++/**
++ * xenHypervisorMakeCapabilitiesInternal:
++ * @conn: pointer to the connection block
++ * @cpuinfo: file handle containing /proc/cpuinfo data, or NULL
++ * @capabilities: file handle containing
/sys/hypervisor/properties/capabilities data, or NULL
++ *
++ * Return the capabilities of this hypervisor.
++ */
++virCapsPtr
++xenHypervisorMakeCapabilitiesInternal(virConnectPtr conn,
++ virArch hostarch,
++ FILE *cpuinfo,
++ FILE *capabilities)
++{
++ char line[1024];
++ regmatch_t subs[4];
++ char hvm_type[4] = ""; /* "vmx" or "svm" (or "" if not in CPU). */
++ int host_pae = 0;
++
++ /* /proc/cpuinfo: flags: Intel calls HVM "vmx", AMD calls it "svm".
++ * It's not clear if this will work on IA64, let alone other
++ * architectures and non-Linux. (XXX)
++ */
++ if (cpuinfo) {
++ while (fgets(line, sizeof(line), cpuinfo)) {
++ if (regexec(&flags_hvm_rec, line,
sizeof(subs)/sizeof(regmatch_t), subs, 0) == 0
++ && subs[0].rm_so != -1) {
++ if (virStrncpy(hvm_type,
++ &line[subs[1].rm_so],
++ subs[1].rm_eo-subs[1].rm_so,
++ sizeof(hvm_type)) == NULL)
++ goto no_memory;
++ } else if (regexec(&flags_pae_rec, line, 0, NULL, 0) == 0)
++ host_pae = 1;
++ }
++ }
++
++ /* Expecting one line in this file - ignore any more. */
++ if (!capabilities) {
++ line[0] = 0;
++ }
++ fgets(line, sizeof(line), capabilities);
++
++ /* Make the capabilities */
++ return makeVirCapabilitiesFromXenCapabilities(conn, hostarch,
++ host_pae, hvm_type, line);
++}
++
++
+ /**
+ * xenHypervisorMakeCapabilities:
+ *
+@@ -2499,7 +2599,7 @@ xenHypervisorMakeCapabilities(virConnect
+ {
+ #ifdef __sun
+ return xenHypervisorMakeCapabilitiesSunOS(conn);
+-#else
++#elif defined(__linux__)
+ virCapsPtr caps = NULL;
+ FILE *cpuinfo, *capabilities;
+
+@@ -2539,6 +2639,10 @@ cleanup:
+ VIR_FORCE_FCLOSE(capabilities);
+
+ return caps;
++#elif defined(HAVE_XENCTRL_H) /* all other XEN */
++ return xenHypervisorMakeCapabilitiesXenCtrl(conn);
++#else
++#error "Unsupported Platform: No way to determine capabilities!"
+ #endif /* __sun */
+ }
+
Index: sysutils/xentools42/buildlink3.mk
===================================================================
RCS file: sysutils/xentools42/buildlink3.mk
diff -N sysutils/xentools42/buildlink3.mk
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ sysutils/xentools42/buildlink3.mk 26 May 2014 21:59:05 -0000
@@ -0,0 +1,12 @@
+# $NetBSD: buildlink3.mk,v 1.4 2009/03/20 19:25:26 joerg Exp $
+
+BUILDLINK_TREE+= xentools42
+
+.if !defined(XENTOOLS42_BUILDLINK3_MK)
+XENTOOLS42_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.xentools42+= xentools42>=4.2
+BUILDLINK_PKGSRCDIR.xentools42?= ../../sysutils/xentools42
+.endif # XENTOOLS42_BUILDLINK3_MK
+
+BUILDLINK_TREE+= -xentools42
Home |
Main Index |
Thread Index |
Old Index