OSDN Git Service

addition of new api
authorniwa-hideyuki <niwa.hideyuki@jp.fujitsu.com>
Thu, 23 Oct 2014 02:28:53 +0000 (11:28 +0900)
committerniwa-hideyuki <niwa.hideyuki@jp.fujitsu.com>
Thu, 23 Oct 2014 02:28:53 +0000 (11:28 +0900)
The following API is added.
memlimit
memswlimit
net_cls
numa
q
queue
reboot
rename
restore
resume
resume-n
set
set-n
show
snapshot
snapshot-n
start
start-n
stop
stop-n
submit
suspend
suspend-n
sysgen
sysgen-n
update
version

lxcf/rest-api/lxcfv1/api_common.py
lxcf/rest-api/lxcfv1/lxcf-api

index 842f9e4..b97523e 100755 (executable)
@@ -148,56 +148,6 @@ class api_common(object):
         return fp
 
 
-# API: start
-def call_start(cmdline):
-    cmdstr = "start "
-    for str in cmdline:
-        cmdstr = cmdstr + " " + str
-    print cmdstr
-    return cmdstr
-
-class api_start(api_common):
-    def __init__(self, callcmd):
-        super(api_start, self).__init__(callcmd)
-
-# API: stop
-def call_stop(cmdline):
-    cmdstr = "stop "
-    for str in cmdline:
-        cmdstr = cmdstr + " " + str
-    print cmdstr
-    return cmdstr
-
-class api_stop(api_common):
-    def __init__(self, callcmd):
-        super(api_stop, self).__init__(callcmd)
-
-
-# API: sysgen
-def call_sysgen(cmdline):
-    cmdstr = "sysgen"
-    for str in cmdline:
-        cmdstr = cmdstr + " " + str
-    print cmdstr
-    return cmdstr
-
-class api_sysgen(api_common):
-    def __init__(self, callcmd):
-        super(api_sysgen, self).__init__(callcmd)
-
-# API: show
-def call_show(cmdline):
-    cmdstr = "show"
-    for str in cmdline:
-        cmdstr = cmdstr + " " + str
-    print cmdstr
-    return cmdstr
-
-class api_show(api_common):
-    def __init__(self, callcmd):
-        super(api_show, self).__init__(callcmd)
-
-
 # API: autostart
 def call_autostart(cmdline):
     cmdstr = "autostart "
@@ -400,4 +350,355 @@ class api_log(api_common):
     def __init__(self, callcmd):
         super(api_log, self).__init__(callcmd)
 
+# API: memlimit
+def call_memlimit(cmdline):
+    cmdstr = "memlimit"
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_memlimit(api_common):
+    def __init__(self, callcmd):
+        super(api_memlimit, self).__init__(callcmd)
+
+
+# API: memswlimit
+def call_memswlimit(cmdline):
+    cmdstr = "memswlimit"
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_memswlimit(api_common):
+    def __init__(self, callcmd):
+        super(api_memswlimit, self).__init__(callcmd)
+
+
+# API: net_cls
+def call_net_cls(cmdline):
+    cmdstr = "net_cls"
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_net_cls(api_common):
+    def __init__(self, callcmd):
+        super(api_net_cls, self).__init__(callcmd)
+
+
+# API: numa
+def call_numa(cmdline):
+    cmdstr = "numa"
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_numa(api_common):
+    def __init__(self, callcmd):
+        super(api_numa, self).__init__(callcmd)
+
+
+# API: q
+def call_q(cmdline):
+    cmdstr = "q"
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_q(api_common):
+    def __init__(self, callcmd):
+        super(api_q, self).__init__(callcmd)
+
+
+# API: queue
+def call_queue(cmdline):
+    cmdstr = "queue"
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_queue(api_common):
+    def __init__(self, callcmd):
+        super(api_queue, self).__init__(callcmd)
+
+
+# API: reboot
+def call_reboot(cmdline):
+    cmdstr = "reboot"
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_reboot(api_common):
+    def __init__(self, callcmd):
+        super(api_reboot, self).__init__(callcmd)
+
+
+# API: rename
+def call_rename(cmdline):
+    cmdstr = "rename"
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_rename(api_common):
+    def __init__(self, callcmd):
+        super(api_rename, self).__init__(callcmd)
+
+
+# API: restore
+def call_restore(cmdline):
+    cmdstr = "restore"
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_restore(api_common):
+    def __init__(self, callcmd):
+        super(api_restore, self).__init__(callcmd)
+
+
+# API: resume
+def call_resume(cmdline):
+    cmdstr = "resume"
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_resume(api_common):
+    def __init__(self, callcmd):
+        super(api_resume, self).__init__(callcmd)
+
+
+# API: resume-n
+def call_resume_n(cmdline):
+    cmdstr = "resume-n"
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_resume_n(api_common):
+    def __init__(self, callcmd):
+        super(api_resume_n, self).__init__(callcmd)
+
+
+# API: set
+def call_set(cmdline):
+    cmdstr = "set"
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_set(api_common):
+    def __init__(self, callcmd):
+        super(api_set, self).__init__(callcmd)
+
+
+# API: set-n
+def call_set_n(cmdline):
+    cmdstr = "set-n"
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_set_n(api_common):
+    def __init__(self, callcmd):
+        super(api_set_n, self).__init__(callcmd)
+
+
+# API: show
+def call_show(cmdline):
+    cmdstr = "show"
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_show(api_common):
+    def __init__(self, callcmd):
+        super(api_show, self).__init__(callcmd)
+
+
+# API: snapshot
+def call_snapshot(cmdline):
+    cmdstr = "snapshot"
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_snapshot(api_common):
+    def __init__(self, callcmd):
+        super(api_snapshot, self).__init__(callcmd)
+
+
+# API: snapshot-n
+def call_snapshot_n(cmdline):
+    cmdstr = "snapshot-n"
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_snapshot_n(api_common):
+    def __init__(self, callcmd):
+        super(api_snapshot_n, self).__init__(callcmd)
+
+
+# API: start
+def call_start(cmdline):
+    cmdstr = "start "
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_start(api_common):
+    def __init__(self, callcmd):
+        super(api_start, self).__init__(callcmd)
+
+# API: start-n
+def call_start_n(cmdline):
+    cmdstr = "start-n "
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_start_n(api_common):
+    def __init__(self, callcmd):
+        super(api_start_n, self).__init__(callcmd)
+
+
+# API: stop
+def call_stop(cmdline):
+    cmdstr = "stop "
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_stop(api_common):
+    def __init__(self, callcmd):
+        super(api_stop, self).__init__(callcmd)
+
+
+# API: stop-n
+def call_stop_n(cmdline):
+    cmdstr = "stop-n "
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_stop_n(api_common):
+    def __init__(self, callcmd):
+        super(api_stop_n, self).__init__(callcmd)
+
+
+# API: submit
+def call_submit(cmdline):
+    cmdstr = "submit"
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_submit(api_common):
+    def __init__(self, callcmd):
+        super(api_submit, self).__init__(callcmd)
+
+
+# API: suspend
+def call_suspend(cmdline):
+    cmdstr = "suspend"
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_suspend(api_common):
+    def __init__(self, callcmd):
+        super(api_suspend, self).__init__(callcmd)
+
+
+# API: suspend-n
+def call_suspend_n(cmdline):
+    cmdstr = "suspend-n"
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_suspend_n(api_common):
+    def __init__(self, callcmd):
+        super(api_suspend_n, self).__init__(callcmd)
+
+
+# API: sysgen
+def call_sysgen(cmdline):
+    cmdstr = "sysgen"
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_sysgen(api_common):
+    def __init__(self, callcmd):
+        super(api_sysgen, self).__init__(callcmd)
+
+
+# API: sysgen-n
+def call_sysgen_n(cmdline):
+    cmdstr = "sysgen-n"
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_sysgen_n(api_common):
+    def __init__(self, callcmd):
+        super(api_sysgen_n, self).__init__(callcmd)
+
+
+# API: update
+def call_update(cmdline):
+    cmdstr = "update"
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_update(api_common):
+    def __init__(self, callcmd):
+        super(api_update, self).__init__(callcmd)
+
+
+# API: version
+def call_version(cmdline):
+    cmdstr = "version"
+    for str in cmdline:
+        cmdstr = cmdstr + " " + str
+    print cmdstr
+    return cmdstr
+
+class api_version(api_common):
+    def __init__(self, callcmd):
+        super(api_version, self).__init__(callcmd)
+
+
+
 
