Ejemplo n.º 1
0
func reserveNodeFromRackHD(c config.Cpi, agentID string, nodeID string) error {
	workflowName, err := workflows.PublishReserveNodeWorkflow(c, agentID)
	if err != nil {
		return fmt.Errorf("error publishing reserve workflow: %s", err)
	}

	err = workflows.RunReserveNodeWorkflow(c, nodeID, workflowName)
	if err != nil {
		return fmt.Errorf("error running reserve workflow: %s", err)
	}

	log.Info(fmt.Sprintf("reserved node %s", nodeID))
	return nil
}
func ReserveNodeFromRackHD(c config.Cpi, node rackhdapi.Node) error {
	if node.Status == rackhdapi.Reserved {
		return nil
	}

	workflowName, err := workflows.PublishReserveNodeWorkflow(c)
	if err != nil {
		return fmt.Errorf("error publishing reserve workflow: %s", err)
	}

	err = workflows.RunReserveNodeWorkflow(c, node.ID, workflowName)
	if err != nil {
		return fmt.Errorf("error running reserve workflow: %s", err)
	}

	log.Info(fmt.Sprintf("reserved node %s", node.ID))
	return nil
}