コード例 #1
0
ファイル: nestedfs.py プロジェクト: prasad-joshi/autotest
        def run_once(self):
            logging.info("In run_once function.. ")

            logging.info("Here we will create the pool..")
            disks = libzfs_common.get_free_disks()

            status = libzpool.create(TESTPOOL, disks[0])
            if status != SUCCESS:
	       raise error.TestFail("zpool create failed..")

            logging.info("Create a file system and set its mount point....")

            utils.system("mkdir -p " + TESTDIR)
            libzfs.create(TESTPOOL, fs1)
            libzfs.set_property(TESTPOOL, fs1, "mountpoint", TESTDIR)

            logging.info("Create nested file system..")
            libzfs.create(TESTPOOL, fs2)

            status = libzfs.destroy(TESTPOOL, fs1)
            if status == SUCCESS:
               raise error.TestFail("Parent file system destroyed..")

	    logging.info("The nestedfs test passed successfully..")
            return SUCCESS
コード例 #2
0
      def run_once(self):
          logging.info("In run_once function.. ")

	  disks = libzfs_common.get_free_disks()

          opts = ["none", "none", CPATH, "-", CPATH1, CPATH1]
	  for i in range(0, 5, 2):
              logging.info("create a zpool with cachefile and altroot property..")
	      status = libzpool.create(TESTPOOL, disks[0], cachefile = opts[i],
			               altroot = TESTDIR)
              if status != SUCCESS:
                 raise error.TestFail("zpool create failed..")

	      if opts[i] == "none":
                 status = pool_in_cache(TESTPOOL, CPATH)
                 if status == SUCCESS:
	            raise error.TestFail("pool was in cache..")
              else:
	          status = pool_in_cache(TESTPOOL, opts[i])
                  if status != SUCCESS:
		     raise error.TestFail("pool was not in cache..")

              prop_val = libzpool.get_property(TESTPOOL, "cachefile")
              if prop_val != opts[i + 1]:
	         raise error.TestFail("cachefile property not set as expected..")

              libzpool.destroy(TESTPOOL)

	  logging.info("cachefile_004_pos test passed successfully..")
コード例 #3
0
ファイル: zvol_cli_001.py プロジェクト: prasad-joshi/autotest
      def run_once(self):
          logging.info("In run_once function.. ")
          logging.info("create pool..")
          disks = libzfs_common.get_free_disks()
          version = "1"
          status = libzpool.create(TESTPOOL, disks[0])
          if status != SUCCESS:
             raise error.TestFail("zpool create failed.. ")

          logging.info("create zvol on pool..")
          status = libzfs.create_zvol(TESTPOOL, "2G", TESTVOL)
          if status != SUCCESS:
             raise error.TestFail("cannot create zvol..")

          list_args = ["list", "list -r", "list "+TESTPOOL+"/"+TESTVOL,
                       "list -r "+TESTPOOL+"/"+TESTVOL,
                       "list -H "+TESTPOOL+"/"+TESTVOL,
                       "list -Hr "+TESTPOOL+"/"+TESTVOL,
                       "list -rH "+TESTPOOL+"/"+TESTVOL,
                       "list -o name "+TESTPOOL+"/"+TESTVOL,
                       "list -r -o name "+TESTPOOL+"/"+TESTVOL,
                       "list -H -o name "+TESTPOOL+"/"+TESTVOL,
                       "list -rH -o name "+TESTPOOL+"/"+TESTVOL]

          logging.info("Executing well-formed 'zfs list' commands")
          for i in list_args:
             utils.system("zfs " + i + " > /dev/null")

          logging.info("Executing zfs list on volume works as expected")
コード例 #4
0
ファイル: zvol_cli_003.py プロジェクト: prasad-joshi/autotest
      def run_once(self):
          logging.info("In run_once function.. ")
          logging.info("create pool of version 1.. ")
          disks = libzfs_common.get_free_disks()
          version = "1"
          status = libzpool.create(TESTPOOL, disks[0])
          if status != SUCCESS:
             raise error.TestFail("zpool create failed.. ")

          logging.info("create zvol on pool..")
          status = libzfs.create_zvol(TESTPOOL, "2G", TESTVOL)
          if status != SUCCESS:
             raise error.TestFail("cannot create zvol..")

          list_args = ["", "create -V", "create -V " + TESTPOOL,
                       "create -V " + TESTPOOL + "/" + TESTVOL + "@",
                       "create -V blah", "destroy"]

          logging.info("Try each ZFS volume sub-command without parameters to\
make sure it returns an error.")
          for i in list_args:
             try:
                status = SUCCESS
                utils.system_output("zfs " + i)
             except:
                status = FAIL
             if status == FAIL:
                logging.info("Badly formed ZFS volume sub-commands fail as expected.")
             else:
                raise error.TestFail("ZFS volume sub-commands succeeded unexpectedly.")
コード例 #5
0
ファイル: zvol_cli_002.py プロジェクト: prasad-joshi/autotest
      def run_once(self):
          logging.info("In run_once function.. ")
          logging.info("create pool of version 1.. ")
          disks = libzfs_common.get_free_disks()
          version = "1"
          status = libzpool.create(TESTPOOL, disks[0])
          if status != SUCCESS:
             raise error.TestFail("zpool create failed.. ")

          logging.info("Creating a volume a 50 letter name should work..")
          status = libzfs.create_zvol(TESTPOOL, "2G", LONGVOLNAME)
          if status != SUCCESS:
             raise error.TestFail("failed to create zvol..")

          status = libzfs.dataset_exists(TESTPOOL + "/" + LONGVOLNAME)
          if status != SUCCESS:
             raise error.TestFail("Couldn't find long volume name")

          logging.info("Created a 50-letter zvol volume name")
