Coder Social home page Coder Social logo

Comments (8)

jrgarcia avatar jrgarcia commented on July 17, 2024

@kartikaydw Just to make sure I'm understanding the issue correctly, the vmdk_spec refuses to allow you to pass a path which means that it always uses the default path and you need to use a non-default path. Is this correct?

from rbvmomi.

kartikaydw avatar kartikaydw commented on July 17, 2024

@jrgarcia Yes you are right, basically I want to create a disk under specified VM folder and then attach the virtual disk to the VM.

from rbvmomi.

jrgarcia avatar jrgarcia commented on July 17, 2024

@kartikaydw Looking at your code snippet, you are creating a VslmCreateSpecDiskFileBackingSpec, but the VslmCreateSpec takes a VslmCreateSpecBackingSpec and that takes an optional path parameter. I can see that the vmodl.db has this correctly.

...
"VslmCreateSpecBackingSpec"=>
  {"kind"=>"data",
   "props"=>
    [{"name"=>"datastore", "is-optional"=>false, "is-array"=>false, "version-id-ref"=>nil, "wsdl_type"=>"Datastore"},
     {"name"=>"path", "is-optional"=>true, "is-array"=>false, "version-id-ref"=>"vim.version.version12", "wsdl_type"=>"xsd:string"}],
   "wsdl_base"=>"DynamicData"},
...

If you use this type (VslmCreateSpecBackingSpec), does it work?

from rbvmomi.

kartikaydw avatar kartikaydw commented on July 17, 2024

Thanks @jrgarcia for looking into this.
Yes I tried using VslmCreateSpecBackingSpec in the below snippet , but it fails out with error

 vmdk_spec = RbVmomi::VIM::VslmCreateSpecBackingSpec(
    datastore: vmdk_datastore,
    #provisioningType: 'thin',
    path: "[#{vmdk_datastore.name}] #{vmdk_file_name}"
  )

vmdk_backing = RbVmomi::VIM::VslmCreateSpec(
capacityInMB: size.to_i * 1024,
backingSpec: vmdk_spec,
name: "[#{vmdk_datastore.name}] #{vmdk_file_name}",
)

vdisk = vim.serviceContent.vStorageObjectManager.CreateDisk_Task(
spec: vmdk_backing,
).wait_for_completion

Traceback (most recent call last):
1: from vCenter/add_disk.rb:172:in <main>' /usr/local/lib/ruby/gems/2.6.0/gems/rbvmomi-2.0.0/lib/rbvmomi/vim/Task.rb:14:in wait_for_completion': InvalidArgument: A specified parameter was not correct: spec.backingSpec (RbVmomi::Fault)

from rbvmomi.

jrgarcia avatar jrgarcia commented on July 17, 2024

Ok, just wanted to make sure. I'll continue to check into this. Thanks!

from rbvmomi.

jrgarcia avatar jrgarcia commented on July 17, 2024

I'm still looking into this. I'm waiting on feedback to confirm a suspicion I have. I'll let you know as soon as I have any info.

from rbvmomi.

kartikaydw avatar kartikaydw commented on July 17, 2024

Thanks @jrgarcia

from rbvmomi.

jrgarcia avatar jrgarcia commented on July 17, 2024

Ok, it appears that the path is expected to be a certain format. It should be an existing folder and nothing more meaning that you don't include [#{datastore.name}] or give a file name. It is just the name of an existing folder on that datastore. For example, instead of '[datastore1] folder1/folder2/filename.vmdk' you would just do 'folder1/folder2'.

from rbvmomi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.