Still looks good, thanks!

On Fri, Dec 20, 2013 at 11:02 AM, Helga Velroyen <[email protected]> wrote:

> FYI: interdiff due to the renamining:
>
> diff --git a/test/py/cmdlib/node_unittest.py
> b/test/py/cmdlib/node_unittest.py
> index 2a02f9a..d0ab416 100644
> --- a/test/py/cmdlib/node_unittest.py
> +++ b/test/py/cmdlib/node_unittest.py
> @@ -83,7 +83,7 @@ class TestLUNodeAdd(CmdlibTestCase):
>      self.rpc.call_node_crypto_tokens.return_value = \
>        self.RpcResultsBuilder() \
>          .CreateSuccessfulNodeResult(self.node_add,
> -            [(constants.CRYPTO_TYPE_SSL, "IA:MA:FA:KE:DI:GE:ST")])
> +            [(constants.CRYPTO_TYPE_SSL_DIGEST, "IA:MA:FA:KE:DI:GE:ST")])
>
>    def testOvsNoLink(self):
>      ndparams = {
>
>
>
> On Fri, Dec 20, 2013 at 10:27 AM, Hrvoje Ribicic <[email protected]> wrote:
>
>> LGTM, thanks!
>>
>>
>> On Thu, Dec 19, 2013 at 3:49 PM, Helga Velroyen <[email protected]>wrote:
>>
>>> This patch adds the certificate of a newly added or
>>> readded master candidate node to the map of master candidate
>>> certificates. It removes a master candidate node's certificate
>>> digest from the candidate certificate map if the node is
>>> removed from the cluster.
>>>
>>> Signed-off-by: Helga Velroyen <[email protected]>
>>> ---
>>>  lib/cmdlib/node.py              | 22 ++++++++++++++++++++--
>>>  test/py/cmdlib/node_unittest.py | 27 ++++++++++++++++++++++++++-
>>>  2 files changed, 46 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/lib/cmdlib/node.py b/lib/cmdlib/node.py
>>> index 429f21d..09cd9c8 100644
>>> --- a/lib/cmdlib/node.py
>>> +++ b/lib/cmdlib/node.py
>>> @@ -42,7 +42,7 @@ from ganeti.cmdlib.common import CheckParamsNotGlobal,
>>> \
>>>    CheckInstanceState, INSTANCE_DOWN, GetUpdatedParams, \
>>>    AdjustCandidatePool, CheckIAllocatorOrNode, LoadNodeEvacResult, \
>>>    GetWantedNodes, MapInstanceLvsToNodes, RunPostHook, \
>>> -  FindFaultyInstanceDisks, CheckStorageTypeEnabled
>>> +  FindFaultyInstanceDisks, CheckStorageTypeEnabled,
>>> AddNodeCertToCandidateCerts
>>>
>>>
>>>  def _DecideSelfPromotion(lu, exceptions=None):
>>> @@ -414,6 +414,16 @@ class LUNodeAdd(LogicalUnit):
>>>        self.context.AddNode(self.new_node, self.proc.GetECId())
>>>        RedistributeAncillaryFiles(self)
>>>
>>> +    cluster = self.cfg.GetClusterInfo()
>>> +    if self.new_node.master_candidate:
>>> +      AddNodeCertToCandidateCerts(self, self.new_node.uuid, cluster)
>>> +      self.cfg.Update(cluster, feedback_fn)
>>> +    else:
>>> +      if self.new_node.uuid in cluster.candidate_certs:
>>> +        utils.RemoveNodeFromCandidateCerts(self.new_node.uuid,
>>> +                                           cluster.candidate_certs)
>>> +        self.cfg.Update(cluster, feedback_fn)
>>> +
>>>
>>>  class LUNodeSetParams(LogicalUnit):
>>>    """Modifies the parameters of a node.
>>> @@ -1473,8 +1483,16 @@ class LUNodeRemove(LogicalUnit):
>>>        self.LogWarning("Errors encountered on the remote node while
>>> leaving"
>>>                        " the cluster: %s", msg)
>>>
>>> +    cluster = self.cfg.GetClusterInfo()
>>> +
>>> +    # Remove node from candidate certificate list
>>> +    if self.node.master_candidate:
>>> +      utils.RemoveNodeFromCandidateCerts(self.node.uuid,
>>> +                                         cluster.candidate_certs)
>>> +      self.cfg.Update(cluster, feedback_fn)
>>> +
>>>      # Remove node from our /etc/hosts
>>> -    if self.cfg.GetClusterInfo().modify_etc_hosts:
>>> +    if cluster.modify_etc_hosts:
>>>        master_node_uuid = self.cfg.GetMasterNode()
>>>        result = self.rpc.call_etc_hosts_modify(master_node_uuid,
>>>
>>>  constants.ETC_HOSTS_REMOVE,
>>> diff --git a/test/py/cmdlib/node_unittest.py
>>> b/test/py/cmdlib/node_unittest.py
>>> index dc8e124..2a02f9a 100644
>>> --- a/test/py/cmdlib/node_unittest.py
>>> +++ b/test/py/cmdlib/node_unittest.py
>>> @@ -29,7 +29,6 @@ from ganeti import compat
>>>  from ganeti import constants
>>>  from ganeti import objects
>>>  from ganeti import opcodes
>>> -from ganeti import errors
>>>
>>>  from testsupport import *
>>>
>>> @@ -81,6 +80,10 @@ class TestLUNodeAdd(CmdlibTestCase):
>>>      # we can't know the node's UUID in advance, so use defaultdict here
>>>      self.rpc.call_node_verify.return_value = \
>>>        defaultdict(lambda: node_verify_result, {})
>>> +    self.rpc.call_node_crypto_tokens.return_value = \
>>> +      self.RpcResultsBuilder() \
>>> +        .CreateSuccessfulNodeResult(self.node_add,
>>> +            [(constants.CRYPTO_TYPE_SSL, "IA:MA:FA:KE:DI:GE:ST")])
>>>
>>>    def testOvsNoLink(self):
>>>      ndparams = {
>>> @@ -106,6 +109,28 @@ class TestLUNodeAdd(CmdlibTestCase):
>>>      self.assertEqual(ndparams[constants.ND_OVS_LINK],
>>>                       created_node.ndparams.get(constants.ND_OVS_LINK,
>>> None))
>>>
>>> +  def testAddCandidateCert(self):
>>> +    self.ExecOpCode(self.op_add)
>>> +
>>> +    created_node = self.cfg.GetNodeInfoByName(self.op_add.node_name)
>>> +    cluster = self.cfg.GetClusterInfo()
>>> +    self.assertTrue(created_node.uuid in cluster.candidate_certs)
>>> +
>>> +  def testReAddCandidateCert(self):
>>> +    cluster = self.cfg.GetClusterInfo()
>>> +    self.ExecOpCode(self.op_readd)
>>> +    created_node = self.cfg.GetNodeInfoByName(self.op_readd.node_name)
>>> +    self.assertTrue(created_node.uuid in cluster.candidate_certs)
>>> +
>>> +  def testAddNoCandidateCert(self):
>>> +    op = self.CopyOpCode(self.op_add,
>>> +                         master_capable=False)
>>> +    self.ExecOpCode(op)
>>> +
>>> +    created_node = self.cfg.GetNodeInfoByName(self.op_add.node_name)
>>> +    cluster = self.cfg.GetClusterInfo()
>>> +    self.assertFalse(created_node.uuid in cluster.candidate_certs)
>>> +
>>>    def testWithoutOVS(self):
>>>      self.ExecOpCode(self.op_add)
>>>
>>> --
>>> 1.8.5.1
>>>
>>>
>>
>
>
> --
> --
> Helga Velroyen | Software Engineer | [email protected] |
>
> Google Germany GmbH
> Dienerstr. 12
> 80331 München
>
> Registergericht und -nummer: Hamburg, HRB 86891
> Sitz der Gesellschaft: Hamburg
> Geschäftsführer: Graham Law, Christine Elizabeth Flores
>

Reply via email to