diff --git a/cccli/command/__init__.py b/cccli/command/__init__.py index 080918c7d590b74265a6e444a26aa2ca8bb30d4e..00546ee001e6218215c124de186496a8f7b9177c 100644 --- a/cccli/command/__init__.py +++ b/cccli/command/__init__.py @@ -18,3 +18,4 @@ from cccli.command.vm import * # by command module from cccli.command.list import Command_list from cccli.command.expert import Command_expert +from cccli.command.cache import Command_cache diff --git a/cccli/command/cache.py b/cccli/command/cache.py new file mode 100644 index 0000000000000000000000000000000000000000..01a4063e5116f82f10fbbf0f611bea1eadc02423 --- /dev/null +++ b/cccli/command/cache.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +#coding=utf8 + +''' +CloudControl cache command +''' +from cccli.exception import * +from sjrpc.core.exceptions import * +from cccli.printer import Printer, color +from cccli.command.command import Command + +class Command_cache(Command): + '''Show server cache statistics''' + + def __call__(self, argv): + try: + d = self.cli.rpc.call("dbstats") + for i,v in d.items(): + self.printer.out("%s: %s"%(i,v)) + except RpcError as e: + raise cmdError("RPCError: %s"%str(e))