0-complexity / openvcloud

OpenvCloud
Other
2 stars 4 forks source link

reset virtual machine returns internal server error #1116

Closed ahsayde closed 6 years ago

ahsayde commented 6 years ago

Detailed description

reset virtual machine returns internal server error

Steps to reproduce

Relevant stacktraces

TypeError: ex_hard_reboot_node() takes exactly 3 arguments (2 given)
Execute method POST_cloudapi_machines_reset failed.
method was:/restmachine/cloudapi/machines/reset

code

/opt/jumpscale7/apps/portals/main/base/cloudapi__machines/methodclass/cloudapi_machines.py

------------------------------------------------------------------------------------------
  /opt/jumpscale7/lib/JumpScale/portal/portal/PortalRest.py(line 254) (function execute_rest_call)
  ========== STACKFRAME==========
                            result = json.dumps([False, str(e)])
                        self.redis.set('tasks.{}'.format(taskguid), result, ex=600)
                        self.tasks.pop(taskguid, None)

                    greenlet = gevent.spawn(exec_async)
                    self.tasks[taskguid] = greenlet
                    result = taskguid
                else:
-->                 result = method(ctx=ctx, **ctx.params)

                return (True, result)
            except RemoteException as error:
                if error.eco.get('exceptionclassname') == 'KeyError' or error.eco['category'] == 'osis.objectnotfound':
                    data = error.eco['data'] or {'categoryname': 'unknown', 'key': '-1'}
                    raise exceptions.NotFound("Could not find %(key)s of type %(categoryname)s" % data)
                raise
  ============ LOCALS============
    ctx : <JumpScale.portal.portal.RequestContext.RequestContext object at 0x7fa7c8295fd0>
    errorObject : ex_hard_reboot_node() takes exactly 3 arguments (2 given)
    method : <bound method cloudapi_machines.wrapper of <cloudapi_machines.cloudapi_machines object at 0x7fa7d007b750>>
    routekey : POST_cloudapi_machines_reset
    self : <JumpScale.portal.portal.PortalRest.PortalRest instance at 0x7fa7d1f59680>

------------------------------------------------------------------------------------------
  /opt/jumpscale7/libext/cloudbrokerlib/authenticator.py(line 138) (function wrapper)
  ========== STACKFRAME==========
                        account = self.models.account.get(int(kwargs['accountId']))

                for key, value in (('accountId', account), ('cloudspaceId', cloudspace), ('machineId', machine)):
                    if value is not None:
                        tags.tagSet(key, str(value.id))

                ctx.env['beaker.session']['tags'] = str(tags)
                if self.isAuthorized(user, account, cloudspace, machine):
