nbd device can not be released after injecting files into image if mount operation failed
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Undecided
|
wangpan |
Bug Description
I got this issue with stable folsom when I wanted to run a windows8 instance, but I believe this issue still exists in grizzly.
My host distro is debian wheezy, and the version of 'mount' is mount_2.
error logs:
2013-03-07 17:52:50 DEBUG nova.utils [-] Running cmd (subprocess): sudo nova-rootwrap /etc/nova/
2013-03-07 17:52:50 DEBUG nova.utils [-] Result was 0 from (pid=19455) execute /usr/local/
2013-03-07 17:52:50 DEBUG nova.utils [-] Running cmd (subprocess): sudo nova-rootwrap /etc/nova/
2013-03-07 17:52:51 DEBUG nova.utils [-] Result was 0 from (pid=19455) execute /usr/local/
=============here we can see that the 'umount' operation isn't executed=
2013-03-07 17:52:51 DEBUG nova.utils [-] Running cmd (subprocess): sudo nova-rootwrap /etc/nova/
2013-03-07 17:52:51 DEBUG nova.utils [-] Result was 1 from (pid=19455) execute /usr/local/
2013-03-07 17:52:51 WARNING nova.virt.
I have debug this issue inline, and find that error occurs in the 'mount' operation, (===but the nbd device has been mounted!===):
_out, err = utils.trycmd(
if err: ######### err is set by the utils.trycmd() method.
return False #### return here
so the do_umount method will not call the unmnt_dev method because self.mounted is False:
def do_umount(self):
"""Call the unmnt, unmap and unget operations."""
if self.mounted:
and then the 'kpartx -d' operation will fail(raise ProcessExecutio
Finally, the nbd device used by qemu-nbd isn't released!
Changed in nova: | |
milestone: | none → grizzly-rc1 |
status: | Fix Committed → Fix Released |
Changed in nova: | |
milestone: | grizzly-rc1 → 2013.1 |
no longer affects: | nova/folsom |
And I have try this with mount_2. 20.1-4_ amd64.deb installed in host, the 'mount' operation is failed with nbd device has NOT been mounted, so the nbd device is released successfully.
I guess this is a bug of 'mount', but it's better that we fix it by changing our nova codes.