Wrap several actions in VMTask with atomic timer

Atomic action "vm.attach_floating_ip" makes 2 actions: create floating
ip and associate it with an server. Only the second action is wrapped by
atomic action timer, so in the reports (after we start support nested
atomics) the case looks like "vm.attach_floating_ip" makes only one
action. It is no fair and wrong, so this patch wraps creating floating
ip action as well with atomic timer.

"vm.delete_floating_ip" has the similar case. It performs 2 actions:
dissociating floating ip from the server and removing fip. The second
action was not covered with own atomic timer.

Change-Id: Ia97102034001b07bb8389c02b94d8b0c784077a4
This commit is contained in:
Andrey Kurilin 2017-09-28 18:26:09 +03:00
parent 9ac967b974
commit 7ffa1b95c5

View File

@ -166,9 +166,10 @@ class VMScenario(nova_utils.NovaScenario):
internal_network = list(server.networks)[0]
fixed_ip = server.addresses[internal_network][0]["addr"]
fip = network_wrapper.wrap(self.clients, self).create_floating_ip(
ext_network=floating_network,
tenant_id=server.tenant_id, fixed_ip=fixed_ip)
with atomic.ActionTimer(self, "neutron.create_floating_ip"):
fip = network_wrapper.wrap(self.clients, self).create_floating_ip(
ext_network=floating_network,
tenant_id=server.tenant_id, fixed_ip=fixed_ip)
self._associate_floating_ip(server, fip["ip"], fixed_address=fixed_ip)
@ -180,8 +181,10 @@ class VMScenario(nova_utils.NovaScenario):
LOG, _("Unable to delete IP: %s") % fip["ip"]):
if self.check_ip_address(fip["ip"])(server):
self._dissociate_floating_ip(server, fip["ip"])
network_wrapper.wrap(self.clients, self).delete_floating_ip(
fip["id"], wait=True)
with atomic.ActionTimer(self, "neutron.delete_floating_ip"):
network_wrapper.wrap(self.clients,
self).delete_floating_ip(
fip["id"], wait=True)
def _delete_server_with_fip(self, server, fip, force_delete=False):
if fip["is_floating"]: