0-complexity / openvcloud

OpenvCloud
Other
2 stars 4 forks source link

import vm doesn't work #1082

Closed ahsayde closed 6 years ago

ahsayde commented 6 years ago

Detailed description

the imported vm was broken

image

Steps to reproduce

image

image

Relevant stacktraces

| Please make sure to include the stacktrace found under /grid/error conditions in the portal. Adding a link alone is not sufficient as it might have expired by the time the issue is looked at.

Installation information

JumpScale Core: branch: master (444fc87) 12/13/2017, 3:08:41 PM Portal: branch: master (e5150e9) 12/12/2017, 1:34:17 PM OpenvCloud Core: branch: resizevm (a334df8) 11/28/2017, 4:21:51 PM G8VDC: branch: master (695c7c0) 12/5/2017, 1:41:03 PM Selfhealing: branch: master (fd97c9c) 12/13/2017, 3:08:22 PM OpenvStorage du-conv-2 openvstorage-backend-core: 1.8.1-1 openvstorage-health-check: 3.3.1-1 alba: 1.3.14 openvstorage-webapps: 2.8.2-1 openvstorage-backend-webapps: 1.8.1-1 openvstorage-core: 2.8.2-1 openvstorage-hc: 1.8.1-1 openvstorage: 2.8.2-1 openvstorage-backend: 1.8.1-1 openvstorage-sdm: 1.7.1-1

FastGeert commented 6 years ago

Jo fixed it.

ahsayde commented 6 years ago

blocked on: https://github.com/0-complexity/openvcloud/issues/1088

ahsayde commented 6 years ago

should be tested on non-enterprise environment

ahsayde commented 6 years ago

still fails in case the vm has multiple disks Job log

Traceback (most recent call last):
~   File "/opt/jumpscale7/lib/JumpScale/grid/jumpscripts/JumpscriptFactory.py", line 176, in executeInProcess
    return True, self.module.action(*args, **kwargs)
~   File "/tmp/jumpscripts/greenitglobe_cloudbroker_import.py", line 55, in action
    '%s/%s' % (ts.path, member.name), path, isdata)
~   File "/opt/jumpscale7/libext/CloudscalerLibcloud/openvstorage.py", line 215, in importVolume
    return disk.guid, dest
~ AttributeError: 'NoneType' object has no attribute 'guid'

error condition log code

/opt/jumpscale7/libext/CloudscalerLibcloud/openvstorage.py
------------------------------------------------------------------------------------------
  /opt/jumpscale7/lib/JumpScale/grid/jumpscripts/JumpscriptFactory.py(line 176) (function executeInProcess)
  ========== STACKFRAME==========
            eco.tags="jscategory:%s"%self.category
            eco.jid = j.application.jid
            eco.tags+=" jsorganization:%s"%self.organization
            eco.tags+=" jsname:%s"%self.name
            return eco

        def executeInProcess(self, *args, **kwargs):
            try:
-->             return True, self.module.action(*args, **kwargs)
            except Exception as e:
                print "error in jumpscript factory: execute in process."
                eco = self._getECO(e)
                j.errorconditionhandler.raiseOperationalCritical(eco=eco,die=False)
                print(eco)
                return False, eco

  ============ LOCALS============
    args : ()
    e : 'NoneType' object has no attribute 'guid'
    kwargs : {u'machine': {u'name': u'test', u'mem': 536870912, u'disks': [{u'path': 'openvstorage+tcp:10.107.3.41:26203/vm-553/bootdisk-vm-553:username=edgeUser01:password=xaep0dooV8ughoo0', 'guid': '2725792d-6532-468b-bbde-2fbe76003101', u'id': 1211, u'file': u'disk-0.vmdk', u'size': 21474836480L}, {u'path': u'disk-1.vmdk', u'id': 1212, u'file': u'disk-1.vmdk', u'size': 0}], u'cpus': 1, u'id': 553, u'description': u'test'}, u'passwd': u'123456', u'username': u'admin', u'link': u'http://10.101.163.122:8080/remote.php/webdav/', u'path': u'vms'}
    self : <JumpScale.grid.jumpscripts.JumpscriptFactory.Jumpscript object at 0x7fd96d6a4690>

