-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v2v: Handle IMPORTEXPORT_STARTING_IMPORT_VM event #149
Conversation
6aea139
to
61bb9c5
Compare
CC @tinaafitz |
CC @pkliczewski |
module Event | ||
module EmsEvent | ||
module RHEVM | ||
class UpdateVmImportStatus |
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.
What happened to updateVmImportStatus? I do not see any information why are you replacing it.
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.
@pkliczewski UpdateVmImportStatus cannot work as it is because when IMPORTEXPORT_IMPORT_VM event arrives nobody guarantees that the VM object is accessible. That's why I'm replacing the UpdateVmImportStatus method with a state machine that will wait until the VM object is accessible and only after that will update its import status.
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.
@smelamud It was not clear to me from your description. Can you please update it?
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.
@pkliczewski Do you know if the VM will show up in our inventory before the import is complete? The reason I ask is, if it's not included in our inventory until the import is complete, we don't need the additional state machine because the import state machine will catch the VM when it's complete.
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.
@tinaafitz I am not sure about the sequence of the events during the import but as far as I know other parts of the code we always create an entity in the db (call refresh) when the action is done.
@smelamud please respond to the question
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.
@tinaafitz oVirt always creates a VM at the beginning of V2V process. But V2V that converts the VM and refresh that puts VM into CFME's inventory are two independent processes. And my and Martin Betak's testing shows that sometimes the VM appears before and sometimes after the V2V process completes.
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.
@smelamud What is the event triggered by ovirt when a vm is created during v2v? For example during vm creating process we have two events (we have more but for sake of discussion I simplify ) USER_ADD_VM
and USER_ADD_VM_FINISHED_SUCCESS
. The last event triggers refresh to update the inventory. I wonder why do we need it at the beginning?
BTW do we know what is the difference between two v2v runs when a vm is inventory before and after the process completes? It sounds like a bug to me.
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.
@pkliczewski @smelamud - @mkanoor, @agrare and I discussed various aspects of the issue.
I have a few suggestions:
- Change the event refresh call.
The RHEVM event IMPORTEXPORT_IMPORT_VM instance currently calls for a refresh with the following:
/System/event_handlers/event_action_refresh?target=src_vm
It should call this instead:
/System/event_handlers/event_action_refresh_new_target?target=src_vm
-
This new state machine is not necessary. The original import state machine will be pick up the VM on a retry and the failure will be caught by the state machine when it exceeds the specified number of retries.
-
Remove the custom_get logic from the original state machine wait_for_vm_import method.
status = vm.custom_get(:import_status)
The method is a success if there is a VM, otherwise setup the retry.
@miq-bot assign @gmcculloug |
61bb9c5
to
3998957
Compare
Added more detailed description and bug URL. |
Okay so couple of questions @smelamud:
|
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.
@pkliczewski @smelamud - @mkanoor, @agrare and I discussed various aspects of the issue.
I have a few suggestions:
- Change the event refresh call.
The RHEVM event IMPORTEXPORT_IMPORT_VM instance currently calls for a refresh with the following:
/System/event_handlers/event_action_refresh?target=src_vm
It should call this instead:
/System/event_handlers/event_action_refresh_new_target?target=src_vm
-
This new state machine is not necessary. The original import state machine will be pick up the VM on a retry and the failure will be caught by the state machine when it exceeds the specified number of retries.
-
Remove the custom_get logic from the original state machine wait_for_vm_import method.
status = vm.custom_get(:import_status)
The method is a success if there is a VM, otherwise setup the retry.
@agrare There is |
@smelamud okay great, if we can get the |
The original import state machine ( |
@agrare Sorry, I don't clearly understand how
in But if this requires |
@smelamud looking at your parser it would be if |
@agrare, @smelamud and I were looking at the event_stream object the other day. The vm information is available here: |
@agrare No, I'm using
And
|
@smelamud @tinaafitz so it sounds like we're all agreeing that we can get the new VM's unique reference from the |
@agrare No, I was talking about |
If so, yes, we have a way to construct |
@smelamud check out
|
@agrare OK, this I understand. But how |
@smelamud because I wasn't sure if the |
@agrare @pkliczewski OK, let's summarize how it should be working.
|
@smelamud |
@mkanoor if the VM is present in the provider it can be in our DB, it will get picked up by other refreshes anyway. If we want to prevent users from interacting with the VM while it is importing we should use another method to do that. |
We need to decide this ASAP, because this bug blocks V2V feature from being included into the nearest release. |
@smelamud Can you confirm that the refresh_new_target works properly on import? |
@tinaafitz @agrare I just retested it again on the latest master. Yes, after
|
@smelamud Check the logs for that refresh and see if you see |
@agrare Yes, I see |
@smelamud yes can you send me the log |
@smelamud okay the problem is definitely with the duplicate UUIDs:
|
@smelamud The wait_for_vm_import method uses the custom_get(:import_status) to determine success or failure: |
What does it mean? If |
@tinaafitz Yes, it is still valid. We set |
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.
@smelamud Looks good.
@smelamud you can call |
@smelamud can you try to reproduce that disconnect issue with refresh_new_target in isolation of this feature? |
@miq-bot add_label fine/yes |
@simaishi you need to use the src_vm |
@jelkosz use Using |
@simaishi well, the #119 is targeted to 5.9 so maybe I would not backport the whole thing. I have tested on my setup only to backport this particular patch and use the "src_vm" only for importexport_import_vm.yaml, importexport_import_vm_failed.yaml and importexport_starting_import_vm.yaml and all worked well. |
@jelkosz |
v2v: Handle IMPORTEXPORT_STARTING_IMPORT_VM event (cherry picked from commit 2e4892c) https://bugzilla.redhat.com/show_bug.cgi?id=1479454 https://bugzilla.redhat.com/show_bug.cgi?id=1479453
Fine backport details:
|
Added VmImportWaitForVm state machine that is created when
IMPORTEXPORT_IMPORT_VM event arrives. VmImportWaitForVm state machine
waits for the converted VM to appear in the database and then sets its
import status. After that VmImport state machine can continue its
operation.
https://bugzilla.redhat.com/show_bug.cgi?id=1469498
https://bugzilla.redhat.com/show_bug.cgi?id=1469492