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 support for MAC address in network mapping #351

Conversation

ghost
Copy link

@ghost ghost commented Jul 5, 2018

This PR is the automate side to enable support for Distributed Virtual Switch (DVS) and Distributed Port Group (DPG). The solution is to allow mapping based on the MAC address rather than the source network name. Richard W.M. Jones has implemented the --mac option in virt-v2v [1]. I have created a PR to add the support for this option in virt-v2v-wrapper [2]. This code simply adds the MAC address of the NICs to the network mappings hash, so that it is passed to virt-v2v-wrapper.

Associated RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1594515

[1] https://www.redhat.com/archives/libguestfs/2018-July/msg00004.html
[2] oVirt/v2v-conversion-host#6

@ghost
Copy link
Author

ghost commented Jul 5, 2018

@miq-bot add-label enhancement

@ghost
Copy link
Author

ghost commented Jul 5, 2018

@miq-bot add-label transformation

@gmcculloug
Copy link
Member

@fdupont-redhat To avoid creating technical debt we need to ensure that these PRs include tests. Please reach out to us if you feel you need any help with testing.

end

def storage_mappings(task, vm)
vm.hardware.disks.select { |d| d.device_type == 'disk' }.each do |disk|
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
Either you can replace the each with collect and remove the appending into virtv2v_disks or initialize virtv2v_disks array like you do for mapping

def storage_mappings(task, vm)
            vm.hardware.disks.select { |d| d.device_type == 'disk' }.collect do |disk|
source_storage = disk.storage
              destination_storage = task.transformation_destination(disk.storage)
              raise "[#{vm.name}] Disk #{disk.device_name} [#{source_storage.name}] has no mapping. Aborting." if destination_storage.nil?
             {
                :path    => disk.filename,
                :size    => disk.size,
                :percent => 0,
                :weight  => disk.size.to_f / vm.allocated_disk_storage.to_f * 100
              }
            end
          end

@miq-bot
Copy link
Member

miq-bot commented Jul 5, 2018

Checked commits fabiendupont/manageiq-content@2109027~...62aea5e with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 0 offenses detected
Everything looks fine. 🏆

@ghost
Copy link
Author

ghost commented Jul 13, 2018

@miq-bot add-label gaprindashvili/yes

Copy link
Contributor

@syncrou syncrou left a comment

Choose a reason for hiding this comment

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

@fdupont-redhat - Specs on this would be a huge help

@gmcculloug
Copy link
Member

Adding specs for v2v methods is being tracked in #360

@gmcculloug gmcculloug merged commit a740e88 into ManageIQ:master Jul 17, 2018
@gmcculloug gmcculloug added this to the Sprint 91 Ending Jul 30, 2018 milestone Jul 17, 2018
@ghost ghost deleted the v2v_add_support_for_mac_address_in_network_mapping branch July 31, 2018 07:11
simaishi pushed a commit that referenced this pull request Jul 31, 2018
…ddress_in_network_mapping

Add support for MAC address in network mapping
(cherry picked from commit a740e88)

https://bugzilla.redhat.com/show_bug.cgi?id=1610547
@simaishi
Copy link
Contributor

Gaprindashvili backport details:

$ git log -1
commit 64769faa3358b0653c7c923ce88c2b40e2bc5865
Author: Greg McCullough <gmccullo@redhat.com>
Date:   Tue Jul 17 09:36:51 2018 -0400

    Merge pull request #351 from fdupont-redhat/v2v_add_support_for_mac_address_in_network_mapping
    
    Add support for MAC address in network mapping
    (cherry picked from commit a740e88dc0e2c0b2d1a21defb6deca33f45ad34e)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1610547

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.

None yet

6 participants