tumblr / collins

groovy kind of love
tumblr.github.com/collins
Apache License 2.0
571 stars 99 forks source link

Power configuration silently ignored #480

Closed discordianfish closed 7 years ago

discordianfish commented 8 years ago

Hi,

I have struggle with the power configuration. I didn't specify any powerconfiguration options in my config, so I assume I'm using https://github.com/tumblr/collins/blob/master/conf/reference/powerconfiguration_reference.conf.

Now I've created a new asset like this:

curl ... -X PUT -d generate_ipmi=false http://collins.service.consul:9000/api/asset/my-asset-tag
curl ... -X POST http://collins.service.consul:9000/api/asset/my-asset-tag --data-urlencode lldp@lldpctl.xml --data-urlencode lshw@lshw.xml -d POWER_OUTLET_A=ac14 -d POWER_PORT_A=foobar23

The last command returns success, asset data is available in collins but the powerconfig is missing:

$ curl ... http://collins.service.consul:9000/api/asset/my-asset-tag | jq .data.POWER
[]

(Same for UI and collins-shell). What confuses me the most is that there are a few systems where it actually worked: I registered the nodes a few weeks ago and at least on one I have the dummy port entries I used before. Maybe it worked when I updated it in another state? But I tried unallocated and allocated as well with the same result.

discordianfish commented 8 years ago

btw, the docs say Only accepted for New assets during the web based intake process. Since I don't know of any 'web based intake process', I assume this refers to tumblr internals and this should work if status = New without any other conditions met, right?

byxorna commented 8 years ago

"Web based intake" is the physical intake process, driven by collins web UI. I.e. an asset in New that has no rack_position attribute has collins blink the UID, operator confirm asset tag on physical label, input rack_position and power distribution.

Heres a snippet from a script i use to "induct" manually created assets that dont go through our normal manual induction process (for example, if they dont have IPMI). This takes a New asset and moves to Unallocated, simulating a human performing the physical induction process.

  a = c.get(tag)
  if a.status == 'New'
    puts c.set_multi_attribute!(a.tag, {:RACK_POSITION => position, :POWER_OUTLET_A => 'A', :POWER_PORT_A => 'A' })
  end
discordianfish commented 8 years ago

@byxorna Right, this is how I understand it. But if I update a NEW asset with POWER_PORT_A and POWER_OUTLET_A collins seem to ignore that. See above. It looks like I do exactly what your script snippet is doing.

discordianfish commented 7 years ago

Okay! I figure this out. There is indeed a hidden intake process :)

michaeljs1990 commented 7 years ago

@discordianfish o please tell me about this hidden intake process. I have it working via curl but would like to know what you found out 😱 don't leave me hanging.

I have a strange feeling it's something to do with the /resource/:id endpoint but having trouble getting it to return anything of use.

EDIT: That was an adventure that turned out with adding ipmitool to the docker image... and I really think that is all that it needed. However I am still curious what method people use for this entire process right now if I was just using the web UI it would look like this.

  1. Initial induction of asset lshw/lldp
  2. log into mysql and list the id of the asset just inducted
  3. type /resource/:id in my browser and walk through the process.

How do you manage number 2. A simple bash script or application that glues everything together could pull back all the ID's but wanted to see what others did.

byxorna commented 7 years ago

@michaeljs1990 just typing the asset tag into the asset tag text box will trigger the intake flow from the main search page. No need to lookup the resource's primary key

michaeljs1990 commented 7 years ago

That is much cleaner 👍