def create_empty_volume(self, req): cmd = jsonobject.loads(req[http.REQUEST_BODY]) rsp = AgentResponse() try: dirname = os.path.dirname(cmd.installUrl) if not os.path.exists(dirname): os.makedirs(dirname) if cmd.backingFile: linux.qcow2_create_with_backing_file(cmd.backingFile, cmd.installUrl) else: linux.qcow2_create(cmd.installUrl, cmd.size) except Exception as e: logger.warn(linux.get_exception_stacktrace()) rsp.error = 'unable to create empty volume[uuid:%s, name:%s], %s' % ( cmd.uuid, cmd.name, str(e)) rsp.success = False return jsonobject.dumps(rsp) logger.debug( 'successfully create empty volume[uuid:%s, size:%s] at %s' % (cmd.volumeUuid, cmd.size, cmd.installUrl)) rsp.totalCapacity, rsp.availableCapacity = self._get_disk_capacity() return jsonobject.dumps(rsp)
def create_empty_volume(self, req): cmd = jsonobject.loads(req[http.REQUEST_BODY]) rsp = AgentRsp() dirname = os.path.dirname(cmd.installPath) if not os.path.exists(dirname): os.makedirs(dirname) if cmd.backingFile: linux.qcow2_create_with_backing_file(cmd.backingFile, cmd.installPath) else: linux.qcow2_create(cmd.installPath, cmd.size) logger.debug('successfully create empty volume[uuid:%s, size:%s] at %s' % (cmd.volumeUuid, cmd.size, cmd.installPath)) rsp.totalCapacity, rsp.availableCapacity = self._get_disk_capacity(cmd.mountPoint) return jsonobject.dumps(rsp)
def create_empty_volume(self, req): cmd = jsonobject.loads(req[http.REQUEST_BODY]) rsp = AgentRsp() dirname = os.path.dirname(cmd.installPath) if not os.path.exists(dirname): os.makedirs(dirname) if cmd.backingFile: linux.qcow2_create_with_backing_file(cmd.backingFile, cmd.installPath) else: linux.qcow2_create(cmd.installPath, cmd.size) logger.debug('successfully create empty volume[uuid:%s, size:%s] at %s' % (cmd.volumeUuid, cmd.size, cmd.installPath)) rsp.totalCapacity, rsp.availableCapacity = self._get_disk_capacity() return jsonobject.dumps(rsp)
def create_empty_volume(self, req): cmd = jsonobject.loads(req[http.REQUEST_BODY]) rsp = AgentResponse() try: dirname = os.path.dirname(cmd.installUrl) if not os.path.exists(dirname): os.makedirs(dirname) if cmd.backingFile: linux.qcow2_create_with_backing_file(cmd.backingFile, cmd.installUrl) else: linux.qcow2_create(cmd.installUrl, cmd.size) except Exception as e: logger.warn(linux.get_exception_stacktrace()) rsp.error = 'unable to create empty volume[uuid:%s, name:%s], %s' % (cmd.uuid, cmd.name, str(e)) rsp.success = False return jsonobject.dumps(rsp) logger.debug('successfully create empty volume[uuid:%s, size:%s] at %s' % (cmd.volumeUuid, cmd.size, cmd.installUrl)) rsp.totalCapacity, rsp.availableCapacity = self._get_disk_capacity() return jsonobject.dumps(rsp)