index 514da91..2737f0b 100755 (executable)
@@ -49,10 +49,33 @@ path_dirs = { \
 '/lxcfv1/helpcmd':api_common.api_helpcmd(api_common.call_helpcmd), \
 '/lxcfv1/list':api_common.api_list(api_common.call_list), \
 '/lxcfv1/log':api_common.api_log(api_common.call_log), \
+'/lxcfv1/memlimit':api_common.api_memlimit(api_common.call_memlimit), \
+'/lxcfv1/memswlimit':api_common.api_memswlimit(api_common.call_memswlimit), \
+'/lxcfv1/net_cls':api_common.api_net_cls(api_common.call_net_cls), \
+'/lxcfv1/numa':api_common.api_numa(api_common.call_numa), \
+'/lxcfv1/q':api_common.api_q(api_common.call_q), \
+'/lxcfv1/queue':api_common.api_queue(api_common.call_queue), \
+'/lxcfv1/reboot':api_common.api_reboot(api_common.call_reboot), \
+'/lxcfv1/rename':api_common.api_rename(api_common.call_rename), \
+'/lxcfv1/restore':api_common.api_restore(api_common.call_restore), \
+'/lxcfv1/resume':api_common.api_resume(api_common.call_resume), \
+'/lxcfv1/resume-n':api_common.api_resume_n(api_common.call_resume_n), \
+'/lxcfv1/set':api_common.api_set(api_common.call_set), \
+'/lxcfv1/set-n':api_common.api_set_n(api_common.call_set_n), \
+'/lxcfv1/show':api_common.api_show(api_common.call_show), \
+'/lxcfv1/snapshot':api_common.api_snapshot(api_common.call_snapshot), \
+'/lxcfv1/snapshot-n':api_common.api_snapshot_n(api_common.call_snapshot_n), \
 '/lxcfv1/start':api_common.api_start(api_common.call_start), \
+'/lxcfv1/start-n':api_common.api_start_n(api_common.call_start_n), \
 '/lxcfv1/stop':api_common.api_stop(api_common.call_stop), \
+'/lxcfv1/stop-n':api_common.api_stop_n(api_common.call_stop_n), \
+'/lxcfv1/submit':api_common.api_submit(api_common.call_submit), \
+'/lxcfv1/suspend':api_common.api_suspend(api_common.call_suspend), \
+'/lxcfv1/suspend-n':api_common.api_suspend_n(api_common.call_suspend_n), \
 '/lxcfv1/sysgen':api_common.api_sysgen(api_common.call_sysgen), \
-'/lxcfv1/show':api_common.api_show(api_common.call_show), \
+'/lxcfv1/sysgen-n':api_common.api_sysgen_n(api_common.call_sysgen_n), \
+'/lxcfv1/update':api_common.api_update(api_common.call_update), \
+'/lxcfv1/version':api_common.api_version(api_common.call_version), \
 }
 
 class ThreadingWsgiServer(ThreadingMixIn, WSGIServer):