Bug 1253089 - thin_restore doesn't take a device with valid metadata as an input (-i)
thin_restore doesn't take a device with valid metadata as an input (-i)
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: lvm2 (Show other bugs)
7.2
x86_64 Linux
low Severity low
: rc
: ---
Assigned To: Joe Thornber
cluster-qe@redhat.com
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-12 19:48 EDT by Corey Marthaler
Modified: 2016-03-22 13:00 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-03-22 12:35:21 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Corey Marthaler 2015-08-12 19:48:58 EDT
Description of problem:
According to the man page, thin_restore should take a device as valid input:
       -i, --input {device|file}
              Input file or device with metadata.

       -o, --output {device|file}
              Output file or device.


lvcreate  --thinpool POOL  --zero n -L 1G --poolmetadatasize 4M snapper_thinp

Making origin volume
lvcreate  --virtualsize 1G -T snapper_thinp/POOL -n origin
lvcreate  -V 1G -T snapper_thinp/POOL -n other1
  WARNING: Sum of all thin volume sizes (2.00 GiB) exceeds the size of thin pool snapper_thinp/POOL (1.00 GiB)!
lvcreate  --virtualsize 1G -T snapper_thinp/POOL -n other2
  WARNING: Sum of all thin volume sizes (3.00 GiB) exceeds the size of thin pool snapper_thinp/POOL (1.00 GiB)!
lvcreate  -V 1G -T snapper_thinp/POOL -n other3
  WARNING: Sum of all thin volume sizes (4.00 GiB) exceeds the size of thin pool snapper_thinp/POOL (1.00 GiB)!
lvcreate  -V 1G -T snapper_thinp/POOL -n other4
  WARNING: Sum of all thin volume sizes (5.00 GiB) exceeds the size of thin pool snapper_thinp/POOL (1.00 GiB)!
lvcreate  --virtualsize 1G -T snapper_thinp/POOL -n other5
  WARNING: Sum of all thin volume sizes (6.00 GiB) exceeds the size of thin pool snapper_thinp/POOL (1.00 GiB)!
Making snapshot of origin volume
lvcreate  -k n -s /dev/snapper_thinp/origin -n snap
Create new device to swap in as the new _tmeta device
  WARNING: Sum of all thin volume sizes (7.00 GiB) exceeds the size of thin pools (1.00 GiB)!

Dumping current pool (POOL) metadata to /tmp/snapper_thinp_dump.5718.16440
lvcreate -L 4M -n meta_swap snapper_thinp
  WARNING: Sum of all thin volume sizes (7.00 GiB) exceeds the size of thin pools (1.00 GiB)!
lvconvert --yes --thinpool snapper_thinp/POOL --poolmetadata snapper_thinp/meta_swap
lvchange -ay snapper_thinp/meta_swap

[root@host-111 ~]# lvs -a -o +devices
  LV              VG            Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert Devices       
  root            rhel_host-111 -wi-ao----   6.67g                                                     /dev/vda2(205)
  swap            rhel_host-111 -wi-ao---- 820.00m                                                     /dev/vda2(0)  
  POOL            snapper_thinp twi---t---   1.00g                                                     POOL_tdata(0) 
  [POOL_tdata]    snapper_thinp Twi-------   1.00g                                                     /dev/sdd1(1)  
  [POOL_tmeta]    snapper_thinp ewi-------   4.00m                                                     /dev/sdd1(266)
  [lvol0_pmspare] snapper_thinp ewi-------   4.00m                                                     /dev/sdd1(0)  
  meta_swap       snapper_thinp -wi-a-----   4.00m                                                     /dev/sdf1(0)  
  newtmeta        snapper_thinp -wi-a----- 100.00g                                                     /dev/sdb1(0)  
  newtmeta        snapper_thinp -wi-a----- 100.00g                                                     /dev/sdc1(0)  
  newtmeta        snapper_thinp -wi-a----- 100.00g                                                     /dev/sde1(0)  
  newtmeta        snapper_thinp -wi-a----- 100.00g                                                     /dev/sdf1(1)  
  newtmeta        snapper_thinp -wi-a----- 100.00g                                                     /dev/sdd1(257)
  origin          snapper_thinp Vwi---t---   1.00g POOL                                                              
  other1          snapper_thinp Vwi---t---   1.00g POOL                                                              
  other2          snapper_thinp Vwi---t---   1.00g POOL                                                              
  other3          snapper_thinp Vwi---t---   1.00g POOL                                                              
  other4          snapper_thinp Vwi---t---   1.00g POOL                                                              
  other5          snapper_thinp Vwi---t---   1.00g POOL                                                              
  snap            snapper_thinp Vwi---t---   1.00g POOL origin                                                       

