From 8fafc892d39f132bc25292ba6f6f4909c64aa8c1 Mon Sep 17 00:00:00 2001 From: Kris McQueen Date: Tue, 26 Oct 2010 14:55:27 -0700 Subject: [PATCH 1/4] bug 6730: if a volume was never attached to a VM, then the poolId will be null and this will be flagged as not on shared storage. Since the code was deleting detached volumes only on shared storage, the never-attached volume was in an undeletable state. Instead, allow deletion of any detached volume, regardless of storage pool until some technical reason limits this from happening. Also, the UI was not allowing volumes to be deleted due to a bug in looking at the vmname property of the volume. The 'if' conditional always returned true that the volume was attached to a VM to due a boolean logic error. status 6730: resolved fixed --- server/src/com/cloud/storage/StorageManagerImpl.java | 9 ++++++--- ui/scripts/cloud.core.storage.js | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java index 842e0330602..047ca9fb469 100755 --- a/server/src/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/com/cloud/storage/StorageManagerImpl.java @@ -2487,9 +2487,12 @@ public class StorageManagerImpl implements StorageManager { // Check that the volume is stored on shared storage - if (!volumeOnSharedStoragePool(volume)) { - throw new InvalidParameterValueException("Please specify a volume that has been created on a shared storage pool."); - } + // NOTE: We used to ensure the volume is on shared storage before deleting. However, this seems like an unnecessary check since all we allow + // is deleting a detached volume. Is there a technical reason why the volume has to be on shared storage? If so, uncomment this...otherwise, + // just delete the detached volume regardless of storage pool. +// if (!volumeOnSharedStoragePool(volume)) { +// throw new InvalidParameterValueException("Please specify a volume that has been created on a shared storage pool."); +// } // Check that the volume is not currently attached to any VM if (volume.getInstanceId() != null) { diff --git a/ui/scripts/cloud.core.storage.js b/ui/scripts/cloud.core.storage.js index 580b03046d8..10ca6570729 100644 --- a/ui/scripts/cloud.core.storage.js +++ b/ui/scripts/cloud.core.storage.js @@ -959,7 +959,7 @@ function showStorageTab(domainId, targetTab) { switch (linkAction) { case "volume_action_delete" : //check if this volume is attached to a virtual machine. If yes, can't be deleted. - if(vmname != null && (vmname != "" || vmname != "none")) { + if(vmname != null && vmname != "" && vmname != "none") { $("#dialog_alert").html("

This volume is attached to virtual machine " + vmname + " and can't be deleted.

") $("#dialog_alert").dialog("open"); return; From 56509fe1f1cfa151612802a09eefb210e3325333 Mon Sep 17 00:00:00 2001 From: NIKITA Date: Tue, 26 Oct 2010 15:04:01 -0700 Subject: [PATCH 2/4] Midmenu blank msg box --- ui/new/css/main.css | 22 +++++++++++++++++++++- ui/new/images/midmenu_emptymsg.gif | Bin 0 -> 215 bytes ui/new/index.jsp | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 ui/new/images/midmenu_emptymsg.gif diff --git a/ui/new/css/main.css b/ui/new/css/main.css index 81e4e53561b..3563d418fbe 100644 --- a/ui/new/css/main.css +++ b/ui/new/css/main.css @@ -2006,6 +2006,7 @@ a:hover.search_button { height:auto; float:left; text-align:left; + background:#FFF url(../images/midmenu_hover.gif) repeat-x top left; color:#CCC; font-size:11px; font-weight:normal; @@ -2251,6 +2252,25 @@ a:hover.search_button { color:#999; } +.midmenu_emptymsgbox { + width:220px; + height:auto; + float:left; + background:#d4d4d4 url(../images/midmenu_emptymsg.gif) repeat-x top left; + margin:0 0 0 0; + padding:0; +} + +.midmenu_emptymsgbox p{ + width:200px; + height:auto; + float:left; + color:#666; + font-size:11px; + font-weight:normal; + margin:0 0 0 0; + padding:0; +} .main_contentarea_with_midmenu { width:auto; @@ -3067,7 +3087,7 @@ a:hover.search_button { height:auto; float:left; position:absolute; - background:#FFF url(../images/midmenu_hover.gif) repeat top left; + background:#FFF repeat top left; border:1px solid #CCC; top:18px; right:1px; diff --git a/ui/new/images/midmenu_emptymsg.gif b/ui/new/images/midmenu_emptymsg.gif new file mode 100644 index 0000000000000000000000000000000000000000..d668944b8c8f602917db6a5fe00587b865dd623f GIT binary patch literal 215 zcmZ?wbhEHbVQa)oeZoY4;1^JWX#Fv63ThK z%}3{aQPTY%Z{O6McRsMdKtn^S|5#(u$r!PD7c{;&u8mqfaZTCk+=~4V^pkw_CNsa- fVzoA7_x*RRHGcD%-~HHAcmDnF{|${ziVW5ORcB&+ literal 0 HcmV?d00001 diff --git a/ui/new/index.jsp b/ui/new/index.jsp index bee9823d813..e91278a55f5 100644 --- a/ui/new/index.jsp +++ b/ui/new/index.jsp @@ -316,7 +316,7 @@ long milliseconds = new Date().getTime();
- +

No Items Available

From 2ed93a406cb9ea82dc6ed09fd1161bfff9d17226 Mon Sep 17 00:00:00 2001 From: will Date: Tue, 26 Oct 2010 15:15:10 -0700 Subject: [PATCH 3/4] Fixing second level navigation for instance menu --- ui/new/index.jsp | 45 +++++++++ ui/new/scripts/cloud.core2.init.js | 123 +++++++++++++------------ ui/new/scripts/cloud.core2.instance.js | 16 +--- 3 files changed, 114 insertions(+), 70 deletions(-) diff --git a/ui/new/index.jsp b/ui/new/index.jsp index bee9823d813..38bb2f0e4f5 100644 --- a/ui/new/index.jsp +++ b/ui/new/index.jsp @@ -346,6 +346,51 @@ long milliseconds = new Date().getTime(); diff --git a/ui/new/scripts/cloud.core2.init.js b/ui/new/scripts/cloud.core2.init.js index b0e6634c457..47cde4c539c 100644 --- a/ui/new/scripts/cloud.core2.init.js +++ b/ui/new/scripts/cloud.core2.init.js @@ -64,66 +64,70 @@ $(document).ready(function() { }); // Setup 2nd level navigation + function buildSecondLevelNavigation() { - bindAndListMidMenuItems($("#leftmenu_event"), "listEvents", "listeventsresponse", "event", "jsp/event.jsp", afterLoadEventJSP, eventToMidmenu, eventToRightPanel, getMidmenuId, false); - bindAndListMidMenuItems($("#leftmenu_alert"), "listAlerts", "listalertsresponse", "alert", "jsp/alert.jsp", afterLoadAlertJSP, alertToMidmenu, alertToRightPanel, getMidmenuId, false); - bindAndListMidMenuItems($("#leftmenu_volume"), "listVolumes", "listvolumesresponse", "volume", "jsp/volume.jsp", afterLoadVolumeJSP, volumeToMidmenu, volumeToRightPanel, getMidmenuId, false); - bindAndListMidMenuItems($("#leftmenu_snapshot"), "listSnapshots", "listsnapshotsresponse", "snapshot", "jsp/snapshot.jsp", afterLoadSnapshotJSP, snapshotToMidmenu, snapshotToRightPanel, getMidmenuId, false); - bindAndListMidMenuItems($("#leftmenu_ip"), "listPublicIpAddresses", "listpublicipaddressesresponse", "publicipaddress", "jsp/ipaddress.jsp", afterLoadIpJSP, ipToMidmenu, ipToRightPanel, ipGetMidmenuId, false); - //bindAndListMidMenuItems("leftmenu_router", "listRouters", "listroutersresponse", "router", "jsp/router.jsp", afterLoadRouterJSP, routerToMidmenu, routerToRightPanel, getMidmenuId, false); - - bindAndListMidMenuItems($("#leftmenu_submenu_my_template"), "listTemplates&templatefilter=self", "listtemplatesresponse", "template", "jsp/template.jsp", afterLoadTemplateJSP, templateToMidmenu, templateToRightPanel, templateGetMidmenuId, false); - bindAndListMidMenuItems($("#leftmenu_submenu_featured_template"), "listTemplates&templatefilter=featured", "listtemplatesresponse", "template", "jsp/template.jsp", afterLoadTemplateJSP, templateToMidmenu, templateToRightPanel, templateGetMidmenuId, false); - bindAndListMidMenuItems($("#leftmenu_submenu_community_template"), "listTemplates&templatefilter=community", "listtemplatesresponse", "template", "jsp/template.jsp", afterLoadTemplateJSP, templateToMidmenu, templateToRightPanel, templateGetMidmenuId, false); - - bindAndListMidMenuItems($("#leftmenu_submenu_my_iso"), "listIsos&isofilter=self", "listisosresponse", "iso", "jsp/iso.jsp", afterLoadIsoJSP, isoToMidmenu, isoToRightPanel, isoGetMidmenuId, false); - bindAndListMidMenuItems($("#leftmenu_submenu_featured_iso"), "listIsos&isofilter=featured", "listisosresponse", "iso", "jsp/iso.jsp", afterLoadIsoJSP, isoToMidmenu, isoToRightPanel, isoGetMidmenuId, false); - bindAndListMidMenuItems($("#leftmenu_submenu_community_iso"), "listIsos&isofilter=community", "listisosresponse", "iso", "jsp/iso.jsp", afterLoadIsoJSP, isoToMidmenu, isoToRightPanel, isoGetMidmenuId, false); - - bindAndListMidMenuItems($("#leftmenu_service_offering"), "listServiceOfferings", "listserviceofferingsresponse", "serviceoffering", "jsp/serviceoffering.jsp", afterLoadServiceOfferingJSP, serviceOfferingToMidmenu, serviceOfferingToRightPanel, getMidmenuId, false); - bindAndListMidMenuItems($("#leftmenu_disk_offering"), "listDiskOfferings", "listdiskofferingsresponse", "diskoffering", "jsp/diskoffering.jsp", afterLoadDiskOfferingJSP, diskOfferingToMidmenu, diskOfferingToRightPanel, getMidmenuId, false); - bindAndListMidMenuItems($("#leftmenu_global_setting"), "listConfigurations", "listconfigurationsresponse", "configuration", "jsp/globalsetting.jsp", afterLoadGlobalSettingJSP, globalSettingToMidmenu, globalSettingToRightPanel, globalSettingGetMidmenuId, false); - - $("#leftmenu_instances").bind("click", function(event) { - selectLeftMenu($(this), true); - instanceBuildSubMenu(); - return false; - }); - - $("#leftmenu_domain").bind("click", function(event) { - selectLeftMenu($(this), true); - hideMiddleMenu(); - disableMultipleSelectionInMidMenu(); - clearMiddleMenu(); - - bindEventHandlerToDomainTreeNode(); - refreshWholeTree(g_domainid, defaultRootLevel); - - return false; - }); - - $("#leftmenu_resource").bind("click", function(event) { - showMiddleMenu(); - disableMultipleSelectionInMidMenu(); - clearMiddleMenu(); - - $arrowIcon = $(this).find("#resource_arrow"); - if($arrowIcon.hasClass("expanded_close") == true) { - $arrowIcon.removeClass("expanded_close").addClass("expanded_open"); - buildZoneTree(); - } else { - $arrowIcon.removeClass("expanded_open").addClass("expanded_close"); - $("#leftmenu_zone_tree").find("#tree_container").empty(); - } + // Instance sub menus + bindAndListMidMenuItems($("#leftmenu_instances_my_instances"), "listVirtualMachines&domainid="+g_domainid+"&account="+g_account, "listvirtualmachinesresponse", "virtualmachine", "jsp/instance.jsp", afterLoadInstanceJSP, vmToMidmenu, vmToRightPanel, getMidmenuId, true); + bindAndListMidMenuItems($("#leftmenu_instances_all_instances"), "listVirtualMachines", "listvirtualmachinesresponse", "virtualmachine", "jsp/instance.jsp", afterLoadInstanceJSP, vmToMidmenu, vmToRightPanel, getMidmenuId, true); + bindAndListMidMenuItems($("#leftmenu_instances_running_instances"), "listVirtualMachines&state=Running", "listvirtualmachinesresponse", "virtualmachine", "jsp/instance.jsp", afterLoadInstanceJSP, vmToMidmenu, vmToRightPanel, getMidmenuId, true); + bindAndListMidMenuItems($("#leftmenu_instances_stopped_instances"), "listVirtualMachines&state=Stopped", "listvirtualmachinesresponse", "virtualmachine", "jsp/instance.jsp", afterLoadInstanceJSP, vmToMidmenu, vmToRightPanel, getMidmenuId, true); + bindAndListMidMenuItems($("#leftmenu_instances_destroyed_instances"), "listVirtualMachines&state=Destroyed", "listvirtualmachinesresponse", "virtualmachine", "jsp/instance.jsp", afterLoadInstanceJSP, vmToMidmenu, vmToRightPanel, getMidmenuId, true); - showPage($("#resource_page"), null); - return false; - }); - - - - - + bindAndListMidMenuItems($("#leftmenu_event"), "listEvents", "listeventsresponse", "event", "jsp/event.jsp", afterLoadEventJSP, eventToMidmenu, eventToRightPanel, getMidmenuId, false); + bindAndListMidMenuItems($("#leftmenu_alert"), "listAlerts", "listalertsresponse", "alert", "jsp/alert.jsp", afterLoadAlertJSP, alertToMidmenu, alertToRightPanel, getMidmenuId, false); + bindAndListMidMenuItems($("#leftmenu_volume"), "listVolumes", "listvolumesresponse", "volume", "jsp/volume.jsp", afterLoadVolumeJSP, volumeToMidmenu, volumeToRightPanel, getMidmenuId, false); + bindAndListMidMenuItems($("#leftmenu_snapshot"), "listSnapshots", "listsnapshotsresponse", "snapshot", "jsp/snapshot.jsp", afterLoadSnapshotJSP, snapshotToMidmenu, snapshotToRightPanel, getMidmenuId, false); + bindAndListMidMenuItems($("#leftmenu_ip"), "listPublicIpAddresses", "listpublicipaddressesresponse", "publicipaddress", "jsp/ipaddress.jsp", afterLoadIpJSP, ipToMidmenu, ipToRightPanel, ipGetMidmenuId, false); + //bindAndListMidMenuItems("leftmenu_router", "listRouters", "listroutersresponse", "router", "jsp/router.jsp", afterLoadRouterJSP, routerToMidmenu, routerToRightPanel, getMidmenuId, false); + + bindAndListMidMenuItems($("#leftmenu_submenu_my_template"), "listTemplates&templatefilter=self", "listtemplatesresponse", "template", "jsp/template.jsp", afterLoadTemplateJSP, templateToMidmenu, templateToRightPanel, templateGetMidmenuId, false); + bindAndListMidMenuItems($("#leftmenu_submenu_featured_template"), "listTemplates&templatefilter=featured", "listtemplatesresponse", "template", "jsp/template.jsp", afterLoadTemplateJSP, templateToMidmenu, templateToRightPanel, templateGetMidmenuId, false); + bindAndListMidMenuItems($("#leftmenu_submenu_community_template"), "listTemplates&templatefilter=community", "listtemplatesresponse", "template", "jsp/template.jsp", afterLoadTemplateJSP, templateToMidmenu, templateToRightPanel, templateGetMidmenuId, false); + + bindAndListMidMenuItems($("#leftmenu_submenu_my_iso"), "listIsos&isofilter=self", "listisosresponse", "iso", "jsp/iso.jsp", afterLoadIsoJSP, isoToMidmenu, isoToRightPanel, isoGetMidmenuId, false); + bindAndListMidMenuItems($("#leftmenu_submenu_featured_iso"), "listIsos&isofilter=featured", "listisosresponse", "iso", "jsp/iso.jsp", afterLoadIsoJSP, isoToMidmenu, isoToRightPanel, isoGetMidmenuId, false); + bindAndListMidMenuItems($("#leftmenu_submenu_community_iso"), "listIsos&isofilter=community", "listisosresponse", "iso", "jsp/iso.jsp", afterLoadIsoJSP, isoToMidmenu, isoToRightPanel, isoGetMidmenuId, false); + + bindAndListMidMenuItems($("#leftmenu_service_offering"), "listServiceOfferings", "listserviceofferingsresponse", "serviceoffering", "jsp/serviceoffering.jsp", afterLoadServiceOfferingJSP, serviceOfferingToMidmenu, serviceOfferingToRightPanel, getMidmenuId, false); + bindAndListMidMenuItems($("#leftmenu_disk_offering"), "listDiskOfferings", "listdiskofferingsresponse", "diskoffering", "jsp/diskoffering.jsp", afterLoadDiskOfferingJSP, diskOfferingToMidmenu, diskOfferingToRightPanel, getMidmenuId, false); + bindAndListMidMenuItems($("#leftmenu_global_setting"), "listConfigurations", "listconfigurationsresponse", "configuration", "jsp/globalsetting.jsp", afterLoadGlobalSettingJSP, globalSettingToMidmenu, globalSettingToRightPanel, globalSettingGetMidmenuId, false); + + $("#leftmenu_instances").bind("click", function(event) { + instanceBuildSubMenu(); + selectLeftMenu($(this), true); + return false; + }); + + $("#leftmenu_domain").bind("click", function(event) { + selectLeftMenu($(this), true); + hideMiddleMenu(); + disableMultipleSelectionInMidMenu(); + clearMiddleMenu(); + + bindEventHandlerToDomainTreeNode(); + refreshWholeTree(g_domainid, defaultRootLevel); + + return false; + }); + + $("#leftmenu_resource").bind("click", function(event) { + showMiddleMenu(); + disableMultipleSelectionInMidMenu(); + clearMiddleMenu(); + + $arrowIcon = $(this).find("#resource_arrow"); + if($arrowIcon.hasClass("expanded_close") == true) { + $arrowIcon.removeClass("expanded_close").addClass("expanded_open"); + buildZoneTree(); + } else { + $arrowIcon.removeClass("expanded_open").addClass("expanded_close"); + $("#leftmenu_zone_tree").find("#tree_container").empty(); + } + + showPage($("#resource_page"), null); + return false; + }); + } $("#midmenu_action_link").bind("mouseover", function(event) { $(this).find("#action_menu").show(); @@ -347,6 +351,8 @@ $(document).ready(function() { $.cookie('directattacheduntaggedenabled', g_directAttachedUntaggedEnabled, { expires: 1}); $.cookie('systemvmuselocalstorage', g_systemVmUseLocalStorage, { expires: 1}); + buildSecondLevelNavigation(); + $("#main_username").text(g_username); $("#login_wrapper").hide(); $("#main").show(); @@ -450,6 +456,7 @@ $(document).ready(function() { dataType: "json", async: false, success: function(json) { + buildSecondLevelNavigation(); $("#main_username").text(g_username); $("#leftmenu_dashboard").click(); $("#main").show(); diff --git a/ui/new/scripts/cloud.core2.instance.js b/ui/new/scripts/cloud.core2.instance.js index 606d922d85d..4388d978aa1 100644 --- a/ui/new/scripts/cloud.core2.instance.js +++ b/ui/new/scripts/cloud.core2.instance.js @@ -18,19 +18,11 @@ var $instanceSubMenuContainer; function instanceBuildSubMenu() { - $instanceSubMenuContainer = $("#leftmenu_instance_expandedbox").empty(); - - if (isAdmin() || isDomainAdmin()) { - instanceBuildSubMenu2("My Instances", ("listVirtualMachines&domainid="+g_domainid+"&account="+g_account)); - instanceBuildSubMenu2("All Instances", "listVirtualMachines"); - instanceBuildSubMenu2("Running Instances", "listVirtualMachines&state=Running"); - instanceBuildSubMenu2("Stopped Instances", "listVirtualMachines&state=Stopped"); - instanceBuildSubMenu2("Destroyed Instances", "listVirtualMachines&state=Destroyed"); + if (isAdmin() || isDomainAdmin()) { + $("#leftmenu_instance_expandedbox").find("#leftmenu_instances_my_instances_container, #leftmenu_instances_all_instances_container, #leftmenu_instances_running_instances_container, #leftmenu_instances_stopped_instances_container, #leftmenu_instances_destroyed_instances_container ").show(); } - else if(isUser()) { - instanceBuildSubMenu2("All Instances", "listVirtualMachines"); - instanceBuildSubMenu2("Running Instances", "listVirtualMachines&state=Running"); - instanceBuildSubMenu2("Stopped Instances", "listVirtualMachines&state=Stopped"); + else if(isUser()) { + $("#leftmenu_instance_expandedbox").find("#leftmenu_instances_all_instances_container, #leftmenu_instances_running_instances_container, #leftmenu_instances_stopped_instances_container").show(); $.ajax({ cache: false, data: createURL("command=listInstanceGroups"), From a6e897b539223a984734cb90b29b671c25601979 Mon Sep 17 00:00:00 2001 From: abhishek Date: Tue, 26 Oct 2010 15:17:25 -0700 Subject: [PATCH 4/4] changing the log level to debug for some messages --- .../cloud/agent/resource/consoleproxy/ConsoleProxyResource.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java b/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java index 7ae873581d8..fd45d25680d 100644 --- a/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java +++ b/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java @@ -120,7 +120,7 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe if (dirCreated) { if(s_logger.isDebugEnabled()) - s_logger.info("Directory: " + strDirectoy + " created"); + s_logger.debug("Directory: " + strDirectoy + " created"); //copy cert to the dir FileWriter fstream = new FileWriter("/etc/cloud/consoleproxy/cert/customcert"); BufferedWriter out = new BufferedWriter(fstream);