region: add one random config if user input net config is empty when create server (#379)

This commit is contained in:
Zexi Li
2019-04-13 22:07:10 +08:00
committed by yunion-ci-robot
parent 434fc54623
commit a418df7854
+4
View File
@@ -1009,6 +1009,10 @@ func (manager *SGuestManager) ValidateCreateData(ctx context.Context, userCred m
}
}
// HACK: if input networks is empty, add one random network config
if len(input.Networks) == 0 {
input.Networks = append(input.Networks, &api.NetworkConfig{Exit: false})
}
netArray := input.Networks
for idx := 0; idx < len(netArray); idx += 1 {
netConfig, err := parseNetworkInfo(userCred, netArray[idx])