Irit Goihman has uploaded a new change for review.
Change subject: wip: jsonrpc: introduce new cli
..
wip: jsonrpc: introduce new cli
Change-Id: Idd45d7e88bf2246beaf30550b12201917f32c354
Signed-off-by: Irit goihman
---
M lib/vdsm/Makefile.am
A lib/vdsm/jsonrpccli.py
M vdsm.spec.in
3 files changed, 200 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/02/64502/1
diff --git a/lib/vdsm/Makefile.am b/lib/vdsm/Makefile.am
index d248d30..1022380 100644
--- a/lib/vdsm/Makefile.am
+++ b/lib/vdsm/Makefile.am
@@ -35,6 +35,7 @@
hooks.py \
hostdev.py \
jobs.py \
+ jsonrpccli.py \
jsonrpcvdscli.py \
kaxmlrpclib.py \
libvirtconnection.py \
diff --git a/lib/vdsm/jsonrpccli.py b/lib/vdsm/jsonrpccli.py
new file mode 100644
index 000..13d4d55
--- /dev/null
+++ b/lib/vdsm/jsonrpccli.py
@@ -0,0 +1,198 @@
+#
+# Copyright 2016 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+
+from __future__ import absolute_import
+
+from functools import partial
+from uuid import uuid4
+
+from yajsonrpc import stompreactor
+from yajsonrpc import \
+JsonRpcRequest, \
+JsonRpcNoResponseError, \
+CALL_TIMEOUT
+
+from api import vdsmapi
+from .config import config
+
+
+_COMMAND_CONVERTER = {
+'activateStorageDomain': 'StorageDomain.activate',
+'connectStoragePool': 'StoragePool.connect',
+'connectStorageServer': 'StoragePool.connectStorageServer',
+'cont': 'VM.cont',
+'clearTask': 'Task.clear',
+'create': 'VM.create',
+'createStorageDomain': 'StorageDomain.create',
+'createStoragePool': 'StoragePool.create',
+'createVG': 'LVMVolumeGroup.create',
+'createVolume': 'Volume.create',
+'destroy': 'VM.destroy',
+'destroyStoragePool': 'StoragePool.destroy',
+'detachStorageDomain': 'StorageDomain.detach',
+'disconnectStoragePool': 'StoragePool.disconnect',
+'disconnectStorageServer': 'StoragePool.disconnectStorageServer',
+'discoverSendTargets': 'ISCSIConnection.discoverSendTargets',
+'extendVolumeSize': 'Volume.extendSize',
+'formatStorageDomain': 'StorageDomain.format',
+'fullList': 'Host.getVMFullList',
+'getAllTasksInfo': 'Host.getAllTasksInfo',
+'getAllTasksStatuses': 'Host.getAllTasksStatuses',
+'getAllVmStats': 'Host.getAllVmStats',
+'getConnectedStoragePoolsList': 'Host.getConnectedStoragePools',
+'getDeviceList': 'Host.getDeviceList',
+'getImagesList': 'StorageDomain.getImages',
+'getIoTunePolicy': 'VM.getIoTunePolicy',
+'getIoTune': 'VM.getIoTune',
+'getSpmStatus': 'StoragePool.getSpmStatus',
+'getStorageDomainInfo': 'StorageDomain.getInfo',
+'getStorageDomainsList': 'Host.getStorageDomains',
+'getStorageDomainStats': 'StorageDomain.getStats',
+'getStoragePoolInfo': 'StoragePool.getInfo',
+'getTaskInfo': 'Task.getInfo',
+'getTaskStatus': 'Task.getStatus',
+'getVdsCapabilities': 'Host.getCapabilities',
+'getVdsHardwareInfo': 'Host.getHardwareInfo',
+'getVdsStats': 'Host.getStats',
+'getVGInfo': 'LVMVolumeGroup.getInfo',
+'getVolumeInfo': 'Volume.getInfo',
+'getVmStats': 'VM.getStats',
+'getVolumeSize': 'Volume.getSize',
+'getVolumesList': 'StorageDomain.getVolumes',
+'glusterTasksList': 'GlusterTask.list',
+'glusterVolumeCreate': 'GlusterVolume.create',
+'glusterVolumeSet': 'GlusterVolume.set',
+'glusterVolumesList': 'GlusterVolume.list',
+'glusterVolumeStart': 'GlusterVolume.start',
+'glusterTasksList': 'GlusterTask.list',
+'hotplugDisk': 'VM.hotplugDisk',
+'hotplugNic': 'VM.hotplugNic',
+'hotunplugDisk': 'VM.hotunplugDisk',
+'hotunplugNic': 'VM.hotunplugNic',
+'list': 'Host.getVMList',
+'migrate': 'VM.migrate',
+'migrateStatus': 'VM.getMigrationStatus',
+'migrationCreate': 'VM.migrationCreate',
+'ping': 'Host.ping',
+'prepareImage': 'Image.prepare',
+'repoStats': 'Host.getStorageRepoStats',
+'setBalloonTarget': 'VM.setBalloonTarget',
+'setCpuTunePeriod': 'VM.setCpuTunePeriod',
+'setCpuTuneQuota': 'VM.setCpuTuneQuota',
+'setKsmTune': 'Host.setKsmTune',
+'setMOMPoli