VMware Cloud Community
datue
Contributor
Contributor

vCLI Passthroughauth with Virtual Center to VM-Host

Hello,

i want to use the vCli vmkfstools with passthroughauth option to create/cline vmdk-files, but i get an error "Unable to create virtual disk with specified parameters.".

The vcenter and the esxi-hosts are full licensed.

I get this error only for "writing"-tasks like creating (-c), cloning (-i) or deleting (-U) disks.

When i use the option -P to print file system information, i get no error and the command works.

Also when i authenticate with username and password directly to the esxi-host i get no errors and can use all functions of vmkfstools.

I run the following command:

vmkfstools --server vc.domain.local --vihost vm.domain.local --passthroughauth -c 1G /vmfs/volumes/DATASTORE/test.vmdk

whith the following result:

Attempting to create virtual disk [DATASTORE] g.vmdk
Unable to create virtual disk with specified parameters.

I run the same command with --verbose option and get the following SOAP messages (excerpt):

Attempting to create virtual disk [DATASTORE] g.vmdk

REQUEST: $VAR1 = '<?xml version="1.0" encoding="UTF-8"?>
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
<CreateVirtualDisk_Task xmlns="urn:vim25">
  <_this type="VirtualDiskManager">virtualDiskManager</_this>
  <name>[DATASTORE] g.vmdk</name>
  <spec xsi:type="FileBackedVirtualDiskSpec">
   <diskType>preallocated</diskType>
   <adapterType>busLogic</adapterType>
   <capacityKb>1048576</capacityKb>
  </spec>
</CreateVirtualDisk_Task>
</soapenv:Body>
</soapenv:Envelope>
';

RESPONSE: $VAR1 = '<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<soapenv:Fault>
  <faultcode>ServerFaultCode</faultcode>
  <faultstring></faultstring>
  <detail>
   <InvalidArgumentFault xmlns="urn:vim25" xsi:type="InvalidArgument">
    <invalidProperty>dc</invalidProperty>
   </InvalidArgumentFault>
  </detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>';

Unable to create virtual disk with specified parameters.


What is the "dc" property?

Thank you for your answers.

5 Replies
ManiaArmyYurt
Contributor
Contributor

Hey !

I'm digging this topic up because I have the same issue. I'm running the exact same command without passthroughauth, and I'm having the same error.

If I understand the error correctly, dc stands for datacenter, and you must specify one in case of a vCenter. For instance, the vifs tool has a --dc option.

But then how can I select the datacenter in this case, with vmkfstools ? Nothing seemed to answer that when running vmkfstools --help. Is it a known bug or am I missing something ?

Thanks a lot.

0 Kudos
P_Koetsier
Contributor
Contributor

I ran into the same issue.

The remark about "dc" standing for datacenter put me on the right track, so thanks for that. When the vmkfstools script calls the CreateVirtualDisk() function, it doesn't specify a datacenter.

I created a little patch against the version of the script that came with the Perl SDK 5.0. It allows you to specify a datacenter using a "--datacenter <datacenter name>" option. It worked for me.

--- vmkfstools.orig 2013-09-06 15:23:35.000000000 +0200

+++ vmkfstools 2014-01-21 11:36:38.196450037 +0100

@@ -6,6 +6,7 @@

#

my @options = (

+    ['datacenter', '_default_'],

     ['createfs', 'blocksize', 'setfsname', '_default_'],

     ['createfs', 'setfsname', '_default_'],

     ['queryfs', '_default_'],

@@ -43,6 +44,13 @@

       !,

       required => 0,

    },

+   'datacenter' => {

+        type => "=s",

+        help => qq!

+          The datacenter to use when connecting via a vCenter Server.

+      !,

+      required => 0,

+   },

    'createfs' => {

       alias => "C",

       type => "=s",

@@ -250,6 +258,9 @@

Opts::validate();

+# Connection ops

+my $datacenter = Opts::get_option('datacenter');

+

# for file system ops

my $createfs = Opts::get_option('createfs');

my $blocksize = Opts::get_option('blocksize');

@@ -439,6 +450,10 @@

sub create_disk {

    my ($vdm, $path, $size, $disk_type, $adapter_type, $device) = @_;

+   $datacenter="dhvdc1-p" unless defined($datacenter);

+   my $dcRef = Vim::find_entity_view(view_type => 'Datacenter', filter => {name => $datacenter});

+   defined($dcRef) || die "Cannot find datacenter $datacenter";

+

    # bug 388713, 468488

    if(defined($adapter_type) && ($adapter_type eq 'ide')) {

       #bug 560892

@@ -480,7 +495,7 @@

    eval {

       printf ("\nAttempting to create virtual disk %s\n", $path);

-      $vdm->CreateVirtualDisk(name => $path, spec => $spec);

+      $vdm->CreateVirtualDisk(name => $path, spec => $spec, datacenter => $dcRef);

       printf ("\nSuccessfully created virtual disk %s\n", $path);

    };

    if ($@) {

P_Koetsier
Contributor
Contributor

I looked into this in more detail, and found documentation for the CreateVirtualDisk_Task that it used by the vmkfstools script. It states that the datacenter parameter is only needed when using a datastore path, not when using a "URL referring to the virtual disk to be created.".

I found that using a command like this worked fine:

vmkfstools --server vc.my.domain --vihost esxhost.my.domain --username user --password pwd --createrdmpassthru /vmfs/devices/disks/naa.99999999999999999999999999999999 'https://vc.my.domain/folder/test_directory/test_rdm.vmdk?dcPath=datacenter&dsName=datastore'

Note that the "/folder" string in the URL is part of the syntax, it does not signify a directory in which you want to create the vmdk file. There is more information about the URL syntax here: http://pubs.vmware.com/vsphere-51/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc%2Fvim.VirtualDiskMa...

0 Kudos
jackchentoronto
Enthusiast
Enthusiast

Thanks Koetsier,

followed your suggestion and patched vmkstools.pl on vSphere Cli 5.5 , finally I am able to create disk ( Why Vmware doesn't fix this bug? looks like it has been here for years! )

0 Kudos
StardustECR
Contributor
Contributor

Hi, the whole patched version is here : https://pastebin.com/raw/cE8vFRDe

0 Kudos