Beispiel #1
0
    def test_start_target_mount_options_none(self):
        """test command line start target (mount_options missing)"""
        tgt = self.fs.new_target(self.srv1, 'mgt', 0, '/dev/root')
        tgt.full_check(mountdata=False)
        action = StartTarget(tgt, mount_options={'mdt': 'abort_recov'})
        self.check_cmd(action,
               'mkdir -p "/mnt/action/mgt/0" && ' +
               '/bin/mount -t lustre /dev/root /mnt/action/mgt/0')

        action = StartTarget(tgt, mount_options={'mgt': None})
        self.check_cmd(action,
               'mkdir -p "/mnt/action/mgt/0" && ' +
               '/bin/mount -t lustre /dev/root /mnt/action/mgt/0')
Beispiel #2
0
 def test_start_target_mount_paths(self):
     """test command line start target (mount paths)"""
     tgt = self.fs.new_target(self.srv1, 'mgt', 0, '/dev/root')
     tgt.full_check(mountdata=False)
     action = StartTarget(tgt, mount_paths={'mgt': '/mnt/mypath'})
     self.check_cmd(action,
             'mkdir -p "/mnt/mypath" && ' +
             '/bin/mount -t lustre /dev/root /mnt/mypath')
Beispiel #3
0
 def test_start_target_file_device(self):
     """test command line start target (file device)"""
     tgt = self.fs.new_target(self.srv1, 'mgt', 0, '/etc/passwd')
     tgt.full_check(mountdata=False)
     action = StartTarget(tgt)
     self.check_cmd(action,
             'mkdir -p "/mnt/action/mgt/0" && ' +
             '/bin/mount -t lustre -o loop /etc/passwd /mnt/action/mgt/0')
Beispiel #4
0
 def test_start_target_addopts(self):
     """test command line start target (addl options)"""
     tgt = self.fs.new_target(self.srv1, 'mgt', 0, '/dev/root')
     tgt.full_check(mountdata=False)
     action = StartTarget(tgt, addopts='abort_recov')
     self.check_cmd(action,
            'mkdir -p "/mnt/action/mgt/0" && ' +
            '/bin/mount -t lustre -o abort_recov /dev/root /mnt/action/mgt/0')
Beispiel #5
0
 def test_start_target(self):
     """test command line start target"""
     tgt = self.fs.new_target(self.srv1, 'mgt', 0, '/dev/root')
     tgt.full_check(mountdata=False)
     action = StartTarget(tgt)
     self.check_cmd(action,
             'mkdir -p "/mnt/action/mgt/0" && ' +
             '/bin/mount -t lustre /dev/root /mnt/action/mgt/0')
Beispiel #6
0
 def test_start_target_mount_options(self):
     """test command line start target (mount_options)"""
     tgt = self.fs.new_target(self.srv1, 'mgt', 0, self.block1)
     tgt.full_check(mountdata=False)
     action = StartTarget(tgt, mount_options={'mgt': 'abort_recov'})
     self.check_cmd(
         action, 'mkdir -p "/mnt/action/mgt/0" && ' +
         '/bin/mount -t lustre -o abort_recov %s /mnt/action/mgt/0' %
         self.block1)
Beispiel #7
0
    def test_start_target_custom_mount_paths(self):
        """test command line start target (custom mount paths)"""
        tgt = self.fs.new_target(self.srv1, 'mgt', 0, self.block1)
        tgt.full_check(mountdata=False)

        # fs_name
        action = StartTarget(tgt, mount_paths={'mgt': '/mnt/$fs_name/mgt'})
        self.check_cmd(
            action, 'mkdir -p "/mnt/action/mgt" && ' +
            '/bin/mount -t lustre %s /mnt/action/mgt' % self.block1)
        # index
        action = StartTarget(tgt, mount_paths={'mgt': '/mnt/mgt/$index'})
        self.check_cmd(
            action, 'mkdir -p "/mnt/mgt/0" && ' +
            '/bin/mount -t lustre %s /mnt/mgt/0' % self.block1)
        # type
        action = StartTarget(tgt, mount_paths={'mgt': '/mnt/$type/$index'})
        self.check_cmd(
            action, 'mkdir -p "/mnt/mgt/0" && ' +
            '/bin/mount -t lustre %s /mnt/mgt/0' % self.block1)
        # label
        action = StartTarget(tgt, mount_paths={'mgt': '/mnt/$label'})
        self.check_cmd(
            action, 'mkdir -p "/mnt/MGS"' +
            ' && /bin/mount -t lustre %s /mnt/MGS' % self.block1)
        # dev
        action = StartTarget(tgt, mount_paths={'mgt': '/mnt/$fs_name-$dev'})
        loopname = self.block1[self.block1.rindex('/') + 1:]
        self.check_cmd(
            action, 'mkdir -p "/mnt/action-%s"' % loopname +
            ' && /bin/mount -t lustre %s /mnt/action-%s' %
            (self.block1, loopname))
        # No jdev
        action = StartTarget(tgt, mount_paths={'mgt': '/mnt/$fs_name-$jdev'})
        self.check_cmd(
            action, 'mkdir -p "/mnt/action-$jdev"' +
            ' && /bin/mount -t lustre %s /mnt/action-$jdev' % self.block1)

        # Bad variable, leave it as-is
        action = StartTarget(tgt, mount_paths={'mgt': '/mnt/$bad'})
        self.check_cmd(
            action, 'mkdir -p "/mnt/$bad" && ' +
            '/bin/mount -t lustre %s /mnt/$bad' % self.block1)

        # jdev
        dirname = self.block2[self.block2.rfind('/') + 1:]
        majorminor = os.stat(self.block2).st_rdev
        tgt = self.fs.new_target(self.srv1, 'mdt', 0, self.block1, self.block2)
        tgt.full_check(mountdata=False)
        action = StartTarget(tgt, mount_paths={'mdt': '/mnt/$jdev'})
        self.check_cmd(
            action, 'mkdir -p "/mnt/%s" && ' % dirname +
            '/bin/mount -t lustre -o journal_dev=%#x ' % majorminor +
            '%s /mnt/%s' % (self.block1, dirname))
