Project

General

Profile

Actions

Bug #13898

open

Hammer : issue with provisioning openstack virtual machine with 2 interfaces

Added by Olivier Lebhard about 8 years ago. Updated almost 8 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Compute resources - OpenStack
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Files

foreman - wrong nic.png View foreman - wrong nic.png 35.5 KB Olivier Lebhard, 02/25/2016 08:27 AM
Actions #1

Updated by Dominic Cleal about 8 years ago

  • Status changed from New to Need more information

There's no information in this ticket, please can you explain the issue?

Actions #2

Updated by Olivier Lebhard about 8 years ago

Hello,

I have an issue with provisioning openstack virtual machine with 2 network interfaces.
1 - eth1 is main interface administration interface (name : adm)
2 - eth0 is another interface (name : usr)

hammer -c ~/.hammer/int00.yml host create
--name='server_name'
--hostgroup='hostgroup'
--environment='environment'
--compute-resource='compute_resource'
--compute-attributes='flavor_ref=53,security_groups=default,image_ref=41362541-79b8-4dd9-9c1f-670546e84fa6,nics=["ba535079-ed45-4e19-a988-74ce08ecf2ce", "f5025778-cd74-45dc-a79d-17a066c6ab1d"]'
--volume='capacity=32'
--volume='capacity=26'
--volume='capacity=11'
--interface='type=interface,identifier=eth0,managed=true,domain_id=8,subnet_id=103'
--interface='type=interface,identifier=eth1,managed=true,primary=true,provision=true,domain_id=1,subnet_id=104'

Notes :
Here the result of "neutron network-list" for the compute attributes
ba535079-ed45-4e19-a988-74ce08ecf2ce | int00-all-all_usr | 54152b5f-f5c5-4333-bc64-751c5666aa5b 10.9.0.0/23 | | f5025778-cd74-45dc-a79d-17a066c6ab1d | int00-all-all_adm | 3ad34b37-4040-4684-91e1-897e037bf79d 10.245.0.0/23

Here the result of hammer subnet list for the interfaces attributes (subnet_id)
103 | int00-all-all_usr | 10.9.0.0 | 255.255.254.0
104 | int00-all-all_adm | 10.245.0.0 | 255.255.254.0

Here the result of hammer domain list for the interfaces attributes (domain_id)
1 | adm
8 | usr


I can see my virtual machine in openstack , the following networks :
- network_usr=10.9.0.190
- network_adm=10.245.0.198

The problem, when i go to foreman host page, on nics tab i see
eth1 = 10.9.0.190 or it should be 10.245.0.198
eth0 with none or it should get the ip address
(i've attached a screenshot)

thanks and let me know if it's not clear

Actions #3

Updated by Dominic Cleal about 8 years ago

  • Project changed from Foreman to Hammer CLI

Can you attach debug from your Hammer command? run "hammer -d ..." to enable it, it'll print out the parameters being sent to Foreman.

I'm unsure that the "nics" list is in a correct format.

Actions #4

Updated by Olivier Lebhard about 8 years ago

Here, i put only the host part

DEBUG 2016-02-25T14:54:00 API] Params: {
    "host" => {
                              "name" => "name",
                    "environment_id" => 1,
               "compute_resource_id" => 1,
                      "hostgroup_id" => 32,
                             "build" => true,
                           "enabled" => true,
                           "managed" => true,
                "compute_attributes" => {
                    "flavor_ref" => "53",
               "security_groups" => "default",
                     "image_ref" => "41362541-79b8-4cc9-9c1f-670546e84fa6",
                          "nics" => [
                [0] "ba535079-ed45-4e19-a988-74ce08ecf2ce",
                [1] "f5025778-cd74-45dc-a79d-17a066c6ab1d" 
            ],
            "volumes_attributes" => {
                "0" => {
                    "capacity" => "32" 
                }
            }
        },
        "host_parameters_attributes" => {},
             "interfaces_attributes" => {
            "0" => {
                      "type" => "interface",
                "identifier" => "eth0",
                   "managed" => "true",
                 "domain_id" => "8",
                 "subnet_id" => "103" 
            },
            "1" => {
                      "type" => "interface",
                "identifier" => "eth1",
                   "managed" => "true",
                   "primary" => "true",
                 "provision" => "true",
                 "domain_id" => "1",
                 "subnet_id" => "104" 
            }
        }
    }
}

Let me know if you need more

thanks

Actions #5

Updated by Dominic Cleal about 8 years ago

  • Project changed from Hammer CLI to Foreman
  • Category set to Compute resources - OpenStack
  • Status changed from Need more information to New
Actions #6

Updated by Olivier Lebhard about 8 years ago

Hello Dominic, do you know if someone is working on this issue ?

It might come from the following code (There is a TODO list) but do not know how to fix it.

#app/models/concerns/orchestration/compute.rb

def queue_compute_create
    queue.create(:name   => _("Render user data template for %s") % self, :priority => 1,
                 :action => [self, :setUserData]) if find_image.try(:user_data)
    queue.create(:name   => _("Set up compute instance %s") % self, :priority => 2,
                 :action => [self, :setCompute])
    queue.create(:name   => _("Acquire IP address for %s") % self, :priority => 3,
                 :action => [self, :setComputeIP]) if compute_provides?(:ip)
    queue.create(:name   => _("Query instance details for %s") % self, :priority => 4,
                 :action => [self, :setComputeDetails])
    queue.create(:name   => _("Power up compute instance %s") % self, :priority => 1000,
                 :action => [self, :setComputePowerUp]) if compute_attributes[:start] == '1'
end

def setComputeDetails
  Rails.logger.debug "method setComputeDetails" 

    if vm
      attrs = compute_resource.provided_attributes
      Rails.logger.debug "inside method setComputeDetails, attrs : #{attrs}" 

      attrs.each do |foreman_attr, fog_attr |
        Rails.logger.debug "foreman_attr : #{foreman_attr}" 
        Rails.logger.debug "fog_attr : #{fog_attr}" 

        if foreman_attr == :mac
          #TODO, do we need handle :ip as well? for openstack / ec2 we only set a single
          # interface (so host.ip will be fine), and we'd need to rethink #find_address

          return false unless match_macs_to_nics(fog_attr)
        else
          value = vm.send(fog_attr)
          Rails.logger.debug "Value is : #{value}" 
          value ||= find_address if foreman_attr == :ip
          Rails.logger.debug "Value after is : #{value}" 
          self.send("#{foreman_attr}=", value)

          # validate_foreman_attr handles the failure msg, so we just bubble
          # the false state up the stack
          return false unless validate_foreman_attr(value,Host,foreman_attr)
        end
      end
      true
    else
      failure _("failed to save %s") % name
    end
  end


Thanks

-Olivier

Actions #7

Updated by Dominic Cleal about 8 years ago

There's no assignee, so nobody is working on it. I don't think the code you pasted is related to the assignment of OpenStack networks, that probably happens in the model at app/models/compute_resources/foreman/model/openstack.rb or in Fog.

Actions #8

Updated by Olivier Lebhard about 8 years ago

In the code i've pasted, you can see a comment :

#TODO, do we need handle :ip as well? for openstack / ec2 we only set a single
  1. interface (so host.ip will be fine), and we'd need to rethink #find_address

Saying if we are in the openstack mode, we set only 1 interface but i can be wrong.

Actions #9

Updated by Olivier Lebhard almost 8 years ago

Hello,

Do you have any updates on this ticket ?

Thanks

-Olivier L

Actions

Also available in: Atom PDF