V2T migration: fix qos migration & logging
Change-Id: I81b961b1690df520916c64c7cccfa763aba24706
This commit is contained in:
parent
bcbc82bcbc
commit
7b332c1dc0
|
@ -225,7 +225,8 @@ class ApiReplayClient(utils.PrepareObjectForMigration):
|
|||
if dest_rule['type'] == rule_type:
|
||||
return
|
||||
pol_id = dest_policy['id']
|
||||
body = self.prepare_qos_rule(source_rule)
|
||||
tenant_id = dest_policy.get('tenant_id')
|
||||
body = self.prepare_qos_rule(source_rule, tenant_id=tenant_id)
|
||||
try:
|
||||
if rule_type == 'bandwidth_limit':
|
||||
rule = self.dest_neutron.create_bandwidth_limit_rule(
|
||||
|
@ -239,8 +240,8 @@ class ApiReplayClient(utils.PrepareObjectForMigration):
|
|||
{'rule': rule_type, 'pol': pol_id})
|
||||
LOG.info("created QoS policy %s rule %s", pol_id, rule)
|
||||
except Exception as e:
|
||||
LOG.error("Failed to create QoS rule for policy %(pol)s: %(e)s",
|
||||
{'pol': pol_id, 'e': e})
|
||||
LOG.error("Failed to create QoS rule %(rule)s for policy %(pol)s: "
|
||||
"%(e)s", {'rule': body, 'pol': pol_id, 'e': e})
|
||||
n_errors = n_errors + 1
|
||||
|
||||
def migrate_qos_policies(self):
|
||||
|
@ -741,6 +742,7 @@ class ApiReplayClient(utils.PrepareObjectForMigration):
|
|||
dest_objects, prepare_method, create_method):
|
||||
global n_errors
|
||||
total_num = len(source_objects)
|
||||
LOG.info("Migrating %s %ss", total_num, resource_type)
|
||||
for count, source_obj in enumerate(source_objects, 1):
|
||||
# Check if the object already exists
|
||||
if self.have_id(source_obj['id'], dest_objects):
|
||||
|
|
|
@ -98,7 +98,7 @@ class PrepareObjectForMigration(object):
|
|||
'status', 'router_id', 'id', 'revision']
|
||||
|
||||
drop_qos_rule_fields = ['revision', 'type', 'qos_policy_id', 'id']
|
||||
drop_qos_policy_fields = ['revision']
|
||||
drop_qos_policy_fields = basic_ignore_fields
|
||||
|
||||
drop_fwaas_rule_fields = ['firewall_policy_id']
|
||||
drop_fwaas_policy_fields = []
|
||||
|
@ -283,8 +283,10 @@ class PrepareObjectForMigration(object):
|
|||
self.fix_description(fip)
|
||||
return self.drop_fields(fip, self.drop_fip_fields)
|
||||
|
||||
def prepare_qos_rule(self, rule, direct_call=False):
|
||||
def prepare_qos_rule(self, rule, tenant_id=None, direct_call=False):
|
||||
self.fix_description(rule)
|
||||
if tenant_id and not rule.get('tenant_id'):
|
||||
rule['tenant_id'] = tenant_id
|
||||
return self.drop_fields(rule, self.drop_qos_rule_fields)
|
||||
|
||||
def prepare_qos_policy(self, policy, direct_call=False):
|
||||
|
|
Loading…
Reference in New Issue