def ping(self, req): cmd = jsonobject.loads(req[http.REQUEST_BODY]) rsp = PingRsp() if cmd.testImagePath: pool = cmd.testImagePath.split('/')[0] testImagePath = '%s/this-is-a-test-image-with-long-name' % pool shellcmd = lichbd.lichbd_file_info(testImagePath) if shellcmd.return_code == errno.ENOENT: try: lichbd.lichbd_create_raw(testImagePath, '1b') except Exception, e: rsp.success = False rsp.operationFailure = True rsp.error = str(e) logger.debug("%s" % rsp.error) elif shellcmd.return_code == 0: pass else: rsp.success = False rsp.operationFailure = True rsp.error = "%s %s" % (shellcmd.cmd, shellcmd.stderr) logger.debug("%s: %s" % (shellcmd.cmd, shellcmd.stderr))
def ping(self, req): cmd = jsonobject.loads(req[http.REQUEST_BODY]) rsp = PingRsp() if cmd.testImagePath: pool = cmd.testImagePath.split('/')[0] testImagePath = '%s/this-is-a-test-image-with-long-name' % pool shellcmd = lichbd.lichbd_file_info(testImagePath) if shellcmd.return_code == errno.ENOENT: try: lichbd.lichbd_create_raw(testImagePath, '1b') except Exception, e: rsp.success = False rsp.operationFailure = True rsp.error = str(e) logger.debug("%s" % rsp.error) elif shellcmd.return_code == 0: pass else: rsp.success = False rsp.operationFailure = True rsp.error = "%s %s" % (shellcmd.cmd, shellcmd.stderr) logger.debug("%s: %s" % (shellcmd.cmd, shellcmd.stderr))