Project

General

Profile

Actions

Bug #6476

closed

Unable to associate oVirt VM with multiple interfaces

Added by Trey Dockendorf almost 10 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Category:
Compute resources
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

I have a Host in Foreman that was associated to a Libvirt compute resource. I disassociated it after migrating it to oVirt. When I attempt to re-associate that VM to the oVirt compute resource it fails with "No host found to associate this VM with".

Looking at the Rails console I see it's trying to query the DB using wrong MAC address as the search condition.

> Host.find_by_name('syslog.brazos.tamu.edu').mac
  Host::Managed Load (0.2ms)  SELECT `hosts`.* FROM `hosts` WHERE `hosts`.`type` IN ('Host::Managed') AND `hosts`.`name` = 'syslog.brazos.tamu.edu' LIMIT 1
=> "52:54:00:ea:a8:40" 
> @compute_resource = ComputeResource.find(2)
> @vm = @compute_resource.find_vm_by_uuid('534078e6-678b-4490-8f68-60d002881ca2')
> host = @compute_resource.associated_host(@vm) if @compute_resource.respond_to?(:associated_host)
  Host::Managed Load (1.2ms)  SELECT `hosts`.* FROM `hosts` WHERE `hosts`.`type` IN ('Host::Managed') AND `hosts`.`mac` = '52:54:00:dc:9d:bd' LIMIT 1
=> nil

That host's secondary interface is used in the SELECT statement. My guess is because when the two are "sorted", that one is first.

irb(main):018:0> @vm.interfaces
=>   <Fog::Compute::Ovirt::Interfaces
    [
      <Fog::Compute::Ovirt::Interface
        id="d257a1a3-82b3-457e-9da2-364d0b269b38",
        name="eth1",
        network="3d3dac29-4642-4df1-a860-91606d6c08ab",
        interface="virtio",
        mac="52:54:00:dc:9d:bd" 
      >,
      <Fog::Compute::Ovirt::Interface
        id="218c9e72-6b1b-4fe7-a807-dc177ef7f9ef",
        name="eth0",
        network="00000000-0000-0000-0000-000000000009",
        interface="virtio",
        mac="52:54:00:ea:a8:40" 
      >
    ]
  >
irb(main):019:0> @vm.interfaces.first
=>   <Fog::Compute::Ovirt::Interface
    id="d257a1a3-82b3-457e-9da2-364d0b269b38",
    name="eth1",
    network="3d3dac29-4642-4df1-a860-91606d6c08ab",
    interface="virtio",
    mac="52:54:00:dc:9d:bd" 
  >
Actions

Also available in: Atom PDF