func createServerGroup(t *testing.T, computeClient *gophercloud.ServiceClient) (*servergroups.ServerGroup, error) {
	sg, err := servergroups.Create(computeClient, &servergroups.CreateOpts{
		Name:     "test",
		Policies: []string{"affinity"},
	}).Extract()

	if err != nil {
		t.Fatalf("Unable to create server group: %v", err)
	}

	t.Logf("Created server group: %v", sg.ID)
	t.Logf("It has policies: %v", sg.Policies)

	return sg, nil
}
func resourceComputeServerGroupV2Create(d *schema.ResourceData, meta interface{}) error {
	config := meta.(*Config)
	computeClient, err := config.computeV2Client(d.Get("region").(string))
	if err != nil {
		return fmt.Errorf("Error creating OpenStack compute client: %s", err)
	}

	createOpts := &servergroups.CreateOpts{
		Name:     d.Get("name").(string),
		Policies: resourceServerGroupPoliciesV2(d),
	}
	log.Printf("[DEBUG] Create Options: %#v", createOpts)
	newSG, err := servergroups.Create(computeClient, createOpts).Extract()
	if err != nil {
		return fmt.Errorf("Error creating ServerGroup: %s", err)
	}

	d.SetId(newSG.ID)

	return resourceComputeServerGroupV2Read(d, meta)
}