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

vsphere-iso: docs are insufficient for iso_paths with a content library #313

Closed
1 of 2 tasks
DonBower opened this issue Oct 19, 2023 · 6 comments · Fixed by #337
Closed
1 of 2 tasks

vsphere-iso: docs are insufficient for iso_paths with a content library #313

DonBower opened this issue Oct 19, 2023 · 6 comments · Fixed by #337
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@DonBower
Copy link

DonBower commented Oct 19, 2023

When filing a bug please include the following headings, if possible.
code:
iso_paths = ["ag6hq-cl/ubuntu-22.04.3-live-server-amd64.iso"]

results in this error:

==> Some builds didn't complete successfully and had errors:
--> vsphere-iso.linux-ubuntu: error mounting an image 'ag6hq-cl/ubuntu-22.04.3-live-server-amd64.iso': Invalid datastore path 'ag6hq-cl/ubuntu-22.04.3-live-server-amd64.iso'.

Overview of the Issue

I have a two host vCenter. I created a content library, backed by a local datastore of one of the hosts.
I uploaded an Ubuntu ISO to the content library, and specified the the output of govc library.ls ag6hq-cl/ (minus the leading /) in the iso_paths as shown above.
I have tried inserting /iso/ and /ISO/ in the path between.
And then, while writing this, I recalled that vSphere chopped the .iso off the name, so I added it back in.
That made me think that's the second level you are looking for in the code (yea, I dug through the code best I could)
The Correct name now is:

["ag6hq-cl/ubuntu-22.04.3-live-server-amd64.iso/ubuntu-22.04.3-live-server-amd64.iso"]

because I add the .iso back in when I was importing the file to the field "item name".

Reproduction Steps

I think I described them pretty well above.

Packer Version

packer=1.9.2

Plugin Version and Builders

Please provide the plugin version.

packer-plugin-vsphere=1.2.1

Please select the builder.

  • vsphere-iso
  • vsphere-clone

VMware vSphere Version

Please provide the VMware vSphere version.

7.0.3n

Guest Operating System

Ubuntu 22.04 LTS x64

Simplified Packer Buildfile

If the file is longer than a few dozen lines, please include the URL to the gist of the log or use the GitHub detailed format instead of posting it directly in the issue.

Operating System and Environment Details

Please add any information you can provide about the environment.

MacOS 13.5.2 (Intel)

Log Fragments and crash.log Files

Include appropriate log fragments. If the log is longer than a few dozen lines, please include the URL to the gist of the log or use the Github detailed format instead of posting it directly in the issue.

Set the env var PACKER_LOG=1 for maximum log detail.

@DonBower DonBower added the bug label Oct 19, 2023
@DonBower
Copy link
Author

Documentation should advise that there are three parts, content library name, item name, and file name, and these can be retrieved from govc library.ls command

$ govc library.ls
> /library-name1
> /library-name2
$ govc library.ls /library-name1/
>  /library-name1/item-name-1
>  /library-name1/item-name-2
>  /library-name1/item-name-3
$ govc library.ls /library-name1/item-name-1/
> /library-name1/item-name-1/file-name

and use the final output minus the leading /

Note: this is also because of a poor UX in vCenter/Content Libraries. When you are looking at the "Item", no where do you see a file name.

@tenthirtyam
Copy link
Collaborator

tenthirtyam commented Oct 20, 2023

I don't think that there's a need for the govc method to be described in the plugin's documentation.

govc will not return the full path or the details on the guid concatenated to the filename.

➜ govc library.ls -json /m01-cl01/ubuntu-22.04.3-live-server-amd64 | jq .
[
  {
    "cached": true,
    "content_version": "2",
    "creation_time": "2023-10-20T00:55:46.228Z",
    "description": "",
    "id": "7b1af331-0bb6-4a09-afd3-b46a59f51d6b",
    "last_modified_time": "2023-10-20T01:06:12.638Z",
    "library_id": "c9ac8ddf-3650-492a-9c22-d1c88df3d975",
    "metadata_version": "1",
    "name": "ubuntu-22.04.3-live-server-amd64",
    "size": 2133391360,
    "type": "iso",
    "version": "1",
    "security_compliance": true,
    "certificate_verification_info": {
      "status": "NOT_AVAILABLE"
    }
  }
]

You need:

iso_paths = "[<datastore_name>] contentlib-<library-guid>/<item-guid>/<item_name>_<other-guid>.iso

