-
Notifications
You must be signed in to change notification settings - Fork 52
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
base: master
Are you sure you want to change the base?
Conversation
lib/puppet/provider/vc_vm/default.rb
Outdated
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 |
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.
Hmm, I'm not sure about this. findvm_by_name
has some fairly complicated different logic it can do that you're losing:
vmware-vcenter/lib/puppet/provider/vcenter.rb
Lines 63 to 81 in 1fbc59e
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?
1fbc59e
to
fbbe99a
Compare
@gavin-scott @sushilrai Instead of pointing to vmFolder . Here we added sub folder with cluster name . And Now SVM is created inside the subfolder . Please review the approach . |
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.
@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.
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 .
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 . |
@gavin-scott
Please review the approach .