VMware Cloud Community
sandipsubedi
Contributor
Contributor

CreateVmfsDatastore: A specified parameter was not correct

I am trying to create a VMFS datastore. But getting this error:

A specified parameter was not correct:

That's is. It doesn't tell which parameter is incorrect.

This is what my API call  looks like:

host.configManager.datastoreSystem.CreateVmfsDatastore(spec: {diskUuid: 'UUID_of_from_the_presented_LUN', partition: {}, vmfs: {volumeName: 'unique_volume_name_i_created', majorVersion: 5, extent: {diskName: 'naa.canonicalName_of_the_LUN', partition: 1}} })

Basically there are 3 variables:
diskUuid: I got that this way:

host.configManager.storageSystem.storageDeviceInfo.scsiLun[5].uuid

volumeName: unique name I created

diskName: This is where my confusion is. I got it this way.

host.configManager.storageSystem.storageDeviceInfo.scsiLun[6].canonicalName

Am I doing anything wrong? I even tried with different host. The size of the LUN that I created was 10GB.

Any help or suggestions is appreciated.

8 Replies
continuum
Immortal
Immortal

> This is what my function looks like:
Do you plan to create 100 datastores a day in future ?
That would explain why you try to create a function that in the end will call the vmkfstools -c command.
Creating a vmfs-datastore will only be a success if the conditions are good.
1. partitiontable needs to be clean - anything a little bit obscure will result in : A specified parameter was not correct
If your function fails once you will very likely have to clean up before you try next time.

2. command has a significant failure rate if it is not executed from with in /dev/disks

3. creating a datastore will cause issues in future if you create more than one per LUN

4. vmfs-volumes should really use partition 1 - avoid all other scenarios

5. using any other account than root to run the vmkfstools command should be avoided

So before you try to call a function - create datastores via vmkfstools.
If you then provide the full syntax we can assist you.
For now - some examples that fail would be useful.
> Basically there are 3 variables:
Agreed - but not the ones that you use.
Provide an example for the parameter you use - and show us the resulting vmkfstools command that your function creates.


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

Reply
0 Kudos
sandipsubedi
Contributor
Contributor

> Do you plan to create 100 datastores a day in future ?
Yes, we will be automating the process of datastores creation, so we might have to create 100 datastores a day in the future.

> So before you try to call a function - create datastores via vmkfstools.

I am not sure what you meant by that? We need to create datastores via API so that it can go into our automation pipeline.

We use GitHub - vmware/rbvmomi: Ruby interface to the VMware vSphere API.  for most of the other things already.

Based on this discussion here API to create Datastore · Issue #166 · vmware/rbvmomi · GitHub  I was able make call to create the VmfsDatastore.

> If you then provide the full syntax we can assist you.
I have provided the API call that I was using on my original question. But I am not sure what vmkfstools are.

Reply
0 Kudos
continuum
Immortal
Immortal

> But I am not sure what vmkfstools are.
Wow - this will be entertaing ....
You cant imagine how funny that sounds to a simple putty user like me.

As if you were talking about building cars and then not careing about the underlying details such as motors or tyres.

Anyway - maybe you really use different parameters via api - folks like me create datastores with vmkfstools (small binary - several options)

If the api drops it pants it basically also calls vmkfstools with parameters.

vmkfstools -C vmfs5 -b <blocksize> -S <datastoreName> <partitionName>
vmkfstools -C vmfs5 -b 1m -S home-is-where-the-vhsf-is  /vmfs/devices/disks/naa.long-number
:1

It needs this parameters:

vmfs-version

block-size

friendly name

device

If you start with a blank disk you need to call "partedUtil" (small binary - several options)  first.

If partedUtil fails you need to call "dd"  (small binary - several options) next.

If vmkfstools  with options is successful but mounting fails you need "hirn"  (small binary - several options) next.

Probably you automation guys never need those basic tools ??? 
My offer still stands - show me which parameters you use and how you label those parameters and maybe I find which parameters are incorrect


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

sandipsubedi
Contributor
Contributor

Thank you for your time and effort !

Looks like they make similar calls but format is different. Following are the params I have:

1. diskUuid: Example: 01000d000090003bv000000000000090ef0000c1de121210404040

This is how I go it

