From f2165b8aff2d8331625b9930af591383d8db3d05 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Mon, 25 Oct 2010 12:06:20 +0200
Subject: [PATCH] Simplify and extend the instance OS env

Some parameters were missing (uuid, c/mtime). We simplify the export
method; unfortunately we cannot simply iterate over __slots__ since the
mapping is not 1:1.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 lib/backend.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/backend.py b/lib/backend.py
index 1d0d15f08..8abe5a676 100644
--- a/lib/backend.py
+++ b/lib/backend.py
@@ -1995,8 +1995,9 @@ def OSEnvironment(instance, inst_os, debug=0):
   """
   result = OSCoreEnv(instance.os, inst_os, instance.osparams, debug=debug)
 
-  result['INSTANCE_NAME'] = instance.name
-  result['INSTANCE_OS'] = instance.os
+  for attr in ["name", "os", "uuid", "ctime", "mtime"]:
+    result["INSTANCE_%s" % attr.upper()] = str(getattr(instance, attr))
+
   result['HYPERVISOR'] = instance.hypervisor
   result['DISK_COUNT'] = '%d' % len(instance.disks)
   result['NIC_COUNT'] = '%d' % len(instance.nics)
-- 
GitLab