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

VM rename isn't persistant (vCloud Director) #2761

Closed
g3kk0 opened this issue Mar 14, 2014 · 9 comments
Closed

VM rename isn't persistant (vCloud Director) #2761

g3kk0 opened this issue Mar 14, 2014 · 9 comments

Comments

@g3kk0
Copy link

g3kk0 commented Mar 14, 2014

Re-opened as the suggested fix (calling 'save' method) doesn't work.

Renaming a VM doesn't appear to work/persist in vCloud Director:

irb(main):085:0* vm
=> id="vm-fkgdcca5-725a-4e87-bff3-46ef41480b53",
vapp_id="vapp-56ab1743-d41e-42c3-8bad-8d1a958dc119",
vapp_name="testbox",
name="centos65x64",
type="application/vnd.vmware.vcloud.vm+xml",
href="https://myvdc.example.com/api/vApp/vm-fkgdcca5-725a-4e87-bff3-46ef41480b53",
status="off",
operating_system="Red Hat Enterprise Linux 6 (64-bit)",
ip_address="",
cpu=2,
memory=2048,
hard_disks=[{"Hard disk 1"=>10240}]

Editing it just as you would for cpu or memory changes it but it doesn't remain changed after a reload.

irb(main):105:0* vm.name = "node1"
=> "node1"

irb(main):085:0* vm
=> id="vm-fkgdcca5-725a-4e87-bff3-46ef41480b53",
vapp_id="vapp-56ab1743-d41e-42c3-8bad-8d1a958dc119",
vapp_name="testbox",
name="node1",
type="application/vnd.vmware.vcloud.vm+xml",
href="https://myvdc.example.com/api/vApp/vm-fkgdcca5-725a-4e87-bff3-46ef41480b53",
status="off",
operating_system="Red Hat Enterprise Linux 6 (64-bit)",
ip_address="",
cpu=2,
memory=2048,
hard_disks=[{"Hard disk 1"=>10240}]

irb(main):085:0* vm.reload
=> id="vm-fkgdcca5-725a-4e87-bff3-46ef41480b53",
vapp_id="vapp-56ab1743-d41e-42c3-8bad-8d1a958dc119",
vapp_name="testbox",
name="centos65x64",
type="application/vnd.vmware.vcloud.vm+xml",
href="https://myvdc.example.com/api/vApp/vm-fkgdcca5-725a-4e87-bff3-46ef41480b53",
status="off",
operating_system="Red Hat Enterprise Linux 6 (64-bit)",
ip_address="",
cpu=2,
memory=2048,
hard_disks=[{"Hard disk 1"=>10240}]

Calling the suggested vm.save method doesn't work as the method doesn't seem to exist like it does for the network object.

irb(main):033:0> vm.save
NoMethodError: undefined method save' for #Fog::Compute::VcloudDirector::Vm:0x000000019e48b8
from (irb):33
from /home/mnewman/.rbenv/versions/1.9.3-p448/bin/irb:12:in'

@geemus
Copy link
Member

geemus commented Mar 14, 2014

@g3kk0 Thanks, let me see if I can get somebody with more expertise in vcloud to help out.

@mikepea Hey, could you check this out and advise? Thanks!

@mikepea
Copy link
Contributor

mikepea commented Mar 15, 2014

I'm not surprised it doesn't work, as the put_vm service request that it depends on was only added somewhat recently. It's probably a small fix to get it wired up into the Model, will look at that shortly (just became a dad tho, so no promises!

Not sure why save is not implemented though, again will take a look at why that is - prob docs are out of date.

There is a clean workaround for changing the VM name though, which is to do:

fog_connection_obj.service.put_vm(id, new_name)

On 14 Mar 2014, at 14:28, Wesley Beary notifications@github.com wrote:

@g3kk0 Thanks, let me see if I can get somebody with more expertise in vcloud to help out.

@mikepea Hey, could you check this out and advise? Thanks!


Reply to this email directly or view it on GitHub.

@g3kk0
Copy link
Author

g3kk0 commented Mar 17, 2014

@mikepea Thanks for the workaround.

Much appreciated.

@geemus
Copy link
Member

geemus commented Mar 17, 2014

@mikepea - congrats on dad-hood!

@plribeiro3000
Copy link
Member

@g3kk0 @mikepea @geemus Still needs fix?

@geemus
Copy link
Member

geemus commented Nov 24, 2014

There is a way to be able to do it, but it would be good to wire that in to the model. So yeah, we should probably leave this for now. Thanks!

@trilitheus
Copy link

Hi there, any chance you could expand on how to implement this workaround?

v = Fog::Compute::VcloudDirector.new(vcloud_director_username: "#{user}@#{org}",
                                      vcloud_director_password: pass,
                                      vcloud_director_host: host,
                                      vcloud_director_show_progress: true)

vm_id=v.organizations.get_by_name(org).vdcs.first.vapps.first.vms.first.id

v.put_vm(vm_id, 'new-vm-name')
ArgumentError: wrong number of arguments (2 for 3)

v.service.put_vm(vm_id, 'new-vm-name')
NoMethodError: undefined method `put_vm' for Fog::Compute::VcloudDirector:Class

@trilitheus
Copy link

For anyone else....

v.put_vm(vm_id, 'new-vm-name', {})

This does the trick

@geemus
Copy link
Member

geemus commented Sep 4, 2015

@trilitheus thanks!

@geemus geemus closed this as completed Sep 4, 2015
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