def test_format_target(self): """test command line format (MGT)""" tgt = self.fs.new_target(self.srv1, 'mgt', 0, '/dev/root') tgt.full_check(mountdata=False) action = Format(tgt) self.assertEquals(sorted(action.needed_modules()), ['ldiskfs']) self.check_cmd_format(action, '--mgs /dev/root')
def format(self, **kwargs): """ Check the target is correct and not used and format it in Lustre format. """ action = Format(self, **kwargs) if self.journal: action.depends_on(JournalFormat(self.journal, **kwargs)) return action
def test_format_target_ost_bad_network(self): """test command line format (OST with a bad network)""" self.fs.new_target(self.srv1, 'mgt', 0, '/dev/root') tgt = self.fs.new_target(self.srv1, 'ost', 0, '/dev/root', network='bad netw') tgt.add_server(self.srv2) action = Format(tgt) self.assertRaises(ValueError, action._prepare_cmd)
def test_format_target_ost(self): """test command line format (OST)""" self.fs.new_target(self.srv1, 'mgt', 0, '/dev/root') tgt = self.fs.new_target(self.srv2, 'ost', 0, '/dev/root') tgt.full_check(mountdata=False) action = Format(tgt) self.check_cmd_format(action, '--ost --index=0 ' + '"--mgsnode=localhost@tcp" /dev/root')
def test_format_target_mdt_param(self): """test command line format (MDT with param)""" self.fs.new_target(self.srv1, 'mgt', 0, '/dev/root') tgt = self.fs.new_target(self.srv2, 'mdt', 0, '/dev/root') tgt.full_check(mountdata=False) action = Format(tgt, format_params={'mdt': 'foo'}) self.check_cmd_format(action, '--mdt --index=0 ' + '"--mgsnode=localhost@tcp" "--param=foo" /dev/root')
def test_format_target_mdt_mkfsoptions(self): """test command line format (MDT with mkfsoptions)""" self.fs.new_target(self.srv1, 'mgt', 0, '/dev/root') tgt = self.fs.new_target(self.srv2, 'mdt', 0, '/dev/root') tgt.full_check(mountdata=False) action = Format(tgt, mkfs_options={'mdt': '-m 2'}) self.check_cmd_format(action, '--mdt --index=0 ' + '"--mgsnode=localhost@tcp" "--mkfsoptions=-m 2" /dev/root')
def test_format_target_mdt_options(self): """test command line format (MDT with addl options)""" self.fs.new_target(self.srv1, 'mgt', 0, '/dev/root') tgt = self.fs.new_target(self.srv2, 'mdt', 0, '/dev/root') tgt.full_check(mountdata=False) action = Format(tgt, addopts='-v') self.check_cmd_format(action, '--mdt --index=0 ' + '"--mgsnode=localhost@tcp" -v /dev/root')
def test_format_target_loopback(self): """test command line format (MGT in loopback)""" tgt = self.fs.new_target(self.srv1, 'mgt', 0, '/etc/passwd') tgt.full_check(mountdata=False) action = Format(tgt) size = os.stat('/etc/passwd').st_size / 1024 self.check_cmd_format(action, '--mgs --device-size=%d /etc/passwd' % size)
def test_format_target_ost_quota_v24(self): """test command line format v2.4 and above (OST with quota)""" Globals().replace('lustre_version', '2.4') self.fs.new_target(self.srv1, 'mgt', 0, '/dev/root') tgt = self.fs.new_target(self.srv2, 'ost', 0, '/dev/root') tgt.full_check(mountdata=False) action = Format(tgt, quota=True, quota_type='ug') self.check_cmd_format(action, '--ost --index=0 ' + '"--mgsnode=localhost@tcp" /dev/root')
def test_format_target_mdt_striping(self): """test command line format (MDT with striping)""" self.fs.new_target(self.srv1, 'mgt', 0, '/dev/root') tgt = self.fs.new_target(self.srv2, 'mdt', 0, '/dev/root') tgt.full_check(mountdata=False) action = Format(tgt, stripecount=2, stripesize=2097152) self.check_cmd_format(action, '--mdt --index=0 ' + '"--mgsnode=localhost@tcp" --param=lov.stripecount=2 ' + '--param=lov.stripesize=2097152 /dev/root')
def test_format_target_mdt_quota_v2x(self): """test command line format v2.x (MDT with quota)""" Globals().replace('lustre_version', '2.0.0.1') self.fs.new_target(self.srv1, 'mgt', 0, '/dev/root') tgt = self.fs.new_target(self.srv2, 'mdt', 0, '/dev/root') tgt.full_check(mountdata=False) action = Format(tgt, quota=True, quota_type='ug') self.check_cmd_format(action, '--mdt --index=0 ' + '"--mgsnode=localhost@tcp" "--param=mdd.quota_type=ug" /dev/root')
def test_format_target_mdt(self): """test command line format (MDT)""" self.fs.new_target(self.srv1, 'mgt', 0, self.block1) tgt = self.fs.new_target(self.srv2, 'mdt', 0, self.block1) tgt.full_check(mountdata=False) action = Format(tgt) self.check_cmd_format( action, '--mdt --index=0 ' + '"--mgsnode=localhost@tcp" %s' % self.block1)
def test_format_target_jdev(self): """test command line format (MGT with jdev and mkfsoptions)""" jdev = Utils.config_options('noformat_jdev') tgt = self.fs.new_target(self.srv1, 'mgt', 0, '/dev/root', jdev) tgt.full_check(mountdata=False) action = Format(tgt, mkfs_options={'mgt': '-m 2'}) jaction = JournalFormat(tgt.journal) self.check_cmd(jaction, 'mke2fs -q -F -O journal_dev -b 4096 %s' % jdev) self.check_cmd_format(action, '--mgs ' '"--mkfsoptions=-j -J device=%s -m 2" /dev/root' % jdev)
def test_format_target_network_zero(self): """test command line format (network with zero suffix)""" self.fs.new_target(self.srv1, 'mgt', 0, '/dev/root') tgt = self.fs.new_target(self.srv1, 'ost', 0, '/dev/root', network='o2ib0') tgt.add_server(self.srv2) tgt.add_server(Server('localhost3', ['localhost3@o2ib'])) tgt.full_check(mountdata=False) action = Format(tgt) self.check_cmd_format(action, '--ost --index=0 ' + '"--mgsnode=localhost@tcp" "--failnode=localhost3@o2ib" ' + '--network=o2ib0 /dev/root')
def test_format_target_ost_failnodes_network(self): """test command line format (OST with 2 failnodes and network)""" self.fs.new_target(self.srv1, 'mgt', 0, '/dev/root') tgt = self.fs.new_target(self.srv1, 'ost', 0, '/dev/root', network='tcp') tgt.add_server(self.srv2) tgt.add_server(Server('localhost3', ['localhost3@o2ib'])) tgt.full_check(mountdata=False) action = Format(tgt) self.check_cmd_format(action, '--ost --index=0 ' + '"--mgsnode=localhost@tcp" "--failnode=localhost2@tcp" ' + '--network=tcp /dev/root')
def test_format_target_ost_failnode(self): """test command line format (OST with failnode)""" self.fs.new_target(self.srv1, 'mgt', 0, self.block1) tgt = self.fs.new_target(self.srv1, 'ost', 0, self.block1) tgt.add_server(self.srv2) tgt.full_check(mountdata=False) action = Format(tgt) self.check_cmd_format( action, '--ost --index=0 ' + '"--mgsnode=localhost@tcp" "--failnode=localhost2@tcp" %s' % self.block1)