fog / fog-vsphere

Fog for vSphere
MIT License
36 stars 63 forks source link

give server class access to extra_config of create_vm #268

Closed Bonehead5338 closed 3 years ago

Bonehead5338 commented 3 years ago

The intent of this PR is to give access to the extra_config parameter of create_vm method to the server class.

extra_config added in https://github.com/fog/fog-vsphere/pull/17

Bonehead5338 commented 3 years ago

I mocked up some test code and checked this:

server.extra_config = {"disk.EnableUUID" => "TRUE"}`
server.save

result in created VM:

image

Bonehead5338 commented 3 years ago

@ezr-ondrej updated per your comment, and per the VMware docs

Bonehead5338 commented 3 years ago

I did a quick test and the results come back like below. Do we need to parse this back to a simple dictionary?

extra_config=[#<RbVmomi::VIM::OptionValue:0x00000000083ef398 @props={:key=>"nvram", :value=>"ruby_test.nvram"}>, #<RbVmomi::VIM::OptionValue:0x00000000083ee7b8 @props={:key=>"pciBridge0.present", :value=>"TRUE"}>, #<RbVmomi::VIM::OptionValue:0x00000000083edb38 @props={:key=>"svga.present", :value=>"TRUE"}>, #<RbVmomi::VIM::OptionValue:0x00000000083ecf58 @props={:key=>"pciBridge4.present", :value=>"TRUE"}>, #<RbVmomi::VIM::OptionValue:0x00000000083ec328 @props={:key=>"pciBridge4.virtualDev", :value=>"pcieRootPort"}>, #<RbVmomi::VIM::OptionValue:0x00000000083e77b0 @props={:key=>"pciBridge4.functions", :value=>"8"}>, #<RbVmomi::VIM::OptionValue:0x00000000083e6c70 @props={:key=>"pciBridge5.present", :value=>"TRUE"}>, #<RbVmomi::VIM::OptionValue:0x00000000083e61f8 @props={:key=>"pciBridge5.virtualDev", :value=>"pcieRootPort"}>, #<RbVmomi::VIM::OptionValue:0x00000000083e5618 @props={:key=>"pciBridge5.functions", :value=>"8"}>, #<RbVmomi::VIM::OptionValue:0x00000000083e4a88 @props={:key=>"pciBridge6.present", :value=>"TRUE"}>, #<RbVmomi::VIM::OptionValue:0x00000000083dfe48 @props={:key=>"pciBridge6.virtualDev", :value=>"pcieRootPort"}>, #<RbVmomi::VIM::OptionValue:0x00000000083df2b8 @props={:key=>"pciBridge6.functions", :value=>"8"}>, #<RbVmomi::VIM::OptionValue:0x00000000083de778 @props={:key=>"pciBridge7.present", :value=>"TRUE"}>, #<RbVmomi::VIM::OptionValue:0x00000000083ddb48 @props={:key=>"pciBridge7.virtualDev", :value=>"pcieRootPort"}>, #<RbVmomi::VIM::OptionValue:0x00000000083dcf40 @props={:key=>"pciBridge7.functions", :value=>"8"}>, #<RbVmomi::VIM::OptionValue:0x00000000083dc338 @props={:key=>"hpet0.present", :value=>"TRUE"}>, #<RbVmomi::VIM::OptionValue:0x00000000083d7748 @props={:key=>"disk.EnableUUID", :value=>"TRUE"}>, #<RbVmomi::VIM::OptionValue:0x00000000083d6c08 @props={:key=>"viv.moid", :value=>"35ecb274-de6d-440f-8569-b8a0b10be610:vm-12107:idSGEFEd/e66igYu/at/xLcGyDRbYm3HG4NHWSnTIQU="}>, #<RbVmomi::VIM::OptionValue:0x00000000083d60c8 @props={:key=>"vmware.tools.internalversion", :value=>"0"}>, #<RbVmomi::VIM::OptionValue:0x00000000083d5448 @props={:key=>"vmware.tools.requiredversion", :value=>"11297"}>, #<RbVmomi::VIM::OptionValue:0x00000000083d47c8 @props={:key=>"migrate.hostLogState", :value=>"success"}>, #<RbVmomi::VIM::OptionValue:0x00000000083cfbd8 @props={:key=>"migrate.migrationId", :value=>"5731620226343364639"}>, #<RbVmomi::VIM::OptionValue:0x00000000083ceff8 @props={:key=>"migrate.hostLog", :value=>"ruby_test-0c3524fd.hlog"}>]
  >]
Bonehead5338 commented 3 years ago

@ezr-ondrej I now get the below returned. Let me know if there is anything else I need to add, thanks.

extra_config = {
    "nvram" => "ruby_test.nvram",
    "pciBridge0.present" => "TRUE",
    "svga.present" => "TRUE",
    "pciBridge4.present" => "TRUE",
    "pciBridge4.virtualDev" => "pcieRootPort",
    "pciBridge4.functions" => "8",
    "pciBridge5.present" => "TRUE",
    "pciBridge5.virtualDev" => "pcieRootPort",
    "pciBridge5.functions" => "8",
    "pciBridge6.present" => "TRUE",
    "pciBridge6.virtualDev" => "pcieRootPort",
    "pciBridge6.functions" => "8",
    "pciBridge7.present" => "TRUE",
    "pciBridge7.virtualDev" => "pcieRootPort",
    "pciBridge7.functions" => "8",
    "hpet0.present" => "TRUE",
    "disk.EnableUUID" => "TRUE",
    "viv.moid" => "35ecb274-de6d-440f-8569-b8a0b10be610:vm-12107:idSGEFEd/e66igYu/at/xLcGyDRbYm3HG4NHWSnTIQU=",
    "vmware.tools.internalversion" => "0",
    "vmware.tools.requiredversion" => "11297",
    "migrate.hostLogState" => "success",
    "migrate.migrationId" => "5731620226343364639",
    "migrate.hostLog" => "ruby_test-0c3524fd.hlog"
  }