From 155523125f7dca8fac97c443d63b1e632640309c Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Mon, 2 Feb 2009 14:49:10 +0000
Subject: [PATCH] A couple of small changes to the OS environment

This patch correctly exports the mode of disks (rw/ro) and also exports
the instance OS.

Reviewed-by: imsnah
---
 lib/backend.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/backend.py b/lib/backend.py
index d0d958b5f..d4d10300d 100644
--- a/lib/backend.py
+++ b/lib/backend.py
@@ -1594,6 +1594,7 @@ def OSEnvironment(instance, debug=0):
   result = {}
   result['OS_API_VERSION'] = '%d' % constants.OS_API_VERSION
   result['INSTANCE_NAME'] = instance.name
+  result['INSTANCE_OS'] = instance.os
   result['HYPERVISOR'] = instance.hypervisor
   result['DISK_COUNT'] = '%d' % len(instance.disks)
   result['NIC_COUNT'] = '%d' % len(instance.nics)
@@ -1606,7 +1607,7 @@ def OSEnvironment(instance, debug=0):
     real_disk.Open()
     result['DISK_%d_PATH' % idx] = real_disk.dev_path
     # FIXME: When disks will have read-only mode, populate this
-    result['DISK_%d_ACCESS' % idx] = 'W'
+    result['DISK_%d_ACCESS' % idx] = disk.mode
     if constants.HV_DISK_TYPE in instance.hvparams:
       result['DISK_%d_FRONTEND_TYPE' % idx] = \
         instance.hvparams[constants.HV_DISK_TYPE]
-- 
GitLab