Skip to content
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

Add V2V for VMware to oVirt / RHV #301

Merged
merged 12 commits into from
May 31, 2018

Conversation

ghost
Copy link

@ghost ghost commented May 23, 2018

This PR aims at merging the code maintained in https://github.com/fdupont-redhat/v2v-automate/ in the manageiq-content repository, so that it can be shipped with the appliance.

Related PR: #312

@ghost
Copy link
Author

ghost commented May 23, 2018

@miq-bot add-label transformation

@miq-bot miq-bot added the v2v label May 23, 2018
@ghost
Copy link
Author

ghost commented May 23, 2018

@miq-bot add-label wip

@miq-bot miq-bot changed the title Add V2V for VMware to oVirt / RHV [WIP] Add V2V for VMware to oVirt / RHV May 23, 2018
@miq-bot miq-bot added the wip label May 23, 2018
@gmcculloug gmcculloug self-assigned this May 23, 2018
@@ -0,0 +1,53 @@
---
object_type: class
Copy link
Contributor

Choose a reason for hiding this comment

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

@fdupont-redhat
This class already exists in master, are there any changes to it.

Copy link
Author

Choose a reason for hiding this comment

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

Nope. But apparently, Git think there is...

Copy link
Contributor

Choose a reason for hiding this comment

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

@fdupont-redhat
When the first PR was created the directory for MiqAe didn't have the class prefix.
The actual name should have been MiqAe.class but it got stored in the content repo as MiqAe.
I am not sure how you created the class, if you look at other class directories under

https://github.com/ManageIQ/manageiq-content/tree/master/content/automate/ManageIQ/System/CommonMethods

You will see that MiqAe stands out.
Can we fix this issue in a separate PR which might help reduce the # of files in this PR?

@ghost
Copy link
Author

ghost commented May 25, 2018

@mkanoor, @gmcculloug, @tinaafitz, my Ruby skills hit a limit with the last errors:

  • Lint/RescueException - If I understand correctly, I simply have to replace Exception with StandardError in my rescue statements. Am I right ?
  • Style/RedundantBegin - I have no clue.
  • Naming/ClassAndModuleCamelCase - The name of the class is consistent with the name of the automate method. Should I change it to comply with Rubocop ? Then, it wouldn't be consistent with the rest of automate methods...
  • Detected cloudforms - It is due to the message we have decided to put in the description of the VM upon migration. Should we change it ?

Thanks for your help.

@@ -22,7 +22,7 @@ def main
destination_ems = task.transformation_destination(source_cluster).ext_management_system
raise "Invalid destination EMS type: #{destination_ems.emstype}. Aborting." unless destination_ems.emstype == "rhevm"

transformation_host = ManageIQ::Automate::Transformation::TransformationHosts::Common::Utils.get_transformation_host(destination_ems, 'vddk', factory_config)
transformation_host = ManageIQ::Automate::Transformation::TransformationHosts::Common::Utils.get_transformation_host(destination_ems, @handle.get_state_var(:transformation_method), factory_config)
Copy link
Contributor

Choose a reason for hiding this comment

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

@fdupont-redhat
Should the transformation_method be set in request/task options hash, since we want that information to persist. The state_var is temporary and will disappear when the task ends. The Request/Task options would persist.

Copy link
Author

Choose a reason for hiding this comment

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

@mkanoor
The transformation method is set in the AssessTransformation method. Currently, it's hardcoded to 'vddk', but in future versions 'ssh' will also be available and provided by the task or transformation plan, or even the transformation mapping. We still don't know which of these objects will hold the information.

Copy link
Contributor

Choose a reason for hiding this comment

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

@fdupont-redhat
Do you want to open a git issue on moving this to the request or task options instead of leaving it in state vars?

Copy link
Author

Choose a reason for hiding this comment

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

Shouldn't I wait for this PR to be merged before ? If not, I'll open the issue.

@@ -9,7 +9,7 @@ def initialize(handle = $evm)
end

def main
playbook = "/usr/share/doc/ovirt-ansible-v2v-conversion-host-1.0.0/examples/conversion_host_check.yml"
playbook = "/usr/share/doc/ovirt-ansible-v2v-conversion-host-1.2.0/examples/conversion_host_check.yml"
Copy link
Contributor

Choose a reason for hiding this comment

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

@fdupont-redhat
How do these playbooks get into the appliance, is there a seeding process for each ansible enabled appliance?

Copy link
Author

Choose a reason for hiding this comment

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

@mkanoor
The playbooks are not on the appliance, but on the RHV Manager. They are provided by the ovirt-ansible-v2v-conversion-host package. So nothing to do on ManageIQ side.

source_vm = task.source
@handle.log(:info, "Source VM: #{source_vm.name}")
source_cluster = source_vm.ems_cluster
@handle.log(:info, "Source Cluster: #{source_cluster.name}")
Copy link
Contributor

Choose a reason for hiding this comment

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

@fdupont-redhat
You dont need the .name
You can just change it to

@handle.log(:info, "Source Cluster: #{source_cluster}")

By default the to_s method that is indirectly called here will look for an attribute called name.
https://github.com/ManageIQ/manageiq-automation_engine/blob/a05c976f0983e18aea96f5d9609c931f75d7ad31/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_object.rb#L20

Copy link
Author

@ghost ghost May 30, 2018

Choose a reason for hiding this comment

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

So, that will be the same anytime I use .name, isn't it ? Because, a quick grep tells me it is used a lot, and not only in this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

@fdupont-redhat
You dont have to make this change, if you just used #{vmdb_object} you will get the name attribute.

@ghost ghost force-pushed the v2v_gaprindashvili-3 branch from 0f55a86 to 4a5e5dc Compare May 30, 2018 17:26
@@ -0,0 +1,140 @@
module ManageIQ
Copy link
Contributor

Choose a reason for hiding this comment

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

@fdupont-redhat
Didn't this file get moved when you moved the MiqAe to MiqAe.class. This is not a new file.
Have you rebased after your PR got merged?

Copy link
Author

@ghost ghost May 31, 2018

Choose a reason for hiding this comment

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

I have made changes to handle generic error messages. I confirm that I have rebased.

Copy link
Member

Choose a reason for hiding this comment

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

The existing files are named with underscore characters: weighted_update_status.rb and weighted_update_status.yaml. This PR is adding additional files without underscores in the names.

@fdupont-redhat Please correct.

Copy link
Author

Choose a reason for hiding this comment

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

You're correct. I had renamed the files for consistency with the method name, which has no underscore.

@@ -0,0 +1,73 @@
---
Copy link
Contributor

Choose a reason for hiding this comment

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

@fdupont-redhat
Even this one was in the MiqAe move to MiqAe.class

@miq-bot
Copy link
Member

miq-bot commented May 31, 2018

Some comments on commits fabiendupont/manageiq-content@b9469bf~...20ce583

content/automate/ManageIQ/Transformation/Infrastructure/VM/rhevm.class/methods/setdescription.rb

  • 💣 💥 🔥 🚒 - 17 - Detected cloudforms

@miq-bot
Copy link
Member

miq-bot commented May 31, 2018

Checked commits fabiendupont/manageiq-content@b9469bf~...20ce583 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
19 files checked, 12 offenses detected

content/automate/ManageIQ/Transformation/Common.class/methods/acquiretransformationhost.rb

content/automate/ManageIQ/Transformation/Common.class/methods/assesstransformation.rb

content/automate/ManageIQ/Transformation/Infrastructure/VM/Common.class/methods/poweroff.rb

content/automate/ManageIQ/Transformation/Infrastructure/VM/Common.class/methods/poweron.rb

content/automate/ManageIQ/Transformation/Infrastructure/VM/rhevm.class/methods/checkpoweredon.rb

content/automate/ManageIQ/Transformation/Infrastructure/VM/rhevm.class/methods/checkvmininventory.rb

content/automate/ManageIQ/Transformation/Infrastructure/VM/rhevm.class/methods/setdescription.rb

content/automate/ManageIQ/Transformation/Infrastructure/VM/vmwarews.class/methods/collapsesnapshots.rb

content/automate/ManageIQ/Transformation/Infrastructure/VM/vmwarews.class/methods/setmigrated.rb

content/automate/ManageIQ/Transformation/Infrastructure/VM/vmwarews.class/methods/utils.rb

content/automate/ManageIQ/Transformation/TransformationHosts/ovirt_host.class/methods/vmchecktransformed_vmwarews2rhevm_vddk.rb

content/automate/ManageIQ/Transformation/TransformationHosts/ovirt_host.class/methods/vmtransform_vmwarews2rhevm_vddk.rb

@gmcculloug
Copy link
Member

The remaining rubocop errors use the implicit rescue style and is consistent with the existing code base. Rubocop changed their default setting for this check and I prefer keeping them this way for consistency.

The recent rubocop change is being discussed here: ManageIQ/guides#310

@gmcculloug gmcculloug changed the title [WIP] Add V2V for VMware to oVirt / RHV Add V2V for VMware to oVirt / RHV May 31, 2018
@gmcculloug gmcculloug removed the wip label May 31, 2018
@Fryguy
Copy link
Member

Fryguy commented May 31, 2018

and I prefer keeping them this way for consistency.

Then go vote, @gmcculloug ! 😉

@gmcculloug
Copy link
Member

Thanks @fdupont-redhat.

I opened issue #315 to address refactoring and spec concerns.

@gmcculloug gmcculloug merged commit dc72f1f into ManageIQ:master May 31, 2018
@gmcculloug gmcculloug added this to the Sprint 87 Ending Jun 4, 2018 milestone May 31, 2018
simaishi pushed a commit that referenced this pull request Jun 1, 2018
Add V2V for VMware to oVirt / RHV
(cherry picked from commit dc72f1f)
@simaishi
Copy link
Contributor

simaishi commented Jun 1, 2018

Gaprindashvili backport details:

$ git log -1
commit 35ca01c522188967b71d0d9877a9db9ba40c7f5b
Author: Greg McCullough <[email protected]>
Date:   Thu May 31 16:08:42 2018 -0400

    Merge pull request #301 from fdupont-redhat/v2v_gaprindashvili-3
    
    Add V2V for VMware to oVirt / RHV
    (cherry picked from commit dc72f1fed8e5faac9e4dca0ad3c6a4982dc5d49f)

@ghost ghost deleted the v2v_gaprindashvili-3 branch July 31, 2018 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants