{"action":"created","issue":{"url":"https://api.github.com/repos/porcupie/rbd-docker-plugin/issues/5","repository_url":"https://api.github.com/repos/porcupie/rbd-docker-plugin","labels_url":"https://api.github.com/repos/porcupie/rbd-docker-plugin/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/porcupie/rbd-docker-plugin/issues/5/comments","events_url":"https://api.github.com/repos/porcupie/rbd-docker-plugin/issues/5/events","html_url":"https://github.com/porcupie/rbd-docker-plugin/issues/5","id":158616927,"number":5,"title":"rbd-docker-plugin shouldn't unmount and remove lock when device have lock exclusive","user":{"login":"CBR09","id":15046232,"avatar_url":"https://avatars.githubusercontent.com/u/15046232?v=3","gravatar_id":"","url":"https://api.github.com/users/CBR09","html_url":"https://github.com/CBR09","followers_url":"https://api.github.com/users/CBR09/followers","following_url":"https://api.github.com/users/CBR09/following{/other_user}","gists_url":"https://api.github.com/users/CBR09/gists{/gist_id}","starred_url":"https://api.github.com/users/CBR09/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CBR09/subscriptions","organizations_url":"https://api.github.com/users/CBR09/orgs","repos_url":"https://api.github.com/users/CBR09/repos","events_url":"https://api.github.com/users/CBR09/events{/privacy}","received_events_url":"https://api.github.com/users/CBR09/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/porcupie/rbd-docker-plugin/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"porcupie","id":1464209,"avatar_url":"https://avatars.githubusercontent.com/u/1464209?v=3","gravatar_id":"","url":"https://api.github.com/users/porcupie","html_url":"https://github.com/porcupie","followers_url":"https://api.github.com/users/porcupie/followers","following_url":"https://api.github.com/users/porcupie/following{/other_user}","gists_url":"https://api.github.com/users/porcupie/gists{/gist_id}","starred_url":"https://api.github.com/users/porcupie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/porcupie/subscriptions","organizations_url":"https://api.github.com/users/porcupie/orgs","repos_url":"https://api.github.com/users/porcupie/repos","events_url":"https://api.github.com/users/porcupie/events{/privacy}","received_events_url":"https://api.github.com/users/porcupie/received_events","type":"User","site_admin":false},"milestone":null,"comments":5,"created_at":"2016-06-06T07:35:47Z","updated_at":"2016-06-08T03:05:23Z","closed_at":null,"body":"Hi @porcupie and everyone.\r\nI created container with rbd test image, rbd-docker-plugin also created lock exclusive for test image, when I tried to create container with same rbd test image, docker told me  \"Unable to get Exlusive Lock\", I've tried again, docker told me \"Unable to mount device.\", everything seem fine but I saw rbd-docker-plugin also unmount and remove lock exclusive. Is it a bug?\r\n\r\nFirst, create container with rbd test image, check lock list and mount point\r\n\r\n> root@ceph:~# docker run -it --volume-driver=rbd --volume test:/test ceph/base bash\r\n> root@ceph:~# rbd lock list test\r\n> There is 1 exclusive lock on this image.\r\n> Locker       ID   Address                 \r\n> client.14507 ceph 10.76.0.79:0/2029373395 \r\n> root@ceph:~# cat /proc/self/mountinfo  | grep rbd\r\n> 56 22 251:0 / /var/lib/docker-volumes/rbd/rbd/test rw,relatime - xfs /dev/rbd4 rw,attr2,inode64,sunit=8192,swidth=8192,noquota\r\n\r\nSwitch terminal and tried to create container with same rbd test image two time, I got different logs, so confuse\r\n\r\n> root@ceph:~# docker run -it --volume-driver=rbd --volume test:/test ceph/base bash\r\n> docker: Error response from daemon: VolumeDriver.Mount: Unable to get Exlusive Lock.\r\n> root@ceph:~# docker run -it --volume-driver=rbd --volume test:/test ceph/base bash\r\n> docker: Error response from daemon: VolumeDriver.Mount: Unable to mount device.\r\n\r\nAnd I didn't see lock exclusive anymore\r\n\r\n> root@ceph:~# rbd lock list test\r\n> root@ceph:~# cat /proc/self/mountinfo  | grep rbd\r\n> root@ceph:~# \r\n\r\n\r\nrbd-docker-plugin log:\r\n\r\n> rbd-volume-plugin: 2016/06/06 14:33:02 driver.go:722: DEBUG: parseImagePoolNameSize: \"test\": [\"test\" \"\" \"\" \"test\" \"\" \"\"]\r\n> rbd-volume-plugin: 2016/06/06 14:33:02 driver.go:530: INFO: API Path request(test) => /var/lib/docker-volumes/rbd/rbd/test\r\n> rbd-volume-plugin: 2016/06/06 14:33:03 driver.go:348: INFO: API Mount(test)\r\n> rbd-volume-plugin: 2016/06/06 14:33:03 driver.go:722: DEBUG: parseImagePoolNameSize: \"test\": [\"test\" \"\" \"\" \"test\" \"\" \"\"]\r\n> rbd-volume-plugin: 2016/06/06 14:33:03 driver.go:1158: DEBUG: sh CMD: &{\"/usr/bin/rbd\" [\"rbd\" \"--pool\" \"rbd\" \"--conf\" \"/etc/ceph/ceph.conf\" \"--id\" \"admin\" \"info\" \"test\"] [] \"\" <nil> <nil> <nil> [] %!q(*syscall.SysProcAttr=<nil>) %!q(*os.Process=<nil>) \"<nil>\" <nil> %!q(bool=false) [] [] [] [] %!q(chan error=<nil>)}\r\n> rbd-volume-plugin: 2016/06/06 14:33:03 driver.go:1158: DEBUG: sh CMD: &{\"/usr/bin/rbd\" [\"rbd\" \"--pool\" \"rbd\" \"--conf\" \"/etc/ceph/ceph.conf\" \"--id\" \"admin\" \"lock\" \"add\" \"test\" \"ceph\"] [] \"\" <nil> <nil> <nil> [] %!q(*syscall.SysProcAttr=<nil>) %!q(*os.Process=<nil>) \"<nil>\" <nil> %!q(bool=false) [] [] [] [] %!q(chan error=<nil>)}\r\n> rbd-volume-plugin: 2016/06/06 14:33:03 driver.go:1158: DEBUG: sh CMD: &{\"/usr/bin/rbd\" [\"rbd\" \"--pool\" \"rbd\" \"--conf\" \"/etc/ceph/ceph.conf\" \"--id\" \"admin\" \"map\" \"test\"] [] \"\" <nil> <nil> <nil> [] %!q(*syscall.SysProcAttr=<nil>) %!q(*os.Process=<nil>) \"<nil>\" <nil> %!q(bool=false) [] [] [] [] %!q(chan error=<nil>)}\r\n> rbd-volume-plugin: 2016/06/06 14:33:03 driver.go:1158: DEBUG: sh CMD: &{\"/sbin/blkid\" [\"blkid\" \"-o\" \"value\" \"-s\" \"TYPE\" \"/dev/rbd/rbd/test\"] [] \"\" <nil> <nil> <nil> [] %!q(*syscall.SysProcAttr=<nil>) %!q(*os.Process=<nil>) \"<nil>\" <nil> %!q(bool=false) [] [] [] [] %!q(chan error=<nil>)}\r\n> rbd-volume-plugin: 2016/06/06 14:33:03 driver.go:1158: DEBUG: sh CMD: &{\"/bin/mount\" [\"mount\" \"-t\" \"xfs\" \"/dev/rbd/rbd/test\" \"/var/lib/docker-volumes/rbd/rbd/test\"] [] \"\" <nil> <nil> <nil> [] %!q(*syscall.SysProcAttr=<nil>) %!q(*os.Process=<nil>) \"<nil>\" <nil> %!q(bool=false) [] [] [] [] %!q(chan error=<nil>)}\r\n> rbd-volume-plugin: 2016/06/06 14:33:03 driver.go:429: ERROR: mounting device(/dev/rbd/rbd/test) to directory(/var/lib/docker-volumes/rbd/rbd/test): exit status 32\r\n> rbd-volume-plugin: 2016/06/06 14:33:03 driver.go:973: INFO: unlockImage(rbd/test, ceph)\r\n> rbd-volume-plugin: 2016/06/06 14:33:03 driver.go:1158: DEBUG: sh CMD: &{\"/usr/bin/rbd\" [\"rbd\" \"--pool\" \"rbd\" \"--conf\" \"/etc/ceph/ceph.conf\" \"--id\" \"admin\" \"lock\" \"list\" \"test\"] [] \"\" <nil> <nil> <nil> [] %!q(*syscall.SysProcAttr=<nil>) %!q(*os.Process=<nil>) \"<nil>\" <nil> %!q(bool=false) [] [] [] [] %!q(chan error=<nil>)}\r\n> rbd-volume-plugin: 2016/06/06 14:33:03 driver.go:994: DEBUG: found lines matching ceph:\r\n> [client.14527 ceph 10.76.0.79:0/2929348065]\r\n> rbd-volume-plugin: 2016/06/06 14:33:03 driver.go:1158: DEBUG: sh CMD: &{\"/usr/bin/rbd\" [\"rbd\" \"--pool\" \"rbd\" \"--conf\" \"/etc/ceph/ceph.conf\" \"--id\" \"admin\" \"lock\" \"rm\" \"test\" \"ceph\" \"client.14527\"] [] \"\" <nil> <nil> <nil> [] %!q(*syscall.SysProcAttr=<nil>) %!q(*os.Process=<nil>) \"<nil>\" <nil> %!q(bool=false) [] [] [] [] %!q(chan error=<nil>)}\r\n> rbd-volume-plugin: 2016/06/06 14:33:03 driver.go:1158: DEBUG: sh CMD: &{\"/usr/bin/rbd\" [\"rbd\" \"--conf\" \"/etc/ceph/ceph.conf\" \"--id\" \"admin\" \"unmap\" \"/dev/rbd/rbd/test\"] [] \"\" <nil> <nil> <nil> [] %!q(*syscall.SysProcAttr=<nil>) %!q(*os.Process=<nil>) \"<nil>\" <nil> %!q(bool=false) [] [] [] [] %!q(chan error=<nil>)}\r\n> rbd-volume-plugin: 2016/06/06 14:33:03 driver.go:549: INFO: API Unmount(test)\r\n> rbd-volume-plugin: 2016/06/06 14:33:03 driver.go:722: DEBUG: parseImagePoolNameSize: \"test\": [\"test\" \"\" \"\" \"test\" \"\" \"\"]\r\n> rbd-volume-plugin: 2016/06/06 14:33:03 driver.go:577: WARN: Volume is not in known mounts: will attempt limited Unmount: rbd/test\r\n> rbd-volume-plugin: 2016/06/06 14:33:03 driver.go:1158: DEBUG: sh CMD: &{\"/bin/umount\" [\"umount\" \"/dev/rbd/rbd/test\"] [] \"\" <nil> <nil> <nil> [] %!q(*syscall.SysProcAttr=<nil>) %!q(*os.Process=<nil>) \"<nil>\" <nil> %!q(bool=false) [] [] [] [] %!q(chan error=<nil>)}\r\n> rbd-volume-plugin: 2016/06/06 14:33:03 driver.go:592: ERROR: unmounting device(/dev/rbd/rbd/test): exit status 1\r\n> rbd-volume-plugin: 2016/06/06 14:33:03 driver.go:1158: DEBUG: sh CMD: &{\"/usr/bin/rbd\" [\"rbd\" \"--conf\" \"/etc/ceph/ceph.conf\" \"--id\" \"admin\" \"unmap\" \"/dev/rbd/rbd/test\"] [] \"\" <nil> <nil> <nil> [] %!q(*syscall.SysProcAttr=<nil>) %!q(*os.Process=<nil>) \"<nil>\" <nil> %!q(bool=false) [] [] [] [] %!q(chan error=<nil>)}\r\n> rbd-volume-plugin: 2016/06/06 14:33:03 driver.go:600: ERROR: unmapping image device(/dev/rbd/rbd/test): exit status 16\r\n> rbd-volume-plugin: 2016/06/06 14:33:03 driver.go:973: INFO: unlockImage(rbd/test, ceph)\r\n> rbd-volume-plugin: 2016/06/06 14:33:03 driver.go:1158: DEBUG: sh CMD: &{\"/usr/bin/rbd\" [\"rbd\" \"--pool\" \"rbd\" \"--conf\" \"/etc/ceph/ceph.conf\" \"--id\" \"admin\" \"lock\" \"list\" \"test\"] [] \"\" <nil> <nil> <nil> [] %!q(*syscall.SysProcAttr=<nil>) %!q(*os.Process=<nil>) \"<nil>\" <nil> %!q(bool=false) [] [] [] [] %!q(chan error=<nil>)}\r\n> rbd-volume-plugin: 2016/06/06 14:33:03 driver.go:986: ERROR: image not locked or ceph rbd error: %!s(<nil>)\r\n\r\n\r\nI think rbd-docker-plugin should check device have a lock exclusive or when got \"locking RBD Image(test): exit status 16\" error, rbd-docker-plugin should be stop and notify to docker daemon.\r\n\r\nThanks\r\n"},"comment":{"url":"https://api.github.com/repos/porcupie/rbd-docker-plugin/issues/comments/224475548","html_url":"https://github.com/porcupie/rbd-docker-plugin/issues/5#issuecomment-224475548","issue_url":"https://api.github.com/repos/porcupie/rbd-docker-plugin/issues/5","id":224475548,"user":{"login":"porcupie","id":1464209,"avatar_url":"https://avatars.githubusercontent.com/u/1464209?v=3","gravatar_id":"","url":"https://api.github.com/users/porcupie","html_url":"https://github.com/porcupie","followers_url":"https://api.github.com/users/porcupie/followers","following_url":"https://api.github.com/users/porcupie/following{/other_user}","gists_url":"https://api.github.com/users/porcupie/gists{/gist_id}","starred_url":"https://api.github.com/users/porcupie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/porcupie/subscriptions","organizations_url":"https://api.github.com/users/porcupie/orgs","repos_url":"https://api.github.com/users/porcupie/repos","events_url":"https://api.github.com/users/porcupie/events{/privacy}","received_events_url":"https://api.github.com/users/porcupie/received_events","type":"User","site_admin":false},"created_at":"2016-06-08T03:05:23Z","updated_at":"2016-06-08T03:05:23Z","body":"@CBR09 unfortunately it is not that simple.  \r\n\r\nThe Unmount api method is being called - this means that docker engine wants me to unmount, unmap and unlock the image in question.  This is called even when the lock is exclusive, as it always is the case.\r\n\r\nI'm not sure how to tell this case apart from the legitimate case of calling Unmount, so will have to do more research into a possible fix.  "}}
{"actor":{"display_login":"porcupie"}}