Change in vdsm[master]: grub2: expose via API

mpolednik at redhat.com mpolednik at redhat.com
Thu Dec 3 14:36:32 UTC 2015


Martin Polednik has uploaded a new change for review.

Change subject: grub2: expose via API
......................................................................

grub2: expose via API

Change-Id: I61eec50cf0923e2874ff1e8b8d90fa4380b8fdb2
Signed-off-by: Martin Polednik <mpolednik at redhat.com>
---
M lib/vdsm/define.py
M vdsm/API.py
M vdsm/rpc/Bridge.py
M vdsm/rpc/bindingxmlrpc.py
4 files changed, 25 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/56/49656/1

diff --git a/lib/vdsm/define.py b/lib/vdsm/define.py
index 0943939..777529a 100644
--- a/lib/vdsm/define.py
+++ b/lib/vdsm/define.py
@@ -193,6 +193,9 @@
     'destVolumeTooSmall': {'status': {
         'code': 79,
         'message': 'Destination volume is too small'}},
+    'grub2MkconfigErr': {'status': {
+        'code': 80,
+        'message': 'Failed to regenerate grub2 configuration'}},
     'recovery': {'status': {
         'code': 99,
         'message': 'Recovering from crash or Initializing'}},
diff --git a/vdsm/API.py b/vdsm/API.py
index 9936d1e..b3170b4 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -35,6 +35,7 @@
 from vdsm import utils
 from clientIF import clientIF
 from vdsm import constants
+from vdsm import grub2
 from vdsm import response
 from vdsm import supervdsm
 import storage.misc
@@ -1351,6 +1352,20 @@
         hostdev.change_numvfs(deviceName, numvfs)
         return {'status': doneCode}
 
+    def grub2ModifyCmdline(self, devices_add, devices_del, directives_add,
+                           directives_del):
+        grub2.add_to_stub(devices_add)
+        grub2.del_from_stub(devices_del)
+        grub2.add_to_cmdline(directives_add)
+        grub2.del_from_cmdline(directives_del)
+
+        try:
+            grub2.mkconfig()
+        except grub2.Error:
+            return errCode['grub2MkconfigErr']
+
+        return {'status': doneCode}
+
     def getStats(self):
         """
         Report host statistics.
diff --git a/vdsm/rpc/Bridge.py b/vdsm/rpc/Bridge.py
index 1d8f1a0..b2d3a1d 100644
--- a/vdsm/rpc/Bridge.py
+++ b/vdsm/rpc/Bridge.py
@@ -422,6 +422,7 @@
     'Host_getStorageRepoStats': {'ret': Host_getStorageRepoStats_Ret},
     'Host_hostdevListByCaps': {'ret': 'deviceList'},
     'Host_hostdevChangeNumvfs': {},
+    'Host_grub2ModifyCmdline': {},
     'Host_startMonitoringDomain': {},
     'Host_stopMonitoringDomain': {},
     'Host_getVMList': {'call': Host_getVMList_Call, 'ret': 'vmList'},
diff --git a/vdsm/rpc/bindingxmlrpc.py b/vdsm/rpc/bindingxmlrpc.py
index d449132..8f22319 100644
--- a/vdsm/rpc/bindingxmlrpc.py
+++ b/vdsm/rpc/bindingxmlrpc.py
@@ -540,6 +540,12 @@
         api = API.Global()
         return api.hostdevChangeNumvfs(device_name, numvfs)
 
+    def grub2ModifyCmdline(self, devices_add, devices_del, directives_add,
+                           directives_del):
+        api = API.Global()
+        return api.grub2ModifyCmdline(self, devices_add, devices_del,
+                                      directives_add, directives_del)
+
     def vmGetIoTunePolicy(self, vmId):
         vm = API.VM(vmId)
         return vm.getIoTunePolicy()


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I61eec50cf0923e2874ff1e8b8d90fa4380b8fdb2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik at redhat.com>


More information about the vdsm-patches mailing list