From 2928f08da5f5bf39dae53c2c9f897ee0d313e9d2 Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Thu, 29 Jan 2009 15:51:14 +0000
Subject: [PATCH] LUAddNode: copy the vnc password file also for KVM

Before we used to copy the file if xen-hvm was enabled on the cluster,
no we'll do that if any enabled hypervisor is in the new HTS_USE_VNC
group.

Reviewed-by: iustinp
---
 lib/cmdlib.py    | 4 +++-
 lib/constants.py | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 9db397bb8..d7f883b37 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -2178,8 +2178,10 @@ class LUAddNode(LogicalUnit):
           logging.error("Copy of file %s to node %s failed", fname, to_node)
 
     to_copy = []
-    if constants.HT_XEN_HVM in self.cfg.GetClusterInfo().enabled_hypervisors:
+    enabled_hypervisors = self.cfg.GetClusterInfo().enabled_hypervisors
+    if constants.HTS_USE_VNC.intersection(enabled_hypervisors):
       to_copy.append(constants.VNC_PASSWORD_FILE)
+
     for fname in to_copy:
       result = self.rpc.call_upload_file([node], fname)
       if result[node].failed or not result[node]:
diff --git a/lib/constants.py b/lib/constants.py
index 2c6030121..2e0b8d99a 100644
--- a/lib/constants.py
+++ b/lib/constants.py
@@ -325,6 +325,7 @@ HT_XEN_HVM = "xen-hvm"
 HT_KVM = "kvm"
 HYPER_TYPES = frozenset([HT_XEN_PVM, HT_FAKE, HT_XEN_HVM, HT_KVM])
 HTS_REQ_PORT = frozenset([HT_XEN_HVM, HT_KVM])
+HTS_USE_VNC = frozenset([HT_XEN_HVM, HT_KVM])
 
 HT_HVM_VNC_BASE_PORT = 5900
 HT_HVM_DEFAULT_BOOT_ORDER = 'dc'
-- 
GitLab