コード例 #6
0
      def run_once(self):
          logging.info("In run_once function.. ")

	  disks = libzfs_common.get_free_disks()

          opts = ["none", "false", "none", CPATH, "true", "-", CPATH1, "true", CPATH1]
	  for i in range(0, 8, 3):
              logging.info("create a zpool with cachefile property..")

	      status = libzpool.create(TESTPOOL, disks[0], cachefile = opts[i])
              if status != SUCCESS:
                 raise error.TestFail("zpool create failed..")

	      # checking for the pool name in the strings output of
	      # the given cachefile, default is /etc/zfs/zpool.cache
	      if opts[i + 1] == "false":
	         tmp = "strings " + CPATH + " | grep -w " + TESTPOOL
	      else:
	         tmp = "strings " + opts[i] + " | grep -w " + TESTPOOL
	      try:
		 status = SUCCESS
                 utils.system_output(tmp)
              except:
	         status = FAIL

              if status == SUCCESS:
	         if opts[i + 1] != "true":
		    raise error.TestFail("pool was not in cache..")
              else:
		 if opts[i + 1] != "false":
		    raise error.TestFail("pool was in cache..")

              prop_val = libzpool.get_property(TESTPOOL, "cachefile")
              if prop_val != opts[i + 2]:
	         raise error.TestFail("cachefile property not set as expected..")

              libzpool.destroy(TESTPOOL)

	  logging.info("cachefile_001_pos test passed successfully..")
コード例 #7
0
      def run_once(self):
          logging.info("In run_once function.. ")

	  disks = libzfs_common.get_free_disks()

	  logging.info("create a zpool with cachefile property..")
	  status = libzpool.create(TESTPOOL, disks[0], cachefile = "none")
          if status != SUCCESS:
	     raise error.TestFail("zpool create failed..")

          status = pool_in_cache(TESTPOOL, CPATH)
	  if status == SUCCESS:
	     raise error.TestFail("pool was in cache..")

	  libzpool.export_pool(TESTPOOL)
          libzpool.import_pool(TESTPOOL)

          status = pool_in_cache(TESTPOOL, CPATH)
          if status != SUCCESS:
             raise error.TestFail("pool was not in cache..")

          libzpool.export_pool(TESTPOOL)
	  libzpool.import_pool(TESTPOOL, cachefile="none")

	  status = pool_in_cache(TESTPOOL, CPATH)
	  if status == SUCCESS:
	     raise error.TestFail("pool was not in cache..")

          libzpool.export_pool(TESTPOOL)
          libzpool.import_pool(TESTPOOL, cachefile = CPATH1)

	  status = pool_in_cache(TESTPOOL, CPATH1)
	  if status != SUCCESS:
	     raise error.TestFail("pool was not in cache..")

	  logging.info("cachefile_002_pos test passed successfully..")
コード例 #8
0
      def run_once(self):
          logging.info("In run_once function.. ")

	  logging.info("Verify set, export and destroy when cachefile is set on pool.")
          disks = libzfs_common.get_free_disks()

          logging.info("create a zpool with cachefile property..")
          status = libzpool.create(TESTPOOL, disks[0], cachefile = CPATH1)
          if status != SUCCESS:
	     raise error.TestFail("zpool create failed..")

	  status = pool_in_cache(TESTPOOL, CPATH1)
	  if status != SUCCESS:
	     raise error.TestFail("pool was not in cache..")

	  status = libzpool.create(TESTPOOL1, disks[3], cachefile = CPATH1)
	  if status != SUCCESS:
	     raise error.TestFail("zpool create failed..")

          status = pool_in_cache(TESTPOOL1, CPATH1)
	  if status != SUCCESS:
	     raise error.TestFail("pool was not in cache..")

	  status = libzpool.set_property(TESTPOOL, "cachefile", CPATH2)
	  if status != SUCCESS:
	     raise error.TestFail("zpool set property failed..")

          status = pool_in_cache(TESTPOOL, CPATH2)
	  if status != SUCCESS:
	     raise error.TestFail("pool was not in cache..")

	  status = libzpool.set_property(TESTPOOL1, "cachefile", CPATH2)
          if status != SUCCESS:
	     raise error.TestFail("zpool set property failed..")

          status = pool_in_cache(TESTPOOL1, CPATH2)
	  if status != SUCCESS:
	     raise error.TestFail("pool was not in cache..")

	  if os.path.isfile(CPATH1) :
	     raise error.TestFail(CPATH1 + " file still exist..")

	  libzpool.export_pool(TESTPOOL)
	  libzpool.export_pool(TESTPOOL1)

          if os.path.isfile(CPATH2) :
	     raise error.TestFail(CPATH2 + " file still exist..")

	  libzpool.import_pool(TESTPOOL)

          status = libzpool.set_property(TESTPOOL, "cachefile", CPATH2)
	  if status != SUCCESS:
	     raise error.TestFail("zpool set property failed..")

          status = pool_in_cache(TESTPOOL, CPATH2)
	  if status != SUCCESS:
             raise error.TestFail("pool was not in cache..")

          libzpool.import_pool(TESTPOOL1)

          status = libzpool.set_property(TESTPOOL1, "cachefile", CPATH2)
	  if status != SUCCESS:
	     raise error.TestFail("zpool set property failed..")

	  status = pool_in_cache(TESTPOOL1, CPATH2)
          if status != SUCCESS:
             raise error.TestFail("pool was not in cache..")

          libzpool.destroy(TESTPOOL)
          libzpool.destroy(TESTPOOL1)

	  if os.path.isfile(CPATH2):
	     raise error.TestFail(CPATH2 + " file still exist..")

	  logging.info("cachefile_003_pos test passed successfully..")