Bug 1065522
| Summary: | openlmi partition delete fails to delete a partition created my openlmi partition create | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Barry Donahue <bdonahue> |
| Component: | python-blivet | Assignee: | David Lehman <dlehman> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Barry Donahue <bdonahue> |
| Severity: | high | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 7.0 | CC: | jsafrane |
| Target Milestone: | rc | ||
| Target Release: | 7.0 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | python-blivet-0.18.27-1 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2014-06-13 11:53:07 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Attachments: | |||
Something is wrong with blivet. If I remove a volume group on /dev/sdb1 + /dev/sdb2 and _then_ try to delete the sdb1 partition, I get following traceback:
Traceback (most recent call last):
File "/mnt/home/tmp/delete_part.py", line 89, in <module>
b.devicetree.registerAction(a7)
File "/usr/lib/python2.7/site-packages/blivet/devicetree.py", line 405, in registerAction
self._removeDevice(action.device)
File "/usr/lib/python2.7/site-packages/blivet/devicetree.py", line 347, in _removeDevice
dev.disk.format.removePartition(dev.partedPartition)
File "/usr/lib/python2.7/site-packages/blivet/formats/disklabel.py", line 326, in removePartition
self.partedDisk.removePartition(partition)
File "/usr/lib64/python2.7/site-packages/parted/decorators.py", line 41, in new
ret = fn(*args, **kwds)
File "/usr/lib64/python2.7/site-packages/parted/disk.py", line 269, in removePartition
if self.__disk.remove_partition(partition.getPedPartition()):
_ped.PartitionException: Partition is not part of the disk it is being removed from
Code leading to this was:
vg = b.vgs[0]
a6 = blivet.ActionDestroyDevice(vg)
b.devicetree.registerAction(a6)
b.devicetree.processActions()
p1 = b.devicetree.getDeviceByName('sdb1')
p2 = b.devicetree.getDeviceByName('sdb2')
a7 = blivet.ActionDestroyDevice(p1)
a8 = blivet.ActionDestroyDevice(p2)
b.devicetree.registerAction(a7)
b.devicetree.registerAction(a8)
b.devicetree.processActions()
If I add b.reset() after VG removal and before partition removal (see attached reproducer), it starts working. But reset() is quite expensive and slow, I have _only_ 10 partitions on my system and it takes 1.5 seconds.
Created attachment 864063 [details]
reproducer
Version-Release number of selected component
python-blivet-0.18.24-1.el7.noarch
(also rawhide, python-blivet-0.41-1.fc21.noarch)
Created attachment 864065 [details]
full blivet log
Created attachment 864815 [details]
proposed patch to update parted partition refs after processing actions
Jan, if possible please test this patch and let me know if it works for you.
Almost there! With the patch, this part of the reproducer removes only sdb2 and throws a traceback:
p1 = b.devicetree.getDeviceByName('sdb1')
p2 = b.devicetree.getDeviceByName('sdb2')
a7 = blivet.ActionDestroyDevice(p1)
a8 = blivet.ActionDestroyDevice(p2)
b.devicetree.registerAction(a7)
b.devicetree.registerAction(a8)
b.devicetree.processActions()
DEBUG:blivet: action: [6] Destroy Device partition sdb1 (id 34)
DEBUG:blivet: action: [7] Destroy Device partition sdb2 (id 35)
INFO:blivet: pruning action queue...
INFO:blivet: sorting actions...
DEBUG:blivet: action: [7] Destroy Device partition sdb2 (id 35)
DEBUG:blivet: action: [6] Destroy Device partition sdb1 (id 34)
INFO:blivet: executing action: [7] Destroy Device partition sdb2 (id 35)
DEBUG:blivet: PartitionDevice.destroy: sdb2 ; status: True ;
DEBUG:blivet: PartitionDevice.teardown: sdb2 ; status: True ; controllable: True ;
DEBUG:blivet: DeviceFormat.teardown: device: /dev/sdb2 ; status: False ; type: None ;
DEBUG:blivet: LVMPhysicalVolume.teardown: device: /dev/sdb2 ; status: None ; type: lvmpv ;
INFO:program: Running... udevadm settle --timeout=300
DEBUG:program: Return code: 0
DEBUG:blivet: PartitionDevice.setupParents: kids: 0 ; name: sdb2 ; orig: True ;
DEBUG:blivet: DiskDevice.setup: sdb ; status: True ; controllable: True ; orig: True ;
DEBUG:blivet: DiskLabel.setup: device: /dev/sdb ; status: False ; type: disklabel ;
DEBUG:blivet: DiskLabel.setup: device: /dev/sdb ; status: False ; type: disklabel ;
DEBUG:blivet: PartitionDevice._destroy: sdb2 ; status: True ;
DEBUG:blivet: DiskLabel.commit: device: /dev/sdb ; numparts: 1 ;
INFO:program: Running... udevadm settle --timeout=300
DEBUG:program: Return code: 0
Traceback (most recent call last):
File "/mnt/home/download/repro_part.py", line 92, in <module>
b.devicetree.processActions()
File "/usr/lib/python2.7/site-packages/blivet/devicetree.py", line 237, in processActions
action.execute()
File "/usr/lib/python2.7/site-packages/blivet/deviceaction.py", line 319, in execute
self.device.destroy()
File "/usr/lib/python2.7/site-packages/blivet/devices.py", line 823, in destroy
self._destroy()
File "/usr/lib/python2.7/site-packages/blivet/devices.py", line 1630, in _destroy
self.disk.format.removePartition(part)
File "/usr/lib/python2.7/site-packages/blivet/formats/disklabel.py", line 328, in removePartition
self.partedDisk.removePartition(partition)
File "/usr/lib64/python2.7/site-packages/parted/decorators.py", line 41, in new
ret = fn(*args, **kwds)
File "/usr/lib64/python2.7/site-packages/parted/disk.py", line 267, in removePartition
raise parted.DiskException, "no partition specified"
_ped.DiskException: no partition specified
It works if I destroy just one partition per b.devicetree.processActions() call.
Created attachment 865164 [details]
proposed patch fix handling of partitions across multiple processActions calls
This time I set up a reproducer on my system and this patch worked for me. Please verify that it works for you as well.
Now it works well, thanks. This request was resolved in Red Hat Enterprise Linux 7.0. Contact your manager or support representative in case you have further questions about the request. |
Description of problem:I create a partition table and some partitions on a disk. All commands work ok until I try to delete the partitions. After the first failure, I can delete the partitions. Version-Release number of selected component (if applicable): openlmi-python-providers-0.4.2-7.el7.noarch openlmi-networking-0.2.2-3.el7.x86_64 openlmi-logicalfile-0.4.2-7.el7.x86_64 openlmi-1.0.1-7.el7.noarch openlmi-tools-0.9-18.el7.noarch openlmi-python-base-0.4.2-7.el7.noarch openlmi-providers-0.4.2-7.el7.x86_64 openlmi-software-0.4.2-7.el7.noarch openlmi-service-0.4.2-7.el7.x86_64 openlmi-powermanagement-0.4.2-7.el7.x86_64 openlmi-account-0.4.2-7.el7.x86_64 openlmi-storage-0.7.1-5.el7.noarch openlmi-hardware-0.4.2-7.el7.x86_64 openlmi-indicationmanager-libs-0.4.2-7.el7.x86_64 Here is the output from the test case: lmi partition-table create /dev/sde DeviceID Name ElementName Largest free region /dev/disk/by-id/scsi-3600605b0028119101a16068142e17bf0 /dev/sde sde 145999493120 lmi partition create /dev/sde 30G {'extent': LMIInstance(classname="LMI_StorageExtent", ...), 'Size': 32212254720L} Partition /dev/sde1, with DeviceID /dev/disk/by-id/scsi-3600605b0028119101a16068142e17bf0-part1 created. lmi partition create /dev/sde 30G {'extent': LMIInstance(classname="LMI_StorageExtent", ...), 'Size': 32212254720L} Partition /dev/sde2, with DeviceID /dev/disk/by-id/scsi-3600605b0028119101a16068142e17bf0-part2 created. lmi partition create /dev/sde 30G {'extent': LMIInstance(classname="LMI_StorageExtent", ...), 'Size': 32212254720L} Partition /dev/sde3, with DeviceID /dev/disk/by-id/scsi-3600605b0028119101a16068142e17bf0-part3 created. lmi partition create --extended /dev/sde 30G {'Goal': LMIInstance(classname="LMI_DiskPartitionConfigurationSetting", ...), 'extent': LMIInstance(classname="LMI_StorageExtent", ...), 'Size': 32212254720L} ERROR: failed to execute wrapped function: Cannot create the partition: Goal.PartitionType cannot be Extended for this Extent.. ERROR: invocation failed for host "https://localhost": Cannot create the partition: Goal.PartitionType cannot be Extended for this Extent.. There was 1 error: host https://localhost Cannot create the partition: Goal.PartitionType cannot be Extended for this Extent.. lmi partition create /dev/sde 10G {'extent': LMIInstance(classname="LMI_StorageExtent", ...), 'Size': 10737418240L} Partition /dev/sde4, with DeviceID /dev/disk/by-id/scsi-3600605b0028119101a16068142e17bf0-part4 created. Other commands executed... lmi vg create VG /dev/sde1 /dev/sde2 lmi lv create VG lv1 20G lmi fs create --label=LV1 xfs /dev/mapper/VG-lv1 lmi mount create /dev/mapper/VG-lv1 /mnt/lv -t xfs ./dt.17.05 log=lv-log of=/mnt/lv/dtout limit=1g bs=128k procs=10 passes=2 dlimit=1512 pattern=iot ofla gs=dsync flags=rsync lmi mount delete /mnt/lv lmi lv delete /dev/mapper/VG-lv1 lmi vg delete VG Then... lmi partition delete sde4 ERROR: failed to execute wrapped function: Cannot delete the partition: Partition is not part of the disk it is being removed from. ERROR: invocation failed for host "https://localhost": Cannot delete the partition: Partition is not part of the disk it is being removed from. There was 1 error: host https://localhost Cannot delete the partition: Partition is not part of the disk it is being removed from. After this failure, the command succeeds the second time. # lmi partition delete sde4