Project

General

Profile

create-broken-rbd-snapshot.sh

Reproducer - Benjamin Gilbert, 03/16/2015 03:43 AM

Download (668 Bytes)

 
1
#!/bin/bash
2

    
3
pool=scratch
4

    
5
set -x
6

    
7
# Demonstrate that things work
8
rbd ls -l -p $pool > /dev/null
9

    
10
# Create origin image
11
dd if=/dev/zero bs=1M count=10000 | rbd import - $pool/origin --image-format 2
12

    
13
# Clone origin
14
rbd snap create $pool/origin@snap
15
rbd snap protect $pool/origin@snap
16
rbd clone $pool/origin@snap $pool/clone
17

    
18
# Flatten clone; create snapshot while flattening
19
( sleep 5; rbd snap create $pool/clone@broken ) &
20
rbd flatten $pool/clone
21

    
22
# Tear down origin
23
rbd snap unprotect $pool/origin@snap
24
rbd snap rm $pool/origin@snap
25
rbd rm $pool/origin
26

    
27
# Now things are broken!
28
rbd snap ls $pool/clone
29
rbd snap rm $pool/clone@broken
30
rbd ls -l -p $pool > /dev/null