[openstack-dev] [nova][api] Is this a potential issue
Isaku Yamahata
isaku.yamahata at gmail.com
Fri Nov 15 10:57:02 UTC 2013
On Tue, Nov 12, 2013 at 03:07:19PM -0500,
Andrew Laski <andrew.laski at rackspace.com> wrote:
> On 11/11/13 at 05:27pm, Jiang, Yunhong wrote:
> >Resend after the HK summit, hope someone can give me hint on it.
> >
> >Thanks
> >--jyh
> >
> >>-----Original Message-----
> >>From: Jiang, Yunhong [mailto:yunhong.jiang at intel.com]
> >>Sent: Thursday, November 07, 2013 5:39 PM
> >>To: openstack-dev at lists.openstack.org
> >>Subject: [openstack-dev] [nova][api] Is this a potential issue
> >>
> >>Hi, all
> >> I'm a bit confused of followed code in ./compute/api.py, which will be
> >>invoked by api/openstack/compute/servers.py, _action_revert_resize().
> >> From the code seems there is a small windows between get the
> >>migration object and update migration.status. If another API request
> >>comes at this small window, it means two utility will try to revert resize at
> >>same time. Is this a potential issue?
> >> Currently implementation already roll back the reservation if
> >>something wrong, but not sure if we should update state to "reverting" as
> >>a transaction in get_by_instance_and_status()?
>
> The migration shouldn't end up being set to 'reverting' twice
> because of the expected_task_state set and check in
> instance.save(expected_task_state=None). The quota reservation
> could happen twice, so a rollback in the case of a failure in
> instance.save could be good.
nova.objects.instance.Intance.save() seems like that expected_task_state=None
means don't care of task state instead of no-task going-on.
Am I missing anything?
thanks,
>
> >>
> >>--jyh
> >>
> >> def revert_resize(self, context, instance):
> >> """Reverts a resize, deleting the 'new' instance in the process."""
> >> elevated = context.elevated()
> >> migration =
> >>migration_obj.Migration.get_by_instance_and_status(
> >> elevated, instance.uuid, 'finished')
> >> >>>>>>>>>>>>>>>>>>>>>>Here we get the migration object
> >>
> >> # reverse quota reservation for increased resource usage
> >> deltas = self._reverse_upsize_quota_delta(context, migration)
> >> reservations = self._reserve_quota_delta(context, deltas)
> >>
> >> instance.task_state = task_states.RESIZE_REVERTING
> >> instance.save(expected_task_state=None)
> >>
> >> migration.status = 'reverting' >>>>>>>>>>>>>>Here
> >>we update the status.
> >> migration.save()
> >>
> >>_______________________________________________
> >>OpenStack-dev mailing list
> >>OpenStack-dev at lists.openstack.org
> >>http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> >
> >_______________________________________________
> >OpenStack-dev mailing list
> >OpenStack-dev at lists.openstack.org
> >http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
--
Isaku Yamahata <isaku.yamahata at gmail.com>
More information about the OpenStack-dev
mailing list