On Fri, Oct 07, 2016 at 08:38:07PM +0100, 'Viktor Bachraty' via ganeti-devel 
wrote:
> Add a side effect to StartInstance on Xen hypervisor that restores the
> Xen configuration in case it is missing. This is a common failure
> scenario during migrations. The generic backend checks if the instance
> is running and queries the hypervisor about it's state. If it needs
> recovery, the backend gathers the associated block devices and calls
> RestoreInstance in the same manner as if it would call StartInstance in
> case the instance wasn't already running.

LGTM, except for the nits below (which don't change functionality).

> +    if instance_info and not _IsInstanceUserDown(instance_info):
> +      logging.info("Instance '%s' already running, not starting", 
> instance.name)
> +      if hyper.VerifyInstance(instance):
> +        return
> +      logging.info("Instance '%s' needs fixup", instance.name)

"Instance '%s' hypervisor config out of date. Restoring." maybe?

> +  def VerifyInstance(self, instance):  # pylint: disable=R0201,W0613

Nit: I think this is a bit misleading: it's not quite about the running instance
state, it's about the config on disk. How about VerifyHypervisorConfig?

> +    """Verify if running instance is in correct state.

Nit: has correct configuration

> +    @param instance: instance to stop

Nit: s/to stop/to verify/

> +  def RestoreInstance(self, instance, block_devices):

Nit: WriteHypervisorConfig, maybe?

> +    @param instance: instance to stop

Nit: s/to stop/to write/

> +  def VerifyInstance(self, instance):
> +    """Verify if running instance is in correct state.
> +
> +    @type instance: L{objects.Instance}
> +    @param instance: instance to stop

As for hv_base.

> +  def RestoreInstance(self, instance, block_devices):
> +    """Fixup running instance's state.
> +
> +    @type instance: L{objects.Instance}
> +    @param instance: instance to stop

As for hv_base.

>    def StartInstance(self, instance, block_devices, startup_paused):
>      """Start an instance.
>  
> +    @type instance: L{objects.Instance}
> +    @param instance: instance to stop

Nit: s/to stop/to start/

Reply via email to