Revision 8e1db003

b/qa/ganeti-qa.py
160 160
  if qa_config.TestEnabled('node-volumes'):
161 161
    RunTest(qa_node.TestNodeVolumes)
162 162

  
163
  if qa_config.TestEnabled("node-storage"):
164
    RunTest(qa_node.TestNodeStorage)
165

  
163 166
  if qa_rapi.Enabled():
164 167
    RunTest(qa_rapi.TestInstance, instance)
165 168

  
b/qa/qa-sample.json
51 51
    "node-info": true,
52 52
    "node-volumes": true,
53 53
    "node-readd": true,
54
    "node-storage": true,
54 55

  
55 56
    "# This test needs at least three nodes": null,
56 57
    "node-evacuate": false,
......
73 74
    "instance-automatic-restart": false,
74 75
    "instance-consecutive-failures": false,
75 76

  
76
    "# This test might fail with certain hypervisor types, depending on whether": null,
77
    "# they support the `gnt-instance console' command.": null,
77
    "# This test might fail with certain hypervisor types, depending": null,
78
    "# on whether they support the `gnt-instance console' command.": null,
78 79
    "instance-console": false,
79 80

  
80 81
    "# Disabled by default because it takes rather long": null,
81 82
    "instance-replace-disks": false,
82 83

  
83
    "# Make sure not to include the disk(s) required for Dom0 to be included in": null,
84
    "# the volume group used for instances. Otherwise the whole system may stop": null,
85
    "# working until restarted.": null,
84
    "# Make sure not to include the disk(s) required for Dom0 to be": null,
85
    "# included in the volume group used for instances. Otherwise": null,
86
    "# whole system may stop working until restarted.": null,
86 87
    "instance-disk-failure": false
87 88
  },
88 89

  
b/qa/qa_node.py
20 20

  
21 21

  
22 22
from ganeti import utils
23
from ganeti import constants
23 24

  
24 25
import qa_config
25 26
import qa_error
26 27
import qa_utils
27 28

  
28
from qa_utils import AssertEqual, StartSSH
29
from qa_utils import AssertEqual, AssertNotEqual, StartSSH
29 30

  
30 31

  
31 32
def _NodeAdd(node, readd=False):
......
96 97
                       utils.ShellQuoteArgs(cmd)).wait(), 0)
97 98

  
98 99

  
100
def TestNodeStorage():
101
  """gnt-node storage"""
102
  master = qa_config.GetMasterNode()
103

  
104
  for storage_type in constants.VALID_STORAGE_TYPES:
105
    # Test simple list
106
    cmd = ["gnt-node", "list-storage", "--storage-type", storage_type]
107
    AssertEqual(StartSSH(master["primary"],
108
                         utils.ShellQuoteArgs(cmd)).wait(), 0)
109

  
110
    # Test all storage fields
111
    cmd = ["gnt-node", "list-storage", "--storage-type", storage_type,
112
           "--output=%s" % ",".join(list(constants.VALID_STORAGE_FIELDS) +
113
                                    [constants.SF_NODE, constants.SF_TYPE])]
114
    AssertEqual(StartSSH(master["primary"],
115
                         utils.ShellQuoteArgs(cmd)).wait(), 0)
116

  
117
    # Get list of valid storage devices
118
    cmd = ["gnt-node", "list-storage", "--storage-type", storage_type,
119
           "--output=node,name,allocatable", "--separator=|",
120
           "--no-headers"]
121
    output = qa_utils.GetCommandOutput(master["primary"],
122
                                       utils.ShellQuoteArgs(cmd))
123

  
124
    # Test with up to two devices
125
    testdevcount = 2
126

  
127
    for line in output.splitlines()[:testdevcount]:
128
      (node_name, st_name, st_allocatable) = line.split("|")
129

  
130
      # Dummy modification without any changes
131
      cmd = ["gnt-node", "modify-storage", node_name, storage_type, st_name]
132
      AssertEqual(StartSSH(master["primary"],
133
                           utils.ShellQuoteArgs(cmd)).wait(), 0)
134

  
135
      # Make sure we end up with the same value as before
136
      if st_allocatable.lower() == "y":
137
        test_allocatable = ["no", "yes"]
138
      else:
139
        test_allocatable = ["yes", "no"]
140

  
141
      if (constants.SF_ALLOCATABLE in
142
          constants.MODIFIABLE_STORAGE_FIELDS.get(storage_type, [])):
143
        assert_fn = AssertEqual
144
      else:
145
        assert_fn = AssertNotEqual
146

  
147
      for i in test_allocatable:
148
        cmd = ["gnt-node", "modify-storage", "--allocatable", i,
149
               node_name, storage_type, st_name]
150
        assert_fn(StartSSH(master["primary"],
151
                  utils.ShellQuoteArgs(cmd)).wait(), 0)
152

  
153
      # Test repair functionality
154
      cmd = ["gnt-node", "repair-storage", node_name, storage_type, st_name]
155

  
156
      if (constants.SO_FIX_CONSISTENCY in
157
          constants.VALID_STORAGE_OPERATIONS.get(storage_type, [])):
158
        assert_fn = AssertEqual
159
      else:
160
        assert_fn = AssertNotEqual
161

  
162
      assert_fn(StartSSH(master["primary"],
163
                         utils.ShellQuoteArgs(cmd)).wait(), 0)
164

  
165

  
99 166
def TestNodeFailover(node, node2):
100 167
  """gnt-node failover"""
101 168
  master = qa_config.GetMasterNode()

Also available in: Unified diff