Revision 783a6c0b

b/lib/cli.py
1 1
#
2 2
#
3 3

  
4
# Copyright (C) 2006, 2007 Google Inc.
4
# Copyright (C) 2006, 2007, 2008, 2009, 2010 Google Inc.
5 5
#
6 6
# This program is free software; you can redistribute it and/or modify
7 7
# it under the terms of the GNU General Public License as published by
......
87 87
  "MAINTAIN_NODE_HEALTH_OPT",
88 88
  "MASTER_NETDEV_OPT",
89 89
  "MC_OPT",
90
  "MIGRATION_TYPE_OPT",
90
  "MIGRATION_MODE_OPT",
91 91
  "NET_OPT",
92 92
  "NEW_CLUSTER_CERT_OPT",
93 93
  "NEW_CLUSTER_DOMAIN_SECRET_OPT",
......
699 699
                         " freeze the instance, save the state, transfer and"
700 700
                         " only then resume running on the secondary node)")
701 701

  
702
MIGRATION_TYPE_OPT = cli_option("--migration-type", dest="migration_type",
702
MIGRATION_MODE_OPT = cli_option("--migration-mode", dest="migration_mode",
703 703
                                default=None,
704
                                choices=list(constants.HT_MIGRATION_TYPES),
705
                                help="Override default migration type (choose"
704
                                choices=list(constants.HT_MIGRATION_MODES),
705
                                help="Override default migration mode (choose"
706 706
                                " either live or non-live")
707 707

  
708 708
NODE_PLACEMENT_OPT = cli_option("-n", "--node", dest="node",
b/lib/cmdlib.py
1 1
#
2 2
#
3 3

  
4
# Copyright (C) 2006, 2007, 2008 Google Inc.
4
# Copyright (C) 2006, 2007, 2008, 2009, 2010 Google Inc.
5 5
#
6 6
# This program is free software; you can redistribute it and/or modify
7 7
# it under the terms of the GNU General Public License as published by
......
234 234

  
235 235
#: the migration type (live/non-live)
236 236
_PMigrationLive = ("live", None, _TOr(_TNone,
237
                                      _TElemOf(constants.HT_MIGRATION_TYPES)))
237
                                      _TElemOf(constants.HT_MIGRATION_MODES)))
238 238

  
239 239

  
240 240
# End types
......
5822 5822
    if self.lu.op.live is None:
5823 5823
      # read the default value from the hypervisor
5824 5824
      i_hv = self.cfg.GetClusterInfo().FillHV(instance, skip_globals=False)
5825
      self.lu.op.live = i_hv[constants.HV_MIGRATION_TYPE]
5825
      self.lu.op.live = i_hv[constants.HV_MIGRATION_MODE]
5826 5826

  
5827 5827
    self.live = self.lu.op.live == constants.HT_MIGRATION_LIVE
5828 5828

  
b/lib/constants.py
546 546
HV_MIGRATION_PORT = "migration_port"
547 547
HV_MIGRATION_BANDWIDTH = "migration_bandwidth"
548 548
HV_MIGRATION_DOWNTIME = "migration_downtime"
549
HV_MIGRATION_TYPE = "migration_type"
549
HV_MIGRATION_MODE = "migration_mode"
550 550
HV_USE_LOCALTIME = "use_localtime"
551 551
HV_DISK_CACHE = "disk_cache"
552 552
HV_SECURITY_MODEL = "security_model"
......
582 582
  HV_MIGRATION_PORT: VTYPE_INT,
583 583
  HV_MIGRATION_BANDWIDTH: VTYPE_INT,
584 584
  HV_MIGRATION_DOWNTIME: VTYPE_INT,
585
  HV_MIGRATION_TYPE: VTYPE_STRING,
585
  HV_MIGRATION_MODE: VTYPE_STRING,
586 586
  HV_USE_LOCALTIME: VTYPE_BOOL,
587 587
  HV_DISK_CACHE: VTYPE_STRING,
