Page MenuHomePhabricator

Spicerack: improve support for Ganeti VMs
Open, NormalPublic


In order to be able to perform some actions on VMs like on physical hosts (for example when decommissioning), some improvement is needed in the Netbox and Ganeti support in Spicerack.


  • given a FQDN an easy way to get if the host is physical or virtual (ganeti). We could do that with a cumin query, but seems more correct to get the info from Netbox probably.
  • given a FQDN of a Ganeti VM get the Ganeti cluster it belongs (that in turn would allow to perform Ganeti CLI actions). This should probably come from Netbox.
  • evaluate if we should support also FQDNs in the Netbox module transparently in addition to hostnames
  • [optional] evaluate the possibility to expose some GanetiCLI object from the ganeti spicerack interface to allow to perform gnt commands directly on the right master host.

Event Timeline

Volans created this task.Fri, Aug 23, 10:39 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFri, Aug 23, 10:39 AM
Volans triaged this task as Normal priority.Fri, Aug 23, 10:39 AM
Volans updated the task description. (Show Details)Fri, Aug 23, 10:46 AM

Finding which cluster, or if the instance by fqdn is a Ganeti instance, could be done as easily as trrying to look it up in every configured cluster, and checking if there's information. We could provide utility functions to perform those actions trivially.

Supporting FQDN in netbox should be easy enough.

There is already a utility function to get the master node for the ganeti cluster, so making something that uses that to execute gnt commands would be very straight forward if that seems reasonable.

Change 533984 had a related patch set uploaded (by CRusnov; owner: CRusnov):
[operations/software/spicerack@master] ganeti: Add ability to get ganeti cluster for given instance

Change 533987 had a related patch set uploaded (by CRusnov; owner: CRusnov):
[operations/software/spicerack@master] netbox: Transparently support read-only operations for virtual machines

Okay I've implemented changes to the netbox and ganeti modules as linked above which should allow all of the operations requested. I have not implemented writing status to Ganeti VMs since this information is updated automatically but it should be relatively straight forward to implement if desired.

Basically the change to the ganeti module allows you to discover the cluster that a particular machine belongs to (and indeed, if it belongs to any). The change to netbox treats VMs transparently as deices for read purposes, and marks the information returned by fetch_host_detail with is_virtual and cluster_name.

In terms of allowing running commands on the Ganeti host (the gnt* commands), that will be a separate patch if we stil lwant it.

Change 533984 merged by CRusnov:
[operations/software/spicerack@master] ganeti: Add ability to get ganeti cluster for given instance