Revision 57de31c0 lib/cmdlib.py

b/lib/cmdlib.py
10982 10982

  
10983 10983
  def CheckArguments(self):
10984 10984
    if not (self.op.nics or self.op.disks or self.op.disk_template or
10985
            self.op.hvparams or self.op.beparams or self.op.os_name):
10985
            self.op.hvparams or self.op.beparams or self.op.os_name or
10986
            self.op.online_inst or self.op.offline_inst):
10986 10987
      raise errors.OpPrereqError("No changes submitted", errors.ECODE_INVAL)
10987 10988

  
10988 10989
    if self.op.hvparams:
......
11449 11450
                                     (disk_op, len(instance.disks)),
11450 11451
                                     errors.ECODE_INVAL)
11451 11452

  
11453
    # disabling the instance
11454
    if self.op.offline_inst:
11455
      _CheckInstanceState(self, instance, INSTANCE_DOWN,
11456
                          msg="cannot change instance state to offline")
11457

  
11458
    # enabling the instance
11459
    if self.op.online_inst:
11460
      _CheckInstanceState(self, instance, INSTANCE_OFFLINE,
11461
                          msg="cannot make instance go online")
11462

  
11452 11463
  def _ConvertPlainToDrbd(self, feedback_fn):
11453 11464
    """Converts an instance from plain to drbd.
11454 11465

  
......
11709 11720
      for key, val in self.op.osparams.iteritems():
11710 11721
        result.append(("os/%s" % key, val))
11711 11722

  
11723
    # online/offline instance
11724
    if self.op.online_inst:
11725
      self.cfg.MarkInstanceDown(instance.name)
11726
      result.append(("admin_state", constants.ADMINST_DOWN))
11727
    if self.op.offline_inst:
11728
      self.cfg.MarkInstanceOffline(instance.name)
11729
      result.append(("admin_state", constants.ADMINST_OFFLINE))
11730

  
11712 11731
    self.cfg.Update(instance, feedback_fn)
11713 11732

  
11714 11733
    assert not (self.owned_locks(locking.LEVEL_NODE_RES) or

Also available in: Unified diff