diff --git a/compass/db/api/cluster.py b/compass/db/api/cluster.py index a329408f..d5b4a845 100644 --- a/compass/db/api/cluster.py +++ b/compass/db/api/cluster.py @@ -1166,6 +1166,10 @@ def validate_clusterhost(session, clusterhost): def validate_cluster(session, cluster): + if not cluster.clusterhosts: + raise exception.InvalidParameter( + '%s does not have any hosts' % cluster.name + ) cluster_roles = [ flavor_role.role for flavor_role in cluster.flavor.flavor_roles diff --git a/compass/db/api/host.py b/compass/db/api/host.py index f00ea1c9..accb85fb 100644 --- a/compass/db/api/host.py +++ b/compass/db/api/host.py @@ -235,6 +235,10 @@ def is_host_editable( def validate_host(session, host): + if not host.host_networks: + raise exception.InvalidParameter( + '%s does not have any network' % host.name + ) mgmt_interface_set = False for host_network in host.host_networks: if host_network.is_mgmt: