Skip to content

Conversation

@zli
Copy link
Contributor

@zli zli commented Jun 20, 2016

Alternative version of #2664.

... aggregates two similar branching logics, no semantics change.

Signed-off-by: Zheng Li <dev@zheng.li>
post_mirror ?mirror_id mirror_record))
else
let mirror_record = get_mirror_record vconf.location (XenAPI.VDI.get_by_uuid remote.rpc remote.session vdi_uuid) in
post_mirror mirror_record
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to call post_mirror here, or just call the continuation with the mirror record?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, with the current code, the effect is the same.

If we want to put more common logic in post_mirror in the future, making a uniform call might make better sense. For now, indeed, the semantic is no difference.

Let me know if you'd prefer calling the continuation directly here, in which case I'll make a quick update.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'll be clearer directly calling the continuation at this point, as it's not obvious without carefully looking that the post_mirror call does nothing if mirror=false. If we want to add common logic later, we can reconsider then. Please make the update, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, cheers!

zli added 2 commits June 20, 2016 14:16
…task failure

... previously we didn't do this which caused issue like CA-199734.

A bit of code refactoring is done as part of this. Big chunk of code is
re-orgnized into small parts. Also use with_<resource> style functions
to facilitate the separation and composition of error handling etc.

Signed-off-by: Zheng Li <dev@zheng.li>
The code change was suggested by Christian Lindig <christian.lindig@citrix.com>
for better naming and style.

Signed-off-by: Zheng Li <dev@zheng.li>
@jonludlam
Copy link
Contributor

I think this is better than #2664. :shipit:

@jonludlam jonludlam merged commit 0a5cbfb into xapi-project:master Jun 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants