commit 1c3231aad9e5dddbe9490d49896434000cec6dd9
Author: Thomas Thrainer <thomasth@google.com>
Date:   Mon May 27 16:17:41 2013 +0200

    Index nodes by their UUID
    
    No longer index nodes by their name but by their UUID in the cluster
    config. This change changes large parts of the code, as the following
    adjustments were necessary:
     * Change the index key to UUID in the configuration and the
       ConfigWriter, including all methods.
     * Change all cross-references to nodes to use UUID's.
     * External interfaces (command line interface, IAllocator interface,
       hook scripts, etc.) are kept stable.
     * RPC-calls can resolve UUID's as target node arguments, if the RPC
       runner is based on a ConfigWriter instance. The result dictionary is
       presented in the form the nodes are addressed: by UUID if UUID's were
       given, or by name if names were given.
     * Node UUID's are resolved in ExpandNames and then stored in the
       OpCode. This allows to check for node renames if the OpCode is
       reloaded after a cluster restart. This check is currently only done
       for single node parameters.
     * Variable names are renamed to follow the following pattern:
       - Suffix is 'node' or 'nodes': Variable holds Node objects
       - Suffix is 'name' or 'names': Variable holds node names
       - Suffix is 'uuid' or 'uuids': Variable holds node UUID's
     * Tests are adapted.
    
    Signed-off-by: Thomas Thrainer <thomasth@google.com>
    Reviewed-by: Klaus Aehlig <aehlig@google.com>

diff --git a/test/py/ganeti.hypervisor.hv_kvm_unittest.py b/test/py/ganeti.hypervisor.hv_kvm_unittest.py
index c21c749..b3d3f79 100755
--- a/test/py/ganeti.hypervisor.hv_kvm_unittest.py
+++ b/test/py/ganeti.hypervisor.hv_kvm_unittest.py
@@ -185,35 +185,37 @@ class TestQmp(testutils.GanetiTestCase):
 
 
 class TestConsole(unittest.TestCase):
-  def _Test(self, instance, hvparams):
-    cons = hv_kvm.KVMHypervisor.GetInstanceConsole(instance, hvparams, {})
+  def _Test(self, instance, node, hvparams):
+    cons = hv_kvm.KVMHypervisor.GetInstanceConsole(instance, node, hvparams, {})
     self.assertTrue(cons.Validate())
     return cons
 
   def testSerial(self):
     instance = objects.Instance(name="kvm.example.com",
-                                primary_node="node6017")
+                                primary_node="node6017-uuid")
+    node = objects.Node(name="node6017", uuid="node6017-uuid")
     hvparams = {
       constants.HV_SERIAL_CONSOLE: True,
       constants.HV_VNC_BIND_ADDRESS: None,
       constants.HV_KVM_SPICE_BIND: None,
       }
-    cons = self._Test(instance, hvparams)
+    cons = self._Test(instance, node, hvparams)
     self.assertEqual(cons.kind, constants.CONS_SSH)
-    self.assertEqual(cons.host, instance.primary_node)
+    self.assertEqual(cons.host, node.name)
     self.assertEqual(cons.command[0], pathutils.KVM_CONSOLE_WRAPPER)
     self.assertEqual(cons.command[1], constants.SOCAT_PATH)
 
   def testVnc(self):
     instance = objects.Instance(name="kvm.example.com",
-                                primary_node="node7235",
+                                primary_node="node7235-uuid",
                                 network_port=constants.VNC_BASE_PORT + 10)
+    node = objects.Node(name="node7235", uuid="node7235-uuid")
     hvparams = {
       constants.HV_SERIAL_CONSOLE: False,
       constants.HV_VNC_BIND_ADDRESS: "192.0.2.1",
       constants.HV_KVM_SPICE_BIND: None,
       }
-    cons = self._Test(instance, hvparams)
+    cons = self._Test(instance, node, hvparams)
     self.assertEqual(cons.kind, constants.CONS_VNC)
     self.assertEqual(cons.host, "192.0.2.1")
     self.assertEqual(cons.port, constants.VNC_BASE_PORT + 10)
@@ -223,12 +225,13 @@ class TestConsole(unittest.TestCase):
     instance = objects.Instance(name="kvm.example.com",
                                 primary_node="node7235",
                                 network_port=11000)
+    node = objects.Node(name="node7235", uuid="node7235-uuid")
     hvparams = {
       constants.HV_SERIAL_CONSOLE: False,
       constants.HV_VNC_BIND_ADDRESS: None,
       constants.HV_KVM_SPICE_BIND: "192.0.2.1",
       }
-    cons = self._Test(instance, hvparams)
+    cons = self._Test(instance, node, hvparams)
     self.assertEqual(cons.kind, constants.CONS_SPICE)
     self.assertEqual(cons.host, "192.0.2.1")
     self.assertEqual(cons.port, 11000)
@@ -237,12 +240,13 @@ class TestConsole(unittest.TestCase):
     instance = objects.Instance(name="kvm.example.com",
                                 primary_node="node24325",
                                 network_port=0)
+    node = objects.Node(name="node24325", uuid="node24325-uuid")
     hvparams = {
       constants.HV_SERIAL_CONSOLE: False,
       constants.HV_VNC_BIND_ADDRESS: None,
       constants.HV_KVM_SPICE_BIND: None,
       }
-    cons = self._Test(instance, hvparams)
+    cons = self._Test(instance, node, hvparams)
     self.assertEqual(cons.kind, constants.CONS_MESSAGE)
 
 