-->                 return func(*args, **kwargs)
                else:
                    raise exceptions.Forbidden(
                        '''User: "%s" isn't allowed to execute this action.
                            Not enough permissions''' % user)
            return wrapper

        def checkAccountStatus(self, requiredaccessrights, account):
  ============ LOCALS============
    account : {
  "DCLocation": "", 
  "_ckey": "", 
  "_meta": [
    "osismodel", 
    "cloudbroker", 
    "account", 
    1
  ], 
  "acl": [
    {
      "guid": "", 
      "right": "CXDRAU", 
      "status": "CONFIRMED", 
      "type": "U", 
      "userGroupId": "e50b929b95acl40"
    }
  ], 
  "company": "", 
  "companyurl": "", 
  "creationTime": 1513504560, 
  "deactivationTime": 0, 
  "displayname": "", 
  "guid": 78, 
  "id": 78, 
  "name": "e50b929b95acl40", 
  "resourceLimits": {
    "CU_C": -1, 
    "CU_D": -1, 
    "CU_I": -1, 
    "CU_M": -1.0, 
    "CU_NP": -1
  }, 
  "sendAccessEmails": true, 
  "status": "CONFIRMED", 
  "updateTime": 1513504560
}
    args : (<cloudapi_machines.cloudapi_machines object at 0x7fa7d007b750>,)
    cloudspace : {
  "_ckey": "", 
  "_meta": [
    "osismodel", 
    "cloudbroker", 
    "cloudspace", 
    1
  ], 
  "accountId": 78, 
  "acl": [
    {
      "guid": "", 
      "right": "CXDRAU", 
      "status": "CONFIRMED", 
      "type": "U", 
      "userGroupId": "e50b929b95acl40"
    }
  ], 
  "allowedVMSizes": [], 
  "creationTime": 1513504560, 
  "deletionTime": 0, 
  "descr": "", 
  "externalnetworkId": 3, 
  "externalnetworkip": "10.101.163.127/16", 
  "gid": 107, 
  "guid": 80, 
  "id": 80, 
  "location": "be-g8-3", 
  "name": "default", 
  "networkId": 240, 
  "resourceLimits": {
    "CU_C": -1, 
    "CU_D": -1, 
    "CU_I": -1, 
    "CU_M": -1.0, 
    "CU_NP": -1
  }, 
  "resourceProviderStacks": [], 
  "secret": "6eeda109-861c-4b18-b2bc-d45dcf75de29", 
  "status": "DEPLOYED", 
  "updateTime": 1513504603
}
    ctx : <JumpScale.portal.portal.RequestContext.RequestContext object at 0x7fa7c8295fd0>
    func : <function reset at 0x7fa7d0075de8>
    key : machineId
    kwargs : {'machineId': 299, 'ctx': <JumpScale.portal.portal.RequestContext.RequestContext object at 0x7fa7c8295fd0>}
    machine : {
  "_ckey": "", 
  "_meta": [
    "osismodel", 
    "cloudbroker", 
    "vmachine", 
    1
  ], 
  "accounts": [
    {
      "guid": "", 
      "login": "cloudscalers", 
      "password": "GrLfeq2xB"
    }
  ], 
  "acl": [
    {
      "guid": "", 
      "right": "CRX", 
      "status": "CONFIRMED", 
      "type": "U", 
      "userGroupId": "a1a09455dd"
    }
  ], 
  "boot": true, 
  "clone": 0, 
  "cloneReference": 0, 
  "cloudspaceId": 80, 
  "cpus": null, 
  "creationTime": 1513504604, 
  "dedicatedCU": true, 
  "deletionTime": 0, 
  "descr": null, 
  "disks": [
    659, 
    660
  ], 
  "guid": 299, 
  "hostName": "vm-299", 
  "hypervisorType": "", 
  "id": 299, 
  "imageId": 1, 
  "name": "ea724d34-1479-418c-a38c-5892c771be7c", 
  "networkGatewayIPv4": "", 
  "nics": [
    {
      "deviceName": "vm-299-00f0", 
      "guid": "", 
      "ipAddress": "192.168.103.254", 
      "macAddress": "52:54:00:00:00:8f", 
      "networkId": 0, 
      "params": "", 
      "referenceId": "", 
      "status": "", 
      "type": "bridge"
    }
  ], 
  "referenceId": "c7a76412-f7b0-4333-9a42-ca642c754603", 
  "referenceSizeId": "1", 
  "sizeId": 1, 
  "stackId": 7, 
  "status": "RUNNING", 
  "tags": "", 
  "type": "VIRTUAL", 
  "updateTime": 1513504628
}
    self : <cloudbrokerlib.authenticator.auth object at 0x7fa7d007b950>
    tags : cloudspaceId:80 machineId:299 accountId:78
    user : a1a09455dd
    value : {
  "_ckey": "", 
  "_meta": [
    "osismodel", 
    "cloudbroker", 
    "vmachine", 
    1
  ], 
  "accounts": [
    {
      "guid": "", 
      "login": "cloudscalers", 
      "password": "GrLfeq2xB"
    }
  ], 
  "acl": [
    {
      "guid": "", 
      "right": "CRX", 
      "status": "CONFIRMED", 
      "type": "U", 
      "userGroupId": "a1a09455dd"
    }
  ], 
  "boot": true, 
  "clone": 0, 
  "cloneReference": 0, 
  "cloudspaceId": 80, 
  "cpus": null, 
  "creationTime": 1513504604, 
  "dedicatedCU": true, 
  "deletionTime": 0, 
  "descr": null, 
  "disks": [
    659, 
    660
  ], 
  "guid": 299, 
  "hostName": "vm-299", 
  "hypervisorType": "", 
  "id": 299, 
  "imageId": 1, 
  "name": "ea724d34-1479-418c-a38c-5892c771be7c", 
  "networkGatewayIPv4": "", 
  "nics": [
    {
      "deviceName": "vm-299-00f0", 
      "guid": "", 
      "ipAddress": "192.168.103.254", 
      "macAddress": "52:54:00:00:00:8f", 
      "networkId": 0, 
      "params": "", 
      "referenceId": "", 
      "status": "", 
      "type": "bridge"
    }
  ], 
  "referenceId": "c7a76412-f7b0-4333-9a42-ca642c754603", 
  "referenceSizeId": "1", 
  "sizeId": 1, 
  "stackId": 7, 
  "status": "RUNNING", 
  "tags": "", 
  "type": "VIRTUAL", 
  "updateTime": 1513504628
}

------------------------------------------------------------------------------------------
  /opt/jumpscale7/apps/portals/main/base/cloudapi__machines/methodclass/cloudapi_machines.py(line 130) (function reset)
  ========== STACKFRAME==========

        @authenticator.auth(acl={'machine': set('X')})
        def reset(self, machineId, **kwargs):
            """
            Reset the machine, force reboot

            :param machineId: id of the machine
            """
