HewlettPackard / python-redfish-utility

Python-based utility for interacting with devices supporting a Redfish Service
Other
86 stars 41 forks source link

virtualmedia command not working #1

Closed ansiblejunky closed 7 years ago

ansiblejunky commented 7 years ago

Trying to tell the HP server to boot from the virtual media ISO file, but it doesn't seem to be working... see below. The command says successful but actually nothing is attached to the virtualmedia. The virtualmedia command should say "Image Inserted: True" or perhaps instead of True, it should say the image name.

iLOrest > virtualmedia
[200] The operation completed successfully.
Available Virtual Media Options:
[1] Media Types Available: Floppy USBStick  Image Inserted: None
[2] Media Types Available: CD DVD  Image Inserted: None
iLOrest > virtualmedia 2 --url=file:///C://ISO/test.iso --bootnextreset
[200] The operation completed successfully.
iLOrest > virtualmedia
[200] The operation completed successfully.
Available Virtual Media Options:
[1] Media Types Available: Floppy USBStick  Image Inserted: None
[2] Media Types Available: CD DVD  Image Inserted: None
iLOrest >
Yergidy commented 7 years ago

@munichman2008 You are using the command wrong "--url" is for logging into a server, not attaching virtualmedia. The help for this command is correct. Also the argument must be a URL, not a file path. We will be adding extra checks to make sure this is clear.

ansiblejunky commented 7 years ago

So my understanding is that the URI needs to be an HTTP path and that we need to have a Web Server running to support this. Is there any other way to point to a local ISO file? We are working with DoD and an HTTP Server is a security problem. Using the HP iLO Console Window I can simply point to my local ISO and it's attached.

Yergidy commented 7 years ago

@munichman2008 Unfortunately, local ISO mounting is only possible using the remote console app in the iLO client. The python-redfish-utility uses the iLO RESTful API, which can only mount using a URI.

ansiblejunky commented 7 years ago

Ok, so we are running an HTTP server on the laptop. We turned off any firewalls on the laptop. We use the ilorest REST api to set the virtualmedia command to point to the HTTP location of our custom ISO file. We verified the file is accessible from the browser and from another server. However, we are hitting a few problems still...

Running this command from the ilorest REST application, the server does NOT perform a reboot: virtualmedia 2 http://10.10.x.x:8000/temp/custom_esxi.iso --reboot=REBOOT --bootnextreset

After forcing reboot using Remote Console, the HP iLO attempts to connect to the URL provided above. Our HTTP server shows the GET requests but the HP iLO does not boot to the ISO correctly - it goes into some red text with weird characters. We verified the ISO works just fine when we use the Remote Console to manually select the local file and boot to it. So the ISO is valid.

The HTTP server shows the following error message:

Exception happened during processing of request from ('10.10.x.x', 59317)
Traceback (most recent call last):
  File "C:\Python27\lib\SocketServer.py", line 290, in _handle_request_noblock
    self.process_request(request, client_address)
  File "C:\Python27\lib\SocketServer.py", line 318, in process_request
    self.finish_request(request, client_address)
  File "C:\Python27\lib\SocketServer.py", line 331, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Python27\lib\SocketServer.py", line 654, in __init__
    self.finish()
  File "C:\Python27\lib\SocketServer.py", line 713, in finish
    self.wfile.close()
  File "C:\Python27\lib\socket.py", line 283, in close
    self.flush()
  File "C:\Python27\lib\socket.py", line 307, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 10053] An established connection was aborted by the software in your host machine

So what are we missing? Does the ISO need to be mounted? We do not understand what could be wrong here... thanks for the help.

ansiblejunky commented 7 years ago

We noticed the HTTP server must be configured with the following:

We noticed the HP iLO mounts the ISO upon startup. If you use the Remote Console to point to the URL, then the Remote Console also tries to mount the ISO. The problem is that the HP iLO does not validate the URL at all. This means, even submitting a URL that is well-formatted but points to an invalid location or an ISO that cannot be mounted, etc.. it doesn't matter. HP iLO does not do any of these validations. It seems to show SUCCESS no matter what.. if only the URL is well-formatted. You of course find out if it works only upon boot up.

We are still getting the [Errno 10053] error sometimes, but we suspect this is because of the HTTP Server implementation that we used from the Python SimpleHTTPServer module. It seems it has this bug with Python 2.x.

Additionally, the reboot option in the iLO REST API on the virtualmedia command still is not working. We tried "--reboot=ForceRestart" but it did not restart. What is wrong?

Yergidy commented 7 years ago

@munichman2008 This should fix your reboot issue.

ansiblejunky commented 7 years ago

Ok, that code looks better. I installed the python redfish library using pip, so how do I made this small code change locally?

Yergidy commented 7 years ago

The change is in this github location, not in the library. Just update the git clone here from python-redfish-utility, rerun it, and it should have your changes.

ansiblejunky commented 7 years ago

Ok thanks