Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1739340 - Failed to provision a VM when there are multiple datacenters with the same name in the vcenter
Summary: Failed to provision a VM when there are multiple datacenters with the same na...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Compute Resources - VMWare
Version: 6.5.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Jitendra Yejare
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-08-09 05:23 UTC by Hao Chang Yu
Modified: 2021-07-09 17:02 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-07-09 17:02:24 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 29814 0 Normal New Failed to provision a VM when there are multiple datacenters with the same name in the vcenter 2020-07-07 13:30:41 UTC

Description Hao Chang Yu 2019-08-09 05:23:13 UTC
Description of problem:
Provision a host failed with the following error.

[W|app|<id>] Caught VMware error
Fog::Compute::Vsphere::NotFound: Could not descend into .  Please check your path. /Datacenters/<Folder>/<Datacenter name>/vm/
Unix
/opt/theforeman/tfm/root/usr/share/gems/gems/fog-vsphere-2.4.0/lib/fog/vsphere/requests/compute/get_folder.rb:44:in `block in get_r
aw_vmfolder'
/opt/theforeman/tfm/root/usr/share/gems/gems/fog-vsphere-2.4.0/lib/fog/vsphere/requests/compute/get_folder.rb:38:in `each'
/opt/theforeman/tfm/root/usr/share/gems/gems/fog-vsphere-2.4.0/lib/fog/vsphere/requests/compute/get_folder.rb:38:in `reduce'
/opt/theforeman/tfm/root/usr/share/gems/gems/fog-vsphere-2.4.0/lib/fog/vsphere/requests/compute/get_folder.rb:38:in `get_raw_vmfolder'


As we can see above, Satellite fetched the root path of the other datacenter with the same name and caused the regex substitution issue to return empty string.

In /opt/theforeman/tfm/root/usr/share/gems/gems/fog-vsphere-2.4.0/lib/fog/vsphere/requests/compute/get_folder.rb
----------------------------
        def get_raw_vmfolder(path, datacenter_name)
          # The required path syntax - 'topfolder/subfolder

          # Clean up path to be relative since we're providing datacenter name
          dc             = find_raw_datacenter(datacenter_name)
          dc_root_folder = dc.vmFolder
          # Filter the root path for this datacenter not to be used."
          dc_root_folder_path = dc_root_folder.path.map { |_id, name| name }.join('/')
          paths = path.sub(/^\/?#{Regexp.quote(dc_root_folder_path)}\/?/, '').split('/') <==== Failed here because the root path didn't match the vm path
----------------------------


Version-Release number of selected component (if applicable):
6.5


How reproducible:
When vcenter has same datacenter name.

Steps to Reproduce:
1. In vSphere client, create the following folder structures

region 1:
  Datacenter:
    vm folder 1

region 2:
  Datacenter:
    vm folder 2

Datacenter

2. Foreman rake console you will see paths for both datacenter

irb(main)> dc = ComputeResource.find(<compute resource id>).send(:dc)
irb(main)> pp dc.vm_folders
[  <Fog::Compute::Vsphere::Folder
    id="group-v<Num>",
    name="vm",
    parent="Datacenter",
    datacenter="Datacenter",
    path="/Datacenters/Datacenter/vm",
    type=:vm
  >,
   <Fog::Compute::Vsphere::Folder
    id="group-v<Num>",
    name="vm folder 1",
    parent="vm",
    datacenter="Datacenter",
    path="/Datacenters/region 1/Datacenter/vm/vm folder 1",
    type=:vm
  >,
   <Fog::Compute::Vsphere::Folder
    id="group-v<Num>",
    name="vm folder 2",
    parent="vm",
    datacenter="Datacenter",
    path="/Datacenters/region 2/Datacenter/vm/vm folder 2",
    type=:vm
  >]


# Returned 3 datacenters with the same name
# then "find" method will just fetch the first match.
irb(main)> dc.service.send(:raw_datacenters).map(&:name)
=> ["Datacenter", "Datacenter", "Datacenter"]

Comment 5 Ondřej Ezr 2020-05-14 11:40:44 UTC
Created redmine issue https://projects.theforeman.org/issues/29814 from this bug

Comment 6 Mike McCune 2021-07-09 17:02:24 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and while we recognize that it is a valid request, we do not expect this to be implemented in the product in the foreseeable future. This is due to other priorities for the product, and not a reflection on the request itself. We are therefore closing this out as WONTFIX. If you have any concerns about this feel free to contact your Red Hat Account Team. Thank you.


Note You need to log in before you can comment on or make changes to this bug.