host.configManager.storageSystem.storageDeviceInfo.scsiLun[5].uuid

2. partition: {}

I just left is blank because it's optional.

3. volumeName: Example: ab1ab1_04_3PAR_12fe

This is the name we want to give to the datastore.

4. majorVersion: 5

5. diskName: Example: naa.90003bv000000000000090ef0000c1de . canonicalName of the disk.

This is how I got it:

host.configManager.storageSystem.storageDeviceInfo.scsiLun[5].canonicalName

6. partition: 1

All those params are collected and a hash is created and it looks like this:

{
diskUuid: '01000d000090003bv000000000000090ef0000c1de121210404040',
partition: {},
vmfs: {volumeName: 'ab1ab1_04_3PAR_12fe',
       majorVersion: 5,
       extent: {diskName: 'naa.90003bv000000000000090ef0000c1de', partition: 1}}
}

thank you again for your help.

Reply
0 Kudos
continuum
Immortal
Immortal

I dont know enough about APIs to check your code.
So I can only tell you what I find a little bit odd - hope it helps...


diskUuid: '01000d000090003bv000000000000090ef0000c1de121210404040',  ### 0
partition: {},  ### 1
vmfs: {volumeName: 'ab1ab1_04_3PAR_12fe', 
  majorVersion: 5,  ### 2
  extent: {diskName ### 3 : 'naa.90003bv000000000000090ef0000c1de', partition: 1 ### 1 }} 

### 0

- when we create a datastore this parameter is not needed

### 1

- is this the same as the other partition-parameter ?

- for vmkfstools the partition-parameter is required and it should better be 1

### 2

- dont you need to quote parameters ?
- does majorVersion = 5 automatically sets blocksize = 1M ?
- or do you ignore blocksize and always use 1M blocks ?

### 3

- the extent parameter is used with vmkfstools and it is specified for your case as: naa.90003bv000000000000090ef0000c1de:1


If I translate your parameters to vmkfstools parameter the call would be

vmkfstools -C vmfs5 -b  -S ab1ab1_04_3PAR_12fe naa.90003bv000000000000090ef0000c1de:1
vmkfstools -C vmfs5 -b <blocksize> -S <datastoreName> <partitionName>

If I remember right vmkfstools would probably complain that blocksize is not defined - or just a specified parameter was not correct.


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

sandipsubedi
Contributor
Contributor

### 0

- when we create a datastore this parameter is not needed

When I remove that I get this error.

Required property diskUuid is missing from data object of type VmfsDatastoreCreateSpec

### 1

- is this the same as the other partition-parameter ?

- for vmkfstools the partition-parameter is required and it should better be 1

No this is a different one. For partition  the datatype is HostDiskPartitionSpec, and all fields inside it are optional.

partitionHostDiskPartitionSpec

For partition inside vmfs->extent->partition it's an int.

partitionxsd:int

### 2

- dont you need to quote parameters ?
- does majorVersion = 5 automatically sets blocksize = 1M ?
- or do you ignore blocksize and always use 1M blocks ?

No I don't need to quote parameters. I tried just for testing purpose and returns the same result.

I think so. This is what the documentation says. If this optional property is not set, the maximum file size defaults to the maximum file size for the platform. Since 1M is the only allowed option on VMFS5 I think it will set it to 1. I tried adding blockSize: 1, still the same error.

Thank you again for checking this for me.

Reply
0 Kudos
continuum
Immortal
Immortal

Ok - then lets assume the syntax is fine.

What about the other reason for an error message ?
Has your script worked before against other test objects ?
Maybe in this special case the partitiontable is invalid - or write protected ?
Just curious ... would like to see what vmkfstools would do in your case ?
Can you try it ?


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

Reply
0 Kudos
sandipsubedi
Contributor
Contributor

> Has your script worked before against other test objects ?
It basically working for all the GET calls. Just throwing that error when I make POST call (CreateDataStore). And this is the first time I am making POST call here. Haven't tried other things.

> Maybe in this special case the partitiontable is invalid - or write protected ?

I kinda doubt it. I tried creating a datastore from the UI, where the LUN was created and presented the same way. And it worked fine.

would like to see what vmkfstools would do in your case ? Can you try it ?

I haven't tried that yet. I will probably spend some time debugging and try this later.

Reply
0 Kudos