Petr Horáček has uploaded a new change for review.

Change subject: vdsClient: getRoute verb added
......................................................................

vdsClient: getRoute verb added

New verb in vdsClient `getRoute <ip>` returns name of the device
assigned to IP. It uses `ip route get <ip>`.

Change-Id: Ia060ced7e9b13b1c461898f24170c49feab4382b
Bug-Url: https://bugzilla.redhat.com/1117303
Signed-off-by: Petr Horáček <[email protected]>
---
M client/vdsClient.py
M vdsm/API.py
M vdsm/rpc/BindingXMLRPC.py
3 files changed, 21 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/15/32115/1

diff --git a/client/vdsClient.py b/client/vdsClient.py
index 35f4ca5..6a289e3 100644
--- a/client/vdsClient.py
+++ b/client/vdsClient.py
@@ -502,6 +502,10 @@
         print response['status']['message']
         sys.exit(response['status']['code'])
 
+    def do_getRoute(self, args):
+        ip = args[0]
+        return self.ExecAndExit(self.s.getRoute(ip))
+
     def do_getCap(self, args):
         return self.ExecAndExit(self.s.getVdsCapabilities())
 
@@ -2114,6 +2118,10 @@
                      ('<vmId> <key1> ...... <keyN>',
                       'Send the key sequence to the vm'
                       )),
+        'getRoute': (serv.do_getRoute,
+                     ('<ip>',
+                      'Get devices assigned on IP'
+                      )),
         'getVdsCapabilities': (serv.do_getCap,
                                ('',
                                 'Get Capabilities info of the VDS'
diff --git a/vdsm/API.py b/vdsm/API.py
index dceec2d..17be9c7 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -1250,6 +1250,14 @@
         updateTimestamp()
         return {'status': doneCode}
 
+    def getRoute(self, ip):
+        """
+        Return the name of the device leading to destination IP or the empty
+        string if none is found
+        """
+        device = netinfo.getRouteDeviceTo(ip)
+        return {'status': doneCode, 'info': {'device': device}}
+
     def getCapabilities(self):
         """
         Report host capabilities.
diff --git a/vdsm/rpc/BindingXMLRPC.py b/vdsm/rpc/BindingXMLRPC.py
index b6ddd1d..b955b7e 100644
--- a/vdsm/rpc/BindingXMLRPC.py
+++ b/vdsm/rpc/BindingXMLRPC.py
@@ -459,6 +459,10 @@
         vm = API.VM(vmId)
         return vm.setBalloonTarget(target)
 
+    def getRoute(self, ip):
+        api = API.Global()
+        return api.getRoute(ip)
+
     def getCapabilities(self):
         api = API.Global()
         ret = api.getCapabilities()
@@ -989,6 +993,7 @@
                 (self.vmMigrate, 'migrate'),
                 (self.vmGetMigrationStatus, 'migrateStatus'),
                 (self.vmMigrationCancel, 'migrateCancel'),
+                (self.getRoute, 'getRoute'),
                 (self.getCapabilities, 'getVdsCapabilities'),
                 (self.getHardwareInfo, 'getVdsHardwareInfo'),
                 (self.diskGetAlignment, 'getDiskAlignment'),


-- 
To view, visit http://gerrit.ovirt.org/32115
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia060ced7e9b13b1c461898f24170c49feab4382b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to