Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

losetup -a shows different status depends on its version #741

Open
akry opened this issue Oct 1, 2015 · 1 comment
Open

losetup -a shows different status depends on its version #741

akry opened this issue Oct 1, 2015 · 1 comment

Comments

@akry
Copy link
Contributor

akry commented Oct 1, 2015

hva shows an error when launching an instance.

2015-09-29 12:51:51 JobContext thr=JobWorker[0/1] [ERROR]: Caught RuntimeError: Failed to find loop device from: /var/lib/wakame-vdc/instances/i-3rq0dr2o/metadata.img
        /opt/axsh/wakame-vdc/dcmgr/lib/dcmgr/helpers/block_device_helper.rb:77:in `detach_loop'
        /opt/axsh/wakame-vdc/dcmgr/lib/dcmgr/drivers/hypervisor/linux_hypervisor.rb:146:in `setup_metadata_drive'

It happens here:
https://github.com/axsh/wakame-vdc/blob/develop/dcmgr/lib/dcmgr/helpers/block_device_helper.rb#L55

if i =~ %r{^(/dev/loop\d+): \[([0-9a-f]+)\]:(\d+) } && $2.hex == stat.dev && $3.to_i == stat.ino

It assumes $2 as a hex value where stat and losetup -a show different results than expected.

"stat: #<File::Stat dev=0x803, ino=2382902, mode=0100644, nlink=1, uid=0, gid=0, rdev=0x0, size=10485760, blksize=4096, blocks=312, atime=2015-09-29 12:51:51 -0700, mtime=2015-09-29 12:51:51 -0700, ctime=2015-09-29 12:51:51 -0700>"
[root@localhost dcmgr]# losetup -a
/dev/loop0: [2051]:141745283 (/var/lib/wakame-vdc/instances/i-1wllauqo/metadata.img (deleted))

0x803 is 2051 in decimal, but "2051".hex is not 0x803 so it fails.

@akry
Copy link
Contributor Author

akry commented Oct 1, 2015

on CentOS 6.4

[root@localhost i-zb241121]# which losetup
/sbin/losetup
[root@localhost i-zb241121]# rpm -qf /sbin/losetup
util-linux-ng-2.17.2-12.18.el6.x86_64

on CentOS 7

[root@localhost dcmgr]# losetup --version
losetup from util-linux 2.23.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants