On Tue, May 18, 2010 at 02:36:04PM +0200, Michael Hanselmann wrote:
> To prepare a remote export, the X509 key and certificate need to be generated.
> A handshake value is also returned for an easier check whether both clusters
> share the same cluster domain secret.
> ---
> lib/cmdlib.py | 62
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> lib/constants.py | 6 +++++
> lib/mcpu.py | 1 +
> lib/opcodes.py | 14 ++++++++++++
> 4 files changed, 83 insertions(+), 0 deletions(-)
> diff --git a/lib/constants.py b/lib/constants.py
> index 13af563..cf6a656 100644
> --- a/lib/constants.py
> +++ b/lib/constants.py
> @@ -333,6 +333,12 @@ LOCKS_APPEND = 'append'
> INSTANCE_CREATE = "create"
> INSTANCE_IMPORT = "import"
>
> +# Remote import/export handshake message
> +RIE_HANDSHAKE = "Hi, I'm Ganeti"
I wonder if this shouldn't be tied to the Ganeti version (or RIE/IED
protocol version), so that the handshake fails between incompatible
versions.
> +# Remote import/export certificate validity in seconds
> +RIE_CERT_VALIDITY = 24 * 60 * 60
> +
> DISK_TEMPLATES = frozenset([DT_DISKLESS, DT_PLAIN,
> DT_DRBD8, DT_FILE])
>
> diff --git a/lib/mcpu.py b/lib/mcpu.py
> index c601c51..3198780 100644
> --- a/lib/mcpu.py
> +++ b/lib/mcpu.py
> @@ -210,6 +210,7 @@ class Processor(object):
> opcodes.OpDiagnoseOS: cmdlib.LUDiagnoseOS,
> # exports lu
> opcodes.OpQueryExports: cmdlib.LUQueryExports,
> + opcodes.OpPrepareExport: cmdlib.LUPrepareExport,
> opcodes.OpExportInstance: cmdlib.LUExportInstance,
> opcodes.OpRemoveExport: cmdlib.LURemoveExport,
> # tags lu
> diff --git a/lib/opcodes.py b/lib/opcodes.py
> index c7d00be..149dbab 100644
> --- a/lib/opcodes.py
> +++ b/lib/opcodes.py
> @@ -653,6 +653,20 @@ class OpQueryExports(OpCode):
> __slots__ = ["nodes", "use_locking"]
>
>
> +class OpPrepareExport(OpCode):
> + """Prepares an instance export.
> +
> + @ivar instance_name: Instance name
> + @ivar mode: Export mode (one of L{constants.EXPORT_MODES})
Does this work correctly? I would expect ganeti.contants.EXPORT_MODES to
be required.
Rest LGTM.
iustin