Fix the network subnets check in create instance form
If a project is only one available network, we need to verify whether it contains subnets, otherwise nova api will return "Network f1a03328-60d0-4b0e-a4a0-d25ec0d185c4 requires a subnet in order to boot instances on. (HTTP 400)" The default network may not contain subnets[1]. We should first query the networks that contains the subnets, and then get the default network from the networks. [1] https://github.com/openstack/horizon/blob/master/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js#L478-#L484 Change-Id: I16f7f8cddf045445ed026f62366957de9d289c03 Closes-Bug: #1686449
This commit is contained in:
parent
f8701149a2
commit
a92d1658d8
|
@ -475,13 +475,13 @@
|
|||
function onGetNetworks(data) {
|
||||
model.neutronEnabled = true;
|
||||
model.networks.length = 0;
|
||||
if (data.data.items.length === 1) {
|
||||
model.newInstanceSpec.networks.push(data.data.items[0]);
|
||||
}
|
||||
push.apply(model.networks,
|
||||
data.data.items.filter(function(net) {
|
||||
return net.subnets.length > 0;
|
||||
}));
|
||||
if (model.networks.length === 1) {
|
||||
model.newInstanceSpec.networks.push(model.networks[0]);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue