We call _GatherAndLinkBlockDevs during the process, which in turn
calls _RecursiveFindBD. This needs disk parameters to work.

Probably, this is not the cleanest way to solve the problem.
See also commit b8291e0.

This was reported by Ansgar and Damien.

Signed-off-by: Constantinos Venetsanopoulos <c...@grnet.gr>
---

Hello team,

this patch fixes the bug concerning instance startup of an RBD
instance. The beginning of the corresponding discussion can be
found here:

https://groups.google.com/forum/?fromgroups=#!topic/ganeti/tV4MVBJyS-Q

It seems that there is no obvious/clean way to solve this.
Relevant commits are: 70817ce, b5cbddd, 4504bfc, 55de1d6.
This patch copies Rene's approach in commit b8291e0.

If this is OK, I will send another one that fixes disk params
during migration (as reported by Damien).

Regards,
Constantinos

 lib/rpc.py      |    8 +++++---
 lib/rpc_defs.py |    4 ++--
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/lib/rpc.py b/lib/rpc.py
index 136532f..073439a 100644
--- a/lib/rpc.py
+++ b/lib/rpc.py
@@ -661,7 +661,7 @@ class RpcRunner(_RpcClientBase,
     encoders.update({
       # Encoders requiring configuration object
       rpc_defs.ED_INST_DICT: self._InstDict,
-      rpc_defs.ED_INST_DICT_HVP_BEP: self._InstDictHvpBep,
+      rpc_defs.ED_INST_DICT_HVP_BEP_DP: self._InstDictHvpBepDp,
       rpc_defs.ED_INST_DICT_OSP_DP: self._InstDictOspDp,
 
       # Encoders annotating disk parameters
@@ -724,11 +724,13 @@ class RpcRunner(_RpcClientBase,
         nic["nicparams"])
     return idict
 
-  def _InstDictHvpBep(self, (instance, hvp, bep)):
+  def _InstDictHvpBepDp(self, (instance, hvp, bep)):
     """Wrapper for L{_InstDict}.
 
     """
-    return self._InstDict(instance, hvp=hvp, bep=bep)
+    updated_inst = self._InstDict(instance, hvp=hvp, bep=bep)
+    updated_inst["disks"] = self._DisksDictDP((instance.disks, instance))
+    return updated_inst
 
   def _InstDictOspDp(self, (instance, osparams)):
     """Wrapper for L{_InstDict}.
diff --git a/lib/rpc_defs.py b/lib/rpc_defs.py
index 2e8841b..233fce5 100644
--- a/lib/rpc_defs.py
+++ b/lib/rpc_defs.py
@@ -64,7 +64,7 @@ ACCEPT_OFFLINE_NODE = object()
 (ED_OBJECT_DICT,
  ED_OBJECT_DICT_LIST,
  ED_INST_DICT,
- ED_INST_DICT_HVP_BEP,
+ ED_INST_DICT_HVP_BEP_DP,
  ED_NODE_TO_DISK_DICT,
  ED_INST_DICT_OSP_DP,
  ED_IMPEXP_IO,
@@ -266,7 +266,7 @@ _INSTANCE_CALLS = [
     ("instance", ED_INST_DICT, "Instance object"),
     ], None, _MigrationStatusPostProc, "Report migration status"),
   ("instance_start", SINGLE, None, TMO_NORMAL, [
-    ("instance_hvp_bep", ED_INST_DICT_HVP_BEP, None),
+    ("instance_hvp_bep", ED_INST_DICT_HVP_BEP_DP, None),
     ("startup_paused", None, None),
     ], None, None, "Starts an instance"),
   ("instance_os_add", SINGLE, None, TMO_1DAY, [
-- 
1.7.2.5

Reply via email to