-->         return self._action(machineId, 'hard_reboot', enums.MachineStatus.RUNNING)

        @authenticator.auth(acl={'machine': set('X')})
        def pause(self, machineId, **kwargs):
            """
            Pause the machine

            :param machineId: id of the machine
  ============ LOCALS============
    kwargs : {'ctx': <JumpScale.portal.portal.RequestContext.RequestContext object at 0x7fa7c8295fd0>}
    self : <cloudapi_machines.cloudapi_machines object at 0x7fa7d007b750>

------------------------------------------------------------------------------------------
  /opt/jumpscale7/apps/portals/main/base/cloudapi__machines/methodclass/cloudapi_machines.py(line 70) (function _action)
  ========== STACKFRAME==========
                if bootdisk:
                    size = self.models.size.get(machine.sizeId)
                    kwargs['size'] = provider.getSize(size, bootdisk)
                method = getattr(provider.client, actionname, None)
                if not method:
                    method = getattr(provider.client, "ex_%s" % actionname.lower(), None)
                    if not method:
                        raise exceptions.BadRequest("Action %s is not support on machine %s" % (actiontype, machineId))
-->             result = method(node, **kwargs)
                if newstatus and newstatus != machine.status:
                    self.models.vmachine.updateSearch({'id': machine.id}, {'$set': {'status': newstatus}})
                return result

        def _get_boot_disk(self, machine):
            bootdisk = None
            for disk_id in machine.disks:
  ============ LOCALS============
    actionname : hard_reboot_node
    actiontype : hard_reboot
    bootdisk : None
    kwargs : {}
    machine : {
  "_ckey": "", 
  "_meta": [
    "osismodel", 
    "cloudbroker", 
    "vmachine", 
    1
  ], 
  "accounts": [
    {
      "guid": "", 
      "login": "cloudscalers", 
      "password": "GrLfeq2xB"
    }
  ], 
  "acl": [
    {
      "guid": "", 
      "right": "CRX", 
      "status": "CONFIRMED", 
      "type": "U", 
      "userGroupId": "a1a09455dd"
    }
  ], 
  "boot": true, 
  "clone": 0, 
  "cloneReference": 0, 
  "cloudspaceId": 80, 
  "cpus": null, 
  "creationTime": 1513504604, 
  "dedicatedCU": true, 
  "deletionTime": 0, 
  "descr": null, 
  "disks": [
    659, 
    660
  ], 
  "guid": 299, 
  "hostName": "vm-299", 
  "hypervisorType": "", 
  "id": 299, 
  "imageId": 1, 
  "name": "ea724d34-1479-418c-a38c-5892c771be7c", 
  "networkGatewayIPv4": "", 
  "nics": [
    {
      "deviceName": "vm-299-00f0", 
      "guid": "", 
      "ipAddress": "192.168.103.254", 
      "macAddress": "52:54:00:00:00:8f", 
      "networkId": 0, 
      "params": "", 
      "referenceId": "", 
      "status": "", 
      "type": "bridge"
    }
  ], 
  "referenceId": "c7a76412-f7b0-4333-9a42-ca642c754603", 
  "referenceSizeId": "1", 
  "sizeId": 1, 
  "stackId": 7, 
  "status": "RUNNING", 
  "tags": "", 
  "type": "VIRTUAL", 
  "updateTime": 1513504628
}
    method : <bound method CSLibvirtNodeDriver.ex_hard_reboot_node of <CloudscalerLibcloud.compute.drivers.libvirt_driver.CSLibvirtNodeDriver object at 0x7fa7cb62fbd0>>
    newstatus : RUNNING
    provider : <cloudbrokerlib.cloudbroker.CloudProvider object at 0x7fa7c8285bd0>
    self : <cloudapi_machines.cloudapi_machines object at 0x7fa7d007b750>

Installation information

JumpScale

Core: branch: master (0a1fa90) 4/27/2017, 12:57:54 PM
Portal: branch: master (30066b4) 12/13/2017, 10:39:40 PM

OpenvCloud

Core: branch: master (63c11d3) 12/18/2017, 2:21:26 PM
G8VDC: branch: master (ea4dc79) 12/14/2017, 9:33:18 AM
Selfhealing: branch: master (d0a4bc5) 12/17/2017, 11:25:08 AM

OpenvStorage be-g8-3

openvstorage-backend-core: 1.9.2-1
openvstorage-health-check: 3.4.0-1
openvstorage-webapps: 2.9.9-1
openvstorage-backend-webapps: 1.9.2-1
openvstorage-core: 2.9.9-1
openvstorage-hc: 1.9.2-1
alba-ee: 1.5.17
openvstorage: 2.9.9-1
openvstorage-backend: 1.9.2-1
openvstorage-extensions: 0.1.1-1
openvstorage-sdm: 1.9.1-1
ahsayde commented 6 years ago

software versions

JumpScale

Core: branch: master (0a1fa90) 4/27/2017, 12:57:54 PM
Portal: branch: master (30066b4) 12/13/2017, 10:39:40 PM

OpenvCloud

Core: branch: master (3c10bcf) 12/18/2017, 5:15:19 PM
G8VDC: branch: master (ea4dc79) 12/14/2017, 9:33:18 AM
Selfhealing: branch: master (d0a4bc5) 12/17/2017, 11:25:08 AM

OpenvStorage be-g8-3

openvstorage-backend-core: 1.9.2-1
openvstorage-health-check: 3.4.0-1
openvstorage-webapps: 2.9.9-1
openvstorage-backend-webapps: 1.9.2-1
openvstorage-core: 2.9.9-1
openvstorage-hc: 1.9.2-1
alba-ee: 1.5.17
openvstorage: 2.9.9-1
openvstorage-backend: 1.9.2-1
openvstorage-extensions: 0.1.1-1
openvstorage-sdm: 1.9.1-1