-
Notifications
You must be signed in to change notification settings - Fork 3
WIP: clean/fip: Add new clean command #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
8ce5a70 to
1cc5e02
Compare
setup.py
Outdated
| 'clean-si-scheduling = contrail_api_cli_extra.clean.si:CleanSIScheduling', | ||
| 'clean-subnet = contrail_api_cli_extra.clean.subnet:CleanSubnet', | ||
| 'clean-refs = contrail_api_cli_extra.clean.refs:CleanRefs', | ||
| 'clean-fip = contrail_api_cli_extra.clean.fip:CleanBrokenFips', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clean-fip-refs and CleanFipRefs would be better names I think
contrail_api_cli_extra/clean/refs.py
Outdated
| # when the parent doesn't exists anymore, | ||
| # we don't need to keep the source | ||
| if not self.check: | ||
| if not self.check and self.dry_run: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and not self.dry_run
contrail_api_cli_extra/clean/fip.py
Outdated
| filters=None | ||
| if pool: | ||
| filters=[('uuid', pool)] | ||
| pools = Collection('floating-ip-pool', fetch=True, filters=filters) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not using contrail_api_cli_extra.utils.PathCommand class with resource_type = "floating-ip-pool" ?
contrail_api_cli_extra/clean/fip.py
Outdated
| try: | ||
| pool = Resource('floating-ip-pool', uuid=p.uuid, fetch=True) | ||
| if not fip_refs: | ||
| fip_refs = [f.uuid for f in pool.data['floating_ips'].data] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fip_refs = [f.uuid for f in pool.children.floating_ip]
| CleanRefs(ref_type="children", | ||
| target_type="floating_ip", | ||
| paths=[src, tgt], | ||
| **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding fip refs, there is also project -> fip refs that might be broken also and should be removed
Do you think it could be handled by this command ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be great but since we cannot find the project from the fip object, do you think we can list only project that have a floating_ip_back_refs field in the contrail API?
contrail_api_cli_extra/clean/fip.py
Outdated
|
|
||
| pool = Option(help="floating IP pool ref", | ||
| nargs="?") | ||
| fip_refs = Arg(help="list of refs [fip0, fip1, fip2, fip3, ...]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/refs/uuids
contrail_api_cli_extra/clean/fip.py
Outdated
| cassandra_servers = Option(help="cassandra server list' (default: %(default)s)", | ||
| nargs='+', | ||
| type=server_type, | ||
| default=['localhost:9160']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to add contrail_api_cli_extra.utils.CassandraCommand so that all commands that need cassandra can use it
1cc5e02 to
04b3214
Compare
contrail_api_cli_extra/clean/fip.py
Outdated
| for pool in self.resources: | ||
| try: | ||
| pool.fetch() | ||
| for fip in pool.children: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to be more explicit and do pool.children.floating_ip
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it would ne nice to be able to pass (optionaly) a fixed list of floating-ip uuids to the command, so that we can use this command in gremlin-fsck (as with gremlin we already know which FIPs are missing)
04b3214 to
6992941
Compare
* Remove refs between floating-ip-pool and floatinip (which do not exist anymore).
6992941 to
a9a240a
Compare
anymore).