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

[DNM]VXFM-6201 :Verify the SVM we are configuring is on the correct host #292

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pankaj1176088
Copy link

@gavin-scott
Please review the approach .

host ||= cluster.host.select{ |h| h[:name] == resource[:host] }.first if cluster && cluster.host
@vm ||= host.vm.select{ |v| v[:name] == resource[:name]}.first if host && host.vm
end
@vm

Choose a reason for hiding this comment

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

Hmm, I'm not sure about this. findvm_by_name has some fairly complicated different logic it can do that you're losing:

def findvm_by_name(folder, vm_name)
folder.children.each do |f|
case f
when RbVmomi::VIM::Folder
foundvm = findvm_by_name(f, vm_name)
return foundvm if foundvm
when RbVmomi::VIM::VirtualMachine
return f if f.name == vm_name
when RbVmomi::VIM::VirtualApp
f.vm.each do |v|
return f if v.name == vm_name
end
else
raise(Puppet::Error, "unknown child type found: #{f.class}")
end
end
nil
end

I'd have to dig into this more to find the right fix. @sushilrai do you have any ideas?

@pankaj1176088
Copy link
Author

@gavin-scott @sushilrai
In existing deployment flow all SVM is created inside the vmFolder . If we deploy the another cluster within same datacenter then SVM is not being created because of duplicate SVM name . Since both are pointing to vmFolder .

Instead of pointing to vmFolder . Here we added sub folder with cluster name . And Now SVM is created inside the subfolder .
dc
|
vmFolder
| |
Cluster1 Cluster2
-SVM1 -SVM1
-SVM2 -SVM2
-SVM3 -SVM3

Please review the approach .

Copy link

@gavin-scott gavin-scott left a comment

Choose a reason for hiding this comment

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

@pankaj1176088 I don't believe we can require that a new folder get created in the hierarchy (vm folder). That would be a user-visible change requiring project management approval.

@pankaj1176088
Copy link
Author

@gavin-scott

In the Existing code under the vmware module  "exists?" method only check SVM name .  It return true if vm has same name even though vm does not belong to that cluster . 

To Fixed this issue we added condition to check cluster name as well as .

Like vm.name == vm_name && vm.resourcePool.owner.name == cluster_name . 

So now it continues with flow . But it failed during the OVF deployment . 

Debug: Failure during OVF deployment for vm: svm-node3 with error DuplicateName: The name 'svm-node3' already exists.: RbVmomi::Fault

This is the api it calls for ovf deployment .

vm_name = resource[:name]

It failed because both point to vmFolder . 

To avoid duplicate name , we added sub folder with cluster name . And  SVM is getting created inside the sub folder . This approach is working fine to create two svm with same name under the same data center .

Could you please let us know if any other approach we can use .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants