mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
Merge branch 'master' of ssh://git.cloud.com/var/lib/git/cloudstack-oss
This commit is contained in:
commit
0669c2c1d4
@ -35,11 +35,12 @@ public class IPAssocCommand extends RoutingCommand {
|
||||
private String vlanGateway;
|
||||
private String vlanNetmask;
|
||||
private String vifMacAddress;
|
||||
private String guestIp;
|
||||
|
||||
protected IPAssocCommand() {
|
||||
}
|
||||
|
||||
public IPAssocCommand(String routerName, String privateIpAddress, String ipAddress, boolean add, boolean firstIP, boolean sourceNat, String vlanId, String vlanGateway, String vlanNetmask, String vifMacAddress) {
|
||||
public IPAssocCommand(String routerName, String privateIpAddress, String ipAddress, boolean add, boolean firstIP, boolean sourceNat, String vlanId, String vlanGateway, String vlanNetmask, String vifMacAddress, String guestIp) {
|
||||
this.setRouterName(routerName);
|
||||
this.routerIp = privateIpAddress;
|
||||
this.publicIp = ipAddress;
|
||||
@ -50,8 +51,13 @@ public class IPAssocCommand extends RoutingCommand {
|
||||
this.vlanGateway = vlanGateway;
|
||||
this.vlanNetmask = vlanNetmask;
|
||||
this.vifMacAddress = vifMacAddress;
|
||||
this.guestIp = guestIp;
|
||||
}
|
||||
|
||||
public String getGuestIp(){
|
||||
return guestIp;
|
||||
}
|
||||
|
||||
public String getRouterIp() {
|
||||
return routerIp;
|
||||
}
|
||||
|
||||
@ -1288,7 +1288,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
||||
}
|
||||
|
||||
protected void assignPublicIpAddress(final String vmName, final String privateIpAddress, final String publicIpAddress, final boolean add, final boolean firstIP,
|
||||
final boolean sourceNat, final String vlanId, final String vlanGateway, final String vlanNetmask, final String vifMacAddress) throws InternalErrorException {
|
||||
final boolean sourceNat, final String vlanId, final String vlanGateway, final String vlanNetmask, final String vifMacAddress, String guestIp) throws InternalErrorException {
|
||||
|
||||
try {
|
||||
Connection conn = getConnection();
|
||||
@ -1328,7 +1328,8 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
||||
throw new InternalErrorException("Failed to find DomR VIF to associate/disassociate IP with.");
|
||||
}
|
||||
|
||||
String args;
|
||||
String args = null;
|
||||
|
||||
if (add) {
|
||||
args = "-A";
|
||||
} else {
|
||||
@ -1346,6 +1347,11 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
||||
args += " -g ";
|
||||
args += vlanGateway;
|
||||
|
||||
if(guestIp!=null){
|
||||
args += " -G ";
|
||||
args += guestIp;
|
||||
}
|
||||
|
||||
String result = callHostPlugin("vmops", "ipassoc", "args", args);
|
||||
if (result == null || result.isEmpty()) {
|
||||
throw new InternalErrorException("Xen plugin \"ipassoc\" failed.");
|
||||
@ -1388,7 +1394,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
||||
protected Answer execute(final IPAssocCommand cmd) {
|
||||
try {
|
||||
assignPublicIpAddress(cmd.getRouterName(), cmd.getRouterIp(), cmd.getPublicIp(), cmd.isAdd(), cmd.isFirstIP(), cmd.isSourceNat(), cmd.getVlanId(),
|
||||
cmd.getVlanGateway(), cmd.getVlanNetmask(), cmd.getVifMacAddress());
|
||||
cmd.getVlanGateway(), cmd.getVlanNetmask(), cmd.getVifMacAddress(), cmd.getGuestIp());
|
||||
} catch (InternalErrorException e) {
|
||||
return new Answer(cmd, false, e.getMessage());
|
||||
}
|
||||
@ -1668,8 +1674,15 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
||||
try {
|
||||
doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(statsSource);
|
||||
} catch (Exception e) {
|
||||
s_logger.warn("Exception caught whilst processing the document via document factory:"+e);
|
||||
return null;
|
||||
}
|
||||
|
||||
if(doc==null){
|
||||
s_logger.warn("Null document found after tryinh to parse the stats source");
|
||||
return null;
|
||||
}
|
||||
|
||||
NodeList firstLevelChildren = doc.getChildNodes();
|
||||
NodeList secondLevelChildren = (firstLevelChildren.item(0)).getChildNodes();
|
||||
Node metaNode = secondLevelChildren.item(0);
|
||||
|
||||
@ -409,12 +409,13 @@ public interface ManagementServer {
|
||||
* @param accountId
|
||||
* @param domainId
|
||||
* @param zoneId
|
||||
* @param vmId
|
||||
* @return allocated IP address in the zone specified
|
||||
* @throws InsufficientAddressCapacityException if no more addresses are available
|
||||
* @throws InvalidParameterValueException if no router for that user exists in the zone specified
|
||||
* @throws InternalErrorException if the new address could not be sent down to the router
|
||||
*/
|
||||
String associateIpAddress(long userId, long accountId, long domainId, long zoneId) throws ResourceAllocationException, InsufficientAddressCapacityException, InvalidParameterValueException, InternalErrorException;
|
||||
String associateIpAddress(long userId, long accountId, long domainId, long zoneId, long vmId) throws ResourceAllocationException, InsufficientAddressCapacityException, InvalidParameterValueException, InternalErrorException;
|
||||
long associateIpAddressAsync(long userId, long accountId, long domainId, long zoneId);
|
||||
|
||||
|
||||
@ -2253,5 +2254,10 @@ public interface ManagementServer {
|
||||
URISyntaxException, InternalErrorException;
|
||||
long extractTemplateAsync(String url, Long templateId, Long zoneId) throws URISyntaxException;
|
||||
long extractVolumeAsync(String url, Long volumeId, Long zoneId) throws URISyntaxException;
|
||||
|
||||
/*
|
||||
* Fetches the version of cloud stack
|
||||
*/
|
||||
String getVersion();
|
||||
|
||||
}
|
||||
|
||||
@ -892,6 +892,7 @@ def prompt_for_hostpods(zonespods):
|
||||
for n,(z,p) in enumerate(zonespods):
|
||||
print "%3d) %s, %s"%(n,z,p)
|
||||
print "================"
|
||||
print "> ",
|
||||
zoneandpod = raw_input().strip()
|
||||
|
||||
if not zoneandpod:
|
||||
@ -930,6 +931,7 @@ def setup_agent_config(configfile, host, zone, pod, cluster, guid):
|
||||
try: host = confopts["host"]
|
||||
except KeyError: host = "localhost"
|
||||
stderr("Please enter the host name of the management server that this agent will connect to: (just hit ENTER to go with %s)",host)
|
||||
print "> ",
|
||||
newhost = raw_input().strip()
|
||||
if newhost: host = newhost
|
||||
|
||||
@ -977,6 +979,7 @@ def setup_consoleproxy_config(configfile, host, zone, pod):
|
||||
try: host = confopts["host"]
|
||||
except KeyError: host = "localhost"
|
||||
stderr("Please enter the host name of the management server that this console-proxy will connect to: (just hit ENTER to go with %s)",host)
|
||||
print "> ",
|
||||
newhost = raw_input().strip()
|
||||
if newhost: host = newhost
|
||||
confopts["host"] = host
|
||||
|
||||
@ -50,6 +50,22 @@ check_gw() {
|
||||
return $?;
|
||||
}
|
||||
|
||||
#Add 1:1 NAT entry
|
||||
add_one_to_one_nat_entry() {
|
||||
local guestIp=$1
|
||||
local publicIp=$2
|
||||
local dIp=$3
|
||||
ssh -p 3922 -o StrictHostKeyChecking=no -i $cert root@$dIp "\
|
||||
iptables -t nat -A PREROUTING -i eth2 -d $publicIp -j DNAT --to-destination $guestIp
|
||||
iptables -t nat -A POSTROUTING -o $eth2 -s $guestIp -j SNAT --to-source $publicIp
|
||||
iptables -P FORWARD DROP
|
||||
iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
|
||||
iptables -A FORWARD -i $eth2 -o $eth1 -d $guestIp -m state --state NEW -j ACCEPT
|
||||
iptables -A FORWARD -i $eth1 -o $eth2 -s $guestIp -m state --state NEW -j ACCEPT
|
||||
"
|
||||
return $?
|
||||
}
|
||||
|
||||
#Add the NAT entries into iptables in the routing domain
|
||||
add_nat_entry() {
|
||||
local dRIp=$1
|
||||
@ -120,9 +136,10 @@ vflag=
|
||||
gflag=
|
||||
nflag=
|
||||
cflag=
|
||||
Gflag=
|
||||
op=""
|
||||
|
||||
while getopts 'fADr:i:a:l:v:g:n:c:' OPTION
|
||||
while getopts 'fADr:i:a:l:v:g:n:c:G:' OPTION
|
||||
do
|
||||
case $OPTION in
|
||||
A) Aflag=1
|
||||
@ -157,12 +174,23 @@ do
|
||||
c) cflag=1
|
||||
correctVif="$OPTARG"
|
||||
;;
|
||||
G) Gflag=1
|
||||
guestIp="$OPTARG"
|
||||
;;
|
||||
?) usage
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
#1:1 NAT
|
||||
if [ "$Gflag" == "1" ] && [ "$fflag" == "1" ] && [ "$Aflag" == "1" ]
|
||||
then
|
||||
add_nat_entry $domRIp $publicIp
|
||||
add_one_to_one_nat_entry $guestIp $publicIp $domRIp
|
||||
exit $?
|
||||
fi
|
||||
|
||||
#Either the A flag or the D flag but not both
|
||||
if [ "$Aflag$Dflag" != "1" ]
|
||||
then
|
||||
@ -182,7 +210,6 @@ then
|
||||
exit 3
|
||||
fi
|
||||
|
||||
|
||||
if [ "$fflag" == "1" ] && [ "$Aflag" == "1" ]
|
||||
then
|
||||
add_nat_entry $domRIp $publicIp
|
||||
@ -208,4 +235,3 @@ then
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
@ -624,13 +624,14 @@ public abstract class BaseCmd {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
|
||||
// JSON response
|
||||
sb.append("{ \"" + getName() + "\" : { \"errorcode\" : \"" + apiException.getErrorCode() + "\", \"description\" : \"" + apiException.getDescription() + "\" } }");
|
||||
sb.append("{ \"" + getName() + "\" : { " + "\"@attributes\":{\"cloud-stack-version\":\""+getManagementServer().getVersion()+"\"},");
|
||||
sb.append("\"errorcode\" : \"" + apiException.getErrorCode() + "\", \"description\" : \"" + apiException.getDescription() + "\" } }");
|
||||
} else {
|
||||
sb.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
|
||||
sb.append("<" + getName() + ">");
|
||||
sb.append("<errorcode>" + apiException.getErrorCode() + "</errorcode>");
|
||||
sb.append("<description>" + escapeXml(apiException.getDescription()) + "</description>");
|
||||
sb.append("</" + getName() + ">");
|
||||
sb.append("</" + getName() + " cloud-stack-version=\""+getManagementServer().getVersion()+ "\">");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
@ -640,10 +641,10 @@ public abstract class BaseCmd {
|
||||
|
||||
// set up the return value with the name of the response
|
||||
if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
|
||||
sb.append("{ \"" + getName() + "\" : { ");
|
||||
sb.append("{ \"" + getName() + "\" : { \"@attributes\":{\"cloud-stack-version\":\""+getManagementServer().getVersion()+"\"},");
|
||||
} else {
|
||||
sb.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
|
||||
sb.append("<" + getName() + ">");
|
||||
sb.append("<" + getName() + " cloud-stack-version=\""+getManagementServer().getVersion()+ "\">");
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
|
||||
@ -71,7 +71,11 @@ public class AssociateIPAddrCmd extends BaseCmd {
|
||||
Long userId = (Long)params.get(BaseCmd.Properties.USER_ID.getName());
|
||||
String accountName = (String)params.get(BaseCmd.Properties.ACCOUNT.getName());
|
||||
Long domainId = (Long)params.get(BaseCmd.Properties.DOMAIN_ID.getName());
|
||||
Long vmId = (Long)params.get(BaseCmd.Properties.VIRTUAL_MACHINE_ID.getName());
|
||||
Long vmId = (Long)params.get(BaseCmd.Properties.VIRTUAL_MACHINE_ID.getName());
|
||||
|
||||
//todo REMOVE
|
||||
//vmId = new Long(3);
|
||||
|
||||
String newIpAddr = null;
|
||||
String errorDesc = null;
|
||||
Long accountId = null;
|
||||
@ -108,13 +112,13 @@ public class AssociateIPAddrCmd extends BaseCmd {
|
||||
}
|
||||
|
||||
//vmId == 0 => general flow
|
||||
//vmId = 1 => 1:1 NAT
|
||||
//vmId != 0 => 1:1 NAT
|
||||
if(vmId == null){
|
||||
vmId = Long.valueOf(0);
|
||||
}
|
||||
|
||||
try {
|
||||
newIpAddr = getManagementServer().associateIpAddress(userId.longValue(), accountId.longValue(), domainId.longValue(), zoneId.longValue());
|
||||
newIpAddr = getManagementServer().associateIpAddress(userId.longValue(), accountId.longValue(), domainId.longValue(), zoneId.longValue(), vmId.longValue());
|
||||
} catch (ResourceAllocationException rae) {
|
||||
if (rae.getResourceType().equals("vm")) throw new ServerApiException (BaseCmd.VM_ALLOCATION_ERROR, rae.getMessage());
|
||||
else if (rae.getResourceType().equals("ip")) throw new ServerApiException (BaseCmd.IP_ALLOCATION_ERROR, rae.getMessage());
|
||||
|
||||
@ -131,9 +131,9 @@ public class ListVolumesCmd extends BaseCmd{
|
||||
} else {
|
||||
c.addCriteria(Criteria.ID, id);
|
||||
c.addCriteria(Criteria.INSTANCEID, vmId);
|
||||
c.addCriteria(Criteria.NAME, name);
|
||||
if (isAdmin) {
|
||||
c.addCriteria(Criteria.VTYPE, type);
|
||||
c.addCriteria(Criteria.NAME, name);
|
||||
c.addCriteria(Criteria.VTYPE, type);
|
||||
if (isAdmin) {
|
||||
c.addCriteria(Criteria.DATACENTERID, zoneId);
|
||||
c.addCriteria(Criteria.PODID, podId);
|
||||
c.addCriteria(Criteria.HOSTID, hostId);
|
||||
|
||||
@ -62,7 +62,7 @@ public class AssociateIpAddressExecutor extends BaseAsyncJobExecutor {
|
||||
} else {
|
||||
try {
|
||||
String ipAddress = managementServer.associateIpAddress(param.getUserId(), param.getAccountId(),
|
||||
param.getDomainId(), param.getZoneId());
|
||||
param.getDomainId(), param.getZoneId(), 0);
|
||||
asyncMgr.completeAsyncJob(getJob().getId(), AsyncJobResult.STATUS_SUCCEEDED, 0,
|
||||
composeResultObject(managementServer, param, ipAddress));
|
||||
} catch (ResourceAllocationException e) {
|
||||
|
||||
@ -594,8 +594,9 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, VirtualMach
|
||||
|
||||
if (routingHost == null) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Unable to find a routing host for " + proxy.toString());
|
||||
continue;
|
||||
String msg = "Unable to find a routing host for " + proxy.toString() + " in pod " + pod.getId();
|
||||
s_logger.debug(msg);
|
||||
throw new CloudRuntimeException(msg);
|
||||
}
|
||||
}
|
||||
// to ensure atomic state transition to Starting state
|
||||
@ -622,9 +623,9 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, VirtualMach
|
||||
String privateIpAddress = allocPrivateIpAddress(proxy.getDataCenterId(), routingHost.getPodId(), proxy.getId(),
|
||||
proxy.getPrivateMacAddress());
|
||||
if (privateIpAddress == null && (_IpAllocator != null && !_IpAllocator.exteralIpAddressAllocatorEnabled())) {
|
||||
s_logger.debug("Not enough ip addresses in " + routingHost.getPodId());
|
||||
avoid.add(routingHost);
|
||||
continue;
|
||||
String msg = "Unable to allocate private ip addresses for " + proxy.getName() + " in pod " + pod.getId();
|
||||
s_logger.debug(msg);
|
||||
throw new CloudRuntimeException(msg);
|
||||
}
|
||||
|
||||
proxy.setPrivateIpAddress(privateIpAddress);
|
||||
@ -635,10 +636,10 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, VirtualMach
|
||||
proxy = _consoleProxyDao.findById(proxy.getId());
|
||||
|
||||
List<VolumeVO> vols = _storageMgr.prepare(proxy, routingHost);
|
||||
if (vols == null) {
|
||||
s_logger.debug("Unable to prepare storage for " + routingHost);
|
||||
avoid.add(routingHost);
|
||||
continue;
|
||||
if (vols == null || vols.size() == 0) {
|
||||
String msg = "Unable to prepare storage for " + proxy.getName() + " in pod " + pod.getId();
|
||||
s_logger.debug(msg);
|
||||
throw new CloudRuntimeException(msg);
|
||||
}
|
||||
|
||||
// _storageMgr.share(proxy, vols, null, true);
|
||||
@ -955,10 +956,9 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, VirtualMach
|
||||
}
|
||||
|
||||
if (pod == null || publicIpAndVlan == null) {
|
||||
s_logger.warn("Unable to allocate pod for console proxy vm in data center : " + dataCenterId);
|
||||
|
||||
context.put("proxyVmId", (long) 0);
|
||||
return context;
|
||||
String msg = "Unable to allocate pod for console proxy vm in data center : " + dataCenterId;
|
||||
s_logger.warn(msg);
|
||||
throw new CloudRuntimeException(msg);
|
||||
}
|
||||
|
||||
long id = _consoleProxyDao.getNextInSequence(Long.class, "id");
|
||||
|
||||
@ -176,9 +176,10 @@ public interface NetworkManager extends Manager {
|
||||
* @param router router object to send the association to
|
||||
* @param ipAddrList list of public IP addresses
|
||||
* @param add true if associate, false if disassociate
|
||||
* @param vmId
|
||||
* @return
|
||||
*/
|
||||
boolean associateIP(DomainRouterVO router, List<String> ipAddrList, boolean add) throws ResourceAllocationException;
|
||||
boolean associateIP(DomainRouterVO router, List<String> ipAddrList, boolean add, long vmId) throws ResourceAllocationException;
|
||||
|
||||
boolean updateFirewallRule(FirewallRuleVO fwRule, String oldPrivateIP, String oldPrivatePort);
|
||||
boolean executeAssignToLoadBalancer(AssignToLoadBalancerExecutor executor, LoadBalancerParam param);
|
||||
|
||||
@ -1118,7 +1118,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
||||
ipAddrList.add(ipVO.getAddress());
|
||||
}
|
||||
if (!ipAddrList.isEmpty()) {
|
||||
final boolean success = associateIP(router, ipAddrList, true);
|
||||
final boolean success = associateIP(router, ipAddrList, true, 0);
|
||||
if (!success) {
|
||||
return false;
|
||||
}
|
||||
@ -1353,7 +1353,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean associateIP(final DomainRouterVO router, final List<String> ipAddrList, final boolean add) {
|
||||
public boolean associateIP(final DomainRouterVO router, final List<String> ipAddrList, final boolean add, long vmId) {
|
||||
final Command [] cmds = new Command[ipAddrList.size()];
|
||||
int i=0;
|
||||
boolean sourceNat = false;
|
||||
@ -1374,7 +1374,12 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
||||
vifMacAddress = macAddresses[1];
|
||||
}
|
||||
|
||||
cmds[i++] = new IPAssocCommand(router.getInstanceName(), router.getPrivateIpAddress(), ipAddress, add, firstIP, sourceNat, vlanId, vlanGateway, vlanNetmask, vifMacAddress);
|
||||
String vmGuestAddress = null;
|
||||
if(vmId!=0){
|
||||
vmGuestAddress = _vmDao.findById(vmId).getGuestIpAddress();
|
||||
}
|
||||
|
||||
cmds[i++] = new IPAssocCommand(router.getInstanceName(), router.getPrivateIpAddress(), ipAddress, add, firstIP, sourceNat, vlanId, vlanGateway, vlanNetmask, vifMacAddress, vmGuestAddress);
|
||||
|
||||
sourceNat = false;
|
||||
}
|
||||
@ -1717,7 +1722,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
||||
s_logger.debug("Disassociate ip " + router.getName());
|
||||
}
|
||||
|
||||
if (associateIP(router, ipAddrs, false)) {
|
||||
if (associateIP(router, ipAddrs, false, 0)) {
|
||||
_ipAddressDao.unassignIpAddress(ipAddress);
|
||||
} else {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
|
||||
@ -1493,7 +1493,7 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
boolean success = true;
|
||||
String params = "\nsourceNat=" + false + "\ndcId=" + zoneId;
|
||||
ArrayList<String> dummyipAddrList = new ArrayList<String>();
|
||||
success = _networkMgr.associateIP(router,ipAddrsList, true);
|
||||
success = _networkMgr.associateIP(router,ipAddrsList, true, 0);
|
||||
String errorMsg = "Unable to assign public IP address pool";
|
||||
if (!success) {
|
||||
s_logger.debug(errorMsg);
|
||||
@ -1524,7 +1524,7 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
|
||||
@Override
|
||||
@DB
|
||||
public String associateIpAddress(long userId, long accountId, long domainId, long zoneId) throws ResourceAllocationException, InsufficientAddressCapacityException,
|
||||
public String associateIpAddress(long userId, long accountId, long domainId, long zoneId, long vmId) throws ResourceAllocationException, InsufficientAddressCapacityException,
|
||||
InvalidParameterValueException, InternalErrorException {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
AccountVO account = null;
|
||||
@ -1576,7 +1576,7 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
ipAddrs.add(ipAddress);
|
||||
|
||||
if (router.getState() == State.Running) {
|
||||
success = _networkMgr.associateIP(router, ipAddrs, true);
|
||||
success = _networkMgr.associateIP(router, ipAddrs, true, vmId);
|
||||
if (!success) {
|
||||
errorMsg = "Unable to assign public IP address.";
|
||||
}
|
||||
@ -8933,15 +8933,8 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
if(networkGroupsEnabled == null)
|
||||
networkGroupsEnabled = "false";
|
||||
|
||||
capabilities.put("networkGroupsEnabled", networkGroupsEnabled);
|
||||
|
||||
final Class<?> c = this.getClass();
|
||||
String fullVersion = c.getPackage().getImplementationVersion();
|
||||
String version = "unknown";
|
||||
if(fullVersion.length() > 0){
|
||||
version = fullVersion.substring(0,fullVersion.lastIndexOf("."));
|
||||
}
|
||||
capabilities.put("cloudStackVersion", version);
|
||||
capabilities.put("networkGroupsEnabled", networkGroupsEnabled);
|
||||
capabilities.put("cloudStackVersion", getVersion());
|
||||
return capabilities;
|
||||
}
|
||||
|
||||
@ -9083,6 +9076,17 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
public List<VlanVO> searchForZoneWideVlans(long dcId, String vlanType, String vlanId){
|
||||
return _vlanDao.searchForZoneWideVlans(dcId, vlanType, vlanId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion(){
|
||||
final Class<?> c = this.getClass();
|
||||
String fullVersion = c.getPackage().getImplementationVersion();
|
||||
String version = "unknown";
|
||||
if(fullVersion.length() > 0){
|
||||
version = fullVersion.substring(0,fullVersion.lastIndexOf("."));
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -318,8 +318,9 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
||||
|
||||
if (routingHost == null) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Unable to find a routing host for " + secStorageVm.toString());
|
||||
continue;
|
||||
String msg = "Unable to find a routing host for " + secStorageVm.toString() + " in pod " + pod.getId();
|
||||
s_logger.debug(msg);
|
||||
throw new CloudRuntimeException(msg);
|
||||
}
|
||||
}
|
||||
// to ensure atomic state transition to Starting state
|
||||
@ -350,9 +351,9 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
||||
secStorageVm.getDataCenterId(), routingHost.getPodId(),
|
||||
secStorageVm.getId(), secStorageVm.getPrivateMacAddress());
|
||||
if (privateIpAddress == null && (_IpAllocator != null && !_IpAllocator.exteralIpAddressAllocatorEnabled())) {
|
||||
s_logger.debug("Not enough ip addresses in " + routingHost.getPodId());
|
||||
avoid.add(routingHost);
|
||||
continue;
|
||||
String msg = "Unable to allocate private ip addresses for " + secStorageVm.getName() + " in pod " + pod.getId();
|
||||
s_logger.debug(msg);
|
||||
throw new CloudRuntimeException(msg);
|
||||
}
|
||||
|
||||
secStorageVm.setPrivateIpAddress(privateIpAddress);
|
||||
@ -363,9 +364,9 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
||||
|
||||
List<VolumeVO> vols = _storageMgr.prepare(secStorageVm, routingHost);
|
||||
if (vols == null || vols.size() == 0) {
|
||||
s_logger.warn("Can not share " + secStorageVm.getName());
|
||||
avoid.add(routingHost);
|
||||
continue;
|
||||
String msg = "Unable to prepare storage for " + secStorageVm.getName() + " in pod " + pod.getId();
|
||||
s_logger.debug(msg);
|
||||
throw new CloudRuntimeException(msg);
|
||||
}
|
||||
VolumeVO vol = vols.get(0);
|
||||
|
||||
@ -716,10 +717,9 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
||||
}
|
||||
|
||||
if (pod == null || publicIpAndVlan == null) {
|
||||
s_logger.warn("Unable to allocate pod for secondary storage vm in data center : " + dataCenterId);
|
||||
|
||||
context.put("secStorageVmId", (long) 0);
|
||||
return context;
|
||||
String msg = "Unable to allocate pod for secondary storage vm in data center : " + dataCenterId;
|
||||
s_logger.warn(msg);
|
||||
throw new CloudRuntimeException(msg);
|
||||
}
|
||||
|
||||
long id = _secStorageVmDao.getNextInSequence(Long.class, "id");
|
||||
|
||||
@ -1386,6 +1386,7 @@ a:visited {
|
||||
width:223px;
|
||||
height:27px;
|
||||
float:left;
|
||||
position:relative;
|
||||
margin:0;
|
||||
padding:0;
|
||||
background:url(../images/actionpanel_border.gif) no-repeat top right;
|
||||
@ -1460,6 +1461,174 @@ a:visited {
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.adv_searchpopup {
|
||||
width:156px;
|
||||
height:auto;
|
||||
float:left;
|
||||
position:absolute;
|
||||
background:#fefae7 repeat top left;
|
||||
border:1px solid #999;
|
||||
top:5px;
|
||||
left:8px;
|
||||
margin:0;
|
||||
padding:0;
|
||||
z-index:1005;
|
||||
}
|
||||
|
||||
.adv_searchformbox {
|
||||
width:140px;
|
||||
height:auto;
|
||||
float:left;
|
||||
margin:0 0 10px 10px;
|
||||
display:inline;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.adv_searchformbox a:link {
|
||||
width:auto;
|
||||
height:auto;
|
||||
float:right;
|
||||
text-align:left;
|
||||
text-decoration:underline;
|
||||
font-size:10px;
|
||||
font-weight:normal;
|
||||
color: #2c8bbc;
|
||||
margin: 7px 5px 0 0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.adv_searchformbox a:visited {
|
||||
width:auto;
|
||||
height:auto;
|
||||
float:right;
|
||||
text-align:left;
|
||||
text-decoration:underline;
|
||||
font-size:10px;
|
||||
font-weight:normal;
|
||||
color: #2c8bbc;
|
||||
margin: 7px 5px 0 0;
|
||||
padding:0;
|
||||
}
|
||||
.adv_searchformbox a:hover {
|
||||
width:auto;
|
||||
height:auto;
|
||||
float:right;
|
||||
text-align:left;
|
||||
text-decoration:none;
|
||||
font-size:10px;
|
||||
font-weight:normal;
|
||||
color: #2c8bbc;
|
||||
margin: 7px 5px 0 0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.adv_searchformbox h3 {
|
||||
width:auto;
|
||||
height:auto;
|
||||
color:#2d6487;
|
||||
font-size:11px;
|
||||
font-weight:bold;
|
||||
float:left;
|
||||
margin:8px 0 7px 0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.adv_searchformbox ol {
|
||||
width: auto;
|
||||
color:#333;
|
||||
float:left;
|
||||
font-family:Arial, Helvetica, sans-serif;
|
||||
font-size:11px;
|
||||
list-style:none;
|
||||
}
|
||||
|
||||
.adv_searchformbox li {
|
||||
width:140px;
|
||||
float:left;
|
||||
clear:left;
|
||||
font-family:Arial, Helvetica, sans-serif;
|
||||
color:#333;
|
||||
font-weight:normal;
|
||||
margin:0 0 7px 0;
|
||||
}
|
||||
|
||||
.adv_searchformbox label {
|
||||
width:45px;
|
||||
float:left;
|
||||
clear:left;
|
||||
font-family:Arial, Helvetica, sans-serif;
|
||||
color:#333;
|
||||
font-size:10px;
|
||||
font-weight:normal;
|
||||
margin:2px 5px 0 0;
|
||||
}
|
||||
|
||||
.adv_searchformbox .text {
|
||||
background-color: #FFF;
|
||||
font: normal 11px Arial, Helvetica, sans-serif;
|
||||
float:left;
|
||||
border: 1px solid #CCC;
|
||||
height: 13px;
|
||||
width: 80px;
|
||||
color:#666;
|
||||
margin:0;
|
||||
padding:1px 0 0 2px;
|
||||
font-weight:normal;
|
||||
}
|
||||
|
||||
.adv_searchformbox .select {
|
||||
background-color: #FFF;
|
||||
font: normal 11px Arial, Helvetica, sans-serif;
|
||||
float:left;
|
||||
border: 1px solid #CCC;
|
||||
height: 17px;
|
||||
width: 83px;
|
||||
margin:0;
|
||||
padding:1px 0 0 2px;
|
||||
color:#666;
|
||||
}
|
||||
|
||||
|
||||
.adv_search_actionbox {
|
||||
width:140px;
|
||||
height:20px;
|
||||
float:left;
|
||||
margin:5px 0 0 0;
|
||||
padding:0;
|
||||
}
|
||||
.adv_searchpopup_button {
|
||||
width:49px;
|
||||
height:16px;
|
||||
float:left;
|
||||
background:url(../images/adv_searchbutton.gif) no-repeat top left;
|
||||
margin:0 5px 0 0;
|
||||
display:inline;
|
||||
padding:0;
|
||||
cursor:pointer;
|
||||
cursor:hand;
|
||||
}
|
||||
|
||||
.adv_searchpopup_button:hover {
|
||||
background:url(../images/adv_searchbutton_hover.gif) no-repeat top left;
|
||||
}
|
||||
|
||||
a.search_button {
|
||||
width:26px;
|
||||
height:25px;
|
||||
float:left;
|
||||
margin-left:10px;
|
||||
display:inline;
|
||||
text-decoration:none;
|
||||
background:url(../images/searchicon_button.jpg) no-repeat top left;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
a:hover.search_button {
|
||||
background:url(../images/searchicon_button_hover.jpg) no-repeat top left;
|
||||
}
|
||||
|
||||
.actionpanel_button_wrapper{
|
||||
width:auto;
|
||||
height:27px;
|
||||
|
||||
BIN
ui/new/images/adv_searchbutton.gif
Normal file
BIN
ui/new/images/adv_searchbutton.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 781 B |
BIN
ui/new/images/adv_searchbutton_hover.gif
Normal file
BIN
ui/new/images/adv_searchbutton_hover.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 781 B |
@ -89,16 +89,61 @@ long milliseconds = new Date().getTime();
|
||||
<li>
|
||||
<div class="search_textbg">
|
||||
<input class="text" type="text" name="search_input" />
|
||||
<div class="search_closebutton" style="display:none;"></div>
|
||||
<div class="search_closebutton" style="display:block;"></div>
|
||||
</div>
|
||||
</li>
|
||||
</ol>
|
||||
</form>
|
||||
<a href="#">Advanced</a>
|
||||
<div class="adv_searchpopup" id="action_menu" style="display: none;">
|
||||
<div class="adv_searchformbox">
|
||||
<h3>
|
||||
Advance Search</h3>
|
||||
<a id="advanced_search_close" href="#">Close </a>
|
||||
<form action="#"method="post">
|
||||
<ol style="margin-top:8px;">
|
||||
<li>
|
||||
<label for="filter">
|
||||
Name:</label>
|
||||
<input class="text" type="text" name="adv_search_name" id="adv_search_name" />
|
||||
</li>
|
||||
<li>
|
||||
<label for="filter">
|
||||
Status:</label>
|
||||
<select class="select" id="adv_search_state">
|
||||
<option value=""></option>
|
||||
<option value="Creating">Creating</option>
|
||||
<option value="Starting">Starting</option>
|
||||
<option value="Running">Running</option>
|
||||
<option value="Stopping">Stopping</option>
|
||||
<option value="Stopped">Stopped</option>
|
||||
<option value="Destroyed">Destroyed</option>
|
||||
<option value="Expunging">Expunging</option>
|
||||
<option value="Migrating">Migrating</option>
|
||||
<option value="Error">Error</option>
|
||||
<option value="Unknown">Unknown</option>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
<label for="filter">
|
||||
Zone:</label>
|
||||
<select class="select" id="adv_search_zone">
|
||||
</select>
|
||||
</li>
|
||||
|
||||
</ol>
|
||||
</form>
|
||||
<div class="adv_search_actionbox">
|
||||
<div class="adv_searchpopup_button" id="adv_search_button">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actionpanel_button_wrapper" id="midmenu_action_link" style="position: relative;
|
||||
display: none">
|
||||
<div class="actionpanel_button">
|
||||
<div class="actionpanel_button">
|
||||
<div class="actionpanel_button_icons">
|
||||
<img src="images/actions_actionicon.png" alt="Add" /></div>
|
||||
<div class="actionpanel_button_links">
|
||||
@ -108,6 +153,7 @@ long milliseconds = new Date().getTime();
|
||||
</div>
|
||||
<div class="actionsdropdown_box" id="action_menu" style="display: none;">
|
||||
<ul class="actionsdropdown_boxlist" id="action_list">
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1,59 +1,59 @@
|
||||
<%@ page import="java.util.*" %>
|
||||
<%@ page import="com.cloud.utils.*" %>
|
||||
|
||||
<%
|
||||
Locale browserLocale = request.getLocale();
|
||||
CloudResourceBundle t = CloudResourceBundle.getBundle("resources/resource", browserLocale);
|
||||
%>
|
||||
|
||||
<!-- alert detail panel (begin) -->
|
||||
<div class="main_title" id="right_panel_header">
|
||||
<!--
|
||||
<div class="main_titleicon">
|
||||
<img src="images/instancetitle_icons.gif" alt="Instance" /></div>
|
||||
-->
|
||||
<h1>Alert
|
||||
</h1>
|
||||
</div>
|
||||
<div class="contentbox" id="right_panel_content">
|
||||
<div class="info_detailbox errorbox" id="after_action_info_container" style="display:none">
|
||||
<p id="after_action_info"></p>
|
||||
</div>
|
||||
<div class="tabbox" style="margin-top:15px;">
|
||||
<div class="content_tabs on">
|
||||
<%=t.t("Details")%></div>
|
||||
</div>
|
||||
<div class="grid_container">
|
||||
<div class="grid_rows odd">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
<%=t.t("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">
|
||||
<%=t.t("Description")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="description">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_rows odd">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
<%=t.t("Sent")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="sent">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%@ page import="java.util.*" %>
|
||||
<%@ page import="com.cloud.utils.*" %>
|
||||
|
||||
<%
|
||||
Locale browserLocale = request.getLocale();
|
||||
CloudResourceBundle t = CloudResourceBundle.getBundle("resources/resource", browserLocale);
|
||||
%>
|
||||
|
||||
<!-- alert detail panel (begin) -->
|
||||
<div class="main_title" id="right_panel_header">
|
||||
|
||||
<div class="main_titleicon">
|
||||
<img src="images/title_alerticon.gif" alt="Alerts" /></div>
|
||||
|
||||
<h1>Alerts
|
||||
</h1>
|
||||
</div>
|
||||
<div class="contentbox" id="right_panel_content">
|
||||
<div class="info_detailbox errorbox" id="after_action_info_container" style="display:none">
|
||||
<p id="after_action_info"></p>
|
||||
</div>
|
||||
<div class="tabbox" style="margin-top:15px;">
|
||||
<div class="content_tabs on">
|
||||
<%=t.t("Details")%></div>
|
||||
</div>
|
||||
<div class="grid_container">
|
||||
<div class="grid_rows odd">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
<%=t.t("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">
|
||||
<%=t.t("Description")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="description">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_rows odd">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
<%=t.t("Sent")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="sent">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- alert detail panel (end) -->
|
||||
@ -314,6 +314,13 @@
|
||||
<a id="cancel_link" href="#">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gridrow_loaderbox" style="display: none;" id="spinning_wheel">
|
||||
<div class="gridrow_loader">
|
||||
</div>
|
||||
<p id="description">
|
||||
Waiting …
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_detailspanel" id="management_area" style="display: none;">
|
||||
<div class="grid_details_pointer">
|
||||
@ -325,9 +332,7 @@
|
||||
<img src="images/network_managevmicon.gif" /></div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 60%;">
|
||||
<select class="select" style="width: 90%;">
|
||||
<option>Instance A </option>
|
||||
<option>Instance B </option>
|
||||
<select id="vm_select" class="select" style="width: 90%;">
|
||||
</select>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 30%;">
|
||||
@ -338,10 +343,10 @@
|
||||
<div class="gridrow_loader">
|
||||
</div>
|
||||
<p>
|
||||
Assigning instance to load balancer policy …</p>
|
||||
Assigning instance to load balancer rule …</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="grid_content" class="ip_description_managearea">
|
||||
<div id="subgrid_content" class="ip_description_managearea">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -354,10 +359,10 @@
|
||||
<div class="row_celltitles">
|
||||
<img src="images/network_managevmicon.gif" /></div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 50%;">
|
||||
<div class="grid_row_cell" style="width: 30%;">
|
||||
<div class="row_celltitles" id="vm_name"></div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 10%;">
|
||||
<div class="grid_row_cell" style="width: 30%;">
|
||||
<div class="row_celltitles" id="vm_private_ip"></div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 30%;">
|
||||
@ -368,7 +373,7 @@
|
||||
<div class="gridrow_loader">
|
||||
</div>
|
||||
<p>
|
||||
Removing instance from load balancer policy …</p>
|
||||
Removing instance from load balancer rule …</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Load Balancer's VM subgrid template (end) -->
|
||||
@ -1,159 +1,159 @@
|
||||
<%@ page import="java.util.*" %>
|
||||
|
||||
<%@ page import="com.cloud.utils.*" %>
|
||||
|
||||
<%
|
||||
Locale browserLocale = request.getLocale();
|
||||
CloudResourceBundle t = CloudResourceBundle.getBundle("resources/resource", browserLocale);
|
||||
%>
|
||||
<!-- router detail panel (begin) -->
|
||||
<div class="main_title" id="right_panel_header">
|
||||
<!--
|
||||
<div class="main_titleicon">
|
||||
<img src="images/title_eventsicon.gif" alt="Event" /></div>
|
||||
-->
|
||||
<h1>
|
||||
Router
|
||||
</h1>
|
||||
</div>
|
||||
<div class="contentbox" id="right_panel_content">
|
||||
<div class="info_detailbox errorbox" id="after_action_info_container" style="display: none">
|
||||
<p id="after_action_info">
|
||||
</p>
|
||||
</div>
|
||||
<div class="tabbox" style="margin-top: 15px;">
|
||||
<div class="content_tabs on">
|
||||
<%=t.t("Details")%></div>
|
||||
</div>
|
||||
<div id="tab_content_details">
|
||||
<div class="grid_actionpanel">
|
||||
<div class="grid_actionbox" id="action_link">
|
||||
<div class="grid_actionsdropdown_box" id="action_menu" style="display: none;">
|
||||
<ul class="actionsdropdown_boxlist" id="action_list">
|
||||
<!--
|
||||
<li> <a href="#"> Delete </a> </li>
|
||||
<li> <a href="#"> Attach Disk </a> </li>
|
||||
-->
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_editbox">
|
||||
</div>
|
||||
<div class="gridheader_loaderbox" id="spinning_wheel" style="border: 1px solid #999;
|
||||
display: none;">
|
||||
<div class="gridheader_loader" id="icon">
|
||||
</div>
|
||||
<p id="description">
|
||||
Detaching Disk …</p>
|
||||
</div>
|
||||
<div class="gridheader_message" id="action_message_box" style="border: 1px solid #999; display: none;">
|
||||
<p id="description"></p>
|
||||
<div class="close_button" id="close_button">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_container">
|
||||
<div class="grid_rows odd">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
<%=t.t("Status")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="state">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_rows even">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
<%=t.t("Zone")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="zonename">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_rows odd">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
<%=t.t("Name")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="name">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_rows even">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
<%=t.t("Public IP")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="publicip">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_rows odd">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
<%=t.t("Private IP")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="privateip">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_rows even">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
<%=t.t("Guest IP")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="guestipaddress">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_rows odd">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
<%=t.t("Host")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="hostname">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_rows even">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
<%=t.t("Network Domain")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="networkdomain">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_rows odd">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
<%=t.t("Account")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="account">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_rows even">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
<%=t.t("Created")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="created">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- router detail panel (end) -->
|
||||
<%@ page import="java.util.*" %>
|
||||
|
||||
<%@ page import="com.cloud.utils.*" %>
|
||||
|
||||
<%
|
||||
Locale browserLocale = request.getLocale();
|
||||
CloudResourceBundle t = CloudResourceBundle.getBundle("resources/resource", browserLocale);
|
||||
%>
|
||||
<!-- router detail panel (begin) -->
|
||||
<div class="main_title" id="right_panel_header">
|
||||
|
||||
<div class="main_titleicon">
|
||||
<img src="images/title_routersicon.gif" alt="Routers" /></div>
|
||||
|
||||
<h1>
|
||||
Router
|
||||
</h1>
|
||||
</div>
|
||||
<div class="contentbox" id="right_panel_content">
|
||||
<div class="info_detailbox errorbox" id="after_action_info_container" style="display: none">
|
||||
<p id="after_action_info">
|
||||
</p>
|
||||
</div>
|
||||
<div class="tabbox" style="margin-top: 15px;">
|
||||
<div class="content_tabs on">
|
||||
<%=t.t("Details")%></div>
|
||||
</div>
|
||||
<div id="tab_content_details">
|
||||
<div class="grid_actionpanel">
|
||||
<div class="grid_actionbox" id="action_link">
|
||||
<div class="grid_actionsdropdown_box" id="action_menu" style="display: none;">
|
||||
<ul class="actionsdropdown_boxlist" id="action_list">
|
||||
<!--
|
||||
<li> <a href="#"> Delete </a> </li>
|
||||
<li> <a href="#"> Attach Disk </a> </li>
|
||||
-->
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_editbox">
|
||||
</div>
|
||||
<div class="gridheader_loaderbox" id="spinning_wheel" style="border: 1px solid #999;
|
||||
display: none;">
|
||||
<div class="gridheader_loader" id="icon">
|
||||
</div>
|
||||
<p id="description">
|
||||
Detaching Disk …</p>
|
||||
</div>
|
||||
<div class="gridheader_message" id="action_message_box" style="border: 1px solid #999; display: none;">
|
||||
<p id="description"></p>
|
||||
<div class="close_button" id="close_button">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_container">
|
||||
<div class="grid_rows odd">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
<%=t.t("Status")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="state">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_rows even">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
<%=t.t("Zone")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="zonename">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_rows odd">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
<%=t.t("Name")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="name">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_rows even">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
<%=t.t("Public IP")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="publicip">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_rows odd">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
<%=t.t("Private IP")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="privateip">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_rows even">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
<%=t.t("Guest IP")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="guestipaddress">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_rows odd">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
<%=t.t("Host")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="hostname">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_rows even">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
<%=t.t("Network Domain")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="networkdomain">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_rows odd">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
<%=t.t("Account")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="account">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_rows even">
|
||||
<div class="grid_row_cell" style="width: 20%;">
|
||||
<div class="row_celltitles">
|
||||
<%=t.t("Created")%>:</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 79%;">
|
||||
<div class="row_celltitles" id="created">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- router detail panel (end) -->
|
||||
|
||||
@ -75,7 +75,7 @@ $(document).ready(function() {
|
||||
listMidMenuItems("leftmenu_account", "listAccounts", "listaccountsresponse", "account", "jsp/account.jsp", afterLoadAccountJSP, accountToMidmenu, accountToRigntPanel);
|
||||
listMidMenuItems("leftmenu_volume", "listVolumes", "listvolumesresponse", "volume", "jsp/volume.jsp", afterLoadVolumeJSP, volumeToMidmenu, volumeToRigntPanel);
|
||||
listMidMenuItems("leftmenu_snapshot", "listSnapshots", "listsnapshotsresponse", "snapshot", "jsp/snapshot.jsp", afterLoadSnapshotJSP, snapshotToMidmenu, snapshotToRigntPanel);
|
||||
listMidMenuItems("leftmenu_ip", "listPublicIpAddresses", "listpublicipaddressesresponse", "publicipaddress", "jsp/ip_address.jsp", afterLoadIpJSP, ipToMidmenu, ipToRigntPanel, ipGetMidmenuId);
|
||||
listMidMenuItems("leftmenu_ip", "listPublicIpAddresses", "listpublicipaddressesresponse", "publicipaddress", "jsp/ipaddress.jsp", afterLoadIpJSP, ipToMidmenu, ipToRigntPanel, ipGetMidmenuId);
|
||||
listMidMenuItems("leftmenu_router", "listRouters", "listroutersresponse", "router", "jsp/router.jsp", afterLoadRouterJSP, routerToMidmenu, routerToRigntPanel);
|
||||
|
||||
listMidMenuItems("leftmenu_submenu_my_template", "listTemplates&templatefilter=self", "listtemplatesresponse", "template", "jsp/template.jsp", afterLoadTemplateJSP, templateToMidmenu, templateToRigntPanel, templateGetMidmenuId);
|
||||
|
||||
@ -89,7 +89,7 @@ function afterLoadIpJSP() {
|
||||
$("#tab_content_load_balancer #grid_content").append($template.show());
|
||||
|
||||
var $spinningWheel = $template.find("#row_container").find("#spinning_wheel");
|
||||
$spinningWheel.find("#description").text("Adding....");
|
||||
$spinningWheel.find("#description").text("Adding load balancer rule....");
|
||||
$spinningWheel.show();
|
||||
|
||||
var ipObj = $("#right_panel_content #tab_content_details").data("jsonObj");
|
||||
@ -112,7 +112,7 @@ function afterLoadIpJSP() {
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var items = json.createloadbalancerruleresponse.loadbalancerrule;
|
||||
loadBalancerJsonToTemplate(items[0],$template);
|
||||
loadBalancerJsonToTemplate(items[0], $template);
|
||||
$spinningWheel.hide();
|
||||
refreshCreateLoadBalancerRow();
|
||||
},
|
||||
@ -125,8 +125,6 @@ function afterLoadIpJSP() {
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
function ipGetMidmenuId(jsonObj) {
|
||||
@ -145,18 +143,31 @@ function ipToMidmenu(jsonObj, $midmenuItem1) {
|
||||
$midmenuItem1.find("#second_row").text(fromdb(jsonObj.account).substring(0,25));
|
||||
}
|
||||
|
||||
function isIpManageable(domainid, account) {
|
||||
if((g_domainid == domainid && g_account == account) || (isAdmin() && account!="system"))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function ipToRigntPanel($midmenuItem1) {
|
||||
var ipObj = $midmenuItem1.data("jsonObj");
|
||||
|
||||
//Details tab
|
||||
ipJsonToDetailsTab(ipObj);
|
||||
$("#tab_details").click();
|
||||
|
||||
//Port Forwarding tab
|
||||
listPortForwardingRules(ipObj);
|
||||
refreshCreatePortForwardingRow();
|
||||
|
||||
//Load Balancer tab
|
||||
listLoadBalancerRules(ipObj);
|
||||
//Port Forwarding tab, Load Balancer tab
|
||||
if(isIpManageable(ipObj.domainid, ipObj.account) == true) {
|
||||
$("#tab_port_forwarding, #tab_load_balancer").show();
|
||||
listPortForwardingRules(ipObj);
|
||||
refreshCreatePortForwardingRow();
|
||||
listLoadBalancerRules(ipObj);
|
||||
refreshCreateLoadBalancerRow();
|
||||
}
|
||||
else {
|
||||
$("#tab_port_forwarding, #tab_load_balancer").hide();
|
||||
}
|
||||
}
|
||||
|
||||
function ipJsonToDetailsTab(jsonObj) {
|
||||
@ -220,20 +231,21 @@ function listPortForwardingRules(ipObj) {
|
||||
}
|
||||
|
||||
//var portForwardingIndex = 0;
|
||||
function portForwardingJsonToTemplate(jsonObj, template) {
|
||||
//(portForwardingIndex++ % 2 == 0)? template.find("#row_container").addClass("smallrow_even"): template.find("#row_container").addClass("smallrow_odd");
|
||||
template.attr("id", "portForwarding_" + jsonObj.id).data("portForwardingId", jsonObj.id);
|
||||
function portForwardingJsonToTemplate(jsonObj, $template) {
|
||||
//(portForwardingIndex++ % 2 == 0)? $template.find("#row_container").addClass("smallrow_even"): $template.find("#row_container").addClass("smallrow_odd");
|
||||
$template.attr("id", "portForwarding_" + jsonObj.id).data("portForwardingId", jsonObj.id);
|
||||
|
||||
template.find("#row_container #public_port").text(jsonObj.publicport);
|
||||
template.find("#row_container_edit #public_port").text(jsonObj.publicport);
|
||||
$template.find("#row_container #public_port").text(jsonObj.publicport);
|
||||
$template.find("#row_container_edit #public_port").text(jsonObj.publicport);
|
||||
|
||||
template.find("#row_container #private_port").text(jsonObj.privateport);
|
||||
template.find("#row_container_edit #private_port").val(jsonObj.privateport);
|
||||
$template.find("#row_container #private_port").text(jsonObj.privateport);
|
||||
$template.find("#row_container_edit #private_port").val(jsonObj.privateport);
|
||||
|
||||
template.find("#row_container #protocol").text(jsonObj.protocol);
|
||||
template.find("#row_container_edit #protocol").text(jsonObj.protocol);
|
||||
|
||||
template.find("#row_container #vm_name").text(jsonObj.vmname);
|
||||
$template.find("#row_container #protocol").text(jsonObj.protocol);
|
||||
$template.find("#row_container_edit #protocol").text(jsonObj.protocol);
|
||||
|
||||
var vmName = getVmName(jsonObj.vmname, jsonObj.vmdisplayname); //jsonObj doesn't include vmdisplayname property(incorrect). Waiting for Bug 6241 to be fixed....
|
||||
$template.find("#row_container #vm_name").text(vmName);
|
||||
var virtualMachineId = jsonObj.virtualmachineid;
|
||||
|
||||
var $detailsTab = $("#right_panel_content #tab_content_details");
|
||||
@ -247,7 +259,7 @@ function portForwardingJsonToTemplate(jsonObj, template) {
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var instances = json.listvirtualmachinesresponse.virtualmachine;
|
||||
var vmSelect = template.find("#row_container_edit #vm").empty();
|
||||
var vmSelect = $template.find("#row_container_edit #vm").empty();
|
||||
if (instances != null && instances.length > 0) {
|
||||
for (var i = 0; i < instances.length; i++) {
|
||||
var html = $("<option value='" + instances[i].id + "'>" + getVmName(instances[i].name, instances[i].displayname) + "</option>");
|
||||
@ -258,10 +270,10 @@ function portForwardingJsonToTemplate(jsonObj, template) {
|
||||
}
|
||||
});
|
||||
|
||||
var $rowContainer = template.find("#row_container");
|
||||
var $rowContainerEdit = template.find("#row_container_edit");
|
||||
var $rowContainer = $template.find("#row_container");
|
||||
var $rowContainerEdit = $template.find("#row_container_edit");
|
||||
|
||||
template.find("#delete_link").unbind("click").bind("click", function(event){
|
||||
$template.find("#delete_link").unbind("click").bind("click", function(event){
|
||||
var $spinningWheel = $rowContainer.find("#spinning_wheel");
|
||||
$spinningWheel.find("#description").text("Deleting....");
|
||||
$spinningWheel.show();
|
||||
@ -269,7 +281,7 @@ function portForwardingJsonToTemplate(jsonObj, template) {
|
||||
data: createURL("command=deletePortForwardingRule&id="+jsonObj.id),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
template.slideUp("slow", function(){
|
||||
$template.slideUp("slow", function(){
|
||||
$(this).remove();
|
||||
});
|
||||
},
|
||||
@ -281,17 +293,17 @@ function portForwardingJsonToTemplate(jsonObj, template) {
|
||||
return false;
|
||||
});
|
||||
|
||||
template.find("#edit_link").unbind("click").bind("click", function(event){
|
||||
$template.find("#edit_link").unbind("click").bind("click", function(event){
|
||||
$rowContainer.hide();
|
||||
$rowContainerEdit.show();
|
||||
});
|
||||
|
||||
template.find("#cancel_link").unbind("click").bind("click", function(event){
|
||||
$template.find("#cancel_link").unbind("click").bind("click", function(event){
|
||||
$rowContainer.show();
|
||||
$rowContainerEdit.hide();
|
||||
});
|
||||
|
||||
template.find("#save_link").unbind("click").bind("click", function(event){
|
||||
$template.find("#save_link").unbind("click").bind("click", function(event){
|
||||
// validate values
|
||||
var isValid = true;
|
||||
isValid &= validateNumber("Private Port", $rowContainerEdit.find("#private_port"), $rowContainerEdit.find("#private_port_errormsg"), 1, 65535);
|
||||
@ -332,7 +344,7 @@ function portForwardingJsonToTemplate(jsonObj, template) {
|
||||
$("body").stopTime(timerKey);
|
||||
if (result.jobstatus == 1) { // Succeeded
|
||||
var items = result.portforwardingrule;
|
||||
portForwardingJsonToTemplate(items[0],template);
|
||||
portForwardingJsonToTemplate(items[0],$template);
|
||||
$spinningWheel.hide();
|
||||
$rowContainerEdit.hide();
|
||||
$rowContainer.show();
|
||||
@ -402,38 +414,38 @@ function listLoadBalancerRules(ipObj) {
|
||||
loadBalancerGrid.empty();
|
||||
if (items != null && items.length > 0) {
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
var template = $("#load_balancer_template").clone(true);
|
||||
loadBalancerJsonToTemplate(items[i], template);
|
||||
loadBalancerGrid.append(template.show());
|
||||
var $template = $("#load_balancer_template").clone(true);
|
||||
loadBalancerJsonToTemplate(items[i], $template);
|
||||
loadBalancerGrid.append($template.show());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function loadBalancerJsonToTemplate(jsonObj, template) {
|
||||
//(loadBalancerIndex++ % 2 == 0)? template.find("#row_container").addClass("smallrow_even"): template.find("#row_container").addClass("smallrow_odd");
|
||||
function loadBalancerJsonToTemplate(jsonObj, $template) {
|
||||
//(loadBalancerIndex++ % 2 == 0)? $template.find("#row_container").addClass("smallrow_even"): $template.find("#row_container").addClass("smallrow_odd");
|
||||
|
||||
var loadBalancerId = jsonObj.id;
|
||||
template.attr("id", "loadBalancer_" + loadBalancerId).data("loadBalancerId", loadBalancerId);
|
||||
$template.attr("id", "loadBalancer_" + loadBalancerId).data("loadBalancerId", loadBalancerId);
|
||||
|
||||
template.find("#row_container #name").text(jsonObj.name);
|
||||
template.find("#row_container_edit #name").val(jsonObj.name);
|
||||
$template.find("#row_container #name").text(jsonObj.name);
|
||||
$template.find("#row_container_edit #name").val(jsonObj.name);
|
||||
|
||||
template.find("#row_container #public_port").text(jsonObj.publicport);
|
||||
template.find("#row_container_edit #public_port").text(jsonObj.publicport);
|
||||
$template.find("#row_container #public_port").text(jsonObj.publicport);
|
||||
$template.find("#row_container_edit #public_port").text(jsonObj.publicport);
|
||||
|
||||
template.find("#row_container #private_port").text(jsonObj.privateport);
|
||||
template.find("#row_container_edit #private_port").val(jsonObj.privateport);
|
||||
$template.find("#row_container #private_port").text(jsonObj.privateport);
|
||||
$template.find("#row_container_edit #private_port").val(jsonObj.privateport);
|
||||
|
||||
template.find("#row_container #algorithm").text(jsonObj.algorithm);
|
||||
template.find("#row_container_edit #algorithm").val(jsonObj.algorithm);
|
||||
$template.find("#row_container #algorithm").text(jsonObj.algorithm);
|
||||
$template.find("#row_container_edit #algorithm").val(jsonObj.algorithm);
|
||||
|
||||
template.find("#manage_link").unbind("click").bind("click", function(event){
|
||||
var managementArea = template.find("#management_area");
|
||||
var vmSubgrid = managementArea.find("#grid_content");
|
||||
if(managementArea.css("display") == "none") {
|
||||
vmSubgrid.empty();
|
||||
$template.find("#manage_link").unbind("click").bind("click", function(event){
|
||||
var $managementArea = $template.find("#management_area");
|
||||
var $vmSubgrid = $managementArea.find("#subgrid_content");
|
||||
if($managementArea.css("display") == "none") {
|
||||
$vmSubgrid.empty();
|
||||
$.ajax({
|
||||
cache: false,
|
||||
data: createURL("command=listLoadBalancerRuleInstances&id="+loadBalancerId),
|
||||
@ -442,100 +454,105 @@ function loadBalancerJsonToTemplate(jsonObj, template) {
|
||||
var instances = json.listloadbalancerruleinstancesresponse.loadbalancerruleinstance;
|
||||
if (instances != null && instances.length > 0) {
|
||||
for (var i = 0; i < instances.length; i++) {
|
||||
var lbVmTemplate = $("#load_balancer_vm_template").clone();
|
||||
var $lbVmTemplate = $("#load_balancer_vm_template").clone();
|
||||
var obj = {"loadBalancerId": loadBalancerId, "vmId": instances[i].id, "vmName": getVmName(instances[i].name, instances[i].displayname), "vmPrivateIp": instances[i].privateip};
|
||||
lbVmObjToTemplate(obj, lbVmTemplate);
|
||||
vmSubgrid.append(lbVmTemplate.show());
|
||||
lbVmObjToTemplate(obj, $lbVmTemplate);
|
||||
$vmSubgrid.append($lbVmTemplate.show());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
managementArea.show();
|
||||
$managementArea.show();
|
||||
}
|
||||
else {
|
||||
managementArea.hide();
|
||||
$managementArea.hide();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
//???
|
||||
var loadingContainer = template.find("#loading_container");
|
||||
var rowContainer = template.find("#row_container");
|
||||
var rowContainerEdit = template.find("#row_container_edit");
|
||||
|
||||
var $rowContainer = $template.find("#row_container");
|
||||
var $rowContainerEdit = $template.find("#row_container_edit");
|
||||
|
||||
template.find("#delete_link").unbind("click").bind("click", function(event){
|
||||
loadingContainer.find(".adding_text").text("Deleting....");
|
||||
loadingContainer.show();
|
||||
rowContainer.hide();
|
||||
$template.find("#delete_link").unbind("click").bind("click", function(event){
|
||||
var $managementArea = $template.find("#management_area");
|
||||
if($managementArea.css("display") != "none")
|
||||
$managementArea.hide();
|
||||
|
||||
var $spinningWheel = $template.find("#row_container").find("#spinning_wheel");
|
||||
$spinningWheel.find("#description").text("Deleting load balancer rule....");
|
||||
$spinningWheel.show();
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=deleteLoadBalancerRule&id="+loadBalancerId),
|
||||
data: createURL("command=deleteLoadBalancerRule&id="+loadBalancerId),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var lbJSON = jsonObj.deleteloadbalancerruleresponse;
|
||||
var timerKey = "deleteLoadBalancerRuleJob_"+lbjsonObj.jobid;
|
||||
success: function(json) {
|
||||
var jobId = json.deleteloadbalancerruleresponse.jobid;
|
||||
var timerKey = "deleteLoadBalancerRuleJob_"+jobId;
|
||||
$("body").everyTime(
|
||||
5000,
|
||||
timerKey,
|
||||
function() {
|
||||
$.ajax({
|
||||
data: createURL("command=queryAsyncJobResult&jobId="+lbjsonObj.jobid),
|
||||
data: createURL("command=queryAsyncJobResult&jobId="+jobId),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var result = jsonObj.queryasyncjobresultresponse;
|
||||
var result = json.queryasyncjobresultresponse;
|
||||
if (result.jobstatus == 0) {
|
||||
return; //Job has not completed
|
||||
} else {
|
||||
$("body").stopTime(timerKey);
|
||||
if (result.jobstatus == 1) { // Succeeded
|
||||
template.slideUp("slow", function() {
|
||||
$template.slideUp("slow", function() {
|
||||
$(this).remove();
|
||||
});
|
||||
} else if (result.jobstatus == 2) { // Failed
|
||||
loadingContainer.hide();
|
||||
rowContainer.show();
|
||||
$spinningWheel.hide();
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
handleError(XMLHttpResponse);
|
||||
error: function(XMLHttpResponse) {
|
||||
$("body").stopTime(timerKey);
|
||||
loadingContainer.hide();
|
||||
rowContainer.show();
|
||||
$spinningWheel.hide();
|
||||
handleError(XMLHttpResponse);
|
||||
}
|
||||
});
|
||||
},
|
||||
0
|
||||
);
|
||||
}
|
||||
,
|
||||
error: function(XMLHttpResponse) {
|
||||
$spinningWheel.hide();
|
||||
handleError(XMLHttpResponse);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
template.find("#edit_link").unbind("click").bind("click", function(event){
|
||||
rowContainer.hide();
|
||||
rowContainerEdit.show();
|
||||
$template.find("#edit_link").unbind("click").bind("click", function(event){
|
||||
$rowContainer.hide();
|
||||
$rowContainerEdit.show();
|
||||
});
|
||||
|
||||
template.find("#cancel_link").unbind("click").bind("click", function(event){
|
||||
rowContainer.show();
|
||||
rowContainerEdit.hide();
|
||||
$template.find("#cancel_link").unbind("click").bind("click", function(event){
|
||||
$rowContainer.show();
|
||||
$rowContainerEdit.hide();
|
||||
});
|
||||
|
||||
template.find("#save_link").unbind("click").bind("click", function(event){
|
||||
// validate values
|
||||
$template.find("#save_link").unbind("click").bind("click", function(event){
|
||||
var isValid = true;
|
||||
isValid &= validateString("Name", rowContainerEdit.find("#name"), rowContainerEdit.find("#name_errormsg"));
|
||||
isValid &= validateNumber("Private Port", rowContainerEdit.find("#private_port"), rowContainerEdit.find("#private_port_errormsg"), 1, 65535);
|
||||
if (!isValid) return;
|
||||
isValid &= validateString("Name", $rowContainerEdit.find("#name"), $rowContainerEdit.find("#name_errormsg"));
|
||||
isValid &= validateNumber("Private Port", $rowContainerEdit.find("#private_port"), $rowContainerEdit.find("#private_port_errormsg"), 1, 65535);
|
||||
if (!isValid)
|
||||
return;
|
||||
|
||||
var loadingContainer = template.find(".adding_loading");
|
||||
loadingContainer.find(".adding_text").text("Saving....");
|
||||
loadingContainer.show();
|
||||
rowContainerEdit.hide();
|
||||
var $spinningWheel = $template.find("#row_container_edit").find("#spinning_wheel");
|
||||
$spinningWheel.find("#description").text("Saving load balancer rule....");
|
||||
$spinningWheel.show();
|
||||
|
||||
var name = rowContainerEdit.find("#name").val();
|
||||
var privatePort = rowContainerEdit.find("#private_port").val();
|
||||
var algorithm = rowContainerEdit.find("#algorithm_select").val();
|
||||
var name = $rowContainerEdit.find("#name").val();
|
||||
var privatePort = $rowContainerEdit.find("#private_port").val();
|
||||
var algorithm = $rowContainerEdit.find("#algorithm_select").val();
|
||||
|
||||
var array1 = [];
|
||||
array1.push("&id=" + loadBalancerId);
|
||||
@ -547,7 +564,7 @@ function loadBalancerJsonToTemplate(jsonObj, template) {
|
||||
data: createURL("command=updateLoadBalancerRule"+array1.join("")),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var jobId = jsonObj.updateloadbalancerruleresponse.jobid;
|
||||
var jobId = json.updateloadbalancerruleresponse.jobid;
|
||||
var timerKey = "updateloadbalancerruleJob"+jobId;
|
||||
|
||||
$("body").everyTime(2000, timerKey, function() {
|
||||
@ -555,91 +572,94 @@ function loadBalancerJsonToTemplate(jsonObj, template) {
|
||||
data: createURL("command=queryAsyncJobResult&jobId="+jobId),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var result = jsonObj.queryasyncjobresultresponse;
|
||||
var result = json.queryasyncjobresultresponse;
|
||||
if (result.jobstatus == 0) {
|
||||
return; //Job has not completed
|
||||
} else {
|
||||
$("body").stopTime(timerKey);
|
||||
if (result.jobstatus == 1) { // Succeeded
|
||||
var items = result.loadbalancer;
|
||||
loadBalancerJsonToTemplate(items[0],template);
|
||||
loadingContainer.hide();
|
||||
rowContainer.show();
|
||||
loadBalancerJsonToTemplate(items[0],$template);
|
||||
$spinningWheel.hide();
|
||||
$rowContainerEdit.hide();
|
||||
$rowContainer.show();
|
||||
} else if (result.jobstatus == 2) { //Fail
|
||||
loadingContainer.hide();
|
||||
rowContainer.show();
|
||||
$spinningWheel.hide();
|
||||
$rowContainerEdit.hide();
|
||||
$rowContainer.show();
|
||||
$("#dialog_alert").html("<p>" + sanitizeXSS(result.jobresult) + "</p>").dialog("open");
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
handleError(XMLHttpResponse);
|
||||
error: function(XMLHttpResponse) {
|
||||
$("body").stopTime(timerKey);
|
||||
loadingContainer.hide();
|
||||
rowContainer.show();
|
||||
$spinningWheel.hide();
|
||||
$rowContainerEdit.hide();
|
||||
$rowContainer.show();
|
||||
handleError(XMLHttpResponse);
|
||||
}
|
||||
});
|
||||
}, 0);
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
handleError(XMLHttpResponse);
|
||||
loadingContainer.hide();
|
||||
rowContainer.show();
|
||||
$spinningWheel.hide();
|
||||
$rowContainerEdit.hide();
|
||||
$rowContainer.show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
refreshLbVmSelect(template, jsonObj.id);
|
||||
refreshLbVmSelect($template, jsonObj.id);
|
||||
|
||||
template.find("#add_vm_to_lb_row #add_link").unbind("click").bind("click", function(event){
|
||||
var vmOption = template.find("#add_vm_to_lb_row #vm_select option:selected");
|
||||
$template.find("#add_vm_to_lb_row #assign_link").unbind("click").bind("click", function(event){
|
||||
var vmOption = $template.find("#add_vm_to_lb_row #vm_select option:selected");
|
||||
var vmId = vmOption.val();
|
||||
var vmName = vmOption.data("vmName");
|
||||
var vmPrivateIp = vmOption.data("vmPrivateIp");
|
||||
if(vmId == null || vmId.length == 0)
|
||||
return;
|
||||
var loading = template.find("#adding_loading").show();
|
||||
var rowContainer = template.find("#adding_row_container").hide();
|
||||
|
||||
|
||||
var $spinningWheel = $template.find("#add_vm_to_lb_row #spinning_wheel");
|
||||
$spinningWheel.show();
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=assignToLoadBalancerRule&id="+loadBalancerId+"&virtualmachineid="+vmId),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var lbInstanceJSON = jsonObj.assigntoloadbalancerruleresponse;
|
||||
var timerKey = "lbInstanceNew"+lbInstancejsonObj.jobid;
|
||||
var lbInstanceJSON = json.assigntoloadbalancerruleresponse;
|
||||
var jobId = lbInstanceJSON.jobid;
|
||||
var timerKey = "assignToLoadBalancerRuleJob_"+jobId;
|
||||
$("body").everyTime(
|
||||
5000,
|
||||
timerKey,
|
||||
function() {
|
||||
$.ajax({
|
||||
data: createURL("command=queryAsyncJobResult&jobId="+lbInstancejsonObj.jobid),
|
||||
data: createURL("command=queryAsyncJobResult&jobId="+jobId),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var result = jsonObj.queryasyncjobresultresponse;
|
||||
var result = json.queryasyncjobresultresponse;
|
||||
if (result.jobstatus == 0) {
|
||||
return; //Job has not completed
|
||||
} else {
|
||||
$("body").stopTime(timerKey);
|
||||
if (result.jobstatus == 1) { // Succeeded
|
||||
var lbVmTemplate = $("#load_balancer_vm_template").clone();
|
||||
var $lbVmTemplate = $("#load_balancer_vm_template").clone();
|
||||
var obj = {"loadBalancerId": loadBalancerId, "vmId": vmId, "vmName": vmName, "vmPrivateIp": vmPrivateIp};
|
||||
lbVmObjToTemplate(obj, lbVmTemplate);
|
||||
template.find("#management_area #grid_content").append(lbVmTemplate.show());
|
||||
refreshLbVmSelect(template, loadBalancerId);
|
||||
loading.hide();
|
||||
rowContainer.show();
|
||||
lbVmObjToTemplate(obj, $lbVmTemplate);
|
||||
$template.find("#management_area #subgrid_content").append($lbVmTemplate.show());
|
||||
refreshLbVmSelect($template, loadBalancerId);
|
||||
$spinningWheel.hide();
|
||||
} else if (result.jobstatus == 2) { // Failed
|
||||
$("#dialog_error").html("<p style='color:red'><b>Operation error:</b></p><br/><p style='color:red'>"+ sanitizeXSS(result.jobresult)+"</p>").dialog("open");
|
||||
loading.hide();
|
||||
rowContainer.show();
|
||||
$spinningWheel.hide();
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
handleError(XMLHttpResponse);
|
||||
$("body").stopTime(timerKey);
|
||||
loading.hide();
|
||||
rowContainer.show();
|
||||
$spinningWheel.hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -648,13 +668,11 @@ function loadBalancerJsonToTemplate(jsonObj, template) {
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
handleError(XMLHttpResponse);
|
||||
loading.hide();
|
||||
rowContainer.show();
|
||||
$spinningWheel.hide();
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
//???
|
||||
});
|
||||
}
|
||||
|
||||
function refreshCreateLoadBalancerRow() {
|
||||
@ -666,28 +684,26 @@ function refreshCreateLoadBalancerRow() {
|
||||
}
|
||||
|
||||
|
||||
function lbVmObjToTemplate(obj, template) {
|
||||
template.find("#vm_name").text(obj.vmName);
|
||||
template.find("#vm_private_ip").text(obj.vmPrivateIp);
|
||||
template.find("#remove_link").bind("click", function(event){
|
||||
var $spinningWheel = $template.find("#row_container").find("#spinning_wheel");
|
||||
$spinningWheel.show();
|
||||
|
||||
//var loading = template.find("#deleting_loading").show();
|
||||
//var rowContainer = template.find("#deleting_row_container").hide();
|
||||
|
||||
function lbVmObjToTemplate(obj, $template) {
|
||||
$template.find("#vm_name").text(obj.vmName);
|
||||
$template.find("#vm_private_ip").text(obj.vmPrivateIp);
|
||||
|
||||
$template.find("#remove_link").bind("click", function(event){
|
||||
var $spinningWheel = $template.find("#spinning_wheel");
|
||||
$spinningWheel.show();
|
||||
$.ajax({
|
||||
data: createURL("command=removeFromLoadBalancerRule&id="+obj.loadBalancerId+"&virtualmachineid="+obj.vmId),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var lbJSON = json.removefromloadbalancerruleresponse;
|
||||
var timerKey = "removeVmFromLb"+obj.vmId;
|
||||
var jobId = lbJSON.jobid;
|
||||
var timerKey = "removeFromLoadBalancerRuleJob_"+jobId;
|
||||
$("body").everyTime(
|
||||
5000,
|
||||
timerKey,
|
||||
function() {
|
||||
$.ajax({
|
||||
data: createURL("command=queryAsyncJobResult&jobId="+lbJSON.jobid),
|
||||
data: createURL("command=queryAsyncJobResult&jobId="+jobId),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var result = json.queryasyncjobresultresponse;
|
||||
@ -697,7 +713,7 @@ function lbVmObjToTemplate(obj, template) {
|
||||
$("body").stopTime(timerKey);
|
||||
if (result.jobstatus == 1) { // Succeeded
|
||||
refreshLbVmSelect($("#loadBalancer_" + obj.loadBalancerId), obj.loadBalancerId);
|
||||
template.fadeOut("slow", function(event) {
|
||||
$template.fadeOut("slow", function(event) {
|
||||
$(this).remove();
|
||||
});
|
||||
} else if (result.jobstatus == 2) { // Failed
|
||||
@ -725,8 +741,8 @@ function lbVmObjToTemplate(obj, template) {
|
||||
});
|
||||
}
|
||||
|
||||
function refreshLbVmSelect(template, loadBalancerId) {
|
||||
var vmSelect = template.find("#add_vm_to_lb_row #vm_select");
|
||||
function refreshLbVmSelect($template, loadBalancerId) {
|
||||
var vmSelect = $template.find("#add_vm_to_lb_row #vm_select");
|
||||
// Load the select box with the VMs that haven't been applied a LB rule to.
|
||||
$.ajax({
|
||||
cache: false,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user