Esempio n. 1
0
 def run(self):
     # Wait for the filesystem that is being monitored to exist.
     while not ZfsApi.fs_exists(self.filesystem):
         time.sleep(1)
     while True:
         time.sleep(1)
         self.size_ma.insert_value(ZfsApi.get_filesystem_size(self.filesystem))
         result_string = ""
         for size_delta,diff in self.size_ma.get_diffs():
             size_diff_in_bytes = float(diff)/size_delta
             size_diff_in_mib = Common.bytes_to_mebibyte(size_diff_in_bytes)
             reasonable_string = '%.3f' % size_diff_in_mib
             result_string = result_string + reasonable_string.rjust(9)
         print("Average speed in mib/sec")
         print(result_string)
Esempio n. 2
0
def check_pool_exists():
    """The config file specifies a pool that the testing will be happening on,
    make sure that the pool exists"""
    if not ZfsApi.zpool_exists(Configs.main_pool):
        print("The main pool in config.cfg is " + Configs.main_pool +
              " however no pool by that name was found. Is your pool setup?")
        sys.exit(1)
Esempio n. 3
0
def check_pool_exists():
    """The config file specifies a pool that the testing will be happening on,
    make sure that the pool exists"""
    if not ZfsApi.zpool_exists(Configs.main_pool):
        print("The main pool in config.cfg is " + Configs.main_pool +
            " however no pool by that name was found. Is your pool setup?")
        sys.exit(1)
Esempio n. 4
0
 def print_stats_to_file(self):
     """Since the stats collected at the begingng and end of a run are the
     same, they can be collapsed into a single function"""
     current_time = time.time()
     self.log("time: " + str(current_time))
     current_txg = ZfsApi.get_current_txg(Configs.main_pool)
     self.log("TXG: " + str(current_txg))
     # If the filesystem does not exist, its size is 0.
     if ZfsApi.fs_exists(self.filesystem):
         current_size = ZfsApi.get_filesystem_size(self.filesystem)
         self.log("size: " + str(current_size))
     else:
         self.log("size: 0")
     self.log("zpool iostat -v:")
     self.log(subprocess.check_output(["zpool", "iostat", "-v"]))
     self.log("zpool status:")
     self.log(subprocess.check_output(["zpool", "status"]))
Esempio n. 5
0
 def print_stats_to_file(self):
     """Since the stats collected at the begingng and end of a run are the
     same, they can be collapsed into a single function"""
     current_time = time.time()
     self.log("time: " + str(current_time))
     current_txg = ZfsApi.get_current_txg(Configs.main_pool)
     self.log("TXG: " + str(current_txg))
     # If the filesystem does not exist, its size is 0.
     if ZfsApi.fs_exists(self.filesystem):
         current_size = ZfsApi.get_filesystem_size(self.filesystem)
         self.log("size: " + str(current_size))
     else:
         self.log("size: 0")
     self.log("zpool iostat -v:")
     self.log(subprocess.check_output(['zpool', 'iostat', '-v']))
     self.log("zpool status:")
     self.log(subprocess.check_output(['zpool', 'status']))
Esempio n. 6
0
def setup_system():
    # This function will setup the zfs filesystems, it does not perform
    # any checks, call it when you know this machine needs to be set up
    subprocess.check_call(['zfs', 'create', '-p',
        Configs.test_filesystem_path,
        '-o', "mountpoint=" + Configs.mount_point])
    # Create the corpus directory, currently setting primarycahce=none
    # since not doing so results in abnormalities in test timing. I
    # think this will become especially useful when this process
    # becomes multithreaded.
    subprocess.check_call(['zfs', 'create',
        Configs.test_filesystem_path + '/corpus',
        '-o', 'primarycache=none'])
    # Create the area for test runs to go. I keep this in a separate
    # area to ensure that cleanup is easy
    ZfsApi.create_filesystem(Configs.test_filesystem_path + '/runs')
    # Create the log directory, and its two sub directories
    ZfsApi.create_filesystem(Configs.test_filesystem_path + '/logs')
    # The two sub directories are not zfs filesystems
    os.mkdir(Configs.results_directory)
    os.mkdir(Configs.stats_directory)
