Merge "Metering fix error that might happen when labels are removed during processing"
This commit is contained in:
commit
980c8fd908
@ -134,10 +134,17 @@ class MeteringAgent(MeteringPluginRpc, manager.Manager):
|
|||||||
if driver.BASE_LABEL_TRAFFIC_COUNTER_KEY in key:
|
if driver.BASE_LABEL_TRAFFIC_COUNTER_KEY in key:
|
||||||
other_ids, actual_label_id = key.split(
|
other_ids, actual_label_id = key.split(
|
||||||
driver.BASE_LABEL_TRAFFIC_COUNTER_KEY)
|
driver.BASE_LABEL_TRAFFIC_COUNTER_KEY)
|
||||||
is_label_shared = self.metering_labels[actual_label_id]['shared']
|
|
||||||
|
is_label_shared = None
|
||||||
|
label_name = actual_label_id
|
||||||
|
|
||||||
|
metering_label = self.metering_labels.get(actual_label_id)
|
||||||
|
if metering_label:
|
||||||
|
is_label_shared = metering_label['shared']
|
||||||
|
label_name = metering_label['name']
|
||||||
|
|
||||||
data['label_id'] = actual_label_id
|
data['label_id'] = actual_label_id
|
||||||
data['label_name'] = self.metering_labels[actual_label_id]['name']
|
data['label_name'] = label_name
|
||||||
data['label_shared'] = is_label_shared
|
data['label_shared'] = is_label_shared
|
||||||
|
|
||||||
if is_label_shared:
|
if is_label_shared:
|
||||||
|
@ -309,7 +309,8 @@ class IptablesMeteringDriver(abstract_driver.MeteringAbstractDriver):
|
|||||||
labels = router.get(constants.METERING_LABEL_KEY, [])
|
labels = router.get(constants.METERING_LABEL_KEY, [])
|
||||||
for label in labels:
|
for label in labels:
|
||||||
label_id = label['id']
|
label_id = label['id']
|
||||||
del rm.metering_labels[label_id]
|
if rm.metering_labels.get(label_id):
|
||||||
|
del rm.metering_labels[label_id]
|
||||||
|
|
||||||
@log_helpers.log_method_call
|
@log_helpers.log_method_call
|
||||||
def add_metering_label(self, context, routers):
|
def add_metering_label(self, context, routers):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user