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

[Xen-devel] [PATCH 7/8] xl: generate a new random VM generation ID if requested

If the "generation_id" option is set in the domain configuration,
generate and set a new random VM generation ID every time a domain is
created or restored.

xl lacks the infrastructure to fully track the lifecycle of VM images
as they are snapshotted and cloned (etc) so always using a new ID is
the safe option and ensures that a new one will be used where it matters.

Signed-off-by: David Vrabel <david.vrabel@xxxxxxxxxx>
 docs/man/xl.cfg.pod.5    |   29 +++++++++++++++++++++++++++++
 tools/libxl/xl_cmdimpl.c |   15 +++++++++++++++
 2 files changed, 44 insertions(+)

diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5
index c087cbc..ff9ea77 100644
--- a/docs/man/xl.cfg.pod.5
+++ b/docs/man/xl.cfg.pod.5
@@ -936,6 +936,35 @@ number of vendor defined SMBIOS structures (type 128 - 
255). Since SMBIOS
 structures do not present their overall size, each entry in the file must be
 preceded by a 32b integer indicating the size of the next structure.
+=item B<ms_vm_genid="OPTION">
+Provide a VM generation ID to the guest.
+The VM generation ID as a 128-bit random number that a guest may use
+to determine if the guest has been restored from an earlier snapshot
+or cloned.
+This is required for Microsoft Windows Server 2012 (and later) domain
+Valid options are:
+=over 4
+=item B<"generate">
+Generate a random VM generation ID every time the domain is created or
+=item B<"none">
+Do not provide a VM generation ID.
+See also "Virtual Machine Generation ID" by Microsoft
 =head3 Guest Virtual Time Controls
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 64a1c77..6a67c9c 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -1021,6 +1021,21 @@ static void parse_config_data(const char *config_source,
                                &b_info->u.hvm.smbios_firmware, 0);
         xlu_cfg_replace_string(config, "acpi_firmware",
                                &b_info->u.hvm.acpi_firmware, 0);
+        if (!xlu_cfg_get_string(config, "ms_vm_genid", &buf, 0)) {
+            if (!strcmp(buf, "generate")) {
+                e = libxl_ms_vm_genid_generate(ctx, 
+                if (e) {
+                    fprintf(stderr, "ERROR: failed to generate a VM Generation 
+                    exit(1);
+                }
+            } else if (!strcmp(buf, "none")) {
+                ;
+            } else {
+                    fprintf(stderr, "ERROR: \"ms_vm_genid\" option must be 
\"generate\" or \"none\"\n");
+                    exit(1);
+            }
+        }

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.