GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — HPOneViewException not raised when connection with paused VM fails · Issue #309 · HewlettPackard/python-hpOneView

This repository was archived by the owner on Oct 15, 2020. It is now read-only.
This repository was archived by the owner on Oct 15, 2020. It is now read-only.

HPOneViewException not raised when connection with paused VM fails  #309

Copy link
Copy link
Closed
Closed
HPOneViewException not raised when connection with paused VM fails #309
Copy link
Assignees
fgbulsoni

Description

@llvieira
llvieira
opened on Aug 26, 2017
Issue body actions

Hi guys,

When I try to create the OneView client but my VM is paused, an OSError exception is raised instead of a HPOneViewException. The HPOneViewException should not cover this type of exception in this scenario? For treat this exception is only possible if I catch an OSError, but is seems odd for me since this also could be used as a HPOneViewException maybe.

Code example:

#VM paused
config = {
	"ip": "x.x.x.x",
	"credentials": {
		"userName": "user_name",
		"password": "pass"
	}
}

oneview_client = OneViewClient(config)

Result:

Traceback (most recent call last):
  File "one_view.py", line 89, in <module>
    one_view = OneView(config)
  File "one_view.py", line 12, in __init__
    self.oneview_client = OneViewClient(config)
  File "/usr/local/lib/python3.5/dist-packages/hpOneView/oneview_client.py", line 118, in __init__
    self.__connection.login(config["credentials"])
  File "/usr/local/lib/python3.5/dist-packages/hpOneView/connection.py", line 483, in login
    self.validateVersion()
  File "/usr/local/lib/python3.5/dist-packages/hpOneView/connection.py", line 79, in validateVersion
    version = self.get(uri['version'])
  File "/usr/local/lib/python3.5/dist-packages/hpOneView/connection.py", line 324, in get
    resp, body = self.do_http('GET', uri, '')
  File "/usr/local/lib/python3.5/dist-packages/hpOneView/connection.py", line 126, in do_http
    conn.request(method, path, body, http_headers)
  File "/usr/lib/python3.5/http/client.py", line 1106, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python3.5/http/client.py", line 1151, in _send_request
    self.endheaders(body)
  File "/usr/lib/python3.5/http/client.py", line 1102, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python3.5/http/client.py", line 934, in _send_output
    self.send(msg)
  File "/usr/lib/python3.5/http/client.py", line 877, in send
    self.connect()
  File "/usr/lib/python3.5/http/client.py", line 1252, in connect
    super().connect()
  File "/usr/lib/python3.5/http/client.py", line 849, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib/python3.5/socket.py", line 711, in create_connection
    raise err
  File "/usr/lib/python3.5/socket.py", line 702, in create_connection
    sock.connect(sa)
OSError: [Errno 113] No route to host

Activity

  1. fgbulsoni
    changed the title [-]HPOneViewException not raised when I try to create a connection with VM paused[/-] [+]HPOneViewException not raised when connection with paused VM fails [/+] on Aug 28, 2017
  2. fgbulsoni
    self-assigned this
    on Aug 28, 2017
  3. fgbulsoni commented on Aug 28, 2017

    @fgbulsoni
    fgbulsoni
    on Aug 28, 2017
    Contributor
    More actions

    Seems like a valid request, possible solution in #310 .

    Not every http error is being caught that way, as it is not impossible for those to happen in some other part of the code, but this should catch the errors coming from a first attempt at connecting to the appliance, usually timeout or no route to host.

    Reacted by Lucas Lima Vieira
  4. llvieira commented on Aug 28, 2017

    @llvieira
    llvieira
    on Aug 28, 2017
    MemberAuthor
    More actions

    @fgbulsoni Thanks for answer and for your new PR related to this request.

  5. tmiotto
    closed this as completedin #310on Sep 1, 2017
  6. AnushaY1916
    added a commit that references this issue on Mar 2, 2018

    Merge pull request #309 from adamdmharvey/master

    a7ef385
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @fgbulsoni
    fgbulsoni

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.