func RunReserveNodeWorkflow(c config.Cpi, nodeID string, workflowName string) error {
	options, err := buildReserveNodeWorkflowOptions(c, nodeID)
	if err != nil {
		return err
	}

	req := rackhdapi.RunWorkflowRequestBody{
		Name:    workflowName,
		Options: map[string]interface{}{"defaults": options},
	}

	return rackhdapi.RunWorkflow(rackhdapi.WorkflowPoster, rackhdapi.WorkflowFetcher, c, nodeID, req)
}
func RunProvisionNodeWorkflow(c config.Cpi, nodeID string, workflowName string, vmCID string, stemcellCID string, wipeDisk bool) error {
	options, err := buildProvisionWorkflowOptions(c, nodeID, vmCID, stemcellCID, wipeDisk)
	if err != nil {
		return err
	}

	req := rackhdapi.RunWorkflowRequestBody{
		Name:    workflowName,
		Options: map[string]interface{}{"defaults": options},
	}

	return rackhdapi.RunWorkflow(rackhdapi.WorkflowPoster, rackhdapi.WorkflowFetcher, c, nodeID, req)
}
func RunDeprovisionNodeWorkflow(c config.Cpi, nodeID string, workflowName string) error {
	options, err := buildDeprovisionNodeWorkflowOptions(c, nodeID)
	if err != nil {
		return err
	}

	req := rackhdapi.RunWorkflowRequestBody{
		Name:    workflowName,
		Options: map[string]interface{}{"defaults": options},
	}

	err = rackhdapi.RunWorkflow(rackhdapi.WorkflowPoster, rackhdapi.WorkflowFetcher, c, nodeID, req)
	if err != nil {
		return fmt.Errorf("Failed to complete delete VM workflow--its resource may not have been deprovisioned! Details: %s", err)
	}
	return nil
}
func RunReserveNodeWorkflow(c config.Cpi, nodeID string, workflowName string) error {
	options := reserveNodeWorkflowOptions{}

	isAMTService, err := rackhdapi.IsAMTService(c, nodeID)
	if err != nil {
		return err
	}

	if isAMTService {
		obmName := rackhdapi.OBMSettingAMTServiceName
		options.OBMServiceName = &obmName
	}

	req := rackhdapi.RunWorkflowRequestBody{
		Name:    workflowName,
		Options: map[string]interface{}{"defaults": options},
	}

	return rackhdapi.RunWorkflow(rackhdapi.WorkflowPoster, rackhdapi.WorkflowFetcher, c, nodeID, req)
}
						Name:       fakeWorkflowName,
						UnusedName: rackhdapi.DefaultUnusedName,
						Tasks:      fakeTasks,
					}

					fakeWorkflowStubBytes, err := json.Marshal(fakeWorkflowStub)
					Expect(err).ToNot(HaveOccurred())

					err = rackhdapi.PublishWorkflow(cpiConfig, fakeWorkflowStubBytes)
					Expect(err).ToNot(HaveOccurred())

					body := rackhdapi.RunWorkflowRequestBody{
						Name: fakeWorkflowName,
					}

					err = rackhdapi.RunWorkflow(rackhdapi.WorkflowPoster, rackhdapi.WorkflowFetcher, cpiConfig, nodeID, body)
					Expect(err).ToNot(HaveOccurred())
				})
			})
		})

		Context("when the workflow completes with failure", func() {
			Describe("SLOW_TEST", func() {
				It("returns an error", func() {
					rejectNodesRunningWorkflows := func(nodes []rackhdapi.Node) []rackhdapi.Node {
						var n []rackhdapi.Node
						for i := range nodes {
							if len(nodes[i].Workflows) == 0 {
								n = append(n, nodes[i])
							}
						}