How to use get_device_total_space method in avocado

Best Python code snippet using avocado_python

lv_utils.py

Source:lv_utils.py Github

copy

Full Screen

...43 for line in results:44 if line.startswith('Disk ' + disk):45 return re.findall(r", (.*?) bytes", line)[0]46 raise LVException('Error in finding disk space')47def get_device_total_space(disk):48 """Get the total device size.49 :param str device: name of the device/disk to find the total size50 :returns: size in bytes51 :rtype: int52 :raises: :py:class:`LVException` on failure to find disk space53 """54 result = process.run('fdisk -l %s' % disk,55 env={"LANG": "C"}, sudo=True).stdout_text56 results = result.splitlines()57 for line in results:58 if line.startswith('Disk ' + disk):59 return int(re.findall(r", (.*?) bytes", line)[0])60 raise LVException('Error in finding disk space')61def get_devices_total_space(devices):62 """Get the total size of given device(s)/disk(s).63 :param list devices: list with the names of devices separated with space.64 :returns: sizes in bytes65 :rtype: int66 :raises: :py:class:`LVException` on failure to find disk space67 """68 size = 069 for device in devices:70 size = size + get_device_total_space(device)71 if not size:72 raise LVException('failed to get disks size')73 return size74def vg_ramdisk(disk, vg_name, ramdisk_vg_size,75 ramdisk_basedir, ramdisk_sparse_filename,76 use_tmpfs=True):77 """78 Create volume group on top of ram memory to speed up LV performance.79 When disk is specified the size of the physical volume is taken from80 existing disk space.81 :param str disk: name of the disk in which volume groups are created82 :param str vg_name: name of the volume group83 :param str ramdisk_vg_size: size of the ramdisk virtual group (MB)84 :param str ramdisk_basedir: base directory for the ramdisk sparse file...

Full Screen

Full Screen

blkdiscard.py

Source:blkdiscard.py Github

copy

Full Screen

...50 def test(self):51 """52 Sectors are dicarded for the different values of OFFSET and LENGTH.53 """54 size = lv_utils.get_device_total_space(self.disk)55 cmd = "blkdiscard %s -o 0 -v -l %d" % (self.disk, size)56 process.run(cmd, shell=True)57 cmd = "blkdiscard %s -o %d \58 -v -l %d" % (self.disk, size, size)59 process.run(cmd, shell=True)60 cmd = "blkdiscard %s -o %d -v -l 0" % (self.disk, size)61 process.run(cmd, shell=True)62 for i in xrange(2, 10, 2):63 for j in xrange(2, 10, 2):64 if (size / i) % 4096 == 0 and (size / j) % 4096 == 0:65 cmd = "blkdiscard %s -o %d -l %d -v" \66 % (self.disk, size / i, size / j)67 process.system(cmd, shell=True)68 else:...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful