From 81a142374bebc0281f215b947cfa66cd4d2b3fda Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Tue, 24 Apr 2012 16:53:13 +0200 Subject: [PATCH 1/5] Fix occi-server script, +x is not required --- src/cloud/occi/bin/occi-server | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cloud/occi/bin/occi-server b/src/cloud/occi/bin/occi-server index e9615a2108..72625a1d61 100755 --- a/src/cloud/occi/bin/occi-server +++ b/src/cloud/occi/bin/occi-server @@ -54,7 +54,7 @@ setup() start() { - if [ ! -x "$OCCI_SERVER" ]; then + if [ ! -f "$OCCI_SERVER" ]; then echo "Cannot find $OCCI_SERVER." exit 1 fi From fda4161a6c6bc01eb3c9e9a6a898b8ed29113f44 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Mon, 23 Apr 2012 17:12:10 +0200 Subject: [PATCH 2/5] Sunstone: require image target when adding image to VM template. Autofill when attribute is present in image template. Include special input for target in image creation form. (cherry picked from commit c7721e814dac16b1f5d38e3ce603c854a060338f) --- src/sunstone/public/js/plugins/images-tab.js | 19 +++++++++++++++---- .../public/js/plugins/templates-tab.js | 11 ++++++----- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/sunstone/public/js/plugins/images-tab.js b/src/sunstone/public/js/plugins/images-tab.js index 4fe86d4051..d7a5ebe693 100644 --- a/src/sunstone/public/js/plugins/images-tab.js +++ b/src/sunstone/public/js/plugins/images-tab.js @@ -36,6 +36,7 @@ var images_tab_content = '\ '+tr("Persistent")+'\ '+tr("Status")+'\ '+tr("#VMS")+'\ + '+tr("Target")+'\ \ \ \ @@ -108,6 +109,11 @@ var create_image_tmpl = \
'+tr("Specific image mapping driver. KVM: raw, qcow2. XEN: tap:aio, file:")+'
\ \ +
\ + \ + \ +
'+tr("Target on which the image will be mounted at. For example: hda, sdb...")+'
\ +
\ \
\
\ @@ -544,7 +550,8 @@ function imageElementArray(image_json){ parseInt(image.PERSISTENT) ? '' : '', OpenNebula.Helper.resource_state("image",image.STATE), - image.RUNNING_VMS + image.RUNNING_VMS, + image.TEMPLATE.TARGET ? image.TEMPLATE.TARGET : '--' ]; } @@ -899,6 +906,10 @@ function setupCreateImageDialog(){ if (driver.length) img_json["DRIVER"] = driver; + var target = $('#img_target',this).val(); + if (target) + img_json["TARGET"] = target; + switch ($('#src_path_select input:checked',this).val()){ case "path": path = $('#img_path',this).val(); @@ -1144,10 +1155,10 @@ $(document).ready(function(){ "aoColumnDefs": [ { "bSortable": false, "aTargets": ["check"] }, { "sWidth": "60px", "aTargets": [0,2,3,9,10] }, - { "sWidth": "35px", "aTargets": [1,6,11] }, + { "sWidth": "35px", "aTargets": [1,6,11,12] }, { "sWidth": "100px", "aTargets": [5,7] }, { "sWidth": "150px", "aTargets": [8] }, - { "bVisible": false, "aTargets": [6,8]} + { "bVisible": false, "aTargets": [6,8,12]} ], "oLanguage": (datatable_lang != "") ? { @@ -1158,7 +1169,7 @@ $(document).ready(function(){ dataTable_images.fnClearTable(); addElement([ spinner, - '','','','','','','','','','',''],dataTable_images); + '','','','','','','','','','','',''],dataTable_images); Sunstone.runAction("Image.list"); setupCreateImageDialog(); diff --git a/src/sunstone/public/js/plugins/templates-tab.js b/src/sunstone/public/js/plugins/templates-tab.js index 993f3980fb..8411a95bd8 100644 --- a/src/sunstone/public/js/plugins/templates-tab.js +++ b/src/sunstone/public/js/plugins/templates-tab.js @@ -208,7 +208,7 @@ var create_template_tmpl = '
\ \
'+tr("Type of disk device to emulate: ide, scsi")+'
\
\ -
\ +
\ \ \
'+tr("Device to map image disk. If set, it will overwrite the default device mapping")+'
\ @@ -1405,6 +1405,11 @@ function setupCreateTemplateDialog(){ $('#IMAGE', section_disks).change(function(){ var uname = getValue($(this).val(),4,2,dataTable_images); $('input#IMAGE_UNAME',section_disks).val(uname); + var target = getValue($(this).val(),4,12,dataTable_images); + if (target && target != "--") + $('input#TARGET',section_disks).val(target); + else + $('input#TARGET',section_disks).val(''); }); //Depending on adding a disk or a image we need to show/hide @@ -1420,16 +1425,12 @@ function setupCreateTemplateDialog(){ $('.add_image',section_disks).attr('disabled','disabled'); $('.add_disk',section_disks).show(); $('.add_disk',section_disks).removeAttr('disabled'); - $('#TARGET',section_disks).parent().removeClass(opt_class); - $('#TARGET',section_disks).parent().addClass(man_class); break; case "image": $('.add_disk',section_disks).hide(); $('.add_disk',section_disks).attr('disabled','disabled'); $('.add_image',section_disks).show(); $('.add_image',section_disks).removeAttr('disabled'); - $('#TARGET',section_disks).parent().removeClass(man_class); - $('#TARGET',section_disks).parent().addClass(opt_class); break; } $('#SIZE',section_disks).parent().hide(); From fda520349f381aaf6acbde9e684d363ae5661de5 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Tue, 24 Apr 2012 12:44:21 +0200 Subject: [PATCH 3/5] Feature #1218: add IP column to compute list in Selfservice (cherry picked from commit 5fcb907a9ecfc8b561f125dfe10a55e1b4e204f4) --- .../occi/lib/ui/public/js/plugins/compute.js | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/cloud/occi/lib/ui/public/js/plugins/compute.js b/src/cloud/occi/lib/ui/public/js/plugins/compute.js index cedf1210e1..2f405ad7c7 100644 --- a/src/cloud/occi/lib/ui/public/js/plugins/compute.js +++ b/src/cloud/occi/lib/ui/public/js/plugins/compute.js @@ -63,6 +63,7 @@ var vms_tab_content = '+tr("All")+'\ '+tr("ID")+'\ '+tr("Name")+' / '+tr("State")+'\ + '+tr("IP")+'\ \ \ \ @@ -397,6 +398,20 @@ function str_start_time(vm){ return pretty_time(vm.STIME); } +function ip_str(vm){ + var nic = vm.NIC; + var ip = '--'; + if ($.isArray(nic)) { + ip = ''; + $.each(nic, function(index,value){ + ip += value.IP+'
'; + }); + } else if (nic && nic.IP) { + ip = nic.IP; + }; + return ip; +}; + // Returns an array formed by the information contained in the vm_json // and ready to be introduced in a dataTable function vMachineElementArray(vm_json){ @@ -416,7 +431,8 @@ function vMachineElementArray(vm_json){ return [ '', id, - VMStateBulletStr(vm_json) + name + VMStateBulletStr(vm_json) + name, + ip_str(vm) ]; } @@ -454,7 +470,7 @@ function addVMachineElement(request,vm_json){ var id = vm_json.COMPUTE.ID; var element = vMachineElementArray(vm_json); addElement(element,dataTable_vMachines); - Sunstone.runAction("VM.showstate",id); + Sunstone.runAction("VM.show",id); } @@ -1097,6 +1113,7 @@ $(document).ready(function(){ { "bSortable": false, "aTargets": ["check"] }, { "sWidth": "60px", "aTargets": [0] }, { "sWidth": "35px", "aTargets": [1] }, + { "sWidth": "110px", "aTargets": [3] }, ], "oLanguage": (datatable_lang != "") ? { @@ -1107,7 +1124,7 @@ $(document).ready(function(){ dataTable_vMachines.fnClearTable(); addElement([ spinner, - '',''],dataTable_vMachines); + '','',''],dataTable_vMachines); Sunstone.runAction("VM.list"); //setupCreateVMDialog(); From 6fc7eac554362ddcfc5f0ee990e1f0cf5d838249 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Tue, 24 Apr 2012 11:45:27 +0200 Subject: [PATCH 4/5] Bug #1043: Prevent VNC dialog from closing with ESC key in Sunstone and SelfService (cherry picked from commit 889249a6af8a78bd43452042302b7bd3b4405e31) --- src/cloud/occi/lib/ui/public/js/plugins/compute.js | 1 + src/sunstone/public/js/plugins/vms-tab.js | 1 + 2 files changed, 2 insertions(+) diff --git a/src/cloud/occi/lib/ui/public/js/plugins/compute.js b/src/cloud/occi/lib/ui/public/js/plugins/compute.js index 2f405ad7c7..5b99c81c9f 100644 --- a/src/cloud/occi/lib/ui/public/js/plugins/compute.js +++ b/src/cloud/occi/lib/ui/public/js/plugins/compute.js @@ -1013,6 +1013,7 @@ function setupVNC(){ modal:true, height:500, resizable:true, + closeOnEscape: false }); $('#sendCtrlAltDelButton',dialog).click(function(){ diff --git a/src/sunstone/public/js/plugins/vms-tab.js b/src/sunstone/public/js/plugins/vms-tab.js index 8a936c904a..e4ec4f57d8 100644 --- a/src/sunstone/public/js/plugins/vms-tab.js +++ b/src/sunstone/public/js/plugins/vms-tab.js @@ -1300,6 +1300,7 @@ function setupVNC(){ modal:true, height:500, resizable:true, + closeOnEscape: false }); $('#sendCtrlAltDelButton',dialog).click(function(){ From e024d57def62684a4e0cb846a6753b9cb4bd4f67 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Wed, 25 Apr 2012 10:33:46 +0200 Subject: [PATCH 5/5] Fix watch_client filtering (cherry picked from commit 590ba0e4eb25c126d59d4df91646f10ec2a5ec6a) --- src/acct/watch_client.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/acct/watch_client.rb b/src/acct/watch_client.rb index 7a63251a48..c3da4289bf 100644 --- a/src/acct/watch_client.rb +++ b/src/acct/watch_client.rb @@ -154,7 +154,7 @@ module OneWatchClient if filter[:uid] filter[:uid]==0 ? (hosts = pool) : (return nil) elsif filter[:gid] - filter[:uid]==0 ? (hosts = pool) : (return nil) + filter[:gid]==0 ? (hosts = pool) : (return nil) else hosts = pool end