dcos/dcos-e2e

FileNotFoundError: [Errno 2] No such file or directory: while deleting the minidcos vagrant cluster

rajcspsg opened this issue · 3 comments

I have created local minidcos vagrant cluster using below command.

$ sudo minidcos vagrant create ./dcos_generate_config.sh --agents 0

when I list the cluster I see the cluster exists.

    $ sudo minidcos vagrant  list
    default

I'm not able to access the cluster using sudo minidcos vagrant web. I get the same error when I tried to destroy the cluster as below -

$ sudo minidcos vagrant  destroy
    Traceback (most recent call last):
    File "/usr/local/bin/minidcos", line 10, in <module>
        sys.exit(minidcos())
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
        return self.main(*args, **kwargs)
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 717, in main
        rv = self.invoke(ctx)
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
        return ctx.invoke(self.callback, **ctx.params)
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
        return callback(*args, **kwargs)
    File "/usr/local/lib/python3.7/site-packages/dcos_e2e_cli/dcos_vagrant/commands/destroy.py", line 59, in destroy
        cluster_vms.destroy()
    File "/usr/local/lib/python3.7/site-packages/dcos_e2e_cli/dcos_vagrant/commands/_common.py", line 294, in destroy
        self.vagrant_client.destroy()
    File "/usr/local/lib/python3.7/site-packages/dcos_e2e_cli/dcos_vagrant/commands/_common.py", line 274, in vagrant_client
        item for item in self.workspace_dir.iterdir()
    File "/usr/local/lib/python3.7/site-packages/dcos_e2e_cli/dcos_vagrant/commands/_common.py", line 274, in <listcomp>
        item for item in self.workspace_dir.iterdir()
    File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/pathlib.py", line 1074, in iterdir
        for name in self._accessor.listdir(self):
    FileNotFoundError: [Errno 2] No such file or directory: '/tmp/acaa37838a534dc0ae51c3fcc059f650'

How can I successfully delete the cluster?

I have asked in the stackoverflow as well.

I have now seen this error. I believe that it happens when the VirtualBox VMs are not in the Running state. For example, after the computer has been restarted. We either need to revive those VMs, or to not list them in the list command. The latter may be confusing as they still take up resources. Perhaps we could also add a clean command, or a list -a option.

Thank you for this bug report @rajcspsg .

The issue here was that the workspace directory was deleted, and yet the VMs were still detected.
The workspace is configurable as per the documentation.

This could happen because the workspace directory is somehow deleted while the VMs are running, but it also happens when the host is shut down (assuming the default workspace temporary directory is used).

The behaviour is now changed as of minidcos version 2019.04.08.1.
In particular, minidcos vagrant list no longer lists VMs which are not in the running state.
There is also a new minidcos vagrant clean command which cleans all VMs and leftover VMs.

Please reopen this issue if it is not solved by these changes.

Thanks @adamtheturtle. Your suggestion is working. I have updated the stackoverflow as well.