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

vSphere vm_clone a template to another datacenter/resource pool #2233

Closed
snobear opened this issue Oct 8, 2013 · 6 comments
Closed

vSphere vm_clone a template to another datacenter/resource pool #2233

snobear opened this issue Oct 8, 2013 · 6 comments

Comments

@snobear
Copy link

snobear commented Oct 8, 2013

Is it possible to clone a template to a VM in another datacenter? I have a vm template that exists in datacenter "Foo" and I'd like to deploy a VM from that template to datacenter "Bar". I'm able to clone to datacenter "Foo", presumably because its the same datacenter where the template resides.

From reading the docs, it seems like resource_pool is the option to use for specifying the destination? Here's what I'm trying:

connection = Fog::Compute.new(credentials)

options = {"wait"=>true,
 "numCPUs"=>1,
 "memoryGB"=>1,
 "datacenter"=>"Foo",
 "datastore"=>"VM NFS Mount",
 "network_label"=>"172.10.16.x",
 "resource_pool"=>["Bar", "Bar Cluster"],
 "template_path"=>"centos_6_4",
 "power_on"=>true,
 "customization_spec"=>
  {"domain"=>"example.com",
   "hostname"=>"test01",
   "ipsettings"=>
    {"gateway"=>["172.10.16.1"],
     "ip"=>"172.10.31.2",
     "subnetMask"=>"255.255.240.0"}},
 "name"=>"Test01"}

This results in:

/usr/lib/ruby/gems/1.8/gems/fog-1.15.0/lib/fog/vsphere/requests/compute/get_resource_pool.rb:16:in `get_raw_resource_pool': undefined method `resourcePool' for nil:NilClass (NoMethodError)
        from /usr/lib/ruby/gems/1.8/gems/fog-1.15.0/lib/fog/vsphere/requests/compute/vm_clone.rb:97:in `vm_clone'
        from ./deploy.rb:148

Leaving off the resource_pool option, it clones successfully to the same datacenter, so as I said no problem there.

I'm sure that Bar and Bar Cluster exist, to I'm not sure what I'm doing wrong. Let me know if I can grab some debug info.

Great work on fog and thanks for the help.

@geemus
Copy link
Member

geemus commented Oct 8, 2013

@MarcGrimme - could you take a look? Thanks!

@MarcGrimme
Copy link
Contributor

From the documentation I read the following:

 Only works with clusters within the same datacenter as where you're cloning from. Datacenter grabbed from template_path option.

Looks like it doesn't work over datacenters.
See https://github.com/fog/fog/blob/master/lib/fog/vsphere/requests/compute/vm_clone.rb#L51

I don't know if it would be possible to use VSphere API to clone from one DC to another (might have some difficult requirements). I could check if this is possible anyways.

Hope that helps
Marc.

@snobear
Copy link
Author

snobear commented Oct 15, 2013

Hi @MarcGrimme thanks for the info. In the vSphere web GUI, it's pretty trivial to clone a template to a VM in any cluster, regardless of DC, so I'd be surprised if it wasn't straightforward in the API, but you never know :).

I think the datacenter option in vm_clone is used for specifying the path to the template as well as the destination...

https://github.com/fog/fog/blob/master/lib/fog/vsphere/requests/compute/vm_clone.rb#L97

...so it could just be a matter of specifying a destination datacenter separately. I'll spend some time looking into it and will report back.

@plribeiro3000
Copy link
Member

I'm closing this due inactivity.

@snobear Please comment here if you have more feedback about it.

@geemus
Copy link
Member

geemus commented Nov 21, 2014

Thanks!

On Fri, Nov 21, 2014 at 2:33 PM, Paulo Henrique Lopes Ribeiro <
notifications@github.com> wrote:

Closed #2233 #2233.

Reply to this email directly or view it on GitHub
#2233 (comment).

@synthead
Copy link

+1

This would be a great feature to have!

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

No branches or pull requests

5 participants