[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libvir] [RFC] Host and guest capabilities



I've been looking into the parts of virtinst which try to probe the capabilities of the host directly, rather than being abstracted through libvirt (for example, opening and parsing /sys/hypervisor/properties/capabilities directly).

Attached is a proposed API for probing the capabilities and supported guest architectures of the hypervisor / driver.

I've implemented the virCapabilities part already. My original implementation of the guest architectures had virCapabilities containing a list of supported architectures, but that doesn't nearly cover the richness of what the underlying drivers could support, so I'm currently separating that out into a separate virConnectGetGuestArchitectures call.

Let me know your opinions of this API.

As an aside, the current virt-manager "choose paravirt / fullvirt" screen doesn't really capture the full, shall I say, ugliness of the possible choices for architecture, particularly when we add qemu, kqemu, and emulation in the mix. I suspect that presenting a list of architectures here, perhaps with some options to show only paravirt, show only fullvirt, show only accelerated ...

Rich.

--
Emerging Technologies, Red Hat  http://et.redhat.com/~rjones/
64 Baker Street, London, W1U 7DF     Mobile: +44 7866 314 421
 "[Negative numbers] darken the very whole doctrines of the equations
 and make dark of the things which are in their nature excessively
 obvious and simple" (Francis Maseres FRS, mathematician, 1759)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index bd8f6a1..5a84bf5 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -188,6 +188,52 @@ struct _virNodeInfo {
 typedef virNodeInfo *virNodeInfoPtr;
 
 /**
+ * virCapabilitiesPtr:
+ *
+ * a virCapabilitiesPtr contains the capabilities of the hypervisor or
+ * driver that we have connected to, returned by virConnectGetCapabilities.
+ * Use virCapabilitiesFree to free the structure after use.
+ */
+
+struct _virCapabilities;
+typedef struct _virCapabilities virCapabilities;
+typedef virCapabilities *virCapabilitiesPtr;
+
+int virCapabilitiesFree (virCapabilitiesPtr caps);
+
+/* Accessors for fields in the virCapabilitiesPtr structure. */
+int virCapabilitiesGetHostSupportsHVM (virCapabilitiesPtr caps);
+int virCapabilitiesGetHostHVMDisabledByBIOS (virCapabilitiesPtr caps);
+  /* XXX Other things which virtinst needs:
+   * blktap
+   * KVM/KQEMU available in kernel
+   */
+
+/**
+ * virGuestArchitecturesPtr
+ *
+ * a virGuestArchitecturesPtr contains a list of the guest architectures
+ * supported by the driver, returned by virConnectGetGuestArchitectures.
+ * Use virGuestArchitecturesFree to free the structure after use.
+ */
+
+struct _virGuestArchitectures;
+typedef struct _virGuestArchitectures virGuestArchitectures;
+typedef struct virGuestArchitectures *virGuestArchitecturesPtr;
+
+int virGuestArchitecturesFree (virGuestArchitecturesPtr archs);
+
+/* Accessors for elements in the virGuestArchitecturesPtr structure. */
+int virGuestArchitecturesGetCount (virGuestArchitecturesPtr archs);
+char *virGuestArchitecturesGetName (virGuestArchitecturesPtr archs, int n);
+int virGuestArchitecturesGetIsHVM (virGuestArchitecturesPtr archs, int n);
+int virGuestArchitecturesGetIsAccelerated (virGuestArchitecturesPtr archs, int n);
+int virGuestArchitecturesGetIsEmulated (virGuestArchitecturesPtr archs, int n);
+int virGuestArchitecturesGetIsBigEndian (virGuestArchitecturesPtr archs, int n);
+int virGuestArchitecturesGetBits (virGuestArchitecturesPtr archs, int n);
+int virGuestArchitecturesGetIsPAE (virGuestArchitecturesPtr archs, int n);
+
+/**
  * VIR_UUID_STRING_BUFLEN:
  *
  * This macro provides the length of the buffer required
@@ -231,8 +277,14 @@ int			virConnectClose		(virConnectPtr conn);
 const char *		virConnectGetType	(virConnectPtr conn);
 int			virConnectGetVersion	(virConnectPtr conn,
 						 unsigned long *hvVer);
+/*
+ * Capabilities of the connection / driver.
+ */
+
 int			virNodeGetInfo		(virConnectPtr conn,
 						 virNodeInfoPtr info);
+virCapabilitiesPtr      virConnectGetCapabilities (virConnectPtr conn);
+virGuestArchitecturesPtr virConnectGetGuestArchitectures (virConnectPtr conn);
 
 /*
  * Gather list of running domains

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]