[root@host-111 ~]# thin_restore -i /dev/mapper/snapper_thinp-meta_swap -o /tmp/foofile
Couldn't stat dev path
[root@host-111 ~]# thin_restore -i /dev/snapper_thinp/meta_swap -o /tmp/foofile
Couldn't stat dev path


[root@host-111 ~]# thin_dump /dev/mapper/snapper_thinp-meta_swap
<superblock uuid="" time="1" transaction="7" data_block_size="128" nr_data_blocks="16384">
  <device dev_id="1" mapped_blocks="1" transaction="0" creation_time="0" snap_time="1">
    <single_mapping origin_block="0" data_block="0" time="0"/>
  </device>
  <device dev_id="2" mapped_blocks="1" transaction="1" creation_time="0" snap_time="0">
    <single_mapping origin_block="0" data_block="1" time="0"/>
  </device>
  <device dev_id="3" mapped_blocks="1" transaction="2" creation_time="0" snap_time="0">
    <single_mapping origin_block="0" data_block="2" time="0"/>
  </device>
  <device dev_id="4" mapped_blocks="1" transaction="3" creation_time="0" snap_time="0">
    <single_mapping origin_block="0" data_block="3" time="0"/>
  </device>
  <device dev_id="5" mapped_blocks="1" transaction="4" creation_time="0" snap_time="0">
    <single_mapping origin_block="0" data_block="4" time="0"/>
  </device>
  <device dev_id="6" mapped_blocks="1" transaction="5" creation_time="0" snap_time="0">
    <single_mapping origin_block="0" data_block="5" time="0"/>
  </device>
  <device dev_id="7" mapped_blocks="1" transaction="6" creation_time="1" snap_time="1">
    <single_mapping origin_block="0" data_block="0" time="0"/>
  </device>
</superblock>

[root@host-111 ~]# thin_dump /dev/snapper_thinp/meta_swap > /tmp/foofile

[root@host-111 ~]# thin_restore -i /tmp/foofile -o /dev/snapper_thinp/meta_swap
Restoring: [=================================================] / 100%

[root@host-111 ~]# thin_restore -i /dev/snapper_thinp/meta_swap -o /tmp/foofile
transaction_manager::new_block() couldn't allocate new block


Version-Release number of selected component (if applicable):
3.10.0-302.el7.x86_64
lvm2-2.02.127-1.el7    BUILT: Mon Aug 10 03:22:35 CDT 2015
lvm2-libs-2.02.127-1.el7    BUILT: Mon Aug 10 03:22:35 CDT 2015
lvm2-cluster-2.02.127-1.el7    BUILT: Mon Aug 10 03:22:35 CDT 2015
device-mapper-1.02.104-1.el7    BUILT: Mon Aug 10 03:22:35 CDT 2015
device-mapper-libs-1.02.104-1.el7    BUILT: Mon Aug 10 03:22:35 CDT 2015
device-mapper-event-1.02.104-1.el7    BUILT: Mon Aug 10 03:22:35 CDT 2015
device-mapper-event-libs-1.02.104-1.el7    BUILT: Mon Aug 10 03:22:35 CDT 2015
device-mapper-persistent-data-0.5.4-1.el7    BUILT: Fri Jul 17 08:56:22 CDT 2015
cmirror-2.02.127-1.el7    BUILT: Mon Aug 10 03:22:35 CDT 2015
sanlock-3.2.4-1.el7    BUILT: Fri Jun 19 12:48:49 CDT 2015
sanlock-lib-3.2.4-1.el7    BUILT: Fri Jun 19 12:48:49 CDT 2015
lvm2-lockd-2.02.127-1.el7    BUILT: Mon Aug 10 03:22:35 CDT 2015
Comment 1 Joe Thornber 2016-03-22 12:35:21 EDT
-i should always be in xml format.  -o should always be to a file or device that's big enough to store the binary format of the metadata.
Comment 2 Corey Marthaler 2016-03-22 13:00:35 EDT
I'm confused. According to the man page, -i should be "Input file or device with metadata", and according to my thin_dump of "/dev/mapper/snapper_thinp-meta_swap", it was just that, a device with valid metadata. Yet it's not allowed to be used? Does thin_dump somehow deal with the how the data is laid out on the device differently?

Note You need to log in before you can comment on or make changes to this bug.