(* libguestfs
- * Copyright (C) 2009-2010 Red Hat Inc.
+ * Copyright (C) 2009-2011 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
"\
Return the current attach method. See C<guestfs_set_attach_method>.");
+ ("inspect_get_product_variant", (RString "variant", [Device "root"], []), -1, [],
+ [],
+ "get product variant of inspected operating system",
+ "\
+This function should only be called with a root device string
+as returned by C<guestfs_inspect_os>.
+
+This returns the product variant of the inspected operating
+system.
+
+For Windows guests, this returns the contents of the Registry key
+C<HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion>
+C<InstallationType> which is usually a string such as
+C<Client> or C<Server> (other values are possible). This
+can be used to distinguish consumer and enterprise versions
+of Windows that have the same version number (for example,
+Windows 7 and Windows 2008 Server are both version 6.1,
+but the former is C<Client> and the latter is C<Server>).
+
+For enterprise Linux guests, in future we intend this to return
+the product variant such as C<Desktop>, C<Server> and so on. But
+this is not implemented at present.
+
+If the product variant could not be determined, then the
+string C<unknown> is returned.
+
+Please read L<guestfs(3)/INSPECTION> for more details.
+See also C<guestfs_inspect_get_product_name>,
+C<guestfs_inspect_get_major_version>.");
+
]
(* daemon_functions are any functions which cause some action
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"=str(1):"Microsoft Windows 7 Phony Edition"
"CurrentVersion"=str(1):"6.1"
+"InstallationType"=str(1):"Client"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows]
<arch>i386</arch>
<distro>windows</distro>
<product_name>Microsoft Windows 7 Phony Edition</product_name>
+ <product_variant>Client</product_variant>
<major_version>6</major_version>
<minor_version>1</minor_version>
<windows_systemroot>/Windows</windows_systemroot>
+ <format>installed</format>
<mountpoints>
<mountpoint dev="/dev/sda2">/</mountpoint>
</mountpoints>
/* virt-inspector
- * Copyright (C) 2010 Red Hat Inc.
+ * Copyright (C) 2010-2011 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
xmlTextWriterWriteElement (xo, BAD_CAST "product_name", BAD_CAST str));
free (str);
+ str = guestfs_inspect_get_product_variant (g, root);
+ if (!str) exit (EXIT_FAILURE);
+ if (STRNEQ (str, "unknown"))
+ XMLERROR (-1,
+ xmlTextWriterWriteElement (xo, BAD_CAST "product_variant", BAD_CAST str));
+ free (str);
+
i = guestfs_inspect_get_major_version (g, root);
snprintf (buf, sizeof buf, "%d", i);
XMLERROR (-1,
<arch>i386</arch>
<distro>windows</distro>
<product_name>Windows 7 Enterprise</product_name>
+ <product_variant>Client</product_variant>
<major_version>6</major_version>
<minor_version>1</minor_version>
<windows_systemroot>/Windows</windows_systemroot>
=head1 COPYRIGHT
-Copyright (C) 2010 Red Hat Inc.
+Copyright (C) 2010-2011 Red Hat Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
<optional><element name="arch"><text/></element></optional>
<optional><element name="distro"><text/></element></optional>
<optional><element name="product_name"><text/></element></optional>
+ <optional><element name="product_variant"><text/></element></optional>
<element name="major_version"><text/></element>
<element name="minor_version"><text/></element>
<optional><element name="windows_systemroot"><text/></element></optional>
enum inspect_os_package_format package_format;
enum inspect_os_package_management package_management;
char *product_name;
+ char *product_variant;
int major_version;
int minor_version;
char *arch;
free (version);
}
+ else if (STRCASEEQ (key, "InstallationType")) {
+ fs->product_variant = hivex_value_string (h, values[i]);
+ if (!fs->product_variant) {
+ perrorf (g, "hivex_value_string");
+ free (key);
+ goto out;
+ }
+ }
free (key);
}
}
char *
+guestfs__inspect_get_product_variant (guestfs_h *g, const char *root)
+{
+ struct inspect_fs *fs = search_for_root (g, root);
+ if (!fs)
+ return NULL;
+
+ return safe_strdup (g, fs->product_variant ? : "unknown");
+}
+
+char *
guestfs__inspect_get_windows_systemroot (guestfs_h *g, const char *root)
{
struct inspect_fs *fs = search_for_root (g, root);
}
char *
+guestfs__inspect_get_product_variant (guestfs_h *g, const char *root)
+{
+ NOT_IMPL(NULL);
+}
+
+char *
guestfs__inspect_get_windows_systemroot (guestfs_h *g, const char *root)
{
NOT_IMPL(NULL);
for (i = 0; i < g->nr_fses; ++i) {
free (g->fses[i].device);
free (g->fses[i].product_name);
+ free (g->fses[i].product_variant);
free (g->fses[i].arch);
free (g->fses[i].hostname);
free (g->fses[i].windows_systemroot);