Esempio n. 7
0
def setup_system():
    # This function will setup the zfs filesystems, it does not perform
    # any checks, call it when you know this machine needs to be set up
    subprocess.check_call([
        'zfs', 'create', '-p', Configs.test_filesystem_path, '-o',
        "mountpoint=" + Configs.mount_point
    ])
    # Create the corpus directory, currently setting primarycahce=none
    # since not doing so results in abnormalities in test timing. I
    # think this will become especially useful when this process
    # becomes multithreaded.
    subprocess.check_call([
        'zfs', 'create', Configs.test_filesystem_path + '/corpus', '-o',
        'primarycache=none'
    ])
    # Create the area for test runs to go. I keep this in a separate
    # area to ensure that cleanup is easy
    ZfsApi.create_filesystem(Configs.test_filesystem_path + '/runs')
    # Create the log directory, and its two sub directories
    ZfsApi.create_filesystem(Configs.test_filesystem_path + '/logs')
    # The two sub directories are not zfs filesystems
    os.mkdir(Configs.results_directory)
    os.mkdir(Configs.stats_directory)
Esempio n. 8
0
 def run(self):
     ZfsApi.zfs_recv(self.sendfile, self.filesystem)
Esempio n. 9
0
 def run(self):
     ZfsApi.zfs_recv(self.sendfile, self.filesystem)
Esempio n. 10
0
def receive_file(zfs_filesystem):
    ZfsApi.zfs_recv(Configs.test_file_full_path, zfs_filesystem)
Esempio n. 11
0
        choices=xrange(1,32),
        help="The number of concurrent receives to perform")
args = parser.parse_args()

# Use TestConfig to ensure this computer is set up properly
TestConfig.check_all()
# This test case will use the test send file, check that it will work
TestConfig.check_testfile()

Pid.create_pid_file()

# Establish where this test will be writing its output
current_min = time.strftime("%Y%m%d%H%M%S")
zfs_receive_path = Configs.test_filesystem_path + '/runs/' + current_min

start_txg = ZfsApi.get_current_txg(Configs.main_pool)

results_collector = Results.ResultsCollector(zfs_receive_path)
results_collector.gather_start_results()

if args.verbose:
    monitor_thread = MonitorThread.MonitorThread(zfs_receive_path)
    monitor_thread.start()

# Create the base FS that each thread will be receiveing into sub filesystem
ZfsApi.create_filesystem(zfs_receive_path)

start_time = time.time()

def receive_file(zfs_filesystem):
    ZfsApi.zfs_recv(Configs.test_file_full_path, zfs_filesystem)
Esempio n. 12
0
def receive_file(zfs_filesystem):
    ZfsApi.zfs_recv(Configs.test_file_full_path, zfs_filesystem)
Esempio n. 13
0
    "-t", "--threads", type=int, default=4, choices=xrange(1, 32), help="The number of concurrent receives to perform"
)
args = parser.parse_args()

# Use TestConfig to ensure this computer is set up properly
TestConfig.check_all()
# This test case will use the test send file, check that it will work
TestConfig.check_testfile()

Pid.create_pid_file()

# Establish where this test will be writing its output
current_min = time.strftime("%Y%m%d%H%M%S")
zfs_receive_path = Configs.test_filesystem_path + "/runs/" + current_min

start_txg = ZfsApi.get_current_txg(Configs.main_pool)

results_collector = Results.ResultsCollector(zfs_receive_path)
results_collector.gather_start_results()

if args.verbose:
    monitor_thread = MonitorThread.MonitorThread(zfs_receive_path)
    monitor_thread.start()

# Create the base FS that each thread will be receiveing into sub filesystem
ZfsApi.create_filesystem(zfs_receive_path)

start_time = time.time()


def receive_file(zfs_filesystem):