Bug 1225694
| Summary: | Disk partition table is broken after wiping an extended partition | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Yang Yang <yanyang> |
| Component: | libvirt | Assignee: | John Ferlan <jferlan> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.2 | CC: | dyuan, jdenemar, jferlan, mzhan, rbalakri, shyu, xuzhang, yisun |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-1.2.17-1.el7 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2015-11-19 06:39:20 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: | |||
The following patch has been posted upstream http://www.redhat.com/archives/libvir-list/2015-June/msg00389.html Patch pushed upstream:
commit 84020f9a398f739ee2cf7588a7cf3b4b0c077984
Author: John Ferlan <jferlan>
Date: Tue Jun 9 18:15:39 2015 -0400
storage: Disallow wiping an extended disk partition
Check if the disk partition to be wiped is the extended partition, if
so then disallow it. Do this via changing the wipeVol backend to check
the volume before passing to the common virStorageBackendVolWipeLocal
$ git describe 84020f9a398f739ee2cf7588a7cf3b4b0c077984
v1.2.16-151-g84020f9
$
Verified and passed with:
libvirt-1.2.17-2.el7.x86_64
qemu-kvm-rhev-2.3.0-9.el7.x86_64
kernel-3.10.0-290.el7.x86_64
Steps:
1. prepare a disk sdb and make 3 partitions, sdb1 (primary) sdb2 (extended) sdb3 (logical) as follow:
# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): print
Disk /dev/sdb: 8004 MB, 8004304896 bytes, 15633408 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x1e3d54c6
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 6293503 2097152 5 Extended
/dev/sdb5 2101248 2121727 10240 83 Linux
2. create a disk pool
# cat pool.xml
<pool type="disk">
<name>usbdisk</name>
<source>
<device path='/dev/sdb'/>
<format type='dos'/>
</source>
<target>
<path>/dev</path>
</target>
</pool>
# virsh pool-create pool.xml
Pool usbdisk created from pool.xml
# virsh vol-list usbdisk --details
Name Path Type Capacity Allocation
-----------------------------------------------
sdb1 /dev/sdb1 block 1.00 GiB 1.00 GiB
sdb2 /dev/sdb2 block 2.00 GiB 2.00 GiB
sdb5 /dev/sdb5 block 10.00 MiB 10.00 MiB
3. vol-wipe the primary, logical and extended partition to see if it works as expected.
# virsh vol-wipe sdb5 usbdisk
Vol sdb5 wiped <=== logical
# virsh vol-wipe sdb1 usbdisk
Vol sdb1 wiped <=== primary
# virsh vol-wipe sdb2 usbdisk
error: Failed to wipe vol sdb2
error: this function is not supported by the connection driver: cannot wipe extended partition '/dev/sdb2' <=== extended, failed as expected.
4. check the partition table of /dev/sdb
# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): print
Disk /dev/sdb: 8004 MB, 8004304896 bytes, 15633408 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x1e3d54c6
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 6293503 2097152 5 Extended
/dev/sdb5 2101248 2121727 10240 83 Linux
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2015-2202.html |
Description of problem: Disk partition table is broken after wiping an extended partition Version-Release number of selected component (if applicable): libvirt-1.2.15-2.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1. define/build/start a disk pool # cat disk-pool.xml <pool type="disk"> <name>disk2</name> <source> <device path='/dev/sdl'/> <format type='dos'/> </source> <target> <path>/dev</path> </target> </pool> # virsh pool-define disk-pool.xml Pool disk2 defined from disk-pool.xml [root@rhel7_test yy]# virsh pool-build disk2 Pool disk2 built [root@rhel7_test yy]# virsh pool-start disk2 Pool disk2 started 2. create 3 primary partitions and 1 extended partition [root@rhel7_test yy]# for i in {1..3}; do virsh vol-create-as disk2 sdl$i 2G; done Vol sdl1 created Vol sdl2 created Vol sdl3 created [root@rhel7_test yy]# virsh vol-create-as disk2 sdl4 30G --format extended Vol sdl4 created [root@rhel7_test yy]# parted /dev/sdl GNU Parted 3.1 Using /dev/sdl Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) print Model: IET VIRTUAL-DISK (scsi) Disk /dev/sdl: 42.9GB Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 32.3kB 2149MB 2148MB primary 2 2149MB 4297MB 2149MB primary 3 4297MB 6446MB 2149MB primary 4 6446MB 38.7GB 32.2GB extended lba (parted) quit 3. do vol-wipe on extended partition [root@rhel7_test yy]# virsh vol-wipe sdl4 disk2 Vol sdl4 wiped 4. check partition table via parted [root@rhel7_test yy]# parted /dev/sdl GNU Parted 3.1 Using /dev/sdl Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) print Error: Invalid partition table on /dev/sdl -- wrong signature 0. Ignore/Cancel? cancel Model: IET VIRTUAL-DISK (scsi) Disk /dev/sdl: 42.9GB Sector size (logical/physical): 512B/512B Partition Table: unknown Disk Flags: 5. create a logical partition # virsh vol-create-as disk2 sdl5 2G error: Failed to create vol sdl5 error: internal error: Child process (/usr/sbin/parted /dev/sdl mkpart --script 'logical ext2' 6445629440B 8594128895B) unexpected exit status 1: Error: Invalid partition table on /dev/sdl -- wrong signature 0. Actual results Disk partition table is broken after wiping an extended partition so that disk pool does not work Expected results If wiping extended partition is supported, do not crash disk partition table If NOT, provide an error message. Additional info: