Lee Yarwood has uploaded a new change for review. Change subject: PXE boot UI plugin. ......................................................................
PXE boot UI plugin. This sample plugin allows guests to be PXE booted without the use of the 'Run Once' option. Change-Id: I23264376bae9786bf9a3b291290f580bca7261c8 Signed-off-by: Lee Yarwood <lyarw...@redhat.com> --- A pxe-plugin/ui-vm-pxe-resouces/start.html A pxe-plugin/ui-vm-pxe.json 2 files changed, 52 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/samples-uiplugins refs/changes/98/15498/1 diff --git a/pxe-plugin/ui-vm-pxe-resouces/start.html b/pxe-plugin/ui-vm-pxe-resouces/start.html new file mode 100644 index 0000000..5134fc7 --- /dev/null +++ b/pxe-plugin/ui-vm-pxe-resouces/start.html @@ -0,0 +1,44 @@ +<!DOCTYPE html> +<html> +<head> +<script type='text/javascript'> + var api = parent.pluginApi('ui-vm-pxe'); + var conf = api.configObject(); + var session; + var baseurl; + + function apiPost(url, data) { + xmlhttp = new XMLHttpRequest(); + xmlhttp.open("POST", url, true); + xmlhttp.setRequestHeader('Content-Type', 'application/xml'); + xmlhttp.setRequestHeader('Prefer', 'persistent-auth'); + xmlhttp.setRequestHeader('cookie', 'JSESSIONID=' + session); + xmlhttp.send(data); + } + + function startVM(vms) { + for (var i=0; i<=vms.length ; i++) { + alert('PXE booting vm ' + vms[i].name); + data = "<action><vm><os><boot dev='network'/></os></vm></action>"; + apiPost(baseurl+'/vms/'+vms[i].id+'/start', data); + } + } + + api.register({ + UiInit: function() { + baseurl = conf.url; + api.addMainTabActionButton('VirtualMachine', 'PXE Boot', + { onClick: function() { startVM(arguments);}, + isEnabled: function() { return arguments.length >= 1;}, + location: 'OnlyFromContext' + }); + }, + RestApiSessionAcquired: function(sessionId) { + session = sessionId; + } + }); + api.ready(); +</script> +</head> +<body></body> +</html> diff --git a/pxe-plugin/ui-vm-pxe.json b/pxe-plugin/ui-vm-pxe.json new file mode 100644 index 0000000..074b76f --- /dev/null +++ b/pxe-plugin/ui-vm-pxe.json @@ -0,0 +1,8 @@ +{ + "name": "ui-vm-pxe", + "url": "/webadmin/webadmin/plugin/ui-vm-pxe/start.html", + "resourcePath": "ui-vm-pxe-resouces", + "config" : { + "url" : "https://engine.example.com/api" + } +} -- To view, visit http://gerrit.ovirt.org/15498 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I23264376bae9786bf9a3b291290f580bca7261c8 Gerrit-PatchSet: 1 Gerrit-Project: samples-uiplugins Gerrit-Branch: master Gerrit-Owner: Lee Yarwood <lyarw...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches