mirror of https://github.com/apache/cloudstack.git
Merge branch 'master' of ssh://git.cloud.com/var/lib/git/cloudstack-oss
This commit is contained in:
commit
7792be4d7b
|
|
@ -101,5 +101,7 @@ public interface StoragePoolDao extends GenericDao<StoragePoolVO, Long> {
|
|||
List<String> searchForStoragePoolDetails(long poolId, String value);
|
||||
|
||||
long countBy(long podId, Status... statuses);
|
||||
|
||||
List<StoragePoolVO> findIfDuplicatePoolsExistByUUID(String uuid);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
|
|||
protected final SearchBuilder<StoragePoolVO> DeleteLvmSearch;
|
||||
protected final GenericSearchBuilder<StoragePoolVO, Long> 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<StoragePoolVO, Long> imp
|
|||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StoragePoolVO> findIfDuplicatePoolsExistByUUID(String uuid) {
|
||||
SearchCriteria<StoragePoolVO> sc = UUIDSearch.create();
|
||||
sc.setParameters("uuid", uuid);
|
||||
return listActiveBy(sc);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<StoragePoolVO> listByDataCenterId(long datacenterId) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ do
|
|||
esac
|
||||
done
|
||||
|
||||
CERT="$(dirname $0)/id_rsa"
|
||||
cert="/root/.ssh/id_rsa.cloud"
|
||||
|
||||
# Check if DomR is up and running. If not, exit with error code 1.
|
||||
check_gw "$domRIp"
|
||||
|
|
@ -114,7 +114,7 @@ then
|
|||
exit 2
|
||||
fi
|
||||
|
||||
ssh -p 3922 -q -o StrictHostKeyChecking=no -i $CERT root@$domRIp "/root/firewall.sh $*"
|
||||
ssh -p 3922 -q -o StrictHostKeyChecking=no -i $cert root@$domRIp "/root/firewall.sh $*"
|
||||
exit $?
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ copy_haproxy() {
|
|||
local domRIp=$1
|
||||
local cfg=$2
|
||||
|
||||
scp -P 3922 -q -o StrictHostKeyChecking=no -i $CERT $cfg root@$domRIp:/etc/haproxy/haproxy.cfg.new
|
||||
scp -P 3922 -q -o StrictHostKeyChecking=no -i $cert $cfg root@$domRIp:/etc/haproxy/haproxy.cfg.new
|
||||
return $?
|
||||
}
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ do
|
|||
esac
|
||||
done
|
||||
|
||||
CERT="$(dirname $0)/id_rsa"
|
||||
cert="/root/.ssh/id_rsa.cloud"
|
||||
|
||||
if [ "$iflag$fflag" != "11" ]
|
||||
then
|
||||
|
|
@ -79,5 +79,5 @@ then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
ssh -p 3922 -q -o StrictHostKeyChecking=no -i $CERT root@$domRIp "/root/loadbalancer.sh $*"
|
||||
ssh -p 3922 -q -o StrictHostKeyChecking=no -i $cert root@$domRIp "/root/loadbalancer.sh $*"
|
||||
exit $?
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ usage() {
|
|||
}
|
||||
|
||||
set -x
|
||||
CERT="/root/.ssh/id_rsa.cloud"
|
||||
cert="/root/.ssh/id_rsa.cloud"
|
||||
PORT=3922
|
||||
|
||||
create_htaccess() {
|
||||
|
|
@ -24,7 +24,7 @@ create_htaccess() {
|
|||
entry="RewriteRule ^$file$ ../$folder/%{REMOTE_ADDR}/$file [L,NC,QSA]"
|
||||
htaccessFolder="/var/www/html/latest"
|
||||
htaccessFile=$htaccessFolder/.htaccess
|
||||
ssh -p $PORT -o StrictHostKeyChecking=no -i $CERT root@$domrIp "mkdir -p $htaccessFolder; touch $htaccessFile; grep -F \"$entry\" $htaccessFile; if [ \$? -gt 0 ]; then echo -e \"$entry\" >> $htaccessFile; fi" >/dev/null
|
||||
ssh -p $PORT -o StrictHostKeyChecking=no -i $cert root@$domrIp "mkdir -p $htaccessFolder; touch $htaccessFile; grep -F \"$entry\" $htaccessFile; if [ \$? -gt 0 ]; then echo -e \"$entry\" >> $htaccessFile; fi" >/dev/null
|
||||
result=$?
|
||||
|
||||
if [ $result -eq 0 ]
|
||||
|
|
@ -32,7 +32,7 @@ create_htaccess() {
|
|||
entry="Options -Indexes\\nOrder Deny,Allow\\nDeny from all\\nAllow from $vmIp"
|
||||
htaccessFolder="/var/www/html/$folder/$vmIp"
|
||||
htaccessFile=$htaccessFolder/.htaccess
|
||||
ssh -p $PORT -o StrictHostKeyChecking=no -i $CERT root@$domrIp "mkdir -p $htaccessFolder; echo -e \"$entry\" > $htaccessFile" >/dev/null
|
||||
ssh -p $PORT -o StrictHostKeyChecking=no -i $cert root@$domrIp "mkdir -p $htaccessFolder; echo -e \"$entry\" > $htaccessFile" >/dev/null
|
||||
result=$?
|
||||
fi
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ copy_vm_data_file() {
|
|||
local dataFile=$5
|
||||
|
||||
chmod +r $dataFile
|
||||
scp -P $PORT -o StrictHostKeyChecking=no -i $CERT $dataFile root@$domrIp:/var/www/html/$folder/$vmIp/$file >/dev/null
|
||||
scp -P $PORT -o StrictHostKeyChecking=no -i $cert $dataFile root@$domrIp:/var/www/html/$folder/$vmIp/$file >/dev/null
|
||||
return $?
|
||||
}
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ delete_vm_data_file() {
|
|||
local file=$4
|
||||
|
||||
vmDataFilePath="/var/www/html/$folder/$vmIp/$file"
|
||||
ssh -p $PORT -o StrictHostKeyChecking=no -i $CERT root@$domrIp "if [ -f $vmDataFilePath ]; then rm -rf $vmDataFilePath; fi" >/dev/null
|
||||
ssh -p $PORT -o StrictHostKeyChecking=no -i $cert root@$domrIp "if [ -f $vmDataFilePath ]; then rm -rf $vmDataFilePath; fi" >/dev/null
|
||||
return $?
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<StoragePoolVO> 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);
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -1,3 +1,9 @@
|
|||
<%@ page import="java.util.Date" %>
|
||||
|
||||
<%
|
||||
long milliseconds = new Date().getTime();
|
||||
%>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
|
|
@ -24,23 +30,23 @@
|
|||
|
||||
<!-- cloud.com scripts -->
|
||||
|
||||
<script type="text/javascript" src="scripts/cloud.logger.js"></script>
|
||||
<script type="text/javascript" src="scripts/cloud.logger.js?t=<%=milliseconds%>"></script>
|
||||
|
||||
<script type="text/javascript" src="scripts/cloud.core.js"></script>
|
||||
<script type="text/javascript" src="scripts/cloud.core.js?t=<%=milliseconds%>"></script>
|
||||
|
||||
<script type="text/javascript" src="scripts/cloud.core.init.js"></script>
|
||||
<script type="text/javascript" src="scripts/cloud.core.init.js?t=<%=milliseconds%>"></script>
|
||||
|
||||
<script type="text/javascript" src="scripts/cloud.core.instance.js"></script>
|
||||
<script type="text/javascript" src="scripts/cloud.core.instance.js?t=<%=milliseconds%>"></script>
|
||||
|
||||
<script type="text/javascript" src="scripts/cloud.core.event.js"></script>
|
||||
<script type="text/javascript" src="scripts/cloud.core.event.js?t=<%=milliseconds%>"></script>
|
||||
|
||||
<script type="text/javascript" src="scripts/cloud.core.alert.js"></script>
|
||||
<script type="text/javascript" src="scripts/cloud.core.alert.js?t=<%=milliseconds%>"></script>
|
||||
|
||||
<script type="text/javascript" src="scripts/cloud.core.account.js"></script>
|
||||
<script type="text/javascript" src="scripts/cloud.core.account.js?t=<%=milliseconds%>"></script>
|
||||
|
||||
<script type="text/javascript" src="scripts/cloud.core.volume.js"></script>
|
||||
<script type="text/javascript" src="scripts/cloud.core.volume.js?t=<%=milliseconds%>"></script>
|
||||
|
||||
<script type="text/javascript" src="scripts/cloud.core.snapshot.js"></script>
|
||||
<script type="text/javascript" src="scripts/cloud.core.snapshot.js?t=<%=milliseconds%>"></script>
|
||||
|
||||
<title>Cloud.com CloudStack</title>
|
||||
</head>
|
||||
|
|
@ -338,18 +344,14 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="leftmenu_content" id="leftmenu_router">
|
||||
<div class="leftmenu_secondindent">
|
||||
<div class="leftmenu_arrows close" id="arrowIcon">
|
||||
</div>
|
||||
<div class="leftmenu_secondindent">
|
||||
<div class="leftmenu_list_icons">
|
||||
<img src="images/routers_leftmenuicon.png" alt="Routers" /></div>
|
||||
Routers
|
||||
</div>
|
||||
</div>
|
||||
<div class="leftmenu_content" id="leftmenu_system">
|
||||
<div class="leftmenu_secondindent">
|
||||
<div class="leftmenu_arrows close" id="arrowIcon">
|
||||
</div>
|
||||
<div class="leftmenu_secondindent">
|
||||
<div class="leftmenu_list_icons">
|
||||
<img src="images/storage_leftmenuicon.png" alt="Storage" /></div>
|
||||
System
|
||||
|
|
@ -430,14 +432,14 @@
|
|||
</div>
|
||||
<div class="leftmenu_list">
|
||||
<div class="leftmenu_content" id="leftmenu_ip">
|
||||
<div class="leftmenu_firstindent">
|
||||
<div class="leftmenu_secondindent">
|
||||
<div class="leftmenu_list_icons">
|
||||
<img src="images/network_leftmenuicon.png" alt="Network" /></div>
|
||||
IP Addresses
|
||||
</div>
|
||||
</div>
|
||||
<div class="leftmenu_content" id="leftmenu_network_group">
|
||||
<div class="leftmenu_firstindent">
|
||||
<div class="leftmenu_secondindent">
|
||||
<div class="leftmenu_list_icons">
|
||||
<img src="images/network_leftmenuicon.png" alt="Network" /></div>
|
||||
Network Groups
|
||||
|
|
|
|||
|
|
@ -23,15 +23,16 @@
|
|||
<p id="after_action_info"></p>
|
||||
</div>
|
||||
<div class="tabbox" style="margin-top:15px;">
|
||||
<div class="content_tabs on">
|
||||
<div class="content_tabs on" id="tab_details">
|
||||
<%=t.t("Details")%></div>
|
||||
<div class="content_tabs off">
|
||||
<div class="content_tabs off" id="tab_volume">
|
||||
<%=t.t("Volume")%></div>
|
||||
<div class="content_tabs off">
|
||||
<div class="content_tabs off" id="tab_statistics">
|
||||
<%=t.t("Statistics")%></div>
|
||||
</div>
|
||||
<!--VM details start here-->
|
||||
<div class="grid_container" style="display:none;">
|
||||
|
||||
<!--Details tab (start)-->
|
||||
<div class="grid_container" style="display:block;" id="tab_content_details">
|
||||
<div class="grid_rows odd">
|
||||
<div class="vm_statusbox">
|
||||
<div class="vm_consolebox">
|
||||
|
|
@ -140,10 +141,11 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--VM details ends here-->
|
||||
<!--Details tab (end)-->
|
||||
|
||||
<!--Volume start here-->
|
||||
<div class="grid_container" style="display:block;">
|
||||
<!--Volume tab (start)-->
|
||||
<div style="display:none;" id="tab_content_volume">
|
||||
<!--
|
||||
<div class="grid_header">
|
||||
<div class="grid_header_title">i-2-7-JW</div>
|
||||
<div class="grid_actionbox"></div>
|
||||
|
|
@ -184,8 +186,15 @@
|
|||
<div class="row_celltitles">09/03/2010 15:06:04</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
-->
|
||||
</div>
|
||||
<!--Volume tab (end)-->
|
||||
|
||||
<!--Statistics tab (start)-->
|
||||
<div class="grid_container" style="display:none;" id="tab_content_statistics">
|
||||
statistics....
|
||||
</div>
|
||||
<!--Statistics tab (start)-->
|
||||
</div>
|
||||
<!-- VM detail panel (end) -->
|
||||
<!-- VM wizard (begin)-->
|
||||
|
|
@ -648,8 +657,9 @@
|
|||
Custom:</label>
|
||||
<label class="label1">
|
||||
Disk Size:</label>
|
||||
<input type="text" name="disksize" class="text" />
|
||||
<span>GB</span>
|
||||
<input type="text" id="custom_disk_size" class="text" />
|
||||
<span>MB</span>
|
||||
<div id="custom_disk_size_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
<div class="vmpopup_offeringbox" id="vm_popup_disk_offering_template_existing" style="display: none">
|
||||
<input type="radio" class="radio" checked />
|
||||
|
|
@ -743,4 +753,48 @@
|
|||
</ol>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- volume tab template -->
|
||||
<div class="grid_container" id="volume_tab_template" style="display:none">
|
||||
<div class="grid_header">
|
||||
<div class="grid_header_title" id="name"></div>
|
||||
<div class="grid_actionbox"></div>
|
||||
</div>
|
||||
<div class="grid_rows even">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
ID:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="id"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_rows odd">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
Type:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="type"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_rows even">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
Size:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="size"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_rows odd">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
Created:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="created"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -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);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
@ -508,7 +557,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");
|
||||
|
||||
|
|
@ -542,6 +591,32 @@ function clickInstanceGroupHeader($arrowIcon) {
|
|||
zIndex: 2000
|
||||
}));
|
||||
|
||||
//***** switch to different tab (begin) ********************************************************************
|
||||
$("#tab_details").bind("click", function(event){
|
||||
$(this).removeClass("off").addClass("on");
|
||||
$("#tab_volume, #tab_statistics").removeClass("on").addClass("off");
|
||||
$("#tab_content_details").show();
|
||||
$("#tab_content_volume, #tab_content_statistics").hide();
|
||||
return false;
|
||||
});
|
||||
|
||||
$("#tab_volume").bind("click", function(event){
|
||||
$(this).removeClass("off").addClass("on");
|
||||
$("#tab_details, #tab_statistics").removeClass("on").addClass("off");
|
||||
$("#tab_content_volume").show();
|
||||
$("#tab_content_details, #tab_content_statistics").hide();
|
||||
return false;
|
||||
});
|
||||
|
||||
$("#tab_statistics").bind("click", function(event){
|
||||
$(this).removeClass("off").addClass("on");
|
||||
$("#tab_details, #tab_volume").removeClass("on").addClass("off");
|
||||
$("#tab_content_statistics").show();
|
||||
$("#tab_content_details, #tab_content_volume").hide();
|
||||
return false;
|
||||
});
|
||||
//***** switch to different tab (end) **********************************************************************
|
||||
|
||||
//***** VM Wizard (begin) ******************************************************************************
|
||||
$vmPopup = $("#vm_popup");
|
||||
var $serviceOfferingTemplate = $("#vm_popup_service_offering_template");
|
||||
|
|
@ -955,12 +1030,12 @@ function clickInstanceGroupHeader($arrowIcon) {
|
|||
listTemplatesInVmPopup();
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
$vmPopup.find("#next_step").bind("click", function(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
var $thisPopup = $vmPopup;
|
||||
if (currentStepInVmPopup == 1) { //select a template
|
||||
if (currentStepInVmPopup == 1) { //select a template/ISO
|
||||
// prevent a person from moving on if no templates are selected
|
||||
if($thisPopup.find("#step1 #template_container .rev_wiztemplistbox_selected").length == 0) {
|
||||
$thisPopup.find("#step1 #wiz_message").show();
|
||||
|
|
@ -971,30 +1046,15 @@ function clickInstanceGroupHeader($arrowIcon) {
|
|||
$thisPopup.find("#step3_label").text("Root Disk Offering");
|
||||
$thisPopup.find("#root_disk_offering_container").show();
|
||||
$thisPopup.find("#data_disk_offering_container").hide();
|
||||
} else { //template
|
||||
}
|
||||
else { //template
|
||||
$thisPopup.find("#step3_label").text("Data Disk Offering");
|
||||
$thisPopup.find("#data_disk_offering_container").show();
|
||||
$thisPopup.find("#root_disk_offering_container").hide();
|
||||
}
|
||||
|
||||
$thisPopup.find("#wizard_review_zone").text($thisPopup.find("#wizard_zone option:selected").text());
|
||||
$thisPopup.find("#wizard_review_template").text($thisPopup.find("#step1 .rev_wiztemplistbox_selected .rev_wiztemp_listtext").text());
|
||||
|
||||
// $thisPopup.find("#wizard_review_service_offering").text($thisPopup.find("#wizard_service_offering input[name=service]:checked").next().text());
|
||||
// $thisPopup.find("#wizard_review_zone").text($thisPopup.find("#wizard_zone option:selected").text());
|
||||
// $thisPopup.find("#wizard_review_name").text($thisPopup.find("#wizard_vm_name").val());
|
||||
// $thisPopup.find("#wizard_review_group").text($thisPopup.find("#wizard_vm_group").val());
|
||||
//
|
||||
// if($thisPopup.find("#wizard_network_groups_container").css("display") != "none" && $thisPopup.find("#wizard_network_groups").val() != null) {
|
||||
// var networkGroupList = $thisPopup.find("#wizard_network_groups").val().join(",");
|
||||
// $thisPopup.find("#wizard_review_network_groups_p").show();
|
||||
// $thisPopup.find("#wizard_review_network_groups").text(networkGroupList);
|
||||
// } else {
|
||||
// $thisPopup.find("#wizard_review_network_groups_p").hide();
|
||||
// $thisPopup.find("#wizard_review_network_groups").text("");
|
||||
// }
|
||||
|
||||
|
||||
$thisPopup.find("#wizard_review_template").text($thisPopup.find("#step1 .rev_wiztemplistbox_selected .rev_wiztemp_listtext").text());
|
||||
}
|
||||
|
||||
if (currentStepInVmPopup == 2) { //service offering
|
||||
|
|
@ -1009,31 +1069,28 @@ function clickInstanceGroupHeader($arrowIcon) {
|
|||
|
||||
}
|
||||
|
||||
if(currentStepInVmPopup ==3) { //disk offering
|
||||
/*
|
||||
// validate values
|
||||
var isValid = true;
|
||||
isValid &= validateString("Name", $thisPopup.find("#wizard_vm_name"), $thisPopup.find("#wizard_vm_name_errormsg"), true);
|
||||
isValid &= validateString("Group", $thisPopup.find("#wizard_vm_group"), $thisPopup.find("#wizard_vm_group_errormsg"), true);
|
||||
if (!isValid) return;
|
||||
*/
|
||||
|
||||
/*
|
||||
// prevent a person from moving on if no radio button is selected
|
||||
if($thisPopup.find("input:radio[name=disk_offering_radio]:checked").length == 0) {
|
||||
$thisPopup.find("#step2 #wiz_message #wiz_message_text").text("Please select a disk offering to continue");
|
||||
$thisPopup.find("#step2 #wiz_message").show();
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
if(currentStepInVmPopup ==3) { //disk offering
|
||||
if($thisPopup.find("#wiz_blank").hasClass("rev_wizmid_selectedtempbut")) { //ISO
|
||||
$thisPopup.find("#wizard_review_disk_offering_label").text("Root Disk Offering:");
|
||||
$thisPopup.find("#wizard_review_disk_offering").text($thisPopup.find("#root_disk_offering_container input[name=root_disk_offering_radio]:checked").next().text());
|
||||
}
|
||||
else { //template
|
||||
var checkedRadioButton = $thisPopup.find("#data_disk_offering_container input[name=data_disk_offering_radio]:checked");
|
||||
|
||||
// validate values
|
||||
var isValid = true;
|
||||
if(checkedRadioButton.parent().attr("id") == "vm_popup_disk_offering_template_custom")
|
||||
isValid &= validateNumber("Disk Size", $thisPopup.find("#custom_disk_size"), $thisPopup.find("#custom_disk_size_errormsg"), null, null, false); //required
|
||||
else
|
||||
isValid &= validateNumber("Disk Size", $thisPopup.find("#custom_disk_size"), $thisPopup.find("#custom_disk_size_errormsg"), null, null, true); //optional
|
||||
if (!isValid) return;
|
||||
|
||||
$thisPopup.find("#wizard_review_disk_offering_label").text("Data Disk Offering:");
|
||||
$thisPopup.find("#wizard_review_disk_offering").text($thisPopup.find("#data_disk_offering_container input[name=data_disk_offering_radio]:checked").next().text());
|
||||
|
||||
var diskOfferingName = checkedRadioButton.next().text();
|
||||
if(checkedRadioButton.parent().attr("id") == "vm_popup_disk_offering_template_custom")
|
||||
diskOfferingName += (" " + $thisPopup.find("#data_disk_offering_container input[name=data_disk_offering_radio]:checked").next().next().next().val() + " MB");
|
||||
$thisPopup.find("#wizard_review_disk_offering").text(diskOfferingName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1060,10 +1117,14 @@ function clickInstanceGroupHeader($arrowIcon) {
|
|||
if ($thisPopup.find("#wiz_blank").hasClass("rev_wizmid_selectedtempbut")) //ISO
|
||||
diskOfferingId = $thisPopup.find("#root_disk_offering_container input[name=root_disk_offering_radio]:checked").val();
|
||||
else //template
|
||||
diskOfferingId = $thisPopup.find("#data_disk_offering_container input[name=data_disk_offering_radio]:checked").val();
|
||||
|
||||
diskOfferingId = $thisPopup.find("#data_disk_offering_container input[name=data_disk_offering_radio]:checked").val();
|
||||
if(diskOfferingId != null && diskOfferingId != "" && diskOfferingId != "no" && diskOfferingId != "custom")
|
||||
moreCriteria.push("&diskOfferingId="+diskOfferingId);
|
||||
|
||||
var customDiskSize = $thisPopup.find("#custom_disk_size").val(); //unit is MB
|
||||
if(customDiskSize != null && customDiskSize.length > 0)
|
||||
moreCriteria.push("&size="+customDiskSize);
|
||||
|
||||
|
||||
var name = trim($thisPopup.find("#wizard_vm_name").val());
|
||||
if (name != null && name.length > 0)
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ function fromdb(val) {
|
|||
}
|
||||
|
||||
function todb(val) {
|
||||
return encodeURIComponent(escape(display));
|
||||
return encodeURIComponent(escape(val));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue