Browse Source

Fix sriov-related methods

- Introduce new method for getting devops node based
  on nailgun node's id
- Add missing 'value' key to enabling sriov

Change-Id: I95b60c25eab97e8577a16481741a76db99207976
(cherry picked from commit 8d2ccd2d26)
changes/73/452173/1
Vladimir Khlyunev 2 years ago
parent
commit
f1d636e508
1 changed files with 13 additions and 3 deletions
  1. 13
    3
      fuelweb_test/models/fuel_web_client.py

+ 13
- 3
fuelweb_test/models/fuel_web_client.py View File

@@ -1216,6 +1216,17 @@ class FuelWebClient29(object):
1216 1216
         if nailgun_node:
1217 1217
             return self.get_devops_node_by_mac(nailgun_node['mac'])
1218 1218
 
1219
+    @logwrap
1220
+    def get_devops_node_by_nailgun_node_id(self, nailgun_node_id):
1221
+        """Return devops node by nailgun node id
1222
+
1223
+        :type nailgun_node_id: int
1224
+        :rtype: Node or None
1225
+        """
1226
+        nailgun_node = [node for node in self.client.list_nodes() if
1227
+                        node['id'] == nailgun_node_id].pop()
1228
+        return self.get_devops_node_by_mac(nailgun_node['mac'])
1229
+
1219 1230
     @logwrap
1220 1231
     def get_devops_node_by_nailgun_fqdn(self, fqdn):
1221 1232
         """Return devops node with nailgun fqdn
@@ -3159,8 +3170,7 @@ class FuelWebClient29(object):
3159 3170
     def check_sriov(self, nailgun_node_id):
3160 3171
         nailgun_node_ifaces = self.client.get_node_interfaces(
3161 3172
             nailgun_node_id)
3162
-        devops_node = self.get_devops_node_by_nailgun_node(
3163
-            nailgun_node_id)
3173
+        devops_node = self.get_devops_node_by_nailgun_node_id(nailgun_node_id)
3164 3174
         devops_sriov_macs = [i.mac_address for i in devops_node.interfaces
3165 3175
                              if 'sriov' in i.features]
3166 3176
         nailgun_sriov_nics = []
@@ -3194,7 +3204,7 @@ class FuelWebClient29(object):
3194 3204
                     'sriov']['sriov_totalvfs']
3195 3205
             else:
3196 3206
                 interface['attributes']['sriov']['enabled']['value'] = True
3197
-                interface['attributes']['sriov']['numvfs'] = \
3207
+                interface['attributes']['sriov']['numvfs']['value'] = \
3198 3208
                     interface['meta']['sriov']['totalvfs']
3199 3209
 
3200 3210
         self.client.put_node_interfaces(

Loading…
Cancel
Save