How to use _exists_pool method in lisa

Best Python code snippet using lisa_python

mdadm.py

Source:mdadm.py Github

copy

Full Screen

...129 # delete virtual disk if it exists130 self.node.tools[HyperV].delete_virtual_disk(volume_name)131 # delete storage pool132 self._delete_pool(pool_name)133 def _exists_pool(self, pool_name: str) -> bool:134 output = self.node.tools[PowerShell].run_cmdlet(135 f"Get-StoragePool -FriendlyName {pool_name}",136 fail_on_error=False,137 force_run=True,138 )139 return output.strip() != ""140 def _delete_pool(self, pool_name: str) -> None:141 if self._exists_pool(pool_name):142 self.node.tools[PowerShell].run_cmdlet(143 f"Remove-StoragePool -FriendlyName {pool_name} -confirm:$false",144 force_run=True,145 )146 def _create_pool(self, pool_name: str) -> None:147 # delete pool if exists148 self._delete_pool(pool_name)149 # create pool150 self.node.tools[PowerShell].run_cmdlet(151 "$disks = Get-PhysicalDisk -CanPool $true; New-StoragePool "152 "-StorageSubSystemFriendlyName 'Windows Storage*' "153 f"-FriendlyName {pool_name} -PhysicalDisks $disks",154 force_run=True,155 )

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 lisa 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