def test_target_index_nodes_failover(self): # shine -f param -t ost -n foo2 -F foo3 -i 3 fsconf, fs = open_lustrefs(self.fsconf.get_fs_name(), target_types='ost', nodes=NodeSet('foo3'), failover=NodeSet('foo3'), indexes=RangeSet('1')) comps = self.complist(fs) self.assertEqual(len(comps), 1) self.assert_comp(comps[0], OST.TYPE, 1, "/dev/sdd")
def test_label(self): # shine -f param -l param-MDT0000 fsconf, fs = open_lustrefs(self.fsconf.get_fs_name(), labels=NodeSet("param-MDT0000")) comps = self.complist(fs) self.assertEqual(len(comps), 1) self.assert_comp(comps[0], MDT.TYPE, 0)
def test_target_index_unknown_failover(self): # shine -f param -t ost -i 1 -F foo5 fsconf, fs = open_lustrefs(self.fsconf.get_fs_name(), target_types='ost', failover=NodeSet('foo5'), indexes=RangeSet("1")) comps = self.complist(fs) self.assertEqual(len(comps), 0)
def test_nodes_target(self): # shine -f param -t ost -n foo2 fsconf, fs = open_lustrefs(self.fsconf.get_fs_name(), target_types='ost', nodes=NodeSet('foo2')) comps = self.complist(fs) self.assertEqual(len(comps), 2) self.assert_comp(comps[0], OST.TYPE, 0, "/dev/sdc") self.assert_comp(comps[1], OST.TYPE, 1, "/dev/sdd")
def test_target_index_failover(self): # shine -f param -t ost -i 1 -F foo2 fsconf, fs = open_lustrefs(self.fsconf.get_fs_name(), target_types='ost', failover=NodeSet('foo2')) comps = self.complist(fs) self.assertEqual(len(comps), 2) self.assert_comp(comps[0], OST.TYPE, 2, "/dev/sdc") self.assert_comp(comps[1], OST.TYPE, 3, "/dev/sdd")
def test_exclude(self): # shine -f param -x foo[3,5,8-10] fsconf, fs = open_lustrefs(self.fsconf.get_fs_name(), excluded=NodeSet("foo[3,5,8-10]")) comps = self.complist(fs) self.assertEqual(len(comps), 9) self.assertEqual(comps[0].TYPE, Client.TYPE) self.assertEqual(comps[1].TYPE, MDT.TYPE) self.assertEqual(comps[2].TYPE, MGT.TYPE) self.assert_comp(comps[3], OST.TYPE, None, "/dev/sdc") self.assert_comp(comps[4], OST.TYPE, None, "/dev/sdd") self.assert_comp(comps[5], OST.TYPE, None, "/dev/sde") self.assert_comp(comps[6], OST.TYPE, None, "/dev/sdf") self.assertEqual(comps[7].TYPE, Router.TYPE) self.assertEqual(comps[8].TYPE, Router.TYPE)
def test_action_enabled_nodes(self): # shine failover extended selection with nodes fsconf, fs = open_lustrefs(self.fsconf.get_fs_name(), nodes=NodeSet("foo[1,3]"), extended=True) comps = self.complist(fs) self.assertEqual(len(comps), 6) self.assertEqual(comps[0].TYPE, MDT.TYPE) self.assertEqual(comps[1].TYPE, MGT.TYPE) self.assert_comp(comps[2], OST.TYPE, None, "/dev/sdc") self.assert_comp(comps[3], OST.TYPE, None, "/dev/sdd") self.assert_comp(comps[4], OST.TYPE, None, "/dev/sdc") self.assert_comp(comps[5], OST.TYPE, None, "/dev/sdd") self.assertTrue(comps[0].server.action_enabled) self.assertTrue(comps[1].server.action_enabled) self.assertFalse(comps[2].server.action_enabled) self.assertFalse(comps[3].server.action_enabled) self.assertTrue(comps[4].server.action_enabled) self.assertTrue(comps[5].server.action_enabled)
def test_action_enabled_exclude(self): # shine failover extended selection with exclude fsconf, fs = open_lustrefs(self.fsconf.get_fs_name(), excluded=NodeSet("foo[1,2-5,9-11]"), extended=True) comps = self.complist(fs) self.assertEqual(len(comps), 7) self.assertEqual(comps[0].TYPE, Client.TYPE) self.assert_comp(comps[1], OST.TYPE, None, "/dev/sde") self.assert_comp(comps[2], OST.TYPE, None, "/dev/sdf") self.assert_comp(comps[3], OST.TYPE, None, "/dev/sde") self.assert_comp(comps[4], OST.TYPE, None, "/dev/sdf") self.assertEqual(comps[5].TYPE, Router.TYPE) self.assertEqual(comps[6].TYPE, Router.TYPE) self.assertTrue(comps[0].server.action_enabled) self.assertFalse(comps[1].server.action_enabled) self.assertFalse(comps[2].server.action_enabled) self.assertTrue(comps[3].server.action_enabled) self.assertTrue(comps[4].server.action_enabled) self.assertTrue(comps[5].server.action_enabled)