Revision 61a980a9

b/lib/cmdlib.py
7872 7872

  
7873 7873
    if instance.name not in node_insts.payload:
7874 7874
      if instance.admin_up:
7875
        state = "ERROR_down"
7875
        state = constants.INSTST_ERRORDOWN
7876 7876
      else:
7877
        state = "ADMIN_down"
7877
        state = constants.INSTST_ADMINDOWN
7878 7878
      raise errors.OpExecError("Instance %s is not running (state %s)" %
7879 7879
                               (instance.name, state))
7880 7880

  
b/lib/constants.py
861 861
NV_VMNODES = "vmnodes"
862 862
NV_OOB_PATHS = "oob-paths"
863 863

  
864
# Instance status
865
INSTST_RUNNING = "running"
866
INSTST_ADMINDOWN = "ADMIN_down"
867
INSTST_NODEOFFLINE = "ERROR_nodeoffline"
868
INSTST_NODEDOWN = "ERROR_nodedown"
869
INSTST_WRONGNODE = "ERROR_wrongnode"
870
INSTST_ERRORUP = "ERROR_up"
871
INSTST_ERRORDOWN = "ERROR_down"
872
INSTST_ALL = frozenset([
873
  INSTST_RUNNING,
874
  INSTST_ADMINDOWN,
875
  INSTST_NODEOFFLINE,
876
  INSTST_NODEDOWN,
877
  INSTST_WRONGNODE,
878
  INSTST_ERRORUP,
879
  INSTST_ERRORDOWN,
880
  ])
881

  
864 882
# SSL certificate check constants (in days)
865 883
SSL_CERT_EXPIRATION_WARN = 30
866 884
SSL_CERT_EXPIRATION_ERROR = 7
b/lib/query.py
779 779

  
780 780
  """
781 781
  if inst.primary_node in ctx.offline_nodes:
782
    return "ERROR_nodeoffline"
782
    return constants.INSTST_NODEOFFLINE
783 783

  
784 784
  if inst.primary_node in ctx.bad_nodes:
785
    return "ERROR_nodedown"
785
    return constants.INSTST_NODEDOWN
786 786

  
787 787
  if bool(ctx.live_data.get(inst.name)):
788 788
    if inst.name in ctx.wrongnode_inst:
789
      return "ERROR_wrongnode"
789
      return constants.INSTST_WRONGNODE
790 790
    elif inst.admin_up:
791
      return "running"
791
      return constants.INSTST_RUNNING
792 792
    else:
793
      return "ERROR_up"
793
      return constants.INSTST_ERRORUP
794 794

  
795 795
  if inst.admin_up:
796
    return "ERROR_down"
796
    return constants.INSTST_ERRORDOWN
797 797

  
798
  return "ADMIN_down"
798
  return constants.INSTST_ADMINDOWN
799 799

  
800 800

  
801 801
def _GetInstDiskSize(index):
b/lib/watcher/__init__.py
62 62
# 5 minutes, so it takes around half an hour to exceed the retry
63 63
# counter, so 8 hours (16*1/2h) seems like a reasonable reset time
64 64
RETRY_EXPIRATION = 8 * 3600
65
BAD_STATES = ['ERROR_down']
66
HELPLESS_STATES = ['ERROR_nodedown', 'ERROR_nodeoffline']
65
BAD_STATES = [constants.INSTST_ERRORDOWN]
66
HELPLESS_STATES = [constants.INSTST_NODEDOWN, constants.INSTST_NODEOFFLINE]
67 67
NOTICE = 'NOTICE'
68 68
ERROR = 'ERROR'
69 69
KEY_RESTART_COUNT = "restart_count"
b/test/ganeti.query_unittest.py
743 743
                       (constants.RS_NORMAL, inst.name))
744 744

  
745 745
      if inst.primary_node in offline_nodes:
746
        exp_status = "ERROR_nodeoffline"
746
        exp_status = constants.INSTST_NODEOFFLINE
747 747
      elif inst.primary_node in bad_nodes:
748
        exp_status = "ERROR_nodedown"
748
        exp_status = constants.INSTST_NODEDOWN
749 749
      elif inst.name in live_data:
750 750
        if inst.name in wrongnode_inst:
751
          exp_status = "ERROR_wrongnode"
751
          exp_status = constants.INSTST_WRONGNODE
752 752
        elif inst.admin_up:
753
          exp_status = "running"
753
          exp_status = constants.INSTST_RUNNING
754 754
        else:
755
          exp_status = "ERROR_up"
755
          exp_status = constants.INSTST_ERRORUP
756 756
      elif inst.admin_up:
757
        exp_status = "ERROR_down"
757
        exp_status = constants.INSTST_ERRORDOWN
758 758
      else:
759
        exp_status = "ADMIN_down"
759
        exp_status = constants.INSTST_ADMINDOWN
760 760

  
761 761
      self.assertEqual(row[fieldidx["status"]],
762 762
                       (constants.RS_NORMAL, exp_status))
......
830 830
      self._CheckInstanceConsole(inst, row[fieldidx["console"]])
831 831

  
832 832
    # Ensure all possible status' have been tested
833
    self.assertEqual(tested_status,
834
                     set(["ERROR_nodeoffline", "ERROR_nodedown",
835
                          "running", "ERROR_up", "ERROR_down",
836
                          "ADMIN_down", "ERROR_wrongnode"]))
833
    self.assertEqual(tested_status, constants.INSTST_ALL)
837 834

  
838 835
  def _CheckInstanceConsole(self, instance, (status, consdata)):
839 836
    if instance.name == "inst7":

Also available in: Unified diff