Show boot device in Node Details/Configuration
Partial-Bug: #1671567 Change-Id: I3208dde3e47477e42f4ce59d8c65e8d5049d0c0e
This commit is contained in:
parent
a4c89967d8
commit
18e6379814
@ -190,6 +190,18 @@ def node_validate(request, node_id):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def node_get_boot_device(request, node_id):
|
||||||
|
"""Get the boot device for a specified node.
|
||||||
|
|
||||||
|
:param request: HTTP request.
|
||||||
|
:param node_id: The id of the node.
|
||||||
|
:return: Dictionary with keys "boot_device" and "persistent"
|
||||||
|
|
||||||
|
http://docs.openstack.org/developer/python-ironicclient/api/ironicclient.v1.node.html#ironicclient.v1.node.NodeManager.get_boot_device
|
||||||
|
"""
|
||||||
|
return ironicclient(request).node.get_boot_device(node_id)
|
||||||
|
|
||||||
|
|
||||||
def driver_list(request):
|
def driver_list(request):
|
||||||
"""Retrieve a list of drivers.
|
"""Retrieve a list of drivers.
|
||||||
|
|
||||||
|
@ -224,6 +224,22 @@ class Validate(generic.View):
|
|||||||
return ironic.node_validate(request, node_id)
|
return ironic.node_validate(request, node_id)
|
||||||
|
|
||||||
|
|
||||||
|
@urls.register
|
||||||
|
class BootDevice(generic.View):
|
||||||
|
|
||||||
|
url_regex = r'ironic/nodes/(?P<node_id>[0-9a-f-]+)/boot_device$'
|
||||||
|
|
||||||
|
@rest_utils.ajax()
|
||||||
|
def get(self, request, node_id):
|
||||||
|
"""Get the boot device for a specified node
|
||||||
|
|
||||||
|
:param request: HTTP request.
|
||||||
|
:param node_id: Node name or uuid
|
||||||
|
:return: Dictionary with keys "boot_device" and "persistent"
|
||||||
|
"""
|
||||||
|
return ironic.node_get_boot_device(request, node_id)
|
||||||
|
|
||||||
|
|
||||||
@urls.register
|
@urls.register
|
||||||
class Drivers(generic.View):
|
class Drivers(generic.View):
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
getNode: getNode,
|
getNode: getNode,
|
||||||
getNodes: getNodes,
|
getNodes: getNodes,
|
||||||
getPortsWithNode: getPortsWithNode,
|
getPortsWithNode: getPortsWithNode,
|
||||||
|
getBootDevice: getBootDevice,
|
||||||
powerOffNode: powerOffNode,
|
powerOffNode: powerOffNode,
|
||||||
powerOnNode: powerOnNode,
|
powerOnNode: powerOnNode,
|
||||||
putNodeInMaintenanceMode: putNodeInMaintenanceMode,
|
putNodeInMaintenanceMode: putNodeInMaintenanceMode,
|
||||||
@ -111,6 +112,28 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description Retrieve the boot device for a node
|
||||||
|
* https://developer.openstack.org/api-ref/baremetal/#get-boot-device
|
||||||
|
*
|
||||||
|
* @param {string} uuid – UUID or logical name of a node.
|
||||||
|
* @return {promise} Dictionary describing the current boot device
|
||||||
|
*/
|
||||||
|
function getBootDevice(uuid) {
|
||||||
|
return apiService.get('/api/ironic/nodes/' + uuid + '/boot_device')
|
||||||
|
.then(function(response) {
|
||||||
|
return response.data;
|
||||||
|
})
|
||||||
|
.catch(function(response) {
|
||||||
|
var msg = interpolate(
|
||||||
|
gettext('Unable to retrieve boot device for Ironic node. %s'),
|
||||||
|
[response.data],
|
||||||
|
false);
|
||||||
|
toastService.add('error', msg);
|
||||||
|
return $q.reject(msg);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Retrieve a list of ports associated with a node.
|
* @description Retrieve a list of ports associated with a node.
|
||||||
*
|
*
|
||||||
|
@ -132,6 +132,7 @@
|
|||||||
ctrl.nodeStateTransitions =
|
ctrl.nodeStateTransitions =
|
||||||
nodeStateTransitionService.getTransitions(ctrl.node.provision_state);
|
nodeStateTransitionService.getTransitions(ctrl.node.provision_state);
|
||||||
retrievePorts();
|
retrievePorts();
|
||||||
|
retrieveBootDevice();
|
||||||
validateNode();
|
validateNode();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -164,6 +165,19 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name horizon.dashboard.admin.ironic.NodeDetailsController.retrieveBootDevice
|
||||||
|
* @description Retrieve the boot device associated with the current node,
|
||||||
|
* and store it in the controller instance.
|
||||||
|
*
|
||||||
|
* @return {void}
|
||||||
|
*/
|
||||||
|
function retrieveBootDevice() {
|
||||||
|
ironic.getBootDevice(ctrl.node.uuid).then(function (bootDevice) {
|
||||||
|
ctrl.node.bootDevice = bootDevice;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name horizon.dashboard.admin.ironic.NodeDetailsController.validateNode
|
* @name horizon.dashboard.admin.ironic.NodeDetailsController.validateNode
|
||||||
* @description Retrieve the ports associated with the current node,
|
* @description Retrieve the ports associated with the current node,
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
var nodeUuid = "0123abcd-0123-4567-abcd-0123456789ab";
|
var nodeUuid = "0123abcd-0123-4567-abcd-0123456789ab";
|
||||||
var nodeName = "herp";
|
var nodeName = "herp";
|
||||||
var numPorts = 2;
|
var numPorts = 2;
|
||||||
|
var bootDevice = {boot_device: 'pxe', persistent: true};
|
||||||
|
|
||||||
function portUuid(nodeUuid, index) {
|
function portUuid(nodeUuid, index) {
|
||||||
return '' + index + index + nodeUuid.substring(2);
|
return '' + index + index + nodeUuid.substring(2);
|
||||||
@ -66,6 +67,10 @@
|
|||||||
return $q.when(ports);
|
return $q.when(ports);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getBootDevice: function () {
|
||||||
|
return $q.when(bootDevice);
|
||||||
|
},
|
||||||
|
|
||||||
validateNode: function() {
|
validateNode: function() {
|
||||||
return $q.when({});
|
return $q.when({});
|
||||||
}
|
}
|
||||||
@ -125,6 +130,7 @@
|
|||||||
expect(ctrl.node).toBeDefined();
|
expect(ctrl.node).toBeDefined();
|
||||||
var node = createNode(nodeName, nodeUuid);
|
var node = createNode(nodeName, nodeUuid);
|
||||||
node.id = node.uuid;
|
node.id = node.uuid;
|
||||||
|
node.bootDevice = bootDevice;
|
||||||
expect(ctrl.node).toEqual(node);
|
expect(ctrl.node).toEqual(node);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -170,5 +176,10 @@
|
|||||||
expect(ctrl.nodeValidation).toBeDefined();
|
expect(ctrl.nodeValidation).toBeDefined();
|
||||||
expect(ctrl.nodeValidation).toEqual([]);
|
expect(ctrl.nodeValidation).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should have a boot device', function () {
|
||||||
|
expect(ctrl.node.bootDevice).toBeDefined();
|
||||||
|
expect(ctrl.node.bootDevice).toEqual(bootDevice);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
@ -267,6 +267,18 @@
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Boot Device -->
|
||||||
|
<div class="col-md-6 status detail">
|
||||||
|
<h4 translate>Boot Device</h4>
|
||||||
|
<hr class="header_rule">
|
||||||
|
<dl class="dl-horizontal">
|
||||||
|
<dt translate>Device</dt>
|
||||||
|
<dd>{$ ctrl.node.bootDevice.boot_device | noValue $}</dd>
|
||||||
|
<dt translate>Persistent</dt>
|
||||||
|
<dd>{$ ctrl.node.bootDevice.persistent | noValue $}</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
4
releasenotes/notes/bug-1671567-a95d7cb0d21470e4.yaml
Normal file
4
releasenotes/notes/bug-1671567-a95d7cb0d21470e4.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
The Node Details/Configuration tab now shows the node's boot device.
|
Loading…
x
Reference in New Issue
Block a user