Beispiel #8
0
    def test_start_target_jdev(self):
        """test command line start target (with journal)"""
        dev = Utils.config_options('noformat_dev')
        jdev = Utils.config_options('noformat_jdev')
        majorminor = os.stat(jdev).st_rdev

        tgt = self.fs.new_target(self.srv1, 'mgt', 0, dev, jdev)
        tgt.full_check(mountdata=False)
        action = StartTarget(tgt)
        self.check_cmd(action,
          'mkdir -p "/mnt/action/mgt/0" && ' +
          '/bin/mount -t lustre -o journal_dev=%#x %s /mnt/action/mgt/0' %
          (majorminor, dev))
Beispiel #9
0
    def setUp(self):
        self.fs = FileSystem('proxy')
        self.srv1 = Server(Utils.HOSTNAME, ["%s@tcp" % Utils.HOSTNAME])
        disk = Utils.makeTempFilename()
        self.tgt = self.fs.new_target(self.srv1, 'mgt', 0, disk)

        self.act = self.fs._proxy_action('start', self.srv1.hostname,
                                         self.fs.components)
        self.info = StartTarget(self.tgt).info()

        def fakeprepare(action):
            return [action.fakecmd]

        self.act._prepare_cmd = types.MethodType(fakeprepare, self.act)
Beispiel #10
0
    def test_start_target_custom_mount_paths(self):
        """test command line start target (custom mount paths)"""
        tgt = self.fs.new_target(self.srv1, 'mgt', 0, '/dev/root')
        tgt.full_check(mountdata=False)

        # fs_name
        action = StartTarget(tgt, mount_paths={'mgt': '/mnt/$fs_name/mgt'})
        self.check_cmd(action,
                'mkdir -p "/mnt/action/mgt" && ' +
                '/bin/mount -t lustre /dev/root /mnt/action/mgt')
        # index
        action = StartTarget(tgt, mount_paths={'mgt': '/mnt/mgt/$index'})
        self.check_cmd(action,
                'mkdir -p "/mnt/mgt/0" && ' +
                '/bin/mount -t lustre /dev/root /mnt/mgt/0')
        # type
        action = StartTarget(tgt, mount_paths={'mgt': '/mnt/$type/$index'})
        self.check_cmd(action,
                'mkdir -p "/mnt/mgt/0" && ' +
                '/bin/mount -t lustre /dev/root /mnt/mgt/0')
        # label
        action = StartTarget(tgt, mount_paths={'mgt': '/mnt/$label'})
        self.check_cmd(action, 'mkdir -p "/mnt/MGS"' +
                               ' && /bin/mount -t lustre /dev/root /mnt/MGS')
        # dev
        action = StartTarget(tgt, mount_paths={'mgt': '/mnt/$fs_name-$dev'})
        self.check_cmd(action, 'mkdir -p "/mnt/action-root"' +
                        ' && /bin/mount -t lustre /dev/root /mnt/action-root')
        # No jdev
        action = StartTarget(tgt, mount_paths={'mgt': '/mnt/$fs_name-$jdev'})
        self.check_cmd(action, 'mkdir -p "/mnt/action-$jdev"' +
                        ' && /bin/mount -t lustre /dev/root /mnt/action-$jdev')

        # Bad variable, leave it as-is
        action = StartTarget(tgt, mount_paths={'mgt': '/mnt/$bad'})
        self.check_cmd(action,
                'mkdir -p "/mnt/$bad" && ' +
                '/bin/mount -t lustre /dev/root /mnt/$bad')

        # jdev
        tgt = self.fs.new_target(self.srv1, 'mdt', 0, '/dev/root', '/dev/loop0')
        tgt.full_check(mountdata=False)
        action = StartTarget(tgt, mount_paths={'mdt': '/mnt/$jdev'})
        self.check_cmd(action, 'mkdir -p "/mnt/loop0" && ' +
              '/bin/mount -t lustre -o journal_dev=0x700 /dev/root /mnt/loop0')
Beispiel #11
0
 def start(self, **kwargs):
     """Start the local Target and check for system sanity."""
     return StartTarget(self, **kwargs)
Beispiel #12
0
 def test_start_target_modules_v2_5x(self):
     Globals().replace('lustre_version', '2.5')
     tgt = self.fs.new_target(self.srv1, 'mgt', 0, '/dev/root')
     action = StartTarget(tgt)
     self.assertEquals(sorted(action.needed_modules()),
                       ['ldiskfs', 'lustre'])
Beispiel #13
0
 def test_start_target_modules_v2_4x(self):
     Globals().replace('lustre_version', '2.4')
     tgt = self.fs.new_target(self.srv1, 'mgt', 0, self.block1)
     action = StartTarget(tgt)
     self.assertEqual(sorted(action.needed_modules()),
                      ['fsfilt_ldiskfs', 'lustre'])