This patch adds an implementation of the version function to the LXC driver.
The providers use the hypervisor version in a field of one of the instances,
so we need to have something meaningful here. AFAICT, the only real option
we have (considering the limitations of the libvirt version information) is
to use the kernel version.
diff -r be3be31c94a2 -r 0cabead40d65 src/lxc_driver.c
--- a/src/lxc_driver.c Fri Aug 29 07:11:15 2008 +0000
+++ b/src/lxc_driver.c Fri Aug 29 09:10:41 2008 -0700
@@ -1110,6 +1110,29 @@
return 0;
}
+static int lxcVersion(virConnectPtr conn, unsigned long *version)
+{
+ struct utsname ver;
+ int maj;
+ int min;
+ int rev;
+
+ if (uname(&ver) != 0) {
+ lxcError(conn, NULL, VIR_ERR_INTERNAL_ERROR,
+ _("uname(): %m"));
+ return -1;
+ }
+
+ if (sscanf(ver.release, "%i.%i.%i", &maj, &min, &rev) != 3) {
+ lxcError(conn, NULL, VIR_ERR_INTERNAL_ERROR,
+ _("Unknown release: %s"), ver.release);
+ return -1;
+ }
+
+ *version = (maj * 1000 * 1000) + (min * 1000) + rev;
+
+ return 0;
+}
/* Function Tables */
static virDriver lxcDriver = {
@@ -1121,7 +1144,7 @@
lxcClose, /* close */
NULL, /* supports_feature */
NULL, /* type */
- NULL, /* version */
+ lxcVersion, /* version */
NULL, /* getHostname */
NULL, /* getURI */
NULL, /* getMaxVcpus */
Show replies by date
On Fri, Aug 29, 2008 at 09:11:27AM -0700, Dan Smith wrote:
This patch adds an implementation of the version function to the LXC
driver.
The providers use the hypervisor version in a field of one of the instances,
so we need to have something meaningful here. AFAICT, the only real option
we have (considering the limitations of the libvirt version information) is
to use the kernel version.
Yes, this is a reasonable idea.
ACK.
Daniel
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://ovirt.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|