Best Python code snippet using avocado_python
lvm.py
Source: lvm.py
1import subprocess as sp2while True:3 4 print("""51. To create Physical Volume62. To display Physical Volume73. To create Volume Group84. To display volume group95. To create logical volume 106. To display logical volume117. To extend the logical volume128. To reduce the logical volume139. Exit14 """)15 print("\n")16 # Take Input that what operation user would like to perform17 ch=int(input("Enter your choice => "))18 if ch == 1:19 print("Create Physical Volume")20 # Take list of Volume21 drive_name= input("Enter your drive name ")22 pv_create=sp.getoutput("pvcreate {}".format(drive_name))23 print(pv_create)24 # Create Volume Group25 26 elif ch == 2:27 print("Create display Physical Volume")28 drive_name= input("Enter your drive name ")29 lv_disp=sp.getoutput("pvdisplay {}".format(drive_name))30 print(lv_disp)31 32 elif ch == 3:33 print("Create volume Group")34 pv_name= input("Enter your PV name: ")35 vg_name= input("Enter VG name you want create: ")36 vg_create= sp.getoutput("vgcreate {} {}".format(pv_name,vg_name))37 38 elif ch == 4:39 print("Display volume Group")40 vg_name= input("Enter VG name: ")41 vg_disp=sp.getoutput("vgdisplay {}".format(vg_name))42 print(vg_disp)43 44 elif ch == 5:45 print("Create Logical Volume")46 size= int(input("Enter the size of LV: "))47 lv_name= input("Enter the name of LV: ")48 vg_name= input("Enter the name of VG: ")49 lv_create=sp.getoutput("lvcreate --size {} --name {} {}".format(size,lv_name,vg_name))50 print(lv_create)51 52 elif ch == 6:53 print("Display Logical Volume")54 lv_name= input("Enter the name of LV: ")55 lv_disp= sp.getoutput("lvdisplay {}".format(lv_name))56 print(lv_disp)57 58 elif ch == 7:59 print("Extending Logical Volume")60 lv_name= input("Enter the name of LV: ")61 size= int(input("Enter the size you want extend: "))62 sp.getoutput("lvextend --size {} {}".format(size,lv_name))63 lv_extend= sp.getoutput("resize2fs --size {} {}".format(size,lv_name))64 print(lv_extend)65 66 elif ch == 8:67 print("Reducing Logical Volume")68 lv_name= input("Enter the name of LV: ")69 size= int(input("Enter the size you want reduce: "))70 drive_name= input("Enter drive name to unmount: ")71 sp.getoutput("umount {}".format(drive_name))72 sp.getoutput("e2fsck -f ".format(lv_name))73 sp.getoutput("mkfs.ext4 {}".format(lv_name))74 sp.getoutput("resize2fs {} --size {}".format(lv_name,size))75 lv_reduce= sp.getoutput("lvreduce --size {} {}".format(size,lv_name))76 sp.getoutput("mount lv_name drive_name".format(lv_name,drive_name))77 print(lv_reduce)78 print("LV is mounted with {}".format(drive_name))79 80 elif ch == 9:81 print("Bye Bye")82 break...
lv.py
Source: lv.py
...18 vg_create()19 elif av=="4":20 vg_create()21 elif av=="5":22 lv_create()23 elif av=="6":24 lv_create()25 26 def vg_create():27 disk_name1=input("enter Your disk name here for lvm partation")28 print(os.system("pvcreate {}".format(disk_name1)))29 30 disk_name2=input("enter Your disk name here for lvm partation")31 print(os.system("pvcreate {}".format(disk_name2)))32 a=input("1 for create 2 for display")33 if a=="1":34 vgname=input("Enter your vg name here")35 print(os.system("vgcreate {0} {1} {2} ".format(vgname , disk_name1 , disk_name2))) 36 elif a=="2":37 a=input("enter your vg name here")38 print(os.system("vgdisplay {}".format(a)))39 menu_lvm()40 41 def lv_create():42 a=input("1 for display 2 for create" )43 if a=="2":44 b=input("To create lv press1")45 size1=input("enter size of disk in gb")46 name_of_lv=input("enter the name of lv ")47 vg_name=input("enter name of your vg")48 size=("{}G".format(size1))49 print(size)50 print(os.system("lvcreate --size {} --name {} {} ".format(size,name_of_lv,vg_name)))51 elif a=="1":52 print(os.system("lvdisplay dev/{}/{}".format(vg_name,name_of_lv)))53 menu_lvm()54if a==1:55 print("manual partation")...
Check out the latest blogs from LambdaTest on this topic:
Hola Testers! Hope you all had a great Thanksgiving weekend! To make this time more memorable, we at LambdaTest have something to offer you as a token of appreciation.
In addition to the four values, the Agile Manifesto contains twelve principles that are used as guides for all methodologies included under the Agile movement, such as XP, Scrum, and Kanban.
JavaScript is one of the most widely used programming languages. This popularity invites a lot of JavaScript development and testing frameworks to ease the process of working with it. As a result, numerous JavaScript testing frameworks can be used to perform unit testing.
When I started writing tests with Cypress, I was always going to use the user interface to interact and change the application’s state when running tests.
The rapid shift in the use of technology has impacted testing and quality assurance significantly, especially around the cloud adoption of agile development methodologies. With this, the increasing importance of quality and automation testing has risen enough to deliver quality work.
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!