Change in vdsm[master]: Introducing getAvailableUpdates API

ybronhei at redhat.com ybronhei at redhat.com
Wed Mar 11 08:18:50 UTC 2015


Yaniv Bronhaim has uploaded a new change for review.

Change subject: Introducing getAvailableUpdates API
......................................................................

Introducing getAvailableUpdates API

This API returns list of available packages update.

Change-Id: I9d47d5395519fff4378ab7dd88b30c4766467427
Signed-off-by: Yaniv Bronhaim <ybronhei at redhat.com>
---
M client/vdsClient.py
M lib/vdsm/define.py
M vdsm/API.py
M vdsm/rpc/BindingXMLRPC.py
M vdsm/rpc/Bridge.py
M vdsm/rpc/vdsmapi-schema.json
6 files changed, 56 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/59/38559/1

diff --git a/client/vdsClient.py b/client/vdsClient.py
index 07dbaa2..4e426d7 100644
--- a/client/vdsClient.py
+++ b/client/vdsClient.py
@@ -529,6 +529,9 @@
     def do_getHardware(self, args):
         return self.ExecAndExit(self.s.getVdsHardwareInfo())
 
+    def do_getUpdates(self, args):
+        return self.ExecAndExit(self.s.getAvailableUpdates())
+
     def do_getVdsStats(self, args):
         return self.ExecAndExit(self.s.getVdsStats())
 
@@ -2177,6 +2180,10 @@
                                ('',
                                 'Get hardware info of the VDS'
                                 )),
+        'getAvailableUpdates': (self.do_getUpdates,
+                                ('',
+                                 'Get host available packages update'
+                                 )),
         'getVdsStats': (serv.do_getVdsStats,
                         ('',
                          'Get Statistics info on the VDS'
diff --git a/lib/vdsm/define.py b/lib/vdsm/define.py
index f725748..74be756 100644
--- a/lib/vdsm/define.py
+++ b/lib/vdsm/define.py
@@ -150,6 +150,9 @@
     'V2VConnection': {'status': {
         'code': 65,
         'message': 'error connecting to hypervisor'}},
+    'updateInfoErr': {'status': {
+        'code': 66,
+        'message': 'Failed to read update info'}},
     'recovery': {'status': {
         'code': 99,
         'message': 'Recovering from crash or Initializing'}},
diff --git a/vdsm/API.py b/vdsm/API.py
index 42c471e..4803b1f 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -1300,6 +1300,21 @@
             self.log.error("failed to retrieve hardware info", exc_info=True)
             return errCode['hwInfoErr']
 
+    def getAvailableUpdates(self):
+        """
+        Return list of available packages updates
+        """
+        try:
+            info = []
+            with open('/var/lib/vdsm/updates.list', 'r') as f:
+                for pkg in f:
+                    info.append(pkg)
+
+            return {'status': doneCode, 'info': info}
+        except:
+            self.log.error("failed to read update info", exc_info=True)
+            return errCode['updateInfoErr']
+
     def getAllVmStats(self):
         """
         Get statistics of all running VMs.
diff --git a/vdsm/rpc/BindingXMLRPC.py b/vdsm/rpc/BindingXMLRPC.py
index b01b661..9a917a7 100644
--- a/vdsm/rpc/BindingXMLRPC.py
+++ b/vdsm/rpc/BindingXMLRPC.py
@@ -478,6 +478,10 @@
         api = API.Global()
         return api.getHardwareInfo()
 
+    def getAvailableUpdates(self):
+        api = API.Global()
+        return api.getAvailableUpdates()
+
     def getStats(self):
         api = API.Global()
         return api.getStats()
@@ -998,6 +1002,7 @@
                 (self.getRoute, 'getRoute'),
                 (self.getCapabilities, 'getVdsCapabilities'),
                 (self.getHardwareInfo, 'getVdsHardwareInfo'),
+                (self.getAvailableUpdates, 'getAvailableUpdates'),
                 (self.diskGetAlignment, 'getDiskAlignment'),
                 (self.getStats, 'getVdsStats'),
                 (self.vmGetStats, 'getVmStats'),
diff --git a/vdsm/rpc/Bridge.py b/vdsm/rpc/Bridge.py
index 1d44b90..a2d2d4a 100644
--- a/vdsm/rpc/Bridge.py
+++ b/vdsm/rpc/Bridge.py
@@ -397,6 +397,7 @@
     'Host_fenceNode': {'ret': Host_fenceNode_Ret},
     'Host_getAllTasksInfo': {'ret': 'allTasksInfo'},
     'Host_getAllTasksStatuses': {'ret': 'allTasksStatus'},
+    'Host_getAvailableUpdates': {'ret': 'info'},
     'Host_getCapabilities': {'ret': Host_getCapabilities_Ret},
     'Host_getConnectedStoragePools': {'ret': 'poollist'},
     'Host_getDeviceList': {'ret': 'devList'},
diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index 1d919e8..ff7b2fa 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -1320,6 +1320,31 @@
  'returns': 'HardwareInformation'}
 
 ##
+# @PackageUpdateInfo:
+#
+# Package information
+#
+# @fullname: Package name and version.
+#
+# Since: 4.17.0
+##
+{'type': 'PackageUpdateInfo',
+ 'data': {'fullname': 'str'}}
+
+##
+# @Host.getAvailableUpdates:
+#
+# Get list of available packages update.
+#
+# Returns:
+# List of available updates
+#
+# Since: 4.17.0
+##
+{'command': {'class': 'Host', 'name': 'getAvailableUpdates'},
+ 'returns': ['PackageUpdateInfo']}
+
+##
 # @Host.getConnectedStoragePools:
 #
 # Get a list of all Storage Pools that are connected to this host.


-- 
To view, visit https://gerrit.ovirt.org/38559
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9d47d5395519fff4378ab7dd88b30c4766467427
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei at redhat.com>


More information about the vdsm-patches mailing list