-
Notifications
You must be signed in to change notification settings - Fork 42
[#437] Resolve all Retry Migration issues #468
[#437] Resolve all Retry Migration issues #468
Conversation
With @kedark3 's assistance, an appliance was set up where a Plan had 2 out of 3 VMs migrated successfully. |
{} | ||
), | ||
|
||
flattenArray: (arrayItems, flattenedArray) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like we could use flatten
here https://lodash.com/docs/4.17.4#flatten?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to have to respectfully disagree here. I think it's preferred to use es6 methods when the functions are trivial and there is not much more to implement using a native function. Individual Lodash imports will soon be stripped by Webpack tree shaking techniques and loaded individually, however I still don't think that's a reason to prefer them (since they often times add more code on the loading end). In these cases I prefer to extend the native functions which removes the need for those imports. I have seen cases where lodash functions do provide a lot of value (sortBy
for example is non trivial), but these are specific to the use case...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will believe this was mentioned in several Foreman PRs as well...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooooo! We disagree indeed. I don't have performance metrics to compare, so I cannot assert one method is "better than another" 🤷♂️ BUT the less code we have to maintain, watch something go wrong with, the better. Both of these functions have been written before, I see no strong case for us to rewrite them.
☝️ being said, this is a blocker, my personal preference to not rewrite commonly functions will not hinder approval of this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, obviously we are still loading Lodash and not stripping it...so it's already included and would be minimal impact on this project, but long term I still think it's considered bad practice now by most communities (kind of like using jQuery at this point, we avoid it when we can but obviously we still rely on it in some places). Reference:
https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_flatten
If we end up converting things to lodash, it becomes preferential to do what Foreman did w/ the lodash babel plugin. Went ahead and referenced that in 3776
but happy to open a separate issue if we care at all about the performance of lodash.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love love the link, thanks for sharing!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok mmm I would make one humble request, that we keep the naming consistent, renaming this to flatten
would be nice 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, not a problem!
getMostRecentEntityByCreationDate: entities => | ||
entities.reduce((prev, current) => (prev.created_on > current.created_on ? prev : current)), | ||
|
||
groupBy: (items, key) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this function exists in lodash, a tool we use elsewhere in v2v, https://lodash.com/docs/4.17.4#groupBy
Wonder if using ☝️ might be a lil less code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above...
On an unrelated topic to the above discussion, there might be 2 open items to the Retry issue (depending on how we look at it) Item 1 - -- should the Migration card say Item 2 - |
Does this also include the fix for the recently opened #469 @AparnaKarve ? |
Item 1 - Sonds very reasonable to me! Migrated implies success, only two of them succeeded,unless we wanta negate the verbiage... 🤔 Item 2 - yeah this is tricky, the rub is that not all the VMs will be migraine at the same time some will have already been completed while others will still be needing to be completed... Maybe it should be total elapsed time.. Including the retry time.. |
transformation_host_name: task.options && task.options.transformation_host_name, | ||
delivered_on: new Date(task.options.delivered_on), | ||
updated_on: new Date(task.updated_on), | ||
completed: task.message === 'VM Transformations completed' || task.message === 'VM Transformations failed', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a string that might change with translation? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somewhat related: we actually already have an issue about those... if we want to tackle that in a future PR (or in this one): #255
"VM Transformations completed" vs "Migrations completed"
Ideally, we can create some sort of dictionary to map them to the UI translation on the Redux end... I don't know if we tackle this now though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those strings are coming from the backend -- hopefully the backend has gettexted them.
But you are right, this should be -
completed: task.message === __('VM Transformations completed') || task.message === __('VM Transformations failed'),
We can't control the backend, but we can at least do our part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have also found a couple of incorrect sprintf
usages - i.e. incorrect in the context of i18n.
I'm thinking of handling this string and a bunch of other strings in a separate PR for addressing all known i18n issues.
if (!task.diskSpaceCompletedGb) { | ||
taskDetails.diskSpaceCompletedGb = '0'; | ||
} | ||
vmTasks.forEach(task => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any chance vmTasks could ever be null/undefined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, not in PlanReducer - i.e., we are always expected to have tasks in the Plan detail screen.
(PlanReducer is the reducer for Plan detail screen)
00ecba1
to
29844e8
Compare
Per our discussion, I have kept the elapsed time in the Overview screen to reflect the elapsed time of the most recent request. PlanB in the below screenshot in it's most recent request had 1 VM to migrate (Webserver-01). The migration for this VM took 4min:38sec The Plan detail page shows the VM, Webserver-01 that took 4min:38sec - /cc @vconzola |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome additions @AparnaKarve !
🏆 ⚓️ 👩🚀
} | ||
tasksOfPlan.forEach(task => { | ||
tasks[task.source_id] = tasks[task.source_id] || {}; | ||
tasks[task.source_id].completed = task.status === 'Ok' && task.state === 'finished'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we still haven't extracted these task statuses to constants... since the number of places these are used is increasing, and we have pre/post playbook support upcoming, i think it would be nice to move those to constants in a future PR
pulled this locally earlier today...works for me! |
Once we have all requests with tasks for a given plan, reuse functions from `commonUtilitiesHelper` to retrieve the most recent tasks from the requests object based on the VM id's
29844e8
to
e6f6846
Compare
@priley86 @AllenBW In the last commit, I have made the necessary adjustments for ManageIQ/manageiq#17674 Should be GTG now. |
thanks! Will be nice to get this one to QE sooner than later...merging... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OH snap, I though I had already reviewed the last version of this...
but also 👍 ❤️
@AllenBW Yeah the new structure BTW, your old plans won't work anymore because of this new structure - so you would have to delete them all and create new ones. |
@AparnaKarve Please create a separate PR for Gaprindashvili due to conflicts...
|
@simaishi Would it be possible to merge ManageIQ/manageiq#17627 and ManageIQ/manageiq#17674 first before I create a G specific PR for this? If it's not possible to merge the above PRs at this time, I might have to exclude the last commit from this PR and then add it after those PRs are merged. |
@AparnaKarve I was holding off backporting those, as PRs/BZs aren't properly linked together and I can't tell which PRs are needed for pre/post feature... I hope to get them cleared out in the next few days, so let's hold off creating G-specific PR for this until next week. |
@simaishi No problem - we can wait. |
@AparnaKarve FYI, ManageIQ/manageiq#17627 and ManageIQ/manageiq#17674 are backported to Gaprindashvili branch now. |
@AparnaKarve was there further work needed to resolve the conflict. |
Gaprindashvili specific PR - #521 |
Backported to Gaprindashvili via #521 |
Fixes #437, #469
https://bugzilla.redhat.com/show_bug.cgi?id=1592956
https://bugzilla.redhat.com/show_bug.cgi?id=1594428