Add the referenced flavor to a new Server

This commit is contained in:
Gerd Aschemann 2025-05-14 09:27:33 +02:00
parent 3763276daa
commit 0f3c092245
1 changed files with 10 additions and 0 deletions

View File

@ -212,11 +212,21 @@ func (m *MockClient) createServer(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusAccepted)
flavorId := create.Server.FlavorRef
flavor := m.flavors[flavorId]
server := servers.Server{
ID: uuid.New().String(),
Name: create.Server.Name,
Metadata: create.Server.Metadata,
Status: "ACTIVE",
Flavor: map[string]any{
"id": flavor.ID,
"name": flavor.Name,
"ram": flavor.RAM,
"vcpus": flavor.VCPUs,
"disk": flavor.Disk,
},
}
securityGroups := make([]map[string]interface{}, len(create.Server.SecurityGroups))
for i, groupName := range create.Server.SecurityGroups {