[BUG] OpenNebula VM Create Fails
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
Creating an OpenNebula VM fails with an error:
[ERROR ] Failed to create VM hostname.example.org. Configuration value '__utils__' needs to be set
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/salt/cloud/__init__.py", line 1226, in create
output = self.clouds[func](vm_)
File "/usr/local/lib/python3.10/dist-packages/salt/loader/lazy.py", line 149, in __call__
return self.loader.run(run_func, *args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/salt/loader/lazy.py", line 1228, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/salt/loader/lazy.py", line 1243, in _run_as
return _func_or_method(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/salt/cloud/clouds/opennebula.py", line 1080, in create
data = __utils__["cloud.wait_for_ip"](
File "/usr/local/lib/python3.10/dist-packages/salt/loader/lazy.py", line 149, in __call__
return self.loader.run(run_func, *args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/salt/loader/lazy.py", line 1228, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/salt/loader/lazy.py", line 1243, in _run_as
return _func_or_method(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/salt/utils/cloud.py", line 2616, in wait_for_ip
data = update_callback(*update_args, **update_kwargs)
File "/usr/local/lib/python3.10/dist-packages/salt/cloud/clouds/opennebula.py", line 1070, in __query_node_data
node_data = show_instance(vm_name, call="action")
File "/usr/local/lib/python3.10/dist-packages/salt/cloud/clouds/opennebula.py", line 1898, in show_instance
__utils__["cloud.cache_node"](node, _get_active_provider_name(), __opts__)
File "/usr/local/lib/python3.10/dist-packages/salt/loader/context.py", line 78, in __getitem__
return self.value()[item]
File "/usr/local/lib/python3.10/dist-packages/salt/loader/context.py", line 72, in value
return loader.pack[self.name]
KeyError: '__utils__'
Setup
(Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)
Please be as specific as possible and give set-up details.
- on-prem machine
- VM (Virtualbox, KVM, etc. please specify)
- VM running on a cloud service, please be explicit and add details
- container (Kubernetes, Docker, containerd, etc. please specify)
- or a combination, please be explicit
- jails if it is FreeBSD
- classic packaging
- onedir packaging
- used bootstrap to install
Steps to Reproduce the behavior
/usr/local/bin/salt-run' 'cloud.map_run' 'map_data={"one-ubuntu-profile":[{"hostname.example.org":{"cpu":1,"vcpu":1,"memory":512}}]}'
Expected behavior
The VM is created.
Versions Report
salt --versions-report
Salt Version:
Salt: 3005.1
Dependency Versions:
cffi: 1.15.1
cherrypy: Not Installed
dateutil: 2.8.2
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.1.2
libgit2: Not Installed
M2Crypto: Not Installed
Mako: 1.2.4
msgpack: 1.0.5
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: 2.21
pycrypto: Not Installed
pycryptodome: 3.17
pygit2: Not Installed
Python: 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0]
python-gnupg: Not Installed
PyYAML: 6.0
PyZMQ: 20.0.0
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.3
System Versions:
dist: ubuntu 22.04 Jammy Jellyfish
locale: utf-8
machine: x86_64
release: 5.15.0-75-generic
system: Linux
version: Ubuntu 22.04 Jammy Jellyfish
Additional context
Referenced a couple of years ago here: https://github.com/saltstack/salt/issues/60239#issuecomment-957801409
Fix
The fix is to change: https://github.com/saltstack/salt/blob/2d02017d6c8e2b950eec959ba25ffe62f72214e3/salt/cloud/clouds/opennebula.py#L1080
From: data = __utils__["cloud.wait_for_ip"]( to data = salt.utils.cloud.wait_for_ip(
I've tested this out dozens of times whilst adding the vm_disk_resize feature.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in salt/cloud/clouds/opennebula.py, especially create and show_instance near the referenced line, and run the reported salt-run cloud.map_run reproduction. Done means the OpenNebula VM is created without the 'utils' KeyError; no test file is named in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100