Commit graph

51 commits

Author SHA1 Message Date
Christophe Simon
34c1619ce8 Merge remote-tracking branch 'origin/master' into 176-netbox-2.9 2022-02-21 18:09:25 +01:00
Christophe Simon
5d9602402b
Merge branch 'master' into fix/chriss/purge_remaining_devices 2022-02-15 10:34:50 +01:00
Christophe Simon
2f09cf8d42 Manage blade expansions as independent devices
This patch adds the ability to detect and manage GPU and Disk expansion
bays, and either add their internal components into the device
corresponding to the blade server, or into a dedicated device.

It takes advantage of the work made by @cyrinux on GPU bays management, and
applies the same principle to the external disk bays, but harmonize the
inventory management:

- If no argument is specified on the command line, the GPU cards, RAID
  controllers and their attached disks are added in the blade device,
  and the device corresponding to an expansion device is deleted.
- If the `--expansion-as-device` option is specified on the command
  line, a dedicated device corresponding to the expansion bay is
  created, and the GPUs, RAID card and attached disks are removed from
  the blade device and added to the expansion device.
2022-02-14 14:37:02 +01:00
Christophe Simon
58775c0950 Added option to purge remaining devices
This patch adds an option to clear remaining devices in the context of a
new device replacing an old one with the same name but with a different
hardware.

The serial leading to the bug is described below:

- A first server is registered under name `A` with serial `X`
- A second server is registered under name `B` with serial `Y`
- The server with serial `X` is decomissionned, but not removed
- The server with serial `Y` is reinstalled with name `A`

In this case, a device with serial `X` is well found, and netbox agent
tries to update its name. But this raises an error because of the unique
constraint on name, as another device already holds this name.

The proposed solution to handle this situation is to delete any device
with same `name` but different `serial` before handling a device.

