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
ad571eef36
|
|
@ -6,6 +6,8 @@ package com.cloud.acl;
|
|||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.offering.DiskOffering;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.utils.component.Adapter;
|
||||
|
|
@ -57,6 +59,10 @@ public interface SecurityChecker extends Adapter {
|
|||
|
||||
boolean checkAccess(Account account, DataCenter zone) throws PermissionDeniedException;
|
||||
|
||||
public boolean checkAccess(Account account, ServiceOffering so) throws PermissionDeniedException;
|
||||
|
||||
boolean checkAccess(Account account, DiskOffering dof) throws PermissionDeniedException;
|
||||
|
||||
// We should be able to use this method to check against commands. For example, we can
|
||||
// annotate the command with access annotations and this method can use it to extract
|
||||
// OwnedBy and PartOf interfaces on the object and use it to verify against a user.
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.VolumeResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.user.Account;
|
||||
|
|
@ -85,6 +86,14 @@ public class AttachVolumeCmd extends BaseAsyncCmd {
|
|||
public String getName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Volume;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAccountId() {
|
||||
|
|
@ -107,6 +116,11 @@ public class AttachVolumeCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public void execute(){
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
Volume result = _userVmService.attachVolumeToVM(this);
|
||||
if (result != null) {
|
||||
VolumeResponse response = _responseGenerator.createVolumeResponse(result);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.HostResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.user.Account;
|
||||
|
|
@ -87,6 +88,14 @@ public class CancelMaintenanceCmd extends BaseAsyncCmd {
|
|||
public String getEventDescription() {
|
||||
return "canceling maintenance for host: " + getId();
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Host;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.TemplateResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.StorageUnavailableException;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
|
|
@ -99,6 +100,14 @@ public class CopyIsoCmd extends BaseAsyncCmd {
|
|||
public String getEventDescription() {
|
||||
return "copying ISO: " + getId() + " from zone: " + getSourceZoneId() + " to zone: " + getDestinationZoneId();
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Iso;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.TemplateResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.StorageUnavailableException;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
|
|
@ -100,6 +101,14 @@ public class CopyTemplateCmd extends BaseAsyncCmd {
|
|||
public String getEventDescription() {
|
||||
return "copying template: " + getId() + " from zone: " + getSourceZoneId() + " to zone: " + getDestinationZoneId();
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Template;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import com.cloud.api.BaseCmd;
|
|||
import com.cloud.api.Implementation;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.BaseCmd.CommandType;
|
||||
import com.cloud.api.response.ServiceOfferingResponse;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
|
||||
|
|
@ -64,6 +65,9 @@ public class CreateServiceOfferingCmd extends BaseCmd {
|
|||
@Parameter(name=ApiConstants.USE_VIRTUAL_NETWORK, type=CommandType.BOOLEAN, description="if true, the VM created will use default virtual networking. If false, the VM created will use a direct attached networking model. The default value is true.")
|
||||
private Boolean useVirtualNetwork;
|
||||
|
||||
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the ID of the containing domain, null for public offerings")
|
||||
private Long domainId;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -100,7 +104,11 @@ public class CreateServiceOfferingCmd extends BaseCmd {
|
|||
return tags;
|
||||
}
|
||||
|
||||
public Boolean getUseVirtualNetwork() {
|
||||
public Long getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
|
||||
public Boolean getUseVirtualNetwork() {
|
||||
return useVirtualNetwork;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.SnapshotResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.storage.Snapshot;
|
||||
|
|
@ -100,7 +101,11 @@ public class CreateSnapshotCmd extends BaseAsyncCmd {
|
|||
public String getEventDescription() {
|
||||
return "creating snapshot for volume: " + getVolumeId();
|
||||
}
|
||||
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Snapshot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import com.cloud.api.Parameter;
|
|||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.StoragePoolResponse;
|
||||
import com.cloud.api.response.TemplateResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.storage.Snapshot;
|
||||
import com.cloud.storage.Volume;
|
||||
|
|
@ -161,6 +162,10 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd {
|
|||
public String getEventDescription() {
|
||||
return "creating template: " + getTemplateName();
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Template;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callCreate(){
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.VolumeResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.storage.Volume;
|
||||
|
|
@ -108,7 +109,11 @@ public class CreateVolumeCmd extends BaseAsyncCreateCmd {
|
|||
public static String getResultObjectName() {
|
||||
return "volume";
|
||||
}
|
||||
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Volume;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAccountId() {
|
||||
Account account = UserContext.current().getAccount();
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.SuccessResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import com.cloud.user.Account;
|
||||
|
|
@ -91,6 +92,14 @@ public class DeleteIsoCmd extends BaseAsyncCmd {
|
|||
return "Deleting iso " + getId();
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Iso;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
boolean result = _templateService.deleteIso(this);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.SuccessResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.storage.Snapshot;
|
||||
import com.cloud.user.Account;
|
||||
|
|
@ -80,6 +81,14 @@ public class DeleteSnapshotCmd extends BaseAsyncCmd {
|
|||
public String getEventDescription() {
|
||||
return "deleting snapshot: " + getId();
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Snapshot;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.SuccessResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import com.cloud.user.Account;
|
||||
|
|
@ -93,6 +94,14 @@ public class DeleteTemplateCmd extends BaseAsyncCmd {
|
|||
return "Deleting template " + getId();
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Template;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
boolean result = _templateService.deleteTemplate(this);
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.VolumeResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.user.Account;
|
||||
|
|
@ -77,6 +78,14 @@ public class DetachVolumeCmd extends BaseAsyncCmd {
|
|||
public static String getResultObjectName() {
|
||||
return "volume";
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Volume;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAccountId() {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.ExtractResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.InternalErrorException;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
|
|
@ -106,6 +107,14 @@ public class ExtractIsoCmd extends BaseAsyncCmd {
|
|||
return s_name;
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Iso;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.ExtractResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.InternalErrorException;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
|
|
@ -106,6 +107,14 @@ public class ExtractTemplateCmd extends BaseAsyncCmd {
|
|||
public String getEventDescription() {
|
||||
return "Extraction job";
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Template;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.ExtractResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.storage.Upload;
|
||||
|
|
@ -91,6 +92,14 @@ public class ExtractVolumeCmd extends BaseAsyncCmd {
|
|||
public static String getStaticName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Volume;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAccountId() {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public class ListDiskOfferingsCmd extends BaseListCmd {
|
|||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the ID of the domain of the disk offering. This information is not currently applicable, and should not be used as a parameter.")
|
||||
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the ID of the domain of the disk offering.")
|
||||
private Long domainId;
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="ID of the disk offering")
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.response.HostResponse;
|
||||
import com.cloud.api.response.ListResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.host.Host;
|
||||
|
||||
@Implementation(description="Lists hosts.", responseObject=HostResponse.class)
|
||||
|
|
@ -103,6 +104,10 @@ public class ListHostsCmd extends BaseListCmd {
|
|||
@Override
|
||||
public String getName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Host;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.response.ListResponse;
|
||||
import com.cloud.api.response.TemplateResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import com.cloud.template.VirtualMachineTemplate.TemplateFilter;
|
||||
import com.cloud.user.Account;
|
||||
|
|
@ -130,6 +131,10 @@ public class ListIsosCmd extends BaseListCmd {
|
|||
return s_name;
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Iso;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
List<? extends VirtualMachineTemplate> isos = _mgr.listIsos(this);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.response.DomainRouterResponse;
|
||||
import com.cloud.api.response.ListResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.network.router.VirtualRouter;
|
||||
|
||||
@Implementation(description="List routers.", responseObject=DomainRouterResponse.class)
|
||||
|
|
@ -102,6 +103,10 @@ public class ListRoutersCmd extends BaseListCmd {
|
|||
public String getName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.DomainRouter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import com.cloud.api.ApiConstants;
|
|||
import com.cloud.api.BaseListCmd;
|
||||
import com.cloud.api.Implementation;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.BaseCmd.CommandType;
|
||||
import com.cloud.api.response.ListResponse;
|
||||
import com.cloud.api.response.ServiceOfferingResponse;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
|
|
@ -48,6 +49,9 @@ public class ListServiceOfferingsCmd extends BaseListCmd {
|
|||
|
||||
@Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, description="the ID of the virtual machine. Pass this in if you want to see the available service offering that a virtual machine can be changed to.")
|
||||
private Long virtualMachineId;
|
||||
|
||||
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the ID of the domain associated with the service offering")
|
||||
private Long domainId;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
|
|
@ -65,6 +69,9 @@ public class ListServiceOfferingsCmd extends BaseListCmd {
|
|||
return virtualMachineId;
|
||||
}
|
||||
|
||||
public Long getDomainId(){
|
||||
return domainId;
|
||||
}
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.response.ListResponse;
|
||||
import com.cloud.api.response.SnapshotResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.storage.Snapshot;
|
||||
|
||||
@Implementation(description="Lists all available snapshots for the account.", responseObject=SnapshotResponse.class)
|
||||
|
|
@ -101,6 +102,10 @@ public class ListSnapshotsCmd extends BaseListCmd {
|
|||
public String getName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Snapshot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.response.ListResponse;
|
||||
import com.cloud.api.response.SystemVmResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
|
||||
@Implementation(description="List system virtual machines.", responseObject=SystemVmResponse.class)
|
||||
|
|
@ -102,6 +103,10 @@ public class ListSystemVMsCmd extends BaseListCmd {
|
|||
return s_name;
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.SystemVm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
List<? extends VirtualMachine> systemVMs = _mgr.searchForSystemVm(this);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.response.ListResponse;
|
||||
import com.cloud.api.response.TemplateResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.storage.Storage;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import com.cloud.template.VirtualMachineTemplate.TemplateFilter;
|
||||
|
|
@ -111,6 +112,10 @@ public class ListTemplatesCmd extends BaseListCmd {
|
|||
return s_name;
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Template;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
List<? extends VirtualMachineTemplate> templates = _mgr.listTemplates(this);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.response.ListResponse;
|
||||
import com.cloud.api.response.VolumeResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.storage.Volume;
|
||||
|
||||
@Implementation(description="Lists all volumes.", responseObject=VolumeResponse.class)
|
||||
|
|
@ -116,6 +117,10 @@ public class ListVolumesCmd extends BaseListCmd {
|
|||
return s_name;
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Volume;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
List<? extends Volume> volumes = _mgr.searchForVolumes(this);
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.HostResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.user.Account;
|
||||
|
|
@ -85,6 +86,14 @@ public class PrepareForMaintenanceCmd extends BaseAsyncCmd {
|
|||
return "preparing host: " + getId() + " for maintenance";
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Host;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
Host result = _resourceService.maintain(this);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.DomainRouterResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.network.router.VirtualRouter;
|
||||
import com.cloud.user.Account;
|
||||
|
|
@ -79,6 +80,14 @@ public class RebootRouterCmd extends BaseAsyncCmd {
|
|||
public String getEventDescription() {
|
||||
return "rebooting router: " + getId();
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.DomainRouter;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.SystemVmResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
|
@ -82,6 +83,14 @@ public class RebootSystemVmCmd extends BaseAsyncCmd {
|
|||
return "rebooting system vm: " + getId();
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.SystemVm;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
VirtualMachine result = _mgr.rebootSystemVM(this);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.HostResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.AgentUnavailableException;
|
||||
import com.cloud.host.Host;
|
||||
|
|
@ -86,6 +87,14 @@ public class ReconnectHostCmd extends BaseAsyncCmd {
|
|||
public String getEventDescription() {
|
||||
return "reconnecting host: " + getId();
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Host;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import com.cloud.api.Parameter;
|
|||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.ListResponse;
|
||||
import com.cloud.api.response.TemplateResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
|
||||
|
|
@ -158,6 +159,10 @@ public class RegisterTemplateCmd extends BaseCmd {
|
|||
public String getName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Template;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.DomainRouterResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
|
|
@ -89,6 +90,14 @@ public class StartRouterCmd extends BaseAsyncCmd {
|
|||
public String getEventDescription() {
|
||||
return "starting router: " + getId();
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.DomainRouter;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException{
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.SystemVmResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
|
@ -85,6 +86,14 @@ public class StartSystemVMCmd extends BaseAsyncCmd {
|
|||
public String getEventDescription() {
|
||||
return "starting system vm: " + getId();
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.SystemVm;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.DomainRouterResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
|
|
@ -83,6 +84,14 @@ public class StopRouterCmd extends BaseAsyncCmd {
|
|||
public String getEventDescription() {
|
||||
return "stopping router: " + getId();
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.DomainRouter;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws ConcurrentOperationException, ResourceUnavailableException{
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import com.cloud.api.Implementation;
|
|||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.SystemVmResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
|
@ -81,6 +82,14 @@ public class StopSystemVmCmd extends BaseAsyncCmd {
|
|||
public String getEventDescription() {
|
||||
return "stopping system vm: " + getId();
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.SystemVm;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import com.cloud.api.BaseCmd;
|
|||
import com.cloud.api.Implementation;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.BaseCmd.CommandType;
|
||||
import com.cloud.api.response.DiskOfferingResponse;
|
||||
import com.cloud.offering.DiskOffering;
|
||||
|
||||
|
|
@ -48,6 +49,9 @@ public class UpdateDiskOfferingCmd extends BaseCmd{
|
|||
// @Parameter(name=ApiConstants.TAGS, type=CommandType.STRING, description="update tags of the disk offering with this value")
|
||||
// private String tags;
|
||||
|
||||
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the ID of the containing domain, null for public offerings")
|
||||
private Long domainId;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -67,6 +71,10 @@ public class UpdateDiskOfferingCmd extends BaseCmd{
|
|||
// public String getTags() {
|
||||
// return tags;
|
||||
// }
|
||||
|
||||
public Long getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import com.cloud.api.BaseCmd;
|
|||
import com.cloud.api.Implementation;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.BaseCmd.CommandType;
|
||||
import com.cloud.api.response.ServiceOfferingResponse;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
|
||||
|
|
@ -53,6 +54,9 @@ public class UpdateServiceOfferingCmd extends BaseCmd {
|
|||
|
||||
@Parameter(name=ApiConstants.USE_VIRTUAL_NETWORK, type=CommandType.BOOLEAN, description="if true, the VM created from the offering will use default virtual networking. If false, the VM created will use a direct attached networking model. The default value is true.")
|
||||
private Boolean useVirtualNetwork;
|
||||
|
||||
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the ID of the containing domain, null for public offerings")
|
||||
private Long domainId;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
|
|
@ -82,17 +86,25 @@ public class UpdateServiceOfferingCmd extends BaseCmd {
|
|||
return useVirtualNetwork;
|
||||
}
|
||||
|
||||
|
||||
public Long getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
//Note
|
||||
//Once an offering is created, we cannot update the domainId field (keeping consistent with zones logic)
|
||||
ServiceOffering result = _configService.updateServiceOffering(this);
|
||||
if (result != null){
|
||||
ServiceOfferingResponse response = _responseGenerator.createServiceOfferingResponse(result);
|
||||
|
|
|
|||
|
|
@ -102,6 +102,10 @@ public class DomainRouterResponse extends BaseResponse {
|
|||
|
||||
@SerializedName(ApiConstants.DOMAIN) @Param(description="the domain associated with the router")
|
||||
private String domainName;
|
||||
|
||||
public Long getObjectId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
|
|
|
|||
|
|
@ -131,6 +131,10 @@ public class HostResponse extends BaseResponse {
|
|||
|
||||
@SerializedName("events") @Param(description="events available for the host")
|
||||
private String events;
|
||||
|
||||
public Long getObjectId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package com.cloud.api.response;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
import com.cloud.api.ApiConstants;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
|
@ -56,6 +57,12 @@ public class ServiceOfferingResponse extends BaseResponse {
|
|||
@SerializedName("tags") @Param(description="the tags for the service offering")
|
||||
private String tags;
|
||||
|
||||
@SerializedName("domainId") @Param(description="the domain id of the service offering")
|
||||
private Long domainId;
|
||||
|
||||
@SerializedName(ApiConstants.DOMAIN) @Param(description="Domain name for the offering")
|
||||
private String domain;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
|
@ -143,4 +150,23 @@ public class ServiceOfferingResponse extends BaseResponse {
|
|||
public void setTags(String tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
public Long getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
|
||||
public void setDomainId(Long domainId) {
|
||||
this.domainId = domainId;
|
||||
}
|
||||
|
||||
public String getDomain() {
|
||||
return domain;
|
||||
}
|
||||
|
||||
public void setDomain(String domain) {
|
||||
this.domain = domain;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,10 @@ public class SnapshotResponse extends BaseResponse {
|
|||
|
||||
@SerializedName("intervaltype") @Param(description="valid types are hourly, daily, weekly, monthy, template, and none.")
|
||||
private String intervalType;
|
||||
|
||||
public Long getObjectId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
|
|
|
|||
|
|
@ -94,6 +94,10 @@ public class SystemVmResponse extends BaseResponse {
|
|||
|
||||
@SerializedName("activeviewersessions") @Param(description="the number of active console sessions for the console proxy system vm")
|
||||
private Integer activeViewerSessions;
|
||||
|
||||
public Long getObjectId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
|
|
|
|||
|
|
@ -107,6 +107,10 @@ public class TemplateResponse extends BaseResponse {
|
|||
@SerializedName("isextractable") @Param(description="true if the template is extractable, false otherwise")
|
||||
private Boolean extractable;
|
||||
|
||||
public Long getObjectId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
public Long getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,6 +119,10 @@ public class VolumeResponse extends BaseResponse {
|
|||
|
||||
@SerializedName("serviceofferingdisplaytext") @Param(description="the display text of the service offering for root disk")
|
||||
private String serviceOfferingDisplayText;
|
||||
|
||||
public Long getObjectId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
public Boolean getDestroyed() {
|
||||
return destroyed;
|
||||
|
|
|
|||
|
|
@ -23,10 +23,14 @@ public interface AsyncJob {
|
|||
public enum Type {
|
||||
None,
|
||||
VirtualMachine,
|
||||
Router,
|
||||
DomainRouter,
|
||||
Volume,
|
||||
ConsoleProxy,
|
||||
Snapshot
|
||||
Snapshot,
|
||||
Template,
|
||||
Iso,
|
||||
SystemVm,
|
||||
Host
|
||||
}
|
||||
|
||||
Long getId();
|
||||
|
|
|
|||
|
|
@ -77,4 +77,6 @@ public interface ServiceOffering {
|
|||
*/
|
||||
boolean getUseLocalStorage();
|
||||
|
||||
Long getDomainId();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -810,7 +810,9 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||
if (!(guestOsTypeName.startsWith("Windows") || guestOsTypeName.startsWith("Citrix") || guestOsTypeName.startsWith("Other"))) {
|
||||
if (vmSpec.getBootloader() == BootloaderType.CD) {
|
||||
vm.setPVBootloader(conn, "eliloader");
|
||||
vm.addToOtherConfig(conn, "install-repository", "cdrom");
|
||||
Map<String, String> otherConfig = vm.getOtherConfig(conn);
|
||||
otherConfig.put( "install-repository", "cdrom");
|
||||
vm.setOtherConfig(conn, otherConfig);
|
||||
} else if (vmSpec.getBootloader() == BootloaderType.PyGrub ){
|
||||
vm.setPVBootloader(conn, "pygrub");
|
||||
} else {
|
||||
|
|
@ -5527,7 +5529,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||
if (!result) {
|
||||
throw new CloudRuntimeException("Could not create the template.properties file on secondary storage dir: " + tmpltURI);
|
||||
}
|
||||
|
||||
installPath = installPath + "/" + tmpltFilename;
|
||||
return new CreatePrivateTemplateAnswer(cmd, true, null, installPath, virtualSize, physicalSize, tmpltUUID, ImageFormat.VHD);
|
||||
} catch (XenAPIException e) {
|
||||
details = "Creating template from snapshot " + backedUpSnapshotUuid + " failed due to " + e.getMessage();
|
||||
|
|
@ -6197,103 +6199,4 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||
protected String getGuestOsType(String stdType) {
|
||||
return stdType;
|
||||
}
|
||||
|
||||
/*
|
||||
protected boolean patchSystemVm(VDI vdi, String vmName, VirtualMachine.Type type) {
|
||||
if (type == VirtualMachine.Type.DomainRouter) {
|
||||
return patchSpecialVM(vdi, vmName, "router");
|
||||
} else if (type == VirtualMachine.Type.ConsoleProxy) {
|
||||
return patchSpecialVM(vdi, vmName, "consoleproxy");
|
||||
} else if (type == VirtualMachine.Type.SecondaryStorageVm) {
|
||||
return patchSpecialVM(vdi, vmName, "secstorage");
|
||||
} else {
|
||||
throw new CloudRuntimeException("Tried to patch unknown type of system vm");
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean patchSystemVm(VDI vdi, String vmName) {
|
||||
if (vmName.startsWith("r-")) {
|
||||
return patchSpecialVM(vdi, vmName, "router");
|
||||
} else if (vmName.startsWith("v-")) {
|
||||
return patchSpecialVM(vdi, vmName, "consoleproxy");
|
||||
} else if (vmName.startsWith("s-")) {
|
||||
return patchSpecialVM(vdi, vmName, "secstorage");
|
||||
} else {
|
||||
throw new CloudRuntimeException("Tried to patch unknown type of system vm");
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean patchSpecialVM(VDI vdi, String vmname, String vmtype) {
|
||||
// patch special vm here, domr, domp
|
||||
VBD vbd = null;
|
||||
Connection conn = getConnection();
|
||||
try {
|
||||
Host host = Host.getByUuid(conn, _host.uuid);
|
||||
|
||||
Set<VM> vms = host.getResidentVMs(conn);
|
||||
|
||||
for (VM vm : vms) {
|
||||
VM.Record vmrec = null;
|
||||
try {
|
||||
vmrec = vm.getRecord(conn);
|
||||
} catch (Exception e) {
|
||||
String msg = "VM.getRecord failed due to " + e.toString() + " " + e.getMessage();
|
||||
s_logger.warn(msg);
|
||||
continue;
|
||||
}
|
||||
if (vmrec.isControlDomain) {
|
||||
|
||||
VBD.Record vbdr = new VBD.Record();
|
||||
vbdr.VM = vm;
|
||||
vbdr.VDI = vdi;
|
||||
vbdr.bootable = false;
|
||||
vbdr.userdevice = getUnusedDeviceNum(vm);
|
||||
vbdr.unpluggable = true;
|
||||
vbdr.mode = Types.VbdMode.RW;
|
||||
vbdr.type = Types.VbdType.DISK;
|
||||
|
||||
vbd = VBD.create(conn, vbdr);
|
||||
|
||||
vbd.plug(conn);
|
||||
|
||||
String device = vbd.getDevice(conn);
|
||||
|
||||
return patchspecialvm(vmname, device, vmtype);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (XenAPIException e) {
|
||||
String msg = "patchSpecialVM faile on " + _host.uuid + " due to " + e.toString();
|
||||
s_logger.warn(msg, e);
|
||||
} catch (Exception e) {
|
||||
String msg = "patchSpecialVM faile on " + _host.uuid + " due to " + e.getMessage();
|
||||
s_logger.warn(msg, e);
|
||||
} finally {
|
||||
if (vbd != null) {
|
||||
try {
|
||||
if (vbd.getCurrentlyAttached(conn)) {
|
||||
vbd.unplug(conn);
|
||||
}
|
||||
vbd.destroy(conn);
|
||||
} catch (XmlRpcException e) {
|
||||
String msg = "Catch XmlRpcException due to " + e.getMessage();
|
||||
s_logger.warn(msg, e);
|
||||
} catch (XenAPIException e) {
|
||||
String msg = "Catch XenAPIException due to " + e.toString();
|
||||
s_logger.warn(msg, e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean patchspecialvm(String vmname, String device, String vmtype) {
|
||||
String result = callHostPlugin("vmops", "patchdomr", "vmname", vmname, "vmtype", vmtype, "device", "/dev/" + device);
|
||||
if (result == null || result.isEmpty())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,6 +120,21 @@ public class DiskOfferingVO implements DiskOffering {
|
|||
this.systemUse = systemUse;
|
||||
this.customized = customized;
|
||||
}
|
||||
|
||||
//domain specific offerings constructor (null domainId implies public offering)
|
||||
public DiskOfferingVO(String name, String displayText, boolean mirrored, String tags, boolean recreatable, boolean useLocalStorage, boolean systemUse, boolean customized, Long domainId) {
|
||||
this.domainId = null;
|
||||
this.type = Type.Service;
|
||||
this.name = name;
|
||||
this.displayText = displayText;
|
||||
this.mirrored = mirrored;
|
||||
this.tags = tags;
|
||||
this.recreatable = recreatable;
|
||||
this.useLocalStorage = useLocalStorage;
|
||||
this.systemUse = systemUse;
|
||||
this.customized = customized;
|
||||
this.domainId = domainId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getId() {
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
|
|||
protected Answer execute(final DeleteTemplateCommand cmd) {
|
||||
String relativeTemplatePath = cmd.getTemplatePath();
|
||||
String parent = _parent;
|
||||
|
||||
|
||||
if (relativeTemplatePath.startsWith(File.separator)) {
|
||||
relativeTemplatePath = relativeTemplatePath.substring(1);
|
||||
}
|
||||
|
|
@ -234,24 +234,37 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
|
|||
}
|
||||
String absoluteTemplatePath = parent + relativeTemplatePath;
|
||||
File tmpltParent = new File(absoluteTemplatePath).getParentFile();
|
||||
|
||||
boolean result = true;
|
||||
if (tmpltParent.exists()) {
|
||||
File [] tmpltFiles = tmpltParent.listFiles();
|
||||
if (tmpltFiles != null) {
|
||||
for (File f : tmpltFiles) {
|
||||
f.delete();
|
||||
}
|
||||
}
|
||||
|
||||
result = _storage.delete(tmpltParent.getAbsolutePath());
|
||||
}
|
||||
|
||||
if (result) {
|
||||
return new Answer(cmd, true, null);
|
||||
} else {
|
||||
return new Answer(cmd, false, "Failed to delete file");
|
||||
}
|
||||
if (!tmpltParent.exists()) {
|
||||
return new Answer(cmd, false, "template parent directory " + tmpltParent.getName()
|
||||
+ " doesn't exist, Template path ( " + relativeTemplatePath + " ) is wrong");
|
||||
}
|
||||
File[] tmpltFiles = tmpltParent.listFiles();
|
||||
if (tmpltFiles == null || tmpltFiles.length == 0) {
|
||||
return new Answer(cmd, false, "No files under template parent directory " + tmpltParent.getName()
|
||||
+ " Template path ( " + relativeTemplatePath + " ) is wrong");
|
||||
}
|
||||
boolean found = false;
|
||||
for (File f : tmpltFiles) {
|
||||
if (f.getName().equals("template.properties")) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
return new Answer(cmd, false, "Can not find template.properties, Template path ( " + relativeTemplatePath
|
||||
+ " ) is wrong");
|
||||
}
|
||||
for (File f : tmpltFiles) {
|
||||
if( !f.delete() ) {
|
||||
return new Answer(cmd, false, "Unable to delete file " + f.getName()
|
||||
+ " Template path ( " + relativeTemplatePath + " ) is wrong");
|
||||
}
|
||||
}
|
||||
if ( !tmpltParent.delete() ) {
|
||||
return new Answer(cmd, false, "Unable to delete directory " + tmpltParent.getName()
|
||||
+ " Template path ( " + relativeTemplatePath + " ) is wrong");
|
||||
}
|
||||
return new Answer(cmd, true, null);
|
||||
}
|
||||
|
||||
protected long getUsedSize() {
|
||||
|
|
|
|||
|
|
@ -63,9 +63,6 @@ def setup_iscsi(session, args):
|
|||
txt = ''
|
||||
return txt
|
||||
|
||||
@echo
|
||||
def execute_script(session, args):
|
||||
return ""
|
||||
|
||||
@echo
|
||||
def getvncport(session, args):
|
||||
|
|
@ -130,21 +127,6 @@ def setIptables(session, args):
|
|||
|
||||
return txt
|
||||
|
||||
@echo
|
||||
def patchdomr(session, args):
|
||||
vmname = args['vmname']
|
||||
vmtype = args['vmtype']
|
||||
device = args['device']
|
||||
try:
|
||||
cmd = ["/bin/bash", "/opt/xensource/bin/prepsystemvm.sh", "-l", vmname, "-t", vmtype, "-d", device]
|
||||
txt = util.pread2(cmd)
|
||||
txt = 'success'
|
||||
except:
|
||||
util.SMlog(" patch domr failed " )
|
||||
txt = ''
|
||||
|
||||
return txt
|
||||
|
||||
@echo
|
||||
def pingdomr(session, args):
|
||||
host = args['host']
|
||||
|
|
@ -1077,5 +1059,5 @@ def network_rules(session, args):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
XenAPIPlugin.dispatch({"pingtest": pingtest, "setup_iscsi":setup_iscsi, "gethostvmstats": gethostvmstats, "getvncport": getvncport, "getgateway": getgateway, "getnetwork": getnetwork, "preparemigration": preparemigration, "setIptables": setIptables, "patchdomr": patchdomr, "pingdomr": pingdomr, "pingxenserver": pingxenserver, "ipassoc": ipassoc, "vm_data": vm_data, "savePassword": savePassword, "saveDhcpEntry": saveDhcpEntry, "setFirewallRule": setFirewallRule, "setLoadBalancerRule": setLoadBalancerRule, "createFile": createFile, "deleteFile": deleteFile, "networkUsage": networkUsage, "network_rules":network_rules, "can_bridge_firewall":can_bridge_firewall, "default_network_rules":default_network_rules, "destroy_network_rules_for_vm":destroy_network_rules_for_vm, "default_network_rules_systemvm":default_network_rules_systemvm, "get_rule_logs_for_vms":get_rule_logs_for_vms, "setLinkLocalIP":setLinkLocalIP, "lt2p_vpn":lt2p_vpn})
|
||||
XenAPIPlugin.dispatch({"pingtest": pingtest, "setup_iscsi":setup_iscsi, "gethostvmstats": gethostvmstats, "getvncport": getvncport, "getgateway": getgateway, "getnetwork": getnetwork, "preparemigration": preparemigration, "setIptables": setIptables, "pingdomr": pingdomr, "pingxenserver": pingxenserver, "ipassoc": ipassoc, "vm_data": vm_data, "savePassword": savePassword, "saveDhcpEntry": saveDhcpEntry, "setFirewallRule": setFirewallRule, "setLoadBalancerRule": setLoadBalancerRule, "createFile": createFile, "deleteFile": deleteFile, "networkUsage": networkUsage, "network_rules":network_rules, "can_bridge_firewall":can_bridge_firewall, "default_network_rules":default_network_rules, "destroy_network_rules_for_vm":destroy_network_rules_for_vm, "default_network_rules_systemvm":default_network_rules_systemvm, "get_rule_logs_for_vms":get_rule_logs_for_vms, "setLinkLocalIP":setLinkLocalIP, "lt2p_vpn":lt2p_vpn})
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ import com.cloud.domain.Domain;
|
|||
import com.cloud.domain.DomainVO;
|
||||
import com.cloud.domain.dao.DomainDao;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.offering.DiskOffering;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
import com.cloud.storage.LaunchPermissionVO;
|
||||
import com.cloud.storage.dao.LaunchPermissionDao;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
|
|
@ -100,6 +102,100 @@ public class DomainChecker extends AdapterBase implements SecurityChecker {
|
|||
return checkAccess(account, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkAccess(Account account, DiskOffering dof) throws PermissionDeniedException
|
||||
{
|
||||
if(account == null || dof.getDomainId() == null)
|
||||
{//public offering
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//admin has all permissions
|
||||
if(account.getType() == Account.ACCOUNT_TYPE_ADMIN)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
//if account is normal user or domain admin
|
||||
//check if account's domain is a child of zone's domain (Note: This is made consistent with the list command for disk offering)
|
||||
else if(account.getType() == Account.ACCOUNT_TYPE_NORMAL || account.getType() == Account.ACCOUNT_TYPE_DOMAIN_ADMIN)
|
||||
{
|
||||
if(account.getDomainId() == dof.getDomainId())
|
||||
{
|
||||
return true; //disk offering and account at exact node
|
||||
}
|
||||
else
|
||||
{
|
||||
DomainVO domainRecord = _domainDao.findById(account.getDomainId());
|
||||
if(domainRecord != null)
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
if(domainRecord.getId() == dof.getDomainId())
|
||||
{
|
||||
//found as a child
|
||||
return true;
|
||||
}
|
||||
if(domainRecord.getParent() != null)
|
||||
domainRecord = _domainDao.findById(domainRecord.getParent());
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//not found
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkAccess(Account account, ServiceOffering so) throws PermissionDeniedException
|
||||
{
|
||||
if(account == null || so.getDomainId() == null)
|
||||
{//public offering
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//admin has all permissions
|
||||
if(account.getType() == Account.ACCOUNT_TYPE_ADMIN)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
//if account is normal user or domain admin
|
||||
//check if account's domain is a child of zone's domain (Note: This is made consistent with the list command for service offering)
|
||||
else if(account.getType() == Account.ACCOUNT_TYPE_NORMAL || account.getType() == Account.ACCOUNT_TYPE_DOMAIN_ADMIN)
|
||||
{
|
||||
if(account.getDomainId() == so.getDomainId())
|
||||
{
|
||||
return true; //service offering and account at exact node
|
||||
}
|
||||
else
|
||||
{
|
||||
DomainVO domainRecord = _domainDao.findById(account.getDomainId());
|
||||
if(domainRecord != null)
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
if(domainRecord.getId() == so.getDomainId())
|
||||
{
|
||||
//found as a child
|
||||
return true;
|
||||
}
|
||||
if(domainRecord.getParent() != null)
|
||||
domainRecord = _domainDao.findById(domainRecord.getParent());
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//not found
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkAccess(Account account, DataCenter zone) throws PermissionDeniedException {
|
||||
if(account == null || zone.getDomainId() == null){//public zone
|
||||
|
|
|
|||
|
|
@ -382,9 +382,16 @@ public class AlertManagerImpl implements AlertManager {
|
|||
Map<String, List<CapacityVO>> capacityDcTypeMap = new HashMap<String, List<CapacityVO>>();
|
||||
|
||||
for (CapacityVO capacity : capacityList) {
|
||||
long dataCenterId = capacity.getDataCenterId();
|
||||
long dataCenterId = capacity.getDataCenterId();
|
||||
Long podId = capacity.getPodId();
|
||||
short type = capacity.getCapacityType();
|
||||
String key = "dc" + dataCenterId + "t" + type;
|
||||
String key = null;
|
||||
if((type == CapacityVO.CAPACITY_TYPE_PUBLIC_IP) || (type == CapacityVO.CAPACITY_TYPE_SECONDARY_STORAGE)){
|
||||
key = "dc" + dataCenterId + "t" + type;
|
||||
} else {
|
||||
key = "pod" + podId + "t" + type;
|
||||
}
|
||||
|
||||
List<CapacityVO> list = capacityDcTypeMap.get(key);
|
||||
if (list == null) {
|
||||
list = new ArrayList<CapacityVO>();
|
||||
|
|
@ -399,7 +406,8 @@ public class AlertManagerImpl implements AlertManager {
|
|||
double usedCapacity = 0d;
|
||||
CapacityVO cap = capacities.get(0);
|
||||
short capacityType = cap.getCapacityType();
|
||||
long dataCenterId = cap.getDataCenterId();
|
||||
long dataCenterId = cap.getDataCenterId();
|
||||
Long podId = cap.getPodId();
|
||||
|
||||
for (CapacityVO capacity : capacities) {
|
||||
totalCapacity += capacity.getTotalCapacity();
|
||||
|
|
@ -409,7 +417,12 @@ public class AlertManagerImpl implements AlertManager {
|
|||
double capacityPct = (usedCapacity / totalCapacity);
|
||||
double thresholdLimit = 1.0;
|
||||
DataCenterVO dcVO = _dcDao.findById(dataCenterId);
|
||||
String dcName = ((dcVO == null) ? "unknown" : dcVO.getName());
|
||||
String dcName = ((dcVO == null) ? "unknown" : dcVO.getName());
|
||||
String podName = "";
|
||||
if( podId != null){
|
||||
HostPodVO pod = _podDao.findById(podId);
|
||||
podName = ((pod == null) ? "unknown" : pod.getName());
|
||||
}
|
||||
String msgSubject = "";
|
||||
String msgContent = "";
|
||||
String totalStr = "";
|
||||
|
|
@ -420,28 +433,28 @@ public class AlertManagerImpl implements AlertManager {
|
|||
switch (capacityType) {
|
||||
case CapacityVO.CAPACITY_TYPE_MEMORY:
|
||||
thresholdLimit = _memoryCapacityThreshold;
|
||||
msgSubject = "System Alert: Low Available Memory in availablity zone " + dcName;
|
||||
msgSubject = "System Alert: Low Available Memory in pod "+podName+" of availablity zone " + dcName;
|
||||
totalStr = formatBytesToMegabytes(totalCapacity);
|
||||
usedStr = formatBytesToMegabytes(usedCapacity);
|
||||
msgContent = "System memory is low, total: " + totalStr + " MB, used: " + usedStr + " MB (" + pctStr + "%)";
|
||||
break;
|
||||
case CapacityVO.CAPACITY_TYPE_CPU:
|
||||
thresholdLimit = _cpuCapacityThreshold;
|
||||
msgSubject = "System Alert: Low Unallocated CPU in availablity zone " + dcName;
|
||||
msgSubject = "System Alert: Low Unallocated CPU in pod "+podName+" of availablity zone " + dcName;
|
||||
totalStr = _dfWhole.format(totalCapacity);
|
||||
usedStr = _dfWhole.format(usedCapacity);
|
||||
msgContent = "Unallocated CPU is low, total: " + totalStr + " Mhz, used: " + usedStr + " Mhz (" + pctStr + "%)";
|
||||
break;
|
||||
case CapacityVO.CAPACITY_TYPE_STORAGE:
|
||||
thresholdLimit = _storageCapacityThreshold;
|
||||
msgSubject = "System Alert: Low Available Storage in availablity zone " + dcName;
|
||||
msgSubject = "System Alert: Low Available Storage in pod "+podName+" of availablity zone " + dcName;
|
||||
totalStr = formatBytesToMegabytes(totalCapacity);
|
||||
usedStr = formatBytesToMegabytes(usedCapacity);
|
||||
msgContent = "Available storage space is low, total: " + totalStr + " MB, used: " + usedStr + " MB (" + pctStr + "%)";
|
||||
break;
|
||||
case CapacityVO.CAPACITY_TYPE_STORAGE_ALLOCATED:
|
||||
thresholdLimit = _storageAllocCapacityThreshold;
|
||||
msgSubject = "System Alert: Remaining unallocated Storage is low in availablity zone " + dcName;
|
||||
msgSubject = "System Alert: Remaining unallocated Storage is low in pod "+podName+" of availablity zone " + dcName;
|
||||
totalStr = formatBytesToMegabytes(totalCapacity);
|
||||
usedStr = formatBytesToMegabytes(usedCapacity);
|
||||
msgContent = "Unallocated storage space is low, total: " + totalStr + " MB, allocated: " + usedStr + " MB (" + pctStr + "%)";
|
||||
|
|
@ -455,7 +468,7 @@ public class AlertManagerImpl implements AlertManager {
|
|||
break;
|
||||
case CapacityVO.CAPACITY_TYPE_PRIVATE_IP:
|
||||
thresholdLimit = _privateIPCapacityThreshold;
|
||||
msgSubject = "System Alert: Number of unallocated private IPs is low in availablity zone " + dcName;
|
||||
msgSubject = "System Alert: Number of unallocated private IPs is low in pod "+podName+" of availablity zone " + dcName;
|
||||
totalStr = Double.toString(totalCapacity);
|
||||
usedStr = Double.toString(usedCapacity);
|
||||
msgContent = "Number of unallocated private IPs is low, total: " + totalStr + ", allocated: " + usedStr + " (" + pctStr + "%)";
|
||||
|
|
|
|||
|
|
@ -420,7 +420,7 @@ public class ApiDBUtils {
|
|||
}
|
||||
|
||||
public static VolumeVO findVolumeById(Long volumeId) {
|
||||
return _volumeDao.findById(volumeId);
|
||||
return _volumeDao.findByIdIncludingRemoved(volumeId);
|
||||
}
|
||||
|
||||
public static DataCenterVO findZoneById(Long zoneId) {
|
||||
|
|
|
|||
|
|
@ -345,6 +345,10 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
offeringResponse.setOfferHa(offering.getOfferHA());
|
||||
offeringResponse.setUseVirtualNetwork(offering.getGuestIpType().equals(GuestIpType.Virtualized));
|
||||
offeringResponse.setTags(offering.getTags());
|
||||
if(offering.getDomainId() != null){
|
||||
offeringResponse.setDomain(ApiDBUtils.findDomainById(offering.getDomainId()).getName());
|
||||
offeringResponse.setDomainId(offering.getDomainId());
|
||||
}
|
||||
offeringResponse.setObjectName("serviceoffering");
|
||||
|
||||
return offeringResponse;
|
||||
|
|
@ -374,20 +378,17 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
snapshotResponse.setDomainName(ApiDBUtils.findDomainById(acct.getDomainId()).getName());
|
||||
}
|
||||
|
||||
VolumeVO volume = ApiDBUtils.findVolumeById(snapshot.getVolumeId());
|
||||
VolumeVO volume = findVolumeById(snapshot.getVolumeId());
|
||||
String snapshotTypeStr = Type.values()[snapshot.getSnapshotType()].name();
|
||||
snapshotResponse.setSnapshotType(snapshotTypeStr);
|
||||
snapshotResponse.setVolumeId(snapshot.getVolumeId());
|
||||
snapshotResponse.setVolumeName(volume.getName());
|
||||
snapshotResponse.setVolumeType(volume.getVolumeType().name());
|
||||
if( volume != null ) {
|
||||
snapshotResponse.setVolumeName(volume.getName());
|
||||
snapshotResponse.setVolumeType(volume.getVolumeType().name());
|
||||
}
|
||||
snapshotResponse.setCreated(snapshot.getCreated());
|
||||
snapshotResponse.setName(snapshot.getName());
|
||||
snapshotResponse.setIntervalType(ApiDBUtils.getSnapshotIntervalTypes(snapshot.getId()));
|
||||
AsyncJobVO asyncJob = ApiDBUtils.findInstancePendingAsyncJob("snapshot", snapshot.getId());
|
||||
if (asyncJob != null) {
|
||||
snapshotResponse.setJobId(asyncJob.getId());
|
||||
snapshotResponse.setJobStatus(asyncJob.getStatus());
|
||||
}
|
||||
snapshotResponse.setObjectName("snapshot");
|
||||
return snapshotResponse;
|
||||
}
|
||||
|
|
@ -427,12 +428,6 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
}
|
||||
|
||||
userVmResponse.setId(userVm.getId());
|
||||
AsyncJobVO asyncJob = ApiDBUtils.findInstancePendingAsyncJob("vm_instance", userVm.getId());
|
||||
if (asyncJob != null) {
|
||||
userVmResponse.setJobId(asyncJob.getId());
|
||||
userVmResponse.setJobStatus(asyncJob.getStatus());
|
||||
}
|
||||
|
||||
userVmResponse.setName(userVm.getHostName());
|
||||
userVmResponse.setCreated(userVm.getCreated());
|
||||
userVmResponse.setIpAddress(userVm.getPrivateIpAddress());
|
||||
|
|
@ -558,12 +553,6 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
// the moment
|
||||
}
|
||||
|
||||
AsyncJobVO asyncJob = ApiDBUtils.findInstancePendingAsyncJob(instanceType, vm.getId());
|
||||
if (asyncJob != null) {
|
||||
vmResponse.setJobId(asyncJob.getId());
|
||||
vmResponse.setJobStatus(asyncJob.getStatus());
|
||||
}
|
||||
|
||||
vmResponse.setZoneId(vm.getDataCenterId());
|
||||
vmResponse.setZoneName(ApiDBUtils.findZoneById(vm.getDataCenterId()).getName());
|
||||
vmResponse.setDns1(vm.getDns1());
|
||||
|
|
@ -882,12 +871,6 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
VolumeResponse volResponse = new VolumeResponse();
|
||||
volResponse.setId(volume.getId());
|
||||
|
||||
AsyncJobVO asyncJob = ApiDBUtils.findInstancePendingAsyncJob("volume", volume.getId());
|
||||
if (asyncJob != null) {
|
||||
volResponse.setJobId(asyncJob.getId());
|
||||
volResponse.setJobStatus(asyncJob.getStatus());
|
||||
}
|
||||
|
||||
if (volume.getName() != null) {
|
||||
volResponse.setName(volume.getName());
|
||||
} else {
|
||||
|
|
@ -1119,12 +1102,6 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
}
|
||||
|
||||
userVmResponse.setId(userVm.getId());
|
||||
AsyncJobVO asyncJob = ApiDBUtils.findInstancePendingAsyncJob("vm_instance", userVm.getId());
|
||||
if (asyncJob != null) {
|
||||
userVmResponse.setJobId(asyncJob.getId());
|
||||
userVmResponse.setJobStatus(asyncJob.getStatus());
|
||||
}
|
||||
|
||||
userVmResponse.setName(userVm.getHostName());
|
||||
userVmResponse.setCreated(userVm.getCreated());
|
||||
|
||||
|
|
@ -1332,12 +1309,6 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
// the moment
|
||||
}
|
||||
|
||||
AsyncJobVO asyncJob = ApiDBUtils.findInstancePendingAsyncJob(instanceType, vm.getId());
|
||||
if (asyncJob != null) {
|
||||
vmResponse.setJobId(asyncJob.getId());
|
||||
vmResponse.setJobStatus(asyncJob.getStatus());
|
||||
}
|
||||
|
||||
// for console proxies, add the active sessions
|
||||
if (systemVM instanceof ConsoleProxyVO) {
|
||||
ConsoleProxyVO proxy = (ConsoleProxyVO) systemVM;
|
||||
|
|
@ -1392,7 +1363,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Volume findVolumeById(Long volumeId) {
|
||||
public VolumeVO findVolumeById(Long volumeId) {
|
||||
return ApiDBUtils.findVolumeById(volumeId);
|
||||
}
|
||||
|
||||
|
|
@ -1535,12 +1506,6 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
templateResponse.setSize(templateSize);
|
||||
}
|
||||
|
||||
AsyncJobVO asyncJob = ApiDBUtils.findInstancePendingAsyncJob("vm_template", template.getId());
|
||||
if (asyncJob != null) {
|
||||
templateResponse.setJobId(asyncJob.getId());
|
||||
templateResponse.setJobStatus(asyncJob.getStatus());
|
||||
}
|
||||
|
||||
templateResponse.setObjectName("template");
|
||||
responses.add(templateResponse);
|
||||
}
|
||||
|
|
@ -1921,12 +1886,12 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
response.setPasswordEnabled(template.getEnablePassword());
|
||||
response.setCrossZones(template.isCrossZones());
|
||||
|
||||
Volume volume = null;
|
||||
VolumeVO volume = null;
|
||||
if (snapshotId != null) {
|
||||
Snapshot snapshot = ApiDBUtils.findSnapshotById(snapshotId);
|
||||
volume = ApiDBUtils.findVolumeById(snapshot.getVolumeId());
|
||||
volume = findVolumeById(snapshot.getVolumeId());
|
||||
} else {
|
||||
volume = ApiDBUtils.findVolumeById(volumeId);
|
||||
volume = findVolumeById(volumeId);
|
||||
}
|
||||
|
||||
VMTemplateHostVO templateHostRef = ApiDBUtils.findTemplateHostRef(template.getId(), volume.getDataCenterId());
|
||||
|
|
@ -2077,12 +2042,6 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
isoResponse.setSize(isoSize);
|
||||
}
|
||||
|
||||
AsyncJobVO asyncJob = ApiDBUtils.findInstancePendingAsyncJob("vm_template", iso.getId());
|
||||
if(asyncJob != null) {
|
||||
isoResponse.setJobId(asyncJob.getId());
|
||||
isoResponse.setJobStatus(asyncJob.getStatus());
|
||||
}
|
||||
|
||||
isoResponse.setObjectName("iso");
|
||||
isoResponses.add(isoResponse);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -380,9 +380,6 @@ public class ApiServer implements HttpRequestHandler {
|
|||
}
|
||||
|
||||
BaseAsyncCmd asyncCmd = (BaseAsyncCmd)cmdObj;
|
||||
if (objectId != null) {
|
||||
objectId = asyncCmd.getInstanceId();
|
||||
}
|
||||
|
||||
if (userId != null) {
|
||||
params.put("ctxUserId", userId.toString());
|
||||
|
|
@ -400,7 +397,7 @@ public class ApiServer implements HttpRequestHandler {
|
|||
}
|
||||
|
||||
AsyncJobVO job = new AsyncJobVO();
|
||||
job.setInstanceId(asyncCmd.getInstanceId());
|
||||
job.setInstanceId((objectId == null) ? asyncCmd.getInstanceId() : objectId);
|
||||
job.setInstanceType(asyncCmd.getInstanceType());
|
||||
job.setUserId(userId);
|
||||
if (account != null) {
|
||||
|
|
@ -439,7 +436,7 @@ public class ApiServer implements HttpRequestHandler {
|
|||
return;
|
||||
}
|
||||
|
||||
// Using maps might possibly be more efficient if the set is large enough but for now, we'll just n squared
|
||||
// Using maps might possibly be more efficient if the set is large enough but for now, we'll just do a
|
||||
// comparison of two lists. Either way, there shouldn't be too many async jobs active for the account.
|
||||
for (AsyncJob job : jobs) {
|
||||
if (job.getInstanceId() == null) continue;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ import com.cloud.dc.HostPodVO;
|
|||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.offering.DiskOffering;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
import com.cloud.service.ServiceOfferingVO;
|
||||
import com.cloud.storage.DiskOfferingVO;
|
||||
import com.cloud.user.Account;
|
||||
|
|
@ -56,9 +58,10 @@ public interface ConfigurationManager extends Manager {
|
|||
* @param localStorageRequired
|
||||
* @param offerHA
|
||||
* @param useVirtualNetwork
|
||||
* @param domainId
|
||||
* @return ID
|
||||
*/
|
||||
ServiceOfferingVO createServiceOffering(long userId, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired, boolean offerHA, boolean useVirtualNetwork, String tags);
|
||||
ServiceOfferingVO createServiceOffering(long userId, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired, boolean offerHA, boolean useVirtualNetwork, String tags, Long domainId);
|
||||
|
||||
|
||||
|
||||
|
|
@ -152,5 +155,10 @@ public interface ConfigurationManager extends Manager {
|
|||
|
||||
void checkAccess(Account caller, DataCenter zone)
|
||||
throws PermissionDeniedException;
|
||||
|
||||
|
||||
void checkServiceOfferingAccess(Account caller, ServiceOffering so)
|
||||
throws PermissionDeniedException;
|
||||
|
||||
void checkDiskOfferingAccess(Account caller, DiskOffering dof)
|
||||
throws PermissionDeniedException;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1115,6 +1115,13 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Failed to create service offering " + name + ": specify the memory value between 1 and 2147483647");
|
||||
}
|
||||
|
||||
//check if valid domain
|
||||
if(cmd.getDomainId() != null){
|
||||
DomainVO domain = _domainDao.findById(cmd.getDomainId());
|
||||
if(domain == null)
|
||||
throw new InvalidParameterValueException("Please specify a valid domain id");
|
||||
}
|
||||
|
||||
boolean localStorageRequired = false;
|
||||
String storageType = cmd.getStorageType();
|
||||
if (storageType == null) {
|
||||
|
|
@ -1138,18 +1145,18 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||
}
|
||||
|
||||
return createServiceOffering(userId, cmd.getServiceOfferingName(), cpuNumber.intValue(), memory.intValue(), cpuSpeed.intValue(), cmd.getDisplayText(),
|
||||
localStorageRequired, offerHA, useVirtualNetwork, cmd.getTags());
|
||||
localStorageRequired, offerHA, useVirtualNetwork, cmd.getTags(),cmd.getDomainId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServiceOfferingVO createServiceOffering(long userId, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired, boolean offerHA, boolean useVirtualNetwork, String tags) {
|
||||
public ServiceOfferingVO createServiceOffering(long userId, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired, boolean offerHA, boolean useVirtualNetwork, String tags, Long domainId) {
|
||||
String networkRateStr = _configDao.getValue("network.throttling.rate");
|
||||
String multicastRateStr = _configDao.getValue("multicast.throttling.rate");
|
||||
int networkRate = ((networkRateStr == null) ? 200 : Integer.parseInt(networkRateStr));
|
||||
int multicastRate = ((multicastRateStr == null) ? 10 : Integer.parseInt(multicastRateStr));
|
||||
NetworkOffering.GuestIpType guestIpType = useVirtualNetwork ? NetworkOffering.GuestIpType.Virtualized : NetworkOffering.GuestIpType.DirectSingle;
|
||||
tags = cleanupTags(tags);
|
||||
ServiceOfferingVO offering = new ServiceOfferingVO(name, cpu, ramSize, speed, networkRate, multicastRate, offerHA, displayText, guestIpType, localStorageRequired, false, tags, false);
|
||||
ServiceOfferingVO offering = new ServiceOfferingVO(name, cpu, ramSize, speed, networkRate, multicastRate, offerHA, displayText, guestIpType, localStorageRequired, false, tags, false,domainId);
|
||||
|
||||
if ((offering = _serviceOfferingDao.persist(offering)) != null) {
|
||||
saveConfigurationEvent(userId, null, EventTypes.EVENT_SERVICE_OFFERING_CREATE, "Successfully created new service offering with name: " + name + ".", "soId=" + offering.getId(), "name=" + name, "numCPUs=" + cpu, "ram=" + ramSize, "cpuSpeed=" + speed,
|
||||
|
|
@ -1159,7 +1166,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ServiceOffering updateServiceOffering(UpdateServiceOfferingCmd cmd) {
|
||||
String displayText = cmd.getDisplayText();
|
||||
|
|
@ -1169,7 +1176,8 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||
// String tags = cmd.getTags();
|
||||
Boolean useVirtualNetwork = cmd.getUseVirtualNetwork();
|
||||
Long userId = UserContext.current().getUserId();
|
||||
|
||||
Long domainId = cmd.getDomainId();
|
||||
|
||||
if (userId == null) {
|
||||
userId = Long.valueOf(User.UID_SYSTEM);
|
||||
}
|
||||
|
|
@ -1179,8 +1187,8 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||
if (offeringHandle == null) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "unable to find service offering " + id);
|
||||
}
|
||||
|
||||
boolean updateNeeded = (name != null || displayText != null || ha != null || useVirtualNetwork != null);
|
||||
|
||||
boolean updateNeeded = (name != null || displayText != null || ha != null || useVirtualNetwork != null || domainId != null);
|
||||
if (!updateNeeded) {
|
||||
return _serviceOfferingDao.findById(id);
|
||||
}
|
||||
|
|
@ -1204,6 +1212,9 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||
offering.setGuestIpType(guestIpType);
|
||||
}
|
||||
|
||||
if (domainId != null){
|
||||
offering.setDomainId(domainId);
|
||||
}
|
||||
// if (tags != null)
|
||||
// {
|
||||
// if (tags.trim().isEmpty() && offeringHandle.getTags() == null)
|
||||
|
|
@ -1229,7 +1240,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||
if (_serviceOfferingDao.update(id, offering)) {
|
||||
offering = _serviceOfferingDao.findById(id);
|
||||
saveConfigurationEvent(userId, null, EventTypes.EVENT_SERVICE_OFFERING_EDIT, "Successfully updated service offering with name: " + offering.getName() + ".", "soId=" + offering.getId(), "name=" + offering.getName(),
|
||||
"displayText=" + offering.getDisplayText(), "offerHA=" + offering.getOfferHA(), "useVirtualNetwork=" + (offering.getGuestIpType() == NetworkOffering.GuestIpType.Virtualized), "tags=" + offering.getTags());
|
||||
"displayText=" + offering.getDisplayText(), "offerHA=" + offering.getOfferHA(), "useVirtualNetwork=" + (offering.getGuestIpType() == NetworkOffering.GuestIpType.Virtualized), "tags=" + offering.getTags(), "domainId=" + offering.getDomainId());
|
||||
return offering;
|
||||
} else {
|
||||
return null;
|
||||
|
|
@ -1280,6 +1291,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||
String name = cmd.getDiskOfferingName();
|
||||
String displayText = cmd.getDisplayText();
|
||||
// String tags = cmd.getTags();
|
||||
Long domainId = cmd.getDomainId();
|
||||
|
||||
//Check if diskOffering exists
|
||||
DiskOfferingVO diskOfferingHandle = _diskOfferingDao.findById(diskOfferingId);
|
||||
|
|
@ -1303,6 +1315,10 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||
diskOffering.setDisplayText(displayText);
|
||||
}
|
||||
|
||||
if (domainId != null){
|
||||
diskOffering.setDomainId(domainId);
|
||||
}
|
||||
|
||||
// if (tags != null)
|
||||
// {
|
||||
// if (tags.trim().isEmpty() && diskOfferingHandle.getTags() == null)
|
||||
|
|
@ -1327,7 +1343,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||
|
||||
if (_diskOfferingDao.update(diskOfferingId, diskOffering)) {
|
||||
saveConfigurationEvent(UserContext.current().getUserId(), null, EventTypes.EVENT_DISK_OFFERING_EDIT, "Successfully updated disk offering with name: " + diskOffering.getName() + ".", "doId=" + diskOffering.getId(), "name=" + diskOffering.getName(),
|
||||
"displayText=" + diskOffering.getDisplayText(), "diskSize=" + diskOffering.getDiskSize(),"tags=" + diskOffering.getTags());
|
||||
"displayText=" + diskOffering.getDisplayText(), "diskSize=" + diskOffering.getDiskSize(),"tags=" + diskOffering.getTags(),"domainId="+cmd.getDomainId());
|
||||
return _diskOfferingDao.findById(diskOfferingId);
|
||||
} else {
|
||||
return null;
|
||||
|
|
@ -2311,7 +2327,41 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||
return deleteVlanAndPublicIpRange(userId, vlanDbId);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkDiskOfferingAccess(Account caller, DiskOffering dof) throws PermissionDeniedException {
|
||||
for (SecurityChecker checker : _secChecker) {
|
||||
if (checker.checkAccess(caller, dof)) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Access granted to " + caller + " to disk offering:" + dof.getId() + " by " + checker.getName());
|
||||
}
|
||||
return;
|
||||
}else{
|
||||
throw new PermissionDeniedException("Access denied to "+caller+" by "+checker.getName());
|
||||
}
|
||||
}
|
||||
|
||||
assert false : "How can all of the security checkers pass on checking this caller?";
|
||||
throw new PermissionDeniedException("There's no way to confirm " + caller + " has access to disk offering:" + dof.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServiceOfferingAccess(Account caller, ServiceOffering so) throws PermissionDeniedException {
|
||||
for (SecurityChecker checker : _secChecker) {
|
||||
if (checker.checkAccess(caller, so)) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Access granted to " + caller + " to service offering:" + so.getId() + " by " + checker.getName());
|
||||
}
|
||||
return;
|
||||
}else{
|
||||
throw new PermissionDeniedException("Access denied to "+caller+" by "+checker.getName());
|
||||
}
|
||||
}
|
||||
|
||||
assert false : "How can all of the security checkers pass on checking this caller?";
|
||||
throw new PermissionDeniedException("There's no way to confirm " + caller + " has access to service offering:" + so.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkAccess(Account caller, DataCenter zone) throws PermissionDeniedException {
|
||||
for (SecurityChecker checker : _secChecker) {
|
||||
|
|
|
|||
|
|
@ -1196,6 +1196,16 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId);
|
||||
}
|
||||
|
||||
if(offering.getDomainId() == null){
|
||||
//do nothing as offering is public
|
||||
}else{
|
||||
if(userAccount != null){
|
||||
_configMgr.checkServiceOfferingAccess(userAccount, offering);//user deploying his own vm
|
||||
}else{
|
||||
_configMgr.checkServiceOfferingAccess(ctxAccount, offering);
|
||||
}
|
||||
}
|
||||
|
||||
VMTemplateVO template = _templateDao.findById(templateId);
|
||||
// Make sure a valid template ID was specified
|
||||
if (template == null) {
|
||||
|
|
@ -1220,6 +1230,18 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
throw new InvalidParameterValueException("Please specify a valid disk offering ID.");
|
||||
}
|
||||
|
||||
if(diskOffering != null){
|
||||
if(diskOffering.getDomainId() == null){
|
||||
//do nothing as offering is public
|
||||
}else{
|
||||
if(userAccount != null){
|
||||
_configMgr.checkDiskOfferingAccess(userAccount, diskOffering);//user deploying his own vm
|
||||
}else{
|
||||
_configMgr.checkDiskOfferingAccess(ctxAccount, diskOffering);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isIso) {
|
||||
/*iso template doesn;t have hypervisor type, temporarily set it's type as user specified, pass it to storage allocator */
|
||||
template.setHypervisorType(HypervisorType.getType(cmd.getHypervisor()));
|
||||
|
|
@ -1592,17 +1614,71 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
|
||||
return _userAccountDao.search(sc, searchFilter);
|
||||
}
|
||||
|
||||
//This method is used for permissions check for both disk and service offerings
|
||||
private boolean isPermissible(Long accountDomainId, Long offeringDomainId){
|
||||
|
||||
if(accountDomainId == offeringDomainId)
|
||||
return true; // account and service offering in same domain
|
||||
|
||||
DomainVO domainRecord = _domainDao.findById(accountDomainId);
|
||||
|
||||
if(domainRecord != null){
|
||||
while(true){
|
||||
if(domainRecord.getId() == offeringDomainId)
|
||||
return true;
|
||||
|
||||
//try and move on to the next domain
|
||||
if(domainRecord.getParent() != null)
|
||||
domainRecord = _domainDao.findById(domainRecord.getParent());
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ServiceOfferingVO> searchForServiceOfferings(ListServiceOfferingsCmd cmd) throws InvalidParameterValueException, PermissionDeniedException {
|
||||
Filter searchFilter = new Filter(ServiceOfferingVO.class, "created", false, cmd.getStartIndex(), cmd.getPageSizeVal());
|
||||
|
||||
//Note
|
||||
//The list method for offerings is being modified in accordance with discussion with Will/Kevin
|
||||
//For now, we will be listing the following based on the usertype
|
||||
//1. For root, we will list all offerings
|
||||
//2. For domainAdmin and regular users, we will list everything in their domains+parent domains ... all the way till root
|
||||
Filter searchFilter = new Filter(ServiceOfferingVO.class, "created", false, cmd.getStartIndex(), cmd.getPageSizeVal());
|
||||
SearchCriteria<ServiceOfferingVO> sc = _offeringsDao.createSearchCriteria();
|
||||
|
||||
Account account = UserContext.current().getAccount();
|
||||
Object name = cmd.getServiceOfferingName();
|
||||
Object id = cmd.getId();
|
||||
Object keyword = cmd.getKeyword();
|
||||
Long vmId = cmd.getVirtualMachineId();
|
||||
|
||||
Long domainId = cmd.getDomainId();
|
||||
|
||||
//Keeping this logic consistent with domain specific zones
|
||||
//if a domainId is provided, we just return the so associated with this domain
|
||||
if(domainId != null){
|
||||
if(account.getType() == Account.ACCOUNT_TYPE_ADMIN){
|
||||
return _offeringsDao.findServiceOfferingByDomainId(domainId);//no perm check
|
||||
}else{
|
||||
//check if the user's domain == so's domain || user's domain is a child of so's domain
|
||||
if(isPermissible(account.getDomainId(), domainId)){
|
||||
//perm check succeeded
|
||||
return _offeringsDao.findServiceOfferingByDomainId(domainId);
|
||||
}else{
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "The account:"+account.getAccountName()+" does not fall in the same domain hierarchy as the service offering");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//For non-root users
|
||||
if((account.getType() == Account.ACCOUNT_TYPE_NORMAL || account.getType() == Account.ACCOUNT_TYPE_DOMAIN_ADMIN)){
|
||||
return searchServiceOfferingsInternal(account, name, id, vmId, keyword, searchFilter);
|
||||
}
|
||||
|
||||
//for root users, the existing flow
|
||||
if (keyword != null) {
|
||||
SearchCriteria<ServiceOfferingVO> ssc = _offeringsDao.createSearchCriteria();
|
||||
ssc.addOr("displayText", SearchCriteria.Op.LIKE, "%" + keyword + "%");
|
||||
|
|
@ -1610,8 +1686,6 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
|
||||
sc.addAnd("name", SearchCriteria.Op.SC, ssc);
|
||||
} else if (vmId != null) {
|
||||
Account account = UserContext.current().getAccount();
|
||||
|
||||
UserVmVO vmInstance = _userVmDao.findById(vmId);
|
||||
if ((vmInstance == null) || (vmInstance.getRemoved() != null)) {
|
||||
throw new InvalidParameterValueException("unable to find a virtual machine with id " + vmId);
|
||||
|
|
@ -1642,6 +1716,80 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
return _offeringsDao.search(sc, searchFilter);
|
||||
}
|
||||
|
||||
private List<ServiceOfferingVO> searchServiceOfferingsInternal(Account account, Object name, Object id, Long vmId, Object keyword, Filter searchFilter){
|
||||
|
||||
//it was decided to return all offerings for the user's domain, and everything above till root (for normal user or domain admin)
|
||||
//list all offerings belonging to this domain, and all of its parents
|
||||
//check the parent, if not null, add offerings for that parent to list
|
||||
List<ServiceOfferingVO> sol = new ArrayList<ServiceOfferingVO>();
|
||||
DomainVO domainRecord = _domainDao.findById(account.getDomainId());
|
||||
boolean includePublicOfferings = true;
|
||||
if(domainRecord != null)
|
||||
{
|
||||
while(true){
|
||||
SearchCriteria<ServiceOfferingVO> sc = _offeringsDao.createSearchCriteria();
|
||||
|
||||
if (keyword != null) {
|
||||
includePublicOfferings = false;
|
||||
SearchCriteria<ServiceOfferingVO> ssc = _offeringsDao.createSearchCriteria();
|
||||
ssc.addOr("displayText", SearchCriteria.Op.LIKE, "%" + keyword + "%");
|
||||
ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
|
||||
|
||||
sc.addAnd("name", SearchCriteria.Op.SC, ssc);
|
||||
} else if (vmId != null) {
|
||||
includePublicOfferings = false;
|
||||
UserVmVO vmInstance = _userVmDao.findById(vmId);
|
||||
if ((vmInstance == null) || (vmInstance.getRemoved() != null)) {
|
||||
throw new InvalidParameterValueException("unable to find a virtual machine with id " + vmId);
|
||||
}
|
||||
if ((account != null) && !isAdmin(account.getType())) {
|
||||
if (account.getId() != vmInstance.getAccountId()) {
|
||||
throw new PermissionDeniedException("unable to find a virtual machine with id " + vmId + " for this account");
|
||||
}
|
||||
}
|
||||
|
||||
ServiceOfferingVO offering = _offeringsDao.findById(vmInstance.getServiceOfferingId());
|
||||
sc.addAnd("id", SearchCriteria.Op.NEQ, offering.getId());
|
||||
|
||||
// Only return offerings with the same Guest IP type and storage pool preference
|
||||
sc.addAnd("guestIpType", SearchCriteria.Op.EQ, offering.getGuestIpType());
|
||||
sc.addAnd("useLocalStorage", SearchCriteria.Op.EQ, offering.getUseLocalStorage());
|
||||
}
|
||||
|
||||
if (id != null) {
|
||||
includePublicOfferings = false;
|
||||
sc.addAnd("id", SearchCriteria.Op.EQ, id);
|
||||
}
|
||||
|
||||
if (name != null) {
|
||||
includePublicOfferings = false;
|
||||
sc.addAnd("name", SearchCriteria.Op.LIKE, "%" + name + "%");
|
||||
}
|
||||
sc.addAnd("systemUse", SearchCriteria.Op.EQ, false);
|
||||
|
||||
//for this domain
|
||||
sc.addAnd("domainId", SearchCriteria.Op.EQ, domainRecord.getId());
|
||||
|
||||
//search and add for this domain
|
||||
sol.addAll(_offeringsDao.search(sc, searchFilter));
|
||||
|
||||
//try and move on to the next domain
|
||||
if(domainRecord.getParent() != null)
|
||||
domainRecord = _domainDao.findById(domainRecord.getParent());
|
||||
else
|
||||
break;//now we got all the offerings for this user/dom adm
|
||||
}
|
||||
}else{
|
||||
s_logger.error("Could not find the domainId for account:"+account.getAccountName());
|
||||
throw new CloudAuthenticationException("Could not find the domainId for account:"+account.getAccountName());
|
||||
}
|
||||
|
||||
//add all the public offerings to the sol list before returning
|
||||
if(includePublicOfferings)
|
||||
sol.addAll(_offeringsDao.findPublicServiceOfferings());
|
||||
|
||||
return sol;
|
||||
}
|
||||
@Override
|
||||
public List<ClusterVO> searchForClusters(ListClustersCmd cmd) {
|
||||
Filter searchFilter = new Filter(ClusterVO.class, "id", true, cmd.getStartIndex(), cmd.getPageSizeVal());
|
||||
|
|
@ -4202,17 +4350,106 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
return accountNames;
|
||||
}
|
||||
|
||||
private List<DiskOfferingVO> searchDiskOfferingsInternal(Account account, Object name, Object id, Object keyword, Filter searchFilter){
|
||||
//it was decided to return all offerings for the user's domain, and everything above till root (for normal user or domain admin)
|
||||
//list all offerings belonging to this domain, and all of its parents
|
||||
//check the parent, if not null, add offerings for that parent to list
|
||||
List<DiskOfferingVO> dol = new ArrayList<DiskOfferingVO>();
|
||||
DomainVO domainRecord = _domainDao.findById(account.getDomainId());
|
||||
boolean includePublicOfferings = true;
|
||||
if(domainRecord != null)
|
||||
{
|
||||
while(true){
|
||||
SearchBuilder<DiskOfferingVO> sb = _diskOfferingDao.createSearchBuilder();
|
||||
|
||||
sb.and("name", sb.entity().getName(), SearchCriteria.Op.LIKE);
|
||||
sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
|
||||
|
||||
SearchCriteria<DiskOfferingVO> sc = sb.create();
|
||||
if (keyword != null) {
|
||||
includePublicOfferings = false;
|
||||
SearchCriteria<DiskOfferingVO> ssc = _diskOfferingDao.createSearchCriteria();
|
||||
ssc.addOr("displayText", SearchCriteria.Op.LIKE, "%" + keyword + "%");
|
||||
ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
|
||||
|
||||
sc.addAnd("name", SearchCriteria.Op.SC, ssc);
|
||||
}
|
||||
|
||||
if (name != null) {
|
||||
includePublicOfferings = false;
|
||||
sc.setParameters("name", "%" + name + "%");
|
||||
}
|
||||
|
||||
if (id != null) {
|
||||
includePublicOfferings = false;
|
||||
sc.setParameters("id", id);
|
||||
}
|
||||
|
||||
//for this domain
|
||||
sc.addAnd("domainId", SearchCriteria.Op.EQ, domainRecord.getId());
|
||||
|
||||
//search and add for this domain
|
||||
dol.addAll(_diskOfferingDao.search(sc, searchFilter));
|
||||
|
||||
//try and move on to the next domain
|
||||
if(domainRecord.getParent() != null)
|
||||
domainRecord = _domainDao.findById(domainRecord.getParent());
|
||||
else
|
||||
break;//now we got all the offerings for this user/dom adm
|
||||
}
|
||||
}else{
|
||||
s_logger.error("Could not find the domainId for account:"+account.getAccountName());
|
||||
throw new CloudAuthenticationException("Could not find the domainId for account:"+account.getAccountName());
|
||||
}
|
||||
|
||||
//add all the public offerings to the sol list before returning
|
||||
if(includePublicOfferings)
|
||||
dol.addAll(_diskOfferingDao.findPublicDiskOfferings());
|
||||
|
||||
return dol;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DiskOfferingVO> searchForDiskOfferings(ListDiskOfferingsCmd cmd) {
|
||||
//Note
|
||||
//The list method for offerings is being modified in accordance with discussion with Will/Kevin
|
||||
//For now, we will be listing the following based on the usertype
|
||||
//1. For root, we will list all offerings
|
||||
//2. For domainAdmin and regular users, we will list everything in their domains+parent domains ... all the way till root
|
||||
|
||||
Filter searchFilter = new Filter(DiskOfferingVO.class, "id", true, cmd.getStartIndex(), cmd.getPageSizeVal());
|
||||
SearchBuilder<DiskOfferingVO> sb = _diskOfferingDao.createSearchBuilder();
|
||||
|
||||
// SearchBuilder and SearchCriteria are now flexible so that the search builder can be built with all possible
|
||||
// search terms and only those with criteria can be set. The proper SQL should be generated as a result.
|
||||
Account account = UserContext.current().getAccount();
|
||||
Object name = cmd.getDiskOfferingName();
|
||||
Object id = cmd.getId();
|
||||
Object keyword = cmd.getKeyword();
|
||||
|
||||
Long domainId = cmd.getDomainId();
|
||||
//Keeping this logic consistent with domain specific zones
|
||||
//if a domainId is provided, we just return the disk offering associated with this domain
|
||||
if(domainId != null){
|
||||
if(account.getType() == Account.ACCOUNT_TYPE_ADMIN){
|
||||
return _diskOfferingDao.listByDomainId(domainId);//no perm check
|
||||
}else{
|
||||
//check if the user's domain == do's domain || user's domain is a child of so's domain
|
||||
if(isPermissible(account.getDomainId(), domainId)){
|
||||
//perm check succeeded
|
||||
return _diskOfferingDao.listByDomainId(domainId);
|
||||
}else{
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "The account:"+account.getAccountName()+" does not fall in the same domain hierarchy as the disk offering");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//For non-root users
|
||||
if((account.getType() == Account.ACCOUNT_TYPE_NORMAL || account.getType() == Account.ACCOUNT_TYPE_DOMAIN_ADMIN)){
|
||||
return searchDiskOfferingsInternal(account, name, id, keyword, searchFilter);
|
||||
}
|
||||
|
||||
//For root users, preserving existing flow
|
||||
sb.and("name", sb.entity().getName(), SearchCriteria.Op.LIKE);
|
||||
sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
|
||||
|
||||
|
|
|
|||
|
|
@ -72,6 +72,17 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
|
|||
this.offerHA = offerHA;
|
||||
this.guestIpType = guestIpType;
|
||||
}
|
||||
|
||||
public ServiceOfferingVO(String name, int cpu, int ramSize, int speed, int rateMbps, int multicastRateMbps, boolean offerHA, String displayText, NetworkOffering.GuestIpType guestIpType, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, Long domainId) {
|
||||
super(name, displayText, false, tags, recreatable, useLocalStorage, systemUse,false,domainId);
|
||||
this.cpu = cpu;
|
||||
this.ramSize = ramSize;
|
||||
this.speed = speed;
|
||||
this.rateMbps = rateMbps;
|
||||
this.multicastRateMbps = multicastRateMbps;
|
||||
this.offerHA = offerHA;
|
||||
this.guestIpType = guestIpType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getOfferHA() {
|
||||
|
|
@ -145,5 +156,6 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
|
|||
@Override
|
||||
public NetworkOffering.GuestIpType getGuestIpType() {
|
||||
return guestIpType;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
package com.cloud.service.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.service.ServiceOfferingVO;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
|
|
@ -26,5 +28,7 @@ import com.cloud.utils.db.GenericDao;
|
|||
*/
|
||||
public interface ServiceOfferingDao extends GenericDao<ServiceOfferingVO, Long> {
|
||||
ServiceOfferingVO findByName(String name);
|
||||
ServiceOfferingVO persistSystemServiceOffering(ServiceOfferingVO vo);
|
||||
ServiceOfferingVO persistSystemServiceOffering(ServiceOfferingVO vo);
|
||||
List<ServiceOfferingVO> findPublicServiceOfferings();
|
||||
List<ServiceOfferingVO> findServiceOfferingByDomainId(Long domainId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import javax.persistence.EntityExistsException;
|
|||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.service.ServiceOfferingVO;
|
||||
import com.cloud.utils.db.DB;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
|
|
@ -35,7 +36,11 @@ import com.cloud.utils.db.SearchCriteria;
|
|||
public class ServiceOfferingDaoImpl extends GenericDaoBase<ServiceOfferingVO, Long> implements ServiceOfferingDao {
|
||||
protected static final Logger s_logger = Logger.getLogger(ServiceOfferingDaoImpl.class);
|
||||
|
||||
protected final SearchBuilder<ServiceOfferingVO> UniqueNameSearch;
|
||||
protected final SearchBuilder<ServiceOfferingVO> UniqueNameSearch;
|
||||
protected final SearchBuilder<ServiceOfferingVO> ServiceOfferingsByDomainIdSearch;
|
||||
protected final SearchBuilder<ServiceOfferingVO> ServiceOfferingsByKeywordSearch;
|
||||
protected final SearchBuilder<ServiceOfferingVO> PublicServiceOfferingSearch;
|
||||
|
||||
protected ServiceOfferingDaoImpl() {
|
||||
super();
|
||||
|
||||
|
|
@ -43,6 +48,20 @@ public class ServiceOfferingDaoImpl extends GenericDaoBase<ServiceOfferingVO, Lo
|
|||
UniqueNameSearch.and("name", UniqueNameSearch.entity().getUniqueName(), SearchCriteria.Op.EQ);
|
||||
UniqueNameSearch.and("system", UniqueNameSearch.entity().isSystemUse(), SearchCriteria.Op.EQ);
|
||||
UniqueNameSearch.done();
|
||||
|
||||
ServiceOfferingsByDomainIdSearch = createSearchBuilder();
|
||||
ServiceOfferingsByDomainIdSearch.and("domainId", ServiceOfferingsByDomainIdSearch.entity().getDomainId(), SearchCriteria.Op.EQ);
|
||||
ServiceOfferingsByDomainIdSearch.done();
|
||||
|
||||
PublicServiceOfferingSearch = createSearchBuilder();
|
||||
PublicServiceOfferingSearch.and("domainId", PublicServiceOfferingSearch.entity().getDomainId(), SearchCriteria.Op.NULL);
|
||||
PublicServiceOfferingSearch.and("system", PublicServiceOfferingSearch.entity().isSystemUse(), SearchCriteria.Op.EQ);
|
||||
PublicServiceOfferingSearch.done();
|
||||
|
||||
ServiceOfferingsByKeywordSearch = createSearchBuilder();
|
||||
ServiceOfferingsByKeywordSearch.or("name", ServiceOfferingsByKeywordSearch.entity().getName(), SearchCriteria.Op.EQ);
|
||||
ServiceOfferingsByKeywordSearch.or("displayText", ServiceOfferingsByKeywordSearch.entity().getDisplayText(), SearchCriteria.Op.EQ);
|
||||
ServiceOfferingsByKeywordSearch.done();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -71,5 +90,19 @@ public class ServiceOfferingDaoImpl extends GenericDaoBase<ServiceOfferingVO, Lo
|
|||
// Assume it's conflict on unique name
|
||||
return findByName(offering.getUniqueName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ServiceOfferingVO> findServiceOfferingByDomainId(Long domainId){
|
||||
SearchCriteria<ServiceOfferingVO> sc = ServiceOfferingsByDomainIdSearch.create();
|
||||
sc.setParameters("domainId", domainId);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ServiceOfferingVO> findPublicServiceOfferings(){
|
||||
SearchCriteria<ServiceOfferingVO> sc = PublicServiceOfferingSearch.create();
|
||||
sc.setParameters("system", false);
|
||||
return listBy(sc);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1742,6 +1742,12 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
|||
throw new InvalidParameterValueException("Please specify a valid disk offering.");
|
||||
}
|
||||
|
||||
if(diskOffering.getDomainId() == null){
|
||||
//do nothing as offering is public
|
||||
}else{
|
||||
_configMgr.checkDiskOfferingAccess(account, diskOffering);
|
||||
}
|
||||
|
||||
if(!validateVolumeSizeRange(diskOffering.getDiskSize()/1024)){//convert size from mb to gb for validation
|
||||
throw new InvalidParameterValueException("Invalid size for custom volume creation: " + size+" ,max volume size is:"+_maxVolumeSizeInGb);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,5 +26,6 @@ import com.cloud.utils.db.GenericDao;
|
|||
public interface DiskOfferingDao extends GenericDao<DiskOfferingVO, Long> {
|
||||
List<DiskOfferingVO> listByDomainId(long domainId);
|
||||
List<DiskOfferingVO> findPrivateDiskOffering();
|
||||
List<DiskOfferingVO> findPublicDiskOfferings();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import javax.ejb.Local;
|
|||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.service.ServiceOfferingVO;
|
||||
import com.cloud.storage.DiskOfferingVO;
|
||||
import com.cloud.storage.DiskOfferingVO.Type;
|
||||
import com.cloud.utils.db.Attribute;
|
||||
|
|
@ -39,6 +40,7 @@ public class DiskOfferingDaoImpl extends GenericDaoBase<DiskOfferingVO, Long> im
|
|||
|
||||
private final SearchBuilder<DiskOfferingVO> DomainIdSearch;
|
||||
private final SearchBuilder<DiskOfferingVO> PrivateDiskOfferingSearch;
|
||||
private final SearchBuilder<DiskOfferingVO> PublicDiskOfferingSearch;
|
||||
private final Attribute _typeAttr;
|
||||
|
||||
protected DiskOfferingDaoImpl() {
|
||||
|
|
@ -50,6 +52,11 @@ public class DiskOfferingDaoImpl extends GenericDaoBase<DiskOfferingVO, Long> im
|
|||
PrivateDiskOfferingSearch.and("diskSize", PrivateDiskOfferingSearch.entity().getDiskSize(), SearchCriteria.Op.EQ);
|
||||
PrivateDiskOfferingSearch.done();
|
||||
|
||||
PublicDiskOfferingSearch = createSearchBuilder();
|
||||
PublicDiskOfferingSearch.and("domainId", PublicDiskOfferingSearch.entity().getDomainId(), SearchCriteria.Op.NULL);
|
||||
PublicDiskOfferingSearch.and("system", PublicDiskOfferingSearch.entity().isSystemUse(), SearchCriteria.Op.EQ);
|
||||
PublicDiskOfferingSearch.done();
|
||||
|
||||
_typeAttr = _allAttributes.get("type");
|
||||
}
|
||||
|
||||
|
|
@ -91,5 +98,12 @@ public class DiskOfferingDaoImpl extends GenericDaoBase<DiskOfferingVO, Long> im
|
|||
}
|
||||
|
||||
return super.executeList(sql, Type.Disk, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DiskOfferingVO> findPublicDiskOfferings(){
|
||||
SearchCriteria<DiskOfferingVO> sc = PublicDiskOfferingSearch.create();
|
||||
sc.setParameters("system", false);
|
||||
return listBy(sc);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1320,6 +1320,95 @@ a:hover {
|
|||
text-decoration:underline;
|
||||
}
|
||||
|
||||
.language_dropdownpanel {
|
||||
width:103px;
|
||||
height:19px;
|
||||
float:left;
|
||||
position:relative;
|
||||
background:url(../images/language_bg.gif) no-repeat top left;
|
||||
margin:-3px 0 0 8px;
|
||||
display:inline;
|
||||
padding:0;
|
||||
cursor:pointer;
|
||||
cursor:hand;
|
||||
}
|
||||
|
||||
.language_dropdownpanel:hover {
|
||||
background:url(../images/language_bg_hover.gif) no-repeat top left;
|
||||
}
|
||||
|
||||
.language_dropdownpanel p {
|
||||
width:auto;
|
||||
height:auto;
|
||||
float:left;
|
||||
color:#FFF;
|
||||
font-size:11px;
|
||||
font-weight:normal;
|
||||
text-align:left;
|
||||
margin:4px 0 0 4px;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.language_icon {
|
||||
width: 12px;
|
||||
height:11px;
|
||||
float:left;
|
||||
background:url(../images/language_icon.gif) no-repeat top left;
|
||||
margin:4px 0 0 5px;
|
||||
display:inline;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.language_ddarrow {
|
||||
width: 9px;
|
||||
height:5px;
|
||||
float:left;
|
||||
background:url(../images/language_ddarrow.png) no-repeat top left;
|
||||
margin:8px 0 0 5px;
|
||||
display:inline;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.language_dropdownbox {
|
||||
width:105px;
|
||||
height:auto;
|
||||
position:absolute;
|
||||
background:#FFF repeat top left;
|
||||
border:1px solid #999;
|
||||
margin:0;
|
||||
padding:0 0 15px 0;
|
||||
top:16px;
|
||||
z-index:1010;
|
||||
}
|
||||
|
||||
.language_dropdownbox ul {
|
||||
width:85px;
|
||||
height:auto;
|
||||
float:left;
|
||||
list-style:none;
|
||||
margin:5px 0 0 10px;
|
||||
display:inline;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.language_dropdownbox li {
|
||||
width:80px;
|
||||
height:auto;
|
||||
float:left;
|
||||
list-style:none;
|
||||
margin:0px 0 0 0;
|
||||
border-bottom:1px dashed #999;
|
||||
color:#333;
|
||||
font-size:11px;
|
||||
font-weight:normal;
|
||||
display:inline;
|
||||
padding:6px 0 6px 3px;
|
||||
}
|
||||
|
||||
.language_dropdownbox li:hover {
|
||||
background:#e9e9e9 repeat top left;
|
||||
}
|
||||
|
||||
#main_contentpanel {
|
||||
min-width:960px;
|
||||
width:100%;
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 596 B |
Binary file not shown.
|
After Width: | Height: | Size: 402 B |
Binary file not shown.
|
After Width: | Height: | Size: 164 B |
Binary file not shown.
|
After Width: | Height: | Size: 545 B |
70
ui/index.jsp
70
ui/index.jsp
|
|
@ -126,6 +126,19 @@
|
|||
<p>
|
||||
<fmt:message key="label.welcome"/> <span id="main_username"></span>, <a href="#" id="main_logout"><fmt:message key="label.logout"/></a>
|
||||
</p>
|
||||
<div class="language_dropdownpanel">
|
||||
<div class="language_icon"></div>
|
||||
<p>International</p>
|
||||
<div class="language_ddarrow"></div>
|
||||
<div class="language_dropdownbox" style="display:none;">
|
||||
<ul>
|
||||
<li>English</li>
|
||||
<li>汉语 </li>
|
||||
<li>Français</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -138,57 +151,17 @@
|
|||
<form method="post" action="#">
|
||||
<ol>
|
||||
<li>
|
||||
<div class="search_textbg">
|
||||
<input class="text" type="text" name="search_input" />
|
||||
<div id="basic_search" class="search_textbg">
|
||||
<input class="text" type="text" id="search_input" />
|
||||
<div class="search_closebutton" style="display: none;">
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ol>
|
||||
</form>
|
||||
<a href="#">
|
||||
<a id="advanced_search_icon" href="#">
|
||||
<fmt:message key="label.advanced"/></a>
|
||||
<div class="adv_searchpopup" id="adv_search_dialog" style="display: none;">
|
||||
<div class="adv_searchformbox">
|
||||
<h3><fmt:message key="label.advanced.search"/></h3>
|
||||
<a id="advanced_search_close" href="#"><fmt:message key="label.close"/> </a>
|
||||
<form action="#" method="post">
|
||||
<ol style="margin-top: 8px;">
|
||||
<li>
|
||||
<label for="filter">
|
||||
<fmt:message key="label.name"/>:</label>
|
||||
<input class="text" type="text" name="adv_search_name" id="adv_search_name" />
|
||||
</li>
|
||||
<li>
|
||||
<label for="filter">
|
||||
<fmt:message key="label.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">
|
||||
<fmt:message key="label.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 id="advanced_search_container">
|
||||
</div>
|
||||
</div>
|
||||
<div class="actionpanel_button_wrapper" id="midmenu_action_link" style="position: relative;
|
||||
|
|
@ -500,9 +473,12 @@
|
|||
<span id="label"><fmt:message key="label.menu.destroyed.instances"/></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="leftmenu_instance_group_container">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="leftmenu_list">
|
||||
<div class="leftmenu_content_flevel" id="leftmenu_storage">
|
||||
|
|
|
|||
130
ui/jsp/event.jsp
130
ui/jsp/event.jsp
|
|
@ -120,4 +120,132 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- event detail panel (end) -->
|
||||
<!-- event detail panel (end) -->
|
||||
|
||||
<!-- advanced search template (begin) -->
|
||||
<div id="advanced_search_template" class="adv_searchpopup" style="display: none;">
|
||||
<div class="adv_searchformbox">
|
||||
<h3>
|
||||
Advance Search</h3>
|
||||
<a id="advanced_search_close" href="#">Close </a>
|
||||
<form action="#" method="post">
|
||||
<ol>
|
||||
<li>
|
||||
<label>
|
||||
Type:</label>
|
||||
<select class="select" id="adv_search_type">
|
||||
<option value=""></option>
|
||||
<option value="VM.CREATE">VM.CREATE</option>
|
||||
<option value="VM.DESTROY">VM.DESTROY</option>
|
||||
<option value="VM.START">VM.START</option>
|
||||
<option value="VM.STOP">VM.STOP</option>
|
||||
<option value="VM.REBOOT">VM.REBOOT</option>
|
||||
<option value="VM.DISABLEHA">VM.DISABLEHA</option>
|
||||
<option value="VM.ENABLEHA">VM.ENABLEHA</option>
|
||||
<option value="VM.UPGRADE">VM.UPGRADE</option>
|
||||
<option value="VM.RESETPASSWORD">VM.RESETPASSWORD</option>
|
||||
<option value="ROUTER.CREATE">ROUTER.CREATE</option>
|
||||
<option value="ROUTER.DESTROY">ROUTER.DESTROY</option>
|
||||
<option value="ROUTER.START">ROUTER.START</option>
|
||||
<option value="ROUTER.STOP">ROUTER.STOP</option>
|
||||
<option value="ROUTER.REBOOT">ROUTER.REBOOT</option>
|
||||
<option value="ROUTER.HA">ROUTER.HA</option>
|
||||
<option value="PROXY.CREATE">PROXY.CREATE</option>
|
||||
<option value="PROXY.DESTROY">PROXY.DESTROY</option>
|
||||
<option value="PROXY.START">PROXY.START</option>
|
||||
<option value="PROXY.STOP">PROXY.STOP</option>
|
||||
<option value="PROXY.REBOOT">PROXY.REBOOT</option>
|
||||
<option value="PROXY.HA">PROXY.HA</option>
|
||||
<option value="VNC.CONNECT">VNC.CONNECT</option>
|
||||
<option value="VNC.DISCONNECT">VNC.DISCONNECT</option>
|
||||
<option value="NET.IPASSIGN">NET.IPASSIGN</option>
|
||||
<option value="NET.IPRELEASE">NET.IPRELEASE</option>
|
||||
<option value="NET.RULEADD">NET.RULEADD</option>
|
||||
<option value="NET.RULEDELETE">NET.RULEDELETE</option>
|
||||
<option value="NET.RULEMODIFY">NET.RULEMODIFY</option>
|
||||
<option value="PF.SERVICE.APPLY">PF.SERVICE.APPLY</option>
|
||||
<option value="PF.SERVICE.REMOVE">PF.SERVICE.REMOVE</option>
|
||||
<option value="SECGROUP.APPLY">SECGROUP.APPLY</option>
|
||||
<option value="SECGROUP.REMOVE">SECGROUP.REMOVE</option>
|
||||
<option value="LB.CREATE">LB.CREATE</option>
|
||||
<option value="LB.DELETE">LB.DELETE</option>
|
||||
<option value="USER.LOGIN">USER.LOGIN</option>
|
||||
<option value="USER.LOGOUT">USER.LOGOUT</option>
|
||||
<option value="USER.CREATE">USER.CREATE</option>
|
||||
<option value="USER.DELETE">USER.DELETE</option>
|
||||
<option value="USER.UPDATE">USER.UPDATE</option>
|
||||
<option value="TEMPLATE.CREATE">TEMPLATE.CREATE</option>
|
||||
<option value="TEMPLATE.DELETE">TEMPLATE.DELETE</option>
|
||||
<option value="TEMPLATE.UPDATE">TEMPLATE.UPDATE</option>
|
||||
<option value="TEMPLATE.COPY">TEMPLATE.COPY</option>
|
||||
<option value="TEMPLATE.DOWNLOAD.START">TEMPLATE.DOWNLOAD.START</option>
|
||||
<option value="TEMPLATE.DOWNLOAD.SUCCESS">TEMPLATE.DOWNLOAD.SUCCESS</option>
|
||||
<option value="TEMPLATE.DOWNLOAD.FAILED">TEMPLATE.DOWNLOAD.FAILED</option>
|
||||
<option value="VOLUME.CREATE">VOLUME.CREATE</option>
|
||||
<option value="VOLUME.DELETE">VOLUME.DELETE</option>
|
||||
<option value="VOLUME.ATTACH">VOLUME.ATTACH</option>
|
||||
<option value="VOLUME.DETACH">VOLUME.DETACH</option>
|
||||
<option value="SERVICEOFFERING.CREATE">SERVICEOFFERING.CREATE</option>
|
||||
<option value="SERVICEOFFERING.UPDATE">SERVICEOFFERING.UPDATE</option>
|
||||
<option value="SERVICEOFFERING.DELETE">SERVICEOFFERING.DELETE</option>
|
||||
<option value="DOMAIN.CREATE">DOMAIN.CREATE</option>
|
||||
<option value="DOMAIN.DELETE">DOMAIN.DELETE</option>
|
||||
<option value="DOMAIN.UPDATE">DOMAIN.UPDATE</option>
|
||||
<option value="SNAPSHOT.CREATE">SNAPSHOT.CREATE</option>
|
||||
<option value="SNAPSHOT.DELETE">SNAPSHOT.DELETE</option>
|
||||
<option value="SNAPSHOTPOLICY.CREATE">SNAPSHOTPOLICY.CREATE</option>
|
||||
<option value="SNAPSHOTPOLICY.UPDATE">SNAPSHOTPOLICY.UPDATE</option>
|
||||
<option value="SNAPSHOTPOLICY.DELETE">SNAPSHOTPOLICY.DELETE</option>
|
||||
<option value="ISO.CREATE">ISO.CREATE</option>
|
||||
<option value="ISO.DELETE">ISO.DELETE</option>
|
||||
<option value="ISO.COPY">ISO.COPY</option>
|
||||
<option value="ISO.ATTACH">ISO.ATTACH</option>
|
||||
<option value="ISO.DETACH">ISO.DETACH</option>
|
||||
<option value="SSVM.CREATE">SSVM.CREATE</option>
|
||||
<option value="SSVM.DESTROY">SSVM.DESTROY</option>
|
||||
<option value="SSVM.START">SSVM.START</option>
|
||||
<option value="SSVM.STOP">SSVM.STOP</option>
|
||||
<option value="SSVM.REBOOT">SSVM.REBOOT</option>
|
||||
<option value="SSVM.HA">SSVM.HA</option>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
Level:</label>
|
||||
<select class="select" id="adv_search_level">
|
||||
<option value=""></option>
|
||||
<option value="INFO">INFO</option>
|
||||
<option value="WARN">WARN</option>
|
||||
<option value="ERROR">ERROR</option>
|
||||
</select>
|
||||
</li>
|
||||
<li id="adv_search_domain_li" style="display: none;">
|
||||
<label>
|
||||
Domain:</label>
|
||||
<select class="select" id="adv_search_domain">
|
||||
</select>
|
||||
</li>
|
||||
<li id="adv_search_account_li" style="display: none;">
|
||||
<label>
|
||||
Account:</label>
|
||||
<input class="text" type="text" id="adv_search_account" />
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
Start Date:</label>
|
||||
<input class="text" type="text" id="adv_search_startdate" />
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
End Date:</label>
|
||||
<input class="text" type="text" id="adv_search_enddate" />
|
||||
</li>
|
||||
</ol>
|
||||
</form>
|
||||
<div class="adv_search_actionbox">
|
||||
<div class="adv_searchpopup_button" id="adv_search_button">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- advanced search template (end) -->
|
||||
|
|
@ -1353,3 +1353,60 @@
|
|||
</div>
|
||||
|
||||
<!-- ***** Dialogs (end) ***** -->
|
||||
|
||||
<!-- advanced search template (begin) -->
|
||||
<div id="advanced_search_template" class="adv_searchpopup" style="display: none;">
|
||||
<div class="adv_searchformbox">
|
||||
<h3>
|
||||
Advance Search</h3>
|
||||
<a id="advanced_search_close" href="#">Close </a>
|
||||
<form action="#" method="post">
|
||||
<ol>
|
||||
<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>
|
||||
<li id="adv_search_domain_li" style="display: none;">
|
||||
<label for="filter">
|
||||
Domain:</label>
|
||||
<select class="select" id="adv_search_domain">
|
||||
</select>
|
||||
</li>
|
||||
<li id="adv_search_account_li" style="display: none;">
|
||||
<label for="filter">
|
||||
Account:</label>
|
||||
<input class="text" type="text" id="adv_search_account" />
|
||||
</li>
|
||||
</ol>
|
||||
</form>
|
||||
<div class="adv_search_actionbox">
|
||||
<div class="adv_searchpopup_button" id="adv_search_button">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- advanced search template (end) -->
|
||||
|
|
@ -717,3 +717,49 @@
|
|||
</div>
|
||||
</div>
|
||||
<!-- Create template from snapshot (end) -->
|
||||
|
||||
<!-- advanced search template (begin) -->
|
||||
<div id="advanced_search_template" class="adv_searchpopup" style="display: none;">
|
||||
<div class="adv_searchformbox">
|
||||
<h3>
|
||||
Advance Search</h3>
|
||||
<a id="advanced_search_close" href="#">Close </a>
|
||||
<form action="#" method="post">
|
||||
<ol>
|
||||
<li>
|
||||
<label for="filter">
|
||||
Name:</label>
|
||||
<input class="text" type="text" name="adv_search_name" id="adv_search_name" />
|
||||
</li>
|
||||
<li>
|
||||
<label for="filter">
|
||||
Zone:</label>
|
||||
<select class="select" id="adv_search_zone">
|
||||
</select>
|
||||
</li>
|
||||
<li id="adv_search_pod_li" style="display: none;">
|
||||
<label for="filter" id="adv_search_pod_label">
|
||||
Pod:</label>
|
||||
<select class="select" id="adv_search_pod">
|
||||
</select>
|
||||
</li>
|
||||
<li id="adv_search_domain_li" style="display: none;">
|
||||
<label for="filter">
|
||||
Domain:</label>
|
||||
<select class="select" id="adv_search_domain">
|
||||
</select>
|
||||
</li>
|
||||
<li id="adv_search_account_li" style="display: none;">
|
||||
<label for="filter">
|
||||
Account:</label>
|
||||
<input class="text" type="text" id="adv_search_account" />
|
||||
</li>
|
||||
</ol>
|
||||
</form>
|
||||
<div class="adv_search_actionbox">
|
||||
<div class="adv_searchpopup_button" id="adv_search_button">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- advanced search template (end) -->
|
||||
|
|
@ -19,6 +19,10 @@
|
|||
var systemAccountId = 1;
|
||||
var adminAccountId = 2;
|
||||
|
||||
function accountGetSearchParams() {
|
||||
return "";
|
||||
}
|
||||
|
||||
function afterLoadAccountJSP() {
|
||||
initDialog("dialog_resource_limits");
|
||||
initDialog("dialog_disable_account");
|
||||
|
|
@ -60,15 +64,15 @@ function accountJsonToDetailsTab() {
|
|||
var $detailsTab = $("#right_panel_content").find("#tab_content_details");
|
||||
|
||||
$detailsTab.find("#grid_header_title").text(fromdb(jsonObj.name));
|
||||
$detailsTab.find("#id").text(noNull(jsonObj.id));
|
||||
$detailsTab.find("#id").text(fromdb(jsonObj.id));
|
||||
$detailsTab.find("#role").text(toRole(jsonObj.accounttype));
|
||||
$detailsTab.find("#account").text(fromdb(jsonObj.name));
|
||||
$detailsTab.find("#domain").text(fromdb(jsonObj.domain));
|
||||
$detailsTab.find("#vm_total").text(noNull(jsonObj.vmtotal));
|
||||
$detailsTab.find("#ip_total").text(noNull(jsonObj.iptotal));
|
||||
$detailsTab.find("#vm_total").text(fromdb(jsonObj.vmtotal));
|
||||
$detailsTab.find("#ip_total").text(fromdb(jsonObj.iptotal));
|
||||
$detailsTab.find("#bytes_received").text(convertBytes(jsonObj.receivedbytes));
|
||||
$detailsTab.find("#bytes_sent").text(convertBytes(jsonObj.sentbytes));
|
||||
$detailsTab.find("#state").text(noNull(jsonObj.state));
|
||||
$detailsTab.find("#state").text(fromdb(jsonObj.state));
|
||||
|
||||
//actions ***
|
||||
var $actionMenu = $("#right_panel_content #tab_content_details #action_link #action_menu");
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
function alertGetSearchParams() {
|
||||
return "";
|
||||
}
|
||||
|
||||
function afterLoadAlertJSP() {
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
function diskOfferingGetSearchParams() {
|
||||
return "";
|
||||
}
|
||||
|
||||
function afterLoadDiskOfferingJSP() {
|
||||
var $detailsTab = $("#right_panel_content #tab_content_details");
|
||||
initAddDiskOfferingButton($("#midmenu_add_link"));
|
||||
|
|
@ -84,7 +88,7 @@ function initAddDiskOfferingButton($midmenuAddLink1) {
|
|||
|
||||
var tags = trim(thisDialog.find("#add_disk_tags").val());
|
||||
if(tags != null && tags.length > 0)
|
||||
array1.push("&tags="+encodeURIComponent(tags));
|
||||
array1.push("&tags="+todb(tags));
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=createDiskOffering&isMirrored=false" + array1.join("")),
|
||||
|
|
@ -149,7 +153,7 @@ function doEditDiskOffering2($actionLink, $detailsTab, $midmenuItem1, $readonlyF
|
|||
array1.push("&displayText="+todb(displaytext));
|
||||
|
||||
var tags = $detailsTab.find("#tags_edit").val();
|
||||
array1.push("&tags="+encodeURIComponent(tags));
|
||||
array1.push("&tags="+todb(tags));
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=updateDiskOffering&id="+id+array1.join("")),
|
||||
|
|
@ -212,7 +216,7 @@ function diskOfferingJsonToDetailsTab() {
|
|||
}
|
||||
});
|
||||
|
||||
$thisTab.find("#id").text(noNull(jsonObj.id));
|
||||
$thisTab.find("#id").text(fromdb(jsonObj.id));
|
||||
|
||||
$thisTab.find("#grid_header_title").text(fromdb(jsonObj.name));
|
||||
$thisTab.find("#name").text(fromdb(jsonObj.name));
|
||||
|
|
|
|||
|
|
@ -60,12 +60,12 @@ function drawNode(json, level, container) {
|
|||
|
||||
var $treeNode = $("#domain_tree_node_template").clone(true);
|
||||
$treeNode.find("#domain_indent").css("marginLeft", (30*(level+1)));
|
||||
$treeNode.attr("id", "domain_"+noNull(json.id));
|
||||
$treeNode.attr("id", "domain_"+fromdb(json.id));
|
||||
$treeNode.data("jsonObj", json).data("domainLevel", level);
|
||||
$treeNode.find("#domain_title_container").attr("id", "domain_title_container_"+noNull(json.id));
|
||||
$treeNode.find("#domain_expand_icon").attr("id", "domain_expand_icon_"+noNull(json.id));
|
||||
$treeNode.find("#domain_name").attr("id", "domain_name_"+noNull(json.id)).text(fromdb(json.name));
|
||||
$treeNode.find("#domain_children_container").attr("id", "domain_children_container_"+noNull(json.id));
|
||||
$treeNode.find("#domain_title_container").attr("id", "domain_title_container_"+fromdb(json.id));
|
||||
$treeNode.find("#domain_expand_icon").attr("id", "domain_expand_icon_"+fromdb(json.id));
|
||||
$treeNode.find("#domain_name").attr("id", "domain_name_"+fromdb(json.id)).text(fromdb(json.name));
|
||||
$treeNode.find("#domain_children_container").attr("id", "domain_children_container_"+fromdb(json.id));
|
||||
container.append($treeNode.show());
|
||||
return $treeNode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,49 @@
|
|||
*
|
||||
*/
|
||||
|
||||
function eventGetSearchParams() {
|
||||
var moreCriteria = [];
|
||||
|
||||
var $advancedSearchPopup = $("#advanced_search_popup");
|
||||
if (lastSearchType == "advanced_search" && $advancedSearchPopup.length > 0) {
|
||||
var type = $advancedSearchPopup.find("#adv_search_type").val();
|
||||
if (type!=null && trim(type).length > 0)
|
||||
moreCriteria.push("&type="+todb(type));
|
||||
|
||||
var level = $advancedSearchPopup.find("#adv_search_level").val();
|
||||
if (level!=null && level.length > 0)
|
||||
moreCriteria.push("&level="+todb(level));
|
||||
|
||||
if ($advancedSearchPopup.find("#adv_search_domain_li").css("display") != "none") {
|
||||
var domainId = $advancedSearchPopup.find("#adv_search_domain").val();
|
||||
if (domainId!=null && domainId.length > 0)
|
||||
moreCriteria.push("&domainid="+todb(domainId));
|
||||
}
|
||||
|
||||
if ($advancedSearchPopup.find("#adv_search_account_li").css("display") != "none") {
|
||||
var account = $advancedSearchPopup.find("#adv_search_account").val();
|
||||
if (account!=null && account.length > 0)
|
||||
moreCriteria.push("&account="+todb(account));
|
||||
}
|
||||
|
||||
var startdate = $advancedSearchPopup.find("#adv_search_startdate").val();
|
||||
if (startdate!=null && startdate.length > 0)
|
||||
moreCriteria.push("&startdate="+todb(startdate));
|
||||
|
||||
var enddate = $advancedSearchPopup.find("#adv_search_enddate").val();
|
||||
if (enddate!=null && enddate.length > 0)
|
||||
moreCriteria.push("&enddate="+todb(enddate));
|
||||
}
|
||||
else {
|
||||
var searchInput = $("#basic_search").find("#search_input").val();
|
||||
if (lastSearchType == "basic_search" && searchInput != null && searchInput.length > 0) {
|
||||
moreCriteria.push("&type="+todb(searchInput));
|
||||
}
|
||||
}
|
||||
|
||||
return moreCriteria.join("");
|
||||
}
|
||||
|
||||
function afterLoadEventJSP() {
|
||||
|
||||
}
|
||||
|
|
@ -55,7 +98,7 @@ function eventJsonToDetailsTab() {
|
|||
$thisTab.find("#tab_container").hide();
|
||||
$thisTab.find("#tab_spinning_wheel").show();
|
||||
|
||||
$thisTab.find("#id").text(noNull(jsonObj.id));
|
||||
$thisTab.find("#id").text(fromdb(jsonObj.id));
|
||||
$thisTab.find("#username").text(fromdb(jsonObj.username));
|
||||
$thisTab.find("#account").text(fromdb(jsonObj.account));
|
||||
$thisTab.find("#type").text(fromdb(jsonObj.type));
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ function hostJsonToDetailsTab() {
|
|||
$thisTab.find("#tab_container").hide();
|
||||
$thisTab.find("#tab_spinning_wheel").show();
|
||||
|
||||
$thisTab.find("#id").text(noNull(jsonObj.id));
|
||||
$thisTab.find("#id").text(fromdb(jsonObj.id));
|
||||
$thisTab.find("#grid_header_title").text(fromdb(jsonObj.name));
|
||||
$thisTab.find("#name").text(fromdb(jsonObj.name));
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ $(document).ready(function() {
|
|||
});
|
||||
$("#leftmenu_account").bind("click", function(event) {
|
||||
selectLeftMenu($(this), false);
|
||||
listMidMenuItems("listAccounts", "listaccountsresponse", "account", "jsp/account.jsp", afterLoadAccountJSP, accountToMidmenu, accountToRightPanel, getMidmenuId, false, "leftmenu_account");
|
||||
listMidMenuItems("listAccounts", accountGetSearchParams, "listaccountsresponse", "account", "jsp/account.jsp", afterLoadAccountJSP, accountToMidmenu, accountToRightPanel, getMidmenuId, false, "leftmenu_account");
|
||||
return false;
|
||||
});
|
||||
|
||||
|
|
@ -109,31 +109,31 @@ $(document).ready(function() {
|
|||
function buildSecondLevelNavigation() {
|
||||
|
||||
// Instance sub menus
|
||||
bindAndListMidMenuItems($("#leftmenu_instances_my_instances"), "listVirtualMachines&domainid="+g_domainid+"&account="+g_account, "listvirtualmachinesresponse", "virtualmachine", "jsp/instance.jsp", afterLoadInstanceJSP, vmToMidmenu, vmToRightPanel, getMidmenuId, true);
|
||||
bindAndListMidMenuItems($("#leftmenu_instances_all_instances"), "listVirtualMachines", "listvirtualmachinesresponse", "virtualmachine", "jsp/instance.jsp", afterLoadInstanceJSP, vmToMidmenu, vmToRightPanel, getMidmenuId, true);
|
||||
bindAndListMidMenuItems($("#leftmenu_instances_running_instances"), "listVirtualMachines&state=Running", "listvirtualmachinesresponse", "virtualmachine", "jsp/instance.jsp", afterLoadInstanceJSP, vmToMidmenu, vmToRightPanel, getMidmenuId, true);
|
||||
bindAndListMidMenuItems($("#leftmenu_instances_stopped_instances"), "listVirtualMachines&state=Stopped", "listvirtualmachinesresponse", "virtualmachine", "jsp/instance.jsp", afterLoadInstanceJSP, vmToMidmenu, vmToRightPanel, getMidmenuId, true);
|
||||
bindAndListMidMenuItems($("#leftmenu_instances_destroyed_instances"), "listVirtualMachines&state=Destroyed", "listvirtualmachinesresponse", "virtualmachine", "jsp/instance.jsp", afterLoadInstanceJSP, vmToMidmenu, vmToRightPanel, getMidmenuId, true);
|
||||
bindAndListMidMenuItems($("#leftmenu_instances_my_instances"), "listVirtualMachines&domainid="+g_domainid+"&account="+g_account, vmGetSearchParams, "listvirtualmachinesresponse", "virtualmachine", "jsp/instance.jsp", afterLoadInstanceJSP, vmToMidmenu, vmToRightPanel, getMidmenuId, true);
|
||||
bindAndListMidMenuItems($("#leftmenu_instances_all_instances"), "listVirtualMachines", vmGetSearchParams, "listvirtualmachinesresponse", "virtualmachine", "jsp/instance.jsp", afterLoadInstanceJSP, vmToMidmenu, vmToRightPanel, getMidmenuId, true);
|
||||
bindAndListMidMenuItems($("#leftmenu_instances_running_instances"), "listVirtualMachines&state=Running", vmGetSearchParams, "listvirtualmachinesresponse", "virtualmachine", "jsp/instance.jsp", afterLoadInstanceJSP, vmToMidmenu, vmToRightPanel, getMidmenuId, true);
|
||||
bindAndListMidMenuItems($("#leftmenu_instances_stopped_instances"), "listVirtualMachines&state=Stopped", vmGetSearchParams, "listvirtualmachinesresponse", "virtualmachine", "jsp/instance.jsp", afterLoadInstanceJSP, vmToMidmenu, vmToRightPanel, getMidmenuId, true);
|
||||
bindAndListMidMenuItems($("#leftmenu_instances_destroyed_instances"), "listVirtualMachines&state=Destroyed", vmGetSearchParams, "listvirtualmachinesresponse", "virtualmachine", "jsp/instance.jsp", afterLoadInstanceJSP, vmToMidmenu, vmToRightPanel, getMidmenuId, true);
|
||||
|
||||
bindAndListMidMenuItems($("#leftmenu_event"), "listEvents", "listeventsresponse", "event", "jsp/event.jsp", afterLoadEventJSP, eventToMidmenu, eventToRightPanel, getMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_alert"), "listAlerts", "listalertsresponse", "alert", "jsp/alert.jsp", afterLoadAlertJSP, alertToMidmenu, alertToRightPanel, getMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_volume"), "listVolumes", "listvolumesresponse", "volume", "jsp/volume.jsp", afterLoadVolumeJSP, volumeToMidmenu, volumeToRightPanel, getMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_snapshot"), "listSnapshots", "listsnapshotsresponse", "snapshot", "jsp/snapshot.jsp", afterLoadSnapshotJSP, snapshotToMidmenu, snapshotToRightPanel, getMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_ip"), "listPublicIpAddresses", "listpublicipaddressesresponse", "publicipaddress", "jsp/ipaddress.jsp", afterLoadIpJSP, ipToMidmenu, ipToRightPanel, ipGetMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_event"), "listEvents", eventGetSearchParams, "listeventsresponse", "event", "jsp/event.jsp", afterLoadEventJSP, eventToMidmenu, eventToRightPanel, getMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_alert"), "listAlerts", alertGetSearchParams, "listalertsresponse", "alert", "jsp/alert.jsp", afterLoadAlertJSP, alertToMidmenu, alertToRightPanel, getMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_volume"), "listVolumes", volumeGetSearchParams, "listvolumesresponse", "volume", "jsp/volume.jsp", afterLoadVolumeJSP, volumeToMidmenu, volumeToRightPanel, getMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_snapshot"), "listSnapshots", snapshotGetSearchParams, "listsnapshotsresponse", "snapshot", "jsp/snapshot.jsp", afterLoadSnapshotJSP, snapshotToMidmenu, snapshotToRightPanel, getMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_ip"), "listPublicIpAddresses", ipGetSearchParams, "listpublicipaddressesresponse", "publicipaddress", "jsp/ipaddress.jsp", afterLoadIpJSP, ipToMidmenu, ipToRightPanel, ipGetMidmenuId, false);
|
||||
|
||||
bindAndListMidMenuItems($("#leftmenu_submenu_my_template"), "listTemplates&templatefilter=self", "listtemplatesresponse", "template", "jsp/template.jsp", afterLoadTemplateJSP, templateToMidmenu, templateToRightPanel, templateGetMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_submenu_featured_template"), "listTemplates&templatefilter=featured", "listtemplatesresponse", "template", "jsp/template.jsp", afterLoadTemplateJSP, templateToMidmenu, templateToRightPanel, templateGetMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_submenu_community_template"), "listTemplates&templatefilter=community", "listtemplatesresponse", "template", "jsp/template.jsp", afterLoadTemplateJSP, templateToMidmenu, templateToRightPanel, templateGetMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_submenu_my_template"), "listTemplates&templatefilter=self", templateGetSearchParams, "listtemplatesresponse", "template", "jsp/template.jsp", afterLoadTemplateJSP, templateToMidmenu, templateToRightPanel, templateGetMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_submenu_featured_template"), "listTemplates&templatefilter=featured", templateGetSearchParams, "listtemplatesresponse", "template", "jsp/template.jsp", afterLoadTemplateJSP, templateToMidmenu, templateToRightPanel, templateGetMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_submenu_community_template"), "listTemplates&templatefilter=community", templateGetSearchParams, "listtemplatesresponse", "template", "jsp/template.jsp", afterLoadTemplateJSP, templateToMidmenu, templateToRightPanel, templateGetMidmenuId, false);
|
||||
|
||||
bindAndListMidMenuItems($("#leftmenu_submenu_my_iso"), "listIsos&isofilter=self", "listisosresponse", "iso", "jsp/iso.jsp", afterLoadIsoJSP, isoToMidmenu, isoToRightPanel, isoGetMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_submenu_featured_iso"), "listIsos&isofilter=featured", "listisosresponse", "iso", "jsp/iso.jsp", afterLoadIsoJSP, isoToMidmenu, isoToRightPanel, isoGetMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_submenu_community_iso"), "listIsos&isofilter=community", "listisosresponse", "iso", "jsp/iso.jsp", afterLoadIsoJSP, isoToMidmenu, isoToRightPanel, isoGetMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_submenu_my_iso"), "listIsos&isofilter=self", isoGetSearchParams, "listisosresponse", "iso", "jsp/iso.jsp", afterLoadIsoJSP, isoToMidmenu, isoToRightPanel, isoGetMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_submenu_featured_iso"), "listIsos&isofilter=featured", isoGetSearchParams, "listisosresponse", "iso", "jsp/iso.jsp", afterLoadIsoJSP, isoToMidmenu, isoToRightPanel, isoGetMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_submenu_community_iso"), "listIsos&isofilter=community", isoGetSearchParams, "listisosresponse", "iso", "jsp/iso.jsp", afterLoadIsoJSP, isoToMidmenu, isoToRightPanel, isoGetMidmenuId, false);
|
||||
|
||||
bindAndListMidMenuItems($("#leftmenu_service_offering"), "listServiceOfferings", "listserviceofferingsresponse", "serviceoffering", "jsp/serviceoffering.jsp", afterLoadServiceOfferingJSP, serviceOfferingToMidmenu, serviceOfferingToRightPanel, getMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_disk_offering"), "listDiskOfferings", "listdiskofferingsresponse", "diskoffering", "jsp/diskoffering.jsp", afterLoadDiskOfferingJSP, diskOfferingToMidmenu, diskOfferingToRightPanel, getMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_service_offering"), "listServiceOfferings", serviceOfferingGetSearchParams, "listserviceofferingsresponse", "serviceoffering", "jsp/serviceoffering.jsp", afterLoadServiceOfferingJSP, serviceOfferingToMidmenu, serviceOfferingToRightPanel, getMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_disk_offering"), "listDiskOfferings", diskOfferingGetSearchParams, "listdiskofferingsresponse", "diskoffering", "jsp/diskoffering.jsp", afterLoadDiskOfferingJSP, diskOfferingToMidmenu, diskOfferingToRightPanel, getMidmenuId, false);
|
||||
|
||||
bindAndListMidMenuItems($("#leftmenu_submenu_virtual_router"), "listRouters", "listroutersresponse", "router", "jsp/router.jsp", afterLoadRouterJSP, routerToMidmenu, routerToRightPanel, getMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_submenu_systemvm"), "listSystemVms", "listsystemvmsresponse", "systemvm", "jsp/systemvm.jsp", afterLoadSystemVmJSP, systemvmToMidmenu, systemvmToRightPanel, getMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_submenu_virtual_router"), "listRouters", routerGetSearchParams, "listroutersresponse", "router", "jsp/router.jsp", afterLoadRouterJSP, routerToMidmenu, routerToRightPanel, getMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_submenu_systemvm"), "listSystemVms", systemVmGetSearchParams, "listsystemvmsresponse", "systemvm", "jsp/systemvm.jsp", afterLoadSystemVmJSP, systemvmToMidmenu, systemvmToRightPanel, getMidmenuId, false);
|
||||
|
||||
$("#leftmenu_global_setting").bind("click", function(event) {
|
||||
selectLeftSubMenu($(this));
|
||||
|
|
@ -210,6 +210,147 @@ $(document).ready(function() {
|
|||
return;
|
||||
}
|
||||
|
||||
//basic search
|
||||
$("#basic_search").find("#search_input").unbind("keypress").bind("keypress", function(event) {
|
||||
event.stopPropagation();
|
||||
if(event.keyCode == keycode_Enter) {
|
||||
event.preventDefault();
|
||||
var params = $("#middle_menu_pagination").data("params");
|
||||
if(params == null)
|
||||
return;
|
||||
lastSearchType = "basic_search";
|
||||
listMidMenuItems2(params.commandString, params.getSearchParamsFn, params.jsonResponse1, params.jsonResponse2, params.toMidmenuFn, params.toRightPanelFn, params.getMidmenuIdFn, params.isMultipleSelectionInMidMenu, 1);
|
||||
}
|
||||
});
|
||||
|
||||
//advanced search
|
||||
$("#advanced_search_icon").unbind("click").bind("click", function(event) {
|
||||
var $advancedSearch = $("#advanced_search_template").clone().attr("id", "advanced_search_popup");
|
||||
|
||||
$advancedSearch.unbind("click").bind("click", function(event) {
|
||||
var $target = $(event.target);
|
||||
var targetId = $target.attr("id");
|
||||
if(targetId == "advanced_search_close") {
|
||||
$(this).hide();
|
||||
return false;
|
||||
}
|
||||
else if(targetId == "adv_search_button") {
|
||||
var params = $("#middle_menu_pagination").data("params");
|
||||
if(params == null)
|
||||
return;
|
||||
lastSearchType = "advanced_search";
|
||||
$("#basic_search").find("#search_input").val("");
|
||||
listMidMenuItems2(params.commandString, params.getSearchParamsFn, params.jsonResponse1, params.jsonResponse2, params.toMidmenuFn, params.toRightPanelFn, params.getMidmenuIdFn, params.isMultipleSelectionInMidMenu, 1);
|
||||
$(this).hide();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
$advancedSearch.unbind("keypress").bind("keypress", function(event) {
|
||||
event.stopPropagation();
|
||||
if(event.keyCode == keycode_Enter) {
|
||||
event.preventDefault();
|
||||
$(this).find("#adv_search_button").click();
|
||||
}
|
||||
});
|
||||
|
||||
if(isAdmin())
|
||||
$advancedSearch.find("#adv_search_domain_li, #adv_search_account_li, #adv_search_pod_li").show();
|
||||
else
|
||||
$advancedSearch.find("#adv_search_domain_li, #adv_search_account_li, #adv_search_pod_li").hide();
|
||||
|
||||
var zoneSelect = $advancedSearch.find("#adv_search_zone");
|
||||
if(zoneSelect.length>0) { //if zone dropdown is found on Advanced Search dialog
|
||||
$.ajax({
|
||||
data: createURL("command=listZones&available=true"),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var zones = json.listzonesresponse.zone;
|
||||
zoneSelect.empty();
|
||||
zoneSelect.append("<option value=''></option>");
|
||||
if (zones != null && zones.length > 0) {
|
||||
for (var i = 0; i < zones.length; i++) {
|
||||
zoneSelect.append("<option value='" + zones[i].id + "'>" + fromdb(zones[i].name) + "</option>");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var podSelect = $advancedSearch.find("#adv_search_pod").empty();
|
||||
var podLabel = $advancedSearch.find("#adv_search_pod_label");
|
||||
if(podSelect.length>0 && $advancedSearch.find("#adv_search_pod_li").css("display")!="none") {
|
||||
zoneSelect.bind("change", function(event) {
|
||||
var zoneId = $(this).val();
|
||||
if (zoneId == null || zoneId.length == 0) {
|
||||
podLabel.css("color", "gray");
|
||||
podSelect.attr("disabled", "disabled");
|
||||
podSelect.empty();
|
||||
} else {
|
||||
podLabel.css("color", "black");
|
||||
podSelect.removeAttr("disabled");
|
||||
$.ajax({
|
||||
data: createURL("command=listPods&zoneId="+zoneId+""),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
var pods = json.listpodsresponse.pod;
|
||||
podSelect.empty();
|
||||
if (pods != null && pods.length > 0) {
|
||||
for (var i = 0; i < pods.length; i++) {
|
||||
podSelect.append("<option value='" + pods[i].id + "'>" + fromdb(pods[i].name) + "</option>");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
zoneSelect.change();
|
||||
}
|
||||
}
|
||||
|
||||
var domainSelect = $advancedSearch.find("#adv_search_domain");
|
||||
if(domainSelect.length>0 && $advancedSearch.find("#adv_search_domain_li").css("display")!="none") {
|
||||
var domainSelect = domainSelect.empty();
|
||||
$.ajax({
|
||||
data: createURL("command=listDomains&available=true"),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var domains = json.listdomainsresponse.domain;
|
||||
if (domains != null && domains.length > 0) {
|
||||
for (var i = 0; i < domains.length; i++) {
|
||||
domainSelect.append("<option value='" + domains[i].id + "'>" + fromdb(domains[i].name) + "</option>");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var vmSelect = $advancedSearch.find("#adv_search_vm");
|
||||
if(vmSelect.length>0) {
|
||||
vmSelect.empty();
|
||||
vmSelect.append("<option value=''></option>");
|
||||
$.ajax({
|
||||
data: createURL("command=listVirtualMachines"),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var items = json.listvirtualmachinesresponse.virtualmachine;
|
||||
if (items != null && items.length > 0) {
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
vmSelect.append("<option value='" + items[i].id + "'>" + fromdb(items[i].name) + "</option>");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$("#advanced_search_container").empty().append($advancedSearch.show());
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
//pagination
|
||||
$("#middle_menu_pagination").unbind("clik").bind("click", function(event) {
|
||||
var params = $(this).data("params");
|
||||
|
|
@ -220,10 +361,10 @@ $(document).ready(function() {
|
|||
var targetId = $target.attr("id");
|
||||
|
||||
if(targetId == "midmenu_prevbutton") {
|
||||
listMidMenuItems2(params.commandString, params.jsonResponse1, params.jsonResponse2, params.toMidmenuFn, params.toRightPanelFn, params.getMidmenuIdFn, params.isMultipleSelectionInMidMenu, (params.page-1));
|
||||
listMidMenuItems2(params.commandString, params.getSearchParamsFn, params.jsonResponse1, params.jsonResponse2, params.toMidmenuFn, params.toRightPanelFn, params.getMidmenuIdFn, params.isMultipleSelectionInMidMenu, (params.page-1));
|
||||
}
|
||||
else if(targetId == "midmenu_nextbutton") {
|
||||
listMidMenuItems2(params.commandString, params.jsonResponse1, params.jsonResponse2, params.toMidmenuFn, params.toRightPanelFn, params.getMidmenuIdFn, params.isMultipleSelectionInMidMenu, (params.page+1));
|
||||
listMidMenuItems2(params.commandString, params.getSearchParamsFn, params.jsonResponse1, params.jsonResponse2, params.toMidmenuFn, params.toRightPanelFn, params.getMidmenuIdFn, params.isMultipleSelectionInMidMenu, (params.page+1));
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,44 @@
|
|||
*
|
||||
*/
|
||||
|
||||
var $instanceSubMenuContainer;
|
||||
function vmGetSearchParams() {
|
||||
var moreCriteria = [];
|
||||
|
||||
var $advancedSearchPopup = $("#advanced_search_popup");
|
||||
if (lastSearchType == "advanced_search" && $advancedSearchPopup.length > 0) {
|
||||
var name = $advancedSearchPopup.find("#adv_search_name").val();
|
||||
if (name!=null && trim(name).length > 0)
|
||||
moreCriteria.push("&name="+todb(name));
|
||||
|
||||
var state = $advancedSearchPopup.find("#adv_search_state").val();
|
||||
if (state!=null && state.length > 0)
|
||||
moreCriteria.push("&state="+todb(state));
|
||||
|
||||
var zone = $advancedSearchPopup.find("#adv_search_zone").val();
|
||||
if (zone!=null && zone.length > 0)
|
||||
moreCriteria.push("&zoneid="+todb(zone));
|
||||
|
||||
if ($advancedSearchPopup.find("#adv_search_domain_li").css("display") != "none") {
|
||||
var domainId = $advancedSearchPopup.find("#adv_search_domain").val();
|
||||
if(domainId!=null && domainId.length > 0)
|
||||
moreCriteria.push("&domainid="+todb(domainId));
|
||||
}
|
||||
|
||||
if ($advancedSearchPopup.find("#adv_search_account_li").css("display") != "none") {
|
||||
var account = $advancedSearchPopup.find("#adv_search_account").val();
|
||||
if(account!=null && account.length > 0)
|
||||
moreCriteria.push("&account="+todb(account));
|
||||
}
|
||||
}
|
||||
else {
|
||||
var searchInput = $("#basic_search").find("#search_input").val();
|
||||
if (lastSearchType == "basic_search" && searchInput != null && searchInput.length > 0) {
|
||||
moreCriteria.push("&name="+todb(searchInput));
|
||||
}
|
||||
}
|
||||
|
||||
return moreCriteria.join("");
|
||||
}
|
||||
function instanceBuildSubMenu() {
|
||||
if (isAdmin() || isDomainAdmin()) {
|
||||
$("#leftmenu_instance_expandedbox").find("#leftmenu_instances_my_instances_container, #leftmenu_instances_all_instances_container, #leftmenu_instances_running_instances_container, #leftmenu_instances_stopped_instances_container, #leftmenu_instances_destroyed_instances_container ").show();
|
||||
|
|
@ -27,7 +64,8 @@ function instanceBuildSubMenu() {
|
|||
cache: false,
|
||||
data: createURL("command=listInstanceGroups"),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
success: function(json) {
|
||||
$("#leftmenu_instance_group_container").empty();
|
||||
var instancegroups = json.listinstancegroupsresponse.instancegroup;
|
||||
if(instancegroups!=null && instancegroups.length>0) {
|
||||
for(var i=0; i < instancegroups.length; i++) {
|
||||
|
|
@ -42,8 +80,8 @@ function instanceBuildSubMenu() {
|
|||
function instanceBuildSubMenu2(label, commandString) {
|
||||
var $newSubMenu = $("#leftmenu_secondindent_template").clone();
|
||||
$newSubMenu.find("#label").text(label);
|
||||
bindAndListMidMenuItems($newSubMenu, commandString, "listvirtualmachinesresponse", "virtualmachine", "jsp/instance.jsp", afterLoadInstanceJSP, vmToMidmenu, vmToRightPanel, getMidmenuId, true);
|
||||
$instanceSubMenuContainer.append($newSubMenu.show());
|
||||
bindAndListMidMenuItems($newSubMenu, commandString, vmGetSearchParams, "listvirtualmachinesresponse", "virtualmachine", "jsp/instance.jsp", afterLoadInstanceJSP, vmToMidmenu, vmToRightPanel, getMidmenuId, true);
|
||||
$("#leftmenu_instance_group_container").append($newSubMenu.show());
|
||||
}
|
||||
|
||||
var $doTemplateNo, $doTemplateCustom,$doTemplateExisting;
|
||||
|
|
@ -1327,9 +1365,9 @@ function vmJsonToDetailsTab(){
|
|||
|
||||
resetViewConsoleAction(jsonObj, $thisTab);
|
||||
setVmStateInRightPanel(jsonObj.state, $thisTab.find("#state"));
|
||||
$thisTab.find("#ipAddress").text(noNull(jsonObj.ipaddress));
|
||||
$thisTab.find("#ipAddress").text(fromdb(jsonObj.ipaddress));
|
||||
|
||||
$thisTab.find("#id").text(noNull(jsonObj.id));
|
||||
$thisTab.find("#id").text(fromdb(jsonObj.id));
|
||||
$thisTab.find("#zoneName").text(fromdb(jsonObj.zonename));
|
||||
|
||||
var vmName = getVmName(jsonObj.name, jsonObj.displayname);
|
||||
|
|
@ -1549,10 +1587,10 @@ var vmVolumeActionMap = {
|
|||
}
|
||||
|
||||
function vmVolumeJSONToTemplate(json, $template) {
|
||||
$template.attr("id","vm_volume_"+noNull(json.id));
|
||||
$template.attr("id","vm_volume_"+fromdb(json.id));
|
||||
$template.data("jsonObj", json);
|
||||
$template.find("#title").text(fromdb(json.name));
|
||||
$template.find("#id").text(noNull(json.id));
|
||||
$template.find("#id").text(fromdb(json.id));
|
||||
$template.find("#name").text(fromdb(json.name));
|
||||
if (json.storagetype == "shared")
|
||||
$template.find("#type").text(fromdb(json.type) + " (shared storage)");
|
||||
|
|
@ -1608,7 +1646,7 @@ function vmRouterJSONToTemplate(jsonObj, $template) {
|
|||
|
||||
resetViewConsoleAction(jsonObj, $template);
|
||||
setVmStateInRightPanel(fromdb(jsonObj.state), $template.find("#state"));
|
||||
$template.find("#ipAddress").text(noNull(jsonObj.publicip));
|
||||
$template.find("#ipAddress").text(fromdb(jsonObj.publicip));
|
||||
|
||||
$template.find("#zonename").text(fromdb(jsonObj.zonename));
|
||||
$template.find("#name").text(fromdb(jsonObj.name));
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
function ipGetSearchParams() {
|
||||
return "";
|
||||
}
|
||||
|
||||
function afterLoadIpJSP() {
|
||||
//***** switch between different tabs (begin) ********************************************************************
|
||||
var tabArray = [$("#tab_details"), $("#tab_port_forwarding"), $("#tab_load_balancer"), $("#tab_vpn")];
|
||||
|
|
@ -755,8 +759,8 @@ function ipJsonToDetailsTab() {
|
|||
}
|
||||
});
|
||||
|
||||
$thisTab.find("#grid_header_title").text(noNull(ipObj.ipaddress));
|
||||
$thisTab.find("#ipaddress").text(noNull(ipObj.ipaddress));
|
||||
$thisTab.find("#grid_header_title").text(fromdb(ipObj.ipaddress));
|
||||
$thisTab.find("#ipaddress").text(fromdb(ipObj.ipaddress));
|
||||
$thisTab.find("#zonename").text(fromdb(ipObj.zonename));
|
||||
$thisTab.find("#vlanname").text(fromdb(ipObj.vlanname));
|
||||
setBooleanReadField(ipObj.issourcenat, $thisTab.find("#source_nat"));
|
||||
|
|
@ -991,20 +995,20 @@ function ipClearPortForwardingTab() {
|
|||
}
|
||||
|
||||
function portForwardingJsonToTemplate(jsonObj, $template) {
|
||||
$template.attr("id", "portForwarding_" + noNull(jsonObj.id)).data("portForwardingId", noNull(jsonObj.id));
|
||||
$template.attr("id", "portForwarding_" + fromdb(jsonObj.id)).data("portForwardingId", fromdb(jsonObj.id));
|
||||
|
||||
$template.find("#row_container #public_port").text(noNull(jsonObj.publicport));
|
||||
$template.find("#row_container_edit #public_port").text(noNull(jsonObj.publicport));
|
||||
$template.find("#row_container #public_port").text(fromdb(jsonObj.publicport));
|
||||
$template.find("#row_container_edit #public_port").text(fromdb(jsonObj.publicport));
|
||||
|
||||
$template.find("#row_container #private_port").text(noNull(jsonObj.privateport));
|
||||
$template.find("#row_container_edit #private_port").val(noNull(jsonObj.privateport));
|
||||
$template.find("#row_container #private_port").text(fromdb(jsonObj.privateport));
|
||||
$template.find("#row_container_edit #private_port").val(fromdb(jsonObj.privateport));
|
||||
|
||||
$template.find("#row_container #protocol").text(fromdb(jsonObj.protocol));
|
||||
$template.find("#row_container_edit #protocol").text(fromdb(jsonObj.protocol));
|
||||
|
||||
var vmName = getVmName(jsonObj.virtualmachinename, jsonObj.virtualmachinedisplayname);
|
||||
$template.find("#row_container #vm_name").text(vmName);
|
||||
var virtualMachineId = noNull(jsonObj.virtualmachineid);
|
||||
var virtualMachineId = fromdb(jsonObj.virtualmachineid);
|
||||
|
||||
var $midmenuItem1 = $("#right_panel_content").data("$midmenuItem1");
|
||||
if($midmenuItem1 == null)
|
||||
|
|
@ -1012,8 +1016,8 @@ function portForwardingJsonToTemplate(jsonObj, $template) {
|
|||
var ipObj = $midmenuItem1.data("jsonObj");
|
||||
if(ipObj == null)
|
||||
return;
|
||||
var ipAddress = noNull(ipObj.ipaddress);
|
||||
var IpDomainid = noNull(ipObj.domainid);
|
||||
var ipAddress = fromdb(ipObj.ipaddress);
|
||||
var IpDomainid = fromdb(ipObj.domainid);
|
||||
var IpAccount = fromdb(ipObj.account);
|
||||
|
||||
var $vmSelect = $template.find("#row_container_edit #vm").empty();
|
||||
|
|
@ -1028,7 +1032,7 @@ function portForwardingJsonToTemplate(jsonObj, $template) {
|
|||
$spinningWheel.find("#description").text("Deleting....");
|
||||
$spinningWheel.show();
|
||||
$.ajax({
|
||||
data: createURL("command=deletePortForwardingRule&id="+noNull(jsonObj.id)),
|
||||
data: createURL("command=deletePortForwardingRule&id="+fromdb(jsonObj.id)),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
$template.slideUp("slow", function(){
|
||||
|
|
@ -1148,7 +1152,7 @@ function ipPopulateVMDropdown($vmSelect, IpDomainid, IpAccount) {
|
|||
var instances = json.listvirtualmachinesresponse.virtualmachine;
|
||||
if (instances != null && instances.length > 0) {
|
||||
for (var i = 0; i < instances.length; i++) {
|
||||
var html = $("<option value='" + noNull(instances[i].id) + "'>" + getVmName(instances[i].name, instances[i].displayname) + "</option>");
|
||||
var html = $("<option value='" + fromdb(instances[i].id) + "'>" + getVmName(instances[i].name, instances[i].displayname) + "</option>");
|
||||
$vmSelect.append(html);
|
||||
}
|
||||
}
|
||||
|
|
@ -1163,7 +1167,7 @@ function ipPopulateVMDropdown($vmSelect, IpDomainid, IpAccount) {
|
|||
var instances = json.listvirtualmachinesresponse.virtualmachine;
|
||||
if (instances != null && instances.length > 0) {
|
||||
for (var i = 0; i < instances.length; i++) {
|
||||
var html = $("<option value='" + noNull(instances[i].id) + "'>" + getVmName(instances[i].name, instances[i].displayname) + "</option>");
|
||||
var html = $("<option value='" + fromdb(instances[i].id) + "'>" + getVmName(instances[i].name, instances[i].displayname) + "</option>");
|
||||
$vmSelect.append(html);
|
||||
}
|
||||
}
|
||||
|
|
@ -1180,17 +1184,17 @@ function ipClearLoadBalancerTab() {
|
|||
}
|
||||
|
||||
function loadBalancerJsonToTemplate(jsonObj, $template) {
|
||||
var loadBalancerId = noNull(jsonObj.id);
|
||||
var loadBalancerId = fromdb(jsonObj.id);
|
||||
$template.attr("id", "loadBalancer_" + loadBalancerId).data("loadBalancerId", loadBalancerId);
|
||||
|
||||
$template.find("#row_container #name").text(fromdb(jsonObj.name));
|
||||
$template.find("#row_container_edit #name").val(fromdb(jsonObj.name));
|
||||
|
||||
$template.find("#row_container #public_port").text(noNull(jsonObj.publicport));
|
||||
$template.find("#row_container_edit #public_port").text(noNull(jsonObj.publicport));
|
||||
$template.find("#row_container #public_port").text(fromdb(jsonObj.publicport));
|
||||
$template.find("#row_container_edit #public_port").text(fromdb(jsonObj.publicport));
|
||||
|
||||
$template.find("#row_container #private_port").text(noNull(jsonObj.privateport));
|
||||
$template.find("#row_container_edit #private_port").val(noNull(jsonObj.privateport));
|
||||
$template.find("#row_container #private_port").text(fromdb(jsonObj.privateport));
|
||||
$template.find("#row_container_edit #private_port").val(fromdb(jsonObj.privateport));
|
||||
|
||||
$template.find("#row_container #algorithm").text(fromdb(jsonObj.algorithm));
|
||||
$template.find("#row_container_edit #algorithm").val(fromdb(jsonObj.algorithm));
|
||||
|
|
@ -1440,13 +1444,13 @@ function refreshCreateLoadBalancerRow() {
|
|||
|
||||
function lbVmObjToTemplate(obj, $template) {
|
||||
$template.find("#vm_name").text(obj.vmName);
|
||||
$template.find("#vm_private_ip").text(noNull(obj.vmPrivateIp));
|
||||
$template.find("#vm_private_ip").text(fromdb(obj.vmPrivateIp));
|
||||
|
||||
$template.find("#remove_link").bind("click", function(event){
|
||||
var $spinningWheel = $template.find("#spinning_wheel");
|
||||
$spinningWheel.show();
|
||||
$.ajax({
|
||||
data: createURL("command=removeFromLoadBalancerRule&id="+noNull(obj.loadBalancerId)+"&virtualmachineid="+noNull(obj.vmId)),
|
||||
data: createURL("command=removeFromLoadBalancerRule&id="+fromdb(obj.loadBalancerId)+"&virtualmachineid="+fromdb(obj.vmId)),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var lbJSON = json.removefromloadbalancerruleresponse;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,10 @@ var xsToolsIsoId = 200;
|
|||
var g_zoneIds = [];
|
||||
var g_zoneNames = [];
|
||||
|
||||
function isoGetSearchParams() {
|
||||
return "";
|
||||
}
|
||||
|
||||
function afterLoadIsoJSP() {
|
||||
var $detailsTab = $("#right_panel_content #tab_content_details");
|
||||
|
||||
|
|
@ -52,7 +56,7 @@ function afterLoadIsoJSP() {
|
|||
array1.push("&displayText="+todb(desc));
|
||||
|
||||
var url = trim(thisDialog.find("#add_iso_url").val());
|
||||
array1.push("&url="+encodeURIComponent(url));
|
||||
array1.push("&url="+todb(url));
|
||||
|
||||
var zoneId = thisDialog.find("#add_iso_zone").val();
|
||||
array1.push("&zoneId="+zoneId);
|
||||
|
|
@ -225,7 +229,7 @@ function isoJsonToDetailsTab() {
|
|||
|
||||
$thisTab.find("#grid_header_title").text(fromdb(jsonObj.name));
|
||||
|
||||
$thisTab.find("#id").text(noNull(jsonObj.id));
|
||||
$thisTab.find("#id").text(fromdb(jsonObj.id));
|
||||
$thisTab.find("#zonename").text(fromdb(jsonObj.zonename));
|
||||
|
||||
$thisTab.find("#name").text(fromdb(jsonObj.name));
|
||||
|
|
@ -234,7 +238,7 @@ function isoJsonToDetailsTab() {
|
|||
$thisTab.find("#displaytext").text(fromdb(jsonObj.displaytext));
|
||||
$thisTab.find("#displaytext_edit").val(fromdb(jsonObj.displaytext));
|
||||
$thisTab.find("#ostypename").text(fromdb(jsonObj.ostypename));
|
||||
$thisTab.find("#ostypename_edit").val(noNull(jsonObj.ostypeid));
|
||||
$thisTab.find("#ostypename_edit").val(fromdb(jsonObj.ostypeid));
|
||||
$thisTab.find("#account").text(fromdb(jsonObj.account));
|
||||
$thisTab.find("#domain").text(fromdb(jsonObj.domain));
|
||||
|
||||
|
|
|
|||
|
|
@ -474,20 +474,6 @@ function hideDetailsTabActionSpinningWheel(id, inProcessText) {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
function handleAsyncJobFailInMidMenu(errorMsg, $midmenuItem1) {
|
||||
$midmenuItem1.find("#content").removeClass("inaction");
|
||||
$midmenuItem1.find("#spinning_wheel").hide();
|
||||
$midmenuItem1.find("#info_icon").addClass("error").show();
|
||||
$midmenuItem1.find("#first_row").text("Adding failed");
|
||||
|
||||
if(errorMsg.length > 0)
|
||||
$midmenuItem1.find("#second_row").text(fromdb(errorMsg));
|
||||
else
|
||||
$midmenuItem1.find("#second_row").html(" ");
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
If Cancel button in dialog is clicked, action won't preceed.
|
||||
i.e. doActionToMidMenu() won't get called => highlight won't be removd from middle menu.
|
||||
|
|
@ -568,6 +554,9 @@ function clearMiddleMenu() {
|
|||
$("#midmenu_container").empty();
|
||||
$("#midmenu_action_link").hide();
|
||||
clearAddButtonsOnTop();
|
||||
lastSearchType = null;
|
||||
$("#basic_search").find("#search_input").val("");
|
||||
$("#advanced_search_container").empty();
|
||||
$("#midmenu_prevbutton, #midmenu_nextbutton").hide();
|
||||
$("#middle_menu_pagination").data("params", null);
|
||||
}
|
||||
|
|
@ -926,9 +915,11 @@ function getMidmenuId(jsonObj) {
|
|||
return "midmenuItem_" + jsonObj.id;
|
||||
}
|
||||
|
||||
function listMidMenuItems2(commandString, jsonResponse1, jsonResponse2, toMidmenuFn, toRightPanelFn, getMidmenuIdFn, isMultipleSelectionInMidMenu, page) {
|
||||
var lastSearchType;
|
||||
function listMidMenuItems2(commandString, getSearchParamsFn, jsonResponse1, jsonResponse2, toMidmenuFn, toRightPanelFn, getMidmenuIdFn, isMultipleSelectionInMidMenu, page) {
|
||||
var params = {
|
||||
"commandString": commandString,
|
||||
"getSearchParamsFn": getSearchParamsFn,
|
||||
"jsonResponse1": jsonResponse1,
|
||||
"jsonResponse2": jsonResponse2,
|
||||
"toMidmenuFn": toMidmenuFn,
|
||||
|
|
@ -949,7 +940,7 @@ function listMidMenuItems2(commandString, jsonResponse1, jsonResponse2, toMidmen
|
|||
var count = 0;
|
||||
$.ajax({
|
||||
cache: false,
|
||||
data: createURL("command="+commandString+"&pagesize="+midmenuItemCount+"&page="+page),
|
||||
data: createURL("command="+commandString+getSearchParamsFn()+"&pagesize="+midmenuItemCount+"&page="+page),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
|
|
@ -986,7 +977,7 @@ function listMidMenuItems2(commandString, jsonResponse1, jsonResponse2, toMidmen
|
|||
return count;
|
||||
}
|
||||
|
||||
function listMidMenuItems(commandString, jsonResponse1, jsonResponse2, rightPanelJSP, afterLoadRightPanelJSPFn, toMidmenuFn, toRightPanelFn, getMidmenuIdFn, isMultipleSelectionInMidMenu, leftmenuId) {
|
||||
function listMidMenuItems(commandString, getSearchParamsFn, jsonResponse1, jsonResponse2, rightPanelJSP, afterLoadRightPanelJSPFn, toMidmenuFn, toRightPanelFn, getMidmenuIdFn, isMultipleSelectionInMidMenu, leftmenuId) {
|
||||
clearMiddleMenu();
|
||||
showMiddleMenu();
|
||||
$("#midmenu_container").hide();
|
||||
|
|
@ -1008,15 +999,15 @@ function listMidMenuItems(commandString, jsonResponse1, jsonResponse2, rightPane
|
|||
});
|
||||
removeDialogs();
|
||||
afterLoadRightPanelJSPFn();
|
||||
listMidMenuItems2(commandString, jsonResponse1, jsonResponse2, toMidmenuFn, toRightPanelFn, getMidmenuIdFn, isMultipleSelectionInMidMenu, 1);
|
||||
listMidMenuItems2(commandString, getSearchParamsFn, jsonResponse1, jsonResponse2, toMidmenuFn, toRightPanelFn, getMidmenuIdFn, isMultipleSelectionInMidMenu, 1);
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
function bindAndListMidMenuItems($leftmenu, commandString, jsonResponse1, jsonResponse2, rightPanelJSP, afterLoadRightPanelJSPFn, toMidmenuFn, toRightPanelFn, getMidmenuIdFn, isMultipleSelectionInMidMenu) {
|
||||
function bindAndListMidMenuItems($leftmenu, commandString, getSearchParamsFn, jsonResponse1, jsonResponse2, rightPanelJSP, afterLoadRightPanelJSPFn, toMidmenuFn, toRightPanelFn, getMidmenuIdFn, isMultipleSelectionInMidMenu) {
|
||||
$leftmenu.bind("click", function(event) {
|
||||
selectLeftSubMenu($(this));
|
||||
listMidMenuItems(commandString, jsonResponse1, jsonResponse2, rightPanelJSP, afterLoadRightPanelJSPFn, toMidmenuFn, toRightPanelFn, getMidmenuIdFn, isMultipleSelectionInMidMenu, $(this).attr("id"));
|
||||
listMidMenuItems(commandString, getSearchParamsFn, jsonResponse1, jsonResponse2, rightPanelJSP, afterLoadRightPanelJSPFn, toMidmenuFn, toRightPanelFn, getMidmenuIdFn, isMultipleSelectionInMidMenu, $(this).attr("id"));
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
|
@ -1342,215 +1333,6 @@ function convertMilliseconds(string) {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
function drawGrid(items, submenuContent, template, fnJSONToTemplate) {
|
||||
var grid = submenuContent.find("#grid_content").empty();
|
||||
if (items != null && items.length > 0) {
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
var newTemplate = template.clone(true);
|
||||
fnJSONToTemplate(items[i], newTemplate);
|
||||
grid.append(newTemplate.show());
|
||||
}
|
||||
setGridRowsTotal(submenuContent.find("#grid_rows_total"), items.length);
|
||||
if(items.length < pageSize)
|
||||
submenuContent.find("#nextPage_div").hide();
|
||||
else
|
||||
submenuContent.find("#nextPage_div").show();
|
||||
} else {
|
||||
setGridRowsTotal(submenuContent.find("#grid_rows_total"), null);
|
||||
submenuContent.find("#nextPage_div").hide();
|
||||
}
|
||||
}
|
||||
|
||||
//listItems() function takes care of loading image, pagination
|
||||
var items = [];
|
||||
function listItems(submenuContent, commandString, jsonResponse1, jsonResponse2, template, fnJSONToTemplate ) {
|
||||
if(currentPage==1)
|
||||
submenuContent.find("#prevPage_div").hide();
|
||||
else
|
||||
submenuContent.find("#prevPage_div").show();
|
||||
|
||||
submenuContent.find("#loading_gridtable").show();
|
||||
submenuContent.find("#pagination_panel").hide();
|
||||
|
||||
index = 0;
|
||||
$.ajax({
|
||||
data: createURL(commandString),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
//IF jsonResponse1=="listaccountsresponse", jsonResponse2=="account", THEN json[jsonResponse1][jsonResponse2] == json.listaccountsresponse.account
|
||||
items = json[jsonResponse1][jsonResponse2];
|
||||
drawGrid(items, submenuContent, template, fnJSONToTemplate);
|
||||
submenuContent.find("#loading_gridtable").hide();
|
||||
submenuContent.find("#pagination_panel").show();
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
submenuContent.find("#loading_gridtable").hide();
|
||||
handleError(XMLHttpResponse, function() {
|
||||
if(XMLHttpResponse.status == ERROR_VMOPS_ACCOUNT_ERROR) {
|
||||
submenuContent.find("#grid_content").empty();
|
||||
setGridRowsTotal(submenuContent.find("#grid_rows_total"), null);
|
||||
submenuContent.find("#nextPage_div").hide();
|
||||
}
|
||||
submenuContent.find("#loading_gridtable").hide();
|
||||
submenuContent.find("#pagination_panel").show();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//event binder
|
||||
var currentPage = 1;
|
||||
var pageSize = 50; //consistent with server-side
|
||||
function submenuContentEventBinder(submenuContent, listFunction) {
|
||||
submenuContent.find("#nextPage").bind("click", function(event){
|
||||
event.preventDefault();
|
||||
currentPage++;
|
||||
listFunction();
|
||||
});
|
||||
|
||||
submenuContent.find("#prevPage").bind("click", function(event){
|
||||
event.preventDefault();
|
||||
currentPage--;
|
||||
listFunction();
|
||||
});
|
||||
|
||||
submenuContent.find("#refresh").bind("click", function(event){
|
||||
event.preventDefault();
|
||||
currentPage=1;
|
||||
listFunction();
|
||||
});
|
||||
|
||||
submenuContent.find("#search_button").bind("click", function(event) {
|
||||
event.preventDefault();
|
||||
currentPage = 1;
|
||||
listFunction();
|
||||
});
|
||||
|
||||
submenuContent.find("#adv_search_button").bind("click", function(event) {
|
||||
event.preventDefault();
|
||||
currentPage = 1;
|
||||
listFunction();
|
||||
submenuContent.find("#search_button").data("advanced", false);
|
||||
submenuContent.find("#advanced_search").hide();
|
||||
});
|
||||
|
||||
submenuContent.find("#search_input").bind("keypress", function(event) {
|
||||
if(event.keyCode == keycode_Enter) {
|
||||
event.preventDefault();
|
||||
submenuContent.find("#search_button").click();
|
||||
}
|
||||
});
|
||||
|
||||
submenuContent.find("#advanced_search").bind("keypress", function(event) {
|
||||
if(event.keyCode == keycode_Enter) {
|
||||
event.preventDefault();
|
||||
submenuContent.find("#adv_search_button").click();
|
||||
}
|
||||
});
|
||||
|
||||
submenuContent.find("#advanced_search_close").bind("click", function(event) {
|
||||
event.preventDefault();
|
||||
submenuContent.find("#search_button").data("advanced", false);
|
||||
submenuContent.find("#advanced_search").hide();
|
||||
});
|
||||
|
||||
submenuContent.find("#advanced_search_link").bind("click", function(event) {
|
||||
event.preventDefault();
|
||||
submenuContent.find("#search_button").data("advanced", true);
|
||||
submenuContent.find("#advanced_search").show();
|
||||
});
|
||||
|
||||
var zoneSelect = submenuContent.find("#advanced_search #adv_search_zone");
|
||||
if(zoneSelect.length>0) { //if zone dropdown is found on Advanced Search dialog
|
||||
$.ajax({
|
||||
data: createURL("command=listZones&available=true&response=json"),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var zones = json.listzonesresponse.zone;
|
||||
zoneSelect.empty();
|
||||
zoneSelect.append("<option value=''></option>");
|
||||
if (zones != null && zones.length > 0) {
|
||||
for (var i = 0; i < zones.length; i++) {
|
||||
zoneSelect.append("<option value='" + zones[i].id + "'>" + fromdb(zones[i].name) + "</option>");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var podSelect = submenuContent.find("#advanced_search #adv_search_pod").empty();
|
||||
var podLabel = submenuContent.find("#advanced_search #adv_search_pod_label");
|
||||
if(podSelect.length>0 && isAdmin()) { //if pod dropdown is found on Advanced Search dialog and if its role is admin
|
||||
zoneSelect.bind("change", function(event) {
|
||||
var zoneId = $(this).val();
|
||||
if (zoneId == null || zoneId.length == 0) {
|
||||
podLabel.css("color", "gray");
|
||||
podSelect.attr("disabled", "disabled");
|
||||
podSelect.empty();
|
||||
} else {
|
||||
podLabel.css("color", "black");
|
||||
podSelect.removeAttr("disabled");
|
||||
$.ajax({
|
||||
data: createURL("command=listPods&zoneId="+zoneId+"&response=json"),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
var pods = json.listpodsresponse.pod;
|
||||
podSelect.empty();
|
||||
if (pods != null && pods.length > 0) {
|
||||
for (var i = 0; i < pods.length; i++) {
|
||||
podSelect.append("<option value='" + pods[i].id + "'>" + fromdb(pods[i].name) + "</option>");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
zoneSelect.change();
|
||||
}
|
||||
}
|
||||
|
||||
var domainSelect = submenuContent.find("#advanced_search #adv_search_domain");
|
||||
if(domainSelect.length>0 && isAdmin()) {
|
||||
var domainSelect = domainSelect.empty();
|
||||
$.ajax({
|
||||
data: createURL("command=listDomains&available=true&response=json"),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var domains = json.listdomainsresponse.domain;
|
||||
if (domains != null && domains.length > 0) {
|
||||
for (var i = 0; i < domains.length; i++) {
|
||||
domainSelect.append("<option value='" + domains[i].id + "'>" + fromdb(domains[i].name) + "</option>");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var vmSelect = submenuContent.find("#advanced_search").find("#adv_search_vm");
|
||||
if(vmSelect.length>0) {
|
||||
vmSelect.empty();
|
||||
vmSelect.append("<option value=''></option>");
|
||||
$.ajax({
|
||||
data: createURL("command=listVirtualMachines&response=json"),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var items = json.listvirtualmachinesresponse.virtualmachine;
|
||||
if (items != null && items.length > 0) {
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
vmSelect.append("<option value='" + items[i].id + "'>" + fromdb(items[i].name) + "</option>");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Validation functions
|
||||
function showError(isValid, field, errMsgField, errMsg) {
|
||||
if(isValid) {
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ function podJsonToDetailsTab() {
|
|||
$thisTab.find("#tab_container").hide();
|
||||
$thisTab.find("#tab_spinning_wheel").show();
|
||||
|
||||
$thisTab.find("#id").text(noNull(jsonObj.id));
|
||||
$thisTab.find("#id").text(fromdb(jsonObj.id));
|
||||
$thisTab.find("#grid_header_title").text(fromdb(jsonObj.name));
|
||||
|
||||
$thisTab.find("#name").text(fromdb(jsonObj.name));
|
||||
|
|
@ -90,7 +90,7 @@ function podJsonToDetailsTab() {
|
|||
// hide network tab upon zone vlan
|
||||
var networkType;
|
||||
$.ajax({
|
||||
data: createURL("command=listZones&id="+noNull(jsonObj.zoneid)),
|
||||
data: createURL("command=listZones&id="+fromdb(jsonObj.zoneid)),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
|
|
@ -143,7 +143,7 @@ function podJsonToNetworkTab() {
|
|||
$thisTab.find("#tab_spinning_wheel").show();
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=listVlanIpRanges&zoneid="+noNull(jsonObj.zoneid)+"&podid="+noNull(jsonObj.id)),
|
||||
data: createURL("command=listVlanIpRanges&zoneid="+fromdb(jsonObj.zoneid)+"&podid="+fromdb(jsonObj.id)),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var items = json.listvlaniprangesresponse.vlaniprange;
|
||||
|
|
@ -164,12 +164,12 @@ function podJsonToNetworkTab() {
|
|||
|
||||
function podNetworkJsonToTemplate(jsonObj, template) {
|
||||
template.data("jsonObj", jsonObj);
|
||||
template.attr("id", "pod_VLAN_"+noNull(jsonObj.id)).data("podVLANId", noNull(jsonObj.id));
|
||||
template.attr("id", "pod_VLAN_"+fromdb(jsonObj.id)).data("podVLANId", fromdb(jsonObj.id));
|
||||
template.find("#grid_header_title").text(fromdb(jsonObj.description));
|
||||
template.find("#id").text(noNull(jsonObj.id));
|
||||
template.find("#id").text(fromdb(jsonObj.id));
|
||||
template.find("#iprange").text(fromdb(jsonObj.description));
|
||||
template.find("#netmask").text(noNull(jsonObj.netmask));
|
||||
template.find("#gateway").text(noNull(jsonObj.gateway));
|
||||
template.find("#netmask").text(fromdb(jsonObj.netmask));
|
||||
template.find("#gateway").text(fromdb(jsonObj.gateway));
|
||||
template.find("#podname").text(fromdb(jsonObj.podname));
|
||||
|
||||
var $actionLink = template.find("#network_action_link");
|
||||
|
|
@ -247,9 +247,9 @@ function refreshClsuterFieldInAddHostDialog(dialogAddHost, podId, clusterId) {
|
|||
if(items != null && items.length > 0) {
|
||||
for(var i=0; i<items.length; i++) {
|
||||
if(clusterId != null && items[i].id == clusterId)
|
||||
clusterSelect.append("<option value='" + noNull(items[i].id) + "' selected>" + fromdb(items[i].name) + "</option>");
|
||||
clusterSelect.append("<option value='" + fromdb(items[i].id) + "' selected>" + fromdb(items[i].name) + "</option>");
|
||||
else
|
||||
clusterSelect.append("<option value='" + noNull(items[i].id) + "'>" + fromdb(items[i].name) + "</option>");
|
||||
clusterSelect.append("<option value='" + fromdb(items[i].id) + "'>" + fromdb(items[i].name) + "</option>");
|
||||
}
|
||||
dialogAddHost.find("input[value=existing_cluster_radio]").attr("checked", true);
|
||||
}
|
||||
|
|
@ -328,10 +328,10 @@ function initAddHostButton($button, currentPageInRightPanel, $leftmenuItem1) {
|
|||
array1.push("&podId="+podId);
|
||||
|
||||
var username = trim($thisDialog.find("#host_username").val());
|
||||
array1.push("&username="+encodeURIComponent(username));
|
||||
array1.push("&username="+todb(username));
|
||||
|
||||
var password = trim($thisDialog.find("#host_password").val());
|
||||
array1.push("&password="+encodeURIComponent(password));
|
||||
array1.push("&password="+todb(password));
|
||||
|
||||
var newClusterName, existingClusterId;
|
||||
if(clusterRadio == "new_cluster_radio") {
|
||||
|
|
@ -352,7 +352,7 @@ function initAddHostButton($button, currentPageInRightPanel, $leftmenuItem1) {
|
|||
url = "http://" + todb(hostname);
|
||||
else
|
||||
url = hostname;
|
||||
array1.push("&url="+encodeURIComponent(url));
|
||||
array1.push("&url="+todb(url));
|
||||
|
||||
//var $midmenuItem1 = beforeAddingMidMenuItem() ;
|
||||
|
||||
|
|
@ -521,11 +521,11 @@ function initAddPrimaryStorageButton($button, currentPageInRightPanel, $leftmenu
|
|||
var lun = trim($thisDialog.find("#add_pool_lun").val());
|
||||
url = iscsiURL(server, iqn, lun);
|
||||
}
|
||||
array1.push("&url="+encodeURIComponent(url));
|
||||
array1.push("&url="+todb(url));
|
||||
|
||||
var tags = trim($thisDialog.find("#add_pool_tags").val());
|
||||
if(tags != null && tags.length > 0)
|
||||
array1.push("&tags="+encodeURIComponent(tags));
|
||||
array1.push("&tags="+todb(tags));
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=createStoragePool" + array1.join("")),
|
||||
|
|
@ -615,11 +615,11 @@ function initAddPodVLANButton($button, $leftmenuItem1) {
|
|||
array1.push("&zoneid=" + zoneId);
|
||||
array1.push("&podId=" + podId);
|
||||
array1.push("&forVirtualNetwork=false"); //direct VLAN
|
||||
array1.push("&gateway="+encodeURIComponent(guestgateway));
|
||||
array1.push("&netmask="+encodeURIComponent(netmask));
|
||||
array1.push("&startip="+encodeURIComponent(startip));
|
||||
array1.push("&gateway="+todb(guestgateway));
|
||||
array1.push("&netmask="+todb(netmask));
|
||||
array1.push("&startip="+todb(startip));
|
||||
if(endip != null && endip.length > 0)
|
||||
array1.push("&endip="+encodeURIComponent(endip));
|
||||
array1.push("&endip="+todb(endip));
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=createVlanIpRange" + array1.join("")),
|
||||
|
|
@ -751,17 +751,17 @@ function doEditPod2($actionLink, $detailsTab, $midmenuItem1, $readonlyFields, $e
|
|||
if(newName != oldName)
|
||||
array1.push("&name="+todb(newName));
|
||||
if(newCidr != oldCidr)
|
||||
array1.push("&cidr="+encodeURIComponent(newCidr));
|
||||
array1.push("&cidr="+todb(newCidr));
|
||||
if(newStartip != oldStartip)
|
||||
array1.push("&startIp="+encodeURIComponent(newStartip));
|
||||
array1.push("&startIp="+todb(newStartip));
|
||||
if(newEndip != oldEndip && newEndip != null && newEndip.length > 0) {
|
||||
if(newStartip == oldStartip) {
|
||||
array1.push("&startIp="+encodeURIComponent(newStartip)); //startIp needs to be passed to updatePod API when endIp is passed to updatePod API.
|
||||
array1.push("&startIp="+todb(newStartip)); //startIp needs to be passed to updatePod API when endIp is passed to updatePod API.
|
||||
}
|
||||
array1.push("&endIp="+encodeURIComponent(newEndip));
|
||||
array1.push("&endIp="+todb(newEndip));
|
||||
}
|
||||
if(newGateway != oldGateway && newGateway != null && newGateway.length > 0)
|
||||
array1.push("&gateway="+encodeURIComponent(newGateway));
|
||||
array1.push("&gateway="+todb(newGateway));
|
||||
|
||||
if(array1.length > 0) {
|
||||
$.ajax({
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ function primarystorageJsonToDetailsTab() {
|
|||
$thisTab.find("#tab_container").hide();
|
||||
$thisTab.find("#tab_spinning_wheel").show();
|
||||
|
||||
$thisTab.find("#id").text(noNull(jsonObj.id));
|
||||
$thisTab.find("#id").text(fromdb(jsonObj.id));
|
||||
$thisTab.find("#grid_header_title").text(fromdb(jsonObj.name));
|
||||
$thisTab.find("#name").text(fromdb(jsonObj.name));
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ function primarystorageJsonToDetailsTab() {
|
|||
if (jsonObj.type == 'NetworkFilesystem')
|
||||
storageType = "NFS Share";
|
||||
$thisTab.find("#type").text(fromdb(storageType));
|
||||
$thisTab.find("#ipaddress").text(noNull(jsonObj.ipaddress));
|
||||
$thisTab.find("#ipaddress").text(fromdb(jsonObj.ipaddress));
|
||||
$thisTab.find("#path").text(fromdb(jsonObj.path));
|
||||
$thisTab.find("#disksizetotal").text(convertBytes(jsonObj.disksizetotal));
|
||||
$thisTab.find("#disksizeallocated").text(convertBytes(jsonObj.disksizeallocated));
|
||||
|
|
@ -240,7 +240,7 @@ function doEditPrimaryStorage2($actionLink, $detailsTab, $midmenuItem1, $readonl
|
|||
var array1 = [];
|
||||
|
||||
var tags = $detailsTab.find("#tags_edit").val();
|
||||
array1.push("&tags="+encodeURIComponent(tags));
|
||||
array1.push("&tags="+todb(tags));
|
||||
|
||||
if(array1.length == 0)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -320,11 +320,11 @@ function initAddPodShortcut() {
|
|||
var array1 = [];
|
||||
array1.push("&zoneId="+zoneId);
|
||||
array1.push("&name="+todb(name));
|
||||
array1.push("&cidr="+encodeURIComponent(cidr));
|
||||
array1.push("&startIp="+encodeURIComponent(startip));
|
||||
array1.push("&cidr="+todb(cidr));
|
||||
array1.push("&startIp="+todb(startip));
|
||||
if (endip != null && endip.length > 0)
|
||||
array1.push("&endIp="+encodeURIComponent(endip));
|
||||
array1.push("&gateway="+encodeURIComponent(gateway));
|
||||
array1.push("&endIp="+todb(endip));
|
||||
array1.push("&gateway="+todb(gateway));
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=createPod"+array1.join("")),
|
||||
|
|
@ -458,10 +458,10 @@ function initAddHostShortcut() {
|
|||
array1.push("&podid="+podId);
|
||||
|
||||
var username = trim($thisDialog.find("#host_username").val());
|
||||
array1.push("&username="+encodeURIComponent(username));
|
||||
array1.push("&username="+todb(username));
|
||||
|
||||
var password = trim($thisDialog.find("#host_password").val());
|
||||
array1.push("&password="+encodeURIComponent(password));
|
||||
array1.push("&password="+todb(password));
|
||||
|
||||
var newClusterName, existingClusterId;
|
||||
if(clusterRadio == "new_cluster_radio") {
|
||||
|
|
@ -482,7 +482,7 @@ function initAddHostShortcut() {
|
|||
url = "http://" + todb(hostname);
|
||||
else
|
||||
url = hostname;
|
||||
array1.push("&url="+encodeURIComponent(url));
|
||||
array1.push("&url="+todb(url));
|
||||
|
||||
//var $midmenuItem1 = beforeAddingMidMenuItem() ;
|
||||
|
||||
|
|
@ -751,32 +751,32 @@ function addZoneWizardSubmit($thisWizard) {
|
|||
moreCriteria.push("&name="+todb(name));
|
||||
|
||||
var dns1 = trim($thisWizard.find("#add_zone_dns1").val());
|
||||
moreCriteria.push("&dns1="+encodeURIComponent(dns1));
|
||||
moreCriteria.push("&dns1="+todb(dns1));
|
||||
|
||||
var dns2 = trim($thisWizard.find("#add_zone_dns2").val());
|
||||
if (dns2 != null && dns2.length > 0)
|
||||
moreCriteria.push("&dns2="+encodeURIComponent(dns2));
|
||||
moreCriteria.push("&dns2="+todb(dns2));
|
||||
|
||||
var internaldns1 = trim($thisWizard.find("#add_zone_internaldns1").val());
|
||||
moreCriteria.push("&internaldns1="+encodeURIComponent(internaldns1));
|
||||
moreCriteria.push("&internaldns1="+todb(internaldns1));
|
||||
|
||||
var internaldns2 = trim($thisWizard.find("#add_zone_internaldns2").val());
|
||||
if (internaldns2 != null && internaldns2.length > 0)
|
||||
moreCriteria.push("&internaldns2="+encodeURIComponent(internaldns2));
|
||||
moreCriteria.push("&internaldns2="+todb(internaldns2));
|
||||
|
||||
if($thisWizard.find("#step2").find("#add_zone_vlan_container").css("display") != "none") {
|
||||
var vlanStart = $thisWizard.find("#add_zone_startvlan").val();
|
||||
if(vlanStart != null && vlanStart.length > 0) {
|
||||
var vlanEnd = $thisWizard.find("#add_zone_endvlan").val();
|
||||
if (vlanEnd != null && vlanEnd.length > 0)
|
||||
moreCriteria.push("&vlan=" + encodeURIComponent(vlanStart + "-" + vlanEnd));
|
||||
moreCriteria.push("&vlan=" + todb(vlanStart + "-" + vlanEnd));
|
||||
else
|
||||
moreCriteria.push("&vlan=" + encodeURIComponent(vlanStart));
|
||||
moreCriteria.push("&vlan=" + todb(vlanStart));
|
||||
}
|
||||
}
|
||||
|
||||
var guestcidraddress = trim($thisWizard.find("#add_zone_guestcidraddress").val());
|
||||
moreCriteria.push("&guestcidraddress="+encodeURIComponent(guestcidraddress));
|
||||
moreCriteria.push("&guestcidraddress="+todb(guestcidraddress));
|
||||
|
||||
if($thisWizard.find("#domain_dropdown_container").css("display") != "none") {
|
||||
var domainId = trim($thisWizard.find("#domain_dropdown").val());
|
||||
|
|
@ -825,11 +825,11 @@ function addZoneWizardSubmit($thisWizard) {
|
|||
var array1 = [];
|
||||
array1.push("&zoneId="+zoneId);
|
||||
array1.push("&name="+todb(name));
|
||||
array1.push("&cidr="+encodeURIComponent(cidr));
|
||||
array1.push("&startIp="+encodeURIComponent(startip));
|
||||
array1.push("&cidr="+todb(cidr));
|
||||
array1.push("&startIp="+todb(startip));
|
||||
if (endip != null && endip.length > 0)
|
||||
array1.push("&endIp="+encodeURIComponent(endip));
|
||||
array1.push("&gateway="+encodeURIComponent(gateway));
|
||||
array1.push("&endIp="+todb(endip));
|
||||
array1.push("&gateway="+todb(gateway));
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=createPod"+array1.join("")),
|
||||
|
|
@ -885,11 +885,11 @@ function addZoneWizardSubmit($thisWizard) {
|
|||
array1.push("&zoneid=" + zoneId);
|
||||
array1.push("&podId=" + podId);
|
||||
array1.push("&forVirtualNetwork=false"); //direct VLAN
|
||||
array1.push("&gateway="+encodeURIComponent(guestgateway));
|
||||
array1.push("&netmask="+encodeURIComponent(netmask));
|
||||
array1.push("&startip="+encodeURIComponent(startip));
|
||||
array1.push("&gateway="+todb(guestgateway));
|
||||
array1.push("&netmask="+todb(netmask));
|
||||
array1.push("&startip="+todb(startip));
|
||||
if(endip != null && endip.length > 0)
|
||||
array1.push("&endip="+encodeURIComponent(endip));
|
||||
array1.push("&endip="+todb(endip));
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=createVlanIpRange" + array1.join("")),
|
||||
|
|
@ -936,7 +936,7 @@ function initUpdateConsoleCertButton($midMenuAddLink2) {
|
|||
var cert = trim($thisDialog.find("#update_cert").val());
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=uploadCustomCertificate&certificate="+encodeURIComponent(cert)),
|
||||
data: createURL("command=uploadCustomCertificate&certificate="+todb(cert)),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var jobId = json.uploadcustomcertificateresponse.jobid;
|
||||
|
|
@ -1123,7 +1123,7 @@ function initAddPrimaryStorageShortcut($midmenuAddLink2, currentPageInRightPanel
|
|||
var lun = trim($thisDialog.find("#add_pool_lun").val());
|
||||
url = iscsiURL(server, iqn, lun);
|
||||
}
|
||||
array1.push("&url="+encodeURIComponent(url));
|
||||
array1.push("&url="+todb(url));
|
||||
|
||||
var tags = trim($thisDialog.find("#add_pool_tags").val());
|
||||
if(tags != null && tags.length > 0)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
function routerGetSearchParams() {
|
||||
return "";
|
||||
}
|
||||
|
||||
function afterLoadRouterJSP() {
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
function serviceOfferingGetSearchParams() {
|
||||
return "";
|
||||
}
|
||||
|
||||
function afterLoadServiceOfferingJSP() {
|
||||
var $detailsTab = $("#right_panel_content #tab_content_details");
|
||||
|
||||
|
|
@ -84,7 +88,7 @@ function afterLoadServiceOfferingJSP() {
|
|||
|
||||
var tags = trim(thisDialog.find("#add_service_tags").val());
|
||||
if(tags != null && tags.length > 0)
|
||||
array1.push("&tags="+encodeURIComponent(tags));
|
||||
array1.push("&tags="+todb(tags));
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=createServiceOffering"+array1.join("")+"&response=json"),
|
||||
|
|
@ -159,7 +163,7 @@ function doEditServiceOffering2($actionLink, $detailsTab, $midmenuItem1, $readon
|
|||
*/
|
||||
|
||||
var tags = $detailsTab.find("#tags_edit").val();
|
||||
array1.push("&tags="+encodeURIComponent(tags));
|
||||
array1.push("&tags="+todb(tags));
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=updateServiceOffering&id="+id+array1.join("")),
|
||||
|
|
@ -221,7 +225,7 @@ function serviceOfferingJsonToDetailsTab() {
|
|||
}
|
||||
});
|
||||
|
||||
$thisTab.find("#id").text(noNull(jsonObj.id));
|
||||
$thisTab.find("#id").text(fromdb(jsonObj.id));
|
||||
|
||||
$thisTab.find("#grid_header_title").text(fromdb(jsonObj.name));
|
||||
$thisTab.find("#name").text(fromdb(jsonObj.name));
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
function snapshotGetSearchParams() {
|
||||
return "";
|
||||
}
|
||||
|
||||
function afterLoadSnapshotJSP() {
|
||||
//initialize dialog
|
||||
initDialog("dialog_add_volume_from_snapshot");
|
||||
|
|
@ -85,7 +89,7 @@ function snapshotJsonToDetailsTab() {
|
|||
}
|
||||
});
|
||||
|
||||
$thisTab.find("#id").text(noNull(jsonObj.id));
|
||||
$thisTab.find("#id").text(fromdb(jsonObj.id));
|
||||
$thisTab.find("#name").text(fromdb(jsonObj.name));
|
||||
$thisTab.find("#volume_name").text(fromdb(jsonObj.volumename));
|
||||
$thisTab.find("#interval_type").text(fromdb(jsonObj.intervaltype));
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
function systemVmGetSearchParams() {
|
||||
return "";
|
||||
}
|
||||
|
||||
function afterLoadSystemVmJSP($midmenuItem1) {
|
||||
//hideMiddleMenu();
|
||||
//systemvmToRightPanel($midmenuItem1);
|
||||
|
|
@ -61,7 +65,7 @@ function systemvmJsonToDetailsTab() {
|
|||
|
||||
resetViewConsoleAction(jsonObj, $thisTab);
|
||||
setVmStateInRightPanel(fromdb(jsonObj.state), $thisTab.find("#state"));
|
||||
$thisTab.find("#ipAddress").text(noNull(jsonObj.publicip));
|
||||
$thisTab.find("#ipAddress").text(fromdb(jsonObj.publicip));
|
||||
|
||||
$thisTab.find("#state").text(fromdb(jsonObj.state));
|
||||
$thisTab.find("#systemvmtype").text(toSystemVMTypeText(jsonObj.systemvmtype));
|
||||
|
|
|
|||
|
|
@ -21,6 +21,10 @@
|
|||
var g_zoneIds = [];
|
||||
var g_zoneNames = [];
|
||||
|
||||
function templateGetSearchParams() {
|
||||
return "";
|
||||
}
|
||||
|
||||
function afterLoadTemplateJSP() {
|
||||
var $detailsTab = $("#right_panel_content #tab_content_details");
|
||||
|
||||
|
|
@ -84,7 +88,7 @@ function afterLoadTemplateJSP() {
|
|||
var $midmenuItem1 = beforeAddingMidMenuItem() ;
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=registerTemplate&name="+todb(name)+"&displayText="+todb(desc)+"&url="+encodeURIComponent(url)+"&zoneid="+zoneId+"&ispublic="+isPublic+moreCriteria.join("")+"&format="+format+"&passwordEnabled="+password+"&osTypeId="+osType+"&hypervisor="+hypervisor+"&response=json"),
|
||||
data: createURL("command=registerTemplate&name="+todb(name)+"&displayText="+todb(desc)+"&url="+todb(url)+"&zoneid="+zoneId+"&ispublic="+isPublic+moreCriteria.join("")+"&format="+format+"&passwordEnabled="+password+"&osTypeId="+osType+"&hypervisor="+hypervisor+"&response=json"),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var items = json.registertemplateresponse.template;
|
||||
|
|
@ -242,7 +246,7 @@ function templateJsonToDetailsTab() {
|
|||
|
||||
$thisTab.find("#grid_header_title").text(fromdb(jsonObj.name));
|
||||
|
||||
$thisTab.find("#id").text(noNull(jsonObj.id));
|
||||
$thisTab.find("#id").text(fromdb(jsonObj.id));
|
||||
$thisTab.find("#zonename").text(fromdb(jsonObj.zonename));
|
||||
|
||||
$thisTab.find("#name").text(fromdb(jsonObj.name));
|
||||
|
|
|
|||
|
|
@ -16,6 +16,47 @@
|
|||
*
|
||||
*/
|
||||
|
||||
function volumeGetSearchParams() {
|
||||
var moreCriteria = [];
|
||||
|
||||
var $advancedSearchPopup = $("#advanced_search_popup");
|
||||
if (lastSearchType == "advanced_search" && $advancedSearchPopup.length > 0) {
|
||||
var name = $advancedSearchPopup.find("#adv_search_name").val();
|
||||
if (name!=null && trim(name).length > 0)
|
||||
moreCriteria.push("&name="+todb(name));
|
||||
|
||||
var zone = $advancedSearchPopup.find("#adv_search_zone").val();
|
||||
if (zone!=null && zone.length > 0)
|
||||
moreCriteria.push("&zoneId="+zone);
|
||||
|
||||
if ($advancedSearchPopup.find("#adv_search_pod_li").css("display") != "none") {
|
||||
var pod = $advancedSearchPopup.find("#adv_search_pod").val();
|
||||
if (pod!=null && pod.length > 0)
|
||||
moreCriteria.push("&podId="+pod);
|
||||
}
|
||||
|
||||
if ($advancedSearchPopup.find("#adv_search_domain_li").css("display") != "none") {
|
||||
var domainId = $advancedSearchPopup.find("#adv_search_domain").val();
|
||||
if (domainId!=null && domainId.length > 0)
|
||||
moreCriteria.push("&domainid="+domainId);
|
||||
}
|
||||
|
||||
if ($advancedSearchPopup.find("#adv_search_account_li").css("display") != "none") {
|
||||
var account = $advancedSearchPopup.find("#adv_search_account").val();
|
||||
if (account!=null && account.length > 0)
|
||||
moreCriteria.push("&account="+account);
|
||||
}
|
||||
}
|
||||
else {
|
||||
var searchInput = $("#basic_search").find("#search_input").val();
|
||||
if (lastSearchType == "basic_search" && searchInput != null && searchInput.length > 0) {
|
||||
moreCriteria.push("&name="+todb(searchInput));
|
||||
}
|
||||
}
|
||||
|
||||
return moreCriteria.join("");
|
||||
}
|
||||
|
||||
function afterLoadVolumeJSP() {
|
||||
initDialog("dialog_create_template", 400);
|
||||
initDialog("dialog_create_snapshot");
|
||||
|
|
@ -329,7 +370,7 @@ function volumeJsonToDetailsTab(){
|
|||
}
|
||||
});
|
||||
|
||||
$thisTab.find("#id").text(noNull(jsonObj.id));
|
||||
$thisTab.find("#id").text(fromdb(jsonObj.id));
|
||||
$thisTab.find("#name").text(fromdb(jsonObj.name));
|
||||
$thisTab.find("#zonename").text(fromdb(jsonObj.zonename));
|
||||
$thisTab.find("#device_id").text(fromdb(jsonObj.deviceid));
|
||||
|
|
@ -394,7 +435,7 @@ function volumeJsonToSnapshotTab() {
|
|||
|
||||
$.ajax({
|
||||
cache: false,
|
||||
data: createURL("command=listSnapshots&volumeid="+noNull(jsonObj.id)),
|
||||
data: createURL("command=listSnapshots&volumeid="+fromdb(jsonObj.id)),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var items = json.listsnapshotsresponse.snapshot;
|
||||
|
|
@ -415,9 +456,9 @@ function volumeJsonToSnapshotTab() {
|
|||
|
||||
function volumeSnapshotJSONToTemplate(jsonObj, template) {
|
||||
template.data("jsonObj", jsonObj);
|
||||
template.attr("id", "volume_snapshot_"+noNull(jsonObj.id)).data("volumeSnapshotId", noNull(jsonObj.id));
|
||||
template.attr("id", "volume_snapshot_"+fromdb(jsonObj.id)).data("volumeSnapshotId", fromdb(jsonObj.id));
|
||||
template.find("#grid_header_title").text(fromdb(jsonObj.name));
|
||||
template.find("#id").text(noNull(jsonObj.id));
|
||||
template.find("#id").text(fromdb(jsonObj.id));
|
||||
template.find("#name").text(fromdb(jsonObj.name));
|
||||
template.find("#volumename").text(fromdb(jsonObj.volumename));
|
||||
template.find("#intervaltype").text(fromdb(jsonObj.intervaltype));
|
||||
|
|
@ -732,7 +773,7 @@ function doRecurringSnapshot($actionLink, $detailsTab, $midmenuItem1) {
|
|||
}
|
||||
var thisLink;
|
||||
$.ajax({
|
||||
data: createURL("command=createSnapshotPolicy&intervaltype="+intervalType+"&schedule="+schedule+"&volumeid="+volumeId+"&maxsnaps="+max+"&timezone="+encodeURIComponent(timezone)),
|
||||
data: createURL("command=createSnapshotPolicy&intervaltype="+intervalType+"&schedule="+schedule+"&volumeid="+volumeId+"&maxsnaps="+max+"&timezone="+todb(timezone)),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
thisDialog.dialog("close");
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ function zoneJsonToDetailsTab() {
|
|||
$thisTab.find("#tab_container").hide();
|
||||
$thisTab.find("#tab_spinning_wheel").show();
|
||||
|
||||
$thisTab.find("#id").text(noNull(jsonObj.id));
|
||||
$thisTab.find("#id").text(fromdb(jsonObj.id));
|
||||
$thisTab.find("#grid_header_title").text(fromdb(jsonObj.name));
|
||||
|
||||
$thisTab.find("#name").text(fromdb(jsonObj.name));
|
||||
|
|
@ -479,7 +479,7 @@ function initAddVLANButton($button, $leftmenuItem1) {
|
|||
var endip = trim($thisDialog.find("#add_publicip_vlan_endip").val());
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=createVlanIpRange&forVirtualNetwork="+type+"&zoneId="+zoneObj.id+vlan+scopeParams+"&gateway="+encodeURIComponent(gateway)+"&netmask="+encodeURIComponent(netmask)+"&startip="+encodeURIComponent(startip)+"&endip="+encodeURIComponent(endip)),
|
||||
data: createURL("command=createVlanIpRange&forVirtualNetwork="+type+"&zoneId="+zoneObj.id+vlan+scopeParams+"&gateway="+todb(gateway)+"&netmask="+todb(netmask)+"&startip="+todb(startip)+"&endip="+todb(endip)),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
$thisDialog.find("#spinning_wheel").hide();
|
||||
|
|
@ -543,7 +543,7 @@ function initAddSecondaryStorageButton($button, $leftmenuItem1) {
|
|||
var url = nfsURL(nfs_server, path);
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=addSecondaryStorage&zoneId="+zoneId+"&url="+encodeURIComponent(url)),
|
||||
data: createURL("command=addSecondaryStorage&zoneId="+zoneId+"&url="+todb(url)),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
$thisDialog.find("#spinning_wheel").hide();
|
||||
|
|
@ -604,11 +604,11 @@ function initAddPodButton($button, $leftmenuItem1) {
|
|||
var array1 = [];
|
||||
array1.push("&zoneId="+zoneObj.id);
|
||||
array1.push("&name="+todb(name));
|
||||
array1.push("&cidr="+encodeURIComponent(cidr));
|
||||
array1.push("&startIp="+encodeURIComponent(startip));
|
||||
array1.push("&cidr="+todb(cidr));
|
||||
array1.push("&startIp="+todb(startip));
|
||||
if (endip != null && endip.length > 0)
|
||||
array1.push("&endIp="+encodeURIComponent(endip));
|
||||
array1.push("&gateway="+encodeURIComponent(gateway));
|
||||
array1.push("&endIp="+todb(endip));
|
||||
array1.push("&gateway="+todb(gateway));
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=createPod"+array1.join("")),
|
||||
|
|
@ -855,19 +855,19 @@ function doEditZone2($actionLink, $detailsTab, $leftmenuItem1, $readonlyFields,
|
|||
|
||||
var dns1 = $detailsTab.find("#dns1_edit").val();
|
||||
if(dns1 != jsonObj.dns1)
|
||||
moreCriteria.push("&dns1="+encodeURIComponent(dns1));
|
||||
moreCriteria.push("&dns1="+todb(dns1));
|
||||
|
||||
var dns2 = $detailsTab.find("#dns2_edit").val();
|
||||
if (dns2 != null && dns2.length > 0 && dns2 != jsonObj.dns2)
|
||||
moreCriteria.push("&dns2="+encodeURIComponent(dns2));
|
||||
moreCriteria.push("&dns2="+todb(dns2));
|
||||
|
||||
var internaldns1 = $detailsTab.find("#internaldns1_edit").val();
|
||||
if(internaldns1 != jsonObj.internaldns1)
|
||||
moreCriteria.push("&internaldns1="+encodeURIComponent(internaldns1));
|
||||
moreCriteria.push("&internaldns1="+todb(internaldns1));
|
||||
|
||||
var internaldns2 = $detailsTab.find("#internaldns2_edit").val();
|
||||
if (internaldns2 != null && internaldns2.length > 0 && internaldns2 != jsonObj.internaldns2)
|
||||
moreCriteria.push("&internaldns2="+encodeURIComponent(internaldns2));
|
||||
moreCriteria.push("&internaldns2="+todb(internaldns2));
|
||||
|
||||
var vlan;
|
||||
if ($("#tab_content_details #vlan_container").css("display") != "none") {
|
||||
|
|
@ -880,13 +880,13 @@ function doEditZone2($actionLink, $detailsTab, $leftmenuItem1, $readonlyFields,
|
|||
vlan = vlanStart;
|
||||
|
||||
if(vlan != jsonObj.vlan)
|
||||
moreCriteria.push("&vlan=" + encodeURIComponent(vlan));
|
||||
moreCriteria.push("&vlan=" + todb(vlan));
|
||||
}
|
||||
}
|
||||
|
||||
var guestcidraddress = $detailsTab.find("#guestcidraddress_edit").val();
|
||||
if(guestcidraddress != jsonObj.guestcidraddress)
|
||||
moreCriteria.push("&guestcidraddress="+encodeURIComponent(guestcidraddress));
|
||||
moreCriteria.push("&guestcidraddress="+todb(guestcidraddress));
|
||||
|
||||
if(moreCriteria.length > 0) {
|
||||
$.ajax({
|
||||
|
|
@ -986,10 +986,10 @@ function initAddHostButtonOnZonePage($button, zoneId, zoneName) {
|
|||
array1.push("&podid="+podId);
|
||||
|
||||
var username = trim($thisDialog.find("#host_username").val());
|
||||
array1.push("&username="+encodeURIComponent(username));
|
||||
array1.push("&username="+todb(username));
|
||||
|
||||
var password = trim($thisDialog.find("#host_password").val());
|
||||
array1.push("&password="+encodeURIComponent(password));
|
||||
array1.push("&password="+todb(password));
|
||||
|
||||
var newClusterName, existingClusterId;
|
||||
if(clusterRadio == "new_cluster_radio") {
|
||||
|
|
@ -1010,7 +1010,7 @@ function initAddHostButtonOnZonePage($button, zoneId, zoneName) {
|
|||
url = "http://" + todb(hostname);
|
||||
else
|
||||
url = hostname;
|
||||
array1.push("&url="+encodeURIComponent(url));
|
||||
array1.push("&url="+todb(url));
|
||||
|
||||
//var $midmenuItem1 = beforeAddingMidMenuItem() ;
|
||||
|
||||
|
|
@ -1176,7 +1176,7 @@ function initAddPrimaryStorageButtonOnZonePage($button, zoneId, zoneName) {
|
|||
var lun = trim($thisDialog.find("#add_pool_lun").val());
|
||||
url = iscsiURL(server, iqn, lun);
|
||||
}
|
||||
array1.push("&url="+encodeURIComponent(url));
|
||||
array1.push("&url="+todb(url));
|
||||
|
||||
var tags = trim($thisDialog.find("#add_pool_tags").val());
|
||||
if(tags != null && tags.length > 0)
|
||||
|
|
|
|||
Loading…
Reference in New Issue