#6 Add a test of recursive removal of device stacks.
Opened 7 months ago by dlehman. Modified 7 months ago
rpms/ dlehman/python-blivet removal-test  into  master

file modified
+6

@@ -14,3 +14,9 @@ 

          - list-devices-2:

              dir: .

              run: python3 /usr/share/doc/python3-blivet/examples/list_devices.py

+         - wipe-disks:

+             dir: .

+             run: python3 ./wipe_disks.py --disks=vda,vdb

+         - list-devices-3:

+             dir: .

+             run: python3 /usr/share/doc/python3-blivet/examples/list_devices.py

file added
+26

@@ -0,0 +1,26 @@ 

+ #!/usr/bin/python3

+ 

+ import argparse

+ import sys

+ 

+ import blivet

+ 

+ 

+ parser = argparse.ArgumentParser()

+ parser.add_argument('-d', '--disks', default='')

+ args = parser.parse_args()

+ 

+ b = blivet.Blivet()

+ b.reset()

+ 

+ disks = list()

+ for disk_id in args.disks.split(','):

+     disk = b.devicetree.resolve_device(disk_id)

+     if not disk.is_disk:

+         sys.stderr.write("specified disk '%s' is not a disk\n" % disk_id)

+         sys.exit(1)

+ 

+     disks.append(disk)

+     b.devicetree.recursive_remove(disk)

+ 

+ b.do_it()