package kvm import ( "fmt" "strings" ) // The providerID carries the host, so Get/Delete stay correct after a // placement.zone edit mid-replacement — re-reading the spec then would look // at the wrong hypervisor. func formatProviderID(host, name string) string { return fmt.Sprintf("hosts/%s/domains/%s", host, name) } func parseProviderID(id string) (host, name string, err error) { parts := strings.Split(id, "/") if len(parts) != 4 || parts[0] != "hosts" || parts[2] != "domains" || parts[1] == "" || parts[3] == "" { return "", "", fmt.Errorf("malformed kvm providerID %q, want hosts//domains/", id) } return parts[1], parts[3], nil }