def enable_account(atName,urName): ''' 功能:启用账户 输入:管理员账户,被启用账户名 输出:无 ''' t = UserEnable(atName,urName) mission.execute(t) print t.response return t.response
def add_config_executor(atName,hostip): ''' 功能:添加需要配置节点 输入:用户名,节点ip (测试cloudfs节点ip为192.168.36.201) 输出: ''' t = ExecutorAdd(atName,hostip) mission.execute(t) print t.response return t.response
def disable_object(atName, objPath): ''' 功能:禁用文件 输入:用户名,对象路径 输出: 无 ''' t = ObjectDisable(atName, objPath) mission.execute(t) print t.response return t.response
def delete_object(atName, objPath): ''' 功能:删除文件 输入:用户名,对象路径 输出:无 ''' t = ObjectDelete(atName, objPath) mission.execute(t) print t.response return t.response
def delete_object(atName,objPath): ''' 功能:删除文件 输入:用户名,对象路径 输出:无 ''' t = ObjectDelete(atName,objPath) mission.execute(t) print t.response return t.response
def disable_object(atName,objPath): ''' 功能:禁用文件 输入:用户名,对象路径 输出: 无 ''' t = ObjectDisable(atName,objPath) mission.execute(t) print t.response return t.response
def enable_object(atName,objPath): ''' 功能:启用文件 输入:用户名,对象路径 输出:无 ''' t = ObjectEnable(atName,objPath) mission.execute(t) print t.response return t.response
def enable_object(atName, objPath): ''' 功能:启用文件 输入:用户名,对象路径 输出:无 ''' t = ObjectEnable(atName, objPath) mission.execute(t) print t.response return t.response
def get_config_executor_list(atName): ''' 功能:获取配置节点列表 输入:用户名 输出:节点主机名,节点uuid,节点ip,节点状态 ''' t = ExecutorList(atName) mission.execute(t) print t.response return t.response
def get_service_status(atName, hostUuid): ''' 功能:获取主机服务状态 输入:用户名,主机uuid(通过get_host_static获取) 输出:主机服务状态 ''' t = ServiceStatus(atName, hostUuid) mission.execute(t) print t.response return t.response
def disable_account(atName,urName): ''' 功能:禁用账户 输入:管理员账户,被禁用账户名 输出:无 ''' t = UserDisable(atName,urName) mission.execute(t) print t.response return t.response
def del_config_executor(atName, hostUuid): ''' 功能:删除配置节点 输入:用户名,节点uuid 输出: ''' t = ExecutorDel(atName, hostUuid) mission.execute(t) print t.response return t.response
def get_service_status(atName,hostUuid): ''' 功能:获取主机服务状态 输入:用户名,主机uuid(通过get_host_static获取) 输出:主机服务状态 ''' t = ServiceStatus(atName,hostUuid) mission.execute(t) print t.response return t.response
def add_config_executor(atName, hostip): ''' 功能:添加需要配置节点 输入:用户名,节点ip (测试cloudfs节点ip为192.168.36.201) 输出: ''' t = ExecutorAdd(atName, hostip) mission.execute(t) print t.response return t.response
def get_config_executor_list(atName): ''' 功能:获取配置节点列表 输入:用户名 输出:节点主机名,节点uuid,节点ip,节点状态 ''' t = ExecutorList(atName) mission.execute(t) print t.response return t.response
def set_account_quota(atName,val ): ''' 功能:设置用户配额值 输入:用户名,配额字节数(1G则val为1024*1024*1024) 输出:无 ''' t = QuotaSet(atName,val) mission.execute(t) print t.response return t.response
def del_config_executor(atName,hostUuid): ''' 功能:删除配置节点 输入:用户名,节点uuid 输出: ''' t = ExecutorDel(atName,hostUuid) mission.execute(t) print t.response return t.response
def enable_account(atName, urName): ''' 功能:启用账户 输入:管理员账户,被启用账户名 输出:无 ''' t = UserEnable(atName, urName) mission.execute(t) print t.response return t.response
def disable_account(atName, urName): ''' 功能:禁用账户 输入:管理员账户,被禁用账户名 输出:无 ''' t = UserDisable(atName, urName) mission.execute(t) print t.response return t.response
def delete_account(atName,urName): ''' 功能:删除账户 输入:管理员账户,被删除账户名 输出:无 备注:实际并未删除,禁用账户,可通过启动恢复 ''' t = UserDelete(atName,urName) mission.execute(t) print t.response return t.response
def get_account_quota(atName): ''' 功能:获取用户配额信息 输入:用户名 输出:bytes-used:空间已使用字节数 quota-bytes:用户配额大小 ''' t = QuotaGet(atName) mission.execute(t) print t.response return t.response
def delete_account(atName, urName): ''' 功能:删除账户 输入:管理员账户,被删除账户名 输出:无 备注:实际并未删除,禁用账户,可通过启动恢复 ''' t = UserDelete(atName, urName) mission.execute(t) print t.response return t.response
def get_accounts(atName, start=0, num=0): ''' 功能:获取账户信息 输入:管理员账户 输出:state 账户状态 type 账户类型 name:账户名 ''' t = UserList(atName) mission.execute(t) print t.response return t.response
def get_accounts(atName,start=0,num=0): ''' 功能:获取账户信息 输入:管理员账户 输出:state 账户状态 type 账户类型 name:账户名 ''' t = UserList(atName) mission.execute(t) print t.response return t.response
def get_object_details(atName,objectId): ''' 功能:获取对象详细信息 输入:用户名,对象数据库id 输出:urlpath 对象全路径 账户:Account-Bytes-Used 账户已用空间,Account-Meta-Quota-Bytes 账户配额 容器:container-bytes-used 容器已用空间,versions-location 容器版本容器,container-object-count 容器对象数量 对象:object-permisson 权限,content-length 文件大小,file-type 对象类型,md5 文件md5值 ''' t = ObjectDetails(atName,objectId) mission.execute(t) print t.response return t.response
def data_user_find(atName,keyword): ''' 功能:根据关键字搜索用户空间内的对象 输入:用户名,关键字 输出:path:路径 state:状态 type:类型 id:数据库id parent_id:父路径id ''' t = UserSearch(atName,keyword) mission.execute(t) print t.response return t.response
def set_configs(atName,hostUuid,attrs): ''' 功能:配置节点选项 输入:用户名,节点uuid,配置选项 {'cache':{xxx}, 'storage':{xxx}, ... ... } 输出: ''' t = ConfigSet(atName,hostUuid,attrs) mission.execute(t) print t.response return t.response
def set_configs(atName, hostUuid, attrs): ''' 功能:配置节点选项 输入:用户名,节点uuid,配置选项 {'cache':{xxx}, 'storage':{xxx}, ... ... } 输出: ''' t = ConfigSet(atName, hostUuid, attrs) mission.execute(t) print t.response return t.response
def upload_object(atName,dst,localPath): ''' 功能:上传文件 输入:用户名,目标路径,源文件路径 输出:ctime:创建时间 mtime:修改时间 permission:文件权限 path:路径 md5:文件md5 size:文件大小 ''' t = ObjectUpload(atName,dst,localPath) mission.execute(t) print t.response return t.response
def upload_object(atName, dst, localPath): ''' 功能:上传文件 输入:用户名,目标路径,源文件路径 输出:ctime:创建时间 mtime:修改时间 permission:文件权限 path:路径 md5:文件md5 size:文件大小 ''' t = ObjectUpload(atName, dst, localPath) mission.execute(t) print t.response return t.response
def data_global_find(atName,keyword): ''' 功能:根据关键字搜索全局空间内的对象 输入:管理员用户名,关键字 输出:path:路径 state:状态 type:类型 id:数据库id parent_id:父路径id ''' t = GlobalSearch(atName,keyword) mission.execute(t) print t.response return t.response
def get_workload_status(atName, hostUuid, className): ''' 功能:获取主机运行负载信息 输入:用户名,主机uuid,信息类型(cpu,mem,disk,net,storage) 输出:主机负载类型数据,其中 cpu:获取1000条主机运行数据 mem:获取最新内存信息 disk:获取1000条运行数据 net:获取1000条运行数据 storage:获取最新存储状态 ''' t = WorkloadStatus(atName, hostUuid, className) mission.execute(t) print t.response return t.response
def user_login(email, passwd): ''' 功能:用户登录 输入:用户邮箱,密码 输出:access_token:用户token expires:超时时间 tanent:账户名 name:数据库用户名 state:账户状态 type:用户类型 id:数据库id 备注:tanent不可直接使用,作为atName参数使用时,使用name值 ''' t = UserLogin(email, passwd) mission.execute(t) print t.response return t.response
def get_workload_status(atName,hostUuid,className): ''' 功能:获取主机运行负载信息 输入:用户名,主机uuid,信息类型(cpu,mem,disk,net,storage) 输出:主机负载类型数据,其中 cpu:获取1000条主机运行数据 mem:获取最新内存信息 disk:获取1000条运行数据 net:获取1000条运行数据 storage:获取最新存储状态 ''' t = WorkloadStatus(atName,hostUuid,className) mission.execute(t) print t.response return t.response
def user_login(email,passwd): ''' 功能:用户登录 输入:用户邮箱,密码 输出:access_token:用户token expires:超时时间 tanent:账户名 name:数据库用户名 state:账户状态 type:用户类型 id:数据库id 备注:tanent不可直接使用,作为atName参数使用时,使用name值 ''' t = UserLogin(email,passwd) mission.execute(t) print t.response return t.response
def get_host_static(atName): ''' 功能:获取所有监控主机硬件配置信息 输入:用户名 输出:主机硬件配置数据,其中 {'hostUuidA':{'cpu':{},'mem':{},'disk':{},'net':{},'host':{}}, 'hostUuidB':{'cpu':{},'mem':{},'disk':{},'net':{},'host':{}}} host:主板信息 cpu:cpu信息 mem:内存信息 disk:硬盘信息 net:网卡数据 ''' t = HostStatic(atName) mission.execute(t) print t.response return t.response
def get_host_static(atName): ''' 功能:获取所有监控主机硬件配置信息 输入:用户名 输出:主机硬件配置数据,其中 {'hostUuidA':{'cpu':{},'mem':{},'disk':{},'net':{},'host':{}}, 'hostUuidB':{'cpu':{},'mem':{},'disk':{},'net':{},'host':{}}} host:主板信息 cpu:cpu信息 mem:内存信息 disk:硬盘信息 net:网卡数据 ''' t = HostStatic(atName) mission.execute(t) print t.response return t.response
def get_object_records(atName,objPath,start=0,num=0): ''' 功能:获取对象操作记录 输入:用户名,对象路径 输出:数据库id,消息正文,时间 ''' t = ObjectRecord(atName,objPath ) t = mission.execute(t) print t.response return t.response
def get_account_records(atName, start=0, num=0): ''' 功能:获取用户操作记录 输入:用户名 输出:数据库id,消息正文,时间 ''' t = AccountRecord(atName) t = mission.execute(t) print t.response return t.response
def get_account_records(atName,start=0,num=0): ''' 功能:获取用户操作记录 输入:用户名 输出:数据库id,消息正文,时间 ''' t = AccountRecord(atName ) t = mission.execute(t) print t.response return t.response
def get_object_records(atName, objPath, start=0, num=0): ''' 功能:获取对象操作记录 输入:用户名,对象路径 输出:数据库id,消息正文,时间 ''' t = ObjectRecord(atName, objPath) t = mission.execute(t) print t.response return t.response
def get_config(atName, hostUuid): ''' 功能:获取配置节点选项 输入:用户名,主机uuid 输出: {"cache": {"cache_memcache_host": "127.0.0.1", "cache_memcache_port": "11211"}, "storage": {"storage_devices": "/mnt/cloudfs-object"}, "concurrency": {"concurrency_container": "0", "concurrency_proxy": "0", "concurrency_account": "0", "concurrency_object": "0"}, "auth": {"auth_oauth_host": "http://192.168.36.201", "auth_oauth_port": "8080"}, "proxy": {"proxy_bind_port": "443"}} cache 缓存:cache_memcache_host memcache主机,cache_memcache_port memcache端口 storage存储:storage_devices 存储挂载路径 concurrency并发:concurrency_account 账户服务并发数,concurrency_container容器服务并发数, concurrency_object对象服务并发数,concurrency_proxy代理服务并发数 auth认证: auth_oauth_host认证主机地址,auth_oauth_port认证主机端口 proxy代理:proxy_bind_port代理服务端口 ''' t = ConfigGet(atName, hostUuid) mission.execute(t) print t.response return t.response
def get_config(atName,hostUuid): ''' 功能:获取配置节点选项 输入:用户名,主机uuid 输出: {"cache": {"cache_memcache_host": "127.0.0.1", "cache_memcache_port": "11211"}, "storage": {"storage_devices": "/mnt/cloudfs-object"}, "concurrency": {"concurrency_container": "0", "concurrency_proxy": "0", "concurrency_account": "0", "concurrency_object": "0"}, "auth": {"auth_oauth_host": "http://192.168.36.201", "auth_oauth_port": "8080"}, "proxy": {"proxy_bind_port": "443"}} cache 缓存:cache_memcache_host memcache主机,cache_memcache_port memcache端口 storage存储:storage_devices 存储挂载路径 concurrency并发:concurrency_account 账户服务并发数,concurrency_container容器服务并发数, concurrency_object对象服务并发数,concurrency_proxy代理服务并发数 auth认证: auth_oauth_host认证主机地址,auth_oauth_port认证主机端口 proxy代理:proxy_bind_port代理服务端口 ''' t = ConfigGet(atName,hostUuid) mission.execute(t) print t.response return t.response
def list_account(atName): ''' 功能:获取用户下的容器 输入:用户名 输出:path 名称 state:忽略 type:类型 id:数据库id parent_id:父路径id ''' t = AccountList(atName) t = mission.execute(t) print t.response return t.response
def list_container(atName, cntPath, tree=False): ''' 功能:获取容器下的对象 输入:用户名,容器路径 输出:path:对象路径 state:对象状态 type:对象类型 id:对象数据库id parent_id:父路径id ''' t = ContainerList(atName, cntPath, tree) t = mission.execute(t) print t.response return t.response
def list_account(atName): ''' 功能:获取用户下的容器 输入:用户名 输出:path 名称 state:忽略 type:类型 id:数据库id parent_id:父路径id ''' t = AccountList(atName) t = mission.execute(t) print t.response return t.response
def list_dir(atName, drPath, tree=False): ''' 功能:获取目录下的文件 输入:用户名,目录路径 输出:path:对象路径 state:对象状态 type:对象类型 id:对象数据库id parent_id:父路径id ''' t = DirList(atName, drPath, tree) t = mission.execute(t) print t.response return t.response
def list_container(atName,cntPath,tree=False): ''' 功能:获取容器下的对象 输入:用户名,容器路径 输出:path:对象路径 state:对象状态 type:对象类型 id:对象数据库id parent_id:父路径id ''' t = ContainerList(atName,cntPath,tree) t = mission.execute(t) print t.response return t.response
def list_dir(atName,drPath,tree=False): ''' 功能:获取目录下的文件 输入:用户名,目录路径 输出:path:对象路径 state:对象状态 type:对象类型 id:对象数据库id parent_id:父路径id ''' t = DirList(atName,drPath,tree) t = mission.execute(t) print t.response return t.response
def get_abnormal_events(atName): t = AbnormalEvents(atName) mission.execute(t) print t.response return t.response
def data_md5_find(atName,keyword): t = Md5Search(atName,keyword) mission.execute(t) print t.response return t.response
def get_abnormal_events(atName): t = AbnormalEvents(atName) mission.execute(t) print t.response return t.response