contrail_api_cli_extra.fix package¶
Module containing commands to fix bad resources.
contrail_api_cli_extra.fix.fix_fip_locks module¶
contrail_api_cli_extra.fix.fix_sg module¶
-
class
contrail_api_cli_extra.fix.fix_sg.
FixSg
(name)¶ Bases:
contrail_api_cli_extra.utils.CheckCommand
,contrail_api_cli_extra.utils.PathCommand
,contrail_api_cli_extra.utils.ConfirmCommand
Fix multiple default security groups on projects.
It appears sometimes several default security groups have been created. Normally, only one default security group should be created. When there are several security groups, some of them doesn’t have the right project name in their fq_name. These security groups are not legitimate.
The check mode of this script detects theses security groups and marks default security groups of a tenant as good or bad. Good default security group is legitimate while bad are not. Moreover, if it exists bad security groups, the scripts returns 1 otherwise, it returns 0.
Concerning normal mode and dry-run mode, the script tries to delete non used bad default security groups. “Non used” means no VMIs are attached to them.
To run the command:
contrail-api-cli fix-sg [project/uuid]
If no project path is provided all projects are considered.
contrail_api_cli_extra.fix.fix_subnets module¶
-
class
contrail_api_cli_extra.fix.fix_subnets.
FixSubnets
(name)¶ Bases:
contrail_api_cli_extra.utils.CheckCommand
Fix subnet/vn association in kv store.
When the API server is not properly started the hooks that populates the kv store on subnet creation are not properly run. As a result doing neutron net-list will lead to the following error:
404-{u'NeutronError': {u'message': u'Subnet 646f986a-67c9-4e1b-bf13-59f18f787068 could not be found', u'type': u'SubnetNotFound', u'detail': u''}}
This command check all the IPAM subnet informations and verifies that proper kv store keys exists for each subnet.
This command assumes there is only one IPAM in the contrail installation (
default-domain:default-project:default-network-ipam
).To check all subnets run:
contrail-api-cli fix-subnets --check
To fix all subnets run:
contrail-api-cli fix-subnets [--dry-run]
Or to fix a particular subnet run:
contrail-api-cli fix-subnets <subnet_uuid> [--dry-run]
The version of the schema is required for this command:
contrail-api-cli --schema-version 3.2 fix-subnets
contrail_api_cli_extra.fix.fix_vn_id module¶
-
class
contrail_api_cli_extra.fix.fix_vn_id.
FixVnId
(name)¶ Bases:
contrail_api_cli_extra.utils.PathCommand
,contrail_api_cli_extra.utils.ZKCommand
,contrail_api_cli_extra.utils.CheckCommand
,contrail_api_cli_extra.utils.ConfirmCommand
Compare and fix virtual network IDs in Zookeeper and the API server.
Checks that the ZK lock for a VN has the correct index. Checks also that the VN has a lock in ZK.
To check all VNs run:
contrail-api-cli fix-vn-id --check
To fix all VNs or a particular VN run:
contrail-api-cli fix-vn-id [--dry-run] [vn_uuid]
contrail_api_cli_extra.fix.fix_zk_ip module¶
-
class
contrail_api_cli_extra.fix.fix_zk_ip.
FixZkIP
(name)¶ Bases:
contrail_api_cli_extra.utils.ZKCommand
,contrail_api_cli_extra.utils.CheckCommand
,contrail_api_cli_extra.utils.PathCommand
,contrail_api_cli_extra.utils.ConfirmCommand
Remove or add ZK locks based on the IPAM configuration.
Sometimes, when an instance-ip or a floating-ip is created or deleted, its associated zookeeper node isn’t managed properly.
This led to situation where, no IPs are reserved from the Contrail API standpoint and nevertheless, you are not able to get one, or the same floating IP address is reserved for several users/tenants.
This command list all zookeeper nodes for a given network (which may contain one or several subnet) and compare the nodes with the IPs found with the contrail API. For each IP found in zookeeper and not in the contrail API (abusive lock scenario), the command delete the associated zookeeper node. Then, for each IP found in API, and not in Zookeeper, the command creates the appropriate lock.
Usage:
contrail-api-cli fix-zk-ip --zk-server <IP> [path/to/virtual-network] [--dry-run]
If no virtual-network is given, all virtual-networks are considered.
-
class
contrail_api_cli_extra.fix.fix_zk_ip.
Subnet
(cidr, gateway, dns)¶ Bases:
tuple
-
cidr
¶ Alias for field number 0
-
dns
¶ Alias for field number 2
-
gateway
¶ Alias for field number 1
-
-
exception
contrail_api_cli_extra.fix.fix_zk_ip.
SubnetNotFound
¶ Bases:
exceptions.Exception
-
exception
contrail_api_cli_extra.fix.fix_zk_ip.
UnhandledResourceType
¶ Bases:
exceptions.Exception
-
exception
contrail_api_cli_extra.fix.fix_zk_ip.
ZkNodeNotFound
(zk_subnets)¶ Bases:
exceptions.Exception
contrail_api_cli_extra.fix.ri module¶
-
class
contrail_api_cli_extra.fix.ri.
FixRI
(name)¶ Bases:
contrail_api_cli_extra.utils.CheckCommand
,contrail_api_cli_extra.utils.ZKCommand
,contrail_api_cli_extra.utils.PathCommand
Fix routing-instances without route-targets
contrail-api-cli fix-ri –zk-server <ip> [routing-instance/uuid]