)]}'
{"nova/virt/disk/mount/nbd.py":[{"author":{"_account_id":1812,"name":"p-draigbrady","email":"P@draigBrady.com","username":"p-draigbrady"},"change_message_id":"abf014e3aad529352db93c9ebd5abbabd31c470c","unresolved":false,"context_lines":[{"line_number":49,"context_line":""},{"line_number":50,"context_line":"    def _find_unused(self, devices):"},{"line_number":51,"context_line":"        for device in devices:"},{"line_number":52,"context_line":"            if not os.path.exists(os.path.join(\u0027/sys/block/\u0027, device, \u0027pid\u0027)):"},{"line_number":53,"context_line":"                return device"},{"line_number":54,"context_line":"        LOG.warn(_(\u0027No free nbd devices\u0027))"},{"line_number":55,"context_line":"        return None"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAMX%2F%2F15k%3D","line":52,"updated":"2012-12-13 00:21:38.000000000","message":"so this is still racy. I.E. my point 1 might be addressed by this patch, but point 2 is probably not. So that comment should probably be reinstated?\n\nIf anything else grabs this nbd device between now and\nwhen we try to use it, we\u0027ll get an error.\nqemu-nbd -f pushes the lock down to the kernel\nwhich is the only safe place to do it.\n\nI suppose we could retry and get another device if qemu-nbd -c\nbelow fails, and that might alleviate issue 2 somewhat.","commit_id":"2bcd26cc92217f2b98643743af35f00de6a6af97"},{"author":{"_account_id":2271,"name":"Michael Still","email":"mikal@stillhq.com","username":"mikalstill"},"change_message_id":"1d4074648ca445acac8a03a0f6bac50131103ac7","unresolved":false,"context_lines":[{"line_number":49,"context_line":""},{"line_number":50,"context_line":"    def _find_unused(self, devices):"},{"line_number":51,"context_line":"        for device in devices:"},{"line_number":52,"context_line":"            if not os.path.exists(os.path.join(\u0027/sys/block/\u0027, device, \u0027pid\u0027)):"},{"line_number":53,"context_line":"                return device"},{"line_number":54,"context_line":"        LOG.warn(_(\u0027No free nbd devices\u0027))"},{"line_number":55,"context_line":"        return None"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAMX%2F%2F1wY%3D","line":52,"in_reply_to":"AAAAMX%2F%2F15k%3D","updated":"2012-12-13 02:20:23.000000000","message":"This is true. We\u0027ll also get an error if the device is grabbed in between us asking for it and checking. However, its a failure, not a silent unexpected thing now.\n\nThe next step is to wrap all this in some retry logic, which has to happen for when we run out of device files anyways.","commit_id":"2bcd26cc92217f2b98643743af35f00de6a6af97"},{"author":{"_account_id":1812,"name":"p-draigbrady","email":"P@draigBrady.com","username":"p-draigbrady"},"change_message_id":"abf014e3aad529352db93c9ebd5abbabd31c470c","unresolved":false,"context_lines":[{"line_number":56,"context_line":""},{"line_number":57,"context_line":"    def _detect_nbd_devices(self):"},{"line_number":58,"context_line":"        \"\"\"Detect nbd device files.\"\"\""},{"line_number":59,"context_line":"        return filter(NBD_DEVICE_RE.match, os.listdir(\u0027/sys/block/\u0027))"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"    def _allocate_nbd(self):"},{"line_number":62,"context_line":"        if not os.path.exists(\u0027/sys/block/nbd0\u0027):"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAMX%2F%2F16E%3D","line":59,"updated":"2012-12-13 00:21:38.000000000","message":"duplicate function","commit_id":"2bcd26cc92217f2b98643743af35f00de6a6af97"},{"author":{"_account_id":2271,"name":"Michael Still","email":"mikal@stillhq.com","username":"mikalstill"},"change_message_id":"1d4074648ca445acac8a03a0f6bac50131103ac7","unresolved":false,"context_lines":[{"line_number":56,"context_line":""},{"line_number":57,"context_line":"    def _detect_nbd_devices(self):"},{"line_number":58,"context_line":"        \"\"\"Detect nbd device files.\"\"\""},{"line_number":59,"context_line":"        return filter(NBD_DEVICE_RE.match, os.listdir(\u0027/sys/block/\u0027))"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"    def _allocate_nbd(self):"},{"line_number":62,"context_line":"        if not os.path.exists(\u0027/sys/block/nbd0\u0027):"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAMX%2F%2F1wU%3D","line":59,"in_reply_to":"AAAAMX%2F%2F16E%3D","updated":"2012-12-13 02:20:23.000000000","message":"LOL. Merge fail.","commit_id":"2bcd26cc92217f2b98643743af35f00de6a6af97"},{"author":{"_account_id":1812,"name":"p-draigbrady","email":"P@draigBrady.com","username":"p-draigbrady"},"change_message_id":"abf014e3aad529352db93c9ebd5abbabd31c470c","unresolved":false,"context_lines":[{"line_number":107,"context_line":"        # Make sure that the user process could conceivably be ours"},{"line_number":108,"context_line":"        pid \u003d self._read_pid_file(pidfile)"},{"line_number":109,"context_line":"        if not utils.is_parent_process(pid):"},{"line_number":110,"context_line":"            self.error \u003d _(\u0027nbd device stolen by another user\u0027)"},{"line_number":111,"context_line":"            return False"},{"line_number":112,"context_line":""},{"line_number":113,"context_line":"        self.linked \u003d True"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAMX%2F%2F15E%3D","line":110,"updated":"2012-12-13 00:21:38.000000000","message":"I\u0027ve no concrete issue with this but\nI\u0027m a bit worried about the robustness of the pid checking.\nAlso is this even required? If we get to here we know qemu-nbd -c\nhas worked and so we\u0027ve got the device. Or can qemu-nbd -c\nfail asynchronously? If that\u0027s the case is there a more direct\ncheck we can do on the pidfile, like correlating the output from stat() or something. Just thinking out loud here really.","commit_id":"2bcd26cc92217f2b98643743af35f00de6a6af97"},{"author":{"_account_id":2271,"name":"Michael Still","email":"mikal@stillhq.com","username":"mikalstill"},"change_message_id":"1d4074648ca445acac8a03a0f6bac50131103ac7","unresolved":false,"context_lines":[{"line_number":107,"context_line":"        # Make sure that the user process could conceivably be ours"},{"line_number":108,"context_line":"        pid \u003d self._read_pid_file(pidfile)"},{"line_number":109,"context_line":"        if not utils.is_parent_process(pid):"},{"line_number":110,"context_line":"            self.error \u003d _(\u0027nbd device stolen by another user\u0027)"},{"line_number":111,"context_line":"            return False"},{"line_number":112,"context_line":""},{"line_number":113,"context_line":"        self.linked \u003d True"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAMX%2F%2F1v0%3D","line":110,"in_reply_to":"AAAAMX%2F%2F15E%3D","updated":"2012-12-13 02:20:23.000000000","message":"I\u0027m not sure what qemu-nbd does here. The man page doesn\u0027t provide any detail of error handling (on Ubuntu at least). I\u0027ll dig deeper.","commit_id":"2bcd26cc92217f2b98643743af35f00de6a6af97"},{"author":{"_account_id":2271,"name":"Michael Still","email":"mikal@stillhq.com","username":"mikalstill"},"change_message_id":"00e5ed7755e5e2e09b25c34a5786c9d00dc7a420","unresolved":false,"context_lines":[{"line_number":107,"context_line":"        # Make sure that the user process could conceivably be ours"},{"line_number":108,"context_line":"        pid \u003d self._read_pid_file(pidfile)"},{"line_number":109,"context_line":"        if not utils.is_parent_process(pid):"},{"line_number":110,"context_line":"            self.error \u003d _(\u0027nbd device stolen by another user\u0027)"},{"line_number":111,"context_line":"            return False"},{"line_number":112,"context_line":""},{"line_number":113,"context_line":"        self.linked \u003d True"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAMX%2F%2F1t4%3D","line":110,"in_reply_to":"AAAAMX%2F%2F1v0%3D","updated":"2012-12-13 02:59:07.000000000","message":"Reading the qemu-nbd code, you\u0027re right. We\u0027ll get an exit code that indicates the device file is in use.","commit_id":"2bcd26cc92217f2b98643743af35f00de6a6af97"}]}
