Ejemplo n.º 1
0
 def _validate_openstack_upgrade(self, old_obj, new_obj):
     # NOTE(pas-ha) this logic relies on 'master' already has been denied
     old_version = constants.OpenStackVersion[
         old_obj["spec"]["openstack_version"]
     ]
     new_version = constants.OpenStackVersion[
         new_obj["spec"]["openstack_version"]
     ]
     # not an upgrade
     if new_version == old_version:
         return
     if old_version > new_version:
         raise exception.OsDplValidationFailed(
             "OpenStack version downgrade is not permitted"
         )
     if new_version.value - old_version.value != 1:
         raise exception.OsDplValidationFailed(
             "Skip-level OpenStack version upgrade is not permitted"
         )
     # validate that nothing else is changed together with
     # openstack_version
     _old_spec = copy.deepcopy(old_obj["spec"])
     _old_spec.pop("openstack_version")
     _new_spec = copy.deepcopy(new_obj["spec"])
     _new_spec.pop("openstack_version")
     if _new_spec != _old_spec:
         raise exception.OsDplValidationFailed(
             "If spec.openstack_version is changed, "
             "changing other values in the spec is not permitted."
         )
Ejemplo n.º 2
0
 def _deny_master(self, new_obj):
     new_version = new_obj.get("spec", {}).get("openstack_version")
     if new_version == "master":
         raise exception.OsDplValidationFailed(
             "Using master of OpenStack is not permitted. "
             "You must disable the OpenStackDeployment admission "
             "controller to deploy, use or upgrade to master."
         )
Ejemplo n.º 3
0
 def validate(self, review_request):
     keycloak_section = (review_request.get("object", {}).get(
         "spec", {}).get("features", {}).get("keystone",
                                             {}).get("keycloak", {}))
     if (keycloak_section.get("enabled", False)
             and keycloak_section.get("url") is None):
         raise exception.OsDplValidationFailed(
             "Malformed OpenStackDeployment spec, if keycloak is "
             "enabled for identity service, you need to specify url.")
Ejemplo n.º 4
0
 def validate(self, review_request):
     node_specific = (review_request.get("object",
                                         {}).get("spec",
                                                 {}).get("nodes", {}))
     try:
         validate(instance=node_specific, schema=SCHEMA)
     except Exception as e:
         raise exception.OsDplValidationFailed(
             f"The spec:nodes format is invalid. Failed to validate schema: {e}"
         )
Ejemplo n.º 5
0
 def validate(self, review_request):
     neutron_features = (review_request.get("object", {}).get(
         "spec", {}).get("features", {}).get("neutron", {}))
     neutron_backend = neutron_features.get("backend")
     floating_network = neutron_features.get("floating_network", {})
     if neutron_backend != "tungstenfabric" and not floating_network.get(
             "physnet"):
         raise exception.OsDplValidationFailed(
             "Malformed OpenStackDeployment spec, if TungstenFabric is "
             "not used, physnet needs to be specified in "
             "features.neutron.floating_network section.")