olopez32 / ganeti

Automatically exported from code.google.com/p/ganeti
0 stars 0 forks source link

gnt-backup export fails when removing LVM snapshot. #274

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
# gnt-cluster --version
gnt-cluster (ganeti v2.4.2) 2.4.2

# gnt-cluster version
Software version: 2.4.2
Internode protocol: 2040000
Configuration format: 2040000
OS api version: 20
Export interface: 0

# cat /etc/debian_version
wheezy/sid
# uname -vrs
Linux 3.0.0-16-generic #28-Ubuntu SMP Fri Jan 27 17:44:39 UTC 2012
# dpkg -l |grep lvm2
ii  lvm2                                2.02.66-4ubuntu3                        
The Linux Logical Volume Manager
root@node1:~# dpkg -l |grep udev
ii  libudev0                            173-0ubuntu4.1                          
udev library
ii  udev                                173-0ubuntu4.1

What steps will reproduce the problem?
1. create instance from existing instance
# gnt-instance add -n node1 -o image+default -t plain --disk 
0:adopt=k101-ubuntu-root,vg=kvm-clust1 -H kvm:vnc_bind_address=192.168.0.20 
--net 0:bridge=br0 --no-start --no-install --no-name-check --no-ip-check 
k101-ubuntu

2. startup and login into VM successful. 
3. shutdown VM with "gnt-instance shutdown"
4. perform export
# gnt-backup export -d -n node1 k102-ubuntu
2012-10-02 17:39:51,283: gnt-backup export pid=13403 cli:1927 INFO run with 
arguments '-d -n node1 k102-ubuntu'
Tue Oct  2 17:39:52 2012 Shutting down instance k102-ubuntu
Tue Oct  2 17:39:52 2012 Creating a snapshot of disk/0 on node 
node1.gnt.loadtomobile.com
Tue Oct  2 17:39:53 2012 Starting instance k102-ubuntu
Tue Oct  2 17:39:53 2012 Exporting snapshot/0 from node1.gnt.loadtomobile.com 
to node1.gnt.loadtomobile.com
Tue Oct  2 17:39:56 2012 snapshot/0 is now listening, starting export
Tue Oct  2 17:39:59 2012 snapshot/0 finished receiving data
Tue Oct  2 17:39:59 2012  - WARNING: export 'export-2012-10-02_17_39_57-TIRril' 
on node1.gnt.loadtomobile.com failed: Exited with status 1
Tue Oct  2 17:39:59 2012 snapshot/0 failed to send data: Exited with status 1 
(recent output: device-mapper: remove ioctl failed: Device or resource busy)
Tue Oct  2 17:39:59 2012 Removing snapshot of disk/0 on node 
node1.gnt.loadtomobile.com
Tue Oct  2 17:39:59 2012  - WARNING: Could not remove snapshot for disk/0 from 
node node1.gnt.loadtomobile.com: Can't lvremove: exited with exit code 5 -   
Can't remove open logical volume 
"3fbaa44b-cb0a-471d-9e75-aeec3cc16f12.disk0.snap"\n
Tue Oct  2 17:39:59 2012 Finalizing export on node1.gnt.loadtomobile.com
Tue Oct  2 17:40:00 2012 Removing snapshot of disk/0 on node 
node1.gnt.loadtomobile.com
Tue Oct  2 17:40:00 2012  - WARNING: Could not remove snapshot for disk/0 from 
node node1.gnt.loadtomobile.com: Can't lvremove: exited with exit code 5 -   
Can't remove open logical volume 
"3fbaa44b-cb0a-471d-9e75-aeec3cc16f12.disk0.snap"\n
2012-10-02 17:40:00,653: gnt-backup export pid=13403 cli:1936 ERROR Error 
during command processing
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/ganeti/cli.py", line 1932, in GenericMain
    result = func(options, args)
  File "/usr/lib/pymodules/python2.7/ganeti/client/gnt_backup.py", line 83, in ExportInstance
    SubmitOpCode(op, opts=opts)
  File "/usr/lib/pymodules/python2.7/ganeti/cli.py", line 1727, in SubmitOpCode
    reporter=reporter)
  File "/usr/lib/pymodules/python2.7/ganeti/cli.py", line 1708, in PollJob
    return GenericPollJob(job_id, _LuxiJobPollCb(cl), reporter)
  File "/usr/lib/pymodules/python2.7/ganeti/cli.py", line 1530, in GenericPollJob
    errors.MaybeRaise(msg)
  File "/usr/lib/pymodules/python2.7/ganeti/errors.py", line 448, in MaybeRaise
    raise errcls, args
OpExecError: Export failed, errors in disk export: disk(s) 0
Failure: command execution error:
Export failed, errors in disk export: disk(s) 0

After that I got failed "export" and unremovable LVM snapshot.

# lvs
  1824fb12-dcd7-4863-912b-199c0ad9cd72.disk0      kvm-clust1 owi-ao  20,00g                                                                          
  1824fb12-dcd7-4863-912b-199c0ad9cd72.disk0.snap kvm-clust1 swi-ao  20,00g 1824fb12-dcd7-4863-912b-199c0ad9cd72.disk0   0,00

#  lvchange -an -v kvm-clust1/1824fb12-dcd7-4863-912b-199c0ad9cd72.disk0.snap
    Using logical volume(s) on command line
  Can't change snapshot logical volume "1824fb12-dcd7-4863-912b-199c0ad9cd72.disk0.snap"
# lvremove -ff kvm-clust1/1824fb12-dcd7-4863-912b-199c0ad9cd72.disk0.snap
  Can't remove open logical volume "1824fb12-dcd7-4863-912b-199c0ad9cd72.disk0.snap"
# dmsetup remove /dev/kvm-clust1/1824fb12-dcd7-4863-912b-199c0ad9cd72.disk0.snap
device-mapper: remove ioctl failed: Устройство или ресурс 
занято
Command failed

How I can export instance?

Original issue reported on code.google.com by lesov...@gmail.com on 2 Oct 2012 at 2:09

GoogleCodeExporter commented 9 years ago
Something is keeping the block device open. What does your export script look 
like?

Original comment by han...@google.com on 4 Oct 2012 at 12:52

GoogleCodeExporter commented 9 years ago
>> What does your export script look like?
It's a standart script from the package. I don't modified it.

Original comment by lesov...@gmail.com on 4 Oct 2012 at 2:42

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
kpartx add partition table to kernel. unload table helps close snapshots and 
remove them.

Original comment by lesov...@gmail.com on 4 Oct 2012 at 1:48

GoogleCodeExporter commented 9 years ago

Original comment by ultrot...@gmail.com on 9 Dec 2013 at 2:37