On Mon, Aug 12, 2013 at 10:26 AM, Thomas Thrainer <[email protected]> wrote:
> CheckNodeNotDrained displayed only the node UUID if the node is drained.
> In order to provide a more helpful error message, use the node name
> instead.
>
> Signed-off-by: Thomas Thrainer <[email protected]>
> ---
>  lib/cmdlib/instance_utils.py | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/lib/cmdlib/instance_utils.py b/lib/cmdlib/instance_utils.py
> index fd6dd80..0092c67 100644
> --- a/lib/cmdlib/instance_utils.py
> +++ b/lib/cmdlib/instance_utils.py
> @@ -201,8 +201,9 @@ def CheckNodeNotDrained(lu, node_uuid):
>    @raise errors.OpPrereqError: if the node is drained
>
>    """
> -  if lu.cfg.GetNodeInfo(node_uuid).drained:
> -    raise errors.OpPrereqError("Can't use drained node %s" % node_uuid,
> +  node = lu.cfg.GetNodeInfo(node_uuid)
> +  if node.drained:
> +    raise errors.OpPrereqError("Can't use drained node %s" % node.name,
>                                 errors.ECODE_STATE)

LGTM

Thanks,
Guido

Reply via email to