Fixes Hyper-V port metrics enabling after service restart
(cherry picked from commit 492190aae0
)
Closes-Bug: #1263766
Change-Id: I48fb5389b6049641ca2649990e81e94e4c45ef7f
This commit is contained in:
parent
d57ce79c95
commit
858ec2eae0
|
@ -183,18 +183,12 @@ class HyperVUtilsV2(utils.HyperVUtils):
|
|||
acls = port.associators(wmi_result_class=self._PORT_ALLOC_ACL_SET_DATA)
|
||||
for acl_type in [self._ACL_TYPE_IPV4, self._ACL_TYPE_IPV6]:
|
||||
for acl_dir in [self._ACL_DIR_IN, self._ACL_DIR_OUT]:
|
||||
acls = [v for v in acls
|
||||
if v.Action == self._ACL_ACTION_METER and
|
||||
v.Applicability == self._ACL_APPLICABILITY_LOCAL and
|
||||
v.Direction == acl_dir and
|
||||
v.AclType == acl_type]
|
||||
if not acls:
|
||||
acl = self._get_default_setting_data(
|
||||
self._PORT_ALLOC_ACL_SET_DATA)
|
||||
acl.AclType = acl_type
|
||||
acl.Direction = acl_dir
|
||||
acl.Action = self._ACL_ACTION_METER
|
||||
acl.Applicability = self._ACL_APPLICABILITY_LOCAL
|
||||
_acls = self._filter_acls(
|
||||
acls, self._ACL_ACTION_METER, acl_dir, acl_type)
|
||||
|
||||
if not _acls:
|
||||
acl = self._create_acl(
|
||||
acl_dir, acl_type, self._ACL_ACTION_METER)
|
||||
self._add_virt_feature(port, acl)
|
||||
|
||||
def _create_acl(self, direction, acl_type, action):
|
||||
|
|
Loading…
Reference in New Issue