------------------------------------------------------------------------------------------
  /tmp/jumpscripts/greenitglobe_cloudbroker_import.py(line 55) (function action)
  ========== STACKFRAME==========
                            path = "vm-%d/bootdisk-vm-%d.raw" % (machine['id'], machine['id'])
                        else:
                            isdata = True
                            path = "volumes/volume_%d.raw" % (disk['id'])
                        print('Extracting')
                        tar.extract(member, ts.path)
                        print('Converting')
                        disk['guid'], disk['path'] = openvstorage.importVolume(
-->                         '%s/%s' % (ts.path, member.name), path, isdata)
                        j.system.fs.remove('%s/%s' % (ts.path, member.name))
        return machine

    if __name__ == "__main__":
        print(action('http://192.168.27.152/owncloud/remote.php/webdav', 'myuser', 'rooter', '/images/mie.tar.gz', {
            'id': 5555,
  ============ LOCALS============
    StreamUnifier : <class 'JumpScale.core.system.streamchunker.StreamUnifier'>
    WebDav : <class 'CloudscalerLibcloud.utils.webdav.WebDav'>
    connection : <CloudscalerLibcloud.utils.webdav.WebDav object at 0x7fd956e64950>
    disk : {u'path': u'disk-1.vmdk', u'id': 1212, u'file': u'disk-1.vmdk', u'size': 0}
    disks : [u'disk-0.vmdk', u'disk-1.vmdk']
    find_ova_files : <function find_ova_files at 0x7fd9570dce60>
    get_ova_streams : <function get_ova_streams at 0x7fd956e6a0c8>
    join : <function join at 0x7fd9570dcde8>
    link : http://10.101.163.122:8080/remote.php/webdav/
    machine : {u'name': u'test', u'mem': 536870912, u'disks': [{u'path': 'openvstorage+tcp:10.107.3.41:26203/vm-553/bootdisk-vm-553:username=edgeUser01:password=xaep0dooV8ughoo0', 'guid': '2725792d-6532-468b-bbde-2fbe76003101', u'id': 1211, u'file': u'disk-0.vmdk', u'size': 21474836480L}, {u'path': u'disk-1.vmdk', u'id': 1212, u'file': u'disk-1.vmdk', u'size': 0}], u'cpus': 1, u'id': 553, u'description': u'test'}
    member : <TarInfo 'disk-1.vmdk' at 0x7fd9570e18d0>
    ovafiles : ['export.ova.gz.000000000', 'export.ova.gz.000000001', 'export.ova.gz.000000002']
    passwd : 123456
    path : volumes/volume_1212.raw
    tar : <tarfile.TarFile object at 0x7fd9570e1e50>
    ts : <CloudscalerLibcloud.openvstorage.TempStorage object at 0x7fd9570e1e10>
    url : http://10.101.163.122:8080/remote.php/webdav/vms
    username : admin

------------------------------------------------------------------------------------------
  /opt/jumpscale7/libext/CloudscalerLibcloud/openvstorage.py(line 215) (function importVolume)
  ========== STACKFRAME==========
        srcpath = getOpenvStorageURL(srcpath)
        if data:
            dest = getUrlPath(destpath, vpoolname=None)
        else:
            dest = getUrlPath(destpath, vpoolname=VPOOLNAME)
        dest = getOpenvStorageURL(dest)
        j.system.platform.qemu_img.convert(srcpath, None, dest, 'raw')
        disk = getVDisk(destpath, timeout=60)
-->     return disk.guid, dest

    def exportVolume(srcpath, destpath):
        srcpath = getOpenvStorageURL(srcpath)
        j.system.platform.qemu_img.convert(srcpath.replace('://', ':', 1), None, destpath, 'vmdk')
        return destpath

  ============ LOCALS============
    dest : openvstorage+tcp:10.107.3.44:26211/volumes/volume_1212:username=edgeUser01:password=xaep0dooV8ughoo0
    destpath : volumes/volume_1212.raw
    disk : None
    srcpath : /tmp/17857782/disk-1.vmdk
ahsayde commented 6 years ago

verified on be-g8-3

software version

JumpScale

Core: branch: master (bdbb2fd) 12/19/2017, 10:14:55 AM Portal: branch: master (9a65ce8) 12/19/2017, 10:56:59 AM OpenvCloud

Core: branch: master (bfea912) 12/19/2017, 6:45:57 PM G8VDC: branch: master (2f5e95f) 12/19/2017, 8:37:17 AM Selfhealing: branch: master (0893c28) 12/19/2017, 11:34:51 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