588 588
  HV_SECURITY_MODEL: VTYPE_STRING,
......
733 733
# Migration type
734 734
HT_MIGRATION_LIVE = "live"
735 735
HT_MIGRATION_NONLIVE = "non-live"
736
HT_MIGRATION_TYPES = frozenset([HT_MIGRATION_LIVE, HT_MIGRATION_NONLIVE])
736
HT_MIGRATION_MODES = frozenset([HT_MIGRATION_LIVE, HT_MIGRATION_NONLIVE])
737 737

  
738 738
# Cluster Verify steps
739 739
VERIFY_NPLUSONE_MEM = 'nplusone_mem'
......
877 877
    HV_ROOT_PATH: '/dev/sda1',
878 878
    HV_KERNEL_ARGS: 'ro',
879 879
    HV_MIGRATION_PORT: 8002,
880
    HV_MIGRATION_TYPE: HT_MIGRATION_LIVE,
880
    HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
881 881
    },
882 882
  HT_XEN_HVM: {
883 883
    HV_BOOT_ORDER: "cd",
......
891 891
    HV_KERNEL_PATH: "/usr/lib/xen/boot/hvmloader",
892 892
    HV_DEVICE_MODEL: "/usr/lib/xen/bin/qemu-dm",
893 893
    HV_MIGRATION_PORT: 8002,
894
    HV_MIGRATION_TYPE: HT_MIGRATION_NONLIVE,
894
    HV_MIGRATION_MODE: HT_MIGRATION_NONLIVE,
895 895
    HV_USE_LOCALTIME: False,
896 896
    },
897 897
  HT_KVM: {
......
914 914
    HV_MIGRATION_PORT: 8102,
915 915
    HV_MIGRATION_BANDWIDTH: 32, # MiB/s
916 916
    HV_MIGRATION_DOWNTIME: 30,  # ms
917
    HV_MIGRATION_TYPE: HT_MIGRATION_LIVE,
917
    HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
918 918
    HV_USE_LOCALTIME: False,
919 919
    HV_DISK_CACHE: HT_CACHE_DEFAULT,
920 920
    HV_SECURITY_MODEL: HT_SM_NONE,
......
936 936
HVC_GLOBALS = frozenset([
937 937
  HV_MIGRATION_PORT,
938 938
  HV_MIGRATION_BANDWIDTH,
939
  HV_MIGRATION_TYPE,
939
  HV_MIGRATION_MODE,
940 940
  ])
941 941

  
942 942
BEC_DEFAULTS = {
b/lib/hypervisor/hv_base.py
1 1
#
2 2
#
3 3

  
4
# Copyright (C) 2006, 2007, 2008 Google Inc.
4
# Copyright (C) 2006, 2007, 2008, 2009, 2010 Google Inc.
5 5
#
6 6
# This program is free software; you can redistribute it and/or modify
7 7
# it under the terms of the GNU General Public License as published by
......
89 89
REQUIRED_CHECK = (True, None, None, None, None)
90 90

  
91 91
# migration type
92
MIGRATION_TYPE_CHECK = (True, lambda x: x in constants.HT_MIGRATION_TYPES,
93
                        "invalid migration type", None, None)
92
MIGRATION_MODE_CHECK = (True, lambda x: x in constants.HT_MIGRATION_MODES,
93
                        "invalid migration mode", None, None)
94 94

  
95 95

  
96 96
def ParamInSet(required, my_set):
b/lib/hypervisor/hv_kvm.py
1 1
#
2 2
#
3 3

  
4
# Copyright (C) 2008 Google Inc.
4
# Copyright (C) 2008, 2009, 2010 Google Inc.
5 5
#
6 6
# This program is free software; you can redistribute it and/or modify
7 7
# it under the terms of the GNU General Public License as published by
......
194 194
    constants.HV_MIGRATION_PORT: hv_base.NET_PORT_CHECK,
195 195
    constants.HV_MIGRATION_BANDWIDTH: hv_base.NO_CHECK,
196 196
    constants.HV_MIGRATION_DOWNTIME: hv_base.NO_CHECK,
197
    constants.HV_MIGRATION_TYPE: hv_base.MIGRATION_TYPE_CHECK,
197
    constants.HV_MIGRATION_MODE: hv_base.MIGRATION_MODE_CHECK,
198 198
    constants.HV_USE_LOCALTIME: hv_base.NO_CHECK,
199 199
    constants.HV_DISK_CACHE:
200 200
      hv_base.ParamInSet(True, constants.HT_VALID_CACHE_TYPES),
b/lib/hypervisor/hv_xen.py
1 1
#
2 2
#
3 3

  
4
# Copyright (C) 2006, 2007, 2008 Google Inc.
4
# Copyright (C) 2006, 2007, 2008, 2009, 2010 Google Inc.
5 5
#
6 6
# This program is free software; you can redistribute it and/or modify
7 7
# it under the terms of the GNU General Public License as published by
......
458 458
    constants.HV_ROOT_PATH: hv_base.REQUIRED_CHECK,
459 459
    constants.HV_KERNEL_ARGS: hv_base.NO_CHECK,
460 460
    constants.HV_MIGRATION_PORT: hv_base.NET_PORT_CHECK,
461
    constants.HV_MIGRATION_TYPE: hv_base.MIGRATION_TYPE_CHECK,
461
    constants.HV_MIGRATION_MODE: hv_base.MIGRATION_MODE_CHECK,
462 462
    }
463 463

  
464 464
  @classmethod
......
557 557
    constants.HV_DEVICE_MODEL: hv_base.REQ_FILE_CHECK,
558 558
    constants.HV_VNC_PASSWORD_FILE: hv_base.REQ_FILE_CHECK,
559 559
    constants.HV_MIGRATION_PORT: hv_base.NET_PORT_CHECK,
560
    constants.HV_MIGRATION_TYPE: hv_base.MIGRATION_TYPE_CHECK,
560
    constants.HV_MIGRATION_MODE: hv_base.MIGRATION_MODE_CHECK,
561 561
    constants.HV_USE_LOCALTIME: hv_base.NO_CHECK,
562 562
    }
