Example #1
0
	def setUp(self):
		self.z = pyzfs.z(False)
Example #2
0
#! /usr/site/bin/python
import sys
import pyzfs
fsname=str(sys.argv[1])
a=pyzfs.z(True) # argument is "should I spew debug"

def test_one(fsname):
	print " Python starting test one: open filesystems"
	for fs in [fsname, 'rpool', 'filesystemthatdoesntexist']:
		print "=================================="
		print " Python: Opening fs \"%s\"" % (fs)
		try:
			print dir(pyzfs.zfs.types)
			b=a.open_fs(fs, pyzfs.zfs.types.filesystem | pyzfs.zfs.types.snapshot | pyzfs.zfs.types.volume)
			print " Python: %s is of type %s" % (b.name(), b.type())
			print " Python: Quota for %s is %s" % (b.name(), bytestonice(b.quota()))
			print " Python: Origin for %s is %s" % (b.name(), b.origin())
			print " Python: Mounted for %s is %s" % (b.name(), b.mounted())
			print " Python: Compressratio for %s is %s" % (b.name(), b.compressratio())
			print " Python: Referenced for %s is %s" % (b.name(), bytestonice(b.referenced()))
			print " Python: Available for %s is %s" % (b.name(), bytestonice(b.available()))
			print " Python: Used for %s is %s" % (b.name(), bytestonice(b.used()))
			print " Python: Creation time for %s is %s" % (b.name(), b.creation())
			del(b)
		except RuntimeError, e:
			print " Python error raised: %s" % e
def test_two(poolname):
	print " Python starting test two: open pools"
	for pool in [poolname, 'poolthatdoesntexist']:
		print "=================================="
		print " Python: Opening pool \"%s\"" % (pool)
Example #3
0
	def setUp(self):
		self.z = pyzfs.z(False) # argument is "should I spew debug"
		self.outfile = open("/tmp/teststream", "w+b") #tempfile.NamedTemporaryFile()
Example #4
0
#! /usr/site/bin/python
import sys
import pyzfs

fsname = str(sys.argv[1])
a = pyzfs.z(True)  # argument is "should I spew debug"


def test_one(fsname):
    print " Python starting test one: open filesystems"
    for fs in [fsname, 'rpool', 'filesystemthatdoesntexist']:
        print "=================================="
        print " Python: Opening fs \"%s\"" % (fs)
        try:
            print dir(pyzfs.zfs.types)
            b = a.open_fs(
                fs, pyzfs.zfs.types.filesystem | pyzfs.zfs.types.snapshot
                | pyzfs.zfs.types.volume)
            print " Python: %s is of type %s" % (b.name(), b.type())
            print " Python: Quota for %s is %s" % (b.name(),
                                                   bytestonice(b.quota()))
            print " Python: Origin for %s is %s" % (b.name(), b.origin())
            print " Python: Mounted for %s is %s" % (b.name(), b.mounted())
            print " Python: Compressratio for %s is %s" % (b.name(),
                                                           b.compressratio())
            print " Python: Referenced for %s is %s" % (
                b.name(), bytestonice(b.referenced()))
            print " Python: Available for %s is %s" % (
                b.name(), bytestonice(b.available()))
            print " Python: Used for %s is %s" % (b.name(),
                                                  bytestonice(b.used()))