As this is not necessarily the expected behavior, it can be enabled by
using the `--purge-old-devices` to avoid breaking existing inventory.
2022-02-08 18:46:30 +01:00
Cyrinux
8a46af19b8
Fix a crash when missing rack id (#172) 2021-07-20 21:55:47 +02:00
Solvik Blum
86527af1c0 lint 2021-05-18 13:59:04 +02:00
Solvik Blum
9eafcbf215 this MR will drop compatibility with versions < 2.9 2021-05-12 19:41:35 +02:00
Solvik Blum
58c18fc2da add more compatibility, now to netbox 2.10 2021-05-12 19:41:01 +02:00
Solvik Blum
3639662961 ignore tag update for Netbox version >= 2.8 2021-05-12 19:41:01 +02:00
Cyrinux
137728be1f
Add "ProLiant BL460c Gen10 Graphics Exp" support and GPU expansion bay (#165)
* Add "ProLiant BL460c Gen10 Graphics Exp"

* Add GPU expansion support for HP_ProLiant_BL460c_Gen10_Graphics_Exp

* Add ProLiant BL460c Graphics Expansion Blade support in README

* Dont crash if vendor other than HP

* Typo
2020-09-18 12:29:17 +02:00
Solvik Blum
f8c0732c2b fix agent crash on server creation if not blade 2020-07-29 00:45:24 +02:00
Solvik Blum
70146b8614 fix not passing tenant when tenants exist in Netbox 2020-07-11 15:33:34 +02:00
ThomasADavis
a60c0cd70c
Add tags,device roles,tenants.. (#110)
* Adds support for:

* sets the tenant for IP addresses and Devices.
* setting device tags
* setting the blade, chassis, and server roles.

Co-authored-by: Thomas Davis <tdavis@nersc.gov>
Co-authored-by: Solvik <solvik@solvik.fr>
2020-07-01 18:54:58 +02:00
Solvik
bd5037996b
make the agent work if only a datacenter is specified (#143) 2020-07-01 18:51:57 +02:00
Solvik
f06da32fc3
Virtual Machine feature (#122)
Add ability to create Virtual Machine in netbox with an auto-detecting feature (currently VirtualBox, Xen, Hyper-V, VMWare, GCP)

One caveat, I made the choice not to report the disk as Netbox model allow only one size but VM often have multiples.

Also, lot of code refactoring to be able to use create_or_update function style, fixing a lot of corner case
2020-04-19 12:28:49 +02:00
ramnes
bab2d26ad0 Setup tests 2020-02-02 20:24:01 +01:00
ThomasADavis
405cce3995 Gets the right chassis serial number (#104) 2020-01-25 12:03:30 +01:00
Solvik
6497261708
better error handling when DeviceRole or DeviceType don't exist (#91) 2019-10-23 12:14:50 +02:00
Solvik
a1297813ef
fix rack comparison while updating location (#84) 2019-09-12 17:47:41 +02:00
Solvik
06328e745c
Revert "fix rack comparison while updating location (#82)" (#83)
This reverts commit e9ec69bc3b.
2019-09-12 17:43:39 +02:00
Solvik
e9ec69bc3b
fix rack comparison while updating location (#82) 2019-09-12 12:03:13 +02:00
Solvik
5f851ec619
add config to set hostname command (#81) 2019-09-12 11:15:12 +02:00
Solvik
9f7f29c190
fix rack association (#79) 2019-09-11 17:35:27 +02:00
Solvik
93c6444105
more strip from shitty dmidecode (#73) 2019-09-10 14:46:04 +02:00
ThomasADavis
b7b22ae316 use lshw for inventory (#58)
* Use lshw for inventory
* Add motherboard to inventory
* Handle non raid devices
* Handle nvme drives
2019-09-05 15:13:36 +02:00
Solvik
8d0168acb5
Add power supply support (#56) 2019-09-05 13:47:10 +02:00
Solvik
d12ac49d50
new config system (#53) 2019-09-03 13:16:37 +02:00
Solvik
de3c59a675
Local inventory (#16)
- Create and update CPU
- Create and update Memory
- Create and update RAID Cards (HP and Storcli)
- Create and update Physical disks
2019-08-26 16:54:48 +02:00
Solvik
770a97bc57
create server/rack/chassis with Rack location if found (#34) 2019-08-14 11:17:24 +02:00
Solvik
2988a8bd6a
Rework all network part (#21)
* rework network part by ignoring devices and ip from config file

* update config file

* associate slave device to bond device with Netbox LAG

* update README

* make sure every interface attribute is ok

* some fixes after  test

* tox

* add ipmi feature

* fix bug in LAG

* ipmi class

* update README

* network update

* delete print

* update README
2019-08-09 12:08:11 +02:00
Solvik Blum
9519a43277
fixes 2019-08-08 14:46:06 +02:00
Solvik Blum
048fa22b1e
fix blade slot 2019-08-08 14:37:02 +02:00
Solvik Blum
b60860e0f5
fix bug while testing server creation 2019-08-07 15:36:47 +02:00
Solvik Blum
e8a9d318cc
simpler logging, log_level from config file 2019-08-07 10:32:23 +02:00
Solvik Blum
cc08300fee
add some logging 2019-08-06 18:11:26 +02:00
Solvik
18e29638e7
Merge branch 'master' into feature/rack_awareness 2019-08-05 17:07:36 +02:00
Solvik Blum
bea1bf8614
flake8 fixes 2019-08-05 16:55:22 +02:00
Solvik Blum
165f911631
handle network update 2019-08-05 16:51:01 +02:00
Solvik Blum
e80d8b941c
wip - update in progress, working for blades/hostname 2019-08-05 16:03:35 +02:00
Solvik Blum
cd97fe4d3a
wip 2019-08-05 12:02:42 +02:00
Solvik Blum
acbb767e22
rack awareness 2019-08-05 11:54:06 +02:00
Solvik Blum
15faf59182
better ethool and device type guessing 2019-08-04 21:48:06 +02:00
Solvik
4ddbb89c18
Merge branch 'master' into feature/network 2019-08-04 20:27:58 +02:00
Solvik Blum
d90eac3fe6
no more upper() and use slug for dc search 2019-08-04 19:33:09 +02:00
Solvik Blum
d5673d4992
WIP - create netbox interfaces with IP 2019-08-04 15:14:36 +02:00
Solvik Blum
1063ec63e0
WIP - handle network 2019-08-04 14:37:51 +02:00
Solvik Blum
8b8cd68ff2
add datacenter location awareness with pseudo-driver (cmd and file) 2019-08-04 01:21:20 +02:00
Solvik
396c4b5d10 Project cleanup (#6)
* add requirements.txt

* Create LICENSE

* add test directory

* code cleanup

* flake8 fixes and code cleanup

* setup.py and tox.ini

* more fixes
2019-08-04 00:00:22 +02:00
Solvik Blum
ab4ea42466 pizza box (server) netbox creation 2019-08-03 15:57:06 +02:00
Solvik Blum
8960df61dc * new dmidecode code
* move netbox creation server to ServerBase class
* HP blades support
2019-08-03 15:46:21 +02:00