KVM: fix per-instance stored UID value
authorApollon Oikonomopoulos <apollon@noc.grnet.gr>
Wed, 22 Jun 2011 15:41:29 +0000 (18:41 +0300)
committerGuido Trotter <ultrotter@google.com>
Wed, 22 Jun 2011 16:16:15 +0000 (17:16 +0100)
When using the pool security model, _ExecuteKVMRuntime was storing the
instance's UID using str(uid), which would result in storing the
LockedUid.__repr__() result:

 $ cat /var/run/ganeti/kvm-hypervisor/uid/xxxxxxxxxxxxx
 <ganeti.uidpool.LockedUid object at 0x1f30610>

This patch restores the intended behaviour, by using LockedUid.AsStr().

Signed-off-by: Apollon Oikonomopoulos <apollon@noc.grnet.gr>
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

lib/hypervisor/hv_kvm.py

index 290a2e8..6df67df 100644 (file)
@@ -875,7 +875,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
         raise
       else:
         uid.Unlock()
-        utils.WriteFile(self._InstanceUidFile(name), data=str(uid))
+        utils.WriteFile(self._InstanceUidFile(name), data=uid.AsStr())
     else:
       self._RunKVMCmd(name, kvm_cmd, tapfds)