The location can be seen in the vSphere Client:

image

Example:

iso_paths = "[local-ssd-01] contentlib-c9ac8ddf-3650-492a-9c22-d1c88df3d975>/7b1af331-0bb6-4a09-afd3-b46a59f51d6b/ubuntu-22.04.3-live-server-amd64_88cfaf0c-e0aa-4506-b4c6-172d33cc4dc0.iso

Refer to this enhancement request to support data sources in the plugin which would be a cleaner approach to retrieving the item path.

@tenthirtyam tenthirtyam changed the title packer-iso documentation is insufficient for Content Library use of iso_paths. vsphere-iso: doc are insufficient for iso_paths with a content library Oct 20, 2023
@tenthirtyam tenthirtyam changed the title vsphere-iso: doc are insufficient for iso_paths with a content library vsphere-iso: docs are insufficient for iso_paths with a content library Oct 20, 2023
@tenthirtyam tenthirtyam added documentation Improvements or additions to documentation stage/waiting-reply and removed bug labels Oct 20, 2023
@DonBower
Copy link
Author

I don't think that there's a need for the govc method to be described in the plugin's documentation.

govc will not return the full path or the details on the guid concatenated to the filename.

➜ govc library.ls -json /m01-cl01/ubuntu-22.04.3-live-server-amd64 | jq .
[
  {
    "cached": true,
    "content_version": "2",
    "creation_time": "2023-10-20T00:55:46.228Z",
    "description": "",
    "id": "7b1af331-0bb6-4a09-afd3-b46a59f51d6b",
    "last_modified_time": "2023-10-20T01:06:12.638Z",
    "library_id": "c9ac8ddf-3650-492a-9c22-d1c88df3d975",
    "metadata_version": "1",
    "name": "ubuntu-22.04.3-live-server-amd64",
    "size": 2133391360,
    "type": "iso",
    "version": "1",
    "security_compliance": true,
    "certificate_verification_info": {
      "status": "NOT_AVAILABLE"
    }
  }
]

You need:

iso_paths = "[<datastore_name>] contentlib-<library-guid>/<item-guid>/<item_name>_<other-guid>.iso

The location can be seen in the vSphere Client:

image Example:
iso_paths = "[local-ssd-01] contentlib-c9ac8ddf-3650-492a-9c22-d1c88df3d975>/7b1af331-0bb6-4a09-afd3-b46a59f51d6b/ubuntu-22.04.3-live-server-amd64_88cfaf0c-e0aa-4506-b4c6-172d33cc4dc0.iso

Refer to this enhancement request to support data sources in the plugin which would be a cleaner approach to retrieving the item path.

My point is, that in content libraries, there are item names, and file names, and both must be referenced in the iso_paths statement. that's all. it took me hours to figure out that the item name (different from the file name) is what is shown in the vCenter Content Library display (note I am using vCenter 7.0.3n, and using the web client). It was using govc that exposed this key piece of information to me.
Once I referenced "lib/item/file" in the iso_paths it worked as expected.

So I think that's the difference in your point of view, because you are looking at the datastore, and the reference on your screen, but I was looking at the content library screen, which does not show the file name, only the item name.

@tenthirtyam
Copy link
Collaborator

Fair point. I think perhaps I happened to immediately know where to look and/or query myself.

Adding this to the documentation would be trivial and I can look at it next week if time permits.

Ryan Johnson
Senior Staff Solutions Architect | Product Engineering @ VMware, Inc.

@DonBower
Copy link
Author

DonBower commented Oct 20, 2023

here is my suggestion for the docs: (or something similar)

	// List of Datastore or Content Library paths to ISO files that will be mounted to the VM.
	// In this HCL2 example, two ISOs are referenced.
	// The first is located in `datastore1`, in a folder `ISO` with the name `ubuntu.iso`
	// The second is located in a Content Library `Packer Library Test` with the item name `ubuntu-16.04.6-server-amd64`
	// and the item's file name is `ubuntu-16.04.6-server-amd64.iso`
	// note: all files stored in content libraries have an _item name_ associated with them.
	// view the datastore backing the content library, or use the GOVC tool to determin the actual file name behind the item.
	// ```hcl
	// iso_paths = [
	//   "[datastore1] ISO/ubuntu.iso",
	//   "Packer Library Test/ubuntu-16.04.6-server-amd64/ubuntu-16.04.6-server-amd64.iso"
	// ]
	// ```

@tenthirtyam
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants