LGTM, thanks

On Thu, Mar 20, 2014 at 3:48 PM, Jose A. Lopes <[email protected]> wrote:

> When an instance does not have OS scripts because, for example, it
> uses an OS image, do not rename the instance after an import.
>
> Signed-off-by: Jose A. Lopes <[email protected]>
> ---
>  lib/cmdlib/instance.py | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/lib/cmdlib/instance.py b/lib/cmdlib/instance.py
> index da46ea1..28585f3 100644
> --- a/lib/cmdlib/instance.py
> +++ b/lib/cmdlib/instance.py
> @@ -1609,14 +1609,16 @@ class LUInstanceCreate(LogicalUnit):
>            raise errors.ProgrammerError("Unknown OS initialization mode
> '%s'"
>                                         % self.op.mode)
>
> -        # Run rename script on newly imported instance
>          assert iobj.name == self.op.instance_name
> -        feedback_fn("Running rename script for %s" %
> self.op.instance_name)
> -        result = self.rpc.call_instance_run_rename(self.pnode.uuid, iobj,
> -                                                   rename_from,
> -                                                   self.op.debug_level)
> -        result.Warn("Failed to run rename script for %s on node %s" %
> -                    (self.op.instance_name, self.pnode.name),
> self.LogWarning)
> +
> +        # Run rename script on newly imported instance
> +        if iobj.os:
> +          feedback_fn("Running rename script for %s" %
> self.op.instance_name)
> +          result = self.rpc.call_instance_run_rename(self.pnode.uuid,
> iobj,
> +                                                     rename_from,
> +                                                     self.op.debug_level)
> +          result.Warn("Failed to run rename script for %s on node %s" %
> +                      (self.op.instance_name, self.pnode.name),
> self.LogWarning)
>
>      assert not self.owned_locks(locking.LEVEL_NODE_RES)
>
> --
> 1.9.0.279.gdc9e3eb
>
>

Reply via email to