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

VirtualMediaEject should not require image_url #3042

Open
1 task done
smalleni opened this issue Jul 21, 2021 · 15 comments · May be fixed by #8765
Open
1 task done

VirtualMediaEject should not require image_url #3042

smalleni opened this issue Jul 21, 2021 · 15 comments · May be fixed by #8765
Labels
bug This issue/PR relates to a bug module module plugins plugin (any type) python3 remote_management

Comments

@smalleni
Copy link

smalleni commented Jul 21, 2021

Summary

When using redfish_command (https://github.com/ansible-collections/community.general/blob/main/plugins/modules/remote_management/redfish/redfish_command.py) I want to eject all virtual media and looks like the module expects a value for image_url for this to work. There are cases when a user wants to eject all virtual media and it might not be possible to know the exact urls of the virtual media previously supported. It looks like redfish supports ejecting all virtual media without providig an image_url link (dell/iDRAC-Redfish-Scripting#24 (comment)), however I see an error like

TASK [boot-iso : DELL - Eject Virtual Media (if any)] *******************************************************************************************************************************
Wednesday 21 July 2021  12:48:53 -0500 (0:00:11.918)       0:02:23.541 ******** 
fatal: [e16-h12-b02-fc640.rdu2.scalelab.redhat.com]: FAILED! => {"changed": false, "msg": "image_url option required for VirtualMediaEject"}

if I try passing an empty dictionary to virtual_media

Issue Type

Bug Report

Component Name

redfish_command

Ansible Version

[smalleni@unknown74d83e950f42 jetlag]$ ansible --version
ansible 2.9.21
  config file = /home/smalleni/Documents/code/jetlag/ansible.cfg
  configured module search path = ['/home/smalleni/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.8/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.8.7 (default, Jan 20 2021, 00:00:00) [GCC 10.2.1 20201125 (Red Hat 10.2.1-9)]

Configuration

[smalleni@unknown74d83e950f42 jetlag]$ ansible-config dump --only-changed
DEFAULT_CALLBACK_WHITELIST(/home/smalleni/Documents/code/jetlag/ansible.cfg) = ['profile_tasks']

OS / Environment

Fedora 32

Steps to Reproduce

    - name: DELL - Eject Virtual Media (if any)
      community.general.redfish_command:
        category: Manager
        command: VirtualMediaEject
        baseuri: "{{ hostvars[item]['bmc_address'] }}"
        username: "{{ hostvars[item]['bmc_user'] }}"
        password: "{{ hostvars[item]['bmc_password'] }}"
        virtual_media:
          image_url: "http://{{ http_store_host }}:{{ http_store_port }}/{{ hostvars[item]['boot_iso'] }}"
        resource_id: iDRAC.Embedded.1
      ignore_errors: yes

Expected Results

I expect to be able to unmount all virtual media without being required to know the urls of all the virtualmedia previously mounted.

Actual Results

TASK [boot-iso : DELL - Eject Virtual Media (if any)] *******************************************************************************************************************************
Wednesday 21 July 2021  12:48:53 -0500 (0:00:11.918)       0:02:23.541 ******** 
fatal: [e16-h12-b02-fc640.rdu2.scalelab.redhat.com]: FAILED! => {"changed": false, "msg": "image_url option required for VirtualMediaEject"}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link
Collaborator

@smalleni
Copy link
Author

smalleni commented Jul 21, 2021

Looks like there is an explicit check for image_url:

if not image_url:
return {'ret': False,
'msg': "image_url option required for VirtualMediaEject"}

And it is used to to find the virtual media to eject at:

uri, data, eject = self._find_virt_media_to_eject(resources, image_url)

@mraineri
Copy link
Contributor

mraineri commented Jul 21, 2021

Yes, at least with the behavior we've implemented today the image URL is needed since the expectation is the user is specifying the image URL for the ISO to eject. I think we need to consider some things first before making changes.

If the image URL is not given, then what exactly should be ejected? All virtual media your example indicates? This seems a bit heavy handed in my opinion, but others might like this behavior. Redfish itself doesn't support an "eject all" type of operation, and I suspect the script you're referencing is either using OEM actions or is just looping on all slots and ejecting everything.

Should a user be allowed specify an alternative identifier (such as the "Id" of the virtual media instance) in order to control what slot is ejected?

Certainly would like opinions from others for desired behavior. I do like the idea of keeping the mandatory argument list as minimal as possible, but would like to agree upon the desired behavior first.

@smalleni
Copy link
Author

smalleni commented Jul 21, 2021

Yes, at least with the behavior we've implemented today the image URL is needed since the expectation is the user is specifying the image URL for the ISO to eject. I think we need to consider some things first before making changes.

If the image URL is not given, then what exactly should be ejected? All virtual media your example indicates? This seems a bit heavy handed in my opinion, but others might like this behavior. Redfish itself doesn't support an "eject all" type of operation, and I suspect the script you're referencing is either using OEM actions or is just looping on all slots and ejecting everything.

Should a user be allowed specify an alternative identifier (such as the "Id" of the virtual media instance) in order to control what slot is ejected?

Certainly would like opinions from others for desired behavior. I do like the idea of keeping the mandatory argument list as minimal as possible, but would like to agree upon the desired behavior first.

Thank you for taking a look quickly. This is especially useful in our situation where the hardware nodes get recycled quite a bit between tenants and we might have things lingering around from previous tenants. Hence the need to remove any virtualmedia. I thought redifsh supported this but perhaps not then? I thought I saw

Method: POST
URI: https://<idrac_ip_address>/redfish/v1/Managers/iDRAC.Embedded.1/VirtualMedia/CD/Actions/VirtualMedia.EjectMedia
BODY:
{}

@mraineri
Copy link
Contributor

That particular example ejects a virtual media instance called "CD"; there are other virtual media instances in the collection. Essentially you'd replace the segment "CD" in the URI for the action with another instance identifier (I think "USB" is another one used by iDRAC).

@smalleni
Copy link
Author

That particular example ejects a virtual media instance called "CD"; there are other virtual media instances in the collection. Essentially you'd replace the segment "CD" in the URI for the action with another instance identifier (I think "USB" is another one used by iDRAC).

Got it, but since it doesn't require an image url, maybe even in ansible we can support ejecting all media instance of a particular media type?

@mraineri
Copy link
Contributor

Maybe an explicit "all" option just for clarity? I'd be concerned with having default behavior eject everything since the other slot could be in use for another user.

@smalleni
Copy link
Author

Maybe an explicit "all" option just for clarity? I'd be concerned with having default behavior eject everything since the other slot could be in use for another user.

Sure, but it's really useful for sysadmins to be able to eject all virtual media. Either it is a default option when you don't provide image_url or you have to explicitly ask for it, either is fine.

At the end of the day I want to be able to eject virtual media (either of a particular type like CD or of all types) without the image_url since I may not always know the image_url used by a user who had used the hardware previouly.

@mraineri
Copy link
Contributor

mraineri commented Aug 6, 2021

The group has discussed this a bit and is okay with adding a dedicated "eject all" command in order to keep the semantics of the existing eject command as is.

Is this something you'd be able to work on?

@ansibullbot
Copy link
Collaborator

@ansibullbot
Copy link
Collaborator

@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link
Collaborator

@ansibullbot
Copy link
Collaborator

cc @jyundt
click here for bot help

plumbis pushed a commit to plumbis/community.general that referenced this issue Aug 14, 2024
plumbis pushed a commit to plumbis/community.general that referenced this issue Aug 14, 2024
plumbis pushed a commit to plumbis/community.general that referenced this issue Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug module module plugins plugin (any type) python3 remote_management
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants