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

upload iso to datastore #120

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

OrrBG
Copy link
Contributor

@OrrBG OrrBG commented Jan 7, 2025

No description provided.

src: "{{ upload_iso_to_datastore_src }}"
datacenter: "{{ upload_iso_to_datastore_datacenter }}"
datastore: "{{ upload_iso_to_datastore_datastore }}"
path: "{{ upload_iso_to_datastore_dst}}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe here we can add an option to upload a file to a specific directory inside the datastore?
we can do a task before this one, that creates a folder in a specific datastore, and then upload the iso to that folder

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

upload_iso_to_datastore_dst has no default value so it needs to be checked as a required variable like the others. also theres a missing space before the closing brackets

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also i think shelly's idea is good. we should have a task before this one that creates the dst path in the datastore

@OrrBG OrrBG force-pushed the feature/upload_iso_to_datastore branch from 67afab8 to 8ad0e4d Compare January 12, 2025 08:50
@mikemorency mikemorency self-requested a review January 13, 2025 13:49
src: "{{ upload_iso_to_datastore_src }}"
datacenter: "{{ upload_iso_to_datastore_datacenter }}"
datastore: "{{ upload_iso_to_datastore_datastore }}"
path: "{{ upload_iso_to_datastore_dst}}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

upload_iso_to_datastore_dst has no default value so it needs to be checked as a required variable like the others. also theres a missing space before the closing brackets

roles/upload_iso_to_datastore/README.md Show resolved Hide resolved
src: "{{ upload_iso_to_datastore_src }}"
datacenter: "{{ upload_iso_to_datastore_datacenter }}"
datastore: "{{ upload_iso_to_datastore_datastore }}"
path: "{{ upload_iso_to_datastore_dst}}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also i think shelly's idea is good. we should have a task before this one that creates the dst path in the datastore

- upload_iso_to_datastore_src is defined
- upload_iso_to_datastore_dst is defined
- upload_iso_to_datastore_datastore is defined
quiet: true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

upload_iso_to_datastore_datacenter is also required

upload_iso_to_datastore_datacenter: "{{ vcenter_datacenter }}"
upload_iso_to_datastore_datastore: "{{ shared_storage_01 }}"
upload_iso_to_datastore_src: "/tmp/{{ tiny_prefix }}-test.iso"
upload_iso_to_datastore_dst: "/{{ tiny_prefix }}-upload_iso_to_datastore/test.iso"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to save the folder in a separate variable and use it here and in Delete a VM folder on given datacenter task

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i agree, you should be using a variable in the folder cleanup task instead of hardcoding the folder name. You can have two seperate variables like anna suggested or use the dirname filter:
folder_name: "{{ upload_iso_to_datastore_dst | dirname }}"

password: '{{ upload_iso_to_datastore_password }}'
datacenter_name: "{{ upload_iso_to_datastore_datacenter }}"
folder_name: "/{{ tiny_prefix }}-upload_iso_to_datastore"
folder_type: vm
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not required parameter for absent state

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vcenter_folder is not the correct module for what your trying to do. This module manages folders in vcenter, which are used to organize vcenter objects like vms, datastores, hosts, and networks.

You want to use community.vmware.vsphere_file with state: directory (or state: absent for cleanup).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the vsphere_file module does not allow me to remove a directory

@anna-savina
Copy link
Collaborator

Delete a VM folder on given datacenter task doesn't actually delete the folder from the data-store. I see folders left on the eco-vcenter data-store after the test run. Fix the deletion task please.

@mikemorency
Copy link
Collaborator

Delete a VM folder on given datacenter task doesn't actually delete the folder from the data-store. I see folders left on the eco-vcenter data-store after the test run. Fix the deletion task please.

Orr and I talked about this, and there is no module that allows you to delete a folder in a datastore. I think having the functionality in the role is good idea. So maybe we can add a module to delete a folder in the next release, and then update this test to include that?

@anna-savina
Copy link
Collaborator

Delete a VM folder on given datacenter task doesn't actually delete the folder from the data-store. I see folders left on the eco-vcenter data-store after the test run. Fix the deletion task please.

Orr and I talked about this, and there is no module that allows you to delete a folder in a datastore. I think having the functionality in the role is good idea. So maybe we can add a module to delete a folder in the next release, and then update this test to include that?

I think in this case it is better to add this test only in the next release, since a large number of unnecessary folders will be created on the datastore

- The ISO will be uploaded into this Datastore.
- Please see the examples for more usage.

- **upload_iso_to_datastore_dst_folder** (str, required)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this parameter mandatory? Or can it can be set to an empty string to create the ISO in the root?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously I only thought about adding a folder var to a test, not to a role itself.


- name: Attempt to recreate ISO file
community.vmware.vsphere_file:
hostname: '{{ upload_iso_to_datastore_hostname }}'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did you define upload_iso_to_datastore_hostname, upload_iso_to_datastore_username, and other Auth role vars? I don't think that it is a good idea to use vars defined in some other role, not in a test itself.

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 this pull request may close these issues.

4 participants