Revision b4ec07f8

b/lib/cmdlib.py
2592 2592
    assert self.instance is not None, \
2593 2593
      "Cannot retrieve locked instance %s" % self.op.instance_name
2594 2594
    _CheckNodeOnline(self, self.instance.primary_node)
2595
    if not hasattr(self.op, "ignore_size"):
2596
      self.op.ignore_size = False
2595 2597

  
2596 2598
  def Exec(self, feedback_fn):
2597 2599
    """Activate the disks.
2598 2600

  
2599 2601
    """
2600
    disks_ok, disks_info = _AssembleInstanceDisks(self, self.instance)
2602
    disks_ok, disks_info = \
2603
              _AssembleInstanceDisks(self, self.instance,
2604
                                     ignore_size=self.op.ignore_size)
2601 2605
    if not disks_ok:
2602 2606
      raise errors.OpExecError("Cannot activate block devices")
2603 2607

  
b/lib/opcodes.py
438 438
  """Activate an instance's disks."""
439 439
  OP_ID = "OP_INSTANCE_ACTIVATE_DISKS"
440 440
  OP_DSC_FIELD = "instance_name"
441
  __slots__ = ["instance_name"]
441
  __slots__ = ["instance_name", "ignore_size"]
442 442

  
443 443

  
444 444
class OpDeactivateInstanceDisks(OpCode):
b/man/gnt-instance.sgml
1657 1657
        <cmdsynopsis>
1658 1658
          <command>activate-disks</command>
1659 1659
          <arg>--submit</arg>
1660
          <arg>--ignore-size</arg>
1660 1661
          <arg choice="req"><replaceable>instance</replaceable></arg>
1661 1662
        </cmdsynopsis>
1662 1663
        <para>
......
1686 1687
        </para>
1687 1688

  
1688 1689
        <para>
1690
          The <option>--ignore-size</option> option can be used to
1691
          activate disks ignoring the currently configured size in
1692
          Ganeti. This can be used in cases where the configuration
1693
          has gotten out of sync with the real-world (e.g. after a
1694
          partially-failed grow-disk operation or due to rounding in
1695
          LVM devices). This should not be used in normal cases, but
1696
          only when activate-disks fails without it.
1697
        </para>
1698

  
1699
        <para>
1689 1700
          Note that it is safe to run this command while the instance
1690 1701
          is already running.
1691 1702
        </para>
b/scripts/gnt-instance
609 609

  
610 610
  """
611 611
  instance_name = args[0]
612
  op = opcodes.OpActivateInstanceDisks(instance_name=instance_name)
612
  op = opcodes.OpActivateInstanceDisks(instance_name=instance_name,
613
                                       ignore_size=opts.ignore_size)
613 614
  disks_info = SubmitOrSend(op, opts)
614 615
  for host, iname, nname in disks_info:
615 616
    ToStdout("%s:%s:%s", host, iname, nname)
......
1482 1483
               SUBMIT_OPT,
1483 1484
               ],
1484 1485
            "<instance>", "Reboots an instance"),
1485
  'activate-disks': (ActivateDisks, ARGS_ONE, [DEBUG_OPT, SUBMIT_OPT],
1486
  'activate-disks': (ActivateDisks, ARGS_ONE,
1487
                     [DEBUG_OPT, SUBMIT_OPT,
1488
                      make_option("--ignore-size", dest="ignore_size",
1489
                                  default=False, action="store_true",
1490
                                  help="Ignore current recorded size"
1491
                                  " (useful for forcing activation when"
1492
                                  " the recorded size is wrong)"),
1493
                      ],
1486 1494
                     "<instance>",
1487 1495
                     "Activate an instance's disks"),
1488 1496
  'deactivate-disks': (DeactivateDisks, ARGS_ONE, [DEBUG_OPT, SUBMIT_OPT],

Also available in: Unified diff