openvcloud / 0-templates

Apache License 2.0
1 stars 5 forks source link

Always getting 409 conflict (with port 2200 already exists) when trying to create machine #66

Closed john-kheir closed 6 years ago

john-kheir commented 6 years ago

Blueprint

services:
  - github.com/openvcloud/0-templates/sshkey/0.0.1__85687c86:
       dir: '/root/.ssh/'
       passphrase: '85687c86'
  - github.com/openvcloud/0-templates/openvcloud/0.0.1__3faf2a96:
      address: 'be-g8-3.demo.greenitglobe.com'
      login: 'gig_qa_1@itsyouonline'
      token: '*********'
      location: 'be-g8-3'
  - github.com/openvcloud/0-templates/vdcuser/0.0.1__gig_qa_1:
      email: dina.magdy.mohammed+123@gmail.com
      openvcloud: 3faf2a96
      provider: itsyouonline
  - github.com/openvcloud/0-templates/vdcuser/0.0.1__ebac2f26:
      groups: ['user']
      email: d9a7131f@test.com
      openvcloud: 3faf2a96
      provider: itsyouonline

  - github.com/openvcloud/0-templates/account/0.0.1__aef2cf68:
      openvcloud: 3faf2a96

  - github.com/openvcloud/0-templates/vdc/0.0.1__d0365584:
      account: aef2cf68

  - github.com/openvcloud/0-templates/node/0.0.1__bb1f55ce:
      users:
        - name: ebac2f26
          accesstype: CXDRAU
      bootDiskSize: 17
      sshKey: 85687c86
      vdc: d0365584
      dataDiskSize: 18

actions:
  - template: github.com/openvcloud/0-templates/account/0.0.1
    actions: ['install']
  - template: github.com/openvcloud/0-templates/node/0.0.1
    actions: ['install']
  - template: github.com/openvcloud/0-templates/vdcuser/0.0.1
    actions: ['install']
  - template: github.com/openvcloud/0-templates/vdc/0.0.1
    actions: ['install']

Error

ipdb> task.state 'error' ipdb> task.eco.printTraceback()

Traceback (most recent call last):
  File "/opt/code/github/jumpscale/lib9/JumpScale9Lib/clients/openvcloud/Machine.py", line 228, in portforward_create
    publicPort=publicport
  File "/opt/code/github/jumpscale/lib9/JumpScale9Lib/clients/portal/PortalClient.py", line 56, in __call__
    raise ApiError(response)
JumpScale9Lib.clients.portal.PortalClient.ApiError: 409 Conflict
Forward to 10.101.107.136 with port 2200 already exists

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/0-robot/zerorobot/task/task.py", line 79, in execute
    self._result = self.func()
  File "/opt/code/github/openvcloud/0-templates/templates/node/node.py", line 131, in install
    machine = self._machine_create()
  File "/opt/code/github/openvcloud/0-templates/templates/node/node.py", line 156, in _machine_create
    managed_private=self.data.get('managedPrivate', False)
  File "/opt/code/github/jumpscale/lib9/JumpScale9Lib/clients/openvcloud/Space.py", line 291, in machine_create
    machine.portforward_create(None, 22)
  File "/opt/code/github/jumpscale/lib9/JumpScale9Lib/clients/openvcloud/Machine.py", line 238, in portforward_create
    "Port forward already exists. Please specify another port forwarding.\nerrormsg:%s" % e)
JumpScale9.errorhandling.JSExceptions.RuntimeError: ERROR: Port forward already exists. Please specify another port forwarding.
errormsg:409 Conflict
Forward to 10.101.107.136 with port 2200 already exists ((type:runtime.error)
katia-e commented 6 years ago

@john-kheir , does the port forward get created despite the error?

I had similar error today on be-gen-1, the port was created, but still error is returned in response of self.client.api.cloudapi.portforwarding.create. However, I couldn't reproduce the same on be-g8-3.

screenshot from 2018-03-20 14-04-57

chrisvdg commented 6 years ago

@john-kheir, can you give more details on how to reproduce this? I have created a vm on ovc 'manually' and added a portforwarding to 2200 after which I executed my bpto create a node/machine and it successfully created the vm and added portforwarding to 2201.

edit: Been able to reproduce by creating multiple machines/nodes.

Also normally your exception shouldn't be raised in your case as that exception is caught and in case of 409 Conflict, portforward_create would be called recursively here: https://github.com/Jumpscale/lib9/blob/development/JumpScale9Lib/clients/openvcloud/Machine.py#L235 But I also see publicport needs to be None for the recursion call to happen which I don't think is ever the case. See: https://github.com/Jumpscale/lib9/blob/development/JumpScale9Lib/clients/openvcloud/Machine.py#L212

And I think @katia-e's error is caused by BdbQuit (were you runnning with (i)pdb.set_trace()?) so not related to this issue.

john-kheir commented 6 years ago

fixed