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")
Exemple #2
0
        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
      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..")
      def run_once(self):
          logging.info("In run_once function.. ")

          logging.info("create zpool of version 1..")
          disks = "/dev/sda1"
          version = "1"
          status = libzpool.create(TESTPOOL, disks, version)
          if status != SUCCESS:
             raise error.TestFail("zpool create failed..")

          logging.info("Verify zpool set version can upgrade a pool..")
          for version in range(1, 29):
              status = libzpool.set_version(TESTPOOL, version)
              if status != SUCCESS:
                 raise error.TestFail("Version not set to expected version..")

              ret_val = libzpool.get_version(TESTPOOL)
              if ret_val != str(version):
                 raise error.TestFail("Version not set to expected version..")

          logging.info("Verify zpool set version should not downgrade the version..")

          for version in range(27, 0, -1):
              status = libzpool.set_version(TESTPOOL, version)
              if status == SUCCESS:
                 raise error.TestFail("version should not downgrade..")

              ret_val = libzpool.get_version(TESTPOOL)
              if ret_val != "28":
                 raise error.TestFail("version should not downgrade..")

          logging.info("Upgrading and downgrading pool version passed..")
      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.")
Exemple #6
0
        def run_once(self):
            logging.info("In run_once function.. ")

            logging.info("Here we will create the pool..")
            disks = "/dev/sda1"
            libzpool.create(TESTPOOL, disks)

            logging.info("Create a file system with mount point, so it will mount automatically..")
            utils.system("mkdir -p " + TESTDIR)
            fs = TESTPOOL + "/" + TESTFS
            libzfs.create(fs)
            libzfs.set_mount_point(TESTDIR,fs)

            status = libzfs.is_mounted(fs)
            if status != SUCCESS :
               raise error.TestFail("File system " + TESTFS +" is not mounted..")

            logging.info("Unmount the file system..")
            libzfs.unmount(fs)

            logging.info("Make sure file system " + fs + " is unmounted..")
            status = libzfs.is_mounted(fs)
            if status == SUCCESS :
               raise error.TestFail("File system " + fs +" is mounted..")

            logging.info("File system " + fs +" is unmounted..")

            logging.info("Here we will mount the file system..")
            fs = TESTPOOL + "/" + TESTFS
            libzfs.mount(fs)

            logging.info("Make sure the file system is mounted..")
            status = libzfs.is_mounted(fs)
            if status != SUCCESS :
               raise error.TestFail("File system " + TESTFS +" is not mounted..")

            logging.info("Unmount the file system..")
            libzfs.unmount(fs)

            logging.info("Make sure the file system is unmounted..")
            status = libzfs.is_mounted(fs)
            if status == SUCCESS :
               raise error.TestFail("File system " + TESTFS +" is  mounted..")

            logging.info("Mount test passed successfully..")
            return SUCCESS
      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")
      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..")
      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..")
      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..")