Skip to content

VMware plugin: fix check_mac_address() for vm.config not present#2059

Merged
BareosBot merged 3 commits intobareos:masterfrom
swenske:swe-white-odd-marten
Feb 17, 2025
Merged

VMware plugin: fix check_mac_address() for vm.config not present#2059
BareosBot merged 3 commits intobareos:masterfrom
swenske:swe-white-odd-marten

Conversation

@swenske
Copy link

@swenske swenske commented Dec 12, 2024

Thank you for contributing to the Bareos Project!

Please check

  • Short description and the purpose of this PR is present above this paragraph
  • Your name is present in the AUTHORS file (optional)

If you have any questions or problems, please give a comment in the PR.

Helpful documentation and best practices

Checklist for the reviewer of the PR (will be processed by the Bareos team)

Make sure you check/merge the PR using devtools/pr-tool to have some simple automated checks run and a proper changelog record added.

General
  • Is the PR title usable as CHANGELOG entry?
  • Purpose of the PR is understood
  • Commit descriptions are understandable and well formatted
  • Required backport PRs have been created
  • Correct milestone is set
Source code quality
  • Source code changes are understandable
  • Variable and function names are meaningful
  • Code comments are correct (logically and spelling)

@swenske
Copy link
Author

swenske commented Dec 12, 2024

Replace #2030 (sorry for the mess)

When the vmware plugin recreates a VM it checks all MAC addresses to avoid a conflict.
If a cloning (or maybe also migration) task is in progress, the destination VM does not have a config yet and the following error occurs:

2024-11-20 15:53:18.874 | DEBUG | bareos-fd-vmware:check_mac_address:3131 - !!! vm: 'vim.VirtualMachine:vm-233350'
2024-11-20 15:53:18.878 | DEBUG | bareos-fd-vmware:check_mac_address:3132 - !!! vm.config: None
bareos-disk-sd-int-fr2.storage.xxxx.xxxx.xx (150): include/python_plugins_common.inc:125-30 bareosfd: Traceback (most recent call last):
File "/usr/lib/bareos/plugins/BareosFdWrapper.py", line 59, in handle_plugin_event
return bareos_fd_plugin_object.handle_plugin_event(event)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/bareos/plugins/bareos-fd-vmware.py", line 1076, in handle_plugin_event
return self.start_restore_job()
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/bareos/plugins/bareos-fd-vmware.py", line 618, in start_restore_job
return self.vadp.prepare_vm_restore()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/bareos/plugins/bareos-fd-vmware.py", line 1549, in prepare_vm_restore
if not self.create_vm():
^^^^^^^^^^^^^^^
File "/usr/lib/bareos/plugins/bareos-fd-vmware.py", line 1883, in create_vm
self.check_mac_address(config_info)
File "/usr/lib/bareos/plugins/bareos-fd-vmware.py", line 3133, in check_mac_address
for dev in vm.config.hardware.device:
^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'hardware'

@swenske swenske changed the title VMware plugin: fix check_mac_address() VMware plugin: fix check_mac_address() for vm.config not present Dec 12, 2024
@sduehr sduehr self-requested a review December 13, 2024 18:02
@sduehr sduehr self-assigned this Dec 13, 2024
@bruno-at-bareos bruno-at-bareos added this to the 25.0.0 milestone Jan 28, 2025
Copy link
Member

@sduehr sduehr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for your contribution.

@pstorz pstorz force-pushed the swe-white-odd-marten branch from 02def4d to bfb32b3 Compare February 17, 2025 10:19
@BareosBot BareosBot merged commit 9d7c4c0 into bareos:master Feb 17, 2025
1 check was pending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants