I got so carried away with getting the services interface, i didn't go back 
and check the model. Thanks for getting me back on path

Sooo .. it works for me kind of .. as soon as I get past adding the 6th 
disk (i'm just playing) i go from:

>> compute.volumes.create('server_id' => 
'50133300-edc8-2810-b651-6a5beb496afd', 'size_gb' => '2', 'name' => 'var', 
'datastore' => 'SL-Dev-Tier1-SPD-02')
  <Fog::Compute::Vsphere::Volume                                           
                                                                            
  
    id="6000C29b-ebe9-0a80-b4ce-43c93dd18f40",                             
                                                                            
  
    datastore="SL-Dev-Tier1-SPD-02",                                       
                                                                            
  
    storage_pod=nil,                                                       
                                                                            
  
    mode="persistent",                                                     
                                                                            
  
    size=2097152,                                                           
                                                                            
 
    thin=true,                                                             
                                                                            
  
    eager_zero=nil,                                                         
                                                                            
 
    name="var",                                                             
                                                                            
 
    filename="[SL-Dev-Tier1-SPD-02] rundecktest01E/rundecktest01E_6.vmdk", 
                                                                            
  
    size_gb=2,                                                             
                                                                            
  
    key=2006,                                                               
                                                                            
 
    unit_number=6,                                                         
                                                                            
  
    server_id="50133300-edc8-2810-b651-6a5beb496afd"                       
                                                                            
  
  >     

Which is all good .. to (around the 6th Disk)
>> compute.volumes.create('server_id' => 
'50133300-edc8-2810-b651-6a5beb496afd', 'size_gb' => '2', 'name' => 'var', 
'datastore' => 'SL-Dev-Tier1-SPD-02')
NoMethodError: undefined method `id' for nil:NilClass                       
                                                                            
 
        from 
/usr/local/lib/ruby/gems/2.3.0/gems/fog-vsphere-0.6.0/lib/fog/vsphere/models/compute/volume.rb:73:in
 
`save'                                 
        from 
/usr/local/lib/ruby/gems/2.3.0/gems/fog-core-1.35.0/lib/fog/core/collection.rb:51:in
 
`create'                                               
        from (irb):49:in `<top (required)>'                                 
                                                                            
 
        from /usr/local/lib/ruby/gems/2.3.0/gems/fog-1.37.0/bin/fog:76:in 
`block in <top (required)>'                                                 
   
        from /usr/local/lib/ruby/gems/2.3.0/gems/fog-1.37.0/bin/fog:76:in 
`catch'                                                                     
   
        from /usr/local/lib/ruby/gems/2.3.0/gems/fog-1.37.0/bin/fog:76:in 
`<top (required)>'                                                         
    
        from /usr/local/bin/fog:23:in `load'                               
                                                                            
  
        from /usr/local/bin/fog:23:in `<main>'                             
                                                                            
  
        from /usr/local/bin/ruby_executable_hooks:15:in `eval'             
                                                                            
  
        from /usr/local/bin/ruby_executable_hooks:15:in `<main>'        

and then onwards to:
compute.volumes.create('server_id' => 
'50133300-edc8-2810-b651-6a5beb496afd', 'size_gb' => '2', 'name' => 'varg', 
'datastore' => 'SL-Dev-Tier1-SPD-02')
NoMethodError: undefined method `exclude?' for [0, 1, 2, 3, 4, 5, 6, 8, 
10]:Array                                                                   
      
        from 
/usr/local/lib/ruby/gems/2.3.0/gems/fog-vsphere-0.6.0/lib/fog/vsphere/models/compute/volume.rb:57:in
 
`block in save'                         
        from 
/usr/local/lib/ruby/gems/2.3.0/gems/fog-vsphere-0.6.0/lib/fog/vsphere/models/compute/volume.rb:57:in
 
`each'                                  
        from 
/usr/local/lib/ruby/gems/2.3.0/gems/fog-vsphere-0.6.0/lib/fog/vsphere/models/compute/volume.rb:57:in
 
`find'                                  
        from 
/usr/local/lib/ruby/gems/2.3.0/gems/fog-vsphere-0.6.0/lib/fog/vsphere/models/compute/volume.rb:57:in
 
`save'                                  
        from 
/usr/local/lib/ruby/gems/2.3.0/gems/fog-core-1.35.0/lib/fog/core/collection.rb:51:in
 
`create'                                                
        from (irb):51:in `<top (required)>'                                 
                                                                            
  
        from /usr/local/lib/ruby/gems/2.3.0/gems/fog-1.37.0/bin/fog:76:in 
`block in <top (required)>'                                                 
    
        from /usr/local/lib/ruby/gems/2.3.0/gems/fog-1.37.0/bin/fog:76:in 
`catch'                                                                     
    
        from /usr/local/lib/ruby/gems/2.3.0/gems/fog-1.37.0/bin/fog:76:in 
`<top (required)>'                                                         
     
        from /usr/local/bin/fog:23:in `load'                               
                                                                            
   
        from /usr/local/bin/fog:23:in `<main>'                             
                                                                            
   
        from /usr/local/bin/ruby_executable_hooks:15:in `eval'             
                                                                            
   
        from /usr/local/bin/ruby_executable_hooks:15:in `<main>'
                                                  

But the first 10 disks get added, bu as far as concerned, if there's a need 
to add this many disk to a new build, then someone has some justifying to 
do ;)

Thanks for your help again :)

Regards
AJ


On Thursday, 11 February 2016 15:23:03 UTC, Kevin Menard wrote:
>
> Hi AJ,
>  
> Is there any reason you can't use the model interface? I think it'll make 
> things a bit easier for you. As an example, you can see how we create and 
> attach a volume in Rubber:
>  
>
> https://github.com/rubber/rubber/blob/ed32381ab201358a14b7c0ecc396cc6330ae9c9d/lib/rubber/cloud/vsphere.rb#L179-L206
>  
> If you do need to use the service methods directly, I'd look at how the 
> models call them. rbvmomi has a bit of an odd API and getting the 
> parameters right can be tricky, as you've seen.
>  
> If that doesn't get you going, let me know and I can try to help out more.
>  
> --
> Kevin
>  
>  
> On Thu, Feb 11, 2016, at 07:55, Ajmal Ali wrote:
>
> Hey group, Has anyone got an example of how add_vm_volume works? or what 
> the correct format is? or a better way to add storage to a vm
>  
>  
> I tried something like compute.add_vm_volume('storage_pod' => 
> 'SL-Dev-Tier1-SPD', 'size' => '5', 'name' => 'var', 'server_id' => 
> 'ae8230bf-d13e-4d8b-82fa-388a18c4813b')
> but all i get back is 
>  
> NoMethodError: undefined method `server_id' for #<Hash:0x007f7b71d51e40>
>         from 
> /usr/local/lib/ruby/gems/2.3.0/gems/fog-vsphere-0.6.0/lib/fog/vsphere/requests/compute/modify_vm_volume.rb:6:in
>  
> `add_vm_volume'
>         from (irb):27:in `<top (required)>'
>         from /usr/local/lib/ruby/gems/2.3.0/gems/fog-1.37.0/bin/fog:76:in 
> `block in <top (required)>'
>         from /usr/local/lib/ruby/gems/2.3.0/gems/fog-1.37.0/bin/fog:76:in 
> `catch'
>         from /usr/local/lib/ruby/gems/2.3.0/gems/fog-1.37.0/bin/fog:76:in 
> `<top (required)>'
>         from /usr/local/bin/fog:23:in `load'
>         from /usr/local/bin/fog:23:in `<main>'
>         from /usr/local/bin/ruby_executable_hooks:15:in `eval'
>         from /usr/local/bin/ruby_executable_hooks:15:in `<main>'
>  
> Regards
> AJ
>
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "ruby-fog" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to