Open smalenfant opened 6 months ago
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.
cc @panyy3 @renxulei click here for bot help
@smalenfant Does this issue only occur on Lenovo SR635? Have ever meet this issue on other platforms?
@smalenfant Does this issue only occur on Lenovo SR635? Have ever meet this issue on other platforms?
I think this would be applicable to any server. This is about the returned information, not necessarily a bug. The problem with inserting a Virtual Media is that it is not accessible right away and other API calls are required to verify the media is ready (or failed). I don't thing it is possible to check the Virtual Media for a pending task (unless you want to parse all the existing pending tasks).
I have been unsuccessful using the pre-written virtual_media command from this module but I'll give it a try again. I figured out that one can't use FQDN and has to be IP address with TLS for HTTPS, which makes it really inconvenient. But that would be a bug on the XCC controller (or limitation).
In addition, looks like the response code of 202 tells us something:
The 202 Accepted status code means that the request has been accepted for processing, but the processing has not been finished yet. The request may or may not be completed when the processing eventually takes place.
Maybe if a 202 is returned, the location field should be returned as well.
I've tried the virtual_media option:
- name: Insert Virtual Media (xcc_redfish)
community.general.xcc_redfish_command:
category: Manager
command: VirtualMediaInsert
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
virtual_media:
image_url: "https://10.10.10.10/files/{{ inventory_hostname }}.iso"
media_types:
- CD
transfer_protocol_type: HTTPS
username: test
password: test
And the returned response was:
"msg": "HTTP Error 400 on POST request to 'https://fqdn/redfish/v1/Managers/Self/VirtualMedia/CD1/Actions/VirtualMedia.InsertMedia', extended message: 'The property Password is a required property and must be included in the request.'"
In raise an exception in the modules and got the following which Password
was not included.
line 2732, in _insert_virt_media_payload\nException: {'Image': 'https://10.10.10.10/files/dklbcdedgel02.coxlab.net.iso', 'Inserted': True, 'WriteProtected': True, 'UserName': 'test', 'TransferProtocolType': 'HTTPS'}\n"
I've also tested this to make the virtual_media to work. This is because the password isn't part of the data coming back, it gets discarded. I added manually and that inserted the media. Password is required even if not used for HTTPS (at least my service):
def _insert_virt_media_payload(options, param_map, data, ai):
payload = {
'Image': options.get('image_url')
}
for param, option in param_map.items():
if param is "Password":
payload[param] = options.get(option)
if options.get(option) is not None and param in data:
allowable = ai.get(param, {}).get('AllowableValues', [])
if allowable and options.get(option) not in allowable:
return {'ret': False,
'msg': "Value '%s' specified for option '%s' not "
"in list of AllowableValues %s" % (
options.get(option), option,
allowable)}
payload[param] = options.get(option)
# raise Exception(payload)
return payload
The Password
option is in the allowable values. But the code can't get there due to the previous conditional about param in data
.
@smalenfant Thanks for reporting issues about task location not return and password not inclueded. We will fix it in future.
Summary
When I try to use the community.general.xcc_redfish_command to InsertMedia, it doesn't quite work against an SR635 server. I had to revert to using the uri module and that starting working correctly. I tried to migrate back to the xcc_redfish_command with Raw/PostResource but the return values are not sent back in the results.
This was tested with Lenovo SR635 with BMC version 7.27
Steps:
Issue Type
Bug Report
Component Name
xcc_redfish_command
Ansible Version
Community.general Version
Configuration
OS / Environment
RHEL9, OSX
Steps to Reproduce
Expected Results
When using the URI module, we actually get useful information about the task created by the command:
Output:
Actual Results
Code of Conduct