Commit 537dba0c authored by Raffa Santi's avatar Raffa Santi Committed by Thomas Thrainer
Browse files

Add tests specific to the user/kernelspace access feature



Check that the validation procedures don't accept invalid values
and also don't choke on valid values.
Signed-off-by: default avatarSanti Raffa <rsanti@google.com>
Reviewed-by: default avatarThomas Thrainer <thomasth@google.com>
parent 294254b1
......@@ -446,6 +446,24 @@ class TestLUClusterSetParams(CmdlibTestCase):
self.ExecOpCode(op)
self.assertEqual(diskparams, self.cluster.diskparams)
def testValidDiskparamsAccess(self):
for value in constants.DISK_VALID_ACCESS_MODES:
self.ResetMocks()
op = opcodes.OpClusterSetParams(diskparams={
constants.DT_RBD: {constants.RBD_ACCESS: value}
})
self.ExecOpCode(op)
got = self.cluster.diskparams[constants.DT_RBD][constants.RBD_ACCESS]
self.assertEqual(value, got)
def testInvalidDiskparamsAccess(self):
for value in ["default", "pinky_bunny"]:
self.ResetMocks()
op = opcodes.OpClusterSetParams(diskparams={
constants.DT_RBD: {constants.RBD_ACCESS: value}
})
self.ExecOpCodeExpectOpPrereqError(op, "Invalid value of 'rbd:access'")
def testUnsetDrbdHelperWithDrbdDisks(self):
self.cfg.AddNewInstance(disks=[
self.cfg.CreateDisk(dev_type=constants.DT_DRBD8, create_nodes=True)])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment