Skip to content

Conversation

@rasta-rocket
Copy link
Contributor

  • Remove refs between floating-ip-pool and floatinip (which do not exist
    anymore).

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',
Copy link
Contributor

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

# 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:
Copy link
Contributor

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

filters=None
if pool:
filters=[('uuid', pool)]
pools = Collection('floating-ip-pool', fetch=True, filters=filters)
Copy link
Contributor

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" ?

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]
Copy link
Contributor

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)
Copy link
Contributor

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 ?

Copy link
Contributor Author

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?


pool = Option(help="floating IP pool ref",
nargs="?")
fip_refs = Arg(help="list of refs [fip0, fip1, fip2, fip3, ...]",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/refs/uuids

cassandra_servers = Option(help="cassandra server list' (default: %(default)s)",
nargs='+',
type=server_type,
default=['localhost:9160'])
Copy link
Contributor

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

for pool in self.resources:
try:
pool.fetch()
for fip in pool.children:
Copy link
Contributor

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

Copy link
Contributor

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)

* Remove refs between floating-ip-pool and floatinip (which do not exist
  anymore).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants