Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default NIC model_type virtio is not being setted when attach new NIC to the VM #6575

Closed
3 tasks
Franco-Sparrow opened this issue Apr 28, 2024 · 6 comments
Closed
3 tasks

Comments

@Franco-Sparrow
Copy link

Franco-Sparrow commented Apr 28, 2024

Description
When you instantiate a new VM with a given number of NICs or just one, and you dont specify the model type, Opennebula is configured to set by default to use virtio. This works when the VM is instantiated, but not when you add NICs after being instantiated, without specify the emulated model type of the NIC, which should relay on the default driver (virtio). Instead of this, the new NIC is configured for driver RTL-8100/8101L/8139 PCI fast Ethernet Adapter (rev 20), in other words, Realtek.

Issue confirmed for OpenNebula clusters running in 6.8.1 and 6.8.2.

WhatsApp Image 2024-04-27 at 10 46 56 PM

To Reproduce
Create a new VM. After created, add a new NIC Verify the PCI devices on the VM with lspci.

Expected behavior
Added a new NIC using virtio driver, as configured by default.

Details

  • Affected Component: [Network]
  • Hypervisor: [KVM]
  • Version: [6.6.x, 6.8.x]

Additional context
Add any other context about the problem here.

Progress Status

  • Code committed
  • Testing - QA
  • Documentation (Release notes - resolved issues, compatibility, known issues)
@Franco-Sparrow Franco-Sparrow changed the title NIC model_type == virtio is not being setted when attach new NIC to the VM Default NIC model_type virtio is not being setted when attach new NIC to the VM Apr 28, 2024
@nachowork90
Copy link

Hi @Franco-Sparrow ,

I have found something curious:

require_relative '../lib/command'
include VirtualMachineManagerKVM
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
load_local_env
domain = ARGV[0]
vm = KvmVM.new(STDIN.read)

In the line 61 of the previews code, the environment loaded is the local one, but I assume that this action must run in the host, so I believe that the function that needs to called is the load_remote_env.

I will do some test and i will back to you!
PD: This is not commonly used because only apply for day2 operations!

@Franco-Sparrow
Copy link
Author

Franco-Sparrow commented Apr 28, 2024

Thanks @nachowork90 🥇 I tested your configuration and it works now!!!

Hi @rsmontero, this is a confirmed issue that is present since 6.6.x. Please, give it a chance to this, we have verified on clusters using 6.6.3, 6.8.1 and 6.8.2.

PS: BTW, your commit when changing this file from bash to ruby is beautifull :)

Regards

@rsmontero rsmontero added this to the Release 7.0 milestone May 14, 2024
@ibrahimkahn
Copy link

I just encountered the same error related to model name of NIC on the same ON version as mentioned by the OP. In my case, the issue is intermittent. I encountered the error while instantiating Windows VM, where it would not boot with a NIC attached when NIC = "virtio" attribute is added to the template. The VM logs throws Model name has invalid characters error causing BOOT_FAILURE state. Removing the attribute from template works and the VM boots fine.

I'll try out your fix @nachowork90 and give feedback here. Thanks

Also, thank you @Franco-Sparrow for the bug report and @rsmontero for adding fix to next release.

@rsmontero
Copy link
Member

So @Franco-Sparrow, changing to load_remote_env fixed for you?

@Franco-Sparrow
Copy link
Author

Hi Sir @rsmontero

Yes, in my case I havent faced the issue that @ibrahimkahn explained, only when adding new nics and @nachowork90 's patch fixed the problem.

@rsmontero rsmontero modified the milestones: Release 7.0, Release 6.10.0 May 16, 2024
rsmontero added a commit that referenced this issue May 16, 2024
This properly loads kvmrc values on attach nic, in particular DEFAULT_ATTACH_NIC_MODEL

(cherry picked from commit cd5527e7d6e89d721938331a56d1679a1c85af4d)
@rsmontero
Copy link
Member

Thanks, fix is now merge. In the meantime @ibrahimkahn you can apply the patch manually to /var/lib/one/remotes/vmm/kvm/attach_nic and do a onehost forceupdate to propagate the changes.

rsmontero added a commit to OpenNebula/docs that referenced this issue May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants