From 7b702595669138b81ad2a9a23d0d9df81c8c484b Mon Sep 17 00:00:00 2001 From: edison Date: Wed, 8 Sep 2010 11:04:18 -0700 Subject: [PATCH 01/10] Disallow sshd listening on public nic, for domR in dhcp server mode --- patches/systemvm/etc/init.d/seteth1 | 1 + 1 file changed, 1 insertion(+) diff --git a/patches/systemvm/etc/init.d/seteth1 b/patches/systemvm/etc/init.d/seteth1 index 0081e664930..32a0ad704f4 100755 --- a/patches/systemvm/etc/init.d/seteth1 +++ b/patches/systemvm/etc/init.d/seteth1 @@ -123,6 +123,7 @@ setup_dhcpsrvr() { echo "$ETH0_IP $NAME" >> /etc/hosts [ -f /etc/httpd/conf/httpd.conf ] && sed -i -e "s/^Listen.*$/Listen $ETH0_IP:80/" /etc/httpd/conf/httpd.conf [ -f /etc/httpd/conf.d/ssl.conf ] && mv /etc/httpd/conf.d/ssl.conf /etc/httpd/conf.d/ssl.conf.bak + [ -f /etc/ssh/sshd_config ] && sed -i -e "s/^[#]*ListenAddress.*$/ListenAddress $ETH1_IP/" /etc/ssh/sshd_config } setup_secstorage() { From b12b3bb827726563f747b88b3cc19d32fbcfe985 Mon Sep 17 00:00:00 2001 From: "Manuel Amador (Rudd-O)" Date: Wed, 8 Sep 2010 11:43:40 -0700 Subject: [PATCH 02/10] somebody forgot to remove networkUsage from the debian package manifests --- debian/cloud-agent-scripts.install | 1 - 1 file changed, 1 deletion(-) diff --git a/debian/cloud-agent-scripts.install b/debian/cloud-agent-scripts.install index e825669bf7b..eb0c1589ee0 100644 --- a/debian/cloud-agent-scripts.install +++ b/debian/cloud-agent-scripts.install @@ -12,7 +12,6 @@ /usr/lib/cloud/agent/scripts/vm/hypervisor/xenserver/id_rsa.cloud /usr/lib/cloud/agent/scripts/vm/hypervisor/xenserver/make_migratable.sh /usr/lib/cloud/agent/scripts/vm/hypervisor/xenserver/network_info.sh -/usr/lib/cloud/agent/scripts/vm/hypervisor/xenserver/networkUsage.sh /usr/lib/cloud/agent/scripts/vm/hypervisor/xenserver/setup_iscsi.sh /usr/lib/cloud/agent/scripts/vm/hypervisor/xenserver/setupxenserver.sh /usr/lib/cloud/agent/scripts/vm/hypervisor/xenserver/vmops From d4bed852c8bd83b69ce627ef382246c1f20840c8 Mon Sep 17 00:00:00 2001 From: abhishek Date: Wed, 8 Sep 2010 13:41:50 -0700 Subject: [PATCH 03/10] bug 6139: Now we can add the same sp again, once deleted. I removed the unique key constraint on the uuid, and am making the check to ensure uniqueness based on uuid in the java layer. status 6139: resolved fixed --- core/src/com/cloud/storage/dao/StoragePoolDao.java | 2 ++ core/src/com/cloud/storage/dao/StoragePoolDaoImpl.java | 8 ++++++++ server/src/com/cloud/storage/StorageManagerImpl.java | 10 +++++++++- setup/db/create-schema.sql | 2 +- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/core/src/com/cloud/storage/dao/StoragePoolDao.java b/core/src/com/cloud/storage/dao/StoragePoolDao.java index 104f282d1f2..85b5b33b40e 100644 --- a/core/src/com/cloud/storage/dao/StoragePoolDao.java +++ b/core/src/com/cloud/storage/dao/StoragePoolDao.java @@ -101,5 +101,7 @@ public interface StoragePoolDao extends GenericDao { List searchForStoragePoolDetails(long poolId, String value); long countBy(long podId, Status... statuses); + + List findIfDuplicatePoolsExistByUUID(String uuid); } diff --git a/core/src/com/cloud/storage/dao/StoragePoolDaoImpl.java b/core/src/com/cloud/storage/dao/StoragePoolDaoImpl.java index 700dfccccab..456019f6874 100644 --- a/core/src/com/cloud/storage/dao/StoragePoolDaoImpl.java +++ b/core/src/com/cloud/storage/dao/StoragePoolDaoImpl.java @@ -61,6 +61,7 @@ public class StoragePoolDaoImpl extends GenericDaoBase imp protected final SearchBuilder DeleteLvmSearch; protected final GenericSearchBuilder MaintenanceCountSearch; + protected final StoragePoolDetailsDao _detailsDao; private final String DetailsSqlPrefix = "SELECT storage_pool.* from storage_pool LEFT JOIN storage_pool_details ON storage_pool.id = storage_pool_details.pool_id WHERE storage_pool.data_center_id = ? and (storage_pool.pod_id = ? or storage_pool.pod_id is null) and ("; @@ -144,6 +145,13 @@ public class StoragePoolDaoImpl extends GenericDaoBase imp return findOneBy(sc); } + @Override + public List findIfDuplicatePoolsExistByUUID(String uuid) { + SearchCriteria sc = UUIDSearch.create(); + sc.setParameters("uuid", uuid); + return listActiveBy(sc); + } + @Override public List listByDataCenterId(long datacenterId) { diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java index 0b7ff4b675e..3f40bff1a38 100644 --- a/server/src/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/com/cloud/storage/StorageManagerImpl.java @@ -1364,7 +1364,7 @@ public class StorageManagerImpl implements StorageManager { } List pools = _storagePoolDao.listPoolByHostPath(storageHost, hostPath); - if (!pools.isEmpty()) { + if (!pools.isEmpty() && pools.get(0).getRemoved()==null) { Long oldPodId = pools.get(0).getPodId(); throw new ResourceInUseException("Storage pool " + uri + " already in use by another pod (id=" + oldPodId + ")", "StoragePool", uri.toASCIIString()); } @@ -1379,6 +1379,14 @@ public class StorageManagerImpl implements StorageManager { } long poolId = _storagePoolDao.getNextInSequence(Long.class, "id"); String uuid = UUID.nameUUIDFromBytes(new String(storageHost + hostPath).getBytes()).toString(); + + List spHandles = _storagePoolDao.findIfDuplicatePoolsExistByUUID(uuid); + if(spHandles!=null && spHandles.size()>0) + { + s_logger.debug("Another active pool with the same uuid already exists"); + throw new ResourceInUseException("Another active pool with the same uuid already exists"); + } + s_logger.debug("In createPool Setting poolId - " +poolId+ " uuid - " +uuid+ " zoneId - " +zoneId+ " podId - " +podId+ " poolName - " +poolName); pool.setId(poolId); pool.setUuid(uuid); diff --git a/setup/db/create-schema.sql b/setup/db/create-schema.sql index 183fbab2026..f2e6f8c6ed7 100755 --- a/setup/db/create-schema.sql +++ b/setup/db/create-schema.sql @@ -907,7 +907,7 @@ CREATE TABLE `cloud`.`load_balancer` ( CREATE TABLE `cloud`.`storage_pool` ( `id` bigint unsigned UNIQUE NOT NULL, `name` varchar(255) COMMENT 'should be NOT NULL', - `uuid` varchar(255) UNIQUE NOT NULL, + `uuid` varchar(255) NOT NULL, `pool_type` varchar(32) NOT NULL, `port` int unsigned NOT NULL, `data_center_id` bigint unsigned NOT NULL, From d92aea1d1f1f66a304570b103ed1c94d9edfd05f Mon Sep 17 00:00:00 2001 From: abhishek Date: Wed, 8 Sep 2010 13:46:48 -0700 Subject: [PATCH 04/10] bug 6139: A few more improvements to the sp code --- server/src/com/cloud/storage/StorageManagerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java index 3f40bff1a38..64391ce5cf8 100644 --- a/server/src/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/com/cloud/storage/StorageManagerImpl.java @@ -1364,7 +1364,7 @@ public class StorageManagerImpl implements StorageManager { } List pools = _storagePoolDao.listPoolByHostPath(storageHost, hostPath); - if (!pools.isEmpty() && pools.get(0).getRemoved()==null) { + if (!pools.isEmpty()) { Long oldPodId = pools.get(0).getPodId(); throw new ResourceInUseException("Storage pool " + uri + " already in use by another pod (id=" + oldPodId + ")", "StoragePool", uri.toASCIIString()); } From e8882803d4c8c551847fdfe1d42b0e7f40330041 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Wed, 8 Sep 2010 14:20:10 -0700 Subject: [PATCH 05/10] new UI - vm wizard - pass size parameter to deployvirtualmachine API if custom disk offering is selected. --- ui/new/jsp/tab_instance.jsp | 5 +- ui/new/scripts/cloud.core.instance.js | 68 +++++++++++---------------- 2 files changed, 30 insertions(+), 43 deletions(-) diff --git a/ui/new/jsp/tab_instance.jsp b/ui/new/jsp/tab_instance.jsp index 6f2e8bd021d..cb517b0079c 100644 --- a/ui/new/jsp/tab_instance.jsp +++ b/ui/new/jsp/tab_instance.jsp @@ -648,8 +648,9 @@ Custom: - - GB + + MB +
-
+
<%=t.t("Details")%>
-
+
<%=t.t("Volume")%>
-
+
<%=t.t("Statistics")%>
- -
-
-
-
+
Routers
Routers
-
-
-
+
Storage
System @@ -430,14 +432,14 @@
-
+
Network
IP Addresses
-
+
Network
Network Groups From 2642fe7a639fef03ff362b58a587a94bb6bb9416 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Wed, 8 Sep 2010 15:45:51 -0700 Subject: [PATCH 09/10] new UI - rename JSP files from tab_xxxxxxx.jsp to xxxxxxx.jsp --- ui/new/jsp/{tab_account.jsp => account.jsp} | 0 ui/new/jsp/{tab_alert.jsp => alert.jsp} | 0 ui/new/jsp/{tab_event.jsp => event.jsp} | 0 ui/new/jsp/{tab_instance.jsp => instance.jsp} | 0 ui/new/jsp/{tab_snapshot.jsp => snapshot.jsp} | 0 ui/new/jsp/{tab_volume.jsp => volume.jsp} | 0 ui/new/scripts/cloud.core.init.js | 10 +++++----- ui/new/scripts/cloud.core.instance.js | 2 +- 8 files changed, 6 insertions(+), 6 deletions(-) rename ui/new/jsp/{tab_account.jsp => account.jsp} (100%) rename ui/new/jsp/{tab_alert.jsp => alert.jsp} (100%) rename ui/new/jsp/{tab_event.jsp => event.jsp} (100%) rename ui/new/jsp/{tab_instance.jsp => instance.jsp} (100%) rename ui/new/jsp/{tab_snapshot.jsp => snapshot.jsp} (100%) rename ui/new/jsp/{tab_volume.jsp => volume.jsp} (100%) diff --git a/ui/new/jsp/tab_account.jsp b/ui/new/jsp/account.jsp similarity index 100% rename from ui/new/jsp/tab_account.jsp rename to ui/new/jsp/account.jsp diff --git a/ui/new/jsp/tab_alert.jsp b/ui/new/jsp/alert.jsp similarity index 100% rename from ui/new/jsp/tab_alert.jsp rename to ui/new/jsp/alert.jsp diff --git a/ui/new/jsp/tab_event.jsp b/ui/new/jsp/event.jsp similarity index 100% rename from ui/new/jsp/tab_event.jsp rename to ui/new/jsp/event.jsp diff --git a/ui/new/jsp/tab_instance.jsp b/ui/new/jsp/instance.jsp similarity index 100% rename from ui/new/jsp/tab_instance.jsp rename to ui/new/jsp/instance.jsp diff --git a/ui/new/jsp/tab_snapshot.jsp b/ui/new/jsp/snapshot.jsp similarity index 100% rename from ui/new/jsp/tab_snapshot.jsp rename to ui/new/jsp/snapshot.jsp diff --git a/ui/new/jsp/tab_volume.jsp b/ui/new/jsp/volume.jsp similarity index 100% rename from ui/new/jsp/tab_volume.jsp rename to ui/new/jsp/volume.jsp diff --git a/ui/new/scripts/cloud.core.init.js b/ui/new/scripts/cloud.core.init.js index 732adf89029..f3c551cac78 100755 --- a/ui/new/scripts/cloud.core.init.js +++ b/ui/new/scripts/cloud.core.init.js @@ -94,11 +94,11 @@ $(document).ready(function() { return false; }); } - listMidMenuItems("leftmenu_event", "listEvents", "listeventsresponse", "event", "description", "jsp/tab_event.jsp", loadEventToRigntPanelFn); - listMidMenuItems("leftmenu_alert", "listAlerts", "listalertsresponse", "alert", "description", "jsp/tab_alert.jsp", loadAlertToRigntPanelFn); - listMidMenuItems("leftmenu_account", "listAccounts", "listaccountsresponse", "account", "name", "jsp/tab_account.jsp", loadAccountToRigntPanelFn); - listMidMenuItems("leftmenu_volume", "listVolumes", "listvolumesresponse", "volume", "name", "jsp/tab_volume.jsp", loadVolumeToRigntPanelFn); - listMidMenuItems("leftmenu_snapshot", "listSnapshots", "listsnapshotsresponse", "snapshot", "name", "jsp/tab_snapshot.jsp", loadSnapshotToRigntPanelFn); + listMidMenuItems("leftmenu_event", "listEvents", "listeventsresponse", "event", "description", "jsp/event.jsp", loadEventToRigntPanelFn); + listMidMenuItems("leftmenu_alert", "listAlerts", "listalertsresponse", "alert", "description", "jsp/alert.jsp", loadAlertToRigntPanelFn); + listMidMenuItems("leftmenu_account", "listAccounts", "listaccountsresponse", "account", "name", "jsp/account.jsp", loadAccountToRigntPanelFn); + listMidMenuItems("leftmenu_volume", "listVolumes", "listvolumesresponse", "volume", "name", "jsp/volume.jsp", loadVolumeToRigntPanelFn); + listMidMenuItems("leftmenu_snapshot", "listSnapshots", "listsnapshotsresponse", "snapshot", "name", "jsp/snapshot.jsp", loadSnapshotToRigntPanelFn); diff --git a/ui/new/scripts/cloud.core.instance.js b/ui/new/scripts/cloud.core.instance.js index 1bbb17f7330..fc9834392d7 100755 --- a/ui/new/scripts/cloud.core.instance.js +++ b/ui/new/scripts/cloud.core.instance.js @@ -508,7 +508,7 @@ function clickInstanceGroupHeader($arrowIcon) { $instanceGroupContainer.empty(); } //***** VM Detail (end) ******************************************************************************** - $("#right_panel").load("jsp/tab_instance.jsp", function() { + $("#right_panel").load("jsp/instance.jsp", function() { $rightPanelHeader = $("#right_panel_header"); $rightPanelContent = $("#right_panel_content"); From e356e4e502d97ab1fdc830a57e884dc4ad77720d Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Wed, 8 Sep 2010 17:10:51 -0700 Subject: [PATCH 10/10] new UI - instance page - implement volume tab --- ui/new/jsp/instance.jsp | 49 ++++++++++++++++++++- ui/new/scripts/cloud.core.instance.js | 63 ++++++++++++++++++++++++--- 2 files changed, 103 insertions(+), 9 deletions(-) diff --git a/ui/new/jsp/instance.jsp b/ui/new/jsp/instance.jsp index 32a6350fd62..fd67c4f2f10 100644 --- a/ui/new/jsp/instance.jsp +++ b/ui/new/jsp/instance.jsp @@ -144,7 +144,8 @@ - +
+ + + \ No newline at end of file diff --git a/ui/new/scripts/cloud.core.instance.js b/ui/new/scripts/cloud.core.instance.js index fc9834392d7..928c8872524 100755 --- a/ui/new/scripts/cloud.core.instance.js +++ b/ui/new/scripts/cloud.core.instance.js @@ -368,10 +368,11 @@ function clickInstanceGroupHeader($arrowIcon) { $rightPanelContent.find("#iso").hide(); } - function vmMidmenuItemToRightPanel($t) { - if($t.find("#info_icon").css("display") != "none") { - $rightPanelContent.find("#after_action_info").text($t.data("afterActionInfo")); - if($t.find("#info_icon").hasClass("error")) + function vmMidmenuItemToRightPanel($midmenuItem) { + //details tab + if($midmenuItem.find("#info_icon").css("display") != "none") { + $rightPanelContent.find("#after_action_info").text($midmenuItem.data("afterActionInfo")); + if($midmenuItem.find("#info_icon").hasClass("error")) $rightPanelContent.find("#after_action_info_container").addClass("errorbox"); else $rightPanelContent.find("#after_action_info_container").removeClass("errorbox"); @@ -382,7 +383,7 @@ function clickInstanceGroupHeader($arrowIcon) { $rightPanelContent.find("#after_action_info_container").hide(); } - var jsonObj = $t.data("jsonObj"); + var jsonObj = $midmenuItem.data("jsonObj"); var vmName = getVmName(jsonObj.name, jsonObj.displayname); $rightPanelHeader.find("#vm_name").text(fromdb(vmName)); updateVirtualMachineStateInRightPanel(jsonObj.state); @@ -402,10 +403,58 @@ function clickInstanceGroupHeader($arrowIcon) { if(jsonObj.isoid != null && jsonObj.isoid.length > 0) $rightPanelContent.find("#iso").removeClass("cross_icon").addClass("tick_icon").show(); else - $rightPanelContent.find("#iso").removeClass("tick_icon").addClass("cross_icon").show(); + $rightPanelContent.find("#iso").removeClass("tick_icon").addClass("cross_icon").show(); + + //volume tab + //if (getHypervisorType() == "kvm") + //detail.find("#volume_action_create_template").show(); + $.ajax({ + cache: false, + data: createURL("command=listVolumes&virtualMachineId="+jsonObj.id+maxPageSize), + dataType: "json", + success: function(json) { + var items = json.listvolumesresponse.volume; + if (items != null && items.length > 0) { + var container = $rightPanelContent.find("#tab_content_volume").empty(); + var template = $("#volume_tab_template"); + for (var i = 0; i < items.length; i++) { + var newTemplate = template.clone(true); + vmVolumeJSONToTemplate(items[i], newTemplate); + container.append(newTemplate.show()); + } + } + } + }); } - + function vmVolumeJSONToTemplate(json, template) { + template.attr("id","vm_volume_"+json.id); + template.find("#id").text(json.id); + template.find("#name").text(json.name); + if (json.storagetype == "shared") + template.find("#type").text(json.type + " (shared storage)"); + else + template.find("#type").text(json.type + " (local storage)"); + + template.find("#size").text((json.size == "0") ? "" : convertBytes(json.size)); + setDateField(json.created, template.find("#created")); + + /* + if(json.type=="ROOT") { + if (json.vmstate == "Stopped") { + template.find("#volume_action_detach_disk, #volume_acton_separator").hide(); + } else { + template.find("#volume_action_detach_disk, #volume_acton_separator, #volume_action_create_template").hide(); + } + } else { + if (json.vmstate != "Stopped") { + template.find("#volume_acton_separator, #volume_action_create_template").hide(); + } + } + */ + } + + $("#add_link").show(); if($arrowIcon.hasClass("close") == true) {