563 563

  
b/man/gnt-instance.sgml
2407 2407
          <command>migrate</command>
2408 2408
          <arg>-f</arg>
2409 2409
          <arg>--non-live</arg>
2410
          <arg>--migration-type=live|non-live</arg>
2410
          <arg>--migration-mode=live|non-live</arg>
2411 2411
          <arg choice="req"><replaceable>instance</replaceable></arg>
2412 2412
        </cmdsynopsis>
2413 2413

  
......
2425 2425

  
2426 2426
        <para>
2427 2427
          The <option>--non-live</option>
2428
          and <option>--migration-type=non-live</option> options will
2428
          and <option>--migration-mode=non-live</option> options will
2429 2429
          switch (for the hypervisors that support it) between a
2430 2430
          "fully live" (i.e. the interruption is as minimal as
2431 2431
          possible) migration and one in which the instance is frozen,
......
2434 2434
          for two different methods. In any case, it is not an error
2435 2435
          to pass this parameter (it will just be ignored if the
2436 2436
          hypervisor doesn't support it). The
2437
          option <option>--migration-type=live</option> option will
2437
          option <option>--migration-mode=live</option> option will
2438 2438
          request a fully-live migration. The default, when neither
2439 2439
          option is passed, depends on the hypervisor parameters (and
2440 2440
          can be viewed with the <command>gnt-cluster info</command>
b/man/gnt-node.sgml
571 571
        <command>migrate</command>
572 572
        <arg>-f</arg>
573 573
        <arg>--non-live</arg>
574
        <arg>--migration-type=live|non-live</arg>
574
        <arg>--migration-mode=live|non-live</arg>
575 575
        <arg choice="req"><replaceable>node</replaceable></arg>
576 576
      </cmdsynopsis>
577 577

  
......
584 584
      <para>
585 585
        As for the <command>gnt-instance migrate</command> command,
586 586
        the options <option>--no-live</option>
587
        and <option>--migration-type</option> can be given to
587
        and <option>--migration-mode</option> can be given to
588 588
        influence the migration type.
589 589
      </para>
590 590

  
b/scripts/gnt-instance
1 1
#!/usr/bin/python
2 2
#
3 3

  
4
# Copyright (C) 2006, 2007 Google Inc.
4
# Copyright (C) 2006, 2007, 2008, 2009, 2010 Google Inc.
5 5
#
6 6
# This program is free software; you can redistribute it and/or modify
7 7
# it under the terms of the GNU General Public License as published by
......
898 898
      return 1
899 899

  
900 900
  # this should be removed once --non-live is deprecated
901
  if not opts.live and opts.migration_type is not None:
901
  if not opts.live and opts.migration_mode is not None:
902 902
    raise errors.OpPrereqError("Only one of the --non-live and "
903
                               "--migration-type options can be passed",
903
                               "--migration-mode options can be passed",
904 904
                               errors.ECODE_INVAL)
905 905
  if not opts.live: # --non-live passed
906 906
    live = constants.HT_MIGRATION_NONLIVE
907 907
  else:
908
    live = opts.migration_type
908
    live = opts.migration_mode
909 909

  
910 910
  op = opcodes.OpMigrateInstance(instance_name=instance_name, live=live,
911 911
                                 cleanup=opts.cleanup)
......
1419 1419
    " using the remote mirror (only for instances of type drbd)"),
1420 1420
  'migrate': (
1421 1421
    MigrateInstance, ARGS_ONE_INSTANCE,
1422
    [FORCE_OPT, NONLIVE_OPT, MIGRATION_TYPE_OPT, CLEANUP_OPT],
1422
    [FORCE_OPT, NONLIVE_OPT, MIGRATION_MODE_OPT, CLEANUP_OPT],
1423 1423
    "[-f] <instance>", "Migrate instance to its secondary node"
1424 1424
    " (only for instances of type drbd)"),
1425 1425
  'move': (
b/scripts/gnt-node
1 1
#!/usr/bin/python
2 2
#
3 3

  
4
# Copyright (C) 2006, 2007, 2008 Google Inc.
4
# Copyright (C) 2006, 2007, 2008, 2009, 2010 Google Inc.
5 5
#
6 6
# This program is free software; you can redistribute it and/or modify
7 7
# it under the terms of the GNU General Public License as published by
......
361 361
    return 2
362 362

  
363 363
  # this should be removed once --non-live is deprecated
364
  if not opts.live and opts.migration_type is not None:
364
  if not opts.live and opts.migration_mode is not None:
365 365
    raise errors.OpPrereqError("Only one of the --non-live and "
366
                               "--migration-type options can be passed",
366
                               "--migration-mode options can be passed",
367 367
                               errors.ECODE_INVAL)
368 368
  if not opts.live: # --non-live passed
369 369
    live = constants.HT_MIGRATION_NONLIVE
370 370
  else:
371
    live = opts.migration_type
371
    live = opts.migration_mode
372 372
  op = opcodes.OpMigrateNode(node_name=args[0], live=live)
373 373
  SubmitOpCode(op, cl=cl, opts=opts)
374 374

  
......
661 661
    "Stops the primary instances on a node and start them on their"
662 662
    " secondary node (only for instances with drbd disk template)"),
663 663
  'migrate': (
664
    MigrateNode, ARGS_ONE_NODE, [FORCE_OPT, NONLIVE_OPT, MIGRATION_TYPE_OPT],
664
    MigrateNode, ARGS_ONE_NODE, [FORCE_OPT, NONLIVE_OPT, MIGRATION_MODE_OPT],
665 665
    "[-f] <node>",
666 666
    "Migrate all the primary instance on a node away from it"
667 667
    " (only for instances of type drbd)"),

Also available in: Unified diff