Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[OneSwap] Conversion fails with NoMethodError in add_one_nics when guest IPs are known

Open Beginner friendly
#8,237 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
ruby
Domain
cloud, networking

Research direction

Start with add_one_nics in oneswap_helper.rb, especially the reported lines 3563 and 4062–4091, and trace how net_templ is built under netkey before the success message reads NETWORK_ID. Reproduce with a vCenter VM that reports guest IPs, using --network without --skip-ip; done means the NIC is added with the guest IP and the VM template is created without the NoMethodError.

Written by the indexing model from the issue text.

Description

Category: OneSwap Status: Accepted

Description
When a conversion runs with --network, vCenter reports guest IP addresses for a NIC, and --skip-ip is not set, OneSwap fails while adding the NICs to the VM template:

Creating AR for IP <ip>...Success
Error: undefined method '[]' for nil

In add_one_nics, the per-IP loop builds net_templ under the key held in netkey (NIC_ALIAS for the first address, NETWORK_ALIAS after that). The success message then reads net_templ['NIC']['NETWORK_ID']. In that branch net_templ['NIC'] is nil, so the puts raises right after the address range has been added to the virtual network.

  • 7.4.1: oneswap_helper.rb:3563

To Reproduce

  1. Pick a vCenter VM for which vCenter reports guest IPs (guest.net[].ipConfig.ipAddress).
  2. Convert it with a target network and without --skip-ip, e.g. oneswap convert <vm> $VOPTS --network <vnet-id>.
  3. The disk conversion and image import succeed. The run then fails while adding the NIC, with the error above.

Expected behavior
The NIC is added with the guest's IP, and the VM template is created.

Details

  • Affected Component: OneSwap
  • Hypervisor: KVM
  • Version: 7.4.1 (still present on master, dd172c0)

Additional context
add_one_nics runs after the images are imported oneswap_helper.rb:5130. A failure here leaves the new images in OpenNebula with no VM template, and the address range that was just added stays in the virtual network.

The fix should probably also cover these other problems in the same block oneswap_helper.rb:4062-4091

Progress Status

  • Code committed
  • Testing - QA
  • Documentation (Release notes - resolved issues, compatibility, known issues)
Dominant language
JavaScript
Stars
1.7k
Forks
534
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OpenNebula/one

All issues in OpenNebula/one

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.