Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] govc: datastore.disk.inflate/shrink does not check whether vmdk is specified #2791

Closed
Syuparn opened this issue Mar 24, 2022 · 0 comments · Fixed by #2792
Closed

[BUG] govc: datastore.disk.inflate/shrink does not check whether vmdk is specified #2791

Syuparn opened this issue Mar 24, 2022 · 0 comments · Fixed by #2792

Comments

@Syuparn
Copy link
Contributor

Syuparn commented Mar 24, 2022

Describe the bug

When govc datastore.disk.inflate is executed without vmdk file argument(, that is wrong usage), it does not validate arguments and requests to vCenter with empty vmdk path.
This also occurs when datastore.disk.shrink is executed.

To Reproduce
Steps to reproduce the behavior:

  1. execute command below
$ govc datastore.disk.inflate

Expected behavior
A clear and concise description of what you expected to happen.

govc shows help to tell the right command usage.

$ govc datastore.disk.inflate
Usage: govc datastore.disk.inflate [OPTIONS] VMDK

Inflate VMDK on DS.

Examples:
  govc datastore.disk.inflate disks/disk1.vmdk

Options:
  -cert=                              Certificate [GOVC_CERTIFICATE]
  -dc=                                Datacenter [GOVC_DATACENTER]
  -debug=false                        Store debug logs [GOVC_DEBUG]
  -ds=                                Datastore [GOVC_DATASTORE]
  -dump=false                         Enable Go output
  -json=false                         Enable JSON output
  -k=true                             Skip verification of server certificate [GOVC_INSECURE]
  -key=                               Private key [GOVC_PRIVATE_KEY]
  -persist-session=true               Persist session to disk [GOVC_PERSIST_SESSION]
  -tls-ca-certs=                      TLS CA certificates file [GOVC_TLS_CA_CERTS]
  -tls-known-hosts=                   TLS known hosts file [GOVC_TLS_KNOWN_HOSTS]
  -trace=false                        Write SOAP/REST traffic to stderr
  -u=https://user@127.0.0.1:8989/sdk  ESX or vCenter URL [GOVC_URL]
  -verbose=false                      Write request/response data to stderr
  -vim-namespace=vim25                Vim namespace [GOVC_VIM_NAMESPACE]
  -vim-version=7.0                    Vim version [GOVC_VIM_VERSION]
  -xml=false                          Enable XML output

Affected version
Please provide details on the version used, e.g. release tag, commit, module version, etc.

  • govc 0.27.4

Screenshots/Debug Output
If applicable, add screenshots or debug output to help explain your problem.

govc requests inflatation to vCenter with empty vmdk path and responds an error.

$  govc datastore.disk.inflate
[22-03-22 09:29:18] Inflating [datastore1]...Error: The virtual disk is either corrupted or not a supported format.
C:\Users\tanot\apps\govc.exe: The virtual disk is either corrupted or not a supported format.

# same as below
$ govc datastore.disk.inflate ""
[22-03-22 09:29:19] Inflating [datastore1]...Error: The virtual disk is either corrupted or not a supported format.
C:\Users\tanot\apps\govc.exe: The virtual disk is either corrupted or not a supported format.

Additional context
Add any other context about the problem here.

datastore.disk.info and datastore.disk.create show usage help when vmdk is not specified.

Syuparn added a commit to Syuparn/govmomi that referenced this issue Mar 24, 2022
Closes: vmware#2791
Signed-off-by: syuparn <s.hello.spagetti@gmail.com>
Syuparn added a commit to Syuparn/govmomi that referenced this issue Mar 25, 2022
Closes: vmware#2791
Signed-off-by: syuparn <s.hello.spagetti@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant