diff --git a/agent/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-agent.in b/agent/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-agent.in index fb82ebfab99..60e1e045b24 100755 --- a/agent/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-agent.in +++ b/agent/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-agent.in @@ -24,12 +24,10 @@ . /etc/rc.d/init.d/functions -whatami=cloud-agent - # set environment variables -SHORTNAME="$whatami" -PIDFILE=@PIDDIR@/"$whatami".pid +SHORTNAME="$0" +PIDFILE=@PIDDIR@/"$SHORTNAME".pid LOCKFILE=@LOCKDIR@/"$SHORTNAME" LOGFILE=@AGENTLOG@ PROGNAME="Cloud Agent" @@ -114,7 +112,7 @@ case "$1" in fi ;; *) - echo $"Usage: $whatami {start|stop|restart|condrestart|status|help}" + echo $"Usage: $SHORTNAME {start|stop|restart|condrestart|status|help}" RETVAL=3 esac diff --git a/agent/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-agent.in b/agent/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-agent.in index fb82ebfab99..60e1e045b24 100755 --- a/agent/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-agent.in +++ b/agent/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-agent.in @@ -24,12 +24,10 @@ . /etc/rc.d/init.d/functions -whatami=cloud-agent - # set environment variables -SHORTNAME="$whatami" -PIDFILE=@PIDDIR@/"$whatami".pid +SHORTNAME="$0" +PIDFILE=@PIDDIR@/"$SHORTNAME".pid LOCKFILE=@LOCKDIR@/"$SHORTNAME" LOGFILE=@AGENTLOG@ PROGNAME="Cloud Agent" @@ -114,7 +112,7 @@ case "$1" in fi ;; *) - echo $"Usage: $whatami {start|stop|restart|condrestart|status|help}" + echo $"Usage: $SHORTNAME {start|stop|restart|condrestart|status|help}" RETVAL=3 esac diff --git a/agent/distro/opensuse/sles/SYSCONFDIR/init.d/cloud-agent.in b/agent/distro/opensuse/sles/SYSCONFDIR/init.d/cloud-agent.in index ea1c6059b60..2422268f416 100644 --- a/agent/distro/opensuse/sles/SYSCONFDIR/init.d/cloud-agent.in +++ b/agent/distro/opensuse/sles/SYSCONFDIR/init.d/cloud-agent.in @@ -31,12 +31,10 @@ . /lib/lsb/init-functions . /etc/rc.status -whatami=cloud-agent - # set environment variables -SHORTNAME="$whatami" -PIDFILE=@PIDDIR@/"$whatami".pid +SHORTNAME="$0" +PIDFILE=@PIDDIR@/"$SHORTNAME".pid LOCKFILE=@LOCKDIR@/"$SHORTNAME" LOGFILE=@AGENTLOG@ PROGNAME="Cloud Agent" @@ -166,7 +164,7 @@ case "$1" in start ;; *) - echo $"Usage: $whatami {start|stop|restart|status|help}" + echo $"Usage: $SHORTNAME {start|stop|restart|status|help}" RETVAL=3 esac diff --git a/agent/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-agent.in b/agent/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-agent.in index fb82ebfab99..60e1e045b24 100644 --- a/agent/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-agent.in +++ b/agent/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-agent.in @@ -24,12 +24,10 @@ . /etc/rc.d/init.d/functions -whatami=cloud-agent - # set environment variables -SHORTNAME="$whatami" -PIDFILE=@PIDDIR@/"$whatami".pid +SHORTNAME="$0" +PIDFILE=@PIDDIR@/"$SHORTNAME".pid LOCKFILE=@LOCKDIR@/"$SHORTNAME" LOGFILE=@AGENTLOG@ PROGNAME="Cloud Agent" @@ -114,7 +112,7 @@ case "$1" in fi ;; *) - echo $"Usage: $whatami {start|stop|restart|condrestart|status|help}" + echo $"Usage: $SHORTNAME {start|stop|restart|condrestart|status|help}" RETVAL=3 esac diff --git a/agent/distro/sles/SYSCONFDIR/init.d/cloud-agent.in b/agent/distro/sles/SYSCONFDIR/init.d/cloud-agent.in index ea1c6059b60..2422268f416 100644 --- a/agent/distro/sles/SYSCONFDIR/init.d/cloud-agent.in +++ b/agent/distro/sles/SYSCONFDIR/init.d/cloud-agent.in @@ -31,12 +31,10 @@ . /lib/lsb/init-functions . /etc/rc.status -whatami=cloud-agent - # set environment variables -SHORTNAME="$whatami" -PIDFILE=@PIDDIR@/"$whatami".pid +SHORTNAME="$0" +PIDFILE=@PIDDIR@/"$SHORTNAME".pid LOCKFILE=@LOCKDIR@/"$SHORTNAME" LOGFILE=@AGENTLOG@ PROGNAME="Cloud Agent" @@ -166,7 +164,7 @@ case "$1" in start ;; *) - echo $"Usage: $whatami {start|stop|restart|status|help}" + echo $"Usage: $SHORTNAME {start|stop|restart|status|help}" RETVAL=3 esac diff --git a/api/src/com/cloud/event/EventTypes.java b/api/src/com/cloud/event/EventTypes.java index d0ade896c20..37b2ebb169c 100755 --- a/api/src/com/cloud/event/EventTypes.java +++ b/api/src/com/cloud/event/EventTypes.java @@ -455,6 +455,7 @@ public class EventTypes { public static final String EVENT_UCS_ASSOCIATED_PROFILE = "UCS.ASSOCIATEPROFILE"; + // IAM events public static final String EVENT_IAM_POLICY_CREATE = "IAMPOLICY.CREATE"; public static final String EVENT_IAM_POLICY_DELETE = "IAMPOLICY.DELETE"; public static final String EVENT_IAM_POLICY_GRANT = "IAMPOLICY.GRANT"; diff --git a/api/src/com/cloud/network/IpAddress.java b/api/src/com/cloud/network/IpAddress.java index a3816cb3ded..5aae7842798 100644 --- a/api/src/com/cloud/network/IpAddress.java +++ b/api/src/com/cloud/network/IpAddress.java @@ -85,4 +85,6 @@ public interface IpAddress extends ControlledEntity, Identity, InternalIdentity Long getNetworkId(); + boolean isDisplay(); + } diff --git a/api/src/com/cloud/network/NetworkService.java b/api/src/com/cloud/network/NetworkService.java index 072a27d1003..1e126f52aee 100755 --- a/api/src/com/cloud/network/NetworkService.java +++ b/api/src/com/cloud/network/NetworkService.java @@ -50,7 +50,7 @@ public interface NetworkService { List getIsolatedNetworksOwnedByAccountInZone(long zoneId, Account owner); - IpAddress allocateIP(Account ipOwner, long zoneId, Long networkId) throws ResourceAllocationException, InsufficientAddressCapacityException, + IpAddress allocateIP(Account ipOwner, long zoneId, Long networkId, Boolean displayIp) throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException; boolean releaseIpAddress(long ipAddressId) throws InsufficientAddressCapacityException; @@ -177,5 +177,5 @@ public interface NetworkService { Map getNetworkOfferingServiceCapabilities(NetworkOffering offering, Service service); - IpAddress updateIP(Long id, String customId); + IpAddress updateIP(Long id, String customId, Boolean displayIp); } diff --git a/api/src/com/cloud/network/RemoteAccessVpn.java b/api/src/com/cloud/network/RemoteAccessVpn.java index d3262b75e3e..4d7e4d49b12 100644 --- a/api/src/com/cloud/network/RemoteAccessVpn.java +++ b/api/src/com/cloud/network/RemoteAccessVpn.java @@ -38,4 +38,6 @@ public interface RemoteAccessVpn extends ControlledEntity, InternalIdentity, Ide Long getVpcId(); State getState(); + + boolean isDisplay(); } diff --git a/api/src/com/cloud/network/Site2SiteVpnConnection.java b/api/src/com/cloud/network/Site2SiteVpnConnection.java index ad1a9825c01..81e81801195 100644 --- a/api/src/com/cloud/network/Site2SiteVpnConnection.java +++ b/api/src/com/cloud/network/Site2SiteVpnConnection.java @@ -42,4 +42,6 @@ public interface Site2SiteVpnConnection extends ControlledEntity, InternalIdenti public Date getRemoved(); public boolean isPassive(); + + boolean isDisplay(); } diff --git a/api/src/com/cloud/network/Site2SiteVpnGateway.java b/api/src/com/cloud/network/Site2SiteVpnGateway.java index b60db3adf5c..bae12597f27 100644 --- a/api/src/com/cloud/network/Site2SiteVpnGateway.java +++ b/api/src/com/cloud/network/Site2SiteVpnGateway.java @@ -1,3 +1,4 @@ + // Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information @@ -15,17 +16,19 @@ // specific language governing permissions and limitations // under the License. package com.cloud.network; - import java.util.Date; import org.apache.cloudstack.acl.ControlledEntity; import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; + public interface Site2SiteVpnGateway extends ControlledEntity, Identity, InternalIdentity { public long getAddrId(); public long getVpcId(); public Date getRemoved(); + + boolean isDisplay(); } diff --git a/api/src/com/cloud/network/as/AutoScaleVmGroup.java b/api/src/com/cloud/network/as/AutoScaleVmGroup.java index e8b328fc267..14c761593b1 100644 --- a/api/src/com/cloud/network/as/AutoScaleVmGroup.java +++ b/api/src/com/cloud/network/as/AutoScaleVmGroup.java @@ -53,4 +53,6 @@ public interface AutoScaleVmGroup extends ControlledEntity, InternalIdentity { String getUuid(); + boolean isDisplay(); + } diff --git a/api/src/com/cloud/network/as/AutoScaleVmProfile.java b/api/src/com/cloud/network/as/AutoScaleVmProfile.java index 0577080a316..6e0b5ffb91b 100644 --- a/api/src/com/cloud/network/as/AutoScaleVmProfile.java +++ b/api/src/com/cloud/network/as/AutoScaleVmProfile.java @@ -48,4 +48,6 @@ public interface AutoScaleVmProfile extends ControlledEntity, InternalIdentity { public long getAutoScaleUserId(); + boolean isDisplay(); + } diff --git a/api/src/com/cloud/network/firewall/FirewallService.java b/api/src/com/cloud/network/firewall/FirewallService.java index 0e4f4953ec7..5ab789121ad 100644 --- a/api/src/com/cloud/network/firewall/FirewallService.java +++ b/api/src/com/cloud/network/firewall/FirewallService.java @@ -50,6 +50,6 @@ public interface FirewallService { boolean revokeRelatedFirewallRule(long ruleId, boolean apply); - FirewallRule updateFirewallRule(long ruleId, String customId); + FirewallRule updateFirewallRule(long ruleId, String customId, Boolean forDisplay); } diff --git a/api/src/com/cloud/network/lb/LoadBalancingRulesService.java b/api/src/com/cloud/network/lb/LoadBalancingRulesService.java index cd0a276c73c..4c87d342db5 100644 --- a/api/src/com/cloud/network/lb/LoadBalancingRulesService.java +++ b/api/src/com/cloud/network/lb/LoadBalancingRulesService.java @@ -41,16 +41,17 @@ import com.cloud.utils.net.Ip; public interface LoadBalancingRulesService { /** * Create a load balancer rule from the given ipAddress/port to the given private port - * * @param openFirewall * TODO + * @param forDisplay TODO * @param cmd * the command specifying the ip address, public port, protocol, private port, and algorithm + * * @return the newly created LoadBalancerVO if successful, null otherwise * @throws InsufficientAddressCapacityException */ LoadBalancer createPublicLoadBalancerRule(String xId, String name, String description, int srcPortStart, int srcPortEnd, int defPortStart, int defPortEnd, - Long ipAddrId, String protocol, String algorithm, long networkId, long lbOwnerId, boolean openFirewall, String lbProtocol) throws NetworkRuleConflictException, + Long ipAddrId, String protocol, String algorithm, long networkId, long lbOwnerId, boolean openFirewall, String lbProtocol, Boolean forDisplay) throws NetworkRuleConflictException, InsufficientAddressCapacityException; LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd); diff --git a/api/src/com/cloud/network/rules/FirewallRule.java b/api/src/com/cloud/network/rules/FirewallRule.java index 274242ad394..b02257b7c89 100644 --- a/api/src/com/cloud/network/rules/FirewallRule.java +++ b/api/src/com/cloud/network/rules/FirewallRule.java @@ -87,4 +87,6 @@ public interface FirewallRule extends ControlledEntity, Identity, InternalIdenti */ TrafficType getTrafficType(); + boolean isDisplay(); + } diff --git a/api/src/com/cloud/network/rules/RulesService.java b/api/src/com/cloud/network/rules/RulesService.java index 1bd9cfe3400..2dd0182dbc4 100644 --- a/api/src/com/cloud/network/rules/RulesService.java +++ b/api/src/com/cloud/network/rules/RulesService.java @@ -41,11 +41,12 @@ public interface RulesService { * vm to be linked to. If specified the destination ip address is ignored. * @param openFirewall * TODO + * @param forDisplay TODO * @return PortForwardingRule if created. * @throws NetworkRuleConflictException * if conflicts in the network rules are detected. */ - PortForwardingRule createPortForwardingRule(PortForwardingRule rule, Long vmId, Ip vmIp, boolean openFirewall) throws NetworkRuleConflictException; + PortForwardingRule createPortForwardingRule(PortForwardingRule rule, Long vmId, Ip vmIp, boolean openFirewall, Boolean forDisplay) throws NetworkRuleConflictException; /** * Revokes a port forwarding rule @@ -80,6 +81,6 @@ public interface RulesService { boolean disableStaticNat(long ipId) throws ResourceUnavailableException, NetworkRuleConflictException, InsufficientAddressCapacityException; - PortForwardingRule updatePortForwardingRule(long id, String customId); + PortForwardingRule updatePortForwardingRule(long id, String customId, Boolean forDisplay); } diff --git a/api/src/com/cloud/network/vpc/NetworkACL.java b/api/src/com/cloud/network/vpc/NetworkACL.java index a97c57d6ff0..3ebee146ed8 100644 --- a/api/src/com/cloud/network/vpc/NetworkACL.java +++ b/api/src/com/cloud/network/vpc/NetworkACL.java @@ -33,4 +33,6 @@ public interface NetworkACL extends InternalIdentity { long getId(); String getName(); + + boolean isDisplay(); } diff --git a/api/src/com/cloud/network/vpc/NetworkACLItem.java b/api/src/com/cloud/network/vpc/NetworkACLItem.java index d8dd0fb79d1..faa4d273c9c 100644 --- a/api/src/com/cloud/network/vpc/NetworkACLItem.java +++ b/api/src/com/cloud/network/vpc/NetworkACLItem.java @@ -73,4 +73,6 @@ public interface NetworkACLItem extends InternalIdentity { */ TrafficType getTrafficType(); + boolean isDisplay(); + } diff --git a/api/src/com/cloud/network/vpc/NetworkACLService.java b/api/src/com/cloud/network/vpc/NetworkACLService.java index 29ae4ea5ced..7cd1d3b3141 100644 --- a/api/src/com/cloud/network/vpc/NetworkACLService.java +++ b/api/src/com/cloud/network/vpc/NetworkACLService.java @@ -31,9 +31,10 @@ public interface NetworkACLService { * @param name * @param description * @param vpcId + * @param forDisplay TODO * @return */ - NetworkACL createNetworkACL(String name, String description, long vpcId); + NetworkACL createNetworkACL(String name, String description, long vpcId, Boolean forDisplay); /** * Get Network ACL with specified Id @@ -115,11 +116,12 @@ public interface NetworkACLService { * @param icmpCode * @param icmpType * @param newUUID TODO + * @param forDisplay TODO * @return * @throws ResourceUnavailableException */ NetworkACLItem updateNetworkACLItem(Long id, String protocol, List sourceCidrList, NetworkACLItem.TrafficType trafficType, String action, Integer number, - Integer sourcePortStart, Integer sourcePortEnd, Integer icmpCode, Integer icmpType, String newUUID) throws ResourceUnavailableException; + Integer sourcePortStart, Integer sourcePortEnd, Integer icmpCode, Integer icmpType, String newUUID, Boolean forDisplay) throws ResourceUnavailableException; /** * Associates ACL with specified Network @@ -130,6 +132,6 @@ public interface NetworkACLService { */ boolean replaceNetworkACLonPrivateGw(long aclId, long privateGatewayId) throws ResourceUnavailableException; - NetworkACL updateNetworkACL(Long id, String customId); + NetworkACL updateNetworkACL(Long id, String customId, Boolean forDisplay); } diff --git a/api/src/com/cloud/network/vpc/StaticRouteProfile.java b/api/src/com/cloud/network/vpc/StaticRouteProfile.java index 941b5b29302..b5bd5f7af52 100644 --- a/api/src/com/cloud/network/vpc/StaticRouteProfile.java +++ b/api/src/com/cloud/network/vpc/StaticRouteProfile.java @@ -107,5 +107,4 @@ public class StaticRouteProfile implements StaticRoute { public IAMEntityType getEntityType() { return IAMEntityType.StaticRoute; } - } diff --git a/api/src/com/cloud/network/vpc/Vpc.java b/api/src/com/cloud/network/vpc/Vpc.java index fb5f2cc8991..eb7e39134c3 100644 --- a/api/src/com/cloud/network/vpc/Vpc.java +++ b/api/src/com/cloud/network/vpc/Vpc.java @@ -72,4 +72,5 @@ public interface Vpc extends ControlledEntity, Identity, InternalIdentity { */ boolean isRestartRequired(); + boolean isDisplay(); } diff --git a/api/src/com/cloud/network/vpc/VpcService.java b/api/src/com/cloud/network/vpc/VpcService.java index 218e6755c94..d1166df4065 100644 --- a/api/src/com/cloud/network/vpc/VpcService.java +++ b/api/src/com/cloud/network/vpc/VpcService.java @@ -43,10 +43,11 @@ public interface VpcService { * @param displayText * @param cidr * @param networkDomain TODO + * @param displayVpc TODO * @return * @throws ResourceAllocationException TODO */ - public Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName, String displayText, String cidr, String networkDomain) + public Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName, String displayText, String cidr, String networkDomain, Boolean displayVpc) throws ResourceAllocationException; /** @@ -67,9 +68,10 @@ public interface VpcService { * @param vpcName * @param displayText * @param customId TODO + * @param displayVpc TODO * @return */ - public Vpc updateVpc(long vpcId, String vpcName, String displayText, String customId); + public Vpc updateVpc(long vpcId, String vpcName, String displayText, String customId, Boolean displayVpc); /** * Lists VPC(s) based on the parameters passed to the method call @@ -91,12 +93,13 @@ public interface VpcService { * @param restartRequired TODO * @param tags TODO * @param projectId TODO + * @param display TODO * @param vpc * @return */ public List listVpcs(Long id, String vpcName, String displayText, List supportedServicesStr, String cidr, Long vpcOffId, String state, String accountName, Long domainId, String keyword, Long startIndex, Long pageSizeVal, Long zoneId, Boolean isRecursive, Boolean listAll, Boolean restartRequired, - Map tags, Long projectId); + Map tags, Long projectId, Boolean display); /** * Starts VPC which includes starting VPC provider and applying all the neworking rules on the backend diff --git a/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java b/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java index 1183211dfb8..acf007bbb33 100644 --- a/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java +++ b/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java @@ -31,7 +31,7 @@ import com.cloud.utils.Pair; public interface RemoteAccessVpnService { static final String RemoteAccessVpnClientIpRangeCK = "remote.access.vpn.client.iprange"; - RemoteAccessVpn createRemoteAccessVpn(long vpnServerAddressId, String ipRange, boolean openFirewall) throws NetworkRuleConflictException; + RemoteAccessVpn createRemoteAccessVpn(long vpnServerAddressId, String ipRange, boolean openFirewall, Boolean forDisplay) throws NetworkRuleConflictException; void destroyRemoteAccessVpnForIp(long vpnServerAddressId, Account caller) throws ResourceUnavailableException; @@ -55,6 +55,6 @@ public interface RemoteAccessVpnService { RemoteAccessVpn getRemoteAccessVpnById(long vpnId); - RemoteAccessVpn updateRemoteAccessVpn(long id, String customId); + RemoteAccessVpn updateRemoteAccessVpn(long id, String customId, Boolean forDisplay); } diff --git a/api/src/com/cloud/network/vpn/Site2SiteVpnService.java b/api/src/com/cloud/network/vpn/Site2SiteVpnService.java index 7b76b3a488b..abdc7568766 100644 --- a/api/src/com/cloud/network/vpn/Site2SiteVpnService.java +++ b/api/src/com/cloud/network/vpn/Site2SiteVpnService.java @@ -64,7 +64,7 @@ public interface Site2SiteVpnService { Site2SiteCustomerGateway updateCustomerGateway(UpdateVpnCustomerGatewayCmd updateVpnCustomerGatewayCmd); - Site2SiteVpnConnection updateVpnConnection(long id, String customId); + Site2SiteVpnConnection updateVpnConnection(long id, String customId, Boolean forDisplay); - Site2SiteVpnGateway updateVpnGateway(Long id, String customId); + Site2SiteVpnGateway updateVpnGateway(Long id, String customId, Boolean forDisplay); } diff --git a/api/src/com/cloud/serializer/Param.java b/api/src/com/cloud/serializer/Param.java index 02deb6f1c1f..3e6f852128a 100644 --- a/api/src/com/cloud/serializer/Param.java +++ b/api/src/com/cloud/serializer/Param.java @@ -19,6 +19,8 @@ package com.cloud.serializer; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import org.apache.cloudstack.acl.RoleType; + @Retention(RetentionPolicy.RUNTIME) public @interface Param { String name() default ""; @@ -33,4 +35,6 @@ public @interface Param { boolean includeInApiDoc() default true; String since() default ""; + + RoleType[] authorized() default {}; } diff --git a/api/src/com/cloud/server/ManagementService.java b/api/src/com/cloud/server/ManagementService.java index 24fad87ea0f..9b138feb308 100755 --- a/api/src/com/cloud/server/ManagementService.java +++ b/api/src/com/cloud/server/ManagementService.java @@ -269,9 +269,9 @@ public interface ManagementService { */ String generateRandomPassword(); - public Long saveStartedEvent(Long userId, Long accountId, String type, String description, long startEventId); + public Long saveStartedEvent(Long userId, Long accountId, String type, String description, boolean startEventId, Long displayResourceEnabled); - public Long saveCompletedEvent(Long userId, Long accountId, String level, String type, String description, long startEventId); + public Long saveCompletedEvent(Long userId, Long accountId, String level, String type, String description, boolean displayResourceEnabled, long startEventId); /** * Search registered key pairs for the logged in user. diff --git a/api/src/com/cloud/server/ResourceMetaDataService.java b/api/src/com/cloud/server/ResourceMetaDataService.java index 2871d991ab7..56fe1045ab3 100644 --- a/api/src/com/cloud/server/ResourceMetaDataService.java +++ b/api/src/com/cloud/server/ResourceMetaDataService.java @@ -30,9 +30,10 @@ public interface ResourceMetaDataService { * @param resourceId TODO * @param resourceType * @param details + * @param forDisplay TODO * @return */ - boolean addResourceMetaData(String resourceId, ResourceObjectType resourceType, Map details); + boolean addResourceMetaData(String resourceId, ResourceObjectType resourceType, Map details, boolean forDisplay); /** * diff --git a/api/src/com/cloud/storage/Storage.java b/api/src/com/cloud/storage/Storage.java index ff83dfc1166..8ab2463a81b 100755 --- a/api/src/com/cloud/storage/Storage.java +++ b/api/src/com/cloud/storage/Storage.java @@ -98,7 +98,8 @@ public class Storage { PreSetup(true), // for XenServer, Storage Pool is set up by customers. EXT(false), // XenServer local EXT SR OCFS2(true), - SMB(true); + SMB(true), + Gluster(true); boolean shared; diff --git a/api/src/com/cloud/storage/Volume.java b/api/src/com/cloud/storage/Volume.java index 36648840448..304dbcfe342 100755 --- a/api/src/com/cloud/storage/Volume.java +++ b/api/src/com/cloud/storage/Volume.java @@ -190,4 +190,6 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba Long getVmSnapshotChainSize(); Integer getHypervisorSnapshotReserve(); + + boolean isDisplayVolume(); } diff --git a/api/src/com/cloud/storage/VolumeApiService.java b/api/src/com/cloud/storage/VolumeApiService.java index 6bbfd634241..35bcb6f80f3 100644 --- a/api/src/com/cloud/storage/VolumeApiService.java +++ b/api/src/com/cloud/storage/VolumeApiService.java @@ -82,7 +82,7 @@ public interface VolumeApiService { Snapshot allocSnapshot(Long volumeId, Long policyId) throws ResourceAllocationException; - Volume updateVolume(long volumeId, String path, String state, Long storageId, Boolean displayVolume, String customId, long owner); + Volume updateVolume(long volumeId, String path, String state, Long storageId, Boolean displayVolume, String customId, long owner, String chainInfo); /** * Extracts the volume to a particular location. diff --git a/api/src/com/cloud/uservm/UserVm.java b/api/src/com/cloud/uservm/UserVm.java index b1d1712d9cf..16a203746a9 100755 --- a/api/src/com/cloud/uservm/UserVm.java +++ b/api/src/com/cloud/uservm/UserVm.java @@ -39,4 +39,5 @@ public interface UserVm extends VirtualMachine, ControlledEntity { void setAccountId(long accountId); + public boolean isDisplayVm(); } diff --git a/api/src/com/cloud/vm/VirtualMachine.java b/api/src/com/cloud/vm/VirtualMachine.java index d6e70a8a6cf..dd11a829afa 100755 --- a/api/src/com/cloud/vm/VirtualMachine.java +++ b/api/src/com/cloud/vm/VirtualMachine.java @@ -34,7 +34,10 @@ import com.cloud.utils.fsm.StateObject; public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, InternalIdentity, StateObject { public enum PowerState { - PowerUnknown, PowerOn, PowerOff, + PowerUnknown, + PowerOn, + PowerOff, + PowerReportMissing } public enum State { diff --git a/api/src/org/apache/cloudstack/acl/SecurityChecker.java b/api/src/org/apache/cloudstack/acl/SecurityChecker.java index 2c98e82dbc5..2889bc85e10 100644 --- a/api/src/org/apache/cloudstack/acl/SecurityChecker.java +++ b/api/src/org/apache/cloudstack/acl/SecurityChecker.java @@ -100,6 +100,7 @@ public interface SecurityChecker extends Adapter { */ boolean checkAccess(Account caller, ControlledEntity entity, AccessType accessType, String action) throws PermissionDeniedException; + /** * Checks if the user belongs to an account that can access the object. * diff --git a/api/src/org/apache/cloudstack/api/APICommand.java b/api/src/org/apache/cloudstack/api/APICommand.java index 690dd9ad51a..9b4dfafdb6c 100644 --- a/api/src/org/apache/cloudstack/api/APICommand.java +++ b/api/src/org/apache/cloudstack/api/APICommand.java @@ -22,9 +22,9 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import org.apache.cloudstack.acl.IAMEntityType; import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.ResponseObject.ResponseView; -import org.apache.cloudstack.acl.IAMEntityType; @Retention(RetentionPolicy.RUNTIME) @Target({TYPE}) @@ -43,6 +43,10 @@ public @interface APICommand { ResponseView responseView() default ResponseView.Full; + boolean requestHasSensitiveInfo() default true; + + boolean responseHasSensitiveInfo() default true; + RoleType[] authorized() default {}; IAMEntityType[] entityType() default {}; diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java index b34f106d6dc..62191fc602e 100755 --- a/api/src/org/apache/cloudstack/api/ApiConstants.java +++ b/api/src/org/apache/cloudstack/api/ApiConstants.java @@ -41,6 +41,7 @@ public class ApiConstants { public static final String PRIVATE_KEY = "privatekey"; public static final String DOMAIN_SUFFIX = "domainsuffix"; public static final String DNS_SEARCH_ORDER = "dnssearchorder"; + public static final String CHAIN_INFO = "chaininfo"; public static final String CIDR = "cidr"; public static final String IP6_CIDR = "ip6cidr"; public static final String CIDR_LIST = "cidrlist"; @@ -543,6 +544,7 @@ public class ApiConstants { public static final String ROUTING = "isrouting"; public static final String MAX_CONNECTIONS = "maxconnections"; public static final String SERVICE_STATE = "servicestate"; + public static final String IAM_ACCOUNT_IDS = "accountids"; public static final String IAM_MEMBER_ACCOUNTS = "memberaccounts"; public static final String IAM_PARENT_POLICY_ID = "parentpolicyid"; diff --git a/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java b/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java index ae0f5d703bc..bbc898f2a51 100644 --- a/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java +++ b/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java @@ -105,7 +105,8 @@ public abstract class BaseAsyncCmd extends BaseCmd { if (startEvent == null) { startEvent = 0L; } - return _mgr.saveStartedEvent((userId == null) ? User.UID_SYSTEM : userId, getEntityOwnerId(), eventType, description, startEvent); + return _mgr.saveStartedEvent((userId == null) ? User.UID_SYSTEM : userId, getEntityOwnerId(), eventType, description, + isDisplayResourceEnabled(), startEvent); } protected long saveCompletedEvent(String level, String description) { @@ -120,7 +121,8 @@ public abstract class BaseAsyncCmd extends BaseCmd { if (startEvent == null) { startEvent = 0L; } - return _mgr.saveCompletedEvent((userId == null) ? User.UID_SYSTEM : userId, getEntityOwnerId(), level, eventType, description, startEvent); + return _mgr.saveCompletedEvent((userId == null) ? User.UID_SYSTEM : userId, getEntityOwnerId(), level, eventType, description, + isDisplayResourceEnabled(), startEvent); } } diff --git a/api/src/org/apache/cloudstack/api/BaseCmd.java b/api/src/org/apache/cloudstack/api/BaseCmd.java index 364baf86f5a..7c720c9dfc0 100644 --- a/api/src/org/apache/cloudstack/api/BaseCmd.java +++ b/api/src/org/apache/cloudstack/api/BaseCmd.java @@ -402,4 +402,12 @@ public abstract class BaseCmd { } return null; } + + /** + * display flag is used to control the display of the resource only to the end user. It doesnt affect Root Admin. + * @return display flag + */ + public boolean isDisplayResourceEnabled(){ + return true; + } } diff --git a/api/src/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java b/api/src/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java index 0586117f0c6..63d2b7f7615 100644 --- a/api/src/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java +++ b/api/src/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java @@ -16,6 +16,10 @@ // under the License. package org.apache.cloudstack.api; +import org.apache.cloudstack.context.CallContext; + +import com.cloud.user.Account; + public abstract class BaseListAccountResourcesCmd extends BaseListDomainResourcesCmd { @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "list resources by account. Must be used with the domainId parameter.") @@ -24,4 +28,12 @@ public abstract class BaseListAccountResourcesCmd extends BaseListDomainResource public String getAccountName() { return accountName; } + + public Boolean getDisplay() { + Account caller = CallContext.current().getCallingAccount(); + if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL) { + return true; + } + return null; + } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java index a2399cfe35e..0c46d501bd2 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java @@ -36,7 +36,9 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.user.Account; import com.cloud.user.UserAccount; -@APICommand(name = "createAccount", description = "Creates an account", responseObject = AccountResponse.class, entityType = { IAMEntityType.Account }) + +@APICommand(name = "createAccount", description = "Creates an account", responseObject = AccountResponse.class, entityType = {IAMEntityType.Account}, + requestHasSensitiveInfo = true, responseHasSensitiveInfo = true) public class CreateAccountCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(CreateAccountCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java index f1547a42454..8cc87c2884f 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java @@ -39,7 +39,8 @@ import com.cloud.event.EventTypes; import com.cloud.user.Account; import com.cloud.user.User; -@APICommand(name = "deleteAccount", description = "Deletes a account, and all users associated with this account", responseObject = SuccessResponse.class, entityType = { IAMEntityType.Account }) +@APICommand(name = "deleteAccount", description = "Deletes a account, and all users associated with this account", responseObject = SuccessResponse.class, entityType = {IAMEntityType.Account}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteAccountCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteAccountCmd.class.getName()); private static final String s_name = "deleteaccountresponse"; @@ -104,7 +105,7 @@ public class DeleteAccountCmd extends BaseAsyncCmd { boolean result = _regionService.deleteUserAccount(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete user account and all corresponding users"); } diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java index 028481c6a56..1e810091eeb 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java @@ -41,7 +41,8 @@ import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.Account; -@APICommand(name = "disableAccount", description = "Disables an account", responseObject = AccountResponse.class, entityType = { IAMEntityType.Account }) +@APICommand(name = "disableAccount", description = "Disables an account", responseObject = AccountResponse.class, entityType = {IAMEntityType.Account}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class DisableAccountCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DisableAccountCmd.class.getName()); private static final String s_name = "disableaccountresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java index 9e38d3aa0a2..1bfd71c8040 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java @@ -36,7 +36,8 @@ import org.apache.cloudstack.region.RegionService; import com.cloud.user.Account; -@APICommand(name = "enableAccount", description = "Enables an account", responseObject = AccountResponse.class, entityType = { IAMEntityType.Account }) +@APICommand(name = "enableAccount", description = "Enables an account", responseObject = AccountResponse.class, entityType = {IAMEntityType.Account}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class EnableAccountCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(EnableAccountCmd.class.getName()); private static final String s_name = "enableaccountresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java index ddc1628e859..780dac1d7ab 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java @@ -28,7 +28,8 @@ import org.apache.cloudstack.api.response.DomainResponse; import com.cloud.user.Account; -@APICommand(name = "lockAccount", description = "Locks an account", responseObject = AccountResponse.class, entityType = { IAMEntityType.Account }) +@APICommand(name = "lockAccount", description = "Locks an account", responseObject = AccountResponse.class, entityType = {IAMEntityType.Account}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class LockAccountCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(LockAccountCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java index d42384862fb..8d9fe261f92 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java @@ -39,7 +39,8 @@ import org.apache.cloudstack.region.RegionService; import com.cloud.user.Account; -@APICommand(name = "updateAccount", description = "Updates account information for the authenticated user", responseObject = AccountResponse.class, entityType = { IAMEntityType.Account }) +@APICommand(name = "updateAccount", description = "Updates account information for the authenticated user", responseObject = AccountResponse.class, entityType = {IAMEntityType.Account}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class UpdateAccountCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(UpdateAccountCmd.class.getName()); private static final String s_name = "updateaccountresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/alert/GenerateAlertCmd.java b/api/src/org/apache/cloudstack/api/command/admin/alert/GenerateAlertCmd.java index 3eaa0530646..58920d7dd74 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/alert/GenerateAlertCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/alert/GenerateAlertCmd.java @@ -31,7 +31,8 @@ import org.apache.log4j.Logger; import com.cloud.event.EventTypes; -@APICommand(name = "generateAlert", description = "Generates an alert", responseObject = SuccessResponse.class, since = "4.3") +@APICommand(name = "generateAlert", description = "Generates an alert", responseObject = SuccessResponse.class, since = "4.3", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class GenerateAlertCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(GenerateAlertCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java index 6c4b81b4f0e..ea715663d9c 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java @@ -32,7 +32,8 @@ import com.cloud.event.EventTypes; import com.cloud.network.as.Counter; import com.cloud.user.Account; -@APICommand(name = "createCounter", description = "Adds metric counter", responseObject = CounterResponse.class) +@APICommand(name = "createCounter", description = "Adds metric counter", responseObject = CounterResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateCounterCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreateCounterCmd.class.getName()); private static final String s_name = "counterresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java index 50477f53760..3547ef10c8c 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java @@ -33,7 +33,8 @@ import com.cloud.event.EventTypes; import com.cloud.exception.ResourceInUseException; import com.cloud.user.Account; -@APICommand(name = "deleteCounter", description = "Deletes a counter", responseObject = SuccessResponse.class) +@APICommand(name = "deleteCounter", description = "Deletes a counter", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteCounterCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteCounterCmd.class.getName()); private static final String s_name = "deletecounterresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java index d0e73807392..b9df18e01ed 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java @@ -38,7 +38,8 @@ import com.cloud.exception.ResourceInUseException; import com.cloud.org.Cluster; import com.cloud.user.Account; -@APICommand(name = "addCluster", description = "Adds a new cluster", responseObject = ClusterResponse.class) +@APICommand(name = "addCluster", description = "Adds a new cluster", responseObject = ClusterResponse.class, + requestHasSensitiveInfo = true, responseHasSensitiveInfo = false) public class AddClusterCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(AddClusterCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java index e1bc5855ee8..5d046758007 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java @@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.user.Account; -@APICommand(name = "deleteCluster", description = "Deletes a cluster.", responseObject = SuccessResponse.class) +@APICommand(name = "deleteCluster", description = "Deletes a cluster.", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteClusterCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeleteClusterCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java index 8640f371445..432ca921c4d 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java @@ -34,7 +34,8 @@ import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.org.Cluster; import com.cloud.utils.Pair; -@APICommand(name = "listClusters", description = "Lists clusters.", responseObject = ClusterResponse.class) +@APICommand(name = "listClusters", description = "Lists clusters.", responseObject = ClusterResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListClustersCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListServiceOfferingsCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java index b13f81a16bc..53d01c58a56 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java @@ -30,7 +30,8 @@ import com.cloud.exception.InvalidParameterValueException; import com.cloud.org.Cluster; import com.cloud.user.Account; -@APICommand(name = "updateCluster", description = "Updates an existing cluster", responseObject = ClusterResponse.class) +@APICommand(name = "updateCluster", description = "Updates an existing cluster", responseObject = ClusterResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateClusterCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(AddClusterCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java index 517807d4a78..a34bc3eb622 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java @@ -35,7 +35,8 @@ import org.apache.cloudstack.config.Configuration; import com.cloud.utils.Pair; -@APICommand(name = "listConfigurations", description = "Lists all configurations.", responseObject = ConfigurationResponse.class) +@APICommand(name = "listConfigurations", description = "Lists all configurations.", responseObject = ConfigurationResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListCfgsByCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListCfgsByCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/ListDeploymentPlannersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/ListDeploymentPlannersCmd.java index 1d9d2d935ff..b5a24b9bda8 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/config/ListDeploymentPlannersCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/config/ListDeploymentPlannersCmd.java @@ -26,7 +26,8 @@ import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.response.DeploymentPlannersResponse; import org.apache.cloudstack.api.response.ListResponse; -@APICommand(name = "listDeploymentPlanners", description = "Lists all DeploymentPlanners available.", responseObject = DeploymentPlannersResponse.class) +@APICommand(name = "listDeploymentPlanners", description = "Lists all DeploymentPlanners available.", responseObject = DeploymentPlannersResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListDeploymentPlannersCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListDeploymentPlannersCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java index 16adf664bdd..6d3c2012af7 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java @@ -35,7 +35,9 @@ import com.cloud.utils.Pair; @APICommand(name = "listHypervisorCapabilities", description = "Lists all hypervisor capabilities.", responseObject = HypervisorCapabilitiesResponse.class, - since = "3.0.0") + since = "3.0.0", + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class ListHypervisorCapabilitiesCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListHypervisorCapabilitiesCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java index 9bc9b3cbb5c..0124d5997b3 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java @@ -33,7 +33,8 @@ import org.apache.cloudstack.config.Configuration; import com.cloud.user.Account; -@APICommand(name = "updateConfiguration", description = "Updates a configuration.", responseObject = ConfigurationResponse.class) +@APICommand(name = "updateConfiguration", description = "Updates a configuration.", responseObject = ConfigurationResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateCfgCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(UpdateCfgCmd.class.getName()); private static final String s_name = "updateconfigurationresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java index 5cb5f9c3e52..6550c89240b 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java @@ -32,7 +32,9 @@ import com.cloud.user.Account; @APICommand(name = "updateHypervisorCapabilities", description = "Updates a hypervisor capabilities.", responseObject = HypervisorCapabilitiesResponse.class, - since = "3.0.0") + since = "3.0.0", + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class UpdateHypervisorCapabilitiesCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(UpdateHypervisorCapabilitiesCmd.class.getName()); private static final String s_name = "updatehypervisorcapabilitiesresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java index 47375551aea..312c9ee4b09 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java @@ -30,7 +30,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.domain.Domain; import com.cloud.user.Account; -@APICommand(name = "createDomain", description = "Creates a domain", responseObject = DomainResponse.class) +@APICommand(name = "createDomain", description = "Creates a domain", responseObject = DomainResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateDomainCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(CreateDomainCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java index b1075c10fc5..a6d2b0b10c1 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java @@ -35,7 +35,8 @@ import com.cloud.domain.Domain; import com.cloud.event.EventTypes; import com.cloud.user.Account; -@APICommand(name = "deleteDomain", description = "Deletes a specified domain", responseObject = SuccessResponse.class) +@APICommand(name = "deleteDomain", description = "Deletes a specified domain", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteDomainCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteDomainCmd.class.getName()); private static final String s_name = "deletedomainresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java index e1ba1789616..cf35295358b 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java @@ -31,7 +31,8 @@ import org.apache.cloudstack.api.response.ListResponse; import com.cloud.domain.Domain; import com.cloud.utils.Pair; -@APICommand(name = "listDomainChildren", description = "Lists all children domains belonging to a specified domain", responseObject = DomainResponse.class) +@APICommand(name = "listDomainChildren", description = "Lists all children domains belonging to a specified domain", responseObject = DomainResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListDomainChildrenCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListDomainChildrenCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java index 5a3786cda20..1942afd9af3 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java @@ -31,7 +31,8 @@ import org.apache.cloudstack.api.response.ListResponse; import com.cloud.domain.Domain; import com.cloud.utils.Pair; -@APICommand(name = "listDomains", description = "Lists domains and provides detailed information for listed domains", responseObject = DomainResponse.class) +@APICommand(name = "listDomains", description = "Lists domains and provides detailed information for listed domains", responseObject = DomainResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListDomainsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListDomainsCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java index 8acfcd5acda..409a84d7d80 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java @@ -33,7 +33,8 @@ import org.apache.cloudstack.region.RegionService; import com.cloud.domain.Domain; import com.cloud.user.Account; -@APICommand(name = "updateDomain", description = "Updates a domain with a new name", responseObject = DomainResponse.class) +@APICommand(name = "updateDomain", description = "Updates a domain with a new name", responseObject = DomainResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateDomainCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(UpdateDomainCmd.class.getName()); private static final String s_name = "updatedomainresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java index 363bcd6db50..960be8df577 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java @@ -37,7 +37,8 @@ import com.cloud.exception.DiscoveryException; import com.cloud.host.Host; import com.cloud.user.Account; -@APICommand(name = "addHost", description = "Adds a new host.", responseObject = HostResponse.class) +@APICommand(name = "addHost", description = "Adds a new host.", responseObject = HostResponse.class, + requestHasSensitiveInfo = true, responseHasSensitiveInfo = false) public class AddHostCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(AddHostCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java index b573bea3e84..9108d600419 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java @@ -31,7 +31,8 @@ import com.cloud.exception.DiscoveryException; import com.cloud.storage.ImageStore; import com.cloud.user.Account; -@APICommand(name = "addSecondaryStorage", description = "Adds secondary storage.", responseObject = ImageStoreResponse.class) +@APICommand(name = "addSecondaryStorage", description = "Adds secondary storage.", responseObject = ImageStoreResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AddSecondaryStorageCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(AddSecondaryStorageCmd.class.getName()); private static final String s_name = "addsecondarystorageresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java index 46289ee49bd..d23a7651bbc 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java @@ -32,7 +32,8 @@ import com.cloud.event.EventTypes; import com.cloud.host.Host; import com.cloud.user.Account; -@APICommand(name = "cancelHostMaintenance", description = "Cancels host maintenance.", responseObject = HostResponse.class) +@APICommand(name = "cancelHostMaintenance", description = "Cancels host maintenance.", responseObject = HostResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CancelMaintenanceCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(CancelMaintenanceCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java index 5a4478e21a3..b9945281296 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java @@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.user.Account; -@APICommand(name = "deleteHost", description = "Deletes a host.", responseObject = SuccessResponse.class) +@APICommand(name = "deleteHost", description = "Deletes a host.", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteHostCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeleteHostCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java index 0faf72cc245..dbb94384523 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java @@ -34,7 +34,8 @@ import com.cloud.host.Host; import com.cloud.utils.Pair; import com.cloud.utils.Ternary; -@APICommand(name = "findHostsForMigration", description = "Find hosts suitable for migrating a virtual machine.", responseObject = HostForMigrationResponse.class) +@APICommand(name = "findHostsForMigration", description = "Find hosts suitable for migrating a virtual machine.", responseObject = HostForMigrationResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class FindHostsForMigrationCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(FindHostsForMigrationCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java index eda821b0498..d7aa18bbfef 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java @@ -42,7 +42,8 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.utils.Pair; import com.cloud.utils.Ternary; -@APICommand(name = "listHosts", description = "Lists hosts.", responseObject = HostResponse.class) +@APICommand(name = "listHosts", description = "Lists hosts.", responseObject = HostResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListHostsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListHostsCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/PrepareForMaintenanceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/PrepareForMaintenanceCmd.java index 23cfacfa87a..e49aabc49d4 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/host/PrepareForMaintenanceCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/host/PrepareForMaintenanceCmd.java @@ -32,7 +32,8 @@ import com.cloud.event.EventTypes; import com.cloud.host.Host; import com.cloud.user.Account; -@APICommand(name = "prepareHostForMaintenance", description = "Prepares a host for maintenance.", responseObject = HostResponse.class) +@APICommand(name = "prepareHostForMaintenance", description = "Prepares a host for maintenance.", responseObject = HostResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class PrepareForMaintenanceCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(PrepareForMaintenanceCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java index 1ce888b1570..5e156372681 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java @@ -32,7 +32,8 @@ import com.cloud.event.EventTypes; import com.cloud.host.Host; import com.cloud.user.Account; -@APICommand(name = "reconnectHost", description = "Reconnects a host.", responseObject = HostResponse.class) +@APICommand(name = "reconnectHost", description = "Reconnects a host.", responseObject = HostResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ReconnectHostCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ReconnectHostCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/ReleaseHostReservationCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/ReleaseHostReservationCmd.java index b60feca5977..6aeff6312c9 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/host/ReleaseHostReservationCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/host/ReleaseHostReservationCmd.java @@ -32,7 +32,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.event.EventTypes; import com.cloud.user.Account; -@APICommand(name = "releaseHostReservation", description = "Releases host reservation.", responseObject = SuccessResponse.class) +@APICommand(name = "releaseHostReservation", description = "Releases host reservation.", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ReleaseHostReservationCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ReleaseHostReservationCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java index d778b37bed1..c6f6530dc50 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java @@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.HostResponse; import com.cloud.host.Host; import com.cloud.user.Account; -@APICommand(name = "updateHost", description = "Updates a host.", responseObject = HostResponse.class) +@APICommand(name = "updateHost", description = "Updates a host.", responseObject = HostResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateHostCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(UpdateHostCmd.class.getName()); private static final String s_name = "updatehostresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostPasswordCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostPasswordCmd.java index 69480b14f4b..94f58254896 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostPasswordCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostPasswordCmd.java @@ -28,7 +28,8 @@ import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.user.Account; -@APICommand(name = "updateHostPassword", description = "Update password of a host/pool on management server.", responseObject = SuccessResponse.class) +@APICommand(name = "updateHostPassword", description = "Update password of a host/pool on management server.", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = true, responseHasSensitiveInfo = false) public class UpdateHostPasswordCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(UpdateHostPasswordCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/internallb/ConfigureInternalLoadBalancerElementCmd.java b/api/src/org/apache/cloudstack/api/command/admin/internallb/ConfigureInternalLoadBalancerElementCmd.java index 51da7608dac..7e39749ff17 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/internallb/ConfigureInternalLoadBalancerElementCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/internallb/ConfigureInternalLoadBalancerElementCmd.java @@ -43,7 +43,9 @@ import com.cloud.user.Account; @APICommand(name = "configureInternalLoadBalancerElement", responseObject = InternalLoadBalancerElementResponse.class, description = "Configures an Internal Load Balancer element.", - since = "4.2.0") + since = "4.2.0", + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class ConfigureInternalLoadBalancerElementCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ConfigureInternalLoadBalancerElementCmd.class.getName()); private static final String s_name = "configureinternalloadbalancerelementresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/internallb/CreateInternalLoadBalancerElementCmd.java b/api/src/org/apache/cloudstack/api/command/admin/internallb/CreateInternalLoadBalancerElementCmd.java index a6ece720455..b9c61f3bf90 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/internallb/CreateInternalLoadBalancerElementCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/internallb/CreateInternalLoadBalancerElementCmd.java @@ -41,7 +41,9 @@ import com.cloud.user.Account; @APICommand(name = "createInternalLoadBalancerElement", responseObject = InternalLoadBalancerElementResponse.class, description = "Create an Internal Load Balancer element.", - since = "4.2.0") + since = "4.2.0", + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class CreateInternalLoadBalancerElementCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreateInternalLoadBalancerElementCmd.class.getName()); private static final String s_name = "createinternalloadbalancerelementresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLBVMsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLBVMsCmd.java index 1cec188cde4..e6ea5197782 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLBVMsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLBVMsCmd.java @@ -35,7 +35,8 @@ import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.network.router.VirtualRouter.Role; -@APICommand(name = "listInternalLoadBalancerVMs", description = "List internal LB VMs.", responseObject = DomainRouterResponse.class, entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "listInternalLoadBalancerVMs", description = "List internal LB VMs.", responseObject = DomainRouterResponse.class, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListInternalLBVMsCmd extends BaseListProjectAndAccountResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListInternalLBVMsCmd.class.getName()); @@ -134,6 +135,6 @@ public class ListInternalLBVMsCmd extends BaseListProjectAndAccountResourcesCmd public void execute() { ListResponse response = _queryService.searchForInternalLbVms(this); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLoadBalancerElementsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLoadBalancerElementsCmd.java index a42a0b306af..489b64325f6 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLoadBalancerElementsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLoadBalancerElementsCmd.java @@ -42,7 +42,9 @@ import com.cloud.network.VirtualRouterProvider; @APICommand(name = "listInternalLoadBalancerElements", description = "Lists all available Internal Load Balancer elements.", responseObject = InternalLoadBalancerElementResponse.class, - since = "4.2.0") + since = "4.2.0", + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class ListInternalLoadBalancerElementsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListInternalLoadBalancerElementsCmd.class.getName()); private static final String Name = "listinternalloadbalancerelementsresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java index b747c309b78..54d76216004 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java @@ -39,7 +39,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.router.VirtualRouter; import com.cloud.network.router.VirtualRouter.Role; -@APICommand(name = "startInternalLoadBalancerVM", responseObject = DomainRouterResponse.class, description = "Starts an existing internal lb vm.", entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "startInternalLoadBalancerVM", responseObject = DomainRouterResponse.class, description = "Starts an existing internal lb vm.", entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class StartInternalLBVMCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(StartInternalLBVMCmd.class.getName()); private static final String s_name = "startinternallbvmresponse"; @@ -116,7 +117,7 @@ public class StartInternalLBVMCmd extends BaseAsyncCmd { if (result != null) { DomainRouterResponse routerResponse = _responseGenerator.createDomainRouterResponse(result); routerResponse.setResponseName(getCommandName()); - this.setResponseObject(routerResponse); + setResponseObject(routerResponse); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to start internal lb vm"); } diff --git a/api/src/org/apache/cloudstack/api/command/admin/internallb/StopInternalLBVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/internallb/StopInternalLBVMCmd.java index f8a8b7bb111..aa946bee311 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/internallb/StopInternalLBVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/internallb/StopInternalLBVMCmd.java @@ -38,7 +38,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.router.VirtualRouter; import com.cloud.network.router.VirtualRouter.Role; -@APICommand(name = "stopInternalLoadBalancerVM", description = "Stops an Internal LB vm.", responseObject = DomainRouterResponse.class, entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "stopInternalLoadBalancerVM", description = "Stops an Internal LB vm.", responseObject = DomainRouterResponse.class, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class StopInternalLBVMCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(StopInternalLBVMCmd.class.getName()); private static final String s_name = "stopinternallbvmresponse"; @@ -118,7 +119,7 @@ public class StopInternalLBVMCmd extends BaseAsyncCmd { if (result != null) { DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to stop internal lb vm"); } diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkDeviceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkDeviceCmd.java index 7af93559b2e..68c43c449e2 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkDeviceCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkDeviceCmd.java @@ -41,7 +41,8 @@ import com.cloud.utils.exception.CloudRuntimeException; @APICommand(name = "addNetworkDevice", description = "Adds a network device of one of the following types: ExternalDhcp, ExternalFirewall, ExternalLoadBalancer, PxeServer", - responseObject = NetworkDeviceResponse.class) + responseObject = NetworkDeviceResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AddNetworkDeviceCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(AddNetworkDeviceCmd.class); private static final String s_name = "addnetworkdeviceresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java index f1904939969..bb87015da78 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java @@ -39,7 +39,9 @@ import com.cloud.user.Account; @APICommand(name = "addNetworkServiceProvider", description = "Adds a network serviceProvider to a physical network", responseObject = ProviderResponse.class, - since = "3.0.0") + since = "3.0.0", + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class AddNetworkServiceProviderCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(AddNetworkServiceProviderCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java index 5614295f905..cbc1936697e 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java @@ -41,7 +41,8 @@ import com.cloud.offering.NetworkOffering; import com.cloud.offering.NetworkOffering.Availability; import com.cloud.user.Account; -@APICommand(name = "createNetworkOffering", description = "Creates a network offering.", responseObject = NetworkOfferingResponse.class, since = "3.0.0") +@APICommand(name = "createNetworkOffering", description = "Creates a network offering.", responseObject = NetworkOfferingResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateNetworkOfferingCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(CreateNetworkOfferingCmd.class.getName()); private static final String Name = "createnetworkofferingresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java index de4e5e55253..c691a18c835 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java @@ -37,7 +37,8 @@ import com.cloud.exception.ResourceAllocationException; import com.cloud.network.PhysicalNetwork; import com.cloud.user.Account; -@APICommand(name = "createPhysicalNetwork", description = "Creates a physical network", responseObject = PhysicalNetworkResponse.class, since = "3.0.0") +@APICommand(name = "createPhysicalNetwork", description = "Creates a physical network", responseObject = PhysicalNetworkResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreatePhysicalNetworkCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreatePhysicalNetworkCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/CreateStorageNetworkIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/CreateStorageNetworkIpRangeCmd.java index cfbbd36f354..e9fbc6dd62d 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/CreateStorageNetworkIpRangeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/CreateStorageNetworkIpRangeCmd.java @@ -38,7 +38,9 @@ import com.cloud.user.Account; @APICommand(name = "createStorageNetworkIpRange", description = "Creates a Storage network IP range.", responseObject = StorageNetworkIpRangeResponse.class, - since = "3.0.0") + since = "3.0.0", + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class CreateStorageNetworkIpRangeCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(CreateStorageNetworkIpRangeCmd.class); diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DedicateGuestVlanRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/DedicateGuestVlanRangeCmd.java index 51b49244544..2890c27be60 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/DedicateGuestVlanRangeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/DedicateGuestVlanRangeCmd.java @@ -36,7 +36,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.GuestVlan; import com.cloud.user.Account; -@APICommand(name = "dedicateGuestVlanRange", description = "Dedicates a guest vlan range to an account", responseObject = GuestVlanRangeResponse.class) +@APICommand(name = "dedicateGuestVlanRange", description = "Dedicates a guest vlan range to an account", responseObject = GuestVlanRangeResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DedicateGuestVlanRangeCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DedicateGuestVlanRangeCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkDeviceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkDeviceCmd.java index 96e4fa552b8..abd9c11e7f0 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkDeviceCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkDeviceCmd.java @@ -37,7 +37,8 @@ import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "deleteNetworkDevice", description = "Deletes network device.", responseObject = SuccessResponse.class) +@APICommand(name = "deleteNetworkDevice", description = "Deletes network device.", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteNetworkDeviceCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeleteNetworkDeviceCmd.class); private static final String s_name = "deletenetworkdeviceresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkOfferingCmd.java index 3aa7d664a52..62de3dd1752 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkOfferingCmd.java @@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.user.Account; -@APICommand(name = "deleteNetworkOffering", description = "Deletes a network offering.", responseObject = SuccessResponse.class, since = "3.0.0") +@APICommand(name = "deleteNetworkOffering", description = "Deletes a network offering.", responseObject = SuccessResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteNetworkOfferingCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeleteNetworkOfferingCmd.class.getName()); private static final String s_name = "deletenetworkofferingresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkServiceProviderCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkServiceProviderCmd.java index c4993c3f6e5..9df27d3e06c 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkServiceProviderCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkServiceProviderCmd.java @@ -33,7 +33,8 @@ import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.Account; -@APICommand(name = "deleteNetworkServiceProvider", description = "Deletes a Network Service Provider.", responseObject = SuccessResponse.class, since = "3.0.0") +@APICommand(name = "deleteNetworkServiceProvider", description = "Deletes a Network Service Provider.", responseObject = SuccessResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteNetworkServiceProviderCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteNetworkServiceProviderCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DeletePhysicalNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/DeletePhysicalNetworkCmd.java index 828683accfa..4d8c44628d3 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/DeletePhysicalNetworkCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/DeletePhysicalNetworkCmd.java @@ -32,7 +32,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.event.EventTypes; import com.cloud.user.Account; -@APICommand(name = "deletePhysicalNetwork", description = "Deletes a Physical Network.", responseObject = SuccessResponse.class, since = "3.0.0") +@APICommand(name = "deletePhysicalNetwork", description = "Deletes a Physical Network.", responseObject = SuccessResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeletePhysicalNetworkCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeletePhysicalNetworkCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteStorageNetworkIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteStorageNetworkIpRangeCmd.java index 42c96190507..c4317278af6 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteStorageNetworkIpRangeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteStorageNetworkIpRangeCmd.java @@ -34,7 +34,8 @@ import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.Account; -@APICommand(name = "deleteStorageNetworkIpRange", description = "Deletes a storage network IP Range.", responseObject = SuccessResponse.class, since = "3.0.0") +@APICommand(name = "deleteStorageNetworkIpRange", description = "Deletes a storage network IP Range.", responseObject = SuccessResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteStorageNetworkIpRangeCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteStorageNetworkIpRangeCmd.class); diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListDedicatedGuestVlanRangesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ListDedicatedGuestVlanRangesCmd.java index ca7c1f70173..9b1935c1d5a 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/ListDedicatedGuestVlanRangesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListDedicatedGuestVlanRangesCmd.java @@ -36,7 +36,8 @@ import com.cloud.network.GuestVlan; import com.cloud.user.Account; import com.cloud.utils.Pair; -@APICommand(name = "listDedicatedGuestVlanRanges", description = "Lists dedicated guest vlan ranges", responseObject = GuestVlanRangeResponse.class) +@APICommand(name = "listDedicatedGuestVlanRanges", description = "Lists dedicated guest vlan ranges", responseObject = GuestVlanRangeResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListDedicatedGuestVlanRangesCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListDedicatedGuestVlanRangesCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkDeviceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkDeviceCmd.java index de175d079b7..405c2654bdf 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkDeviceCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkDeviceCmd.java @@ -42,7 +42,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.host.Host; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "listNetworkDevice", description = "List network devices", responseObject = NetworkDeviceResponse.class) +@APICommand(name = "listNetworkDevice", description = "List network devices", responseObject = NetworkDeviceResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListNetworkDeviceCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListNetworkDeviceCmd.class); private static final String s_name = "listnetworkdevice"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkIsolationMethodsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkIsolationMethodsCmd.java index d30f7b8f588..8242df94025 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkIsolationMethodsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkIsolationMethodsCmd.java @@ -29,7 +29,9 @@ import com.cloud.network.Networks; @APICommand(name = "listNetworkIsolationMethods", description = "Lists supported methods of network isolation", responseObject = IsolationMethodResponse.class, - since = "4.2.0") + since = "4.2.0", + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class ListNetworkIsolationMethodsCmd extends BaseListCmd { private static final String s_name = "listnetworkisolationmethodsresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkServiceProvidersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkServiceProvidersCmd.java index 5a1235b7b61..94b859716e4 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkServiceProvidersCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkServiceProvidersCmd.java @@ -36,7 +36,9 @@ import com.cloud.utils.Pair; @APICommand(name = "listNetworkServiceProviders", description = "Lists network serviceproviders for a given physical network.", responseObject = ProviderResponse.class, - since = "3.0.0") + since = "3.0.0", + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class ListNetworkServiceProvidersCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListNetworkServiceProvidersCmd.class.getName()); private static final String Name = "listnetworkserviceprovidersresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java index 3ac2faaacd9..e495fd6a398 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java @@ -35,7 +35,8 @@ import com.cloud.network.PhysicalNetwork; import com.cloud.user.Account; import com.cloud.utils.Pair; -@APICommand(name = "listPhysicalNetworks", description = "Lists physical networks", responseObject = PhysicalNetworkResponse.class, since = "3.0.0") +@APICommand(name = "listPhysicalNetworks", description = "Lists physical networks", responseObject = PhysicalNetworkResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListPhysicalNetworksCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListPhysicalNetworksCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java index 89cba471041..b3f8b8197a4 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java @@ -39,7 +39,8 @@ import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.Account; -@APICommand(name = "listStorageNetworkIpRange", description = "List a storage network IP range.", responseObject = StorageNetworkIpRangeResponse.class, since = "3.0.0") +@APICommand(name = "listStorageNetworkIpRange", description = "List a storage network IP range.", responseObject = StorageNetworkIpRangeResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListStorageNetworkIpRangeCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListStorageNetworkIpRangeCmd.class); diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListSupportedNetworkServicesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ListSupportedNetworkServicesCmd.java index 342f9b04d88..612c733a34b 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/ListSupportedNetworkServicesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListSupportedNetworkServicesCmd.java @@ -36,7 +36,9 @@ import com.cloud.user.Account; @APICommand(name = "listSupportedNetworkServices", description = "Lists all network services provided by CloudStack or for the given Provider.", responseObject = ServiceResponse.class, - since = "3.0.0") + since = "3.0.0", + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class ListSupportedNetworkServicesCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListSupportedNetworkServicesCmd.class.getName()); private static final String Name = "listsupportednetworkservicesresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedGuestVlanRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedGuestVlanRangeCmd.java index 43e1149a1ec..263d46a7509 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedGuestVlanRangeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedGuestVlanRangeCmd.java @@ -33,7 +33,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.event.EventTypes; import com.cloud.user.Account; -@APICommand(name = "releaseDedicatedGuestVlanRange", description = "Releases a dedicated guest vlan range to the system", responseObject = SuccessResponse.class) +@APICommand(name = "releaseDedicatedGuestVlanRange", description = "Releases a dedicated guest vlan range to the system", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ReleaseDedicatedGuestVlanRangeCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ReleaseDedicatedGuestVlanRangeCmd.class.getName()); private static final String s_name = "releasededicatedguestvlanrangeresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java index 957450f78f7..f650b4ffb04 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java @@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.NetworkOfferingResponse; import com.cloud.offering.NetworkOffering; import com.cloud.user.Account; -@APICommand(name = "updateNetworkOffering", description = "Updates a network offering.", responseObject = NetworkOfferingResponse.class) +@APICommand(name = "updateNetworkOffering", description = "Updates a network offering.", responseObject = NetworkOfferingResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateNetworkOfferingCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(UpdateNetworkOfferingCmd.class.getName()); private static final String Name = "updatenetworkofferingresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java index c530c53b7f3..bb4f64e0400 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java @@ -36,7 +36,9 @@ import com.cloud.user.Account; @APICommand(name = "updateNetworkServiceProvider", description = "Updates a network serviceProvider of a physical network", responseObject = ProviderResponse.class, - since = "3.0.0") + since = "3.0.0", + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class UpdateNetworkServiceProviderCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(UpdateNetworkServiceProviderCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdatePhysicalNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/UpdatePhysicalNetworkCmd.java index f808424fc86..8e29c393813 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/UpdatePhysicalNetworkCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/UpdatePhysicalNetworkCmd.java @@ -31,7 +31,8 @@ import com.cloud.event.EventTypes; import com.cloud.network.PhysicalNetwork; import com.cloud.user.Account; -@APICommand(name = "updatePhysicalNetwork", description = "Updates a physical network", responseObject = PhysicalNetworkResponse.class, since = "3.0.0") +@APICommand(name = "updatePhysicalNetwork", description = "Updates a physical network", responseObject = PhysicalNetworkResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdatePhysicalNetworkCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(UpdatePhysicalNetworkCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java index 9fd084a104f..d82c28d1bff 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java @@ -37,7 +37,9 @@ import com.cloud.user.Account; @APICommand(name = "updateStorageNetworkIpRange", description = "Update a Storage network IP range, only allowed when no IPs in this range have been allocated.", responseObject = StorageNetworkIpRangeResponse.class, - since = "3.0.0") + since = "3.0.0", + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class UpdateStorageNetworkIpRangeCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(UpdateStorageNetworkIpRangeCmd.class); private static final String s_name = "updatestoragenetworkiprangeresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java index 1d959a0589b..84c2c25d9fa 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java @@ -31,7 +31,8 @@ import com.cloud.offering.DiskOffering; import com.cloud.offering.ServiceOffering; import com.cloud.user.Account; -@APICommand(name = "createDiskOffering", description = "Creates a disk offering.", responseObject = DiskOfferingResponse.class) +@APICommand(name = "createDiskOffering", description = "Creates a disk offering.", responseObject = DiskOfferingResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateDiskOfferingCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(CreateDiskOfferingCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java index 6f9693cbcb0..1d8cbff9307 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java @@ -33,7 +33,8 @@ import org.apache.cloudstack.api.response.ServiceOfferingResponse; import com.cloud.offering.ServiceOffering; import com.cloud.user.Account; -@APICommand(name = "createServiceOffering", description = "Creates a service offering.", responseObject = ServiceOfferingResponse.class) +@APICommand(name = "createServiceOffering", description = "Creates a service offering.", responseObject = ServiceOfferingResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateServiceOfferingCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(CreateServiceOfferingCmd.class.getName()); private static final String Name = "createserviceofferingresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteDiskOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteDiskOfferingCmd.java index 9845aa49e2b..8987d50066e 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteDiskOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteDiskOfferingCmd.java @@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.user.Account; -@APICommand(name = "deleteDiskOffering", description = "Updates a disk offering.", responseObject = SuccessResponse.class) +@APICommand(name = "deleteDiskOffering", description = "Updates a disk offering.", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteDiskOfferingCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeleteDiskOfferingCmd.class.getName()); private static final String s_name = "deletediskofferingresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java index 0f81409d264..2a07fff9b15 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java @@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.user.Account; -@APICommand(name = "deleteServiceOffering", description = "Deletes a service offering.", responseObject = SuccessResponse.class) +@APICommand(name = "deleteServiceOffering", description = "Deletes a service offering.", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteServiceOfferingCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeleteServiceOfferingCmd.class.getName()); private static final String s_name = "deleteserviceofferingresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java index 6d45fb5d55d..6e1fde55a30 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java @@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.DiskOfferingResponse; import com.cloud.offering.DiskOffering; import com.cloud.user.Account; -@APICommand(name = "updateDiskOffering", description = "Updates a disk offering.", responseObject = DiskOfferingResponse.class) +@APICommand(name = "updateDiskOffering", description = "Updates a disk offering.", responseObject = DiskOfferingResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateDiskOfferingCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(UpdateDiskOfferingCmd.class.getName()); private static final String s_name = "updatediskofferingresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java index fbc88450fea..f4f4bdfac88 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java @@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.ServiceOfferingResponse; import com.cloud.offering.ServiceOffering; import com.cloud.user.Account; -@APICommand(name = "updateServiceOffering", description = "Updates a service offering.", responseObject = ServiceOfferingResponse.class) +@APICommand(name = "updateServiceOffering", description = "Updates a service offering.", responseObject = ServiceOfferingResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateServiceOfferingCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(UpdateServiceOfferingCmd.class.getName()); private static final String s_name = "updateserviceofferingresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java b/api/src/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java index 835a3b98bc4..d912b44132f 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java @@ -30,7 +30,8 @@ import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.dc.Pod; import com.cloud.user.Account; -@APICommand(name = "createPod", description = "Creates a new Pod.", responseObject = PodResponse.class) +@APICommand(name = "createPod", description = "Creates a new Pod.", responseObject = PodResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreatePodCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(CreatePodCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java b/api/src/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java index 584eed41e7d..c2edacba353 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java @@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.user.Account; -@APICommand(name = "deletePod", description = "Deletes a Pod.", responseObject = SuccessResponse.class) +@APICommand(name = "deletePod", description = "Deletes a Pod.", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeletePodCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeletePodCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java b/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java index 75b5efd2fab..3cc03f24d7c 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java @@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.dc.Pod; import com.cloud.utils.Pair; -@APICommand(name = "listPods", description = "Lists all Pods.", responseObject = PodResponse.class) +@APICommand(name = "listPods", description = "Lists all Pods.", responseObject = PodResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListPodsByCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListPodsByCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java b/api/src/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java index 7b8f6eb0f97..c89694c56bb 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java @@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.PodResponse; import com.cloud.dc.Pod; import com.cloud.user.Account; -@APICommand(name = "updatePod", description = "Updates a Pod.", responseObject = PodResponse.class) +@APICommand(name = "updatePod", description = "Updates a Pod.", responseObject = PodResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdatePodCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(UpdatePodCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java index 9e7c035bb9d..f6743baf625 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java @@ -32,7 +32,8 @@ import org.apache.cloudstack.region.RegionService; import com.cloud.user.Account; -@APICommand(name = "addRegion", description = "Adds a Region", responseObject = RegionResponse.class) +@APICommand(name = "addRegion", description = "Adds a Region", responseObject = RegionResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AddRegionCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(AddRegionCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/CreatePortableIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/CreatePortableIpRangeCmd.java index e900f47476f..955bb9c292c 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/region/CreatePortableIpRangeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/region/CreatePortableIpRangeCmd.java @@ -38,7 +38,9 @@ import com.cloud.user.Account; @APICommand(name = "createPortableIpRange", responseObject = PortableIpRangeResponse.class, description = "adds a range of portable public IP's to a region", - since = "4.2.0") + since = "4.2.0", + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class CreatePortableIpRangeCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreatePortableIpRangeCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java index 5408eda5658..413818b8242 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java @@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.event.EventTypes; import com.cloud.user.Account; -@APICommand(name = "deletePortableIpRange", description = "deletes a range of portable public IP's associated with a region", responseObject = SuccessResponse.class) +@APICommand(name = "deletePortableIpRange", description = "deletes a range of portable public IP's associated with a region", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeletePortableIpRangeCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeletePortableIpRangeCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/ListPortableIpRangesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/ListPortableIpRangesCmd.java index 42a92e62873..100572ef5ad 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/region/ListPortableIpRangesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/region/ListPortableIpRangesCmd.java @@ -33,7 +33,8 @@ import org.apache.cloudstack.region.PortableIpRange; import com.cloud.user.Account; -@APICommand(name = "listPortableIpRanges", description = "list portable IP ranges", responseObject = PortableIpRangeResponse.class) +@APICommand(name = "listPortableIpRanges", description = "list portable IP ranges", responseObject = PortableIpRangeResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListPortableIpRangesCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListPortableIpRangesCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/RemoveRegionCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/RemoveRegionCmd.java index e9126595f9f..415456f9414 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/region/RemoveRegionCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/region/RemoveRegionCmd.java @@ -31,7 +31,8 @@ import org.apache.cloudstack.region.RegionService; import com.cloud.user.Account; -@APICommand(name = "removeRegion", description = "Removes specified region", responseObject = SuccessResponse.class) +@APICommand(name = "removeRegion", description = "Removes specified region", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class RemoveRegionCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(RemoveRegionCmd.class.getName()); private static final String s_name = "removeregionresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java index 527e142ee8b..b08cbbbb10c 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java @@ -32,7 +32,8 @@ import org.apache.cloudstack.region.RegionService; import com.cloud.user.Account; -@APICommand(name = "updateRegion", description = "Updates a region", responseObject = RegionResponse.class) +@APICommand(name = "updateRegion", description = "Updates a region", responseObject = RegionResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateRegionCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(UpdateRegionCmd.class.getName()); private static final String s_name = "updateregionresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/ArchiveAlertsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/resource/ArchiveAlertsCmd.java index b1177b9e3eb..79b3520b0b4 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/resource/ArchiveAlertsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/resource/ArchiveAlertsCmd.java @@ -33,7 +33,8 @@ import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.exception.InvalidParameterValueException; import com.cloud.user.Account; -@APICommand(name = "archiveAlerts", description = "Archive one or more alerts.", responseObject = SuccessResponse.class) +@APICommand(name = "archiveAlerts", description = "Archive one or more alerts.", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ArchiveAlertsCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(ArchiveAlertsCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/CleanVMReservationsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/resource/CleanVMReservationsCmd.java index edc3bcf42d0..9acc71ce693 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/resource/CleanVMReservationsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/resource/CleanVMReservationsCmd.java @@ -28,7 +28,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.event.EventTypes; import com.cloud.user.Account; -@APICommand(name = "cleanVMReservations", description = "Cleanups VM reservations in the database.", responseObject = SuccessResponse.class) +@APICommand(name = "cleanVMReservations", description = "Cleanups VM reservations in the database.", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CleanVMReservationsCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(CleanVMReservationsCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/DeleteAlertsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/resource/DeleteAlertsCmd.java index 8ba25251a70..246b25785b3 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/resource/DeleteAlertsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/resource/DeleteAlertsCmd.java @@ -33,7 +33,8 @@ import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.exception.InvalidParameterValueException; import com.cloud.user.Account; -@APICommand(name = "deleteAlerts", description = "Delete one or more alerts.", responseObject = SuccessResponse.class) +@APICommand(name = "deleteAlerts", description = "Delete one or more alerts.", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteAlertsCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeleteAlertsCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java index 397b00a034e..8f21263b85c 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java @@ -30,7 +30,8 @@ import org.apache.log4j.Logger; import com.cloud.alert.Alert; import com.cloud.utils.Pair; -@APICommand(name = "listAlerts", description = "Lists all alerts.", responseObject = AlertResponse.class) +@APICommand(name = "listAlerts", description = "Lists all alerts.", responseObject = AlertResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListAlertsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListAlertsCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java b/api/src/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java index 2b0f82715aa..d79ff07fbcc 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java @@ -34,7 +34,8 @@ import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.capacity.Capacity; import com.cloud.exception.InvalidParameterValueException; -@APICommand(name = "listCapacity", description = "Lists all the system wide capacities.", responseObject = CapacityResponse.class) +@APICommand(name = "listCapacity", description = "Lists all the system wide capacities.", responseObject = CapacityResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListCapacityCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListCapacityCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java b/api/src/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java index 68ef5accb17..e11876a6816 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java @@ -31,7 +31,8 @@ import com.cloud.user.Account; @APICommand(name = "uploadCustomCertificate", responseObject = CustomCertificateResponse.class, - description = "Uploads a custom certificate for the console proxy VMs to use for SSL. Can be used to upload a single certificate signed by a known CA. Can also be used, through multiple calls, to upload a chain of certificates from CA to the custom certificate itself.") + description = "Uploads a custom certificate for the console proxy VMs to use for SSL. Can be used to upload a single certificate signed by a known CA. Can also be used, through multiple calls, to upload a chain of certificates from CA to the custom certificate itself.", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UploadCustomCertificateCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(UploadCustomCertificateCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureOvsElementCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureOvsElementCmd.java index 75b08b1fab5..7577f2eb884 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureOvsElementCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureOvsElementCmd.java @@ -39,7 +39,8 @@ import com.cloud.network.OvsProvider; import com.cloud.network.element.VirtualRouterElementService; import com.cloud.user.Account; -@APICommand(name = "configureOvsElement", responseObject = OvsProviderResponse.class, description = "Configures an ovs element.") +@APICommand(name = "configureOvsElement", responseObject = OvsProviderResponse.class, description = "Configures an ovs element.", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ConfigureOvsElementCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger .getLogger(ConfigureOvsElementCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java index 2cfefda8c40..b8fafb63a6f 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java @@ -40,7 +40,8 @@ import com.cloud.network.VirtualRouterProvider; import com.cloud.network.element.VirtualRouterElementService; import com.cloud.user.Account; -@APICommand(name = "configureVirtualRouterElement", responseObject = VirtualRouterProviderResponse.class, description = "Configures a virtual router element.") +@APICommand(name = "configureVirtualRouterElement", responseObject = VirtualRouterProviderResponse.class, description = "Configures a virtual router element.", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ConfigureVirtualRouterElementCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ConfigureVirtualRouterElementCmd.class.getName()); private static final String s_name = "configurevirtualrouterelementresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java index bf5eb188a01..f43b143d4ec 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java @@ -40,7 +40,8 @@ import com.cloud.network.VirtualRouterProvider.Type; import com.cloud.network.element.VirtualRouterElementService; import com.cloud.user.Account; -@APICommand(name = "createVirtualRouterElement", responseObject = VirtualRouterProviderResponse.class, description = "Create a virtual router element.") +@APICommand(name = "createVirtualRouterElement", responseObject = VirtualRouterProviderResponse.class, description = "Create a virtual router element.", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreateVirtualRouterElementCmd.class.getName()); private static final String s_name = "createvirtualrouterelementresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java index 462219e40d9..26440d4be96 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java @@ -35,7 +35,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.router.VirtualRouter; import com.cloud.user.Account; -@APICommand(name = "destroyRouter", description = "Destroys a router.", responseObject = DomainRouterResponse.class, entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "destroyRouter", description = "Destroys a router.", responseObject = DomainRouterResponse.class, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DestroyRouterCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DestroyRouterCmd.class.getName()); private static final String s_name = "destroyrouterresponse"; @@ -103,7 +104,7 @@ public class DestroyRouterCmd extends BaseAsyncCmd { if (result != null) { DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to destroy router"); } diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ListOvsElementsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/ListOvsElementsCmd.java index d5f73fd742a..75c69564188 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/ListOvsElementsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/ListOvsElementsCmd.java @@ -39,7 +39,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.OvsProvider; import com.cloud.network.element.VirtualRouterElementService; -@APICommand(name = "listOvsElements", description = "Lists all available ovs elements.", responseObject = OvsProviderResponse.class) +@APICommand(name = "listOvsElements", description = "Lists all available ovs elements.", responseObject = OvsProviderResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListOvsElementsCmd extends BaseListCmd { public static final Logger s_logger = Logger .getLogger(ListNetworkOfferingsCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java index c0e54c8bd80..d55a5f3ed9c 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java @@ -36,7 +36,8 @@ import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.network.router.VirtualRouter.Role; -@APICommand(name = "listRouters", description = "List routers.", responseObject = DomainRouterResponse.class, entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "listRouters", description = "List routers.", responseObject = DomainRouterResponse.class, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListRoutersCmd.class.getName()); @@ -149,6 +150,6 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd { public void execute() { ListResponse response = _queryService.searchForRouters(this); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ListVirtualRouterElementsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/ListVirtualRouterElementsCmd.java index 6f1792145be..62c6da5ee25 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/ListVirtualRouterElementsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/ListVirtualRouterElementsCmd.java @@ -40,7 +40,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.VirtualRouterProvider; import com.cloud.network.element.VirtualRouterElementService; -@APICommand(name = "listVirtualRouterElements", description = "Lists all available virtual router elements.", responseObject = VirtualRouterProviderResponse.class) +@APICommand(name = "listVirtualRouterElements", description = "Lists all available virtual router elements.", responseObject = VirtualRouterProviderResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListVirtualRouterElementsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListNetworkOfferingsCmd.class.getName()); private static final String Name = "listvirtualrouterelementsresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java index f4200c57026..3a8938812b3 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java @@ -36,7 +36,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.router.VirtualRouter; import com.cloud.user.Account; -@APICommand(name = "rebootRouter", description = "Starts a router.", responseObject = DomainRouterResponse.class, entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "rebootRouter", description = "Starts a router.", responseObject = DomainRouterResponse.class, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class RebootRouterCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(RebootRouterCmd.class.getName()); private static final String s_name = "rebootrouterresponse"; @@ -98,11 +99,11 @@ public class RebootRouterCmd extends BaseAsyncCmd { @Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { CallContext.current().setEventDetails("Router Id: " + getId()); - VirtualRouter result = _routerService.rebootRouter(this.getId(), true); + VirtualRouter result = _routerService.rebootRouter(getId(), true); if (result != null) { DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result); response.setResponseName("router"); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reboot router"); } diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java index 0c553be6a0c..f83466b1dcd 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java @@ -38,7 +38,8 @@ import com.cloud.network.router.VirtualRouter; import com.cloud.network.router.VirtualRouter.Role; import com.cloud.user.Account; -@APICommand(name = "startRouter", responseObject = DomainRouterResponse.class, description = "Starts a router.", entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "startRouter", responseObject = DomainRouterResponse.class, description = "Starts a router.", entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class StartRouterCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(StartRouterCmd.class.getName()); private static final String s_name = "startrouterresponse"; @@ -114,7 +115,7 @@ public class StartRouterCmd extends BaseAsyncCmd { if (result != null) { DomainRouterResponse routerResponse = _responseGenerator.createDomainRouterResponse(result); routerResponse.setResponseName(getCommandName()); - this.setResponseObject(routerResponse); + setResponseObject(routerResponse); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to start router"); } diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java index 9472e4a94a9..e2d420073d2 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java @@ -37,7 +37,8 @@ import com.cloud.network.router.VirtualRouter; import com.cloud.network.router.VirtualRouter.Role; import com.cloud.user.Account; -@APICommand(name = "stopRouter", description = "Stops a router.", responseObject = DomainRouterResponse.class, entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "stopRouter", description = "Stops a router.", responseObject = DomainRouterResponse.class, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class StopRouterCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(StopRouterCmd.class.getName()); private static final String s_name = "stoprouterresponse"; @@ -117,7 +118,7 @@ public class StopRouterCmd extends BaseAsyncCmd { if (result != null) { DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to stop router"); } diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java index e414fc93d10..0b67db9cefc 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java @@ -31,7 +31,8 @@ import org.apache.cloudstack.api.response.ServiceOfferingResponse; import com.cloud.network.router.VirtualRouter; import com.cloud.user.Account; -@APICommand(name = "changeServiceForRouter", description = "Upgrades domain router to a new service offering", responseObject = DomainRouterResponse.class, entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "changeServiceForRouter", description = "Upgrades domain router to a new service offering", responseObject = DomainRouterResponse.class, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpgradeRouterCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(UpgradeRouterCmd.class.getName()); private static final String s_name = "changeserviceforrouterresponse"; @@ -87,7 +88,7 @@ public class UpgradeRouterCmd extends BaseCmd { if (router != null) { DomainRouterResponse routerResponse = _responseGenerator.createDomainRouterResponse(router); routerResponse.setResponseName(getCommandName()); - this.setResponseObject(routerResponse); + setResponseObject(routerResponse); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade router"); } diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterTemplateCmd.java index 49477452142..65d26cc7f96 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterTemplateCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterTemplateCmd.java @@ -40,7 +40,8 @@ import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.Account; -@APICommand(name = "upgradeRouterTemplate", description = "Upgrades router to use newer template", responseObject = BaseResponse.class) +@APICommand(name = "upgradeRouterTemplate", description = "Upgrades router to use newer template", responseObject = BaseResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpgradeRouterTemplateCmd extends org.apache.cloudstack.api.BaseCmd { public static final Logger s_logger = Logger.getLogger(UpgradeRouterTemplateCmd.class.getName()); private static final String s_name = "upgraderoutertemplateresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java index 5e5bd3dcde5..6b673cf6322 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java @@ -36,7 +36,8 @@ import com.cloud.exception.DiscoveryException; import com.cloud.storage.ImageStore; import com.cloud.user.Account; -@APICommand(name = "addImageStore", description = "Adds backup image store.", responseObject = ImageStoreResponse.class, since = "4.2.0") +@APICommand(name = "addImageStore", description = "Adds backup image store.", responseObject = ImageStoreResponse.class, since = "4.2.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AddImageStoreCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(AddImageStoreCmd.class.getName()); private static final String s_name = "addimagestoreresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/AddS3Cmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/AddS3Cmd.java index 32897e4d59d..8a82e89d7a3 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/AddS3Cmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/AddS3Cmd.java @@ -52,7 +52,8 @@ import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.storage.ImageStore; -@APICommand(name = "addS3", description = "Adds S3", responseObject = ImageStoreResponse.class, since = "4.0.0") +@APICommand(name = "addS3", description = "Adds S3", responseObject = ImageStoreResponse.class, since = "4.0.0", + requestHasSensitiveInfo = true, responseHasSensitiveInfo = false) public final class AddS3Cmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(AddS3Cmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java index b1c55944638..91348ecf6b0 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java @@ -33,7 +33,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.storage.StoragePool; import com.cloud.user.Account; -@APICommand(name = "cancelStorageMaintenance", description = "Cancels maintenance for primary storage", responseObject = StoragePoolResponse.class) +@APICommand(name = "cancelStorageMaintenance", description = "Cancels maintenance for primary storage", responseObject = StoragePoolResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CancelPrimaryStorageMaintenanceCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(CancelPrimaryStorageMaintenanceCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/CreateSecondaryStagingStoreCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/CreateSecondaryStagingStoreCmd.java index 1480e75c063..39ec6098516 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/CreateSecondaryStagingStoreCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/CreateSecondaryStagingStoreCmd.java @@ -37,7 +37,8 @@ import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.storage.ImageStore; import com.cloud.user.Account; -@APICommand(name = "createSecondaryStagingStore", description = "create secondary staging store.", responseObject = ImageStoreResponse.class) +@APICommand(name = "createSecondaryStagingStore", description = "create secondary staging store.", responseObject = ImageStoreResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateSecondaryStagingStoreCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(AddImageStoreCmd.class.getName()); private static final String s_name = "createsecondarystagingstoreresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java index dfd00266835..ae44bc93732 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java @@ -38,7 +38,8 @@ import com.cloud.storage.StoragePool; import com.cloud.user.Account; @SuppressWarnings("rawtypes") -@APICommand(name = "createStoragePool", description = "Creates a storage pool.", responseObject = StoragePoolResponse.class) +@APICommand(name = "createStoragePool", description = "Creates a storage pool.", responseObject = StoragePoolResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateStoragePoolCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(CreateStoragePoolCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/DeleteImageStoreCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/DeleteImageStoreCmd.java index 602da8350e9..669c0ec7b81 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/DeleteImageStoreCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/DeleteImageStoreCmd.java @@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.user.Account; -@APICommand(name = "deleteImageStore", description = "Deletes an image store .", responseObject = SuccessResponse.class, since = "4.2.0") +@APICommand(name = "deleteImageStore", description = "Deletes an image store .", responseObject = SuccessResponse.class, since = "4.2.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteImageStoreCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeleteImageStoreCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/DeletePoolCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/DeletePoolCmd.java index fb63daa51d2..5465fd1440f 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/DeletePoolCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/DeletePoolCmd.java @@ -31,7 +31,8 @@ import com.cloud.storage.StoragePool; import com.cloud.storage.StoragePoolStatus; import com.cloud.user.Account; -@APICommand(name = "deleteStoragePool", description = "Deletes a storage pool.", responseObject = SuccessResponse.class) +@APICommand(name = "deleteStoragePool", description = "Deletes a storage pool.", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeletePoolCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeletePoolCmd.class.getName()); private static final String s_name = "deletestoragepoolresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/DeleteSecondaryStagingStoreCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/DeleteSecondaryStagingStoreCmd.java index caf937fed00..16398623359 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/DeleteSecondaryStagingStoreCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/DeleteSecondaryStagingStoreCmd.java @@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.user.Account; -@APICommand(name = "deleteSecondaryStagingStore", description = "Deletes a secondary staging store .", responseObject = SuccessResponse.class, since = "4.2.0") +@APICommand(name = "deleteSecondaryStagingStore", description = "Deletes a secondary staging store .", responseObject = SuccessResponse.class, since = "4.2.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteSecondaryStagingStoreCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeleteSecondaryStagingStoreCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/FindStoragePoolsForMigrationCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/FindStoragePoolsForMigrationCmd.java index 10813cadc04..47fa965e7dd 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/FindStoragePoolsForMigrationCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/FindStoragePoolsForMigrationCmd.java @@ -33,7 +33,8 @@ import org.apache.cloudstack.api.response.VolumeResponse; import com.cloud.storage.StoragePool; import com.cloud.utils.Pair; -@APICommand(name = "findStoragePoolsForMigration", description = "Lists storage pools available for migration of a volume.", responseObject = StoragePoolResponse.class) +@APICommand(name = "findStoragePoolsForMigration", description = "Lists storage pools available for migration of a volume.", responseObject = StoragePoolResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class FindStoragePoolsForMigrationCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(FindStoragePoolsForMigrationCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/ListImageStoresCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/ListImageStoresCmd.java index bf470844e68..8c37c78c763 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/ListImageStoresCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/ListImageStoresCmd.java @@ -26,7 +26,8 @@ import org.apache.cloudstack.api.response.ImageStoreResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.ZoneResponse; -@APICommand(name = "listImageStores", description = "Lists image stores.", responseObject = ImageStoreResponse.class, since = "4.2.0") +@APICommand(name = "listImageStores", description = "Lists image stores.", responseObject = ImageStoreResponse.class, since = "4.2.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListImageStoresCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListImageStoresCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/ListS3sCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/ListS3sCmd.java index 362d69ef6fc..c1889e72a0b 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/ListS3sCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/ListS3sCmd.java @@ -30,7 +30,8 @@ import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -@APICommand(name = "listS3s", description = "Lists S3s", responseObject = ImageStoreResponse.class, since = "4.0.0") +@APICommand(name = "listS3s", description = "Lists S3s", responseObject = ImageStoreResponse.class, since = "4.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListS3sCmd extends BaseListCmd { private static final String COMMAND_NAME = "lists3sresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/ListSecondaryStagingStoresCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/ListSecondaryStagingStoresCmd.java index 171f9714aef..e315c8a6d47 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/ListSecondaryStagingStoresCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/ListSecondaryStagingStoresCmd.java @@ -26,7 +26,8 @@ import org.apache.cloudstack.api.response.ImageStoreResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.ZoneResponse; -@APICommand(name = "listSecondaryStagingStores", description = "Lists secondary staging stores.", responseObject = ImageStoreResponse.class, since = "4.2.0") +@APICommand(name = "listSecondaryStagingStores", description = "Lists secondary staging stores.", responseObject = ImageStoreResponse.class, since = "4.2.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListSecondaryStagingStoresCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListSecondaryStagingStoresCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java index 868b402b9db..ed123dbb6c3 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java @@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.PodResponse; import org.apache.cloudstack.api.response.StoragePoolResponse; import org.apache.cloudstack.api.response.ZoneResponse; -@APICommand(name = "listStoragePools", description = "Lists storage pools.", responseObject = StoragePoolResponse.class) +@APICommand(name = "listStoragePools", description = "Lists storage pools.", responseObject = StoragePoolResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListStoragePoolsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListStoragePoolsCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/ListStorageProvidersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/ListStorageProvidersCmd.java index bac6b7c46ac..3e960ee84a8 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/ListStorageProvidersCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/ListStorageProvidersCmd.java @@ -37,7 +37,8 @@ import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -@APICommand(name = "listStorageProviders", description = "Lists storage providers.", responseObject = StorageProviderResponse.class) +@APICommand(name = "listStorageProviders", description = "Lists storage providers.", responseObject = StorageProviderResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListStorageProvidersCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListStorageProvidersCmd.class.getName()); private static final String s_name = "liststorageprovidersresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java index 9d1196648ce..cf5fdf66c64 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java @@ -34,7 +34,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.storage.StoragePool; import com.cloud.user.Account; -@APICommand(name = "enableStorageMaintenance", description = "Puts storage pool into maintenance state", responseObject = StoragePoolResponse.class) +@APICommand(name = "enableStorageMaintenance", description = "Puts storage pool into maintenance state", responseObject = StoragePoolResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class PreparePrimaryStorageForMaintenanceCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(PreparePrimaryStorageForMaintenanceCmd.class.getName()); private static final String s_name = "prepareprimarystorageformaintenanceresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateCloudToUseObjectStoreCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateCloudToUseObjectStoreCmd.java index 983a01c7fbe..a99c5e5d75c 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateCloudToUseObjectStoreCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateCloudToUseObjectStoreCmd.java @@ -35,7 +35,8 @@ import com.cloud.exception.DiscoveryException; import com.cloud.storage.ImageStore; import com.cloud.user.Account; -@APICommand(name = "updateCloudToUseObjectStore", description = "Migrate current NFS secondary storages to use object store.", responseObject = ImageStoreResponse.class, since = "4.3.0") +@APICommand(name = "updateCloudToUseObjectStore", description = "Migrate current NFS secondary storages to use object store.", responseObject = ImageStoreResponse.class, since = "4.3.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateCloudToUseObjectStoreCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(UpdateCloudToUseObjectStoreCmd.class.getName()); private static final String s_name = "updatecloudtouseobjectstoreresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java index 50be6ba13f7..3d1a7735325 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java @@ -31,7 +31,8 @@ import org.apache.cloudstack.api.response.StoragePoolResponse; import com.cloud.storage.StoragePool; import com.cloud.user.Account; -@APICommand(name = "updateStoragePool", description = "Updates a storage pool.", responseObject = StoragePoolResponse.class, since = "3.0.0") +@APICommand(name = "updateStoragePool", description = "Updates a storage pool.", responseObject = StoragePoolResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateStoragePoolCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(UpdateStoragePoolCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java b/api/src/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java index 173c95e2c0d..19a84252dd7 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java @@ -33,7 +33,8 @@ import com.cloud.exception.DiscoveryException; import com.cloud.storage.ImageStore; import com.cloud.user.Account; -@APICommand(name = "addSwift", description = "Adds Swift.", responseObject = ImageStoreResponse.class, since = "3.0.0") +@APICommand(name = "addSwift", description = "Adds Swift.", responseObject = ImageStoreResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AddSwiftCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(AddSwiftCmd.class.getName()); private static final String s_name = "addswiftresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/swift/ListSwiftsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/swift/ListSwiftsCmd.java index fcc8e465903..f80cfab4bdd 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/swift/ListSwiftsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/swift/ListSwiftsCmd.java @@ -28,7 +28,8 @@ import org.apache.cloudstack.api.response.ListResponse; import com.cloud.user.Account; -@APICommand(name = "listSwifts", description = "List Swift.", responseObject = ImageStoreResponse.class, since = "3.0.0") +@APICommand(name = "listSwifts", description = "List Swift.", responseObject = ImageStoreResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListSwiftsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListSwiftsCmd.class.getName()); private static final String s_name = "listswiftsresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java index 24687ec29d9..bc977a456ee 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java @@ -35,7 +35,8 @@ import com.cloud.event.EventTypes; import com.cloud.user.Account; import com.cloud.vm.VirtualMachine; -@APICommand(name = "destroySystemVm", responseObject = SystemVmResponse.class, description = "Destroyes a system virtual machine.", entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "destroySystemVm", responseObject = SystemVmResponse.class, description = "Destroyes a system virtual machine.", entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DestroySystemVmCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DestroySystemVmCmd.class.getName()); @@ -104,7 +105,7 @@ public class DestroySystemVmCmd extends BaseAsyncCmd { if (instance != null) { SystemVmResponse response = _responseGenerator.createSystemVmResponse(instance); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to destroy system vm"); } diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java index 6add394ee1e..bfecd1857fd 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java @@ -37,7 +37,8 @@ import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.utils.Pair; import com.cloud.vm.VirtualMachine; -@APICommand(name = "listSystemVms", description = "List system virtual machines.", responseObject = SystemVmResponse.class, entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "listSystemVms", description = "List system virtual machines.", responseObject = SystemVmResponse.class, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListSystemVMsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListSystemVMsCmd.class.getName()); @@ -140,6 +141,6 @@ public class ListSystemVMsCmd extends BaseListCmd { response.setResponses(vmResponses, systemVMs.second()); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java index 44a55866141..994635a1b7f 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java @@ -41,7 +41,8 @@ import com.cloud.host.Host; import com.cloud.user.Account; import com.cloud.vm.VirtualMachine; -@APICommand(name = "migrateSystemVm", description = "Attempts Migration of a system virtual machine to the host specified.", responseObject = SystemVmResponse.class, entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "migrateSystemVm", description = "Attempts Migration of a system virtual machine to the host specified.", responseObject = SystemVmResponse.class, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class MigrateSystemVMCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(MigrateSystemVMCmd.class.getName()); @@ -122,7 +123,7 @@ public class MigrateSystemVMCmd extends BaseAsyncCmd { // return the generic system VM instance response SystemVmResponse response = _responseGenerator.createSystemVmResponse(migratedVm); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate the system vm"); } diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java index 68c941c2418..0031d60351c 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java @@ -35,7 +35,8 @@ import com.cloud.event.EventTypes; import com.cloud.user.Account; import com.cloud.vm.VirtualMachine; -@APICommand(name = "rebootSystemVm", description = "Reboots a system VM.", responseObject = SystemVmResponse.class, entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "rebootSystemVm", description = "Reboots a system VM.", responseObject = SystemVmResponse.class, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class RebootSystemVmCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(RebootSystemVmCmd.class.getName()); @@ -111,7 +112,7 @@ public class RebootSystemVmCmd extends BaseAsyncCmd { if (result != null) { SystemVmResponse response = _responseGenerator.createSystemVmResponse(result); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to reboot system vm"); } diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java index c220e2a83bd..f50b2c4b2c6 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java @@ -21,6 +21,8 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; +import org.apache.log4j.Logger; + import org.apache.cloudstack.acl.IAMEntityType; import org.apache.cloudstack.acl.SecurityChecker.AccessType; import org.apache.cloudstack.api.ACL; @@ -34,7 +36,6 @@ import org.apache.cloudstack.api.command.user.vm.UpgradeVMCmd; import org.apache.cloudstack.api.response.ServiceOfferingResponse; import org.apache.cloudstack.api.response.SystemVmResponse; import org.apache.cloudstack.context.CallContext; -import org.apache.log4j.Logger; import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; @@ -47,7 +48,8 @@ import com.cloud.user.Account; import com.cloud.vm.VirtualMachine; @APICommand(name = "scaleSystemVm", responseObject = SystemVmResponse.class, description = "Scale the service offering for a system vm (console proxy or secondary storage). " - + "The system vm must be in a \"Stopped\" state for " + "this command to take effect.", entityType = { IAMEntityType.VirtualMachine }) + + "The system vm must be in a \"Stopped\" state for " + "this command to take effect.", entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ScaleSystemVMCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(UpgradeVMCmd.class.getName()); private static final String s_name = "changeserviceforsystemvmresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java index ce6a47fa935..6aecc9117c9 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java @@ -35,7 +35,8 @@ import com.cloud.event.EventTypes; import com.cloud.user.Account; import com.cloud.vm.VirtualMachine; -@APICommand(name = "startSystemVm", responseObject = SystemVmResponse.class, description = "Starts a system virtual machine.", entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "startSystemVm", responseObject = SystemVmResponse.class, description = "Starts a system virtual machine.", entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class StartSystemVMCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(StartSystemVMCmd.class.getName()); @@ -115,7 +116,7 @@ public class StartSystemVMCmd extends BaseAsyncCmd { if (instance != null) { SystemVmResponse response = _responseGenerator.createSystemVmResponse(instance); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to start system vm"); } diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java index d5e5f009444..9a049c2afe4 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java @@ -37,7 +37,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.Account; import com.cloud.vm.VirtualMachine; -@APICommand(name = "stopSystemVm", description = "Stops a system VM.", responseObject = SystemVmResponse.class, entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "stopSystemVm", description = "Stops a system VM.", responseObject = SystemVmResponse.class, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class StopSystemVmCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(StopSystemVmCmd.class.getName()); @@ -121,7 +122,7 @@ public class StopSystemVmCmd extends BaseAsyncCmd { if (result != null) { SystemVmResponse response = _responseGenerator.createSystemVmResponse(result); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to stop system vm"); } diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java index c12d6b057a2..033709aca45 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java @@ -21,6 +21,8 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; +import org.apache.log4j.Logger; + import org.apache.cloudstack.acl.IAMEntityType; import org.apache.cloudstack.acl.SecurityChecker.AccessType; import org.apache.cloudstack.api.ACL; @@ -34,7 +36,6 @@ import org.apache.cloudstack.api.command.user.vm.UpgradeVMCmd; import org.apache.cloudstack.api.response.ServiceOfferingResponse; import org.apache.cloudstack.api.response.SystemVmResponse; import org.apache.cloudstack.context.CallContext; -import org.apache.log4j.Logger; import com.cloud.exception.InvalidParameterValueException; import com.cloud.offering.ServiceOffering; @@ -42,7 +43,8 @@ import com.cloud.user.Account; import com.cloud.vm.VirtualMachine; @APICommand(name = "changeServiceForSystemVm", responseObject = SystemVmResponse.class, description = "Changes the service offering for a system vm (console proxy or secondary storage). " - + "The system vm must be in a \"Stopped\" state for " + "this command to take effect.", entityType = { IAMEntityType.VirtualMachine }) + + "The system vm must be in a \"Stopped\" state for " + "this command to take effect.", entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpgradeSystemVMCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(UpgradeVMCmd.class.getName()); private static final String s_name = "changeserviceforsystemvmresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java index af214e0a228..ce432430e16 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java @@ -35,7 +35,8 @@ import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.Account; -@APICommand(name = "prepareTemplate", responseObject = TemplateResponse.class, description = "load template into primary storage", entityType = { IAMEntityType.VirtualMachineTemplate }) +@APICommand(name = "prepareTemplate", responseObject = TemplateResponse.class, description = "load template into primary storage", entityType = {IAMEntityType.VirtualMachineTemplate}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class PrepareTemplateCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(PrepareTemplateCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficMonitorCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficMonitorCmd.java index 031fc8d752a..e0d755518f9 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficMonitorCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficMonitorCmd.java @@ -32,7 +32,8 @@ import com.cloud.host.Host; import com.cloud.user.Account; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "addTrafficMonitor", description = "Adds Traffic Monitor Host for Direct Network Usage", responseObject = TrafficMonitorResponse.class) +@APICommand(name = "addTrafficMonitor", description = "Adds Traffic Monitor Host for Direct Network Usage", responseObject = TrafficMonitorResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AddTrafficMonitorCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(AddTrafficMonitorCmd.class.getName()); private static final String s_name = "addtrafficmonitorresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java index 0fcb8f87e54..a71d5bb6c26 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java @@ -34,7 +34,8 @@ import com.cloud.exception.ResourceAllocationException; import com.cloud.network.PhysicalNetworkTrafficType; import com.cloud.user.Account; -@APICommand(name = "addTrafficType", description = "Adds traffic type to a physical network", responseObject = TrafficTypeResponse.class, since = "3.0.0") +@APICommand(name = "addTrafficType", description = "Adds traffic type to a physical network", responseObject = TrafficTypeResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AddTrafficTypeCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(AddTrafficTypeCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficMonitorCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficMonitorCmd.java index debaf0030f1..4c2bac23a17 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficMonitorCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficMonitorCmd.java @@ -30,7 +30,8 @@ import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.exception.InvalidParameterValueException; import com.cloud.user.Account; -@APICommand(name = "deleteTrafficMonitor", description = "Deletes an traffic monitor host.", responseObject = SuccessResponse.class) +@APICommand(name = "deleteTrafficMonitor", description = "Deletes an traffic monitor host.", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteTrafficMonitorCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeleteTrafficMonitorCmd.class.getName()); private static final String s_name = "deletetrafficmonitorresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java index 111e1774268..46383cca725 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java @@ -31,7 +31,8 @@ import org.apache.cloudstack.api.response.TrafficTypeResponse; import com.cloud.event.EventTypes; import com.cloud.user.Account; -@APICommand(name = "deleteTrafficType", description = "Deletes traffic type of a physical network", responseObject = SuccessResponse.class, since = "3.0.0") +@APICommand(name = "deleteTrafficType", description = "Deletes traffic type of a physical network", responseObject = SuccessResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteTrafficTypeCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteTrafficTypeCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/GenerateUsageRecordsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/GenerateUsageRecordsCmd.java index 4fc36ab5582..184f88aed24 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/usage/GenerateUsageRecordsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/GenerateUsageRecordsCmd.java @@ -33,7 +33,9 @@ import com.cloud.user.Account; @APICommand(name = "generateUsageRecords", description = "Generates usage records. This will generate records only if there any records to be generated, i.e if the scheduled usage job was not run or failed", - responseObject = SuccessResponse.class) + responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class GenerateUsageRecordsCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(GenerateUsageRecordsCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java index a8bd1e52358..21a7e4a1b06 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java @@ -35,7 +35,8 @@ import org.apache.cloudstack.usage.Usage; import com.cloud.utils.Pair; -@APICommand(name = "listUsageRecords", description = "Lists usage records for accounts", responseObject = UsageRecordResponse.class) +@APICommand(name = "listUsageRecords", description = "Lists usage records for accounts", responseObject = UsageRecordResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class GetUsageRecordsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(GetUsageRecordsCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficMonitorsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficMonitorsCmd.java index 3592539aab4..4c398633f14 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficMonitorsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficMonitorsCmd.java @@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.host.Host; -@APICommand(name = "listTrafficMonitors", description = "List traffic monitor Hosts.", responseObject = TrafficMonitorResponse.class) +@APICommand(name = "listTrafficMonitors", description = "List traffic monitor Hosts.", responseObject = TrafficMonitorResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListTrafficMonitorsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListServiceOfferingsCmd.class.getName()); private static final String s_name = "listtrafficmonitorsresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypeImplementorsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypeImplementorsCmd.java index 159608ec589..a1ff29fd007 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypeImplementorsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypeImplementorsCmd.java @@ -40,7 +40,9 @@ import com.cloud.utils.Pair; @APICommand(name = "listTrafficTypeImplementors", description = "Lists implementors of implementor of a network traffic type or implementors of all network traffic types", responseObject = TrafficTypeImplementorResponse.class, - since = "3.0.0") + since = "3.0.0", + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class ListTrafficTypeImplementorsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListTrafficTypeImplementorsCmd.class); private static final String Name = "listtraffictypeimplementorsresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypesCmd.java index 47ba781cdef..33ee29611de 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypesCmd.java @@ -34,7 +34,8 @@ import com.cloud.network.PhysicalNetworkTrafficType; import com.cloud.user.Account; import com.cloud.utils.Pair; -@APICommand(name = "listTrafficTypes", description = "Lists traffic types of a given physical network.", responseObject = ProviderResponse.class, since = "3.0.0") +@APICommand(name = "listTrafficTypes", description = "Lists traffic types of a given physical network.", responseObject = ProviderResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListTrafficTypesCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListTrafficTypesCmd.class.getName()); private static final String Name = "listtraffictypesresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/ListUsageTypesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/ListUsageTypesCmd.java index b5e445bbb53..2c5a7866cbb 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/usage/ListUsageTypesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/ListUsageTypesCmd.java @@ -27,7 +27,8 @@ import org.apache.cloudstack.api.response.UsageTypeResponse; import com.cloud.user.Account; -@APICommand(name = "listUsageTypes", description = "List Usage Types", responseObject = UsageTypeResponse.class) +@APICommand(name = "listUsageTypes", description = "List Usage Types", responseObject = UsageTypeResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListUsageTypesCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(ListUsageTypesCmd.class.getName()); private static final String s_name = "listusagetypesresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java index 2ad470ea761..3de8905fa95 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java @@ -31,7 +31,8 @@ import com.cloud.event.EventTypes; import com.cloud.network.PhysicalNetworkTrafficType; import com.cloud.user.Account; -@APICommand(name = "updateTrafficType", description = "Updates traffic type of a physical network", responseObject = TrafficTypeResponse.class, since = "3.0.0") +@APICommand(name = "updateTrafficType", description = "Updates traffic type of a physical network", responseObject = TrafficTypeResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateTrafficTypeCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(UpdateTrafficTypeCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java index 13c61a82286..24c0fce0ca0 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java @@ -31,7 +31,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.user.Account; import com.cloud.user.User; -@APICommand(name = "createUser", description = "Creates a user for an account that already exists", responseObject = UserResponse.class) +@APICommand(name = "createUser", description = "Creates a user for an account that already exists", responseObject = UserResponse.class, + requestHasSensitiveInfo = true, responseHasSensitiveInfo = true) public class CreateUserCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(CreateUserCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java index 6ba382aec71..08ba521ed62 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java @@ -34,7 +34,8 @@ import org.apache.cloudstack.region.RegionService; import com.cloud.user.Account; import com.cloud.user.User; -@APICommand(name = "deleteUser", description = "Deletes a user for an account", responseObject = SuccessResponse.class) +@APICommand(name = "deleteUser", description = "Deletes a user for an account", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteUserCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeleteUserCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java index 599328d1c35..c6e09ef0f9e 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java @@ -36,7 +36,8 @@ import com.cloud.user.Account; import com.cloud.user.User; import com.cloud.user.UserAccount; -@APICommand(name = "disableUser", description = "Disables a user account", responseObject = UserResponse.class) +@APICommand(name = "disableUser", description = "Disables a user account", responseObject = UserResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class DisableUserCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DisableUserCmd.class.getName()); private static final String s_name = "disableuserresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java index 8d37eda36e9..d69eccf9342 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java @@ -34,7 +34,8 @@ import com.cloud.user.Account; import com.cloud.user.User; import com.cloud.user.UserAccount; -@APICommand(name = "enableUser", description = "Enables a user account", responseObject = UserResponse.class) +@APICommand(name = "enableUser", description = "Enables a user account", responseObject = UserResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class EnableUserCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(EnableUserCmd.class.getName()); private static final String s_name = "enableuserresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java index 592b8285727..b2c6734c9e6 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java @@ -27,7 +27,8 @@ import org.apache.cloudstack.api.response.UserResponse; import com.cloud.exception.InvalidParameterValueException; import com.cloud.user.UserAccount; -@APICommand(name = "getUser", description = "Find user account by API key", responseObject = UserResponse.class) +@APICommand(name = "getUser", description = "Find user account by API key", responseObject = UserResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class GetUserCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(GetUserCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java index 41d6acda1f4..c0c2b24814a 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java @@ -25,7 +25,8 @@ import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.UserResponse; -@APICommand(name = "listUsers", description = "Lists user accounts", responseObject = UserResponse.class) +@APICommand(name = "listUsers", description = "Lists user accounts", responseObject = UserResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class ListUsersCmd extends BaseListAccountResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListUsersCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java index 9533004907f..69623d013d4 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java @@ -30,7 +30,8 @@ import com.cloud.user.Account; import com.cloud.user.User; import com.cloud.user.UserAccount; -@APICommand(name = "lockUser", description = "Locks a user account", responseObject = UserResponse.class) +@APICommand(name = "lockUser", description = "Locks a user account", responseObject = UserResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class LockUserCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(LockUserCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java index facdc876759..2090d21e4a6 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java @@ -30,7 +30,8 @@ import com.cloud.user.User; @APICommand(name = "registerUserKeys", responseObject = RegisterResponse.class, - description = "This command allows a user to register for the developer API, returning a secret key and an API key. This request is made through the integration API port, so it is a privileged command and must be made on behalf of a user. It is up to the implementer just how the username and password are entered, and then how that translates to an integration API request. Both secret key and API key should be returned to the user") + description = "This command allows a user to register for the developer API, returning a secret key and an API key. This request is made through the integration API port, so it is a privileged command and must be made on behalf of a user. It is up to the implementer just how the username and password are entered, and then how that translates to an integration API request. Both secret key and API key should be returned to the user", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class RegisterCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(RegisterCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java index de6e550018a..cf5d355e260 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java @@ -34,7 +34,8 @@ import com.cloud.user.Account; import com.cloud.user.User; import com.cloud.user.UserAccount; -@APICommand(name = "updateUser", description = "Updates a user account", responseObject = UserResponse.class) +@APICommand(name = "updateUser", description = "Updates a user account", responseObject = UserResponse.class, + requestHasSensitiveInfo = true, responseHasSensitiveInfo = true) public class UpdateUserCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(UpdateUserCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java index cd3dd7ea9bf..75edfce3f96 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java @@ -39,7 +39,8 @@ import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.Account; -@APICommand(name = "createVlanIpRange", description = "Creates a VLAN IP range.", responseObject = VlanIpRangeResponse.class) +@APICommand(name = "createVlanIpRange", description = "Creates a VLAN IP range.", responseObject = VlanIpRangeResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateVlanIpRangeCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(CreateVlanIpRangeCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/vlan/DedicatePublicIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vlan/DedicatePublicIpRangeCmd.java index 2650482e9bb..2cba8e69e45 100755 --- a/api/src/org/apache/cloudstack/api/command/admin/vlan/DedicatePublicIpRangeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vlan/DedicatePublicIpRangeCmd.java @@ -33,7 +33,8 @@ import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.Account; -@APICommand(name = "dedicatePublicIpRange", description = "Dedicates a Public IP range to an account", responseObject = VlanIpRangeResponse.class) +@APICommand(name = "dedicatePublicIpRange", description = "Dedicates a Public IP range to an account", responseObject = VlanIpRangeResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DedicatePublicIpRangeCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DedicatePublicIpRangeCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java index 8d291309f4d..af32fc4ebd7 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java @@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.VlanIpRangeResponse; import com.cloud.user.Account; -@APICommand(name = "deleteVlanIpRange", description = "Creates a VLAN IP range.", responseObject = SuccessResponse.class) +@APICommand(name = "deleteVlanIpRange", description = "Creates a VLAN IP range.", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteVlanIpRangeCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeleteVlanIpRangeCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java index 9d6eae66e76..d4f2d5ad611 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java @@ -37,7 +37,8 @@ import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.dc.Vlan; import com.cloud.utils.Pair; -@APICommand(name = "listVlanIpRanges", description = "Lists all VLAN IP ranges.", responseObject = VlanIpRangeResponse.class) +@APICommand(name = "listVlanIpRanges", description = "Lists all VLAN IP ranges.", responseObject = VlanIpRangeResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListVlanIpRangesCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListVlanIpRangesCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/vlan/ReleasePublicIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vlan/ReleasePublicIpRangeCmd.java index 2c160be3a73..15cfbc64e30 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vlan/ReleasePublicIpRangeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vlan/ReleasePublicIpRangeCmd.java @@ -29,7 +29,8 @@ import org.apache.cloudstack.api.response.VlanIpRangeResponse; import com.cloud.user.Account; -@APICommand(name = "releasePublicIpRange", description = "Releases a Public IP range back to the system pool", responseObject = SuccessResponse.class) +@APICommand(name = "releasePublicIpRange", description = "Releases a Public IP range back to the system pool", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ReleasePublicIpRangeCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(ReleasePublicIpRangeCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java index 71ababdd906..dd84ec2a602 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java @@ -39,7 +39,9 @@ import com.cloud.uservm.UserVm; @APICommand(name = "assignVirtualMachine", description = "Change ownership of a VM from one account to another. This API is available for Basic zones with security groups and Advanced zones with guest networks. A root administrator can reassign a VM from any account to any other account in any domain. A domain administrator can reassign a VM to any account in the same domain.", responseObject = UserVmResponse.class, - since = "3.0.0", entityType = { IAMEntityType.VirtualMachine }) + since = "3.0.0", entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = true) public class AssignVMCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(AssignVMCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/ExpungeVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vm/ExpungeVMCmd.java index 2fb6a1e07cf..623ddb6779b 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vm/ExpungeVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vm/ExpungeVMCmd.java @@ -40,7 +40,8 @@ import com.cloud.user.Account; import com.cloud.uservm.UserVm; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "expungeVirtualMachine", description = "Expunge a virtual machine. Once expunged, it cannot be recoverd.", responseObject = SuccessResponse.class, entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "expungeVirtualMachine", description = "Expunge a virtual machine. Once expunged, it cannot be recoverd.", responseObject = SuccessResponse.class, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ExpungeVMCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ExpungeVMCmd.class.getName()); @@ -109,7 +110,7 @@ public class ExpungeVMCmd extends BaseAsyncCmd { if (result != null) { SuccessResponse response = new SuccessResponse(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to expunge vm"); } diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/GetVMUserDataCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vm/GetVMUserDataCmd.java index 0e527149821..bf39f99519f 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vm/GetVMUserDataCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vm/GetVMUserDataCmd.java @@ -29,7 +29,8 @@ import org.apache.log4j.Logger; import com.cloud.user.Account; import com.cloud.uservm.UserVm; -@APICommand(name = "getVirtualMachineUserData", description = "Returns user data associated with the VM", responseObject = VMUserDataResponse.class, since = "4.4") +@APICommand(name = "getVirtualMachineUserData", description = "Returns user data associated with the VM", responseObject = VMUserDataResponse.class, since = "4.4", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class GetVMUserDataCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(GetVMUserDataCmd.class); private static final String s_name = "getvirtualmachineuserdataresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java index b3615fc061a..fe8446859c7 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java @@ -45,7 +45,9 @@ import com.cloud.vm.VirtualMachine; @APICommand(name = "migrateVirtualMachine", description = "Attempts Migration of a VM to a different host or Root volume of the vm to a different storage pool", - responseObject = UserVmResponse.class, entityType = { IAMEntityType.VirtualMachine }) + responseObject = UserVmResponse.class, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = true) public class MigrateVMCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(MigrateVMCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVirtualMachineWithVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVirtualMachineWithVolumeCmd.java index 4920250e6d8..b5d1ae93155 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVirtualMachineWithVolumeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVirtualMachineWithVolumeCmd.java @@ -47,7 +47,9 @@ import com.cloud.vm.VirtualMachine; @APICommand(name = "migrateVirtualMachineWithVolume", description = "Attempts Migration of a VM with its volumes to a different host", - responseObject = UserVmResponse.class, entityType = { IAMEntityType.VirtualMachine }) + responseObject = UserVmResponse.class, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = true) public class MigrateVirtualMachineWithVolumeCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(MigrateVMCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java index c7917b60c08..e7fbbdb7849 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java @@ -32,7 +32,8 @@ import com.cloud.exception.ResourceAllocationException; import com.cloud.user.Account; import com.cloud.uservm.UserVm; -@APICommand(name = "recoverVirtualMachine", description = "Recovers a virtual machine.", responseObject = UserVmResponse.class, entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "recoverVirtualMachine", description = "Recovers a virtual machine.", responseObject = UserVmResponse.class, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class RecoverVMCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(RecoverVMCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/volume/UpdateVolumeCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/volume/UpdateVolumeCmdByAdmin.java index 7e2acc50566..16b2d5db10e 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/volume/UpdateVolumeCmdByAdmin.java +++ b/api/src/org/apache/cloudstack/api/command/admin/volume/UpdateVolumeCmdByAdmin.java @@ -32,7 +32,8 @@ public class UpdateVolumeCmdByAdmin extends UpdateVolumeCmd { @Override public void execute(){ CallContext.current().setEventDetails("Volume Id: "+getId()); - Volume result = _volumeService.updateVolume(getId(), getPath(), getState(), getStorageId(), getDisplayVolume(), getCustomId(), getEntityOwnerId()); + Volume result = _volumeService.updateVolume(getId(), getPath(), getState(), getStorageId(), getDisplayVolume(), + getCustomId(), getEntityOwnerId(), getChainInfo()); if (result != null) { VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, result); response.setResponseName(getCommandName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java index 33c9c555245..ff88ada7815 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java @@ -43,7 +43,8 @@ import com.cloud.network.vpc.PrivateGateway; import com.cloud.network.vpc.Vpc; import com.cloud.user.Account; -@APICommand(name = "createPrivateGateway", description = "Creates a private gateway", responseObject = PrivateGatewayResponse.class, entityType = { IAMEntityType.PrivateGateway }) +@APICommand(name = "createPrivateGateway", description = "Creates a private gateway", responseObject = PrivateGatewayResponse.class, entityType = {IAMEntityType.PrivateGateway}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreatePrivateGatewayCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java index 96d5c6acece..6b2c4ba5cab 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java @@ -39,7 +39,8 @@ import com.cloud.exception.ResourceAllocationException; import com.cloud.network.vpc.VpcOffering; import com.cloud.user.Account; -@APICommand(name = "createVPCOffering", description = "Creates VPC offering", responseObject = VpcOfferingResponse.class) +@APICommand(name = "createVPCOffering", description = "Creates VPC offering", responseObject = VpcOfferingResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreateVPCOfferingCmd.class.getName()); private static final String Name = "createvpcofferingresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java index 27e71cf7737..dcce58e2272 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java @@ -37,7 +37,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.vpc.VpcGateway; import com.cloud.user.Account; -@APICommand(name = "deletePrivateGateway", description = "Deletes a Private gateway", responseObject = SuccessResponse.class, entityType = { IAMEntityType.PrivateGateway }) +@APICommand(name = "deletePrivateGateway", description = "Deletes a Private gateway", responseObject = SuccessResponse.class, entityType = {IAMEntityType.PrivateGateway}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeletePrivateGatewayCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeletePrivateGatewayCmd.class.getName()); private static final String s_name = "deleteprivategatewayresponse"; @@ -86,7 +87,7 @@ public class DeletePrivateGatewayCmd extends BaseAsyncCmd { boolean result = _vpcService.deleteVpcPrivateGateway(id); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete private gateway"); } diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java index 7abaa7d565c..0959f5f8c07 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java @@ -30,7 +30,8 @@ import org.apache.cloudstack.api.response.VpcOfferingResponse; import com.cloud.event.EventTypes; import com.cloud.user.Account; -@APICommand(name = "deleteVPCOffering", description = "Deletes VPC offering", responseObject = SuccessResponse.class) +@APICommand(name = "deleteVPCOffering", description = "Deletes VPC offering", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteVPCOfferingCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteVPCOfferingCmd.class.getName()); private static final String s_name = "deletevpcofferingresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/ListVPCsCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/ListVPCsCmdByAdmin.java index 8ba954c7516..3a95e44df45 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vpc/ListVPCsCmdByAdmin.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/ListVPCsCmdByAdmin.java @@ -36,10 +36,10 @@ public class ListVPCsCmdByAdmin extends ListVPCsCmd { @Override public void execute() { - List vpcs = _vpcService.listVpcs(getId(), getVpcName(), getDisplayText(), - getSupportedServices(), getCidr(), getVpcOffId(), getState(), getAccountName(), getDomainId(), - getKeyword(), getStartIndex(), getPageSizeVal(), getZoneId(), isRecursive(), - listAll(), getRestartRequired(), getTags(), getProjectId()); + List vpcs = + _vpcService.listVpcs(getId(), getVpcName(), getDisplayText(), getSupportedServices(), getCidr(), getVpcOffId(), getState(), getAccountName(), getDomainId(), + getKeyword(), getStartIndex(), getPageSizeVal(), getZoneId(), isRecursive(), listAll(), getRestartRequired(), getTags(), + getProjectId(), getDisplay()); ListResponse response = new ListResponse(); List offeringResponses = new ArrayList(); for (Vpc vpc : vpcs) { diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCCmdByAdmin.java index 372bb755e2d..b94cdcf8d20 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCCmdByAdmin.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCCmdByAdmin.java @@ -33,7 +33,7 @@ public class UpdateVPCCmdByAdmin extends UpdateVPCCmd { @Override public void execute(){ - Vpc result = _vpcService.updateVpc(getId(), getVpcName(), getDisplayText(), getCustomId()); + Vpc result = _vpcService.updateVpc(getId(), getVpcName(), getDisplayText(), getCustomId(), getDisplayVpc()); if (result != null) { VpcResponse response = _responseGenerator.createVpcResponse(ResponseView.Full, result); response.setResponseName(getCommandName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java index 3526b4b3ac9..8b05a7a5a20 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java @@ -30,7 +30,8 @@ import com.cloud.event.EventTypes; import com.cloud.network.vpc.VpcOffering; import com.cloud.user.Account; -@APICommand(name = "updateVPCOffering", description = "Updates VPC offering", responseObject = VpcOfferingResponse.class) +@APICommand(name = "updateVPCOffering", description = "Updates VPC offering", responseObject = VpcOfferingResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateVPCOfferingCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(UpdateVPCOfferingCmd.class.getName()); private static final String Name = "updatevpcofferingresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java b/api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java index 10ae55d4ede..414c058e66d 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java @@ -32,7 +32,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.dc.DataCenter; import com.cloud.user.Account; -@APICommand(name = "createZone", description = "Creates a Zone.", responseObject = ZoneResponse.class) +@APICommand(name = "createZone", description = "Creates a Zone.", responseObject = ZoneResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateZoneCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(CreateZoneCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java b/api/src/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java index 3e7462567e1..c7029b052ec 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java @@ -30,7 +30,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.user.Account; -@APICommand(name = "deleteZone", description = "Deletes a Zone.", responseObject = SuccessResponse.class) +@APICommand(name = "deleteZone", description = "Deletes a Zone.", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteZoneCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeleteZoneCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java index 5589e79b625..28a6d6ccc13 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java @@ -34,7 +34,8 @@ import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.event.EventTypes; import com.cloud.user.Account; -@APICommand(name = "markDefaultZoneForAccount", description = "Marks a default zone for this account", responseObject = AccountResponse.class, since = "4.0") +@APICommand(name = "markDefaultZoneForAccount", description = "Marks a default zone for this account", responseObject = AccountResponse.class, since = "4.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class MarkDefaultZoneForAccountCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(MarkDefaultZoneForAccountCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java b/api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java index 3a36d802197..9ad8972ecfd 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java @@ -34,7 +34,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.dc.DataCenter; import com.cloud.user.Account; -@APICommand(name = "updateZone", description = "Updates a Zone.", responseObject = ZoneResponse.class) +@APICommand(name = "updateZone", description = "Updates a Zone.", responseObject = ZoneResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateZoneCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(UpdateZoneCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java index 36df579d2a6..ef36038c5c4 100644 --- a/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java @@ -32,7 +32,8 @@ import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.projects.Project; -@APICommand(name = "addAccountToProject", description = "Adds acoount to a project", responseObject = SuccessResponse.class, since = "3.0.0") +@APICommand(name = "addAccountToProject", description = "Adds acoount to a project", responseObject = SuccessResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AddAccountToProjectCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(AddAccountToProjectCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java index f6aa36c2ea0..5c891733b5a 100644 --- a/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java @@ -33,7 +33,8 @@ import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.projects.Project; -@APICommand(name = "deleteAccountFromProject", description = "Deletes account from the project", responseObject = SuccessResponse.class, since = "3.0.0") +@APICommand(name = "deleteAccountFromProject", description = "Deletes account from the project", responseObject = SuccessResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteAccountFromProjectCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteProjectCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java b/api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java index 492dd5712d8..65331e4c4aa 100644 --- a/api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java @@ -27,7 +27,8 @@ import org.apache.cloudstack.api.ResponseObject.ResponseView; import org.apache.cloudstack.api.response.AccountResponse; import org.apache.cloudstack.api.response.ListResponse; -@APICommand(name = "listAccounts", description = "Lists accounts and provides detailed account information for listed accounts", responseObject = AccountResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.Account }) +@APICommand(name = "listAccounts", description = "Lists accounts and provides detailed account information for listed accounts", responseObject = AccountResponse.class, responseView = ResponseView.Restricted, entityType = {IAMEntityType.Account}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class ListAccountsCmd extends BaseListDomainResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListAccountsCmd.class.getName()); private static final String s_name = "listaccountsresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java b/api/src/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java index aa600166a6f..a70024edd51 100644 --- a/api/src/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java @@ -28,7 +28,8 @@ import org.apache.cloudstack.api.response.ProjectResponse; import com.cloud.user.Account; -@APICommand(name = "listProjectAccounts", description = "Lists project's accounts", responseObject = ProjectResponse.class, since = "3.0.0") +@APICommand(name = "listProjectAccounts", description = "Lists project's accounts", responseObject = ProjectResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListProjectAccountsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListProjectAccountsCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java b/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java index 12140116b62..3f0d2467bf3 100644 --- a/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java @@ -20,6 +20,7 @@ import java.util.List; import org.apache.log4j.Logger; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandJobType; import org.apache.cloudstack.api.ApiConstants; @@ -56,7 +57,8 @@ import com.cloud.offering.NetworkOffering; import com.cloud.projects.Project; import com.cloud.user.Account; -@APICommand(name = "associateIpAddress", description = "Acquires and associates a public IP to an account.", responseObject = IPAddressResponse.class, responseView = ResponseView.Restricted) +@APICommand(name = "associateIpAddress", description = "Acquires and associates a public IP to an account.", responseObject = IPAddressResponse.class, responseView = ResponseView.Restricted, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AssociateIPAddrCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(AssociateIPAddrCmd.class.getName()); private static final String s_name = "associateipaddressresponse"; @@ -104,6 +106,9 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd { description = "region ID from where portable ip is to be associated.") private Integer regionId; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the ip to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -196,6 +201,10 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd { } } + public Boolean getDisplayIp() { + return display; + } + @Override public long getEntityOwnerId() { Account caller = CallContext.current().getCallingAccount(); @@ -275,7 +284,7 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd { IpAddress ip = null; if (!isPortable()) { - ip = _networkService.allocateIP(_accountService.getAccount(getEntityOwnerId()), getZoneId(), getNetworkId()); + ip = _networkService.allocateIP(_accountService.getAccount(getEntityOwnerId()), getZoneId(), getNetworkId(), getDisplayIp()); } else { ip = _networkService.allocatePortableIP(_accountService.getAccount(getEntityOwnerId()), 1, getZoneId(), getNetworkId(), getVpcId()); } diff --git a/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java b/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java index e3669be4bb0..269fcb552b3 100644 --- a/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java @@ -36,7 +36,8 @@ import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.IpAddress; import com.cloud.user.Account; -@APICommand(name = "disassociateIpAddress", description = "Disassociates an ip address from the account.", responseObject = SuccessResponse.class) +@APICommand(name = "disassociateIpAddress", description = "Disassociates an ip address from the account.", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DisassociateIPAddrCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DisassociateIPAddrCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java b/api/src/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java index b9ac91b07c2..321871380da 100644 --- a/api/src/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java @@ -21,6 +21,7 @@ import java.util.List; import org.apache.log4j.Logger; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandJobType; import org.apache.cloudstack.api.ApiConstants; @@ -38,7 +39,8 @@ import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.network.IpAddress; import com.cloud.utils.Pair; -@APICommand(name = "listPublicIpAddresses", description = "Lists all public ip addresses", responseObject = IPAddressResponse.class, responseView = ResponseView.Restricted) +@APICommand(name = "listPublicIpAddresses", description = "Lists all public ip addresses", responseObject = IPAddressResponse.class, responseView = ResponseView.Restricted, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListPublicIpAddressesCmd extends BaseListTaggedResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListPublicIpAddressesCmd.class.getName()); @@ -90,6 +92,9 @@ public class ListPublicIpAddressesCmd extends BaseListTaggedResourcesCmd { @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "List ips belonging to the VPC") private Long vpcId; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -137,6 +142,14 @@ public class ListPublicIpAddressesCmd extends BaseListTaggedResourcesCmd { return vpcId; } + @Override + public Boolean getDisplay() { + if (display != null) { + return display; + } + return super.getDisplay(); + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/address/UpdateIPAddrCmd.java b/api/src/org/apache/cloudstack/api/command/user/address/UpdateIPAddrCmd.java index ea55dc4fc95..cc736d0d64a 100644 --- a/api/src/org/apache/cloudstack/api/command/user/address/UpdateIPAddrCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/address/UpdateIPAddrCmd.java @@ -18,6 +18,7 @@ package org.apache.cloudstack.api.command.user.address; import org.apache.log4j.Logger; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseAsyncCustomIdCmd; @@ -37,7 +38,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.IpAddress; import com.cloud.user.Account; -@APICommand(name = "updatePublicIpAddress", description = "Updates an ip address", responseObject = IPAddressResponse.class) +@APICommand(name = "updatePublicIpAddress", description = "Updates an ip address", responseObject = IPAddressResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateIPAddrCmd extends BaseAsyncCustomIdCmd { public static final Logger s_logger = Logger.getLogger(UpdateIPAddrCmd.class.getName()); private static final String s_name = "updateipaddressresponse"; @@ -53,6 +55,9 @@ public class UpdateIPAddrCmd extends BaseAsyncCustomIdCmd { @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, entityType = AccountResponse.class, expose = false) private Long ownerId; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the ip to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -65,6 +70,10 @@ public class UpdateIPAddrCmd extends BaseAsyncCustomIdCmd { return id; } + public Boolean getDisplayIp() { + return display; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// @@ -79,6 +88,7 @@ public class UpdateIPAddrCmd extends BaseAsyncCustomIdCmd { return ("Updating ip address with id=" + id); } + @Override public long getEntityOwnerId() { if (ownerId == null) { @@ -116,7 +126,7 @@ public class UpdateIPAddrCmd extends BaseAsyncCustomIdCmd { public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { - IpAddress result = _networkService.updateIP(getId(), getCustomId()); + IpAddress result = _networkService.updateIP(getId(), getCustomId(), getDisplayIp()); IPAddressResponse ipResponse = _responseGenerator.createIPAddressResponse(ResponseView.Restricted, result); ipResponse.setResponseName(getCommandName()); setResponseObject(ipResponse); diff --git a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/CreateAffinityGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/CreateAffinityGroupCmd.java index cf007871d6c..50573e96837 100644 --- a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/CreateAffinityGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/CreateAffinityGroupCmd.java @@ -35,7 +35,8 @@ import com.cloud.event.EventTypes; import com.cloud.exception.ResourceAllocationException; import com.cloud.user.Account; -@APICommand(name = "createAffinityGroup", responseObject = AffinityGroupResponse.class, description = "Creates an affinity/anti-affinity group", entityType = { IAMEntityType.AffinityGroup }) +@APICommand(name = "createAffinityGroup", responseObject = AffinityGroupResponse.class, description = "Creates an affinity/anti-affinity group", entityType = {IAMEntityType.AffinityGroup}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateAffinityGroupCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreateAffinityGroupCmd.class.getName()); @@ -126,7 +127,7 @@ public class CreateAffinityGroupCmd extends BaseAsyncCreateCmd { if (group != null) { AffinityGroupResponse response = _responseGenerator.createAffinityGroupResponse(group); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create affinity group:" + affinityGroupName); } diff --git a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/DeleteAffinityGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/DeleteAffinityGroupCmd.java index 27228896241..eb9145ccc4c 100644 --- a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/DeleteAffinityGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/DeleteAffinityGroupCmd.java @@ -37,7 +37,8 @@ import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.user.Account; -@APICommand(name = "deleteAffinityGroup", description = "Deletes affinity group", responseObject = SuccessResponse.class, entityType = { IAMEntityType.AffinityGroup }) +@APICommand(name = "deleteAffinityGroup", description = "Deletes affinity group", responseObject = SuccessResponse.class, entityType = {IAMEntityType.AffinityGroup}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteAffinityGroupCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteAffinityGroupCmd.class.getName()); private static final String s_name = "deleteaffinitygroupresponse"; @@ -132,7 +133,7 @@ public class DeleteAffinityGroupCmd extends BaseAsyncCmd { boolean result = _affinityGroupService.deleteAffinityGroup(id, accountName, domainId, name); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete affinity group"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupTypesCmd.java b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupTypesCmd.java index 87de7f7acbd..84ad0328463 100644 --- a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupTypesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupTypesCmd.java @@ -28,7 +28,8 @@ import org.apache.cloudstack.api.response.ListResponse; import com.cloud.user.Account; -@APICommand(name = "listAffinityGroupTypes", description = "Lists affinity group types available", responseObject = AffinityGroupTypeResponse.class) +@APICommand(name = "listAffinityGroupTypes", description = "Lists affinity group types available", responseObject = AffinityGroupTypeResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListAffinityGroupTypesCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListAffinityGroupTypesCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupsCmd.java b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupsCmd.java index 5e209dc7e84..e469eab2c1e 100644 --- a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupsCmd.java @@ -17,6 +17,7 @@ package org.apache.cloudstack.api.command.user.affinitygroup; import org.apache.log4j.Logger; + import org.apache.cloudstack.acl.IAMEntityType; import org.apache.cloudstack.affinity.AffinityGroupResponse; import org.apache.cloudstack.api.APICommand; @@ -27,7 +28,8 @@ import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.UserVmResponse; -@APICommand(name = "listAffinityGroups", description = "Lists affinity groups", responseObject = AffinityGroupResponse.class, entityType = { IAMEntityType.AffinityGroup }) +@APICommand(name = "listAffinityGroups", description = "Lists affinity groups", responseObject = AffinityGroupResponse.class, entityType = {IAMEntityType.AffinityGroup}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListAffinityGroupsCmd extends BaseListAccountResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListAffinityGroupsCmd.class.getName()); @@ -80,10 +82,10 @@ public class ListAffinityGroupsCmd extends BaseListAccountResourcesCmd { public void execute() { ListResponse response = _queryService.listAffinityGroups(id, affinityGroupName, - affinityGroupType, virtualMachineId, this.getAccountName(), this.getDomainId(), this.isRecursive(), - this.listAll(), this.getStartIndex(), this.getPageSizeVal(), this.getKeyword()); + affinityGroupType, virtualMachineId, getAccountName(), getDomainId(), isRecursive(), + listAll(), getStartIndex(), getPageSizeVal(), getKeyword()); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } diff --git a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/UpdateVMAffinityGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/UpdateVMAffinityGroupCmd.java index 75f01c11367..4bfcddb3a6d 100644 --- a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/UpdateVMAffinityGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/UpdateVMAffinityGroupCmd.java @@ -45,8 +45,14 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.Account; import com.cloud.uservm.UserVm; -@APICommand(name = "updateVMAffinityGroup", description = "Updates the affinity/anti-affinity group associations of a virtual machine. The VM has to be stopped and restarted for the " - + "new properties to take effect.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "updateVMAffinityGroup", + description = "Updates the affinity/anti-affinity group associations of a virtual machine. The VM has to be stopped and restarted for the " + + "new properties to take effect.", + responseObject = UserVmResponse.class, + responseView = ResponseView.Restricted, + entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = true) public class UpdateVMAffinityGroupCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(UpdateVMAffinityGroupCmd.class.getName()); private static final String s_name = "updatevirtualmachineresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java index e722a6ef9d4..8b5708d0727 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java @@ -40,7 +40,9 @@ import com.cloud.user.Account; @APICommand(name = "createAutoScalePolicy", description = "Creates an autoscale policy for a provision or deprovision action, the action is taken when the all the conditions evaluates to true for the specified duration. The policy is in effect once it is attached to a autscale vm group.", - responseObject = AutoScalePolicyResponse.class, entityType = { IAMEntityType.AutoScalePolicy }) + responseObject = AutoScalePolicyResponse.class, entityType = {IAMEntityType.AutoScalePolicy}, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class CreateAutoScalePolicyCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreateAutoScalePolicyCmd.class.getName()); @@ -164,15 +166,15 @@ public class CreateAutoScalePolicyCmd extends BaseAsyncCreateCmd { AutoScalePolicy result = _entityMgr.findById(AutoScalePolicy.class, getEntityId()); AutoScalePolicyResponse response = _responseGenerator.createAutoScalePolicyResponse(result); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } @Override public void create() throws ResourceAllocationException { AutoScalePolicy result = _autoScaleService.createAutoScalePolicy(this); if (result != null) { - this.setEntityId(result.getId()); - this.setEntityUuid(result.getUuid()); + setEntityId(result.getId()); + setEntityUuid(result.getUuid()); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create AutoScale Policy"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java index 65bbafa12f8..43a7f18189c 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java @@ -21,6 +21,7 @@ import java.util.List; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandJobType; import org.apache.cloudstack.api.ApiConstants; @@ -41,7 +42,9 @@ import com.cloud.network.rules.LoadBalancer; @APICommand(name = "createAutoScaleVmGroup", description = "Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.", - responseObject = AutoScaleVmGroupResponse.class, entityType = { IAMEntityType.AutoScaleVmGroup }) + responseObject = AutoScaleVmGroupResponse.class, entityType = { IAMEntityType.AutoScaleVmGroup }, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class CreateAutoScaleVmGroupCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreateAutoScaleVmGroupCmd.class.getName()); @@ -96,6 +99,9 @@ public class CreateAutoScaleVmGroupCmd extends BaseAsyncCreateCmd { description = "the autoscale profile that contains information about the vms in the vm group.") private long profileId; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the group to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + // /////////////////////////////////////////////////// // ///////////////// Accessors /////////////////////// // /////////////////////////////////////////////////// @@ -179,12 +185,16 @@ public class CreateAutoScaleVmGroupCmd extends BaseAsyncCreateCmd { return ApiCommandJobType.AutoScaleVmGroup; } + public Boolean getDisplay() { + return display; + } + @Override public void create() throws ResourceAllocationException { AutoScaleVmGroup result = _autoScaleService.createAutoScaleVmGroup(this); if (result != null) { - this.setEntityId(result.getId()); - this.setEntityUuid(result.getUuid()); + setEntityId(result.getId()); + setEntityUuid(result.getUuid()); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Autoscale Vm Group"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java index 617b3351e04..5d785938326 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java @@ -22,6 +22,7 @@ import java.util.Map; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandJobType; import org.apache.cloudstack.api.ApiConstants; @@ -45,7 +46,9 @@ import com.cloud.user.User; @APICommand(name = "createAutoScaleVmProfile", description = "Creates a profile that contains information about the virtual machine which will be provisioned automatically by autoscale feature.", - responseObject = AutoScaleVmProfileResponse.class, entityType = { IAMEntityType.AutoScaleVmProfile }) + responseObject = AutoScaleVmProfileResponse.class, entityType = { IAMEntityType.AutoScaleVmProfile }, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) @SuppressWarnings("rawtypes") public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreateAutoScaleVmProfileCmd.class.getName()); @@ -98,6 +101,9 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd { description = "the ID of the user used to launch and destroy the VMs") private Long autoscaleUserId; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the profile to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + private Map otherDeployParamMap; // /////////////////////////////////////////////////// @@ -126,6 +132,10 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd { return templateId; } + public Boolean getDisplay() { + return display; + } + public Map getCounterParamList() { return counterParamList; } @@ -236,7 +246,7 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd { AutoScaleVmProfile result = _entityMgr.findById(AutoScaleVmProfile.class, getEntityId()); AutoScaleVmProfileResponse response = _responseGenerator.createAutoScaleVmProfileResponse(result); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } @Override @@ -244,8 +254,8 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd { AutoScaleVmProfile result = _autoScaleService.createAutoScaleVmProfile(this); if (result != null) { - this.setEntityId(result.getId()); - this.setEntityUuid(result.getUuid()); + setEntityId(result.getId()); + setEntityUuid(result.getUuid()); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Autoscale Vm Profile"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java index f99aecca42d..a3358b29435 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java @@ -36,7 +36,8 @@ import com.cloud.event.EventTypes; import com.cloud.exception.ResourceAllocationException; import com.cloud.network.as.Condition; -@APICommand(name = "createCondition", description = "Creates a condition", responseObject = ConditionResponse.class, entityType = { IAMEntityType.Condition }) +@APICommand(name = "createCondition", description = "Creates a condition", responseObject = ConditionResponse.class, entityType = {IAMEntityType.Condition}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateConditionCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreateConditionCmd.class.getName()); private static final String s_name = "conditionresponse"; @@ -70,8 +71,8 @@ public class CreateConditionCmd extends BaseAsyncCreateCmd { condition = _autoScaleService.createCondition(this); if (condition != null) { - this.setEntityId(condition.getId()); - this.setEntityUuid(condition.getUuid()); + setEntityId(condition.getId()); + setEntityUuid(condition.getUuid()); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create condition."); } @@ -82,7 +83,7 @@ public class CreateConditionCmd extends BaseAsyncCreateCmd { Condition condition = _entityMgr.findById(Condition.class, getEntityId()); ConditionResponse response = _responseGenerator.createConditionResponse(condition); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } // ///////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java index 7d5741e4325..779ee0a392c 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java @@ -36,7 +36,8 @@ import com.cloud.event.EventTypes; import com.cloud.network.as.AutoScalePolicy; import com.cloud.user.Account; -@APICommand(name = "deleteAutoScalePolicy", description = "Deletes a autoscale policy.", responseObject = SuccessResponse.class, entityType = { IAMEntityType.AutoScalePolicy }) +@APICommand(name = "deleteAutoScalePolicy", description = "Deletes a autoscale policy.", responseObject = SuccessResponse.class, entityType = {IAMEntityType.AutoScalePolicy}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteAutoScalePolicyCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteAutoScalePolicyCmd.class.getName()); private static final String s_name = "deleteautoscalepolicyresponse"; @@ -97,7 +98,7 @@ public class DeleteAutoScalePolicyCmd extends BaseAsyncCmd { if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { s_logger.warn("Failed to delete autoscale policy " + getId()); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete AutoScale Policy"); diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java index c8d32bdb8f1..5a43abe8665 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java @@ -36,7 +36,8 @@ import com.cloud.event.EventTypes; import com.cloud.network.as.AutoScaleVmGroup; import com.cloud.user.Account; -@APICommand(name = "deleteAutoScaleVmGroup", description = "Deletes a autoscale vm group.", responseObject = SuccessResponse.class, entityType = { IAMEntityType.AutoScaleVmGroup }) +@APICommand(name = "deleteAutoScaleVmGroup", description = "Deletes a autoscale vm group.", responseObject = SuccessResponse.class, entityType = {IAMEntityType.AutoScaleVmGroup}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteAutoScaleVmGroupCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteAutoScaleVmGroupCmd.class.getName()); private static final String s_name = "deleteautoscalevmgroupresponse"; @@ -97,7 +98,7 @@ public class DeleteAutoScaleVmGroupCmd extends BaseAsyncCmd { if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { s_logger.warn("Failed to delete autoscale vm group " + getId()); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete autoscale vm group"); diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java index 79e0a170951..2391a938d83 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java @@ -36,7 +36,8 @@ import com.cloud.event.EventTypes; import com.cloud.network.as.AutoScaleVmProfile; import com.cloud.user.Account; -@APICommand(name = "deleteAutoScaleVmProfile", description = "Deletes a autoscale vm profile.", responseObject = SuccessResponse.class, entityType = { IAMEntityType.AutoScaleVmProfile }) +@APICommand(name = "deleteAutoScaleVmProfile", description = "Deletes a autoscale vm profile.", responseObject = SuccessResponse.class, entityType = {IAMEntityType.AutoScaleVmProfile}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteAutoScaleVmProfileCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteAutoScaleVmProfileCmd.class.getName()); private static final String s_name = "deleteautoscalevmprofileresponse"; @@ -96,7 +97,7 @@ public class DeleteAutoScaleVmProfileCmd extends BaseAsyncCmd { boolean result = _autoScaleService.deleteAutoScaleVmProfile(id); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { s_logger.warn("Failed to delete autoscale vm profile " + getId()); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete autoscale vm profile"); diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java index 9d12149e7b5..9a7d2d7df8f 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java @@ -37,7 +37,8 @@ import com.cloud.exception.ResourceInUseException; import com.cloud.network.as.Condition; import com.cloud.user.Account; -@APICommand(name = "deleteCondition", description = "Removes a condition", responseObject = SuccessResponse.class, entityType = { IAMEntityType.Condition }) +@APICommand(name = "deleteCondition", description = "Removes a condition", responseObject = SuccessResponse.class, entityType = {IAMEntityType.Condition}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteConditionCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteConditionCmd.class.getName()); private static final String s_name = "deleteconditionresponse"; @@ -65,7 +66,7 @@ public class DeleteConditionCmd extends BaseAsyncCmd { } if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { s_logger.warn("Failed to delete condition " + getId()); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete condition."); diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java index a6e736a33c0..6575d27ba74 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java @@ -35,7 +35,8 @@ import com.cloud.event.EventTypes; import com.cloud.network.as.AutoScaleVmGroup; import com.cloud.user.Account; -@APICommand(name = "disableAutoScaleVmGroup", description = "Disables an AutoScale Vm Group", responseObject = AutoScaleVmGroupResponse.class, entityType = { IAMEntityType.AutoScaleVmGroup }) +@APICommand(name = "disableAutoScaleVmGroup", description = "Disables an AutoScale Vm Group", responseObject = AutoScaleVmGroupResponse.class, entityType = {IAMEntityType.AutoScaleVmGroup}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DisableAutoScaleVmGroupCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DisableAutoScaleVmGroupCmd.class.getName()); private static final String s_name = "disableautoscalevmGroupresponse"; @@ -62,7 +63,7 @@ public class DisableAutoScaleVmGroupCmd extends BaseAsyncCmd { if (result != null) { AutoScaleVmGroupResponse response = _responseGenerator.createAutoScaleVmGroupResponse(result); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disable AutoScale Vm Group"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java index 49a6cee6e38..6b9f2c3ac01 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java @@ -35,7 +35,8 @@ import com.cloud.event.EventTypes; import com.cloud.network.as.AutoScaleVmGroup; import com.cloud.user.Account; -@APICommand(name = "enableAutoScaleVmGroup", description = "Enables an AutoScale Vm Group", responseObject = AutoScaleVmGroupResponse.class, entityType = { IAMEntityType.AutoScaleVmGroup }) +@APICommand(name = "enableAutoScaleVmGroup", description = "Enables an AutoScale Vm Group", responseObject = AutoScaleVmGroupResponse.class, entityType = {IAMEntityType.AutoScaleVmGroup}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class EnableAutoScaleVmGroupCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(EnableAutoScaleVmGroupCmd.class.getName()); private static final String s_name = "enableautoscalevmGroupresponse"; @@ -62,7 +63,7 @@ public class EnableAutoScaleVmGroupCmd extends BaseAsyncCmd { if (result != null) { AutoScaleVmGroupResponse response = _responseGenerator.createAutoScaleVmGroupResponse(result); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable AutoScale Vm Group"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java index c6eb40cfe22..43c4c72a809 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java @@ -33,7 +33,8 @@ import org.apache.cloudstack.api.response.ListResponse; import com.cloud.network.as.AutoScalePolicy; -@APICommand(name = "listAutoScalePolicies", description = "Lists autoscale policies.", responseObject = AutoScalePolicyResponse.class, entityType = { IAMEntityType.AutoScalePolicy }) +@APICommand(name = "listAutoScalePolicies", description = "Lists autoscale policies.", responseObject = AutoScalePolicyResponse.class, entityType = {IAMEntityType.AutoScalePolicy}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListAutoScalePoliciesCmd extends BaseListAccountResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListAutoScalePoliciesCmd.class.getName()); @@ -100,7 +101,7 @@ public class ListAutoScalePoliciesCmd extends BaseListAccountResourcesCmd { } response.setResponses(responses); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java index 5e35e637326..2e88c27b7dc 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java @@ -22,6 +22,7 @@ import java.util.List; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; @@ -36,7 +37,8 @@ import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.as.AutoScaleVmGroup; -@APICommand(name = "listAutoScaleVmGroups", description = "Lists autoscale vm groups.", responseObject = AutoScaleVmGroupResponse.class, entityType = { IAMEntityType.AutoScaleVmGroup }) +@APICommand(name = "listAutoScaleVmGroups", description = "Lists autoscale vm groups.", responseObject = AutoScaleVmGroupResponse.class, entityType = { IAMEntityType.AutoScaleVmGroup }, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListAutoScaleVmGroupsCmd extends BaseListProjectAndAccountResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListAutoScaleVmGroupsCmd.class.getName()); @@ -61,6 +63,9 @@ public class ListAutoScaleVmGroupsCmd extends BaseListProjectAndAccountResources @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the availability zone ID") private Long zoneId; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + // /////////////////////////////////////////////////// // ///////////////// Accessors /////////////////////// // /////////////////////////////////////////////////// @@ -85,6 +90,14 @@ public class ListAutoScaleVmGroupsCmd extends BaseListProjectAndAccountResources return zoneId; } + @Override + public Boolean getDisplay() { + if (display != null) { + return display; + } + return super.getDisplay(); + } + // /////////////////////////////////////////////////// // ///////////// API Implementation/////////////////// // /////////////////////////////////////////////////// @@ -111,6 +124,6 @@ public class ListAutoScaleVmGroupsCmd extends BaseListProjectAndAccountResources } response.setResponses(responses); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java index 8a4a522f06d..94f0eee7f55 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java @@ -18,7 +18,11 @@ package org.apache.cloudstack.api.command.user.autoscale; import java.util.ArrayList; import java.util.List; + +import org.apache.log4j.Logger; + import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; @@ -28,11 +32,11 @@ import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.ServiceOfferingResponse; import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.response.ZoneResponse; -import org.apache.log4j.Logger; import com.cloud.network.as.AutoScaleVmProfile; -@APICommand(name = "listAutoScaleVmProfiles", description = "Lists autoscale vm profiles.", responseObject = AutoScaleVmProfileResponse.class, entityType = { IAMEntityType.AutoScaleVmProfile }) +@APICommand(name = "listAutoScaleVmProfiles", description = "Lists autoscale vm profiles.", responseObject = AutoScaleVmProfileResponse.class, entityType = { IAMEntityType.AutoScaleVmProfile }, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListAutoScaleVmProfilesCmd extends BaseListProjectAndAccountResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListAutoScaleVmProfilesCmd.class.getName()); @@ -57,6 +61,9 @@ public class ListAutoScaleVmProfilesCmd extends BaseListProjectAndAccountResourc @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, since = "4.4", description = "availability zone for the auto deployed virtual machine") private Long zoneId; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + // /////////////////////////////////////////////////// // ///////////////// Accessors /////////////////////// // /////////////////////////////////////////////////// @@ -80,6 +87,15 @@ public class ListAutoScaleVmProfilesCmd extends BaseListProjectAndAccountResourc public Long getZoneId() { return zoneId; } + + @Override + public Boolean getDisplay() { + if (display != null) { + return display; + } + return super.getDisplay(); + } + // /////////////////////////////////////////////////// // ///////////// API Implementation/////////////////// // /////////////////////////////////////////////////// @@ -104,7 +120,7 @@ public class ListAutoScaleVmProfilesCmd extends BaseListProjectAndAccountResourc } response.setResponses(responses); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java index 015f3ed2c6a..d75d64942f9 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java @@ -33,7 +33,8 @@ import org.apache.cloudstack.api.response.ListResponse; import com.cloud.network.as.Condition; -@APICommand(name = "listConditions", description = "List Conditions for the specific user", responseObject = ConditionResponse.class) +@APICommand(name = "listConditions", description = "List Conditions for the specific user", responseObject = ConditionResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListConditionsCmd extends BaseListAccountResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListConditionsCmd.class.getName()); private static final String s_name = "listconditionsresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java index f503b2bc81e..6a9ac8dfdcb 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java @@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.ListResponse; import com.cloud.network.as.Counter; import com.cloud.user.Account; -@APICommand(name = "listCounters", description = "List the counters", responseObject = CounterResponse.class) +@APICommand(name = "listCounters", description = "List the counters", responseObject = CounterResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListCountersCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListCountersCmd.class.getName()); private static final String s_name = "counterresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java index 26f06bd8194..8cd7211a2fb 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java @@ -39,7 +39,8 @@ import com.cloud.event.EventTypes; import com.cloud.network.as.AutoScalePolicy; import com.cloud.user.Account; -@APICommand(name = "updateAutoScalePolicy", description = "Updates an existing autoscale policy.", responseObject = AutoScalePolicyResponse.class, entityType = { IAMEntityType.AutoScalePolicy }) +@APICommand(name = "updateAutoScalePolicy", description = "Updates an existing autoscale policy.", responseObject = AutoScalePolicyResponse.class, entityType = {IAMEntityType.AutoScalePolicy}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateAutoScalePolicyCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(UpdateAutoScalePolicyCmd.class.getName()); @@ -79,7 +80,7 @@ public class UpdateAutoScalePolicyCmd extends BaseAsyncCmd { if (result != null) { AutoScalePolicyResponse response = _responseGenerator.createAutoScalePolicyResponse(result); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update autoscale policy"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java index 1dbdf34f005..60ea51efc9d 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java @@ -22,6 +22,7 @@ import java.util.List; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.acl.SecurityChecker.AccessType; import org.apache.cloudstack.api.ACL; import org.apache.cloudstack.api.APICommand; @@ -39,7 +40,8 @@ import com.cloud.event.EventTypes; import com.cloud.network.as.AutoScaleVmGroup; import com.cloud.user.Account; -@APICommand(name = "updateAutoScaleVmGroup", description = "Updates an existing autoscale vm group.", responseObject = AutoScaleVmGroupResponse.class, entityType = { IAMEntityType.AutoScaleVmGroup }) +@APICommand(name = "updateAutoScaleVmGroup", description = "Updates an existing autoscale vm group.", responseObject = AutoScaleVmGroupResponse.class, entityType = { IAMEntityType.AutoScaleVmGroup }, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateAutoScaleVmGroupCmd extends BaseAsyncCustomIdCmd { public static final Logger s_logger = Logger.getLogger(UpdateAutoScaleVmGroupCmd.class.getName()); @@ -84,6 +86,9 @@ public class UpdateAutoScaleVmGroupCmd extends BaseAsyncCustomIdCmd { description = "the ID of the autoscale group") private Long id; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the group to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + // /////////////////////////////////////////////////// // ///////////// API Implementation/////////////////// // /////////////////////////////////////////////////// @@ -129,6 +134,10 @@ public class UpdateAutoScaleVmGroupCmd extends BaseAsyncCustomIdCmd { return scaleDownPolicyIds; } + public Boolean getDisplay() { + return display; + } + @Override public String getEventType() { return EventTypes.EVENT_AUTOSCALEVMGROUP_UPDATE; diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java index 87b936dd25e..54e34da196b 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java @@ -22,6 +22,7 @@ import java.util.Map; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.acl.SecurityChecker.AccessType; import org.apache.cloudstack.api.ACL; import org.apache.cloudstack.api.APICommand; @@ -40,7 +41,8 @@ import com.cloud.event.EventTypes; import com.cloud.network.as.AutoScaleVmProfile; import com.cloud.user.Account; -@APICommand(name = "updateAutoScaleVmProfile", description = "Updates an existing autoscale vm profile.", responseObject = AutoScaleVmProfileResponse.class, entityType = { IAMEntityType.AutoScaleVmProfile }) +@APICommand(name = "updateAutoScaleVmProfile", description = "Updates an existing autoscale vm profile.", responseObject = AutoScaleVmProfileResponse.class, entityType = { IAMEntityType.AutoScaleVmProfile }, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCustomIdCmd { public static final Logger s_logger = Logger.getLogger(UpdateAutoScaleVmProfileCmd.class.getName()); @@ -80,6 +82,9 @@ public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCustomIdCmd { description = "the ID of the user used to launch and destroy the VMs") private Long autoscaleUserId; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the profile to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + // /////////////////////////////////////////////////// // ///////////// API Implementation/////////////////// // /////////////////////////////////////////////////// @@ -121,6 +126,10 @@ public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCustomIdCmd { return destroyVmGraceperiod; } + public Boolean getDisplay() { + return display; + } + @Override public String getEventType() { return EventTypes.EVENT_AUTOSCALEVMPROFILE_UPDATE; diff --git a/api/src/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java b/api/src/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java index 5c008148207..d47645b956a 100644 --- a/api/src/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java @@ -26,7 +26,8 @@ import org.apache.cloudstack.api.response.CapabilitiesResponse; import com.cloud.user.Account; -@APICommand(name = "listCapabilities", description = "Lists capabilities", responseObject = CapabilitiesResponse.class) +@APICommand(name = "listCapabilities", description = "Lists capabilities", responseObject = CapabilitiesResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListCapabilitiesCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(ListCapabilitiesCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/event/ArchiveEventsCmd.java b/api/src/org/apache/cloudstack/api/command/user/event/ArchiveEventsCmd.java index 22eae0579a7..8ff2c3e4457 100644 --- a/api/src/org/apache/cloudstack/api/command/user/event/ArchiveEventsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/event/ArchiveEventsCmd.java @@ -35,7 +35,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.exception.InvalidParameterValueException; import com.cloud.user.Account; -@APICommand(name = "archiveEvents", description = "Archive one or more events.", responseObject = SuccessResponse.class, entityType = { IAMEntityType.Event }) +@APICommand(name = "archiveEvents", description = "Archive one or more events.", responseObject = SuccessResponse.class, entityType = {IAMEntityType.Event}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ArchiveEventsCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(ArchiveEventsCmd.class.getName()); @@ -112,7 +113,7 @@ public class ArchiveEventsCmd extends BaseCmd { boolean result = _mgr.archiveEvents(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Unable to archive Events, one or more parameters has invalid values"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/event/DeleteEventsCmd.java b/api/src/org/apache/cloudstack/api/command/user/event/DeleteEventsCmd.java index ca802a46c87..10c1c0c8601 100644 --- a/api/src/org/apache/cloudstack/api/command/user/event/DeleteEventsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/event/DeleteEventsCmd.java @@ -35,7 +35,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.exception.InvalidParameterValueException; import com.cloud.user.Account; -@APICommand(name = "deleteEvents", description = "Delete one or more events.", responseObject = SuccessResponse.class, entityType = { IAMEntityType.Event }) +@APICommand(name = "deleteEvents", description = "Delete one or more events.", responseObject = SuccessResponse.class, entityType = {IAMEntityType.Event}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteEventsCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeleteEventsCmd.class.getName()); @@ -112,7 +113,7 @@ public class DeleteEventsCmd extends BaseCmd { boolean result = _mgr.deleteEvents(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Unable to delete Events, one or more parameters has invalid values"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/event/ListEventTypesCmd.java b/api/src/org/apache/cloudstack/api/command/user/event/ListEventTypesCmd.java index 7a58d4c32ed..91f316c3d00 100644 --- a/api/src/org/apache/cloudstack/api/command/user/event/ListEventTypesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/event/ListEventTypesCmd.java @@ -27,7 +27,8 @@ import org.apache.cloudstack.api.response.ListResponse; import com.cloud.user.Account; -@APICommand(name = "listEventTypes", description = "List Event Types", responseObject = EventTypeResponse.class) +@APICommand(name = "listEventTypes", description = "List Event Types", responseObject = EventTypeResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListEventTypesCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(ListEventTypesCmd.class.getName()); private static final String s_name = "listeventtypesresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/event/ListEventsCmd.java b/api/src/org/apache/cloudstack/api/command/user/event/ListEventsCmd.java index 620bd86e699..b420cf1ed25 100644 --- a/api/src/org/apache/cloudstack/api/command/user/event/ListEventsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/event/ListEventsCmd.java @@ -28,7 +28,8 @@ import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.EventResponse; import org.apache.cloudstack.api.response.ListResponse; -@APICommand(name = "listEvents", description = "A command to list events.", responseObject = EventResponse.class, entityType = { IAMEntityType.Event }) +@APICommand(name = "listEvents", description = "A command to list events.", responseObject = EventResponse.class, entityType = {IAMEntityType.Event}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListEventsCmd extends BaseListProjectAndAccountResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListEventsCmd.class.getName()); @@ -109,6 +110,6 @@ public class ListEventsCmd extends BaseListProjectAndAccountResourcesCmd { ListResponse response = _queryService.searchForEvents(this); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/CreateEgressFirewallRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateEgressFirewallRuleCmd.java index 20029bc7686..8ef1b895184 100644 --- a/api/src/org/apache/cloudstack/api/command/user/firewall/CreateEgressFirewallRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateEgressFirewallRuleCmd.java @@ -23,6 +23,7 @@ import java.util.List; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandJobType; import org.apache.cloudstack.api.ApiConstants; @@ -44,7 +45,8 @@ import com.cloud.network.rules.FirewallRule; import com.cloud.user.Account; import com.cloud.utils.net.NetUtils; -@APICommand(name = "createEgressFirewallRule", description = "Creates a egress firewall rule for a given network ", responseObject = FirewallResponse.class, entityType = { IAMEntityType.FirewallRule }) +@APICommand(name = "createEgressFirewallRule", description = "Creates a egress firewall rule for a given network ", responseObject = FirewallResponse.class, entityType = { IAMEntityType.FirewallRule }, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateEgressFirewallRuleCmd extends BaseAsyncCreateCmd implements FirewallRule { public static final Logger s_logger = Logger.getLogger(CreateEgressFirewallRuleCmd.class.getName()); @@ -85,6 +87,9 @@ public class CreateEgressFirewallRuleCmd extends BaseAsyncCreateCmd implements F @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "type of firewallrule: system/user") private String type; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + // /////////////////////////////////////////////////// // ///////////////// Accessors /////////////////////// // /////////////////////////////////////////////////// @@ -272,7 +277,7 @@ public class CreateEgressFirewallRuleCmd extends BaseAsyncCreateCmd implements F @Override public String getEventDescription() { Network network = _networkService.getNetwork(networkId); - return ("Creating firewall rule for network: " + network + " for protocol:" + this.getProtocol()); + return ("Creating firewall rule for network: " + network + " for protocol:" + getProtocol()); } @Override @@ -342,6 +347,15 @@ public class CreateEgressFirewallRuleCmd extends BaseAsyncCreateCmd implements F return null; } + @Override + public boolean isDisplay() { + if (display != null) { + return display; + } else { + return true; + } + } + @Override public IAMEntityType getEntityType() { return IAMEntityType.FirewallRule; diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java index e2fd492566e..21e680ae620 100644 --- a/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java @@ -22,6 +22,7 @@ import java.util.List; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandJobType; import org.apache.cloudstack.api.ApiConstants; @@ -43,7 +44,8 @@ import com.cloud.network.rules.FirewallRule; import com.cloud.user.Account; import com.cloud.utils.net.NetUtils; -@APICommand(name = "createFirewallRule", description = "Creates a firewall rule for a given ip address", responseObject = FirewallResponse.class, entityType = { IAMEntityType.FirewallRule }) +@APICommand(name = "createFirewallRule", description = "Creates a firewall rule for a given ip address", responseObject = FirewallResponse.class, entityType = { IAMEntityType.FirewallRule }, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements FirewallRule { public static final Logger s_logger = Logger.getLogger(CreateFirewallRuleCmd.class.getName()); @@ -84,10 +86,14 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "type of firewallrule: system/user") private String type; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + // /////////////////////////////////////////////////// // ///////////////// Accessors /////////////////////// // /////////////////////////////////////////////////// + public Long getIpAddressId() { return ipAddressId; } @@ -334,6 +340,15 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal return FirewallRule.TrafficType.Ingress; } + @Override + public boolean isDisplay() { + if (display != null) { + return display; + } else { + return true; + } + } + @Override public IAMEntityType getEntityType() { return IAMEntityType.FirewallRule; diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java index a072d900bd0..7328374f5cb 100644 --- a/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java @@ -21,6 +21,7 @@ import java.util.List; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandJobType; import org.apache.cloudstack.api.ApiConstants; @@ -43,8 +44,10 @@ import com.cloud.network.IpAddress; import com.cloud.network.rules.PortForwardingRule; import com.cloud.user.Account; import com.cloud.utils.net.Ip; +import com.cloud.utils.net.NetUtils; -@APICommand(name = "createPortForwardingRule", description = "Creates a port forwarding rule", responseObject = FirewallRuleResponse.class, entityType = { IAMEntityType.PortForwardingRule }) +@APICommand(name = "createPortForwardingRule", description = "Creates a port forwarding rule", responseObject = FirewallRuleResponse.class, entityType = { IAMEntityType.PortForwardingRule }, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements PortForwardingRule { public static final Logger s_logger = Logger.getLogger(CreatePortForwardingRuleCmd.class.getName()); @@ -118,6 +121,9 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P description = "VM guest nic Secondary ip address for the port forwarding rule") private String vmSecondaryIp; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + // /////////////////////////////////////////////////// // ///////////////// Accessors /////////////////////// // /////////////////////////////////////////////////// @@ -335,13 +341,13 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P Ip privateIp = getVmSecondaryIp(); if (privateIp != null) { - if (!privateIp.isIp4()) { + if (!NetUtils.isValidIp(privateIp.toString())) { throw new InvalidParameterValueException("Invalid vm ip address"); } } try { - PortForwardingRule result = _rulesService.createPortForwardingRule(this, virtualMachineId, privateIp, getOpenFirewall()); + PortForwardingRule result = _rulesService.createPortForwardingRule(this, virtualMachineId, privateIp, getOpenFirewall(), isDisplay()); setEntityId(result.getId()); setEntityUuid(result.getUuid()); } catch (NetworkRuleConflictException ex) { @@ -416,6 +422,15 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P return null; } + @Override + public boolean isDisplay() { + if (display != null) { + return display; + } else { + return true; + } + } + @Override public IAMEntityType getEntityType() { return IAMEntityType.FirewallRule; diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java index 7048826f0b1..ebed335ba36 100644 --- a/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java @@ -39,7 +39,8 @@ import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.rules.FirewallRule; -@APICommand(name = "deleteEgressFirewallRule", description = "Deletes an ggress firewall rule", responseObject = SuccessResponse.class, entityType = { IAMEntityType.FirewallRule }) +@APICommand(name = "deleteEgressFirewallRule", description = "Deletes an ggress firewall rule", responseObject = SuccessResponse.class, entityType = {IAMEntityType.FirewallRule}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteEgressFirewallRuleCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteEgressFirewallRuleCmd.class.getName()); private static final String s_name = "deleteegressfirewallruleresponse"; @@ -102,7 +103,7 @@ public class DeleteEgressFirewallRuleCmd extends BaseAsyncCmd { if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete egress firewall rule"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteFirewallRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteFirewallRuleCmd.java index 59612e9025e..3f61e640c80 100644 --- a/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteFirewallRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteFirewallRuleCmd.java @@ -38,7 +38,8 @@ import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.rules.FirewallRule; -@APICommand(name = "deleteFirewallRule", description = "Deletes a firewall rule", responseObject = SuccessResponse.class, entityType = { IAMEntityType.FirewallRule }) +@APICommand(name = "deleteFirewallRule", description = "Deletes a firewall rule", responseObject = SuccessResponse.class, entityType = {IAMEntityType.FirewallRule}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteFirewallRuleCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteFirewallRuleCmd.class.getName()); private static final String s_name = "deletefirewallruleresponse"; @@ -100,7 +101,7 @@ public class DeleteFirewallRuleCmd extends BaseAsyncCmd { if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete firewall rule"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/DeletePortForwardingRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/DeletePortForwardingRuleCmd.java index 1457a32c2f1..551885d0175 100644 --- a/api/src/org/apache/cloudstack/api/command/user/firewall/DeletePortForwardingRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/firewall/DeletePortForwardingRuleCmd.java @@ -37,7 +37,8 @@ import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.rules.PortForwardingRule; -@APICommand(name = "deletePortForwardingRule", description = "Deletes a port forwarding rule", responseObject = SuccessResponse.class, entityType = { IAMEntityType.PortForwardingRule }) +@APICommand(name = "deletePortForwardingRule", description = "Deletes a port forwarding rule", responseObject = SuccessResponse.class, entityType = {IAMEntityType.PortForwardingRule}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeletePortForwardingRuleCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeletePortForwardingRuleCmd.class.getName()); private static final String s_name = "deleteportforwardingruleresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/ListEgressFirewallRulesCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/ListEgressFirewallRulesCmd.java index 8307a9eb07c..ece2201a898 100644 --- a/api/src/org/apache/cloudstack/api/command/user/firewall/ListEgressFirewallRulesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/firewall/ListEgressFirewallRulesCmd.java @@ -34,7 +34,8 @@ import org.apache.cloudstack.api.response.NetworkResponse; import com.cloud.network.rules.FirewallRule; import com.cloud.utils.Pair; -@APICommand(name = "listEgressFirewallRules", description = "Lists all egress firewall rules for network id.", responseObject = FirewallResponse.class, entityType = { IAMEntityType.FirewallRule }) +@APICommand(name = "listEgressFirewallRules", description = "Lists all egress firewall rules for network id.", responseObject = FirewallResponse.class, entityType = { IAMEntityType.FirewallRule }, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListEgressFirewallRulesCmd extends ListFirewallRulesCmd { public static final Logger s_logger = Logger.getLogger(ListEgressFirewallRulesCmd.class.getName()); private static final String s_name = "listegressfirewallrulesresponse"; @@ -92,6 +93,6 @@ public class ListEgressFirewallRulesCmd extends ListFirewallRulesCmd { } response.setResponses(fwResponses, result.second()); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java index e1e83cd1c3f..870f81d9142 100644 --- a/api/src/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java @@ -22,6 +22,7 @@ import java.util.List; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListTaggedResourcesCmd; @@ -35,7 +36,8 @@ import org.apache.cloudstack.api.response.NetworkResponse; import com.cloud.network.rules.FirewallRule; import com.cloud.utils.Pair; -@APICommand(name = "listFirewallRules", description = "Lists all firewall rules for an IP address.", responseObject = FirewallResponse.class, entityType = { IAMEntityType.FirewallRule }) +@APICommand(name = "listFirewallRules", description = "Lists all firewall rules for an IP address.", responseObject = FirewallResponse.class, entityType = {IAMEntityType.FirewallRule}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListFirewallRulesCmd extends BaseListTaggedResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListFirewallRulesCmd.class.getName()); private static final String s_name = "listfirewallrulesresponse"; @@ -59,6 +61,9 @@ public class ListFirewallRulesCmd extends BaseListTaggedResourcesCmd { since = "4.3") private Long networkId; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -79,6 +84,14 @@ public class ListFirewallRulesCmd extends BaseListTaggedResourcesCmd { return networkId; } + @Override + public Boolean getDisplay() { + if (display != null) { + return display; + } + return super.getDisplay(); + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -101,6 +114,6 @@ public class ListFirewallRulesCmd extends BaseListTaggedResourcesCmd { } response.setResponses(fwResponses, result.second()); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/ListPortForwardingRulesCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/ListPortForwardingRulesCmd.java index 11f65927d1f..681da333f09 100644 --- a/api/src/org/apache/cloudstack/api/command/user/firewall/ListPortForwardingRulesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/firewall/ListPortForwardingRulesCmd.java @@ -22,6 +22,7 @@ import java.util.List; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListTaggedResourcesCmd; @@ -34,7 +35,8 @@ import org.apache.cloudstack.api.response.NetworkResponse; import com.cloud.network.rules.PortForwardingRule; import com.cloud.utils.Pair; -@APICommand(name = "listPortForwardingRules", description = "Lists all port forwarding rules for an IP address.", responseObject = FirewallRuleResponse.class, entityType = { IAMEntityType.PortForwardingRule }) +@APICommand(name = "listPortForwardingRules", description = "Lists all port forwarding rules for an IP address.", responseObject = FirewallRuleResponse.class, entityType = {IAMEntityType.PortForwardingRule}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListPortForwardingRulesCmd extends BaseListTaggedResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListPortForwardingRulesCmd.class.getName()); @@ -60,6 +62,9 @@ public class ListPortForwardingRulesCmd extends BaseListTaggedResourcesCmd { since = "4.3") private Long networkId; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -76,6 +81,14 @@ public class ListPortForwardingRulesCmd extends BaseListTaggedResourcesCmd { return networkId; } + @Override + public Boolean getDisplay() { + if (display != null) { + return display; + } + return super.getDisplay(); + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -98,6 +111,6 @@ public class ListPortForwardingRulesCmd extends BaseListTaggedResourcesCmd { } response.setResponses(fwResponses, result.second()); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/UpdateEgressFirewallRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/UpdateEgressFirewallRuleCmd.java index 690afe583b0..079539624c7 100644 --- a/api/src/org/apache/cloudstack/api/command/user/firewall/UpdateEgressFirewallRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/firewall/UpdateEgressFirewallRuleCmd.java @@ -17,6 +17,7 @@ package org.apache.cloudstack.api.command.user.firewall; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseAsyncCustomIdCmd; @@ -33,7 +34,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.rules.FirewallRule; import com.cloud.network.rules.FirewallRule.TrafficType; -@APICommand(name = "updateEgressFirewallRule", description = "Updates egress firewall rule ", responseObject = FirewallResponse.class, since = "4.4") +@APICommand(name = "updateEgressFirewallRule", description = "Updates egress firewall rule ", responseObject = FirewallResponse.class, since = "4.4", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateEgressFirewallRuleCmd extends BaseAsyncCustomIdCmd { public static final Logger s_logger = Logger.getLogger(UpdateEgressFirewallRuleCmd.class.getName()); @@ -50,6 +52,9 @@ public class UpdateEgressFirewallRuleCmd extends BaseAsyncCustomIdCmd { @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, entityType = AccountResponse.class, expose = false) private Long ownerId; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + // /////////////////////////////////////////////////// // ///////////////// Accessors /////////////////////// // /////////////////////////////////////////////////// @@ -57,6 +62,10 @@ public class UpdateEgressFirewallRuleCmd extends BaseAsyncCustomIdCmd { public Long getId() { return id; } + + public Boolean getDisplay() { + return display; + } // /////////////////////////////////////////////////// // ///////////// API Implementation/////////////////// // /////////////////////////////////////////////////// @@ -69,7 +78,7 @@ public class UpdateEgressFirewallRuleCmd extends BaseAsyncCustomIdCmd { @Override public void execute() throws ResourceUnavailableException { CallContext.current().setEventDetails("Rule Id: " + id); - FirewallRule rule = _firewallService.updateFirewallRule(id, this.getCustomId()); + FirewallRule rule = _firewallService.updateFirewallRule(id, this.getCustomId(), getDisplay()); FirewallResponse fwResponse = new FirewallResponse(); if (rule != null) { diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/UpdateFirewallRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/UpdateFirewallRuleCmd.java index 3fa3b9eb9bb..f68437192b7 100644 --- a/api/src/org/apache/cloudstack/api/command/user/firewall/UpdateFirewallRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/firewall/UpdateFirewallRuleCmd.java @@ -17,6 +17,7 @@ package org.apache.cloudstack.api.command.user.firewall; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseAsyncCustomIdCmd; @@ -33,7 +34,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.rules.FirewallRule; import com.cloud.network.rules.FirewallRule.TrafficType; -@APICommand(name = "updateFirewallRule", description = "Updates firewall rule ", responseObject = FirewallResponse.class, since = "4.4") +@APICommand(name = "updateFirewallRule", description = "Updates firewall rule ", responseObject = FirewallResponse.class, since = "4.4", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateFirewallRuleCmd extends BaseAsyncCustomIdCmd { public static final Logger s_logger = Logger.getLogger(UpdateFirewallRuleCmd.class.getName()); @@ -50,6 +52,9 @@ public class UpdateFirewallRuleCmd extends BaseAsyncCustomIdCmd { @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, entityType = AccountResponse.class, expose = false) private Long ownerId; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + // /////////////////////////////////////////////////// // ///////////////// Accessors /////////////////////// // /////////////////////////////////////////////////// @@ -58,6 +63,10 @@ public class UpdateFirewallRuleCmd extends BaseAsyncCustomIdCmd { return id; } + public Boolean getDisplay() { + return display; + } + // /////////////////////////////////////////////////// // ///////////// API Implementation/////////////////// // /////////////////////////////////////////////////// @@ -70,7 +79,7 @@ public class UpdateFirewallRuleCmd extends BaseAsyncCustomIdCmd { @Override public void execute() throws ResourceUnavailableException { CallContext.current().setEventDetails("Rule Id: " + id); - FirewallRule rule = _firewallService.updateFirewallRule(id, this.getCustomId()); + FirewallRule rule = _firewallService.updateFirewallRule(id, this.getCustomId(), getDisplay()); FirewallResponse fwResponse = new FirewallResponse(); if (rule != null) { diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java index fec9ba250d3..55b378a21ae 100644 --- a/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.firewall; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseAsyncCmd; @@ -37,7 +38,8 @@ import com.cloud.user.Account; @APICommand(name = "updatePortForwardingRule", responseObject = FirewallRuleResponse.class, - description = "Updates a port forwarding rule. Only the private port and the virtual machine can be updated.", entityType = {IAMEntityType.PortForwardingRule}) + description = "Updates a port forwarding rule. Only the private port and the virtual machine can be updated.", entityType = {IAMEntityType.PortForwardingRule}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdatePortForwardingRuleCmd extends BaseAsyncCustomIdCmd { public static final Logger s_logger = Logger.getLogger(UpdatePortForwardingRuleCmd.class.getName()); private static final String s_name = "updateportforwardingruleresponse"; @@ -74,6 +76,9 @@ public class UpdatePortForwardingRuleCmd extends BaseAsyncCustomIdCmd { description = "the ID of the virtual machine for the port forwarding rule") private Long virtualMachineId; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -102,6 +107,10 @@ public class UpdatePortForwardingRuleCmd extends BaseAsyncCustomIdCmd { return virtualMachineId; } + public Boolean getDisplay() { + return display; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -141,7 +150,7 @@ public class UpdatePortForwardingRuleCmd extends BaseAsyncCustomIdCmd { @Override public void execute() { - PortForwardingRule rule = _rulesService.updatePortForwardingRule(id, getCustomId()); + PortForwardingRule rule = _rulesService.updatePortForwardingRule(id, getCustomId(), getDisplay()); FirewallRuleResponse fwResponse = new FirewallRuleResponse(); if (rule != null) { fwResponse = _responseGenerator.createPortForwardingRuleResponse(rule); diff --git a/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmd.java b/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmd.java index 604f1ede0df..e82e3c45d1f 100644 --- a/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmd.java @@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.ListResponse; import com.cloud.storage.GuestOsCategory; import com.cloud.utils.Pair; -@APICommand(name = "listOsCategories", description = "Lists all supported OS categories for this cloud.", responseObject = GuestOSCategoryResponse.class) +@APICommand(name = "listOsCategories", description = "Lists all supported OS categories for this cloud.", responseObject = GuestOSCategoryResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListGuestOsCategoriesCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListIsosCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCmd.java b/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCmd.java index 287fb1e8ef5..15a625abfaa 100644 --- a/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCmd.java @@ -33,7 +33,8 @@ import org.apache.cloudstack.api.response.ListResponse; import com.cloud.storage.GuestOS; import com.cloud.utils.Pair; -@APICommand(name = "listOsTypes", description = "Lists all supported OS types for this cloud.", responseObject = GuestOSResponse.class) +@APICommand(name = "listOsTypes", description = "Lists all supported OS types for this cloud.", responseObject = GuestOSResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListGuestOsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListIsosCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java index d5e53a1d3d7..1b8087b8c12 100644 --- a/api/src/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java @@ -34,7 +34,8 @@ import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.uservm.UserVm; -@APICommand(name = "attachIso", description = "Attaches an ISO to a virtual machine.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted) +@APICommand(name = "attachIso", description = "Attaches an ISO to a virtual machine.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class AttachIsoCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(AttachIsoCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/CopyIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/CopyIsoCmd.java index 36193182be3..21196bcb653 100644 --- a/api/src/org/apache/cloudstack/api/command/user/iso/CopyIsoCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/iso/CopyIsoCmd.java @@ -22,7 +22,8 @@ import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.command.user.template.CopyTemplateCmd; import org.apache.cloudstack.api.response.TemplateResponse; -@APICommand(name = "copyIso", description = "Copies an iso from one zone to another.", responseObject = TemplateResponse.class) +@APICommand(name = "copyIso", description = "Copies an iso from one zone to another.", responseObject = TemplateResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CopyIsoCmd extends CopyTemplateCmd { public static final Logger s_logger = Logger.getLogger(CopyIsoCmd.class.getName()); private static final String s_name = "copyisoresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/DeleteIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/DeleteIsoCmd.java index 91ad5f1e11a..b07b08dbf84 100644 --- a/api/src/org/apache/cloudstack/api/command/user/iso/DeleteIsoCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/iso/DeleteIsoCmd.java @@ -34,7 +34,8 @@ import com.cloud.event.EventTypes; import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.Account; -@APICommand(name = "deleteIso", description = "Deletes an ISO file.", responseObject = SuccessResponse.class) +@APICommand(name = "deleteIso", description = "Deletes an ISO file.", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteIsoCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteIsoCmd.class.getName()); private static final String s_name = "deleteisosresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/DetachIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/DetachIsoCmd.java index 1376c10afc0..97db2f37598 100644 --- a/api/src/org/apache/cloudstack/api/command/user/iso/DetachIsoCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/iso/DetachIsoCmd.java @@ -32,7 +32,8 @@ import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.uservm.UserVm; -@APICommand(name = "detachIso", description = "Detaches any ISO file (if any) currently attached to a virtual machine.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted) +@APICommand(name = "detachIso", description = "Detaches any ISO file (if any) currently attached to a virtual machine.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class DetachIsoCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DetachIsoCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/ExtractIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/ExtractIsoCmd.java index 2fb215aea5d..b78a3d3db66 100644 --- a/api/src/org/apache/cloudstack/api/command/user/iso/ExtractIsoCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/iso/ExtractIsoCmd.java @@ -35,7 +35,8 @@ import com.cloud.exception.InternalErrorException; import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.Account; -@APICommand(name = "extractIso", description = "Extracts an ISO", responseObject = ExtractResponse.class) +@APICommand(name = "extractIso", description = "Extracts an ISO", responseObject = ExtractResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ExtractIsoCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ExtractIsoCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java index 2f2c21663dc..f8863d1f753 100644 --- a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java @@ -26,7 +26,9 @@ import org.apache.cloudstack.api.response.TemplatePermissionsResponse; import com.cloud.storage.Storage.ImageFormat; import com.cloud.template.VirtualMachineTemplate; -@APICommand(name = "listIsoPermissions", description = "List iso visibility and all accounts that have permissions to view this iso.", responseObject = TemplatePermissionsResponse.class, responseView = ResponseView.Restricted) +@APICommand(name = "listIsoPermissions", description = "List iso visibility and all accounts that have permissions to view this iso.", responseObject = TemplatePermissionsResponse.class, responseView = ResponseView.Restricted, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class ListIsoPermissionsCmd extends BaseListTemplateOrIsoPermissionsCmd { protected String getResponseName() { return "listisopermissionsresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java index af674eb871b..5f5c61f69a6 100644 --- a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java @@ -32,7 +32,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.template.VirtualMachineTemplate.TemplateFilter; import com.cloud.user.Account; -@APICommand(name = "listIsos", description = "Lists all available ISO files.", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted) +@APICommand(name = "listIsos", description = "Lists all available ISO files.", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListIsosCmd extends BaseListTaggedResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListIsosCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java index b78eeb60c11..fa1a29ec0ad 100644 --- a/api/src/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java @@ -38,7 +38,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.exception.ResourceAllocationException; import com.cloud.template.VirtualMachineTemplate; -@APICommand(name = "registerIso", responseObject = TemplateResponse.class, description = "Registers an existing ISO into the CloudStack Cloud.", responseView = ResponseView.Restricted) +@APICommand(name = "registerIso", responseObject = TemplateResponse.class, description = "Registers an existing ISO into the CloudStack Cloud.", responseView = ResponseView.Restricted, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class RegisterIsoCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(RegisterIsoCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java index b77a913d88a..b569d657beb 100644 --- a/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java @@ -28,7 +28,8 @@ import org.apache.cloudstack.api.response.TemplateResponse; import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.Account; -@APICommand(name = "updateIso", description = "Updates an ISO file.", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted) +@APICommand(name = "updateIso", description = "Updates an ISO file.", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateIsoCmd extends BaseUpdateTemplateOrIsoCmd { public static final Logger s_logger = Logger.getLogger(UpdateIsoCmd.class.getName()); private static final String s_name = "updateisoresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoPermissionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoPermissionsCmd.java index 8267b5c294a..b52bc91c7a5 100644 --- a/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoPermissionsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoPermissionsCmd.java @@ -25,7 +25,8 @@ import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.Account; -@APICommand(name = "updateIsoPermissions", description = "Updates iso permissions", responseObject = SuccessResponse.class) +@APICommand(name = "updateIsoPermissions", description = "Updates iso permissions", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateIsoPermissionsCmd extends BaseUpdateTemplateOrIsoPermissionsCmd { @Override protected String getResponseName() { diff --git a/api/src/org/apache/cloudstack/api/command/user/job/ListAsyncJobsCmd.java b/api/src/org/apache/cloudstack/api/command/user/job/ListAsyncJobsCmd.java index 9d45d506bac..f7bfb94c7a0 100644 --- a/api/src/org/apache/cloudstack/api/command/user/job/ListAsyncJobsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/job/ListAsyncJobsCmd.java @@ -25,7 +25,8 @@ import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.AsyncJobResponse; import org.apache.cloudstack.api.response.ListResponse; -@APICommand(name = "listAsyncJobs", description = "Lists all pending asynchronous jobs for the account.", responseObject = AsyncJobResponse.class) +@APICommand(name = "listAsyncJobs", description = "Lists all pending asynchronous jobs for the account.", responseObject = AsyncJobResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListAsyncJobsCmd extends BaseListAccountResourcesCmd { private static final String s_name = "listasyncjobsresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java b/api/src/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java index 1f9f5dbc411..fc46300a7ac 100644 --- a/api/src/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java @@ -26,7 +26,8 @@ import org.apache.cloudstack.api.response.AsyncJobResponse; import com.cloud.user.Account; -@APICommand(name = "queryAsyncJobResult", description = "Retrieves the current status of asynchronous job.", responseObject = AsyncJobResponse.class) +@APICommand(name = "queryAsyncJobResult", description = "Retrieves the current status of asynchronous job.", responseObject = AsyncJobResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class QueryAsyncJobResultCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(QueryAsyncJobResultCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignCertToLoadBalancerCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignCertToLoadBalancerCmd.java index 4b0ea544c5e..ddafa72a674 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignCertToLoadBalancerCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignCertToLoadBalancerCmd.java @@ -38,7 +38,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.rules.LoadBalancer; import com.cloud.user.Account; -@APICommand(name = "assignCertToLoadBalancer", description = "Assigns a certificate to a Load Balancer Rule", responseObject = SuccessResponse.class) +@APICommand(name = "assignCertToLoadBalancer", description = "Assigns a certificate to a Load Balancer Rule", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AssignCertToLoadBalancerCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(AssignCertToLoadBalancerCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java index bcf6200ca10..6bd75378272 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java @@ -39,7 +39,9 @@ import com.cloud.utils.StringUtils; @APICommand(name = "assignToLoadBalancerRule", description = "Assigns virtual machine or a list of virtual machines to a load balancer rule.", - responseObject = SuccessResponse.class) + responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class AssignToLoadBalancerRuleCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(AssignToLoadBalancerRuleCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java index 0b8d3774dfa..fa9c22eec76 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java @@ -16,8 +16,7 @@ // under the License. package org.apache.cloudstack.api.command.user.loadbalancer; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandJobType; import org.apache.cloudstack.api.ApiConstants; @@ -29,6 +28,7 @@ import org.apache.cloudstack.api.response.ApplicationLoadBalancerResponse; import org.apache.cloudstack.api.response.NetworkResponse; import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule; +import org.apache.log4j.Logger; import com.cloud.event.EventTypes; import com.cloud.exception.InsufficientAddressCapacityException; @@ -41,7 +41,8 @@ import com.cloud.network.Network; import com.cloud.network.rules.LoadBalancerContainer.Scheme; import com.cloud.utils.net.NetUtils; -@APICommand(name = "createLoadBalancer", description = "Creates a Load Balancer", responseObject = ApplicationLoadBalancerResponse.class, since = "4.2.0") +@APICommand(name = "createLoadBalancer", description = "Creates a Load Balancer", responseObject = ApplicationLoadBalancerResponse.class, since = "4.2.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateApplicationLoadBalancerCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreateApplicationLoadBalancerCmd.class.getName()); @@ -94,9 +95,15 @@ public class CreateApplicationLoadBalancerCmd extends BaseAsyncCreateCmd { description = "the load balancer scheme. Supported value in this release is Internal") private String scheme; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// + public Boolean getDisplay() { + return display; + } public String getAlgorithm() { return algorithm; @@ -215,7 +222,7 @@ public class CreateApplicationLoadBalancerCmd extends BaseAsyncCreateCmd { ApplicationLoadBalancerRule result = _appLbService.createApplicationLoadBalancer(getName(), getDescription(), getScheme(), getSourceIpNetworkId(), getSourceIp(), getSourcePort(), - getInstancePort(), getAlgorithm(), getNetworkId(), getEntityOwnerId()); + getInstancePort(), getAlgorithm(), getNetworkId(), getEntityOwnerId(), getDisplay()); this.setEntityId(result.getId()); this.setEntityUuid(result.getUuid()); } catch (NetworkRuleConflictException e) { diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBHealthCheckPolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBHealthCheckPolicyCmd.java index 5ff7239e832..547274dc530 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBHealthCheckPolicyCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBHealthCheckPolicyCmd.java @@ -39,7 +39,9 @@ import com.cloud.user.Account; @APICommand(name = "createLBHealthCheckPolicy", description = "Creates a Load Balancer healthcheck policy ", responseObject = LBHealthCheckResponse.class, - since = "4.2.0") + since = "4.2.0", + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) @SuppressWarnings("rawtypes") public class CreateLBHealthCheckPolicyCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreateLBHealthCheckPolicyCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java index 159fcf542d6..738f837ccd2 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java @@ -40,7 +40,8 @@ import com.cloud.network.rules.LoadBalancer; import com.cloud.network.rules.StickinessPolicy; import com.cloud.user.Account; -@APICommand(name = "createLBStickinessPolicy", description = "Creates a Load Balancer stickiness policy ", responseObject = LBStickinessResponse.class, since = "3.0.0") +@APICommand(name = "createLBStickinessPolicy", description = "Creates a Load Balancer stickiness policy ", responseObject = LBStickinessResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) @SuppressWarnings("rawtypes") public class CreateLBStickinessPolicyCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreateLBStickinessPolicyCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java index 764e3793728..a405913f78e 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java @@ -18,8 +18,7 @@ package org.apache.cloudstack.api.command.user.loadbalancer; import java.util.List; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandJobType; import org.apache.cloudstack.api.ApiConstants; @@ -34,6 +33,7 @@ import org.apache.cloudstack.api.response.LoadBalancerResponse; import org.apache.cloudstack.api.response.NetworkResponse; import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.cloudstack.context.CallContext; +import org.apache.log4j.Logger; import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter.NetworkType; @@ -49,7 +49,8 @@ import com.cloud.network.rules.LoadBalancer; import com.cloud.user.Account; import com.cloud.utils.net.NetUtils; -@APICommand(name = "createLoadBalancerRule", description = "Creates a load balancer rule", responseObject = LoadBalancerResponse.class) +@APICommand(name = "createLoadBalancerRule", description = "Creates a load balancer rule", responseObject = LoadBalancerResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements LoadBalancer */{ public static final Logger s_logger = Logger.getLogger(CreateLoadBalancerRuleCmd.class.getName()); @@ -116,10 +117,17 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements L @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "The protocol for the LB") private String lbProtocol; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// + public Boolean getDisplay() { + return display; + } + public String getAlgorithm() { return algorithm; } @@ -301,7 +309,7 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements L try { LoadBalancer result = _lbService.createPublicLoadBalancerRule(getXid(), getName(), getDescription(), getSourcePortStart(), getSourcePortEnd(), getDefaultPortStart(), - getDefaultPortEnd(), getSourceIpAddressId(), getProtocol(), getAlgorithm(), getNetworkId(), getEntityOwnerId(), getOpenFirewall(), getLbProtocol()); + getDefaultPortEnd(), getSourceIpAddressId(), getProtocol(), getAlgorithm(), getNetworkId(), getEntityOwnerId(), getOpenFirewall(), getLbProtocol(), getDisplay()); this.setEntityId(result.getId()); this.setEntityUuid(result.getUuid()); } catch (NetworkRuleConflictException e) { diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteApplicationLoadBalancerCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteApplicationLoadBalancerCmd.java index 0b53d53f808..8f4ecca58f8 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteApplicationLoadBalancerCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteApplicationLoadBalancerCmd.java @@ -33,7 +33,8 @@ import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; -@APICommand(name = "deleteLoadBalancer", description = "Deletes a load balancer", responseObject = SuccessResponse.class, since = "4.2.0") +@APICommand(name = "deleteLoadBalancer", description = "Deletes a load balancer", responseObject = SuccessResponse.class, since = "4.2.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteApplicationLoadBalancerCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteApplicationLoadBalancerCmd.class.getName()); private static final String s_name = "deleteloadbalancerresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBHealthCheckPolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBHealthCheckPolicyCmd.java index d625ed571e4..3f27477903c 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBHealthCheckPolicyCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBHealthCheckPolicyCmd.java @@ -34,7 +34,8 @@ import com.cloud.network.rules.HealthCheckPolicy; import com.cloud.network.rules.LoadBalancer; import com.cloud.user.Account; -@APICommand(name = "deleteLBHealthCheckPolicy", description = "Deletes a load balancer HealthCheck policy.", responseObject = SuccessResponse.class, since = "4.2.0") +@APICommand(name = "deleteLBHealthCheckPolicy", description = "Deletes a load balancer HealthCheck policy.", responseObject = SuccessResponse.class, since = "4.2.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteLBHealthCheckPolicyCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteLBHealthCheckPolicyCmd.class.getName()); private static final String s_name = "deletelbhealthcheckpolicyresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBStickinessPolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBStickinessPolicyCmd.java index c4f72d9742b..ffed94bff12 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBStickinessPolicyCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBStickinessPolicyCmd.java @@ -34,7 +34,8 @@ import com.cloud.network.rules.LoadBalancer; import com.cloud.network.rules.StickinessPolicy; import com.cloud.user.Account; -@APICommand(name = "deleteLBStickinessPolicy", description = "Deletes a LB stickiness policy.", responseObject = SuccessResponse.class, since = "3.0.0") +@APICommand(name = "deleteLBStickinessPolicy", description = "Deletes a LB stickiness policy.", responseObject = SuccessResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteLBStickinessPolicyCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteLBStickinessPolicyCmd.class.getName()); private static final String s_name = "deleteLBstickinessrruleresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLoadBalancerRuleCmd.java index 1dc3cd17604..3423cab0518 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLoadBalancerRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLoadBalancerRuleCmd.java @@ -34,7 +34,8 @@ import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.rules.LoadBalancer; import com.cloud.user.Account; -@APICommand(name = "deleteLoadBalancerRule", description = "Deletes a load balancer rule.", responseObject = SuccessResponse.class) +@APICommand(name = "deleteLoadBalancerRule", description = "Deletes a load balancer rule.", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteLoadBalancerRuleCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteLoadBalancerRuleCmd.class.getName()); private static final String s_name = "deleteloadbalancerruleresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteSslCertCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteSslCertCmd.java index d5683b0b198..fab11250687 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteSslCertCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteSslCertCmd.java @@ -37,7 +37,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.lb.CertService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "deleteSslCert", description = "Delete a certificate to cloudstack", responseObject = SuccessResponse.class) +@APICommand(name = "deleteSslCert", description = "Delete a certificate to cloudstack", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteSslCertCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeleteSslCertCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListApplicationLoadBalancersCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListApplicationLoadBalancersCmd.java index 05572c81b13..f8696d4b3f6 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListApplicationLoadBalancersCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListApplicationLoadBalancersCmd.java @@ -19,8 +19,7 @@ package org.apache.cloudstack.api.command.user.loadbalancer; import java.util.ArrayList; import java.util.List; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListTaggedResourcesCmd; @@ -30,12 +29,14 @@ import org.apache.cloudstack.api.response.FirewallRuleResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.NetworkResponse; import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule; +import org.apache.log4j.Logger; import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.rules.LoadBalancerContainer.Scheme; import com.cloud.utils.Pair; -@APICommand(name = "listLoadBalancers", description = "Lists Load Balancers", responseObject = ApplicationLoadBalancerResponse.class, since = "4.2.0") +@APICommand(name = "listLoadBalancers", description = "Lists Load Balancers", responseObject = ApplicationLoadBalancerResponse.class, since = "4.2.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListApplicationLoadBalancersCmd extends BaseListTaggedResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListApplicationLoadBalancersCmd.class.getName()); @@ -66,6 +67,9 @@ public class ListApplicationLoadBalancersCmd extends BaseListTaggedResourcesCmd @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "the network id of the Load Balancer") private Long networkId; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + // /////////////////////////////////////////////////// // ///////////////// Accessors /////////////////////// // /////////////////////////////////////////////////// @@ -90,6 +94,14 @@ public class ListApplicationLoadBalancersCmd extends BaseListTaggedResourcesCmd return sourceIpNetworkId; } + @Override + public Boolean getDisplay() { + if (display != null) { + return display; + } + return super.getDisplay(); + } + @Override public String getCommandName() { return s_name; diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBHealthCheckPoliciesCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBHealthCheckPoliciesCmd.java index 8aa286fb3d7..5f4ca09ec98 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBHealthCheckPoliciesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBHealthCheckPoliciesCmd.java @@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.ListResponse; import com.cloud.network.rules.HealthCheckPolicy; import com.cloud.network.rules.LoadBalancer; -@APICommand(name = "listLBHealthCheckPolicies", description = "Lists load balancer HealthCheck policies.", responseObject = LBHealthCheckResponse.class, since = "4.2.0") +@APICommand(name = "listLBHealthCheckPolicies", description = "Lists load balancer HealthCheck policies.", responseObject = LBHealthCheckResponse.class, since = "4.2.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListLBHealthCheckPoliciesCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListLBHealthCheckPoliciesCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBStickinessPoliciesCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBStickinessPoliciesCmd.java index ade487881b0..2e7ae3c5e19 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBStickinessPoliciesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBStickinessPoliciesCmd.java @@ -34,7 +34,8 @@ import com.cloud.network.rules.LoadBalancer; import com.cloud.network.rules.StickinessPolicy; import com.cloud.user.Account; -@APICommand(name = "listLBStickinessPolicies", description = "Lists LBStickiness policies.", responseObject = LBStickinessResponse.class, since = "3.0.0") +@APICommand(name = "listLBStickinessPolicies", description = "Lists LBStickiness policies.", responseObject = LBStickinessResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListLBStickinessPoliciesCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListLBStickinessPoliciesCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java index ec9801b834c..2d458a7408d 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java @@ -33,7 +33,9 @@ import org.apache.cloudstack.api.response.UserVmResponse; import com.cloud.uservm.UserVm; import com.cloud.utils.Pair; -@APICommand(name = "listLoadBalancerRuleInstances", description = "List all virtual machine instances that are assigned to a load balancer rule.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted) +@APICommand(name = "listLoadBalancerRuleInstances", description = "List all virtual machine instances that are assigned to a load balancer rule.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = true) public class ListLoadBalancerRuleInstancesCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListLoadBalancerRuleInstancesCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java index 663f9910098..013deb730ed 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java @@ -36,7 +36,8 @@ import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.network.rules.LoadBalancer; import com.cloud.utils.Pair; -@APICommand(name = "listLoadBalancerRules", description = "Lists load balancer rules.", responseObject = LoadBalancerResponse.class) +@APICommand(name = "listLoadBalancerRules", description = "Lists load balancer rules.", responseObject = LoadBalancerResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListLoadBalancerRulesCmd extends BaseListTaggedResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListLoadBalancerRulesCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListSslCertsCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListSslCertsCmd.java index 7f8118af3bc..aaadebbd142 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListSslCertsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListSslCertsCmd.java @@ -35,7 +35,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.network.lb.CertService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "listSslCerts", description = "Lists SSL certificates", responseObject = SslCertResponse.class) +@APICommand(name = "listSslCerts", description = "Lists SSL certificates", responseObject = SslCertResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListSslCertsCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeleteSslCertCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveCertFromLoadBalancerCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveCertFromLoadBalancerCmd.java index ea420f31bf5..14da0893d19 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveCertFromLoadBalancerCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveCertFromLoadBalancerCmd.java @@ -36,7 +36,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.rules.LoadBalancer; import com.cloud.user.Account; -@APICommand(name = "removeCertFromLoadBalancer", description = "Removes a certificate from a Load Balancer Rule", responseObject = SuccessResponse.class) +@APICommand(name = "removeCertFromLoadBalancer", description = "Removes a certificate from a Load Balancer Rule", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class RemoveCertFromLoadBalancerCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(RemoveCertFromLoadBalancerCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java index 5027ad30fa5..8714d34bc68 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java @@ -39,7 +39,9 @@ import com.cloud.utils.StringUtils; @APICommand(name = "removeFromLoadBalancerRule", description = "Removes a virtual machine or a list of virtual machines from a load balancer rule.", - responseObject = SuccessResponse.class) + responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class RemoveFromLoadBalancerRuleCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(RemoveFromLoadBalancerRuleCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateApplicationLoadBalancerCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateApplicationLoadBalancerCmd.java index 4a82ce16969..fbda84ddce9 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateApplicationLoadBalancerCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateApplicationLoadBalancerCmd.java @@ -16,6 +16,7 @@ // under the License. package org.apache.cloudstack.api.command.user.loadbalancer; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseAsyncCustomIdCmd; @@ -30,7 +31,8 @@ import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.rules.FirewallRule; -@APICommand(name = "updateLoadBalancer", description = "Updates a Load Balancer", responseObject = ApplicationLoadBalancerResponse.class, since = "4.4.0") +@APICommand(name = "updateLoadBalancer", description = "Updates a Load Balancer", responseObject = ApplicationLoadBalancerResponse.class, since = "4.4.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateApplicationLoadBalancerCmd extends BaseAsyncCustomIdCmd { public static final Logger s_logger = Logger.getLogger(UpdateApplicationLoadBalancerCmd.class.getName()); @@ -42,6 +44,9 @@ public class UpdateApplicationLoadBalancerCmd extends BaseAsyncCustomIdCmd { @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "the ID of the Load Balancer") private Long id; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -54,6 +59,10 @@ public class UpdateApplicationLoadBalancerCmd extends BaseAsyncCustomIdCmd { return id; } + public Boolean getDisplay() { + return display; + } + @Override public long getEntityOwnerId() { ApplicationLoadBalancerRule lb = _entityMgr.findById(ApplicationLoadBalancerRule.class, getId()); @@ -81,7 +90,7 @@ public class UpdateApplicationLoadBalancerCmd extends BaseAsyncCustomIdCmd { @Override public void execute() { CallContext.current().setEventDetails("Load balancer Id: " + getId()); - ApplicationLoadBalancerRule rule = _appLbService.deleteApplicationLoadBalancer(getId(), this.getCustomId()); + ApplicationLoadBalancerRule rule = _appLbService.updateApplicationLoadBalancer(getId(), this.getCustomId(), getDisplay()); ApplicationLoadBalancerResponse lbResponse = _responseGenerator.createLoadBalancerContainerReponse(rule, _lbService.getLbInstances(getId())); setResponseObject(lbResponse); lbResponse.setResponseName(getCommandName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java index 3a9a03c139e..03dd62179ea 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java @@ -16,6 +16,7 @@ // under the License. package org.apache.cloudstack.api.command.user.loadbalancer; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiErrorCode; @@ -34,7 +35,8 @@ import com.cloud.network.rules.FirewallRule; import com.cloud.network.rules.LoadBalancer; import com.cloud.user.Account; -@APICommand(name = "updateLoadBalancerRule", description = "Updates load balancer", responseObject = LoadBalancerResponse.class) +@APICommand(name = "updateLoadBalancerRule", description = "Updates load balancer", responseObject = LoadBalancerResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateLoadBalancerRuleCmd extends BaseAsyncCustomIdCmd { public static final Logger s_logger = Logger.getLogger(UpdateLoadBalancerRuleCmd.class.getName()); private static final String s_name = "updateloadbalancerruleresponse"; @@ -59,6 +61,9 @@ public class UpdateLoadBalancerRuleCmd extends BaseAsyncCustomIdCmd { @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the load balancer rule") private String loadBalancerName; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -79,6 +84,10 @@ public class UpdateLoadBalancerRuleCmd extends BaseAsyncCustomIdCmd { return loadBalancerName; } + public Boolean getDisplay() { + return display; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UploadSslCertCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UploadSslCertCmd.java index 00bd01343dd..7b150a7fe06 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UploadSslCertCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UploadSslCertCmd.java @@ -36,7 +36,8 @@ import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.lb.CertService; -@APICommand(name = "uploadSslCert", description = "Upload a certificate to cloudstack", responseObject = SslCertResponse.class) +@APICommand(name = "uploadSslCert", description = "Upload a certificate to cloudstack", responseObject = SslCertResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UploadSslCertCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(UploadSslCertCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java index b500c11a6c4..77edbfccca8 100644 --- a/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java @@ -43,7 +43,8 @@ import com.cloud.network.rules.FirewallRule; import com.cloud.network.rules.StaticNatRule; import com.cloud.user.Account; -@APICommand(name = "createIpForwardingRule", description = "Creates an ip forwarding rule", responseObject = FirewallRuleResponse.class) +@APICommand(name = "createIpForwardingRule", description = "Creates an ip forwarding rule", responseObject = FirewallRuleResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateIpForwardingRuleCmd extends BaseAsyncCreateCmd implements StaticNatRule { public static final Logger s_logger = Logger.getLogger(CreateIpForwardingRuleCmd.class.getName()); @@ -318,6 +319,11 @@ public class CreateIpForwardingRuleCmd extends BaseAsyncCreateCmd implements Sta return null; } + @Override + public boolean isDisplay() { + return true; + } + @Override public IAMEntityType getEntityType() { return IAMEntityType.FirewallRule; diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java index 66a9f8aee9e..52a5ba777e0 100644 --- a/api/src/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java @@ -34,7 +34,8 @@ import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.rules.FirewallRule; -@APICommand(name = "deleteIpForwardingRule", description = "Deletes an ip forwarding rule", responseObject = SuccessResponse.class) +@APICommand(name = "deleteIpForwardingRule", description = "Deletes an ip forwarding rule", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteIpForwardingRuleCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteIpForwardingRuleCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java b/api/src/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java index 351d3ae2c2b..1df77ec0fda 100644 --- a/api/src/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java @@ -35,7 +35,8 @@ import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.IpAddress; -@APICommand(name = "disableStaticNat", description = "Disables static rule for given ip address", responseObject = SuccessResponse.class) +@APICommand(name = "disableStaticNat", description = "Disables static rule for given ip address", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DisableStaticNatCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeletePortForwardingRuleCmd.class.getName()); private static final String s_name = "disablestaticnatresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java b/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java index 832cbc2d06d..aa4e28768a6 100644 --- a/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java @@ -36,7 +36,8 @@ import com.cloud.network.IpAddress; import com.cloud.user.Account; import com.cloud.uservm.UserVm; -@APICommand(name = "enableStaticNat", description = "Enables static nat for given ip address", responseObject = SuccessResponse.class) +@APICommand(name = "enableStaticNat", description = "Enables static nat for given ip address", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class EnableStaticNatCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(CreateIpForwardingRuleCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java b/api/src/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java index dca1c2379e5..ecb0c44c700 100644 --- a/api/src/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java @@ -35,7 +35,8 @@ import com.cloud.network.rules.FirewallRule; import com.cloud.network.rules.StaticNatRule; import com.cloud.utils.Pair; -@APICommand(name = "listIpForwardingRules", description = "List the ip forwarding rules", responseObject = FirewallRuleResponse.class) +@APICommand(name = "listIpForwardingRules", description = "List the ip forwarding rules", responseObject = FirewallRuleResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListIpForwardingRulesCmd extends BaseListProjectAndAccountResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListIpForwardingRulesCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java index 9934a4fefcc..e47fa8b2cf7 100644 --- a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java @@ -19,9 +19,7 @@ package org.apache.cloudstack.api.command.user.network; import java.util.ArrayList; import java.util.List; -import org.apache.commons.lang.StringUtils; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiErrorCode; @@ -32,6 +30,8 @@ import org.apache.cloudstack.api.response.NetworkACLItemResponse; import org.apache.cloudstack.api.response.NetworkACLResponse; import org.apache.cloudstack.api.response.NetworkResponse; import org.apache.cloudstack.context.CallContext; +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; @@ -42,7 +42,9 @@ import com.cloud.utils.net.NetUtils; @APICommand(name = "createNetworkACL", description = "Creates a ACL rule in the given network (the network has to belong to VPC)", - responseObject = NetworkACLItemResponse.class) + responseObject = NetworkACLItemResponse.class, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class CreateNetworkACLCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreateNetworkACLCmd.class.getName()); @@ -95,9 +97,15 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd { @Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, description = "scl entry action, allow or deny") private String action; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + // /////////////////////////////////////////////////// // ///////////////// Accessors /////////////////////// // /////////////////////////////////////////////////// + public Boolean getDisplay() { + return display; + } public String getProtocol() { String p = protocol.trim(); diff --git a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLListCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLListCmd.java index cd0eb3237bd..07156cf944f 100644 --- a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLListCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLListCmd.java @@ -16,8 +16,7 @@ // under the License. package org.apache.cloudstack.api.command.user.network; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiErrorCode; @@ -26,6 +25,7 @@ import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.NetworkACLResponse; import org.apache.cloudstack.api.response.VpcResponse; +import org.apache.log4j.Logger; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; @@ -34,7 +34,8 @@ import com.cloud.network.vpc.NetworkACL; import com.cloud.network.vpc.Vpc; import com.cloud.user.Account; -@APICommand(name = "createNetworkACLList", description = "Creates a Network ACL for the given VPC", responseObject = NetworkACLResponse.class) +@APICommand(name = "createNetworkACLList", description = "Creates a Network ACL for the given VPC", responseObject = NetworkACLResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateNetworkACLListCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreateNetworkACLListCmd.class.getName()); @@ -57,6 +58,9 @@ public class CreateNetworkACLListCmd extends BaseAsyncCreateCmd { description = "Id of the VPC associated with this network ACL List") private Long vpcId; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the list to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + // /////////////////////////////////////////////////// // ///////////////// Accessors /////////////////////// // /////////////////////////////////////////////////// @@ -73,6 +77,10 @@ public class CreateNetworkACLListCmd extends BaseAsyncCreateCmd { return vpcId; } + public Boolean getDisplay() { + return display; + } + // /////////////////////////////////////////////////// // ///////////// API Implementation/////////////////// // /////////////////////////////////////////////////// @@ -84,7 +92,7 @@ public class CreateNetworkACLListCmd extends BaseAsyncCreateCmd { @Override public void create() { - NetworkACL result = _networkACLService.createNetworkACL(getName(), getDescription(), getVpcId()); + NetworkACL result = _networkACLService.createNetworkACL(getName(), getDescription(), getVpcId(), getDisplay()); setEntityId(result.getId()); setEntityUuid(result.getUuid()); } diff --git a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java index db3d2cb7d08..172b4c60bef 100644 --- a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.network; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiErrorCode; @@ -44,7 +45,8 @@ import com.cloud.network.Network; import com.cloud.network.Network.GuestType; import com.cloud.offering.NetworkOffering; -@APICommand(name = "createNetwork", description = "Creates a network", responseObject = NetworkResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.Network }) +@APICommand(name = "createNetwork", description = "Creates a network", responseObject = NetworkResponse.class, responseView = ResponseView.Restricted, entityType = {IAMEntityType.Network}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateNetworkCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(CreateNetworkCmd.class.getName()); @@ -138,7 +140,7 @@ public class CreateNetworkCmd extends BaseCmd { @Parameter(name = ApiConstants.DISPLAY_NETWORK, type = CommandType.BOOLEAN, - description = "an optional field, whether to the display the network to the end user or not.") + description = "an optional field, whether to the display the network to the end user or not.", authorized = {RoleType.Admin}) private Boolean displayNetwork; @Parameter(name = ApiConstants.ACL_ID, type = CommandType.UUID, entityType = NetworkACLResponse.class, description = "Network ACL Id associated for the network") diff --git a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java index 7413ea55b00..ecc651dbfa8 100644 --- a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java @@ -32,7 +32,8 @@ import com.cloud.event.EventTypes; import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.Account; -@APICommand(name = "deleteNetworkACL", description = "Deletes a Network ACL", responseObject = SuccessResponse.class) +@APICommand(name = "deleteNetworkACL", description = "Deletes a Network ACL", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteNetworkACLCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteNetworkACLCmd.class.getName()); private static final String s_name = "deletenetworkaclresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLListCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLListCmd.java index 632d710c39f..3b3a4ec4ae4 100644 --- a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLListCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLListCmd.java @@ -32,7 +32,8 @@ import com.cloud.event.EventTypes; import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.Account; -@APICommand(name = "deleteNetworkACLList", description = "Deletes a Network ACL", responseObject = SuccessResponse.class) +@APICommand(name = "deleteNetworkACLList", description = "Deletes a Network ACL", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteNetworkACLListCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteNetworkACLListCmd.class.getName()); private static final String s_name = "deletenetworkacllistresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java index 4f6e9b69c00..50bc94a1268 100644 --- a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java @@ -36,7 +36,8 @@ import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.Network; -@APICommand(name = "deleteNetwork", description = "Deletes a network", responseObject = SuccessResponse.class, entityType = { IAMEntityType.Network }) +@APICommand(name = "deleteNetwork", description = "Deletes a network", responseObject = SuccessResponse.class, entityType = {IAMEntityType.Network}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteNetworkCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteNetworkOfferingCmd.class.getName()); private static final String s_name = "deletenetworkresponse"; @@ -79,7 +80,7 @@ public class DeleteNetworkCmd extends BaseAsyncCmd { boolean result = _networkService.deleteNetwork(id, isForced()); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLListsCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLListsCmd.java index 2e50bb8cf22..c115fb76165 100644 --- a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLListsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLListsCmd.java @@ -19,8 +19,7 @@ package org.apache.cloudstack.api.command.user.network; import java.util.ArrayList; import java.util.List; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; @@ -29,11 +28,13 @@ import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.NetworkACLResponse; import org.apache.cloudstack.api.response.NetworkResponse; import org.apache.cloudstack.api.response.VpcResponse; +import org.apache.log4j.Logger; import com.cloud.network.vpc.NetworkACL; import com.cloud.utils.Pair; -@APICommand(name = "listNetworkACLLists", description = "Lists all network ACLs", responseObject = NetworkACLResponse.class) +@APICommand(name = "listNetworkACLLists", description = "Lists all network ACLs", responseObject = NetworkACLResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListNetworkACLListsCmd extends BaseListProjectAndAccountResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListNetworkACLListsCmd.class.getName()); @@ -54,6 +55,9 @@ public class ListNetworkACLListsCmd extends BaseListProjectAndAccountResourcesCm @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "list network ACLs by specified name") private String name; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -74,6 +78,13 @@ public class ListNetworkACLListsCmd extends BaseListProjectAndAccountResourcesCm return name; } + @Override + public Boolean getDisplay() { + if (display != null) { + return display; + } + return super.getDisplay(); + } ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java index 7f8aef4cd77..4f9065bf2cd 100644 --- a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java @@ -19,8 +19,7 @@ package org.apache.cloudstack.api.command.user.network; import java.util.ArrayList; import java.util.List; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListTaggedResourcesCmd; @@ -29,11 +28,13 @@ import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.NetworkACLItemResponse; import org.apache.cloudstack.api.response.NetworkACLResponse; import org.apache.cloudstack.api.response.NetworkResponse; +import org.apache.log4j.Logger; import com.cloud.network.vpc.NetworkACLItem; import com.cloud.utils.Pair; -@APICommand(name = "listNetworkACLs", description = "Lists all network ACL items", responseObject = NetworkACLItemResponse.class) +@APICommand(name = "listNetworkACLs", description = "Lists all network ACL items", responseObject = NetworkACLItemResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListNetworkACLsCmd extends BaseListTaggedResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListNetworkACLsCmd.class.getName()); @@ -61,6 +62,9 @@ public class ListNetworkACLsCmd extends BaseListTaggedResourcesCmd { @Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, description = "list network ACL Items by Action") private String action; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -89,6 +93,14 @@ public class ListNetworkACLsCmd extends BaseListTaggedResourcesCmd { return action; } + @Override + public Boolean getDisplay() { + if (display != null) { + return display; + } + return super.getDisplay(); + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkOfferingsCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkOfferingsCmd.java index 552a64a63b2..a08e28fb6d4 100644 --- a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkOfferingsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkOfferingsCmd.java @@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.offering.NetworkOffering; -@APICommand(name = "listNetworkOfferings", description = "Lists all available network offerings.", responseObject = NetworkOfferingResponse.class) +@APICommand(name = "listNetworkOfferings", description = "Lists all available network offerings.", responseObject = NetworkOfferingResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListNetworkOfferingsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListNetworkOfferingsCmd.class.getName()); private static final String Name = "listnetworkofferingsresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java index c64031ee8dc..455d8dc6a0f 100644 --- a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java @@ -22,6 +22,7 @@ import java.util.List; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListTaggedResourcesCmd; @@ -36,7 +37,8 @@ import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.network.Network; import com.cloud.utils.Pair; -@APICommand(name = "listNetworks", description = "Lists all available networks.", responseObject = NetworkResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.Network }) +@APICommand(name = "listNetworks", description = "Lists all available networks.", responseObject = NetworkResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.Network }, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListNetworksCmd extends BaseListTaggedResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListNetworksCmd.class.getName()); private static final String Name = "listnetworksresponse"; @@ -83,6 +85,9 @@ public class ListNetworksCmd extends BaseListTaggedResourcesCmd { @Parameter(name = ApiConstants.FOR_VPC, type = CommandType.BOOLEAN, description = "the network belongs to vpc") private Boolean forVpc; + @Parameter(name = ApiConstants.DISPLAY_NETWORK, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -139,6 +144,13 @@ public class ListNetworksCmd extends BaseListTaggedResourcesCmd { return forVpc; } + @Override + public Boolean getDisplay() { + if (display != null) { + return display; + } + return super.getDisplay(); + } ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ReplaceNetworkACLListCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/ReplaceNetworkACLListCmd.java index de1f163ae0b..d005718428e 100644 --- a/api/src/org/apache/cloudstack/api/command/user/network/ReplaceNetworkACLListCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/network/ReplaceNetworkACLListCmd.java @@ -34,7 +34,8 @@ import com.cloud.event.EventTypes; import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.Account; -@APICommand(name = "replaceNetworkACLList", description = "Replaces ACL associated with a Network or private gateway", responseObject = SuccessResponse.class) +@APICommand(name = "replaceNetworkACLList", description = "Replaces ACL associated with a Network or private gateway", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ReplaceNetworkACLListCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ReplaceNetworkACLListCmd.class.getName()); private static final String s_name = "replacenetworkacllistresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/network/RestartNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/RestartNetworkCmd.java index ce0df8ca74f..6baafda7c89 100644 --- a/api/src/org/apache/cloudstack/api/command/user/network/RestartNetworkCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/network/RestartNetworkCmd.java @@ -41,7 +41,9 @@ import com.cloud.network.Network; @APICommand(name = "restartNetwork", description = "Restarts the network; includes 1) restarting network elements - virtual routers, dhcp servers 2) reapplying all public ips 3) reapplying loadBalancing/portForwarding rules", - responseObject = IPAddressResponse.class, entityType = { IAMEntityType.Network }) + responseObject = IPAddressResponse.class, entityType = {IAMEntityType.Network}, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class RestartNetworkCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(RestartNetworkCmd.class.getName()); private static final String s_name = "restartnetworkresponse"; @@ -94,7 +96,7 @@ public class RestartNetworkCmd extends BaseAsyncCmd { boolean result = _networkService.restartNetwork(this, getCleanup()); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to restart network"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLItemCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLItemCmd.java index e684dcf6f60..eb095df2091 100644 --- a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLItemCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLItemCmd.java @@ -18,6 +18,7 @@ package org.apache.cloudstack.api.command.user.network; import java.util.List; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiErrorCode; @@ -33,7 +34,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.vpc.NetworkACLItem; import com.cloud.user.Account; -@APICommand(name = "updateNetworkACLItem", description = "Updates ACL Item with specified Id", responseObject = NetworkACLItemResponse.class) +@APICommand(name = "updateNetworkACLItem", description = "Updates ACL Item with specified Id", responseObject = NetworkACLItemResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateNetworkACLItemCmd extends BaseAsyncCustomIdCmd { public static final Logger s_logger = Logger.getLogger(UpdateNetworkACLItemCmd.class.getName()); @@ -80,9 +82,15 @@ public class UpdateNetworkACLItemCmd extends BaseAsyncCustomIdCmd { @Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, description = "scl entry action, allow or deny") private String action; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + // /////////////////////////////////////////////////// // ///////////////// Accessors /////////////////////// // /////////////////////////////////////////////////// + public Boolean getDisplay() { + return display; + } public Long getId() { return id; @@ -164,7 +172,7 @@ public class UpdateNetworkACLItemCmd extends BaseAsyncCustomIdCmd { CallContext.current().setEventDetails("Rule Id: " + getId()); NetworkACLItem aclItem = _networkACLService.updateNetworkACLItem(getId(), getProtocol(), getSourceCidrList(), getTrafficType(), getAction(), getNumber(), getSourcePortStart(), - getSourcePortEnd(), getIcmpCode(), getIcmpType(), this.getCustomId()); + getSourcePortEnd(), getIcmpCode(), getIcmpType(), this.getCustomId(), this.getDisplay()); if (aclItem == null) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update network ACL Item"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLListCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLListCmd.java index 333090c69fc..c58f9658364 100644 --- a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLListCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLListCmd.java @@ -16,6 +16,7 @@ // under the License. package org.apache.cloudstack.api.command.user.network; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseAsyncCustomIdCmd; @@ -30,7 +31,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.vpc.NetworkACL; import com.cloud.user.Account; -@APICommand(name = "updateNetworkACLList", description = "Updates Network ACL list", responseObject = SuccessResponse.class, since = "4.4") +@APICommand(name = "updateNetworkACLList", description = "Updates Network ACL list", responseObject = SuccessResponse.class, since = "4.4", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateNetworkACLListCmd extends BaseAsyncCustomIdCmd { public static final Logger s_logger = Logger.getLogger(UpdateNetworkACLListCmd.class.getName()); private static final String s_name = "updatenetworkacllistresponse"; @@ -42,6 +44,9 @@ public class UpdateNetworkACLListCmd extends BaseAsyncCustomIdCmd { @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkACLResponse.class, required = true, description = "the ID of the network ACL") private Long id; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the list to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -50,6 +55,10 @@ public class UpdateNetworkACLListCmd extends BaseAsyncCustomIdCmd { return id; } + public Boolean getDisplay() { + return display; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -76,7 +85,7 @@ public class UpdateNetworkACLListCmd extends BaseAsyncCustomIdCmd { @Override public void execute() throws ResourceUnavailableException { - NetworkACL acl = _networkACLService.updateNetworkACL(id, this.getCustomId()); + NetworkACL acl = _networkACLService.updateNetworkACL(id, this.getCustomId(), getDisplay()); NetworkACLResponse aclResponse = _responseGenerator.createNetworkACLResponse(acl); setResponseObject(aclResponse); aclResponse.setResponseName(getCommandName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java index 2d7643c275d..aea7448ab3c 100644 --- a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.network; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.acl.SecurityChecker.AccessType; import org.apache.cloudstack.api.ACL; import org.apache.cloudstack.api.APICommand; @@ -42,7 +43,8 @@ import com.cloud.offering.NetworkOffering; import com.cloud.user.Account; import com.cloud.user.User; -@APICommand(name = "updateNetwork", description = "Updates a network", responseObject = NetworkResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.Network }) +@APICommand(name = "updateNetwork", description = "Updates a network", responseObject = NetworkResponse.class, responseView = ResponseView.Restricted, entityType = {IAMEntityType.Network}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateNetworkCmd extends BaseAsyncCustomIdCmd { public static final Logger s_logger = Logger.getLogger(UpdateNetworkCmd.class.getName()); @@ -76,7 +78,7 @@ public class UpdateNetworkCmd extends BaseAsyncCustomIdCmd { @Parameter(name = ApiConstants.DISPLAY_NETWORK, type = CommandType.BOOLEAN, - description = "an optional field, whether to the display the network to the end user or not.") + description = "an optional field, whether to the display the network to the end user or not.", authorized = {RoleType.Admin}) private Boolean displayNetwork; ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/offering/ListDiskOfferingsCmd.java b/api/src/org/apache/cloudstack/api/command/user/offering/ListDiskOfferingsCmd.java index 954b64e2a41..0e4806a534c 100644 --- a/api/src/org/apache/cloudstack/api/command/user/offering/ListDiskOfferingsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/offering/ListDiskOfferingsCmd.java @@ -26,7 +26,8 @@ import org.apache.cloudstack.api.response.DiskOfferingResponse; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ListResponse; -@APICommand(name = "listDiskOfferings", description = "Lists all available disk offerings.", responseObject = DiskOfferingResponse.class) +@APICommand(name = "listDiskOfferings", description = "Lists all available disk offerings.", responseObject = DiskOfferingResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListDiskOfferingsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListDiskOfferingsCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java b/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java index 08c69e830c2..abeebcbfae6 100644 --- a/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java @@ -27,7 +27,8 @@ import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.ServiceOfferingResponse; import org.apache.cloudstack.api.response.UserVmResponse; -@APICommand(name = "listServiceOfferings", description = "Lists all available service offerings.", responseObject = ServiceOfferingResponse.class) +@APICommand(name = "listServiceOfferings", description = "Lists all available service offerings.", responseObject = ServiceOfferingResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListServiceOfferingsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListServiceOfferingsCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java index 66c64a6e3f9..5b1b76e95ea 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java @@ -31,7 +31,8 @@ import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.projects.Project; -@APICommand(name = "activateProject", description = "Activates a project", responseObject = ProjectResponse.class, since = "3.0.0") +@APICommand(name = "activateProject", description = "Activates a project", responseObject = ProjectResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ActivateProjectCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ActivateProjectCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java index dcb83a89031..e8a045ca1cc 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java @@ -34,7 +34,8 @@ import com.cloud.exception.ResourceAllocationException; import com.cloud.projects.Project; import com.cloud.user.Account; -@APICommand(name = "createProject", description = "Creates a project", responseObject = ProjectResponse.class, since = "3.0.0") +@APICommand(name = "createProject", description = "Creates a project", responseObject = ProjectResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateProjectCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreateProjectCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java index 88205e856bc..3a2e48d51ab 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java @@ -32,7 +32,8 @@ import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.projects.Project; -@APICommand(name = "deleteProject", description = "Deletes a project", responseObject = SuccessResponse.class, since = "3.0.0") +@APICommand(name = "deleteProject", description = "Deletes a project", responseObject = SuccessResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteProjectCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteProjectCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java index 9d4d8383283..9f8baad6408 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java @@ -31,7 +31,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.event.EventTypes; import com.cloud.user.Account; -@APICommand(name = "deleteProjectInvitation", description = "Accepts or declines project invitation", responseObject = SuccessResponse.class, since = "3.0.0") +@APICommand(name = "deleteProjectInvitation", description = "Accepts or declines project invitation", responseObject = SuccessResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteProjectInvitationCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteProjectInvitationCmd.class.getName()); private static final String s_name = "deleteprojectinvitationresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java index 0e9e7ae4aeb..dc607e4faf0 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java @@ -29,7 +29,9 @@ import org.apache.cloudstack.api.response.ProjectResponse; @APICommand(name = "listProjectInvitations", description = "Lists projects and provides detailed information for listed projects", responseObject = ProjectInvitationResponse.class, - since = "3.0.0") + since = "3.0.0", + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class ListProjectInvitationsCmd extends BaseListAccountResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListProjectInvitationsCmd.class.getName()); private static final String s_name = "listprojectinvitationsresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java index 2cf610634b7..7b479b1a9ff 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java @@ -35,7 +35,9 @@ import com.cloud.exception.InvalidParameterValueException; @APICommand(name = "listProjects", description = "Lists projects and provides detailed information for listed projects", responseObject = ProjectResponse.class, - since = "3.0.0") + since = "3.0.0", + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class ListProjectsCmd extends BaseListAccountResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListProjectsCmd.class.getName()); private static final String s_name = "listprojectsresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java index c2a1885472d..69a4b77c7a5 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java @@ -33,7 +33,8 @@ import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.projects.Project; -@APICommand(name = "suspendProject", description = "Suspends a project", responseObject = ProjectResponse.class, since = "3.0.0") +@APICommand(name = "suspendProject", description = "Suspends a project", responseObject = ProjectResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class SuspendProjectCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(SuspendProjectCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java index 78903bf80e2..11e5e35bac3 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java @@ -32,7 +32,8 @@ import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceAllocationException; import com.cloud.projects.Project; -@APICommand(name = "updateProject", description = "Updates a project", responseObject = ProjectResponse.class, since = "3.0.0") +@APICommand(name = "updateProject", description = "Updates a project", responseObject = ProjectResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateProjectCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(UpdateProjectCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java index dda7b5400ba..79e3f8a9cfd 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java @@ -31,7 +31,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.event.EventTypes; import com.cloud.user.Account; -@APICommand(name = "updateProjectInvitation", description = "Accepts or declines project invitation", responseObject = SuccessResponse.class, since = "3.0.0") +@APICommand(name = "updateProjectInvitation", description = "Accepts or declines project invitation", responseObject = SuccessResponse.class, since = "3.0.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateProjectInvitationCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(UpdateProjectInvitationCmd.class.getName()); private static final String s_name = "updateprojectinvitationresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java index c369b9cf6f3..9a0b186d9ea 100644 --- a/api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java @@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.RegionResponse; import org.apache.cloudstack.region.Region; import org.apache.cloudstack.region.RegionService; -@APICommand(name = "listRegions", description = "Lists Regions", responseObject = RegionResponse.class) +@APICommand(name = "listRegions", description = "Lists Regions", responseObject = RegionResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListRegionsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListRegionsCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/AssignToGlobalLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/AssignToGlobalLoadBalancerRuleCmd.java index 1fe73b555e1..177939b2327 100644 --- a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/AssignToGlobalLoadBalancerRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/AssignToGlobalLoadBalancerRuleCmd.java @@ -49,7 +49,9 @@ import com.cloud.utils.db.EntityManager; @APICommand(name = "assignToGlobalLoadBalancerRule", description = "Assign load balancer rule or list of load " + "balancer rules to a global load balancer rules.", - responseObject = SuccessResponse.class) + responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class AssignToGlobalLoadBalancerRuleCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(AssignToGlobalLoadBalancerRuleCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/CreateGlobalLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/CreateGlobalLoadBalancerRuleCmd.java index 550d81755eb..701570327cc 100644 --- a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/CreateGlobalLoadBalancerRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/CreateGlobalLoadBalancerRuleCmd.java @@ -39,7 +39,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.region.ha.GlobalLoadBalancerRule; import com.cloud.region.ha.GlobalLoadBalancingRulesService; -@APICommand(name = "createGlobalLoadBalancerRule", description = "Creates a global load balancer rule", responseObject = GlobalLoadBalancerResponse.class) +@APICommand(name = "createGlobalLoadBalancerRule", description = "Creates a global load balancer rule", responseObject = GlobalLoadBalancerResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateGlobalLoadBalancerRuleCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreateGlobalLoadBalancerRuleCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/DeleteGlobalLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/DeleteGlobalLoadBalancerRuleCmd.java index 2e96965bdce..dfb093d5b16 100644 --- a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/DeleteGlobalLoadBalancerRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/DeleteGlobalLoadBalancerRuleCmd.java @@ -37,7 +37,8 @@ import com.cloud.region.ha.GlobalLoadBalancerRule; import com.cloud.region.ha.GlobalLoadBalancingRulesService; import com.cloud.user.Account; -@APICommand(name = "deleteGlobalLoadBalancerRule", description = "Deletes a global load balancer rule.", responseObject = SuccessResponse.class) +@APICommand(name = "deleteGlobalLoadBalancerRule", description = "Deletes a global load balancer rule.", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteGlobalLoadBalancerRuleCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteGlobalLoadBalancerRuleCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/ListGlobalLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/ListGlobalLoadBalancerRuleCmd.java index f37aba2ac09..e5630f87e14 100644 --- a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/ListGlobalLoadBalancerRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/ListGlobalLoadBalancerRuleCmd.java @@ -35,7 +35,8 @@ import org.apache.cloudstack.api.response.RegionResponse; import com.cloud.region.ha.GlobalLoadBalancerRule; import com.cloud.region.ha.GlobalLoadBalancingRulesService; -@APICommand(name = "listGlobalLoadBalancerRules", description = "Lists load balancer rules.", responseObject = GlobalLoadBalancerResponse.class) +@APICommand(name = "listGlobalLoadBalancerRules", description = "Lists load balancer rules.", responseObject = GlobalLoadBalancerResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListGlobalLoadBalancerRuleCmd extends BaseListTaggedResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListGlobalLoadBalancerRuleCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/RemoveFromGlobalLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/RemoveFromGlobalLoadBalancerRuleCmd.java index b30f4d8d546..af3fa349322 100644 --- a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/RemoveFromGlobalLoadBalancerRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/RemoveFromGlobalLoadBalancerRuleCmd.java @@ -43,7 +43,9 @@ import com.cloud.utils.StringUtils; @APICommand(name = "removeFromGlobalLoadBalancerRule", description = "Removes a load balancer rule association with" + " global load balancer rule", - responseObject = SuccessResponse.class) + responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class RemoveFromGlobalLoadBalancerRuleCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(RemoveFromGlobalLoadBalancerRuleCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/UpdateGlobalLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/UpdateGlobalLoadBalancerRuleCmd.java index e8c5326c604..6c75400c2df 100644 --- a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/UpdateGlobalLoadBalancerRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/UpdateGlobalLoadBalancerRuleCmd.java @@ -34,7 +34,8 @@ import com.cloud.region.ha.GlobalLoadBalancerRule; import com.cloud.region.ha.GlobalLoadBalancingRulesService; import com.cloud.user.Account; -@APICommand(name = "updateGlobalLoadBalancerRule", description = "update global load balancer rules.", responseObject = GlobalLoadBalancerResponse.class) +@APICommand(name = "updateGlobalLoadBalancerRule", description = "update global load balancer rules.", responseObject = GlobalLoadBalancerResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateGlobalLoadBalancerRuleCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(GlobalLoadBalancerResponse.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java b/api/src/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java index ccaca2dbbcc..366401f3a6f 100644 --- a/api/src/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java @@ -31,7 +31,8 @@ import org.apache.cloudstack.api.response.UserResponse; import com.cloud.user.Account; -@APICommand(name = "getCloudIdentifier", description = "Retrieves a cloud identifier.", responseObject = CloudIdentifierResponse.class) +@APICommand(name = "getCloudIdentifier", description = "Retrieves a cloud identifier.", responseObject = CloudIdentifierResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class GetCloudIdentifierCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(GetCloudIdentifierCmd.class.getName()); private static final String s_name = "getcloudidentifierresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java b/api/src/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java index 5e546f4dd11..edaa4051c76 100644 --- a/api/src/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java @@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.user.Account; -@APICommand(name = "listHypervisors", description = "List hypervisors", responseObject = HypervisorResponse.class) +@APICommand(name = "listHypervisors", description = "List hypervisors", responseObject = HypervisorResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListHypervisorsCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(UpgradeRouterCmd.class.getName()); private static final String s_name = "listhypervisorsresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java b/api/src/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java index ba3cfc8d951..bd8942a1cb8 100644 --- a/api/src/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java @@ -30,7 +30,8 @@ import org.apache.cloudstack.api.response.ResourceLimitResponse; import com.cloud.configuration.ResourceLimit; -@APICommand(name = "listResourceLimits", description = "Lists resource limits.", responseObject = ResourceLimitResponse.class) +@APICommand(name = "listResourceLimits", description = "Lists resource limits.", responseObject = ResourceLimitResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListResourceLimitsCmd extends BaseListProjectAndAccountResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListResourceLimitsCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java b/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java index 9a3e1b6225c..48ac9c6de5d 100644 --- a/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java @@ -36,7 +36,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.configuration.ResourceCount; import com.cloud.user.Account; -@APICommand(name = "updateResourceCount", description = "Recalculate and update resource count for an account or domain.", responseObject = ResourceCountResponse.class) +@APICommand(name = "updateResourceCount", description = "Recalculate and update resource count for an account or domain.", responseObject = ResourceCountResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateResourceCountCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(UpdateResourceCountCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java b/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java index c33a9e71cc8..015cafb4960 100644 --- a/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java @@ -31,7 +31,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.configuration.ResourceLimit; -@APICommand(name = "updateResourceLimit", description = "Updates resource limits for an account or domain.", responseObject = ResourceLimitResponse.class) +@APICommand(name = "updateResourceLimit", description = "Updates resource limits for an account or domain.", responseObject = ResourceLimitResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateResourceLimitCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(UpdateResourceLimitCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java index 06503626384..4eca10fca0e 100644 --- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java @@ -45,7 +45,9 @@ import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.security.SecurityRule; import com.cloud.utils.StringUtils; -@APICommand(name = "authorizeSecurityGroupEgress", responseObject = SecurityGroupRuleResponse.class, description = "Authorizes a particular egress rule for this security group", since = "3.0.0", entityType = { IAMEntityType.SecurityGroup }) +@APICommand(name = "authorizeSecurityGroupEgress", responseObject = SecurityGroupRuleResponse.class, description = "Authorizes a particular egress rule for this security group", since = "3.0.0", entityType = {IAMEntityType.SecurityGroup}, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) @SuppressWarnings("rawtypes") public class AuthorizeSecurityGroupEgressCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(AuthorizeSecurityGroupIngressCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java index 13de69c110a..41cea4124c0 100644 --- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java @@ -45,7 +45,9 @@ import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.security.SecurityRule; import com.cloud.utils.StringUtils; -@APICommand(name = "authorizeSecurityGroupIngress", responseObject = SecurityGroupRuleResponse.class, description = "Authorizes a particular ingress rule for this security group", entityType = { IAMEntityType.SecurityGroup }) +@APICommand(name = "authorizeSecurityGroupIngress", responseObject = SecurityGroupRuleResponse.class, description = "Authorizes a particular ingress rule for this security group", entityType = {IAMEntityType.SecurityGroup}, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) @SuppressWarnings("rawtypes") public class AuthorizeSecurityGroupIngressCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(AuthorizeSecurityGroupIngressCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java index 824db258bd4..1f7f872f1e0 100644 --- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java @@ -33,7 +33,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.network.security.SecurityGroup; import com.cloud.user.Account; -@APICommand(name = "createSecurityGroup", responseObject = SecurityGroupResponse.class, description = "Creates a security group", entityType = { IAMEntityType.SecurityGroup }) +@APICommand(name = "createSecurityGroup", responseObject = SecurityGroupResponse.class, description = "Creates a security group", entityType = {IAMEntityType.SecurityGroup}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateSecurityGroupCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(CreateSecurityGroupCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java index 03634adbb2d..8e08254d367 100644 --- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java @@ -36,7 +36,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceInUseException; -@APICommand(name = "deleteSecurityGroup", description = "Deletes security group", responseObject = SuccessResponse.class, entityType = { IAMEntityType.SecurityGroup }) +@APICommand(name = "deleteSecurityGroup", description = "Deletes security group", responseObject = SuccessResponse.class, entityType = {IAMEntityType.SecurityGroup}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteSecurityGroupCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeleteSecurityGroupCmd.class.getName()); private static final String s_name = "deletesecuritygroupresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java index 23a8ad0eb40..02be63d0b43 100644 --- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java @@ -28,7 +28,8 @@ import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.SecurityGroupResponse; import org.apache.cloudstack.api.response.UserVmResponse; -@APICommand(name = "listSecurityGroups", description = "Lists security groups", responseObject = SecurityGroupResponse.class, entityType = { IAMEntityType.SecurityGroup }) +@APICommand(name = "listSecurityGroups", description = "Lists security groups", responseObject = SecurityGroupResponse.class, entityType = {IAMEntityType.SecurityGroup}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListSecurityGroupsCmd extends BaseListTaggedResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListSecurityGroupsCmd.class.getName()); @@ -78,7 +79,7 @@ public class ListSecurityGroupsCmd extends BaseListTaggedResourcesCmd { public void execute() { ListResponse response = _queryService.searchForSecurityGroups(this); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } @Override diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java index a93bee5f68f..d1ffc1e5ea4 100644 --- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java @@ -35,7 +35,9 @@ import com.cloud.network.security.SecurityRule; import com.cloud.user.Account; -@APICommand(name = "revokeSecurityGroupEgress", responseObject = SuccessResponse.class, description = "Deletes a particular egress rule from this security group", since = "3.0.0", entityType = { IAMEntityType.SecurityGroup }) +@APICommand(name = "revokeSecurityGroupEgress", responseObject = SuccessResponse.class, description = "Deletes a particular egress rule from this security group", since = "3.0.0", entityType = {IAMEntityType.SecurityGroup}, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class RevokeSecurityGroupEgressCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(RevokeSecurityGroupEgressCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java index 3a39cedbe84..8543e0e1dee 100644 --- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java @@ -36,7 +36,8 @@ import com.cloud.network.security.SecurityGroup; import com.cloud.network.security.SecurityRule; import com.cloud.user.Account; -@APICommand(name = "revokeSecurityGroupIngress", responseObject = SuccessResponse.class, description = "Deletes a particular ingress rule from this security group", entityType = { IAMEntityType.SecurityGroup }) +@APICommand(name = "revokeSecurityGroupIngress", responseObject = SuccessResponse.class, description = "Deletes a particular ingress rule from this security group", entityType = {IAMEntityType.SecurityGroup}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class RevokeSecurityGroupIngressCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(RevokeSecurityGroupIngressCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java index 90975860fcb..20205185283 100644 --- a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java @@ -42,7 +42,8 @@ import com.cloud.storage.Snapshot; import com.cloud.storage.Volume; import com.cloud.user.Account; -@APICommand(name = "createSnapshot", description = "Creates an instant snapshot of a volume.", responseObject = SnapshotResponse.class, entityType = { IAMEntityType.Snapshot }) +@APICommand(name = "createSnapshot", description = "Creates an instant snapshot of a volume.", responseObject = SnapshotResponse.class, entityType = {IAMEntityType.Snapshot}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateSnapshotCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreateSnapshotCmd.class.getName()); private static final String s_name = "createsnapshotresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java index 5ecbaaa2bc9..c1381c8d7cc 100644 --- a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java @@ -34,7 +34,8 @@ import com.cloud.storage.Volume; import com.cloud.storage.snapshot.SnapshotPolicy; import com.cloud.user.Account; -@APICommand(name = "createSnapshotPolicy", description = "Creates a snapshot policy for the account.", responseObject = SnapshotPolicyResponse.class) +@APICommand(name = "createSnapshotPolicy", description = "Creates a snapshot policy for the account.", responseObject = SnapshotPolicyResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateSnapshotPolicyCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(CreateSnapshotPolicyCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java index 3771300e245..7d57c214597 100644 --- a/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java @@ -36,7 +36,8 @@ import com.cloud.event.EventTypes; import com.cloud.storage.Snapshot; import com.cloud.user.Account; -@APICommand(name = "deleteSnapshot", description = "Deletes a snapshot of a disk volume.", responseObject = SuccessResponse.class, entityType = { IAMEntityType.Snapshot }) +@APICommand(name = "deleteSnapshot", description = "Deletes a snapshot of a disk volume.", responseObject = SuccessResponse.class, entityType = {IAMEntityType.Snapshot}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteSnapshotCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteSnapshotCmd.class.getName()); private static final String s_name = "deletesnapshotresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java index bcccf8b4f3e..2d97d3df261 100644 --- a/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java @@ -31,7 +31,8 @@ import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.user.Account; -@APICommand(name = "deleteSnapshotPolicies", description = "Deletes snapshot policies for the account.", responseObject = SuccessResponse.class) +@APICommand(name = "deleteSnapshotPolicies", description = "Deletes snapshot policies for the account.", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteSnapshotPoliciesCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeleteSnapshotPoliciesCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java index 7c2899fe67c..ffafe2df7b7 100644 --- a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java @@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.VolumeResponse; import com.cloud.storage.snapshot.SnapshotPolicy; import com.cloud.utils.Pair; -@APICommand(name = "listSnapshotPolicies", description = "Lists snapshot policies.", responseObject = SnapshotPolicyResponse.class) +@APICommand(name = "listSnapshotPolicies", description = "Lists snapshot policies.", responseObject = SnapshotPolicyResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListSnapshotPoliciesCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListSnapshotPoliciesCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java index b44e11f2984..ed26e7ff6f0 100644 --- a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java @@ -35,7 +35,8 @@ import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.storage.Snapshot; import com.cloud.utils.Pair; -@APICommand(name = "listSnapshots", description = "Lists all available snapshots for the account.", responseObject = SnapshotResponse.class, entityType = { IAMEntityType.Snapshot }) +@APICommand(name = "listSnapshots", description = "Lists all available snapshots for the account.", responseObject = SnapshotResponse.class, entityType = {IAMEntityType.Snapshot}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListSnapshotsCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java index 0b9108456fe..ab83812262b 100644 --- a/api/src/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java @@ -37,7 +37,8 @@ import com.cloud.event.EventTypes; import com.cloud.storage.Snapshot; import com.cloud.user.Account; -@APICommand(name = "revertSnapshot", description = "revert a volume snapshot.", responseObject = SnapshotResponse.class, entityType = { IAMEntityType.Snapshot }) +@APICommand(name = "revertSnapshot", description = "revert a volume snapshot.", responseObject = SnapshotResponse.class, entityType = {IAMEntityType.Snapshot}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class RevertSnapshotCmd extends BaseAsyncCmd { private static final String s_name = "revertsnapshotresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java b/api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java index a56fe8050ed..05eddbeb87e 100644 --- a/api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java @@ -30,7 +30,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.user.SSHKeyPair; -@APICommand(name = "createSSHKeyPair", description = "Create a new keypair and returns the private key", responseObject = CreateSSHKeyPairResponse.class, entityType = { IAMEntityType.SSHKeyPair }) +@APICommand(name = "createSSHKeyPair", description = "Create a new keypair and returns the private key", responseObject = CreateSSHKeyPairResponse.class, entityType = {IAMEntityType.SSHKeyPair}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class CreateSSHKeyPairCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(CreateSSHKeyPairCmd.class.getName()); private static final String s_name = "createsshkeypairresponse"; @@ -94,7 +95,7 @@ public class CreateSSHKeyPairCmd extends BaseCmd { CreateSSHKeyPairResponse response = new CreateSSHKeyPairResponse(r.getName(), r.getFingerprint(), r.getPrivateKey()); response.setResponseName(getCommandName()); response.setObjectName("keypair"); - this.setResponseObject(response); + setResponseObject(response); } @Override diff --git a/api/src/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java b/api/src/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java index 7e45ae5aba0..19b29bd2714 100644 --- a/api/src/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java @@ -30,7 +30,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.user.Account; -@APICommand(name = "deleteSSHKeyPair", description = "Deletes a keypair by name", responseObject = SuccessResponse.class, entityType = { IAMEntityType.SSHKeyPair }) +@APICommand(name = "deleteSSHKeyPair", description = "Deletes a keypair by name", responseObject = SuccessResponse.class, entityType = {IAMEntityType.SSHKeyPair}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteSSHKeyPairCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(CreateSSHKeyPairCmd.class.getName()); private static final String s_name = "deletesshkeypairresponse"; @@ -80,7 +81,7 @@ public class DeleteSSHKeyPairCmd extends BaseCmd { boolean result = _mgr.deleteSSHKeyPair(this); SuccessResponse response = new SuccessResponse(getCommandName()); response.setSuccess(result); - this.setResponseObject(response); + setResponseObject(response); } @Override diff --git a/api/src/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java b/api/src/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java index 25518653878..f02bf9f4f57 100644 --- a/api/src/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java @@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.SSHKeyPairResponse; import com.cloud.user.SSHKeyPair; import com.cloud.utils.Pair; -@APICommand(name = "listSSHKeyPairs", description = "List registered keypairs", responseObject = SSHKeyPairResponse.class, entityType = { IAMEntityType.SSHKeyPair }) +@APICommand(name = "listSSHKeyPairs", description = "List registered keypairs", responseObject = SSHKeyPairResponse.class, entityType = {IAMEntityType.SSHKeyPair}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListSSHKeyPairsCmd extends BaseListProjectAndAccountResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListSSHKeyPairsCmd.class.getName()); private static final String s_name = "listsshkeypairsresponse"; @@ -76,7 +77,7 @@ public class ListSSHKeyPairsCmd extends BaseListProjectAndAccountResourcesCmd { ListResponse response = new ListResponse(); response.setResponses(responses, resultList.second()); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } @Override diff --git a/api/src/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java b/api/src/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java index 07fc2f5878a..5fd04925b92 100644 --- a/api/src/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java @@ -30,7 +30,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.user.SSHKeyPair; -@APICommand(name = "registerSSHKeyPair", description = "Register a public key in a keypair under a certain name", responseObject = SSHKeyPairResponse.class, entityType = { IAMEntityType.SSHKeyPair }) +@APICommand(name = "registerSSHKeyPair", description = "Register a public key in a keypair under a certain name", responseObject = SSHKeyPairResponse.class, entityType = {IAMEntityType.SSHKeyPair}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class RegisterSSHKeyPairCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(RegisterSSHKeyPairCmd.class.getName()); private static final String s_name = "registersshkeypairresponse"; @@ -102,7 +103,7 @@ public class RegisterSSHKeyPairCmd extends BaseCmd { SSHKeyPairResponse response = new SSHKeyPairResponse(result.getName(), result.getFingerprint()); response.setResponseName(getCommandName()); response.setObjectName("keypair"); - this.setResponseObject(response); + setResponseObject(response); } @Override diff --git a/api/src/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java b/api/src/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java index 4dc8ad188d8..eab114fea89 100644 --- a/api/src/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java @@ -38,7 +38,8 @@ import com.cloud.event.EventTypes; import com.cloud.server.ResourceTag; import com.cloud.server.ResourceTag.ResourceObjectType; -@APICommand(name = "createTags", description = "Creates resource tag(s)", responseObject = SuccessResponse.class, since = "4.0.0", entityType = { IAMEntityType.ResourceTag }) +@APICommand(name = "createTags", description = "Creates resource tag(s)", responseObject = SuccessResponse.class, since = "4.0.0", entityType = {IAMEntityType.ResourceTag}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateTagsCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(CreateTagsCmd.class.getName()); @@ -118,7 +119,7 @@ public class CreateTagsCmd extends BaseAsyncCmd { if (tags != null && !tags.isEmpty()) { SuccessResponse response = new SuccessResponse(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create tags"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/tag/DeleteTagsCmd.java b/api/src/org/apache/cloudstack/api/command/user/tag/DeleteTagsCmd.java index 8aeea34114b..39b6630b619 100644 --- a/api/src/org/apache/cloudstack/api/command/user/tag/DeleteTagsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/tag/DeleteTagsCmd.java @@ -37,7 +37,8 @@ import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.event.EventTypes; import com.cloud.server.ResourceTag.ResourceObjectType; -@APICommand(name = "deleteTags", description = "Deleting resource tag(s)", responseObject = SuccessResponse.class, since = "4.0.0", entityType = { IAMEntityType.ResourceTag }) +@APICommand(name = "deleteTags", description = "Deleting resource tag(s)", responseObject = SuccessResponse.class, since = "4.0.0", entityType = {IAMEntityType.ResourceTag}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteTagsCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteTagsCmd.class.getName()); @@ -109,7 +110,7 @@ public class DeleteTagsCmd extends BaseAsyncCmd { if (success) { SuccessResponse response = new SuccessResponse(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete tags"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/tag/ListTagsCmd.java b/api/src/org/apache/cloudstack/api/command/user/tag/ListTagsCmd.java index dc025d74ca1..b2249104ac2 100644 --- a/api/src/org/apache/cloudstack/api/command/user/tag/ListTagsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/tag/ListTagsCmd.java @@ -25,7 +25,8 @@ import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.ResourceTagResponse; -@APICommand(name = "listTags", description = "List resource tag(s)", responseObject = ResourceTagResponse.class, since = "4.0.0", entityType = { IAMEntityType.ResourceTag }) +@APICommand(name = "listTags", description = "List resource tag(s)", responseObject = ResourceTagResponse.class, since = "4.0.0", entityType = {IAMEntityType.ResourceTag}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListTagsCmd extends BaseListProjectAndAccountResourcesCmd { private static final String s_name = "listtagsresponse"; @@ -53,7 +54,7 @@ public class ListTagsCmd extends BaseListProjectAndAccountResourcesCmd { ListResponse response = _queryService.listTags(this); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } public String getResourceType() { diff --git a/api/src/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java index 4127c27a809..fdbdafd1446 100644 --- a/api/src/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java @@ -38,7 +38,8 @@ import com.cloud.exception.StorageUnavailableException; import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.Account; -@APICommand(name = "copyTemplate", description = "Copies a template from one zone to another.", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted) +@APICommand(name = "copyTemplate", description = "Copies a template from one zone to another.", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CopyTemplateCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(CopyTemplateCmd.class.getName()); private static final String s_name = "copytemplateresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java index d203fd4b701..10b150df01e 100644 --- a/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java @@ -48,8 +48,9 @@ import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.Account; @APICommand(name = "createTemplate", responseObject = TemplateResponse.class, description = "Creates a template of a virtual machine. " + "The virtual machine must be in a STOPPED state. " - + "A template created from this command is automatically designated as a private template visible to the account that created it.", responseView = ResponseView.Restricted) - public class CreateTemplateCmd extends BaseAsyncCreateCmd { + + "A template created from this command is automatically designated as a private template visible to the account that created it.", responseView = ResponseView.Restricted, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) +public class CreateTemplateCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreateTemplateCmd.class.getName()); private static final String s_name = "createtemplateresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java index 890af70330f..98d53be836e 100644 --- a/api/src/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java @@ -36,7 +36,8 @@ import com.cloud.user.Account; @APICommand(name = "deleteTemplate", responseObject = SuccessResponse.class, - description = "Deletes a template from the system. All virtual machines using the deleted template will not be affected.") + description = "Deletes a template from the system. All virtual machines using the deleted template will not be affected.", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteTemplateCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteTemplateCmd.class.getName()); private static final String s_name = "deletetemplateresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java index 082f46a5abf..c88b5e334b6 100644 --- a/api/src/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java @@ -35,7 +35,8 @@ import com.cloud.exception.InternalErrorException; import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.Account; -@APICommand(name = "extractTemplate", description = "Extracts a template", responseObject = ExtractResponse.class) +@APICommand(name = "extractTemplate", description = "Extracts a template", responseObject = ExtractResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ExtractTemplateCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ExtractTemplateCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java index 76204bced9a..48f8ffff586 100644 --- a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java @@ -26,7 +26,9 @@ import org.apache.cloudstack.api.response.TemplatePermissionsResponse; import com.cloud.storage.Storage.ImageFormat; import com.cloud.template.VirtualMachineTemplate; -@APICommand(name = "listTemplatePermissions", description = "List template visibility and all accounts that have permissions to view this template.", responseObject = TemplatePermissionsResponse.class, responseView = ResponseView.Restricted) +@APICommand(name = "listTemplatePermissions", description = "List template visibility and all accounts that have permissions to view this template.", responseObject = TemplatePermissionsResponse.class, responseView = ResponseView.Restricted, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class ListTemplatePermissionsCmd extends BaseListTemplateOrIsoPermissionsCmd { protected String getResponseName() { return "listtemplatepermissionsresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java index 9ef1e109df4..c7a228550b7 100644 --- a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java @@ -33,7 +33,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.template.VirtualMachineTemplate.TemplateFilter; import com.cloud.user.Account; -@APICommand(name = "listTemplates", description = "List all public, private, and privileged templates.", responseObject = TemplateResponse.class, entityType = {IAMEntityType.VirtualMachineTemplate}, responseView = ResponseView.Restricted) +@APICommand(name = "listTemplates", description = "List all public, private, and privileged templates.", responseObject = TemplateResponse.class, entityType = {IAMEntityType.VirtualMachineTemplate}, responseView = ResponseView.Restricted, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListTemplatesCmd extends BaseListTaggedResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListTemplatesCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java index 1bb7cc80410..63eb12bc307 100644 --- a/api/src/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java @@ -42,7 +42,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.exception.ResourceAllocationException; import com.cloud.template.VirtualMachineTemplate; -@APICommand(name = "registerTemplate", description = "Registers an existing template into the CloudStack cloud. ", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted) +@APICommand(name = "registerTemplate", description = "Registers an existing template into the CloudStack cloud. ", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class RegisterTemplateCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(RegisterTemplateCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java index f7a2ac219f6..81da7eea625 100644 --- a/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java @@ -28,7 +28,8 @@ import org.apache.cloudstack.api.response.TemplateResponse; import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.Account; -@APICommand(name = "updateTemplate", description = "Updates attributes of a template.", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted) +@APICommand(name = "updateTemplate", description = "Updates attributes of a template.", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateTemplateCmd extends BaseUpdateTemplateOrIsoCmd { public static final Logger s_logger = Logger.getLogger(UpdateTemplateCmd.class.getName()); private static final String s_name = "updatetemplateresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplatePermissionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplatePermissionsCmd.java index b2aee4611ed..d5d0c587423 100644 --- a/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplatePermissionsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplatePermissionsCmd.java @@ -28,7 +28,8 @@ import com.cloud.user.Account; @APICommand(name = "updateTemplatePermissions", responseObject = SuccessResponse.class, description = "Updates a template visibility permissions. " + "A public template is visible to all accounts within the same domain. " + "A private template is visible only to the owner of the template. " - + "A priviledged template is a private template with account permissions added. " + "Only accounts specified under the template permissions are visible to them.", entityType = {IAMEntityType.VirtualMachineTemplate}) + + "A priviledged template is a private template with account permissions added. " + "Only accounts specified under the template permissions are visible to them.", entityType = {IAMEntityType.VirtualMachineTemplate}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateTemplatePermissionsCmd extends BaseUpdateTemplateOrIsoPermissionsCmd { @Override protected String getResponseName() { diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java index 439879add9b..a7f94368dcb 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java @@ -43,7 +43,8 @@ import com.cloud.vm.Nic; import com.cloud.vm.NicSecondaryIp; import com.cloud.vm.VirtualMachine; -@APICommand(name = "addIpToNic", description = "Assigns secondary IP to NIC", responseObject = NicSecondaryIpResponse.class) +@APICommand(name = "addIpToNic", description = "Assigns secondary IP to NIC", responseObject = NicSecondaryIpResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AddIpToVmNicCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(AddIpToVmNicCmd.class.getName()); private static final String s_name = "addiptovmnicresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java index 7857594d1ad..a1bbe2a45b0 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java @@ -40,7 +40,8 @@ import com.cloud.event.EventTypes; import com.cloud.user.Account; import com.cloud.uservm.UserVm; -@APICommand(name = "addNicToVirtualMachine", description = "Adds VM to specified network by creating a NIC", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "addNicToVirtualMachine", description = "Adds VM to specified network by creating a NIC", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class AddNicToVMCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(AddNicToVMCmd.class); private static final String s_name = "addnictovirtualmachineresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java index 4be416a2b39..7d55974fa0d 100755 --- a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java @@ -27,6 +27,7 @@ import java.util.Map; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.acl.SecurityChecker.AccessType; import org.apache.cloudstack.affinity.AffinityGroupResponse; import org.apache.cloudstack.api.ACL; @@ -68,7 +69,8 @@ import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.Account; import com.cloud.uservm.UserVm; -@APICommand(name = "deployVirtualMachine", description = "Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "deployVirtualMachine", description = "Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.VirtualMachine }, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class DeployVMCmd extends BaseAsyncCreateCustomIdCmd { public static final Logger s_logger = Logger.getLogger(DeployVMCmd.class.getName()); @@ -173,7 +175,7 @@ public class DeployVMCmd extends BaseAsyncCreateCustomIdCmd { + "Mutually exclusive with affinitygroupids parameter") private List affinityGroupNameList; - @Parameter(name = ApiConstants.DISPLAY_VM, type = CommandType.BOOLEAN, since = "4.2", description = "an optional field, whether to the display the vm to the end user or not.") + @Parameter(name = ApiConstants.DISPLAY_VM, type = CommandType.BOOLEAN, since = "4.2", description = "an optional field, whether to the display the vm to the end user or not.", authorized = {RoleType.Admin}) private Boolean displayVm; @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, since = "4.3", description = "used to specify the custom parameters.") diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java index c34e427df32..b8ac5612634 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java @@ -40,7 +40,9 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.Account; import com.cloud.uservm.UserVm; -@APICommand(name = "destroyVirtualMachine", description = "Destroys a virtual machine. Once destroyed, only the administrator can recover it.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "destroyVirtualMachine", description = "Destroys a virtual machine. Once destroyed, only the administrator can recover it.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = true) public class DestroyVMCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DestroyVMCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/GetVMPasswordCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/GetVMPasswordCmd.java index 50fa7617bf0..ebee189d354 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/GetVMPasswordCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/GetVMPasswordCmd.java @@ -33,7 +33,8 @@ import org.apache.cloudstack.api.response.UserVmResponse; import com.cloud.user.Account; import com.cloud.uservm.UserVm; -@APICommand(name = "getVMPassword", responseObject = GetVMPasswordResponse.class, description = "Returns an encrypted password for the VM", entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "getVMPassword", responseObject = GetVMPasswordResponse.class, description = "Returns an encrypted password for the VM", entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class GetVMPasswordCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(GetVMPasswordCmd.class.getName()); private static final String s_name = "getvmpasswordresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ListNicsCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/ListNicsCmd.java index 95d4990bf57..408497cbc64 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/ListNicsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/ListNicsCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.vm; import java.util.ArrayList; import java.util.List; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandJobType; import org.apache.cloudstack.api.ApiConstants; @@ -40,7 +41,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.Account; import com.cloud.vm.Nic; -@APICommand(name = "listNics", description = "list the vm nics IP to NIC", responseObject = NicResponse.class) +@APICommand(name = "listNics", description = "list the vm nics IP to NIC", responseObject = NicResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListNicsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListNicsCmd.class.getName()); private static final String s_name = "listnicsresponse"; @@ -58,6 +60,9 @@ public class ListNicsCmd extends BaseListCmd { @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "list nic of the specific vm's network") private Long networkId; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -92,6 +97,15 @@ public class ListNicsCmd extends BaseListCmd { return caller.getAccountId(); } + + public Boolean getDisplay() { + Account caller = CallContext.current().getCallingAccount(); + if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL) { + return true; + } + return display; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java index e6111fbe1d4..d1e5c098672 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java @@ -23,6 +23,7 @@ import java.util.List; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.affinity.AffinityGroupResponse; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandJobType; @@ -37,6 +38,7 @@ import org.apache.cloudstack.api.response.IsoVmResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.NetworkResponse; import org.apache.cloudstack.api.response.PodResponse; +import org.apache.cloudstack.api.response.ServiceOfferingResponse; import org.apache.cloudstack.api.response.StoragePoolResponse; import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.response.UserVmResponse; @@ -46,7 +48,8 @@ import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.exception.InvalidParameterValueException; -@APICommand(name = "listVirtualMachines", description = "List the virtual machines owned by the account.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "listVirtualMachines", description = "List the virtual machines owned by the account.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.VirtualMachine }, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class ListVMsCmd extends BaseListTaggedResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListVMsCmd.class.getName()); @@ -114,6 +117,12 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd { @Parameter(name = ApiConstants.AFFINITY_GROUP_ID, type = CommandType.UUID, entityType = AffinityGroupResponse.class, description = "list vms by affinity group") private Long affinityGroupId; + @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, description = "list by the service offering", since = "4.4") + private Long serviceOffId; + + @Parameter(name = ApiConstants.DISPLAY_VM, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -134,6 +143,10 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd { return state; } + public Long getServiceOfferingId() { + return serviceOffId; + } + public Long getZoneId() { return zoneId; } @@ -182,6 +195,13 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd { return dv; } + @Override + public Boolean getDisplay() { + if (display != null) { + return display; + } + return super.getDisplay(); + } ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java index 9904415d3a6..8f04430ea7d 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java @@ -38,7 +38,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.Account; import com.cloud.uservm.UserVm; -@APICommand(name = "rebootVirtualMachine", description = "Reboots a virtual machine.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "rebootVirtualMachine", description = "Reboots a virtual machine.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class RebootVMCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(RebootVMCmd.class.getName()); private static final String s_name = "rebootvirtualmachineresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/RemoveIpFromVmNicCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/RemoveIpFromVmNicCmd.java index b81b8a9450f..75eafa9503a 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/RemoveIpFromVmNicCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/RemoveIpFromVmNicCmd.java @@ -37,7 +37,9 @@ import com.cloud.network.Network; import com.cloud.user.Account; import com.cloud.vm.NicSecondaryIp; -@APICommand(name = "removeIpFromNic", description = "Assigns secondary IP to NIC.", responseObject = SuccessResponse.class) + +@APICommand(name = "removeIpFromNic", description = "Removes secondary IP from the NIC.", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class RemoveIpFromVmNicCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(RemoveIpFromVmNicCmd.class.getName()); private static final String s_name = "removeipfromnicresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/RemoveNicFromVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/RemoveNicFromVMCmd.java index 904f266a1af..44dfcf61af7 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/RemoveNicFromVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/RemoveNicFromVMCmd.java @@ -40,7 +40,8 @@ import com.cloud.event.EventTypes; import com.cloud.user.Account; import com.cloud.uservm.UserVm; -@APICommand(name = "removeNicFromVirtualMachine", description = "Removes VM from specified network by deleting a NIC", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "removeNicFromVirtualMachine", description = "Removes VM from specified network by deleting a NIC", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class RemoveNicFromVMCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(RemoveNicFromVMCmd.class); private static final String s_name = "removenicfromvirtualmachineresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java index a6f132a2e29..2fd508b5935 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java @@ -40,7 +40,8 @@ import com.cloud.uservm.UserVm; @APICommand(name = "resetPasswordForVirtualMachine", responseObject=UserVmResponse.class, description="Resets the password for virtual machine. " + "The virtual machine must be in a \"Stopped\" state and the template must already " + - "support this feature for this command to take effect. [async]", responseView = ResponseView.Restricted, entityType = { IAMEntityType.VirtualMachine }) + "support this feature for this command to take effect. [async]", responseView = ResponseView.Restricted, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class ResetVMPasswordCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ResetVMPasswordCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMSSHKeyCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMSSHKeyCmd.java index bdbd553b25e..288eed708db 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMSSHKeyCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMSSHKeyCmd.java @@ -42,7 +42,8 @@ import com.cloud.user.Account; import com.cloud.uservm.UserVm; @APICommand(name = "resetSSHKeyForVirtualMachine", responseObject = UserVmResponse.class, description = "Resets the SSH Key for virtual machine. " + - "The virtual machine must be in a \"Stopped\" state. [async]", responseView = ResponseView.Restricted, entityType = { IAMEntityType.VirtualMachine }) + "The virtual machine must be in a \"Stopped\" state. [async]", responseView = ResponseView.Restricted, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class ResetVMSSHKeyCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ResetVMSSHKeyCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.java index 78440289a57..9befc670ff1 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.java @@ -40,7 +40,9 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.Account; import com.cloud.uservm.UserVm; -@APICommand(name = "restoreVirtualMachine", description = "Restore a VM to original template/ISO or new template/ISO", responseObject = UserVmResponse.class, since = "3.0.0", responseView = ResponseView.Restricted, entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "restoreVirtualMachine", description = "Restore a VM to original template/ISO or new template/ISO", responseObject = UserVmResponse.class, since = "3.0.0", responseView = ResponseView.Restricted, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = true) public class RestoreVMCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(RestoreVMCmd.class); private static final String s_name = "restorevmresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java index acc457811d2..cd658cb9a43 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java @@ -48,7 +48,8 @@ import com.cloud.user.Account; import com.cloud.uservm.UserVm; -@APICommand(name = "scaleVirtualMachine", description = "Scales the virtual machine to a new service offering.", responseObject = SuccessResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "scaleVirtualMachine", description = "Scales the virtual machine to a new service offering.", responseObject = SuccessResponse.class, responseView = ResponseView.Restricted, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ScaleVMCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ScaleVMCmd.class.getName()); private static final String s_name = "scalevirtualmachineresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java index 8237c0f6fd1..2e4187d9261 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java @@ -44,7 +44,8 @@ import com.cloud.user.Account; import com.cloud.uservm.UserVm; import com.cloud.utils.exception.ExecutionException; -@APICommand(name = "startVirtualMachine", responseObject = UserVmResponse.class, description = "Starts a virtual machine.", responseView = ResponseView.Restricted, entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "startVirtualMachine", responseObject = UserVmResponse.class, description = "Starts a virtual machine.", responseView = ResponseView.Restricted, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class StartVMCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(StartVMCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java index 6a448ba19ec..fe94964e81a 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java @@ -37,7 +37,8 @@ import com.cloud.exception.ConcurrentOperationException; import com.cloud.user.Account; import com.cloud.uservm.UserVm; -@APICommand(name = "stopVirtualMachine", responseObject = UserVmResponse.class, description = "Stops a virtual machine.", responseView = ResponseView.Restricted, entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "stopVirtualMachine", responseObject = UserVmResponse.class, description = "Stops a virtual machine.", responseView = ResponseView.Restricted, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class StopVMCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(StopVMCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/UpdateDefaultNicForVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/UpdateDefaultNicForVMCmd.java index 6d32c96d63d..c70f7e502de 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/UpdateDefaultNicForVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/UpdateDefaultNicForVMCmd.java @@ -40,8 +40,8 @@ import com.cloud.event.EventTypes; import com.cloud.user.Account; import com.cloud.uservm.UserVm; - -@APICommand(name = "updateDefaultNicForVirtualMachine", description = "Changes the default NIC on a VM", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "updateDefaultNicForVirtualMachine", description = "Changes the default NIC on a VM", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class UpdateDefaultNicForVMCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(UpdateDefaultNicForVMCmd.class); private static final String s_name = "updatedefaultnicforvirtualmachineresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java index 4d745747a7f..fac82aac9b1 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.vm; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.acl.SecurityChecker.AccessType; import org.apache.cloudstack.api.ACL; import org.apache.cloudstack.api.APICommand; @@ -37,10 +38,10 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.Account; import com.cloud.uservm.UserVm; - @APICommand(name = "updateVirtualMachine", description="Updates properties of a virtual machine. The VM has to be stopped and restarted for the " + "new properties to take effect. UpdateVirtualMachine does not first check whether the VM is stopped. " + - "Therefore, stop the VM manually before issuing this call.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.VirtualMachine }) + "Therefore, stop the VM manually before issuing this call.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class UpdateVMCmd extends BaseCustomIdCmd { public static final Logger s_logger = Logger.getLogger(UpdateVMCmd.class.getName()); private static final String s_name = "updatevirtualmachineresponse"; @@ -75,7 +76,7 @@ public class UpdateVMCmd extends BaseCustomIdCmd { length = 32768) private String userData; - @Parameter(name = ApiConstants.DISPLAY_VM, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the vm to the end user or not.") + @Parameter(name = ApiConstants.DISPLAY_VM, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the vm to the end user or not.", authorized = {RoleType.Admin}) private Boolean displayVm; @Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE, @@ -83,6 +84,9 @@ public class UpdateVMCmd extends BaseCustomIdCmd { description = "true if VM contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory") protected Boolean isDynamicallyScalable; + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "new host name of the vm. The VM has to be stopped/started for this update to take affect", since = "4.4") + private String name; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -115,6 +119,10 @@ public class UpdateVMCmd extends BaseCustomIdCmd { return isDynamicallyScalable; } + public String getHostName() { + return name; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -142,6 +150,16 @@ public class UpdateVMCmd extends BaseCustomIdCmd { return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked } + @Override + public boolean isDisplayResourceEnabled(){ + UserVm userVm = _entityMgr.findById(UserVm.class, getId()); + if (userVm != null) { + return userVm.isDisplayVm(); + } + + return true; // no info means true + } + @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException { CallContext.current().setEventDetails("Vm Id: " + getId()); diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java index ec060700d5b..7282ebacff0 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java @@ -45,7 +45,8 @@ import com.cloud.uservm.UserVm; @APICommand(name = "changeServiceForVirtualMachine", responseObject=UserVmResponse.class, description="Changes the service offering for a virtual machine. " + "The virtual machine must be in a \"Stopped\" state for " + - "this command to take effect.", responseView = ResponseView.Restricted, entityType = { IAMEntityType.VirtualMachine }) + "this command to take effect.", responseView = ResponseView.Restricted, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class UpgradeVMCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(UpgradeVMCmd.class.getName()); private static final String s_name = "changeserviceforvirtualmachineresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/vmgroup/CreateVMGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmgroup/CreateVMGroupCmd.java index a8cca689952..30b3ac89818 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vmgroup/CreateVMGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vmgroup/CreateVMGroupCmd.java @@ -32,7 +32,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.vm.InstanceGroup; -@APICommand(name = "createInstanceGroup", description = "Creates a vm group", responseObject = InstanceGroupResponse.class, entityType = { IAMEntityType.InstanceGroup }) +@APICommand(name = "createInstanceGroup", description = "Creates a vm group", responseObject = InstanceGroupResponse.class, entityType = {IAMEntityType.InstanceGroup}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateVMGroupCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(CreateVMGroupCmd.class.getName()); @@ -104,7 +105,7 @@ public class CreateVMGroupCmd extends BaseCmd { if (result != null) { InstanceGroupResponse response = _responseGenerator.createInstanceGroupResponse(result); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create vm instance group"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/vmgroup/DeleteVMGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmgroup/DeleteVMGroupCmd.java index 5b4ff8cc742..0bc52369d2a 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vmgroup/DeleteVMGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vmgroup/DeleteVMGroupCmd.java @@ -33,7 +33,8 @@ import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.user.Account; import com.cloud.vm.InstanceGroup; -@APICommand(name = "deleteInstanceGroup", description = "Deletes a vm group", responseObject = SuccessResponse.class, entityType = { IAMEntityType.InstanceGroup }) +@APICommand(name = "deleteInstanceGroup", description = "Deletes a vm group", responseObject = SuccessResponse.class, entityType = {IAMEntityType.InstanceGroup}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteVMGroupCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeleteVMGroupCmd.class.getName()); private static final String s_name = "deleteinstancegroupresponse"; @@ -78,7 +79,7 @@ public class DeleteVMGroupCmd extends BaseCmd { boolean result = _userVmService.deleteVmGroup(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete vm group"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/vmgroup/ListVMGroupsCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmgroup/ListVMGroupsCmd.java index 99aeaf8c2df..e9844dd19ab 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vmgroup/ListVMGroupsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vmgroup/ListVMGroupsCmd.java @@ -26,7 +26,8 @@ import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.InstanceGroupResponse; import org.apache.cloudstack.api.response.ListResponse; -@APICommand(name = "listInstanceGroups", description = "Lists vm groups", responseObject = InstanceGroupResponse.class, entityType = { IAMEntityType.InstanceGroup }) +@APICommand(name = "listInstanceGroups", description = "Lists vm groups", responseObject = InstanceGroupResponse.class, entityType = {IAMEntityType.InstanceGroup}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListVMGroupsCmd extends BaseListProjectAndAccountResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListVMGroupsCmd.class.getName()); @@ -67,6 +68,6 @@ public class ListVMGroupsCmd extends BaseListProjectAndAccountResourcesCmd { public void execute() { ListResponse response = _queryService.searchForVmGroups(this); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vmgroup/UpdateVMGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmgroup/UpdateVMGroupCmd.java index d2f3b46a013..e06ec52e1a0 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vmgroup/UpdateVMGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vmgroup/UpdateVMGroupCmd.java @@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.InstanceGroupResponse; import com.cloud.user.Account; import com.cloud.vm.InstanceGroup; -@APICommand(name = "updateInstanceGroup", description = "Updates a vm group", responseObject = InstanceGroupResponse.class, entityType = { IAMEntityType.InstanceGroup }) +@APICommand(name = "updateInstanceGroup", description = "Updates a vm group", responseObject = InstanceGroupResponse.class, entityType = {IAMEntityType.InstanceGroup}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateVMGroupCmd extends BaseCmd { private static final String s_name = "updateinstancegroupresponse"; @@ -85,7 +86,7 @@ public class UpdateVMGroupCmd extends BaseCmd { if (result != null) { InstanceGroupResponse response = _responseGenerator.createInstanceGroupResponse(result); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update vm instance group"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/CreateVMSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/CreateVMSnapshotCmd.java index 8f0a8c82464..fae0e617235 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/CreateVMSnapshotCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/CreateVMSnapshotCmd.java @@ -37,7 +37,8 @@ import com.cloud.exception.ResourceAllocationException; import com.cloud.uservm.UserVm; import com.cloud.vm.snapshot.VMSnapshot; -@APICommand(name = "createVMSnapshot", description = "Creates snapshot for a vm.", responseObject = VMSnapshotResponse.class, since = "4.2.0", entityType = { IAMEntityType.VMSnapshot }) +@APICommand(name = "createVMSnapshot", description = "Creates snapshot for a vm.", responseObject = VMSnapshotResponse.class, since = "4.2.0", entityType = {IAMEntityType.VMSnapshot}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateVMSnapshotCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreateVMSnapshotCmd.class.getName()); @@ -91,7 +92,7 @@ public class CreateVMSnapshotCmd extends BaseAsyncCreateCmd { public void create() throws ResourceAllocationException { VMSnapshot vmsnapshot = _vmSnapshotService.allocVMSnapshot(getVmId(), getDisplayName(), getDescription(), snapshotMemory()); if (vmsnapshot != null) { - this.setEntityId(vmsnapshot.getId()); + setEntityId(vmsnapshot.getId()); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create vm snapshot"); } @@ -114,7 +115,7 @@ public class CreateVMSnapshotCmd extends BaseAsyncCreateCmd { if (result != null) { VMSnapshotResponse response = _responseGenerator.createVMSnapshotResponse(result); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create vm snapshot due to an internal error creating snapshot for vm " + getVmId()); } diff --git a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/DeleteVMSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/DeleteVMSnapshotCmd.java index 063ff7738d6..af076cff579 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/DeleteVMSnapshotCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/DeleteVMSnapshotCmd.java @@ -36,7 +36,8 @@ import com.cloud.event.EventTypes; import com.cloud.user.Account; import com.cloud.vm.snapshot.VMSnapshot; -@APICommand(name = "deleteVMSnapshot", description = "Deletes a vmsnapshot.", responseObject = SuccessResponse.class, since = "4.2.0", entityType = { IAMEntityType.VMSnapshot }) +@APICommand(name = "deleteVMSnapshot", description = "Deletes a vmsnapshot.", responseObject = SuccessResponse.class, since = "4.2.0", entityType = {IAMEntityType.VMSnapshot}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteVMSnapshotCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteVMSnapshotCmd.class.getName()); private static final String s_name = "deletevmsnapshotresponse"; @@ -73,7 +74,7 @@ public class DeleteVMSnapshotCmd extends BaseAsyncCmd { boolean result = _vmSnapshotService.deleteVMSnapshot(getId()); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete vm snapshot"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/ListVMSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/ListVMSnapshotCmd.java index 7faed638b07..3167d09f01a 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/ListVMSnapshotCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/ListVMSnapshotCmd.java @@ -31,7 +31,8 @@ import org.apache.cloudstack.api.response.VMSnapshotResponse; import com.cloud.vm.snapshot.VMSnapshot; -@APICommand(name = "listVMSnapshot", description = "List virtual machine snapshot by conditions", responseObject = VMSnapshotResponse.class, since = "4.2.0", entityType = { IAMEntityType.VMSnapshot }) +@APICommand(name = "listVMSnapshot", description = "List virtual machine snapshot by conditions", responseObject = VMSnapshotResponse.class, since = "4.2.0", entityType = {IAMEntityType.VMSnapshot}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListVMSnapshotCmd extends BaseListTaggedResourcesCmd { private static final String s_name = "listvmsnapshotresponse"; @@ -76,7 +77,7 @@ public class ListVMSnapshotCmd extends BaseListTaggedResourcesCmd { } response.setResponses(snapshotResponses); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } @Override diff --git a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToVMSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToVMSnapshotCmd.java index 84916ce6902..0ca500962b3 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToVMSnapshotCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToVMSnapshotCmd.java @@ -40,7 +40,8 @@ import com.cloud.user.Account; import com.cloud.uservm.UserVm; import com.cloud.vm.snapshot.VMSnapshot; -@APICommand(name = "revertToVMSnapshot", description = "Revert VM from a vmsnapshot.", responseObject = UserVmResponse.class, since = "4.2.0", responseView = ResponseView.Restricted) +@APICommand(name = "revertToVMSnapshot", description = "Revert VM from a vmsnapshot.", responseObject = UserVmResponse.class, since = "4.2.0", responseView = ResponseView.Restricted, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class RevertToVMSnapshotCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(RevertToVMSnapshotCmd.class.getName()); private static final String s_name = "reverttovmsnapshotresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/AddResourceDetailCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/AddResourceDetailCmd.java index 618be7f3958..d53059ed152 100644 --- a/api/src/org/apache/cloudstack/api/command/user/volume/AddResourceDetailCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/volume/AddResourceDetailCmd.java @@ -31,7 +31,8 @@ import org.apache.log4j.Logger; import com.cloud.event.EventTypes; import com.cloud.server.ResourceTag; -@APICommand(name = "addResourceDetail", description = "Adds detail for the Resource.", responseObject = SuccessResponse.class) +@APICommand(name = "addResourceDetail", description = "Adds detail for the Resource.", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AddResourceDetailCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(AddResourceDetailCmd.class.getName()); private static final String s_name = "addresourcedetailresponse"; @@ -49,6 +50,9 @@ public class AddResourceDetailCmd extends BaseAsyncCmd { @Parameter(name = ApiConstants.RESOURCE_ID, type = CommandType.STRING, required = true, collectionType = CommandType.STRING, description = "resource id to create the details for") private String resourceId; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "pass false if you want this detail to be disabled for the regular user. True by default", since = "4.4") + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -77,6 +81,14 @@ public class AddResourceDetailCmd extends BaseAsyncCmd { return resourceId; } + public boolean forDisplay() { + if (display != null) { + return display; + } else { + return true; + } + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -104,7 +116,7 @@ public class AddResourceDetailCmd extends BaseAsyncCmd { @Override public void execute() { - _resourceMetaDataService.addResourceMetaData(getResourceId(), getResourceType(), getDetails()); + _resourceMetaDataService.addResourceMetaData(getResourceId(), getResourceType(), getDetails(), forDisplay()); setResponseObject(new SuccessResponse(getCommandName())); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/AttachVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/AttachVolumeCmd.java index 9fdf2bc19be..553e2e9339d 100644 --- a/api/src/org/apache/cloudstack/api/command/user/volume/AttachVolumeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/volume/AttachVolumeCmd.java @@ -36,7 +36,8 @@ import com.cloud.event.EventTypes; import com.cloud.storage.Volume; import com.cloud.user.Account; -@APICommand(name = "attachVolume", description = "Attaches a disk volume to a virtual machine.", responseObject = VolumeResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.VirtualMachine }) +@APICommand(name = "attachVolume", description = "Attaches a disk volume to a virtual machine.", responseObject = VolumeResponse.class, responseView = ResponseView.Restricted, entityType = {IAMEntityType.VirtualMachine}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AttachVolumeCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(AttachVolumeCmd.class.getName()); private static final String s_name = "attachvolumeresponse"; @@ -107,6 +108,15 @@ public class AttachVolumeCmd extends BaseAsyncCmd { return EventTypes.EVENT_VOLUME_ATTACH; } + @Override + public boolean isDisplayResourceEnabled(){ + Volume volume = _responseGenerator.findVolumeById(getId()); + if (volume == null) { + return true; // bad id given, parent this command to true so ERROR events are tracked + } + return volume.isDisplayVolume(); + } + @Override public String getEventDescription() { return "attaching volume: " + getId() + " to vm: " + getVirtualMachineId(); diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java index 5939ca60ceb..ad06bc2fc81 100644 --- a/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.volume; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandJobType; import org.apache.cloudstack.api.ApiConstants; @@ -42,7 +43,8 @@ import com.cloud.exception.ResourceAllocationException; import com.cloud.storage.Snapshot; import com.cloud.storage.Volume; -@APICommand(name = "createVolume", responseObject = VolumeResponse.class, description = "Creates a disk volume from a disk offering. This disk volume must still be attached to a virtual machine to make use of it.", responseView = ResponseView.Restricted, entityType = { IAMEntityType.Volume }) +@APICommand(name = "createVolume", responseObject = VolumeResponse.class, description = "Creates a disk volume from a disk offering. This disk volume must still be attached to a virtual machine to make use of it.", responseView = ResponseView.Restricted, entityType = {IAMEntityType.Volume}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateVolumeCmd extends BaseAsyncCreateCustomIdCmd { public static final Logger s_logger = Logger.getLogger(CreateVolumeCmd.class.getName()); private static final String s_name = "createvolumeresponse"; @@ -97,7 +99,7 @@ public class CreateVolumeCmd extends BaseAsyncCreateCustomIdCmd { @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the ID of the availability zone") private Long zoneId; - @Parameter(name = ApiConstants.DISPLAY_VOLUME, type = CommandType.BOOLEAN, description = "an optional field, whether to display the volume to the end user or not.") + @Parameter(name = ApiConstants.DISPLAY_VOLUME, type = CommandType.BOOLEAN, description = "an optional field, whether to display the volume to the end user or not.", authorized = {RoleType.Admin}) private Boolean displayVolume; @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, @@ -151,6 +153,10 @@ public class CreateVolumeCmd extends BaseAsyncCreateCustomIdCmd { } public Boolean getDisplayVolume() { + if(displayVolume == null){ + return true; + } + return displayVolume; } @@ -190,6 +196,11 @@ public class CreateVolumeCmd extends BaseAsyncCreateCustomIdCmd { return EventTypes.EVENT_VOLUME_CREATE; } + @Override + public boolean isDisplayResourceEnabled(){ + return getDisplayVolume(); + } + @Override public String getEventDescription() { return "creating volume: " + getVolumeName() + ((getSnapshotId() == null) ? "" : " from snapshot: " + getSnapshotId()); @@ -210,6 +221,7 @@ public class CreateVolumeCmd extends BaseAsyncCreateCustomIdCmd { @Override public void execute() { CallContext.current().setEventDetails("Volume Id: " + getEntityId() + ((getSnapshotId() == null) ? "" : " from snapshot: " + getSnapshotId())); + CallContext.current().setEventDisplayEnabled(getDisplayVolume()); Volume volume = _volumeService.createVolume(this); if (volume != null) { VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Restricted, volume); diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java index bb17bd9b3fe..546a9d549cf 100644 --- a/api/src/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java @@ -34,7 +34,8 @@ import com.cloud.exception.ConcurrentOperationException; import com.cloud.storage.Volume; import com.cloud.user.Account; -@APICommand(name = "deleteVolume", description = "Deletes a detached disk volume.", responseObject = SuccessResponse.class, entityType = { IAMEntityType.Volume }) +@APICommand(name = "deleteVolume", description = "Deletes a detached disk volume.", responseObject = SuccessResponse.class, entityType = {IAMEntityType.Volume}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteVolumeCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeleteVolumeCmd.class.getName()); private static final String s_name = "deletevolumeresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/DetachVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/DetachVolumeCmd.java index c7419fc3b58..1a874e1e8e3 100644 --- a/api/src/org/apache/cloudstack/api/command/user/volume/DetachVolumeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/volume/DetachVolumeCmd.java @@ -37,7 +37,8 @@ import com.cloud.storage.Volume; import com.cloud.user.Account; import com.cloud.uservm.UserVm; -@APICommand(name = "detachVolume", description = "Detaches a disk volume from a virtual machine.", responseObject = VolumeResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.Volume }) +@APICommand(name = "detachVolume", description = "Detaches a disk volume from a virtual machine.", responseObject = VolumeResponse.class, responseView = ResponseView.Restricted, entityType = {IAMEntityType.Volume}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DetachVolumeCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DetachVolumeCmd.class.getName()); private static final String s_name = "detachvolumeresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java index fef35dcc6ee..b9883cc5aca 100644 --- a/api/src/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java @@ -39,7 +39,8 @@ import com.cloud.storage.Upload; import com.cloud.storage.Volume; import com.cloud.user.Account; -@APICommand(name = "extractVolume", description = "Extracts volume", responseObject = ExtractResponse.class, entityType = { IAMEntityType.Volume }) +@APICommand(name = "extractVolume", description = "Extracts volume", responseObject = ExtractResponse.class, entityType = {IAMEntityType.Volume}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ExtractVolumeCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ExtractVolumeCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/ListResourceDetailsCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/ListResourceDetailsCmd.java index aed0ae02f63..0aeff0c63ce 100644 --- a/api/src/org/apache/cloudstack/api/command/user/volume/ListResourceDetailsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/volume/ListResourceDetailsCmd.java @@ -30,14 +30,15 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.server.ResourceTag; -@APICommand(name = "listResourceDetails", description = "List resource detail(s)", responseObject = ResourceTagResponse.class, since = "4.2") +@APICommand(name = "listResourceDetails", description = "List resource detail(s)", responseObject = ResourceTagResponse.class, since = "4.2", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListResourceDetailsCmd extends BaseListProjectAndAccountResourcesCmd { private static final String s_name = "listresourcedetailsresponse"; @Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.STRING, description = "list by resource type", required = true) private String resourceType; - @Parameter(name = ApiConstants.RESOURCE_ID, type = CommandType.STRING, description = "list by resource id", required = true) + @Parameter(name = ApiConstants.RESOURCE_ID, type = CommandType.STRING, description = "list by resource id") private String resourceId; @Parameter(name = ApiConstants.KEY, type = CommandType.STRING, description = "list by key") diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java index 24425cbd375..b4ac4ae64c4 100644 --- a/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java @@ -15,6 +15,7 @@ // specific language governing permissions and limitations // under the License. package org.apache.cloudstack.api.command.user.volume; + import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; @@ -25,6 +26,7 @@ import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListTaggedResourcesCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ResponseObject.ResponseView; +import org.apache.cloudstack.api.response.DiskOfferingResponse; import org.apache.cloudstack.api.response.HostResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.PodResponse; @@ -33,10 +35,8 @@ import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.cloudstack.api.response.VolumeResponse; import org.apache.cloudstack.api.response.ZoneResponse; - - - -@APICommand(name = "listVolumes", description = "Lists all volumes.", responseObject = VolumeResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.Volume }) +@APICommand(name = "listVolumes", description = "Lists all volumes.", responseObject = VolumeResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.Volume }, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListVolumesCmd extends BaseListTaggedResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListVolumesCmd.class.getName()); @@ -75,6 +75,12 @@ public class ListVolumesCmd extends BaseListTaggedResourcesCmd { authorized = {RoleType.Admin}) private Long storageId; + @Parameter(name = ApiConstants.DISK_OFFERING_ID, type = CommandType.UUID, entityType = DiskOfferingResponse.class, description = "list volumes by disk offering") + private Long diskOfferingId; + + @Parameter(name = ApiConstants.DISPLAY_VOLUME, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -95,6 +101,10 @@ public class ListVolumesCmd extends BaseListTaggedResourcesCmd { return podId; } + public Long getDiskOfferingId() { + return diskOfferingId; + } + public String getType() { return type; } @@ -111,6 +121,13 @@ public class ListVolumesCmd extends BaseListTaggedResourcesCmd { return storageId; } + @Override + public Boolean getDisplay() { + if (display != null) { + return display; + } + return super.getDisplay(); + } ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/MigrateVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/MigrateVolumeCmd.java index bbd754a201f..820d73d058b 100644 --- a/api/src/org/apache/cloudstack/api/command/user/volume/MigrateVolumeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/volume/MigrateVolumeCmd.java @@ -31,8 +31,8 @@ import com.cloud.event.EventTypes; import com.cloud.storage.Volume; import com.cloud.user.Account; - -@APICommand(name = "migrateVolume", description = "Migrate volume", responseObject = VolumeResponse.class, since = "3.0.0", responseView = ResponseView.Restricted, entityType = { IAMEntityType.Volume }) +@APICommand(name = "migrateVolume", description = "Migrate volume", responseObject = VolumeResponse.class, since = "3.0.0", responseView = ResponseView.Restricted, entityType = {IAMEntityType.Volume}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class MigrateVolumeCmd extends BaseAsyncCmd { private static final String s_name = "migratevolumeresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/RemoveResourceDetailCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/RemoveResourceDetailCmd.java index c4c7554dbdb..6fe576dc63c 100644 --- a/api/src/org/apache/cloudstack/api/command/user/volume/RemoveResourceDetailCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/volume/RemoveResourceDetailCmd.java @@ -28,7 +28,8 @@ import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.event.EventTypes; import com.cloud.server.ResourceTag; -@APICommand(name = "removeResourceDetail", description = "Removes detail for the Resource.", responseObject = SuccessResponse.class) +@APICommand(name = "removeResourceDetail", description = "Removes detail for the Resource.", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class RemoveResourceDetailCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(RemoveResourceDetailCmd.class.getName()); private static final String s_name = "removeresourcedetailresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java index 0e7d27de6d8..2f34c758962 100644 --- a/api/src/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java @@ -16,6 +16,7 @@ // under the License. package org.apache.cloudstack.api.command.user.volume; import org.apache.log4j.Logger; + import org.apache.cloudstack.acl.IAMEntityType; import org.apache.cloudstack.acl.SecurityChecker.AccessType; import org.apache.cloudstack.api.ACL; @@ -30,6 +31,7 @@ import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DiskOfferingResponse; import org.apache.cloudstack.api.response.VolumeResponse; import org.apache.cloudstack.context.CallContext; + import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.PermissionDeniedException; @@ -39,7 +41,8 @@ import com.cloud.storage.Volume; import com.cloud.user.Account; -@APICommand(name = "resizeVolume", description = "Resizes a volume", responseObject = VolumeResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.Volume }) +@APICommand(name = "resizeVolume", description = "Resizes a volume", responseObject = VolumeResponse.class, responseView = ResponseView.Restricted, entityType = {IAMEntityType.Volume}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ResizeVolumeCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ResizeVolumeCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java index d5b23ab1981..d9fa82e2463 100644 --- a/api/src/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.volume; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.acl.SecurityChecker.AccessType; import org.apache.cloudstack.api.ACL; import org.apache.cloudstack.api.APICommand; @@ -37,7 +38,8 @@ import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.storage.Volume; -@APICommand(name = "updateVolume", description = "Updates the volume.", responseObject = VolumeResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.Volume }) +@APICommand(name = "updateVolume", description = "Updates the volume.", responseObject = VolumeResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.Volume }, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateVolumeCmd extends BaseAsyncCustomIdCmd { public static final Logger s_logger = Logger.getLogger(UpdateVolumeCmd.class.getName()); private static final String s_name = "updatevolumeresponse"; @@ -53,6 +55,9 @@ public class UpdateVolumeCmd extends BaseAsyncCustomIdCmd { @Parameter(name = ApiConstants.PATH, type = CommandType.STRING, description = "The path of the volume") private String path; + @Parameter(name = ApiConstants.CHAIN_INFO, type = CommandType.STRING, description = "The chain info of the volume") + private String chainInfo; + @Parameter(name = ApiConstants.STORAGE_ID, type = CommandType.UUID, entityType = StoragePoolResponse.class, @@ -65,7 +70,7 @@ public class UpdateVolumeCmd extends BaseAsyncCustomIdCmd { @Parameter(name = ApiConstants.DISPLAY_VOLUME, type = CommandType.BOOLEAN, - description = "an optional field, whether to the display the volume to the end user or not.") + description = "an optional field, whether to the display the volume to the end user or not.", authorized = {RoleType.Admin}) private Boolean displayVolume; ///////////////////////////////////////////////////// @@ -92,7 +97,10 @@ public class UpdateVolumeCmd extends BaseAsyncCustomIdCmd { return displayVolume; } -///////////////////////////////////////////////////// + public String getChainInfo() { + return chainInfo; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -145,7 +153,8 @@ public class UpdateVolumeCmd extends BaseAsyncCustomIdCmd { @Override public void execute() { CallContext.current().setEventDetails("Volume Id: " + getId()); - Volume result = _volumeService.updateVolume(getId(), getPath(), getState(), getStorageId(), getDisplayVolume(), getCustomId(), getEntityOwnerId()); + Volume result = _volumeService.updateVolume(getId(), getPath(), getState(), getStorageId(), getDisplayVolume(), + getCustomId(), getEntityOwnerId(), getChainInfo()); if (result != null) { VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Restricted, result); response.setResponseName(getCommandName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java index 608bde56283..949e6df147f 100644 --- a/api/src/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java @@ -40,7 +40,8 @@ import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.storage.Volume; -@APICommand(name = "uploadVolume", description = "Uploads a data disk.", responseObject = VolumeResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.Volume }) +@APICommand(name = "uploadVolume", description = "Uploads a data disk.", responseObject = VolumeResponse.class, responseView = ResponseView.Restricted, entityType = {IAMEntityType.Volume}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UploadVolumeCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(UploadVolumeCmd.class.getName()); private static final String s_name = "uploadvolumeresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java index 0bbe8cb41e5..f2c9e2c2e2e 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java @@ -40,7 +40,8 @@ import com.cloud.network.vpc.StaticRoute; import com.cloud.network.vpc.Vpc; import com.cloud.network.vpc.VpcGateway; -@APICommand(name = "createStaticRoute", description = "Creates a static route", responseObject = StaticRouteResponse.class, entityType = { IAMEntityType.StaticRoute }) +@APICommand(name = "createStaticRoute", description = "Creates a static route", responseObject = StaticRouteResponse.class, entityType = {IAMEntityType.StaticRoute}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateStaticRouteCmd extends BaseAsyncCreateCmd { private static final String s_name = "createstaticrouteresponse"; public static final Logger s_logger = Logger.getLogger(CreateStaticRouteCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java index 42eeb62880c..5cd1f6e163e 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.vpc; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiErrorCode; @@ -40,8 +41,9 @@ import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.vpc.Vpc; -@APICommand(name = "createVPC", description = "Creates a VPC", responseObject = VpcResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.Vpc }) -public class CreateVPCCmd extends BaseAsyncCreateCmd{ +@APICommand(name = "createVPC", description = "Creates a VPC", responseObject = VpcResponse.class, responseView = ResponseView.Restricted, entityType = {IAMEntityType.Vpc}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) +public class CreateVPCCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreateVPCCmd.class.getName()); private static final String s_name = "createvpcresponse"; @@ -90,6 +92,9 @@ public class CreateVPCCmd extends BaseAsyncCreateCmd{ "True by default.", since = "4.3") private Boolean start; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the vpc to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + // /////////////////////////////////////////////////// // ///////////////// Accessors /////////////////////// // /////////////////////////////////////////////////// @@ -133,9 +138,13 @@ public class CreateVPCCmd extends BaseAsyncCreateCmd{ return true; } + public Boolean getDisplayVpc() { + return display; + } + @Override public void create() throws ResourceAllocationException { - Vpc vpc = _vpcService.createVpc(getZoneId(), getVpcOffering(), getEntityOwnerId(), getVpcName(), getDisplayText(), getCidr(), getNetworkDomain()); + Vpc vpc = _vpcService.createVpc(getZoneId(), getVpcOffering(), getEntityOwnerId(), getVpcName(), getDisplayText(), getCidr(), getNetworkDomain(), getDisplayVpc()); if (vpc != null) { setEntityId(vpc.getId()); setEntityUuid(vpc.getUuid()); diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteStaticRouteCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteStaticRouteCmd.java index b59ba930ea6..0017753e333 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteStaticRouteCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteStaticRouteCmd.java @@ -38,7 +38,8 @@ import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.vpc.StaticRoute; -@APICommand(name = "deleteStaticRoute", description = "Deletes a static route", responseObject = SuccessResponse.class, entityType = { IAMEntityType.StaticRoute }) +@APICommand(name = "deleteStaticRoute", description = "Deletes a static route", responseObject = SuccessResponse.class, entityType = {IAMEntityType.StaticRoute}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteStaticRouteCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteStaticRouteCmd.class.getName()); private static final String s_name = "deletestaticrouteresponse"; @@ -100,7 +101,7 @@ public class DeleteStaticRouteCmd extends BaseAsyncCmd { if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete static route"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java index ab4a447f63a..5928aabff60 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java @@ -36,7 +36,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.vpc.Vpc; import com.cloud.user.Account; -@APICommand(name = "deleteVPC", description = "Deletes a VPC", responseObject = SuccessResponse.class, entityType = { IAMEntityType.Vpc }) +@APICommand(name = "deleteVPC", description = "Deletes a VPC", responseObject = SuccessResponse.class, entityType = {IAMEntityType.Vpc}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteVPCCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteVPCCmd.class.getName()); private static final String s_name = "deletevpcresponse"; @@ -76,7 +77,7 @@ public class DeleteVPCCmd extends BaseAsyncCmd { boolean result = _vpcService.deleteVpc(getId()); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete VPC"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/ListPrivateGatewaysCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/ListPrivateGatewaysCmd.java index 03f51f5a12f..160355a481a 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/ListPrivateGatewaysCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/ListPrivateGatewaysCmd.java @@ -33,7 +33,8 @@ import org.apache.cloudstack.api.response.VpcResponse; import com.cloud.network.vpc.PrivateGateway; import com.cloud.utils.Pair; -@APICommand(name = "listPrivateGateways", description = "List private gateways", responseObject = PrivateGatewayResponse.class, entityType = { IAMEntityType.VpcGateway }) +@APICommand(name = "listPrivateGateways", description = "List private gateways", responseObject = PrivateGatewayResponse.class, entityType = {IAMEntityType.VpcGateway}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListPrivateGatewaysCmd extends BaseListProjectAndAccountResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListPrivateGatewaysCmd.class.getName()); @@ -101,6 +102,6 @@ public class ListPrivateGatewaysCmd extends BaseListProjectAndAccountResourcesCm response.setResponses(projectResponses, gateways.second()); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/ListStaticRoutesCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/ListStaticRoutesCmd.java index 215ae9f31f4..b2cdf879119 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/ListStaticRoutesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/ListStaticRoutesCmd.java @@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.VpcResponse; import com.cloud.network.vpc.StaticRoute; import com.cloud.utils.Pair; -@APICommand(name = "listStaticRoutes", description = "Lists all static routes", responseObject = StaticRouteResponse.class, entityType = { IAMEntityType.StaticRoute }) +@APICommand(name = "listStaticRoutes", description = "Lists all static routes", responseObject = StaticRouteResponse.class, entityType = {IAMEntityType.StaticRoute}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListStaticRoutesCmd extends BaseListTaggedResourcesCmd { private static final String s_name = "liststaticroutesresponse"; @@ -80,7 +81,7 @@ public class ListStaticRoutesCmd extends BaseListTaggedResourcesCmd { } response.setResponses(routeResponses, result.second()); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java index e3d0bc606f5..66ea17654a8 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java @@ -30,7 +30,8 @@ import org.apache.cloudstack.api.response.VpcOfferingResponse; import com.cloud.network.vpc.VpcOffering; -@APICommand(name = "listVPCOfferings", description = "Lists VPC offerings", responseObject = VpcOfferingResponse.class) +@APICommand(name = "listVPCOfferings", description = "Lists VPC offerings", responseObject = VpcOfferingResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListVPCOfferingsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListVPCOfferingsCmd.class.getName()); private static final String Name = "listvpcofferingsresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCsCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCsCmd.java index bbd07d63a3a..fa60f6f7739 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCsCmd.java @@ -22,6 +22,7 @@ import java.util.List; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListTaggedResourcesCmd; @@ -35,8 +36,9 @@ import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.network.vpc.Vpc; -@APICommand(name = "listVPCs", description = "Lists VPCs", responseObject = VpcResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.Vpc }) -public class ListVPCsCmd extends BaseListTaggedResourcesCmd{ +@APICommand(name = "listVPCs", description = "Lists VPCs", responseObject = VpcResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.Vpc }, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) +public class ListVPCsCmd extends BaseListTaggedResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListVPCsCmd.class.getName()); private static final String s_name = "listvpcsresponse"; @@ -71,6 +73,9 @@ public class ListVPCsCmd extends BaseListTaggedResourcesCmd{ @Parameter(name = ApiConstants.RESTART_REQUIRED, type = CommandType.BOOLEAN, description = "list VPCs by restartRequired option") private Boolean restartRequired; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -111,16 +116,24 @@ public class ListVPCsCmd extends BaseListTaggedResourcesCmd{ return restartRequired; } + @Override + public Boolean getDisplay() { + if (display != null) { + return display; + } + return super.getDisplay(); + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @Override public void execute() { - List vpcs = _vpcService.listVpcs(getId(), getVpcName(), getDisplayText(), - getSupportedServices(), getCidr(), getVpcOffId(), getState(), getAccountName(), getDomainId(), - getKeyword(), getStartIndex(), getPageSizeVal(), getZoneId(), isRecursive(), - listAll(), getRestartRequired(), getTags(), getProjectId()); + List vpcs = + _vpcService.listVpcs(getId(), getVpcName(), getDisplayText(), getSupportedServices(), getCidr(), getVpcOffId(), getState(), getAccountName(), getDomainId(), + getKeyword(), getStartIndex(), getPageSizeVal(), getZoneId(), isRecursive(), listAll(), getRestartRequired(), getTags(), + getProjectId(), getDisplay()); ListResponse response = new ListResponse(); List offeringResponses = new ArrayList(); for (Vpc vpc : vpcs) { diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java index cb395eeebd4..d1d805ae48a 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java @@ -37,7 +37,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.vpc.Vpc; import com.cloud.user.Account; -@APICommand(name = "restartVPC", description = "Restarts a VPC", responseObject = VpcResponse.class, entityType = { IAMEntityType.Vpc }) +@APICommand(name = "restartVPC", description = "Restarts a VPC", responseObject = VpcResponse.class, entityType = {IAMEntityType.Vpc}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class RestartVPCCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(RestartVPCCmd.class.getName()); private static final String Name = "restartvpcresponse"; @@ -81,7 +82,7 @@ public class RestartVPCCmd extends BaseAsyncCmd { boolean result = _vpcService.restartVpc(getId()); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to restart VPC"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java index a081b9fd826..76244233b96 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.vpc; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.acl.SecurityChecker.AccessType; import org.apache.cloudstack.api.ACL; import org.apache.cloudstack.api.APICommand; @@ -35,7 +36,8 @@ import com.cloud.event.EventTypes; import com.cloud.network.vpc.Vpc; import com.cloud.user.Account; -@APICommand(name = "updateVPC", description = "Updates a VPC", responseObject = VpcResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.Vpc }) +@APICommand(name = "updateVPC", description = "Updates a VPC", responseObject = VpcResponse.class, responseView = ResponseView.Restricted, entityType = { IAMEntityType.Vpc }, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateVPCCmd extends BaseAsyncCustomIdCmd { public static final Logger s_logger = Logger.getLogger(UpdateVPCCmd.class.getName()); private static final String Name = "updatevpcresponse"; @@ -53,6 +55,9 @@ public class UpdateVPCCmd extends BaseAsyncCustomIdCmd { @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "the display text of the VPC") private String displayText; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the vpc to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -69,6 +74,10 @@ public class UpdateVPCCmd extends BaseAsyncCustomIdCmd { return id; } + public Boolean getDisplayVpc() { + return display; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -89,7 +98,7 @@ public class UpdateVPCCmd extends BaseAsyncCustomIdCmd { @Override public void execute() { - Vpc result = _vpcService.updateVpc(getId(), getVpcName(), getDisplayText(), getCustomId()); + Vpc result = _vpcService.updateVpc(getId(), getVpcName(), getDisplayText(), getCustomId(), getDisplayVpc()); if (result != null) { VpcResponse response = _responseGenerator.createVpcResponse(ResponseView.Restricted, result); response.setResponseName(getCommandName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java index 48ee1fd5939..d057629bb45 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java @@ -35,7 +35,8 @@ import com.cloud.event.EventTypes; import com.cloud.network.VpnUser; import com.cloud.user.Account; -@APICommand(name = "addVpnUser", description = "Adds vpn users", responseObject = VpnUsersResponse.class, entityType = { IAMEntityType.VpnUser }) +@APICommand(name = "addVpnUser", description = "Adds vpn users", responseObject = VpnUsersResponse.class, entityType = {IAMEntityType.VpnUser}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AddVpnUserCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(AddVpnUserCmd.class.getName()); @@ -136,7 +137,7 @@ public class AddVpnUserCmd extends BaseAsyncCreateCmd { vpnResponse.setResponseName(getCommandName()); vpnResponse.setObjectName("vpnuser"); - this.setResponseObject(vpnResponse); + setResponseObject(vpnResponse); } @Override diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateRemoteAccessVpnCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateRemoteAccessVpnCmd.java index b350f3bcfa3..4df21345ecd 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateRemoteAccessVpnCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateRemoteAccessVpnCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.vpn; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiErrorCode; @@ -37,7 +38,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.IpAddress; import com.cloud.network.RemoteAccessVpn; -@APICommand(name = "createRemoteAccessVpn", description = "Creates a l2tp/ipsec remote access vpn", responseObject = RemoteAccessVpnResponse.class, entityType = { IAMEntityType.RemoteAccessVpn }) +@APICommand(name = "createRemoteAccessVpn", description = "Creates a l2tp/ipsec remote access vpn", responseObject = RemoteAccessVpnResponse.class, entityType = { IAMEntityType.RemoteAccessVpn }, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateRemoteAccessVpnCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreateRemoteAccessVpnCmd.class.getName()); @@ -75,10 +77,14 @@ public class CreateRemoteAccessVpnCmd extends BaseAsyncCreateCmd { description = "if true, firewall rule for source/end pubic port is automatically created; if false - firewall rule has to be created explicitely. Has value true by default") private Boolean openFirewall; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the vpn to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// + public Long getPublicIpId() { return publicIpId; } @@ -140,13 +146,13 @@ public class CreateRemoteAccessVpnCmd extends BaseAsyncCreateCmd { @Override public void create() { try { - RemoteAccessVpn vpn = _ravService.createRemoteAccessVpn(publicIpId, ipRange, getOpenFirewall()); + RemoteAccessVpn vpn = _ravService.createRemoteAccessVpn(publicIpId, ipRange, getOpenFirewall(), getDisplay()); if (vpn != null) { - this.setEntityId(vpn.getServerAddressId()); + setEntityId(vpn.getServerAddressId()); // find uuid for server ip address IpAddress ipAddr = _entityMgr.findById(IpAddress.class, vpn.getServerAddressId()); if (ipAddr != null) { - this.setEntityUuid(ipAddr.getUuid()); + setEntityUuid(ipAddr.getUuid()); } } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create remote access vpn"); @@ -165,7 +171,7 @@ public class CreateRemoteAccessVpnCmd extends BaseAsyncCreateCmd { if (result != null) { RemoteAccessVpnResponse response = _responseGenerator.createRemoteAccessVpnResponse(result); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create remote access vpn"); } @@ -192,4 +198,8 @@ public class CreateRemoteAccessVpnCmd extends BaseAsyncCreateCmd { } return ip; } + + public Boolean getDisplay() { + return display; + } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java index e28e4abb129..d405c17ac3d 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.vpn; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiErrorCode; @@ -37,7 +38,9 @@ import com.cloud.network.Site2SiteVpnConnection; import com.cloud.network.Site2SiteVpnGateway; import com.cloud.network.vpc.Vpc; -@APICommand(name = "createVpnConnection", description = "Create site to site vpn connection", responseObject = Site2SiteVpnConnectionResponse.class, entityType = { IAMEntityType.Site2SiteVpnConnection }) + +@APICommand(name = "createVpnConnection", description = "Create site to site vpn connection", responseObject = Site2SiteVpnConnectionResponse.class, entityType = { IAMEntityType.Site2SiteVpnConnection }, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateVpnConnectionCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreateVpnConnectionCmd.class.getName()); @@ -63,6 +66,9 @@ public class CreateVpnConnectionCmd extends BaseAsyncCreateCmd { @Parameter(name = ApiConstants.PASSIVE, type = CommandType.BOOLEAN, required = false, description = "connection is passive or not") private Boolean passive; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the vpn to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -82,6 +88,10 @@ public class CreateVpnConnectionCmd extends BaseAsyncCreateCmd { return passive; } + public Boolean getDisplay() { + return display; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java index 3cc6e17c62d..b8de6e01408 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java @@ -32,7 +32,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.event.EventTypes; import com.cloud.network.Site2SiteCustomerGateway; -@APICommand(name = "createVpnCustomerGateway", description = "Creates site to site vpn customer gateway", responseObject = Site2SiteCustomerGatewayResponse.class, entityType = { IAMEntityType.Site2SiteCustomerGateway }) +@APICommand(name = "createVpnCustomerGateway", description = "Creates site to site vpn customer gateway", responseObject = Site2SiteCustomerGatewayResponse.class, entityType = {IAMEntityType.Site2SiteCustomerGateway}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateVpnCustomerGatewayCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(CreateVpnCustomerGatewayCmd.class.getName()); @@ -166,7 +167,7 @@ public class CreateVpnCustomerGatewayCmd extends BaseAsyncCmd { if (result != null) { Site2SiteCustomerGatewayResponse response = _responseGenerator.createSite2SiteCustomerGatewayResponse(result); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create customer VPN gateway"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java index 19be21bca63..12abfb6e352 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.vpn; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiErrorCode; @@ -32,7 +33,8 @@ import com.cloud.event.EventTypes; import com.cloud.network.Site2SiteVpnGateway; import com.cloud.network.vpc.Vpc; -@APICommand(name = "createVpnGateway", description = "Creates site to site vpn local gateway", responseObject = Site2SiteVpnGatewayResponse.class, entityType = { IAMEntityType.Site2SiteVpnGateway }) +@APICommand(name = "createVpnGateway", description = "Creates site to site vpn local gateway", responseObject = Site2SiteVpnGatewayResponse.class, entityType = { IAMEntityType.Site2SiteVpnGateway }, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateVpnGatewayCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(CreateVpnGatewayCmd.class.getName()); @@ -48,6 +50,9 @@ public class CreateVpnGatewayCmd extends BaseAsyncCmd { description = "public ip address id of the vpn gateway") private Long vpcId; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the vpn to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -56,6 +61,10 @@ public class CreateVpnGatewayCmd extends BaseAsyncCmd { return vpcId; } + public Boolean getDisplay() { + return display; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java index d3eacf5a572..7d0c5aa5a4e 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java @@ -33,7 +33,8 @@ import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.RemoteAccessVpn; -@APICommand(name = "deleteRemoteAccessVpn", description = "Destroys a l2tp/ipsec remote access vpn", responseObject = SuccessResponse.class, entityType = { IAMEntityType.RemoteAccessVpn }) +@APICommand(name = "deleteRemoteAccessVpn", description = "Destroys a l2tp/ipsec remote access vpn", responseObject = SuccessResponse.class, entityType = {IAMEntityType.RemoteAccessVpn}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteRemoteAccessVpnCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteRemoteAccessVpnCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java index 6fe8820f117..6034bcb0de3 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java @@ -33,7 +33,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.Site2SiteVpnConnection; import com.cloud.user.Account; -@APICommand(name = "deleteVpnConnection", description = "Delete site to site vpn connection", responseObject = SuccessResponse.class, entityType = { IAMEntityType.Site2SiteVpnConnection }) +@APICommand(name = "deleteVpnConnection", description = "Delete site to site vpn connection", responseObject = SuccessResponse.class, entityType = {IAMEntityType.Site2SiteVpnConnection}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteVpnConnectionCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteVpnConnectionCmd.class.getName()); @@ -87,7 +88,7 @@ public class DeleteVpnConnectionCmd extends BaseAsyncCmd { boolean result = _s2sVpnService.deleteVpnConnection(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete site to site VPN connection"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java index e24f2317826..3faf5fd2012 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java @@ -34,7 +34,8 @@ import com.cloud.event.EventTypes; import com.cloud.network.Site2SiteCustomerGateway; import com.cloud.user.Account; -@APICommand(name = "deleteVpnCustomerGateway", description = "Delete site to site vpn customer gateway", responseObject = SuccessResponse.class, entityType = { IAMEntityType.Site2SiteCustomerGateway }) +@APICommand(name = "deleteVpnCustomerGateway", description = "Delete site to site vpn customer gateway", responseObject = SuccessResponse.class, entityType = {IAMEntityType.Site2SiteCustomerGateway}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteVpnCustomerGatewayCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteVpnCustomerGatewayCmd.class.getName()); @@ -92,7 +93,7 @@ public class DeleteVpnCustomerGatewayCmd extends BaseAsyncCmd { boolean result = _s2sVpnService.deleteCustomerGateway(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete customer VPN gateway"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java index 6f280370573..66fd55bba2c 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java @@ -32,7 +32,8 @@ import com.cloud.event.EventTypes; import com.cloud.network.Site2SiteVpnGateway; import com.cloud.user.Account; -@APICommand(name = "deleteVpnGateway", description = "Delete site to site vpn gateway", responseObject = SuccessResponse.class, entityType = { IAMEntityType.Site2SiteVpnGateway }) +@APICommand(name = "deleteVpnGateway", description = "Delete site to site vpn gateway", responseObject = SuccessResponse.class, entityType = {IAMEntityType.Site2SiteVpnGateway}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteVpnGatewayCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteVpnGatewayCmd.class.getName()); @@ -86,7 +87,7 @@ public class DeleteVpnGatewayCmd extends BaseAsyncCmd { result = _s2sVpnService.deleteVpnGateway(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete customer VPN gateway"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/ListRemoteAccessVpnsCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/ListRemoteAccessVpnsCmd.java index fde143cccc2..61a3a2993b7 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/ListRemoteAccessVpnsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/ListRemoteAccessVpnsCmd.java @@ -22,6 +22,7 @@ import java.util.List; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; @@ -34,7 +35,8 @@ import org.apache.cloudstack.api.response.RemoteAccessVpnResponse; import com.cloud.network.RemoteAccessVpn; import com.cloud.utils.Pair; -@APICommand(name = "listRemoteAccessVpns", description = "Lists remote access vpns", responseObject = RemoteAccessVpnResponse.class, entityType = { IAMEntityType.RemoteAccessVpn }) +@APICommand(name = "listRemoteAccessVpns", description = "Lists remote access vpns", responseObject = RemoteAccessVpnResponse.class, entityType = { IAMEntityType.RemoteAccessVpn }, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListRemoteAccessVpnsCmd extends BaseListProjectAndAccountResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListRemoteAccessVpnsCmd.class.getName()); @@ -60,6 +62,9 @@ public class ListRemoteAccessVpnsCmd extends BaseListProjectAndAccountResourcesC since = "4.3") private Long networkId; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -76,6 +81,14 @@ public class ListRemoteAccessVpnsCmd extends BaseListProjectAndAccountResourcesC return networkId; } + @Override + public Boolean getDisplay() { + if (display != null) { + return display; + } + return super.getDisplay(); + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -97,6 +110,6 @@ public class ListRemoteAccessVpnsCmd extends BaseListProjectAndAccountResourcesC } response.setResponses(vpnResponses, vpns.second()); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnConnectionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnConnectionsCmd.java index ed93741b159..f8e81c2f010 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnConnectionsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnConnectionsCmd.java @@ -22,6 +22,7 @@ import java.util.List; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; @@ -33,7 +34,8 @@ import org.apache.cloudstack.api.response.VpcResponse; import com.cloud.network.Site2SiteVpnConnection; import com.cloud.utils.Pair; -@APICommand(name = "listVpnConnections", description = "Lists site to site vpn connection gateways", responseObject = Site2SiteVpnConnectionResponse.class, entityType = { IAMEntityType.Site2SiteVpnConnection }) +@APICommand(name = "listVpnConnections", description = "Lists site to site vpn connection gateways", responseObject = Site2SiteVpnConnectionResponse.class, entityType = { IAMEntityType.Site2SiteVpnConnection }, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListVpnConnectionsCmd extends BaseListProjectAndAccountResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListVpnConnectionsCmd.class.getName()); @@ -48,6 +50,9 @@ public class ListVpnConnectionsCmd extends BaseListProjectAndAccountResourcesCmd @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "id of vpc") private Long vpcId; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -60,6 +65,14 @@ public class ListVpnConnectionsCmd extends BaseListProjectAndAccountResourcesCmd return vpcId; } + @Override + public Boolean getDisplay() { + if (display != null) { + return display; + } + return super.getDisplay(); + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -85,6 +98,6 @@ public class ListVpnConnectionsCmd extends BaseListProjectAndAccountResourcesCmd response.setResponses(connResponses, conns.second()); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnCustomerGatewaysCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnCustomerGatewaysCmd.java index 2304964c278..fed96a72b3a 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnCustomerGatewaysCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnCustomerGatewaysCmd.java @@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.Site2SiteCustomerGatewayResponse; import com.cloud.network.Site2SiteCustomerGateway; import com.cloud.utils.Pair; -@APICommand(name = "listVpnCustomerGateways", description = "Lists site to site vpn customer gateways", responseObject = Site2SiteCustomerGatewayResponse.class, entityType = { IAMEntityType.Site2SiteCustomerGateway }) +@APICommand(name = "listVpnCustomerGateways", description = "Lists site to site vpn customer gateways", responseObject = Site2SiteCustomerGatewayResponse.class, entityType = {IAMEntityType.Site2SiteCustomerGateway}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListVpnCustomerGatewaysCmd extends BaseListProjectAndAccountResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListVpnCustomerGatewaysCmd.class.getName()); @@ -78,6 +79,6 @@ public class ListVpnCustomerGatewaysCmd extends BaseListProjectAndAccountResourc response.setResponses(gwResponses, gws.second()); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnGatewaysCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnGatewaysCmd.java index 7f8a33fac8b..17702252e85 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnGatewaysCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnGatewaysCmd.java @@ -22,6 +22,7 @@ import java.util.List; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.IAMEntityType; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; @@ -33,7 +34,8 @@ import org.apache.cloudstack.api.response.VpcResponse; import com.cloud.network.Site2SiteVpnGateway; import com.cloud.utils.Pair; -@APICommand(name = "listVpnGateways", description = "Lists site 2 site vpn gateways", responseObject = Site2SiteVpnGatewayResponse.class, entityType = { IAMEntityType.Site2SiteVpnGateway }) +@APICommand(name = "listVpnGateways", description = "Lists site 2 site vpn gateways", responseObject = Site2SiteVpnGatewayResponse.class, entityType = { IAMEntityType.Site2SiteVpnGateway }, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListVpnGatewaysCmd extends BaseListProjectAndAccountResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListVpnGatewaysCmd.class.getName()); @@ -49,6 +51,9 @@ public class ListVpnGatewaysCmd extends BaseListProjectAndAccountResourcesCmd { @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "id of vpc") private Long vpcId; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -61,6 +66,14 @@ public class ListVpnGatewaysCmd extends BaseListProjectAndAccountResourcesCmd { return vpcId; } + @Override + public Boolean getDisplay() { + if (display != null) { + return display; + } + return super.getDisplay(); + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -86,6 +99,6 @@ public class ListVpnGatewaysCmd extends BaseListProjectAndAccountResourcesCmd { response.setResponses(gwResponses, gws.second()); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnUsersCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnUsersCmd.java index 6efdaa13d56..1d8ea85cbb6 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnUsersCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnUsersCmd.java @@ -32,7 +32,8 @@ import org.apache.cloudstack.api.response.VpnUsersResponse; import com.cloud.network.VpnUser; import com.cloud.utils.Pair; -@APICommand(name = "listVpnUsers", description = "Lists vpn users", responseObject = VpnUsersResponse.class, entityType = { IAMEntityType.VpnUser }) +@APICommand(name = "listVpnUsers", description = "Lists vpn users", responseObject = VpnUsersResponse.class, entityType = {IAMEntityType.VpnUser}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListVpnUsersCmd extends BaseListProjectAndAccountResourcesCmd { public static final Logger s_logger = Logger.getLogger(ListVpnUsersCmd.class.getName()); @@ -80,6 +81,6 @@ public class ListVpnUsersCmd extends BaseListProjectAndAccountResourcesCmd { response.setResponses(vpnResponses, vpnUsers.second()); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java index d39c1a42aee..ed39c9075b5 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java @@ -33,7 +33,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.event.EventTypes; import com.cloud.user.Account; -@APICommand(name = "removeVpnUser", description = "Removes vpn user", responseObject = SuccessResponse.class, entityType = { IAMEntityType.VpnUser }) +@APICommand(name = "removeVpnUser", description = "Removes vpn user", responseObject = SuccessResponse.class, entityType = {IAMEntityType.VpnUser}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class RemoveVpnUserCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(RemoveVpnUserCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java index 025cc861f85..dcd60a40ca9 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java @@ -34,7 +34,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.Site2SiteVpnConnection; import com.cloud.user.Account; -@APICommand(name = "resetVpnConnection", description = "Reset site to site vpn connection", responseObject = Site2SiteVpnConnectionResponse.class, entityType = { IAMEntityType.Site2SiteVpnConnection }) +@APICommand(name = "resetVpnConnection", description = "Reset site to site vpn connection", responseObject = Site2SiteVpnConnectionResponse.class, entityType = {IAMEntityType.Site2SiteVpnConnection}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ResetVpnConnectionCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ResetVpnConnectionCmd.class.getName()); @@ -106,7 +107,7 @@ public class ResetVpnConnectionCmd extends BaseAsyncCmd { if (result != null) { Site2SiteVpnConnectionResponse response = _responseGenerator.createSite2SiteVpnConnectionResponse(result); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reset site to site VPN connection"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateRemoteAccessVpnCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateRemoteAccessVpnCmd.java index e275faf67ed..08d3b0a5cd4 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateRemoteAccessVpnCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateRemoteAccessVpnCmd.java @@ -16,6 +16,7 @@ // under the License. package org.apache.cloudstack.api.command.user.vpn; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseAsyncCustomIdCmd; @@ -28,7 +29,8 @@ import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.RemoteAccessVpn; -@APICommand(name = "updateRemoteAccessVpn", description = "Updates remote access vpn", responseObject = RemoteAccessVpnResponse.class, since = "4.4") +@APICommand(name = "updateRemoteAccessVpn", description = "Updates remote access vpn", responseObject = RemoteAccessVpnResponse.class, since = "4.4", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateRemoteAccessVpnCmd extends BaseAsyncCustomIdCmd { public static final Logger s_logger = Logger.getLogger(UpdateRemoteAccessVpnCmd.class.getName()); @@ -45,6 +47,9 @@ public class UpdateRemoteAccessVpnCmd extends BaseAsyncCustomIdCmd { @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, entityType = AccountResponse.class, expose = false) private Long ownerId; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the vpn to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -58,6 +63,10 @@ public class UpdateRemoteAccessVpnCmd extends BaseAsyncCustomIdCmd { return s_name; } + public Boolean getDisplay() { + return display; + } + @Override public long getEntityOwnerId() { if (ownerId == null) { @@ -86,7 +95,7 @@ public class UpdateRemoteAccessVpnCmd extends BaseAsyncCustomIdCmd { @Override public void execute() { - RemoteAccessVpn result = _ravService.updateRemoteAccessVpn(id, this.getCustomId()); + RemoteAccessVpn result = _ravService.updateRemoteAccessVpn(id, this.getCustomId(), getDisplay()); RemoteAccessVpnResponse response = _responseGenerator.createRemoteAccessVpnResponse(result); response.setResponseName(getCommandName()); this.setResponseObject(response); diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnConnectionCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnConnectionCmd.java index 5fee7a2d42d..282afe04267 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnConnectionCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnConnectionCmd.java @@ -16,6 +16,7 @@ // under the License. package org.apache.cloudstack.api.command.user.vpn; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseAsyncCustomIdCmd; @@ -27,7 +28,8 @@ import com.cloud.event.EventTypes; import com.cloud.network.Site2SiteVpnConnection; import com.cloud.user.Account; -@APICommand(name = "updateVpnConnection", description = "Updates site to site vpn connection", responseObject = Site2SiteVpnConnectionResponse.class, since = "4.4") +@APICommand(name = "updateVpnConnection", description = "Updates site to site vpn connection", responseObject = Site2SiteVpnConnectionResponse.class, since = "4.4", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateVpnConnectionCmd extends BaseAsyncCustomIdCmd { public static final Logger s_logger = Logger.getLogger(UpdateVpnConnectionCmd.class.getName()); @@ -39,12 +41,19 @@ public class UpdateVpnConnectionCmd extends BaseAsyncCustomIdCmd { @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = Site2SiteVpnConnectionResponse.class, required = true, description = "id of vpn connection") private Long id; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the vpn to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// public Long getId() { return id; } + + public Boolean getDisplay() { + return display; + } ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -75,7 +84,7 @@ public class UpdateVpnConnectionCmd extends BaseAsyncCustomIdCmd { @Override public void execute() { - Site2SiteVpnConnection result = _s2sVpnService.updateVpnConnection(id, this.getCustomId()); + Site2SiteVpnConnection result = _s2sVpnService.updateVpnConnection(id, this.getCustomId(), getDisplay()); Site2SiteVpnConnectionResponse response = _responseGenerator.createSite2SiteVpnConnectionResponse(result); response.setResponseName(getCommandName()); setResponseObject(response); diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java index f88fa304ca6..84259641873 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java @@ -32,7 +32,8 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.event.EventTypes; import com.cloud.network.Site2SiteCustomerGateway; -@APICommand(name = "updateVpnCustomerGateway", description = "Update site to site vpn customer gateway", responseObject = Site2SiteCustomerGatewayResponse.class, entityType = { IAMEntityType.Site2SiteCustomerGateway }) +@APICommand(name = "updateVpnCustomerGateway", description = "Update site to site vpn customer gateway", responseObject = Site2SiteCustomerGatewayResponse.class, entityType = {IAMEntityType.Site2SiteCustomerGateway}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateVpnCustomerGatewayCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(UpdateVpnCustomerGatewayCmd.class.getName()); @@ -169,7 +170,7 @@ public class UpdateVpnCustomerGatewayCmd extends BaseAsyncCmd { if (result != null) { Site2SiteCustomerGatewayResponse response = _responseGenerator.createSite2SiteCustomerGatewayResponse(result); response.setResponseName(getCommandName()); - this.setResponseObject(response); + setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update customer VPN gateway"); } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnGatewayCmd.java index 30c56b42fd4..66c59ad9f1b 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnGatewayCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnGatewayCmd.java @@ -16,6 +16,7 @@ // under the License. package org.apache.cloudstack.api.command.user.vpn; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseAsyncCustomIdCmd; @@ -27,7 +28,8 @@ import com.cloud.event.EventTypes; import com.cloud.network.Site2SiteVpnGateway; import com.cloud.user.Account; -@APICommand(name = "updateVpnGateway", description = "Updates site to site vpn local gateway", responseObject = Site2SiteVpnGatewayResponse.class, since = "4.4") +@APICommand(name = "updateVpnGateway", description = "Updates site to site vpn local gateway", responseObject = Site2SiteVpnGatewayResponse.class, since = "4.4", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateVpnGatewayCmd extends BaseAsyncCustomIdCmd { public static final Logger s_logger = Logger.getLogger(UpdateVpnGatewayCmd.class.getName()); @@ -39,6 +41,9 @@ public class UpdateVpnGatewayCmd extends BaseAsyncCustomIdCmd { @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = Site2SiteVpnGatewayResponse.class, required = true, description = "id of customer gateway") private Long id; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the vpn to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -46,6 +51,10 @@ public class UpdateVpnGatewayCmd extends BaseAsyncCustomIdCmd { return id; } + public Boolean getDisplay() { + return display; + } + @Override public String getCommandName() { return s_name; @@ -75,7 +84,7 @@ public class UpdateVpnGatewayCmd extends BaseAsyncCustomIdCmd { ///////////////////////////////////////////////////// @Override public void execute() { - Site2SiteVpnGateway result = _s2sVpnService.updateVpnGateway(id, this.getCustomId()); + Site2SiteVpnGateway result = _s2sVpnService.updateVpnGateway(id, this.getCustomId(), getDisplay()); Site2SiteVpnGatewayResponse response = _responseGenerator.createSite2SiteVpnGatewayResponse(result); response.setResponseName(getCommandName()); } diff --git a/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesCmd.java b/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesCmd.java index 1b2969daf9e..34a5440fb64 100644 --- a/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesCmd.java @@ -34,9 +34,11 @@ import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.exception.InvalidParameterValueException; -@APICommand(name = "listZones", description = "Lists zones", responseObject = ZoneResponse.class, responseView = ResponseView.Restricted) +@APICommand(name = "listZones", description = "Lists zones", responseObject = ZoneResponse.class, responseView = ResponseView.Restricted, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListZonesCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListZonesCmd.class.getName()); + private static final String s_name = "listzonesresponse"; ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerInstanceResponse.java b/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerInstanceResponse.java index edaac07b974..bdbb954df03 100644 --- a/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerInstanceResponse.java +++ b/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerInstanceResponse.java @@ -16,12 +16,11 @@ // under the License. package org.apache.cloudstack.api.response; -import com.google.gson.annotations.SerializedName; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; /** * diff --git a/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerResponse.java b/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerResponse.java index 1e9f9c7ba30..53e3f868a3b 100644 --- a/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerResponse.java +++ b/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerResponse.java @@ -19,12 +19,12 @@ package org.apache.cloudstack.api.response; import java.util.List; -import com.google.gson.annotations.SerializedName; - +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; @SuppressWarnings("unused") public class ApplicationLoadBalancerResponse extends BaseResponse implements ControlledEntityResponse { @@ -88,6 +88,10 @@ public class ApplicationLoadBalancerResponse extends BaseResponse implements Con @Param(description = "the list of resource tags associated with the Load Balancer", responseObject = ResourceTagResponse.class) private List tags; + @SerializedName(ApiConstants.FOR_DISPLAY) + @Param(description = "is rule for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + private Boolean forDisplay; + @Override public void setAccountName(String accountName) { this.accountName = accountName; @@ -152,4 +156,8 @@ public class ApplicationLoadBalancerResponse extends BaseResponse implements Con public void setLbInstances(List lbInstances) { this.lbInstances = lbInstances; } + + public void setForDisplay(Boolean forDisplay) { + this.forDisplay = forDisplay; + } } diff --git a/api/src/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java b/api/src/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java index a88325f98b0..572d4626fd9 100644 --- a/api/src/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java +++ b/api/src/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java @@ -18,14 +18,14 @@ package org.apache.cloudstack.api.response; import java.util.List; -import com.google.gson.annotations.SerializedName; - +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; import com.cloud.network.as.AutoScaleVmGroup; import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; @EntityReference(value = AutoScaleVmGroup.class) public class AutoScaleVmGroupResponse extends BaseResponse implements ControlledEntityResponse { @@ -86,6 +86,10 @@ public class AutoScaleVmGroupResponse extends BaseResponse implements Controlled @Param(description = "the domain name of the vm profile") private String domainName; + @SerializedName(ApiConstants.FOR_DISPLAY) + @Param(description = "is group for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + private Boolean forDisplay; + public AutoScaleVmGroupResponse() { } @@ -155,4 +159,8 @@ public class AutoScaleVmGroupResponse extends BaseResponse implements Controlled public void setProjectName(String projectName) { this.projectName = projectName; } + + public void setForDisplay(Boolean forDisplay) { + this.forDisplay = forDisplay; + } } diff --git a/api/src/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java b/api/src/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java index e1c33e7881b..2c219357150 100644 --- a/api/src/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java +++ b/api/src/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java @@ -20,8 +20,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import com.google.gson.annotations.SerializedName; - +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseCmd.CommandType; import org.apache.cloudstack.api.BaseResponse; @@ -31,6 +30,7 @@ import org.apache.cloudstack.api.Parameter; import com.cloud.network.as.AutoScaleVmProfile; import com.cloud.serializer.Param; import com.cloud.utils.Pair; +import com.google.gson.annotations.SerializedName; @EntityReference(value = AutoScaleVmProfile.class) public class AutoScaleVmProfileResponse extends BaseResponse implements ControlledEntityResponse { @@ -97,8 +97,11 @@ public class AutoScaleVmProfileResponse extends BaseResponse implements Controll @Param(description = "the domain name of the vm profile") private String domainName; - public AutoScaleVmProfileResponse() { + @SerializedName(ApiConstants.FOR_DISPLAY) + @Param(description = "is profile for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + private Boolean forDisplay; + public AutoScaleVmProfileResponse() { } @Override @@ -171,4 +174,8 @@ public class AutoScaleVmProfileResponse extends BaseResponse implements Controll public void setCsUrl(String csUrl) { this.csUrl = csUrl; } + + public void setForDisplay(Boolean forDisplay) { + this.forDisplay = forDisplay; + } } diff --git a/api/src/org/apache/cloudstack/api/response/FirewallResponse.java b/api/src/org/apache/cloudstack/api/response/FirewallResponse.java index e3aaec567e1..4c1342a7ecb 100644 --- a/api/src/org/apache/cloudstack/api/response/FirewallResponse.java +++ b/api/src/org/apache/cloudstack/api/response/FirewallResponse.java @@ -18,12 +18,12 @@ package org.apache.cloudstack.api.response; import java.util.List; -import com.google.gson.annotations.SerializedName; - +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; @SuppressWarnings("unused") public class FirewallResponse extends BaseResponse { @@ -75,6 +75,10 @@ public class FirewallResponse extends BaseResponse { @Param(description = "the list of resource tags associated with the rule", responseObject = ResourceTagResponse.class) private List tags; + @SerializedName(ApiConstants.FOR_DISPLAY) + @Param(description = "is rule for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + private Boolean forDisplay; + public void setId(String id) { this.id = id; } @@ -122,4 +126,8 @@ public class FirewallResponse extends BaseResponse { public void setTags(List tags) { this.tags = tags; } + + public void setForDisplay(Boolean forDisplay) { + this.forDisplay = forDisplay; + } } diff --git a/api/src/org/apache/cloudstack/api/response/FirewallRuleResponse.java b/api/src/org/apache/cloudstack/api/response/FirewallRuleResponse.java index 71a3097688c..0d11e85af66 100644 --- a/api/src/org/apache/cloudstack/api/response/FirewallRuleResponse.java +++ b/api/src/org/apache/cloudstack/api/response/FirewallRuleResponse.java @@ -18,14 +18,14 @@ package org.apache.cloudstack.api.response; import java.util.List; -import com.google.gson.annotations.SerializedName; - +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; import com.cloud.network.rules.FirewallRule; import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; @EntityReference(value = FirewallRule.class) @SuppressWarnings("unused") @@ -94,6 +94,10 @@ public class FirewallRuleResponse extends BaseResponse { @Param(description = "the id of the guest network the port forwarding rule belongs to") private String networkId; + @SerializedName(ApiConstants.FOR_DISPLAY) + @Param(description = "is firewall for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + private Boolean forDisplay; + public String getDestNatVmIp() { return destNatVmIp; } @@ -218,4 +222,8 @@ public class FirewallRuleResponse extends BaseResponse { public void setNetworkId(String networkId) { this.networkId = networkId; } + + public void setForDisplay(Boolean forDisplay) { + this.forDisplay = forDisplay; + } } diff --git a/api/src/org/apache/cloudstack/api/response/IPAddressResponse.java b/api/src/org/apache/cloudstack/api/response/IPAddressResponse.java index 4889a5638c3..3c03247eddb 100644 --- a/api/src/org/apache/cloudstack/api/response/IPAddressResponse.java +++ b/api/src/org/apache/cloudstack/api/response/IPAddressResponse.java @@ -19,14 +19,14 @@ package org.apache.cloudstack.api.response; import java.util.Date; import java.util.List; -import com.google.gson.annotations.SerializedName; - +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; import com.cloud.network.IpAddress; import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; @EntityReference(value = IpAddress.class) @SuppressWarnings("unused") @@ -146,6 +146,10 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR @Param(description = "is public IP portable across the zones") private Boolean isPortable; + @SerializedName(ApiConstants.FOR_DISPLAY) + @Param(description = "is public ip for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + private Boolean forDisplay; + /* @SerializedName(ApiConstants.JOB_ID) @Param(description="shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the volume") private IdentityProxy jobId = new IdentityProxy("async_job"); @@ -280,4 +284,8 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR public void setPortable(Boolean portable) { this.isPortable = portable; } + + public void setForDisplay(Boolean forDisplay) { + this.forDisplay = forDisplay; + } } diff --git a/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java b/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java index 03946b90064..21e1dab450e 100644 --- a/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java +++ b/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java @@ -18,12 +18,12 @@ package org.apache.cloudstack.api.response; import java.util.List; -import com.google.gson.annotations.SerializedName; - +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; @SuppressWarnings("unused") public class LoadBalancerResponse extends BaseResponse implements ControlledEntityResponse { @@ -103,6 +103,10 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti @Param(description = "the list of resource tags associated with load balancer", responseObject = ResourceTagResponse.class) private List tags; + @SerializedName(ApiConstants.FOR_DISPLAY) + @Param(description = "is rule for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + private Boolean forDisplay; + public void setId(String id) { this.id = id; } @@ -183,4 +187,8 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti public void setLbProtocol(String lbProtocol) { this.lbProtocol = lbProtocol; } + + public void setForDisplay(Boolean forDisplay) { + this.forDisplay = forDisplay; + } } diff --git a/api/src/org/apache/cloudstack/api/response/NetworkACLItemResponse.java b/api/src/org/apache/cloudstack/api/response/NetworkACLItemResponse.java index 430422c17e6..01012957978 100644 --- a/api/src/org/apache/cloudstack/api/response/NetworkACLItemResponse.java +++ b/api/src/org/apache/cloudstack/api/response/NetworkACLItemResponse.java @@ -18,14 +18,14 @@ package org.apache.cloudstack.api.response; import java.util.List; -import com.google.gson.annotations.SerializedName; - +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; import com.cloud.network.vpc.NetworkACLItem; import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; @EntityReference(value = NetworkACLItem.class) public class NetworkACLItemResponse extends BaseResponse { @@ -81,6 +81,10 @@ public class NetworkACLItemResponse extends BaseResponse { @Param(description = "Action of ACL Item. Allow/Deny") private String action; + @SerializedName(ApiConstants.FOR_DISPLAY) + @Param(description = "is rule for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + private Boolean forDisplay; + public void setId(String id) { this.id = id; } @@ -132,4 +136,8 @@ public class NetworkACLItemResponse extends BaseResponse { public void setAction(String action) { this.action = action; } + + public void setForDisplay(Boolean forDisplay) { + this.forDisplay = forDisplay; + } } diff --git a/api/src/org/apache/cloudstack/api/response/NetworkACLResponse.java b/api/src/org/apache/cloudstack/api/response/NetworkACLResponse.java index 1ee9c33d2b0..fca8bcdc4cf 100644 --- a/api/src/org/apache/cloudstack/api/response/NetworkACLResponse.java +++ b/api/src/org/apache/cloudstack/api/response/NetworkACLResponse.java @@ -16,14 +16,14 @@ // under the License. package org.apache.cloudstack.api.response; -import com.google.gson.annotations.SerializedName; - +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; import com.cloud.network.vpc.NetworkACL; import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; @EntityReference(value = NetworkACL.class) public class NetworkACLResponse extends BaseResponse { @@ -43,6 +43,10 @@ public class NetworkACLResponse extends BaseResponse { @Param(description = "Id of the VPC this ACL is associated with") private String vpcId; + @SerializedName(ApiConstants.FOR_DISPLAY) + @Param(description = "is ACL for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + private Boolean forDisplay; + public void setId(String id) { this.id = id; } @@ -58,4 +62,8 @@ public class NetworkACLResponse extends BaseResponse { public void setVpcId(String vpcId) { this.vpcId = vpcId; } + + public void setForDisplay(Boolean forDisplay) { + this.forDisplay = forDisplay; + } } diff --git a/api/src/org/apache/cloudstack/api/response/NetworkResponse.java b/api/src/org/apache/cloudstack/api/response/NetworkResponse.java index 58ec956e9bc..bf92aa4f785 100644 --- a/api/src/org/apache/cloudstack/api/response/NetworkResponse.java +++ b/api/src/org/apache/cloudstack/api/response/NetworkResponse.java @@ -18,8 +18,7 @@ package org.apache.cloudstack.api.response; import java.util.List; -import com.google.gson.annotations.SerializedName; - +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; @@ -27,6 +26,7 @@ import org.apache.cloudstack.api.EntityReference; import com.cloud.network.Network; import com.cloud.projects.ProjectAccount; import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; @SuppressWarnings("unused") @EntityReference(value = {Network.class, ProjectAccount.class}) @@ -209,7 +209,7 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes private String ip6Cidr; @SerializedName(ApiConstants.DISPLAY_NETWORK) - @Param(description = "an optional field, whether to the display the network to the end user or not.") + @Param(description = "an optional field, whether to the display the network to the end user or not.", authorized = {RoleType.Admin}) private Boolean displayNetwork; @SerializedName(ApiConstants.ACL_ID) diff --git a/api/src/org/apache/cloudstack/api/response/RemoteAccessVpnResponse.java b/api/src/org/apache/cloudstack/api/response/RemoteAccessVpnResponse.java index e09bd946994..28d788b427b 100644 --- a/api/src/org/apache/cloudstack/api/response/RemoteAccessVpnResponse.java +++ b/api/src/org/apache/cloudstack/api/response/RemoteAccessVpnResponse.java @@ -16,14 +16,14 @@ // under the License. package org.apache.cloudstack.api.response; -import com.google.gson.annotations.SerializedName; - +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; import com.cloud.network.RemoteAccessVpn; import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; @EntityReference(value = RemoteAccessVpn.class) @SuppressWarnings("unused") @@ -73,6 +73,10 @@ public class RemoteAccessVpnResponse extends BaseResponse implements ControlledE @Param(description = "the id of the remote access vpn") private String id; + @SerializedName(ApiConstants.FOR_DISPLAY) + @Param(description = "is vpn for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + private Boolean forDisplay; + public void setPublicIp(String publicIp) { this.publicIp = publicIp; } @@ -122,4 +126,7 @@ public class RemoteAccessVpnResponse extends BaseResponse implements ControlledE this.id = id; } + public void setForDisplay(Boolean forDisplay) { + this.forDisplay = forDisplay; + } } diff --git a/api/src/org/apache/cloudstack/api/response/ResourceTagResponse.java b/api/src/org/apache/cloudstack/api/response/ResourceTagResponse.java index 839876e345e..ae61347b480 100644 --- a/api/src/org/apache/cloudstack/api/response/ResourceTagResponse.java +++ b/api/src/org/apache/cloudstack/api/response/ResourceTagResponse.java @@ -109,4 +109,35 @@ public class ResourceTagResponse extends BaseResponse implements ControlledViewE public void setCustomer(String customer) { this.customer = customer; } + + public String getKey() { + return this.key; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + String key = this.getKey(); + result = prime * result + ((key == null) ? 0 : key.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ResourceTagResponse other = (ResourceTagResponse) obj; + String key = this.getKey(); + if (key == null) { + if (other.getKey() != null) + return false; + } else if (!key.equals(other.getKey())) + return false; + return true; + } } diff --git a/api/src/org/apache/cloudstack/api/response/Site2SiteVpnConnectionResponse.java b/api/src/org/apache/cloudstack/api/response/Site2SiteVpnConnectionResponse.java index f025b525122..4c572566f85 100644 --- a/api/src/org/apache/cloudstack/api/response/Site2SiteVpnConnectionResponse.java +++ b/api/src/org/apache/cloudstack/api/response/Site2SiteVpnConnectionResponse.java @@ -18,6 +18,7 @@ package org.apache.cloudstack.api.response; import java.util.Date; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; @@ -122,6 +123,10 @@ public class Site2SiteVpnConnectionResponse extends BaseResponse implements Cont @Param(description = "the date and time the host was removed") private Date removed; + @SerializedName(ApiConstants.FOR_DISPLAY) + @Param(description = "is connection for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + private Boolean forDisplay; + public void setId(String id) { this.id = id; } @@ -211,4 +216,8 @@ public class Site2SiteVpnConnectionResponse extends BaseResponse implements Cont this.domain = domainName; } + public void setForDisplay(Boolean forDisplay) { + this.forDisplay = forDisplay; + } + } diff --git a/api/src/org/apache/cloudstack/api/response/Site2SiteVpnGatewayResponse.java b/api/src/org/apache/cloudstack/api/response/Site2SiteVpnGatewayResponse.java index c0917c7e09f..e7194d73e91 100644 --- a/api/src/org/apache/cloudstack/api/response/Site2SiteVpnGatewayResponse.java +++ b/api/src/org/apache/cloudstack/api/response/Site2SiteVpnGatewayResponse.java @@ -18,14 +18,14 @@ package org.apache.cloudstack.api.response; import java.util.Date; -import com.google.gson.annotations.SerializedName; - +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; import com.cloud.network.Site2SiteVpnGateway; import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; @EntityReference(value = Site2SiteVpnGateway.class) @SuppressWarnings("unused") @@ -66,6 +66,10 @@ public class Site2SiteVpnGatewayResponse extends BaseResponse implements Control @Param(description = "the date and time the host was removed") private Date removed; + @SerializedName(ApiConstants.FOR_DISPLAY) + @Param(description = "is vpn gateway for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + private Boolean forDisplay; + public void setId(String id) { this.id = id; } @@ -107,4 +111,7 @@ public class Site2SiteVpnGatewayResponse extends BaseResponse implements Control this.domain = domainName; } + public void setForDisplay(Boolean forDisplay) { + this.forDisplay = forDisplay; + } } diff --git a/api/src/org/apache/cloudstack/api/response/UserVmResponse.java b/api/src/org/apache/cloudstack/api/response/UserVmResponse.java index 26ecb5bb088..84d532bbc17 100644 --- a/api/src/org/apache/cloudstack/api/response/UserVmResponse.java +++ b/api/src/org/apache/cloudstack/api/response/UserVmResponse.java @@ -21,6 +21,7 @@ import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.affinity.AffinityGroupResponse; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; @@ -248,7 +249,7 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp private Set affinityGroupList; @SerializedName(ApiConstants.DISPLAY_VM) - @Param(description = "an optional field whether to the display the vm to the end user or not.") + @Param(description = "an optional field whether to the display the vm to the end user or not.", authorized = {RoleType.Admin}) private Boolean displayVm; @SerializedName(ApiConstants.IS_DYNAMICALLY_SCALABLE) diff --git a/api/src/org/apache/cloudstack/api/response/VolumeResponse.java b/api/src/org/apache/cloudstack/api/response/VolumeResponse.java index f511662993e..27e95def021 100644 --- a/api/src/org/apache/cloudstack/api/response/VolumeResponse.java +++ b/api/src/org/apache/cloudstack/api/response/VolumeResponse.java @@ -20,14 +20,14 @@ import java.util.Date; import java.util.LinkedHashSet; import java.util.Set; -import com.google.gson.annotations.SerializedName; - +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; import com.cloud.serializer.Param; import com.cloud.storage.Volume; +import com.google.gson.annotations.SerializedName; @EntityReference(value = Volume.class) @SuppressWarnings("unused") @@ -189,17 +189,21 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity private Set tags; @SerializedName(ApiConstants.DISPLAY_VOLUME) - @Param(description = "an optional field whether to the display the volume to the end user or not.") - private Boolean displayVm; + @Param(description = "an optional field whether to the display the volume to the end user or not.", authorized = {RoleType.Admin}) + private Boolean displayVolume; @SerializedName(ApiConstants.PATH) - @Param(description = "The path of the volume") + @Param(description = "the path of the volume") private String path; @SerializedName(ApiConstants.STORAGE_ID) @Param(description = "id of the primary storage hosting the disk volume; returned to admin user only", since = "4.3") private String storagePoolId; + @SerializedName(ApiConstants.CHAIN_INFO) + @Param(description = "the chain info of the volume", since = "4.4") + String chainInfo; + public String getPath() { return path; } @@ -406,15 +410,19 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity this.tags.add(tag); } - public Boolean getDisplayVm() { - return displayVm; - } - - public void setDisplayVm(Boolean displayVm) { - this.displayVm = displayVm; + public void setDisplayVolume(Boolean displayVm) { + this.displayVolume = displayVm; } public void setStoragePoolId(String storagePoolId) { this.storagePoolId = storagePoolId; } + + public String getChainInfo() { + return chainInfo; + } + + public void setChainInfo(String chainInfo) { + this.chainInfo = chainInfo; + } } diff --git a/api/src/org/apache/cloudstack/api/response/VpcResponse.java b/api/src/org/apache/cloudstack/api/response/VpcResponse.java index fd9b710bc27..eeafb40c142 100644 --- a/api/src/org/apache/cloudstack/api/response/VpcResponse.java +++ b/api/src/org/apache/cloudstack/api/response/VpcResponse.java @@ -19,14 +19,14 @@ package org.apache.cloudstack.api.response; import java.util.Date; import java.util.List; -import com.google.gson.annotations.SerializedName; - +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; import com.cloud.network.vpc.Vpc; import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; @EntityReference(value = Vpc.class) @SuppressWarnings("unused") @@ -107,6 +107,10 @@ public class VpcResponse extends BaseResponse implements ControlledEntityRespons @Param(description = "the list of resource tags associated with the project", responseObject = ResourceTagResponse.class) private List tags; + @SerializedName(ApiConstants.FOR_DISPLAY) + @Param(description = "is vpc for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + private Boolean forDisplay; + public void setId(String id) { this.id = id; } @@ -191,4 +195,8 @@ public class VpcResponse extends BaseResponse implements ControlledEntityRespons public void setTags(List tags) { this.tags = tags; } + + public void setForDisplay(Boolean forDisplay) { + this.forDisplay = forDisplay; + } } diff --git a/api/src/org/apache/cloudstack/context/CallContext.java b/api/src/org/apache/cloudstack/context/CallContext.java index dbeb5c7ea21..661b01dd55c 100644 --- a/api/src/org/apache/cloudstack/context/CallContext.java +++ b/api/src/org/apache/cloudstack/context/CallContext.java @@ -55,6 +55,7 @@ public class CallContext { private String eventDescription; private String eventDetails; private String eventType; + private boolean isEventDisplayEnabled = true; // default to true unless specifically set private User user; private long userId; private final Map context = new HashMap(); @@ -131,7 +132,10 @@ public class CallContext { protected static CallContext register(User callingUser, Account callingAccount, Long userId, Long accountId, String contextId) { /* +<<<<<<< HEAD Unit tests will have multiple times of setup/tear-down call to this, remove assertions to all unit test to run +======= +>>>>>>> a7a8a19... BUG-ID: CS-19295: add job path to help associate an API job to related internal job. Reviewed-By: Self assert s_currentContext.get() == null : "There's a context already so what does this new register context mean? " + s_currentContext.get().toString(); if (s_currentContext.get() != null) { // FIXME: This should be removed soon. I added this check only to surface all the places that have this problem. throw new CloudRuntimeException("There's a context already so what does this new register context mean? " + s_currentContext.get().toString()); @@ -154,6 +158,14 @@ public class CallContext { return callingContext; } + public static CallContext registerPlaceHolderContext() { + CallContext context = new CallContext(0, 0, UUID.randomUUID().toString()); + s_currentContext.set(context); + + s_currentContextStack.get().push(context); + return context; + } + public static CallContext register(User callingUser, Account callingAccount) { return register(callingUser, callingAccount, UUID.randomUUID().toString()); } @@ -228,7 +240,7 @@ public class CallContext { String sessionIdOnStack = null; String sessionIdPushedToNDC = "ctx-" + UuidUtils.first(contextId); while ((sessionIdOnStack = NDC.pop()) != null) { - if (sessionIdPushedToNDC.equals(sessionIdOnStack)) { + if (sessionIdOnStack.isEmpty() || sessionIdPushedToNDC.equals(sessionIdOnStack)) { break; } if (s_logger.isTraceEnabled()) { @@ -241,6 +253,8 @@ public class CallContext { if (!stack.isEmpty()) { s_currentContext.set(stack.peek()); + } else { + s_currentContext.set(null); } return context; @@ -290,6 +304,18 @@ public class CallContext { this.eventDescription = eventDescription; } + /** + * Whether to display the event to the end user. + * @return true - if the event is to be displayed to the end user, false otherwise. + */ + public boolean isEventDisplayEnabled() { + return isEventDisplayEnabled; + } + + public void setEventDisplayEnabled(boolean eventDisplayEnabled) { + isEventDisplayEnabled = eventDisplayEnabled; + } + public static void setActionEventInfo(String eventType, String description) { CallContext context = CallContext.current(); if (context != null) { diff --git a/api/src/org/apache/cloudstack/context/CallContextListener.java b/api/src/org/apache/cloudstack/context/CallContextListener.java index 49866e07733..ab9a8c30046 100644 --- a/api/src/org/apache/cloudstack/context/CallContextListener.java +++ b/api/src/org/apache/cloudstack/context/CallContextListener.java @@ -32,10 +32,9 @@ public class CallContextListener implements ManagedContextListener { @Override public Object onEnterContext(boolean reentry) { - if (!reentry) { + if (!reentry && CallContext.current() == null) { CallContext.registerSystemCallContextOnceOnly(); } - return null; } diff --git a/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerService.java b/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerService.java index 02bc2fd2707..a05e9f4bf15 100644 --- a/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerService.java +++ b/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerService.java @@ -30,7 +30,7 @@ import com.cloud.utils.Pair; public interface ApplicationLoadBalancerService { ApplicationLoadBalancerRule createApplicationLoadBalancer(String name, String description, Scheme scheme, long sourceIpNetworkId, String sourceIp, int sourcePort, - int instancePort, String algorithm, long networkId, long lbOwnerId) throws InsufficientAddressCapacityException, NetworkRuleConflictException, + int instancePort, String algorithm, long networkId, long lbOwnerId, Boolean forDisplay) throws InsufficientAddressCapacityException, NetworkRuleConflictException, InsufficientVirtualNetworkCapcityException; boolean deleteApplicationLoadBalancer(long id); @@ -39,6 +39,6 @@ public interface ApplicationLoadBalancerService { ApplicationLoadBalancerRule getApplicationLoadBalancer(long ruleId); - ApplicationLoadBalancerRule deleteApplicationLoadBalancer(Long id, String customId); + ApplicationLoadBalancerRule updateApplicationLoadBalancer(Long id, String customId, Boolean forDisplay); } diff --git a/awsapi/pom.xml b/awsapi/pom.xml index 4a6c89c9e5f..601e6959a5a 100644 --- a/awsapi/pom.xml +++ b/awsapi/pom.xml @@ -272,11 +272,6 @@ bcprov-jdk16 runtime - - mysql - mysql-connector-java - runtime - org.antlr antlr-runtime diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties index f1c166bda11..82ac499a85e 100644 --- a/client/WEB-INF/classes/resources/messages.properties +++ b/client/WEB-INF/classes/resources/messages.properties @@ -16,9 +16,7 @@ # under the License. label.port=Port label.remove.ldap=Remove LDAP -message.remove.ldap=Are you sure you want to delete the LDAP configuration? label.configure.ldap=Configure LDAP -message.configure.ldap=Please confirm you would like to configure LDAP. label.ldap.configuration=LDAP Configuration label.ldap.port=LDAP port label.create.nfs.secondary.staging.store=Create NFS secondary staging store @@ -603,6 +601,7 @@ label.full=Full label.gateway=Gateway label.general.alerts=General Alerts label.generating.url=Generating URL +label.gluster.volume=Volume label.go.step.2=Go to Step 2 label.go.step.3=Go to Step 3 label.go.step.4=Go to Step 4 @@ -946,6 +945,7 @@ label.project.view=Project View label.project=Project label.projects=Projects label.protocol=Protocol +label.provider=Provider label.providers=Providers label.public.interface=Public Interface label.public.ip=Public IP Address @@ -1269,11 +1269,56 @@ label.zoneWizard.trafficType.management=Management\: Traffic between CloudStack\ label.zoneWizard.trafficType.public=Public\: Traffic between the internet and virtual machines in the cloud. label.zoneWizard.trafficType.storage=Storage\: Traffic between primary and secondary storage servers, such as VM templates and snapshots label.ldap.group.name=LDAP Group +label.password.reset.confirm=Password has been reset to +label.provider=Provider +label.resetVM=Reset VM label.openDaylight=OpenDaylight +label.assign.instance.another=Assign Instance to Another Account +label.network.addVM=Add network to VM +label.set.default.NIC=Set default NIC +label.Xenserver.Tools.Version61plus=XenServer Tools Version 6.1\+ +label.dynamically.scalable=Dynamically Scalable +label.instance.scaled.up=Instance Scaled Up +label.tag.key=Tag Key +label.tag.value=Tag Value +label.ipv6.address=IPv6 IP Address +label.ipv6.gateway=IPv6 Gateway +label.ipv6.CIDR=IPv6 CIDR +label.VPC.limits=VPC limits +label.edit.region=Edit Region +label.gslb.domain.name=GSLB Domain Name +label.add.gslb=Add GSLB +label.gslb.servicetype=Service Type +label.gslb.details=GSLB details +label.gslb.delete=delete GSLB label.opendaylight.controllers=OpenDaylight Controllers +label.portable.ip.ranges=Portable IP Ranges +label.add.portable.ip.range=Add Portable IP Range +label.delete.portable.ip.range=Delete Portable IP Range label.opendaylight.controllerdetail=OpenDaylight Controller Details +label.portable.ip.range.details=Portable IP Range details +label.portable.ips=Portable IPs +label.gslb.assigned.lb=assigned load balancing +label.gslb.assigned.lb.more=assign more load balancing +label.gslb.lb.rule=load balancing rule +label.gslb.lb.details=load balancing details +label.gslb.lb.remove=remove load balancing from this GSLB +label.enable.autoscale=Enable Autoscale +label.disable.autoscale=Disable Autoscale +label.min.instances=Min Instances +label.max.instances=Max Instances label.add.OpenDaylight.device=Add OpenDaylight Controller +label.show.advanced.settings=Show advanced settings label.delete.OpenDaylight.device=Delete OpenDaylight Controller +label.polling.interval.sec=Polling Interval (in sec) +label.quiet.time.sec=Quiet Time (in sec) +label.destroy.vm.graceperiod=Destroy VM Grace Period +label.SNMP.community=SNMP Community +label.SNMP.port=SNMP Port +label.add.ucs.manager=Add UCS Manager +label.ovm.traffic.label=OVM traffic label +label.lxc.traffic.label=LXC Traffic Label +label.hyperv.traffic.label=HyperV Traffic Label managed.state=Managed State message.acquire.new.ip.vpc=Please confirm that you would like to acquire a new IP for this VPC. message.acquire.new.ip=Please confirm that you would like to acquire a new IP for this network. @@ -1587,6 +1632,43 @@ message.zone.step.1.desc=Please select a network model for your zone. message.zone.step.2.desc=Please enter the following info to add a new zone message.zone.step.3.desc=Please enter the following info to add a new pod message.zoneWizard.enable.local.storage=WARNING\: If you enable local storage for this zone, you must do the following, depending on where you would like your system VMs to launch\:

1. If system VMs need to be launched in primary storage, primary storage needs to be added to the zone after creation. You must also start the zone in a disabled state.

2. If system VMs need to be launched in local storage, system.vm.use.local.storage needs to be set to true before you enable the zone.


Would you like to continue? +message.validate.fieldrequired=This field is required. +message.validate.fixfield=Please fix this field. +message.validate.email.address=Please enter a valid email address. +message.validate.URL=Please enter a valid URL. +message.validate.date=Please enter a valid date. +message.validate.date.ISO=Please enter a valid date (ISO). +message.validate.number=Please enter a valid number. +message.validate.digits=Please enter only digits. +message.validate.creditcard=Please enter a valid credit card number. +message.validate.equalto=Please enter the same value again. +message.validate.accept=Please enter a value with a valid extension. +message.validate.maxlength=Please enter no more than {0} characters. +message.validate.minlength=Please enter at least {0} characters. +message.validate.range.length=Please enter a value between {0} and {1} characters long. +message.validate.range=Please enter a value between {0} and {1}. +message.validate.max=Please enter a value less than or equal to {0}. +messgae.validate.min=Please enter a value greater than or equal to {0}. +message.creating.systemVM=Creating system VMs (this may take a while) +message.enabling.zone.dots=Enabling zone... +message.restoreVM=Do you want to restore the VM ? +message.no.host.available=No Hosts are available for Migration +message.network.addVM.desc=Please specify the network that you would like to add this VM to. A new NIC will be added for this network. +message.network.addVMNIC=Please confirm that you would like to add a new VM NIC for this network. +message.set.default.NIC=Please confirm that you would like to make this NIC the default for this VM. +message.set.default.NIC.manual=Please manually update the default NIC on the VM now. +message.instance.scaled.up.confirm=Do you really want to scale Up your instance ? +message.copy.template.confirm=Are you sure you want to copy template? +message.template.copying=Template is being copied. +message.XSTools61plus.update.failed=Failed to update XenServer Tools Version 6.1\+ field. Error\: +message.gslb.delete.confirm=Please confirm you want to delete this GSLB +message.portable.ip.delete.confirm=Please confirm you want to delete Portable IP Range +message.gslb.lb.remove.confirm=Please confirm you want to remove load balancing from GSLB +message.admin.guide.read=For VMware-based VMs, please read the dynamic scaling section in the admin guide before scaling. Would you like to continue?\, +message.tier.required=Tier is required +message.remove.ldap=Are you sure you want to delete the LDAP configuration? +message.action.downloading.template=Downloading template. +message.configure.ldap=Please confirm you would like to configure LDAP. mode=Mode network.rate=Network Rate notification.reboot.instance=Reboot instance diff --git a/client/WEB-INF/classes/resources/messages_es.properties b/client/WEB-INF/classes/resources/messages_es.properties index 31a9c93646c..6d6e4860cf4 100644 --- a/client/WEB-INF/classes/resources/messages_es.properties +++ b/client/WEB-INF/classes/resources/messages_es.properties @@ -22,7 +22,6 @@ error.session.expired=Su sesi\u00c3\u00b3n ha caducado. error.unresolved.internet.name=El nombre de Internet no se puede resolver. extractable=extra\u00c3\u00adble force.delete.domain.warning=Advertencia\: Si elige esta opci\u00c3\u00b3n, la supresi\u00c3\u00b3n de todos los dominios secundarios y todas las cuentas asociadas y sus recursos. -<<<<<<< HEAD force.delete=Fuerza Borrar force.remove=Fuerza Retire force.remove.host.warning=Advertencia\: Si elige esta opci\u00c3\u00b3n, CloudStack para detener la fuerza todas las m\u00c3\u00a1quinas virtuales en ejecuci\u00c3\u00b3n antes de retirar este host del cl\u00c3\u00baster. @@ -32,7 +31,6 @@ ICMP.code=ICMP C\u00c3\u00b3digo ICMP.type=Tipo ICMP image.directory=Directorio de la imagen inline=en l\u00c3\u00adnea -======= force.delete=Forzar el borrado force.remove=Forzar el retiro force.remove.host.warning=Advertencia\: Si elige esta opci\u00f3n, CloudStack para detener la fuerza todas las m\u00e1quinas virtuales en ejecuci\u00f3n antes de retirar este host del cl\u00faster. @@ -44,7 +42,6 @@ image.directory=Directorio de im\u00e1genes inline=alineado label.about=Acerca de label.about.app=Acerca de CloudStack ->>>>>>> 4e449ff... Add Dutch (Netherlands, Polish languages in Web UI Change Japanese code (ja -> ja_JP) Update transifex sync config label.account=Cuenta label.account.id=ID de la cuenta label.account.name=Nombre de cuenta diff --git a/client/WEB-INF/classes/resources/messages_ja_JP.properties b/client/WEB-INF/classes/resources/messages_ja_JP.properties index 42324491418..828cf545c20 100644 --- a/client/WEB-INF/classes/resources/messages_ja_JP.properties +++ b/client/WEB-INF/classes/resources/messages_ja_JP.properties @@ -14,9 +14,22 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +label.port=\u30dd\u30fc\u30c8 +label.remove.ldap=LDAP \u306e\u524a\u9664 +label.configure.ldap=LDAP \u306e\u69cb\u6210 +label.ldap.configuration=LDAP \u69cb\u6210 +label.ldap.port=LDAP \u30dd\u30fc\u30c8 +label.create.nfs.secondary.staging.store=NFS \u30bb\u30ab\u30f3\u30c0\u30ea \u30b9\u30c6\u30fc\u30b8\u30f3\u30b0 \u30b9\u30c8\u30a2\u3092\u4f5c\u6210\u3059\u308b +label.volatile=\u63ee\u767a\u6027 +label.planner.mode=\u30d7\u30e9\u30f3\u30ca\u30fc \u30e2\u30fc\u30c9 +label.deployment.planner=\u5c55\u958b\u30d7\u30e9\u30f3\u30ca\u30fc +label.quiesce.vm=VM \u3092\u4f11\u6b62\u3059\u308b +label.smb.username=SMB \u30e6\u30fc\u30b6\u30fc\u540d +label.smb.password=SMB \u30d1\u30b9\u30ef\u30fc\u30c9 +label.smb.domain=SMB \u30c9\u30e1\u30a4\u30f3 label.hypervisors=\u30cf\u30a4\u30d1\u30fc\u30d0\u30a4\u30b6\u30fc label.home=\u30db\u30fc\u30e0 -label.sockets=\u30bd\u30b1\u30c3\u30c8 +label.sockets=CPU Sockets label.root.disk.size=\u30eb\u30fc\u30c8 \u30c7\u30a3\u30b9\u30af \u30b5\u30a4\u30ba label.s3.nfs.server=S3 NFS \u30b5\u30fc\u30d0\u30fc label.s3.nfs.path=S3 NFS \u30d1\u30b9 @@ -50,7 +63,7 @@ message.action.delete.nic=\u3053\u306e NIC \u3092\u524a\u9664\u3057\u3066\u3082\ changed.item.properties=\u9805\u76ee\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u5909\u66f4 confirm.enable.s3=S3 \u30d9\u30fc\u30b9\u306e\u30bb\u30ab\u30f3\u30c0\u30ea \u30b9\u30c8\u30ec\u30fc\u30b8\u306e\u30b5\u30dd\u30fc\u30c8\u3092\u6709\u52b9\u306b\u3059\u308b\u306b\u306f\u3001\u6b21\u306e\u60c5\u5831\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002 confirm.enable.swift=Swift \u306e\u30b5\u30dd\u30fc\u30c8\u3092\u6709\u52b9\u306b\u3059\u308b\u306b\u306f\u3001\u6b21\u306e\u60c5\u5831\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -error.could.not.change.your.password.because.ldap.is.enabled=LDAP \u304c\u6709\u52b9\u306a\u305f\u3081\u3001\u30a8\u30e9\u30fc\u306b\u3088\u3063\u3066\u30d1\u30b9\u30ef\u30fc\u30c9\u306f\u5909\u66f4\u3055\u308c\u307e\u305b\u3093\u3067\u3057\u305f\u3002 +error.could.not.change.your.password.because.ldap.is.enabled=Error could not change your password because LDAP is enabled. error.could.not.enable.zone=\u30be\u30fc\u30f3\u3092\u6709\u52b9\u306b\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f error.installWizard.message=\u554f\u984c\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002\u623b\u3063\u3066\u30a8\u30e9\u30fc\u3092\u4fee\u6b63\u3067\u304d\u307e\u3059\u3002 error.invalid.username.password=\u7121\u52b9\u306a\u30e6\u30fc\u30b6\u30fc\u540d\u307e\u305f\u306f\u30d1\u30b9\u30ef\u30fc\u30c9\u3067\u3059\u3002 @@ -376,7 +389,7 @@ label.associated.network=\u95a2\u9023\u3065\u3051\u3089\u308c\u305f\u30cd\u30c3\ label.attached.iso=\u30a2\u30bf\u30c3\u30c1\u3055\u308c\u305f ISO label.author.email=\u4f5c\u6210\u8005\u306e\u96fb\u5b50\u30e1\u30fc\u30eb label.author.name=\u4f5c\u6210\u8005\u306e\u540d\u524d -label.availability.zone=\u5229\u7528\u53ef\u80fd\u30be\u30fc\u30f3 +label.availability.zone=\u30a2\u30d9\u30a4\u30e9\u30d3\u30ea\u30c6\u30a3 \u30be\u30fc\u30f3 label.availability=\u53ef\u7528\u6027 label.available.public.ips=\u4f7f\u7528\u3067\u304d\u308b\u30d1\u30d6\u30ea\u30c3\u30af IP \u30a2\u30c9\u30ec\u30b9 label.available=\u4f7f\u7528\u53ef\u80fd @@ -451,7 +464,7 @@ label.continue=\u7d9a\u884c label.corrections.saved=\u63a5\u7d9a\u304c\u4fdd\u5b58\u3055\u308c\u307e\u3057\u305f label.cpu.allocated.for.VMs=VM \u306b\u5272\u308a\u5f53\u3066\u6e08\u307f\u306e CPU label.cpu.allocated=\u5272\u308a\u5f53\u3066\u6e08\u307f\u306e CPU -label.CPU.cap=CPU \u4e0a\u9650 +label.CPU.cap=CPU \u30ad\u30e3\u30c3\u30d7 label.cpu.limits=CPU \u5236\u9650 label.cpu.mhz=CPU (MHz) label.cpu.utilized=CPU \u4f7f\u7528\u7387 @@ -691,6 +704,7 @@ label.lang.arabic=\u30a2\u30e9\u30d3\u30a2\u8a9e label.lang.brportugese=\u30dd\u30eb\u30c8\u30ac\u30eb\u8a9e (\u30d6\u30e9\u30b8\u30eb) label.lang.catalan=\u30ab\u30bf\u30eb\u30cb\u30a2\u8a9e label.lang.chinese=\u7c21\u4f53\u5b57\u4e2d\u56fd\u8a9e +label.lang.dutch=Dutch (Netherlands) label.lang.english=\u82f1\u8a9e label.lang.french=\u30d5\u30e9\u30f3\u30b9\u8a9e label.lang.german=\u30c9\u30a4\u30c4\u8a9e @@ -698,6 +712,7 @@ label.lang.italian=\u30a4\u30bf\u30ea\u30a2\u8a9e label.lang.japanese=\u65e5\u672c\u8a9e label.lang.korean=\u97d3\u56fd\u8a9e label.lang.norwegian=\u30ce\u30eb\u30a6\u30a7\u30fc\u8a9e +label.lang.polish=Polish label.lang.russian=\u30ed\u30b7\u30a2\u8a9e label.lang.spanish=\u30b9\u30da\u30a4\u30f3\u8a9e label.last.disconnected=\u6700\u7d42\u5207\u65ad\u65e5\u6642 @@ -997,7 +1012,7 @@ label.s3.endpoint=\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8 label.s3.max_error_retry=\u6700\u5927\u30a8\u30e9\u30fc\u518d\u8a66\u884c\u6570 label.s3.secret_key=\u79d8\u5bc6\u30ad\u30fc label.s3.socket_timeout=\u30bd\u30b1\u30c3\u30c8 \u30bf\u30a4\u30e0\u30a2\u30a6\u30c8 -label.s3.use_https=HTTPS \u3092\u4f7f\u7528 +label.s3.use_https=HTTPS \u3092\u4f7f\u7528\u3059\u308b label.saturday=\u571f\u66dc\u65e5 label.save.and.continue=\u4fdd\u5b58\u3057\u3066\u7d9a\u884c label.save=\u4fdd\u5b58 @@ -1052,7 +1067,7 @@ label.source=\u9001\u4fe1\u5143 label.specify.IP.ranges=IP \u30a2\u30c9\u30ec\u30b9\u306e\u7bc4\u56f2\u306e\u6307\u5b9a label.specify.vlan=VLAN \u3092\u6307\u5b9a\u3059\u308b label.specify.vxlan=VXLAN \u3092\u6307\u5b9a\u3059\u308b -label.SR.name = SR \u540d\u30e9\u30d9\u30eb +label.SR.name = SR Name-Label label.srx=SRX label.PA=Palo Alto label.start.IP=\u958b\u59cb IP \u30a2\u30c9\u30ec\u30b9 @@ -1096,7 +1111,7 @@ label.storage.tags=\u30b9\u30c8\u30ec\u30fc\u30b8 \u30bf\u30b0 label.storage.traffic=\u30b9\u30c8\u30ec\u30fc\u30b8 \u30c8\u30e9\u30d5\u30a3\u30c3\u30af label.storage.type=\u30b9\u30c8\u30ec\u30fc\u30b8\u306e\u7a2e\u985e label.qos.type=QoS \u306e\u7a2e\u985e -label.cache.mode=\u66f8\u304d\u8fbc\u307f\u30ad\u30e3\u30c3\u30b7\u30e5\u306e\u7a2e\u985e +label.cache.mode=Write-cache Type label.storage=\u30b9\u30c8\u30ec\u30fc\u30b8 label.subdomain.access=\u30b5\u30d6\u30c9\u30e1\u30a4\u30f3 \u30a2\u30af\u30bb\u30b9 label.submit=\u9001\u4fe1 @@ -1129,7 +1144,7 @@ label.tier.details=\u968e\u5c64\u306e\u8a73\u7d30 label.tier=\u968e\u5c64 label.time.zone=\u30bf\u30a4\u30e0\u30be\u30fc\u30f3 label.time=\u6642\u523b -label.timeout.in.second = \u30bf\u30a4\u30e0\u30a2\u30a6\u30c8 (\u79d2) +label.timeout.in.second = Timeout(seconds) label.timeout=\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8 label.timezone=\u30bf\u30a4\u30e0\u30be\u30fc\u30f3 label.token=\u30c8\u30fc\u30af\u30f3 @@ -1151,8 +1166,8 @@ label.unavailable=\u4f7f\u7528\u4e0d\u80fd label.unlimited=\u7121\u5236\u9650 label.untagged=\u30bf\u30b0\u306a\u3057 label.update.project.resources=\u30d7\u30ed\u30b8\u30a7\u30af\u30c8 \u30ea\u30bd\u30fc\u30b9\u306e\u66f4\u65b0 -label.update.ssl.cert= SSL \u8a3c\u660e\u66f8 -label.update.ssl= SSL \u8a3c\u660e\u66f8 +label.update.ssl.cert= SSL Certificate +label.update.ssl= SSL Certificate label.updating=\u66f4\u65b0\u3057\u3066\u3044\u307e\u3059 label.upload.volume=\u30dc\u30ea\u30e5\u30fc\u30e0\u306e\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9 label.upload=\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9 @@ -1252,6 +1267,56 @@ label.zoneWizard.trafficType.management=\u7ba1\u7406\: \u30db\u30b9\u30c8\u3084 label.zoneWizard.trafficType.public=\u30d1\u30d6\u30ea\u30c3\u30af\: \u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u3068\u30af\u30e9\u30a6\u30c9\u5185\u306e\u4eee\u60f3\u30de\u30b7\u30f3\u306e\u9593\u306e\u30c8\u30e9\u30d5\u30a3\u30c3\u30af\u3067\u3059\u3002 label.zoneWizard.trafficType.storage=\u30b9\u30c8\u30ec\u30fc\u30b8\: VM \u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3084\u30b9\u30ca\u30c3\u30d7\u30b7\u30e7\u30c3\u30c8\u306a\u3069\u3001\u30d7\u30e9\u30a4\u30de\u30ea\u304a\u3088\u3073\u30bb\u30ab\u30f3\u30c0\u30ea \u30b9\u30c8\u30ec\u30fc\u30b8 \u30b5\u30fc\u30d0\u30fc\u9593\u306e\u30c8\u30e9\u30d5\u30a3\u30c3\u30af\u3067\u3059\u3002 label.ldap.group.name=LDAP \u30b0\u30eb\u30fc\u30d7 +label.password.reset.confirm=\u6b21\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u306b\u30ea\u30bb\u30c3\u30c8\u3055\u308c\u307e\u3057\u305f: +label.provider=\u30d7\u30ed\u30d0\u30a4\u30c0\u30fc +label.resetVM=VM \u306e\u30ea\u30bb\u30c3\u30c8 +label.openDaylight=OpenDaylight +label.assign.instance.another=\u307b\u304b\u306e\u30a2\u30ab\u30a6\u30f3\u30c8\u3078\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u5272\u308a\u5f53\u3066 +label.network.addVM=VM \u3078\u306e\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u8ffd\u52a0 +label.set.default.NIC=\u30c7\u30d5\u30a9\u30eb\u30c8 NIC \u306e\u8a2d\u5b9a +label.Xenserver.Tools.Version61plus=XenServer Tools Version 6.1 \u4ee5\u964d +label.dynamically.scalable=\u52d5\u7684\u306b\u30b5\u30a4\u30ba\u8a2d\u5b9a\u3059\u308b +label.instance.scaled.up=\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u30b5\u30a4\u30ba\u304c\u62e1\u5927\u3055\u308c\u307e\u3057\u305f +label.tag.key=\u30bf\u30b0 \u30ad\u30fc +label.tag.value=\u30bf\u30b0\u5024 +label.ipv6.address=IPv6 IP \u30a2\u30c9\u30ec\u30b9 +label.ipv6.gateway=IPv6 \u30b2\u30fc\u30c8\u30a6\u30a7\u30a4 +label.ipv6.CIDR=IPv6 CIDR +label.VPC.limits=VPC \u5236\u9650 +label.edit.region=\u9818\u57df\u306e\u7de8\u96c6 +label.gslb.domain.name=GSLB \u30c9\u30e1\u30a4\u30f3\u540d +label.add.gslb=GSLB \u306e\u8ffd\u52a0 +label.gslb.servicetype=\u30b5\u30fc\u30d3\u30b9\u306e\u7a2e\u985e +label.gslb.details=GSLB \u306e\u8a73\u7d30 +label.gslb.delete=GSLB \u306e\u524a\u9664 +label.opendaylight.controllers=OpenDaylight Controllers +label.portable.ip.ranges=\u30dd\u30fc\u30bf\u30d6\u30eb IP \u30a2\u30c9\u30ec\u30b9\u306e\u7bc4\u56f2 +label.add.portable.ip.range=\u30dd\u30fc\u30bf\u30d6\u30eb IP \u30a2\u30c9\u30ec\u30b9\u306e\u7bc4\u56f2\u306e\u8ffd\u52a0 +label.delete.portable.ip.range=\u30dd\u30fc\u30bf\u30d6\u30eb IP \u30a2\u30c9\u30ec\u30b9\u306e\u7bc4\u56f2\u306e\u524a\u9664 +label.opendaylight.controllerdetail=OpenDaylight Controller Details +label.portable.ip.range.details=\u30dd\u30fc\u30bf\u30d6\u30eb IP \u30a2\u30c9\u30ec\u30b9\u306e\u7bc4\u56f2\u306e\u8a73\u7d30 +label.portable.ips=\u30dd\u30fc\u30bf\u30d6\u30eb IP \u30a2\u30c9\u30ec\u30b9 +label.gslb.assigned.lb=\u5272\u308a\u5f53\u3066\u6e08\u307f\u8ca0\u8377\u5206\u6563 +label.gslb.assigned.lb.more=\u8ca0\u8377\u5206\u6563\u306e\u8ffd\u52a0\u5272\u308a\u5f53\u3066 +label.gslb.lb.rule=\u8ca0\u8377\u5206\u6563\u898f\u5247 +label.gslb.lb.details=\u8ca0\u8377\u5206\u6563\u306e\u8a73\u7d30 +label.gslb.lb.remove=\u3053\u306e GSLB \u304b\u3089\u8ca0\u8377\u5206\u6563\u3092\u524a\u9664 +label.enable.autoscale=\u81ea\u52d5\u30b5\u30a4\u30ba\u8a2d\u5b9a\u306e\u6709\u52b9\u5316 +label.disable.autoscale=\u81ea\u52d5\u30b5\u30a4\u30ba\u8a2d\u5b9a\u306e\u7121\u52b9\u5316 +label.min.instances=\u6700\u5c0f\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u6570 +label.max.instances=\u6700\u5927\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u6570 +label.add.OpenDaylight.device=Add OpenDaylight Controller +label.show.advanced.settings=\u8a73\u7d30\u8a2d\u5b9a\u306e\u8868\u793a +label.delete.OpenDaylight.device=Delete OpenDaylight Controller +label.polling.interval.sec=\u30dd\u30fc\u30ea\u30f3\u30b0\u9593\u9694 (\u79d2) +label.quiet.time.sec=\u5f85\u3061\u6642\u9593 (\u79d2) +label.destroy.vm.graceperiod=VM \u7834\u68c4\u306e\u7336\u4e88\u671f\u9593 +label.SNMP.community=SNMP \u30b3\u30df\u30e5\u30cb\u30c6\u30a3 +label.SNMP.port=SNMP \u30dd\u30fc\u30c8 +label.add.ucs.manager=UCS Manager \u306e\u8ffd\u52a0 +label.ovm.traffic.label=OVM \u306e\u30c8\u30e9\u30d5\u30a3\u30c3\u30af \u30e9\u30d9\u30eb +label.lxc.traffic.label=LXC \u306e\u30c8\u30e9\u30d5\u30a3\u30c3\u30af \u30e9\u30d9\u30eb +label.hyperv.traffic.label=Hyper-V \u306e\u30c8\u30e9\u30d5\u30a3\u30c3\u30af \u30e9\u30d9\u30eb managed.state=\u7ba1\u7406\u5bfe\u8c61\u72b6\u614b message.acquire.new.ip.vpc=\u3053\u306e VPC \u306e\u65b0\u3057\u3044 IP \u30a2\u30c9\u30ec\u30b9\u3092\u53d6\u5f97\u3057\u3066\u3082\u3088\u308d\u3057\u3044\u3067\u3059\u304b? message.acquire.new.ip=\u3053\u306e\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u65b0\u3057\u3044 IP \u30a2\u30c9\u30ec\u30b9\u3092\u53d6\u5f97\u3057\u3066\u3082\u3088\u308d\u3057\u3044\u3067\u3059\u304b? @@ -1565,6 +1630,43 @@ message.zone.step.1.desc=\u30be\u30fc\u30f3\u306e\u30cd\u30c3\u30c8\u30ef\u30fc\ message.zone.step.2.desc=\u65b0\u3057\u3044\u30be\u30fc\u30f3\u3092\u8ffd\u52a0\u3059\u308b\u305f\u3081\u306b\u3001\u6b21\u306e\u60c5\u5831\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002 message.zone.step.3.desc=\u65b0\u3057\u3044\u30dd\u30c3\u30c9\u3092\u8ffd\u52a0\u3059\u308b\u305f\u3081\u306b\u3001\u6b21\u306e\u60c5\u5831\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002 message.zoneWizard.enable.local.storage=\u8b66\u544a\: \u3053\u306e\u30be\u30fc\u30f3\u306e\u30ed\u30fc\u30ab\u30eb \u30b9\u30c8\u30ec\u30fc\u30b8\u3092\u6709\u52b9\u306b\u3059\u308b\u5834\u5408\u306f\u3001\u30b7\u30b9\u30c6\u30e0 VM \u306e\u8d77\u52d5\u5834\u6240\u306b\u5fdc\u3058\u3066\u6b21\u306e\u64cd\u4f5c\u304c\u5fc5\u8981\u3067\u3059\u3002

1. \u30b7\u30b9\u30c6\u30e0 VM \u3092\u30d7\u30e9\u30a4\u30de\u30ea \u30b9\u30c8\u30ec\u30fc\u30b8\u3067\u8d77\u52d5\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u5834\u5408\u306f\u3001\u30d7\u30e9\u30a4\u30de\u30ea \u30b9\u30c8\u30ec\u30fc\u30b8\u3092\u4f5c\u6210\u3057\u305f\u5f8c\u3067\u30be\u30fc\u30f3\u306b\u8ffd\u52a0\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u30be\u30fc\u30f3\u3092\u7121\u52b9\u72b6\u614b\u304b\u3089\u958b\u59cb\u3059\u308b\u5fc5\u8981\u3082\u3042\u308a\u307e\u3059\u3002

2. \u30b7\u30b9\u30c6\u30e0 VM \u3092\u30ed\u30fc\u30ab\u30eb \u30b9\u30c8\u30ec\u30fc\u30b8\u3067\u8d77\u52d5\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u5834\u5408\u306f\u3001\u30be\u30fc\u30f3\u3092\u6709\u52b9\u306b\u3059\u308b\u524d\u306b system.vm.use.local.storage \u3092 true \u306b\u8a2d\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002


\u7d9a\u884c\u3057\u3066\u3082\u3088\u308d\u3057\u3044\u3067\u3059\u304b? +message.validate.fieldrequired=\u3053\u308c\u306f\u5fc5\u9808\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u3067\u3059\u3002 +message.validate.fixfield=\u3053\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u4fee\u6b63\u3057\u3066\u304f\u3060\u3055\u3044\u3002 +message.validate.email.address=Please enter a valid email address. +message.validate.URL=Please enter a valid URL. +message.validate.date=Please enter a valid date. +message.validate.date.ISO=Please enter a valid date (ISO). +message.validate.number=Please enter a valid number. +message.validate.digits=Please enter only digits. +message.validate.creditcard=Please enter a valid credit card number. +message.validate.equalto=Please enter the same value again. +message.validate.accept=Please enter a value with a valid extension. +message.validate.maxlength=Please enter no more than {0} characters. +message.validate.minlength=Please enter at least {0} characters. +message.validate.range.length=Please enter a value between {0} and {1} characters long. +message.validate.range=Please enter a value between {0} and {1}. +message.validate.max=Please enter a value less than or equal to {0}. +messgae.validate.min=Please enter a value greater than or equal to {0}. +message.creating.systemVM=\u30b7\u30b9\u30c6\u30e0 VM \u3092\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059 (\u3057\u3070\u3089\u304f\u304a\u5f85\u3061\u304f\u3060\u3055\u3044) +message.enabling.zone.dots=\u30be\u30fc\u30f3\u3092\u6709\u52b9\u306b\u3057\u3066\u3044\u307e\u3059... +message.restoreVM=VM \u3092\u5fa9\u5143\u3057\u3066\u3082\u3088\u308d\u3057\u3044\u3067\u3059\u304b? +message.no.host.available=\u79fb\u884c\u306b\u4f7f\u7528\u3067\u304d\u308b\u30db\u30b9\u30c8\u306f\u3042\u308a\u307e\u305b\u3093 +message.network.addVM.desc=\u3053\u306e VM \u3092\u8ffd\u52a0\u3059\u308b\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u306e\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u305f\u3081\u306e\u65b0\u3057\u3044 NIC \u304c\u8ffd\u52a0\u3055\u308c\u307e\u3059\u3002 +message.network.addVMNIC=\u3053\u306e\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u65b0\u3057\u3044 VM NIC \u3092\u8ffd\u52a0\u3057\u3066\u3082\u3088\u308d\u3057\u3044\u3067\u3059\u304b? +message.set.default.NIC=\u3053\u306e NIC \u3092\u3053\u306e VM \u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u306b\u8a2d\u5b9a\u3057\u3066\u3082\u3088\u308d\u3057\u3044\u3067\u3059\u304b? +message.set.default.NIC.manual=\u4eca\u3059\u3050\u306b\u3053\u306e VM \u306e\u30c7\u30d5\u30a9\u30eb\u30c8 NIC \u3092\u624b\u52d5\u3067\u66f4\u65b0\u3057\u3066\u304f\u3060\u3055\u3044\u3002 +message.instance.scaled.up.confirm=\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u30b5\u30a4\u30ba\u3092\u62e1\u5927\u3057\u3066\u3082\u3088\u308d\u3057\u3044\u3067\u3059\u304b? +message.copy.template.confirm=\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u30b3\u30d4\u30fc\u3057\u3066\u3082\u3088\u308d\u3057\u3044\u3067\u3059\u304b? +message.template.copying=\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u30b3\u30d4\u30fc\u3057\u3066\u3044\u307e\u3059\u3002 +message.XSTools61plus.update.failed=XenServer Tools Version 6.1 \u4ee5\u964d\u3078\u306e\u66f4\u65b0\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002\u30a8\u30e9\u30fc\: +message.gslb.delete.confirm=\u3053\u306e GSLB \u3092\u524a\u9664\u3057\u3066\u3082\u3088\u308d\u3057\u3044\u3067\u3059\u304b? +message.portable.ip.delete.confirm=\u3053\u306e\u30dd\u30fc\u30bf\u30d6\u30eb IP \u30a2\u30c9\u30ec\u30b9\u306e\u7bc4\u56f2\u3092\u524a\u9664\u3057\u3066\u3082\u3088\u308d\u3057\u3044\u3067\u3059\u304b? +message.gslb.lb.remove.confirm=GSLB \u304b\u3089\u8ca0\u8377\u5206\u6563\u3092\u524a\u9664\u3057\u3066\u3082\u3088\u308d\u3057\u3044\u3067\u3059\u304b? +message.admin.guide.read=VMware \u30d9\u30fc\u30b9\u306e VM \u306b\u3064\u3044\u3066\u306f\u3001\u30b5\u30a4\u30ba\u5909\u66f4\u306e\u524d\u306b\u7ba1\u7406\u8005\u30ac\u30a4\u30c9\u306e\u52d5\u7684\u306a\u30b5\u30a4\u30ba\u5909\u66f4\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3092\u304a\u8aad\u307f\u304f\u3060\u3055\u3044\u3002\u7d9a\u884c\u3057\u3066\u3082\u3088\u308d\u3057\u3044\u3067\u3059\u304b?\, +message.tier.required=\u968e\u5c64\u306f\u5fc5\u9808\u3067\u3059 +message.remove.ldap=LDAP \u69cb\u6210\u3092\u524a\u9664\u3057\u3066\u3082\u3088\u308d\u3057\u3044\u3067\u3059\u304b? +message.action.downloading.template=\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u3044\u307e\u3059\u3002 +message.configure.ldap=LDAP \u3092\u69cb\u6210\u3057\u3066\u3082\u3088\u308d\u3057\u3044\u3067\u3059\u304b? mode=\u30e2\u30fc\u30c9 network.rate=\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u901f\u5ea6 notification.reboot.instance=\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u518d\u8d77\u52d5 diff --git a/client/WEB-INF/classes/resources/messages_nl_NL.properties b/client/WEB-INF/classes/resources/messages_nl_NL.properties index b1bfadb42af..5d666a4fb49 100644 --- a/client/WEB-INF/classes/resources/messages_nl_NL.properties +++ b/client/WEB-INF/classes/resources/messages_nl_NL.properties @@ -25,18 +25,18 @@ error.login=Uw gebruikersnaam/wachtwoord komt niet overeen met onze gegevens error.menu.select=Kan actie niet uitvoeren omdat geen items zijn geselecteerd error.mgmt.server.inaccessible=The Management Server is niet toegankelijk. Probeer het later opnieuw. error.password.not.match=De wachtwoord velden komen niet overeen -error.please.specify.physical.network.tags=Netwerk aanbiedingen zijn niet beschikbaar totdat u labels voor het fysieke netwerk specificeert. +error.please.specify.physical.network.tags=Netwerk aanbiedingen zijn niet beschikbaar totdat u labels voor het fysieke netwerk specificeert. error.session.expired=Uw sessie is verlopen -error.something.went.wrong.please.correct.the.following=Er is iets mis gegaan; Corrigeer het volgende +error.something.went.wrong.please.correct.the.following=Er is iets mis gegaan; Corrigeer het volgende error.unable.to.reach.management.server=Niet in staat om de Management Server te bereiken error.unresolved.internet.name=Uw internet naam kan niet worden omgezet. extractable=Uitpakbaar force.delete.domain.warning=Waarschuwing\: Wanneer u deze optie selecteert zullen alle onderliggende domeinen, hun gekoppelde accounts en hun verbruik worden verwijderd. force.delete=Geforceerd verwijderen force.remove=Geforceerd loskoppelen -force.remove.host.warning=Waarschuwing\: Wanneer u deze optie selecteert zal CloudStack alle draaiende virtuele machines geforceerd stoppen voordat de host van het cluster wordt verwijderd. +force.remove.host.warning=Waarschuwing\: Wanneer u deze optie selecteert zal CloudStack alle draaiende virtuele machines geforceerd stoppen voordat de host van het cluster wordt verwijderd. force.stop=Geforceerd stoppen -force.stop.instance.warning=Waarschuwing\: Een instantie geforceerd stoppen zou uw laatste optie moeten zijn. Het kan leiden tot dataverlies en inconsistent gedrag van de staat van de virtuele machine. +force.stop.instance.warning=Waarschuwing\: Een instantie geforceerd stoppen zou uw laatste optie moeten zijn. Het kan leiden tot dataverlies en inconsistent gedrag van de staat van de virtuele machine. ICMP.code=ICMP Code ICMP.type=ICMP Type image.directory=Afbeelding Directory @@ -48,7 +48,7 @@ label.account.and.security.group=Account, Security group label.account.id=Account ID label.account.name=Account Naam label.accounts=Accounts -label.account.specific=Account-specifiek +label.account.specific=Account-specifiek label.acquire.new.ip=Bemachtig nieuw IP label.action.attach.disk.processing=Schijf wordt toegevoegd.... label.action.attach.disk=Schijf toevoegen @@ -65,12 +65,12 @@ label.action.copy.template=Kopieer Template label.action.copy.template.processing=Bezig met kopi\u00ebren Template.... label.action.create.template=Cre\u00eber Template label.action.create.template.from.vm=Cre\u00eber Template vanaf VM -label.action.create.template.from.volume=Cre\u00eber Template van Volume +label.action.create.template.from.volume=Cre\u00eber Template van Volume label.action.create.template.processing=Bezig met aanmaken Template.... -label.action.create.vm=Cre\u00eber VM +label.action.create.vm=Cre\u00eber VM label.action.create.vm.processing=Bezig met aanmaken VM.... label.action.create.volume=Cre\u00eber Volume -label.action.create.volume.processing=Bezig met cre\u00ebren volume.... +label.action.create.volume.processing=Bezig met cre\u00ebren volume.... label.action.delete.account.processing=Bezig met verwijderen account.... label.action.delete.account=Verwijder account label.action.delete.cluster.processing=Bezig met verwijderen van Cluster.... @@ -81,7 +81,7 @@ label.action.delete.domain.processing=Bezig met verwijderen van Domein.... label.action.delete.domain=Verwijder Domein label.action.delete.firewall.processing=Bezig met verwijderen van Firewall.... label.action.delete.firewall=Verwijder firewall regel -label.action.delete.ingress.rule.processing=Bezig met verwijderen van Inkomende Regel.... +label.action.delete.ingress.rule.processing=Bezig met verwijderen van Inkomende Regel.... label.action.delete.ingress.rule=Verwijder Inkomende Regel label.action.delete.IP.range.processing=Bezig met verwijderen van IP Range.... label.action.delete.IP.range=Verwijder IP Range @@ -326,7 +326,7 @@ label.assign.to.load.balancer=Voeg instantie toe aan load balancer label.associated.network=Bijbehorend Netwerk label.associated.network.id=Bijbehorend Netwerk ID label.attached.iso=Gekoppelde ISO -label.author.email=Auteur e-mail +label.author.email=Auteur e-mail label.author.name=Auteur naam label.availability=Beschikbaarheid label.availability.zone=Beschikbaarheids-zone @@ -450,7 +450,7 @@ label.disabled=Uitgeschakeld label.disable.provider=Provider uitschakelen label.disable.vpn=VPN uitschakelen label.disabling.vpn.access=Uitschakelen van VPN Toegang -label.disk.allocated=Schijfruimte gealloceerd +label.disk.allocated=Schijfruimte gealloceerd label.disk.offering=Schijf Aanbieding label.disk.size.gb=Schijf Grootte (in GB) label.disk.size=Schijf Grootte @@ -471,7 +471,7 @@ label.domain.suffix=DNS domein achtervoegsel (v.b., xyz.com) label.done=Klaar label.double.quotes.are.not.allowed=Aanhalingstekens zijn hier niet toegestaan label.download.progress=Download Voortgang -label.drag.new.position=Sleep naar nieuwe positie +label.drag.new.position=Sleep naar nieuwe positie label.edit.lb.rule=Wijzig LB regel label.edit.network.details=Wijzig netwerk details label.edit.project.details=Wijzig project details @@ -568,7 +568,7 @@ label.installWizard.addHostIntro.subtitle=Wat is een host? label.installWizard.addHostIntro.title=Nu\: Host toevoegen label.installWizard.addPodIntro.subtitle=Wat is een pod? label.installWizard.addPodIntro.title=Nu\: Pod toevoegen -label.installWizard.addPrimaryStorageIntro.subtitle=Wat is primary storage? +label.installWizard.addPrimaryStorageIntro.subtitle=Wat is primary storage? label.installWizard.addPrimaryStorageIntro.title=Nu\: Primaire opslag toevoegen label.installWizard.addSecondaryStorageIntro.subtitle=Wat is secundaire opslag? label.installWizard.addSecondaryStorageIntro.title=Nu\: Secundaire opslag toevoegen @@ -620,7 +620,7 @@ label.keyboard.type=Toetsenbord type label.key=Sleutel label.kvm.traffic.label=KVM verkeer label label.label=Label -label.lang.brportugese=Braziliaans Portgees +label.lang.brportugese=Braziliaans Portgees label.lang.chinese=Chinees (Simplified) label.lang.english=Engels label.lang.french=Frans @@ -793,7 +793,7 @@ label.number.of.system.vms=Aantal Systeem VMs label.number.of.virtual.routers=Aantal Virtual Routers label.number.of.zones=Aantal Zones label.num.cpu.cores=Aantal CPU Cores -label.numretries=Keren opnieuw geprorbeerd +label.numretries=Keren opnieuw geprorbeerd label.ocfs2=OCFS2 label.offer.ha=HA aanbieden label.ok=OK @@ -1156,24 +1156,24 @@ label.zones=Zones label.zone.type=Type Zone label.zone.wide=Zone breed label.zoneWizard.trafficType.guest=Gast\: Verkeer tussen virtuele machines van de eindgebruiker -label.zoneWizard.trafficType.public=Publiek\: Verkeer tussen het internet en virtueele machines in de cloud. +label.zoneWizard.trafficType.public=Publiek\: Verkeer tussen het internet en virtueele machines in de cloud. label.zoneWizard.trafficType.storage=Opslag\: Verkeer tussen de primaire en secundaire opslag servers zoals VM templates en snapshots label.zone=Zone managed.state=Beheersstaat message.acquire.new.ip=Bevestigen dat je een nieuw IP voor dit netwerk wilt verkrijgen. -message.acquire.new.ip.vpc=Bevestig dat u een nieuw IP wilt verkrijgen voor deze VPC. +message.acquire.new.ip.vpc=Bevestig dat u een nieuw IP wilt verkrijgen voor deze VPC. message.acquire.public.ip=Selecteer de zone waarvan u een nieuw IP wenst te verkrijgen. -message.action.cancel.maintenance=Het onderhoud voor de host is succesvol geannuleerd. Het daadwerkelijke proces kan echter enkele minuten duren. +message.action.cancel.maintenance=Het onderhoud voor de host is succesvol geannuleerd. Het daadwerkelijke proces kan echter enkele minuten duren. message.action.cancel.maintenance.mode=Bevestig dat u het onderhoud wilt annuleren. message.action.change.service.warning.for.instance=Uw instantie moet uitgeschakeld zijn voordat u de service aanbieding kunt wijzigen. message.action.change.service.warning.for.router=Uw router moet uitgeschakeld zijn voordat u de service aanbieding kunt wijzigen. message.action.delete.cluster=Bevestig dat u dit cluster wilt verwijderen. message.action.delete.disk.offering=Bevestig dat u deze schijf aanbieding wilt verwijderen. message.action.delete.domain=Bevestig dat u dit domein wilt verwijderen. -message.action.delete.external.firewall=Bevestig dat u deze externe firewall wilt verwijderen. Waarschuwing\: Als u van plan bent dezelfde firewall opnieuw toe te voegen, dient u de verbruiksstatistieken eerst te resetten. -message.action.delete.external.load.balancer=Bevestig dat u deze externe loadbalancer wilt verwijderen. Waarschuwing\: Als u van plan bent dezelfde loadbalancer opnieuw toe te voegen, dient u de verbruiksstatistieken eerst te resetten. +message.action.delete.external.firewall=Bevestig dat u deze externe firewall wilt verwijderen. Waarschuwing\: Als u van plan bent dezelfde firewall opnieuw toe te voegen, dient u de verbruiksstatistieken eerst te resetten. +message.action.delete.external.load.balancer=Bevestig dat u deze externe loadbalancer wilt verwijderen. Waarschuwing\: Als u van plan bent dezelfde loadbalancer opnieuw toe te voegen, dient u de verbruiksstatistieken eerst te resetten. message.action.delete.ingress.rule=Bevestig dat u deze inkomende regel wilt verwijderen. -message.action.delete.ISO=Bevestig dat u deze ISO wilt verwijderen. +message.action.delete.ISO=Bevestig dat u deze ISO wilt verwijderen. message.action.delete.ISO.for.all.zones=Deze ISO wordt gebruikt door alle zones. Bevestig dat u deze wilt verwijderen van alle zones. message.action.delete.network=Bevestig dat u dit netwerk wilt verwijderen. message.action.delete.nexusVswitch=Bevestig dat u deze nexus 1000v wilt verwijderen @@ -1184,9 +1184,9 @@ message.action.delete.secondary.storage=Bevestig dat u deze secudaire opslag wil message.action.delete.security.group=Bevestig dat u deze security group wilt verwijderen. message.action.delete.service.offering=Bevestig dat u deze service aanbieding wilt verwijderen. message.action.delete.snapshot=Bevestig dat u deze snapshot wilt verwijderen. -message.action.delete.system.service.offering=Bevestig dat u deze systeem service aanbieding wilt verwijderen. +message.action.delete.system.service.offering=Bevestig dat u deze systeem service aanbieding wilt verwijderen. message.action.delete.template=Bevestig dat u deze template wilt verwijderen -message.action.delete.template.for.all.zones=Deze template wordt gebruikt door alle zones. Bevestig dat u deze wilt verwijderen van alle zones. +message.action.delete.template.for.all.zones=Deze template wordt gebruikt door alle zones. Bevestig dat u deze wilt verwijderen van alle zones. message.action.delete.volume=Bevestig dat u dit volume wilt verwijderen message.action.delete.zone=Bevestig dat u deze zone wilt verwijderen message.action.destroy.instance=Bevestig dat u deze instantie wilt vernietigen @@ -1200,13 +1200,13 @@ message.action.disable.zone=Bevestig dat u deze zone wilt uitschakelen. message.action.download.iso=Bevestig dat u deze ISO wilt downloaden. message.action.download.template=Bevestig dat u deze template wilt downloaden. message.action.enable.cluster=Bevestig dat u dit cluster wilt inschakelen. -message.action.enable.maintenance=Uw host is succesvol voorbereid op onderhoud. Het proces kan echter een paar minuten duren afhankelijk van de hoeveelheid VMs op de host. +message.action.enable.maintenance=Uw host is succesvol voorbereid op onderhoud. Het proces kan echter een paar minuten duren afhankelijk van de hoeveelheid VMs op de host. message.action.enable.nexusVswitch=Bevestig dat u deze nexus 1000v wilt inschakelen message.action.enable.physical.network=Bevestig dat u dit fysieke netwerk wilt inschakelen. message.action.enable.pod=Bevestigd dat u deze pod wilt inschakelen. message.action.enable.zone=Bevestig dat u deze zone wilt inschakelen. message.action.force.reconnect=De host is succesvol geforceerd om opnieuw te verbinden. Dit proces kan echter enkele minuten duren. -message.action.host.enable.maintenance.mode=Het inschakelen van de onderhoudsmodus zorgt ervoor dat alle draaiende instanties worden gemigreerd naar andere beschikbare hosts. +message.action.host.enable.maintenance.mode=Het inschakelen van de onderhoudsmodus zorgt ervoor dat alle draaiende instanties worden gemigreerd naar andere beschikbare hosts. message.step.2.desc= message.step.3.desc= mode=Modus diff --git a/client/WEB-INF/classes/resources/messages_pl.properties b/client/WEB-INF/classes/resources/messages_pl.properties index 9024030f51e..84808f818d8 100644 --- a/client/WEB-INF/classes/resources/messages_pl.properties +++ b/client/WEB-INF/classes/resources/messages_pl.properties @@ -37,7 +37,7 @@ label.action.create.vm.processing=Tworz\u0119 VM.... label.action.create.vm=Utw\u00f3rz VM label.action.create.volume.processing=Tworz\u0119 wolumen.... label.action.create.volume=Utw\u00f3rz wolumen -label.action.delete.account.processing=Usuwanie dost\u0119pu.... +label.action.delete.account.processing=Usuwanie dost\u0119pu.... label.action.delete.account=Usu\u0144 dost\u0119p label.action.delete.cluster.processing=Usuwam klaster.... label.action.delete.cluster=Usu\u0144 klaster @@ -160,7 +160,7 @@ label.adding.failed=Dodanie nieudane label.adding.processing=Dodawanie label.adding.succeeded=Dodanie udane label.add.more=Dodaj wi\u0119cej -label.add.network.device=Dodaj urz\u0105dzenie sieciowe +label.add.network.device=Dodaj urz\u0105dzenie sieciowe label.add.network=Dodaj sie\u0107 label.add.new.F5=Dodaj nowy F5 label.add.new.SRX=Dodaj nowy SRX @@ -373,7 +373,7 @@ label.resource=Zas\u00f3b label.restart.required=Wymagany restart label.rules=Zasady label.saturday=Sobota -label.save.and.continue=Zapisz i kontynuuj +label.save.and.continue=Zapisz i kontynuuj label.save=Zapisz label.saving.processing=Zapisywanie.... label.search=Szukaj @@ -396,7 +396,7 @@ label.sticky.domain=Domena label.sticky.expire=Wygasa label.sticky.length=D\u0142ugo\u015b\u0107 label.sticky.mode=Tryb -label.sticky.prefix=Prefiks +label.sticky.prefix=Prefiks label.stop=Stop label.sunday=Niedziela label.suspend.project=Zawie\u015b projekt @@ -458,8 +458,8 @@ state.Creating=Tworzenie state.Declined=Odrzucono state.Destroyed=Zniszczono state.Disabled=Wy\u0142\u0105czony -state.enabled=W\u0142\u0105czone -state.Enabled=W\u0142\u0105czone +state.enabled=W\u0142\u0105czone +state.Enabled=W\u0142\u0105czone state.Error=B\u0142\u0105d state.ready=Gotowe state.Ready=Gotowe diff --git a/client/WEB-INF/classes/resources/messages_pt_BR.properties b/client/WEB-INF/classes/resources/messages_pt_BR.properties index 07fd3f42d76..1bcdc9ce1bc 100644 --- a/client/WEB-INF/classes/resources/messages_pt_BR.properties +++ b/client/WEB-INF/classes/resources/messages_pt_BR.properties @@ -391,7 +391,7 @@ label.cpu.mhz=CPU (em MHz) label.cpu.utilized=CPU Utilizada label.created.by.system=Criado pelo sistema label.created=Criado -label.create.nfs.secondary.staging.store=Criar storage staging secund\u00e1rio NFS +label.create.nfs.secondary.staging.store=Criar storage staging secund\u00e1rio NFS label.create.project=Criar um projeto label.create.template=Criar template label.create.VPN.connection=Criar uma conex\u00e3o VPN @@ -837,15 +837,12 @@ label.public.zone=Zona P\u00fablica label.purpose=Prop\u00f3sito label.Pxe.server.type=Tipo de Servidor PXE label.quickview=Visualiza\u00e7\u00e3o r\u00e1pida -<<<<<<< HEAD -======= label.quiesce.vm=Quiesce VM label.rbd.id=Usu\u00e1rio Ceph label.rbd.monitor=Monitor Ceph label.rbd.pool=Pool Ceph label.rbd=RDB label.rbd.secret=Cephx secret ->>>>>>> 4e449ff... Add Dutch (Netherlands, Polish languages in Web UI Change Japanese code (ja -> ja_JP) Update transifex sync config label.reboot=Reiniciar label.recent.errors=Erros Recentes label.redundant.router.capability=Recurso de roteador redundante @@ -1101,12 +1098,9 @@ label.vm.state=Estado da VM label.vm.stop=Parar label.vms=VMs label.vmware.traffic.label=Etiqueta de tr\u00e1fego VMware -<<<<<<< HEAD -======= label.vnet.id=VLAN ID label.vnet=VLAN label.volatile=Vol\u00e1til ->>>>>>> 4e449ff... Add Dutch (Netherlands, Polish languages in Web UI Change Japanese code (ja -> ja_JP) Update transifex sync config label.volgroup=Grupo de Volume label.volume=Disco label.volume.limits=Limites de Disco @@ -1383,14 +1377,11 @@ message.please.select.a.different.public.and.management.network.before.removing= message.please.select.networks=Por favor selecione as redes para sua m\u00e1quina virtual. message.please.wait.while.zone.is.being.created=Por favor, espere enquanto sua zona est\u00e1 sendo criada; isto pode demorar um pouco... message.project.invite.sent=Convite enviado para o usu\u00e1rio; Eles ser\u00e3o adicionados ao projeto ap\u00f3s aceitarem o convite -<<<<<<< HEAD -======= message.public.traffic.in.advanced.zone=O tr\u00e1fego p\u00fablico \u00e9 gerado quando as VMs na nuvem acessam a internet. Os IPs acess\u00edveis ao p\u00fablico devem ser alocados para essa finalidade. Os usu\u00e1rios finais podem usar a interface do usu\u00e1rio CloudStack para adquirir esses IPs afim de implementar NAT entre a sua rede de guests e sua rede p\u00fablica.

Forne\u00e7a pelo menos um intervalo de endere\u00e7os IP para o tr\u00e1fego de internet. message.public.traffic.in.basic.zone=O tr\u00e1fego p\u00fablico \u00e9 gerado quando as VMs na nuvem acessam a Internet ou prestam servi\u00e7os aos clientes atrav\u00e9s da Internet. Os IPs acess\u00edveis ao p\u00fablico devem ser alocados para essa finalidade. Quando uma inst\u00e2ncia \u00e9 criada, um IP a partir deste conjunto de IPs p\u00fablicos ser\u00e3o destinados \u00e0 inst\u00e2ncia, al\u00e9m do endere\u00e7o IP guest. Um NAT est\u00e1tico 1-1 ser\u00e1 criada automaticamente entre o IP p\u00fablico e IP guest. Os usu\u00e1rios finais tamb\u00e9m podem usar a interface de usu\u00e1rio CloudStack para adquirir IPs adicionais afim de se implementar NAT est\u00e1tico entre suas inst\u00e2ncias e o IP p\u00fablico. message.redirecting.region=Redirecionando para regi\u00e3o... message.remove.ldap=Voc\u00ea tem certeza que deseja deletar a configura\u00e7\u00e3o LDAP? message.remove.region=Voc\u00ea tem certeza que deseja remover esta regi\u00e3o deste servidor de gerenciamento? ->>>>>>> 4e449ff... Add Dutch (Netherlands, Polish languages in Web UI Change Japanese code (ja -> ja_JP) Update transifex sync config message.remove.vpc=Favor confirmar que voc\u00ea deseja remover a VPC message.remove.vpn.access=Confirme se voc\u00ea deseja remover acesso VPN do seguinte Usu\u00e1rio. message.reset.password.warning.notPasswordEnabled=O template desta inst\u00e2ncia foi criado sem senha habilitada diff --git a/client/WEB-INF/classes/resources/messages_zh_CN.properties b/client/WEB-INF/classes/resources/messages_zh_CN.properties index 7cb65d3236b..f4c206b04f6 100644 --- a/client/WEB-INF/classes/resources/messages_zh_CN.properties +++ b/client/WEB-INF/classes/resources/messages_zh_CN.properties @@ -14,9 +14,22 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +label.port=\u7aef\u53e3 +label.remove.ldap=\u5220\u9664 LDAP +label.configure.ldap=\u914d\u7f6e LDAP +label.ldap.configuration=LDAP \u914d\u7f6e +label.ldap.port=LDAP \u7aef\u53e3 +label.create.nfs.secondary.staging.store=\u521b\u5efa NFS \u8f85\u52a9\u6682\u5b58\u5b58\u50a8 +label.volatile=\u53ef\u53d8 +label.planner.mode=\u89c4\u5212\u5668\u6a21\u5f0f +label.deployment.planner=\u90e8\u7f72\u89c4\u5212\u5668 +label.quiesce.vm=\u9759\u9ed8 VM +label.smb.username=SMB \u7528\u6237\u540d +label.smb.password=SMB \u5bc6\u7801 +label.smb.domain=SMB \u57df label.hypervisors=\u865a\u62df\u673a\u7ba1\u7406\u7a0b\u5e8f label.home=\u9996\u9875 -label.sockets=\u63d2\u69fd +label.sockets=CPU Sockets label.root.disk.size=\u6839\u78c1\u76d8\u5927\u5c0f label.s3.nfs.server=S3 NFS \u670d\u52a1\u5668 label.s3.nfs.path=S3 NFS \u8def\u5f84 @@ -50,7 +63,7 @@ message.action.delete.nic=\u8bf7\u786e\u8ba4\u60a8\u786e\u5b9e\u8981\u79fb\u9664 changed.item.properties=\u66f4\u6539\u9879\u76ee\u5c5e\u6027 confirm.enable.s3=\u8bf7\u586b\u5199\u4ee5\u4e0b\u4fe1\u606f\u4ee5\u542f\u7528\u5bf9 S3 \u652f\u6301\u7684\u8f85\u52a9\u5b58\u50a8\u7684\u652f\u6301 confirm.enable.swift=\u8bf7\u586b\u5199\u4ee5\u4e0b\u4fe1\u606f\u4ee5\u542f\u7528\u5bf9 SWIFT \u7684\u652f\u6301 -error.could.not.change.your.password.because.ldap.is.enabled=\u9519\u8bef\u3002LDAP \u5904\u4e8e\u542f\u7528\u72b6\u6001\uff0c\u65e0\u6cd5\u66f4\u6539\u60a8\u7684\u5bc6\u7801\u3002 +error.could.not.change.your.password.because.ldap.is.enabled=Error could not change your password because LDAP is enabled. error.could.not.enable.zone=\u65e0\u6cd5\u542f\u7528\u533a\u57df error.installWizard.message=\u51fa\u73b0\u95ee\u9898\uff1b\u8bf7\u8fd4\u56de\u5e76\u66f4\u6b63\u4efb\u4f55\u9519\u8bef error.invalid.username.password=\u7528\u6237\u540d\u6216\u5bc6\u7801\u65e0\u6548 @@ -691,6 +704,7 @@ label.lang.arabic=\u963f\u62c9\u4f2f\u8bed label.lang.brportugese=\u8461\u8404\u7259\u8bed(\u5df4\u897f) label.lang.catalan=\u52a0\u6cf0\u7f57\u5c3c\u4e9a\u8bed label.lang.chinese=\u7b80\u4f53\u4e2d\u6587 +label.lang.dutch=Dutch (Netherlands) label.lang.english=\u82f1\u8bed label.lang.french=\u6cd5\u8bed label.lang.german=\u5fb7\u8bed @@ -698,6 +712,7 @@ label.lang.italian=\u610f\u5927\u5229\u8bed label.lang.japanese=\u65e5\u8bed label.lang.korean=\u97e9\u8bed label.lang.norwegian=\u632a\u5a01\u8bed +label.lang.polish=Polish label.lang.russian=\u4fc4\u8bed label.lang.spanish=\u897f\u73ed\u7259\u8bed label.last.disconnected=\u4e0a\u6b21\u65ad\u5f00\u8fde\u63a5\u65f6\u95f4 @@ -1052,7 +1067,7 @@ label.source=\u6e90\u7b97\u6cd5 label.specify.IP.ranges=\u6307\u5b9a IP \u8303\u56f4 label.specify.vlan=\u6307\u5b9a VLAN label.specify.vxlan=\u6307\u5b9a VXLAN -label.SR.name = SR \u540d\u79f0\u6807\u7b7e +label.SR.name = SR Name-Label label.srx=SRX label.PA=Palo Alto label.start.IP=\u8d77\u59cb IP @@ -1096,7 +1111,7 @@ label.storage.tags=\u5b58\u50a8\u6807\u7b7e label.storage.traffic=\u5b58\u50a8\u901a\u4fe1 label.storage.type=\u5b58\u50a8\u7c7b\u578b label.qos.type=QoS \u7c7b\u578b -label.cache.mode=\u5199\u5165\u7f13\u5b58\u7c7b\u578b +label.cache.mode=Write-cache Type label.storage=\u5b58\u50a8 label.subdomain.access=\u5b50\u57df\u8bbf\u95ee label.submit=\u63d0\u4ea4 @@ -1129,7 +1144,7 @@ label.tier.details=\u5c42\u8be6\u7ec6\u4fe1\u606f label.tier=\u5c42 label.time.zone=\u65f6\u533a label.time=\u65f6\u95f4 -label.timeout.in.second = \u8d85\u65f6(\u79d2) +label.timeout.in.second = Timeout(seconds) label.timeout=\u8d85\u65f6 label.timezone=\u65f6\u533a label.token=\u4ee4\u724c @@ -1151,8 +1166,8 @@ label.unavailable=\u4e0d\u53ef\u7528 label.unlimited=\u65e0\u9650\u5236 label.untagged=\u5df2\u53d6\u6d88\u6807\u8bb0 label.update.project.resources=\u66f4\u65b0\u9879\u76ee\u8d44\u6e90 -label.update.ssl.cert= SSL \u8bc1\u4e66 -label.update.ssl= SSL \u8bc1\u4e66 +label.update.ssl.cert= SSL Certificate +label.update.ssl= SSL Certificate label.updating=\u6b63\u5728\u66f4\u65b0 label.upload.volume=\u4e0a\u8f7d\u5377 label.upload=\u4e0a\u8f7d @@ -1252,6 +1267,56 @@ label.zoneWizard.trafficType.management=\u7ba1\u7406\: CloudStack \u7684\u5185\u label.zoneWizard.trafficType.public=\u516c\u7528\: \u4e91\u4e2d Internet \u4e0e\u865a\u62df\u673a\u4e4b\u95f4\u7684\u901a\u4fe1\u3002 label.zoneWizard.trafficType.storage=\u5b58\u50a8\: \u4e3b\u5b58\u50a8\u670d\u52a1\u5668\u4e0e\u8f85\u52a9\u5b58\u50a8\u670d\u52a1\u5668(\u4f8b\u5982 VM \u6a21\u677f\u4e0e\u5feb\u7167)\u4e4b\u95f4\u7684\u901a\u4fe1 label.ldap.group.name=LDAP \u7ec4 +label.password.reset.confirm=\u5bc6\u7801\u5df2\u91cd\u7f6e\u4e3a +label.provider=\u63d0\u4f9b\u7a0b\u5e8f +label.resetVM=\u91cd\u7f6e VM +label.openDaylight=OpenDaylight +label.assign.instance.another=\u5c06\u5b9e\u4f8b\u5206\u914d\u7ed9\u5176\u4ed6\u5e10\u6237 +label.network.addVM=\u5c06\u7f51\u7edc\u6dfb\u52a0\u5230 VM +label.set.default.NIC=\u8bbe\u7f6e\u9ed8\u8ba4 NIC +label.Xenserver.Tools.Version61plus=XenServer Tools \u7248\u672c 6.1\+ +label.dynamically.scalable=\u53ef\u52a8\u6001\u6269\u5c55 +label.instance.scaled.up=\u5df2\u6269\u5c55\u5b9e\u4f8b +label.tag.key=\u6807\u8bb0\u5bc6\u94a5 +label.tag.value=\u6807\u8bb0\u503c +label.ipv6.address=IPv6 IP \u5730\u5740 +label.ipv6.gateway=IPv6 \u7f51\u5173 +label.ipv6.CIDR=IPv6 CIDR +label.VPC.limits=VPC \u9650\u5236 +label.edit.region=\u7f16\u8f91\u533a\u57df +label.gslb.domain.name=GSLB \u57df\u540d +label.add.gslb=\u6dfb\u52a0 GSLB +label.gslb.servicetype=\u670d\u52a1\u7c7b\u578b +label.gslb.details=GSLB \u8be6\u7ec6\u4fe1\u606f +label.gslb.delete=\u5220\u9664 GSLB +label.opendaylight.controllers=OpenDaylight Controllers +label.portable.ip.ranges=\u53ef\u79fb\u690d IP \u8303\u56f4 +label.add.portable.ip.range=\u6dfb\u52a0\u53ef\u79fb\u690d IP \u8303\u56f4 +label.delete.portable.ip.range=\u5220\u9664\u53ef\u79fb\u690d IP \u8303\u56f4 +label.opendaylight.controllerdetail=OpenDaylight Controller Details +label.portable.ip.range.details=\u53ef\u79fb\u690d IP \u8303\u56f4\u8be6\u7ec6\u4fe1\u606f +label.portable.ips=\u53ef\u79fb\u690d IP +label.gslb.assigned.lb=\u5df2\u5206\u914d\u8d1f\u8f7d\u5e73\u8861 +label.gslb.assigned.lb.more=\u5206\u914d\u66f4\u591a\u8d1f\u8f7d\u5e73\u8861 +label.gslb.lb.rule=\u8d1f\u8f7d\u5e73\u8861\u89c4\u5219 +label.gslb.lb.details=\u8d1f\u8f7d\u5e73\u8861\u8be6\u7ec6\u4fe1\u606f +label.gslb.lb.remove=\u4ece\u6b64 GSLB \u4e2d\u5220\u9664\u8d1f\u8f7d\u5e73\u8861 +label.enable.autoscale=\u542f\u7528\u81ea\u52a8\u6269\u5c55 +label.disable.autoscale=\u7981\u7528\u81ea\u52a8\u6269\u5c55 +label.min.instances=\u6700\u5c0f\u5b9e\u4f8b\u6570 +label.max.instances=\u6700\u5927\u5b9e\u4f8b\u6570 +label.add.OpenDaylight.device=Add OpenDaylight Controller +label.show.advanced.settings=\u663e\u793a\u9ad8\u7ea7\u8bbe\u7f6e +label.delete.OpenDaylight.device=Delete OpenDaylight Controller +label.polling.interval.sec=\u8f6e\u8be2\u65f6\u95f4\u95f4\u9694(\u79d2) +label.quiet.time.sec=\u5b89\u9759\u65f6\u95f4(\u79d2) +label.destroy.vm.graceperiod=\u9500\u6bc1 VM \u5bbd\u9650\u671f +label.SNMP.community=SNMP \u793e\u533a +label.SNMP.port=SNMP \u7aef\u53e3 +label.add.ucs.manager=\u6dfb\u52a0 UCS \u7ba1\u7406\u5668 +label.ovm.traffic.label=OVM \u901a\u4fe1\u6807\u7b7e +label.lxc.traffic.label=LXC \u901a\u4fe1\u6807\u7b7e +label.hyperv.traffic.label=HyperV \u901a\u4fe1\u6807\u7b7e managed.state=\u6258\u7ba1\u72b6\u6001 message.acquire.new.ip.vpc=\u8bf7\u786e\u8ba4\u60a8\u786e\u5b9e\u8981\u4e3a\u6b64 VPC \u83b7\u53d6\u4e00\u4e2a\u65b0 IP\u3002 message.acquire.new.ip=\u8bf7\u786e\u8ba4\u60a8\u786e\u5b9e\u8981\u4e3a\u6b64\u7f51\u7edc\u83b7\u53d6\u4e00\u4e2a\u65b0 IP\u3002 @@ -1565,6 +1630,43 @@ message.zone.step.1.desc=\u8bf7\u4e3a\u60a8\u7684\u533a\u57df\u9009\u62e9\u4e00\ message.zone.step.2.desc=\u8bf7\u8f93\u5165\u4ee5\u4e0b\u4fe1\u606f\u4ee5\u6dfb\u52a0\u4e00\u4e2a\u65b0\u533a\u57df message.zone.step.3.desc=\u8bf7\u8f93\u5165\u4ee5\u4e0b\u4fe1\u606f\u4ee5\u6dfb\u52a0\u4e00\u4e2a\u65b0\u63d0\u4f9b\u70b9 message.zoneWizard.enable.local.storage=\u8b66\u544a\: \u5982\u679c\u4e3a\u6b64\u533a\u57df\u542f\u7528\u4e86\u672c\u5730\u5b58\u50a8\uff0c\u5219\u5fc5\u987b\u6267\u884c\u4ee5\u4e0b\u64cd\u4f5c\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u60a8\u5e0c\u671b\u542f\u52a8\u7cfb\u7edf VM \u7684\u4f4d\u7f6e\:

1. \u5982\u679c\u9700\u8981\u5728\u4e3b\u5b58\u50a8\u4e2d\u542f\u52a8\u7cfb\u7edf VM\uff0c\u5219\u5fc5\u987b\u5728\u5b8c\u6210\u521b\u5efa\u540e\u5c06\u4e3b\u5b58\u50a8\u6dfb\u52a0\u5230\u6b64\u533a\u57df\u4e2d\u3002

2. \u5982\u679c\u9700\u8981\u5728\u672c\u5730\u5b58\u50a8\u4e2d\u542f\u52a8\u7cfb\u7edf VM\uff0c\u5219\u5fc5\u987b\u5c06 system.vm.use.local.storage \u8bbe\u7f6e\u4e3a true\u3002


\u662f\u5426\u8981\u7ee7\u7eed? +message.validate.fieldrequired=\u6b64\u5b57\u6bb5\u4e3a\u5fc5\u586b\u5b57\u6bb5\u3002 +message.validate.fixfield=\u8bf7\u4fee\u590d\u6b64\u5b57\u6bb5\u3002 +message.validate.email.address=Please enter a valid email address. +message.validate.URL=Please enter a valid URL. +message.validate.date=Please enter a valid date. +message.validate.date.ISO=Please enter a valid date (ISO). +message.validate.number=Please enter a valid number. +message.validate.digits=Please enter only digits. +message.validate.creditcard=Please enter a valid credit card number. +message.validate.equalto=Please enter the same value again. +message.validate.accept=Please enter a value with a valid extension. +message.validate.maxlength=Please enter no more than {0} characters. +message.validate.minlength=Please enter at least {0} characters. +message.validate.range.length=Please enter a value between {0} and {1} characters long. +message.validate.range=Please enter a value between {0} and {1}. +message.validate.max=Please enter a value less than or equal to {0}. +messgae.validate.min=Please enter a value greater than or equal to {0}. +message.creating.systemVM=\u6b63\u5728\u521b\u5efa\u7cfb\u7edf VM (\u6b64\u64cd\u4f5c\u53ef\u80fd\u9700\u8981\u4e00\u4e9b\u65f6\u95f4) +message.enabling.zone.dots=\u6b63\u5728\u542f\u7528\u533a\u57df... +message.restoreVM=\u662f\u5426\u8981\u8fd8\u539f\u6b64 VM? +message.no.host.available=\u6ca1\u6709\u53ef\u7528\u4e8e\u8fc1\u79fb\u7684\u4e3b\u673a +message.network.addVM.desc=\u8bf7\u6307\u5b9a\u8981\u5c06\u6b64 VM \u6dfb\u52a0\u5230\u7684\u7f51\u7edc\u3002\u5c06\u4e3a\u6b64\u7f51\u7edc\u6dfb\u52a0\u4e00\u4e2a\u65b0 NIC\u3002 +message.network.addVMNIC=\u8bf7\u786e\u8ba4\u60a8\u786e\u5b9e\u8981\u4e3a\u6b64\u7f51\u7edc\u6dfb\u52a0\u4e00\u4e2a\u65b0 VM NIC\u3002 +message.set.default.NIC=\u8bf7\u786e\u8ba4\u60a8\u786e\u5b9e\u8981\u5c06\u6b64 NIC \u8bbe\u7f6e\u4e3a\u6b64 VM \u7684\u9ed8\u8ba4 NIC\u3002 +message.set.default.NIC.manual=\u8bf7\u7acb\u5373\u624b\u52a8\u66f4\u65b0\u6b64 VM \u4e0a\u7684\u9ed8\u8ba4 NIC\u3002 +message.instance.scaled.up.confirm=\u662f\u5426\u786e\u5b9e\u8981\u6269\u5c55\u60a8\u7684\u5b9e\u4f8b? +message.copy.template.confirm=\u662f\u5426\u786e\u5b9e\u8981\u590d\u5236\u6a21\u677f? +message.template.copying=\u6b63\u5728\u590d\u5236\u6a21\u677f\u3002 +message.XSTools61plus.update.failed=\u65e0\u6cd5\u66f4\u65b0\u201cXenServer Tools \u7248\u672c 6.1\+\u201d\u5b57\u6bb5\u3002\u9519\u8bef\: +message.gslb.delete.confirm=\u8bf7\u786e\u8ba4\u60a8\u786e\u5b9e\u8981\u5220\u9664\u6b64 GSLB +message.portable.ip.delete.confirm=\u8bf7\u786e\u8ba4\u60a8\u786e\u5b9e\u8981\u5220\u9664\u53ef\u79fb\u690d IP \u8303\u56f4 +message.gslb.lb.remove.confirm=\u8bf7\u786e\u8ba4\u60a8\u786e\u5b9e\u8981\u4ece GSLB \u4e2d\u5220\u9664\u8d1f\u8f7d\u5e73\u8861 +message.admin.guide.read=\u5bf9\u4e8e\u57fa\u4e8e VMware \u7684 VM\uff0c\u8bf7\u5148\u9605\u8bfb\u7ba1\u7406\u6307\u5357\u4e2d\u7684\u52a8\u6001\u6269\u5c55\u90e8\u5206\uff0c\u7136\u540e\u518d\u8fdb\u884c\u6269\u5c55\u3002\u662f\u5426\u8981\u7ee7\u7eed?\, +message.tier.required=\u201c\u5c42\u201d\u4e3a\u5fc5\u586b\u9879 +message.remove.ldap=\u662f\u5426\u786e\u5b9e\u8981\u5220\u9664 LDAP \u914d\u7f6e? +message.action.downloading.template=\u6b63\u5728\u4e0b\u8f7d\u6a21\u677f\u3002 +message.configure.ldap=\u8bf7\u786e\u8ba4\u60a8\u786e\u5b9e\u8981\u914d\u7f6e LDAP\u3002 mode=\u6a21\u5f0f network.rate=\u7f51\u7edc\u901f\u7387 notification.reboot.instance=\u91cd\u65b0\u542f\u52a8\u5b9e\u4f8b diff --git a/client/pom.xml b/client/pom.xml index cf2dab3a8db..eadd6e9bf57 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -231,11 +231,6 @@ cloud-iam ${project.version}
- - mysql - mysql-connector-java - runtime - org.apache.cloudstack cloud-framework-ipc @@ -380,6 +375,14 @@ org.mortbay.jetty maven-jetty-plugin 6.1.26 + + + + mysql + mysql-connector-java + ${cs.mysql.version} + + 0 9966 @@ -587,6 +590,17 @@ + + org.apache.maven.plugins + maven-checkstyle-plugin + + + cloudstack-checkstyle + none + false + + + @@ -720,6 +734,21 @@ + + mysqlha + + + noredist + + + + + org.apache.cloudstack + cloud-plugin-database-mysqlha + ${project.version} + + + quickcloud diff --git a/client/tomcatconf/catalina.properties.in b/client/tomcatconf/catalina.properties.in index dc2db354920..ce03ff6390b 100644 --- a/client/tomcatconf/catalina.properties.in +++ b/client/tomcatconf/catalina.properties.in @@ -44,7 +44,7 @@ package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache # "foo/*.jar": Add all the JARs of the specified folder as class # repositories # "foo/bar.jar": Add bar.jar as a class repository -common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar +common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,/usr/share/java/mysql-connector-java.jar # # List of comma-separated paths defining the contents of the "server" diff --git a/core/src/com/cloud/agent/api/CheckRouterCommand.java b/core/src/com/cloud/agent/api/CheckRouterCommand.java index 6215fc3722b..c89cdf7b23f 100644 --- a/core/src/com/cloud/agent/api/CheckRouterCommand.java +++ b/core/src/com/cloud/agent/api/CheckRouterCommand.java @@ -27,4 +27,9 @@ public class CheckRouterCommand extends NetworkElementCommand { public CheckRouterCommand() { super(); } + + @Override + public boolean isQuery() { + return true; + } } diff --git a/core/src/com/cloud/agent/api/CheckS2SVpnConnectionsCommand.java b/core/src/com/cloud/agent/api/CheckS2SVpnConnectionsCommand.java index 9cfb53b0828..bbd7c5f5284 100644 --- a/core/src/com/cloud/agent/api/CheckS2SVpnConnectionsCommand.java +++ b/core/src/com/cloud/agent/api/CheckS2SVpnConnectionsCommand.java @@ -16,10 +16,10 @@ // under the License. package com.cloud.agent.api; -import java.util.List; - import com.cloud.agent.api.routing.NetworkElementCommand; +import java.util.List; + public class CheckS2SVpnConnectionsCommand extends NetworkElementCommand { List vpnIps; @@ -36,4 +36,9 @@ public class CheckS2SVpnConnectionsCommand extends NetworkElementCommand { public List getVpnIps() { return vpnIps; } + + @Override + public boolean isQuery() { + return true; + } } diff --git a/core/src/com/cloud/agent/api/GetDomRVersionCmd.java b/core/src/com/cloud/agent/api/GetDomRVersionCmd.java index 577c386b873..7a73fac3e7d 100644 --- a/core/src/com/cloud/agent/api/GetDomRVersionCmd.java +++ b/core/src/com/cloud/agent/api/GetDomRVersionCmd.java @@ -27,4 +27,9 @@ public class GetDomRVersionCmd extends NetworkElementCommand { public GetDomRVersionCmd() { super(); } + + @Override + public boolean isQuery() { + return true; + } } diff --git a/core/src/com/cloud/agent/api/routing/GroupAnswer.java b/core/src/com/cloud/agent/api/routing/GroupAnswer.java new file mode 100644 index 00000000000..293934bce3a --- /dev/null +++ b/core/src/com/cloud/agent/api/routing/GroupAnswer.java @@ -0,0 +1,40 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package com.cloud.agent.api.routing; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.Command; + +public class GroupAnswer extends Answer { + String[] results; + + protected GroupAnswer() { + super(); + } + + public GroupAnswer(Command cmd, boolean success, int rulesCount, String[] results) { + super(cmd, success, null); + + assert (rulesCount == results.length) : "Results' count should match requests' count!"; + this.results = results; + } + + public String[] getResults() { + return results; + } +} diff --git a/core/src/com/cloud/agent/api/routing/IpAssocCommand.java b/core/src/com/cloud/agent/api/routing/IpAssocCommand.java index df5d54a8c88..fe6ab6fef73 100644 --- a/core/src/com/cloud/agent/api/routing/IpAssocCommand.java +++ b/core/src/com/cloud/agent/api/routing/IpAssocCommand.java @@ -38,4 +38,8 @@ public class IpAssocCommand extends NetworkElementCommand { return ipAddresses; } + @Override + public int getAnswersCount() { + return ipAddresses.length; + } } diff --git a/core/src/com/cloud/agent/api/routing/IpAssocVpcCommand.java b/core/src/com/cloud/agent/api/routing/IpAssocVpcCommand.java index 3e5566a700c..d4996a5321e 100644 --- a/core/src/com/cloud/agent/api/routing/IpAssocVpcCommand.java +++ b/core/src/com/cloud/agent/api/routing/IpAssocVpcCommand.java @@ -26,4 +26,10 @@ public class IpAssocVpcCommand extends IpAssocCommand { public IpAssocVpcCommand(IpAddressTO[] ips) { super(ips); } + + @Override + public int getAnswersCount() { + //Count private gateway to maximum value + return ipAddresses.length * 2; + } } diff --git a/core/src/com/cloud/agent/api/routing/NetworkElementCommand.java b/core/src/com/cloud/agent/api/routing/NetworkElementCommand.java index 217e962d18a..120c717f9d1 100644 --- a/core/src/com/cloud/agent/api/routing/NetworkElementCommand.java +++ b/core/src/com/cloud/agent/api/routing/NetworkElementCommand.java @@ -34,6 +34,7 @@ public abstract class NetworkElementCommand extends Command { public static final String GUEST_BRIDGE = "guest.bridge"; public static final String VPC_PRIVATE_GATEWAY = "vpc.gateway.private"; public static final String FIREWALL_EGRESS_DEFAULT = "firewall.egress.default"; + public static final String ROUTER_MONITORING_ENABLE = "router.monitor.enable"; private String routerAccessIp; @@ -61,4 +62,12 @@ public abstract class NetworkElementCommand extends Command { public void setRouterAccessIp(String routerAccessIp) { this.routerAccessIp = routerAccessIp; } + + public int getAnswersCount() { + return 1; + } + + public boolean isQuery() { + return false; + } } diff --git a/core/src/com/cloud/agent/api/routing/SetFirewallRulesCommand.java b/core/src/com/cloud/agent/api/routing/SetFirewallRulesCommand.java index f7ac052d72c..36771b9d0cc 100644 --- a/core/src/com/cloud/agent/api/routing/SetFirewallRulesCommand.java +++ b/core/src/com/cloud/agent/api/routing/SetFirewallRulesCommand.java @@ -16,12 +16,12 @@ // under the License. package com.cloud.agent.api.routing; +import com.cloud.agent.api.to.FirewallRuleTO; + import java.util.HashSet; import java.util.List; import java.util.Set; -import com.cloud.agent.api.to.FirewallRuleTO; - /** * * AccessDetails allow different components to put in information about @@ -92,4 +92,9 @@ public class SetFirewallRulesCommand extends NetworkElementCommand { return result; } + + @Override + public int getAnswersCount() { + return rules.length; + } } diff --git a/core/src/com/cloud/agent/api/routing/SetNetworkACLCommand.java b/core/src/com/cloud/agent/api/routing/SetNetworkACLCommand.java index 7edcdf38f17..0b9fec5155f 100644 --- a/core/src/com/cloud/agent/api/routing/SetNetworkACLCommand.java +++ b/core/src/com/cloud/agent/api/routing/SetNetworkACLCommand.java @@ -17,14 +17,14 @@ package com.cloud.agent.api.routing; +import com.cloud.agent.api.to.NetworkACLTO; +import com.cloud.agent.api.to.NicTO; + import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.List; -import com.cloud.agent.api.to.NetworkACLTO; -import com.cloud.agent.api.to.NicTO; - public class SetNetworkACLCommand extends NetworkElementCommand { NetworkACLTO[] rules; NicTO nic; @@ -97,4 +97,9 @@ public class SetNetworkACLCommand extends NetworkElementCommand { public NicTO getNic() { return nic; } + + @Override + public int getAnswersCount() { + return rules.length; + } } diff --git a/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesCommand.java b/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesCommand.java index a7bf37f83ef..d93ccaf7201 100644 --- a/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesCommand.java +++ b/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesCommand.java @@ -16,10 +16,10 @@ // under the License. package com.cloud.agent.api.routing; -import java.util.List; - import com.cloud.agent.api.to.PortForwardingRuleTO; +import java.util.List; + public class SetPortForwardingRulesCommand extends NetworkElementCommand { PortForwardingRuleTO[] rules; @@ -37,4 +37,10 @@ public class SetPortForwardingRulesCommand extends NetworkElementCommand { public PortForwardingRuleTO[] getRules() { return rules; } + + @Override + public int getAnswersCount() { + return rules.length; + } } + diff --git a/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesVpcCommand.java b/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesVpcCommand.java index 613ae5d7985..1bce50dbddf 100644 --- a/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesVpcCommand.java +++ b/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesVpcCommand.java @@ -16,10 +16,10 @@ // under the License. package com.cloud.agent.api.routing; -import java.util.List; - import com.cloud.agent.api.to.PortForwardingRuleTO; +import java.util.List; + public class SetPortForwardingRulesVpcCommand extends SetPortForwardingRulesCommand { protected SetPortForwardingRulesVpcCommand() { } diff --git a/core/src/com/cloud/agent/api/routing/SetStaticNatRulesCommand.java b/core/src/com/cloud/agent/api/routing/SetStaticNatRulesCommand.java index a38bf5f22ff..64c76605765 100644 --- a/core/src/com/cloud/agent/api/routing/SetStaticNatRulesCommand.java +++ b/core/src/com/cloud/agent/api/routing/SetStaticNatRulesCommand.java @@ -16,10 +16,10 @@ // under the License. package com.cloud.agent.api.routing; -import java.util.List; - import com.cloud.agent.api.to.StaticNatRuleTO; +import java.util.List; + public class SetStaticNatRulesCommand extends NetworkElementCommand { StaticNatRuleTO[] rules; @@ -44,4 +44,9 @@ public class SetStaticNatRulesCommand extends NetworkElementCommand { public Long getVpcId() { return vpcId; } + + @Override + public int getAnswersCount() { + return rules.length; + } } diff --git a/core/src/com/cloud/agent/api/routing/SetStaticRouteAnswer.java b/core/src/com/cloud/agent/api/routing/SetStaticRouteAnswer.java index abdcba86c6f..cf2b95288fe 100644 --- a/core/src/com/cloud/agent/api/routing/SetStaticRouteAnswer.java +++ b/core/src/com/cloud/agent/api/routing/SetStaticRouteAnswer.java @@ -16,6 +16,8 @@ // under the License. package com.cloud.agent.api.routing; +import java.util.Arrays; + import com.cloud.agent.api.Answer; public class SetStaticRouteAnswer extends Answer { @@ -26,11 +28,16 @@ public class SetStaticRouteAnswer extends Answer { public SetStaticRouteAnswer(SetStaticRouteCommand cmd, boolean success, String[] results) { super(cmd, success, null); - assert (cmd.getStaticRoutes().length == results.length) : "Static routes and their results should be the same length"; - this.results = results; + if (results != null) { + assert (cmd.getStaticRoutes().length == results.length) : "Static routes and their results should be the same length"; + this.results = Arrays.copyOf(results, results.length); + } } public String[] getResults() { - return results; + if (results != null) { + return Arrays.copyOf(results, results.length); + } + return null; } } diff --git a/core/src/com/cloud/agent/api/routing/SetStaticRouteCommand.java b/core/src/com/cloud/agent/api/routing/SetStaticRouteCommand.java index 26800a115a1..1e4f0c86e0f 100644 --- a/core/src/com/cloud/agent/api/routing/SetStaticRouteCommand.java +++ b/core/src/com/cloud/agent/api/routing/SetStaticRouteCommand.java @@ -17,14 +17,14 @@ package com.cloud.agent.api.routing; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - import com.cloud.network.vpc.StaticRoute; import com.cloud.network.vpc.StaticRouteProfile; import com.cloud.utils.net.NetUtils; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + public class SetStaticRouteCommand extends NetworkElementCommand { StaticRouteProfile[] staticRoutes; @@ -59,4 +59,9 @@ public class SetStaticRouteCommand extends NetworkElementCommand { result[0] = toAdd.toArray(new String[toAdd.size()]); return result; } + + @Override + public int getAnswersCount() { + return staticRoutes.length; + } } diff --git a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java index 1ed38644536..9bebd4c635e 100755 --- a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java +++ b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java @@ -22,36 +22,28 @@ import com.cloud.agent.api.CheckRouterAnswer; import com.cloud.agent.api.CheckRouterCommand; import com.cloud.agent.api.CheckS2SVpnConnectionsAnswer; import com.cloud.agent.api.CheckS2SVpnConnectionsCommand; -import com.cloud.agent.api.Command; import com.cloud.agent.api.GetDomRVersionAnswer; import com.cloud.agent.api.GetDomRVersionCmd; -import com.cloud.agent.api.SetupGuestNetworkAnswer; import com.cloud.agent.api.SetupGuestNetworkCommand; import com.cloud.agent.api.routing.CreateIpAliasCommand; import com.cloud.agent.api.routing.DeleteIpAliasCommand; import com.cloud.agent.api.routing.DhcpEntryCommand; import com.cloud.agent.api.routing.DnsMasqConfigCommand; +import com.cloud.agent.api.routing.GroupAnswer; import com.cloud.agent.api.routing.IpAliasTO; -import com.cloud.agent.api.routing.IpAssocAnswer; import com.cloud.agent.api.routing.IpAssocCommand; import com.cloud.agent.api.routing.IpAssocVpcCommand; import com.cloud.agent.api.routing.LoadBalancerConfigCommand; import com.cloud.agent.api.routing.NetworkElementCommand; import com.cloud.agent.api.routing.RemoteAccessVpnCfgCommand; import com.cloud.agent.api.routing.SavePasswordCommand; -import com.cloud.agent.api.routing.SetFirewallRulesAnswer; import com.cloud.agent.api.routing.SetFirewallRulesCommand; import com.cloud.agent.api.routing.SetMonitorServiceCommand; -import com.cloud.agent.api.routing.SetNetworkACLAnswer; import com.cloud.agent.api.routing.SetNetworkACLCommand; -import com.cloud.agent.api.routing.SetPortForwardingRulesAnswer; import com.cloud.agent.api.routing.SetPortForwardingRulesCommand; import com.cloud.agent.api.routing.SetPortForwardingRulesVpcCommand; -import com.cloud.agent.api.routing.SetSourceNatAnswer; import com.cloud.agent.api.routing.SetSourceNatCommand; -import com.cloud.agent.api.routing.SetStaticNatRulesAnswer; import com.cloud.agent.api.routing.SetStaticNatRulesCommand; -import com.cloud.agent.api.routing.SetStaticRouteAnswer; import com.cloud.agent.api.routing.SetStaticRouteCommand; import com.cloud.agent.api.routing.Site2SiteVpnCfgCommand; import com.cloud.agent.api.routing.VmDataCommand; @@ -77,6 +69,7 @@ import java.io.IOException; import java.net.InetSocketAddress; import java.nio.channels.SocketChannel; import java.util.HashMap; +import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -89,6 +82,37 @@ import java.util.Map; * } **/ public class VirtualRoutingResource { + protected class VRScripts { + protected static final String S2SVPN_CHECK = "checkbatchs2svpn.sh"; + protected static final String S2SVPN_IPSEC = "ipsectunnel.sh"; + protected static final String DHCP = "edithosts.sh"; + protected static final String DNSMASQ_CONFIG = "dnsmasq.sh"; + protected static final String FIREWALL_EGRESS = "firewall_egress.sh"; + protected static final String FIREWALL_INGRESS = "firewall_ingress.sh"; + protected static final String FIREWALL_NAT = "firewall_nat.sh"; + protected static final String IPALIAS_CREATE = "createipAlias.sh"; + protected static final String IPALIAS_DELETE = "deleteipAlias.sh"; + protected static final String IPASSOC = "ipassoc.sh"; + protected static final String LB = "loadbalancer.sh"; + protected static final String MONITOR_SERVICE = "monitor_service.sh"; + protected static final String PASSWORD = "savepassword.sh"; + protected static final String RVR_CHECK = "checkrouter.sh"; + protected static final String RVR_BUMPUP_PRI = "bumpup_priority.sh"; + protected static final String VMDATA = "vmdata.py"; + protected static final String VERSION = "get_template_version.sh"; + protected static final String VPC_ACL = "vpc_acl.sh"; + protected static final String VPC_GUEST_NETWORK = "vpc_guestnw.sh"; + protected static final String VPC_IPASSOC = "vpc_ipassoc.sh"; + protected static final String VPC_LB = "vpc_loadbalancer.sh"; + protected static final String VPC_PRIVATEGW = "vpc_privateGateway.sh"; + protected static final String VPC_PRIVATEGW_ACL = "vpc_privategw_acl.sh"; + protected static final String VPC_PORTFORWARDING = "vpc_portforwarding.sh"; + protected static final String VPC_SOURCE_NAT = "vpc_snat.sh"; + protected static final String VPC_STATIC_NAT = "vpc_staticnat.sh"; + protected static final String VPC_STATIC_ROUTE = "vpc_staticroute.sh"; + protected static final String VPN_L2TP = "vpn_l2tp.sh"; + } + private static final Logger s_logger = Logger.getLogger(VirtualRoutingResource.class); private VirtualRouterDeployer _vrDeployer; @@ -101,78 +125,221 @@ public class VirtualRoutingResource { this._vrDeployer = deployer; } - public Answer executeRequest(final Command cmd) { + public Answer executeRequest(final NetworkElementCommand cmd) { try { - ExecutionResult rc = _vrDeployer.prepareCommand((NetworkElementCommand)cmd); + ExecutionResult rc = _vrDeployer.prepareCommand(cmd); if (!rc.isSuccess()) { s_logger.error("Failed to prepare VR command due to " + rc.getDetails()); return new Answer(cmd, false, rc.getDetails()); } + assert cmd.getRouterAccessIp() != null : "Why there is no access IP for VR?"; + + if (cmd.isQuery()) { + return executeQueryCommand(cmd); + } + + List cfg; if (cmd instanceof SetPortForwardingRulesVpcCommand) { - return execute((SetPortForwardingRulesVpcCommand)cmd); + cfg = generateConfig((SetPortForwardingRulesVpcCommand)cmd); } else if (cmd instanceof SetPortForwardingRulesCommand) { - return execute((SetPortForwardingRulesCommand)cmd); + cfg = generateConfig((SetPortForwardingRulesCommand)cmd); } else if (cmd instanceof SetStaticRouteCommand) { - return execute((SetStaticRouteCommand)cmd); + cfg = generateConfig((SetStaticRouteCommand)cmd); } else if (cmd instanceof SetStaticNatRulesCommand) { - return execute((SetStaticNatRulesCommand)cmd); + cfg = generateConfig((SetStaticNatRulesCommand)cmd); } else if (cmd instanceof LoadBalancerConfigCommand) { - return execute((LoadBalancerConfigCommand)cmd); + cfg = generateConfig((LoadBalancerConfigCommand)cmd); } else if (cmd instanceof SavePasswordCommand) { - return execute((SavePasswordCommand)cmd); + cfg = generateConfig((SavePasswordCommand)cmd); } else if (cmd instanceof DhcpEntryCommand) { - return execute((DhcpEntryCommand)cmd); + cfg = generateConfig((DhcpEntryCommand)cmd); } else if (cmd instanceof CreateIpAliasCommand) { - return execute((CreateIpAliasCommand)cmd); + cfg = generateConfig((CreateIpAliasCommand)cmd); } else if (cmd instanceof DnsMasqConfigCommand) { - return execute((DnsMasqConfigCommand)cmd); + cfg = generateConfig((DnsMasqConfigCommand)cmd); } else if (cmd instanceof DeleteIpAliasCommand) { - return execute((DeleteIpAliasCommand)cmd); + cfg = generateConfig((DeleteIpAliasCommand)cmd); } else if (cmd instanceof VmDataCommand) { - return execute((VmDataCommand)cmd); - } else if (cmd instanceof CheckRouterCommand) { - return execute((CheckRouterCommand)cmd); + cfg = generateConfig((VmDataCommand)cmd); } else if (cmd instanceof SetFirewallRulesCommand) { - return execute((SetFirewallRulesCommand)cmd); + cfg = generateConfig((SetFirewallRulesCommand)cmd); } else if (cmd instanceof BumpUpPriorityCommand) { - return execute((BumpUpPriorityCommand)cmd); + cfg = generateConfig((BumpUpPriorityCommand)cmd); } else if (cmd instanceof RemoteAccessVpnCfgCommand) { - return execute((RemoteAccessVpnCfgCommand)cmd); + cfg = generateConfig((RemoteAccessVpnCfgCommand)cmd); } else if (cmd instanceof VpnUsersCfgCommand) { - return execute((VpnUsersCfgCommand)cmd); - } else if (cmd instanceof GetDomRVersionCmd) { - return execute((GetDomRVersionCmd)cmd); + cfg = generateConfig((VpnUsersCfgCommand)cmd); } else if (cmd instanceof Site2SiteVpnCfgCommand) { - return execute((Site2SiteVpnCfgCommand)cmd); - } else if (cmd instanceof CheckS2SVpnConnectionsCommand) { - return execute((CheckS2SVpnConnectionsCommand)cmd); + cfg = generateConfig((Site2SiteVpnCfgCommand)cmd); } else if (cmd instanceof SetMonitorServiceCommand) { - return execute((SetMonitorServiceCommand)cmd); + cfg = generateConfig((SetMonitorServiceCommand)cmd); } else if (cmd instanceof SetupGuestNetworkCommand) { - return execute((SetupGuestNetworkCommand)cmd); + cfg = generateConfig((SetupGuestNetworkCommand)cmd); } else if (cmd instanceof SetNetworkACLCommand) { - return execute((SetNetworkACLCommand)cmd); + cfg = generateConfig((SetNetworkACLCommand)cmd); } else if (cmd instanceof SetSourceNatCommand) { - return execute((SetSourceNatCommand)cmd); - } else if (cmd instanceof IpAssocVpcCommand) { - return execute((IpAssocVpcCommand)cmd); + cfg = generateConfig((SetSourceNatCommand)cmd); } else if (cmd instanceof IpAssocCommand) { - return execute((IpAssocCommand)cmd); + cfg = generateConfig((IpAssocCommand)cmd); } else { return Answer.createUnsupportedCommandAnswer(cmd); } + + return applyConfig(cmd, cfg); } catch (final IllegalArgumentException e) { return new Answer(cmd, false, e.getMessage()); } finally { - ExecutionResult rc = _vrDeployer.cleanupCommand((NetworkElementCommand)cmd); + ExecutionResult rc = _vrDeployer.cleanupCommand(cmd); if (!rc.isSuccess()) { s_logger.error("Failed to cleanup VR command due to " + rc.getDetails()); } } } - private Answer execute(VpnUsersCfgCommand cmd) { + protected class ConfigItem { + private String script; + private String args; + private String info; + private String filePath; + private String fileName; + private String fileContents; + private boolean isFile; + + public ConfigItem(String script, String args) { + this.script = script; + this.args = args; + this.isFile = false; + } + + public ConfigItem(String filePath, String fileName, String fileContents) { + this.filePath = filePath; + this.fileName = fileName; + this.fileContents = fileContents; + this.isFile = true; + } + + public String getScript() { + return script; + } + + public void setScript(String script) { + this.script = script; + } + + public String getArgs() { + return args; + } + + public void setArgs(String args) { + this.args = args; + } + + public String getInfo() { + return info; + } + + public void setInfo(String info) { + this.info = info; + } + + public String getFilePath() { + return filePath; + } + + public void setFilePath(String filePath) { + this.filePath = filePath; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getFileContents() { + return fileContents; + } + + public void setFileContents(String fileContents) { + this.fileContents = fileContents; + } + + public boolean isFile() { + return isFile; + } + } + + private Answer executeQueryCommand(NetworkElementCommand cmd) { + if (cmd instanceof CheckRouterCommand) { + return execute((CheckRouterCommand)cmd); + } else if (cmd instanceof GetDomRVersionCmd) { + return execute((GetDomRVersionCmd)cmd); + } else if (cmd instanceof CheckS2SVpnConnectionsCommand) { + return execute((CheckS2SVpnConnectionsCommand)cmd); + } else { + s_logger.error("Unknown query command in VirtualRoutingResource!"); + return Answer.createUnsupportedCommandAnswer(cmd); + } + } + + private ExecutionResult applyConfigToVR(NetworkElementCommand cmd, ConfigItem c) { + if (c.isFile()) { + return _vrDeployer.createFileInVR(cmd.getRouterAccessIp(), c.getFilePath(), c.getFileName(), c.getFileContents()); + } else { + return _vrDeployer.executeInVR(cmd.getRouterAccessIp(), c.getScript(), c.getArgs()); + } + } + + private Answer applyConfig(NetworkElementCommand cmd, List cfg) { + int answersCount = cmd.getAnswersCount(); + + // Use the last answer as final answer + if (answersCount == 1) { + ExecutionResult result = new ExecutionResult(true, "No configure to be applied"); + for (ConfigItem c : cfg) { + result = applyConfigToVR(cmd, c); + if (!result.isSuccess()) { + break; + } + } + return new Answer(cmd, result.isSuccess(), result.getDetails()); + } + + ExecutionResult[] results = new ExecutionResult[answersCount]; + String[] resultsString = new String[answersCount]; + boolean finalResult = true; + int i = 0, j; + for (ConfigItem c : cfg) { + results[i] = applyConfigToVR(cmd, c); + if (c.getInfo() != null) { + if (results[i].isSuccess()) { + results[i].setDetails(c.getInfo() + " - success: " + results[i].getDetails()); + } else { + results[i].setDetails(c.getInfo() + " - failed: " + results[i].getDetails()); + } + } + i ++; + } + i = 0; j = 0; + while (j < answersCount) { + resultsString[j] = results[i].getDetails(); + if (!results[i].isSuccess()) { + finalResult = false; + } + // Fill the resultsString with the last result of execution, mostly in 1:n + if (i < cfg.size() - 1) { + i ++; + } + j ++; + } + return new GroupAnswer(cmd, finalResult, answersCount, resultsString); + } + + private List generateConfig(VpnUsersCfgCommand cmd) { + LinkedList cfg = new LinkedList<>(); for (VpnUsersCfgCommand.UsernamePassword userpwd : cmd.getUserpwds()) { String args = ""; if (!userpwd.isAdd()) { @@ -182,15 +349,13 @@ public class VirtualRoutingResource { args += "-u "; args += userpwd.getUsernamePassword(); } - ExecutionResult result = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), "vpn_l2tp.sh", args); - if (!result.isSuccess()) { - return new Answer(cmd, false, "Configure VPN user failed for user " + userpwd.getUsername() + ":" + result.getDetails()); - } + cfg.add(new ConfigItem(VRScripts.VPN_L2TP, args)); } - return new Answer(cmd); + return cfg; } - private Answer execute(RemoteAccessVpnCfgCommand cmd) { + private List generateConfig(RemoteAccessVpnCfgCommand cmd) { + LinkedList cfg = new LinkedList<>(); String args = ""; if (cmd.isCreate()) { args += "-r "; @@ -209,18 +374,14 @@ public class VirtualRoutingResource { } args += " -C " + cmd.getLocalCidr(); args += " -i " + cmd.getPublicInterface(); - ExecutionResult result = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), "vpn_l2tp.sh", args); - return new Answer(cmd, result.isSuccess(), result.getDetails()); + cfg.add(new ConfigItem(VRScripts.VPN_L2TP, args)); + return cfg; } - private Answer execute(SetFirewallRulesCommand cmd) { - String[] results = new String[cmd.getRules().length]; - String routerAccessIp = cmd.getRouterAccessIp(); - String egressDefault = cmd.getAccessDetail(NetworkElementCommand.FIREWALL_EGRESS_DEFAULT); + private List generateConfig(SetFirewallRulesCommand cmd) { + LinkedList cfg = new LinkedList<>(); - if (routerAccessIp == null) { - return new SetFirewallRulesAnswer(cmd, false, results); - } + String egressDefault = cmd.getAccessDetail(NetworkElementCommand.FIREWALL_EGRESS_DEFAULT); FirewallRuleTO[] allrules = cmd.getRules(); FirewallRule.TrafficType trafficType = allrules[0].getTrafficType(); @@ -248,116 +409,69 @@ public class VirtualRoutingResource { args += " -a " + sb.toString(); } - ExecutionResult result; - if (trafficType == FirewallRule.TrafficType.Egress) { - result = _vrDeployer.executeInVR(routerAccessIp, "firewall_egress.sh", args); + cfg.add(new ConfigItem(VRScripts.FIREWALL_EGRESS, args)); } else { - result = _vrDeployer.executeInVR(routerAccessIp, "firewall_ingress.sh", args); + cfg.add(new ConfigItem(VRScripts.FIREWALL_INGRESS, args)); } - if (!result.isSuccess()) { - //FIXME - in the future we have to process each rule separately; now we temporarily set every rule to be false if single rule fails - for (int i = 0; i < results.length; i++) { - results[i] = "Failed: " + result.getDetails(); - } - return new SetFirewallRulesAnswer(cmd, false, results); - } - return new SetFirewallRulesAnswer(cmd, true, results); - + return cfg; } - private Answer execute(SetPortForwardingRulesCommand cmd) { - String[] results = new String[cmd.getRules().length]; - int i = 0; - boolean endResult = true; + private List generateConfig(SetPortForwardingRulesCommand cmd) { + LinkedList cfg = new LinkedList<>(); + for (PortForwardingRuleTO rule : cmd.getRules()) { StringBuilder args = new StringBuilder(); - args.append(rule.revoked() ? " -D " : " -A "); + args.append(rule.revoked() ? "-D" : "-A"); args.append(" -P ").append(rule.getProtocol().toLowerCase()); args.append(" -l ").append(rule.getSrcIp()); args.append(" -p ").append(rule.getStringSrcPortRange()); args.append(" -r ").append(rule.getDstIp()); args.append(" -d ").append(rule.getStringDstPortRange()); - - ExecutionResult result = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), "firewall_nat.sh", args.toString()); - - if (!result.isSuccess()) { - results[i++] = "Failed"; - endResult = false; - } else { - results[i++] = null; - } + cfg.add(new ConfigItem(VRScripts.FIREWALL_NAT, args.toString())); } - return new SetPortForwardingRulesAnswer(cmd, results, endResult); + return cfg; } - protected SetStaticNatRulesAnswer SetVPCStaticNatRules(SetStaticNatRulesCommand cmd) { - String[] results = new String[cmd.getRules().length]; - int i = 0; - boolean endResult = true; - - for (StaticNatRuleTO rule : cmd.getRules()) { - String args = rule.revoked() ? " -D" : " -A"; - args += " -l " + rule.getSrcIp(); - args += " -r " + rule.getDstIp(); - - ExecutionResult result = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), "vpc_staticnat.sh", args); - - if (!result.isSuccess()) { - results[i++] = null; - } else { - results[i++] = "Failed"; - endResult = false; - } - } - return new SetStaticNatRulesAnswer(cmd, results, endResult); - - } - - private SetStaticNatRulesAnswer execute(SetStaticNatRulesCommand cmd) { + private List generateConfig(SetStaticNatRulesCommand cmd) { + LinkedList cfg = new LinkedList<>(); if (cmd.getVpcId() != null) { - return SetVPCStaticNatRules(cmd); - } - String[] results = new String[cmd.getRules().length]; - int i = 0; - boolean endResult = true; - for (StaticNatRuleTO rule : cmd.getRules()) { - //1:1 NAT needs instanceip;publicip;domrip;op - StringBuilder args = new StringBuilder(); - args.append(rule.revoked() ? " -D " : " -A "); - args.append(" -l ").append(rule.getSrcIp()); - args.append(" -r ").append(rule.getDstIp()); + for (StaticNatRuleTO rule : cmd.getRules()) { + String args = rule.revoked() ? " -D" : " -A"; + args += " -l " + rule.getSrcIp(); + args += " -r " + rule.getDstIp(); - if (rule.getProtocol() != null) { - args.append(" -P ").append(rule.getProtocol().toLowerCase()); + cfg.add(new ConfigItem(VRScripts.VPC_STATIC_NAT, args)); } + } else { + for (StaticNatRuleTO rule : cmd.getRules()) { + //1:1 NAT needs instanceip;publicip;domrip;op + StringBuilder args = new StringBuilder(); + args.append(rule.revoked() ? " -D " : " -A "); + args.append(" -l ").append(rule.getSrcIp()); + args.append(" -r ").append(rule.getDstIp()); - args.append(" -d ").append(rule.getStringSrcPortRange()); - args.append(" -G "); + if (rule.getProtocol() != null) { + args.append(" -P ").append(rule.getProtocol().toLowerCase()); + } - ExecutionResult result = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), "firewall_nat.sh", args.toString()); + args.append(" -d ").append(rule.getStringSrcPortRange()); + args.append(" -G "); - if (!result.isSuccess()) { - results[i++] = "Failed"; - endResult = false; - } else { - results[i++] = null; + cfg.add(new ConfigItem(VRScripts.FIREWALL_NAT, args.toString())); } } - - return new SetStaticNatRulesAnswer(cmd, results, endResult); + return cfg; } - private Answer execute(LoadBalancerConfigCommand cmd) { + private List generateConfig(LoadBalancerConfigCommand cmd) { + LinkedList cfg = new LinkedList<>(); + String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); - - if (routerIp == null) { - return new Answer(cmd); - } - LoadBalancerConfigurator cfgtr = new HAProxyConfigurator(); + String[] config = cfgtr.generateConfiguration(cmd); String tmpCfgFileContents = ""; for (int i = 0; i < config.length; i++) { @@ -366,12 +480,8 @@ public class VirtualRoutingResource { } String tmpCfgFilePath = "/etc/haproxy/"; - String tmpCfgFileName = "haproxy.cfg.new"; - ExecutionResult result = _vrDeployer.createFileInVR(cmd.getRouterAccessIp(), tmpCfgFilePath, tmpCfgFileName, tmpCfgFileContents); - - if (!result.isSuccess()) { - return new Answer(cmd, false, "Fail to copy LB config file to VR"); - } + String tmpCfgFileName = "haproxy.cfg.new." + String.valueOf(System.currentTimeMillis()); + cfg.add(new ConfigItem(tmpCfgFilePath, tmpCfgFileName, tmpCfgFileContents)); String[][] rules = cfgtr.generateFwRules(cmd); @@ -379,7 +489,7 @@ public class VirtualRoutingResource { String[] removeRules = rules[LoadBalancerConfigurator.REMOVE]; String[] statRules = rules[LoadBalancerConfigurator.STATS]; - String args = ""; + String args = " -f " + tmpCfgFilePath + tmpCfgFileName; StringBuilder sb = new StringBuilder(); if (addRules.length > 0) { for (int i = 0; i < addRules.length; i++) { @@ -408,17 +518,17 @@ public class VirtualRoutingResource { if (cmd.getVpcId() == null) { args = " -i " + routerIp + args; - result = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), "loadbalancer.sh", args); + cfg.add(new ConfigItem(VRScripts.LB, args)); } else { args = " -i " + cmd.getNic().getIp() + args; - result = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), "vpc_loadbalancer.sh", args); + cfg.add(new ConfigItem(VRScripts.VPC_LB, args)); } - return new Answer(cmd, result.isSuccess(), result.getDetails()); + return cfg; } - - protected Answer execute(VmDataCommand cmd) { + private List generateConfig(VmDataCommand cmd) { + LinkedList cfg = new LinkedList<>(); Map> data = new HashMap>(); data.put(cmd.getVmIpAddress(), cmd.getVmData()); @@ -429,23 +539,26 @@ public class VirtualRoutingResource { String args = "-d " + json; - final ExecutionResult result = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), "vmdata.py", args); - return new Answer(cmd, result.isSuccess(), result.getDetails()); + cfg.add(new ConfigItem(VRScripts.VMDATA, args)); + return cfg; } - protected Answer execute(final SavePasswordCommand cmd) { + private List generateConfig(SavePasswordCommand cmd) { + LinkedList cfg = new LinkedList<>(); + final String password = cmd.getPassword(); - final String routerPrivateIPAddress = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); final String vmIpAddress = cmd.getVmIpAddress(); String args = "-v " + vmIpAddress; args += " -p " + password; - ExecutionResult result = _vrDeployer.executeInVR(routerPrivateIPAddress, "savepassword.sh", args); - return new Answer(cmd, result.isSuccess(), result.getDetails()); + cfg.add(new ConfigItem(VRScripts.PASSWORD, args)); + return cfg; } - protected Answer execute(final DhcpEntryCommand cmd) { + private List generateConfig(DhcpEntryCommand cmd) { + LinkedList cfg = new LinkedList<>(); + String args = " -m " + cmd.getVmMac(); if (cmd.getVmIpAddress() != null) { args += " -4 " + cmd.getVmIpAddress(); @@ -472,22 +585,27 @@ public class VirtualRoutingResource { if (!cmd.isDefault()) { args += " -N"; } + cfg.add(new ConfigItem(VRScripts.DHCP, args)); - final ExecutionResult result = _vrDeployer.executeInVR(cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), "edithosts.sh", args); - return new Answer(cmd, result.isSuccess(), result.getDetails()); + return cfg; } - protected Answer execute(final CreateIpAliasCommand cmd) { + private List generateConfig(CreateIpAliasCommand cmd) { + LinkedList cfg = new LinkedList<>(); + List ipAliasTOs = cmd.getIpAliasList(); String args = ""; for (IpAliasTO ipaliasto : ipAliasTOs) { args = args + ipaliasto.getAlias_count() + ":" + ipaliasto.getRouterip() + ":" + ipaliasto.getNetmask() + "-"; } - final ExecutionResult result = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), "createipAlias.sh", args); - return new Answer(cmd, result.isSuccess(), result.getDetails()); + + cfg.add(new ConfigItem(VRScripts.IPALIAS_CREATE, args)); + return cfg; } - protected Answer execute(final DeleteIpAliasCommand cmd) { + private List generateConfig(DeleteIpAliasCommand cmd) { + LinkedList cfg = new LinkedList<>(); + String args = ""; List revokedIpAliasTOs = cmd.getDeleteIpAliasTos(); for (IpAliasTO ipAliasTO : revokedIpAliasTOs) { @@ -499,51 +617,50 @@ public class VirtualRoutingResource { for (IpAliasTO ipAliasTO : activeIpAliasTOs) { args = args + ipAliasTO.getAlias_count() + ":" + ipAliasTO.getRouterip() + ":" + ipAliasTO.getNetmask() + "-"; } - final ExecutionResult result = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), "deleteipAlias.sh", args); - return new Answer(cmd, result.isSuccess(), result.getDetails()); + + cfg.add(new ConfigItem(VRScripts.IPALIAS_DELETE, args)); + return cfg; } - protected Answer execute(final DnsMasqConfigCommand cmd) { + private List generateConfig(DnsMasqConfigCommand cmd) { + LinkedList cfg = new LinkedList<>(); + List dhcpTos = cmd.getIps(); String args = ""; for (DhcpTO dhcpTo : dhcpTos) { args = args + dhcpTo.getRouterIp() + ":" + dhcpTo.getGateway() + ":" + dhcpTo.getNetmask() + ":" + dhcpTo.getStartIpOfSubnet() + "-"; } - final ExecutionResult result = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), "dnsmasq.sh", args); - return new Answer(cmd, result.isSuccess(), result.getDetails()); + + cfg.add(new ConfigItem(VRScripts.DNSMASQ_CONFIG, args)); + return cfg; } private CheckS2SVpnConnectionsAnswer execute(CheckS2SVpnConnectionsCommand cmd) { - final String routerIP = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); - String args = ""; for (String ip : cmd.getVpnIps()) { args += ip + " "; } - ExecutionResult result = _vrDeployer.executeInVR(routerIP, "checkbatchs2svpn.sh", args); + ExecutionResult result = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), VRScripts.S2SVPN_CHECK, args); return new CheckS2SVpnConnectionsAnswer(cmd, result.isSuccess(), result.getDetails()); } protected Answer execute(CheckRouterCommand cmd) { - final String routerPrivateIPAddress = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); - - final ExecutionResult result = _vrDeployer.executeInVR(routerPrivateIPAddress, "checkrouter.sh", null); + final ExecutionResult result = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), VRScripts.RVR_CHECK, null); if (!result.isSuccess()) { return new CheckRouterAnswer(cmd, result.getDetails()); } return new CheckRouterAnswer(cmd, result.getDetails(), true); } - protected Answer execute(BumpUpPriorityCommand cmd) { - ExecutionResult result = _vrDeployer.executeInVR(cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), "bumpup_priority.sh", null); - return new Answer(cmd, result.isSuccess(), result.getDetails()); + private List generateConfig(BumpUpPriorityCommand cmd) { + LinkedList cfg = new LinkedList<>(); + cfg.add(new ConfigItem(VRScripts.RVR_BUMPUP_PRI, null)); + return cfg; } protected Answer execute(GetDomRVersionCmd cmd) { - final String routerPrivateIPAddress = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); - - final ExecutionResult result = _vrDeployer.executeInVR(routerPrivateIPAddress, "get_template_version.sh", null); + final ExecutionResult result = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), VRScripts.VERSION, null); if (!result.isSuccess()) { return new GetDomRVersionAnswer(cmd, "GetDomRVersionCmd failed"); } @@ -554,7 +671,9 @@ public class VirtualRoutingResource { return new GetDomRVersionAnswer(cmd, result.getDetails(), lines[0], lines[1]); } - protected Answer execute(Site2SiteVpnCfgCommand cmd) { + private List generateConfig(Site2SiteVpnCfgCommand cmd) { + LinkedList cfg = new LinkedList<>(); + String args = ""; if (cmd.isCreate()) { args += "-A"; @@ -596,28 +715,30 @@ public class VirtualRoutingResource { args += " -N "; args += cmd.getPeerGuestCidrList(); } - ExecutionResult result = _vrDeployer.executeInVR(cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), "ipsectunnel.sh", args); - if (!result.isSuccess()) { - return new Answer(cmd, false, "Configure site to site VPN failed due to " + result.getDetails()); - } - return new Answer(cmd); + + cfg.add(new ConfigItem(VRScripts.S2SVPN_IPSEC, args)); + return cfg; } - protected Answer execute(SetMonitorServiceCommand cmd) { + protected List generateConfig(SetMonitorServiceCommand cmd) { + LinkedList cfg = new LinkedList<>(); + String config = cmd.getConfiguration(); + String disableMonitoring = cmd.getAccessDetail(NetworkElementCommand.ROUTER_MONITORING_ENABLE); String args = " -c " + config; - ExecutionResult result = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), "monitor_service.sh", args); - - if (!result.isSuccess()) { - return new Answer(cmd, false, result.getDetails()); + if (disableMonitoring != null) { + args = args + " -d"; } - return new Answer(cmd); + + cfg.add(new ConfigItem(VRScripts.MONITOR_SERVICE, args)); + return cfg; } - protected SetupGuestNetworkAnswer execute(SetupGuestNetworkCommand cmd) { + protected List generateConfig(SetupGuestNetworkCommand cmd) { + LinkedList cfg = new LinkedList<>(); + NicTO nic = cmd.getNic(); - String routerIP = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); String routerGIP = cmd.getAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP); String gateway = cmd.getAccessDetail(NetworkElementCommand.GUEST_NETWORK_GATEWAY); String cidr = Long.toString(NetUtils.getCidrSize(nic.getNetmask())); @@ -637,6 +758,7 @@ public class VirtualRoutingResource { String netmask = NetUtils.getSubNet(routerGIP, nic.getNetmask()); String args = " -C"; + args += " -M " + nic.getMac(); args += " -d " + dev; args += " -i " + routerGIP; args += " -g " + gateway; @@ -648,224 +770,171 @@ public class VirtualRoutingResource { if (domainName != null && !domainName.isEmpty()) { args += " -e " + domainName; } - ExecutionResult result = _vrDeployer.executeInVR(routerIP, "vpc_guestnw.sh", args); - if (!result.isSuccess()) { - return new SetupGuestNetworkAnswer(cmd, false, "Creating guest network failed due to " + result.getDetails()); - } - return new SetupGuestNetworkAnswer(cmd, true, "success"); + cfg.add(new ConfigItem(VRScripts.VPC_GUEST_NETWORK, args)); + return cfg; } - private SetNetworkACLAnswer execute(SetNetworkACLCommand cmd) { - String[] results = new String[cmd.getRules().length]; + protected List generateConfig(SetNetworkACLCommand cmd) { + LinkedList cfg = new LinkedList<>(); String privateGw = cmd.getAccessDetail(NetworkElementCommand.VPC_PRIVATE_GATEWAY); - try { - String[][] rules = cmd.generateFwRules(); - String[] aclRules = rules[0]; - NicTO nic = cmd.getNic(); - String dev = "eth" + nic.getDeviceId(); - String netmask = Long.toString(NetUtils.getCidrSize(nic.getNetmask())); - StringBuilder sb = new StringBuilder(); + String[][] rules = cmd.generateFwRules(); + String[] aclRules = rules[0]; + NicTO nic = cmd.getNic(); + String dev = "eth" + nic.getDeviceId(); + String netmask = Long.toString(NetUtils.getCidrSize(nic.getNetmask())); + StringBuilder sb = new StringBuilder(); - for (int i = 0; i < aclRules.length; i++) { - sb.append(aclRules[i]).append(','); - } - - String rule = sb.toString(); - ExecutionResult result; - - String args = " -d " + dev; - if (privateGw != null) { - args += " -a " + rule; - result = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), "vpc_privategw_acl.sh", args); - } else { - args += " -i " + nic.getIp(); - args += " -m " + netmask; - args += " -a " + rule; - result = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), "vpc_acl.sh", args); - } - - if (!result.isSuccess()) { - for (int i = 0; i < results.length; i++) { - results[i] = "Failed"; - } - return new SetNetworkACLAnswer(cmd, false, results); - } - - return new SetNetworkACLAnswer(cmd, true, results); - } catch (Exception e) { - String msg = "SetNetworkACL failed due to " + e.toString(); - s_logger.error(msg, e); - return new SetNetworkACLAnswer(cmd, false, results); + for (int i = 0; i < aclRules.length; i++) { + sb.append(aclRules[i]).append(','); } + + String rule = sb.toString(); + + String args = " -d " + dev; + args += " -M " + nic.getMac(); + if (privateGw != null) { + args += " -a " + rule; + + cfg.add(new ConfigItem(VRScripts.VPC_PRIVATEGW_ACL, args)); + } else { + args += " -i " + nic.getIp(); + args += " -m " + netmask; + args += " -a " + rule; + cfg.add(new ConfigItem(VRScripts.VPC_ACL, args)); + } + + return cfg; } - protected SetSourceNatAnswer execute(SetSourceNatCommand cmd) { - String routerIP = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); + protected List generateConfig(SetSourceNatCommand cmd) { + LinkedList cfg = new LinkedList<>(); + IpAddressTO pubIP = cmd.getIpAddress(); String dev = "eth" + pubIP.getNicDevId(); - String args = " -A "; + String args = "-A"; args += " -l "; args += pubIP.getPublicIp(); args += " -c "; args += dev; - ExecutionResult result = _vrDeployer.executeInVR(routerIP, "vpc_snat.sh", args); - return new SetSourceNatAnswer(cmd, result.isSuccess(), result.getDetails()); + + cfg.add(new ConfigItem(VRScripts.VPC_SOURCE_NAT, args)); + return cfg; } - private SetPortForwardingRulesAnswer execute(SetPortForwardingRulesVpcCommand cmd) { - String[] results = new String[cmd.getRules().length]; - int i = 0; + protected List generateConfig(SetPortForwardingRulesVpcCommand cmd) { + LinkedList cfg = new LinkedList<>(); - boolean endResult = true; for (PortForwardingRuleTO rule : cmd.getRules()) { - String args = rule.revoked() ? " -D" : " -A"; + String args = rule.revoked() ? "-D" : "-A"; args += " -P " + rule.getProtocol().toLowerCase(); args += " -l " + rule.getSrcIp(); args += " -p " + rule.getStringSrcPortRange(); args += " -r " + rule.getDstIp(); args += " -d " + rule.getStringDstPortRange().replace(":", "-"); - ExecutionResult result = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), "vpc_portforwarding.sh", args); - - if (!result.isSuccess()) { - results[i++] = "Failed"; - endResult = false; - } else { - results[i++] = null; - } + cfg.add(new ConfigItem(VRScripts.VPC_PORTFORWARDING, args)); } - return new SetPortForwardingRulesAnswer(cmd, results, endResult); + + return cfg; } - public IpAssocAnswer execute(IpAssocVpcCommand cmd) { - String routerIP = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); - String[] results = new String[cmd.getIpAddresses().length]; - String args = ""; - String snatArgs = ""; - for (int i = 0; i < cmd.getIpAddresses().length; i ++) { - results[i] = "Failed"; + protected List generateConfig(SetStaticRouteCommand cmd) { + LinkedList cfg = new LinkedList<>(); + + String[][] rules = cmd.generateSRouteRules(); + StringBuilder sb = new StringBuilder(); + String[] srRules = rules[0]; + + for (int i = 0; i < srRules.length; i++) { + sb.append(srRules[i]).append(','); } - int i = 0; - for (IpAddressTO ip : cmd.getIpAddresses()) { - if (ip.isAdd()) { - args += " -A "; - snatArgs += " -A "; - } else { - args += " -D "; - snatArgs += " -D "; - } + String args = " -a " + sb.toString(); - args += " -l "; - args += ip.getPublicIp(); - String nicName = "eth" + ip.getNicDevId(); - args += " -c "; - args += nicName; - args += " -g "; - args += ip.getVlanGateway(); - args += " -m "; - args += Long.toString(NetUtils.getCidrSize(ip.getVlanNetmask())); - args += " -n "; - args += NetUtils.getSubNet(ip.getPublicIp(), ip.getVlanNetmask()); + cfg.add(new ConfigItem(VRScripts.VPC_STATIC_ROUTE, args)); + return cfg; + } - ExecutionResult result = _vrDeployer.executeInVR(routerIP, "vpc_ipassoc.sh", args); - if (!result.isSuccess()) { - results[i++] = ip.getPublicIp() + " - vpc_ipassoc failed:" + result.getDetails(); - break; - } + protected List generateConfig(IpAssocCommand cmd) { + LinkedList cfg = new LinkedList<>(); + ConfigItem c; - if (ip.isSourceNat()) { - snatArgs += " -l " + ip.getPublicIp(); - snatArgs += " -c " + nicName; + if (cmd instanceof IpAssocVpcCommand) { + for (IpAddressTO ip : cmd.getIpAddresses()) { + String args = ""; + String snatArgs = ""; - result = _vrDeployer.executeInVR(routerIP, "vpc_privateGateway.sh", snatArgs); - if (result != null) { - results[i++] = ip.getPublicIp() + " - vpc_privateGateway failed:" + result.getDetails(); - break; + if (ip.isAdd()) { + args += " -A "; + snatArgs += " -A "; + } else { + args += " -D "; + snatArgs += " -D "; + } + + args += " -l "; + args += ip.getPublicIp(); + String nicName = "eth" + ip.getNicDevId(); + args += " -c "; + args += nicName; + args += " -g "; + args += ip.getVlanGateway(); + args += " -m "; + args += Long.toString(NetUtils.getCidrSize(ip.getVlanNetmask())); + args += " -n "; + args += NetUtils.getSubNet(ip.getPublicIp(), ip.getVlanNetmask()); + + c = new ConfigItem(VRScripts.VPC_IPASSOC, args); + c.setInfo(ip.getPublicIp() + " - vpc_ipassoc"); + cfg.add(c); + + if (ip.isSourceNat()) { + snatArgs += " -l " + ip.getPublicIp(); + snatArgs += " -c " + nicName; + + c = new ConfigItem(VRScripts.VPC_PRIVATEGW, snatArgs); + c.setInfo(ip.getPublicIp() + " - vpc_privategateway"); + cfg.add(c); } } - results[i++] = ip.getPublicIp() + " - success "; - } - return new IpAssocAnswer(cmd, results); - } - - private SetStaticRouteAnswer execute(SetStaticRouteCommand cmd) { - String routerIP = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); - try { - String[] results = new String[cmd.getStaticRoutes().length]; - String[][] rules = cmd.generateSRouteRules(); - StringBuilder sb = new StringBuilder(); - String[] srRules = rules[0]; - - for (int i = 0; i < srRules.length; i++) { - sb.append(srRules[i]).append(','); - } - - String args = " -a " + sb.toString(); - ExecutionResult result = _vrDeployer.executeInVR(routerIP, "vpc_staticroute.sh", args); - - if (!result.isSuccess()) { - for (int i = 0; i < results.length; i++) { - results[i] = "Failed"; + } else { + for (IpAddressTO ip: cmd.getIpAddresses()) { + String args = ""; + if (ip.isAdd()) { + args += "-A"; + } else { + args += "-D"; } - return new SetStaticRouteAnswer(cmd, false, results); - } + String cidrSize = Long.toString(NetUtils.getCidrSize(ip.getVlanNetmask())); + if (ip.isSourceNat()) { + args += " -s"; + } + if (ip.isFirstIP()) { + args += " -f"; + } + args += " -l "; + args += ip.getPublicIp() + "/" + cidrSize; - return new SetStaticRouteAnswer(cmd, true, results); - } catch (Exception e) { - String msg = "SetStaticRoute failed due to " + e.toString(); - s_logger.error(msg, e); - return new SetStaticRouteAnswer(cmd, false, null); - } - } + String publicNic = "eth" + ip.getNicDevId(); + args += " -c "; + args += publicNic; - public Answer execute(IpAssocCommand cmd) { - String[] results = new String[cmd.getIpAddresses().length]; - for (int i = 0; i < results.length; i++) { - results[i] = IpAssocAnswer.errorResult; - } + args += " -g "; + args += ip.getVlanGateway(); - int i = 0; - for (IpAddressTO ip: cmd.getIpAddresses()) { - String args = ""; - if (ip.isAdd()) { - args += "-A"; - } else { - args += "-D"; - } - String cidrSize = Long.toString(NetUtils.getCidrSize(ip.getVlanNetmask())); - if (ip.isSourceNat()) { - args += " -s"; - } - if (ip.isFirstIP()) { - args += " -f"; - } - args += " -l "; - args += ip.getPublicIp() + "/" + cidrSize; + if (ip.isNewNic()) { + args += " -n"; + } - String publicNic = "eth" + ip.getNicDevId(); - args += " -c "; - args += publicNic; - - args += " -g "; - args += ip.getVlanGateway(); - - if (ip.isNewNic()) { - args += " -n"; - } - - ExecutionResult result = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), "ipassoc.sh", args); - if (result.isSuccess()) { - results[i++] = ip.getPublicIp() + " - success"; - } else { - results[i++] = ip.getPublicIp() + " - failed:" + result.getDetails(); - break; + c = new ConfigItem(VRScripts.IPASSOC, args); + c.setInfo(ip.getPublicIp()); + cfg.add(c); } } - return new IpAssocAnswer(cmd, results); + return cfg; } public boolean configure(final String name, final Map params) throws ConfigurationException { diff --git a/core/test/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResourceTest.java b/core/test/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResourceTest.java new file mode 100644 index 00000000000..c980c9dbe52 --- /dev/null +++ b/core/test/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResourceTest.java @@ -0,0 +1,799 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.agent.resource.virtualnetwork; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.BumpUpPriorityCommand; +import com.cloud.agent.api.SetupGuestNetworkCommand; +import com.cloud.agent.api.routing.CreateIpAliasCommand; +import com.cloud.agent.api.routing.DeleteIpAliasCommand; +import com.cloud.agent.api.routing.DhcpEntryCommand; +import com.cloud.agent.api.routing.DnsMasqConfigCommand; +import com.cloud.agent.api.routing.GroupAnswer; +import com.cloud.agent.api.routing.IpAliasTO; +import com.cloud.agent.api.routing.IpAssocCommand; +import com.cloud.agent.api.routing.IpAssocVpcCommand; +import com.cloud.agent.api.routing.LoadBalancerConfigCommand; +import com.cloud.agent.api.routing.NetworkElementCommand; +import com.cloud.agent.api.routing.RemoteAccessVpnCfgCommand; +import com.cloud.agent.api.routing.SavePasswordCommand; +import com.cloud.agent.api.routing.SetFirewallRulesCommand; +import com.cloud.agent.api.routing.SetMonitorServiceCommand; +import com.cloud.agent.api.routing.SetNetworkACLCommand; +import com.cloud.agent.api.routing.SetPortForwardingRulesCommand; +import com.cloud.agent.api.routing.SetPortForwardingRulesVpcCommand; +import com.cloud.agent.api.routing.SetSourceNatCommand; +import com.cloud.agent.api.routing.SetStaticNatRulesCommand; +import com.cloud.agent.api.routing.SetStaticRouteCommand; +import com.cloud.agent.api.routing.Site2SiteVpnCfgCommand; +import com.cloud.agent.api.routing.VmDataCommand; +import com.cloud.agent.api.routing.VpnUsersCfgCommand; +import com.cloud.agent.api.to.DhcpTO; +import com.cloud.agent.api.to.FirewallRuleTO; +import com.cloud.agent.api.to.IpAddressTO; +import com.cloud.agent.api.to.LoadBalancerTO; +import com.cloud.agent.api.to.MonitorServiceTO; +import com.cloud.agent.api.to.NetworkACLTO; +import com.cloud.agent.api.to.NicTO; +import com.cloud.agent.api.to.PortForwardingRuleTO; +import com.cloud.agent.resource.virtualnetwork.VirtualRoutingResource.VRScripts; +import com.cloud.network.lb.LoadBalancingRule.LbDestination; +import com.cloud.network.rules.FirewallRule.Purpose; +import com.cloud.network.vpc.NetworkACLItem.TrafficType; +import com.cloud.network.vpc.VpcGateway; +import com.cloud.utils.ExecutionResult; +import com.cloud.utils.net.NetUtils; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import javax.naming.ConfigurationException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(loader = AnnotationConfigContextLoader.class) +public class VirtualRoutingResourceTest implements VirtualRouterDeployer { + VirtualRoutingResource _resource; + NetworkElementCommand _currentCmd; + int _count; + String _file; + + String ROUTERIP = "10.2.3.4"; + + @Override + public ExecutionResult executeInVR(String routerIp, String script, String args) { + assertEquals(routerIp, ROUTERIP); + verifyCommand(_currentCmd, script, args); + return new ExecutionResult(true, null); + } + + @Override + public ExecutionResult createFileInVR(String routerIp, String path, String filename, String content) { + assertEquals(routerIp, ROUTERIP); + verifyFile(_currentCmd, path, filename, content); + return new ExecutionResult(true, null); + } + + @Override + public ExecutionResult prepareCommand(NetworkElementCommand cmd) { + cmd.setRouterAccessIp(ROUTERIP); + _currentCmd = cmd; + if (cmd instanceof IpAssocVpcCommand) { + return prepareNetworkElementCommand((IpAssocVpcCommand)cmd); + } else if (cmd instanceof IpAssocCommand) { + return prepareNetworkElementCommand((IpAssocCommand)cmd); + } else if (cmd instanceof SetupGuestNetworkCommand) { + return prepareNetworkElementCommand((SetupGuestNetworkCommand)cmd); + } else if (cmd instanceof SetSourceNatCommand) { + return prepareNetworkElementCommand((SetSourceNatCommand)cmd); + } else if (cmd instanceof SetNetworkACLCommand) { + return prepareNetworkElementCommand((SetNetworkACLCommand)cmd); + } + return new ExecutionResult(true, null); + } + + @Override + public ExecutionResult cleanupCommand(NetworkElementCommand cmd) { + return new ExecutionResult(true, null); + } + + @Before + public void setup() { + _resource = new VirtualRoutingResource(this); + try { + _resource.configure("VRResource", new HashMap()); + } catch (ConfigurationException e) { + e.printStackTrace(); + } + } + + protected void verifyCommand(NetworkElementCommand cmd, String script, String args) { + if (cmd instanceof SetPortForwardingRulesVpcCommand) { + verifyArgs((SetPortForwardingRulesVpcCommand) cmd, script, args); + } else if (cmd instanceof SetPortForwardingRulesCommand) { + verifyArgs((SetPortForwardingRulesCommand) cmd, script, args); + } else if (cmd instanceof SetStaticRouteCommand) { + verifyArgs((SetStaticRouteCommand) cmd, script, args); + } else if (cmd instanceof SetStaticNatRulesCommand) { + verifyArgs((SetStaticNatRulesCommand) cmd, script, args); + } else if (cmd instanceof LoadBalancerConfigCommand) { + verifyArgs((LoadBalancerConfigCommand) cmd, script, args); + } else if (cmd instanceof SavePasswordCommand) { + verifyArgs((SavePasswordCommand)cmd, script, args); + } else if (cmd instanceof DhcpEntryCommand) { + verifyArgs((DhcpEntryCommand)cmd, script, args); + } else if (cmd instanceof CreateIpAliasCommand) { + verifyArgs((CreateIpAliasCommand)cmd, script, args); + } else if (cmd instanceof DnsMasqConfigCommand) { + verifyArgs((DnsMasqConfigCommand)cmd, script, args); + } else if (cmd instanceof DeleteIpAliasCommand) { + verifyArgs((DeleteIpAliasCommand)cmd, script, args); + } else if (cmd instanceof VmDataCommand) { + verifyArgs((VmDataCommand)cmd, script, args); + } else if (cmd instanceof SetFirewallRulesCommand) { + verifyArgs((SetFirewallRulesCommand)cmd, script, args); + } else if (cmd instanceof BumpUpPriorityCommand) { + verifyArgs((BumpUpPriorityCommand)cmd, script, args); + } else if (cmd instanceof RemoteAccessVpnCfgCommand) { + verifyArgs((RemoteAccessVpnCfgCommand)cmd, script, args); + } else if (cmd instanceof VpnUsersCfgCommand) { + verifyArgs((VpnUsersCfgCommand)cmd, script, args); + } else if (cmd instanceof Site2SiteVpnCfgCommand) { + verifyArgs((Site2SiteVpnCfgCommand)cmd, script, args); + } else if (cmd instanceof SetMonitorServiceCommand) { + verifyArgs((SetMonitorServiceCommand)cmd, script, args); + } else if (cmd instanceof SetupGuestNetworkCommand) { + verifyArgs((SetupGuestNetworkCommand)cmd, script, args); + } else if (cmd instanceof SetNetworkACLCommand) { + verifyArgs((SetNetworkACLCommand)cmd, script, args); + } else if (cmd instanceof SetSourceNatCommand) { + verifyArgs((SetSourceNatCommand)cmd, script, args); + } else if (cmd instanceof IpAssocCommand) { + verifyArgs((IpAssocCommand)cmd, script, args); + } + } + + private void verifyArgs(VpnUsersCfgCommand cmd, String script, String args) { + //To change body of created methods use File | Settings | File Templates. + } + + private void verifyArgs(SetStaticRouteCommand cmd, String script, String args) { + //To change body of created methods use File | Settings | File Templates. + } + + private void verifyArgs(SetStaticNatRulesCommand cmd, String script, String args) { + //To change body of created methods use File | Settings | File Templates. + } + + @Test + public void testBumpUpCommand() { + BumpUpPriorityCommand cmd = new BumpUpPriorityCommand(); + Answer answer = _resource.executeRequest(cmd); + assertTrue(answer.getResult()); + } + + private void verifyArgs(BumpUpPriorityCommand cmd, String script, String args) { + assertEquals(script, VRScripts.RVR_BUMPUP_PRI); + assertEquals(args, null); + } + + @Test + public void testSetPortForwardingRulesVpcCommand() { + List pfRules = new ArrayList<>(); + pfRules.add(new PortForwardingRuleTO(1, "64.1.1.10", 22, 80, "10.10.1.10", 22, 80, "TCP", false, false)); + pfRules.add(new PortForwardingRuleTO(2, "64.1.1.11", 8080, 8080, "10.10.1.11", 8080, 8080, "UDP", true, false)); + SetPortForwardingRulesVpcCommand cmd = new SetPortForwardingRulesVpcCommand(pfRules); + assertEquals(cmd.getAnswersCount(), 2); + + // Reset rule check count + _count = 0; + + Answer answer = _resource.executeRequest(cmd); + assertTrue(answer instanceof GroupAnswer); + assertEquals(((GroupAnswer) answer).getResults().length, 2); + assertTrue(answer.getResult()); + } + + private void verifyArgs(SetPortForwardingRulesVpcCommand cmd, String script, String args) { + assertTrue(script.equals(VRScripts.VPC_PORTFORWARDING)); + _count ++; + switch (_count) { + case 1: + assertEquals(args, "-A -P tcp -l 64.1.1.10 -p 22:80 -r 10.10.1.10 -d 22-80"); + break; + case 2: + assertEquals(args, "-D -P udp -l 64.1.1.11 -p 8080:8080 -r 10.10.1.11 -d 8080-8080"); + break; + default: + fail("Failed to recongize the match!"); + } + } + + @Test + public void testSetPortForwardingRulesCommand() { + List pfRules = new ArrayList<>(); + pfRules.add(new PortForwardingRuleTO(1, "64.1.1.10", 22, 80, "10.10.1.10", 22, 80, "TCP", false, false)); + pfRules.add(new PortForwardingRuleTO(2, "64.1.1.11", 8080, 8080, "10.10.1.11", 8080, 8080, "UDP", true, false)); + SetPortForwardingRulesCommand cmd = new SetPortForwardingRulesCommand(pfRules); + assertEquals(cmd.getAnswersCount(), 2); + + // Reset rule check count + _count = 0; + + Answer answer = _resource.executeRequest(cmd); + assertTrue(answer instanceof GroupAnswer); + assertEquals(((GroupAnswer) answer).getResults().length, 2); + assertTrue(answer.getResult()); + } + + private void verifyArgs(SetPortForwardingRulesCommand cmd, String script, String args) { + assertTrue(script.equals(VRScripts.FIREWALL_NAT)); + _count ++; + switch (_count) { + case 1: + assertEquals(args, "-A -P tcp -l 64.1.1.10 -p 22:80 -r 10.10.1.10 -d 22:80"); + break; + case 2: + assertEquals(args, "-D -P udp -l 64.1.1.11 -p 8080:8080 -r 10.10.1.11 -d 8080:8080"); + break; + default: + fail("Failed to recongize the match!"); + } + } + + @Test + public void testIpAssocCommand() { + List ips = new ArrayList(); + ips.add(new IpAddressTO(1, "64.1.1.10", true, true, true, "vlan://64", "64.1.1.1", "255.255.255.0", "01:23:45:67:89:AB", 1000, false)); + ips.add(new IpAddressTO(2, "64.1.1.11", false, false, false, "vlan://64", "64.1.1.1", "255.255.255.0", "01:23:45:67:89:AB", 1000, false)); + ips.add(new IpAddressTO(3, "65.1.1.11", true, false, false, "vlan://65", "65.1.1.1", "255.255.255.0", "11:23:45:67:89:AB", 1000, false)); + IpAddressTO[] ipArray = ips.toArray(new IpAddressTO[ips.size()]); + IpAssocCommand cmd = new IpAssocCommand(ipArray); + assertEquals(cmd.getAnswersCount(), 3); + + _count = 0; + + Answer answer = _resource.executeRequest(cmd); + assertTrue(answer instanceof GroupAnswer); + assertEquals(((GroupAnswer) answer).getResults().length, 3); + assertTrue(answer.getResult()); + + } + + private ExecutionResult prepareNetworkElementCommand(IpAssocCommand cmd) { + IpAddressTO[] ips = cmd.getIpAddresses(); + for (IpAddressTO ip : ips) { + ip.setNicDevId(2); + } + return new ExecutionResult(true, null); + } + + @Test + public void testIpAssocVpcCommand() { + List ips = new ArrayList(); + ips.add(new IpAddressTO(1, "64.1.1.10", true, true, true, "vlan://64", "64.1.1.1", "255.255.255.0", "01:23:45:67:89:AB", 1000, false)); + ips.add(new IpAddressTO(2, "64.1.1.11", false, false, true, "vlan://64", "64.1.1.1", "255.255.255.0", "01:23:45:67:89:AB", 1000, false)); + ips.add(new IpAddressTO(3, "65.1.1.11", true, false, false, "vlan://65", "65.1.1.1", "255.255.255.0", "11:23:45:67:89:AB", 1000, false)); + IpAddressTO[] ipArray = ips.toArray(new IpAddressTO[ips.size()]); + IpAssocVpcCommand cmd = new IpAssocVpcCommand(ipArray); + assertEquals(cmd.getAnswersCount(), 6); + + _count = 0; + + Answer answer = _resource.executeRequest(cmd); + assertTrue(answer instanceof GroupAnswer); + assertEquals(((GroupAnswer) answer).getResults().length, 6); + assertTrue(answer.getResult()); + + } + + private ExecutionResult prepareNetworkElementCommand(IpAssocVpcCommand cmd) { + IpAddressTO[] ips = cmd.getIpAddresses(); + for (IpAddressTO ip : ips) { + ip.setNicDevId(2); + } + return new ExecutionResult(true, null); + } + + private void verifyArgs(IpAssocCommand cmd, String script, String args) { + if (cmd instanceof IpAssocVpcCommand) { + _count ++; + switch (_count) { + case 1: + assertEquals(script, VRScripts.VPC_IPASSOC); + assertEquals(args, " -A -l 64.1.1.10 -c eth2 -g 64.1.1.1 -m 24 -n 64.1.1.0"); + break; + case 2: + assertEquals(script, VRScripts.VPC_PRIVATEGW); + assertEquals(args, " -A -l 64.1.1.10 -c eth2"); + break; + case 3: + assertEquals(script, VRScripts.VPC_IPASSOC); + assertEquals(args, " -D -l 64.1.1.11 -c eth2 -g 64.1.1.1 -m 24 -n 64.1.1.0"); + break; + case 4: + assertEquals(script, VRScripts.VPC_PRIVATEGW); + assertEquals(args, " -D -l 64.1.1.11 -c eth2"); + break; + case 5: + assertEquals(script, VRScripts.VPC_IPASSOC); + assertEquals(args, " -A -l 65.1.1.11 -c eth2 -g 65.1.1.1 -m 24 -n 65.1.1.0"); + break; + default: + fail("Failed to recongize the match!"); + } + } else { + assertEquals(script, VRScripts.IPASSOC); + _count ++; + switch (_count) { + case 1: + assertEquals(args, "-A -s -f -l 64.1.1.10/24 -c eth2 -g 64.1.1.1"); + break; + case 2: + assertEquals(args, "-D -l 64.1.1.11/24 -c eth2 -g 64.1.1.1"); + break; + case 3: + assertEquals(args, "-A -l 65.1.1.11/24 -c eth2 -g 65.1.1.1"); + break; + default: + fail("Failed to recongize the match!"); + } + } + } + + @Test + public void testSourceNatCommand() { + IpAddressTO ip = new IpAddressTO(1, "64.1.1.10", true, true, true, "vlan://64", "64.1.1.1", "255.255.255.0", "01:23:45:67:89:AB", 1000, false); + SetSourceNatCommand cmd = new SetSourceNatCommand(ip, true); + Answer answer = _resource.executeRequest(cmd); + assertTrue(answer.getResult()); + } + + private ExecutionResult prepareNetworkElementCommand(SetSourceNatCommand cmd) { + IpAddressTO ip = cmd.getIpAddress(); + ip.setNicDevId(1); + return new ExecutionResult(true, null); + } + + private void verifyArgs(SetSourceNatCommand cmd, String script, String args) { + assertEquals(script, VRScripts.VPC_SOURCE_NAT); + assertEquals(args, "-A -l 64.1.1.10 -c eth1"); + } + + @Test + public void testNetworkACLCommand() { + List acls = new ArrayList<>(); + List cidrs = new ArrayList<>(); + cidrs.add("192.168.0.1/24"); + cidrs.add("192.168.0.2/24"); + acls.add(new NetworkACLTO(1, "64", "TCP", 20, 80, false, false, cidrs, 0, 0, TrafficType.Ingress, true, 1)); + acls.add(new NetworkACLTO(2, "64", "ICMP", 0, 0, false, false, cidrs, -1, -1, TrafficType.Ingress, false, 2)); + acls.add(new NetworkACLTO(3, "65", "ALL", 0, 0, false, false, cidrs, -1, -1, TrafficType.Egress, true, 3)); + NicTO nic = new NicTO(); + nic.setMac("01:23:45:67:89:AB"); + nic.setIp("192.168.1.1"); + nic.setNetmask("255.255.255.0"); + + _count = 0; + + SetNetworkACLCommand cmd = new SetNetworkACLCommand(acls, nic); + Answer answer = _resource.executeRequest(cmd); + assertTrue(answer.getResult()); + + cmd.setAccessDetail(NetworkElementCommand.VPC_PRIVATE_GATEWAY, String.valueOf(VpcGateway.Type.Private)); + answer = _resource.executeRequest(cmd); + assertTrue(answer.getResult()); + } + + private void verifyArgs(SetNetworkACLCommand cmd, String script, String args) { + _count ++; + switch (_count) { + case 1: + assertEquals(script, VRScripts.VPC_ACL); + assertEquals(args, " -d eth3 -M 01:23:45:67:89:AB -i 192.168.1.1 -m 24 -a Egress:ALL:0:0:192.168.0.1/24-192.168.0.2/24:ACCEPT:," + + "Ingress:ICMP:0:0:192.168.0.1/24-192.168.0.2/24:DROP:,Ingress:TCP:20:80:192.168.0.1/24-192.168.0.2/24:ACCEPT:,"); + break; + case 2: + assertEquals(script, VRScripts.VPC_PRIVATEGW_ACL); + assertEquals(args, " -d eth3 -M 01:23:45:67:89:AB -a Egress:ALL:0:0:192.168.0.1/24-192.168.0.2/24:ACCEPT:," + + "Ingress:ICMP:0:0:192.168.0.1/24-192.168.0.2/24:DROP:,Ingress:TCP:20:80:192.168.0.1/24-192.168.0.2/24:ACCEPT:,"); + break; + default: + fail(); + } + } + + private ExecutionResult prepareNetworkElementCommand(SetNetworkACLCommand cmd) { + NicTO nic = cmd.getNic(); + nic.setDeviceId(3); + return new ExecutionResult(true, null); + } + + @Test + public void testSetupGuestNetworkCommand() { + NicTO nic = new NicTO(); + nic.setMac("01:23:45:67:89:AB"); + nic.setIp("10.1.1.1"); + nic.setNetmask("255.255.255.0"); + + SetupGuestNetworkCommand cmd = new SetupGuestNetworkCommand("10.1.1.10-10.1.1.20", "cloud.test", false, 0, "8.8.8.8", "8.8.4.4", true, nic); + cmd.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, "10.1.1.2"); + cmd.setAccessDetail(NetworkElementCommand.GUEST_NETWORK_GATEWAY, "10.1.1.1"); + + Answer answer = _resource.executeRequest(cmd); + assertTrue(answer.getResult()); + + } + + private ExecutionResult prepareNetworkElementCommand(SetupGuestNetworkCommand cmd) { + NicTO nic = cmd.getNic(); + nic.setDeviceId(4); + return new ExecutionResult(true, null); + } + + private void verifyArgs(SetupGuestNetworkCommand cmd, String script, String args) { + assertEquals(script, VRScripts.VPC_GUEST_NETWORK); + assertEquals(args, " -C -M 01:23:45:67:89:AB -d eth4 -i 10.1.1.2 -g 10.1.1.1 -m 24 -n 10.1.1.0 -s 8.8.8.8,8.8.4.4 -e cloud.test"); + } + + @Test + public void testSetMonitorServiceCommand() { + List services = new ArrayList<>(); + services.add(new MonitorServiceTO("service", "process", "name", "path", "file", true)); + services.add(new MonitorServiceTO("service_2", "process_2", "name_2", "path_2", "file_2", false)); + + SetMonitorServiceCommand cmd = new SetMonitorServiceCommand(services); + Answer answer = _resource.executeRequest(cmd); + assertTrue(answer.getResult()); + } + + private void verifyArgs(SetMonitorServiceCommand cmd, String script, String args) { + assertEquals(script, VRScripts.MONITOR_SERVICE); + assertEquals(args, " -c [service]:processname=process:servicename=name:pidfile=file:,[service_2]:processname=process_2:servicename=name_2:pidfile=file_2:,"); + } + + @Test + public void testSite2SiteVpnCfgCommand() { + _count = 0; + + Site2SiteVpnCfgCommand cmd = new Site2SiteVpnCfgCommand(true, "64.10.1.10", "64.10.1.1", "192.168.1.1/16", "124.10.1.10", "192.168.100.1/24", "3des-sha1,aes128-sha1;modp1536", "3des-sha1,aes128-md5", "psk", Long.valueOf(1800), Long.valueOf(1800), true, false); + Answer answer = _resource.executeRequest(cmd); + assertTrue(answer.getResult()); + + cmd = new Site2SiteVpnCfgCommand(true, "64.10.1.10", "64.10.1.1", "192.168.1.1/16", "124.10.1.10", "192.168.100.1/24", "3des-sha1,aes128-sha1;modp1536", "3des-sha1,aes128-md5", "psk", Long.valueOf(1800), Long.valueOf(1800), false, true); + answer = _resource.executeRequest(cmd); + assertTrue(answer.getResult()); + + cmd = new Site2SiteVpnCfgCommand(false, "64.10.1.10", "64.10.1.1", "192.168.1.1/16", "124.10.1.10", "192.168.100.1/24", "3des-sha1,aes128-sha1;modp1536", "3des-sha1,aes128-md5", "psk", Long.valueOf(1800), Long.valueOf(1800), false, true); + answer = _resource.executeRequest(cmd); + assertTrue(answer.getResult()); + } + + private void verifyArgs(Site2SiteVpnCfgCommand cmd, String script, String args) { + _count ++; + + assertEquals(script, VRScripts.S2SVPN_IPSEC); + switch (_count) { + case 1: + assertEquals(args, "-A -l 64.10.1.10 -n 192.168.1.1/16 -g 64.10.1.1 -r 124.10.1.10 -N 192.168.100.1/24 -e \"3des-sha1,aes128-md5\" -i \"3des-sha1,aes128-sha1;modp1536\" -t 1800 -T 1800 -s \"psk\" -d 1"); + break; + case 2: + assertEquals(args, "-A -l 64.10.1.10 -n 192.168.1.1/16 -g 64.10.1.1 -r 124.10.1.10 -N 192.168.100.1/24 -e \"3des-sha1,aes128-md5\" -i \"3des-sha1,aes128-sha1;modp1536\" -t 1800 -T 1800 -s \"psk\" -d 0 -p "); + break; + case 3: + assertEquals(args, "-D -r 124.10.1.10 -n 192.168.1.1/16 -N 192.168.100.1/24"); + break; + default: + fail(); + } + } + + @Test + public void testRemoteAccessVpnCfgCommand() { + _count = 0; + + RemoteAccessVpnCfgCommand cmd = new RemoteAccessVpnCfgCommand(true, "124.10.10.10", "10.10.1.1", "10.10.1.10-10.10.1.20", "sharedkey", false); + cmd.setLocalCidr("10.1.1.1/24"); + Answer answer = _resource.executeRequest(cmd); + assertTrue(answer.getResult()); + + cmd = new RemoteAccessVpnCfgCommand(false, "124.10.10.10", "10.10.1.1", "10.10.1.10-10.10.1.20", "sharedkey", false); + cmd.setLocalCidr("10.1.1.1/24"); + answer = _resource.executeRequest(cmd); + assertTrue(answer.getResult()); + + cmd = new RemoteAccessVpnCfgCommand(true, "124.10.10.10", "10.10.1.1", "10.10.1.10-10.10.1.20", "sharedkey", true); + cmd.setLocalCidr("10.1.1.1/24"); + answer = _resource.executeRequest(cmd); + assertTrue(answer.getResult()); + } + + private void verifyArgs(RemoteAccessVpnCfgCommand cmd, String script, String args) { + _count ++; + + assertEquals(script, VRScripts.VPN_L2TP); + switch (_count) { + case 1: + assertEquals(args, "-r 10.10.1.10-10.10.1.20 -p sharedkey -s 124.10.10.10 -l 10.10.1.1 -c -C 10.1.1.1/24 -i eth2"); + break; + case 2: + assertEquals(args, "-d -s 124.10.10.10 -C 10.1.1.1/24 -i eth2"); + break; + case 3: + assertEquals(args, "-r 10.10.1.10-10.10.1.20 -p sharedkey -s 124.10.10.10 -l 10.10.1.1 -c -C 10.1.1.1/24 -i eth1"); + break; + default: + fail(); + + } + } + + @Test + public void testFirewallRulesCommand() { + _count = 0; + + List rules = new ArrayList<>(); + List sourceCidrs = new ArrayList<>(); + sourceCidrs.add("10.10.1.1/24"); + sourceCidrs.add("10.10.1.2/24"); + rules.add(new FirewallRuleTO(1, "64.10.10.10", "TCP", 22, 80, false, false, Purpose.Firewall, sourceCidrs, 0, 0)); + rules.add(new FirewallRuleTO(2, "64.10.10.10", "ICMP", 0, 0, false, false, Purpose.Firewall, sourceCidrs, -1, -1)); + rules.add(new FirewallRuleTO(3, "64.10.10.10", "ICMP", 0, 0, true, true, Purpose.Firewall, sourceCidrs, -1, -1)); + SetFirewallRulesCommand cmd = new SetFirewallRulesCommand(rules); + Answer answer = _resource.executeRequest(cmd); + assertTrue(answer.getResult()); + assertTrue(answer instanceof GroupAnswer); + assertEquals(((GroupAnswer) answer).getResults().length, 3); + + //TODO Didn't test egress rule because not able to generate FirewallRuleVO object + } + + private void verifyArgs(SetFirewallRulesCommand cmd, String script, String args) { + assertEquals(script, VRScripts.FIREWALL_INGRESS); + assertEquals(args, " -F -a 64.10.10.10:ICMP:0:0:10.10.1.1/24-10.10.1.2/24:,64.10.10.10:TCP:22:80:10.10.1.1/24-10.10.1.2/24:,64.10.10.10:reverted:0:0:0:,"); + } + + @Test + public void testVmDataCommand() { + VmDataCommand cmd = new VmDataCommand("10.1.10.4", "i-4-VM", true); + cmd.addVmData("userdata", "user-data", "user-data"); + cmd.addVmData("metadata", "service-offering", "serviceOffering"); + cmd.addVmData("metadata", "availability-zone", "zoneName"); + cmd.addVmData("metadata", "local-ipv4", "10.1.10.4"); + cmd.addVmData("metadata", "local-hostname", "test-vm"); + cmd.addVmData("metadata", "public-ipv4", "110.1.10.4"); + cmd.addVmData("metadata", "public-hostname", "hostname"); + cmd.addVmData("metadata", "instance-id", "i-4-VM"); + cmd.addVmData("metadata", "vm-id", "4"); + cmd.addVmData("metadata", "public-keys", "publickey"); + cmd.addVmData("metadata", "cloud-identifier", "CloudStack-{test}"); + + Answer answer = _resource.executeRequest(cmd); + assertTrue(answer.getResult()); + } + + private void verifyArgs(VmDataCommand cmd, String script, String args) { + assertEquals(script, VRScripts.VMDATA); + assertEquals(args, "-d eyIxMC4xLjEwLjQiOltbInVzZXJkYXRhIiwidXNlci1kYXRhIiwidXNlci1kYXRhIl0sWyJtZXRhZGF0YSIsInN" + + "lcnZpY2Utb2ZmZXJpbmciLCJzZXJ2aWNlT2ZmZXJpbmciXSxbIm1ldGFkYXRhIiwiYXZhaWxhYmlsaXR5LXpvbmUiLCJ6b25lTmFt" + + "ZSJdLFsibWV0YWRhdGEiLCJsb2NhbC1pcHY0IiwiMTAuMS4xMC40Il0sWyJtZXRhZGF0YSIsImxvY2FsLWhvc3RuYW1lIiwidGVzd" + + "C12bSJdLFsibWV0YWRhdGEiLCJwdWJsaWMtaXB2NCIsIjExMC4xLjEwLjQiXSxbIm1ldGFkYXRhIiwicHVibGljLWhvc3RuYW1lIi" + + "wiaG9zdG5hbWUiXSxbIm1ldGFkYXRhIiwiaW5zdGFuY2UtaWQiLCJpLTQtVk0iXSxbIm1ldGFkYXRhIiwidm0taWQiLCI0Il0sWyJ" + + "tZXRhZGF0YSIsInB1YmxpYy1rZXlzIiwicHVibGlja2V5Il0sWyJtZXRhZGF0YSIsImNsb3VkLWlkZW50aWZpZXIiLCJDbG91ZFN0YWNrLXt0ZXN0fSJdXX0="); + } + + @Test + public void testSavePasswordCommand() { + SavePasswordCommand cmd = new SavePasswordCommand("123pass", "10.1.10.4", "i-4-VM", true); + Answer answer = _resource.executeRequest(cmd); + assertTrue(answer.getResult()); + } + + private void verifyArgs(SavePasswordCommand cmd, String script, String args) { + assertEquals(script, VRScripts.PASSWORD); + assertEquals(args, "-v 10.1.10.4 -p 123pass"); + } + + @Test + public void testDhcpEntryCommand() { + _count = 0; + DhcpEntryCommand cmd = new DhcpEntryCommand("12:34:56:78:90:AB", "10.1.10.2", "vm1", null, true); + Answer answer = _resource.executeRequest(cmd); + assertTrue(answer.getResult()); + + cmd = new DhcpEntryCommand("12:34:56:78:90:AB", null, "vm1", "2001:db8:0:0:0:ff00:42:8329", true); + cmd.setDuid(NetUtils.getDuidLL(cmd.getVmMac())); + answer = _resource.executeRequest(cmd); + assertTrue(answer.getResult()); + + cmd = new DhcpEntryCommand("12:34:56:78:90:AB", "10.1.10.2", "vm1", "2001:db8:0:0:0:ff00:42:8329", true); + cmd.setDuid(NetUtils.getDuidLL(cmd.getVmMac())); + answer = _resource.executeRequest(cmd); + assertTrue(answer.getResult()); + } + + private void verifyArgs(DhcpEntryCommand cmd, String script, String args) { + _count ++; + assertEquals(script, VRScripts.DHCP); + switch (_count) { + case 1: + assertEquals(args, " -m 12:34:56:78:90:AB -4 10.1.10.2 -h vm1"); + break; + case 2: + assertEquals(args, " -m 12:34:56:78:90:AB -h vm1 -6 2001:db8:0:0:0:ff00:42:8329 -u 00:03:00:01:12:34:56:78:90:AB"); + break; + case 3: + assertEquals(args, " -m 12:34:56:78:90:AB -4 10.1.10.2 -h vm1 -6 2001:db8:0:0:0:ff00:42:8329 -u 00:03:00:01:12:34:56:78:90:AB"); + break; + default: + fail(); + } + } + + @Test + public void testCreateIpAliasCommand() { + List aliases = new ArrayList<>(); + aliases.add(new IpAliasTO("169.254.3.10", "255.255.255.0", "1")); + aliases.add(new IpAliasTO("169.254.3.11", "255.255.255.0", "2")); + aliases.add(new IpAliasTO("169.254.3.12", "255.255.255.0", "3")); + CreateIpAliasCommand cmd = new CreateIpAliasCommand("169.254.3.10", aliases); + Answer answer = _resource.executeRequest(cmd); + assertTrue(answer.getResult()); + } + + private void verifyArgs(CreateIpAliasCommand cmd, String script, String args) { + assertEquals(script, VRScripts.IPALIAS_CREATE); + assertEquals(args, "1:169.254.3.10:255.255.255.0-2:169.254.3.11:255.255.255.0-3:169.254.3.12:255.255.255.0-"); + } + + @Test + public void testDeleteIpAliasCommand() { + List aliases = new ArrayList<>(); + aliases.add(new IpAliasTO("169.254.3.10", "255.255.255.0", "1")); + aliases.add(new IpAliasTO("169.254.3.11", "255.255.255.0", "2")); + aliases.add(new IpAliasTO("169.254.3.12", "255.255.255.0", "3")); + DeleteIpAliasCommand cmd = new DeleteIpAliasCommand("169.254.10.1", aliases, aliases); + Answer answer = _resource.executeRequest(cmd); + assertTrue(answer.getResult()); + } + + private void verifyArgs(DeleteIpAliasCommand cmd, String script, String args) { + assertEquals(script, VRScripts.IPALIAS_DELETE); + assertEquals(args, "1:169.254.3.10:255.255.255.0-2:169.254.3.11:255.255.255.0-3:169.254.3.12:255.255.255.0-- 1:169.254.3.10:255.255.255.0-2:169.254.3.11:255.255.255.0-3:169.254.3.12:255.255.255.0-"); + } + + @Test + public void testDnsMasqConfigCommand() { + List dhcps = new ArrayList(); + dhcps.add(new DhcpTO("10.1.20.2", "10.1.20.1", "255.255.255.0", "10.1.20.5")); + dhcps.add(new DhcpTO("10.1.21.2", "10.1.21.1", "255.255.255.0", "10.1.21.5")); + DnsMasqConfigCommand cmd = new DnsMasqConfigCommand(dhcps); + Answer answer = _resource.executeRequest(cmd); + assertTrue(answer.getResult()); + } + + private void verifyArgs(DnsMasqConfigCommand cmd, String script, String args) { + assertEquals(script, VRScripts.DNSMASQ_CONFIG); + assertEquals(args, "10.1.20.2:10.1.20.1:255.255.255.0:10.1.20.5-10.1.21.2:10.1.21.1:255.255.255.0:10.1.21.5-"); + } + + @Test + public void testLoadBalancerConfigCommand() { + _count = 0; + _file = ""; + + List lbs = new ArrayList<>(); + List dests = new ArrayList<>(); + dests.add(new LbDestination(80, 8080, "10.1.10.2", false)); + dests.add(new LbDestination(80, 8080, "10.1.10.2", true)); + lbs.add(new LoadBalancerTO(UUID.randomUUID().toString(), "64.10.1.10", 80, "tcp", "algo", false, false, false, dests)); + LoadBalancerTO[] arrayLbs = new LoadBalancerTO[lbs.size()]; + lbs.toArray(arrayLbs); + NicTO nic = new NicTO(); + LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(arrayLbs, "64.10.2.10", "10.1.10.2", "192.168.1.2", nic, null, "1000", false); + cmd.setAccessDetail(NetworkElementCommand.ROUTER_IP, "10.1.10.2"); + Answer answer = _resource.executeRequest(cmd); + assertTrue(answer.getResult()); + + nic.setIp("10.1.10.2"); + cmd = new LoadBalancerConfigCommand(arrayLbs, "64.10.2.10", "10.1.10.2", "192.168.1.2", nic, Long.valueOf(1), "1000", false); + answer = _resource.executeRequest(cmd); + assertTrue(answer.getResult()); + } + + private void verifyFile(NetworkElementCommand cmd, String path, String filename, String content) { + if (!(cmd instanceof LoadBalancerConfigCommand)) { + fail("Only LB command would call this!"); + } + _count ++; + switch (_count) { + case 1: + case 3: + _file = path + filename; + assertEquals(path, "/etc/haproxy/"); + assertTrue(filename.startsWith("haproxy.cfg.new")); + assertEquals(content, "global\n" + + "\tlog 127.0.0.1:3914 local0 warning\n" + + "\tmaxconn 1000\n" + + "\tmaxpipes 250\n" + + "\tchroot /var/lib/haproxy\n" + + "\tuser haproxy\n" + + "\tgroup haproxy\n" + + "\tdaemon\n" + + "\t \n" + + "defaults\n" + + "\tlog global\n" + + "\tmode tcp\n" + + "\toption dontlognull\n" + + "\tretries 3\n" + + "\toption redispatch\n" + + "\toption forwardfor\n" + + "\toption forceclose\n" + + "\ttimeout connect 5000\n" + + "\ttimeout client 50000\n" + + "\ttimeout server 50000\n" + + "\n" + + "listen stats_on_guest 10.1.10.2:8081\n" + + "\tmode http\n" + + "\toption httpclose\n" + + "\tstats enable\n" + + "\tstats uri /admin?stats\n" + + "\tstats realm Haproxy\\ Statistics\n" + + "\tstats auth admin1:AdMiN123\n" + + "\n" + + "\t \n" + + "listen 64_10_1_10-80 64.10.1.10:80\n" + + "\tbalance algo\n" + + "\tserver 64_10_1_10-80_0 10.1.10.2:80 check\n" + + "\tmode http\n" + + "\toption httpclose\n" + + "\t \n" + + "\t \n"); + break; + default: + fail(); + } + } + + private void verifyArgs(LoadBalancerConfigCommand cmd, String script, String args) { + _count ++; + switch (_count) { + case 2: + assertEquals(script, VRScripts.LB); + assertEquals(args, " -i 10.1.10.2 -f " + _file + " -a 64.10.1.10:80:, -s 10.1.10.2:8081:0/0:,,"); + break; + case 4: + assertEquals(script, VRScripts.VPC_LB); + assertEquals(args, " -i 10.1.10.2 -f " + _file + " -a 64.10.1.10:80:, -s 10.1.10.2:8081:0/0:,,"); + break; + default: + fail(); + } + } + +} + diff --git a/deps/XenServerJava/Makefile b/deps/XenServerJava/Makefile deleted file mode 100644 index c78144aa606..00000000000 --- a/deps/XenServerJava/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -# Makefile to compile the Xen Java SDK bindings - -BINDINGJAVAFILES := $(wildcard com/xensource/xenapi/*.java) -BINDINGCLASSFILES := $(BINDINGJAVAFILES:.java=.class) -BINDINGJAR := xenserver-5.6.100-1.jar - -CLASSPATH := :../cloud-xmlrpc-client-3.1.3.jar:../cloud-xmlrpc-common-3.1.3.jar:../cloud-ws-commons-util-1.0.2.jar -EXAMPLECLASSPATH := :$(BINDINGJAR)$(CLASSPATH) - -.PHONY: all -all: $(BINDINGJAR) tests - @ : - -# Target to compile the automated tests -.PHONY: tests -tests: $(patsubst %.java,%.class,$(wildcard *.java)) - @ : - -.PHONY: docs -docs: - javadoc -classpath ${CLASSPATH} -d doc -link http://java.sun.com/javase/6/docs/api com/xensource/xenapi/*.java - -%.class: %.java - javac -cp ${CLASSPATH} $^ - -$(BINDINGJAR): $(BINDINGCLASSFILES) - jar -cvf $@ com/xensource/xenapi/*.class - -.PHONY: cleanclass -cleanclass: - rm -f com/xensource/xenapi/*.class - rm -f *.class - -.PHONY: cleanjar -cleanjar: - rm -f $(BINDINGJAR) - -.PHONY: cleandocs -cleandocs: - rm -rf doc - -.PHONY: clean -clean: cleanjar cleanclass cleandocs - @ : diff --git a/deps/XenServerJava/pom.xml b/deps/XenServerJava/pom.xml index 84d9a975c98..c9a4e865729 100644 --- a/deps/XenServerJava/pom.xml +++ b/deps/XenServerJava/pom.xml @@ -25,7 +25,7 @@ ../../pom.xml xapi - 5.6.100-1-SNAPSHOT + 6.2.0-1-SNAPSHOT Apache XenSource XAPI XenSource XAPI Java Bindings diff --git a/deps/XenServerJava/src/LICENSE.Apache-2.0.txt b/deps/XenServerJava/src/LICENSE.Apache-2.0.txt new file mode 100755 index 00000000000..261eeb9e9f8 --- /dev/null +++ b/deps/XenServerJava/src/LICENSE.Apache-2.0.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/deps/XenServerJava/src/LICENSE.txt b/deps/XenServerJava/src/LICENSE.txt new file mode 100755 index 00000000000..76c4a2240fa --- /dev/null +++ b/deps/XenServerJava/src/LICENSE.txt @@ -0,0 +1,26 @@ +Copyright (c) Citrix Systems, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + 1) Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2) Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/deps/XenServerJava/src/README.txt b/deps/XenServerJava/src/README.txt new file mode 100755 index 00000000000..2e6fa457cd0 --- /dev/null +++ b/deps/XenServerJava/src/README.txt @@ -0,0 +1,57 @@ +XenServerJava +============= + +NOTE: This is a modified version of Citrix XenServer's SDK. This version of +XenServerJava includes some customization which is required to make it work +with CloudStack. + + +Version 6.2.0-1. + +XenServerJava is a complete SDK for Citrix XenServer, exposing the XenServer +API as Java classes. + +For XenServer documentation, see http://docs.xensource.com. +XenServerJava includes a class for every XenServer class, and a method for +each XenServer API call, so API documentation and examples written for +for other languages will apply equally well to Java. +In particular, the SDK Guide and API Documentation are ideal for developers +wishing to use XenServerJava. + +For community content, blogs, and downloads, visit the XenServer Developer +Network at http://community.citrix.com/cdn/xs. + +XenServerJava is free sofware. You can redistribute and modify it under the +terms of the BSD license. See LICENSE.txt for details. + +This library may be accompanied by pedagogical examples. These do not form +part of this library, and are licensed for redistribution and modification +under the BSD license. Such examples are licensed clearly at the top +of each file. + + +Dependencies +------------ + +XenServerJava is dependent upon Apache XML-RPC and WS-Commons, both by The +Apache Software Foundation. We would like to thank the ASF and the +Apache XML-RPC development team in particular. +Both are licensed under the Apache Software License 2.0; see +LICENSE.Apache-2.0.txt for details. + +We test with version 3.1 of Apache XML-RPC, and version 1.0.2 of WS-Commons. +We recommend that you use these versions, though others may work. + + +Downloads +--------- + +XenServerJava is available in the XenServer-6.2.0-SDK.zip in three separate +folders, one for the compiled binaries, one for the source code, +and one containing sample code. + +The XenServer-6.2.0-SDK.zip is available from +http://www.citrix.com/downloads/xenserver/. + +Apache XML-RPC is available from http://ws.apache.org/xmlrpc/. +WS-Commons is available from http://ws.apache.org/commons/. diff --git a/deps/XenServerJava/src/com/xensource/xenapi/APIVersion.java b/deps/XenServerJava/src/com/xensource/xenapi/APIVersion.java old mode 100644 new mode 100755 index 8d7247d4fc3..9dcdd9f151e --- a/deps/XenServerJava/src/com/xensource/xenapi/APIVersion.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/APIVersion.java @@ -1,18 +1,19 @@ -/* Copyright (c) Citrix Systems, Inc. +/* + * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -31,16 +32,24 @@ package com.xensource.xenapi; public enum APIVersion { - API_1_1, API_1_2, API_1_3, API_1_4, API_1_5, API_1_6, API_1_7, API_1_8, API_1_9, API_1_10, UNKNOWN; + API_1_1, API_1_2, API_1_3, API_1_4, API_1_5, API_1_6, API_1_7, API_1_8, API_1_9, API_1_10, API_2_0, API_2_1, UNKNOWN; public static APIVersion latest() { - return API_1_10; + return API_2_1; } public static APIVersion fromMajorMinor(long major, long minor) { - if (major == 1 && minor == 10) + if (major == 2 && minor == 1) + { + return API_2_1; + } + else if (major == 2 && minor == 0) + { + return API_2_0; + } + else if (major == 1 && minor == 10) { return API_1_10; } @@ -91,28 +100,32 @@ public enum APIVersion { switch (this) { - case API_1_1: - return "1.1"; - case API_1_2: - return "1.2"; - case API_1_3: - return "1.3"; - case API_1_4: - return "1.4"; - case API_1_5: - return "1.5"; - case API_1_6: - return "1.6"; - case API_1_7: - return "1.7"; - case API_1_8: - return "1.8"; - case API_1_9: - return "1.9"; - case API_1_10: - return "1.10"; - default: - return "Unknown"; + case API_1_1: + return "1.1"; + case API_1_2: + return "1.2"; + case API_1_3: + return "1.3"; + case API_1_4: + return "1.4"; + case API_1_5: + return "1.5"; + case API_1_6: + return "1.6"; + case API_1_7: + return "1.7"; + case API_1_8: + return "1.8"; + case API_1_9: + return "1.9"; + case API_1_10: + return "1.10"; + case API_2_0: + return "2.0"; + case API_2_1: + return "2.1"; + default: + return "Unknown"; } } } diff --git a/deps/XenServerJava/src/com/xensource/xenapi/Auth.java b/deps/XenServerJava/src/com/xensource/xenapi/Auth.java index cffaaaca965..4778e6ab061 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/Auth.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/Auth.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -51,6 +52,7 @@ import org.apache.xmlrpc.XmlRpcException; */ public class Auth extends XenAPIObject { + public String toWireString() { return null; } @@ -62,15 +64,15 @@ public class Auth extends XenAPIObject { * @return the subject_identifier obtained from the external directory service */ public static String getSubjectIdentifier(Connection c, String subjectName) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "auth.get_subject_identifier"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(subjectName)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -80,15 +82,15 @@ public class Auth extends XenAPIObject { * @return key-value pairs containing at least a key called subject_name */ public static Map getSubjectInformationFromIdentifier(Connection c, String subjectIdentifier) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "auth.get_subject_information_from_identifier"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(subjectIdentifier)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -98,15 +100,15 @@ public class Auth extends XenAPIObject { * @return set of subject_identifiers that provides the group membership of subject_identifier passed as argument, it contains, recursively, all groups a subject_identifier is member of. */ public static Set getGroupMembership(Connection c, String subjectIdentifier) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "auth.get_group_membership"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(subjectIdentifier)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/Blob.java b/deps/XenServerJava/src/com/xensource/xenapi/Blob.java index 494b9286407..ec91d8788f6 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/Blob.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/Blob.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class Blob extends XenAPIObject { * For internal use only. */ Blob(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class Blob extends XenAPIObject { { if (obj != null && obj instanceof Blob) { - Blob other = (Blob)obj; + Blob other = (Blob) obj; return other.ref.equals(this.ref); } else { @@ -112,8 +113,8 @@ public class Blob extends XenAPIObject { /** * Convert a blob.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("name_label", this.nameLabel == null ? "" : this.nameLabel); map.put("name_description", this.nameDescription == null ? "" : this.nameDescription); @@ -160,15 +161,15 @@ public class Blob extends XenAPIObject { * @return all fields from the object */ public Blob.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "blob.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBlobRecord(result); + return Types.toBlobRecord(result); } /** @@ -178,15 +179,15 @@ public class Blob extends XenAPIObject { * @return reference to the object */ public static Blob getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "blob.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBlob(result); + return Types.toBlob(result); } /** @@ -196,15 +197,15 @@ public class Blob extends XenAPIObject { * @return references to objects with matching names */ public static Set getByNameLabel(Connection c, String label) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "blob.get_by_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfBlob(result); + return Types.toSetOfBlob(result); } /** @@ -213,15 +214,15 @@ public class Blob extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "blob.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -230,15 +231,15 @@ public class Blob extends XenAPIObject { * @return value of the field */ public String getNameLabel(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "blob.get_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -247,15 +248,15 @@ public class Blob extends XenAPIObject { * @return value of the field */ public String getNameDescription(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "blob.get_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -264,15 +265,15 @@ public class Blob extends XenAPIObject { * @return value of the field */ public Long getSize(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "blob.get_size"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -281,15 +282,15 @@ public class Blob extends XenAPIObject { * @return value of the field */ public Boolean getPublic(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "blob.get_public"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -298,15 +299,15 @@ public class Blob extends XenAPIObject { * @return value of the field */ public Date getLastUpdated(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "blob.get_last_updated"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDate(result); + return Types.toDate(result); } /** @@ -315,15 +316,15 @@ public class Blob extends XenAPIObject { * @return value of the field */ public String getMimeType(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "blob.get_mime_type"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -332,9 +333,9 @@ public class Blob extends XenAPIObject { * @param label New value to set */ public void setNameLabel(Connection c, String label) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "blob.set_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(label)}; @@ -348,9 +349,9 @@ public class Blob extends XenAPIObject { * @param description New value to set */ public void setNameDescription(Connection c, String description) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "blob.set_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(description)}; @@ -364,9 +365,9 @@ public class Blob extends XenAPIObject { * @param _public New value to set */ public void setPublic(Connection c, Boolean _public) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "blob.set_public"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(_public)}; @@ -382,25 +383,25 @@ public class Blob extends XenAPIObject { * @return The reference to the created blob */ public static Blob create(Connection c, String mimeType, Boolean _public) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "blob.create"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(mimeType), Marshalling.toXMLRPC(_public)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBlob(result); + return Types.toBlob(result); } /** - * + * * */ public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "blob.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -414,15 +415,15 @@ public class Blob extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "blob.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfBlob(result); + return Types.toSetOfBlob(result); } /** @@ -431,15 +432,15 @@ public class Blob extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "blob.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfBlobBlobRecord(result); + return Types.toMapOfBlobBlobRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/Bond.java b/deps/XenServerJava/src/com/xensource/xenapi/Bond.java index 935fd9847e5..5a54ad27920 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/Bond.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/Bond.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -45,7 +46,7 @@ import java.util.Set; import org.apache.xmlrpc.XmlRpcException; /** - * + * * * @author Citrix Systems, Inc. */ @@ -60,14 +61,14 @@ public class Bond extends XenAPIObject { * For internal use only. */ Bond(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class Bond extends XenAPIObject { { if (obj != null && obj instanceof Bond) { - Bond other = (Bond)obj; + Bond other = (Bond) obj; return other.ref.equals(this.ref); } else { @@ -113,8 +114,8 @@ public class Bond extends XenAPIObject { /** * Convert a Bond.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("master", this.master == null ? new PIF("OpaqueRef:NULL") : this.master); map.put("slaves", this.slaves == null ? new LinkedHashSet() : this.slaves); @@ -166,15 +167,15 @@ public class Bond extends XenAPIObject { * @return all fields from the object */ public Bond.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Bond.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBondRecord(result); + return Types.toBondRecord(result); } /** @@ -184,15 +185,15 @@ public class Bond extends XenAPIObject { * @return reference to the object */ public static Bond getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Bond.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBond(result); + return Types.toBond(result); } /** @@ -201,15 +202,15 @@ public class Bond extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Bond.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -218,15 +219,15 @@ public class Bond extends XenAPIObject { * @return value of the field */ public PIF getMaster(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Bond.get_master"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPIF(result); + return Types.toPIF(result); } /** @@ -235,15 +236,15 @@ public class Bond extends XenAPIObject { * @return value of the field */ public Set getSlaves(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Bond.get_slaves"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfPIF(result); + return Types.toSetOfPIF(result); } /** @@ -252,15 +253,15 @@ public class Bond extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Bond.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -269,15 +270,15 @@ public class Bond extends XenAPIObject { * @return value of the field */ public PIF getPrimarySlave(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Bond.get_primary_slave"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPIF(result); + return Types.toPIF(result); } /** @@ -286,15 +287,15 @@ public class Bond extends XenAPIObject { * @return value of the field */ public Types.BondMode getMode(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Bond.get_mode"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBondMode(result); + return Types.toBondMode(result); } /** @@ -303,15 +304,15 @@ public class Bond extends XenAPIObject { * @return value of the field */ public Map getProperties(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Bond.get_properties"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -320,15 +321,15 @@ public class Bond extends XenAPIObject { * @return value of the field */ public Long getLinksUp(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Bond.get_links_up"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -337,9 +338,9 @@ public class Bond extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Bond.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -354,9 +355,9 @@ public class Bond extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Bond.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -370,9 +371,9 @@ public class Bond extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Bond.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -391,13 +392,12 @@ public class Bond extends XenAPIObject { * @return Task */ public static Task createAsync(Connection c, Network network, Set members, String MAC, Types.BondMode mode, Map properties) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.Bond.create"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(members), Marshalling.toXMLRPC(MAC), - Marshalling.toXMLRPC(mode), Marshalling.toXMLRPC(properties)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(members), Marshalling.toXMLRPC(MAC), Marshalling.toXMLRPC(mode), Marshalling.toXMLRPC(properties)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -414,16 +414,15 @@ public class Bond extends XenAPIObject { * @return The reference of the created Bond object */ public static Bond create(Connection c, Network network, Set members, String MAC, Types.BondMode mode, Map properties) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Bond.create"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(members), Marshalling.toXMLRPC(MAC), - Marshalling.toXMLRPC(mode), Marshalling.toXMLRPC(properties)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(members), Marshalling.toXMLRPC(MAC), Marshalling.toXMLRPC(mode), Marshalling.toXMLRPC(properties)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBond(result); + return Types.toBond(result); } /** @@ -432,9 +431,9 @@ public class Bond extends XenAPIObject { * @return Task */ public Task destroyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.Bond.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -448,9 +447,9 @@ public class Bond extends XenAPIObject { * */ public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Bond.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -465,9 +464,9 @@ public class Bond extends XenAPIObject { * @return Task */ public Task setModeAsync(Connection c, Types.BondMode value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.Bond.set_mode"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -482,9 +481,9 @@ public class Bond extends XenAPIObject { * @param value The new bond mode */ public void setMode(Connection c, Types.BondMode value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Bond.set_mode"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -500,9 +499,9 @@ public class Bond extends XenAPIObject { * @return Task */ public Task setPropertyAsync(Connection c, String name, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.Bond.set_property"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(value)}; @@ -518,9 +517,9 @@ public class Bond extends XenAPIObject { * @param value The property value */ public void setProperty(Connection c, String name, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Bond.set_property"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(value)}; @@ -534,15 +533,15 @@ public class Bond extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Bond.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfBond(result); + return Types.toSetOfBond(result); } /** @@ -551,15 +550,15 @@ public class Bond extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Bond.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfBondBondRecord(result); + return Types.toMapOfBondBondRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/Connection.java b/deps/XenServerJava/src/com/xensource/xenapi/Connection.java old mode 100644 new mode 100755 index a6524503609..661724fefb8 --- a/deps/XenServerJava/src/com/xensource/xenapi/Connection.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/Connection.java @@ -1,18 +1,19 @@ -/* Copyright (c) Citrix Systems, Inc. +/* + * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -38,7 +39,6 @@ import org.apache.xmlrpc.client.XmlRpcClient; import org.apache.xmlrpc.client.XmlRpcClientConfig; import org.apache.xmlrpc.client.XmlRpcClientConfigImpl; import org.apache.xmlrpc.client.XmlRpcHttpClientConfig; -import org.apache.xmlrpc.client.XmlRpcSun15HttpTransportFactory; import com.xensource.xenapi.Types.BadServerResponse; import com.xensource.xenapi.Types.SessionAuthenticationFailed; @@ -54,16 +54,8 @@ public class Connection /** * The version of the bindings that this class belongs to. */ - public static final String BINDINGS_VERSION = "6.1.0-1"; - - /** - * true if the connection is to the Rio edition of XenServer. Certain function calls are not allowed. - * - * @deprecated Use getAPIVersion() instead. - */ - @Deprecated - public Boolean rioConnection = false; - + public static final String BINDINGS_VERSION = "6.2.0-1"; + private APIVersion apiVersion; protected int _wait = 600; @@ -91,47 +83,37 @@ public class Connection /** * Creates a connection to a particular server using a given username and password. This object can then be passed * in to any other API calls. - * + * * This constructor calls Session.loginWithPassword, passing itself as the first parameter. - * + * * When this constructor is used, a call to dispose() (also called in the Connection's finalizer) will attempt a * Session.logout on this connection. - * + * * @deprecated Use a constructor that takes a URL as the first parameter instead. */ @Deprecated public Connection(String client, String username, String password) throws java.net.MalformedURLException, - XmlRpcException, BadServerResponse, SessionAuthenticationFailed, XenAPIException + XmlRpcException, BadServerResponse, SessionAuthenticationFailed, XenAPIException { deprecatedConstructorUsed = true; - // To login normally we call login_with_password(username, password, "1.X"). On rio this call fails and we - // should use login_with_password(username,password) instead, and note that we are talking to a rio host so that we - // can refuse to make certain miami-specific calls final String ApiVersion = APIVersion.latest().toString(); this.client = getClientFromURL(new URL(client)); try { - //first try to login the modern way this.sessionReference = loginWithPassword(this.client, username, password, ApiVersion); } catch (BadServerResponse e) { - //oops, something went wrong String[] errDesc = e.errorDescription; - //was the problem that the host was running rio? If so it will have complained that it got three parameters - //instead of two. Let us carefully verify the details of this complaint + if (0 == errDesc[0].compareTo("MESSAGE_PARAMETER_COUNT_MISMATCH") - && 0 == errDesc[1].compareTo("session.login_with_password") - && 0 == errDesc[2].compareTo("2") - && 0 == errDesc[3].compareTo("3")) + && 0 == errDesc[1].compareTo("session.login_with_password") + && 0 == errDesc[2].compareTo("2") + && 0 == errDesc[3].compareTo("3")) { - //and if so, we can have another go, using the older login method, and see how that goes. this.sessionReference = loginWithPassword(this.client, username, password); - //success!. Note that we are talking to an old host on this connection - this.rioConnection = true; } else { - //Hmm... Can't solve this here. Let upstairs know about the problem. throw e; } } @@ -139,11 +121,13 @@ public class Connection try { setAPIVersion(new Session(sessionReference)); - } catch (XenAPIException exn) + } + catch (XenAPIException exn) { dispose(); throw exn; - } catch (XmlRpcException exn) + } + catch (XmlRpcException exn) { dispose(); throw exn; @@ -153,10 +137,10 @@ public class Connection /** * Creates a connection to a particular server using a given username and password. This object can then be passed * in to any other API calls. - * + * * Note this constructor does NOT call Session.loginWithPassword; the programmer is responsible for calling it, * passing the Connection as a parameter. No attempt to connect to the server is made until login is called. - * + * * When this constructor is used, a call to dispose() will do nothing. The programmer is responsible for manually * logging out the Session. */ @@ -170,7 +154,7 @@ public class Connection /** * Creates a connection to a particular server using a given username and password. This object can then be passed * in to any other API calls. - * + * * The additional sessionReference parameter must be a reference to a logged-in Session. Any method calls on this * Connection will use it. This constructor does not call Session.loginWithPassword, and dispose() on the resulting * Connection object does not call Session.logout. The programmer is responsible for ensuring the Session is logged @@ -206,11 +190,12 @@ public class Connection if (sessionReference != null) { String method_call = "session.logout"; - Object[] method_params = {Marshalling.toXMLRPC(this.sessionReference)}; + Object[] method_params = { Marshalling.toXMLRPC(this.sessionReference) }; client.execute(method_call, method_params); sessionReference = null; } - } catch (XmlRpcException exn) + } + catch (XmlRpcException exn) { } } @@ -220,17 +205,17 @@ public class Connection */ @Deprecated private static String loginWithPassword(XmlRpcClient client, String username, String password) - throws BadServerResponse, XmlRpcException, SessionAuthenticationFailed + throws BadServerResponse, XmlRpcException, SessionAuthenticationFailed { String method_call = "session.login_with_password"; - Object[] method_params = {Marshalling.toXMLRPC(username), Marshalling.toXMLRPC(password)}; - Map response = (Map)client.execute(method_call, method_params); + Object[] method_params = { Marshalling.toXMLRPC(username), Marshalling.toXMLRPC(password) }; + Map response = (Map) client.execute(method_call, method_params); if (response.get("Status").equals("Success")) { - return (String)response.get("Value"); + return (String) response.get("Value"); } else if (response.get("Status").equals("Failure")) { - Object[] error = (Object[])response.get("ErrorDescription"); + Object[] error = (Object[]) response.get("ErrorDescription"); if (error[0].equals("SESSION_AUTHENTICATION_FAILED")) { throw new SessionAuthenticationFailed(); @@ -244,18 +229,18 @@ public class Connection */ @Deprecated private static String loginWithPassword(XmlRpcClient client, String username, String password, String ApiVersion) - throws BadServerResponse, XmlRpcException, SessionAuthenticationFailed + throws BadServerResponse, XmlRpcException, SessionAuthenticationFailed { String method_call = "session.login_with_password"; - Object[] method_params = {Marshalling.toXMLRPC(username), Marshalling.toXMLRPC(password), - Marshalling.toXMLRPC(ApiVersion)}; - Map response = (Map)client.execute(method_call, method_params); + Object[] method_params = { Marshalling.toXMLRPC(username), Marshalling.toXMLRPC(password), + Marshalling.toXMLRPC(ApiVersion) }; + Map response = (Map) client.execute(method_call, method_params); if (response.get("Status").equals("Success")) { - return (String)response.get("Value"); + return (String) response.get("Value"); } else if (response.get("Status").equals("Failure")) { - Object[] error = (Object[])response.get("ErrorDescription"); + Object[] error = (Object[]) response.get("ErrorDescription"); if (error[0].equals("SESSION_AUTHENTICATION_FAILED")) { throw new SessionAuthenticationFailed(); @@ -268,9 +253,8 @@ public class Connection public XmlRpcClientConfigImpl getConfig() { - return config; + return config; } - private XmlRpcClient getClientFromURL(URL url) { config.setTimeZone(TimeZone.getTimeZone("UTC")); @@ -283,7 +267,7 @@ public class Connection } /* - * Because the binding calls are constructing their own parameter lists, they need to be able to get to + * Because the binding calls are constructing their own parameter lists, they need to be able to get to * the session reference directly. This is all rather ugly and needs redone * Changed to public to allow easier integration with HTTP-level streaming interface, * see CA-15447 @@ -298,7 +282,7 @@ public class Connection */ protected Map dispatch(String method_call, Object[] method_params) throws XmlRpcException, XenAPIException { - Map response = (Map)client.execute(method_call, method_params); + Map response = (Map) client.execute(method_call, method_params); if (!deprecatedConstructorUsed) { @@ -314,7 +298,7 @@ public class Connection setAPIVersion(session); } else if (method_call.equals("session.slave_local_login_with_password") && - response.get("Status").equals("Success")) + response.get("Status").equals("Success")) { // Store the Session reference and assume the latest API version. sessionReference = Types.toSession(response.get("Value")).ref; @@ -329,7 +313,7 @@ public class Connection // this session from the master instead. if (response.get("Status").equals("Failure")) { - Object[] error = (Object[])response.get("ErrorDescription"); + Object[] error = (Object[]) response.get("ErrorDescription"); if (error.length == 2 && error[0].equals("HOST_IS_SLAVE")) { try @@ -338,18 +322,20 @@ public class Connection ((XmlRpcHttpClientConfig)client.getClientConfig()).getServerURL(); Connection tmp_conn = new Connection(new URL(client_url.getProtocol(), - (String)error[1], - client_url.getPort(), - client_url.getFile()), _wait); + (String)error[1], + client_url.getPort(), + client_url.getFile()), _wait); tmp_conn.sessionReference = sessionReference; try { Session.logout(tmp_conn); - } finally + } + finally { tmp_conn.dispose(); } - } catch (Exception exn2) + } + catch (Exception exn2) { // Ignore -- we're going to throw HostIsSlave anyway. } @@ -364,6 +350,7 @@ public class Connection return Types.checkResponse(response); } + private void setAPIVersion(Session session) throws XenAPIException, XmlRpcException { try @@ -371,9 +358,10 @@ public class Connection long major = session.getThisHost(this).getAPIVersionMajor(this); long minor = session.getThisHost(this).getAPIVersionMinor(this); apiVersion = APIVersion.fromMajorMinor(major, minor); - } catch (BadServerResponse exn) + } + catch (BadServerResponse exn) { - apiVersion = APIVersion.API_1_1; + apiVersion = APIVersion.UNKNOWN; } } } diff --git a/deps/XenServerJava/src/com/xensource/xenapi/Console.java b/deps/XenServerJava/src/com/xensource/xenapi/Console.java index ac2c9a7ce8a..bb4440aebd4 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/Console.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/Console.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class Console extends XenAPIObject { * For internal use only. */ Console(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class Console extends XenAPIObject { { if (obj != null && obj instanceof Console) { - Console other = (Console)obj; + Console other = (Console) obj; return other.ref.equals(this.ref); } else { @@ -110,8 +111,8 @@ public class Console extends XenAPIObject { /** * Convert a console.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("protocol", this.protocol == null ? Types.ConsoleProtocol.UNRECOGNIZED : this.protocol); map.put("location", this.location == null ? "" : this.location); @@ -148,15 +149,15 @@ public class Console extends XenAPIObject { * @return all fields from the object */ public Console.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "console.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toConsoleRecord(result); + return Types.toConsoleRecord(result); } /** @@ -166,15 +167,15 @@ public class Console extends XenAPIObject { * @return reference to the object */ public static Console getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "console.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toConsole(result); + return Types.toConsole(result); } /** @@ -184,9 +185,9 @@ public class Console extends XenAPIObject { * @return Task */ public static Task createAsync(Connection c, Console.Record record) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.console.create"; String session = c.getSessionReference(); Map record_map = record.toMap(); @@ -203,16 +204,16 @@ public class Console extends XenAPIObject { * @return reference to the newly created object */ public static Console create(Connection c, Console.Record record) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "console.create"; String session = c.getSessionReference(); Map record_map = record.toMap(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toConsole(result); + return Types.toConsole(result); } /** @@ -221,9 +222,9 @@ public class Console extends XenAPIObject { * @return Task */ public Task destroyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.console.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -237,9 +238,9 @@ public class Console extends XenAPIObject { * */ public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "console.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -253,15 +254,15 @@ public class Console extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "console.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -270,15 +271,15 @@ public class Console extends XenAPIObject { * @return value of the field */ public Types.ConsoleProtocol getProtocol(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "console.get_protocol"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toConsoleProtocol(result); + return Types.toConsoleProtocol(result); } /** @@ -287,15 +288,15 @@ public class Console extends XenAPIObject { * @return value of the field */ public String getLocation(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "console.get_location"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -304,15 +305,15 @@ public class Console extends XenAPIObject { * @return value of the field */ public VM getVM(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "console.get_VM"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVM(result); + return Types.toVM(result); } /** @@ -321,15 +322,15 @@ public class Console extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "console.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -338,9 +339,9 @@ public class Console extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "console.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -355,9 +356,9 @@ public class Console extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "console.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -371,9 +372,9 @@ public class Console extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "console.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -387,15 +388,15 @@ public class Console extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "console.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfConsole(result); + return Types.toSetOfConsole(result); } /** @@ -404,15 +405,15 @@ public class Console extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "console.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfConsoleConsoleRecord(result); + return Types.toMapOfConsoleConsoleRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/Crashdump.java b/deps/XenServerJava/src/com/xensource/xenapi/Crashdump.java index be11588cc25..1d40d4d994f 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/Crashdump.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/Crashdump.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class Crashdump extends XenAPIObject { * For internal use only. */ Crashdump(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class Crashdump extends XenAPIObject { { if (obj != null && obj instanceof Crashdump) { - Crashdump other = (Crashdump)obj; + Crashdump other = (Crashdump) obj; return other.ref.equals(this.ref); } else { @@ -109,8 +110,8 @@ public class Crashdump extends XenAPIObject { /** * Convert a crashdump.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("VM", this.VM == null ? new VM("OpaqueRef:NULL") : this.VM); map.put("VDI", this.VDI == null ? new VDI("OpaqueRef:NULL") : this.VDI); @@ -142,15 +143,15 @@ public class Crashdump extends XenAPIObject { * @return all fields from the object */ public Crashdump.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "crashdump.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toCrashdumpRecord(result); + return Types.toCrashdumpRecord(result); } /** @@ -160,15 +161,15 @@ public class Crashdump extends XenAPIObject { * @return reference to the object */ public static Crashdump getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "crashdump.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toCrashdump(result); + return Types.toCrashdump(result); } /** @@ -177,15 +178,15 @@ public class Crashdump extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "crashdump.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -194,15 +195,15 @@ public class Crashdump extends XenAPIObject { * @return value of the field */ public VM getVM(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "crashdump.get_VM"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVM(result); + return Types.toVM(result); } /** @@ -211,15 +212,15 @@ public class Crashdump extends XenAPIObject { * @return value of the field */ public VDI getVDI(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "crashdump.get_VDI"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVDI(result); + return Types.toVDI(result); } /** @@ -228,15 +229,15 @@ public class Crashdump extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "crashdump.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -245,9 +246,9 @@ public class Crashdump extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "crashdump.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -262,9 +263,9 @@ public class Crashdump extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "crashdump.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -278,9 +279,9 @@ public class Crashdump extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "crashdump.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -294,9 +295,9 @@ public class Crashdump extends XenAPIObject { * @return Task */ public Task destroyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.crashdump.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -310,9 +311,9 @@ public class Crashdump extends XenAPIObject { * */ public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "crashdump.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -326,15 +327,15 @@ public class Crashdump extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "crashdump.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfCrashdump(result); + return Types.toSetOfCrashdump(result); } /** @@ -343,15 +344,15 @@ public class Crashdump extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "crashdump.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfCrashdumpCrashdumpRecord(result); + return Types.toMapOfCrashdumpCrashdumpRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/DRTask.java b/deps/XenServerJava/src/com/xensource/xenapi/DRTask.java index 14a5e4064a7..bbca81cb522 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/DRTask.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/DRTask.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class DRTask extends XenAPIObject { * For internal use only. */ DRTask(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class DRTask extends XenAPIObject { { if (obj != null && obj instanceof DRTask) { - DRTask other = (DRTask)obj; + DRTask other = (DRTask) obj; return other.ref.equals(this.ref); } else { @@ -107,8 +108,8 @@ public class DRTask extends XenAPIObject { /** * Convert a DR_task.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("introduced_SRs", this.introducedSRs == null ? new LinkedHashSet() : this.introducedSRs); return map; @@ -130,15 +131,15 @@ public class DRTask extends XenAPIObject { * @return all fields from the object */ public DRTask.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "DR_task.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDRTaskRecord(result); + return Types.toDRTaskRecord(result); } /** @@ -148,15 +149,15 @@ public class DRTask extends XenAPIObject { * @return reference to the object */ public static DRTask getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "DR_task.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDRTask(result); + return Types.toDRTask(result); } /** @@ -165,15 +166,15 @@ public class DRTask extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "DR_task.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -182,15 +183,15 @@ public class DRTask extends XenAPIObject { * @return value of the field */ public Set getIntroducedSRs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "DR_task.get_introduced_SRs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfSR(result); + return Types.toSetOfSR(result); } /** @@ -202,9 +203,9 @@ public class DRTask extends XenAPIObject { * @return Task */ public static Task createAsync(Connection c, String type, Map deviceConfig, Set whitelist) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.DR_task.create"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(deviceConfig), Marshalling.toXMLRPC(whitelist)}; @@ -222,15 +223,15 @@ public class DRTask extends XenAPIObject { * @return The reference to the created task */ public static DRTask create(Connection c, String type, Map deviceConfig, Set whitelist) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "DR_task.create"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(deviceConfig), Marshalling.toXMLRPC(whitelist)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDRTask(result); + return Types.toDRTask(result); } /** @@ -239,9 +240,9 @@ public class DRTask extends XenAPIObject { * @return Task */ public Task destroyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.DR_task.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -255,9 +256,9 @@ public class DRTask extends XenAPIObject { * */ public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "DR_task.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -271,15 +272,15 @@ public class DRTask extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "DR_task.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfDRTask(result); + return Types.toSetOfDRTask(result); } /** @@ -288,15 +289,15 @@ public class DRTask extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "DR_task.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfDRTaskDRTaskRecord(result); + return Types.toMapOfDRTaskDRTaskRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/DataSource.java b/deps/XenServerJava/src/com/xensource/xenapi/DataSource.java index 5f777a32197..9a4bfcd6f74 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/DataSource.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/DataSource.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class DataSource extends XenAPIObject { * For internal use only. */ DataSource(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class DataSource extends XenAPIObject { { if (obj != null && obj instanceof DataSource) { - DataSource other = (DataSource)obj; + DataSource other = (DataSource) obj; return other.ref.equals(this.ref); } else { @@ -113,8 +114,8 @@ public class DataSource extends XenAPIObject { /** * Convert a data_source.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("name_label", this.nameLabel == null ? "" : this.nameLabel); map.put("name_description", this.nameDescription == null ? "" : this.nameDescription); map.put("enabled", this.enabled == null ? false : this.enabled); diff --git a/deps/XenServerJava/src/com/xensource/xenapi/Event.java b/deps/XenServerJava/src/com/xensource/xenapi/Event.java index ec438140fe2..27db4a5652c 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/Event.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/Event.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class Event extends XenAPIObject { * For internal use only. */ Event(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class Event extends XenAPIObject { { if (obj != null && obj instanceof Event) { - Event other = (Event)obj; + Event other = (Event) obj; return other.ref.equals(this.ref); } else { @@ -112,8 +113,8 @@ public class Event extends XenAPIObject { /** * Convert a event.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("id", this.id == null ? 0 : this.id); map.put("timestamp", this.timestamp == null ? new Date(0) : this.timestamp); map.put("class", this.clazz == null ? "" : this.clazz); @@ -162,9 +163,9 @@ public class Event extends XenAPIObject { * @return Task */ public static Task registerAsync(Connection c, Set classes) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.event.register"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(classes)}; @@ -179,9 +180,9 @@ public class Event extends XenAPIObject { * @param classes register for events for the indicated classes */ public static void register(Connection c, Set classes) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "event.register"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(classes)}; @@ -196,9 +197,9 @@ public class Event extends XenAPIObject { * @return Task */ public static Task unregisterAsync(Connection c, Set classes) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.event.unregister"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(classes)}; @@ -213,9 +214,9 @@ public class Event extends XenAPIObject { * @param classes remove this session's registration for the indicated classes */ public static void unregister(Connection c, Set classes) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "event.unregister"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(classes)}; @@ -229,17 +230,17 @@ public class Event extends XenAPIObject { * @return the batch of events */ public static Set next(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.SessionNotRegistered, - Types.EventsLost { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.SessionNotRegistered, + Types.EventsLost { String method_call = "event.next"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfEventRecord(result); + return Types.toSetOfEventRecord(result); } /** @@ -251,17 +252,17 @@ public class Event extends XenAPIObject { * @return the batch of events */ public static Set from(Connection c, Set classes, String token, Double timeout) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.SessionNotRegistered, - Types.EventsLost { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.SessionNotRegistered, + Types.EventsLost { String method_call = "event.from"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(classes), Marshalling.toXMLRPC(token), Marshalling.toXMLRPC(timeout)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfEventRecord(result); + return Types.toSetOfEventRecord(result); } /** @@ -270,15 +271,15 @@ public class Event extends XenAPIObject { * @return the event ID */ public static Long getCurrentId(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "event.get_current_id"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -289,20 +290,20 @@ public class Event extends XenAPIObject { * @return the event ID */ public static String inject(Connection c, String clazz, String ref) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "event.inject"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(clazz), Marshalling.toXMLRPC(ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } public static Map properFrom(Connection c, Set classes, String token, Double timeout) throws BadServerResponse, XenAPIException, XmlRpcException, - Types.SessionNotRegistered, - Types.EventsLost { + Types.SessionNotRegistered, + Types.EventsLost { String method_call = "event.from"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(classes), Marshalling.toXMLRPC(token), Marshalling.toXMLRPC(timeout)}; diff --git a/deps/XenServerJava/src/com/xensource/xenapi/GPUGroup.java b/deps/XenServerJava/src/com/xensource/xenapi/GPUGroup.java index 90704462703..916d8b64aea 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/GPUGroup.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/GPUGroup.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class GPUGroup extends XenAPIObject { * For internal use only. */ GPUGroup(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class GPUGroup extends XenAPIObject { { if (obj != null && obj instanceof GPUGroup) { - GPUGroup other = (GPUGroup)obj; + GPUGroup other = (GPUGroup) obj; return other.ref.equals(this.ref); } else { @@ -106,14 +107,17 @@ public class GPUGroup extends XenAPIObject { print.printf("%1$20s: %2$s\n", "VGPUs", this.VGPUs); print.printf("%1$20s: %2$s\n", "GPUTypes", this.GPUTypes); print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig); + print.printf("%1$20s: %2$s\n", "allocationAlgorithm", this.allocationAlgorithm); + print.printf("%1$20s: %2$s\n", "supportedVGPUTypes", this.supportedVGPUTypes); + print.printf("%1$20s: %2$s\n", "enabledVGPUTypes", this.enabledVGPUTypes); return writer.toString(); } /** * Convert a GPU_group.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("name_label", this.nameLabel == null ? "" : this.nameLabel); map.put("name_description", this.nameDescription == null ? "" : this.nameDescription); @@ -121,6 +125,9 @@ public class GPUGroup extends XenAPIObject { map.put("VGPUs", this.VGPUs == null ? new LinkedHashSet() : this.VGPUs); map.put("GPU_types", this.GPUTypes == null ? new LinkedHashSet() : this.GPUTypes); map.put("other_config", this.otherConfig == null ? new HashMap() : this.otherConfig); + map.put("allocation_algorithm", this.allocationAlgorithm == null ? Types.AllocationAlgorithm.UNRECOGNIZED : this.allocationAlgorithm); + map.put("supported_VGPU_types", this.supportedVGPUTypes == null ? new LinkedHashSet() : this.supportedVGPUTypes); + map.put("enabled_VGPU_types", this.enabledVGPUTypes == null ? new LinkedHashSet() : this.enabledVGPUTypes); return map; } @@ -152,6 +159,18 @@ public class GPUGroup extends XenAPIObject { * Additional configuration */ public Map otherConfig; + /** + * Current allocation of vGPUs to pGPUs for this group + */ + public Types.AllocationAlgorithm allocationAlgorithm; + /** + * vGPU types supported on at least one of the pGPUs in this group + */ + public Set supportedVGPUTypes; + /** + * vGPU types supported on at least one of the pGPUs in this group + */ + public Set enabledVGPUTypes; } /** @@ -160,15 +179,15 @@ public class GPUGroup extends XenAPIObject { * @return all fields from the object */ public GPUGroup.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "GPU_group.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toGPUGroupRecord(result); + return Types.toGPUGroupRecord(result); } /** @@ -178,15 +197,15 @@ public class GPUGroup extends XenAPIObject { * @return reference to the object */ public static GPUGroup getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "GPU_group.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toGPUGroup(result); + return Types.toGPUGroup(result); } /** @@ -196,15 +215,15 @@ public class GPUGroup extends XenAPIObject { * @return references to objects with matching names */ public static Set getByNameLabel(Connection c, String label) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "GPU_group.get_by_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfGPUGroup(result); + return Types.toSetOfGPUGroup(result); } /** @@ -213,15 +232,15 @@ public class GPUGroup extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "GPU_group.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -230,15 +249,15 @@ public class GPUGroup extends XenAPIObject { * @return value of the field */ public String getNameLabel(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "GPU_group.get_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -247,15 +266,15 @@ public class GPUGroup extends XenAPIObject { * @return value of the field */ public String getNameDescription(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "GPU_group.get_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -264,15 +283,15 @@ public class GPUGroup extends XenAPIObject { * @return value of the field */ public Set getPGPUs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "GPU_group.get_PGPUs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfPGPU(result); + return Types.toSetOfPGPU(result); } /** @@ -281,15 +300,15 @@ public class GPUGroup extends XenAPIObject { * @return value of the field */ public Set getVGPUs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "GPU_group.get_VGPUs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVGPU(result); + return Types.toSetOfVGPU(result); } /** @@ -298,15 +317,15 @@ public class GPUGroup extends XenAPIObject { * @return value of the field */ public Set getGPUTypes(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "GPU_group.get_GPU_types"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -315,15 +334,66 @@ public class GPUGroup extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "GPU_group.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); + } + + /** + * Get the allocation_algorithm field of the given GPU_group. + * + * @return value of the field + */ + public Types.AllocationAlgorithm getAllocationAlgorithm(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "GPU_group.get_allocation_algorithm"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toAllocationAlgorithm(result); + } + + /** + * Get the supported_VGPU_types field of the given GPU_group. + * + * @return value of the field + */ + public Set getSupportedVGPUTypes(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "GPU_group.get_supported_VGPU_types"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toSetOfVGPUType(result); + } + + /** + * Get the enabled_VGPU_types field of the given GPU_group. + * + * @return value of the field + */ + public Set getEnabledVGPUTypes(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "GPU_group.get_enabled_VGPU_types"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toSetOfVGPUType(result); } /** @@ -332,9 +402,9 @@ public class GPUGroup extends XenAPIObject { * @param label New value to set */ public void setNameLabel(Connection c, String label) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "GPU_group.set_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(label)}; @@ -348,9 +418,9 @@ public class GPUGroup extends XenAPIObject { * @param description New value to set */ public void setNameDescription(Connection c, String description) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "GPU_group.set_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(description)}; @@ -364,9 +434,9 @@ public class GPUGroup extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "GPU_group.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -381,9 +451,9 @@ public class GPUGroup extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "GPU_group.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -397,9 +467,9 @@ public class GPUGroup extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "GPU_group.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -407,21 +477,145 @@ public class GPUGroup extends XenAPIObject { return; } + /** + * Set the allocation_algorithm field of the given GPU_group. + * + * @param allocationAlgorithm New value to set + */ + public void setAllocationAlgorithm(Connection c, Types.AllocationAlgorithm allocationAlgorithm) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "GPU_group.set_allocation_algorithm"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(allocationAlgorithm)}; + Map response = c.dispatch(method_call, method_params); + return; + } + + /** + * + * + * @param nameLabel + * @param nameDescription + * @param otherConfig + * @return Task + */ + public static Task createAsync(Connection c, String nameLabel, String nameDescription, Map otherConfig) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "Async.GPU_group.create"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(otherConfig)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toTask(result); + } + + /** + * + * + * @param nameLabel + * @param nameDescription + * @param otherConfig + * @return + */ + public static GPUGroup create(Connection c, String nameLabel, String nameDescription, Map otherConfig) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "GPU_group.create"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(otherConfig)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toGPUGroup(result); + } + + /** + * + * + * @return Task + */ + public Task destroyAsync(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "Async.GPU_group.destroy"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toTask(result); + } + + /** + * + * + */ + public void destroy(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "GPU_group.destroy"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + return; + } + + /** + * + * + * @param vgpuType The VGPU_type for which the remaining capacity will be calculated + * @return Task + */ + public Task getRemainingCapacityAsync(Connection c, VGPUType vgpuType) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "Async.GPU_group.get_remaining_capacity"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(vgpuType)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toTask(result); + } + + /** + * + * + * @param vgpuType The VGPU_type for which the remaining capacity will be calculated + * @return The number of VGPUs of the given type which can still be started on the PGPUs in the group + */ + public Long getRemainingCapacity(Connection c, VGPUType vgpuType) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "GPU_group.get_remaining_capacity"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(vgpuType)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toLong(result); + } + /** * Return a list of all the GPU_groups known to the system. * * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "GPU_group.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfGPUGroup(result); + return Types.toSetOfGPUGroup(result); } /** @@ -430,15 +624,15 @@ public class GPUGroup extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "GPU_group.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfGPUGroupGPUGroupRecord(result); + return Types.toMapOfGPUGroupGPUGroupRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/Host.java b/deps/XenServerJava/src/com/xensource/xenapi/Host.java index 21950482123..0bbae111641 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/Host.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/Host.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class Host extends XenAPIObject { * For internal use only. */ Host(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class Host extends XenAPIObject { { if (obj != null && obj instanceof Host) { - Host other = (Host)obj; + Host other = (Host) obj; return other.ref.equals(this.ref); } else { @@ -146,14 +147,15 @@ public class Host extends XenAPIObject { print.printf("%1$20s: %2$s\n", "chipsetInfo", this.chipsetInfo); print.printf("%1$20s: %2$s\n", "PCIs", this.PCIs); print.printf("%1$20s: %2$s\n", "PGPUs", this.PGPUs); + print.printf("%1$20s: %2$s\n", "guestVCPUsParams", this.guestVCPUsParams); return writer.toString(); } /** * Convert a host.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("name_label", this.nameLabel == null ? "" : this.nameLabel); map.put("name_description", this.nameDescription == null ? "" : this.nameDescription); @@ -163,8 +165,7 @@ public class Host extends XenAPIObject { map.put("API_version_major", this.APIVersionMajor == null ? 0 : this.APIVersionMajor); map.put("API_version_minor", this.APIVersionMinor == null ? 0 : this.APIVersionMinor); map.put("API_version_vendor", this.APIVersionVendor == null ? "" : this.APIVersionVendor); - map.put("API_version_vendor_implementation", this.APIVersionVendorImplementation == null ? new HashMap() - : this.APIVersionVendorImplementation); + map.put("API_version_vendor_implementation", this.APIVersionVendorImplementation == null ? new HashMap() : this.APIVersionVendorImplementation); map.put("enabled", this.enabled == null ? false : this.enabled); map.put("software_version", this.softwareVersion == null ? new HashMap() : this.softwareVersion); map.put("other_config", this.otherConfig == null ? new HashMap() : this.otherConfig); @@ -202,6 +203,7 @@ public class Host extends XenAPIObject { map.put("chipset_info", this.chipsetInfo == null ? new HashMap() : this.chipsetInfo); map.put("PCIs", this.PCIs == null ? new LinkedHashSet() : this.PCIs); map.put("PGPUs", this.PGPUs == null ? new LinkedHashSet() : this.PGPUs); + map.put("guest_VCPUs_params", this.guestVCPUsParams == null ? new HashMap() : this.guestVCPUsParams); return map; } @@ -393,6 +395,10 @@ public class Host extends XenAPIObject { * List of physical GPUs in the host */ public Set PGPUs; + /** + * VCPUs params to apply to all resident guests + */ + public Map guestVCPUsParams; } /** @@ -401,15 +407,15 @@ public class Host extends XenAPIObject { * @return all fields from the object */ public Host.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toHostRecord(result); + return Types.toHostRecord(result); } /** @@ -419,15 +425,15 @@ public class Host extends XenAPIObject { * @return reference to the object */ public static Host getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toHost(result); + return Types.toHost(result); } /** @@ -437,15 +443,15 @@ public class Host extends XenAPIObject { * @return references to objects with matching names */ public static Set getByNameLabel(Connection c, String label) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_by_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfHost(result); + return Types.toSetOfHost(result); } /** @@ -454,15 +460,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -471,15 +477,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public String getNameLabel(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -488,15 +494,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public String getNameDescription(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -505,15 +511,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Long getMemoryOverhead(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_memory_overhead"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -522,15 +528,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Set getAllowedOperations(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_allowed_operations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfHostAllowedOperations(result); + return Types.toSetOfHostAllowedOperations(result); } /** @@ -539,15 +545,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Map getCurrentOperations(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_current_operations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringHostAllowedOperations(result); + return Types.toMapOfStringHostAllowedOperations(result); } /** @@ -556,15 +562,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Long getAPIVersionMajor(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_API_version_major"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -573,15 +579,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Long getAPIVersionMinor(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_API_version_minor"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -590,15 +596,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public String getAPIVersionVendor(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_API_version_vendor"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -607,15 +613,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Map getAPIVersionVendorImplementation(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_API_version_vendor_implementation"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -624,15 +630,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Boolean getEnabled(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_enabled"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -641,15 +647,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Map getSoftwareVersion(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_software_version"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -658,15 +664,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -675,15 +681,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Set getCapabilities(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_capabilities"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -692,15 +698,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Map getCpuConfiguration(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_cpu_configuration"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -709,15 +715,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public String getSchedPolicy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_sched_policy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -726,15 +732,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Set getSupportedBootloaders(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_supported_bootloaders"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -743,15 +749,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Set getResidentVMs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_resident_VMs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVM(result); + return Types.toSetOfVM(result); } /** @@ -760,15 +766,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Map getLogging(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_logging"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -777,15 +783,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Set getPIFs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_PIFs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfPIF(result); + return Types.toSetOfPIF(result); } /** @@ -794,15 +800,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public SR getSuspendImageSr(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_suspend_image_sr"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSR(result); + return Types.toSR(result); } /** @@ -811,15 +817,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public SR getCrashDumpSr(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_crash_dump_sr"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSR(result); + return Types.toSR(result); } /** @@ -828,15 +834,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Set getCrashdumps(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_crashdumps"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfHostCrashdump(result); + return Types.toSetOfHostCrashdump(result); } /** @@ -845,15 +851,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Set getPatches(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_patches"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfHostPatch(result); + return Types.toSetOfHostPatch(result); } /** @@ -862,15 +868,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Set getPBDs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_PBDs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfPBD(result); + return Types.toSetOfPBD(result); } /** @@ -879,15 +885,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Set getHostCPUs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_host_CPUs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfHostCpu(result); + return Types.toSetOfHostCpu(result); } /** @@ -896,15 +902,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Map getCpuInfo(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_cpu_info"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -913,15 +919,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public String getHostname(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_hostname"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -930,15 +936,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public String getAddress(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_address"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -947,15 +953,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public HostMetrics getMetrics(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_metrics"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toHostMetrics(result); + return Types.toHostMetrics(result); } /** @@ -964,15 +970,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Map getLicenseParams(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_license_params"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -981,15 +987,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Set getHaStatefiles(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_ha_statefiles"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -998,15 +1004,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Set getHaNetworkPeers(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_ha_network_peers"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -1015,15 +1021,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Map getBlobs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_blobs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringBlob(result); + return Types.toMapOfStringBlob(result); } /** @@ -1032,15 +1038,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Set getTags(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_tags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -1049,15 +1055,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public String getExternalAuthType(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_external_auth_type"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -1066,15 +1072,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public String getExternalAuthServiceName(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_external_auth_service_name"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -1083,15 +1089,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Map getExternalAuthConfiguration(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_external_auth_configuration"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -1100,15 +1106,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public String getEdition(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_edition"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -1117,15 +1123,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Map getLicenseServer(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_license_server"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -1134,15 +1140,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Map getBiosStrings(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_bios_strings"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -1151,15 +1157,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public String getPowerOnMode(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_power_on_mode"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -1168,15 +1174,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Map getPowerOnConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_power_on_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -1185,15 +1191,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public SR getLocalCacheSr(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_local_cache_sr"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSR(result); + return Types.toSR(result); } /** @@ -1202,15 +1208,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Map getChipsetInfo(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_chipset_info"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -1219,15 +1225,15 @@ public class Host extends XenAPIObject { * @return value of the field */ public Set getPCIs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_PCIs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfPCI(result); + return Types.toSetOfPCI(result); } /** @@ -1236,15 +1242,32 @@ public class Host extends XenAPIObject { * @return value of the field */ public Set getPGPUs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_PGPUs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfPGPU(result); + return Types.toSetOfPGPU(result); + } + + /** + * Get the guest_VCPUs_params field of the given host. + * + * @return value of the field + */ + public Map getGuestVCPUsParams(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "host.get_guest_VCPUs_params"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toMapOfStringString(result); } /** @@ -1253,9 +1276,9 @@ public class Host extends XenAPIObject { * @param label New value to set */ public void setNameLabel(Connection c, String label) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.set_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(label)}; @@ -1269,9 +1292,9 @@ public class Host extends XenAPIObject { * @param description New value to set */ public void setNameDescription(Connection c, String description) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.set_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(description)}; @@ -1285,9 +1308,9 @@ public class Host extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -1302,9 +1325,9 @@ public class Host extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -1318,9 +1341,9 @@ public class Host extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -1334,9 +1357,9 @@ public class Host extends XenAPIObject { * @param logging New value to set */ public void setLogging(Connection c, Map logging) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.set_logging"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(logging)}; @@ -1351,9 +1374,9 @@ public class Host extends XenAPIObject { * @param value Value to add */ public void addToLogging(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.add_to_logging"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -1367,9 +1390,9 @@ public class Host extends XenAPIObject { * @param key Key to remove */ public void removeFromLogging(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.remove_from_logging"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -1383,9 +1406,9 @@ public class Host extends XenAPIObject { * @param suspendImageSr New value to set */ public void setSuspendImageSr(Connection c, SR suspendImageSr) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.set_suspend_image_sr"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(suspendImageSr)}; @@ -1399,9 +1422,9 @@ public class Host extends XenAPIObject { * @param crashDumpSr New value to set */ public void setCrashDumpSr(Connection c, SR crashDumpSr) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.set_crash_dump_sr"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(crashDumpSr)}; @@ -1415,9 +1438,9 @@ public class Host extends XenAPIObject { * @param hostname New value to set */ public void setHostname(Connection c, String hostname) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.set_hostname"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(hostname)}; @@ -1431,9 +1454,9 @@ public class Host extends XenAPIObject { * @param address New value to set */ public void setAddress(Connection c, String address) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.set_address"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(address)}; @@ -1447,9 +1470,9 @@ public class Host extends XenAPIObject { * @param tags New value to set */ public void setTags(Connection c, Set tags) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.set_tags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(tags)}; @@ -1463,9 +1486,9 @@ public class Host extends XenAPIObject { * @param value New value to add */ public void addTags(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.add_tags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1479,9 +1502,9 @@ public class Host extends XenAPIObject { * @param value Value to remove */ public void removeTags(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.remove_tags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1495,9 +1518,9 @@ public class Host extends XenAPIObject { * @param licenseServer New value to set */ public void setLicenseServer(Connection c, Map licenseServer) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.set_license_server"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(licenseServer)}; @@ -1512,9 +1535,9 @@ public class Host extends XenAPIObject { * @param value Value to add */ public void addToLicenseServer(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.add_to_license_server"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -1528,9 +1551,9 @@ public class Host extends XenAPIObject { * @param key Key to remove */ public void removeFromLicenseServer(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.remove_from_license_server"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -1538,15 +1561,64 @@ public class Host extends XenAPIObject { return; } + /** + * Set the guest_VCPUs_params field of the given host. + * + * @param guestVCPUsParams New value to set + */ + public void setGuestVCPUsParams(Connection c, Map guestVCPUsParams) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "host.set_guest_VCPUs_params"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(guestVCPUsParams)}; + Map response = c.dispatch(method_call, method_params); + return; + } + + /** + * Add the given key-value pair to the guest_VCPUs_params field of the given host. + * + * @param key Key to add + * @param value Value to add + */ + public void addToGuestVCPUsParams(Connection c, String key, String value) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "host.add_to_guest_VCPUs_params"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; + Map response = c.dispatch(method_call, method_params); + return; + } + + /** + * Remove the given key and its corresponding value from the guest_VCPUs_params field of the given host. If the key is not in that Map, then do nothing. + * + * @param key Key to remove + */ + public void removeFromGuestVCPUsParams(Connection c, String key) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "host.remove_from_guest_VCPUs_params"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; + Map response = c.dispatch(method_call, method_params); + return; + } + /** * Puts the host into a state in which no new VMs can be started. Currently active VMs on the host continue to execute. * * @return Task */ public Task disableAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.disable"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1560,9 +1632,9 @@ public class Host extends XenAPIObject { * */ public void disable(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.disable"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1576,9 +1648,9 @@ public class Host extends XenAPIObject { * @return Task */ public Task enableAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.enable"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1592,9 +1664,9 @@ public class Host extends XenAPIObject { * */ public void enable(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.enable"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1608,9 +1680,9 @@ public class Host extends XenAPIObject { * @return Task */ public Task shutdownAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.shutdown"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1624,9 +1696,9 @@ public class Host extends XenAPIObject { * */ public void shutdown(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.shutdown"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1640,9 +1712,9 @@ public class Host extends XenAPIObject { * @return Task */ public Task rebootAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.reboot"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1656,9 +1728,9 @@ public class Host extends XenAPIObject { * */ public void reboot(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.reboot"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1672,9 +1744,9 @@ public class Host extends XenAPIObject { * @return Task */ public Task dmesgAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.dmesg"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1689,15 +1761,15 @@ public class Host extends XenAPIObject { * @return dmesg string */ public String dmesg(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.dmesg"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -1706,9 +1778,9 @@ public class Host extends XenAPIObject { * @return Task */ public Task dmesgClearAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.dmesg_clear"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1723,15 +1795,15 @@ public class Host extends XenAPIObject { * @return dmesg string */ public String dmesgClear(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.dmesg_clear"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -1740,9 +1812,9 @@ public class Host extends XenAPIObject { * @return Task */ public Task getLogAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.get_log"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1757,15 +1829,15 @@ public class Host extends XenAPIObject { * @return The contents of the host's primary log file */ public String getLog(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_log"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -1775,9 +1847,9 @@ public class Host extends XenAPIObject { * @return Task */ public Task sendDebugKeysAsync(Connection c, String keys) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.send_debug_keys"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(keys)}; @@ -1792,9 +1864,9 @@ public class Host extends XenAPIObject { * @param keys The keys to send */ public void sendDebugKeys(Connection c, String keys) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.send_debug_keys"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(keys)}; @@ -1810,9 +1882,9 @@ public class Host extends XenAPIObject { * @return Task */ public Task bugreportUploadAsync(Connection c, String url, Map options) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.bugreport_upload"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(url), Marshalling.toXMLRPC(options)}; @@ -1828,9 +1900,9 @@ public class Host extends XenAPIObject { * @param options Extra configuration operations */ public void bugreportUpload(Connection c, String url, Map options) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.bugreport_upload"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(url), Marshalling.toXMLRPC(options)}; @@ -1844,15 +1916,15 @@ public class Host extends XenAPIObject { * @return The name of every supported method. */ public static Set listMethods(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.list_methods"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -1862,10 +1934,10 @@ public class Host extends XenAPIObject { * @return Task */ public Task licenseApplyAsync(Connection c, String contents) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.LicenseProcessingError { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.LicenseProcessingError { String method_call = "Async.host.license_apply"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(contents)}; @@ -1880,10 +1952,10 @@ public class Host extends XenAPIObject { * @param contents The contents of the license file, base64 encoded */ public void licenseApply(Connection c, String contents) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.LicenseProcessingError { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.LicenseProcessingError { String method_call = "host.license_apply"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(contents)}; @@ -1897,9 +1969,9 @@ public class Host extends XenAPIObject { * @return Task */ public Task destroyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1913,9 +1985,9 @@ public class Host extends XenAPIObject { * */ public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1929,9 +2001,9 @@ public class Host extends XenAPIObject { * @return Task */ public Task powerOnAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.power_on"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1945,9 +2017,9 @@ public class Host extends XenAPIObject { * */ public void powerOn(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.power_on"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1960,9 +2032,9 @@ public class Host extends XenAPIObject { * */ public static void emergencyHaDisable(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.emergency_ha_disable"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; @@ -1971,20 +2043,20 @@ public class Host extends XenAPIObject { } /** - * + * * * @return A set of data sources */ public Set getDataSources(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_data_sources"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfDataSourceRecord(result); + return Types.toSetOfDataSourceRecord(result); } /** @@ -1993,9 +2065,9 @@ public class Host extends XenAPIObject { * @param dataSource The data source to record */ public void recordDataSource(Connection c, String dataSource) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.record_data_source"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(dataSource)}; @@ -2010,15 +2082,15 @@ public class Host extends XenAPIObject { * @return The latest value, averaged over the last 5 seconds */ public Double queryDataSource(Connection c, String dataSource) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.query_data_source"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(dataSource)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDouble(result); + return Types.toDouble(result); } /** @@ -2027,9 +2099,9 @@ public class Host extends XenAPIObject { * @param dataSource The data source whose archives are to be forgotten */ public void forgetDataSourceArchives(Connection c, String dataSource) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.forget_data_source_archives"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(dataSource)}; @@ -2043,9 +2115,9 @@ public class Host extends XenAPIObject { * @return Task */ public Task assertCanEvacuateAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.assert_can_evacuate"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2059,9 +2131,9 @@ public class Host extends XenAPIObject { * */ public void assertCanEvacuate(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.assert_can_evacuate"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2075,9 +2147,9 @@ public class Host extends XenAPIObject { * @return Task */ public Task getVmsWhichPreventEvacuationAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.get_vms_which_prevent_evacuation"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2092,15 +2164,15 @@ public class Host extends XenAPIObject { * @return VMs which block evacuation together with reasons */ public Map> getVmsWhichPreventEvacuation(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_vms_which_prevent_evacuation"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfVMSetOfString(result); + return Types.toMapOfVMSetOfString(result); } /** @@ -2109,11 +2181,10 @@ public class Host extends XenAPIObject { * * @return Task */ - @Deprecated - public Task getUncooperativeResidentVMsAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public Task getUncooperativeResidentVMsAsync(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.get_uncooperative_resident_VMs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2128,17 +2199,16 @@ public class Host extends XenAPIObject { * * @return VMs which are not co-operating */ - @Deprecated - public Set getUncooperativeResidentVMs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public Set getUncooperativeResidentVMs(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_uncooperative_resident_VMs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVM(result); + return Types.toSetOfVM(result); } /** @@ -2147,9 +2217,9 @@ public class Host extends XenAPIObject { * @return Task */ public Task evacuateAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.evacuate"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2163,9 +2233,9 @@ public class Host extends XenAPIObject { * */ public void evacuate(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.evacuate"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2179,9 +2249,9 @@ public class Host extends XenAPIObject { * @return Task */ public Task syslogReconfigureAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.syslog_reconfigure"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2195,9 +2265,9 @@ public class Host extends XenAPIObject { * */ public void syslogReconfigure(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.syslog_reconfigure"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2212,9 +2282,9 @@ public class Host extends XenAPIObject { * @return Task */ public static Task managementReconfigureAsync(Connection c, PIF pif) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.management_reconfigure"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(pif)}; @@ -2229,9 +2299,9 @@ public class Host extends XenAPIObject { * @param pif reference to a PIF object corresponding to the management interface */ public static void managementReconfigure(Connection c, PIF pif) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.management_reconfigure"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(pif)}; @@ -2245,9 +2315,9 @@ public class Host extends XenAPIObject { * @param iface name of the interface to use as a management interface */ public static void localManagementReconfigure(Connection c, String iface) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.local_management_reconfigure"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(iface)}; @@ -2260,9 +2330,9 @@ public class Host extends XenAPIObject { * */ public static void managementDisable(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.management_disable"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; @@ -2276,9 +2346,9 @@ public class Host extends XenAPIObject { * @return Task */ public Task getManagementIfaceAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.get_management_interface"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2293,32 +2363,32 @@ public class Host extends XenAPIObject { * @return The managment interface for the host */ public PIF getManagementIface(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_management_interface"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPIF(result); + return Types.toPIF(result); } /** - * + * * * @return An XML fragment containing the system status capabilities. */ public String getSystemStatusCapabilities(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_system_status_capabilities"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -2327,9 +2397,9 @@ public class Host extends XenAPIObject { * @return Task */ public Task restartAgentAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.restart_agent"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2343,9 +2413,9 @@ public class Host extends XenAPIObject { * */ public void restartAgent(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.restart_agent"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2358,9 +2428,9 @@ public class Host extends XenAPIObject { * */ public static void shutdownAgent(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.shutdown_agent"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; @@ -2374,10 +2444,10 @@ public class Host extends XenAPIObject { * @param hostname The new host name */ public void setHostnameLive(Connection c, String hostname) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.HostNameInvalid { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.HostNameInvalid { String method_call = "host.set_hostname_live"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(hostname)}; @@ -2391,9 +2461,9 @@ public class Host extends XenAPIObject { * @return Task */ public Task computeFreeMemoryAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.compute_free_memory"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2408,15 +2478,15 @@ public class Host extends XenAPIObject { * @return the amount of free memory on the host. */ public Long computeFreeMemory(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.compute_free_memory"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -2425,9 +2495,9 @@ public class Host extends XenAPIObject { * @return Task */ public Task computeMemoryOverheadAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.compute_memory_overhead"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2442,15 +2512,15 @@ public class Host extends XenAPIObject { * @return the virtualization memory overhead of the host. */ public Long computeMemoryOverhead(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.compute_memory_overhead"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -2458,9 +2528,9 @@ public class Host extends XenAPIObject { * */ public void syncData(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.sync_data"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2474,9 +2544,9 @@ public class Host extends XenAPIObject { * @param delay Delay in seconds from when the call is received to perform the backup */ public void backupRrds(Connection c, Double delay) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.backup_rrds"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(delay)}; @@ -2493,13 +2563,12 @@ public class Host extends XenAPIObject { * @return Task */ public Task createNewBlobAsync(Connection c, String name, String mimeType, Boolean _public) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.create_new_blob"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), - Marshalling.toXMLRPC(_public)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), Marshalling.toXMLRPC(_public)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -2514,16 +2583,15 @@ public class Host extends XenAPIObject { * @return The reference of the blob, needed for populating its data */ public Blob createNewBlob(Connection c, String name, String mimeType, Boolean _public) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.create_new_blob"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), - Marshalling.toXMLRPC(_public)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), Marshalling.toXMLRPC(_public)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBlob(result); + return Types.toBlob(result); } /** @@ -2535,13 +2603,12 @@ public class Host extends XenAPIObject { * @return Task */ public Task callPluginAsync(Connection c, String plugin, String fn, Map args) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.call_plugin"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(plugin), Marshalling.toXMLRPC(fn), - Marshalling.toXMLRPC(args)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(plugin), Marshalling.toXMLRPC(fn), Marshalling.toXMLRPC(args)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -2556,16 +2623,15 @@ public class Host extends XenAPIObject { * @return Result from the plugin */ public String callPlugin(Connection c, String plugin, String fn, Map args) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.call_plugin"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(plugin), Marshalling.toXMLRPC(fn), - Marshalling.toXMLRPC(args)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(plugin), Marshalling.toXMLRPC(fn), Marshalling.toXMLRPC(args)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -2574,15 +2640,15 @@ public class Host extends XenAPIObject { * @return The current time */ public Date getServertime(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_servertime"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDate(result); + return Types.toDate(result); } /** @@ -2591,15 +2657,15 @@ public class Host extends XenAPIObject { * @return The current local time */ public Date getServerLocaltime(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_server_localtime"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDate(result); + return Types.toDate(result); } /** @@ -2610,13 +2676,12 @@ public class Host extends XenAPIObject { * @param authType The type of authentication (e.g. AD for Active Directory) */ public void enableExternalAuth(Connection c, Map config, String serviceName, String authType) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.enable_external_auth"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(config), Marshalling.toXMLRPC(serviceName), - Marshalling.toXMLRPC(authType)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(config), Marshalling.toXMLRPC(serviceName), Marshalling.toXMLRPC(authType)}; Map response = c.dispatch(method_call, method_params); return; } @@ -2627,9 +2692,9 @@ public class Host extends XenAPIObject { * @param config Optional parameters as a list of key-values containing the configuration data */ public void disableExternalAuth(Connection c, Map config) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.disable_external_auth"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(config)}; @@ -2643,9 +2708,9 @@ public class Host extends XenAPIObject { * @return Task */ public Task retrieveWlbEvacuateRecommendationsAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.retrieve_wlb_evacuate_recommendations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2660,15 +2725,15 @@ public class Host extends XenAPIObject { * @return VMs and the reasons why they would block evacuation, or their target host recommended by the wlb server */ public Map> retrieveWlbEvacuateRecommendations(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.retrieve_wlb_evacuate_recommendations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfVMSetOfString(result); + return Types.toMapOfVMSetOfString(result); } /** @@ -2677,9 +2742,9 @@ public class Host extends XenAPIObject { * @return Task */ public Task getServerCertificateAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.get_server_certificate"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2694,29 +2759,30 @@ public class Host extends XenAPIObject { * @return The installed server SSL certificate, in PEM form. */ public String getServerCertificate(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_server_certificate"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** * Change to another edition, or reactivate the current edition after a license has expired. This may be subject to the successful checkout of an appropriate license. * * @param edition The requested edition + * @param force Update the license params even if the apply call fails */ - public void applyEdition(Connection c, String edition) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + public void applyEdition(Connection c, String edition, Boolean force) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.apply_edition"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(edition)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(edition), Marshalling.toXMLRPC(force)}; Map response = c.dispatch(method_call, method_params); return; } @@ -2727,9 +2793,9 @@ public class Host extends XenAPIObject { * @return Task */ public Task refreshPackInfoAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.refresh_pack_info"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2743,9 +2809,9 @@ public class Host extends XenAPIObject { * */ public void refreshPackInfo(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.refresh_pack_info"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2754,16 +2820,16 @@ public class Host extends XenAPIObject { } /** - * Set the power-on-mode, host, user and password + * Set the power-on-mode, host, user and password * * @param powerOnMode power-on-mode can be empty,iLO,wake-on-lan, DRAC or other * @param powerOnConfig Power on config * @return Task */ public Task setPowerOnModeAsync(Connection c, String powerOnMode, Map powerOnConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.set_power_on_mode"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(powerOnMode), Marshalling.toXMLRPC(powerOnConfig)}; @@ -2773,15 +2839,15 @@ public class Host extends XenAPIObject { } /** - * Set the power-on-mode, host, user and password + * Set the power-on-mode, host, user and password * * @param powerOnMode power-on-mode can be empty,iLO,wake-on-lan, DRAC or other * @param powerOnConfig Power on config */ public void setPowerOnMode(Connection c, String powerOnMode, Map powerOnConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.set_power_on_mode"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(powerOnMode), Marshalling.toXMLRPC(powerOnConfig)}; @@ -2795,9 +2861,9 @@ public class Host extends XenAPIObject { * @param features The features string (32 hexadecimal digits) */ public void setCpuFeatures(Connection c, String features) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.set_cpu_features"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(features)}; @@ -2810,9 +2876,9 @@ public class Host extends XenAPIObject { * */ public void resetCpuFeatures(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.reset_cpu_features"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2826,9 +2892,9 @@ public class Host extends XenAPIObject { * @param sr The SR to use as a local cache */ public void enableLocalStorageCaching(Connection c, SR sr) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.enable_local_storage_caching"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(sr)}; @@ -2841,9 +2907,9 @@ public class Host extends XenAPIObject { * */ public void disableLocalStorageCaching(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.disable_local_storage_caching"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2859,9 +2925,9 @@ public class Host extends XenAPIObject { * @return Task */ public Task migrateReceiveAsync(Connection c, Network network, Map options) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host.migrate_receive"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(options)}; @@ -2878,15 +2944,47 @@ public class Host extends XenAPIObject { * @return A value which should be passed to VM.migrate */ public Map migrateReceive(Connection c, Network network, Map options) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.migrate_receive"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(options)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); + } + + /** + * Declare that a host is dead. This is a dangerous operation, and should only be called if the administrator is absolutely sure the host is definitely dead + * + * @return Task + */ + public Task declareDeadAsync(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "Async.host.declare_dead"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toTask(result); + } + + /** + * Declare that a host is dead. This is a dangerous operation, and should only be called if the administrator is absolutely sure the host is definitely dead + * + */ + public void declareDead(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "host.declare_dead"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + return; } /** @@ -2895,15 +2993,15 @@ public class Host extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfHost(result); + return Types.toSetOfHost(result); } /** @@ -2912,15 +3010,15 @@ public class Host extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfHostHostRecord(result); + return Types.toMapOfHostHostRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/HostCpu.java b/deps/XenServerJava/src/com/xensource/xenapi/HostCpu.java index 15fcfa7113f..0f802f88ee9 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/HostCpu.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/HostCpu.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class HostCpu extends XenAPIObject { * For internal use only. */ HostCpu(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class HostCpu extends XenAPIObject { { if (obj != null && obj instanceof HostCpu) { - HostCpu other = (HostCpu)obj; + HostCpu other = (HostCpu) obj; return other.ref.equals(this.ref); } else { @@ -118,8 +119,8 @@ public class HostCpu extends XenAPIObject { /** * Convert a host_cpu.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("host", this.host == null ? new Host("OpaqueRef:NULL") : this.host); map.put("number", this.number == null ? 0 : this.number); @@ -196,17 +197,16 @@ public class HostCpu extends XenAPIObject { * * @return all fields from the object */ - @Deprecated - public HostCpu.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public HostCpu.Record getRecord(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_cpu.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toHostCpuRecord(result); + return Types.toHostCpuRecord(result); } /** @@ -216,17 +216,16 @@ public class HostCpu extends XenAPIObject { * @param uuid UUID of object to return * @return reference to the object */ - @Deprecated - public static HostCpu getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public static HostCpu getByUuid(Connection c, String uuid) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_cpu.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toHostCpu(result); + return Types.toHostCpu(result); } /** @@ -235,15 +234,15 @@ public class HostCpu extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_cpu.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -252,15 +251,15 @@ public class HostCpu extends XenAPIObject { * @return value of the field */ public Host getHost(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_cpu.get_host"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toHost(result); + return Types.toHost(result); } /** @@ -269,15 +268,15 @@ public class HostCpu extends XenAPIObject { * @return value of the field */ public Long getNumber(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_cpu.get_number"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -286,15 +285,15 @@ public class HostCpu extends XenAPIObject { * @return value of the field */ public String getVendor(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_cpu.get_vendor"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -303,15 +302,15 @@ public class HostCpu extends XenAPIObject { * @return value of the field */ public Long getSpeed(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_cpu.get_speed"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -320,15 +319,15 @@ public class HostCpu extends XenAPIObject { * @return value of the field */ public String getModelname(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_cpu.get_modelname"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -337,15 +336,15 @@ public class HostCpu extends XenAPIObject { * @return value of the field */ public Long getFamily(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_cpu.get_family"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -354,15 +353,15 @@ public class HostCpu extends XenAPIObject { * @return value of the field */ public Long getModel(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_cpu.get_model"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -371,15 +370,15 @@ public class HostCpu extends XenAPIObject { * @return value of the field */ public String getStepping(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_cpu.get_stepping"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -388,15 +387,15 @@ public class HostCpu extends XenAPIObject { * @return value of the field */ public String getFlags(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_cpu.get_flags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -405,15 +404,15 @@ public class HostCpu extends XenAPIObject { * @return value of the field */ public String getFeatures(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_cpu.get_features"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -422,15 +421,15 @@ public class HostCpu extends XenAPIObject { * @return value of the field */ public Double getUtilisation(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_cpu.get_utilisation"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDouble(result); + return Types.toDouble(result); } /** @@ -439,15 +438,15 @@ public class HostCpu extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_cpu.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -456,9 +455,9 @@ public class HostCpu extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_cpu.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -473,9 +472,9 @@ public class HostCpu extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_cpu.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -489,9 +488,9 @@ public class HostCpu extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_cpu.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -505,17 +504,16 @@ public class HostCpu extends XenAPIObject { * * @return references to all objects */ - @Deprecated - public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public static Set getAll(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_cpu.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfHostCpu(result); + return Types.toSetOfHostCpu(result); } /** @@ -524,15 +522,15 @@ public class HostCpu extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_cpu.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfHostCpuHostCpuRecord(result); + return Types.toMapOfHostCpuHostCpuRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/HostCrashdump.java b/deps/XenServerJava/src/com/xensource/xenapi/HostCrashdump.java index 02c3bd943f6..e93240e6c2b 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/HostCrashdump.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/HostCrashdump.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class HostCrashdump extends XenAPIObject { * For internal use only. */ HostCrashdump(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class HostCrashdump extends XenAPIObject { { if (obj != null && obj instanceof HostCrashdump) { - HostCrashdump other = (HostCrashdump)obj; + HostCrashdump other = (HostCrashdump) obj; return other.ref.equals(this.ref); } else { @@ -110,8 +111,8 @@ public class HostCrashdump extends XenAPIObject { /** * Convert a host_crashdump.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("host", this.host == null ? new Host("OpaqueRef:NULL") : this.host); map.put("timestamp", this.timestamp == null ? new Date(0) : this.timestamp); @@ -148,15 +149,15 @@ public class HostCrashdump extends XenAPIObject { * @return all fields from the object */ public HostCrashdump.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_crashdump.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toHostCrashdumpRecord(result); + return Types.toHostCrashdumpRecord(result); } /** @@ -166,15 +167,15 @@ public class HostCrashdump extends XenAPIObject { * @return reference to the object */ public static HostCrashdump getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_crashdump.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toHostCrashdump(result); + return Types.toHostCrashdump(result); } /** @@ -183,15 +184,15 @@ public class HostCrashdump extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_crashdump.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -200,15 +201,15 @@ public class HostCrashdump extends XenAPIObject { * @return value of the field */ public Host getHost(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_crashdump.get_host"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toHost(result); + return Types.toHost(result); } /** @@ -217,15 +218,15 @@ public class HostCrashdump extends XenAPIObject { * @return value of the field */ public Date getTimestamp(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_crashdump.get_timestamp"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDate(result); + return Types.toDate(result); } /** @@ -234,15 +235,15 @@ public class HostCrashdump extends XenAPIObject { * @return value of the field */ public Long getSize(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_crashdump.get_size"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -251,15 +252,15 @@ public class HostCrashdump extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_crashdump.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -268,9 +269,9 @@ public class HostCrashdump extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_crashdump.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -285,9 +286,9 @@ public class HostCrashdump extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_crashdump.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -301,9 +302,9 @@ public class HostCrashdump extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_crashdump.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -317,9 +318,9 @@ public class HostCrashdump extends XenAPIObject { * @return Task */ public Task destroyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host_crashdump.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -333,9 +334,9 @@ public class HostCrashdump extends XenAPIObject { * */ public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_crashdump.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -351,9 +352,9 @@ public class HostCrashdump extends XenAPIObject { * @return Task */ public Task uploadAsync(Connection c, String url, Map options) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host_crashdump.upload"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(url), Marshalling.toXMLRPC(options)}; @@ -369,9 +370,9 @@ public class HostCrashdump extends XenAPIObject { * @param options Extra configuration operations */ public void upload(Connection c, String url, Map options) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_crashdump.upload"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(url), Marshalling.toXMLRPC(options)}; @@ -385,15 +386,15 @@ public class HostCrashdump extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_crashdump.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfHostCrashdump(result); + return Types.toSetOfHostCrashdump(result); } /** @@ -402,15 +403,15 @@ public class HostCrashdump extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_crashdump.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfHostCrashdumpHostCrashdumpRecord(result); + return Types.toMapOfHostCrashdumpHostCrashdumpRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/HostMetrics.java b/deps/XenServerJava/src/com/xensource/xenapi/HostMetrics.java index b41277aeb05..261933fef60 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/HostMetrics.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/HostMetrics.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class HostMetrics extends XenAPIObject { * For internal use only. */ HostMetrics(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class HostMetrics extends XenAPIObject { { if (obj != null && obj instanceof HostMetrics) { - HostMetrics other = (HostMetrics)obj; + HostMetrics other = (HostMetrics) obj; return other.ref.equals(this.ref); } else { @@ -111,8 +112,8 @@ public class HostMetrics extends XenAPIObject { /** * Convert a host_metrics.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("memory_total", this.memoryTotal == null ? 0 : this.memoryTotal); map.put("memory_free", this.memoryFree == null ? 0 : this.memoryFree); @@ -154,15 +155,15 @@ public class HostMetrics extends XenAPIObject { * @return all fields from the object */ public HostMetrics.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_metrics.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toHostMetricsRecord(result); + return Types.toHostMetricsRecord(result); } /** @@ -172,15 +173,15 @@ public class HostMetrics extends XenAPIObject { * @return reference to the object */ public static HostMetrics getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_metrics.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toHostMetrics(result); + return Types.toHostMetrics(result); } /** @@ -189,15 +190,15 @@ public class HostMetrics extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_metrics.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -206,15 +207,15 @@ public class HostMetrics extends XenAPIObject { * @return value of the field */ public Long getMemoryTotal(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_metrics.get_memory_total"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -223,17 +224,16 @@ public class HostMetrics extends XenAPIObject { * * @return value of the field */ - @Deprecated - public Long getMemoryFree(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public Long getMemoryFree(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_metrics.get_memory_free"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -242,15 +242,15 @@ public class HostMetrics extends XenAPIObject { * @return value of the field */ public Boolean getLive(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_metrics.get_live"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -259,15 +259,15 @@ public class HostMetrics extends XenAPIObject { * @return value of the field */ public Date getLastUpdated(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_metrics.get_last_updated"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDate(result); + return Types.toDate(result); } /** @@ -276,15 +276,15 @@ public class HostMetrics extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_metrics.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -293,9 +293,9 @@ public class HostMetrics extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_metrics.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -310,9 +310,9 @@ public class HostMetrics extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_metrics.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -326,9 +326,9 @@ public class HostMetrics extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_metrics.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -342,15 +342,15 @@ public class HostMetrics extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_metrics.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfHostMetrics(result); + return Types.toSetOfHostMetrics(result); } /** @@ -359,15 +359,15 @@ public class HostMetrics extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_metrics.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfHostMetricsHostMetricsRecord(result); + return Types.toMapOfHostMetricsHostMetricsRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/HostPatch.java b/deps/XenServerJava/src/com/xensource/xenapi/HostPatch.java index fa77588232a..0f229dc93a4 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/HostPatch.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/HostPatch.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class HostPatch extends XenAPIObject { * For internal use only. */ HostPatch(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class HostPatch extends XenAPIObject { { if (obj != null && obj instanceof HostPatch) { - HostPatch other = (HostPatch)obj; + HostPatch other = (HostPatch) obj; return other.ref.equals(this.ref); } else { @@ -115,8 +116,8 @@ public class HostPatch extends XenAPIObject { /** * Convert a host_patch.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("name_label", this.nameLabel == null ? "" : this.nameLabel); map.put("name_description", this.nameDescription == null ? "" : this.nameDescription); @@ -178,15 +179,15 @@ public class HostPatch extends XenAPIObject { * @return all fields from the object */ public HostPatch.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_patch.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toHostPatchRecord(result); + return Types.toHostPatchRecord(result); } /** @@ -196,15 +197,15 @@ public class HostPatch extends XenAPIObject { * @return reference to the object */ public static HostPatch getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_patch.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toHostPatch(result); + return Types.toHostPatch(result); } /** @@ -214,15 +215,15 @@ public class HostPatch extends XenAPIObject { * @return references to objects with matching names */ public static Set getByNameLabel(Connection c, String label) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_patch.get_by_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfHostPatch(result); + return Types.toSetOfHostPatch(result); } /** @@ -231,15 +232,15 @@ public class HostPatch extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_patch.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -248,15 +249,15 @@ public class HostPatch extends XenAPIObject { * @return value of the field */ public String getNameLabel(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_patch.get_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -265,15 +266,15 @@ public class HostPatch extends XenAPIObject { * @return value of the field */ public String getNameDescription(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_patch.get_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -282,15 +283,15 @@ public class HostPatch extends XenAPIObject { * @return value of the field */ public String getVersion(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_patch.get_version"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -299,15 +300,15 @@ public class HostPatch extends XenAPIObject { * @return value of the field */ public Host getHost(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_patch.get_host"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toHost(result); + return Types.toHost(result); } /** @@ -316,15 +317,15 @@ public class HostPatch extends XenAPIObject { * @return value of the field */ public Boolean getApplied(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_patch.get_applied"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -333,15 +334,15 @@ public class HostPatch extends XenAPIObject { * @return value of the field */ public Date getTimestampApplied(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_patch.get_timestamp_applied"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDate(result); + return Types.toDate(result); } /** @@ -350,15 +351,15 @@ public class HostPatch extends XenAPIObject { * @return value of the field */ public Long getSize(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_patch.get_size"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -367,15 +368,15 @@ public class HostPatch extends XenAPIObject { * @return value of the field */ public PoolPatch getPoolPatch(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_patch.get_pool_patch"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPoolPatch(result); + return Types.toPoolPatch(result); } /** @@ -384,15 +385,15 @@ public class HostPatch extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_patch.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -401,9 +402,9 @@ public class HostPatch extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_patch.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -418,9 +419,9 @@ public class HostPatch extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_patch.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -434,9 +435,9 @@ public class HostPatch extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_patch.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -450,11 +451,10 @@ public class HostPatch extends XenAPIObject { * * @return Task */ - @Deprecated - public Task destroyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public Task destroyAsync(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host_patch.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -468,11 +468,10 @@ public class HostPatch extends XenAPIObject { * @deprecated * */ - @Deprecated - public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public void destroy(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_patch.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -486,11 +485,10 @@ public class HostPatch extends XenAPIObject { * * @return Task */ - @Deprecated - public Task applyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public Task applyAsync(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.host_patch.apply"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -505,17 +503,16 @@ public class HostPatch extends XenAPIObject { * * @return the output of the patch application process */ - @Deprecated - public String apply(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public String apply(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_patch.apply"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -524,15 +521,15 @@ public class HostPatch extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_patch.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfHostPatch(result); + return Types.toSetOfHostPatch(result); } /** @@ -541,15 +538,15 @@ public class HostPatch extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "host_patch.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfHostPatchHostPatchRecord(result); + return Types.toMapOfHostPatchHostPatchRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/Marshalling.java b/deps/XenServerJava/src/com/xensource/xenapi/Marshalling.java old mode 100644 new mode 100755 index 865bc16af11..b7483c1d0fa --- a/deps/XenServerJava/src/com/xensource/xenapi/Marshalling.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/Marshalling.java @@ -1,15 +1,33 @@ -// Copyright 2012 Citrix Systems, Inc. Licensed under the -// Apache License, Version 2.0 (the "License"); you may not use this -// file except in compliance with the License. Citrix Systems, Inc. -// reserves all rights not expressly granted by the License. -// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Automatically generated by addcopyright.py at 04/03/2012 +/* + * Copyright (c) Citrix Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1) Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2) Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + package com.xensource.xenapi; import java.util.*; @@ -29,8 +47,8 @@ public final class Marshalling { o instanceof Double || o instanceof Date) { return o; - } else if (o instanceof Long) { - return o.toString(); + } else if (o instanceof Long) { + return o.toString(); } else if (o instanceof Map) { Map result = new HashMap(); Map m = (Map)o; @@ -46,14 +64,14 @@ public final class Marshalling { result.add(toXMLRPC(e)); } return result; - } else if (o instanceof XenAPIObject) { - return ((XenAPIObject)o).toWireString(); - } else if (o instanceof Enum) { - return o.toString(); - } else if (o == null) { - return ""; + } else if (o instanceof XenAPIObject) { + return ((XenAPIObject) o).toWireString(); + } else if (o instanceof Enum) { + return o.toString(); + }else if (o == null){ + return ""; } else { - throw new RuntimeException("=============don't know how to marshall:({[" + o + "]})"); + throw new RuntimeException ("=============don't know how to marshall:({[" + o + "]})"); } } } diff --git a/deps/XenServerJava/src/com/xensource/xenapi/Message.java b/deps/XenServerJava/src/com/xensource/xenapi/Message.java index a3658e38344..8cb41276be0 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/Message.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/Message.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class Message extends XenAPIObject { * For internal use only. */ Message(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class Message extends XenAPIObject { { if (obj != null && obj instanceof Message) { - Message other = (Message)obj; + Message other = (Message) obj; return other.ref.equals(this.ref); } else { @@ -112,8 +113,8 @@ public class Message extends XenAPIObject { /** * Convert a message.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("name", this.name == null ? "" : this.name); map.put("priority", this.priority == null ? 0 : this.priority); @@ -155,7 +156,7 @@ public class Message extends XenAPIObject { } /** - * + * * * @param name The name of the message * @param priority The priority of the message @@ -165,26 +166,25 @@ public class Message extends XenAPIObject { * @return The reference of the created message */ public static Message create(Connection c, String name, Long priority, Types.Cls cls, String objUuid, String body) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "message.create"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(priority), Marshalling.toXMLRPC(cls), - Marshalling.toXMLRPC(objUuid), Marshalling.toXMLRPC(body)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(priority), Marshalling.toXMLRPC(cls), Marshalling.toXMLRPC(objUuid), Marshalling.toXMLRPC(body)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMessage(result); + return Types.toMessage(result); } /** - * + * * */ public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "message.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -193,7 +193,7 @@ public class Message extends XenAPIObject { } /** - * + * * * @param cls The class of object * @param objUuid The uuid of the object @@ -201,120 +201,120 @@ public class Message extends XenAPIObject { * @return The relevant messages */ public static Map get(Connection c, Types.Cls cls, String objUuid, Date since) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "message.get"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(cls), Marshalling.toXMLRPC(objUuid), Marshalling.toXMLRPC(since)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfMessageMessageRecord(result); + return Types.toMapOfMessageMessageRecord(result); } /** - * + * * * @return The references to the messages */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "message.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfMessage(result); + return Types.toSetOfMessage(result); } /** - * + * * * @param since The cutoff time * @return The relevant messages */ public static Map getSince(Connection c, Date since) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "message.get_since"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(since)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfMessageMessageRecord(result); + return Types.toMapOfMessageMessageRecord(result); } /** - * + * * * @return The message record */ public Message.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "message.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMessageRecord(result); + return Types.toMessageRecord(result); } /** - * + * * * @param uuid The uuid of the message * @return The message reference */ public static Message getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "message.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMessage(result); + return Types.toMessage(result); } /** - * + * * * @return The messages */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "message.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfMessageMessageRecord(result); + return Types.toMapOfMessageMessageRecord(result); } /** - * + * * * @param expr The expression to match (not currently used) * @return The messages */ public static Map getAllRecordsWhere(Connection c, String expr) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "message.get_all_records_where"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(expr)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfMessageMessageRecord(result); + return Types.toMapOfMessageMessageRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/Network.java b/deps/XenServerJava/src/com/xensource/xenapi/Network.java index e9194ef7103..9f8c929f900 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/Network.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/Network.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class Network extends XenAPIObject { * For internal use only. */ Network(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class Network extends XenAPIObject { { if (obj != null && obj instanceof Network) { - Network other = (Network)obj; + Network other = (Network) obj; return other.ref.equals(this.ref); } else { @@ -118,8 +119,8 @@ public class Network extends XenAPIObject { /** * Convert a network.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("name_label", this.nameLabel == null ? "" : this.nameLabel); map.put("name_description", this.nameDescription == null ? "" : this.nameDescription); @@ -196,15 +197,15 @@ public class Network extends XenAPIObject { * @return all fields from the object */ public Network.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toNetworkRecord(result); + return Types.toNetworkRecord(result); } /** @@ -214,15 +215,15 @@ public class Network extends XenAPIObject { * @return reference to the object */ public static Network getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toNetwork(result); + return Types.toNetwork(result); } /** @@ -232,9 +233,9 @@ public class Network extends XenAPIObject { * @return Task */ public static Task createAsync(Connection c, Network.Record record) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.network.create"; String session = c.getSessionReference(); Map record_map = record.toMap(); @@ -251,16 +252,16 @@ public class Network extends XenAPIObject { * @return reference to the newly created object */ public static Network create(Connection c, Network.Record record) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.create"; String session = c.getSessionReference(); Map record_map = record.toMap(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toNetwork(result); + return Types.toNetwork(result); } /** @@ -269,9 +270,9 @@ public class Network extends XenAPIObject { * @return Task */ public Task destroyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.network.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -285,9 +286,9 @@ public class Network extends XenAPIObject { * */ public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -302,15 +303,15 @@ public class Network extends XenAPIObject { * @return references to objects with matching names */ public static Set getByNameLabel(Connection c, String label) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.get_by_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfNetwork(result); + return Types.toSetOfNetwork(result); } /** @@ -319,15 +320,15 @@ public class Network extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -336,15 +337,15 @@ public class Network extends XenAPIObject { * @return value of the field */ public String getNameLabel(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.get_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -353,15 +354,15 @@ public class Network extends XenAPIObject { * @return value of the field */ public String getNameDescription(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.get_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -370,15 +371,15 @@ public class Network extends XenAPIObject { * @return value of the field */ public Set getAllowedOperations(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.get_allowed_operations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfNetworkOperations(result); + return Types.toSetOfNetworkOperations(result); } /** @@ -387,15 +388,15 @@ public class Network extends XenAPIObject { * @return value of the field */ public Map getCurrentOperations(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.get_current_operations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringNetworkOperations(result); + return Types.toMapOfStringNetworkOperations(result); } /** @@ -404,15 +405,15 @@ public class Network extends XenAPIObject { * @return value of the field */ public Set getVIFs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.get_VIFs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVIF(result); + return Types.toSetOfVIF(result); } /** @@ -421,15 +422,15 @@ public class Network extends XenAPIObject { * @return value of the field */ public Set getPIFs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.get_PIFs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfPIF(result); + return Types.toSetOfPIF(result); } /** @@ -438,15 +439,15 @@ public class Network extends XenAPIObject { * @return value of the field */ public Long getMTU(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.get_MTU"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -455,15 +456,15 @@ public class Network extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -472,15 +473,15 @@ public class Network extends XenAPIObject { * @return value of the field */ public String getBridge(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.get_bridge"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -489,15 +490,15 @@ public class Network extends XenAPIObject { * @return value of the field */ public Map getBlobs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.get_blobs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringBlob(result); + return Types.toMapOfStringBlob(result); } /** @@ -506,15 +507,15 @@ public class Network extends XenAPIObject { * @return value of the field */ public Set getTags(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.get_tags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -523,15 +524,15 @@ public class Network extends XenAPIObject { * @return value of the field */ public Types.NetworkDefaultLockingMode getDefaultLockingMode(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.get_default_locking_mode"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toNetworkDefaultLockingMode(result); + return Types.toNetworkDefaultLockingMode(result); } /** @@ -540,9 +541,9 @@ public class Network extends XenAPIObject { * @param label New value to set */ public void setNameLabel(Connection c, String label) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.set_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(label)}; @@ -556,9 +557,9 @@ public class Network extends XenAPIObject { * @param description New value to set */ public void setNameDescription(Connection c, String description) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.set_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(description)}; @@ -572,9 +573,9 @@ public class Network extends XenAPIObject { * @param MTU New value to set */ public void setMTU(Connection c, Long MTU) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.set_MTU"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(MTU)}; @@ -588,9 +589,9 @@ public class Network extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -605,9 +606,9 @@ public class Network extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -621,9 +622,9 @@ public class Network extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -637,9 +638,9 @@ public class Network extends XenAPIObject { * @param tags New value to set */ public void setTags(Connection c, Set tags) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.set_tags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(tags)}; @@ -653,9 +654,9 @@ public class Network extends XenAPIObject { * @param value New value to add */ public void addTags(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.add_tags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -669,9 +670,9 @@ public class Network extends XenAPIObject { * @param value Value to remove */ public void removeTags(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.remove_tags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -688,13 +689,12 @@ public class Network extends XenAPIObject { * @return Task */ public Task createNewBlobAsync(Connection c, String name, String mimeType, Boolean _public) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.network.create_new_blob"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), - Marshalling.toXMLRPC(_public)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), Marshalling.toXMLRPC(_public)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -709,16 +709,15 @@ public class Network extends XenAPIObject { * @return The reference of the blob, needed for populating its data */ public Blob createNewBlob(Connection c, String name, String mimeType, Boolean _public) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.create_new_blob"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), - Marshalling.toXMLRPC(_public)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), Marshalling.toXMLRPC(_public)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBlob(result); + return Types.toBlob(result); } /** @@ -728,9 +727,9 @@ public class Network extends XenAPIObject { * @return Task */ public Task setDefaultLockingModeAsync(Connection c, Types.NetworkDefaultLockingMode value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.network.set_default_locking_mode"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -745,9 +744,9 @@ public class Network extends XenAPIObject { * @param value The default locking mode for VIFs attached to this network. */ public void setDefaultLockingMode(Connection c, Types.NetworkDefaultLockingMode value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.set_default_locking_mode"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -761,15 +760,15 @@ public class Network extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfNetwork(result); + return Types.toSetOfNetwork(result); } /** @@ -778,15 +777,15 @@ public class Network extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "network.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfNetworkNetworkRecord(result); + return Types.toMapOfNetworkNetworkRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/PBD.java b/deps/XenServerJava/src/com/xensource/xenapi/PBD.java index d2898247572..bae095f8d1f 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/PBD.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/PBD.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class PBD extends XenAPIObject { * For internal use only. */ PBD(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class PBD extends XenAPIObject { { if (obj != null && obj instanceof PBD) { - PBD other = (PBD)obj; + PBD other = (PBD) obj; return other.ref.equals(this.ref); } else { @@ -111,8 +112,8 @@ public class PBD extends XenAPIObject { /** * Convert a PBD.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("host", this.host == null ? new Host("OpaqueRef:NULL") : this.host); map.put("SR", this.SR == null ? new SR("OpaqueRef:NULL") : this.SR); @@ -154,15 +155,15 @@ public class PBD extends XenAPIObject { * @return all fields from the object */ public PBD.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PBD.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPBDRecord(result); + return Types.toPBDRecord(result); } /** @@ -172,15 +173,15 @@ public class PBD extends XenAPIObject { * @return reference to the object */ public static PBD getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PBD.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPBD(result); + return Types.toPBD(result); } /** @@ -190,9 +191,9 @@ public class PBD extends XenAPIObject { * @return Task */ public static Task createAsync(Connection c, PBD.Record record) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.PBD.create"; String session = c.getSessionReference(); Map record_map = record.toMap(); @@ -209,16 +210,16 @@ public class PBD extends XenAPIObject { * @return reference to the newly created object */ public static PBD create(Connection c, PBD.Record record) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PBD.create"; String session = c.getSessionReference(); Map record_map = record.toMap(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPBD(result); + return Types.toPBD(result); } /** @@ -227,9 +228,9 @@ public class PBD extends XenAPIObject { * @return Task */ public Task destroyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.PBD.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -243,9 +244,9 @@ public class PBD extends XenAPIObject { * */ public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PBD.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -259,15 +260,15 @@ public class PBD extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PBD.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -276,15 +277,15 @@ public class PBD extends XenAPIObject { * @return value of the field */ public Host getHost(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PBD.get_host"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toHost(result); + return Types.toHost(result); } /** @@ -293,15 +294,15 @@ public class PBD extends XenAPIObject { * @return value of the field */ public SR getSR(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PBD.get_SR"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSR(result); + return Types.toSR(result); } /** @@ -310,15 +311,15 @@ public class PBD extends XenAPIObject { * @return value of the field */ public Map getDeviceConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PBD.get_device_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -327,15 +328,15 @@ public class PBD extends XenAPIObject { * @return value of the field */ public Boolean getCurrentlyAttached(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PBD.get_currently_attached"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -344,15 +345,15 @@ public class PBD extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PBD.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -361,9 +362,9 @@ public class PBD extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PBD.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -378,9 +379,9 @@ public class PBD extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PBD.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -394,9 +395,9 @@ public class PBD extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PBD.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -410,10 +411,10 @@ public class PBD extends XenAPIObject { * @return Task */ public Task plugAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.SrUnknownDriver { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.SrUnknownDriver { String method_call = "Async.PBD.plug"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -427,10 +428,10 @@ public class PBD extends XenAPIObject { * */ public void plug(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.SrUnknownDriver { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.SrUnknownDriver { String method_call = "PBD.plug"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -444,9 +445,9 @@ public class PBD extends XenAPIObject { * @return Task */ public Task unplugAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.PBD.unplug"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -460,9 +461,9 @@ public class PBD extends XenAPIObject { * */ public void unplug(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PBD.unplug"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -477,9 +478,9 @@ public class PBD extends XenAPIObject { * @return Task */ public Task setDeviceConfigAsync(Connection c, Map value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.PBD.set_device_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -494,9 +495,9 @@ public class PBD extends XenAPIObject { * @param value The new value of the PBD's device_config */ public void setDeviceConfig(Connection c, Map value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PBD.set_device_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -510,15 +511,15 @@ public class PBD extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PBD.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfPBD(result); + return Types.toSetOfPBD(result); } /** @@ -527,15 +528,15 @@ public class PBD extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PBD.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfPBDPBDRecord(result); + return Types.toMapOfPBDPBDRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/PCI.java b/deps/XenServerJava/src/com/xensource/xenapi/PCI.java index e11230a6289..fbee50a81b6 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/PCI.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/PCI.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class PCI extends XenAPIObject { * For internal use only. */ PCI(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class PCI extends XenAPIObject { { if (obj != null && obj instanceof PCI) { - PCI other = (PCI)obj; + PCI other = (PCI) obj; return other.ref.equals(this.ref); } else { @@ -113,8 +114,8 @@ public class PCI extends XenAPIObject { /** * Convert a PCI.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("class_name", this.clazzName == null ? "" : this.clazzName); map.put("vendor_name", this.vendorName == null ? "" : this.vendorName); @@ -166,15 +167,15 @@ public class PCI extends XenAPIObject { * @return all fields from the object */ public PCI.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PCI.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPCIRecord(result); + return Types.toPCIRecord(result); } /** @@ -184,15 +185,15 @@ public class PCI extends XenAPIObject { * @return reference to the object */ public static PCI getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PCI.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPCI(result); + return Types.toPCI(result); } /** @@ -201,15 +202,15 @@ public class PCI extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PCI.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -218,15 +219,15 @@ public class PCI extends XenAPIObject { * @return value of the field */ public String getClazzName(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PCI.get_class_name"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -235,15 +236,15 @@ public class PCI extends XenAPIObject { * @return value of the field */ public String getVendorName(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PCI.get_vendor_name"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -252,15 +253,15 @@ public class PCI extends XenAPIObject { * @return value of the field */ public String getDeviceName(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PCI.get_device_name"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -269,15 +270,15 @@ public class PCI extends XenAPIObject { * @return value of the field */ public Host getHost(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PCI.get_host"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toHost(result); + return Types.toHost(result); } /** @@ -286,15 +287,15 @@ public class PCI extends XenAPIObject { * @return value of the field */ public String getPciId(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PCI.get_pci_id"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -303,15 +304,15 @@ public class PCI extends XenAPIObject { * @return value of the field */ public Set getDependencies(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PCI.get_dependencies"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfPCI(result); + return Types.toSetOfPCI(result); } /** @@ -320,15 +321,15 @@ public class PCI extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PCI.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -337,9 +338,9 @@ public class PCI extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PCI.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -354,9 +355,9 @@ public class PCI extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PCI.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -370,9 +371,9 @@ public class PCI extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PCI.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -386,15 +387,15 @@ public class PCI extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PCI.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfPCI(result); + return Types.toSetOfPCI(result); } /** @@ -403,15 +404,15 @@ public class PCI extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PCI.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfPCIPCIRecord(result); + return Types.toMapOfPCIPCIRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/PGPU.java b/deps/XenServerJava/src/com/xensource/xenapi/PGPU.java index 0f5ddb4bdf9..43eadf53b60 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/PGPU.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/PGPU.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class PGPU extends XenAPIObject { * For internal use only. */ PGPU(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class PGPU extends XenAPIObject { { if (obj != null && obj instanceof PGPU) { - PGPU other = (PGPU)obj; + PGPU other = (PGPU) obj; return other.ref.equals(this.ref); } else { @@ -104,19 +105,27 @@ public class PGPU extends XenAPIObject { print.printf("%1$20s: %2$s\n", "GPUGroup", this.GPUGroup); print.printf("%1$20s: %2$s\n", "host", this.host); print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig); + print.printf("%1$20s: %2$s\n", "supportedVGPUTypes", this.supportedVGPUTypes); + print.printf("%1$20s: %2$s\n", "enabledVGPUTypes", this.enabledVGPUTypes); + print.printf("%1$20s: %2$s\n", "residentVGPUs", this.residentVGPUs); + print.printf("%1$20s: %2$s\n", "supportedVGPUMaxCapacities", this.supportedVGPUMaxCapacities); return writer.toString(); } /** * Convert a PGPU.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("PCI", this.PCI == null ? new PCI("OpaqueRef:NULL") : this.PCI); map.put("GPU_group", this.GPUGroup == null ? new GPUGroup("OpaqueRef:NULL") : this.GPUGroup); map.put("host", this.host == null ? new Host("OpaqueRef:NULL") : this.host); map.put("other_config", this.otherConfig == null ? new HashMap() : this.otherConfig); + map.put("supported_VGPU_types", this.supportedVGPUTypes == null ? new LinkedHashSet() : this.supportedVGPUTypes); + map.put("enabled_VGPU_types", this.enabledVGPUTypes == null ? new LinkedHashSet() : this.enabledVGPUTypes); + map.put("resident_VGPUs", this.residentVGPUs == null ? new LinkedHashSet() : this.residentVGPUs); + map.put("supported_VGPU_max_capacities", this.supportedVGPUMaxCapacities == null ? new HashMap() : this.supportedVGPUMaxCapacities); return map; } @@ -140,6 +149,22 @@ public class PGPU extends XenAPIObject { * Additional configuration */ public Map otherConfig; + /** + * List of VGPU types supported by the underlying hardware + */ + public Set supportedVGPUTypes; + /** + * List of VGPU types which have been enabled for this PGPU + */ + public Set enabledVGPUTypes; + /** + * List of VGPUs running on this PGPU + */ + public Set residentVGPUs; + /** + * A map relating each VGPU type supported on this GPU to the maximum number of VGPUs of that type which can run simultaneously on this GPU + */ + public Map supportedVGPUMaxCapacities; } /** @@ -148,15 +173,15 @@ public class PGPU extends XenAPIObject { * @return all fields from the object */ public PGPU.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PGPU.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPGPURecord(result); + return Types.toPGPURecord(result); } /** @@ -166,15 +191,15 @@ public class PGPU extends XenAPIObject { * @return reference to the object */ public static PGPU getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PGPU.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPGPU(result); + return Types.toPGPU(result); } /** @@ -183,15 +208,15 @@ public class PGPU extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PGPU.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -200,15 +225,15 @@ public class PGPU extends XenAPIObject { * @return value of the field */ public PCI getPCI(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PGPU.get_PCI"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPCI(result); + return Types.toPCI(result); } /** @@ -217,15 +242,15 @@ public class PGPU extends XenAPIObject { * @return value of the field */ public GPUGroup getGPUGroup(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PGPU.get_GPU_group"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toGPUGroup(result); + return Types.toGPUGroup(result); } /** @@ -234,15 +259,15 @@ public class PGPU extends XenAPIObject { * @return value of the field */ public Host getHost(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PGPU.get_host"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toHost(result); + return Types.toHost(result); } /** @@ -251,15 +276,83 @@ public class PGPU extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PGPU.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); + } + + /** + * Get the supported_VGPU_types field of the given PGPU. + * + * @return value of the field + */ + public Set getSupportedVGPUTypes(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "PGPU.get_supported_VGPU_types"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toSetOfVGPUType(result); + } + + /** + * Get the enabled_VGPU_types field of the given PGPU. + * + * @return value of the field + */ + public Set getEnabledVGPUTypes(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "PGPU.get_enabled_VGPU_types"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toSetOfVGPUType(result); + } + + /** + * Get the resident_VGPUs field of the given PGPU. + * + * @return value of the field + */ + public Set getResidentVGPUs(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "PGPU.get_resident_VGPUs"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toSetOfVGPU(result); + } + + /** + * Get the supported_VGPU_max_capacities field of the given PGPU. + * + * @return value of the field + */ + public Map getSupportedVGPUMaxCapacities(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "PGPU.get_supported_VGPU_max_capacities"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toMapOfVGPUTypeLong(result); } /** @@ -268,9 +361,9 @@ public class PGPU extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PGPU.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -285,9 +378,9 @@ public class PGPU extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PGPU.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -301,9 +394,9 @@ public class PGPU extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PGPU.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -311,21 +404,193 @@ public class PGPU extends XenAPIObject { return; } + /** + * + * + * @param value The VGPU type to enable + * @return Task + */ + public Task addEnabledVGPUTypesAsync(Connection c, VGPUType value) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "Async.PGPU.add_enabled_VGPU_types"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toTask(result); + } + + /** + * + * + * @param value The VGPU type to enable + */ + public void addEnabledVGPUTypes(Connection c, VGPUType value) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "PGPU.add_enabled_VGPU_types"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; + Map response = c.dispatch(method_call, method_params); + return; + } + + /** + * + * + * @param value The VGPU type to disable + * @return Task + */ + public Task removeEnabledVGPUTypesAsync(Connection c, VGPUType value) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "Async.PGPU.remove_enabled_VGPU_types"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toTask(result); + } + + /** + * + * + * @param value The VGPU type to disable + */ + public void removeEnabledVGPUTypes(Connection c, VGPUType value) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "PGPU.remove_enabled_VGPU_types"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; + Map response = c.dispatch(method_call, method_params); + return; + } + + /** + * + * + * @param value The VGPU types to enable + * @return Task + */ + public Task setEnabledVGPUTypesAsync(Connection c, Set value) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "Async.PGPU.set_enabled_VGPU_types"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toTask(result); + } + + /** + * + * + * @param value The VGPU types to enable + */ + public void setEnabledVGPUTypes(Connection c, Set value) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "PGPU.set_enabled_VGPU_types"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; + Map response = c.dispatch(method_call, method_params); + return; + } + + /** + * + * + * @param value The group to which the PGPU will be moved + * @return Task + */ + public Task setGPUGroupAsync(Connection c, GPUGroup value) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "Async.PGPU.set_GPU_group"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toTask(result); + } + + /** + * + * + * @param value The group to which the PGPU will be moved + */ + public void setGPUGroup(Connection c, GPUGroup value) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "PGPU.set_GPU_group"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; + Map response = c.dispatch(method_call, method_params); + return; + } + + /** + * + * + * @param vgpuType The VGPU type for which we want to find the number of VGPUs which can still be started on this PGPU + * @return Task + */ + public Task getRemainingCapacityAsync(Connection c, VGPUType vgpuType) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "Async.PGPU.get_remaining_capacity"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(vgpuType)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toTask(result); + } + + /** + * + * + * @param vgpuType The VGPU type for which we want to find the number of VGPUs which can still be started on this PGPU + * @return The number of VGPUs of the specified type which can still be started on this PGPU + */ + public Long getRemainingCapacity(Connection c, VGPUType vgpuType) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "PGPU.get_remaining_capacity"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(vgpuType)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toLong(result); + } + /** * Return a list of all the PGPUs known to the system. * * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PGPU.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfPGPU(result); + return Types.toSetOfPGPU(result); } /** @@ -334,15 +599,15 @@ public class PGPU extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PGPU.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfPGPUPGPURecord(result); + return Types.toMapOfPGPUPGPURecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/PIF.java b/deps/XenServerJava/src/com/xensource/xenapi/PIF.java index 27618b4105b..e75b5656185 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/PIF.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/PIF.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class PIF extends XenAPIObject { * For internal use only. */ PIF(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class PIF extends XenAPIObject { { if (obj != null && obj instanceof PIF) { - PIF other = (PIF)obj; + PIF other = (PIF) obj; return other.ref.equals(this.ref); } else { @@ -127,14 +128,15 @@ public class PIF extends XenAPIObject { print.printf("%1$20s: %2$s\n", "IPv6", this.IPv6); print.printf("%1$20s: %2$s\n", "ipv6Gateway", this.ipv6Gateway); print.printf("%1$20s: %2$s\n", "primaryAddressType", this.primaryAddressType); + print.printf("%1$20s: %2$s\n", "managed", this.managed); return writer.toString(); } /** * Convert a PIF.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("device", this.device == null ? "" : this.device); map.put("network", this.network == null ? new Network("OpaqueRef:NULL") : this.network); @@ -163,6 +165,7 @@ public class PIF extends XenAPIObject { map.put("IPv6", this.IPv6 == null ? new LinkedHashSet() : this.IPv6); map.put("ipv6_gateway", this.ipv6Gateway == null ? "" : this.ipv6Gateway); map.put("primary_address_type", this.primaryAddressType == null ? Types.PrimaryAddressType.UNRECOGNIZED : this.primaryAddressType); + map.put("managed", this.managed == null ? false : this.managed); return map; } @@ -278,6 +281,10 @@ public class PIF extends XenAPIObject { * Which protocol should define the primary address of this interface */ public Types.PrimaryAddressType primaryAddressType; + /** + * Indicates whether the interface is managed by xapi. If it is not, then xapi will not configure the interface, the commands PIF.plug/unplug/reconfigure_ip(v6) can not be used, nor can the interface be bonded or have VLANs based on top through xapi. + */ + public Boolean managed; } /** @@ -286,15 +293,15 @@ public class PIF extends XenAPIObject { * @return all fields from the object */ public PIF.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPIFRecord(result); + return Types.toPIFRecord(result); } /** @@ -304,15 +311,15 @@ public class PIF extends XenAPIObject { * @return reference to the object */ public static PIF getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPIF(result); + return Types.toPIF(result); } /** @@ -321,15 +328,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -338,15 +345,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public String getDevice(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_device"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -355,15 +362,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public Network getNetwork(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_network"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toNetwork(result); + return Types.toNetwork(result); } /** @@ -372,15 +379,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public Host getHost(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_host"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toHost(result); + return Types.toHost(result); } /** @@ -389,15 +396,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public String getMAC(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_MAC"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -406,15 +413,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public Long getMTU(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_MTU"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -423,15 +430,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public Long getVLAN(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_VLAN"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -440,15 +447,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public PIFMetrics getMetrics(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_metrics"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPIFMetrics(result); + return Types.toPIFMetrics(result); } /** @@ -457,15 +464,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public Boolean getPhysical(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_physical"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -474,15 +481,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public Boolean getCurrentlyAttached(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_currently_attached"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -491,15 +498,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public Types.IpConfigurationMode getIpConfigurationMode(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_ip_configuration_mode"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toIpConfigurationMode(result); + return Types.toIpConfigurationMode(result); } /** @@ -508,15 +515,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public String getIP(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_IP"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -525,15 +532,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public String getNetmask(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_netmask"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -542,15 +549,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public String getGateway(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_gateway"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -559,15 +566,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public String getDNS(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_DNS"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -576,15 +583,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public Bond getBondSlaveOf(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_bond_slave_of"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBond(result); + return Types.toBond(result); } /** @@ -593,15 +600,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public Set getBondMasterOf(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_bond_master_of"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfBond(result); + return Types.toSetOfBond(result); } /** @@ -610,15 +617,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public VLAN getVLANMasterOf(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_VLAN_master_of"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVLAN(result); + return Types.toVLAN(result); } /** @@ -627,15 +634,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public Set getVLANSlaveOf(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_VLAN_slave_of"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVLAN(result); + return Types.toSetOfVLAN(result); } /** @@ -644,15 +651,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public Boolean getManagement(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_management"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -661,15 +668,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -678,15 +685,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public Boolean getDisallowUnplug(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_disallow_unplug"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -695,15 +702,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public Set getTunnelAccessPIFOf(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_tunnel_access_PIF_of"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfTunnel(result); + return Types.toSetOfTunnel(result); } /** @@ -712,15 +719,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public Set getTunnelTransportPIFOf(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_tunnel_transport_PIF_of"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfTunnel(result); + return Types.toSetOfTunnel(result); } /** @@ -729,15 +736,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public Types.Ipv6ConfigurationMode getIpv6ConfigurationMode(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_ipv6_configuration_mode"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toIpv6ConfigurationMode(result); + return Types.toIpv6ConfigurationMode(result); } /** @@ -746,15 +753,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public Set getIPv6(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_IPv6"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -763,15 +770,15 @@ public class PIF extends XenAPIObject { * @return value of the field */ public String getIpv6Gateway(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_ipv6_gateway"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -780,15 +787,32 @@ public class PIF extends XenAPIObject { * @return value of the field */ public Types.PrimaryAddressType getPrimaryAddressType(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_primary_address_type"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPrimaryAddressType(result); + return Types.toPrimaryAddressType(result); + } + + /** + * Get the managed field of the given PIF. + * + * @return value of the field + */ + public Boolean getManaged(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "PIF.get_managed"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toBoolean(result); } /** @@ -797,9 +821,9 @@ public class PIF extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -814,9 +838,9 @@ public class PIF extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -830,9 +854,9 @@ public class PIF extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -846,9 +870,9 @@ public class PIF extends XenAPIObject { * @param disallowUnplug New value to set */ public void setDisallowUnplug(Connection c, Boolean disallowUnplug) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.set_disallow_unplug"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(disallowUnplug)}; @@ -866,16 +890,14 @@ public class PIF extends XenAPIObject { * @param VLAN VLAN tag for the new interface * @return Task */ - @Deprecated - public static Task createVLANAsync(Connection c, String device, Network network, Host host, Long VLAN) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VlanTagInvalid { + @Deprecated public static Task createVLANAsync(Connection c, String device, Network network, Host host, Long VLAN) throws + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VlanTagInvalid { String method_call = "Async.PIF.create_VLAN"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(device), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(host), - Marshalling.toXMLRPC(VLAN)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(device), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(VLAN)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -891,19 +913,17 @@ public class PIF extends XenAPIObject { * @param VLAN VLAN tag for the new interface * @return The reference of the created PIF object */ - @Deprecated - public static PIF createVLAN(Connection c, String device, Network network, Host host, Long VLAN) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VlanTagInvalid { + @Deprecated public static PIF createVLAN(Connection c, String device, Network network, Host host, Long VLAN) throws + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VlanTagInvalid { String method_call = "PIF.create_VLAN"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(device), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(host), - Marshalling.toXMLRPC(VLAN)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(device), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(VLAN)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPIF(result); + return Types.toPIF(result); } /** @@ -912,12 +932,11 @@ public class PIF extends XenAPIObject { * * @return Task */ - @Deprecated - public Task destroyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.PifIsPhysical { + @Deprecated public Task destroyAsync(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.PifIsPhysical { String method_call = "Async.PIF.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -931,12 +950,11 @@ public class PIF extends XenAPIObject { * @deprecated * */ - @Deprecated - public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.PifIsPhysical { + @Deprecated public void destroy(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.PifIsPhysical { String method_call = "PIF.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -955,13 +973,12 @@ public class PIF extends XenAPIObject { * @return Task */ public Task reconfigureIpAsync(Connection c, Types.IpConfigurationMode mode, String IP, String netmask, String gateway, String DNS) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.PIF.reconfigure_ip"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(mode), Marshalling.toXMLRPC(IP), - Marshalling.toXMLRPC(netmask), Marshalling.toXMLRPC(gateway), Marshalling.toXMLRPC(DNS)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(mode), Marshalling.toXMLRPC(IP), Marshalling.toXMLRPC(netmask), Marshalling.toXMLRPC(gateway), Marshalling.toXMLRPC(DNS)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -977,13 +994,12 @@ public class PIF extends XenAPIObject { * @param DNS the new DNS settings */ public void reconfigureIp(Connection c, Types.IpConfigurationMode mode, String IP, String netmask, String gateway, String DNS) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.reconfigure_ip"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(mode), Marshalling.toXMLRPC(IP), - Marshalling.toXMLRPC(netmask), Marshalling.toXMLRPC(gateway), Marshalling.toXMLRPC(DNS)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(mode), Marshalling.toXMLRPC(IP), Marshalling.toXMLRPC(netmask), Marshalling.toXMLRPC(gateway), Marshalling.toXMLRPC(DNS)}; Map response = c.dispatch(method_call, method_params); return; } @@ -998,13 +1014,12 @@ public class PIF extends XenAPIObject { * @return Task */ public Task reconfigureIpv6Async(Connection c, Types.Ipv6ConfigurationMode mode, String IPv6, String gateway, String DNS) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.PIF.reconfigure_ipv6"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(mode), Marshalling.toXMLRPC(IPv6), - Marshalling.toXMLRPC(gateway), Marshalling.toXMLRPC(DNS)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(mode), Marshalling.toXMLRPC(IPv6), Marshalling.toXMLRPC(gateway), Marshalling.toXMLRPC(DNS)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -1019,13 +1034,12 @@ public class PIF extends XenAPIObject { * @param DNS the new DNS settings */ public void reconfigureIpv6(Connection c, Types.Ipv6ConfigurationMode mode, String IPv6, String gateway, String DNS) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.reconfigure_ipv6"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(mode), Marshalling.toXMLRPC(IPv6), - Marshalling.toXMLRPC(gateway), Marshalling.toXMLRPC(DNS)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(mode), Marshalling.toXMLRPC(IPv6), Marshalling.toXMLRPC(gateway), Marshalling.toXMLRPC(DNS)}; Map response = c.dispatch(method_call, method_params); return; } @@ -1037,9 +1051,9 @@ public class PIF extends XenAPIObject { * @return Task */ public Task setPrimaryAddressTypeAsync(Connection c, Types.PrimaryAddressType primaryAddressType) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.PIF.set_primary_address_type"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(primaryAddressType)}; @@ -1054,9 +1068,9 @@ public class PIF extends XenAPIObject { * @param primaryAddressType Whether to prefer IPv4 or IPv6 connections */ public void setPrimaryAddressType(Connection c, Types.PrimaryAddressType primaryAddressType) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.set_primary_address_type"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(primaryAddressType)}; @@ -1071,9 +1085,9 @@ public class PIF extends XenAPIObject { * @return Task */ public static Task scanAsync(Connection c, Host host) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.PIF.scan"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host)}; @@ -1088,9 +1102,9 @@ public class PIF extends XenAPIObject { * @param host The host on which to scan */ public static void scan(Connection c, Host host) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.scan"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host)}; @@ -1104,15 +1118,16 @@ public class PIF extends XenAPIObject { * @param host The host on which the interface exists * @param MAC The MAC address of the interface * @param device The device name to use for the interface + * @param managed Indicates whether the interface is managed by xapi (defaults to "true") * @return Task */ - public static Task introduceAsync(Connection c, Host host, String MAC, String device) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + public static Task introduceAsync(Connection c, Host host, String MAC, String device, Boolean managed) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.PIF.introduce"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(MAC), Marshalling.toXMLRPC(device)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(MAC), Marshalling.toXMLRPC(device), Marshalling.toXMLRPC(managed)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -1124,18 +1139,19 @@ public class PIF extends XenAPIObject { * @param host The host on which the interface exists * @param MAC The MAC address of the interface * @param device The device name to use for the interface + * @param managed Indicates whether the interface is managed by xapi (defaults to "true") * @return The reference of the created PIF object */ - public static PIF introduce(Connection c, Host host, String MAC, String device) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + public static PIF introduce(Connection c, Host host, String MAC, String device, Boolean managed) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.introduce"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(MAC), Marshalling.toXMLRPC(device)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(MAC), Marshalling.toXMLRPC(device), Marshalling.toXMLRPC(managed)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPIF(result); + return Types.toPIF(result); } /** @@ -1144,10 +1160,10 @@ public class PIF extends XenAPIObject { * @return Task */ public Task forgetAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.PifTunnelStillExists { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.PifTunnelStillExists { String method_call = "Async.PIF.forget"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1161,10 +1177,10 @@ public class PIF extends XenAPIObject { * */ public void forget(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.PifTunnelStillExists { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.PifTunnelStillExists { String method_call = "PIF.forget"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1178,9 +1194,9 @@ public class PIF extends XenAPIObject { * @return Task */ public Task unplugAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.PIF.unplug"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1194,9 +1210,9 @@ public class PIF extends XenAPIObject { * */ public void unplug(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.unplug"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1210,10 +1226,10 @@ public class PIF extends XenAPIObject { * @return Task */ public Task plugAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.TransportPifNotConfigured { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.TransportPifNotConfigured { String method_call = "Async.PIF.plug"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1227,10 +1243,10 @@ public class PIF extends XenAPIObject { * */ public void plug(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.TransportPifNotConfigured { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.TransportPifNotConfigured { String method_call = "PIF.plug"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1241,43 +1257,37 @@ public class PIF extends XenAPIObject { /** * Create a new PIF record in the database only * - * @param device - * @param network - * @param host - * @param MAC - * @param MTU - * @param VLAN - * @param physical - * @param ipConfigurationMode - * @param IP - * @param netmask - * @param gateway - * @param DNS - * @param bondSlaveOf - * @param VLANMasterOf - * @param management - * @param otherConfig - * @param disallowUnplug - * @param ipv6ConfigurationMode - * @param IPv6 - * @param ipv6Gateway - * @param primaryAddressType + * @param device + * @param network + * @param host + * @param MAC + * @param MTU + * @param VLAN + * @param physical + * @param ipConfigurationMode + * @param IP + * @param netmask + * @param gateway + * @param DNS + * @param bondSlaveOf + * @param VLANMasterOf + * @param management + * @param otherConfig + * @param disallowUnplug + * @param ipv6ConfigurationMode + * @param IPv6 + * @param ipv6Gateway + * @param primaryAddressType + * @param managed * @return Task */ - public static Task dbIntroduceAsync(Connection c, String device, Network network, Host host, String MAC, Long MTU, Long VLAN, Boolean physical, - Types.IpConfigurationMode ipConfigurationMode, String IP, String netmask, String gateway, String DNS, Bond bondSlaveOf, VLAN VLANMasterOf, Boolean management, - Map otherConfig, Boolean disallowUnplug, Types.Ipv6ConfigurationMode ipv6ConfigurationMode, Set IPv6, String ipv6Gateway, - Types.PrimaryAddressType primaryAddressType) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + public static Task dbIntroduceAsync(Connection c, String device, Network network, Host host, String MAC, Long MTU, Long VLAN, Boolean physical, Types.IpConfigurationMode ipConfigurationMode, String IP, String netmask, String gateway, String DNS, Bond bondSlaveOf, VLAN VLANMasterOf, Boolean management, Map otherConfig, Boolean disallowUnplug, Types.Ipv6ConfigurationMode ipv6ConfigurationMode, Set IPv6, String ipv6Gateway, Types.PrimaryAddressType primaryAddressType, Boolean managed) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.PIF.db_introduce"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(device), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(host), - Marshalling.toXMLRPC(MAC), Marshalling.toXMLRPC(MTU), Marshalling.toXMLRPC(VLAN), Marshalling.toXMLRPC(physical), Marshalling.toXMLRPC(ipConfigurationMode), - Marshalling.toXMLRPC(IP), Marshalling.toXMLRPC(netmask), Marshalling.toXMLRPC(gateway), Marshalling.toXMLRPC(DNS), Marshalling.toXMLRPC(bondSlaveOf), - Marshalling.toXMLRPC(VLANMasterOf), Marshalling.toXMLRPC(management), Marshalling.toXMLRPC(otherConfig), Marshalling.toXMLRPC(disallowUnplug), - Marshalling.toXMLRPC(ipv6ConfigurationMode), Marshalling.toXMLRPC(IPv6), Marshalling.toXMLRPC(ipv6Gateway), Marshalling.toXMLRPC(primaryAddressType)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(device), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(MAC), Marshalling.toXMLRPC(MTU), Marshalling.toXMLRPC(VLAN), Marshalling.toXMLRPC(physical), Marshalling.toXMLRPC(ipConfigurationMode), Marshalling.toXMLRPC(IP), Marshalling.toXMLRPC(netmask), Marshalling.toXMLRPC(gateway), Marshalling.toXMLRPC(DNS), Marshalling.toXMLRPC(bondSlaveOf), Marshalling.toXMLRPC(VLANMasterOf), Marshalling.toXMLRPC(management), Marshalling.toXMLRPC(otherConfig), Marshalling.toXMLRPC(disallowUnplug), Marshalling.toXMLRPC(ipv6ConfigurationMode), Marshalling.toXMLRPC(IPv6), Marshalling.toXMLRPC(ipv6Gateway), Marshalling.toXMLRPC(primaryAddressType), Marshalling.toXMLRPC(managed)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -1286,46 +1296,40 @@ public class PIF extends XenAPIObject { /** * Create a new PIF record in the database only * - * @param device - * @param network - * @param host - * @param MAC - * @param MTU - * @param VLAN - * @param physical - * @param ipConfigurationMode - * @param IP - * @param netmask - * @param gateway - * @param DNS - * @param bondSlaveOf - * @param VLANMasterOf - * @param management - * @param otherConfig - * @param disallowUnplug - * @param ipv6ConfigurationMode - * @param IPv6 - * @param ipv6Gateway - * @param primaryAddressType + * @param device + * @param network + * @param host + * @param MAC + * @param MTU + * @param VLAN + * @param physical + * @param ipConfigurationMode + * @param IP + * @param netmask + * @param gateway + * @param DNS + * @param bondSlaveOf + * @param VLANMasterOf + * @param management + * @param otherConfig + * @param disallowUnplug + * @param ipv6ConfigurationMode + * @param IPv6 + * @param ipv6Gateway + * @param primaryAddressType + * @param managed * @return The ref of the newly created PIF record. */ - public static PIF dbIntroduce(Connection c, String device, Network network, Host host, String MAC, Long MTU, Long VLAN, Boolean physical, - Types.IpConfigurationMode ipConfigurationMode, String IP, String netmask, String gateway, String DNS, Bond bondSlaveOf, VLAN VLANMasterOf, Boolean management, - Map otherConfig, Boolean disallowUnplug, Types.Ipv6ConfigurationMode ipv6ConfigurationMode, Set IPv6, String ipv6Gateway, - Types.PrimaryAddressType primaryAddressType) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + public static PIF dbIntroduce(Connection c, String device, Network network, Host host, String MAC, Long MTU, Long VLAN, Boolean physical, Types.IpConfigurationMode ipConfigurationMode, String IP, String netmask, String gateway, String DNS, Bond bondSlaveOf, VLAN VLANMasterOf, Boolean management, Map otherConfig, Boolean disallowUnplug, Types.Ipv6ConfigurationMode ipv6ConfigurationMode, Set IPv6, String ipv6Gateway, Types.PrimaryAddressType primaryAddressType, Boolean managed) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.db_introduce"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(device), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(host), - Marshalling.toXMLRPC(MAC), Marshalling.toXMLRPC(MTU), Marshalling.toXMLRPC(VLAN), Marshalling.toXMLRPC(physical), Marshalling.toXMLRPC(ipConfigurationMode), - Marshalling.toXMLRPC(IP), Marshalling.toXMLRPC(netmask), Marshalling.toXMLRPC(gateway), Marshalling.toXMLRPC(DNS), Marshalling.toXMLRPC(bondSlaveOf), - Marshalling.toXMLRPC(VLANMasterOf), Marshalling.toXMLRPC(management), Marshalling.toXMLRPC(otherConfig), Marshalling.toXMLRPC(disallowUnplug), - Marshalling.toXMLRPC(ipv6ConfigurationMode), Marshalling.toXMLRPC(IPv6), Marshalling.toXMLRPC(ipv6Gateway), Marshalling.toXMLRPC(primaryAddressType)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(device), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(MAC), Marshalling.toXMLRPC(MTU), Marshalling.toXMLRPC(VLAN), Marshalling.toXMLRPC(physical), Marshalling.toXMLRPC(ipConfigurationMode), Marshalling.toXMLRPC(IP), Marshalling.toXMLRPC(netmask), Marshalling.toXMLRPC(gateway), Marshalling.toXMLRPC(DNS), Marshalling.toXMLRPC(bondSlaveOf), Marshalling.toXMLRPC(VLANMasterOf), Marshalling.toXMLRPC(management), Marshalling.toXMLRPC(otherConfig), Marshalling.toXMLRPC(disallowUnplug), Marshalling.toXMLRPC(ipv6ConfigurationMode), Marshalling.toXMLRPC(IPv6), Marshalling.toXMLRPC(ipv6Gateway), Marshalling.toXMLRPC(primaryAddressType), Marshalling.toXMLRPC(managed)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPIF(result); + return Types.toPIF(result); } /** @@ -1334,9 +1338,9 @@ public class PIF extends XenAPIObject { * @return Task */ public Task dbForgetAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.PIF.db_forget"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1350,9 +1354,9 @@ public class PIF extends XenAPIObject { * */ public void dbForget(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.db_forget"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1366,15 +1370,15 @@ public class PIF extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfPIF(result); + return Types.toSetOfPIF(result); } /** @@ -1383,15 +1387,15 @@ public class PIF extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfPIFPIFRecord(result); + return Types.toMapOfPIFPIFRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/PIFMetrics.java b/deps/XenServerJava/src/com/xensource/xenapi/PIFMetrics.java index ab6268ee8f7..7d153931f0e 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/PIFMetrics.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/PIFMetrics.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class PIFMetrics extends XenAPIObject { * For internal use only. */ PIFMetrics(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class PIFMetrics extends XenAPIObject { { if (obj != null && obj instanceof PIFMetrics) { - PIFMetrics other = (PIFMetrics)obj; + PIFMetrics other = (PIFMetrics) obj; return other.ref.equals(this.ref); } else { @@ -118,8 +119,8 @@ public class PIFMetrics extends XenAPIObject { /** * Convert a PIF_metrics.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("io_read_kbs", this.ioReadKbs == null ? 0.0 : this.ioReadKbs); map.put("io_write_kbs", this.ioWriteKbs == null ? 0.0 : this.ioWriteKbs); @@ -196,15 +197,15 @@ public class PIFMetrics extends XenAPIObject { * @return all fields from the object */ public PIFMetrics.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF_metrics.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPIFMetricsRecord(result); + return Types.toPIFMetricsRecord(result); } /** @@ -214,15 +215,15 @@ public class PIFMetrics extends XenAPIObject { * @return reference to the object */ public static PIFMetrics getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF_metrics.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPIFMetrics(result); + return Types.toPIFMetrics(result); } /** @@ -231,15 +232,15 @@ public class PIFMetrics extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF_metrics.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -248,15 +249,15 @@ public class PIFMetrics extends XenAPIObject { * @return value of the field */ public Double getIoReadKbs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF_metrics.get_io_read_kbs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDouble(result); + return Types.toDouble(result); } /** @@ -265,15 +266,15 @@ public class PIFMetrics extends XenAPIObject { * @return value of the field */ public Double getIoWriteKbs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF_metrics.get_io_write_kbs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDouble(result); + return Types.toDouble(result); } /** @@ -282,15 +283,15 @@ public class PIFMetrics extends XenAPIObject { * @return value of the field */ public Boolean getCarrier(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF_metrics.get_carrier"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -299,15 +300,15 @@ public class PIFMetrics extends XenAPIObject { * @return value of the field */ public String getVendorId(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF_metrics.get_vendor_id"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -316,15 +317,15 @@ public class PIFMetrics extends XenAPIObject { * @return value of the field */ public String getVendorName(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF_metrics.get_vendor_name"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -333,15 +334,15 @@ public class PIFMetrics extends XenAPIObject { * @return value of the field */ public String getDeviceId(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF_metrics.get_device_id"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -350,15 +351,15 @@ public class PIFMetrics extends XenAPIObject { * @return value of the field */ public String getDeviceName(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF_metrics.get_device_name"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -367,15 +368,15 @@ public class PIFMetrics extends XenAPIObject { * @return value of the field */ public Long getSpeed(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF_metrics.get_speed"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -384,15 +385,15 @@ public class PIFMetrics extends XenAPIObject { * @return value of the field */ public Boolean getDuplex(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF_metrics.get_duplex"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -401,15 +402,15 @@ public class PIFMetrics extends XenAPIObject { * @return value of the field */ public String getPciBusPath(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF_metrics.get_pci_bus_path"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -418,15 +419,15 @@ public class PIFMetrics extends XenAPIObject { * @return value of the field */ public Date getLastUpdated(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF_metrics.get_last_updated"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDate(result); + return Types.toDate(result); } /** @@ -435,15 +436,15 @@ public class PIFMetrics extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF_metrics.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -452,9 +453,9 @@ public class PIFMetrics extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF_metrics.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -469,9 +470,9 @@ public class PIFMetrics extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF_metrics.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -485,9 +486,9 @@ public class PIFMetrics extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF_metrics.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -501,15 +502,15 @@ public class PIFMetrics extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF_metrics.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfPIFMetrics(result); + return Types.toSetOfPIFMetrics(result); } /** @@ -518,15 +519,15 @@ public class PIFMetrics extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "PIF_metrics.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfPIFMetricsPIFMetricsRecord(result); + return Types.toMapOfPIFMetricsPIFMetricsRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/Pool.java b/deps/XenServerJava/src/com/xensource/xenapi/Pool.java index 7ceebb02d56..8b5c94db04a 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/Pool.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/Pool.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class Pool extends XenAPIObject { * For internal use only. */ Pool(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class Pool extends XenAPIObject { { if (obj != null && obj instanceof Pool) { - Pool other = (Pool)obj; + Pool other = (Pool) obj; return other.ref.equals(this.ref); } else { @@ -132,8 +133,8 @@ public class Pool extends XenAPIObject { /** * Convert a pool.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("name_label", this.nameLabel == null ? "" : this.nameLabel); map.put("name_description", this.nameDescription == null ? "" : this.nameDescription); @@ -280,15 +281,15 @@ public class Pool extends XenAPIObject { * @return all fields from the object */ public Pool.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPoolRecord(result); + return Types.toPoolRecord(result); } /** @@ -298,15 +299,15 @@ public class Pool extends XenAPIObject { * @return reference to the object */ public static Pool getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPool(result); + return Types.toPool(result); } /** @@ -315,15 +316,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -332,15 +333,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public String getNameLabel(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -349,15 +350,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public String getNameDescription(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -366,15 +367,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public Host getMaster(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_master"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toHost(result); + return Types.toHost(result); } /** @@ -383,15 +384,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public SR getDefaultSR(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_default_SR"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSR(result); + return Types.toSR(result); } /** @@ -400,15 +401,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public SR getSuspendImageSR(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_suspend_image_SR"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSR(result); + return Types.toSR(result); } /** @@ -417,15 +418,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public SR getCrashDumpSR(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_crash_dump_SR"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSR(result); + return Types.toSR(result); } /** @@ -434,15 +435,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -451,15 +452,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public Boolean getHaEnabled(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_ha_enabled"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -468,15 +469,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public Map getHaConfiguration(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_ha_configuration"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -485,15 +486,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public Set getHaStatefiles(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_ha_statefiles"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -502,15 +503,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public Long getHaHostFailuresToTolerate(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_ha_host_failures_to_tolerate"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -519,15 +520,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public Long getHaPlanExistsFor(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_ha_plan_exists_for"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -536,15 +537,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public Boolean getHaAllowOvercommit(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_ha_allow_overcommit"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -553,15 +554,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public Boolean getHaOvercommitted(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_ha_overcommitted"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -570,15 +571,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public Map getBlobs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_blobs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringBlob(result); + return Types.toMapOfStringBlob(result); } /** @@ -587,15 +588,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public Set getTags(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_tags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -604,15 +605,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public Map getGuiConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_gui_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -621,15 +622,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public String getWlbUrl(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_wlb_url"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -638,15 +639,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public String getWlbUsername(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_wlb_username"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -655,15 +656,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public Boolean getWlbEnabled(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_wlb_enabled"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -672,15 +673,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public Boolean getWlbVerifyCert(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_wlb_verify_cert"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -689,15 +690,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public Boolean getRedoLogEnabled(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_redo_log_enabled"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -706,15 +707,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public VDI getRedoLogVdi(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_redo_log_vdi"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVDI(result); + return Types.toVDI(result); } /** @@ -723,15 +724,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public String getVswitchController(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_vswitch_controller"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -740,15 +741,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public Map getRestrictions(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_restrictions"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -757,15 +758,15 @@ public class Pool extends XenAPIObject { * @return value of the field */ public Set getMetadataVDIs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_metadata_VDIs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVDI(result); + return Types.toSetOfVDI(result); } /** @@ -774,9 +775,9 @@ public class Pool extends XenAPIObject { * @param nameLabel New value to set */ public void setNameLabel(Connection c, String nameLabel) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.set_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(nameLabel)}; @@ -790,9 +791,9 @@ public class Pool extends XenAPIObject { * @param nameDescription New value to set */ public void setNameDescription(Connection c, String nameDescription) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.set_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(nameDescription)}; @@ -806,9 +807,9 @@ public class Pool extends XenAPIObject { * @param defaultSR New value to set */ public void setDefaultSR(Connection c, SR defaultSR) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.set_default_SR"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(defaultSR)}; @@ -822,9 +823,9 @@ public class Pool extends XenAPIObject { * @param suspendImageSR New value to set */ public void setSuspendImageSR(Connection c, SR suspendImageSR) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.set_suspend_image_SR"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(suspendImageSR)}; @@ -838,9 +839,9 @@ public class Pool extends XenAPIObject { * @param crashDumpSR New value to set */ public void setCrashDumpSR(Connection c, SR crashDumpSR) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.set_crash_dump_SR"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(crashDumpSR)}; @@ -854,9 +855,9 @@ public class Pool extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -871,9 +872,9 @@ public class Pool extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -887,9 +888,9 @@ public class Pool extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -903,9 +904,9 @@ public class Pool extends XenAPIObject { * @param haAllowOvercommit New value to set */ public void setHaAllowOvercommit(Connection c, Boolean haAllowOvercommit) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.set_ha_allow_overcommit"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(haAllowOvercommit)}; @@ -919,9 +920,9 @@ public class Pool extends XenAPIObject { * @param tags New value to set */ public void setTags(Connection c, Set tags) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.set_tags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(tags)}; @@ -935,9 +936,9 @@ public class Pool extends XenAPIObject { * @param value New value to add */ public void addTags(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.add_tags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -951,9 +952,9 @@ public class Pool extends XenAPIObject { * @param value Value to remove */ public void removeTags(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.remove_tags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -967,9 +968,9 @@ public class Pool extends XenAPIObject { * @param guiConfig New value to set */ public void setGuiConfig(Connection c, Map guiConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.set_gui_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(guiConfig)}; @@ -984,9 +985,9 @@ public class Pool extends XenAPIObject { * @param value Value to add */ public void addToGuiConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.add_to_gui_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -1000,9 +1001,9 @@ public class Pool extends XenAPIObject { * @param key Key to remove */ public void removeFromGuiConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.remove_from_gui_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -1016,9 +1017,9 @@ public class Pool extends XenAPIObject { * @param wlbEnabled New value to set */ public void setWlbEnabled(Connection c, Boolean wlbEnabled) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.set_wlb_enabled"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(wlbEnabled)}; @@ -1032,9 +1033,9 @@ public class Pool extends XenAPIObject { * @param wlbVerifyCert New value to set */ public void setWlbVerifyCert(Connection c, Boolean wlbVerifyCert) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.set_wlb_verify_cert"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(wlbVerifyCert)}; @@ -1051,14 +1052,13 @@ public class Pool extends XenAPIObject { * @return Task */ public static Task joinAsync(Connection c, String masterAddress, String masterUsername, String masterPassword) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.JoiningHostCannotContainSharedSrs { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.JoiningHostCannotContainSharedSrs { String method_call = "Async.pool.join"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(masterAddress), Marshalling.toXMLRPC(masterUsername), - Marshalling.toXMLRPC(masterPassword)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(masterAddress), Marshalling.toXMLRPC(masterUsername), Marshalling.toXMLRPC(masterPassword)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -1072,14 +1072,13 @@ public class Pool extends XenAPIObject { * @param masterPassword The password for the master (for initial authentication) */ public static void join(Connection c, String masterAddress, String masterUsername, String masterPassword) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.JoiningHostCannotContainSharedSrs { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.JoiningHostCannotContainSharedSrs { String method_call = "pool.join"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(masterAddress), Marshalling.toXMLRPC(masterUsername), - Marshalling.toXMLRPC(masterPassword)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(masterAddress), Marshalling.toXMLRPC(masterUsername), Marshalling.toXMLRPC(masterPassword)}; Map response = c.dispatch(method_call, method_params); return; } @@ -1093,13 +1092,12 @@ public class Pool extends XenAPIObject { * @return Task */ public static Task joinForceAsync(Connection c, String masterAddress, String masterUsername, String masterPassword) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.join_force"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(masterAddress), Marshalling.toXMLRPC(masterUsername), - Marshalling.toXMLRPC(masterPassword)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(masterAddress), Marshalling.toXMLRPC(masterUsername), Marshalling.toXMLRPC(masterPassword)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -1113,13 +1111,12 @@ public class Pool extends XenAPIObject { * @param masterPassword The password for the master (for initial authentication) */ public static void joinForce(Connection c, String masterAddress, String masterUsername, String masterPassword) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.join_force"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(masterAddress), Marshalling.toXMLRPC(masterUsername), - Marshalling.toXMLRPC(masterPassword)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(masterAddress), Marshalling.toXMLRPC(masterUsername), Marshalling.toXMLRPC(masterPassword)}; Map response = c.dispatch(method_call, method_params); return; } @@ -1131,9 +1128,9 @@ public class Pool extends XenAPIObject { * @return Task */ public static Task ejectAsync(Connection c, Host host) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.eject"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host)}; @@ -1148,9 +1145,9 @@ public class Pool extends XenAPIObject { * @param host The host to eject */ public static void eject(Connection c, Host host) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.eject"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host)}; @@ -1163,9 +1160,9 @@ public class Pool extends XenAPIObject { * */ public static void emergencyTransitionToMaster(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.emergency_transition_to_master"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; @@ -1179,9 +1176,9 @@ public class Pool extends XenAPIObject { * @param masterAddress The hostname of the master */ public static void emergencyResetMaster(Connection c, String masterAddress) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.emergency_reset_master"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(masterAddress)}; @@ -1195,9 +1192,9 @@ public class Pool extends XenAPIObject { * @return Task */ public static Task recoverSlavesAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.recover_slaves"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; @@ -1212,15 +1209,15 @@ public class Pool extends XenAPIObject { * @return list of hosts whose master address were succesfully reset */ public static Set recoverSlaves(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.recover_slaves"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfHost(result); + return Types.toSetOfHost(result); } /** @@ -1232,10 +1229,10 @@ public class Pool extends XenAPIObject { * @return Task */ public static Task createVLANAsync(Connection c, String device, Network network, Long VLAN) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VlanTagInvalid { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VlanTagInvalid { String method_call = "Async.pool.create_VLAN"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(device), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(VLAN)}; @@ -1253,16 +1250,16 @@ public class Pool extends XenAPIObject { * @return The references of the created PIF objects */ public static Set createVLAN(Connection c, String device, Network network, Long VLAN) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VlanTagInvalid { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VlanTagInvalid { String method_call = "pool.create_VLAN"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(device), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(VLAN)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfPIF(result); + return Types.toSetOfPIF(result); } /** @@ -1274,10 +1271,10 @@ public class Pool extends XenAPIObject { * @return Task */ public static Task createVLANFromPIFAsync(Connection c, PIF pif, Network network, Long VLAN) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VlanTagInvalid { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VlanTagInvalid { String method_call = "Async.pool.create_VLAN_from_PIF"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(pif), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(VLAN)}; @@ -1295,16 +1292,16 @@ public class Pool extends XenAPIObject { * @return The references of the created PIF objects */ public static Set createVLANFromPIF(Connection c, PIF pif, Network network, Long VLAN) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VlanTagInvalid { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VlanTagInvalid { String method_call = "pool.create_VLAN_from_PIF"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(pif), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(VLAN)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfPIF(result); + return Types.toSetOfPIF(result); } /** @@ -1315,9 +1312,9 @@ public class Pool extends XenAPIObject { * @return Task */ public static Task enableHaAsync(Connection c, Set heartbeatSrs, Map configuration) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.enable_ha"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(heartbeatSrs), Marshalling.toXMLRPC(configuration)}; @@ -1333,9 +1330,9 @@ public class Pool extends XenAPIObject { * @param configuration Detailed HA configuration to apply */ public static void enableHa(Connection c, Set heartbeatSrs, Map configuration) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.enable_ha"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(heartbeatSrs), Marshalling.toXMLRPC(configuration)}; @@ -1349,9 +1346,9 @@ public class Pool extends XenAPIObject { * @return Task */ public static Task disableHaAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.disable_ha"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; @@ -1365,9 +1362,9 @@ public class Pool extends XenAPIObject { * */ public static void disableHa(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.disable_ha"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; @@ -1381,9 +1378,9 @@ public class Pool extends XenAPIObject { * @return Task */ public static Task syncDatabaseAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.sync_database"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; @@ -1397,9 +1394,9 @@ public class Pool extends XenAPIObject { * */ public static void syncDatabase(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.sync_database"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; @@ -1414,9 +1411,9 @@ public class Pool extends XenAPIObject { * @return Task */ public static Task designateNewMasterAsync(Connection c, Host host) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.designate_new_master"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host)}; @@ -1431,9 +1428,9 @@ public class Pool extends XenAPIObject { * @param host The host who should become the new master */ public static void designateNewMaster(Connection c, Host host) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.designate_new_master"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host)}; @@ -1447,9 +1444,9 @@ public class Pool extends XenAPIObject { * @param seconds The number of seconds to block the restart thread for */ public static void haPreventRestartsFor(Connection c, Long seconds) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.ha_prevent_restarts_for"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(seconds)}; @@ -1464,15 +1461,15 @@ public class Pool extends XenAPIObject { * @return true if a failover plan exists for the supplied number of host failures */ public static Boolean haFailoverPlanExists(Connection c, Long n) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.ha_failover_plan_exists"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(n)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -1481,15 +1478,15 @@ public class Pool extends XenAPIObject { * @return maximum value for ha_host_failures_to_tolerate given current configuration */ public static Long haComputeMaxHostFailuresToTolerate(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.ha_compute_max_host_failures_to_tolerate"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -1499,15 +1496,15 @@ public class Pool extends XenAPIObject { * @return maximum value for ha_host_failures_to_tolerate given provided configuration */ public static Long haComputeHypotheticalMaxHostFailuresToTolerate(Connection c, Map configuration) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.ha_compute_hypothetical_max_host_failures_to_tolerate"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(configuration)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -1518,15 +1515,15 @@ public class Pool extends XenAPIObject { * @return VM failover plan: a map of VM to host to restart the host on */ public static Map> haComputeVmFailoverPlan(Connection c, Set failedHosts, Set failedVms) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.ha_compute_vm_failover_plan"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(failedHosts), Marshalling.toXMLRPC(failedVms)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfVMMapOfStringString(result); + return Types.toMapOfVMMapOfStringString(result); } /** @@ -1536,9 +1533,9 @@ public class Pool extends XenAPIObject { * @return Task */ public Task setHaHostFailuresToTolerateAsync(Connection c, Long value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.set_ha_host_failures_to_tolerate"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1553,9 +1550,9 @@ public class Pool extends XenAPIObject { * @param value New number of host failures to consider */ public void setHaHostFailuresToTolerate(Connection c, Long value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.set_ha_host_failures_to_tolerate"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1572,13 +1569,12 @@ public class Pool extends XenAPIObject { * @return Task */ public Task createNewBlobAsync(Connection c, String name, String mimeType, Boolean _public) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.create_new_blob"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), - Marshalling.toXMLRPC(_public)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), Marshalling.toXMLRPC(_public)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -1593,16 +1589,15 @@ public class Pool extends XenAPIObject { * @return The reference of the blob, needed for populating its data */ public Blob createNewBlob(Connection c, String name, String mimeType, Boolean _public) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.create_new_blob"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), - Marshalling.toXMLRPC(_public)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), Marshalling.toXMLRPC(_public)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBlob(result); + return Types.toBlob(result); } /** @@ -1613,13 +1608,12 @@ public class Pool extends XenAPIObject { * @param authType The type of authentication (e.g. AD for Active Directory) */ public void enableExternalAuth(Connection c, Map config, String serviceName, String authType) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.enable_external_auth"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(config), Marshalling.toXMLRPC(serviceName), - Marshalling.toXMLRPC(authType)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(config), Marshalling.toXMLRPC(serviceName), Marshalling.toXMLRPC(authType)}; Map response = c.dispatch(method_call, method_params); return; } @@ -1630,9 +1624,9 @@ public class Pool extends XenAPIObject { * @param config Optional parameters as a list of key-values containing the configuration data */ public void disableExternalAuth(Connection c, Map config) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.disable_external_auth"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(config)}; @@ -1645,9 +1639,9 @@ public class Pool extends XenAPIObject { * */ public void detectNonhomogeneousExternalAuth(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.detect_nonhomogeneous_external_auth"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1666,13 +1660,12 @@ public class Pool extends XenAPIObject { * @return Task */ public static Task initializeWlbAsync(Connection c, String wlbUrl, String wlbUsername, String wlbPassword, String xenserverUsername, String xenserverPassword) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.initialize_wlb"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(wlbUrl), Marshalling.toXMLRPC(wlbUsername), Marshalling.toXMLRPC(wlbPassword), - Marshalling.toXMLRPC(xenserverUsername), Marshalling.toXMLRPC(xenserverPassword)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(wlbUrl), Marshalling.toXMLRPC(wlbUsername), Marshalling.toXMLRPC(wlbPassword), Marshalling.toXMLRPC(xenserverUsername), Marshalling.toXMLRPC(xenserverPassword)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -1688,13 +1681,12 @@ public class Pool extends XenAPIObject { * @param xenserverPassword The password used by the wlb server to authenticate with the xenserver */ public static void initializeWlb(Connection c, String wlbUrl, String wlbUsername, String wlbPassword, String xenserverUsername, String xenserverPassword) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.initialize_wlb"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(wlbUrl), Marshalling.toXMLRPC(wlbUsername), Marshalling.toXMLRPC(wlbPassword), - Marshalling.toXMLRPC(xenserverUsername), Marshalling.toXMLRPC(xenserverPassword)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(wlbUrl), Marshalling.toXMLRPC(wlbUsername), Marshalling.toXMLRPC(wlbPassword), Marshalling.toXMLRPC(xenserverUsername), Marshalling.toXMLRPC(xenserverPassword)}; Map response = c.dispatch(method_call, method_params); return; } @@ -1705,9 +1697,9 @@ public class Pool extends XenAPIObject { * @return Task */ public static Task deconfigureWlbAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.deconfigure_wlb"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; @@ -1721,9 +1713,9 @@ public class Pool extends XenAPIObject { * */ public static void deconfigureWlb(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.deconfigure_wlb"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; @@ -1738,9 +1730,9 @@ public class Pool extends XenAPIObject { * @return Task */ public static Task sendWlbConfigurationAsync(Connection c, Map config) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.send_wlb_configuration"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(config)}; @@ -1755,9 +1747,9 @@ public class Pool extends XenAPIObject { * @param config The configuration to use in optimizing this pool */ public static void sendWlbConfiguration(Connection c, Map config) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.send_wlb_configuration"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(config)}; @@ -1771,9 +1763,9 @@ public class Pool extends XenAPIObject { * @return Task */ public static Task retrieveWlbConfigurationAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.retrieve_wlb_configuration"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; @@ -1788,15 +1780,15 @@ public class Pool extends XenAPIObject { * @return The configuration used in optimizing this pool */ public static Map retrieveWlbConfiguration(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.retrieve_wlb_configuration"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -1805,9 +1797,9 @@ public class Pool extends XenAPIObject { * @return Task */ public static Task retrieveWlbRecommendationsAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.retrieve_wlb_recommendations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; @@ -1822,29 +1814,29 @@ public class Pool extends XenAPIObject { * @return The list of vm migration recommendations */ public static Map> retrieveWlbRecommendations(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.retrieve_wlb_recommendations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfVMSetOfString(result); + return Types.toMapOfVMSetOfString(result); } /** * Send the given body to the given host and port, using HTTPS, and print the response. This is used for debugging the SSL layer. * - * @param host - * @param port - * @param body + * @param host + * @param port + * @param body * @return Task */ public static Task sendTestPostAsync(Connection c, String host, Long port, String body) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.send_test_post"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(port), Marshalling.toXMLRPC(body)}; @@ -1856,21 +1848,21 @@ public class Pool extends XenAPIObject { /** * Send the given body to the given host and port, using HTTPS, and print the response. This is used for debugging the SSL layer. * - * @param host - * @param port - * @param body + * @param host + * @param port + * @param body * @return The response */ public static String sendTestPost(Connection c, String host, Long port, String body) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.send_test_post"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(port), Marshalling.toXMLRPC(body)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -1881,9 +1873,9 @@ public class Pool extends XenAPIObject { * @return Task */ public static Task certificateInstallAsync(Connection c, String name, String cert) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.certificate_install"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(cert)}; @@ -1899,9 +1891,9 @@ public class Pool extends XenAPIObject { * @param cert The certificate */ public static void certificateInstall(Connection c, String name, String cert) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.certificate_install"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(cert)}; @@ -1916,9 +1908,9 @@ public class Pool extends XenAPIObject { * @return Task */ public static Task certificateUninstallAsync(Connection c, String name) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.certificate_uninstall"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(name)}; @@ -1933,9 +1925,9 @@ public class Pool extends XenAPIObject { * @param name The certificate name */ public static void certificateUninstall(Connection c, String name) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.certificate_uninstall"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(name)}; @@ -1949,9 +1941,9 @@ public class Pool extends XenAPIObject { * @return Task */ public static Task certificateListAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.certificate_list"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; @@ -1966,15 +1958,15 @@ public class Pool extends XenAPIObject { * @return All installed certificates */ public static Set certificateList(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.certificate_list"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -1985,9 +1977,9 @@ public class Pool extends XenAPIObject { * @return Task */ public static Task crlInstallAsync(Connection c, String name, String cert) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.crl_install"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(cert)}; @@ -2003,9 +1995,9 @@ public class Pool extends XenAPIObject { * @param cert The CRL */ public static void crlInstall(Connection c, String name, String cert) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.crl_install"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(cert)}; @@ -2020,9 +2012,9 @@ public class Pool extends XenAPIObject { * @return Task */ public static Task crlUninstallAsync(Connection c, String name) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.crl_uninstall"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(name)}; @@ -2037,9 +2029,9 @@ public class Pool extends XenAPIObject { * @param name The CRL name */ public static void crlUninstall(Connection c, String name) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.crl_uninstall"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(name)}; @@ -2053,9 +2045,9 @@ public class Pool extends XenAPIObject { * @return Task */ public static Task crlListAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.crl_list"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; @@ -2070,15 +2062,15 @@ public class Pool extends XenAPIObject { * @return All installed CRLs */ public static Set crlList(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.crl_list"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -2087,9 +2079,9 @@ public class Pool extends XenAPIObject { * @return Task */ public static Task certificateSyncAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.certificate_sync"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; @@ -2103,9 +2095,9 @@ public class Pool extends XenAPIObject { * */ public static void certificateSync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.certificate_sync"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; @@ -2120,9 +2112,9 @@ public class Pool extends XenAPIObject { * @return Task */ public static Task enableRedoLogAsync(Connection c, SR sr) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.enable_redo_log"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(sr)}; @@ -2137,9 +2129,9 @@ public class Pool extends XenAPIObject { * @param sr SR to hold the redo log. */ public static void enableRedoLog(Connection c, SR sr) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.enable_redo_log"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(sr)}; @@ -2153,9 +2145,9 @@ public class Pool extends XenAPIObject { * @return Task */ public static Task disableRedoLogAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.disable_redo_log"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; @@ -2169,9 +2161,9 @@ public class Pool extends XenAPIObject { * */ public static void disableRedoLog(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.disable_redo_log"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; @@ -2186,9 +2178,9 @@ public class Pool extends XenAPIObject { * @return Task */ public static Task setVswitchControllerAsync(Connection c, String address) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.set_vswitch_controller"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(address)}; @@ -2203,9 +2195,9 @@ public class Pool extends XenAPIObject { * @param address IP address of the vswitch controller. */ public static void setVswitchController(Connection c, String address) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.set_vswitch_controller"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(address)}; @@ -2220,15 +2212,15 @@ public class Pool extends XenAPIObject { * @return An XMLRPC result */ public String testArchiveTarget(Connection c, Map config) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.test_archive_target"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(config)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -2237,9 +2229,9 @@ public class Pool extends XenAPIObject { * @return Task */ public Task enableLocalStorageCachingAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.enable_local_storage_caching"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2253,9 +2245,9 @@ public class Pool extends XenAPIObject { * */ public void enableLocalStorageCaching(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.enable_local_storage_caching"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2269,9 +2261,9 @@ public class Pool extends XenAPIObject { * @return Task */ public Task disableLocalStorageCachingAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool.disable_local_storage_caching"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2285,9 +2277,9 @@ public class Pool extends XenAPIObject { * */ public void disableLocalStorageCaching(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.disable_local_storage_caching"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2295,21 +2287,89 @@ public class Pool extends XenAPIObject { return; } + /** + * This call returns the license state for the pool + * + * @return Task + */ + public Task getLicenseStateAsync(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "Async.pool.get_license_state"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toTask(result); + } + + /** + * This call returns the license state for the pool + * + * @return The pool's license state + */ + public Map getLicenseState(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "pool.get_license_state"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toMapOfStringString(result); + } + + /** + * Apply an edition to all hosts in the pool + * + * @param edition The requested edition + * @return Task + */ + public Task applyEditionAsync(Connection c, String edition) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "Async.pool.apply_edition"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(edition)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toTask(result); + } + + /** + * Apply an edition to all hosts in the pool + * + * @param edition The requested edition + */ + public void applyEdition(Connection c, String edition) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "pool.apply_edition"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(edition)}; + Map response = c.dispatch(method_call, method_params); + return; + } + /** * Return a list of all the pools known to the system. * * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfPool(result); + return Types.toSetOfPool(result); } /** @@ -2318,15 +2378,15 @@ public class Pool extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfPoolPoolRecord(result); + return Types.toMapOfPoolPoolRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/PoolPatch.java b/deps/XenServerJava/src/com/xensource/xenapi/PoolPatch.java index 7361bc7da0e..99ac7e8d660 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/PoolPatch.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/PoolPatch.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class PoolPatch extends XenAPIObject { * For internal use only. */ PoolPatch(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class PoolPatch extends XenAPIObject { { if (obj != null && obj instanceof PoolPatch) { - PoolPatch other = (PoolPatch)obj; + PoolPatch other = (PoolPatch) obj; return other.ref.equals(this.ref); } else { @@ -114,8 +115,8 @@ public class PoolPatch extends XenAPIObject { /** * Convert a pool_patch.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("name_label", this.nameLabel == null ? "" : this.nameLabel); map.put("name_description", this.nameDescription == null ? "" : this.nameDescription); @@ -172,15 +173,15 @@ public class PoolPatch extends XenAPIObject { * @return all fields from the object */ public PoolPatch.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool_patch.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPoolPatchRecord(result); + return Types.toPoolPatchRecord(result); } /** @@ -190,15 +191,15 @@ public class PoolPatch extends XenAPIObject { * @return reference to the object */ public static PoolPatch getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool_patch.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPoolPatch(result); + return Types.toPoolPatch(result); } /** @@ -208,15 +209,15 @@ public class PoolPatch extends XenAPIObject { * @return references to objects with matching names */ public static Set getByNameLabel(Connection c, String label) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool_patch.get_by_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfPoolPatch(result); + return Types.toSetOfPoolPatch(result); } /** @@ -225,15 +226,15 @@ public class PoolPatch extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool_patch.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -242,15 +243,15 @@ public class PoolPatch extends XenAPIObject { * @return value of the field */ public String getNameLabel(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool_patch.get_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -259,15 +260,15 @@ public class PoolPatch extends XenAPIObject { * @return value of the field */ public String getNameDescription(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool_patch.get_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -276,15 +277,15 @@ public class PoolPatch extends XenAPIObject { * @return value of the field */ public String getVersion(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool_patch.get_version"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -293,15 +294,15 @@ public class PoolPatch extends XenAPIObject { * @return value of the field */ public Long getSize(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool_patch.get_size"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -310,15 +311,15 @@ public class PoolPatch extends XenAPIObject { * @return value of the field */ public Boolean getPoolApplied(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool_patch.get_pool_applied"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -327,15 +328,15 @@ public class PoolPatch extends XenAPIObject { * @return value of the field */ public Set getHostPatches(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool_patch.get_host_patches"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfHostPatch(result); + return Types.toSetOfHostPatch(result); } /** @@ -344,15 +345,15 @@ public class PoolPatch extends XenAPIObject { * @return value of the field */ public Set getAfterApplyGuidance(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool_patch.get_after_apply_guidance"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfAfterApplyGuidance(result); + return Types.toSetOfAfterApplyGuidance(result); } /** @@ -361,15 +362,15 @@ public class PoolPatch extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool_patch.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -378,9 +379,9 @@ public class PoolPatch extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool_patch.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -395,9 +396,9 @@ public class PoolPatch extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool_patch.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -411,9 +412,9 @@ public class PoolPatch extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool_patch.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -428,9 +429,9 @@ public class PoolPatch extends XenAPIObject { * @return Task */ public Task applyAsync(Connection c, Host host) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool_patch.apply"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host)}; @@ -446,15 +447,15 @@ public class PoolPatch extends XenAPIObject { * @return the output of the patch application process */ public String apply(Connection c, Host host) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool_patch.apply"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -463,9 +464,9 @@ public class PoolPatch extends XenAPIObject { * @return Task */ public Task poolApplyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool_patch.pool_apply"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -479,9 +480,9 @@ public class PoolPatch extends XenAPIObject { * */ public void poolApply(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool_patch.pool_apply"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -496,9 +497,9 @@ public class PoolPatch extends XenAPIObject { * @return Task */ public Task precheckAsync(Connection c, Host host) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool_patch.precheck"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host)}; @@ -514,15 +515,15 @@ public class PoolPatch extends XenAPIObject { * @return the output of the patch prechecks */ public String precheck(Connection c, Host host) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool_patch.precheck"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -531,9 +532,9 @@ public class PoolPatch extends XenAPIObject { * @return Task */ public Task cleanAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool_patch.clean"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -547,9 +548,9 @@ public class PoolPatch extends XenAPIObject { * */ public void clean(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool_patch.clean"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -563,9 +564,9 @@ public class PoolPatch extends XenAPIObject { * @return Task */ public Task poolCleanAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool_patch.pool_clean"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -579,9 +580,9 @@ public class PoolPatch extends XenAPIObject { * */ public void poolClean(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool_patch.pool_clean"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -595,9 +596,9 @@ public class PoolPatch extends XenAPIObject { * @return Task */ public Task destroyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool_patch.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -611,9 +612,9 @@ public class PoolPatch extends XenAPIObject { * */ public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool_patch.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -628,9 +629,9 @@ public class PoolPatch extends XenAPIObject { * @return Task */ public Task cleanOnHostAsync(Connection c, Host host) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.pool_patch.clean_on_host"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host)}; @@ -645,9 +646,9 @@ public class PoolPatch extends XenAPIObject { * @param host The host on which to clean the patch */ public void cleanOnHost(Connection c, Host host) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool_patch.clean_on_host"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host)}; @@ -661,15 +662,15 @@ public class PoolPatch extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool_patch.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfPoolPatch(result); + return Types.toSetOfPoolPatch(result); } /** @@ -678,15 +679,15 @@ public class PoolPatch extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "pool_patch.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfPoolPatchPoolPatchRecord(result); + return Types.toMapOfPoolPatchPoolPatchRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/Role.java b/deps/XenServerJava/src/com/xensource/xenapi/Role.java index 5808b13cdb2..c9eaeaa932a 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/Role.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/Role.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class Role extends XenAPIObject { * For internal use only. */ Role(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class Role extends XenAPIObject { { if (obj != null && obj instanceof Role) { - Role other = (Role)obj; + Role other = (Role) obj; return other.ref.equals(this.ref); } else { @@ -109,8 +110,8 @@ public class Role extends XenAPIObject { /** * Convert a role.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("name_label", this.nameLabel == null ? "" : this.nameLabel); map.put("name_description", this.nameDescription == null ? "" : this.nameDescription); @@ -142,15 +143,15 @@ public class Role extends XenAPIObject { * @return all fields from the object */ public Role.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "role.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toRoleRecord(result); + return Types.toRoleRecord(result); } /** @@ -160,15 +161,15 @@ public class Role extends XenAPIObject { * @return reference to the object */ public static Role getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "role.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toRole(result); + return Types.toRole(result); } /** @@ -178,15 +179,15 @@ public class Role extends XenAPIObject { * @return references to objects with matching names */ public static Set getByNameLabel(Connection c, String label) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "role.get_by_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfRole(result); + return Types.toSetOfRole(result); } /** @@ -195,15 +196,15 @@ public class Role extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "role.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -212,15 +213,15 @@ public class Role extends XenAPIObject { * @return value of the field */ public String getNameLabel(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "role.get_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -229,15 +230,15 @@ public class Role extends XenAPIObject { * @return value of the field */ public String getNameDescription(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "role.get_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -246,15 +247,15 @@ public class Role extends XenAPIObject { * @return value of the field */ public Set getSubroles(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "role.get_subroles"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfRole(result); + return Types.toSetOfRole(result); } /** @@ -263,15 +264,15 @@ public class Role extends XenAPIObject { * @return a list of permissions */ public Set getPermissions(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "role.get_permissions"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfRole(result); + return Types.toSetOfRole(result); } /** @@ -280,15 +281,15 @@ public class Role extends XenAPIObject { * @return a list of permission names */ public Set getPermissionsNameLabel(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "role.get_permissions_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -297,15 +298,15 @@ public class Role extends XenAPIObject { * @return a list of references to roles */ public Set getByPermission(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "role.get_by_permission"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfRole(result); + return Types.toSetOfRole(result); } /** @@ -315,15 +316,15 @@ public class Role extends XenAPIObject { * @return a list of references to roles */ public static Set getByPermissionNameLabel(Connection c, String label) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "role.get_by_permission_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfRole(result); + return Types.toSetOfRole(result); } /** @@ -332,15 +333,15 @@ public class Role extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "role.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfRole(result); + return Types.toSetOfRole(result); } /** @@ -349,15 +350,15 @@ public class Role extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "role.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfRoleRoleRecord(result); + return Types.toMapOfRoleRoleRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/SM.java b/deps/XenServerJava/src/com/xensource/xenapi/SM.java index 0ec362694b6..6950fcd16b6 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/SM.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/SM.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class SM extends XenAPIObject { * For internal use only. */ SM(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class SM extends XenAPIObject { { if (obj != null && obj instanceof SM) { - SM other = (SM)obj; + SM other = (SM) obj; return other.ref.equals(this.ref); } else { @@ -109,6 +110,7 @@ public class SM extends XenAPIObject { print.printf("%1$20s: %2$s\n", "requiredApiVersion", this.requiredApiVersion); print.printf("%1$20s: %2$s\n", "configuration", this.configuration); print.printf("%1$20s: %2$s\n", "capabilities", this.capabilities); + print.printf("%1$20s: %2$s\n", "features", this.features); print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig); print.printf("%1$20s: %2$s\n", "driverFilename", this.driverFilename); return writer.toString(); @@ -117,8 +119,8 @@ public class SM extends XenAPIObject { /** * Convert a SM.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("name_label", this.nameLabel == null ? "" : this.nameLabel); map.put("name_description", this.nameDescription == null ? "" : this.nameDescription); @@ -129,6 +131,7 @@ public class SM extends XenAPIObject { map.put("required_api_version", this.requiredApiVersion == null ? "" : this.requiredApiVersion); map.put("configuration", this.configuration == null ? new HashMap() : this.configuration); map.put("capabilities", this.capabilities == null ? new LinkedHashSet() : this.capabilities); + map.put("features", this.features == null ? new HashMap() : this.features); map.put("other_config", this.otherConfig == null ? new HashMap() : this.otherConfig); map.put("driver_filename", this.driverFilename == null ? "" : this.driverFilename); return map; @@ -174,6 +177,10 @@ public class SM extends XenAPIObject { * capabilities of the SM plugin */ public Set capabilities; + /** + * capabilities of the SM plugin, with capability version numbers + */ + public Map features; /** * additional configuration */ @@ -190,15 +197,15 @@ public class SM extends XenAPIObject { * @return all fields from the object */ public SM.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SM.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSMRecord(result); + return Types.toSMRecord(result); } /** @@ -208,15 +215,15 @@ public class SM extends XenAPIObject { * @return reference to the object */ public static SM getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SM.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSM(result); + return Types.toSM(result); } /** @@ -226,15 +233,15 @@ public class SM extends XenAPIObject { * @return references to objects with matching names */ public static Set getByNameLabel(Connection c, String label) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SM.get_by_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfSM(result); + return Types.toSetOfSM(result); } /** @@ -243,15 +250,15 @@ public class SM extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SM.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -260,15 +267,15 @@ public class SM extends XenAPIObject { * @return value of the field */ public String getNameLabel(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SM.get_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -277,15 +284,15 @@ public class SM extends XenAPIObject { * @return value of the field */ public String getNameDescription(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SM.get_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -294,15 +301,15 @@ public class SM extends XenAPIObject { * @return value of the field */ public String getType(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SM.get_type"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -311,15 +318,15 @@ public class SM extends XenAPIObject { * @return value of the field */ public String getVendor(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SM.get_vendor"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -328,15 +335,15 @@ public class SM extends XenAPIObject { * @return value of the field */ public String getCopyright(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SM.get_copyright"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -345,15 +352,15 @@ public class SM extends XenAPIObject { * @return value of the field */ public String getVersion(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SM.get_version"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -362,15 +369,15 @@ public class SM extends XenAPIObject { * @return value of the field */ public String getRequiredApiVersion(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SM.get_required_api_version"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -379,32 +386,50 @@ public class SM extends XenAPIObject { * @return value of the field */ public Map getConfiguration(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SM.get_configuration"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** * Get the capabilities field of the given SM. + * @deprecated * * @return value of the field */ - public Set getCapabilities(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public Set getCapabilities(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SM.get_capabilities"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); + } + + /** + * Get the features field of the given SM. + * + * @return value of the field + */ + public Map getFeatures(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "SM.get_features"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toMapOfStringLong(result); } /** @@ -413,15 +438,15 @@ public class SM extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SM.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -430,15 +455,15 @@ public class SM extends XenAPIObject { * @return value of the field */ public String getDriverFilename(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SM.get_driver_filename"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -447,9 +472,9 @@ public class SM extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SM.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -464,9 +489,9 @@ public class SM extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SM.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -480,9 +505,9 @@ public class SM extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SM.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -496,15 +521,15 @@ public class SM extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SM.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfSM(result); + return Types.toSetOfSM(result); } /** @@ -513,15 +538,15 @@ public class SM extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SM.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfSMSMRecord(result); + return Types.toMapOfSMSMRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/SR.java b/deps/XenServerJava/src/com/xensource/xenapi/SR.java index db6770fbe8f..899915859f3 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/SR.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/SR.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class SR extends XenAPIObject { * For internal use only. */ SR(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class SR extends XenAPIObject { { if (obj != null && obj instanceof SR) { - SR other = (SR)obj; + SR other = (SR) obj; return other.ref.equals(this.ref); } else { @@ -124,8 +125,8 @@ public class SR extends XenAPIObject { /** * Convert a SR.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("name_label", this.nameLabel == null ? "" : this.nameLabel); map.put("name_description", this.nameDescription == null ? "" : this.nameDescription); @@ -232,15 +233,15 @@ public class SR extends XenAPIObject { * @return all fields from the object */ public SR.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSRRecord(result); + return Types.toSRRecord(result); } /** @@ -250,15 +251,15 @@ public class SR extends XenAPIObject { * @return reference to the object */ public static SR getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSR(result); + return Types.toSR(result); } /** @@ -268,15 +269,15 @@ public class SR extends XenAPIObject { * @return references to objects with matching names */ public static Set getByNameLabel(Connection c, String label) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.get_by_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfSR(result); + return Types.toSetOfSR(result); } /** @@ -285,15 +286,15 @@ public class SR extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -302,15 +303,15 @@ public class SR extends XenAPIObject { * @return value of the field */ public String getNameLabel(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.get_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -319,15 +320,15 @@ public class SR extends XenAPIObject { * @return value of the field */ public String getNameDescription(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.get_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -336,15 +337,15 @@ public class SR extends XenAPIObject { * @return value of the field */ public Set getAllowedOperations(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.get_allowed_operations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfStorageOperations(result); + return Types.toSetOfStorageOperations(result); } /** @@ -353,15 +354,15 @@ public class SR extends XenAPIObject { * @return value of the field */ public Map getCurrentOperations(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.get_current_operations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringStorageOperations(result); + return Types.toMapOfStringStorageOperations(result); } /** @@ -370,15 +371,15 @@ public class SR extends XenAPIObject { * @return value of the field */ public Set getVDIs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.get_VDIs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVDI(result); + return Types.toSetOfVDI(result); } /** @@ -387,15 +388,15 @@ public class SR extends XenAPIObject { * @return value of the field */ public Set getPBDs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.get_PBDs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfPBD(result); + return Types.toSetOfPBD(result); } /** @@ -404,15 +405,15 @@ public class SR extends XenAPIObject { * @return value of the field */ public Long getVirtualAllocation(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.get_virtual_allocation"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -421,15 +422,15 @@ public class SR extends XenAPIObject { * @return value of the field */ public Long getPhysicalUtilisation(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.get_physical_utilisation"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -438,15 +439,15 @@ public class SR extends XenAPIObject { * @return value of the field */ public Long getPhysicalSize(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.get_physical_size"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -455,15 +456,15 @@ public class SR extends XenAPIObject { * @return value of the field */ public String getType(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.get_type"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -472,15 +473,15 @@ public class SR extends XenAPIObject { * @return value of the field */ public String getContentType(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.get_content_type"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -489,15 +490,15 @@ public class SR extends XenAPIObject { * @return value of the field */ public Boolean getShared(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.get_shared"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -506,15 +507,15 @@ public class SR extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -523,15 +524,15 @@ public class SR extends XenAPIObject { * @return value of the field */ public Set getTags(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.get_tags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -540,15 +541,15 @@ public class SR extends XenAPIObject { * @return value of the field */ public Map getSmConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.get_sm_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -557,15 +558,15 @@ public class SR extends XenAPIObject { * @return value of the field */ public Map getBlobs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.get_blobs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringBlob(result); + return Types.toMapOfStringBlob(result); } /** @@ -574,15 +575,15 @@ public class SR extends XenAPIObject { * @return value of the field */ public Boolean getLocalCacheEnabled(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.get_local_cache_enabled"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -591,15 +592,15 @@ public class SR extends XenAPIObject { * @return value of the field */ public DRTask getIntroducedBy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.get_introduced_by"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDRTask(result); + return Types.toDRTask(result); } /** @@ -608,9 +609,9 @@ public class SR extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -625,9 +626,9 @@ public class SR extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -641,9 +642,9 @@ public class SR extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -657,9 +658,9 @@ public class SR extends XenAPIObject { * @param tags New value to set */ public void setTags(Connection c, Set tags) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.set_tags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(tags)}; @@ -673,9 +674,9 @@ public class SR extends XenAPIObject { * @param value New value to add */ public void addTags(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.add_tags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -689,9 +690,9 @@ public class SR extends XenAPIObject { * @param value Value to remove */ public void removeTags(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.remove_tags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -705,9 +706,9 @@ public class SR extends XenAPIObject { * @param smConfig New value to set */ public void setSmConfig(Connection c, Map smConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.set_sm_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(smConfig)}; @@ -722,9 +723,9 @@ public class SR extends XenAPIObject { * @param value Value to add */ public void addToSmConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.add_to_sm_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -738,9 +739,9 @@ public class SR extends XenAPIObject { * @param key Key to remove */ public void removeFromSmConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.remove_from_sm_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -762,52 +763,14 @@ public class SR extends XenAPIObject { * @param smConfig Storage backend specific configuration options * @return Task */ - public static Task createAsync(Connection c, Host host, Map deviceConfig, Long physicalSize, String nameLabel, String nameDescription, String type, - String contentType, Boolean shared, Map smConfig) throws - BadServerResponse, - VersionException, - XenAPIException, - XmlRpcException, - Types.SrUnknownDriver { - - if (c.rioConnection) { - if (smConfig.isEmpty()) { - return rioCreateAsync(c, host, deviceConfig, physicalSize, nameLabel, nameDescription, type, contentType, shared); - } else { - throw new Types.VersionException("smConfig parameter must be empty map for Rio (legacy XenServer) host"); - } - } else { - return miamiCreateAsync(c, host, deviceConfig, physicalSize, nameLabel, nameDescription, type, contentType, shared, smConfig); - } - } - - private static Task rioCreateAsync(Connection c, Host host, Map deviceConfig, Long physicalSize, String nameLabel, String nameDescription, - String type, String contentType, Boolean shared) throws - BadServerResponse, - XmlRpcException, - XenAPIException, - Types.SrUnknownDriver { + public static Task createAsync(Connection c, Host host, Map deviceConfig, Long physicalSize, String nameLabel, String nameDescription, String type, String contentType, Boolean shared, Map smConfig) throws + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.SrUnknownDriver { String method_call = "Async.SR.create"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(deviceConfig), Marshalling.toXMLRPC(physicalSize), - Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(contentType), - Marshalling.toXMLRPC(shared)}; - Map response = c.dispatch(method_call, method_params); - Object result = response.get("Value"); - return Types.toTask(result); - } - - private static Task miamiCreateAsync(Connection c, Host host, Map deviceConfig, Long physicalSize, String nameLabel, String nameDescription, - String type, String contentType, Boolean shared, Map smConfig) throws - BadServerResponse, - XmlRpcException, - XenAPIException, - Types.SrUnknownDriver { - String method_call = "Async.SR.create"; - String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(deviceConfig), Marshalling.toXMLRPC(physicalSize), - Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(contentType), - Marshalling.toXMLRPC(shared), Marshalling.toXMLRPC(smConfig)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(deviceConfig), Marshalling.toXMLRPC(physicalSize), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(contentType), Marshalling.toXMLRPC(shared), Marshalling.toXMLRPC(smConfig)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -827,55 +790,17 @@ public class SR extends XenAPIObject { * @param smConfig Storage backend specific configuration options * @return The reference of the newly created Storage Repository. */ - public static SR create(Connection c, Host host, Map deviceConfig, Long physicalSize, String nameLabel, String nameDescription, String type, - String contentType, Boolean shared, Map smConfig) throws - BadServerResponse, - VersionException, - XenAPIException, - XmlRpcException, - Types.SrUnknownDriver { - - if (c.rioConnection) { - if (smConfig.isEmpty()) { - return rioCreate(c, host, deviceConfig, physicalSize, nameLabel, nameDescription, type, contentType, shared); - } else { - throw new Types.VersionException("smConfig parameter must be empty map for Rio (legacy XenServer) host"); - } - } else { - return miamiCreate(c, host, deviceConfig, physicalSize, nameLabel, nameDescription, type, contentType, shared, smConfig); - } - } - - private static SR rioCreate(Connection c, Host host, Map deviceConfig, Long physicalSize, String nameLabel, String nameDescription, String type, - String contentType, Boolean shared) throws - BadServerResponse, - XmlRpcException, - XenAPIException, - Types.SrUnknownDriver { + public static SR create(Connection c, Host host, Map deviceConfig, Long physicalSize, String nameLabel, String nameDescription, String type, String contentType, Boolean shared, Map smConfig) throws + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.SrUnknownDriver { String method_call = "SR.create"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(deviceConfig), Marshalling.toXMLRPC(physicalSize), - Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(contentType), - Marshalling.toXMLRPC(shared)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(deviceConfig), Marshalling.toXMLRPC(physicalSize), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(contentType), Marshalling.toXMLRPC(shared), Marshalling.toXMLRPC(smConfig)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSR(result); - } - - private static SR miamiCreate(Connection c, Host host, Map deviceConfig, Long physicalSize, String nameLabel, String nameDescription, String type, - String contentType, Boolean shared, Map smConfig) throws - BadServerResponse, - XmlRpcException, - XenAPIException, - Types.SrUnknownDriver { - String method_call = "SR.create"; - String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(deviceConfig), Marshalling.toXMLRPC(physicalSize), - Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(contentType), - Marshalling.toXMLRPC(shared), Marshalling.toXMLRPC(smConfig)}; - Map response = c.dispatch(method_call, method_params); - Object result = response.get("Value"); - return Types.toSR(result); + return Types.toSR(result); } /** @@ -890,46 +815,13 @@ public class SR extends XenAPIObject { * @param smConfig Storage backend specific configuration options * @return Task */ - public static Task introduceAsync(Connection c, String uuid, String nameLabel, String nameDescription, String type, String contentType, Boolean shared, - Map smConfig) throws - BadServerResponse, - VersionException, - XenAPIException, - XmlRpcException { - - if (c.rioConnection) { - if (smConfig.isEmpty()) { - return rioIntroduceAsync(c, uuid, nameLabel, nameDescription, type, contentType, shared); - } else { - throw new Types.VersionException("smConfig parameter must be empty map for Rio (legacy XenServer) host"); - } - } else { - return miamiIntroduceAsync(c, uuid, nameLabel, nameDescription, type, contentType, shared, smConfig); - } - } - - private static Task rioIntroduceAsync(Connection c, String uuid, String nameLabel, String nameDescription, String type, String contentType, Boolean shared) throws - BadServerResponse, - XmlRpcException, - XenAPIException { + public static Task introduceAsync(Connection c, String uuid, String nameLabel, String nameDescription, String type, String contentType, Boolean shared, Map smConfig) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.SR.introduce"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), - Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(contentType), Marshalling.toXMLRPC(shared)}; - Map response = c.dispatch(method_call, method_params); - Object result = response.get("Value"); - return Types.toTask(result); - } - - private static Task miamiIntroduceAsync(Connection c, String uuid, String nameLabel, String nameDescription, String type, String contentType, Boolean shared, - Map smConfig) throws - BadServerResponse, - XmlRpcException, - XenAPIException { - String method_call = "Async.SR.introduce"; - String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), - Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(contentType), Marshalling.toXMLRPC(shared), Marshalling.toXMLRPC(smConfig)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(contentType), Marshalling.toXMLRPC(shared), Marshalling.toXMLRPC(smConfig)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -947,49 +839,16 @@ public class SR extends XenAPIObject { * @param smConfig Storage backend specific configuration options * @return The reference of the newly introduced Storage Repository. */ - public static SR introduce(Connection c, String uuid, String nameLabel, String nameDescription, String type, String contentType, Boolean shared, - Map smConfig) throws - BadServerResponse, - VersionException, - XenAPIException, - XmlRpcException { - - if (c.rioConnection) { - if (smConfig.isEmpty()) { - return rioIntroduce(c, uuid, nameLabel, nameDescription, type, contentType, shared); - } else { - throw new Types.VersionException("smConfig parameter must be empty map for Rio (legacy XenServer) host"); - } - } else { - return miamiIntroduce(c, uuid, nameLabel, nameDescription, type, contentType, shared, smConfig); - } - } - - private static SR rioIntroduce(Connection c, String uuid, String nameLabel, String nameDescription, String type, String contentType, Boolean shared) throws - BadServerResponse, - XmlRpcException, - XenAPIException { + public static SR introduce(Connection c, String uuid, String nameLabel, String nameDescription, String type, String contentType, Boolean shared, Map smConfig) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.introduce"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), - Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(contentType), Marshalling.toXMLRPC(shared)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(contentType), Marshalling.toXMLRPC(shared), Marshalling.toXMLRPC(smConfig)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSR(result); - } - - private static SR miamiIntroduce(Connection c, String uuid, String nameLabel, String nameDescription, String type, String contentType, Boolean shared, - Map smConfig) throws - BadServerResponse, - XmlRpcException, - XenAPIException { - String method_call = "SR.introduce"; - String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), - Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(contentType), Marshalling.toXMLRPC(shared), Marshalling.toXMLRPC(smConfig)}; - Map response = c.dispatch(method_call, method_params); - Object result = response.get("Value"); - return Types.toSR(result); + return Types.toSR(result); } /** @@ -1006,51 +865,13 @@ public class SR extends XenAPIObject { * @param smConfig Storage backend specific configuration options * @return Task */ - @Deprecated - public static Task makeAsync(Connection c, Host host, Map deviceConfig, Long physicalSize, String nameLabel, String nameDescription, String type, - String contentType, Map smConfig) throws - BadServerResponse, - VersionException, - XenAPIException, - XmlRpcException { - - if (c.rioConnection) { - if (smConfig.isEmpty()) { - return rioMakeAsync(c, host, deviceConfig, physicalSize, nameLabel, nameDescription, type, contentType); - } else { - throw new Types.VersionException("smConfig parameter must be empty map for Rio (legacy XenServer) host"); - } - } else { - return miamiMakeAsync(c, host, deviceConfig, physicalSize, nameLabel, nameDescription, type, contentType, smConfig); - } - } - - @Deprecated - private static Task rioMakeAsync(Connection c, Host host, Map deviceConfig, Long physicalSize, String nameLabel, String nameDescription, String type, - String contentType) throws - BadServerResponse, - XmlRpcException, - XenAPIException { + @Deprecated public static Task makeAsync(Connection c, Host host, Map deviceConfig, Long physicalSize, String nameLabel, String nameDescription, String type, String contentType, Map smConfig) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.SR.make"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(deviceConfig), Marshalling.toXMLRPC(physicalSize), - Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(contentType)}; - Map response = c.dispatch(method_call, method_params); - Object result = response.get("Value"); - return Types.toTask(result); - } - - @Deprecated - private static Task miamiMakeAsync(Connection c, Host host, Map deviceConfig, Long physicalSize, String nameLabel, String nameDescription, - String type, String contentType, Map smConfig) throws - BadServerResponse, - XmlRpcException, - XenAPIException { - String method_call = "Async.SR.make"; - String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(deviceConfig), Marshalling.toXMLRPC(physicalSize), - Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(contentType), - Marshalling.toXMLRPC(smConfig)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(deviceConfig), Marshalling.toXMLRPC(physicalSize), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(contentType), Marshalling.toXMLRPC(smConfig)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -1070,54 +891,16 @@ public class SR extends XenAPIObject { * @param smConfig Storage backend specific configuration options * @return The uuid of the newly created Storage Repository. */ - @Deprecated - public static String make(Connection c, Host host, Map deviceConfig, Long physicalSize, String nameLabel, String nameDescription, String type, - String contentType, Map smConfig) throws - BadServerResponse, - VersionException, - XenAPIException, - XmlRpcException { - - if (c.rioConnection) { - if (smConfig.isEmpty()) { - return rioMake(c, host, deviceConfig, physicalSize, nameLabel, nameDescription, type, contentType); - } else { - throw new Types.VersionException("smConfig parameter must be empty map for Rio (legacy XenServer) host"); - } - } else { - return miamiMake(c, host, deviceConfig, physicalSize, nameLabel, nameDescription, type, contentType, smConfig); - } - } - - @Deprecated - private static String rioMake(Connection c, Host host, Map deviceConfig, Long physicalSize, String nameLabel, String nameDescription, String type, - String contentType) throws - BadServerResponse, - XmlRpcException, - XenAPIException { + @Deprecated public static String make(Connection c, Host host, Map deviceConfig, Long physicalSize, String nameLabel, String nameDescription, String type, String contentType, Map smConfig) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.make"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(deviceConfig), Marshalling.toXMLRPC(physicalSize), - Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(contentType)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(deviceConfig), Marshalling.toXMLRPC(physicalSize), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(contentType), Marshalling.toXMLRPC(smConfig)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); - } - - @Deprecated - private static String miamiMake(Connection c, Host host, Map deviceConfig, Long physicalSize, String nameLabel, String nameDescription, String type, - String contentType, Map smConfig) throws - BadServerResponse, - XmlRpcException, - XenAPIException { - String method_call = "SR.make"; - String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(deviceConfig), Marshalling.toXMLRPC(physicalSize), - Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(contentType), - Marshalling.toXMLRPC(smConfig)}; - Map response = c.dispatch(method_call, method_params); - Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -1126,10 +909,10 @@ public class SR extends XenAPIObject { * @return Task */ public Task destroyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.SrHasPbd { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.SrHasPbd { String method_call = "Async.SR.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1143,10 +926,10 @@ public class SR extends XenAPIObject { * */ public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.SrHasPbd { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.SrHasPbd { String method_call = "SR.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1160,10 +943,10 @@ public class SR extends XenAPIObject { * @return Task */ public Task forgetAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.SrHasPbd { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.SrHasPbd { String method_call = "Async.SR.forget"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1177,10 +960,10 @@ public class SR extends XenAPIObject { * */ public void forget(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.SrHasPbd { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.SrHasPbd { String method_call = "SR.forget"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1194,9 +977,9 @@ public class SR extends XenAPIObject { * @return Task */ public Task updateAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.SR.update"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1210,9 +993,9 @@ public class SR extends XenAPIObject { * */ public void update(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.update"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1226,15 +1009,15 @@ public class SR extends XenAPIObject { * @return the supported SR types */ public static Set getSupportedTypes(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.get_supported_types"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -1243,9 +1026,9 @@ public class SR extends XenAPIObject { * @return Task */ public Task scanAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.SR.scan"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1259,9 +1042,9 @@ public class SR extends XenAPIObject { * */ public void scan(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.scan"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1279,13 +1062,12 @@ public class SR extends XenAPIObject { * @return Task */ public static Task probeAsync(Connection c, Host host, Map deviceConfig, String type, Map smConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.SR.probe"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(deviceConfig), Marshalling.toXMLRPC(type), - Marshalling.toXMLRPC(smConfig)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(deviceConfig), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(smConfig)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -1301,16 +1083,15 @@ public class SR extends XenAPIObject { * @return An XML fragment containing the scan results. These are specific to the scan being performed, and the backend. */ public static String probe(Connection c, Host host, Map deviceConfig, String type, Map smConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.probe"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(deviceConfig), Marshalling.toXMLRPC(type), - Marshalling.toXMLRPC(smConfig)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(deviceConfig), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(smConfig)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -1320,9 +1101,9 @@ public class SR extends XenAPIObject { * @return Task */ public Task setSharedAsync(Connection c, Boolean value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.SR.set_shared"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1337,9 +1118,9 @@ public class SR extends XenAPIObject { * @param value True if the SR is shared */ public void setShared(Connection c, Boolean value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.set_shared"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1354,9 +1135,9 @@ public class SR extends XenAPIObject { * @return Task */ public Task setNameLabelAsync(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.SR.set_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1371,9 +1152,9 @@ public class SR extends XenAPIObject { * @param value The name label for the SR */ public void setNameLabel(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.set_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1388,9 +1169,9 @@ public class SR extends XenAPIObject { * @return Task */ public Task setNameDescriptionAsync(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.SR.set_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1405,9 +1186,9 @@ public class SR extends XenAPIObject { * @param value The name description for the SR */ public void setNameDescription(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.set_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1424,13 +1205,12 @@ public class SR extends XenAPIObject { * @return Task */ public Task createNewBlobAsync(Connection c, String name, String mimeType, Boolean _public) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.SR.create_new_blob"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), - Marshalling.toXMLRPC(_public)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), Marshalling.toXMLRPC(_public)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -1445,16 +1225,15 @@ public class SR extends XenAPIObject { * @return The reference of the blob, needed for populating its data */ public Blob createNewBlob(Connection c, String name, String mimeType, Boolean _public) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.create_new_blob"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), - Marshalling.toXMLRPC(_public)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), Marshalling.toXMLRPC(_public)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBlob(result); + return Types.toBlob(result); } /** @@ -1463,9 +1242,9 @@ public class SR extends XenAPIObject { * @param value The new value of the SR's physical_size */ public void setPhysicalSize(Connection c, Long value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.set_physical_size"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1479,9 +1258,9 @@ public class SR extends XenAPIObject { * @param value The new value of the SR's virtual_allocation */ public void setVirtualAllocation(Connection c, Long value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.set_virtual_allocation"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1495,9 +1274,9 @@ public class SR extends XenAPIObject { * @param value The new value of the SR's physical utilisation */ public void setPhysicalUtilisation(Connection c, Long value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.set_physical_utilisation"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1511,9 +1290,9 @@ public class SR extends XenAPIObject { * @return Task */ public Task assertCanHostHaStatefileAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.SR.assert_can_host_ha_statefile"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1527,9 +1306,9 @@ public class SR extends XenAPIObject { * */ public void assertCanHostHaStatefile(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.assert_can_host_ha_statefile"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1543,9 +1322,9 @@ public class SR extends XenAPIObject { * @return Task */ public Task assertSupportsDatabaseReplicationAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.SR.assert_supports_database_replication"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1559,9 +1338,9 @@ public class SR extends XenAPIObject { * */ public void assertSupportsDatabaseReplication(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.assert_supports_database_replication"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1570,14 +1349,14 @@ public class SR extends XenAPIObject { } /** - * + * * * @return Task */ public Task enableDatabaseReplicationAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.SR.enable_database_replication"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1587,13 +1366,13 @@ public class SR extends XenAPIObject { } /** - * + * * */ public void enableDatabaseReplication(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.enable_database_replication"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1602,14 +1381,14 @@ public class SR extends XenAPIObject { } /** - * + * * * @return Task */ public Task disableDatabaseReplicationAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.SR.disable_database_replication"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1619,13 +1398,13 @@ public class SR extends XenAPIObject { } /** - * + * * */ public void disableDatabaseReplication(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.disable_database_replication"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1639,15 +1418,15 @@ public class SR extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfSR(result); + return Types.toSetOfSR(result); } /** @@ -1656,15 +1435,15 @@ public class SR extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "SR.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfSRSRRecord(result); + return Types.toMapOfSRSRRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/Secret.java b/deps/XenServerJava/src/com/xensource/xenapi/Secret.java index 870725fda50..418bb883645 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/Secret.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/Secret.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class Secret extends XenAPIObject { * For internal use only. */ Secret(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class Secret extends XenAPIObject { { if (obj != null && obj instanceof Secret) { - Secret other = (Secret)obj; + Secret other = (Secret) obj; return other.ref.equals(this.ref); } else { @@ -108,8 +109,8 @@ public class Secret extends XenAPIObject { /** * Convert a secret.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("value", this.value == null ? "" : this.value); map.put("other_config", this.otherConfig == null ? new HashMap() : this.otherConfig); @@ -136,15 +137,15 @@ public class Secret extends XenAPIObject { * @return all fields from the object */ public Secret.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "secret.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSecretRecord(result); + return Types.toSecretRecord(result); } /** @@ -154,15 +155,15 @@ public class Secret extends XenAPIObject { * @return reference to the object */ public static Secret getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "secret.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSecret(result); + return Types.toSecret(result); } /** @@ -172,9 +173,9 @@ public class Secret extends XenAPIObject { * @return Task */ public static Task createAsync(Connection c, Secret.Record record) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.secret.create"; String session = c.getSessionReference(); Map record_map = record.toMap(); @@ -191,16 +192,16 @@ public class Secret extends XenAPIObject { * @return reference to the newly created object */ public static Secret create(Connection c, Secret.Record record) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "secret.create"; String session = c.getSessionReference(); Map record_map = record.toMap(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSecret(result); + return Types.toSecret(result); } /** @@ -209,9 +210,9 @@ public class Secret extends XenAPIObject { * @return Task */ public Task destroyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.secret.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -225,9 +226,9 @@ public class Secret extends XenAPIObject { * */ public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "secret.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -241,15 +242,15 @@ public class Secret extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "secret.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -258,15 +259,15 @@ public class Secret extends XenAPIObject { * @return value of the field */ public String getValue(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "secret.get_value"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -275,15 +276,15 @@ public class Secret extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "secret.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -292,9 +293,9 @@ public class Secret extends XenAPIObject { * @param value New value to set */ public void setValue(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "secret.set_value"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -308,9 +309,9 @@ public class Secret extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "secret.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -325,9 +326,9 @@ public class Secret extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "secret.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -341,9 +342,9 @@ public class Secret extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "secret.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -357,15 +358,15 @@ public class Secret extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "secret.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfSecret(result); + return Types.toSetOfSecret(result); } /** @@ -374,15 +375,15 @@ public class Secret extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "secret.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfSecretSecretRecord(result); + return Types.toMapOfSecretSecretRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/Session.java b/deps/XenServerJava/src/com/xensource/xenapi/Session.java index bdf3b4cf80b..a00ab7dcfce 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/Session.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/Session.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class Session extends XenAPIObject { * For internal use only. */ Session(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class Session extends XenAPIObject { { if (obj != null && obj instanceof Session) { - Session other = (Session)obj; + Session other = (Session) obj; return other.ref.equals(this.ref); } else { @@ -119,8 +120,8 @@ public class Session extends XenAPIObject { /** * Convert a session.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("this_host", this.thisHost == null ? new Host("OpaqueRef:NULL") : this.thisHost); map.put("this_user", this.thisUser == null ? new User("OpaqueRef:NULL") : this.thisUser); @@ -202,15 +203,15 @@ public class Session extends XenAPIObject { * @return all fields from the object */ public Session.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "session.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSessionRecord(result); + return Types.toSessionRecord(result); } /** @@ -220,15 +221,15 @@ public class Session extends XenAPIObject { * @return reference to the object */ public static Session getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "session.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSession(result); + return Types.toSession(result); } /** @@ -237,15 +238,15 @@ public class Session extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "session.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -254,15 +255,15 @@ public class Session extends XenAPIObject { * @return value of the field */ public Host getThisHost(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "session.get_this_host"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toHost(result); + return Types.toHost(result); } /** @@ -271,15 +272,15 @@ public class Session extends XenAPIObject { * @return value of the field */ public User getThisUser(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "session.get_this_user"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toUser(result); + return Types.toUser(result); } /** @@ -288,15 +289,15 @@ public class Session extends XenAPIObject { * @return value of the field */ public Date getLastActive(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "session.get_last_active"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDate(result); + return Types.toDate(result); } /** @@ -305,15 +306,15 @@ public class Session extends XenAPIObject { * @return value of the field */ public Boolean getPool(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "session.get_pool"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -322,15 +323,15 @@ public class Session extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "session.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -339,15 +340,15 @@ public class Session extends XenAPIObject { * @return value of the field */ public Boolean getIsLocalSuperuser(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "session.get_is_local_superuser"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -356,15 +357,15 @@ public class Session extends XenAPIObject { * @return value of the field */ public Subject getSubject(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "session.get_subject"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSubject(result); + return Types.toSubject(result); } /** @@ -373,15 +374,15 @@ public class Session extends XenAPIObject { * @return value of the field */ public Date getValidationTime(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "session.get_validation_time"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDate(result); + return Types.toDate(result); } /** @@ -390,15 +391,15 @@ public class Session extends XenAPIObject { * @return value of the field */ public String getAuthUserSid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "session.get_auth_user_sid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -407,15 +408,15 @@ public class Session extends XenAPIObject { * @return value of the field */ public String getAuthUserName(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "session.get_auth_user_name"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -424,15 +425,15 @@ public class Session extends XenAPIObject { * @return value of the field */ public Set getRbacPermissions(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "session.get_rbac_permissions"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -441,15 +442,15 @@ public class Session extends XenAPIObject { * @return value of the field */ public Set getTasks(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "session.get_tasks"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfTask(result); + return Types.toSetOfTask(result); } /** @@ -458,15 +459,15 @@ public class Session extends XenAPIObject { * @return value of the field */ public Session getParent(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "session.get_parent"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSession(result); + return Types.toSession(result); } /** @@ -475,9 +476,9 @@ public class Session extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "session.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -492,9 +493,9 @@ public class Session extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "session.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -508,9 +509,9 @@ public class Session extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "session.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -527,15 +528,15 @@ public class Session extends XenAPIObject { * @return reference of newly created session */ public static Session loginWithPassword(Connection c, String uname, String pwd, String version) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.SessionAuthenticationFailed { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.SessionAuthenticationFailed { String method_call = "session.login_with_password"; Object[] method_params = {Marshalling.toXMLRPC(uname), Marshalling.toXMLRPC(pwd), Marshalling.toXMLRPC(version)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSession(result); + return Types.toSession(result); } /** @@ -543,9 +544,9 @@ public class Session extends XenAPIObject { * */ public static void logout(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "session.logout"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; @@ -560,9 +561,9 @@ public class Session extends XenAPIObject { * @param newPwd New password for account */ public static void changePassword(Connection c, String oldPwd, String newPwd) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "session.change_password"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(oldPwd), Marshalling.toXMLRPC(newPwd)}; @@ -578,14 +579,14 @@ public class Session extends XenAPIObject { * @return ID of newly created session */ public static Session slaveLocalLoginWithPassword(Connection c, String uname, String pwd) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "session.slave_local_login_with_password"; Object[] method_params = {Marshalling.toXMLRPC(uname), Marshalling.toXMLRPC(pwd)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSession(result); + return Types.toSession(result); } /** @@ -593,9 +594,9 @@ public class Session extends XenAPIObject { * */ public static void localLogout(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "session.local_logout"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; @@ -609,9 +610,9 @@ public class Session extends XenAPIObject { * @return Task */ public static Task getAllSubjectIdentifiersAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.session.get_all_subject_identifiers"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; @@ -626,15 +627,15 @@ public class Session extends XenAPIObject { * @return The list of user subject-identifiers of all existing sessions */ public static Set getAllSubjectIdentifiers(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "session.get_all_subject_identifiers"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -644,9 +645,9 @@ public class Session extends XenAPIObject { * @return Task */ public static Task logoutSubjectIdentifierAsync(Connection c, String subjectIdentifier) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.session.logout_subject_identifier"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(subjectIdentifier)}; @@ -661,9 +662,9 @@ public class Session extends XenAPIObject { * @param subjectIdentifier User subject-identifier of the sessions to be destroyed */ public static void logoutSubjectIdentifier(Connection c, String subjectIdentifier) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "session.logout_subject_identifier"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(subjectIdentifier)}; diff --git a/deps/XenServerJava/src/com/xensource/xenapi/Subject.java b/deps/XenServerJava/src/com/xensource/xenapi/Subject.java index a599f237be9..9a8fbfbd895 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/Subject.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/Subject.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class Subject extends XenAPIObject { * For internal use only. */ Subject(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class Subject extends XenAPIObject { { if (obj != null && obj instanceof Subject) { - Subject other = (Subject)obj; + Subject other = (Subject) obj; return other.ref.equals(this.ref); } else { @@ -109,8 +110,8 @@ public class Subject extends XenAPIObject { /** * Convert a subject.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("subject_identifier", this.subjectIdentifier == null ? "" : this.subjectIdentifier); map.put("other_config", this.otherConfig == null ? new HashMap() : this.otherConfig); @@ -142,15 +143,15 @@ public class Subject extends XenAPIObject { * @return all fields from the object */ public Subject.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "subject.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSubjectRecord(result); + return Types.toSubjectRecord(result); } /** @@ -160,15 +161,15 @@ public class Subject extends XenAPIObject { * @return reference to the object */ public static Subject getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "subject.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSubject(result); + return Types.toSubject(result); } /** @@ -178,9 +179,9 @@ public class Subject extends XenAPIObject { * @return Task */ public static Task createAsync(Connection c, Subject.Record record) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.subject.create"; String session = c.getSessionReference(); Map record_map = record.toMap(); @@ -197,16 +198,16 @@ public class Subject extends XenAPIObject { * @return reference to the newly created object */ public static Subject create(Connection c, Subject.Record record) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "subject.create"; String session = c.getSessionReference(); Map record_map = record.toMap(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSubject(result); + return Types.toSubject(result); } /** @@ -215,9 +216,9 @@ public class Subject extends XenAPIObject { * @return Task */ public Task destroyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.subject.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -231,9 +232,9 @@ public class Subject extends XenAPIObject { * */ public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "subject.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -247,15 +248,15 @@ public class Subject extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "subject.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -264,15 +265,15 @@ public class Subject extends XenAPIObject { * @return value of the field */ public String getSubjectIdentifier(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "subject.get_subject_identifier"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -281,15 +282,15 @@ public class Subject extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "subject.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -298,15 +299,15 @@ public class Subject extends XenAPIObject { * @return value of the field */ public Set getRoles(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "subject.get_roles"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfRole(result); + return Types.toSetOfRole(result); } /** @@ -315,9 +316,9 @@ public class Subject extends XenAPIObject { * @param role The unique role reference */ public void addToRoles(Connection c, Role role) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "subject.add_to_roles"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(role)}; @@ -331,9 +332,9 @@ public class Subject extends XenAPIObject { * @param role The unique role reference in the subject's roles field */ public void removeFromRoles(Connection c, Role role) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "subject.remove_from_roles"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(role)}; @@ -347,15 +348,15 @@ public class Subject extends XenAPIObject { * @return a list of permission names */ public Set getPermissionsNameLabel(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "subject.get_permissions_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -364,15 +365,15 @@ public class Subject extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "subject.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfSubject(result); + return Types.toSetOfSubject(result); } /** @@ -381,15 +382,15 @@ public class Subject extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "subject.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfSubjectSubjectRecord(result); + return Types.toMapOfSubjectSubjectRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/Task.java b/deps/XenServerJava/src/com/xensource/xenapi/Task.java index 59d59f6131b..4a85dfedf60 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/Task.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/Task.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class Task extends XenAPIObject { * For internal use only. */ Task(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class Task extends XenAPIObject { { if (obj != null && obj instanceof Task) { - Task other = (Task)obj; + Task other = (Task) obj; return other.ref.equals(this.ref); } else { @@ -121,8 +122,8 @@ public class Task extends XenAPIObject { /** * Convert a task.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("name_label", this.nameLabel == null ? "" : this.nameLabel); map.put("name_description", this.nameDescription == null ? "" : this.nameDescription); @@ -214,15 +215,15 @@ public class Task extends XenAPIObject { * @return all fields from the object */ public Task.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "task.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toTaskRecord(result); + return Types.toTaskRecord(result); } /** @@ -232,15 +233,15 @@ public class Task extends XenAPIObject { * @return reference to the object */ public static Task getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "task.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toTask(result); + return Types.toTask(result); } /** @@ -250,15 +251,15 @@ public class Task extends XenAPIObject { * @return references to objects with matching names */ public static Set getByNameLabel(Connection c, String label) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "task.get_by_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfTask(result); + return Types.toSetOfTask(result); } /** @@ -267,15 +268,15 @@ public class Task extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "task.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -284,15 +285,15 @@ public class Task extends XenAPIObject { * @return value of the field */ public String getNameLabel(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "task.get_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -301,15 +302,15 @@ public class Task extends XenAPIObject { * @return value of the field */ public String getNameDescription(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "task.get_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -318,15 +319,15 @@ public class Task extends XenAPIObject { * @return value of the field */ public Set getAllowedOperations(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "task.get_allowed_operations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfTaskAllowedOperations(result); + return Types.toSetOfTaskAllowedOperations(result); } /** @@ -335,15 +336,15 @@ public class Task extends XenAPIObject { * @return value of the field */ public Map getCurrentOperations(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "task.get_current_operations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringTaskAllowedOperations(result); + return Types.toMapOfStringTaskAllowedOperations(result); } /** @@ -352,15 +353,15 @@ public class Task extends XenAPIObject { * @return value of the field */ public Date getCreated(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "task.get_created"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDate(result); + return Types.toDate(result); } /** @@ -369,15 +370,15 @@ public class Task extends XenAPIObject { * @return value of the field */ public Date getFinished(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "task.get_finished"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDate(result); + return Types.toDate(result); } /** @@ -386,15 +387,15 @@ public class Task extends XenAPIObject { * @return value of the field */ public Types.TaskStatusType getStatus(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "task.get_status"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toTaskStatusType(result); + return Types.toTaskStatusType(result); } /** @@ -403,15 +404,15 @@ public class Task extends XenAPIObject { * @return value of the field */ public Host getResidentOn(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "task.get_resident_on"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toHost(result); + return Types.toHost(result); } /** @@ -420,15 +421,15 @@ public class Task extends XenAPIObject { * @return value of the field */ public Double getProgress(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "task.get_progress"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDouble(result); + return Types.toDouble(result); } /** @@ -437,15 +438,15 @@ public class Task extends XenAPIObject { * @return value of the field */ public String getType(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "task.get_type"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -454,15 +455,15 @@ public class Task extends XenAPIObject { * @return value of the field */ public String getResult(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "task.get_result"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -471,15 +472,15 @@ public class Task extends XenAPIObject { * @return value of the field */ public Set getErrorInfo(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "task.get_error_info"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -488,15 +489,15 @@ public class Task extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "task.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -505,15 +506,15 @@ public class Task extends XenAPIObject { * @return value of the field */ public Task getSubtaskOf(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "task.get_subtask_of"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toTask(result); + return Types.toTask(result); } /** @@ -522,15 +523,15 @@ public class Task extends XenAPIObject { * @return value of the field */ public Set getSubtasks(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "task.get_subtasks"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfTask(result); + return Types.toSetOfTask(result); } /** @@ -539,9 +540,9 @@ public class Task extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "task.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -556,9 +557,9 @@ public class Task extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "task.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -572,9 +573,9 @@ public class Task extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "task.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -590,15 +591,15 @@ public class Task extends XenAPIObject { * @return The reference of the created task object */ public static Task create(Connection c, String label, String description) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "task.create"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label), Marshalling.toXMLRPC(description)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toTask(result); + return Types.toTask(result); } /** @@ -606,9 +607,9 @@ public class Task extends XenAPIObject { * */ public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "task.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -622,10 +623,10 @@ public class Task extends XenAPIObject { * @return Task */ public Task cancelAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.OperationNotAllowed { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.OperationNotAllowed { String method_call = "Async.task.cancel"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -639,10 +640,10 @@ public class Task extends XenAPIObject { * */ public void cancel(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.OperationNotAllowed { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.OperationNotAllowed { String method_call = "task.cancel"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -656,15 +657,15 @@ public class Task extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "task.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfTask(result); + return Types.toSetOfTask(result); } /** @@ -673,15 +674,15 @@ public class Task extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "task.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfTaskTaskRecord(result); + return Types.toMapOfTaskTaskRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/Tunnel.java b/deps/XenServerJava/src/com/xensource/xenapi/Tunnel.java index 44b236df1b7..e30bd0a9d7e 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/Tunnel.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/Tunnel.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class Tunnel extends XenAPIObject { * For internal use only. */ Tunnel(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class Tunnel extends XenAPIObject { { if (obj != null && obj instanceof Tunnel) { - Tunnel other = (Tunnel)obj; + Tunnel other = (Tunnel) obj; return other.ref.equals(this.ref); } else { @@ -110,8 +111,8 @@ public class Tunnel extends XenAPIObject { /** * Convert a tunnel.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("access_PIF", this.accessPIF == null ? new PIF("OpaqueRef:NULL") : this.accessPIF); map.put("transport_PIF", this.transportPIF == null ? new PIF("OpaqueRef:NULL") : this.transportPIF); @@ -148,15 +149,15 @@ public class Tunnel extends XenAPIObject { * @return all fields from the object */ public Tunnel.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "tunnel.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toTunnelRecord(result); + return Types.toTunnelRecord(result); } /** @@ -166,15 +167,15 @@ public class Tunnel extends XenAPIObject { * @return reference to the object */ public static Tunnel getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "tunnel.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toTunnel(result); + return Types.toTunnel(result); } /** @@ -183,15 +184,15 @@ public class Tunnel extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "tunnel.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -200,15 +201,15 @@ public class Tunnel extends XenAPIObject { * @return value of the field */ public PIF getAccessPIF(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "tunnel.get_access_PIF"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPIF(result); + return Types.toPIF(result); } /** @@ -217,15 +218,15 @@ public class Tunnel extends XenAPIObject { * @return value of the field */ public PIF getTransportPIF(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "tunnel.get_transport_PIF"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPIF(result); + return Types.toPIF(result); } /** @@ -234,15 +235,15 @@ public class Tunnel extends XenAPIObject { * @return value of the field */ public Map getStatus(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "tunnel.get_status"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -251,15 +252,15 @@ public class Tunnel extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "tunnel.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -268,9 +269,9 @@ public class Tunnel extends XenAPIObject { * @param status New value to set */ public void setStatus(Connection c, Map status) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "tunnel.set_status"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(status)}; @@ -285,9 +286,9 @@ public class Tunnel extends XenAPIObject { * @param value Value to add */ public void addToStatus(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "tunnel.add_to_status"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -301,9 +302,9 @@ public class Tunnel extends XenAPIObject { * @param key Key to remove */ public void removeFromStatus(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "tunnel.remove_from_status"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -317,9 +318,9 @@ public class Tunnel extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "tunnel.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -334,9 +335,9 @@ public class Tunnel extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "tunnel.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -350,9 +351,9 @@ public class Tunnel extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "tunnel.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -368,12 +369,12 @@ public class Tunnel extends XenAPIObject { * @return Task */ public static Task createAsync(Connection c, PIF transportPIF, Network network) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.OpenvswitchNotActive, - Types.TransportPifNotConfigured, - Types.IsTunnelAccessPif { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.OpenvswitchNotActive, + Types.TransportPifNotConfigured, + Types.IsTunnelAccessPif { String method_call = "Async.tunnel.create"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(transportPIF), Marshalling.toXMLRPC(network)}; @@ -390,18 +391,18 @@ public class Tunnel extends XenAPIObject { * @return The reference of the created tunnel object */ public static Tunnel create(Connection c, PIF transportPIF, Network network) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.OpenvswitchNotActive, - Types.TransportPifNotConfigured, - Types.IsTunnelAccessPif { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.OpenvswitchNotActive, + Types.TransportPifNotConfigured, + Types.IsTunnelAccessPif { String method_call = "tunnel.create"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(transportPIF), Marshalling.toXMLRPC(network)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toTunnel(result); + return Types.toTunnel(result); } /** @@ -410,9 +411,9 @@ public class Tunnel extends XenAPIObject { * @return Task */ public Task destroyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.tunnel.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -426,9 +427,9 @@ public class Tunnel extends XenAPIObject { * */ public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "tunnel.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -442,15 +443,15 @@ public class Tunnel extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "tunnel.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfTunnel(result); + return Types.toSetOfTunnel(result); } /** @@ -459,15 +460,15 @@ public class Tunnel extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "tunnel.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfTunnelTunnelRecord(result); + return Types.toMapOfTunnelTunnelRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/Types.java b/deps/XenServerJava/src/com/xensource/xenapi/Types.java index 777d580e0b1..50f49a0481f 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/Types.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/Types.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import java.util.Date; @@ -44,7 +45,7 @@ import org.apache.xmlrpc.XmlRpcException; /** * This class holds vital marshalling functions, enum types and exceptions. - * + * * @author Citrix Systems, Inc. */ public class Types @@ -68,7 +69,7 @@ public class Types String[] result = new String[objArray.length]; for (int i = 0; i < objArray.length; i++) { - result[i] = (String)objArray[i]; + result[i] = (String) objArray[i]; } return result; } @@ -118,7 +119,6 @@ public class Types return sb.toString(); } } - /** * Thrown if the response from the server contains an invalid status. */ @@ -126,7 +126,7 @@ public class Types { public BadServerResponse(Map response) { - super(ObjectArrayToStringArray((Object[])response.get("ErrorDescription"))); + super(ObjectArrayToStringArray((Object[]) response.get("ErrorDescription"))); } } @@ -144,9 +144,7 @@ public class Types /* * A call has been made which should not be made against this version of host. * Probably the host is out of date and cannot handle this call, or is - * unable to comply with the details of the call. For instance SR.create - * on Miami (4.1) hosts takes an smConfig parameter, which must be an empty map - * when making this call on Rio (4.0) hosts. + * unable to comply with the details of the call. */ public static class VersionException extends XenAPIException { @@ -172,11 +170,10 @@ public class Types return matcher.group(1); } - - /** - * Checks the provided server response was successful. If the call failed, throws a XenAPIException. If the server - * returned an invalid response, throws a BadServerResponse. Otherwise, returns the server response as passed in. - */ + /** + * Checks the provided server response was successful. If the call failed, throws a XenAPIException. If the server + * returned an invalid response, throws a BadServerResponse. Otherwise, returns the server response as passed in. + */ static Map checkResponse(Map response) throws XenAPIException, BadServerResponse { if (response.get("Status").equals("Success")) @@ -186,384 +183,21 @@ public class Types if (response.get("Status").equals("Failure")) { - String[] ErrorDescription = ObjectArrayToStringArray((Object[])response.get("ErrorDescription")); + String[] ErrorDescription = ObjectArrayToStringArray((Object[]) response.get("ErrorDescription")); - if (ErrorDescription[0].equals("RESTORE_TARGET_MISSING_DEVICE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.RestoreTargetMissingDevice(p1); - } - if (ErrorDescription[0].equals("WLB_TIMEOUT")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.WlbTimeout(p1); - } - if (ErrorDescription[0].equals("MAC_DOES_NOT_EXIST")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.MacDoesNotExist(p1); - } - if (ErrorDescription[0].equals("HANDLE_INVALID")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.HandleInvalid(p1, p2); - } - if (ErrorDescription[0].equals("DEVICE_ALREADY_ATTACHED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.DeviceAlreadyAttached(p1); - } - if (ErrorDescription[0].equals("INVALID_IP_ADDRESS_SPECIFIED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.InvalidIpAddressSpecified(p1); - } - if (ErrorDescription[0].equals("SR_NOT_EMPTY")) - { - throw new Types.SrNotEmpty(); - } - if (ErrorDescription[0].equals("VM_HVM_REQUIRED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VmHvmRequired(p1); - } - if (ErrorDescription[0].equals("GPU_GROUP_CONTAINS_PGPU")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.GpuGroupContainsPgpu(p1); - } - if (ErrorDescription[0].equals("PIF_TUNNEL_STILL_EXISTS")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.PifTunnelStillExists(p1); - } - if (ErrorDescription[0].equals("PIF_BOND_NEEDS_MORE_MEMBERS")) - { - throw new Types.PifBondNeedsMoreMembers(); - } - if (ErrorDescription[0].equals("PIF_ALREADY_BONDED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.PifAlreadyBonded(p1); - } if (ErrorDescription[0].equals("CANNOT_DESTROY_DISASTER_RECOVERY_TASK")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; throw new Types.CannotDestroyDisasterRecoveryTask(p1); } - if (ErrorDescription[0].equals("VLAN_TAG_INVALID")) + if (ErrorDescription[0].equals("IMPORT_ERROR_ATTACHED_DISKS_NOT_FOUND")) + { + throw new Types.ImportErrorAttachedDisksNotFound(); + } + if (ErrorDescription[0].equals("COULD_NOT_IMPORT_DATABASE")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VlanTagInvalid(p1); - } - if (ErrorDescription[0].equals("HOST_IS_SLAVE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.HostIsSlave(p1); - } - if (ErrorDescription[0].equals("SR_HAS_MULTIPLE_PBDS")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.SrHasMultiplePbds(p1); - } - if (ErrorDescription[0].equals("POOL_AUTH_ENABLE_FAILED_INVALID_OU")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.PoolAuthEnableFailedInvalidOu(p1, p2); - } - if (ErrorDescription[0].equals("IMPORT_ERROR_SOME_CHECKSUMS_FAILED")) - { - throw new Types.ImportErrorSomeChecksumsFailed(); - } - if (ErrorDescription[0].equals("OPENVSWITCH_NOT_ACTIVE")) - { - throw new Types.OpenvswitchNotActive(); - } - if (ErrorDescription[0].equals("CANNOT_FIND_OEM_BACKUP_PARTITION")) - { - throw new Types.CannotFindOemBackupPartition(); - } - if (ErrorDescription[0].equals("PIF_DEVICE_NOT_FOUND")) - { - throw new Types.PifDeviceNotFound(); - } - if (ErrorDescription[0].equals("DOMAIN_BUILDER_ERROR")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; - throw new Types.DomainBuilderError(p1, p2, p3); - } - if (ErrorDescription[0].equals("PATCH_PRECHECK_FAILED_VM_RUNNING")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.PatchPrecheckFailedVmRunning(p1); - } - if (ErrorDescription[0].equals("VM_REQUIRES_IOMMU")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VmRequiresIommu(p1); - } - if (ErrorDescription[0].equals("HA_HOST_CANNOT_SEE_PEERS")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; - throw new Types.HaHostCannotSeePeers(p1, p2, p3); - } - if (ErrorDescription[0].equals("POOL_AUTH_DISABLE_FAILED_PERMISSION_DENIED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.PoolAuthDisableFailedPermissionDenied(p1, p2); - } - if (ErrorDescription[0].equals("PERMISSION_DENIED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.PermissionDenied(p1); - } - if (ErrorDescription[0].equals("SSL_VERIFY_ERROR")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.SslVerifyError(p1); - } - if (ErrorDescription[0].equals("SR_ATTACH_FAILED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.SrAttachFailed(p1); - } - if (ErrorDescription[0].equals("SUBJECT_ALREADY_EXISTS")) - { - throw new Types.SubjectAlreadyExists(); - } - if (ErrorDescription[0].equals("HA_LOST_STATEFILE")) - { - throw new Types.HaLostStatefile(); - } - if (ErrorDescription[0].equals("HA_NOT_ENABLED")) - { - throw new Types.HaNotEnabled(); - } - if (ErrorDescription[0].equals("HA_HEARTBEAT_DAEMON_STARTUP_FAILED")) - { - throw new Types.HaHeartbeatDaemonStartupFailed(); - } - if (ErrorDescription[0].equals("SESSION_NOT_REGISTERED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.SessionNotRegistered(p1); - } - if (ErrorDescription[0].equals("VM_NO_SUSPEND_SR")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VmNoSuspendSr(p1); - } - if (ErrorDescription[0].equals("VM_HAS_TOO_MANY_SNAPSHOTS")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VmHasTooManySnapshots(p1); - } - if (ErrorDescription[0].equals("PATCH_APPLY_FAILED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.PatchApplyFailed(p1); - } - if (ErrorDescription[0].equals("VDI_READONLY")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VdiReadonly(p1); - } - if (ErrorDescription[0].equals("SR_FULL")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.SrFull(p1, p2); - } - if (ErrorDescription[0].equals("VM_REQUIRES_GPU")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.VmRequiresGpu(p1, p2); - } - if (ErrorDescription[0].equals("VDI_NOT_AVAILABLE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VdiNotAvailable(p1); - } - if (ErrorDescription[0].equals("XMLRPC_UNMARSHAL_FAILURE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.XmlrpcUnmarshalFailure(p1, p2); - } - if (ErrorDescription[0].equals("CRL_ALREADY_EXISTS")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.CrlAlreadyExists(p1); - } - if (ErrorDescription[0].equals("HOST_MASTER_CANNOT_TALK_BACK")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.HostMasterCannotTalkBack(p1); - } - if (ErrorDescription[0].equals("XAPI_HOOK_FAILED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; - String p4 = ErrorDescription.length > 4 ? ErrorDescription[4] : ""; - throw new Types.XapiHookFailed(p1, p2, p3, p4); - } - if (ErrorDescription[0].equals("IMPORT_INCOMPATIBLE_VERSION")) - { - throw new Types.ImportIncompatibleVersion(); - } - if (ErrorDescription[0].equals("UNKNOWN_BOOTLOADER")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.UnknownBootloader(p1, p2); - } - if (ErrorDescription[0].equals("XEN_VSS_REQ_ERROR_PROV_NOT_LOADED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.XenVssReqErrorProvNotLoaded(p1, p2); - } - if (ErrorDescription[0].equals("FEATURE_REQUIRES_HVM")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.FeatureRequiresHvm(p1); - } - if (ErrorDescription[0].equals("SR_VDI_LOCKING_FAILED")) - { - throw new Types.SrVdiLockingFailed(); - } - if (ErrorDescription[0].equals("PIF_IS_PHYSICAL")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.PifIsPhysical(p1); - } - if (ErrorDescription[0].equals("MAP_DUPLICATE_KEY")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; - String p4 = ErrorDescription.length > 4 ? ErrorDescription[4] : ""; - throw new Types.MapDuplicateKey(p1, p2, p3, p4); - } - if (ErrorDescription[0].equals("MISSING_CONNECTION_DETAILS")) - { - throw new Types.MissingConnectionDetails(); - } - if (ErrorDescription[0].equals("XEN_VSS_REQ_ERROR_CREATING_SNAPSHOT_XML_STRING")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.XenVssReqErrorCreatingSnapshotXmlString(p1, p2); - } - if (ErrorDescription[0].equals("BOOTLOADER_FAILED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.BootloaderFailed(p1, p2); - } - if (ErrorDescription[0].equals("WLB_XENSERVER_MALFORMED_RESPONSE")) - { - throw new Types.WlbXenserverMalformedResponse(); - } - if (ErrorDescription[0].equals("GPU_GROUP_CONTAINS_VGPU")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.GpuGroupContainsVgpu(p1); - } - if (ErrorDescription[0].equals("POOL_AUTH_ENABLE_FAILED_DUPLICATE_HOSTNAME")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.PoolAuthEnableFailedDuplicateHostname(p1, p2); - } - if (ErrorDescription[0].equals("SYSTEM_STATUS_RETRIEVAL_FAILED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.SystemStatusRetrievalFailed(p1); - } - if (ErrorDescription[0].equals("VDI_IN_USE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.VdiInUse(p1, p2); - } - if (ErrorDescription[0].equals("HOST_NOT_LIVE")) - { - throw new Types.HostNotLive(); - } - if (ErrorDescription[0].equals("CERTIFICATE_ALREADY_EXISTS")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.CertificateAlreadyExists(p1); - } - if (ErrorDescription[0].equals("SR_HAS_NO_PBDS")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.SrHasNoPbds(p1); - } - if (ErrorDescription[0].equals("CANNOT_ADD_TUNNEL_TO_BOND_SLAVE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.CannotAddTunnelToBondSlave(p1); - } - if (ErrorDescription[0].equals("INVALID_PATCH")) - { - throw new Types.InvalidPatch(); - } - if (ErrorDescription[0].equals("SR_INDESTRUCTIBLE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.SrIndestructible(p1); - } - if (ErrorDescription[0].equals("HA_ABORT_NEW_MASTER")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.HaAbortNewMaster(p1); - } - if (ErrorDescription[0].equals("WLB_MALFORMED_RESPONSE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; - throw new Types.WlbMalformedResponse(p1, p2, p3); - } - if (ErrorDescription[0].equals("POOL_JOINING_HOST_MUST_HAVE_PHYSICAL_MANAGEMENT_NIC")) - { - throw new Types.PoolJoiningHostMustHavePhysicalManagementNic(); - } - if (ErrorDescription[0].equals("PIF_HAS_NO_V6_NETWORK_CONFIGURATION")) - { - throw new Types.PifHasNoV6NetworkConfiguration(); - } - if (ErrorDescription[0].equals("VM_IS_PART_OF_AN_APPLIANCE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.VmIsPartOfAnAppliance(p1, p2); - } - if (ErrorDescription[0].equals("WLB_XENSERVER_AUTHENTICATION_FAILED")) - { - throw new Types.WlbXenserverAuthenticationFailed(); - } - if (ErrorDescription[0].equals("CANNOT_RESET_CONTROL_DOMAIN")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.CannotResetControlDomain(p1); - } - if (ErrorDescription[0].equals("PATCH_PRECHECK_FAILED_UNKNOWN_ERROR")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.PatchPrecheckFailedUnknownError(p1, p2); + throw new Types.CouldNotImportDatabase(p1); } if (ErrorDescription[0].equals("HOST_CANNOT_ATTACH_NETWORK")) { @@ -571,95 +205,6 @@ public class Types String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; throw new Types.HostCannotAttachNetwork(p1, p2); } - if (ErrorDescription[0].equals("WLB_URL_INVALID")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.WlbUrlInvalid(p1); - } - if (ErrorDescription[0].equals("DUPLICATE_VM")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.DuplicateVm(p1); - } - if (ErrorDescription[0].equals("HOST_CANNOT_DESTROY_SELF")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.HostCannotDestroySelf(p1); - } - if (ErrorDescription[0].equals("HOST_BROKEN")) - { - throw new Types.HostBroken(); - } - if (ErrorDescription[0].equals("VM_CHECKPOINT_RESUME_FAILED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VmCheckpointResumeFailed(p1); - } - if (ErrorDescription[0].equals("VM_TOO_MANY_VCPUS")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VmTooManyVcpus(p1); - } - if (ErrorDescription[0].equals("HOST_IS_LIVE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.HostIsLive(p1); - } - if (ErrorDescription[0].equals("IMPORT_ERROR_ATTACHED_DISKS_NOT_FOUND")) - { - throw new Types.ImportErrorAttachedDisksNotFound(); - } - if (ErrorDescription[0].equals("VBD_NOT_UNPLUGGABLE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VbdNotUnpluggable(p1); - } - if (ErrorDescription[0].equals("XEN_VSS_REQ_ERROR_CREATING_SNAPSHOT")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.XenVssReqErrorCreatingSnapshot(p1, p2); - } - if (ErrorDescription[0].equals("CANNOT_ENABLE_REDO_LOG")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.CannotEnableRedoLog(p1); - } - if (ErrorDescription[0].equals("CANNOT_EVACUATE_HOST")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.CannotEvacuateHost(p1); - } - if (ErrorDescription[0].equals("NO_HOSTS_AVAILABLE")) - { - throw new Types.NoHostsAvailable(); - } - if (ErrorDescription[0].equals("DEVICE_ATTACH_TIMEOUT")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.DeviceAttachTimeout(p1, p2); - } - if (ErrorDescription[0].equals("INVALID_DEVICE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.InvalidDevice(p1); - } - if (ErrorDescription[0].equals("PBD_EXISTS")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; - throw new Types.PbdExists(p1, p2, p3); - } - if (ErrorDescription[0].equals("WLB_XENSERVER_CONNECTION_REFUSED")) - { - throw new Types.WlbXenserverConnectionRefused(); - } - if (ErrorDescription[0].equals("HOST_CANNOT_READ_METRICS")) - { - throw new Types.HostCannotReadMetrics(); - } if (ErrorDescription[0].equals("VM_INCOMPATIBLE_WITH_THIS_HOST")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; @@ -667,163 +212,314 @@ public class Types String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; throw new Types.VmIncompatibleWithThisHost(p1, p2, p3); } - if (ErrorDescription[0].equals("NO_MORE_REDO_LOGS_ALLOWED")) + if (ErrorDescription[0].equals("SESSION_INVALID")) { - throw new Types.NoMoreRedoLogsAllowed(); + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.SessionInvalid(p1); } - if (ErrorDescription[0].equals("POOL_AUTH_ENABLE_FAILED")) + if (ErrorDescription[0].equals("XEN_VSS_REQ_ERROR_CREATING_SNAPSHOT")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.PoolAuthEnableFailed(p1, p2); + throw new Types.XenVssReqErrorCreatingSnapshot(p1, p2); } - if (ErrorDescription[0].equals("VM_SNAPSHOT_WITH_QUIESCE_NOT_SUPPORTED")) + if (ErrorDescription[0].equals("VM_REVERT_FAILED")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.VmSnapshotWithQuiesceNotSupported(p1, p2); + throw new Types.VmRevertFailed(p1, p2); } - if (ErrorDescription[0].equals("LICENSE_DOES_NOT_SUPPORT_POOLING")) - { - throw new Types.LicenseDoesNotSupportPooling(); - } - if (ErrorDescription[0].equals("HOST_UNKNOWN_TO_MASTER")) + if (ErrorDescription[0].equals("CPU_FEATURE_MASKING_NOT_SUPPORTED")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.HostUnknownToMaster(p1); + throw new Types.CpuFeatureMaskingNotSupported(p1); } - if (ErrorDescription[0].equals("WLB_CONNECTION_REFUSED")) + if (ErrorDescription[0].equals("HA_LOST_STATEFILE")) { - throw new Types.WlbConnectionRefused(); + throw new Types.HaLostStatefile(); } - if (ErrorDescription[0].equals("VM_SNAPSHOT_WITH_QUIESCE_PLUGIN_DEOS_NOT_RESPOND")) + if (ErrorDescription[0].equals("VM_CANNOT_DELETE_DEFAULT_TEMPLATE")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VmSnapshotWithQuiescePluginDeosNotRespond(p1); + throw new Types.VmCannotDeleteDefaultTemplate(p1); } - if (ErrorDescription[0].equals("VM_REQUIRES_SR")) + if (ErrorDescription[0].equals("AUTH_ENABLE_FAILED_PERMISSION_DENIED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.AuthEnableFailedPermissionDenied(p1); + } + if (ErrorDescription[0].equals("TOO_BUSY")) + { + throw new Types.TooBusy(); + } + if (ErrorDescription[0].equals("BACKUP_SCRIPT_FAILED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.BackupScriptFailed(p1); + } + if (ErrorDescription[0].equals("HOST_NOT_LIVE")) + { + throw new Types.HostNotLive(); + } + if (ErrorDescription[0].equals("LICENSE_EXPIRED")) + { + throw new Types.LicenseExpired(); + } + if (ErrorDescription[0].equals("VM_REQUIRES_NETWORK")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.VmRequiresSr(p1, p2); + throw new Types.VmRequiresNetwork(p1, p2); } - if (ErrorDescription[0].equals("VM_NO_CRASHDUMP_SR")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VmNoCrashdumpSr(p1); - } - if (ErrorDescription[0].equals("HA_NOT_INSTALLED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.HaNotInstalled(p1); - } - if (ErrorDescription[0].equals("DUPLICATE_PIF_DEVICE_NAME")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.DuplicatePifDeviceName(p1); - } - if (ErrorDescription[0].equals("VM_BAD_POWER_STATE")) + if (ErrorDescription[0].equals("LOCATION_NOT_UNIQUE")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; - throw new Types.VmBadPowerState(p1, p2, p3); + throw new Types.LocationNotUnique(p1, p2); } - if (ErrorDescription[0].equals("WLB_DISABLED")) - { - throw new Types.WlbDisabled(); - } - if (ErrorDescription[0].equals("VM_HOST_INCOMPATIBLE_VERSION")) + if (ErrorDescription[0].equals("VGPU_TYPE_NOT_SUPPORTED")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.VmHostIncompatibleVersion(p1, p2); + throw new Types.VgpuTypeNotSupported(p1, p2); } - if (ErrorDescription[0].equals("POOL_JOINING_EXTERNAL_AUTH_MISMATCH")) + if (ErrorDescription[0].equals("HOST_HAS_NO_MANAGEMENT_IP")) { - throw new Types.PoolJoiningExternalAuthMismatch(); + throw new Types.HostHasNoManagementIp(); } - if (ErrorDescription[0].equals("DISK_VBD_MUST_BE_READWRITE_FOR_HVM")) + if (ErrorDescription[0].equals("XEN_VSS_REQ_ERROR_CREATING_SNAPSHOT_XML_STRING")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.DiskVbdMustBeReadwriteForHvm(p1); + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.XenVssReqErrorCreatingSnapshotXmlString(p1, p2); } - if (ErrorDescription[0].equals("VM_BIOS_STRINGS_ALREADY_SET")) - { - throw new Types.VmBiosStringsAlreadySet(); - } - if (ErrorDescription[0].equals("WLB_XENSERVER_UNKNOWN_HOST")) - { - throw new Types.WlbXenserverUnknownHost(); - } - if (ErrorDescription[0].equals("HA_HOST_CANNOT_ACCESS_STATEFILE")) - { - throw new Types.HaHostCannotAccessStatefile(); - } - if (ErrorDescription[0].equals("VM_FAILED_SHUTDOWN_ACKNOWLEDGMENT")) - { - throw new Types.VmFailedShutdownAcknowledgment(); - } - if (ErrorDescription[0].equals("AUTH_SERVICE_ERROR")) + if (ErrorDescription[0].equals("CANNOT_PLUG_BOND_SLAVE")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.AuthServiceError(p1); + throw new Types.CannotPlugBondSlave(p1); } - if (ErrorDescription[0].equals("HOST_IN_EMERGENCY_MODE")) + if (ErrorDescription[0].equals("VGPU_TYPE_NOT_ENABLED")) { - throw new Types.HostInEmergencyMode(); + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.VgpuTypeNotEnabled(p1, p2); + } + if (ErrorDescription[0].equals("CANNOT_FIND_OEM_BACKUP_PARTITION")) + { + throw new Types.CannotFindOemBackupPartition(); + } + if (ErrorDescription[0].equals("PIF_ALREADY_BONDED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.PifAlreadyBonded(p1); + } + if (ErrorDescription[0].equals("RESTORE_INCOMPATIBLE_VERSION")) + { + throw new Types.RestoreIncompatibleVersion(); + } + if (ErrorDescription[0].equals("SESSION_AUTHENTICATION_FAILED")) + { + throw new Types.SessionAuthenticationFailed(); + } + if (ErrorDescription[0].equals("PIF_BOND_NEEDS_MORE_MEMBERS")) + { + throw new Types.PifBondNeedsMoreMembers(); + } + if (ErrorDescription[0].equals("HA_HEARTBEAT_DAEMON_STARTUP_FAILED")) + { + throw new Types.HaHeartbeatDaemonStartupFailed(); + } + if (ErrorDescription[0].equals("INVALID_VALUE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.InvalidValue(p1, p2); + } + if (ErrorDescription[0].equals("INVALID_IP_ADDRESS_SPECIFIED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.InvalidIpAddressSpecified(p1); + } + if (ErrorDescription[0].equals("LICENSE_CANNOT_DOWNGRADE_WHILE_IN_POOL")) + { + throw new Types.LicenseCannotDowngradeWhileInPool(); + } + if (ErrorDescription[0].equals("VMS_FAILED_TO_COOPERATE")) + { + throw new Types.VmsFailedToCooperate(); } if (ErrorDescription[0].equals("HOST_DISABLED_UNTIL_REBOOT")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; throw new Types.HostDisabledUntilReboot(p1); } - if (ErrorDescription[0].equals("DEFAULT_SR_NOT_FOUND")) + if (ErrorDescription[0].equals("SYSTEM_STATUS_RETRIEVAL_FAILED")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.DefaultSrNotFound(p1); + throw new Types.SystemStatusRetrievalFailed(p1); } - if (ErrorDescription[0].equals("DEVICE_ALREADY_EXISTS")) + if (ErrorDescription[0].equals("PIF_INCOMPATIBLE_PRIMARY_ADDRESS_TYPE")) + { + throw new Types.PifIncompatiblePrimaryAddressType(); + } + if (ErrorDescription[0].equals("IMPORT_ERROR_PREMATURE_EOF")) + { + throw new Types.ImportErrorPrematureEof(); + } + if (ErrorDescription[0].equals("PROVISION_ONLY_ALLOWED_ON_TEMPLATE")) + { + throw new Types.ProvisionOnlyAllowedOnTemplate(); + } + if (ErrorDescription[0].equals("VBD_NOT_REMOVABLE_MEDIA")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.DeviceAlreadyExists(p1); + throw new Types.VbdNotRemovableMedia(p1); } - if (ErrorDescription[0].equals("SR_NOT_SHARABLE")) + if (ErrorDescription[0].equals("GPU_GROUP_CONTAINS_NO_PGPUS")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.GpuGroupContainsNoPgpus(p1); + } + if (ErrorDescription[0].equals("HA_HOST_CANNOT_SEE_PEERS")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.SrNotSharable(p1, p2); + String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; + throw new Types.HaHostCannotSeePeers(p1, p2, p3); } - if (ErrorDescription[0].equals("VM_HAS_CHECKPOINT")) + if (ErrorDescription[0].equals("AUTH_ENABLE_FAILED")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VmHasCheckpoint(p1); + throw new Types.AuthEnableFailed(p1); + } + if (ErrorDescription[0].equals("HOST_NAME_INVALID")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.HostNameInvalid(p1); + } + if (ErrorDescription[0].equals("WLB_XENSERVER_CONNECTION_REFUSED")) + { + throw new Types.WlbXenserverConnectionRefused(); + } + if (ErrorDescription[0].equals("XEN_VSS_REQ_ERROR_NO_VOLUMES_SUPPORTED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.XenVssReqErrorNoVolumesSupported(p1, p2); + } + if (ErrorDescription[0].equals("HOST_NOT_ENOUGH_FREE_MEMORY")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.HostNotEnoughFreeMemory(p1, p2); + } + if (ErrorDescription[0].equals("CANNOT_EVACUATE_HOST")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.CannotEvacuateHost(p1); + } + if (ErrorDescription[0].equals("VM_IS_PART_OF_AN_APPLIANCE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.VmIsPartOfAnAppliance(p1, p2); + } + if (ErrorDescription[0].equals("VDI_IS_A_PHYSICAL_DEVICE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VdiIsAPhysicalDevice(p1); + } + if (ErrorDescription[0].equals("SR_VDI_LOCKING_FAILED")) + { + throw new Types.SrVdiLockingFailed(); + } + if (ErrorDescription[0].equals("PIF_VLAN_EXISTS")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.PifVlanExists(p1); + } + if (ErrorDescription[0].equals("HOSTS_NOT_COMPATIBLE")) + { + throw new Types.HostsNotCompatible(); + } + if (ErrorDescription[0].equals("VM_IS_PROTECTED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VmIsProtected(p1); + } + if (ErrorDescription[0].equals("HA_POOL_IS_ENABLED_BUT_HOST_IS_DISABLED")) + { + throw new Types.HaPoolIsEnabledButHostIsDisabled(); + } + if (ErrorDescription[0].equals("V6D_FAILURE")) + { + throw new Types.V6dFailure(); + } + if (ErrorDescription[0].equals("DEVICE_DETACH_TIMEOUT")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.DeviceDetachTimeout(p1, p2); + } + if (ErrorDescription[0].equals("LICENSE_PROCESSING_ERROR")) + { + throw new Types.LicenseProcessingError(); + } + if (ErrorDescription[0].equals("PIF_VLAN_STILL_EXISTS")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.PifVlanStillExists(p1); + } + if (ErrorDescription[0].equals("VM_REBOOTED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VmRebooted(p1); + } + if (ErrorDescription[0].equals("OBJECT_NOLONGER_EXISTS")) + { + throw new Types.ObjectNolongerExists(); + } + if (ErrorDescription[0].equals("CERTIFICATE_LIBRARY_CORRUPT")) + { + throw new Types.CertificateLibraryCorrupt(); + } + if (ErrorDescription[0].equals("DUPLICATE_VM")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.DuplicateVm(p1); + } + if (ErrorDescription[0].equals("CERTIFICATE_ALREADY_EXISTS")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.CertificateAlreadyExists(p1); + } + if (ErrorDescription[0].equals("CERTIFICATE_CORRUPT")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.CertificateCorrupt(p1); } if (ErrorDescription[0].equals("SM_PLUGIN_COMMUNICATION_FAILURE")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; throw new Types.SmPluginCommunicationFailure(p1); } - if (ErrorDescription[0].equals("VM_ASSIGNED_TO_PROTECTION_POLICY")) + if (ErrorDescription[0].equals("WLB_DISABLED")) + { + throw new Types.WlbDisabled(); + } + if (ErrorDescription[0].equals("GPU_GROUP_CONTAINS_PGPU")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.VmAssignedToProtectionPolicy(p1, p2); + throw new Types.GpuGroupContainsPgpu(p1); } - if (ErrorDescription[0].equals("RBAC_PERMISSION_DENIED")) + if (ErrorDescription[0].equals("VDI_NOT_IN_MAP")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.RbacPermissionDenied(p1, p2); + throw new Types.VdiNotInMap(p1); } - if (ErrorDescription[0].equals("AUTH_DISABLE_FAILED_PERMISSION_DENIED")) + if (ErrorDescription[0].equals("LICENCE_RESTRICTION")) { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.AuthDisableFailedPermissionDenied(p1); - } - if (ErrorDescription[0].equals("LICENSE_CANNOT_DOWNGRADE_WHILE_IN_POOL")) - { - throw new Types.LicenseCannotDowngradeWhileInPool(); + throw new Types.LicenceRestriction(); } if (ErrorDescription[0].equals("TOO_MANY_PENDING_TASKS")) { @@ -834,102 +530,11 @@ public class Types String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; throw new Types.VmSnapshotWithQuiesceTimeout(p1); } - if (ErrorDescription[0].equals("HA_CANNOT_CHANGE_BOND_STATUS_OF_MGMT_IFACE")) - { - throw new Types.HaCannotChangeBondStatusOfMgmtIface(); - } - if (ErrorDescription[0].equals("PATCH_ALREADY_APPLIED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.PatchAlreadyApplied(p1); - } - if (ErrorDescription[0].equals("SR_UUID_EXISTS")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.SrUuidExists(p1); - } - if (ErrorDescription[0].equals("AUTH_ENABLE_FAILED_DOMAIN_LOOKUP_FAILED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.AuthEnableFailedDomainLookupFailed(p1); - } - if (ErrorDescription[0].equals("PATCH_PRECHECK_FAILED_WRONG_SERVER_BUILD")) + if (ErrorDescription[0].equals("VDI_INCOMPATIBLE_TYPE")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; - throw new Types.PatchPrecheckFailedWrongServerBuild(p1, p2, p3); - } - if (ErrorDescription[0].equals("INVALID_FEATURE_STRING")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.InvalidFeatureString(p1); - } - if (ErrorDescription[0].equals("WLB_NOT_INITIALIZED")) - { - throw new Types.WlbNotInitialized(); - } - if (ErrorDescription[0].equals("OPERATION_BLOCKED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.OperationBlocked(p1, p2); - } - if (ErrorDescription[0].equals("PROVISION_ONLY_ALLOWED_ON_TEMPLATE")) - { - throw new Types.ProvisionOnlyAllowedOnTemplate(); - } - if (ErrorDescription[0].equals("VM_SHUTDOWN_TIMEOUT")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.VmShutdownTimeout(p1, p2); - } - if (ErrorDescription[0].equals("ROLE_ALREADY_EXISTS")) - { - throw new Types.RoleAlreadyExists(); - } - if (ErrorDescription[0].equals("NETWORK_CONTAINS_PIF")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.NetworkContainsPif(p1); - } - if (ErrorDescription[0].equals("COULD_NOT_FIND_NETWORK_INTERFACE_WITH_SPECIFIED_DEVICE_NAME_AND_MAC_ADDRESS")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.CouldNotFindNetworkInterfaceWithSpecifiedDeviceNameAndMacAddress(p1, p2); - } - if (ErrorDescription[0].equals("JOINING_HOST_SERVICE_FAILED")) - { - throw new Types.JoiningHostServiceFailed(); - } - if (ErrorDescription[0].equals("VDI_MISSING")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.VdiMissing(p1, p2); - } - if (ErrorDescription[0].equals("VBD_TRAY_LOCKED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VbdTrayLocked(p1); - } - if (ErrorDescription[0].equals("POOL_AUTH_ENABLE_FAILED_PERMISSION_DENIED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.PoolAuthEnableFailedPermissionDenied(p1, p2); - } - if (ErrorDescription[0].equals("UUID_INVALID")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.UuidInvalid(p1, p2); - } - if (ErrorDescription[0].equals("LICENCE_RESTRICTION")) - { - throw new Types.LicenceRestriction(); + throw new Types.VdiIncompatibleType(p1, p2); } if (ErrorDescription[0].equals("VIF_IN_USE")) { @@ -937,117 +542,553 @@ public class Types String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; throw new Types.VifInUse(p1, p2); } - if (ErrorDescription[0].equals("ONLY_ALLOWED_ON_OEM_EDITION")) + if (ErrorDescription[0].equals("VMPP_ARCHIVE_MORE_FREQUENT_THAN_BACKUP")) + { + throw new Types.VmppArchiveMoreFrequentThanBackup(); + } + if (ErrorDescription[0].equals("IMPORT_INCOMPATIBLE_VERSION")) + { + throw new Types.ImportIncompatibleVersion(); + } + if (ErrorDescription[0].equals("INVALID_EDITION")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.OnlyAllowedOnOemEdition(p1); + throw new Types.InvalidEdition(p1); } - if (ErrorDescription[0].equals("VDI_IS_A_PHYSICAL_DEVICE")) + if (ErrorDescription[0].equals("AUTH_SERVICE_ERROR")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VdiIsAPhysicalDevice(p1); + throw new Types.AuthServiceError(p1); } - if (ErrorDescription[0].equals("LICENSE_PROCESSING_ERROR")) - { - throw new Types.LicenseProcessingError(); - } - if (ErrorDescription[0].equals("ILLEGAL_VBD_DEVICE")) + if (ErrorDescription[0].equals("XEN_VSS_REQ_ERROR_ADDING_VOLUME_TO_SNAPSET_FAILED")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.IllegalVbdDevice(p1, p2); + throw new Types.XenVssReqErrorAddingVolumeToSnapsetFailed(p1, p2); } - if (ErrorDescription[0].equals("CRL_DOES_NOT_EXIST")) + if (ErrorDescription[0].equals("PERMISSION_DENIED")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.CrlDoesNotExist(p1); + throw new Types.PermissionDenied(p1); } - if (ErrorDescription[0].equals("TASK_CANCELLED")) + if (ErrorDescription[0].equals("DEVICE_ALREADY_EXISTS")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.TaskCancelled(p1); + throw new Types.DeviceAlreadyExists(p1); + } + if (ErrorDescription[0].equals("SR_UUID_EXISTS")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.SrUuidExists(p1); + } + if (ErrorDescription[0].equals("VM_HAS_VGPU")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VmHasVgpu(p1); + } + if (ErrorDescription[0].equals("TOO_MANY_STORAGE_MIGRATES")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.TooManyStorageMigrates(p1); + } + if (ErrorDescription[0].equals("HA_IS_ENABLED")) + { + throw new Types.HaIsEnabled(); + } + if (ErrorDescription[0].equals("CANNOT_DESTROY_SYSTEM_NETWORK")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.CannotDestroySystemNetwork(p1); + } + if (ErrorDescription[0].equals("OPENVSWITCH_NOT_ACTIVE")) + { + throw new Types.OpenvswitchNotActive(); + } + if (ErrorDescription[0].equals("NOT_IMPLEMENTED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.NotImplemented(p1); + } + if (ErrorDescription[0].equals("VBD_NOT_UNPLUGGABLE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VbdNotUnpluggable(p1); } if (ErrorDescription[0].equals("VM_CRASHED")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; throw new Types.VmCrashed(p1); } + if (ErrorDescription[0].equals("VM_BAD_POWER_STATE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; + throw new Types.VmBadPowerState(p1, p2, p3); + } + if (ErrorDescription[0].equals("FEATURE_REQUIRES_HVM")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.FeatureRequiresHvm(p1); + } + if (ErrorDescription[0].equals("IMPORT_ERROR_UNEXPECTED_FILE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.ImportErrorUnexpectedFile(p1, p2); + } + if (ErrorDescription[0].equals("SR_NOT_EMPTY")) + { + throw new Types.SrNotEmpty(); + } + if (ErrorDescription[0].equals("JOINING_HOST_CANNOT_HAVE_VMS_WITH_CURRENT_OPERATIONS")) + { + throw new Types.JoiningHostCannotHaveVmsWithCurrentOperations(); + } + if (ErrorDescription[0].equals("VDI_NOT_MANAGED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VdiNotManaged(p1); + } + if (ErrorDescription[0].equals("VM_HALTED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VmHalted(p1); + } + if (ErrorDescription[0].equals("COULD_NOT_FIND_NETWORK_INTERFACE_WITH_SPECIFIED_DEVICE_NAME_AND_MAC_ADDRESS")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.CouldNotFindNetworkInterfaceWithSpecifiedDeviceNameAndMacAddress(p1, p2); + } + if (ErrorDescription[0].equals("SR_BACKEND_FAILURE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; + throw new Types.SrBackendFailure(p1, p2, p3); + } + if (ErrorDescription[0].equals("RESTORE_TARGET_MISSING_DEVICE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.RestoreTargetMissingDevice(p1); + } + if (ErrorDescription[0].equals("VM_IS_TEMPLATE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VmIsTemplate(p1); + } + if (ErrorDescription[0].equals("HA_OPERATION_WOULD_BREAK_FAILOVER_PLAN")) + { + throw new Types.HaOperationWouldBreakFailoverPlan(); + } + if (ErrorDescription[0].equals("VMPP_HAS_VM")) + { + throw new Types.VmppHasVm(); + } + if (ErrorDescription[0].equals("HANDLE_INVALID")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.HandleInvalid(p1, p2); + } + if (ErrorDescription[0].equals("POOL_JOINING_HOST_MUST_HAVE_PHYSICAL_MANAGEMENT_NIC")) + { + throw new Types.PoolJoiningHostMustHavePhysicalManagementNic(); + } + if (ErrorDescription[0].equals("DEVICE_ALREADY_ATTACHED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.DeviceAlreadyAttached(p1); + } + if (ErrorDescription[0].equals("NOT_SUPPORTED_DURING_UPGRADE")) + { + throw new Types.NotSupportedDuringUpgrade(); + } + if (ErrorDescription[0].equals("OPERATION_PARTIALLY_FAILED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.OperationPartiallyFailed(p1); + } + if (ErrorDescription[0].equals("OTHER_OPERATION_IN_PROGRESS")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.OtherOperationInProgress(p1, p2); + } + if (ErrorDescription[0].equals("PIF_CANNOT_BOND_CROSS_HOST")) + { + throw new Types.PifCannotBondCrossHost(); + } + if (ErrorDescription[0].equals("PATCH_PRECHECK_FAILED_WRONG_SERVER_VERSION")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; + throw new Types.PatchPrecheckFailedWrongServerVersion(p1, p2, p3); + } + if (ErrorDescription[0].equals("CANNOT_PLUG_VIF")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.CannotPlugVif(p1); + } if (ErrorDescription[0].equals("POOL_AUTH_ENABLE_FAILED_DOMAIN_LOOKUP_FAILED")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; throw new Types.PoolAuthEnableFailedDomainLookupFailed(p1, p2); } - if (ErrorDescription[0].equals("HA_SHOULD_BE_FENCED")) + if (ErrorDescription[0].equals("NOT_ALLOWED_ON_OEM_EDITION")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.HaShouldBeFenced(p1); + throw new Types.NotAllowedOnOemEdition(p1); } - if (ErrorDescription[0].equals("VM_UNSAFE_BOOT")) + if (ErrorDescription[0].equals("PATCH_PRECHECK_FAILED_UNKNOWN_ERROR")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VmUnsafeBoot(p1); + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.PatchPrecheckFailedUnknownError(p1, p2); } - if (ErrorDescription[0].equals("PIF_HAS_NO_NETWORK_CONFIGURATION")) + if (ErrorDescription[0].equals("CRL_CORRUPT")) { - throw new Types.PifHasNoNetworkConfiguration(); + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.CrlCorrupt(p1); } - if (ErrorDescription[0].equals("TOO_BUSY")) + if (ErrorDescription[0].equals("POOL_JOINING_EXTERNAL_AUTH_MISMATCH")) { - throw new Types.TooBusy(); + throw new Types.PoolJoiningExternalAuthMismatch(); } - if (ErrorDescription[0].equals("VALUE_NOT_SUPPORTED")) + if (ErrorDescription[0].equals("JOINING_HOST_SERVICE_FAILED")) + { + throw new Types.JoiningHostServiceFailed(); + } + if (ErrorDescription[0].equals("CHANGE_PASSWORD_REJECTED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.ChangePasswordRejected(p1); + } + if (ErrorDescription[0].equals("PIF_UNMANAGED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.PifUnmanaged(p1); + } + if (ErrorDescription[0].equals("VM_DUPLICATE_VBD_DEVICE")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; - throw new Types.ValueNotSupported(p1, p2, p3); + throw new Types.VmDuplicateVbdDevice(p1, p2, p3); } - if (ErrorDescription[0].equals("SESSION_INVALID")) + if (ErrorDescription[0].equals("RESTORE_SCRIPT_FAILED")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.SessionInvalid(p1); + throw new Types.RestoreScriptFailed(p1); } - if (ErrorDescription[0].equals("HA_CONSTRAINT_VIOLATION_NETWORK_NOT_SHARED")) + if (ErrorDescription[0].equals("WLB_XENSERVER_TIMEOUT")) + { + throw new Types.WlbXenserverTimeout(); + } + if (ErrorDescription[0].equals("MAC_DOES_NOT_EXIST")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.HaConstraintViolationNetworkNotShared(p1); + throw new Types.MacDoesNotExist(p1); } - if (ErrorDescription[0].equals("HA_FAILED_TO_FORM_LIVESET")) + if (ErrorDescription[0].equals("HOST_ITS_OWN_SLAVE")) { - throw new Types.HaFailedToFormLiveset(); + throw new Types.HostItsOwnSlave(); } - if (ErrorDescription[0].equals("PIF_CANNOT_BOND_CROSS_HOST")) + if (ErrorDescription[0].equals("AUTH_DISABLE_FAILED_WRONG_CREDENTIALS")) { - throw new Types.PifCannotBondCrossHost(); + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.AuthDisableFailedWrongCredentials(p1); + } + if (ErrorDescription[0].equals("HA_TOO_FEW_HOSTS")) + { + throw new Types.HaTooFewHosts(); + } + if (ErrorDescription[0].equals("VM_ASSIGNED_TO_PROTECTION_POLICY")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.VmAssignedToProtectionPolicy(p1, p2); + } + if (ErrorDescription[0].equals("MAP_DUPLICATE_KEY")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; + String p4 = ErrorDescription.length > 4 ? ErrorDescription[4] : ""; + throw new Types.MapDuplicateKey(p1, p2, p3, p4); + } + if (ErrorDescription[0].equals("HOST_MASTER_CANNOT_TALK_BACK")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.HostMasterCannotTalkBack(p1); + } + if (ErrorDescription[0].equals("VM_CHECKPOINT_RESUME_FAILED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VmCheckpointResumeFailed(p1); + } + if (ErrorDescription[0].equals("CRL_NAME_INVALID")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.CrlNameInvalid(p1); } if (ErrorDescription[0].equals("EVENT_FROM_TOKEN_PARSE_FAILURE")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; throw new Types.EventFromTokenParseFailure(p1); } - if (ErrorDescription[0].equals("SR_REQUIRES_UPGRADE")) + if (ErrorDescription[0].equals("CANNOT_ENABLE_REDO_LOG")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.SrRequiresUpgrade(p1); + throw new Types.CannotEnableRedoLog(p1); } - if (ErrorDescription[0].equals("CERTIFICATE_DOES_NOT_EXIST")) + if (ErrorDescription[0].equals("PIF_DEVICE_NOT_FOUND")) + { + throw new Types.PifDeviceNotFound(); + } + if (ErrorDescription[0].equals("LICENSE_DOES_NOT_SUPPORT_POOLING")) + { + throw new Types.LicenseDoesNotSupportPooling(); + } + if (ErrorDescription[0].equals("OPERATION_BLOCKED")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.CertificateDoesNotExist(p1); + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.OperationBlocked(p1, p2); } - if (ErrorDescription[0].equals("HA_OPERATION_WOULD_BREAK_FAILOVER_PLAN")) - { - throw new Types.HaOperationWouldBreakFailoverPlan(); - } - if (ErrorDescription[0].equals("CANNOT_FETCH_PATCH")) + if (ErrorDescription[0].equals("VM_NO_CRASHDUMP_SR")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.CannotFetchPatch(p1); + throw new Types.VmNoCrashdumpSr(p1); } - if (ErrorDescription[0].equals("CANNOT_FIND_PATCH")) + if (ErrorDescription[0].equals("HOST_EVACUATE_IN_PROGRESS")) { - throw new Types.CannotFindPatch(); + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.HostEvacuateInProgress(p1); + } + if (ErrorDescription[0].equals("SYSTEM_STATUS_MUST_USE_TAR_ON_OEM")) + { + throw new Types.SystemStatusMustUseTarOnOem(); + } + if (ErrorDescription[0].equals("HA_NO_PLAN")) + { + throw new Types.HaNoPlan(); + } + if (ErrorDescription[0].equals("HOST_UNKNOWN_TO_MASTER")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.HostUnknownToMaster(p1); + } + if (ErrorDescription[0].equals("AUTH_ENABLE_FAILED_WRONG_CREDENTIALS")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.AuthEnableFailedWrongCredentials(p1); + } + if (ErrorDescription[0].equals("OPERATION_NOT_ALLOWED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.OperationNotAllowed(p1); + } + if (ErrorDescription[0].equals("USER_IS_NOT_LOCAL_SUPERUSER")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.UserIsNotLocalSuperuser(p1); + } + if (ErrorDescription[0].equals("HA_FAILED_TO_FORM_LIVESET")) + { + throw new Types.HaFailedToFormLiveset(); + } + if (ErrorDescription[0].equals("WLB_CONNECTION_RESET")) + { + throw new Types.WlbConnectionReset(); + } + if (ErrorDescription[0].equals("HOST_CD_DRIVE_EMPTY")) + { + throw new Types.HostCdDriveEmpty(); + } + if (ErrorDescription[0].equals("EVENTS_LOST")) + { + throw new Types.EventsLost(); + } + if (ErrorDescription[0].equals("PROVISION_FAILED_OUT_OF_SPACE")) + { + throw new Types.ProvisionFailedOutOfSpace(); + } + if (ErrorDescription[0].equals("LICENSE_FILE_DEPRECATED")) + { + throw new Types.LicenseFileDeprecated(); + } + if (ErrorDescription[0].equals("SUBJECT_ALREADY_EXISTS")) + { + throw new Types.SubjectAlreadyExists(); + } + if (ErrorDescription[0].equals("VM_HOST_INCOMPATIBLE_VERSION")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.VmHostIncompatibleVersion(p1, p2); + } + if (ErrorDescription[0].equals("HOST_BROKEN")) + { + throw new Types.HostBroken(); + } + if (ErrorDescription[0].equals("NOT_IN_EMERGENCY_MODE")) + { + throw new Types.NotInEmergencyMode(); + } + if (ErrorDescription[0].equals("ROLE_NOT_FOUND")) + { + throw new Types.RoleNotFound(); + } + if (ErrorDescription[0].equals("MAC_STILL_EXISTS")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.MacStillExists(p1); + } + if (ErrorDescription[0].equals("HA_HOST_IS_ARMED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.HaHostIsArmed(p1); + } + if (ErrorDescription[0].equals("JOINING_HOST_CANNOT_HAVE_RUNNING_VMS")) + { + throw new Types.JoiningHostCannotHaveRunningVms(); + } + if (ErrorDescription[0].equals("DOMAIN_BUILDER_ERROR")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; + throw new Types.DomainBuilderError(p1, p2, p3); + } + if (ErrorDescription[0].equals("HA_CONSTRAINT_VIOLATION_NETWORK_NOT_SHARED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.HaConstraintViolationNetworkNotShared(p1); + } + if (ErrorDescription[0].equals("HOST_CANNOT_DESTROY_SELF")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.HostCannotDestroySelf(p1); + } + if (ErrorDescription[0].equals("WLB_INTERNAL_ERROR")) + { + throw new Types.WlbInternalError(); + } + if (ErrorDescription[0].equals("FIELD_TYPE_ERROR")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.FieldTypeError(p1); + } + if (ErrorDescription[0].equals("DEVICE_ALREADY_DETACHED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.DeviceAlreadyDetached(p1); + } + if (ErrorDescription[0].equals("GPU_GROUP_CONTAINS_VGPU")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.GpuGroupContainsVgpu(p1); + } + if (ErrorDescription[0].equals("DEVICE_DETACH_REJECTED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; + throw new Types.DeviceDetachRejected(p1, p2, p3); + } + if (ErrorDescription[0].equals("SR_UNKNOWN_DRIVER")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.SrUnknownDriver(p1); + } + if (ErrorDescription[0].equals("HOSTS_NOT_HOMOGENEOUS")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.HostsNotHomogeneous(p1); + } + if (ErrorDescription[0].equals("VDI_CONTAINS_METADATA_OF_THIS_POOL")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.VdiContainsMetadataOfThisPool(p1, p2); + } + if (ErrorDescription[0].equals("SR_NOT_SHARABLE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.SrNotSharable(p1, p2); + } + if (ErrorDescription[0].equals("POOL_AUTH_ENABLE_FAILED_DUPLICATE_HOSTNAME")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.PoolAuthEnableFailedDuplicateHostname(p1, p2); + } + if (ErrorDescription[0].equals("HA_NOT_ENABLED")) + { + throw new Types.HaNotEnabled(); + } + if (ErrorDescription[0].equals("SR_ATTACH_FAILED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.SrAttachFailed(p1); + } + if (ErrorDescription[0].equals("MESSAGE_PARAMETER_COUNT_MISMATCH")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; + throw new Types.MessageParameterCountMismatch(p1, p2, p3); + } + if (ErrorDescription[0].equals("VM_MEMORY_SIZE_TOO_LOW")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VmMemorySizeTooLow(p1); + } + if (ErrorDescription[0].equals("POOL_JOINING_HOST_MUST_HAVE_SAME_PRODUCT_VERSION")) + { + throw new Types.PoolJoiningHostMustHaveSameProductVersion(); + } + if (ErrorDescription[0].equals("VM_REQUIRES_IOMMU")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VmRequiresIommu(p1); + } + if (ErrorDescription[0].equals("POOL_AUTH_ENABLE_FAILED_PERMISSION_DENIED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.PoolAuthEnableFailedPermissionDenied(p1, p2); + } + if (ErrorDescription[0].equals("VM_REQUIRES_VDI")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.VmRequiresVdi(p1, p2); + } + if (ErrorDescription[0].equals("JOINING_HOST_CONNECTION_FAILED")) + { + throw new Types.JoiningHostConnectionFailed(); + } + if (ErrorDescription[0].equals("NETWORK_ALREADY_CONNECTED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.NetworkAlreadyConnected(p1, p2); + } + if (ErrorDescription[0].equals("HOST_HAS_RESIDENT_VMS")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.HostHasResidentVms(p1); + } + if (ErrorDescription[0].equals("SESSION_NOT_REGISTERED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.SessionNotRegistered(p1); } if (ErrorDescription[0].equals("DB_UNIQUENESS_CONSTRAINT_VIOLATION")) { @@ -1056,22 +1097,514 @@ public class Types String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; throw new Types.DbUniquenessConstraintViolation(p1, p2, p3); } - if (ErrorDescription[0].equals("VM_REQUIRES_NETWORK")) + if (ErrorDescription[0].equals("SR_INDESTRUCTIBLE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.SrIndestructible(p1); + } + if (ErrorDescription[0].equals("WLB_XENSERVER_MALFORMED_RESPONSE")) + { + throw new Types.WlbXenserverMalformedResponse(); + } + if (ErrorDescription[0].equals("VDI_NOT_AVAILABLE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VdiNotAvailable(p1); + } + if (ErrorDescription[0].equals("SR_FULL")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.VmRequiresNetwork(p1, p2); + throw new Types.SrFull(p1, p2); + } + if (ErrorDescription[0].equals("CANNOT_FETCH_PATCH")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.CannotFetchPatch(p1); + } + if (ErrorDescription[0].equals("HOST_IN_EMERGENCY_MODE")) + { + throw new Types.HostInEmergencyMode(); + } + if (ErrorDescription[0].equals("IMPORT_ERROR_SOME_CHECKSUMS_FAILED")) + { + throw new Types.ImportErrorSomeChecksumsFailed(); + } + if (ErrorDescription[0].equals("XENAPI_MISSING_PLUGIN")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.XenapiMissingPlugin(p1); + } + if (ErrorDescription[0].equals("AUTH_ALREADY_ENABLED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.AuthAlreadyEnabled(p1, p2); + } + if (ErrorDescription[0].equals("VALUE_NOT_SUPPORTED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; + throw new Types.ValueNotSupported(p1, p2, p3); + } + if (ErrorDescription[0].equals("TRANSPORT_PIF_NOT_CONFIGURED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.TransportPifNotConfigured(p1); + } + if (ErrorDescription[0].equals("PATCH_PRECHECK_FAILED_VM_RUNNING")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.PatchPrecheckFailedVmRunning(p1); + } + if (ErrorDescription[0].equals("SR_HAS_PBD")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.SrHasPbd(p1); + } + if (ErrorDescription[0].equals("INVALID_DEVICE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.InvalidDevice(p1); + } + if (ErrorDescription[0].equals("VGPU_TYPE_NOT_COMPATIBLE_WITH_RUNNING_TYPE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; + throw new Types.VgpuTypeNotCompatibleWithRunningType(p1, p2, p3); + } + if (ErrorDescription[0].equals("ACTIVATION_WHILE_NOT_FREE")) + { + throw new Types.ActivationWhileNotFree(); + } + if (ErrorDescription[0].equals("VDI_READONLY")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VdiReadonly(p1); + } + if (ErrorDescription[0].equals("VDI_IS_NOT_ISO")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.VdiIsNotIso(p1, p2); + } + if (ErrorDescription[0].equals("HOST_DISABLED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.HostDisabled(p1); + } + if (ErrorDescription[0].equals("WLB_CONNECTION_REFUSED")) + { + throw new Types.WlbConnectionRefused(); } if (ErrorDescription[0].equals("VBD_NOT_EMPTY")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; throw new Types.VbdNotEmpty(p1); } - if (ErrorDescription[0].equals("HOST_NOT_ENOUGH_FREE_MEMORY")) + if (ErrorDescription[0].equals("CANNOT_FIND_STATE_PARTITION")) + { + throw new Types.CannotFindStatePartition(); + } + if (ErrorDescription[0].equals("INTERFACE_HAS_NO_IP")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.InterfaceHasNoIp(p1); + } + if (ErrorDescription[0].equals("JOINING_HOST_CANNOT_HAVE_RUNNING_OR_SUSPENDED_VMS")) + { + throw new Types.JoiningHostCannotHaveRunningOrSuspendedVms(); + } + if (ErrorDescription[0].equals("AUTH_ENABLE_FAILED_DOMAIN_LOOKUP_FAILED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.AuthEnableFailedDomainLookupFailed(p1); + } + if (ErrorDescription[0].equals("INVALID_FEATURE_STRING")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.InvalidFeatureString(p1); + } + if (ErrorDescription[0].equals("CANNOT_CONTACT_HOST")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.CannotContactHost(p1); + } + if (ErrorDescription[0].equals("MAC_INVALID")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.MacInvalid(p1); + } + if (ErrorDescription[0].equals("VBD_IS_EMPTY")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VbdIsEmpty(p1); + } + if (ErrorDescription[0].equals("POOL_AUTH_ENABLE_FAILED_INVALID_OU")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.HostNotEnoughFreeMemory(p1, p2); + throw new Types.PoolAuthEnableFailedInvalidOu(p1, p2); + } + if (ErrorDescription[0].equals("MESSAGE_METHOD_UNKNOWN")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.MessageMethodUnknown(p1); + } + if (ErrorDescription[0].equals("PIF_DOES_NOT_ALLOW_UNPLUG")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.PifDoesNotAllowUnplug(p1); + } + if (ErrorDescription[0].equals("PATCH_PRECHECK_FAILED_PREREQUISITE_MISSING")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.PatchPrecheckFailedPrerequisiteMissing(p1, p2); + } + if (ErrorDescription[0].equals("VDI_MISSING")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.VdiMissing(p1, p2); + } + if (ErrorDescription[0].equals("WLB_XENSERVER_AUTHENTICATION_FAILED")) + { + throw new Types.WlbXenserverAuthenticationFailed(); + } + if (ErrorDescription[0].equals("JOINING_HOST_CANNOT_CONTAIN_SHARED_SRS")) + { + throw new Types.JoiningHostCannotContainSharedSrs(); + } + if (ErrorDescription[0].equals("RESTORE_TARGET_MGMT_IF_NOT_IN_BACKUP")) + { + throw new Types.RestoreTargetMgmtIfNotInBackup(); + } + if (ErrorDescription[0].equals("VM_SNAPSHOT_WITH_QUIESCE_NOT_SUPPORTED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.VmSnapshotWithQuiesceNotSupported(p1, p2); + } + if (ErrorDescription[0].equals("PIF_IS_PHYSICAL")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.PifIsPhysical(p1); + } + if (ErrorDescription[0].equals("DOMAIN_EXISTS")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.DomainExists(p1, p2); + } + if (ErrorDescription[0].equals("VM_OLD_PV_DRIVERS")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; + throw new Types.VmOldPvDrivers(p1, p2, p3); + } + if (ErrorDescription[0].equals("IS_TUNNEL_ACCESS_PIF")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.IsTunnelAccessPif(p1); + } + if (ErrorDescription[0].equals("SR_REQUIRES_UPGRADE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.SrRequiresUpgrade(p1); + } + if (ErrorDescription[0].equals("ROLE_ALREADY_EXISTS")) + { + throw new Types.RoleAlreadyExists(); + } + if (ErrorDescription[0].equals("XEN_VSS_REQ_ERROR_INIT_FAILED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.XenVssReqErrorInitFailed(p1, p2); + } + if (ErrorDescription[0].equals("CRL_DOES_NOT_EXIST")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.CrlDoesNotExist(p1); + } + if (ErrorDescription[0].equals("INVALID_PATCH")) + { + throw new Types.InvalidPatch(); + } + if (ErrorDescription[0].equals("LICENSE_DOES_NOT_SUPPORT_XHA")) + { + throw new Types.LicenseDoesNotSupportXha(); + } + if (ErrorDescription[0].equals("AUTH_IS_DISABLED")) + { + throw new Types.AuthIsDisabled(); + } + if (ErrorDescription[0].equals("XEN_VSS_REQ_ERROR_PROV_NOT_LOADED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.XenVssReqErrorProvNotLoaded(p1, p2); + } + if (ErrorDescription[0].equals("VM_HVM_REQUIRED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VmHvmRequired(p1); + } + if (ErrorDescription[0].equals("WLB_MALFORMED_REQUEST")) + { + throw new Types.WlbMalformedRequest(); + } + if (ErrorDescription[0].equals("VM_BIOS_STRINGS_ALREADY_SET")) + { + throw new Types.VmBiosStringsAlreadySet(); + } + if (ErrorDescription[0].equals("POOL_AUTH_DISABLE_FAILED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.PoolAuthDisableFailed(p1, p2); + } + if (ErrorDescription[0].equals("VM_HAS_PCI_ATTACHED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VmHasPciAttached(p1); + } + if (ErrorDescription[0].equals("VM_SNAPSHOT_WITH_QUIESCE_FAILED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VmSnapshotWithQuiesceFailed(p1); + } + if (ErrorDescription[0].equals("WLB_UNKNOWN_HOST")) + { + throw new Types.WlbUnknownHost(); + } + if (ErrorDescription[0].equals("SR_DEVICE_IN_USE")) + { + throw new Types.SrDeviceInUse(); + } + if (ErrorDescription[0].equals("DISK_VBD_MUST_BE_READWRITE_FOR_HVM")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.DiskVbdMustBeReadwriteForHvm(p1); + } + if (ErrorDescription[0].equals("DUPLICATE_PIF_DEVICE_NAME")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.DuplicatePifDeviceName(p1); + } + if (ErrorDescription[0].equals("PATCH_PRECHECK_FAILED_ISO_MOUNTED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.PatchPrecheckFailedIsoMounted(p1); + } + if (ErrorDescription[0].equals("PATCH_PRECHECK_FAILED_WRONG_SERVER_BUILD")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; + throw new Types.PatchPrecheckFailedWrongServerBuild(p1, p2, p3); + } + if (ErrorDescription[0].equals("VM_NOT_RESIDENT_HERE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.VmNotResidentHere(p1, p2); + } + if (ErrorDescription[0].equals("TASK_CANCELLED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.TaskCancelled(p1); + } + if (ErrorDescription[0].equals("VM_TOO_MANY_VCPUS")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VmTooManyVcpus(p1); + } + if (ErrorDescription[0].equals("SUBJECT_CANNOT_BE_RESOLVED")) + { + throw new Types.SubjectCannotBeResolved(); + } + if (ErrorDescription[0].equals("VM_MISSING_PV_DRIVERS")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VmMissingPvDrivers(p1); + } + if (ErrorDescription[0].equals("PATCH_APPLY_FAILED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.PatchApplyFailed(p1); + } + if (ErrorDescription[0].equals("SLAVE_REQUIRES_MANAGEMENT_INTERFACE")) + { + throw new Types.SlaveRequiresManagementInterface(); + } + if (ErrorDescription[0].equals("HOST_IS_LIVE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.HostIsLive(p1); + } + if (ErrorDescription[0].equals("VM_NO_SUSPEND_SR")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VmNoSuspendSr(p1); + } + if (ErrorDescription[0].equals("XEN_VSS_REQ_ERROR_START_SNAPSHOT_SET_FAILED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.XenVssReqErrorStartSnapshotSetFailed(p1, p2); + } + if (ErrorDescription[0].equals("EVENT_SUBSCRIPTION_PARSE_FAILURE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.EventSubscriptionParseFailure(p1); + } + if (ErrorDescription[0].equals("VM_TO_IMPORT_IS_NOT_NEWER_VERSION")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; + throw new Types.VmToImportIsNotNewerVersion(p1, p2, p3); + } + if (ErrorDescription[0].equals("DEFAULT_SR_NOT_FOUND")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.DefaultSrNotFound(p1); + } + if (ErrorDescription[0].equals("UUID_INVALID")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.UuidInvalid(p1, p2); + } + if (ErrorDescription[0].equals("CANNOT_CREATE_STATE_FILE")) + { + throw new Types.CannotCreateStateFile(); + } + if (ErrorDescription[0].equals("VM_REQUIRES_GPU")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.VmRequiresGpu(p1, p2); + } + if (ErrorDescription[0].equals("LICENSE_CHECKOUT_ERROR")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.LicenseCheckoutError(p1); + } + if (ErrorDescription[0].equals("HOST_IS_SLAVE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.HostIsSlave(p1); + } + if (ErrorDescription[0].equals("HOST_STILL_BOOTING")) + { + throw new Types.HostStillBooting(); + } + if (ErrorDescription[0].equals("PGPU_NOT_COMPATIBLE_WITH_GPU_GROUP")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.PgpuNotCompatibleWithGpuGroup(p1, p2); + } + if (ErrorDescription[0].equals("XMLRPC_UNMARSHAL_FAILURE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.XmlrpcUnmarshalFailure(p1, p2); + } + if (ErrorDescription[0].equals("MESSAGE_REMOVED")) + { + throw new Types.MessageRemoved(); + } + if (ErrorDescription[0].equals("NETWORK_CONTAINS_PIF")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.NetworkContainsPif(p1); + } + if (ErrorDescription[0].equals("WLB_XENSERVER_UNKNOWN_HOST")) + { + throw new Types.WlbXenserverUnknownHost(); + } + if (ErrorDescription[0].equals("DEVICE_ATTACH_TIMEOUT")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.DeviceAttachTimeout(p1, p2); + } + if (ErrorDescription[0].equals("PATCH_ALREADY_EXISTS")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.PatchAlreadyExists(p1); + } + if (ErrorDescription[0].equals("PGPU_IN_USE_BY_VM")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.PgpuInUseByVm(p1); + } + if (ErrorDescription[0].equals("AUTH_ENABLE_FAILED_UNAVAILABLE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.AuthEnableFailedUnavailable(p1); + } + if (ErrorDescription[0].equals("CANNOT_ADD_VLAN_TO_BOND_SLAVE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.CannotAddVlanToBondSlave(p1); + } + if (ErrorDescription[0].equals("VDI_LOCATION_MISSING")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.VdiLocationMissing(p1, p2); + } + if (ErrorDescription[0].equals("POOL_AUTH_DISABLE_FAILED_WRONG_CREDENTIALS")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.PoolAuthDisableFailedWrongCredentials(p1, p2); + } + if (ErrorDescription[0].equals("VM_FAILED_SHUTDOWN_ACKNOWLEDGMENT")) + { + throw new Types.VmFailedShutdownAcknowledgment(); + } + if (ErrorDescription[0].equals("CERTIFICATE_NAME_INVALID")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.CertificateNameInvalid(p1); + } + if (ErrorDescription[0].equals("UNKNOWN_BOOTLOADER")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.UnknownBootloader(p1, p2); + } + if (ErrorDescription[0].equals("VM_ATTACHED_TO_MORE_THAN_ONE_VDI_WITH_TIMEOFFSET_MARKED_AS_RESET_ON_BOOT")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VmAttachedToMoreThanOneVdiWithTimeoffsetMarkedAsResetOnBoot(p1); + } + if (ErrorDescription[0].equals("INTERNAL_ERROR")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.InternalError(p1); + } + if (ErrorDescription[0].equals("MESSAGE_DEPRECATED")) + { + throw new Types.MessageDeprecated(); + } + if (ErrorDescription[0].equals("CANNOT_FIND_PATCH")) + { + throw new Types.CannotFindPatch(); + } + if (ErrorDescription[0].equals("VM_UNSAFE_BOOT")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VmUnsafeBoot(p1); } if (ErrorDescription[0].equals("VM_MIGRATE_FAILED")) { @@ -1081,234 +1614,24 @@ public class Types String p4 = ErrorDescription.length > 4 ? ErrorDescription[4] : ""; throw new Types.VmMigrateFailed(p1, p2, p3, p4); } - if (ErrorDescription[0].equals("SR_OPERATION_NOT_SUPPORTED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.SrOperationNotSupported(p1); - } - if (ErrorDescription[0].equals("DEVICE_NOT_ATTACHED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.DeviceNotAttached(p1); - } - if (ErrorDescription[0].equals("HOST_DISABLED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.HostDisabled(p1); - } - if (ErrorDescription[0].equals("SYSTEM_STATUS_MUST_USE_TAR_ON_OEM")) - { - throw new Types.SystemStatusMustUseTarOnOem(); - } - if (ErrorDescription[0].equals("XEN_VSS_REQ_ERROR_PREPARING_WRITERS")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.XenVssReqErrorPreparingWriters(p1, p2); - } - if (ErrorDescription[0].equals("AUTH_ENABLE_FAILED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.AuthEnableFailed(p1); - } - if (ErrorDescription[0].equals("JOINING_HOST_CANNOT_CONTAIN_SHARED_SRS")) - { - throw new Types.JoiningHostCannotContainSharedSrs(); - } - if (ErrorDescription[0].equals("VM_NO_VCPUS")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VmNoVcpus(p1); - } - if (ErrorDescription[0].equals("INVALID_PATCH_WITH_LOG")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.InvalidPatchWithLog(p1); - } - if (ErrorDescription[0].equals("SR_DEVICE_IN_USE")) - { - throw new Types.SrDeviceInUse(); - } - if (ErrorDescription[0].equals("HOST_CD_DRIVE_EMPTY")) - { - throw new Types.HostCdDriveEmpty(); - } - if (ErrorDescription[0].equals("HA_HOST_IS_ARMED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.HaHostIsArmed(p1); - } - if (ErrorDescription[0].equals("EVENT_SUBSCRIPTION_PARSE_FAILURE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.EventSubscriptionParseFailure(p1); - } - if (ErrorDescription[0].equals("LICENSE_EXPIRED")) - { - throw new Types.LicenseExpired(); - } - if (ErrorDescription[0].equals("SESSION_AUTHENTICATION_FAILED")) - { - throw new Types.SessionAuthenticationFailed(); - } - if (ErrorDescription[0].equals("PIF_IS_VLAN")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.PifIsVlan(p1); - } - if (ErrorDescription[0].equals("VMPP_ARCHIVE_MORE_FREQUENT_THAN_BACKUP")) - { - throw new Types.VmppArchiveMoreFrequentThanBackup(); - } - if (ErrorDescription[0].equals("V6D_FAILURE")) - { - throw new Types.V6dFailure(); - } if (ErrorDescription[0].equals("JOINING_HOST_CANNOT_BE_MASTER_OF_OTHER_HOSTS")) { throw new Types.JoiningHostCannotBeMasterOfOtherHosts(); } - if (ErrorDescription[0].equals("HOST_HAS_RESIDENT_VMS")) + if (ErrorDescription[0].equals("IMPORT_ERROR_CANNOT_HANDLE_CHUNKED")) { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.HostHasResidentVms(p1); + throw new Types.ImportErrorCannotHandleChunked(); } - if (ErrorDescription[0].equals("VM_CHECKPOINT_SUSPEND_FAILED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VmCheckpointSuspendFailed(p1); - } - if (ErrorDescription[0].equals("PIF_IS_MANAGEMENT_INTERFACE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.PifIsManagementInterface(p1); - } - if (ErrorDescription[0].equals("MAC_INVALID")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.MacInvalid(p1); - } - if (ErrorDescription[0].equals("XEN_VSS_REQ_ERROR_START_SNAPSHOT_SET_FAILED")) + if (ErrorDescription[0].equals("POOL_AUTH_ENABLE_FAILED_WRONG_CREDENTIALS")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.XenVssReqErrorStartSnapshotSetFailed(p1, p2); + throw new Types.PoolAuthEnableFailedWrongCredentials(p1, p2); } - if (ErrorDescription[0].equals("VBD_IS_EMPTY")) + if (ErrorDescription[0].equals("ONLY_ALLOWED_ON_OEM_EDITION")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VbdIsEmpty(p1); - } - if (ErrorDescription[0].equals("PATCH_PRECHECK_FAILED_WRONG_SERVER_VERSION")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; - throw new Types.PatchPrecheckFailedWrongServerVersion(p1, p2, p3); - } - if (ErrorDescription[0].equals("CANNOT_FIND_STATE_PARTITION")) - { - throw new Types.CannotFindStatePartition(); - } - if (ErrorDescription[0].equals("WLB_AUTHENTICATION_FAILED")) - { - throw new Types.WlbAuthenticationFailed(); - } - if (ErrorDescription[0].equals("AUTH_UNKNOWN_TYPE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.AuthUnknownType(p1); - } - if (ErrorDescription[0].equals("NOT_IN_EMERGENCY_MODE")) - { - throw new Types.NotInEmergencyMode(); - } - if (ErrorDescription[0].equals("AUTH_DISABLE_FAILED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.AuthDisableFailed(p1); - } - if (ErrorDescription[0].equals("NETWORK_ALREADY_CONNECTED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.NetworkAlreadyConnected(p1, p2); - } - if (ErrorDescription[0].equals("VDI_INCOMPATIBLE_TYPE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.VdiIncompatibleType(p1, p2); - } - if (ErrorDescription[0].equals("WLB_UNKNOWN_HOST")) - { - throw new Types.WlbUnknownHost(); - } - if (ErrorDescription[0].equals("IMPORT_ERROR")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.ImportError(p1); - } - if (ErrorDescription[0].equals("SR_UNKNOWN_DRIVER")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.SrUnknownDriver(p1); - } - if (ErrorDescription[0].equals("AUTH_DISABLE_FAILED_WRONG_CREDENTIALS")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.AuthDisableFailedWrongCredentials(p1); - } - if (ErrorDescription[0].equals("VM_HALTED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VmHalted(p1); - } - if (ErrorDescription[0].equals("FEATURE_RESTRICTED")) - { - throw new Types.FeatureRestricted(); - } - if (ErrorDescription[0].equals("VDI_CONTAINS_METADATA_OF_THIS_POOL")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.VdiContainsMetadataOfThisPool(p1, p2); - } - if (ErrorDescription[0].equals("CRL_NAME_INVALID")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.CrlNameInvalid(p1); - } - if (ErrorDescription[0].equals("VDI_NOT_SPARSE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VdiNotSparse(p1); - } - if (ErrorDescription[0].equals("VDI_TOO_SMALL")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.VdiTooSmall(p1, p2); - } - if (ErrorDescription[0].equals("HOST_POWER_ON_MODE_DISABLED")) - { - throw new Types.HostPowerOnModeDisabled(); - } - if (ErrorDescription[0].equals("ACTIVATION_WHILE_NOT_FREE")) - { - throw new Types.ActivationWhileNotFree(); - } - if (ErrorDescription[0].equals("XENAPI_PLUGIN_FAILURE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; - throw new Types.XenapiPluginFailure(p1, p2, p3); - } - if (ErrorDescription[0].equals("MAC_STILL_EXISTS")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.MacStillExists(p1); + throw new Types.OnlyAllowedOnOemEdition(p1); } if (ErrorDescription[0].equals("HOST_IN_USE")) { @@ -1317,611 +1640,152 @@ public class Types String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; throw new Types.HostInUse(p1, p2, p3); } - if (ErrorDescription[0].equals("HA_TOO_FEW_HOSTS")) + if (ErrorDescription[0].equals("VM_CHECKPOINT_SUSPEND_FAILED")) { - throw new Types.HaTooFewHosts(); + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VmCheckpointSuspendFailed(p1); } - if (ErrorDescription[0].equals("WLB_CONNECTION_RESET")) + if (ErrorDescription[0].equals("PATCH_ALREADY_APPLIED")) { - throw new Types.WlbConnectionReset(); + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.PatchAlreadyApplied(p1); } - if (ErrorDescription[0].equals("POOL_AUTH_ENABLE_FAILED_WRONG_CREDENTIALS")) + if (ErrorDescription[0].equals("DEVICE_NOT_ATTACHED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.DeviceNotAttached(p1); + } + if (ErrorDescription[0].equals("POOL_AUTH_ENABLE_FAILED")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.PoolAuthEnableFailedWrongCredentials(p1, p2); + throw new Types.PoolAuthEnableFailed(p1, p2); } - if (ErrorDescription[0].equals("PATCH_IS_APPLIED")) - { - throw new Types.PatchIsApplied(); - } - if (ErrorDescription[0].equals("SR_HAS_PBD")) + if (ErrorDescription[0].equals("VDI_IN_USE")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.SrHasPbd(p1); - } - if (ErrorDescription[0].equals("OPERATION_PARTIALLY_FAILED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.OperationPartiallyFailed(p1); - } - if (ErrorDescription[0].equals("WLB_MALFORMED_REQUEST")) - { - throw new Types.WlbMalformedRequest(); - } - if (ErrorDescription[0].equals("HOST_STILL_BOOTING")) - { - throw new Types.HostStillBooting(); - } - if (ErrorDescription[0].equals("CANNOT_DESTROY_SYSTEM_NETWORK")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.CannotDestroySystemNetwork(p1); - } - if (ErrorDescription[0].equals("OBJECT_NOLONGER_EXISTS")) - { - throw new Types.ObjectNolongerExists(); - } - if (ErrorDescription[0].equals("VDI_NOT_IN_MAP")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VdiNotInMap(p1); - } - if (ErrorDescription[0].equals("HOSTS_NOT_HOMOGENEOUS")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.HostsNotHomogeneous(p1); - } - if (ErrorDescription[0].equals("POOL_JOINING_HOST_MUST_HAVE_SAME_PRODUCT_VERSION")) - { - throw new Types.PoolJoiningHostMustHaveSameProductVersion(); - } - if (ErrorDescription[0].equals("PIF_VLAN_EXISTS")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.PifVlanExists(p1); - } - if (ErrorDescription[0].equals("LICENSE_CHECKOUT_ERROR")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.LicenseCheckoutError(p1); - } - if (ErrorDescription[0].equals("CERTIFICATE_LIBRARY_CORRUPT")) - { - throw new Types.CertificateLibraryCorrupt(); - } - if (ErrorDescription[0].equals("VDI_NOT_MANAGED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VdiNotManaged(p1); - } - if (ErrorDescription[0].equals("INVALID_EDITION")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.InvalidEdition(p1); - } - if (ErrorDescription[0].equals("PATCH_ALREADY_EXISTS")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.PatchAlreadyExists(p1); - } - if (ErrorDescription[0].equals("OUT_OF_SPACE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.OutOfSpace(p1); - } - if (ErrorDescription[0].equals("IMPORT_ERROR_PREMATURE_EOF")) - { - throw new Types.ImportErrorPrematureEof(); - } - if (ErrorDescription[0].equals("NOT_SYSTEM_DOMAIN")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.NotSystemDomain(p1); - } - if (ErrorDescription[0].equals("VM_MEMORY_SIZE_TOO_LOW")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VmMemorySizeTooLow(p1); - } - if (ErrorDescription[0].equals("VMPP_HAS_VM")) - { - throw new Types.VmppHasVm(); + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.VdiInUse(p1, p2); } if (ErrorDescription[0].equals("HOST_NOT_DISABLED")) { throw new Types.HostNotDisabled(); } - if (ErrorDescription[0].equals("FIELD_TYPE_ERROR")) + if (ErrorDescription[0].equals("FEATURE_RESTRICTED")) { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.FieldTypeError(p1); + throw new Types.FeatureRestricted(); } - if (ErrorDescription[0].equals("SLAVE_REQUIRES_MANAGEMENT_INTERFACE")) - { - throw new Types.SlaveRequiresManagementInterface(); - } - if (ErrorDescription[0].equals("VM_IS_TEMPLATE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VmIsTemplate(p1); - } - if (ErrorDescription[0].equals("VM_IS_PROTECTED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VmIsProtected(p1); - } - if (ErrorDescription[0].equals("JOINING_HOST_CANNOT_HAVE_RUNNING_VMS")) - { - throw new Types.JoiningHostCannotHaveRunningVms(); - } - if (ErrorDescription[0].equals("VM_REQUIRES_VDI")) + if (ErrorDescription[0].equals("VM_REQUIRES_SR")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.VmRequiresVdi(p1, p2); + throw new Types.VmRequiresSr(p1, p2); } - if (ErrorDescription[0].equals("VBD_CDS_MUST_BE_READONLY")) - { - throw new Types.VbdCdsMustBeReadonly(); - } - if (ErrorDescription[0].equals("LICENSE_FILE_DEPRECATED")) - { - throw new Types.LicenseFileDeprecated(); - } - if (ErrorDescription[0].equals("CANNOT_CREATE_STATE_FILE")) - { - throw new Types.CannotCreateStateFile(); - } - if (ErrorDescription[0].equals("JOINING_HOST_CANNOT_HAVE_VMS_WITH_CURRENT_OPERATIONS")) - { - throw new Types.JoiningHostCannotHaveVmsWithCurrentOperations(); - } - if (ErrorDescription[0].equals("MESSAGE_PARAMETER_COUNT_MISMATCH")) + if (ErrorDescription[0].equals("BOOTLOADER_FAILED")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; - throw new Types.MessageParameterCountMismatch(p1, p2, p3); + throw new Types.BootloaderFailed(p1, p2); } - if (ErrorDescription[0].equals("POOL_AUTH_ALREADY_ENABLED")) + if (ErrorDescription[0].equals("PIF_HAS_NO_NETWORK_CONFIGURATION")) + { + throw new Types.PifHasNoNetworkConfiguration(); + } + if (ErrorDescription[0].equals("PIF_TUNNEL_STILL_EXISTS")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.PoolAuthAlreadyEnabled(p1); - } - if (ErrorDescription[0].equals("RESTORE_INCOMPATIBLE_VERSION")) - { - throw new Types.RestoreIncompatibleVersion(); - } - if (ErrorDescription[0].equals("DEVICE_DETACH_REJECTED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; - throw new Types.DeviceDetachRejected(p1, p2, p3); - } - if (ErrorDescription[0].equals("AUTH_IS_DISABLED")) - { - throw new Types.AuthIsDisabled(); - } - if (ErrorDescription[0].equals("JOINING_HOST_CANNOT_HAVE_RUNNING_OR_SUSPENDED_VMS")) - { - throw new Types.JoiningHostCannotHaveRunningOrSuspendedVms(); - } - if (ErrorDescription[0].equals("PATCH_PRECHECK_FAILED_PREREQUISITE_MISSING")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.PatchPrecheckFailedPrerequisiteMissing(p1, p2); - } - if (ErrorDescription[0].equals("VM_HAS_PCI_ATTACHED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VmHasPciAttached(p1); - } - if (ErrorDescription[0].equals("MIRROR_FAILED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.MirrorFailed(p1); - } - if (ErrorDescription[0].equals("WLB_XENSERVER_TIMEOUT")) - { - throw new Types.WlbXenserverTimeout(); - } - if (ErrorDescription[0].equals("POOL_AUTH_DISABLE_FAILED_WRONG_CREDENTIALS")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.PoolAuthDisableFailedWrongCredentials(p1, p2); - } - if (ErrorDescription[0].equals("VM_SNAPSHOT_WITH_QUIESCE_FAILED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VmSnapshotWithQuiesceFailed(p1); - } - if (ErrorDescription[0].equals("CERTIFICATE_CORRUPT")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.CertificateCorrupt(p1); - } - if (ErrorDescription[0].equals("WLB_INTERNAL_ERROR")) - { - throw new Types.WlbInternalError(); - } - if (ErrorDescription[0].equals("VM_REBOOTED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VmRebooted(p1); - } - if (ErrorDescription[0].equals("CANNOT_CONTACT_HOST")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.CannotContactHost(p1); - } - if (ErrorDescription[0].equals("XEN_VSS_REQ_ERROR_NO_VOLUMES_SUPPORTED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.XenVssReqErrorNoVolumesSupported(p1, p2); - } - if (ErrorDescription[0].equals("HOST_ITS_OWN_SLAVE")) - { - throw new Types.HostItsOwnSlave(); - } - if (ErrorDescription[0].equals("CANNOT_ADD_VLAN_TO_BOND_SLAVE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.CannotAddVlanToBondSlave(p1); - } - if (ErrorDescription[0].equals("REDO_LOG_IS_ENABLED")) - { - throw new Types.RedoLogIsEnabled(); - } - if (ErrorDescription[0].equals("VM_MISSING_PV_DRIVERS")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VmMissingPvDrivers(p1); - } - if (ErrorDescription[0].equals("CERTIFICATE_NAME_INVALID")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.CertificateNameInvalid(p1); + throw new Types.PifTunnelStillExists(p1); } if (ErrorDescription[0].equals("IMPORT_ERROR_FAILED_TO_FIND_OBJECT")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; throw new Types.ImportErrorFailedToFindObject(p1); } - if (ErrorDescription[0].equals("VDI_LOCATION_MISSING")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.VdiLocationMissing(p1, p2); - } - if (ErrorDescription[0].equals("AUTH_ENABLE_FAILED_PERMISSION_DENIED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.AuthEnableFailedPermissionDenied(p1); - } - if (ErrorDescription[0].equals("PIF_VLAN_STILL_EXISTS")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.PifVlanStillExists(p1); - } - if (ErrorDescription[0].equals("VMS_FAILED_TO_COOPERATE")) - { - throw new Types.VmsFailedToCooperate(); - } - if (ErrorDescription[0].equals("TOO_MANY_STORAGE_MIGRATES")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.TooManyStorageMigrates(p1); - } - if (ErrorDescription[0].equals("NETWORK_CONTAINS_VIF")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.NetworkContainsVif(p1); - } - if (ErrorDescription[0].equals("INVALID_VALUE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.InvalidValue(p1, p2); - } - if (ErrorDescription[0].equals("XENAPI_MISSING_PLUGIN")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.XenapiMissingPlugin(p1); - } - if (ErrorDescription[0].equals("RESTORE_TARGET_MGMT_IF_NOT_IN_BACKUP")) - { - throw new Types.RestoreTargetMgmtIfNotInBackup(); - } - if (ErrorDescription[0].equals("IS_TUNNEL_ACCESS_PIF")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.IsTunnelAccessPif(p1); - } - if (ErrorDescription[0].equals("JOINING_HOST_CONNECTION_FAILED")) - { - throw new Types.JoiningHostConnectionFailed(); - } - if (ErrorDescription[0].equals("SUBJECT_CANNOT_BE_RESOLVED")) - { - throw new Types.SubjectCannotBeResolved(); - } - if (ErrorDescription[0].equals("XEN_VSS_REQ_ERROR_ADDING_VOLUME_TO_SNAPSET_FAILED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.XenVssReqErrorAddingVolumeToSnapsetFailed(p1, p2); - } - if (ErrorDescription[0].equals("PROVISION_FAILED_OUT_OF_SPACE")) - { - throw new Types.ProvisionFailedOutOfSpace(); - } if (ErrorDescription[0].equals("VDI_NEEDS_VM_FOR_MIGRATE")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; throw new Types.VdiNeedsVmForMigrate(p1); } - if (ErrorDescription[0].equals("COULD_NOT_IMPORT_DATABASE")) + if (ErrorDescription[0].equals("SR_OPERATION_NOT_SUPPORTED")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.CouldNotImportDatabase(p1); + throw new Types.SrOperationNotSupported(p1); } - if (ErrorDescription[0].equals("VDI_IS_NOT_ISO")) + if (ErrorDescription[0].equals("VM_SNAPSHOT_WITH_QUIESCE_PLUGIN_DEOS_NOT_RESPOND")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.VdiIsNotIso(p1, p2); + throw new Types.VmSnapshotWithQuiescePluginDeosNotRespond(p1); } - if (ErrorDescription[0].equals("MESSAGE_METHOD_UNKNOWN")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.MessageMethodUnknown(p1); - } - if (ErrorDescription[0].equals("VM_CANNOT_DELETE_DEFAULT_TEMPLATE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VmCannotDeleteDefaultTemplate(p1); - } - if (ErrorDescription[0].equals("ROLE_NOT_FOUND")) - { - throw new Types.RoleNotFound(); - } - if (ErrorDescription[0].equals("NOT_ALLOWED_ON_OEM_EDITION")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.NotAllowedOnOemEdition(p1); - } - if (ErrorDescription[0].equals("RESTORE_SCRIPT_FAILED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.RestoreScriptFailed(p1); - } - if (ErrorDescription[0].equals("INTERNAL_ERROR")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.InternalError(p1); - } - if (ErrorDescription[0].equals("LICENSE_DOES_NOT_SUPPORT_XHA")) - { - throw new Types.LicenseDoesNotSupportXha(); - } - if (ErrorDescription[0].equals("PIF_INCOMPATIBLE_PRIMARY_ADDRESS_TYPE")) - { - throw new Types.PifIncompatiblePrimaryAddressType(); - } - if (ErrorDescription[0].equals("DEVICE_ALREADY_DETACHED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.DeviceAlreadyDetached(p1); - } - if (ErrorDescription[0].equals("AUTH_ENABLE_FAILED_UNAVAILABLE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.AuthEnableFailedUnavailable(p1); - } - if (ErrorDescription[0].equals("VBD_NOT_REMOVABLE_MEDIA")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VbdNotRemovableMedia(p1); - } - if (ErrorDescription[0].equals("LOCATION_NOT_UNIQUE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.LocationNotUnique(p1, p2); - } - if (ErrorDescription[0].equals("NOT_IMPLEMENTED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.NotImplemented(p1); - } - if (ErrorDescription[0].equals("CANNOT_PLUG_VIF")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.CannotPlugVif(p1); - } - if (ErrorDescription[0].equals("USER_IS_NOT_LOCAL_SUPERUSER")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.UserIsNotLocalSuperuser(p1); - } - if (ErrorDescription[0].equals("BACKUP_SCRIPT_FAILED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.BackupScriptFailed(p1); - } - if (ErrorDescription[0].equals("IMPORT_ERROR_UNEXPECTED_FILE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.ImportErrorUnexpectedFile(p1, p2); - } - if (ErrorDescription[0].equals("AUTH_ALREADY_ENABLED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.AuthAlreadyEnabled(p1, p2); - } - if (ErrorDescription[0].equals("OPERATION_NOT_ALLOWED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.OperationNotAllowed(p1); - } - if (ErrorDescription[0].equals("HA_NO_PLAN")) - { - throw new Types.HaNoPlan(); - } - if (ErrorDescription[0].equals("EVENTS_LOST")) - { - throw new Types.EventsLost(); - } - if (ErrorDescription[0].equals("SR_BACKEND_FAILURE")) + if (ErrorDescription[0].equals("XAPI_HOOK_FAILED")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; - throw new Types.SrBackendFailure(p1, p2, p3); + String p4 = ErrorDescription.length > 4 ? ErrorDescription[4] : ""; + throw new Types.XapiHookFailed(p1, p2, p3, p4); } - if (ErrorDescription[0].equals("DEVICE_DETACH_TIMEOUT")) + if (ErrorDescription[0].equals("REDO_LOG_IS_ENABLED")) { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.DeviceDetachTimeout(p1, p2); - } - if (ErrorDescription[0].equals("VM_DUPLICATE_VBD_DEVICE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; - throw new Types.VmDuplicateVbdDevice(p1, p2, p3); - } - if (ErrorDescription[0].equals("CANNOT_PLUG_BOND_SLAVE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.CannotPlugBondSlave(p1); - } - if (ErrorDescription[0].equals("VM_TO_IMPORT_IS_NOT_NEWER_VERSION")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; - throw new Types.VmToImportIsNotNewerVersion(p1, p2, p3); - } - if (ErrorDescription[0].equals("CRL_CORRUPT")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.CrlCorrupt(p1); - } - if (ErrorDescription[0].equals("VM_OLD_PV_DRIVERS")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; - throw new Types.VmOldPvDrivers(p1, p2, p3); - } - if (ErrorDescription[0].equals("PIF_DOES_NOT_ALLOW_UNPLUG")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.PifDoesNotAllowUnplug(p1); - } - if (ErrorDescription[0].equals("CHANGE_PASSWORD_REJECTED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.ChangePasswordRejected(p1); - } - if (ErrorDescription[0].equals("OTHER_OPERATION_IN_PROGRESS")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.OtherOperationInProgress(p1, p2); - } - if (ErrorDescription[0].equals("XEN_VSS_REQ_ERROR_INIT_FAILED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.XenVssReqErrorInitFailed(p1, p2); - } - if (ErrorDescription[0].equals("CPU_FEATURE_MASKING_NOT_SUPPORTED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.CpuFeatureMaskingNotSupported(p1); - } - if (ErrorDescription[0].equals("VM_NOT_RESIDENT_HERE")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.VmNotResidentHere(p1, p2); + throw new Types.RedoLogIsEnabled(); } if (ErrorDescription[0].equals("HOST_OFFLINE")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; throw new Types.HostOffline(p1); } - if (ErrorDescription[0].equals("POOL_AUTH_DISABLE_FAILED")) + if (ErrorDescription[0].equals("CRL_ALREADY_EXISTS")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.CrlAlreadyExists(p1); + } + if (ErrorDescription[0].equals("SSL_VERIFY_ERROR")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.SslVerifyError(p1); + } + if (ErrorDescription[0].equals("AUTH_UNKNOWN_TYPE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.AuthUnknownType(p1); + } + if (ErrorDescription[0].equals("PIF_HAS_NO_V6_NETWORK_CONFIGURATION")) + { + throw new Types.PifHasNoV6NetworkConfiguration(); + } + if (ErrorDescription[0].equals("HA_SHOULD_BE_FENCED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.HaShouldBeFenced(p1); + } + if (ErrorDescription[0].equals("OUT_OF_SPACE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.OutOfSpace(p1); + } + if (ErrorDescription[0].equals("SR_HAS_NO_PBDS")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.SrHasNoPbds(p1); + } + if (ErrorDescription[0].equals("RBAC_PERMISSION_DENIED")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.PoolAuthDisableFailed(p1, p2); + throw new Types.RbacPermissionDenied(p1, p2); } - if (ErrorDescription[0].equals("HOST_HAS_NO_MANAGEMENT_IP")) + if (ErrorDescription[0].equals("HA_HOST_CANNOT_ACCESS_STATEFILE")) { - throw new Types.HostHasNoManagementIp(); + throw new Types.HaHostCannotAccessStatefile(); } - if (ErrorDescription[0].equals("TRANSPORT_PIF_NOT_CONFIGURED")) + if (ErrorDescription[0].equals("WLB_TIMEOUT")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.TransportPifNotConfigured(p1); + throw new Types.WlbTimeout(p1); } - if (ErrorDescription[0].equals("HA_IS_ENABLED")) - { - throw new Types.HaIsEnabled(); - } - if (ErrorDescription[0].equals("VM_REVERT_FAILED")) + if (ErrorDescription[0].equals("HA_ABORT_NEW_MASTER")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.VmRevertFailed(p1, p2); - } - if (ErrorDescription[0].equals("HOST_NAME_INVALID")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.HostNameInvalid(p1); - } - if (ErrorDescription[0].equals("DOMAIN_EXISTS")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; - throw new Types.DomainExists(p1, p2); - } - if (ErrorDescription[0].equals("HA_POOL_IS_ENABLED_BUT_HOST_IS_DISABLED")) - { - throw new Types.HaPoolIsEnabledButHostIsDisabled(); - } - if (ErrorDescription[0].equals("MESSAGE_DEPRECATED")) - { - throw new Types.MessageDeprecated(); - } - if (ErrorDescription[0].equals("HA_CONSTRAINT_VIOLATION_SR_NOT_SHARED")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.HaConstraintViolationSrNotShared(p1); - } - if (ErrorDescription[0].equals("IMPORT_ERROR_CANNOT_HANDLE_CHUNKED")) - { - throw new Types.ImportErrorCannotHandleChunked(); - } - if (ErrorDescription[0].equals("VM_ATTACHED_TO_MORE_THAN_ONE_VDI_WITH_TIMEOFFSET_MARKED_AS_RESET_ON_BOOT")) - { - String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.VmAttachedToMoreThanOneVdiWithTimeoffsetMarkedAsResetOnBoot(p1); - } - if (ErrorDescription[0].equals("NOT_SUPPORTED_DURING_UPGRADE")) - { - throw new Types.NotSupportedDuringUpgrade(); + throw new Types.HaAbortNewMaster(p1); } if (ErrorDescription[0].equals("PIF_CONFIGURATION_ERROR")) { @@ -1929,19 +1793,213 @@ public class Types String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; throw new Types.PifConfigurationError(p1, p2); } - if (ErrorDescription[0].equals("INTERFACE_HAS_NO_IP")) + if (ErrorDescription[0].equals("VM_HAS_TOO_MANY_SNAPSHOTS")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.InterfaceHasNoIp(p1); + throw new Types.VmHasTooManySnapshots(p1); } - if (ErrorDescription[0].equals("HOSTS_NOT_COMPATIBLE")) + if (ErrorDescription[0].equals("PATCH_IS_APPLIED")) { - throw new Types.HostsNotCompatible(); + throw new Types.PatchIsApplied(); } - if (ErrorDescription[0].equals("AUTH_ENABLE_FAILED_WRONG_CREDENTIALS")) + if (ErrorDescription[0].equals("MIRROR_FAILED")) { String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; - throw new Types.AuthEnableFailedWrongCredentials(p1); + throw new Types.MirrorFailed(p1); + } + if (ErrorDescription[0].equals("AUTH_DISABLE_FAILED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.AuthDisableFailed(p1); + } + if (ErrorDescription[0].equals("PIF_IS_MANAGEMENT_INTERFACE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.PifIsManagementInterface(p1); + } + if (ErrorDescription[0].equals("CERTIFICATE_DOES_NOT_EXIST")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.CertificateDoesNotExist(p1); + } + if (ErrorDescription[0].equals("NETWORK_CONTAINS_VIF")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.NetworkContainsVif(p1); + } + if (ErrorDescription[0].equals("CANNOT_RESET_CONTROL_DOMAIN")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.CannotResetControlDomain(p1); + } + if (ErrorDescription[0].equals("WLB_AUTHENTICATION_FAILED")) + { + throw new Types.WlbAuthenticationFailed(); + } + if (ErrorDescription[0].equals("WLB_URL_INVALID")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.WlbUrlInvalid(p1); + } + if (ErrorDescription[0].equals("HA_CONSTRAINT_VIOLATION_SR_NOT_SHARED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.HaConstraintViolationSrNotShared(p1); + } + if (ErrorDescription[0].equals("VM_NO_VCPUS")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VmNoVcpus(p1); + } + if (ErrorDescription[0].equals("VM_HAS_CHECKPOINT")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VmHasCheckpoint(p1); + } + if (ErrorDescription[0].equals("VBD_TRAY_LOCKED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VbdTrayLocked(p1); + } + if (ErrorDescription[0].equals("HOST_CANNOT_READ_METRICS")) + { + throw new Types.HostCannotReadMetrics(); + } + if (ErrorDescription[0].equals("WLB_MALFORMED_RESPONSE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; + throw new Types.WlbMalformedResponse(p1, p2, p3); + } + if (ErrorDescription[0].equals("MISSING_CONNECTION_DETAILS")) + { + throw new Types.MissingConnectionDetails(); + } + if (ErrorDescription[0].equals("PGPU_INSUFFICIENT_CAPACITY_FOR_VGPU")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.PgpuInsufficientCapacityForVgpu(p1, p2); + } + if (ErrorDescription[0].equals("VBD_CDS_MUST_BE_READONLY")) + { + throw new Types.VbdCdsMustBeReadonly(); + } + if (ErrorDescription[0].equals("VM_SHUTDOWN_TIMEOUT")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.VmShutdownTimeout(p1, p2); + } + if (ErrorDescription[0].equals("POOL_AUTH_DISABLE_FAILED_PERMISSION_DENIED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.PoolAuthDisableFailedPermissionDenied(p1, p2); + } + if (ErrorDescription[0].equals("IMPORT_ERROR")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.ImportError(p1); + } + if (ErrorDescription[0].equals("WLB_NOT_INITIALIZED")) + { + throw new Types.WlbNotInitialized(); + } + if (ErrorDescription[0].equals("VLAN_TAG_INVALID")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.VlanTagInvalid(p1); + } + if (ErrorDescription[0].equals("NO_MORE_REDO_LOGS_ALLOWED")) + { + throw new Types.NoMoreRedoLogsAllowed(); + } + if (ErrorDescription[0].equals("PBD_EXISTS")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; + throw new Types.PbdExists(p1, p2, p3); + } + if (ErrorDescription[0].equals("AUTH_DISABLE_FAILED_PERMISSION_DENIED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.AuthDisableFailedPermissionDenied(p1); + } + if (ErrorDescription[0].equals("POOL_AUTH_ALREADY_ENABLED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.PoolAuthAlreadyEnabled(p1); + } + if (ErrorDescription[0].equals("NO_HOSTS_AVAILABLE")) + { + throw new Types.NoHostsAvailable(); + } + if (ErrorDescription[0].equals("SR_HAS_MULTIPLE_PBDS")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.SrHasMultiplePbds(p1); + } + if (ErrorDescription[0].equals("XEN_VSS_REQ_ERROR_PREPARING_WRITERS")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.XenVssReqErrorPreparingWriters(p1, p2); + } + if (ErrorDescription[0].equals("XENAPI_PLUGIN_FAILURE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; + throw new Types.XenapiPluginFailure(p1, p2, p3); + } + if (ErrorDescription[0].equals("CANNOT_ADD_TUNNEL_TO_BOND_SLAVE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.CannotAddTunnelToBondSlave(p1); + } + if (ErrorDescription[0].equals("HOST_POWER_ON_MODE_DISABLED")) + { + throw new Types.HostPowerOnModeDisabled(); + } + if (ErrorDescription[0].equals("ILLEGAL_VBD_DEVICE")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + throw new Types.IllegalVbdDevice(p1, p2); + } + if (ErrorDescription[0].equals("VM_REQUIRES_VGPU")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + String p2 = ErrorDescription.length > 2 ? ErrorDescription[2] : ""; + String p3 = ErrorDescription.length > 3 ? ErrorDescription[3] : ""; + throw new Types.VmRequiresVgpu(p1, p2, p3); + } + if (ErrorDescription[0].equals("INVALID_PATCH_WITH_LOG")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.InvalidPatchWithLog(p1); + } + if (ErrorDescription[0].equals("PIF_IS_VLAN")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.PifIsVlan(p1); + } + if (ErrorDescription[0].equals("HA_CANNOT_CHANGE_BOND_STATUS_OF_MGMT_IFACE")) + { + throw new Types.HaCannotChangeBondStatusOfMgmtIface(); + } + if (ErrorDescription[0].equals("NOT_SYSTEM_DOMAIN")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.NotSystemDomain(p1); + } + if (ErrorDescription[0].equals("HA_NOT_INSTALLED")) + { + String p1 = ErrorDescription.length > 1 ? ErrorDescription[1] : ""; + throw new Types.HaNotInstalled(p1); } // An unknown error occurred @@ -1951,6 +2009,29 @@ public class Types throw new BadServerResponse(response); } + public enum AllocationAlgorithm { + /** + * The value does not belong to this enumeration + */ + UNRECOGNIZED, + /** + * vGPUs of a given type are allocated evenly across supporting pGPUs. + */ + BREADTH_FIRST, + /** + * vGPUs of a given type are allocated on supporting pGPUs until they are full. + */ + DEPTH_FIRST; + public String toString() { + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == BREADTH_FIRST) return "breadth_first"; + if (this == DEPTH_FIRST) return "depth_first"; + /* This can never be reached */ + return "illegal enum"; + } + + }; + public enum VdiOperations { /** * The value does not belong to this enumeration @@ -2005,34 +2086,21 @@ public class Types */ BLOCKED; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == SCAN) - return "scan"; - if (this == CLONE) - return "clone"; - if (this == COPY) - return "copy"; - if (this == RESIZE) - return "resize"; - if (this == RESIZE_ONLINE) - return "resize_online"; - if (this == SNAPSHOT) - return "snapshot"; - if (this == DESTROY) - return "destroy"; - if (this == FORGET) - return "forget"; - if (this == UPDATE) - return "update"; - if (this == FORCE_UNLOCK) - return "force_unlock"; - if (this == GENERATE_CONFIG) - return "generate_config"; - if (this == BLOCKED) - return "blocked"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == SCAN) return "scan"; + if (this == CLONE) return "clone"; + if (this == COPY) return "copy"; + if (this == RESIZE) return "resize"; + if (this == RESIZE_ONLINE) return "resize_online"; + if (this == SNAPSHOT) return "snapshot"; + if (this == DESTROY) return "destroy"; + if (this == FORGET) return "forget"; + if (this == UPDATE) return "update"; + if (this == FORCE_UNLOCK) return "force_unlock"; + if (this == GENERATE_CONFIG) return "generate_config"; + if (this == BLOCKED) return "blocked"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -2063,20 +2131,14 @@ public class Types */ VMPP; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == VM) - return "VM"; - if (this == HOST) - return "Host"; - if (this == SR) - return "SR"; - if (this == POOL) - return "Pool"; - if (this == VMPP) - return "VMPP"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == VM) return "VM"; + if (this == HOST) return "Host"; + if (this == SR) return "SR"; + if (this == POOL) return "Pool"; + if (this == VMPP) return "VMPP"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -2119,26 +2181,17 @@ public class Types */ REDO_LOG; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == SYSTEM) - return "system"; - if (this == USER) - return "user"; - if (this == EPHEMERAL) - return "ephemeral"; - if (this == SUSPEND) - return "suspend"; - if (this == CRASHDUMP) - return "crashdump"; - if (this == HA_STATEFILE) - return "ha_statefile"; - if (this == METADATA) - return "metadata"; - if (this == REDO_LOG) - return "redo_log"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == SYSTEM) return "system"; + if (this == USER) return "user"; + if (this == EPHEMERAL) return "ephemeral"; + if (this == SUSPEND) return "suspend"; + if (this == CRASHDUMP) return "crashdump"; + if (this == HA_STATEFILE) return "ha_statefile"; + if (this == METADATA) return "metadata"; + if (this == REDO_LOG) return "redo_log"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -2165,18 +2218,13 @@ public class Types */ RESTARTXAPI; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == RESTARTHVM) - return "restartHVM"; - if (this == RESTARTPV) - return "restartPV"; - if (this == RESTARTHOST) - return "restartHost"; - if (this == RESTARTXAPI) - return "restartXAPI"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == RESTARTHVM) return "restartHVM"; + if (this == RESTARTPV) return "restartPV"; + if (this == RESTARTHOST) return "restartHost"; + if (this == RESTARTXAPI) return "restartXAPI"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -2199,16 +2247,12 @@ public class Types */ MOD; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == ADD) - return "add"; - if (this == DEL) - return "del"; - if (this == MOD) - return "mod"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == ADD) return "add"; + if (this == DEL) return "del"; + if (this == MOD) return "mod"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -2227,14 +2271,11 @@ public class Types */ IPV6; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == IPV4) - return "IPv4"; - if (this == IPV6) - return "IPv6"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == IPV4) return "IPv4"; + if (this == IPV6) return "IPv6"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -2249,12 +2290,10 @@ public class Types */ CANCEL; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == CANCEL) - return "cancel"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == CANCEL) return "cancel"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -2285,20 +2324,14 @@ public class Types */ CANCELLED; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == PENDING) - return "pending"; - if (this == SUCCESS) - return "success"; - if (this == FAILURE) - return "failure"; - if (this == CANCELLING) - return "cancelling"; - if (this == CANCELLED) - return "cancelled"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == PENDING) return "pending"; + if (this == SUCCESS) return "success"; + if (this == FAILURE) return "failure"; + if (this == CANCELLING) return "cancelling"; + if (this == CANCELLED) return "cancelled"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -2313,12 +2346,10 @@ public class Types */ ATTACHING; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == ATTACHING) - return "attaching"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == ATTACHING) return "attaching"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -2341,16 +2372,12 @@ public class Types */ RDP; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == VT100) - return "vt100"; - if (this == RFB) - return "rfb"; - if (this == RDP) - return "rdp"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == VT100) return "vt100"; + if (this == RFB) return "rfb"; + if (this == RDP) return "rdp"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -2385,22 +2412,15 @@ public class Types */ RENAME_RESTART; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == DESTROY) - return "destroy"; - if (this == COREDUMP_AND_DESTROY) - return "coredump_and_destroy"; - if (this == RESTART) - return "restart"; - if (this == COREDUMP_AND_RESTART) - return "coredump_and_restart"; - if (this == PRESERVE) - return "preserve"; - if (this == RENAME_RESTART) - return "rename_restart"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == DESTROY) return "destroy"; + if (this == COREDUMP_AND_DESTROY) return "coredump_and_destroy"; + if (this == RESTART) return "restart"; + if (this == COREDUMP_AND_RESTART) return "coredump_and_restart"; + if (this == PRESERVE) return "preserve"; + if (this == RENAME_RESTART) return "rename_restart"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -2419,14 +2439,11 @@ public class Types */ CHECKPOINT; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == SNAPSHOT) - return "snapshot"; - if (this == CHECKPOINT) - return "checkpoint"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == SNAPSHOT) return "snapshot"; + if (this == CHECKPOINT) return "checkpoint"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -2445,14 +2462,11 @@ public class Types */ RESTART; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == DESTROY) - return "destroy"; - if (this == RESTART) - return "restart"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == DESTROY) return "destroy"; + if (this == RESTART) return "restart"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -2475,16 +2489,12 @@ public class Types */ UNPLUG; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == ATTACH) - return "attach"; - if (this == PLUG) - return "plug"; - if (this == UNPLUG) - return "unplug"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == ATTACH) return "attach"; + if (this == PLUG) return "plug"; + if (this == UNPLUG) return "unplug"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -2591,7 +2601,7 @@ public class Types */ PIF_METRICS, /** - * + * */ BOND, /** @@ -2673,102 +2683,61 @@ public class Types /** * A virtual GPU (vGPU) */ - VGPU; + VGPU, + /** + * A type of virtual GPU + */ + VGPU_TYPE; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == SESSION) - return "session"; - if (this == AUTH) - return "auth"; - if (this == SUBJECT) - return "subject"; - if (this == ROLE) - return "role"; - if (this == TASK) - return "task"; - if (this == EVENT) - return "event"; - if (this == POOL) - return "pool"; - if (this == POOL_PATCH) - return "pool_patch"; - if (this == VM) - return "VM"; - if (this == VM_METRICS) - return "VM_metrics"; - if (this == VM_GUEST_METRICS) - return "VM_guest_metrics"; - if (this == VMPP) - return "VMPP"; - if (this == VM_APPLIANCE) - return "VM_appliance"; - if (this == DR_TASK) - return "DR_task"; - if (this == HOST) - return "host"; - if (this == HOST_CRASHDUMP) - return "host_crashdump"; - if (this == HOST_PATCH) - return "host_patch"; - if (this == HOST_METRICS) - return "host_metrics"; - if (this == HOST_CPU) - return "host_cpu"; - if (this == NETWORK) - return "network"; - if (this == VIF) - return "VIF"; - if (this == VIF_METRICS) - return "VIF_metrics"; - if (this == PIF) - return "PIF"; - if (this == PIF_METRICS) - return "PIF_metrics"; - if (this == BOND) - return "Bond"; - if (this == VLAN) - return "VLAN"; - if (this == SM) - return "SM"; - if (this == SR) - return "SR"; - if (this == VDI) - return "VDI"; - if (this == VBD) - return "VBD"; - if (this == VBD_METRICS) - return "VBD_metrics"; - if (this == PBD) - return "PBD"; - if (this == CRASHDUMP) - return "crashdump"; - if (this == VTPM) - return "VTPM"; - if (this == CONSOLE) - return "console"; - if (this == USER) - return "user"; - if (this == DATA_SOURCE) - return "data_source"; - if (this == BLOB) - return "blob"; - if (this == MESSAGE) - return "message"; - if (this == SECRET) - return "secret"; - if (this == TUNNEL) - return "tunnel"; - if (this == PCI) - return "PCI"; - if (this == PGPU) - return "PGPU"; - if (this == GPU_GROUP) - return "GPU_group"; - if (this == VGPU) - return "VGPU"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == SESSION) return "session"; + if (this == AUTH) return "auth"; + if (this == SUBJECT) return "subject"; + if (this == ROLE) return "role"; + if (this == TASK) return "task"; + if (this == EVENT) return "event"; + if (this == POOL) return "pool"; + if (this == POOL_PATCH) return "pool_patch"; + if (this == VM) return "VM"; + if (this == VM_METRICS) return "VM_metrics"; + if (this == VM_GUEST_METRICS) return "VM_guest_metrics"; + if (this == VMPP) return "VMPP"; + if (this == VM_APPLIANCE) return "VM_appliance"; + if (this == DR_TASK) return "DR_task"; + if (this == HOST) return "host"; + if (this == HOST_CRASHDUMP) return "host_crashdump"; + if (this == HOST_PATCH) return "host_patch"; + if (this == HOST_METRICS) return "host_metrics"; + if (this == HOST_CPU) return "host_cpu"; + if (this == NETWORK) return "network"; + if (this == VIF) return "VIF"; + if (this == VIF_METRICS) return "VIF_metrics"; + if (this == PIF) return "PIF"; + if (this == PIF_METRICS) return "PIF_metrics"; + if (this == BOND) return "Bond"; + if (this == VLAN) return "VLAN"; + if (this == SM) return "SM"; + if (this == SR) return "SR"; + if (this == VDI) return "VDI"; + if (this == VBD) return "VBD"; + if (this == VBD_METRICS) return "VBD_metrics"; + if (this == PBD) return "PBD"; + if (this == CRASHDUMP) return "crashdump"; + if (this == VTPM) return "VTPM"; + if (this == CONSOLE) return "console"; + if (this == USER) return "user"; + if (this == DATA_SOURCE) return "data_source"; + if (this == BLOB) return "blob"; + if (this == MESSAGE) return "message"; + if (this == SECRET) return "secret"; + if (this == TUNNEL) return "tunnel"; + if (this == PCI) return "PCI"; + if (this == PGPU) return "PGPU"; + if (this == GPU_GROUP) return "GPU_group"; + if (this == VGPU) return "VGPU"; + if (this == VGPU_TYPE) return "VGPU_type"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -2811,26 +2780,17 @@ public class Types */ VM_MIGRATE; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == PROVISION) - return "provision"; - if (this == EVACUATE) - return "evacuate"; - if (this == SHUTDOWN) - return "shutdown"; - if (this == REBOOT) - return "reboot"; - if (this == POWER_ON) - return "power_on"; - if (this == VM_START) - return "vm_start"; - if (this == VM_RESUME) - return "vm_resume"; - if (this == VM_MIGRATE) - return "vm_migrate"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == PROVISION) return "provision"; + if (this == EVACUATE) return "evacuate"; + if (this == SHUTDOWN) return "shutdown"; + if (this == REBOOT) return "reboot"; + if (this == POWER_ON) return "power_on"; + if (this == VM_START) return "vm_start"; + if (this == VM_RESUME) return "vm_resume"; + if (this == VM_MIGRATE) return "vm_migrate"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -2857,18 +2817,13 @@ public class Types */ WEEKLY; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == NEVER) - return "never"; - if (this == ALWAYS_AFTER_BACKUP) - return "always_after_backup"; - if (this == DAILY) - return "daily"; - if (this == WEEKLY) - return "weekly"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == NEVER) return "never"; + if (this == ALWAYS_AFTER_BACKUP) return "always_after_backup"; + if (this == DAILY) return "daily"; + if (this == WEEKLY) return "weekly"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -2891,16 +2846,12 @@ public class Types */ NFS; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == NONE) - return "none"; - if (this == CIFS) - return "cifs"; - if (this == NFS) - return "nfs"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == NONE) return "none"; + if (this == CIFS) return "cifs"; + if (this == NFS) return "nfs"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -2919,14 +2870,11 @@ public class Types */ RW; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == RO) - return "RO"; - if (this == RW) - return "RW"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == RO) return "RO"; + if (this == RW) return "RW"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -2953,18 +2901,13 @@ public class Types */ AUTOCONF; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == NONE) - return "None"; - if (this == DHCP) - return "DHCP"; - if (this == STATIC) - return "Static"; - if (this == AUTOCONF) - return "Autoconf"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == NONE) return "None"; + if (this == DHCP) return "DHCP"; + if (this == STATIC) return "Static"; + if (this == AUTOCONF) return "Autoconf"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -2983,14 +2926,11 @@ public class Types */ DISK; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == CD) - return "CD"; - if (this == DISK) - return "Disk"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == CD) return "CD"; + if (this == DISK) return "Disk"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -3009,14 +2949,11 @@ public class Types */ PERSIST; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == RESET) - return "reset"; - if (this == PERSIST) - return "persist"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == RESET) return "reset"; + if (this == PERSIST) return "persist"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -3043,18 +2980,13 @@ public class Types */ SHUTDOWN; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == START) - return "start"; - if (this == CLEAN_SHUTDOWN) - return "clean_shutdown"; - if (this == HARD_SHUTDOWN) - return "hard_shutdown"; - if (this == SHUTDOWN) - return "shutdown"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == START) return "start"; + if (this == CLEAN_SHUTDOWN) return "clean_shutdown"; + if (this == HARD_SHUTDOWN) return "hard_shutdown"; + if (this == SHUTDOWN) return "shutdown"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -3097,26 +3029,17 @@ public class Types */ UNPAUSE; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == ATTACH) - return "attach"; - if (this == EJECT) - return "eject"; - if (this == INSERT) - return "insert"; - if (this == PLUG) - return "plug"; - if (this == UNPLUG) - return "unplug"; - if (this == UNPLUG_FORCE) - return "unplug_force"; - if (this == PAUSE) - return "pause"; - if (this == UNPAUSE) - return "unpause"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == ATTACH) return "attach"; + if (this == EJECT) return "eject"; + if (this == INSERT) return "insert"; + if (this == PLUG) return "plug"; + if (this == UNPLUG) return "unplug"; + if (this == UNPLUG_FORCE) return "unplug_force"; + if (this == PAUSE) return "pause"; + if (this == UNPAUSE) return "unpause"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -3139,16 +3062,12 @@ public class Types */ WEEKLY; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == HOURLY) - return "hourly"; - if (this == DAILY) - return "daily"; - if (this == WEEKLY) - return "weekly"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == HOURLY) return "hourly"; + if (this == DAILY) return "daily"; + if (this == WEEKLY) return "weekly"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -3167,14 +3086,11 @@ public class Types */ DISABLED; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == UNLOCKED) - return "unlocked"; - if (this == DISABLED) - return "disabled"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == UNLOCKED) return "unlocked"; + if (this == DISABLED) return "disabled"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -3201,18 +3117,13 @@ public class Types */ SUSPENDED; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == HALTED) - return "Halted"; - if (this == PAUSED) - return "Paused"; - if (this == RUNNING) - return "Running"; - if (this == SUSPENDED) - return "Suspended"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == HALTED) return "Halted"; + if (this == PAUSED) return "Paused"; + if (this == RUNNING) return "Running"; + if (this == SUSPENDED) return "Suspended"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -3330,6 +3241,10 @@ public class Types * refers to the operation "query_services" */ QUERY_SERVICES, + /** + * refers to the operation "shutdown" + */ + SHUTDOWN, /** * Changing the memory settings */ @@ -3367,7 +3282,7 @@ public class Types */ CHANGING_VCPUS_LIVE, /** - * + * */ ASSERT_OPERATION_VALID, /** @@ -3375,7 +3290,7 @@ public class Types */ DATA_SOURCE_OP, /** - * + * */ UPDATE_ALLOWED_OPERATIONS, /** @@ -3403,100 +3318,55 @@ public class Types */ DESTROY; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == SNAPSHOT) - return "snapshot"; - if (this == CLONE) - return "clone"; - if (this == COPY) - return "copy"; - if (this == CREATE_TEMPLATE) - return "create_template"; - if (this == REVERT) - return "revert"; - if (this == CHECKPOINT) - return "checkpoint"; - if (this == SNAPSHOT_WITH_QUIESCE) - return "snapshot_with_quiesce"; - if (this == PROVISION) - return "provision"; - if (this == START) - return "start"; - if (this == START_ON) - return "start_on"; - if (this == PAUSE) - return "pause"; - if (this == UNPAUSE) - return "unpause"; - if (this == CLEAN_SHUTDOWN) - return "clean_shutdown"; - if (this == CLEAN_REBOOT) - return "clean_reboot"; - if (this == HARD_SHUTDOWN) - return "hard_shutdown"; - if (this == POWER_STATE_RESET) - return "power_state_reset"; - if (this == HARD_REBOOT) - return "hard_reboot"; - if (this == SUSPEND) - return "suspend"; - if (this == CSVM) - return "csvm"; - if (this == RESUME) - return "resume"; - if (this == RESUME_ON) - return "resume_on"; - if (this == POOL_MIGRATE) - return "pool_migrate"; - if (this == MIGRATE_SEND) - return "migrate_send"; - if (this == GET_BOOT_RECORD) - return "get_boot_record"; - if (this == SEND_SYSRQ) - return "send_sysrq"; - if (this == SEND_TRIGGER) - return "send_trigger"; - if (this == QUERY_SERVICES) - return "query_services"; - if (this == CHANGING_MEMORY_LIVE) - return "changing_memory_live"; - if (this == AWAITING_MEMORY_LIVE) - return "awaiting_memory_live"; - if (this == CHANGING_DYNAMIC_RANGE) - return "changing_dynamic_range"; - if (this == CHANGING_STATIC_RANGE) - return "changing_static_range"; - if (this == CHANGING_MEMORY_LIMITS) - return "changing_memory_limits"; - if (this == CHANGING_SHADOW_MEMORY) - return "changing_shadow_memory"; - if (this == CHANGING_SHADOW_MEMORY_LIVE) - return "changing_shadow_memory_live"; - if (this == CHANGING_VCPUS) - return "changing_VCPUs"; - if (this == CHANGING_VCPUS_LIVE) - return "changing_VCPUs_live"; - if (this == ASSERT_OPERATION_VALID) - return "assert_operation_valid"; - if (this == DATA_SOURCE_OP) - return "data_source_op"; - if (this == UPDATE_ALLOWED_OPERATIONS) - return "update_allowed_operations"; - if (this == MAKE_INTO_TEMPLATE) - return "make_into_template"; - if (this == IMPORT) - return "import"; - if (this == EXPORT) - return "export"; - if (this == METADATA_EXPORT) - return "metadata_export"; - if (this == REVERTING) - return "reverting"; - if (this == DESTROY) - return "destroy"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == SNAPSHOT) return "snapshot"; + if (this == CLONE) return "clone"; + if (this == COPY) return "copy"; + if (this == CREATE_TEMPLATE) return "create_template"; + if (this == REVERT) return "revert"; + if (this == CHECKPOINT) return "checkpoint"; + if (this == SNAPSHOT_WITH_QUIESCE) return "snapshot_with_quiesce"; + if (this == PROVISION) return "provision"; + if (this == START) return "start"; + if (this == START_ON) return "start_on"; + if (this == PAUSE) return "pause"; + if (this == UNPAUSE) return "unpause"; + if (this == CLEAN_SHUTDOWN) return "clean_shutdown"; + if (this == CLEAN_REBOOT) return "clean_reboot"; + if (this == HARD_SHUTDOWN) return "hard_shutdown"; + if (this == POWER_STATE_RESET) return "power_state_reset"; + if (this == HARD_REBOOT) return "hard_reboot"; + if (this == SUSPEND) return "suspend"; + if (this == CSVM) return "csvm"; + if (this == RESUME) return "resume"; + if (this == RESUME_ON) return "resume_on"; + if (this == POOL_MIGRATE) return "pool_migrate"; + if (this == MIGRATE_SEND) return "migrate_send"; + if (this == GET_BOOT_RECORD) return "get_boot_record"; + if (this == SEND_SYSRQ) return "send_sysrq"; + if (this == SEND_TRIGGER) return "send_trigger"; + if (this == QUERY_SERVICES) return "query_services"; + if (this == SHUTDOWN) return "shutdown"; + if (this == CHANGING_MEMORY_LIVE) return "changing_memory_live"; + if (this == AWAITING_MEMORY_LIVE) return "awaiting_memory_live"; + if (this == CHANGING_DYNAMIC_RANGE) return "changing_dynamic_range"; + if (this == CHANGING_STATIC_RANGE) return "changing_static_range"; + if (this == CHANGING_MEMORY_LIMITS) return "changing_memory_limits"; + if (this == CHANGING_SHADOW_MEMORY) return "changing_shadow_memory"; + if (this == CHANGING_SHADOW_MEMORY_LIVE) return "changing_shadow_memory_live"; + if (this == CHANGING_VCPUS) return "changing_VCPUs"; + if (this == CHANGING_VCPUS_LIVE) return "changing_VCPUs_live"; + if (this == ASSERT_OPERATION_VALID) return "assert_operation_valid"; + if (this == DATA_SOURCE_OP) return "data_source_op"; + if (this == UPDATE_ALLOWED_OPERATIONS) return "update_allowed_operations"; + if (this == MAKE_INTO_TEMPLATE) return "make_into_template"; + if (this == IMPORT) return "import"; + if (this == EXPORT) return "export"; + if (this == METADATA_EXPORT) return "metadata_export"; + if (this == REVERTING) return "reverting"; + if (this == DESTROY) return "destroy"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -3519,16 +3389,12 @@ public class Types */ LACP; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == BALANCE_SLB) - return "balance-slb"; - if (this == ACTIVE_BACKUP) - return "active-backup"; - if (this == LACP) - return "lacp"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == BALANCE_SLB) return "balance-slb"; + if (this == ACTIVE_BACKUP) return "active-backup"; + if (this == LACP) return "lacp"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -3551,16 +3417,12 @@ public class Types */ STATIC; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == NONE) - return "None"; - if (this == DHCP) - return "DHCP"; - if (this == STATIC) - return "Static"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == NONE) return "None"; + if (this == DHCP) return "DHCP"; + if (this == STATIC) return "Static"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -3627,38 +3489,23 @@ public class Types */ PBD_DESTROY; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == SCAN) - return "scan"; - if (this == DESTROY) - return "destroy"; - if (this == FORGET) - return "forget"; - if (this == PLUG) - return "plug"; - if (this == UNPLUG) - return "unplug"; - if (this == UPDATE) - return "update"; - if (this == VDI_CREATE) - return "vdi_create"; - if (this == VDI_INTRODUCE) - return "vdi_introduce"; - if (this == VDI_DESTROY) - return "vdi_destroy"; - if (this == VDI_RESIZE) - return "vdi_resize"; - if (this == VDI_CLONE) - return "vdi_clone"; - if (this == VDI_SNAPSHOT) - return "vdi_snapshot"; - if (this == PBD_CREATE) - return "pbd_create"; - if (this == PBD_DESTROY) - return "pbd_destroy"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == SCAN) return "scan"; + if (this == DESTROY) return "destroy"; + if (this == FORGET) return "forget"; + if (this == PLUG) return "plug"; + if (this == UNPLUG) return "unplug"; + if (this == UPDATE) return "update"; + if (this == VDI_CREATE) return "vdi_create"; + if (this == VDI_INTRODUCE) return "vdi_introduce"; + if (this == VDI_DESTROY) return "vdi_destroy"; + if (this == VDI_RESIZE) return "vdi_resize"; + if (this == VDI_CLONE) return "vdi_clone"; + if (this == VDI_SNAPSHOT) return "vdi_snapshot"; + if (this == PBD_CREATE) return "pbd_create"; + if (this == PBD_DESTROY) return "pbd_destroy"; + /* This can never be reached */ + return "illegal enum"; } }; @@ -3685,232 +3532,17 @@ public class Types */ DISABLED; public String toString() { - if (this == UNRECOGNIZED) - return "UNRECOGNIZED"; - if (this == NETWORK_DEFAULT) - return "network_default"; - if (this == LOCKED) - return "locked"; - if (this == UNLOCKED) - return "unlocked"; - if (this == DISABLED) - return "disabled"; - /* This can never be reached */ - return "illegal enum"; + if (this == UNRECOGNIZED) return "UNRECOGNIZED"; + if (this == NETWORK_DEFAULT) return "network_default"; + if (this == LOCKED) return "locked"; + if (this == UNLOCKED) return "unlocked"; + if (this == DISABLED) return "disabled"; + /* This can never be reached */ + return "illegal enum"; } }; - /** - * The restore could not be performed because a network interface is missing - */ - public static class RestoreTargetMissingDevice extends XenAPIException { - public final String device; - - /** - * Create a new RestoreTargetMissingDevice - * - * @param device - */ - public RestoreTargetMissingDevice(String device) { - super("The restore could not be performed because a network interface is missing"); - this.device = device; - } - - } - - /** - * The communication with the WLB server timed out. - */ - public static class WlbTimeout extends XenAPIException { - public final String configuredTimeout; - - /** - * Create a new WlbTimeout - * - * @param configuredTimeout - */ - public WlbTimeout(String configuredTimeout) { - super("The communication with the WLB server timed out."); - this.configuredTimeout = configuredTimeout; - } - - } - - /** - * The MAC address specified doesn't exist on this host. - */ - public static class MacDoesNotExist extends XenAPIException { - public final String MAC; - - /** - * Create a new MacDoesNotExist - * - * @param MAC - */ - public MacDoesNotExist(String MAC) { - super("The MAC address specified doesn't exist on this host."); - this.MAC = MAC; - } - - } - - /** - * You gave an invalid object reference. The object may have recently been deleted. The class parameter gives the type of reference given, and the handle parameter echoes the bad value given. - */ - public static class HandleInvalid extends XenAPIException { - public final String clazz; - public final String handle; - - /** - * Create a new HandleInvalid - * - * @param clazz - * @param handle - */ - public HandleInvalid(String clazz, String handle) { - super("You gave an invalid object reference. The object may have recently been deleted. The class parameter gives the type of reference given, and the handle parameter echoes the bad value given."); - this.clazz = clazz; - this.handle = handle; - } - - } - - /** - * The device is already attached to a VM - */ - public static class DeviceAlreadyAttached extends XenAPIException { - public final String device; - - /** - * Create a new DeviceAlreadyAttached - * - * @param device - */ - public DeviceAlreadyAttached(String device) { - super("The device is already attached to a VM"); - this.device = device; - } - - } - - /** - * A required parameter contained an invalid IP address - */ - public static class InvalidIpAddressSpecified extends XenAPIException { - public final String parameter; - - /** - * Create a new InvalidIpAddressSpecified - * - * @param parameter - */ - public InvalidIpAddressSpecified(String parameter) { - super("A required parameter contained an invalid IP address"); - this.parameter = parameter; - } - - } - - /** - * The SR operation cannot be performed because the SR is not empty. - */ - public static class SrNotEmpty extends XenAPIException { - - /** - * Create a new SrNotEmpty - */ - public SrNotEmpty() { - super("The SR operation cannot be performed because the SR is not empty."); - } - - } - - /** - * HVM is required for this operation - */ - public static class VmHvmRequired extends XenAPIException { - public final String vm; - - /** - * Create a new VmHvmRequired - * - * @param vm - */ - public VmHvmRequired(String vm) { - super("HVM is required for this operation"); - this.vm = vm; - } - - } - - /** - * The GPU group contains active PGPUs and cannot be deleted. - */ - public static class GpuGroupContainsPgpu extends XenAPIException { - public final String pgpus; - - /** - * Create a new GpuGroupContainsPgpu - * - * @param pgpus - */ - public GpuGroupContainsPgpu(String pgpus) { - super("The GPU group contains active PGPUs and cannot be deleted."); - this.pgpus = pgpus; - } - - } - - /** - * Operation cannot proceed while a tunnel exists on this interface. - */ - public static class PifTunnelStillExists extends XenAPIException { - public final String PIF; - - /** - * Create a new PifTunnelStillExists - * - * @param PIF - */ - public PifTunnelStillExists(String PIF) { - super("Operation cannot proceed while a tunnel exists on this interface."); - this.PIF = PIF; - } - - } - - /** - * A bond must consist of at least two member interfaces - */ - public static class PifBondNeedsMoreMembers extends XenAPIException { - - /** - * Create a new PifBondNeedsMoreMembers - */ - public PifBondNeedsMoreMembers() { - super("A bond must consist of at least two member interfaces"); - } - - } - - /** - * This operation cannot be performed because the pif is bonded. - */ - public static class PifAlreadyBonded extends XenAPIException { - public final String PIF; - - /** - * Create a new PifAlreadyBonded - * - * @param PIF - */ - public PifAlreadyBonded(String PIF) { - super("This operation cannot be performed because the pif is bonded."); - this.PIF = PIF; - } - - } /** * The disaster recovery task could not be cleanly destroyed. @@ -3931,1110 +3563,37 @@ public class Types } /** - * You tried to create a VLAN, but the tag you gave was invalid -- it must be between 0 and 4094. The parameter echoes the VLAN tag you gave. + * The VM could not be imported because attached disks could not be found. */ - public static class VlanTagInvalid extends XenAPIException { - public final String VLAN; + public static class ImportErrorAttachedDisksNotFound extends XenAPIException { /** - * Create a new VlanTagInvalid - * - * @param VLAN + * Create a new ImportErrorAttachedDisksNotFound */ - public VlanTagInvalid(String VLAN) { - super("You tried to create a VLAN, but the tag you gave was invalid -- it must be between 0 and 4094. The parameter echoes the VLAN tag you gave."); - this.VLAN = VLAN; + public ImportErrorAttachedDisksNotFound() { + super("The VM could not be imported because attached disks could not be found."); } } /** - * You cannot make regular API calls directly on a slave. Please pass API calls via the master host. + * An error occurred while attempting to import a database from a metadata VDI */ - public static class HostIsSlave extends XenAPIException { - public final String masterIPAddress; - - /** - * Create a new HostIsSlave - * - * @param masterIPAddress - */ - public HostIsSlave(String masterIPAddress) { - super("You cannot make regular API calls directly on a slave. Please pass API calls via the master host."); - this.masterIPAddress = masterIPAddress; - } - - } - - /** - * The SR.shared flag cannot be set to false while the SR remains connected to multiple hosts - */ - public static class SrHasMultiplePbds extends XenAPIException { - public final String PBD; - - /** - * Create a new SrHasMultiplePbds - * - * @param PBD - */ - public SrHasMultiplePbds(String PBD) { - super("The SR.shared flag cannot be set to false while the SR remains connected to multiple hosts"); - this.PBD = PBD; - } - - } - - /** - * The pool failed to enable external authentication. - */ - public static class PoolAuthEnableFailedInvalidOu extends XenAPIException { - public final String host; - public final String message; - - /** - * Create a new PoolAuthEnableFailedInvalidOu - * - * @param host - * @param message - */ - public PoolAuthEnableFailedInvalidOu(String host, String message) { - super("The pool failed to enable external authentication."); - this.host = host; - this.message = message; - } - - } - - /** - * Some data checksums were incorrect; the VM may be corrupt. - */ - public static class ImportErrorSomeChecksumsFailed extends XenAPIException { - - /** - * Create a new ImportErrorSomeChecksumsFailed - */ - public ImportErrorSomeChecksumsFailed() { - super("Some data checksums were incorrect; the VM may be corrupt."); - } - - } - - /** - * This operation needs the OpenVSwitch networking backend to be enabled on all hosts in the pool. - */ - public static class OpenvswitchNotActive extends XenAPIException { - - /** - * Create a new OpenvswitchNotActive - */ - public OpenvswitchNotActive() { - super("This operation needs the OpenVSwitch networking backend to be enabled on all hosts in the pool."); - } - - } - - /** - * The backup partition to stream the updat to cannot be found - */ - public static class CannotFindOemBackupPartition extends XenAPIException { - - /** - * Create a new CannotFindOemBackupPartition - */ - public CannotFindOemBackupPartition() { - super("The backup partition to stream the updat to cannot be found"); - } - - } - - /** - * The specified device was not found. - */ - public static class PifDeviceNotFound extends XenAPIException { - - /** - * Create a new PifDeviceNotFound - */ - public PifDeviceNotFound() { - super("The specified device was not found."); - } - - } - - /** - * An internal error generated by the domain builder. - */ - public static class DomainBuilderError extends XenAPIException { - public final String function; - public final String code; - public final String message; - - /** - * Create a new DomainBuilderError - * - * @param function - * @param code - * @param message - */ - public DomainBuilderError(String function, String code, String message) { - super("An internal error generated by the domain builder."); - this.function = function; - this.code = code; - this.message = message; - } - - } - - /** - * The patch precheck stage failed: there are one or more VMs still running on the server. All VMs must be suspended before the patch can be applied. - */ - public static class PatchPrecheckFailedVmRunning extends XenAPIException { - public final String patch; - - /** - * Create a new PatchPrecheckFailedVmRunning - * - * @param patch - */ - public PatchPrecheckFailedVmRunning(String patch) { - super("The patch precheck stage failed: there are one or more VMs still running on the server. All VMs must be suspended before the patch can be applied."); - this.patch = patch; - } - - } - - /** - * You attempted to run a VM on a host which doesn't have I/O virtualisation (IOMMU/VT-d) enabled, which is needed by the VM. - */ - public static class VmRequiresIommu extends XenAPIException { - public final String host; - - /** - * Create a new VmRequiresIommu - * - * @param host - */ - public VmRequiresIommu(String host) { - super("You attempted to run a VM on a host which doesn't have I/O virtualisation (IOMMU/VT-d) enabled, which is needed by the VM."); - this.host = host; - } - - } - - /** - * The operation failed because the HA software on the specified host could not see a subset of other hosts. Check your network connectivity. - */ - public static class HaHostCannotSeePeers extends XenAPIException { - public final String host; - public final String all; - public final String subset; - - /** - * Create a new HaHostCannotSeePeers - * - * @param host - * @param all - * @param subset - */ - public HaHostCannotSeePeers(String host, String all, String subset) { - super("The operation failed because the HA software on the specified host could not see a subset of other hosts. Check your network connectivity."); - this.host = host; - this.all = all; - this.subset = subset; - } - - } - - /** - * The pool failed to disable the external authentication of at least one host. - */ - public static class PoolAuthDisableFailedPermissionDenied extends XenAPIException { - public final String host; - public final String message; - - /** - * Create a new PoolAuthDisableFailedPermissionDenied - * - * @param host - * @param message - */ - public PoolAuthDisableFailedPermissionDenied(String host, String message) { - super("The pool failed to disable the external authentication of at least one host."); - this.host = host; - this.message = message; - } - - } - - /** - * Caller not allowed to perform this operation. - */ - public static class PermissionDenied extends XenAPIException { - public final String message; - - /** - * Create a new PermissionDenied - * - * @param message - */ - public PermissionDenied(String message) { - super("Caller not allowed to perform this operation."); - this.message = message; - } - - } - - /** - * The remote system's SSL certificate failed to verify against our certificate library. - */ - public static class SslVerifyError extends XenAPIException { + public static class CouldNotImportDatabase extends XenAPIException { public final String reason; /** - * Create a new SslVerifyError + * Create a new CouldNotImportDatabase * * @param reason */ - public SslVerifyError(String reason) { - super("The remote system's SSL certificate failed to verify against our certificate library."); + public CouldNotImportDatabase(String reason) { + super("An error occurred while attempting to import a database from a metadata VDI"); this.reason = reason; } } - /** - * Attaching this SR failed. - */ - public static class SrAttachFailed extends XenAPIException { - public final String sr; - - /** - * Create a new SrAttachFailed - * - * @param sr - */ - public SrAttachFailed(String sr) { - super("Attaching this SR failed."); - this.sr = sr; - } - - } - - /** - * Subject already exists. - */ - public static class SubjectAlreadyExists extends XenAPIException { - - /** - * Create a new SubjectAlreadyExists - */ - public SubjectAlreadyExists() { - super("Subject already exists."); - } - - } - - /** - * This host lost access to the HA statefile. - */ - public static class HaLostStatefile extends XenAPIException { - - /** - * Create a new HaLostStatefile - */ - public HaLostStatefile() { - super("This host lost access to the HA statefile."); - } - - } - - /** - * The operation could not be performed because HA is not enabled on the Pool - */ - public static class HaNotEnabled extends XenAPIException { - - /** - * Create a new HaNotEnabled - */ - public HaNotEnabled() { - super("The operation could not be performed because HA is not enabled on the Pool"); - } - - } - - /** - * The host could not join the liveset because the HA daemon failed to start. - */ - public static class HaHeartbeatDaemonStartupFailed extends XenAPIException { - - /** - * Create a new HaHeartbeatDaemonStartupFailed - */ - public HaHeartbeatDaemonStartupFailed() { - super("The host could not join the liveset because the HA daemon failed to start."); - } - - } - - /** - * This session is not registered to receive events. You must call event.register before event.next. The session handle you are using is echoed. - */ - public static class SessionNotRegistered extends XenAPIException { - public final String handle; - - /** - * Create a new SessionNotRegistered - * - * @param handle - */ - public SessionNotRegistered(String handle) { - super("This session is not registered to receive events. You must call event.register before event.next. The session handle you are using is echoed."); - this.handle = handle; - } - - } - - /** - * This VM does not have a suspend SR specified. - */ - public static class VmNoSuspendSr extends XenAPIException { - public final String vm; - - /** - * Create a new VmNoSuspendSr - * - * @param vm - */ - public VmNoSuspendSr(String vm) { - super("This VM does not have a suspend SR specified."); - this.vm = vm; - } - - } - - /** - * You attempted to migrate a VM with more than one snapshot. - */ - public static class VmHasTooManySnapshots extends XenAPIException { - public final String vm; - - /** - * Create a new VmHasTooManySnapshots - * - * @param vm - */ - public VmHasTooManySnapshots(String vm) { - super("You attempted to migrate a VM with more than one snapshot."); - this.vm = vm; - } - - } - - /** - * The patch apply failed. Please see attached output. - */ - public static class PatchApplyFailed extends XenAPIException { - public final String output; - - /** - * Create a new PatchApplyFailed - * - * @param output - */ - public PatchApplyFailed(String output) { - super("The patch apply failed. Please see attached output."); - this.output = output; - } - - } - - /** - * The operation required write access but this VDI is read-only - */ - public static class VdiReadonly extends XenAPIException { - public final String vdi; - - /** - * Create a new VdiReadonly - * - * @param vdi - */ - public VdiReadonly(String vdi) { - super("The operation required write access but this VDI is read-only"); - this.vdi = vdi; - } - - } - - /** - * The SR is full. Requested new size exceeds the maximum size - */ - public static class SrFull extends XenAPIException { - public final String requested; - public final String maximum; - - /** - * Create a new SrFull - * - * @param requested - * @param maximum - */ - public SrFull(String requested, String maximum) { - super("The SR is full. Requested new size exceeds the maximum size"); - this.requested = requested; - this.maximum = maximum; - } - - } - - /** - * You attempted to run a VM on a host which doesn't have a pGPU available in the GPU group needed by the VM. The VM has a vGPU attached to this GPU group. - */ - public static class VmRequiresGpu extends XenAPIException { - public final String vm; - public final String GPUGroup; - - /** - * Create a new VmRequiresGpu - * - * @param vm - * @param GPUGroup - */ - public VmRequiresGpu(String vm, String GPUGroup) { - super("You attempted to run a VM on a host which doesn't have a pGPU available in the GPU group needed by the VM. The VM has a vGPU attached to this GPU group."); - this.vm = vm; - this.GPUGroup = GPUGroup; - } - - } - - /** - * This operation cannot be performed because this VDI could not be properly attached to the VM. - */ - public static class VdiNotAvailable extends XenAPIException { - public final String vdi; - - /** - * Create a new VdiNotAvailable - * - * @param vdi - */ - public VdiNotAvailable(String vdi) { - super("This operation cannot be performed because this VDI could not be properly attached to the VM."); - this.vdi = vdi; - } - - } - - /** - * The server failed to unmarshal the XMLRPC message; it was expecting one element and received something else. - */ - public static class XmlrpcUnmarshalFailure extends XenAPIException { - public final String expected; - public final String received; - - /** - * Create a new XmlrpcUnmarshalFailure - * - * @param expected - * @param received - */ - public XmlrpcUnmarshalFailure(String expected, String received) { - super("The server failed to unmarshal the XMLRPC message; it was expecting one element and received something else."); - this.expected = expected; - this.received = received; - } - - } - - /** - * A CRL already exists with the specified name. - */ - public static class CrlAlreadyExists extends XenAPIException { - public final String name; - - /** - * Create a new CrlAlreadyExists - * - * @param name - */ - public CrlAlreadyExists(String name) { - super("A CRL already exists with the specified name."); - this.name = name; - } - - } - - /** - * The master reports that it cannot talk back to the slave on the supplied management IP address. - */ - public static class HostMasterCannotTalkBack extends XenAPIException { - public final String ip; - - /** - * Create a new HostMasterCannotTalkBack - * - * @param ip - */ - public HostMasterCannotTalkBack(String ip) { - super("The master reports that it cannot talk back to the slave on the supplied management IP address."); - this.ip = ip; - } - - } - - /** - * 3rd party xapi hook failed - */ - public static class XapiHookFailed extends XenAPIException { - public final String hookName; - public final String reason; - public final String stdout; - public final String exitCode; - - /** - * Create a new XapiHookFailed - * - * @param hookName - * @param reason - * @param stdout - * @param exitCode - */ - public XapiHookFailed(String hookName, String reason, String stdout, String exitCode) { - super("3rd party xapi hook failed"); - this.hookName = hookName; - this.reason = reason; - this.stdout = stdout; - this.exitCode = exitCode; - } - - } - - /** - * The import failed because this export has been created by a different (incompatible) product version - */ - public static class ImportIncompatibleVersion extends XenAPIException { - - /** - * Create a new ImportIncompatibleVersion - */ - public ImportIncompatibleVersion() { - super("The import failed because this export has been created by a different (incompatible) product version"); - } - - } - - /** - * The requested bootloader is unknown - */ - public static class UnknownBootloader extends XenAPIException { - public final String vm; - public final String bootloader; - - /** - * Create a new UnknownBootloader - * - * @param vm - * @param bootloader - */ - public UnknownBootloader(String vm, String bootloader) { - super("The requested bootloader is unknown"); - this.vm = vm; - this.bootloader = bootloader; - } - - } - - /** - * The Citrix XenServer Vss Provider is not loaded - */ - public static class XenVssReqErrorProvNotLoaded extends XenAPIException { - public final String vm; - public final String errorCode; - - /** - * Create a new XenVssReqErrorProvNotLoaded - * - * @param vm - * @param errorCode - */ - public XenVssReqErrorProvNotLoaded(String vm, String errorCode) { - super("The Citrix XenServer Vss Provider is not loaded"); - this.vm = vm; - this.errorCode = errorCode; - } - - } - - /** - * The VM is set up to use a feature that requires it to boot as HVM. - */ - public static class FeatureRequiresHvm extends XenAPIException { - public final String details; - - /** - * Create a new FeatureRequiresHvm - * - * @param details - */ - public FeatureRequiresHvm(String details) { - super("The VM is set up to use a feature that requires it to boot as HVM."); - this.details = details; - } - - } - - /** - * The operation could not proceed because necessary VDIs were already locked at the storage level. - */ - public static class SrVdiLockingFailed extends XenAPIException { - - /** - * Create a new SrVdiLockingFailed - */ - public SrVdiLockingFailed() { - super("The operation could not proceed because necessary VDIs were already locked at the storage level."); - } - - } - - /** - * You tried to destroy a PIF, but it represents an aspect of the physical host configuration, and so cannot be destroyed. The parameter echoes the PIF handle you gave. - */ - public static class PifIsPhysical extends XenAPIException { - public final String PIF; - - /** - * Create a new PifIsPhysical - * - * @param PIF - */ - public PifIsPhysical(String PIF) { - super("You tried to destroy a PIF, but it represents an aspect of the physical host configuration, and so cannot be destroyed. The parameter echoes the PIF handle you gave."); - this.PIF = PIF; - } - - } - - /** - * You tried to add a key-value pair to a map, but that key is already there. - */ - public static class MapDuplicateKey extends XenAPIException { - public final String type; - public final String paramName; - public final String uuid; - public final String key; - - /** - * Create a new MapDuplicateKey - * - * @param type - * @param paramName - * @param uuid - * @param key - */ - public MapDuplicateKey(String type, String paramName, String uuid, String key) { - super("You tried to add a key-value pair to a map, but that key is already there."); - this.type = type; - this.paramName = paramName; - this.uuid = uuid; - this.key = key; - } - - } - - /** - * The license-server connection details (address or port) were missing or incomplete. - */ - public static class MissingConnectionDetails extends XenAPIException { - - /** - * Create a new MissingConnectionDetails - */ - public MissingConnectionDetails() { - super("The license-server connection details (address or port) were missing or incomplete."); - } - - } - - /** - * Could not create the XML string generated by the transportable snapshot - */ - public static class XenVssReqErrorCreatingSnapshotXmlString extends XenAPIException { - public final String vm; - public final String errorCode; - - /** - * Create a new XenVssReqErrorCreatingSnapshotXmlString - * - * @param vm - * @param errorCode - */ - public XenVssReqErrorCreatingSnapshotXmlString(String vm, String errorCode) { - super("Could not create the XML string generated by the transportable snapshot"); - this.vm = vm; - this.errorCode = errorCode; - } - - } - - /** - * The bootloader returned an error - */ - public static class BootloaderFailed extends XenAPIException { - public final String vm; - public final String msg; - - /** - * Create a new BootloaderFailed - * - * @param vm - * @param msg - */ - public BootloaderFailed(String vm, String msg) { - super("The bootloader returned an error"); - this.vm = vm; - this.msg = msg; - } - - } - - /** - * The WLB server reported that XenServer said something to it that WLB wasn't expecting or didn't understand. - */ - public static class WlbXenserverMalformedResponse extends XenAPIException { - - /** - * Create a new WlbXenserverMalformedResponse - */ - public WlbXenserverMalformedResponse() { - super("The WLB server reported that XenServer said something to it that WLB wasn't expecting or didn't understand."); - } - - } - - /** - * The GPU group contains active VGPUs and cannot be deleted. - */ - public static class GpuGroupContainsVgpu extends XenAPIException { - public final String vgpus; - - /** - * Create a new GpuGroupContainsVgpu - * - * @param vgpus - */ - public GpuGroupContainsVgpu(String vgpus) { - super("The GPU group contains active VGPUs and cannot be deleted."); - this.vgpus = vgpus; - } - - } - - /** - * The pool failed to enable external authentication. - */ - public static class PoolAuthEnableFailedDuplicateHostname extends XenAPIException { - public final String host; - public final String message; - - /** - * Create a new PoolAuthEnableFailedDuplicateHostname - * - * @param host - * @param message - */ - public PoolAuthEnableFailedDuplicateHostname(String host, String message) { - super("The pool failed to enable external authentication."); - this.host = host; - this.message = message; - } - - } - - /** - * Retrieving system status from the host failed. A diagnostic reason suitable for support organisations is also returned. - */ - public static class SystemStatusRetrievalFailed extends XenAPIException { - public final String reason; - - /** - * Create a new SystemStatusRetrievalFailed - * - * @param reason - */ - public SystemStatusRetrievalFailed(String reason) { - super("Retrieving system status from the host failed. A diagnostic reason suitable for support organisations is also returned."); - this.reason = reason; - } - - } - - /** - * This operation cannot be performed because this VDI is in use by some other operation - */ - public static class VdiInUse extends XenAPIException { - public final String vdi; - public final String operation; - - /** - * Create a new VdiInUse - * - * @param vdi - * @param operation - */ - public VdiInUse(String vdi, String operation) { - super("This operation cannot be performed because this VDI is in use by some other operation"); - this.vdi = vdi; - this.operation = operation; - } - - } - - /** - * This operation cannot be completed as the host is not live. - */ - public static class HostNotLive extends XenAPIException { - - /** - * Create a new HostNotLive - */ - public HostNotLive() { - super("This operation cannot be completed as the host is not live."); - } - - } - - /** - * A certificate already exists with the specified name. - */ - public static class CertificateAlreadyExists extends XenAPIException { - public final String name; - - /** - * Create a new CertificateAlreadyExists - * - * @param name - */ - public CertificateAlreadyExists(String name) { - super("A certificate already exists with the specified name."); - this.name = name; - } - - } - - /** - * The SR has no attached PBDs - */ - public static class SrHasNoPbds extends XenAPIException { - public final String sr; - - /** - * Create a new SrHasNoPbds - * - * @param sr - */ - public SrHasNoPbds(String sr) { - super("The SR has no attached PBDs"); - this.sr = sr; - } - - } - - /** - * This PIF is a bond slave and cannot have a tunnel on it. - */ - public static class CannotAddTunnelToBondSlave extends XenAPIException { - public final String PIF; - - /** - * Create a new CannotAddTunnelToBondSlave - * - * @param PIF - */ - public CannotAddTunnelToBondSlave(String PIF) { - super("This PIF is a bond slave and cannot have a tunnel on it."); - this.PIF = PIF; - } - - } - - /** - * The uploaded patch file is invalid - */ - public static class InvalidPatch extends XenAPIException { - - /** - * Create a new InvalidPatch - */ - public InvalidPatch() { - super("The uploaded patch file is invalid"); - } - - } - - /** - * The SR could not be destroyed, as the 'indestructible' flag was set on it. - */ - public static class SrIndestructible extends XenAPIException { - public final String sr; - - /** - * Create a new SrIndestructible - * - * @param sr - */ - public SrIndestructible(String sr) { - super("The SR could not be destroyed, as the 'indestructible' flag was set on it."); - this.sr = sr; - } - - } - - /** - * This host cannot accept the proposed new master setting at this time. - */ - public static class HaAbortNewMaster extends XenAPIException { - public final String reason; - - /** - * Create a new HaAbortNewMaster - * - * @param reason - */ - public HaAbortNewMaster(String reason) { - super("This host cannot accept the proposed new master setting at this time."); - this.reason = reason; - } - - } - - /** - * The WLB server said something that XenServer wasn't expecting or didn't understand. The method called on the WLB server, a diagnostic reason, and the response from WLB are returned. - */ - public static class WlbMalformedResponse extends XenAPIException { - public final String method; - public final String reason; - public final String response; - - /** - * Create a new WlbMalformedResponse - * - * @param method - * @param reason - * @param response - */ - public WlbMalformedResponse(String method, String reason, String response) { - super("The WLB server said something that XenServer wasn't expecting or didn't understand. The method called on the WLB server, a diagnostic reason, and the response from WLB are returned."); - this.method = method; - this.reason = reason; - this.response = response; - } - - } - - /** - * The host joining the pool must have a physical management NIC (i.e. the management NIC must not be on a VLAN or bonded PIF). - */ - public static class PoolJoiningHostMustHavePhysicalManagementNic extends XenAPIException { - - /** - * Create a new PoolJoiningHostMustHavePhysicalManagementNic - */ - public PoolJoiningHostMustHavePhysicalManagementNic() { - super("The host joining the pool must have a physical management NIC (i.e. the management NIC must not be on a VLAN or bonded PIF)."); - } - - } - - /** - * PIF has no IPv6 configuration (mode curently set to 'none') - */ - public static class PifHasNoV6NetworkConfiguration extends XenAPIException { - - /** - * Create a new PifHasNoV6NetworkConfiguration - */ - public PifHasNoV6NetworkConfiguration() { - super("PIF has no IPv6 configuration (mode curently set to 'none')"); - } - - } - - /** - * This operation is not allowed as the VM is part of an appliance. - */ - public static class VmIsPartOfAnAppliance extends XenAPIException { - public final String vm; - public final String appliance; - - /** - * Create a new VmIsPartOfAnAppliance - * - * @param vm - * @param appliance - */ - public VmIsPartOfAnAppliance(String vm, String appliance) { - super("This operation is not allowed as the VM is part of an appliance."); - this.vm = vm; - this.appliance = appliance; - } - - } - - /** - * The WLB server reported that XenServer rejected its configured authentication details. - */ - public static class WlbXenserverAuthenticationFailed extends XenAPIException { - - /** - * Create a new WlbXenserverAuthenticationFailed - */ - public WlbXenserverAuthenticationFailed() { - super("The WLB server reported that XenServer rejected its configured authentication details."); - } - - } - - /** - * The power-state of a control domain cannot be reset. - */ - public static class CannotResetControlDomain extends XenAPIException { - public final String vm; - - /** - * Create a new CannotResetControlDomain - * - * @param vm - */ - public CannotResetControlDomain(String vm) { - super("The power-state of a control domain cannot be reset."); - this.vm = vm; - } - - } - - /** - * The patch precheck stage failed with an unknown error. See attached info for more details. - */ - public static class PatchPrecheckFailedUnknownError extends XenAPIException { - public final String patch; - public final String info; - - /** - * Create a new PatchPrecheckFailedUnknownError - * - * @param patch - * @param info - */ - public PatchPrecheckFailedUnknownError(String patch, String info) { - super("The patch precheck stage failed with an unknown error. See attached info for more details."); - this.patch = patch; - this.info = info; - } - - } - /** * Host cannot attach network (in the case of NIC bonding, this may be because attaching the network on this host would require other networks [that are currently active] to be taken down). */ @@ -5056,322 +3615,6 @@ public class Types } - /** - * The WLB URL is invalid. Ensure it is in format: :. The configured/given URL is returned. - */ - public static class WlbUrlInvalid extends XenAPIException { - public final String url; - - /** - * Create a new WlbUrlInvalid - * - * @param url - */ - public WlbUrlInvalid(String url) { - super("The WLB URL is invalid. Ensure it is in format: :. The configured/given URL is returned."); - this.url = url; - } - - } - - /** - * Cannot restore this VM because it would create a duplicate - */ - public static class DuplicateVm extends XenAPIException { - public final String vm; - - /** - * Create a new DuplicateVm - * - * @param vm - */ - public DuplicateVm(String vm) { - super("Cannot restore this VM because it would create a duplicate"); - this.vm = vm; - } - - } - - /** - * The pool master host cannot be removed. - */ - public static class HostCannotDestroySelf extends XenAPIException { - public final String host; - - /** - * Create a new HostCannotDestroySelf - * - * @param host - */ - public HostCannotDestroySelf(String host) { - super("The pool master host cannot be removed."); - this.host = host; - } - - } - - /** - * This host failed in the middle of an automatic failover operation and needs to retry the failover action - */ - public static class HostBroken extends XenAPIException { - - /** - * Create a new HostBroken - */ - public HostBroken() { - super("This host failed in the middle of an automatic failover operation and needs to retry the failover action"); - } - - } - - /** - * An error occured while restoring the memory image of the specified virtual machine - */ - public static class VmCheckpointResumeFailed extends XenAPIException { - public final String vm; - - /** - * Create a new VmCheckpointResumeFailed - * - * @param vm - */ - public VmCheckpointResumeFailed(String vm) { - super("An error occured while restoring the memory image of the specified virtual machine"); - this.vm = vm; - } - - } - - /** - * Too many VCPUs to start this VM - */ - public static class VmTooManyVcpus extends XenAPIException { - public final String vm; - - /** - * Create a new VmTooManyVcpus - * - * @param vm - */ - public VmTooManyVcpus(String vm) { - super("Too many VCPUs to start this VM"); - this.vm = vm; - } - - } - - /** - * This operation cannot be completed as the host is still live. - */ - public static class HostIsLive extends XenAPIException { - public final String host; - - /** - * Create a new HostIsLive - * - * @param host - */ - public HostIsLive(String host) { - super("This operation cannot be completed as the host is still live."); - this.host = host; - } - - } - - /** - * The VM could not be imported because attached disks could not be found. - */ - public static class ImportErrorAttachedDisksNotFound extends XenAPIException { - - /** - * Create a new ImportErrorAttachedDisksNotFound - */ - public ImportErrorAttachedDisksNotFound() { - super("The VM could not be imported because attached disks could not be found."); - } - - } - - /** - * Drive could not be hot-unplugged because it is not marked as unpluggable - */ - public static class VbdNotUnpluggable extends XenAPIException { - public final String vbd; - - /** - * Create a new VbdNotUnpluggable - * - * @param vbd - */ - public VbdNotUnpluggable(String vbd) { - super("Drive could not be hot-unplugged because it is not marked as unpluggable"); - this.vbd = vbd; - } - - } - - /** - * An attempt to create the snapshots failed - */ - public static class XenVssReqErrorCreatingSnapshot extends XenAPIException { - public final String vm; - public final String errorCode; - - /** - * Create a new XenVssReqErrorCreatingSnapshot - * - * @param vm - * @param errorCode - */ - public XenVssReqErrorCreatingSnapshot(String vm, String errorCode) { - super("An attempt to create the snapshots failed"); - this.vm = vm; - this.errorCode = errorCode; - } - - } - - /** - * Could not enable redo log. - */ - public static class CannotEnableRedoLog extends XenAPIException { - public final String reason; - - /** - * Create a new CannotEnableRedoLog - * - * @param reason - */ - public CannotEnableRedoLog(String reason) { - super("Could not enable redo log."); - this.reason = reason; - } - - } - - /** - * This host cannot be evacuated. - */ - public static class CannotEvacuateHost extends XenAPIException { - public final String errors; - - /** - * Create a new CannotEvacuateHost - * - * @param errors - */ - public CannotEvacuateHost(String errors) { - super("This host cannot be evacuated."); - this.errors = errors; - } - - } - - /** - * There were no hosts available to complete the specified operation. - */ - public static class NoHostsAvailable extends XenAPIException { - - /** - * Create a new NoHostsAvailable - */ - public NoHostsAvailable() { - super("There were no hosts available to complete the specified operation."); - } - - } - - /** - * A timeout happened while attempting to attach a device to a VM. - */ - public static class DeviceAttachTimeout extends XenAPIException { - public final String type; - public final String ref; - - /** - * Create a new DeviceAttachTimeout - * - * @param type - * @param ref - */ - public DeviceAttachTimeout(String type, String ref) { - super("A timeout happened while attempting to attach a device to a VM."); - this.type = type; - this.ref = ref; - } - - } - - /** - * The device name is invalid - */ - public static class InvalidDevice extends XenAPIException { - public final String device; - - /** - * Create a new InvalidDevice - * - * @param device - */ - public InvalidDevice(String device) { - super("The device name is invalid"); - this.device = device; - } - - } - - /** - * A PBD already exists connecting the SR to the host - */ - public static class PbdExists extends XenAPIException { - public final String sr; - public final String host; - public final String pbd; - - /** - * Create a new PbdExists - * - * @param sr - * @param host - * @param pbd - */ - public PbdExists(String sr, String host, String pbd) { - super("A PBD already exists connecting the SR to the host"); - this.sr = sr; - this.host = host; - this.pbd = pbd; - } - - } - - /** - * The WLB server reported that XenServer refused it a connection (even though we're connecting perfectly fine in the other direction). - */ - public static class WlbXenserverConnectionRefused extends XenAPIException { - - /** - * Create a new WlbXenserverConnectionRefused - */ - public WlbXenserverConnectionRefused() { - super("The WLB server reported that XenServer refused it a connection (even though we're connecting perfectly fine in the other direction)."); - } - - } - - /** - * The metrics of this host could not be read. - */ - public static class HostCannotReadMetrics extends XenAPIException { - - /** - * Create a new HostCannotReadMetrics - */ - public HostCannotReadMetrics() { - super("The metrics of this host could not be read."); - } - - } - /** * The VM is incompatible with the CPU features of this host. */ @@ -5397,375 +3640,481 @@ public class Types } /** - * The upper limit of active redo log instances was reached. + * You gave an invalid session reference. It may have been invalidated by a server restart, or timed out. You should get a new session handle, using one of the session.login_ calls. This error does not invalidate the current connection. The handle parameter echoes the bad value given. */ - public static class NoMoreRedoLogsAllowed extends XenAPIException { + public static class SessionInvalid extends XenAPIException { + public final String handle; /** - * Create a new NoMoreRedoLogsAllowed + * Create a new SessionInvalid + * + * @param handle */ - public NoMoreRedoLogsAllowed() { - super("The upper limit of active redo log instances was reached."); + public SessionInvalid(String handle) { + super("You gave an invalid session reference. It may have been invalidated by a server restart, or timed out. You should get a new session handle, using one of the session.login_ calls. This error does not invalidate the current connection. The handle parameter echoes the bad value given."); + this.handle = handle; } } /** - * The pool failed to enable external authentication. + * An attempt to create the snapshots failed */ - public static class PoolAuthEnableFailed extends XenAPIException { - public final String host; + public static class XenVssReqErrorCreatingSnapshot extends XenAPIException { + public final String vm; + public final String errorCode; + + /** + * Create a new XenVssReqErrorCreatingSnapshot + * + * @param vm + * @param errorCode + */ + public XenVssReqErrorCreatingSnapshot(String vm, String errorCode) { + super("An attempt to create the snapshots failed"); + this.vm = vm; + this.errorCode = errorCode; + } + + } + + /** + * An error occured while reverting the specified virtual machine to the specified snapshot + */ + public static class VmRevertFailed extends XenAPIException { + public final String vm; + public final String snapshot; + + /** + * Create a new VmRevertFailed + * + * @param vm + * @param snapshot + */ + public VmRevertFailed(String vm, String snapshot) { + super("An error occured while reverting the specified virtual machine to the specified snapshot"); + this.vm = vm; + this.snapshot = snapshot; + } + + } + + /** + * The CPU does not support masking of features. + */ + public static class CpuFeatureMaskingNotSupported extends XenAPIException { + public final String details; + + /** + * Create a new CpuFeatureMaskingNotSupported + * + * @param details + */ + public CpuFeatureMaskingNotSupported(String details) { + super("The CPU does not support masking of features."); + this.details = details; + } + + } + + /** + * This host lost access to the HA statefile. + */ + public static class HaLostStatefile extends XenAPIException { + + /** + * Create a new HaLostStatefile + */ + public HaLostStatefile() { + super("This host lost access to the HA statefile."); + } + + } + + /** + * You cannot delete the specified default template. + */ + public static class VmCannotDeleteDefaultTemplate extends XenAPIException { + public final String vm; + + /** + * Create a new VmCannotDeleteDefaultTemplate + * + * @param vm + */ + public VmCannotDeleteDefaultTemplate(String vm) { + super("You cannot delete the specified default template."); + this.vm = vm; + } + + } + + /** + * The host failed to enable external authentication. + */ + public static class AuthEnableFailedPermissionDenied extends XenAPIException { public final String message; /** - * Create a new PoolAuthEnableFailed + * Create a new AuthEnableFailedPermissionDenied * - * @param host * @param message */ - public PoolAuthEnableFailed(String host, String message) { - super("The pool failed to enable external authentication."); - this.host = host; + public AuthEnableFailedPermissionDenied(String message) { + super("The host failed to enable external authentication."); this.message = message; } } /** - * The VSS plug-in is not installed on this virtual machine + * The request was rejected because the server is too busy. */ - public static class VmSnapshotWithQuiesceNotSupported extends XenAPIException { - public final String vm; - public final String error; + public static class TooBusy extends XenAPIException { /** - * Create a new VmSnapshotWithQuiesceNotSupported + * Create a new TooBusy + */ + public TooBusy() { + super("The request was rejected because the server is too busy."); + } + + } + + /** + * The backup could not be performed because the backup script failed. + */ + public static class BackupScriptFailed extends XenAPIException { + public final String log; + + /** + * Create a new BackupScriptFailed + * + * @param log + */ + public BackupScriptFailed(String log) { + super("The backup could not be performed because the backup script failed."); + this.log = log; + } + + } + + /** + * This operation cannot be completed as the host is not live. + */ + public static class HostNotLive extends XenAPIException { + + /** + * Create a new HostNotLive + */ + public HostNotLive() { + super("This operation cannot be completed as the host is not live."); + } + + } + + /** + * Your license has expired. Please contact your support representative. + */ + public static class LicenseExpired extends XenAPIException { + + /** + * Create a new LicenseExpired + */ + public LicenseExpired() { + super("Your license has expired. Please contact your support representative."); + } + + } + + /** + * You attempted to run a VM on a host which doesn't have a PIF on a Network needed by the VM. The VM has at least one VIF attached to the Network. + */ + public static class VmRequiresNetwork extends XenAPIException { + public final String vm; + public final String network; + + /** + * Create a new VmRequiresNetwork * * @param vm - * @param error + * @param network */ - public VmSnapshotWithQuiesceNotSupported(String vm, String error) { - super("The VSS plug-in is not installed on this virtual machine"); + public VmRequiresNetwork(String vm, String network) { + super("You attempted to run a VM on a host which doesn't have a PIF on a Network needed by the VM. The VM has at least one VIF attached to the Network."); this.vm = vm; - this.error = error; + this.network = network; } } /** - * This host cannot join a pool because it's license does not support pooling + * A VDI with the specified location already exists within the SR */ - public static class LicenseDoesNotSupportPooling extends XenAPIException { + public static class LocationNotUnique extends XenAPIException { + public final String SR; + public final String location; /** - * Create a new LicenseDoesNotSupportPooling - */ - public LicenseDoesNotSupportPooling() { - super("This host cannot join a pool because it's license does not support pooling"); - } - - } - - /** - * The master says the host is not known to it. Perhaps the Host was deleted from the master's database? Perhaps the slave is pointing to the wrong master? - */ - public static class HostUnknownToMaster extends XenAPIException { - public final String host; - - /** - * Create a new HostUnknownToMaster + * Create a new LocationNotUnique * - * @param host + * @param SR + * @param location */ - public HostUnknownToMaster(String host) { - super("The master says the host is not known to it. Perhaps the Host was deleted from the master's database? Perhaps the slave is pointing to the wrong master?"); - this.host = host; + public LocationNotUnique(String SR, String location) { + super("A VDI with the specified location already exists within the SR"); + this.SR = SR; + this.location = location; } } /** - * The WLB server refused a connection to XenServer. + * VGPU type is not one of the PGPU's supported types. */ - public static class WlbConnectionRefused extends XenAPIException { + public static class VgpuTypeNotSupported extends XenAPIException { + public final String type; + public final String supportedTypes; /** - * Create a new WlbConnectionRefused + * Create a new VgpuTypeNotSupported + * + * @param type + * @param supportedTypes */ - public WlbConnectionRefused() { - super("The WLB server refused a connection to XenServer."); + public VgpuTypeNotSupported(String type, String supportedTypes) { + super("VGPU type is not one of the PGPU's supported types."); + this.type = type; + this.supportedTypes = supportedTypes; } } /** - * The VSS plug-in cannot be contacted + * The host failed to acquire an IP address on its management interface and therefore cannot contact the master. */ - public static class VmSnapshotWithQuiescePluginDeosNotRespond extends XenAPIException { + public static class HostHasNoManagementIp extends XenAPIException { + + /** + * Create a new HostHasNoManagementIp + */ + public HostHasNoManagementIp() { + super("The host failed to acquire an IP address on its management interface and therefore cannot contact the master."); + } + + } + + /** + * Could not create the XML string generated by the transportable snapshot + */ + public static class XenVssReqErrorCreatingSnapshotXmlString extends XenAPIException { public final String vm; + public final String errorCode; /** - * Create a new VmSnapshotWithQuiescePluginDeosNotRespond + * Create a new XenVssReqErrorCreatingSnapshotXmlString * * @param vm + * @param errorCode */ - public VmSnapshotWithQuiescePluginDeosNotRespond(String vm) { - super("The VSS plug-in cannot be contacted"); + public XenVssReqErrorCreatingSnapshotXmlString(String vm, String errorCode) { + super("Could not create the XML string generated by the transportable snapshot"); this.vm = vm; + this.errorCode = errorCode; } } /** - * You attempted to run a VM on a host which doesn't have access to an SR needed by the VM. The VM has at least one VBD attached to a VDI in the SR. + * This PIF is a bond slave and cannot be plugged. */ - public static class VmRequiresSr extends XenAPIException { - public final String vm; - public final String sr; + public static class CannotPlugBondSlave extends XenAPIException { + public final String PIF; /** - * Create a new VmRequiresSr + * Create a new CannotPlugBondSlave * - * @param vm - * @param sr + * @param PIF */ - public VmRequiresSr(String vm, String sr) { - super("You attempted to run a VM on a host which doesn't have access to an SR needed by the VM. The VM has at least one VBD attached to a VDI in the SR."); - this.vm = vm; - this.sr = sr; + public CannotPlugBondSlave(String PIF) { + super("This PIF is a bond slave and cannot be plugged."); + this.PIF = PIF; } } /** - * This VM does not have a crashdump SR specified. + * VGPU type is not one of the PGPU's enabled types. */ - public static class VmNoCrashdumpSr extends XenAPIException { - public final String vm; + public static class VgpuTypeNotEnabled extends XenAPIException { + public final String type; + public final String enabledTypes; /** - * Create a new VmNoCrashdumpSr + * Create a new VgpuTypeNotEnabled * - * @param vm + * @param type + * @param enabledTypes */ - public VmNoCrashdumpSr(String vm) { - super("This VM does not have a crashdump SR specified."); - this.vm = vm; + public VgpuTypeNotEnabled(String type, String enabledTypes) { + super("VGPU type is not one of the PGPU's enabled types."); + this.type = type; + this.enabledTypes = enabledTypes; } } /** - * The operation could not be performed because the HA software is not installed on this host. + * The backup partition to stream the updat to cannot be found */ - public static class HaNotInstalled extends XenAPIException { - public final String host; + public static class CannotFindOemBackupPartition extends XenAPIException { /** - * Create a new HaNotInstalled + * Create a new CannotFindOemBackupPartition + */ + public CannotFindOemBackupPartition() { + super("The backup partition to stream the updat to cannot be found"); + } + + } + + /** + * This operation cannot be performed because the pif is bonded. + */ + public static class PifAlreadyBonded extends XenAPIException { + public final String PIF; + + /** + * Create a new PifAlreadyBonded * - * @param host + * @param PIF */ - public HaNotInstalled(String host) { - super("The operation could not be performed because the HA software is not installed on this host."); - this.host = host; + public PifAlreadyBonded(String PIF) { + super("This operation cannot be performed because the pif is bonded."); + this.PIF = PIF; } } /** - * A PIF with this specified device name already exists. + * The restore could not be performed because this backup has been created by a different (incompatible) product version */ - public static class DuplicatePifDeviceName extends XenAPIException { - public final String device; + public static class RestoreIncompatibleVersion extends XenAPIException { /** - * Create a new DuplicatePifDeviceName + * Create a new RestoreIncompatibleVersion + */ + public RestoreIncompatibleVersion() { + super("The restore could not be performed because this backup has been created by a different (incompatible) product version"); + } + + } + + /** + * The credentials given by the user are incorrect, so access has been denied, and you have not been issued a session handle. + */ + public static class SessionAuthenticationFailed extends XenAPIException { + + /** + * Create a new SessionAuthenticationFailed + */ + public SessionAuthenticationFailed() { + super("The credentials given by the user are incorrect, so access has been denied, and you have not been issued a session handle."); + } + + } + + /** + * A bond must consist of at least two member interfaces + */ + public static class PifBondNeedsMoreMembers extends XenAPIException { + + /** + * Create a new PifBondNeedsMoreMembers + */ + public PifBondNeedsMoreMembers() { + super("A bond must consist of at least two member interfaces"); + } + + } + + /** + * The host could not join the liveset because the HA daemon failed to start. + */ + public static class HaHeartbeatDaemonStartupFailed extends XenAPIException { + + /** + * Create a new HaHeartbeatDaemonStartupFailed + */ + public HaHeartbeatDaemonStartupFailed() { + super("The host could not join the liveset because the HA daemon failed to start."); + } + + } + + /** + * The value given is invalid + */ + public static class InvalidValue extends XenAPIException { + public final String field; + public final String value; + + /** + * Create a new InvalidValue * - * @param device + * @param field + * @param value */ - public DuplicatePifDeviceName(String device) { - super("A PIF with this specified device name already exists."); - this.device = device; + public InvalidValue(String field, String value) { + super("The value given is invalid"); + this.field = field; + this.value = value; } } /** - * You attempted an operation on a VM that was not in an appropriate power state at the time; for example, you attempted to start a VM that was already running. The parameters returned are the VM's handle, and the expected and actual VM state at the time of the call. + * A required parameter contained an invalid IP address */ - public static class VmBadPowerState extends XenAPIException { - public final String vm; - public final String expected; - public final String actual; + public static class InvalidIpAddressSpecified extends XenAPIException { + public final String parameter; /** - * Create a new VmBadPowerState + * Create a new InvalidIpAddressSpecified * - * @param vm - * @param expected - * @param actual + * @param parameter */ - public VmBadPowerState(String vm, String expected, String actual) { - super("You attempted an operation on a VM that was not in an appropriate power state at the time; for example, you attempted to start a VM that was already running. The parameters returned are the VM's handle, and the expected and actual VM state at the time of the call."); - this.vm = vm; - this.expected = expected; - this.actual = actual; + public InvalidIpAddressSpecified(String parameter) { + super("A required parameter contained an invalid IP address"); + this.parameter = parameter; } } /** - * This pool has wlb-enabled set to false. + * Cannot downgrade license while in pool. Please disband the pool first, then downgrade licenses on hosts separately. */ - public static class WlbDisabled extends XenAPIException { + public static class LicenseCannotDowngradeWhileInPool extends XenAPIException { /** - * Create a new WlbDisabled + * Create a new LicenseCannotDowngradeWhileInPool */ - public WlbDisabled() { - super("This pool has wlb-enabled set to false."); + public LicenseCannotDowngradeWhileInPool() { + super("Cannot downgrade license while in pool. Please disband the pool first, then downgrade licenses on hosts separately."); } } /** - * This VM operation cannot be performed on an older-versioned host during an upgrade. + * The given VMs failed to release memory when instructed to do so */ - public static class VmHostIncompatibleVersion extends XenAPIException { - public final String host; - public final String vm; + public static class VmsFailedToCooperate extends XenAPIException { /** - * Create a new VmHostIncompatibleVersion - * - * @param host - * @param vm + * Create a new VmsFailedToCooperate */ - public VmHostIncompatibleVersion(String host, String vm) { - super("This VM operation cannot be performed on an older-versioned host during an upgrade."); - this.host = host; - this.vm = vm; - } - - } - - /** - * Cannot join pool whose external authentication configuration is different. - */ - public static class PoolJoiningExternalAuthMismatch extends XenAPIException { - - /** - * Create a new PoolJoiningExternalAuthMismatch - */ - public PoolJoiningExternalAuthMismatch() { - super("Cannot join pool whose external authentication configuration is different."); - } - - } - - /** - * All VBDs of type 'disk' must be read/write for HVM guests - */ - public static class DiskVbdMustBeReadwriteForHvm extends XenAPIException { - public final String vbd; - - /** - * Create a new DiskVbdMustBeReadwriteForHvm - * - * @param vbd - */ - public DiskVbdMustBeReadwriteForHvm(String vbd) { - super("All VBDs of type 'disk' must be read/write for HVM guests"); - this.vbd = vbd; - } - - } - - /** - * The BIOS strings for this VM have already been set and cannot be changed anymore. - */ - public static class VmBiosStringsAlreadySet extends XenAPIException { - - /** - * Create a new VmBiosStringsAlreadySet - */ - public VmBiosStringsAlreadySet() { - super("The BIOS strings for this VM have already been set and cannot be changed anymore."); - } - - } - - /** - * The WLB server reported that its configured server name for this XenServer instance failed to resolve in DNS. - */ - public static class WlbXenserverUnknownHost extends XenAPIException { - - /** - * Create a new WlbXenserverUnknownHost - */ - public WlbXenserverUnknownHost() { - super("The WLB server reported that its configured server name for this XenServer instance failed to resolve in DNS."); - } - - } - - /** - * The host could not join the liveset because the HA daemon could not access the heartbeat disk. - */ - public static class HaHostCannotAccessStatefile extends XenAPIException { - - /** - * Create a new HaHostCannotAccessStatefile - */ - public HaHostCannotAccessStatefile() { - super("The host could not join the liveset because the HA daemon could not access the heartbeat disk."); - } - - } - - /** - * VM didn't acknowledge the need to shutdown. - */ - public static class VmFailedShutdownAcknowledgment extends XenAPIException { - - /** - * Create a new VmFailedShutdownAcknowledgment - */ - public VmFailedShutdownAcknowledgment() { - super("VM didn't acknowledge the need to shutdown."); - } - - } - - /** - * Error querying the external directory service. - */ - public static class AuthServiceError extends XenAPIException { - public final String message; - - /** - * Create a new AuthServiceError - * - * @param message - */ - public AuthServiceError(String message) { - super("Error querying the external directory service."); - this.message = message; - } - - } - - /** - * Cannot perform operation as the host is running in emergency mode. - */ - public static class HostInEmergencyMode extends XenAPIException { - - /** - * Create a new HostInEmergencyMode - */ - public HostInEmergencyMode() { - super("Cannot perform operation as the host is running in emergency mode."); + public VmsFailedToCooperate() { + super("The given VMs failed to release memory when instructed to do so"); } } @@ -5789,80 +4138,519 @@ public class Types } /** - * The default SR reference does not point to a valid SR + * Retrieving system status from the host failed. A diagnostic reason suitable for support organisations is also returned. */ - public static class DefaultSrNotFound extends XenAPIException { - public final String sr; + public static class SystemStatusRetrievalFailed extends XenAPIException { + public final String reason; /** - * Create a new DefaultSrNotFound + * Create a new SystemStatusRetrievalFailed * - * @param sr + * @param reason */ - public DefaultSrNotFound(String sr) { - super("The default SR reference does not point to a valid SR"); - this.sr = sr; + public SystemStatusRetrievalFailed(String reason) { + super("Retrieving system status from the host failed. A diagnostic reason suitable for support organisations is also returned."); + this.reason = reason; } } /** - * A device with the name given already exists on the selected VM + * The primary address types are not compatible */ - public static class DeviceAlreadyExists extends XenAPIException { - public final String device; + public static class PifIncompatiblePrimaryAddressType extends XenAPIException { /** - * Create a new DeviceAlreadyExists - * - * @param device + * Create a new PifIncompatiblePrimaryAddressType */ - public DeviceAlreadyExists(String device) { - super("A device with the name given already exists on the selected VM"); - this.device = device; + public PifIncompatiblePrimaryAddressType() { + super("The primary address types are not compatible"); } } /** - * The PBD could not be plugged because the SR is in use by another host and is not marked as sharable. + * The VM could not be imported; the end of the file was reached prematurely. */ - public static class SrNotSharable extends XenAPIException { - public final String sr; + public static class ImportErrorPrematureEof extends XenAPIException { + + /** + * Create a new ImportErrorPrematureEof + */ + public ImportErrorPrematureEof() { + super("The VM could not be imported; the end of the file was reached prematurely."); + } + + } + + /** + * The provision call can only be invoked on templates, not regular VMs. + */ + public static class ProvisionOnlyAllowedOnTemplate extends XenAPIException { + + /** + * Create a new ProvisionOnlyAllowedOnTemplate + */ + public ProvisionOnlyAllowedOnTemplate() { + super("The provision call can only be invoked on templates, not regular VMs."); + } + + } + + /** + * Media could not be ejected because it is not removable + */ + public static class VbdNotRemovableMedia extends XenAPIException { + public final String vbd; + + /** + * Create a new VbdNotRemovableMedia + * + * @param vbd + */ + public VbdNotRemovableMedia(String vbd) { + super("Media could not be ejected because it is not removable"); + this.vbd = vbd; + } + + } + + /** + * The GPU group does not contain any PGPUs. + */ + public static class GpuGroupContainsNoPgpus extends XenAPIException { + public final String gpuGroup; + + /** + * Create a new GpuGroupContainsNoPgpus + * + * @param gpuGroup + */ + public GpuGroupContainsNoPgpus(String gpuGroup) { + super("The GPU group does not contain any PGPUs."); + this.gpuGroup = gpuGroup; + } + + } + + /** + * The operation failed because the HA software on the specified host could not see a subset of other hosts. Check your network connectivity. + */ + public static class HaHostCannotSeePeers extends XenAPIException { public final String host; + public final String all; + public final String subset; /** - * Create a new SrNotSharable + * Create a new HaHostCannotSeePeers * - * @param sr * @param host + * @param all + * @param subset */ - public SrNotSharable(String sr, String host) { - super("The PBD could not be plugged because the SR is in use by another host and is not marked as sharable."); - this.sr = sr; + public HaHostCannotSeePeers(String host, String all, String subset) { + super("The operation failed because the HA software on the specified host could not see a subset of other hosts. Check your network connectivity."); this.host = host; + this.all = all; + this.subset = subset; } } /** - * You attempted to migrate a VM which has a checkpoint. + * The host failed to enable external authentication. */ - public static class VmHasCheckpoint extends XenAPIException { + public static class AuthEnableFailed extends XenAPIException { + public final String message; + + /** + * Create a new AuthEnableFailed + * + * @param message + */ + public AuthEnableFailed(String message) { + super("The host failed to enable external authentication."); + this.message = message; + } + + } + + /** + * The host name is invalid. + */ + public static class HostNameInvalid extends XenAPIException { + public final String reason; + + /** + * Create a new HostNameInvalid + * + * @param reason + */ + public HostNameInvalid(String reason) { + super("The host name is invalid."); + this.reason = reason; + } + + } + + /** + * The WLB server reported that XenServer refused it a connection (even though we're connecting perfectly fine in the other direction). + */ + public static class WlbXenserverConnectionRefused extends XenAPIException { + + /** + * Create a new WlbXenserverConnectionRefused + */ + public WlbXenserverConnectionRefused() { + super("The WLB server reported that XenServer refused it a connection (even though we're connecting perfectly fine in the other direction)."); + } + + } + + /** + * Could not find any volumes supported by the Citrix XenServer Vss Provider + */ + public static class XenVssReqErrorNoVolumesSupported extends XenAPIException { + public final String vm; + public final String errorCode; + + /** + * Create a new XenVssReqErrorNoVolumesSupported + * + * @param vm + * @param errorCode + */ + public XenVssReqErrorNoVolumesSupported(String vm, String errorCode) { + super("Could not find any volumes supported by the Citrix XenServer Vss Provider"); + this.vm = vm; + this.errorCode = errorCode; + } + + } + + /** + * Not enough host memory is available to perform this operation + */ + public static class HostNotEnoughFreeMemory extends XenAPIException { + public final String needed; + public final String available; + + /** + * Create a new HostNotEnoughFreeMemory + * + * @param needed + * @param available + */ + public HostNotEnoughFreeMemory(String needed, String available) { + super("Not enough host memory is available to perform this operation"); + this.needed = needed; + this.available = available; + } + + } + + /** + * This host cannot be evacuated. + */ + public static class CannotEvacuateHost extends XenAPIException { + public final String errors; + + /** + * Create a new CannotEvacuateHost + * + * @param errors + */ + public CannotEvacuateHost(String errors) { + super("This host cannot be evacuated."); + this.errors = errors; + } + + } + + /** + * This operation is not allowed as the VM is part of an appliance. + */ + public static class VmIsPartOfAnAppliance extends XenAPIException { + public final String vm; + public final String appliance; + + /** + * Create a new VmIsPartOfAnAppliance + * + * @param vm + * @param appliance + */ + public VmIsPartOfAnAppliance(String vm, String appliance) { + super("This operation is not allowed as the VM is part of an appliance."); + this.vm = vm; + this.appliance = appliance; + } + + } + + /** + * The operation cannot be performed on physical device + */ + public static class VdiIsAPhysicalDevice extends XenAPIException { + public final String vdi; + + /** + * Create a new VdiIsAPhysicalDevice + * + * @param vdi + */ + public VdiIsAPhysicalDevice(String vdi) { + super("The operation cannot be performed on physical device"); + this.vdi = vdi; + } + + } + + /** + * The operation could not proceed because necessary VDIs were already locked at the storage level. + */ + public static class SrVdiLockingFailed extends XenAPIException { + + /** + * Create a new SrVdiLockingFailed + */ + public SrVdiLockingFailed() { + super("The operation could not proceed because necessary VDIs were already locked at the storage level."); + } + + } + + /** + * You tried to create a PIF, but it already exists. + */ + public static class PifVlanExists extends XenAPIException { + public final String PIF; + + /** + * Create a new PifVlanExists + * + * @param PIF + */ + public PifVlanExists(String PIF) { + super("You tried to create a PIF, but it already exists."); + this.PIF = PIF; + } + + } + + /** + * The hosts in this pool are not compatible. + */ + public static class HostsNotCompatible extends XenAPIException { + + /** + * Create a new HostsNotCompatible + */ + public HostsNotCompatible() { + super("The hosts in this pool are not compatible."); + } + + } + + /** + * This operation cannot be performed because the specified VM is protected by xHA + */ + public static class VmIsProtected extends XenAPIException { public final String vm; /** - * Create a new VmHasCheckpoint + * Create a new VmIsProtected * * @param vm */ - public VmHasCheckpoint(String vm) { - super("You attempted to migrate a VM which has a checkpoint."); + public VmIsProtected(String vm) { + super("This operation cannot be performed because the specified VM is protected by xHA"); this.vm = vm; } } + /** + * This host cannot join the pool because the pool has HA enabled but this host has HA disabled. + */ + public static class HaPoolIsEnabledButHostIsDisabled extends XenAPIException { + + /** + * Create a new HaPoolIsEnabledButHostIsDisabled + */ + public HaPoolIsEnabledButHostIsDisabled() { + super("This host cannot join the pool because the pool has HA enabled but this host has HA disabled."); + } + + } + + /** + * There was a problem with the license daemon (v6d). Is it running? + */ + public static class V6dFailure extends XenAPIException { + + /** + * Create a new V6dFailure + */ + public V6dFailure() { + super("There was a problem with the license daemon (v6d). Is it running?"); + } + + } + + /** + * A timeout happened while attempting to detach a device from a VM. + */ + public static class DeviceDetachTimeout extends XenAPIException { + public final String type; + public final String ref; + + /** + * Create a new DeviceDetachTimeout + * + * @param type + * @param ref + */ + public DeviceDetachTimeout(String type, String ref) { + super("A timeout happened while attempting to detach a device from a VM."); + this.type = type; + this.ref = ref; + } + + } + + /** + * There was an error processing your license. Please contact your support representative. + */ + public static class LicenseProcessingError extends XenAPIException { + + /** + * Create a new LicenseProcessingError + */ + public LicenseProcessingError() { + super("There was an error processing your license. Please contact your support representative."); + } + + } + + /** + * Operation cannot proceed while a VLAN exists on this interface. + */ + public static class PifVlanStillExists extends XenAPIException { + public final String PIF; + + /** + * Create a new PifVlanStillExists + * + * @param PIF + */ + public PifVlanStillExists(String PIF) { + super("Operation cannot proceed while a VLAN exists on this interface."); + this.PIF = PIF; + } + + } + + /** + * The VM unexpectedly rebooted + */ + public static class VmRebooted extends XenAPIException { + public final String vm; + + /** + * Create a new VmRebooted + * + * @param vm + */ + public VmRebooted(String vm) { + super("The VM unexpectedly rebooted"); + this.vm = vm; + } + + } + + /** + * The specified object no longer exists. + */ + public static class ObjectNolongerExists extends XenAPIException { + + /** + * Create a new ObjectNolongerExists + */ + public ObjectNolongerExists() { + super("The specified object no longer exists."); + } + + } + + /** + * The certificate library is corrupt or unreadable. + */ + public static class CertificateLibraryCorrupt extends XenAPIException { + + /** + * Create a new CertificateLibraryCorrupt + */ + public CertificateLibraryCorrupt() { + super("The certificate library is corrupt or unreadable."); + } + + } + + /** + * Cannot restore this VM because it would create a duplicate + */ + public static class DuplicateVm extends XenAPIException { + public final String vm; + + /** + * Create a new DuplicateVm + * + * @param vm + */ + public DuplicateVm(String vm) { + super("Cannot restore this VM because it would create a duplicate"); + this.vm = vm; + } + + } + + /** + * A certificate already exists with the specified name. + */ + public static class CertificateAlreadyExists extends XenAPIException { + public final String name; + + /** + * Create a new CertificateAlreadyExists + * + * @param name + */ + public CertificateAlreadyExists(String name) { + super("A certificate already exists with the specified name."); + this.name = name; + } + + } + + /** + * The specified certificate is corrupt or unreadable. + */ + public static class CertificateCorrupt extends XenAPIException { + public final String name; + + /** + * Create a new CertificateCorrupt + * + * @param name + */ + public CertificateCorrupt(String name) { + super("The specified certificate is corrupt or unreadable."); + this.name = name; + } + + } + /** * The SM plugin did not respond to a query. */ @@ -5882,75 +4670,65 @@ public class Types } /** - * This VM is assigned to a protection policy. + * This pool has wlb-enabled set to false. */ - public static class VmAssignedToProtectionPolicy extends XenAPIException { - public final String vm; - public final String vmpp; + public static class WlbDisabled extends XenAPIException { /** - * Create a new VmAssignedToProtectionPolicy - * - * @param vm - * @param vmpp + * Create a new WlbDisabled */ - public VmAssignedToProtectionPolicy(String vm, String vmpp) { - super("This VM is assigned to a protection policy."); - this.vm = vm; - this.vmpp = vmpp; + public WlbDisabled() { + super("This pool has wlb-enabled set to false."); } } /** - * RBAC permission denied. + * The GPU group contains active PGPUs and cannot be deleted. */ - public static class RbacPermissionDenied extends XenAPIException { - public final String permission; - public final String message; + public static class GpuGroupContainsPgpu extends XenAPIException { + public final String pgpus; /** - * Create a new RbacPermissionDenied + * Create a new GpuGroupContainsPgpu * - * @param permission - * @param message + * @param pgpus */ - public RbacPermissionDenied(String permission, String message) { - super("RBAC permission denied."); - this.permission = permission; - this.message = message; + public GpuGroupContainsPgpu(String pgpus) { + super("The GPU group contains active PGPUs and cannot be deleted."); + this.pgpus = pgpus; } } /** - * The host failed to disable external authentication. + * This VDI was not mapped to a destination SR in VM.migrate_send operation */ - public static class AuthDisableFailedPermissionDenied extends XenAPIException { - public final String message; + public static class VdiNotInMap extends XenAPIException { + public final String vdi; /** - * Create a new AuthDisableFailedPermissionDenied + * Create a new VdiNotInMap * - * @param message + * @param vdi */ - public AuthDisableFailedPermissionDenied(String message) { - super("The host failed to disable external authentication."); - this.message = message; + public VdiNotInMap(String vdi) { + super("This VDI was not mapped to a destination SR in VM.migrate_send operation"); + this.vdi = vdi; } } /** - * Cannot downgrade license while in pool. Please disband the pool first, then downgrade licenses on hosts separately. + * This operation is not allowed under your license. Please contact your support representative. */ - public static class LicenseCannotDowngradeWhileInPool extends XenAPIException { + public static class LicenceRestriction extends XenAPIException { /** - * Create a new LicenseCannotDowngradeWhileInPool + * Create a new LicenceRestriction */ - public LicenseCannotDowngradeWhileInPool() { - super("Cannot downgrade license while in pool. Please disband the pool first, then downgrade licenses on hosts separately."); + public LicenceRestriction() { + super("This operation is not allowed under your license. Please contact your support representative."); } } @@ -5988,343 +4766,22 @@ public class Types } /** - * This operation cannot be performed because creating or deleting a bond involving the management interface is not allowed while HA is on. In order to do that, disable HA, create or delete the bond then re-enable HA. + * This operation cannot be performed because the specified VDI is of an incompatible type (eg: an HA statefile cannot be attached to a guest) */ - public static class HaCannotChangeBondStatusOfMgmtIface extends XenAPIException { - - /** - * Create a new HaCannotChangeBondStatusOfMgmtIface - */ - public HaCannotChangeBondStatusOfMgmtIface() { - super("This operation cannot be performed because creating or deleting a bond involving the management interface is not allowed while HA is on. In order to do that, disable HA, create or delete the bond then re-enable HA."); - } - - } - - /** - * This patch has already been applied - */ - public static class PatchAlreadyApplied extends XenAPIException { - public final String patch; - - /** - * Create a new PatchAlreadyApplied - * - * @param patch - */ - public PatchAlreadyApplied(String patch) { - super("This patch has already been applied"); - this.patch = patch; - } - - } - - /** - * An SR with that uuid already exists. - */ - public static class SrUuidExists extends XenAPIException { - public final String uuid; - - /** - * Create a new SrUuidExists - * - * @param uuid - */ - public SrUuidExists(String uuid) { - super("An SR with that uuid already exists."); - this.uuid = uuid; - } - - } - - /** - * The host failed to enable external authentication. - */ - public static class AuthEnableFailedDomainLookupFailed extends XenAPIException { - public final String message; - - /** - * Create a new AuthEnableFailedDomainLookupFailed - * - * @param message - */ - public AuthEnableFailedDomainLookupFailed(String message) { - super("The host failed to enable external authentication."); - this.message = message; - } - - } - - /** - * The patch precheck stage failed: the server is of an incorrect build. - */ - public static class PatchPrecheckFailedWrongServerBuild extends XenAPIException { - public final String patch; - public final String foundBuild; - public final String requiredBuild; - - /** - * Create a new PatchPrecheckFailedWrongServerBuild - * - * @param patch - * @param foundBuild - * @param requiredBuild - */ - public PatchPrecheckFailedWrongServerBuild(String patch, String foundBuild, String requiredBuild) { - super("The patch precheck stage failed: the server is of an incorrect build."); - this.patch = patch; - this.foundBuild = foundBuild; - this.requiredBuild = requiredBuild; - } - - } - - /** - * The given feature string is not valid. - */ - public static class InvalidFeatureString extends XenAPIException { - public final String details; - - /** - * Create a new InvalidFeatureString - * - * @param details - */ - public InvalidFeatureString(String details) { - super("The given feature string is not valid."); - this.details = details; - } - - } - - /** - * No WLB connection is configured. - */ - public static class WlbNotInitialized extends XenAPIException { - - /** - * Create a new WlbNotInitialized - */ - public WlbNotInitialized() { - super("No WLB connection is configured."); - } - - } - - /** - * You attempted an operation that was explicitly blocked (see the blocked_operations field of the given object). - */ - public static class OperationBlocked extends XenAPIException { - public final String ref; - public final String code; - - /** - * Create a new OperationBlocked - * - * @param ref - * @param code - */ - public OperationBlocked(String ref, String code) { - super("You attempted an operation that was explicitly blocked (see the blocked_operations field of the given object)."); - this.ref = ref; - this.code = code; - } - - } - - /** - * The provision call can only be invoked on templates, not regular VMs. - */ - public static class ProvisionOnlyAllowedOnTemplate extends XenAPIException { - - /** - * Create a new ProvisionOnlyAllowedOnTemplate - */ - public ProvisionOnlyAllowedOnTemplate() { - super("The provision call can only be invoked on templates, not regular VMs."); - } - - } - - /** - * VM failed to shutdown before the timeout expired - */ - public static class VmShutdownTimeout extends XenAPIException { - public final String vm; - public final String timeout; - - /** - * Create a new VmShutdownTimeout - * - * @param vm - * @param timeout - */ - public VmShutdownTimeout(String vm, String timeout) { - super("VM failed to shutdown before the timeout expired"); - this.vm = vm; - this.timeout = timeout; - } - - } - - /** - * Role already exists. - */ - public static class RoleAlreadyExists extends XenAPIException { - - /** - * Create a new RoleAlreadyExists - */ - public RoleAlreadyExists() { - super("Role already exists."); - } - - } - - /** - * The network contains active PIFs and cannot be deleted. - */ - public static class NetworkContainsPif extends XenAPIException { - public final String pifs; - - /** - * Create a new NetworkContainsPif - * - * @param pifs - */ - public NetworkContainsPif(String pifs) { - super("The network contains active PIFs and cannot be deleted."); - this.pifs = pifs; - } - - } - - /** - * Could not find a network interface with the specified device name and MAC address. - */ - public static class CouldNotFindNetworkInterfaceWithSpecifiedDeviceNameAndMacAddress extends XenAPIException { - public final String device; - public final String mac; - - /** - * Create a new CouldNotFindNetworkInterfaceWithSpecifiedDeviceNameAndMacAddress - * - * @param device - * @param mac - */ - public CouldNotFindNetworkInterfaceWithSpecifiedDeviceNameAndMacAddress(String device, String mac) { - super("Could not find a network interface with the specified device name and MAC address."); - this.device = device; - this.mac = mac; - } - - } - - /** - * There was an error connecting to the host. the service contacted didn't reply properly. - */ - public static class JoiningHostServiceFailed extends XenAPIException { - - /** - * Create a new JoiningHostServiceFailed - */ - public JoiningHostServiceFailed() { - super("There was an error connecting to the host. the service contacted didn't reply properly."); - } - - } - - /** - * This operation cannot be performed because the specified VDI could not be found on the storage substrate - */ - public static class VdiMissing extends XenAPIException { - public final String sr; + public static class VdiIncompatibleType extends XenAPIException { public final String vdi; - - /** - * Create a new VdiMissing - * - * @param sr - * @param vdi - */ - public VdiMissing(String sr, String vdi) { - super("This operation cannot be performed because the specified VDI could not be found on the storage substrate"); - this.sr = sr; - this.vdi = vdi; - } - - } - - /** - * This VM has locked the DVD drive tray, so the disk cannot be ejected - */ - public static class VbdTrayLocked extends XenAPIException { - public final String vbd; - - /** - * Create a new VbdTrayLocked - * - * @param vbd - */ - public VbdTrayLocked(String vbd) { - super("This VM has locked the DVD drive tray, so the disk cannot be ejected"); - this.vbd = vbd; - } - - } - - /** - * The pool failed to enable external authentication. - */ - public static class PoolAuthEnableFailedPermissionDenied extends XenAPIException { - public final String host; - public final String message; - - /** - * Create a new PoolAuthEnableFailedPermissionDenied - * - * @param host - * @param message - */ - public PoolAuthEnableFailedPermissionDenied(String host, String message) { - super("The pool failed to enable external authentication."); - this.host = host; - this.message = message; - } - - } - - /** - * The uuid you supplied was invalid. - */ - public static class UuidInvalid extends XenAPIException { public final String type; - public final String uuid; /** - * Create a new UuidInvalid + * Create a new VdiIncompatibleType * + * @param vdi * @param type - * @param uuid */ - public UuidInvalid(String type, String uuid) { - super("The uuid you supplied was invalid."); + public VdiIncompatibleType(String vdi, String type) { + super("This operation cannot be performed because the specified VDI is of an incompatible type (eg: an HA statefile cannot be attached to a guest)"); + this.vdi = vdi; this.type = type; - this.uuid = uuid; - } - - } - - /** - * This operation is not allowed under your license. Please contact your support representative. - */ - public static class LicenceRestriction extends XenAPIException { - - /** - * Create a new LicenceRestriction - */ - public LicenceRestriction() { - super("This operation is not allowed under your license. Please contact your support representative."); } } @@ -6351,108 +4808,258 @@ public class Types } /** - * This command is only allowed on the OEM edition. + * Archive more frequent than backup. */ - public static class OnlyAllowedOnOemEdition extends XenAPIException { - public final String command; + public static class VmppArchiveMoreFrequentThanBackup extends XenAPIException { /** - * Create a new OnlyAllowedOnOemEdition + * Create a new VmppArchiveMoreFrequentThanBackup + */ + public VmppArchiveMoreFrequentThanBackup() { + super("Archive more frequent than backup."); + } + + } + + /** + * The import failed because this export has been created by a different (incompatible) product version + */ + public static class ImportIncompatibleVersion extends XenAPIException { + + /** + * Create a new ImportIncompatibleVersion + */ + public ImportIncompatibleVersion() { + super("The import failed because this export has been created by a different (incompatible) product version"); + } + + } + + /** + * The edition you supplied is invalid. + */ + public static class InvalidEdition extends XenAPIException { + public final String edition; + + /** + * Create a new InvalidEdition * - * @param command + * @param edition */ - public OnlyAllowedOnOemEdition(String command) { - super("This command is only allowed on the OEM edition."); - this.command = command; + public InvalidEdition(String edition) { + super("The edition you supplied is invalid."); + this.edition = edition; } } /** - * The operation cannot be performed on physical device + * Error querying the external directory service. */ - public static class VdiIsAPhysicalDevice extends XenAPIException { - public final String vdi; + public static class AuthServiceError extends XenAPIException { + public final String message; /** - * Create a new VdiIsAPhysicalDevice + * Create a new AuthServiceError * - * @param vdi + * @param message */ - public VdiIsAPhysicalDevice(String vdi) { - super("The operation cannot be performed on physical device"); - this.vdi = vdi; + public AuthServiceError(String message) { + super("Error querying the external directory service."); + this.message = message; } } /** - * There was an error processing your license. Please contact your support representative. + * Some volumes to be snapshot could not be added to the VSS snapshot set */ - public static class LicenseProcessingError extends XenAPIException { + public static class XenVssReqErrorAddingVolumeToSnapsetFailed extends XenAPIException { + public final String vm; + public final String errorCode; /** - * Create a new LicenseProcessingError + * Create a new XenVssReqErrorAddingVolumeToSnapsetFailed + * + * @param vm + * @param errorCode */ - public LicenseProcessingError() { - super("There was an error processing your license. Please contact your support representative."); + public XenVssReqErrorAddingVolumeToSnapsetFailed(String vm, String errorCode) { + super("Some volumes to be snapshot could not be added to the VSS snapshot set"); + this.vm = vm; + this.errorCode = errorCode; } } /** - * The specified VBD device is not recognised: please use a non-negative integer + * Caller not allowed to perform this operation. */ - public static class IllegalVbdDevice extends XenAPIException { - public final String vbd; + public static class PermissionDenied extends XenAPIException { + public final String message; + + /** + * Create a new PermissionDenied + * + * @param message + */ + public PermissionDenied(String message) { + super("Caller not allowed to perform this operation."); + this.message = message; + } + + } + + /** + * A device with the name given already exists on the selected VM + */ + public static class DeviceAlreadyExists extends XenAPIException { public final String device; /** - * Create a new IllegalVbdDevice + * Create a new DeviceAlreadyExists * - * @param vbd * @param device */ - public IllegalVbdDevice(String vbd, String device) { - super("The specified VBD device is not recognised: please use a non-negative integer"); - this.vbd = vbd; + public DeviceAlreadyExists(String device) { + super("A device with the name given already exists on the selected VM"); this.device = device; } } /** - * The specified CRL does not exist. + * An SR with that uuid already exists. */ - public static class CrlDoesNotExist extends XenAPIException { - public final String name; + public static class SrUuidExists extends XenAPIException { + public final String uuid; /** - * Create a new CrlDoesNotExist + * Create a new SrUuidExists * - * @param name + * @param uuid */ - public CrlDoesNotExist(String name) { - super("The specified CRL does not exist."); - this.name = name; + public SrUuidExists(String uuid) { + super("An SR with that uuid already exists."); + this.uuid = uuid; } } /** - * The request was asynchronously cancelled. + * This operation could not be performed, because the VM has one or more virtual GPUs. */ - public static class TaskCancelled extends XenAPIException { - public final String task; + public static class VmHasVgpu extends XenAPIException { + public final String vm; /** - * Create a new TaskCancelled + * Create a new VmHasVgpu * - * @param task + * @param vm */ - public TaskCancelled(String task) { - super("The request was asynchronously cancelled."); - this.task = task; + public VmHasVgpu(String vm) { + super("This operation could not be performed, because the VM has one or more virtual GPUs."); + this.vm = vm; + } + + } + + /** + * You reached the maximal number of concurrently migrating VMs. + */ + public static class TooManyStorageMigrates extends XenAPIException { + public final String number; + + /** + * Create a new TooManyStorageMigrates + * + * @param number + */ + public TooManyStorageMigrates(String number) { + super("You reached the maximal number of concurrently migrating VMs."); + this.number = number; + } + + } + + /** + * The operation could not be performed because HA is enabled on the Pool + */ + public static class HaIsEnabled extends XenAPIException { + + /** + * Create a new HaIsEnabled + */ + public HaIsEnabled() { + super("The operation could not be performed because HA is enabled on the Pool"); + } + + } + + /** + * You tried to destroy a system network: these cannot be destroyed. + */ + public static class CannotDestroySystemNetwork extends XenAPIException { + public final String network; + + /** + * Create a new CannotDestroySystemNetwork + * + * @param network + */ + public CannotDestroySystemNetwork(String network) { + super("You tried to destroy a system network: these cannot be destroyed."); + this.network = network; + } + + } + + /** + * This operation needs the OpenVSwitch networking backend to be enabled on all hosts in the pool. + */ + public static class OpenvswitchNotActive extends XenAPIException { + + /** + * Create a new OpenvswitchNotActive + */ + public OpenvswitchNotActive() { + super("This operation needs the OpenVSwitch networking backend to be enabled on all hosts in the pool."); + } + + } + + /** + * The function is not implemented + */ + public static class NotImplemented extends XenAPIException { + public final String function; + + /** + * Create a new NotImplemented + * + * @param function + */ + public NotImplemented(String function) { + super("The function is not implemented"); + this.function = function; + } + + } + + /** + * Drive could not be hot-unplugged because it is not marked as unpluggable + */ + public static class VbdNotUnpluggable extends XenAPIException { + public final String vbd; + + /** + * Create a new VbdNotUnpluggable + * + * @param vbd + */ + public VbdNotUnpluggable(String vbd) { + super("Drive could not be hot-unplugged because it is not marked as unpluggable"); + this.vbd = vbd; } } @@ -6475,6 +5082,404 @@ public class Types } + /** + * You attempted an operation on a VM that was not in an appropriate power state at the time; for example, you attempted to start a VM that was already running. The parameters returned are the VM's handle, and the expected and actual VM state at the time of the call. + */ + public static class VmBadPowerState extends XenAPIException { + public final String vm; + public final String expected; + public final String actual; + + /** + * Create a new VmBadPowerState + * + * @param vm + * @param expected + * @param actual + */ + public VmBadPowerState(String vm, String expected, String actual) { + super("You attempted an operation on a VM that was not in an appropriate power state at the time; for example, you attempted to start a VM that was already running. The parameters returned are the VM's handle, and the expected and actual VM state at the time of the call."); + this.vm = vm; + this.expected = expected; + this.actual = actual; + } + + } + + /** + * The VM is set up to use a feature that requires it to boot as HVM. + */ + public static class FeatureRequiresHvm extends XenAPIException { + public final String details; + + /** + * Create a new FeatureRequiresHvm + * + * @param details + */ + public FeatureRequiresHvm(String details) { + super("The VM is set up to use a feature that requires it to boot as HVM."); + this.details = details; + } + + } + + /** + * The VM could not be imported because the XVA file is invalid: an unexpected file was encountered. + */ + public static class ImportErrorUnexpectedFile extends XenAPIException { + public final String filenameExpected; + public final String filenameFound; + + /** + * Create a new ImportErrorUnexpectedFile + * + * @param filenameExpected + * @param filenameFound + */ + public ImportErrorUnexpectedFile(String filenameExpected, String filenameFound) { + super("The VM could not be imported because the XVA file is invalid: an unexpected file was encountered."); + this.filenameExpected = filenameExpected; + this.filenameFound = filenameFound; + } + + } + + /** + * The SR operation cannot be performed because the SR is not empty. + */ + public static class SrNotEmpty extends XenAPIException { + + /** + * Create a new SrNotEmpty + */ + public SrNotEmpty() { + super("The SR operation cannot be performed because the SR is not empty."); + } + + } + + /** + * The host joining the pool cannot have any VMs with active tasks. + */ + public static class JoiningHostCannotHaveVmsWithCurrentOperations extends XenAPIException { + + /** + * Create a new JoiningHostCannotHaveVmsWithCurrentOperations + */ + public JoiningHostCannotHaveVmsWithCurrentOperations() { + super("The host joining the pool cannot have any VMs with active tasks."); + } + + } + + /** + * This operation cannot be performed because the system does not manage this VDI + */ + public static class VdiNotManaged extends XenAPIException { + public final String vdi; + + /** + * Create a new VdiNotManaged + * + * @param vdi + */ + public VdiNotManaged(String vdi) { + super("This operation cannot be performed because the system does not manage this VDI"); + this.vdi = vdi; + } + + } + + /** + * The VM unexpectedly halted + */ + public static class VmHalted extends XenAPIException { + public final String vm; + + /** + * Create a new VmHalted + * + * @param vm + */ + public VmHalted(String vm) { + super("The VM unexpectedly halted"); + this.vm = vm; + } + + } + + /** + * Could not find a network interface with the specified device name and MAC address. + */ + public static class CouldNotFindNetworkInterfaceWithSpecifiedDeviceNameAndMacAddress extends XenAPIException { + public final String device; + public final String mac; + + /** + * Create a new CouldNotFindNetworkInterfaceWithSpecifiedDeviceNameAndMacAddress + * + * @param device + * @param mac + */ + public CouldNotFindNetworkInterfaceWithSpecifiedDeviceNameAndMacAddress(String device, String mac) { + super("Could not find a network interface with the specified device name and MAC address."); + this.device = device; + this.mac = mac; + } + + } + + /** + * There was an SR backend failure. + */ + public static class SrBackendFailure extends XenAPIException { + public final String status; + public final String stdout; + public final String stderr; + + /** + * Create a new SrBackendFailure + * + * @param status + * @param stdout + * @param stderr + */ + public SrBackendFailure(String status, String stdout, String stderr) { + super("There was an SR backend failure."); + this.status = status; + this.stdout = stdout; + this.stderr = stderr; + } + + } + + /** + * The restore could not be performed because a network interface is missing + */ + public static class RestoreTargetMissingDevice extends XenAPIException { + public final String device; + + /** + * Create a new RestoreTargetMissingDevice + * + * @param device + */ + public RestoreTargetMissingDevice(String device) { + super("The restore could not be performed because a network interface is missing"); + this.device = device; + } + + } + + /** + * The operation attempted is not valid for a template VM + */ + public static class VmIsTemplate extends XenAPIException { + public final String vm; + + /** + * Create a new VmIsTemplate + * + * @param vm + */ + public VmIsTemplate(String vm) { + super("The operation attempted is not valid for a template VM"); + this.vm = vm; + } + + } + + /** + * This operation cannot be performed because it would invalidate VM failover planning such that the system would be unable to guarantee to restart protected VMs after a Host failure. + */ + public static class HaOperationWouldBreakFailoverPlan extends XenAPIException { + + /** + * Create a new HaOperationWouldBreakFailoverPlan + */ + public HaOperationWouldBreakFailoverPlan() { + super("This operation cannot be performed because it would invalidate VM failover planning such that the system would be unable to guarantee to restart protected VMs after a Host failure."); + } + + } + + /** + * There is at least one VM assigned to this protection policy. + */ + public static class VmppHasVm extends XenAPIException { + + /** + * Create a new VmppHasVm + */ + public VmppHasVm() { + super("There is at least one VM assigned to this protection policy."); + } + + } + + /** + * You gave an invalid object reference. The object may have recently been deleted. The class parameter gives the type of reference given, and the handle parameter echoes the bad value given. + */ + public static class HandleInvalid extends XenAPIException { + public final String clazz; + public final String handle; + + /** + * Create a new HandleInvalid + * + * @param clazz + * @param handle + */ + public HandleInvalid(String clazz, String handle) { + super("You gave an invalid object reference. The object may have recently been deleted. The class parameter gives the type of reference given, and the handle parameter echoes the bad value given."); + this.clazz = clazz; + this.handle = handle; + } + + } + + /** + * The host joining the pool must have a physical management NIC (i.e. the management NIC must not be on a VLAN or bonded PIF). + */ + public static class PoolJoiningHostMustHavePhysicalManagementNic extends XenAPIException { + + /** + * Create a new PoolJoiningHostMustHavePhysicalManagementNic + */ + public PoolJoiningHostMustHavePhysicalManagementNic() { + super("The host joining the pool must have a physical management NIC (i.e. the management NIC must not be on a VLAN or bonded PIF)."); + } + + } + + /** + * The device is already attached to a VM + */ + public static class DeviceAlreadyAttached extends XenAPIException { + public final String device; + + /** + * Create a new DeviceAlreadyAttached + * + * @param device + */ + public DeviceAlreadyAttached(String device) { + super("The device is already attached to a VM"); + this.device = device; + } + + } + + /** + * This operation is not supported during an upgrade. + */ + public static class NotSupportedDuringUpgrade extends XenAPIException { + + /** + * Create a new NotSupportedDuringUpgrade + */ + public NotSupportedDuringUpgrade() { + super("This operation is not supported during an upgrade."); + } + + } + + /** + * Some VMs belonging to the appliance threw an exception while carrying out the specified operation + */ + public static class OperationPartiallyFailed extends XenAPIException { + public final String operation; + + /** + * Create a new OperationPartiallyFailed + * + * @param operation + */ + public OperationPartiallyFailed(String operation) { + super("Some VMs belonging to the appliance threw an exception while carrying out the specified operation"); + this.operation = operation; + } + + } + + /** + * Another operation involving the object is currently in progress + */ + public static class OtherOperationInProgress extends XenAPIException { + public final String clazz; + public final String object; + + /** + * Create a new OtherOperationInProgress + * + * @param clazz + * @param object + */ + public OtherOperationInProgress(String clazz, String object) { + super("Another operation involving the object is currently in progress"); + this.clazz = clazz; + this.object = object; + } + + } + + /** + * You cannot bond interfaces across different hosts. + */ + public static class PifCannotBondCrossHost extends XenAPIException { + + /** + * Create a new PifCannotBondCrossHost + */ + public PifCannotBondCrossHost() { + super("You cannot bond interfaces across different hosts."); + } + + } + + /** + * The patch precheck stage failed: the server is of an incorrect version. + */ + public static class PatchPrecheckFailedWrongServerVersion extends XenAPIException { + public final String patch; + public final String foundVersion; + public final String requiredVersion; + + /** + * Create a new PatchPrecheckFailedWrongServerVersion + * + * @param patch + * @param foundVersion + * @param requiredVersion + */ + public PatchPrecheckFailedWrongServerVersion(String patch, String foundVersion, String requiredVersion) { + super("The patch precheck stage failed: the server is of an incorrect version."); + this.patch = patch; + this.foundVersion = foundVersion; + this.requiredVersion = requiredVersion; + } + + } + + /** + * Cannot plug VIF + */ + public static class CannotPlugVif extends XenAPIException { + public final String VIF; + + /** + * Create a new CannotPlugVif + * + * @param VIF + */ + public CannotPlugVif(String VIF) { + super("Cannot plug VIF"); + this.VIF = VIF; + } + + } + /** * The pool failed to enable external authentication. */ @@ -6497,153 +5502,344 @@ public class Types } /** - * Host cannot rejoin pool because it should have fenced (it is not in the master's partition) + * This command is not allowed on the OEM edition. */ - public static class HaShouldBeFenced extends XenAPIException { - public final String host; + public static class NotAllowedOnOemEdition extends XenAPIException { + public final String command; /** - * Create a new HaShouldBeFenced + * Create a new NotAllowedOnOemEdition * - * @param host + * @param command */ - public HaShouldBeFenced(String host) { - super("Host cannot rejoin pool because it should have fenced (it is not in the master's partition)"); - this.host = host; + public NotAllowedOnOemEdition(String command) { + super("This command is not allowed on the OEM edition."); + this.command = command; } } /** - * You attempted an operation on a VM that was judged to be unsafe by the server. This can happen if the VM would run on a CPU that has a potentially incompatible set of feature flags to those the VM requires. If you want to override this warning then use the 'force' option. + * The patch precheck stage failed with an unknown error. See attached info for more details. */ - public static class VmUnsafeBoot extends XenAPIException { + public static class PatchPrecheckFailedUnknownError extends XenAPIException { + public final String patch; + public final String info; + + /** + * Create a new PatchPrecheckFailedUnknownError + * + * @param patch + * @param info + */ + public PatchPrecheckFailedUnknownError(String patch, String info) { + super("The patch precheck stage failed with an unknown error. See attached info for more details."); + this.patch = patch; + this.info = info; + } + + } + + /** + * The specified CRL is corrupt or unreadable. + */ + public static class CrlCorrupt extends XenAPIException { + public final String name; + + /** + * Create a new CrlCorrupt + * + * @param name + */ + public CrlCorrupt(String name) { + super("The specified CRL is corrupt or unreadable."); + this.name = name; + } + + } + + /** + * Cannot join pool whose external authentication configuration is different. + */ + public static class PoolJoiningExternalAuthMismatch extends XenAPIException { + + /** + * Create a new PoolJoiningExternalAuthMismatch + */ + public PoolJoiningExternalAuthMismatch() { + super("Cannot join pool whose external authentication configuration is different."); + } + + } + + /** + * There was an error connecting to the host. the service contacted didn't reply properly. + */ + public static class JoiningHostServiceFailed extends XenAPIException { + + /** + * Create a new JoiningHostServiceFailed + */ + public JoiningHostServiceFailed() { + super("There was an error connecting to the host. the service contacted didn't reply properly."); + } + + } + + /** + * The system rejected the password change request; perhaps the new password was too short? + */ + public static class ChangePasswordRejected extends XenAPIException { + public final String msg; + + /** + * Create a new ChangePasswordRejected + * + * @param msg + */ + public ChangePasswordRejected(String msg) { + super("The system rejected the password change request; perhaps the new password was too short?"); + this.msg = msg; + } + + } + + /** + * The operation you requested cannot be performed because the specified PIF is not managed by xapi. + */ + public static class PifUnmanaged extends XenAPIException { + public final String PIF; + + /** + * Create a new PifUnmanaged + * + * @param PIF + */ + public PifUnmanaged(String PIF) { + super("The operation you requested cannot be performed because the specified PIF is not managed by xapi."); + this.PIF = PIF; + } + + } + + /** + * The specified VM has a duplicate VBD device and cannot be started. + */ + public static class VmDuplicateVbdDevice extends XenAPIException { + public final String vm; + public final String vbd; + public final String device; + + /** + * Create a new VmDuplicateVbdDevice + * + * @param vm + * @param vbd + * @param device + */ + public VmDuplicateVbdDevice(String vm, String vbd, String device) { + super("The specified VM has a duplicate VBD device and cannot be started."); + this.vm = vm; + this.vbd = vbd; + this.device = device; + } + + } + + /** + * The restore could not be performed because the restore script failed. Is the file corrupt? + */ + public static class RestoreScriptFailed extends XenAPIException { + public final String log; + + /** + * Create a new RestoreScriptFailed + * + * @param log + */ + public RestoreScriptFailed(String log) { + super("The restore could not be performed because the restore script failed. Is the file corrupt?"); + this.log = log; + } + + } + + /** + * The WLB server reported that communication with XenServer timed out. + */ + public static class WlbXenserverTimeout extends XenAPIException { + + /** + * Create a new WlbXenserverTimeout + */ + public WlbXenserverTimeout() { + super("The WLB server reported that communication with XenServer timed out."); + } + + } + + /** + * The MAC address specified doesn't exist on this host. + */ + public static class MacDoesNotExist extends XenAPIException { + public final String MAC; + + /** + * Create a new MacDoesNotExist + * + * @param MAC + */ + public MacDoesNotExist(String MAC) { + super("The MAC address specified doesn't exist on this host."); + this.MAC = MAC; + } + + } + + /** + * The host is its own slave. Please use pool-emergency-transition-to-master or pool-emergency-reset-master. + */ + public static class HostItsOwnSlave extends XenAPIException { + + /** + * Create a new HostItsOwnSlave + */ + public HostItsOwnSlave() { + super("The host is its own slave. Please use pool-emergency-transition-to-master or pool-emergency-reset-master."); + } + + } + + /** + * The host failed to disable external authentication. + */ + public static class AuthDisableFailedWrongCredentials extends XenAPIException { + public final String message; + + /** + * Create a new AuthDisableFailedWrongCredentials + * + * @param message + */ + public AuthDisableFailedWrongCredentials(String message) { + super("The host failed to disable external authentication."); + this.message = message; + } + + } + + /** + * HA can only be enabled for 2 hosts or more. Note that 2 hosts requires a pre-configured quorum tiebreak script. + */ + public static class HaTooFewHosts extends XenAPIException { + + /** + * Create a new HaTooFewHosts + */ + public HaTooFewHosts() { + super("HA can only be enabled for 2 hosts or more. Note that 2 hosts requires a pre-configured quorum tiebreak script."); + } + + } + + /** + * This VM is assigned to a protection policy. + */ + public static class VmAssignedToProtectionPolicy extends XenAPIException { + public final String vm; + public final String vmpp; + + /** + * Create a new VmAssignedToProtectionPolicy + * + * @param vm + * @param vmpp + */ + public VmAssignedToProtectionPolicy(String vm, String vmpp) { + super("This VM is assigned to a protection policy."); + this.vm = vm; + this.vmpp = vmpp; + } + + } + + /** + * You tried to add a key-value pair to a map, but that key is already there. + */ + public static class MapDuplicateKey extends XenAPIException { + public final String type; + public final String paramName; + public final String uuid; + public final String key; + + /** + * Create a new MapDuplicateKey + * + * @param type + * @param paramName + * @param uuid + * @param key + */ + public MapDuplicateKey(String type, String paramName, String uuid, String key) { + super("You tried to add a key-value pair to a map, but that key is already there."); + this.type = type; + this.paramName = paramName; + this.uuid = uuid; + this.key = key; + } + + } + + /** + * The master reports that it cannot talk back to the slave on the supplied management IP address. + */ + public static class HostMasterCannotTalkBack extends XenAPIException { + public final String ip; + + /** + * Create a new HostMasterCannotTalkBack + * + * @param ip + */ + public HostMasterCannotTalkBack(String ip) { + super("The master reports that it cannot talk back to the slave on the supplied management IP address."); + this.ip = ip; + } + + } + + /** + * An error occured while restoring the memory image of the specified virtual machine + */ + public static class VmCheckpointResumeFailed extends XenAPIException { public final String vm; /** - * Create a new VmUnsafeBoot + * Create a new VmCheckpointResumeFailed * * @param vm */ - public VmUnsafeBoot(String vm) { - super("You attempted an operation on a VM that was judged to be unsafe by the server. This can happen if the VM would run on a CPU that has a potentially incompatible set of feature flags to those the VM requires. If you want to override this warning then use the 'force' option."); + public VmCheckpointResumeFailed(String vm) { + super("An error occured while restoring the memory image of the specified virtual machine"); this.vm = vm; } } /** - * PIF has no IP configuration (mode curently set to 'none') + * The specified CRL name is invalid. */ - public static class PifHasNoNetworkConfiguration extends XenAPIException { + public static class CrlNameInvalid extends XenAPIException { + public final String name; /** - * Create a new PifHasNoNetworkConfiguration - */ - public PifHasNoNetworkConfiguration() { - super("PIF has no IP configuration (mode curently set to 'none')"); - } - - } - - /** - * The request was rejected because the server is too busy. - */ - public static class TooBusy extends XenAPIException { - - /** - * Create a new TooBusy - */ - public TooBusy() { - super("The request was rejected because the server is too busy."); - } - - } - - /** - * You attempted to set a value that is not supported by this implementation. The fully-qualified field name and the value that you tried to set are returned. Also returned is a developer-only diagnostic reason. - */ - public static class ValueNotSupported extends XenAPIException { - public final String field; - public final String value; - public final String reason; - - /** - * Create a new ValueNotSupported + * Create a new CrlNameInvalid * - * @param field - * @param value - * @param reason + * @param name */ - public ValueNotSupported(String field, String value, String reason) { - super("You attempted to set a value that is not supported by this implementation. The fully-qualified field name and the value that you tried to set are returned. Also returned is a developer-only diagnostic reason."); - this.field = field; - this.value = value; - this.reason = reason; - } - - } - - /** - * You gave an invalid session reference. It may have been invalidated by a server restart, or timed out. You should get a new session handle, using one of the session.login_ calls. This error does not invalidate the current connection. The handle parameter echoes the bad value given. - */ - public static class SessionInvalid extends XenAPIException { - public final String handle; - - /** - * Create a new SessionInvalid - * - * @param handle - */ - public SessionInvalid(String handle) { - super("You gave an invalid session reference. It may have been invalidated by a server restart, or timed out. You should get a new session handle, using one of the session.login_ calls. This error does not invalidate the current connection. The handle parameter echoes the bad value given."); - this.handle = handle; - } - - } - - /** - * This operation cannot be performed because the referenced network is not properly shared. The network must either be entirely virtual or must be physically present via a currently_attached PIF on every host. - */ - public static class HaConstraintViolationNetworkNotShared extends XenAPIException { - public final String network; - - /** - * Create a new HaConstraintViolationNetworkNotShared - * - * @param network - */ - public HaConstraintViolationNetworkNotShared(String network) { - super("This operation cannot be performed because the referenced network is not properly shared. The network must either be entirely virtual or must be physically present via a currently_attached PIF on every host."); - this.network = network; - } - - } - - /** - * HA could not be enabled on the Pool because a liveset could not be formed: check storage and network heartbeat paths. - */ - public static class HaFailedToFormLiveset extends XenAPIException { - - /** - * Create a new HaFailedToFormLiveset - */ - public HaFailedToFormLiveset() { - super("HA could not be enabled on the Pool because a liveset could not be formed: check storage and network heartbeat paths."); - } - - } - - /** - * You cannot bond interfaces across different hosts. - */ - public static class PifCannotBondCrossHost extends XenAPIException { - - /** - * Create a new PifCannotBondCrossHost - */ - public PifCannotBondCrossHost() { - super("You cannot bond interfaces across different hosts."); + public CrlNameInvalid(String name) { + super("The specified CRL name is invalid."); + this.name = name; } } @@ -6667,83 +5863,885 @@ public class Types } /** - * The operation cannot be performed until the SR has been upgraded + * Could not enable redo log. */ - public static class SrRequiresUpgrade extends XenAPIException { - public final String SR; + public static class CannotEnableRedoLog extends XenAPIException { + public final String reason; /** - * Create a new SrRequiresUpgrade + * Create a new CannotEnableRedoLog * - * @param SR + * @param reason */ - public SrRequiresUpgrade(String SR) { - super("The operation cannot be performed until the SR has been upgraded"); - this.SR = SR; + public CannotEnableRedoLog(String reason) { + super("Could not enable redo log."); + this.reason = reason; } } /** - * The specified certificate does not exist. + * The specified device was not found. */ - public static class CertificateDoesNotExist extends XenAPIException { - public final String name; + public static class PifDeviceNotFound extends XenAPIException { /** - * Create a new CertificateDoesNotExist + * Create a new PifDeviceNotFound + */ + public PifDeviceNotFound() { + super("The specified device was not found."); + } + + } + + /** + * This host cannot join a pool because it's license does not support pooling + */ + public static class LicenseDoesNotSupportPooling extends XenAPIException { + + /** + * Create a new LicenseDoesNotSupportPooling + */ + public LicenseDoesNotSupportPooling() { + super("This host cannot join a pool because it's license does not support pooling"); + } + + } + + /** + * You attempted an operation that was explicitly blocked (see the blocked_operations field of the given object). + */ + public static class OperationBlocked extends XenAPIException { + public final String ref; + public final String code; + + /** + * Create a new OperationBlocked * - * @param name + * @param ref + * @param code */ - public CertificateDoesNotExist(String name) { - super("The specified certificate does not exist."); - this.name = name; + public OperationBlocked(String ref, String code) { + super("You attempted an operation that was explicitly blocked (see the blocked_operations field of the given object)."); + this.ref = ref; + this.code = code; } } /** - * This operation cannot be performed because it would invalidate VM failover planning such that the system would be unable to guarantee to restart protected VMs after a Host failure. + * This VM does not have a crashdump SR specified. */ - public static class HaOperationWouldBreakFailoverPlan extends XenAPIException { + public static class VmNoCrashdumpSr extends XenAPIException { + public final String vm; /** - * Create a new HaOperationWouldBreakFailoverPlan - */ - public HaOperationWouldBreakFailoverPlan() { - super("This operation cannot be performed because it would invalidate VM failover planning such that the system would be unable to guarantee to restart protected VMs after a Host failure."); - } - - } - - /** - * The requested update could to be obtained from the master. - */ - public static class CannotFetchPatch extends XenAPIException { - public final String uuid; - - /** - * Create a new CannotFetchPatch + * Create a new VmNoCrashdumpSr * - * @param uuid + * @param vm */ - public CannotFetchPatch(String uuid) { - super("The requested update could to be obtained from the master."); - this.uuid = uuid; + public VmNoCrashdumpSr(String vm) { + super("This VM does not have a crashdump SR specified."); + this.vm = vm; } } /** - * The requested update could not be found. This can occur when you designate a new master or xe patch-clean. Please upload the update again + * This host is being evacuated. */ - public static class CannotFindPatch extends XenAPIException { + public static class HostEvacuateInProgress extends XenAPIException { + public final String host; /** - * Create a new CannotFindPatch + * Create a new HostEvacuateInProgress + * + * @param host */ - public CannotFindPatch() { - super("The requested update could not be found. This can occur when you designate a new master or xe patch-clean. Please upload the update again"); + public HostEvacuateInProgress(String host) { + super("This host is being evacuated."); + this.host = host; + } + + } + + /** + * You must use tar output to retrieve system status from an OEM host. + */ + public static class SystemStatusMustUseTarOnOem extends XenAPIException { + + /** + * Create a new SystemStatusMustUseTarOnOem + */ + public SystemStatusMustUseTarOnOem() { + super("You must use tar output to retrieve system status from an OEM host."); + } + + } + + /** + * Cannot find a plan for placement of VMs as there are no other hosts available. + */ + public static class HaNoPlan extends XenAPIException { + + /** + * Create a new HaNoPlan + */ + public HaNoPlan() { + super("Cannot find a plan for placement of VMs as there are no other hosts available."); + } + + } + + /** + * The master says the host is not known to it. Perhaps the Host was deleted from the master's database? Perhaps the slave is pointing to the wrong master? + */ + public static class HostUnknownToMaster extends XenAPIException { + public final String host; + + /** + * Create a new HostUnknownToMaster + * + * @param host + */ + public HostUnknownToMaster(String host) { + super("The master says the host is not known to it. Perhaps the Host was deleted from the master's database? Perhaps the slave is pointing to the wrong master?"); + this.host = host; + } + + } + + /** + * The host failed to enable external authentication. + */ + public static class AuthEnableFailedWrongCredentials extends XenAPIException { + public final String message; + + /** + * Create a new AuthEnableFailedWrongCredentials + * + * @param message + */ + public AuthEnableFailedWrongCredentials(String message) { + super("The host failed to enable external authentication."); + this.message = message; + } + + } + + /** + * You attempted an operation that was not allowed. + */ + public static class OperationNotAllowed extends XenAPIException { + public final String reason; + + /** + * Create a new OperationNotAllowed + * + * @param reason + */ + public OperationNotAllowed(String reason) { + super("You attempted an operation that was not allowed."); + this.reason = reason; + } + + } + + /** + * Only the local superuser can execute this operation + */ + public static class UserIsNotLocalSuperuser extends XenAPIException { + public final String msg; + + /** + * Create a new UserIsNotLocalSuperuser + * + * @param msg + */ + public UserIsNotLocalSuperuser(String msg) { + super("Only the local superuser can execute this operation"); + this.msg = msg; + } + + } + + /** + * HA could not be enabled on the Pool because a liveset could not be formed: check storage and network heartbeat paths. + */ + public static class HaFailedToFormLiveset extends XenAPIException { + + /** + * Create a new HaFailedToFormLiveset + */ + public HaFailedToFormLiveset() { + super("HA could not be enabled on the Pool because a liveset could not be formed: check storage and network heartbeat paths."); + } + + } + + /** + * The connection to the WLB server was reset. + */ + public static class WlbConnectionReset extends XenAPIException { + + /** + * Create a new WlbConnectionReset + */ + public WlbConnectionReset() { + super("The connection to the WLB server was reset."); + } + + } + + /** + * The host CDROM drive does not contain a valid CD + */ + public static class HostCdDriveEmpty extends XenAPIException { + + /** + * Create a new HostCdDriveEmpty + */ + public HostCdDriveEmpty() { + super("The host CDROM drive does not contain a valid CD"); + } + + } + + /** + * Some events have been lost from the queue and cannot be retrieved. + */ + public static class EventsLost extends XenAPIException { + + /** + * Create a new EventsLost + */ + public EventsLost() { + super("Some events have been lost from the queue and cannot be retrieved."); + } + + } + + /** + * The provision call failed because it ran out of space. + */ + public static class ProvisionFailedOutOfSpace extends XenAPIException { + + /** + * Create a new ProvisionFailedOutOfSpace + */ + public ProvisionFailedOutOfSpace() { + super("The provision call failed because it ran out of space."); + } + + } + + /** + * This license file is no longer accepted. Please upgrade to the new licensing system. + */ + public static class LicenseFileDeprecated extends XenAPIException { + + /** + * Create a new LicenseFileDeprecated + */ + public LicenseFileDeprecated() { + super("This license file is no longer accepted. Please upgrade to the new licensing system."); + } + + } + + /** + * Subject already exists. + */ + public static class SubjectAlreadyExists extends XenAPIException { + + /** + * Create a new SubjectAlreadyExists + */ + public SubjectAlreadyExists() { + super("Subject already exists."); + } + + } + + /** + * This VM operation cannot be performed on an older-versioned host during an upgrade. + */ + public static class VmHostIncompatibleVersion extends XenAPIException { + public final String host; + public final String vm; + + /** + * Create a new VmHostIncompatibleVersion + * + * @param host + * @param vm + */ + public VmHostIncompatibleVersion(String host, String vm) { + super("This VM operation cannot be performed on an older-versioned host during an upgrade."); + this.host = host; + this.vm = vm; + } + + } + + /** + * This host failed in the middle of an automatic failover operation and needs to retry the failover action + */ + public static class HostBroken extends XenAPIException { + + /** + * Create a new HostBroken + */ + public HostBroken() { + super("This host failed in the middle of an automatic failover operation and needs to retry the failover action"); + } + + } + + /** + * This pool is not in emergency mode. + */ + public static class NotInEmergencyMode extends XenAPIException { + + /** + * Create a new NotInEmergencyMode + */ + public NotInEmergencyMode() { + super("This pool is not in emergency mode."); + } + + } + + /** + * Role cannot be found. + */ + public static class RoleNotFound extends XenAPIException { + + /** + * Create a new RoleNotFound + */ + public RoleNotFound() { + super("Role cannot be found."); + } + + } + + /** + * The MAC address specified still exists on this host. + */ + public static class MacStillExists extends XenAPIException { + public final String MAC; + + /** + * Create a new MacStillExists + * + * @param MAC + */ + public MacStillExists(String MAC) { + super("The MAC address specified still exists on this host."); + this.MAC = MAC; + } + + } + + /** + * The operation could not be performed while the host is still armed; it must be disarmed first + */ + public static class HaHostIsArmed extends XenAPIException { + public final String host; + + /** + * Create a new HaHostIsArmed + * + * @param host + */ + public HaHostIsArmed(String host) { + super("The operation could not be performed while the host is still armed; it must be disarmed first"); + this.host = host; + } + + } + + /** + * The host joining the pool cannot have any running VMs. + */ + public static class JoiningHostCannotHaveRunningVms extends XenAPIException { + + /** + * Create a new JoiningHostCannotHaveRunningVms + */ + public JoiningHostCannotHaveRunningVms() { + super("The host joining the pool cannot have any running VMs."); + } + + } + + /** + * An internal error generated by the domain builder. + */ + public static class DomainBuilderError extends XenAPIException { + public final String function; + public final String code; + public final String message; + + /** + * Create a new DomainBuilderError + * + * @param function + * @param code + * @param message + */ + public DomainBuilderError(String function, String code, String message) { + super("An internal error generated by the domain builder."); + this.function = function; + this.code = code; + this.message = message; + } + + } + + /** + * This operation cannot be performed because the referenced network is not properly shared. The network must either be entirely virtual or must be physically present via a currently_attached PIF on every host. + */ + public static class HaConstraintViolationNetworkNotShared extends XenAPIException { + public final String network; + + /** + * Create a new HaConstraintViolationNetworkNotShared + * + * @param network + */ + public HaConstraintViolationNetworkNotShared(String network) { + super("This operation cannot be performed because the referenced network is not properly shared. The network must either be entirely virtual or must be physically present via a currently_attached PIF on every host."); + this.network = network; + } + + } + + /** + * The pool master host cannot be removed. + */ + public static class HostCannotDestroySelf extends XenAPIException { + public final String host; + + /** + * Create a new HostCannotDestroySelf + * + * @param host + */ + public HostCannotDestroySelf(String host) { + super("The pool master host cannot be removed."); + this.host = host; + } + + } + + /** + * The WLB server reported an internal error. + */ + public static class WlbInternalError extends XenAPIException { + + /** + * Create a new WlbInternalError + */ + public WlbInternalError() { + super("The WLB server reported an internal error."); + } + + } + + /** + * The value specified is of the wrong type + */ + public static class FieldTypeError extends XenAPIException { + public final String field; + + /** + * Create a new FieldTypeError + * + * @param field + */ + public FieldTypeError(String field) { + super("The value specified is of the wrong type"); + this.field = field; + } + + } + + /** + * The device is not currently attached + */ + public static class DeviceAlreadyDetached extends XenAPIException { + public final String device; + + /** + * Create a new DeviceAlreadyDetached + * + * @param device + */ + public DeviceAlreadyDetached(String device) { + super("The device is not currently attached"); + this.device = device; + } + + } + + /** + * The GPU group contains active VGPUs and cannot be deleted. + */ + public static class GpuGroupContainsVgpu extends XenAPIException { + public final String vgpus; + + /** + * Create a new GpuGroupContainsVgpu + * + * @param vgpus + */ + public GpuGroupContainsVgpu(String vgpus) { + super("The GPU group contains active VGPUs and cannot be deleted."); + this.vgpus = vgpus; + } + + } + + /** + * The VM rejected the attempt to detach the device. + */ + public static class DeviceDetachRejected extends XenAPIException { + public final String type; + public final String ref; + public final String msg; + + /** + * Create a new DeviceDetachRejected + * + * @param type + * @param ref + * @param msg + */ + public DeviceDetachRejected(String type, String ref, String msg) { + super("The VM rejected the attempt to detach the device."); + this.type = type; + this.ref = ref; + this.msg = msg; + } + + } + + /** + * The SR could not be connected because the driver was not recognised. + */ + public static class SrUnknownDriver extends XenAPIException { + public final String driver; + + /** + * Create a new SrUnknownDriver + * + * @param driver + */ + public SrUnknownDriver(String driver) { + super("The SR could not be connected because the driver was not recognised."); + this.driver = driver; + } + + } + + /** + * The hosts in this pool are not homogeneous. + */ + public static class HostsNotHomogeneous extends XenAPIException { + public final String reason; + + /** + * Create a new HostsNotHomogeneous + * + * @param reason + */ + public HostsNotHomogeneous(String reason) { + super("The hosts in this pool are not homogeneous."); + this.reason = reason; + } + + } + + /** + * The VDI could not be opened for metadata recovery as it contains the current pool's metadata. + */ + public static class VdiContainsMetadataOfThisPool extends XenAPIException { + public final String vdi; + public final String pool; + + /** + * Create a new VdiContainsMetadataOfThisPool + * + * @param vdi + * @param pool + */ + public VdiContainsMetadataOfThisPool(String vdi, String pool) { + super("The VDI could not be opened for metadata recovery as it contains the current pool's metadata."); + this.vdi = vdi; + this.pool = pool; + } + + } + + /** + * The PBD could not be plugged because the SR is in use by another host and is not marked as sharable. + */ + public static class SrNotSharable extends XenAPIException { + public final String sr; + public final String host; + + /** + * Create a new SrNotSharable + * + * @param sr + * @param host + */ + public SrNotSharable(String sr, String host) { + super("The PBD could not be plugged because the SR is in use by another host and is not marked as sharable."); + this.sr = sr; + this.host = host; + } + + } + + /** + * The pool failed to enable external authentication. + */ + public static class PoolAuthEnableFailedDuplicateHostname extends XenAPIException { + public final String host; + public final String message; + + /** + * Create a new PoolAuthEnableFailedDuplicateHostname + * + * @param host + * @param message + */ + public PoolAuthEnableFailedDuplicateHostname(String host, String message) { + super("The pool failed to enable external authentication."); + this.host = host; + this.message = message; + } + + } + + /** + * The operation could not be performed because HA is not enabled on the Pool + */ + public static class HaNotEnabled extends XenAPIException { + + /** + * Create a new HaNotEnabled + */ + public HaNotEnabled() { + super("The operation could not be performed because HA is not enabled on the Pool"); + } + + } + + /** + * Attaching this SR failed. + */ + public static class SrAttachFailed extends XenAPIException { + public final String sr; + + /** + * Create a new SrAttachFailed + * + * @param sr + */ + public SrAttachFailed(String sr) { + super("Attaching this SR failed."); + this.sr = sr; + } + + } + + /** + * You tried to call a method with the incorrect number of parameters. The fully-qualified method name that you used, and the number of received and expected parameters are returned. + */ + public static class MessageParameterCountMismatch extends XenAPIException { + public final String method; + public final String expected; + public final String received; + + /** + * Create a new MessageParameterCountMismatch + * + * @param method + * @param expected + * @param received + */ + public MessageParameterCountMismatch(String method, String expected, String received) { + super("You tried to call a method with the incorrect number of parameters. The fully-qualified method name that you used, and the number of received and expected parameters are returned."); + this.method = method; + this.expected = expected; + this.received = received; + } + + } + + /** + * The specified VM has too little memory to be started. + */ + public static class VmMemorySizeTooLow extends XenAPIException { + public final String vm; + + /** + * Create a new VmMemorySizeTooLow + * + * @param vm + */ + public VmMemorySizeTooLow(String vm) { + super("The specified VM has too little memory to be started."); + this.vm = vm; + } + + } + + /** + * The host joining the pool must have the same product version as the pool master. + */ + public static class PoolJoiningHostMustHaveSameProductVersion extends XenAPIException { + + /** + * Create a new PoolJoiningHostMustHaveSameProductVersion + */ + public PoolJoiningHostMustHaveSameProductVersion() { + super("The host joining the pool must have the same product version as the pool master."); + } + + } + + /** + * You attempted to run a VM on a host which doesn't have I/O virtualization (IOMMU/VT-d) enabled, which is needed by the VM. + */ + public static class VmRequiresIommu extends XenAPIException { + public final String host; + + /** + * Create a new VmRequiresIommu + * + * @param host + */ + public VmRequiresIommu(String host) { + super("You attempted to run a VM on a host which doesn't have I/O virtualization (IOMMU/VT-d) enabled, which is needed by the VM."); + this.host = host; + } + + } + + /** + * The pool failed to enable external authentication. + */ + public static class PoolAuthEnableFailedPermissionDenied extends XenAPIException { + public final String host; + public final String message; + + /** + * Create a new PoolAuthEnableFailedPermissionDenied + * + * @param host + * @param message + */ + public PoolAuthEnableFailedPermissionDenied(String host, String message) { + super("The pool failed to enable external authentication."); + this.host = host; + this.message = message; + } + + } + + /** + * VM cannot be started because it requires a VDI which cannot be attached + */ + public static class VmRequiresVdi extends XenAPIException { + public final String vm; + public final String vdi; + + /** + * Create a new VmRequiresVdi + * + * @param vm + * @param vdi + */ + public VmRequiresVdi(String vm, String vdi) { + super("VM cannot be started because it requires a VDI which cannot be attached"); + this.vm = vm; + this.vdi = vdi; + } + + } + + /** + * There was an error connecting to the host while joining it in the pool. + */ + public static class JoiningHostConnectionFailed extends XenAPIException { + + /** + * Create a new JoiningHostConnectionFailed + */ + public JoiningHostConnectionFailed() { + super("There was an error connecting to the host while joining it in the pool."); + } + + } + + /** + * You tried to create a PIF, but the network you tried to attach it to is already attached to some other PIF, and so the creation failed. + */ + public static class NetworkAlreadyConnected extends XenAPIException { + public final String network; + public final String connectedPIF; + + /** + * Create a new NetworkAlreadyConnected + * + * @param network + * @param connectedPIF + */ + public NetworkAlreadyConnected(String network, String connectedPIF) { + super("You tried to create a PIF, but the network you tried to attach it to is already attached to some other PIF, and so the creation failed."); + this.network = network; + this.connectedPIF = connectedPIF; + } + + } + + /** + * This host can not be forgotten because there are some user VMs still running + */ + public static class HostHasResidentVms extends XenAPIException { + public final String host; + + /** + * Create a new HostHasResidentVms + * + * @param host + */ + public HostHasResidentVms(String host) { + super("This host can not be forgotten because there are some user VMs still running"); + this.host = host; + } + + } + + /** + * This session is not registered to receive events. You must call event.register before event.next. The session handle you are using is echoed. + */ + public static class SessionNotRegistered extends XenAPIException { + public final String handle; + + /** + * Create a new SessionNotRegistered + * + * @param handle + */ + public SessionNotRegistered(String handle) { + super("This session is not registered to receive events. You must call event.register before event.next. The session handle you are using is echoed."); + this.handle = handle; } } @@ -6773,22 +6771,362 @@ public class Types } /** - * You attempted to run a VM on a host which doesn't have a PIF on a Network needed by the VM. The VM has at least one VIF attached to the Network. + * The SR could not be destroyed, as the 'indestructible' flag was set on it. */ - public static class VmRequiresNetwork extends XenAPIException { - public final String vm; - public final String network; + public static class SrIndestructible extends XenAPIException { + public final String sr; /** - * Create a new VmRequiresNetwork + * Create a new SrIndestructible * - * @param vm - * @param network + * @param sr */ - public VmRequiresNetwork(String vm, String network) { - super("You attempted to run a VM on a host which doesn't have a PIF on a Network needed by the VM. The VM has at least one VIF attached to the Network."); - this.vm = vm; - this.network = network; + public SrIndestructible(String sr) { + super("The SR could not be destroyed, as the 'indestructible' flag was set on it."); + this.sr = sr; + } + + } + + /** + * The WLB server reported that XenServer said something to it that WLB wasn't expecting or didn't understand. + */ + public static class WlbXenserverMalformedResponse extends XenAPIException { + + /** + * Create a new WlbXenserverMalformedResponse + */ + public WlbXenserverMalformedResponse() { + super("The WLB server reported that XenServer said something to it that WLB wasn't expecting or didn't understand."); + } + + } + + /** + * This operation cannot be performed because this VDI could not be properly attached to the VM. + */ + public static class VdiNotAvailable extends XenAPIException { + public final String vdi; + + /** + * Create a new VdiNotAvailable + * + * @param vdi + */ + public VdiNotAvailable(String vdi) { + super("This operation cannot be performed because this VDI could not be properly attached to the VM."); + this.vdi = vdi; + } + + } + + /** + * The SR is full. Requested new size exceeds the maximum size + */ + public static class SrFull extends XenAPIException { + public final String requested; + public final String maximum; + + /** + * Create a new SrFull + * + * @param requested + * @param maximum + */ + public SrFull(String requested, String maximum) { + super("The SR is full. Requested new size exceeds the maximum size"); + this.requested = requested; + this.maximum = maximum; + } + + } + + /** + * The requested update could to be obtained from the master. + */ + public static class CannotFetchPatch extends XenAPIException { + public final String uuid; + + /** + * Create a new CannotFetchPatch + * + * @param uuid + */ + public CannotFetchPatch(String uuid) { + super("The requested update could to be obtained from the master."); + this.uuid = uuid; + } + + } + + /** + * Cannot perform operation as the host is running in emergency mode. + */ + public static class HostInEmergencyMode extends XenAPIException { + + /** + * Create a new HostInEmergencyMode + */ + public HostInEmergencyMode() { + super("Cannot perform operation as the host is running in emergency mode."); + } + + } + + /** + * Some data checksums were incorrect; the VM may be corrupt. + */ + public static class ImportErrorSomeChecksumsFailed extends XenAPIException { + + /** + * Create a new ImportErrorSomeChecksumsFailed + */ + public ImportErrorSomeChecksumsFailed() { + super("Some data checksums were incorrect; the VM may be corrupt."); + } + + } + + /** + * The requested plugin could not be found. + */ + public static class XenapiMissingPlugin extends XenAPIException { + public final String name; + + /** + * Create a new XenapiMissingPlugin + * + * @param name + */ + public XenapiMissingPlugin(String name) { + super("The requested plugin could not be found."); + this.name = name; + } + + } + + /** + * External authentication for this host is already enabled. + */ + public static class AuthAlreadyEnabled extends XenAPIException { + public final String currentAuthType; + public final String currentServiceName; + + /** + * Create a new AuthAlreadyEnabled + * + * @param currentAuthType + * @param currentServiceName + */ + public AuthAlreadyEnabled(String currentAuthType, String currentServiceName) { + super("External authentication for this host is already enabled."); + this.currentAuthType = currentAuthType; + this.currentServiceName = currentServiceName; + } + + } + + /** + * You attempted to set a value that is not supported by this implementation. The fully-qualified field name and the value that you tried to set are returned. Also returned is a developer-only diagnostic reason. + */ + public static class ValueNotSupported extends XenAPIException { + public final String field; + public final String value; + public final String reason; + + /** + * Create a new ValueNotSupported + * + * @param field + * @param value + * @param reason + */ + public ValueNotSupported(String field, String value, String reason) { + super("You attempted to set a value that is not supported by this implementation. The fully-qualified field name and the value that you tried to set are returned. Also returned is a developer-only diagnostic reason."); + this.field = field; + this.value = value; + this.reason = reason; + } + + } + + /** + * The tunnel transport PIF has no IP configuration set. + */ + public static class TransportPifNotConfigured extends XenAPIException { + public final String PIF; + + /** + * Create a new TransportPifNotConfigured + * + * @param PIF + */ + public TransportPifNotConfigured(String PIF) { + super("The tunnel transport PIF has no IP configuration set."); + this.PIF = PIF; + } + + } + + /** + * The patch precheck stage failed: there are one or more VMs still running on the server. All VMs must be suspended before the patch can be applied. + */ + public static class PatchPrecheckFailedVmRunning extends XenAPIException { + public final String patch; + + /** + * Create a new PatchPrecheckFailedVmRunning + * + * @param patch + */ + public PatchPrecheckFailedVmRunning(String patch) { + super("The patch precheck stage failed: there are one or more VMs still running on the server. All VMs must be suspended before the patch can be applied."); + this.patch = patch; + } + + } + + /** + * The SR is still connected to a host via a PBD. It cannot be destroyed or forgotten. + */ + public static class SrHasPbd extends XenAPIException { + public final String sr; + + /** + * Create a new SrHasPbd + * + * @param sr + */ + public SrHasPbd(String sr) { + super("The SR is still connected to a host via a PBD. It cannot be destroyed or forgotten."); + this.sr = sr; + } + + } + + /** + * The device name is invalid + */ + public static class InvalidDevice extends XenAPIException { + public final String device; + + /** + * Create a new InvalidDevice + * + * @param device + */ + public InvalidDevice(String device) { + super("The device name is invalid"); + this.device = device; + } + + } + + /** + * VGPU type is not compatible with one or more of the VGPU types currently running on this PGPU + */ + public static class VgpuTypeNotCompatibleWithRunningType extends XenAPIException { + public final String pgpu; + public final String type; + public final String runningType; + + /** + * Create a new VgpuTypeNotCompatibleWithRunningType + * + * @param pgpu + * @param type + * @param runningType + */ + public VgpuTypeNotCompatibleWithRunningType(String pgpu, String type, String runningType) { + super("VGPU type is not compatible with one or more of the VGPU types currently running on this PGPU"); + this.pgpu = pgpu; + this.type = type; + this.runningType = runningType; + } + + } + + /** + * An activation key can only be applied when the edition is set to 'free'. + */ + public static class ActivationWhileNotFree extends XenAPIException { + + /** + * Create a new ActivationWhileNotFree + */ + public ActivationWhileNotFree() { + super("An activation key can only be applied when the edition is set to 'free'."); + } + + } + + /** + * The operation required write access but this VDI is read-only + */ + public static class VdiReadonly extends XenAPIException { + public final String vdi; + + /** + * Create a new VdiReadonly + * + * @param vdi + */ + public VdiReadonly(String vdi) { + super("The operation required write access but this VDI is read-only"); + this.vdi = vdi; + } + + } + + /** + * This operation can only be performed on CD VDIs (iso files or CDROM drives) + */ + public static class VdiIsNotIso extends XenAPIException { + public final String vdi; + public final String type; + + /** + * Create a new VdiIsNotIso + * + * @param vdi + * @param type + */ + public VdiIsNotIso(String vdi, String type) { + super("This operation can only be performed on CD VDIs (iso files or CDROM drives)"); + this.vdi = vdi; + this.type = type; + } + + } + + /** + * The specified host is disabled. + */ + public static class HostDisabled extends XenAPIException { + public final String host; + + /** + * Create a new HostDisabled + * + * @param host + */ + public HostDisabled(String host) { + super("The specified host is disabled."); + this.host = host; + } + + } + + /** + * The WLB server refused a connection to XenServer. + */ + public static class WlbConnectionRefused extends XenAPIException { + + /** + * Create a new WlbConnectionRefused + */ + public WlbConnectionRefused() { + super("The WLB server refused a connection to XenServer."); } } @@ -6812,22 +7150,1425 @@ public class Types } /** - * Not enough host memory is available to perform this operation + * This operation could not be performed because the state partition could not be found */ - public static class HostNotEnoughFreeMemory extends XenAPIException { - public final String needed; - public final String available; + public static class CannotFindStatePartition extends XenAPIException { /** - * Create a new HostNotEnoughFreeMemory - * - * @param needed - * @param available + * Create a new CannotFindStatePartition */ - public HostNotEnoughFreeMemory(String needed, String available) { - super("Not enough host memory is available to perform this operation"); - this.needed = needed; - this.available = available; + public CannotFindStatePartition() { + super("This operation could not be performed because the state partition could not be found"); + } + + } + + /** + * The specified interface cannot be used because it has no IP address + */ + public static class InterfaceHasNoIp extends XenAPIException { + public final String iface; + + /** + * Create a new InterfaceHasNoIp + * + * @param iface + */ + public InterfaceHasNoIp(String iface) { + super("The specified interface cannot be used because it has no IP address"); + this.iface = iface; + } + + } + + /** + * The host joining the pool cannot have any running or suspended VMs. + */ + public static class JoiningHostCannotHaveRunningOrSuspendedVms extends XenAPIException { + + /** + * Create a new JoiningHostCannotHaveRunningOrSuspendedVms + */ + public JoiningHostCannotHaveRunningOrSuspendedVms() { + super("The host joining the pool cannot have any running or suspended VMs."); + } + + } + + /** + * The host failed to enable external authentication. + */ + public static class AuthEnableFailedDomainLookupFailed extends XenAPIException { + public final String message; + + /** + * Create a new AuthEnableFailedDomainLookupFailed + * + * @param message + */ + public AuthEnableFailedDomainLookupFailed(String message) { + super("The host failed to enable external authentication."); + this.message = message; + } + + } + + /** + * The given feature string is not valid. + */ + public static class InvalidFeatureString extends XenAPIException { + public final String details; + + /** + * Create a new InvalidFeatureString + * + * @param details + */ + public InvalidFeatureString(String details) { + super("The given feature string is not valid."); + this.details = details; + } + + } + + /** + * Cannot forward messages because the host cannot be contacted. The host may be switched off or there may be network connectivity problems. + */ + public static class CannotContactHost extends XenAPIException { + public final String host; + + /** + * Create a new CannotContactHost + * + * @param host + */ + public CannotContactHost(String host) { + super("Cannot forward messages because the host cannot be contacted. The host may be switched off or there may be network connectivity problems."); + this.host = host; + } + + } + + /** + * The MAC address specified is not valid. + */ + public static class MacInvalid extends XenAPIException { + public final String MAC; + + /** + * Create a new MacInvalid + * + * @param MAC + */ + public MacInvalid(String MAC) { + super("The MAC address specified is not valid."); + this.MAC = MAC; + } + + } + + /** + * Operation could not be performed because the drive is empty + */ + public static class VbdIsEmpty extends XenAPIException { + public final String vbd; + + /** + * Create a new VbdIsEmpty + * + * @param vbd + */ + public VbdIsEmpty(String vbd) { + super("Operation could not be performed because the drive is empty"); + this.vbd = vbd; + } + + } + + /** + * The pool failed to enable external authentication. + */ + public static class PoolAuthEnableFailedInvalidOu extends XenAPIException { + public final String host; + public final String message; + + /** + * Create a new PoolAuthEnableFailedInvalidOu + * + * @param host + * @param message + */ + public PoolAuthEnableFailedInvalidOu(String host, String message) { + super("The pool failed to enable external authentication."); + this.host = host; + this.message = message; + } + + } + + /** + * You tried to call a method that does not exist. The method name that you used is echoed. + */ + public static class MessageMethodUnknown extends XenAPIException { + public final String method; + + /** + * Create a new MessageMethodUnknown + * + * @param method + */ + public MessageMethodUnknown(String method) { + super("You tried to call a method that does not exist. The method name that you used is echoed."); + this.method = method; + } + + } + + /** + * The operation you requested cannot be performed because the specified PIF does not allow unplug. + */ + public static class PifDoesNotAllowUnplug extends XenAPIException { + public final String PIF; + + /** + * Create a new PifDoesNotAllowUnplug + * + * @param PIF + */ + public PifDoesNotAllowUnplug(String PIF) { + super("The operation you requested cannot be performed because the specified PIF does not allow unplug."); + this.PIF = PIF; + } + + } + + /** + * The patch precheck stage failed: prerequisite patches are missing. + */ + public static class PatchPrecheckFailedPrerequisiteMissing extends XenAPIException { + public final String patch; + public final String prerequisitePatchUuidList; + + /** + * Create a new PatchPrecheckFailedPrerequisiteMissing + * + * @param patch + * @param prerequisitePatchUuidList + */ + public PatchPrecheckFailedPrerequisiteMissing(String patch, String prerequisitePatchUuidList) { + super("The patch precheck stage failed: prerequisite patches are missing."); + this.patch = patch; + this.prerequisitePatchUuidList = prerequisitePatchUuidList; + } + + } + + /** + * This operation cannot be performed because the specified VDI could not be found on the storage substrate + */ + public static class VdiMissing extends XenAPIException { + public final String sr; + public final String vdi; + + /** + * Create a new VdiMissing + * + * @param sr + * @param vdi + */ + public VdiMissing(String sr, String vdi) { + super("This operation cannot be performed because the specified VDI could not be found on the storage substrate"); + this.sr = sr; + this.vdi = vdi; + } + + } + + /** + * The WLB server reported that XenServer rejected its configured authentication details. + */ + public static class WlbXenserverAuthenticationFailed extends XenAPIException { + + /** + * Create a new WlbXenserverAuthenticationFailed + */ + public WlbXenserverAuthenticationFailed() { + super("The WLB server reported that XenServer rejected its configured authentication details."); + } + + } + + /** + * The host joining the pool cannot contain any shared storage. + */ + public static class JoiningHostCannotContainSharedSrs extends XenAPIException { + + /** + * Create a new JoiningHostCannotContainSharedSrs + */ + public JoiningHostCannotContainSharedSrs() { + super("The host joining the pool cannot contain any shared storage."); + } + + } + + /** + * The restore could not be performed because the host's current management interface is not in the backup. The interfaces mentioned in the backup are: + */ + public static class RestoreTargetMgmtIfNotInBackup extends XenAPIException { + + /** + * Create a new RestoreTargetMgmtIfNotInBackup + */ + public RestoreTargetMgmtIfNotInBackup() { + super("The restore could not be performed because the host's current management interface is not in the backup. The interfaces mentioned in the backup are:"); + } + + } + + /** + * The VSS plug-in is not installed on this virtual machine + */ + public static class VmSnapshotWithQuiesceNotSupported extends XenAPIException { + public final String vm; + public final String error; + + /** + * Create a new VmSnapshotWithQuiesceNotSupported + * + * @param vm + * @param error + */ + public VmSnapshotWithQuiesceNotSupported(String vm, String error) { + super("The VSS plug-in is not installed on this virtual machine"); + this.vm = vm; + this.error = error; + } + + } + + /** + * You tried to destroy a PIF, but it represents an aspect of the physical host configuration, and so cannot be destroyed. The parameter echoes the PIF handle you gave. + */ + public static class PifIsPhysical extends XenAPIException { + public final String PIF; + + /** + * Create a new PifIsPhysical + * + * @param PIF + */ + public PifIsPhysical(String PIF) { + super("You tried to destroy a PIF, but it represents an aspect of the physical host configuration, and so cannot be destroyed. The parameter echoes the PIF handle you gave."); + this.PIF = PIF; + } + + } + + /** + * The operation could not be performed because a domain still exists for the specified VM. + */ + public static class DomainExists extends XenAPIException { + public final String vm; + public final String domid; + + /** + * Create a new DomainExists + * + * @param vm + * @param domid + */ + public DomainExists(String vm, String domid) { + super("The operation could not be performed because a domain still exists for the specified VM."); + this.vm = vm; + this.domid = domid; + } + + } + + /** + * You attempted an operation on a VM which requires a more recent version of the PV drivers. Please upgrade your PV drivers. + */ + public static class VmOldPvDrivers extends XenAPIException { + public final String vm; + public final String major; + public final String minor; + + /** + * Create a new VmOldPvDrivers + * + * @param vm + * @param major + * @param minor + */ + public VmOldPvDrivers(String vm, String major, String minor) { + super("You attempted an operation on a VM which requires a more recent version of the PV drivers. Please upgrade your PV drivers."); + this.vm = vm; + this.major = major; + this.minor = minor; + } + + } + + /** + * You tried to create a VLAN or tunnel on top of a tunnel access PIF - use the underlying transport PIF instead. + */ + public static class IsTunnelAccessPif extends XenAPIException { + public final String PIF; + + /** + * Create a new IsTunnelAccessPif + * + * @param PIF + */ + public IsTunnelAccessPif(String PIF) { + super("You tried to create a VLAN or tunnel on top of a tunnel access PIF - use the underlying transport PIF instead."); + this.PIF = PIF; + } + + } + + /** + * The operation cannot be performed until the SR has been upgraded + */ + public static class SrRequiresUpgrade extends XenAPIException { + public final String SR; + + /** + * Create a new SrRequiresUpgrade + * + * @param SR + */ + public SrRequiresUpgrade(String SR) { + super("The operation cannot be performed until the SR has been upgraded"); + this.SR = SR; + } + + } + + /** + * Role already exists. + */ + public static class RoleAlreadyExists extends XenAPIException { + + /** + * Create a new RoleAlreadyExists + */ + public RoleAlreadyExists() { + super("Role already exists."); + } + + } + + /** + * Initialization of the VSS requester failed + */ + public static class XenVssReqErrorInitFailed extends XenAPIException { + public final String vm; + public final String errorCode; + + /** + * Create a new XenVssReqErrorInitFailed + * + * @param vm + * @param errorCode + */ + public XenVssReqErrorInitFailed(String vm, String errorCode) { + super("Initialization of the VSS requester failed"); + this.vm = vm; + this.errorCode = errorCode; + } + + } + + /** + * The specified CRL does not exist. + */ + public static class CrlDoesNotExist extends XenAPIException { + public final String name; + + /** + * Create a new CrlDoesNotExist + * + * @param name + */ + public CrlDoesNotExist(String name) { + super("The specified CRL does not exist."); + this.name = name; + } + + } + + /** + * The uploaded patch file is invalid + */ + public static class InvalidPatch extends XenAPIException { + + /** + * Create a new InvalidPatch + */ + public InvalidPatch() { + super("The uploaded patch file is invalid"); + } + + } + + /** + * XHA cannot be enabled because this host's license does not allow it + */ + public static class LicenseDoesNotSupportXha extends XenAPIException { + + /** + * Create a new LicenseDoesNotSupportXha + */ + public LicenseDoesNotSupportXha() { + super("XHA cannot be enabled because this host's license does not allow it"); + } + + } + + /** + * External authentication is disabled, unable to resolve subject name. + */ + public static class AuthIsDisabled extends XenAPIException { + + /** + * Create a new AuthIsDisabled + */ + public AuthIsDisabled() { + super("External authentication is disabled, unable to resolve subject name."); + } + + } + + /** + * The Citrix XenServer Vss Provider is not loaded + */ + public static class XenVssReqErrorProvNotLoaded extends XenAPIException { + public final String vm; + public final String errorCode; + + /** + * Create a new XenVssReqErrorProvNotLoaded + * + * @param vm + * @param errorCode + */ + public XenVssReqErrorProvNotLoaded(String vm, String errorCode) { + super("The Citrix XenServer Vss Provider is not loaded"); + this.vm = vm; + this.errorCode = errorCode; + } + + } + + /** + * HVM is required for this operation + */ + public static class VmHvmRequired extends XenAPIException { + public final String vm; + + /** + * Create a new VmHvmRequired + * + * @param vm + */ + public VmHvmRequired(String vm) { + super("HVM is required for this operation"); + this.vm = vm; + } + + } + + /** + * The WLB server rejected XenServer's request as malformed. + */ + public static class WlbMalformedRequest extends XenAPIException { + + /** + * Create a new WlbMalformedRequest + */ + public WlbMalformedRequest() { + super("The WLB server rejected XenServer's request as malformed."); + } + + } + + /** + * The BIOS strings for this VM have already been set and cannot be changed anymore. + */ + public static class VmBiosStringsAlreadySet extends XenAPIException { + + /** + * Create a new VmBiosStringsAlreadySet + */ + public VmBiosStringsAlreadySet() { + super("The BIOS strings for this VM have already been set and cannot be changed anymore."); + } + + } + + /** + * The pool failed to disable the external authentication of at least one host. + */ + public static class PoolAuthDisableFailed extends XenAPIException { + public final String host; + public final String message; + + /** + * Create a new PoolAuthDisableFailed + * + * @param host + * @param message + */ + public PoolAuthDisableFailed(String host, String message) { + super("The pool failed to disable the external authentication of at least one host."); + this.host = host; + this.message = message; + } + + } + + /** + * This operation could not be performed, because the VM has one or more PCI devices passed through. + */ + public static class VmHasPciAttached extends XenAPIException { + public final String vm; + + /** + * Create a new VmHasPciAttached + * + * @param vm + */ + public VmHasPciAttached(String vm) { + super("This operation could not be performed, because the VM has one or more PCI devices passed through."); + this.vm = vm; + } + + } + + /** + * The quiesced-snapshot operation failed for an unexpected reason + */ + public static class VmSnapshotWithQuiesceFailed extends XenAPIException { + public final String vm; + + /** + * Create a new VmSnapshotWithQuiesceFailed + * + * @param vm + */ + public VmSnapshotWithQuiesceFailed(String vm) { + super("The quiesced-snapshot operation failed for an unexpected reason"); + this.vm = vm; + } + + } + + /** + * The configured WLB server name failed to resolve in DNS. + */ + public static class WlbUnknownHost extends XenAPIException { + + /** + * Create a new WlbUnknownHost + */ + public WlbUnknownHost() { + super("The configured WLB server name failed to resolve in DNS."); + } + + } + + /** + * The SR operation cannot be performed because a device underlying the SR is in use by the host. + */ + public static class SrDeviceInUse extends XenAPIException { + + /** + * Create a new SrDeviceInUse + */ + public SrDeviceInUse() { + super("The SR operation cannot be performed because a device underlying the SR is in use by the host."); + } + + } + + /** + * All VBDs of type 'disk' must be read/write for HVM guests + */ + public static class DiskVbdMustBeReadwriteForHvm extends XenAPIException { + public final String vbd; + + /** + * Create a new DiskVbdMustBeReadwriteForHvm + * + * @param vbd + */ + public DiskVbdMustBeReadwriteForHvm(String vbd) { + super("All VBDs of type 'disk' must be read/write for HVM guests"); + this.vbd = vbd; + } + + } + + /** + * A PIF with this specified device name already exists. + */ + public static class DuplicatePifDeviceName extends XenAPIException { + public final String device; + + /** + * Create a new DuplicatePifDeviceName + * + * @param device + */ + public DuplicatePifDeviceName(String device) { + super("A PIF with this specified device name already exists."); + this.device = device; + } + + } + + /** + * XenServer Tools ISO must be ejected from all running VMs. + */ + public static class PatchPrecheckFailedIsoMounted extends XenAPIException { + public final String patch; + + /** + * Create a new PatchPrecheckFailedIsoMounted + * + * @param patch + */ + public PatchPrecheckFailedIsoMounted(String patch) { + super("XenServer Tools ISO must be ejected from all running VMs."); + this.patch = patch; + } + + } + + /** + * The patch precheck stage failed: the server is of an incorrect build. + */ + public static class PatchPrecheckFailedWrongServerBuild extends XenAPIException { + public final String patch; + public final String foundBuild; + public final String requiredBuild; + + /** + * Create a new PatchPrecheckFailedWrongServerBuild + * + * @param patch + * @param foundBuild + * @param requiredBuild + */ + public PatchPrecheckFailedWrongServerBuild(String patch, String foundBuild, String requiredBuild) { + super("The patch precheck stage failed: the server is of an incorrect build."); + this.patch = patch; + this.foundBuild = foundBuild; + this.requiredBuild = requiredBuild; + } + + } + + /** + * The specified VM is not currently resident on the specified host. + */ + public static class VmNotResidentHere extends XenAPIException { + public final String vm; + public final String host; + + /** + * Create a new VmNotResidentHere + * + * @param vm + * @param host + */ + public VmNotResidentHere(String vm, String host) { + super("The specified VM is not currently resident on the specified host."); + this.vm = vm; + this.host = host; + } + + } + + /** + * The request was asynchronously cancelled. + */ + public static class TaskCancelled extends XenAPIException { + public final String task; + + /** + * Create a new TaskCancelled + * + * @param task + */ + public TaskCancelled(String task) { + super("The request was asynchronously cancelled."); + this.task = task; + } + + } + + /** + * Too many VCPUs to start this VM + */ + public static class VmTooManyVcpus extends XenAPIException { + public final String vm; + + /** + * Create a new VmTooManyVcpus + * + * @param vm + */ + public VmTooManyVcpus(String vm) { + super("Too many VCPUs to start this VM"); + this.vm = vm; + } + + } + + /** + * Subject cannot be resolved by the external directory service. + */ + public static class SubjectCannotBeResolved extends XenAPIException { + + /** + * Create a new SubjectCannotBeResolved + */ + public SubjectCannotBeResolved() { + super("Subject cannot be resolved by the external directory service."); + } + + } + + /** + * You attempted an operation on a VM which requires PV drivers to be installed but the drivers were not detected. + */ + public static class VmMissingPvDrivers extends XenAPIException { + public final String vm; + + /** + * Create a new VmMissingPvDrivers + * + * @param vm + */ + public VmMissingPvDrivers(String vm) { + super("You attempted an operation on a VM which requires PV drivers to be installed but the drivers were not detected."); + this.vm = vm; + } + + } + + /** + * The patch apply failed. Please see attached output. + */ + public static class PatchApplyFailed extends XenAPIException { + public final String output; + + /** + * Create a new PatchApplyFailed + * + * @param output + */ + public PatchApplyFailed(String output) { + super("The patch apply failed. Please see attached output."); + this.output = output; + } + + } + + /** + * The management interface on a slave cannot be disabled because the slave would enter emergency mode. + */ + public static class SlaveRequiresManagementInterface extends XenAPIException { + + /** + * Create a new SlaveRequiresManagementInterface + */ + public SlaveRequiresManagementInterface() { + super("The management interface on a slave cannot be disabled because the slave would enter emergency mode."); + } + + } + + /** + * This operation cannot be completed as the host is still live. + */ + public static class HostIsLive extends XenAPIException { + public final String host; + + /** + * Create a new HostIsLive + * + * @param host + */ + public HostIsLive(String host) { + super("This operation cannot be completed as the host is still live."); + this.host = host; + } + + } + + /** + * This VM does not have a suspend SR specified. + */ + public static class VmNoSuspendSr extends XenAPIException { + public final String vm; + + /** + * Create a new VmNoSuspendSr + * + * @param vm + */ + public VmNoSuspendSr(String vm) { + super("This VM does not have a suspend SR specified."); + this.vm = vm; + } + + } + + /** + * An attempt to start a new VSS snapshot failed + */ + public static class XenVssReqErrorStartSnapshotSetFailed extends XenAPIException { + public final String vm; + public final String errorCode; + + /** + * Create a new XenVssReqErrorStartSnapshotSetFailed + * + * @param vm + * @param errorCode + */ + public XenVssReqErrorStartSnapshotSetFailed(String vm, String errorCode) { + super("An attempt to start a new VSS snapshot failed"); + this.vm = vm; + this.errorCode = errorCode; + } + + } + + /** + * The server failed to parse your event subscription. Valid values include: *, class-name, class-name/object-reference. + */ + public static class EventSubscriptionParseFailure extends XenAPIException { + public final String subscription; + + /** + * Create a new EventSubscriptionParseFailure + * + * @param subscription + */ + public EventSubscriptionParseFailure(String subscription) { + super("The server failed to parse your event subscription. Valid values include: *, class-name, class-name/object-reference."); + this.subscription = subscription; + } + + } + + /** + * The VM cannot be imported unforced because it is either the same version or an older version of an existing VM. + */ + public static class VmToImportIsNotNewerVersion extends XenAPIException { + public final String vm; + public final String existingVersion; + public final String versionToImport; + + /** + * Create a new VmToImportIsNotNewerVersion + * + * @param vm + * @param existingVersion + * @param versionToImport + */ + public VmToImportIsNotNewerVersion(String vm, String existingVersion, String versionToImport) { + super("The VM cannot be imported unforced because it is either the same version or an older version of an existing VM."); + this.vm = vm; + this.existingVersion = existingVersion; + this.versionToImport = versionToImport; + } + + } + + /** + * The default SR reference does not point to a valid SR + */ + public static class DefaultSrNotFound extends XenAPIException { + public final String sr; + + /** + * Create a new DefaultSrNotFound + * + * @param sr + */ + public DefaultSrNotFound(String sr) { + super("The default SR reference does not point to a valid SR"); + this.sr = sr; + } + + } + + /** + * The uuid you supplied was invalid. + */ + public static class UuidInvalid extends XenAPIException { + public final String type; + public final String uuid; + + /** + * Create a new UuidInvalid + * + * @param type + * @param uuid + */ + public UuidInvalid(String type, String uuid) { + super("The uuid you supplied was invalid."); + this.type = type; + this.uuid = uuid; + } + + } + + /** + * An HA statefile could not be created, perhaps because no SR with the appropriate capability was found. + */ + public static class CannotCreateStateFile extends XenAPIException { + + /** + * Create a new CannotCreateStateFile + */ + public CannotCreateStateFile() { + super("An HA statefile could not be created, perhaps because no SR with the appropriate capability was found."); + } + + } + + /** + * You attempted to run a VM on a host which doesn't have a pGPU available in the GPU group needed by the VM. The VM has a vGPU attached to this GPU group. + */ + public static class VmRequiresGpu extends XenAPIException { + public final String vm; + public final String GPUGroup; + + /** + * Create a new VmRequiresGpu + * + * @param vm + * @param GPUGroup + */ + public VmRequiresGpu(String vm, String GPUGroup) { + super("You attempted to run a VM on a host which doesn't have a pGPU available in the GPU group needed by the VM. The VM has a vGPU attached to this GPU group."); + this.vm = vm; + this.GPUGroup = GPUGroup; + } + + } + + /** + * The license for the edition you requested is not available. + */ + public static class LicenseCheckoutError extends XenAPIException { + public final String reason; + + /** + * Create a new LicenseCheckoutError + * + * @param reason + */ + public LicenseCheckoutError(String reason) { + super("The license for the edition you requested is not available."); + this.reason = reason; + } + + } + + /** + * You cannot make regular API calls directly on a slave. Please pass API calls via the master host. + */ + public static class HostIsSlave extends XenAPIException { + public final String masterIPAddress; + + /** + * Create a new HostIsSlave + * + * @param masterIPAddress + */ + public HostIsSlave(String masterIPAddress) { + super("You cannot make regular API calls directly on a slave. Please pass API calls via the master host."); + this.masterIPAddress = masterIPAddress; + } + + } + + /** + * The host toolstack is still initialising. Please wait. + */ + public static class HostStillBooting extends XenAPIException { + + /** + * Create a new HostStillBooting + */ + public HostStillBooting() { + super("The host toolstack is still initialising. Please wait."); + } + + } + + /** + * PGPU type not compatible with destination group. + */ + public static class PgpuNotCompatibleWithGpuGroup extends XenAPIException { + public final String type; + public final String groupTypes; + + /** + * Create a new PgpuNotCompatibleWithGpuGroup + * + * @param type + * @param groupTypes + */ + public PgpuNotCompatibleWithGpuGroup(String type, String groupTypes) { + super("PGPU type not compatible with destination group."); + this.type = type; + this.groupTypes = groupTypes; + } + + } + + /** + * The server failed to unmarshal the XMLRPC message; it was expecting one element and received something else. + */ + public static class XmlrpcUnmarshalFailure extends XenAPIException { + public final String expected; + public final String received; + + /** + * Create a new XmlrpcUnmarshalFailure + * + * @param expected + * @param received + */ + public XmlrpcUnmarshalFailure(String expected, String received) { + super("The server failed to unmarshal the XMLRPC message; it was expecting one element and received something else."); + this.expected = expected; + this.received = received; + } + + } + + /** + * This function is no longer available. + */ + public static class MessageRemoved extends XenAPIException { + + /** + * Create a new MessageRemoved + */ + public MessageRemoved() { + super("This function is no longer available."); + } + + } + + /** + * The network contains active PIFs and cannot be deleted. + */ + public static class NetworkContainsPif extends XenAPIException { + public final String pifs; + + /** + * Create a new NetworkContainsPif + * + * @param pifs + */ + public NetworkContainsPif(String pifs) { + super("The network contains active PIFs and cannot be deleted."); + this.pifs = pifs; + } + + } + + /** + * The WLB server reported that its configured server name for this XenServer instance failed to resolve in DNS. + */ + public static class WlbXenserverUnknownHost extends XenAPIException { + + /** + * Create a new WlbXenserverUnknownHost + */ + public WlbXenserverUnknownHost() { + super("The WLB server reported that its configured server name for this XenServer instance failed to resolve in DNS."); + } + + } + + /** + * A timeout happened while attempting to attach a device to a VM. + */ + public static class DeviceAttachTimeout extends XenAPIException { + public final String type; + public final String ref; + + /** + * Create a new DeviceAttachTimeout + * + * @param type + * @param ref + */ + public DeviceAttachTimeout(String type, String ref) { + super("A timeout happened while attempting to attach a device to a VM."); + this.type = type; + this.ref = ref; + } + + } + + /** + * The uploaded patch file already exists + */ + public static class PatchAlreadyExists extends XenAPIException { + public final String uuid; + + /** + * Create a new PatchAlreadyExists + * + * @param uuid + */ + public PatchAlreadyExists(String uuid) { + super("The uploaded patch file already exists"); + this.uuid = uuid; + } + + } + + /** + * This PGPU is currently in use by running VMs. + */ + public static class PgpuInUseByVm extends XenAPIException { + public final String VMs; + + /** + * Create a new PgpuInUseByVm + * + * @param VMs + */ + public PgpuInUseByVm(String VMs) { + super("This PGPU is currently in use by running VMs."); + this.VMs = VMs; + } + + } + + /** + * The host failed to enable external authentication. + */ + public static class AuthEnableFailedUnavailable extends XenAPIException { + public final String message; + + /** + * Create a new AuthEnableFailedUnavailable + * + * @param message + */ + public AuthEnableFailedUnavailable(String message) { + super("The host failed to enable external authentication."); + this.message = message; + } + + } + + /** + * This PIF is a bond slave and cannot have a VLAN on it. + */ + public static class CannotAddVlanToBondSlave extends XenAPIException { + public final String PIF; + + /** + * Create a new CannotAddVlanToBondSlave + * + * @param PIF + */ + public CannotAddVlanToBondSlave(String PIF) { + super("This PIF is a bond slave and cannot have a VLAN on it."); + this.PIF = PIF; + } + + } + + /** + * This operation cannot be performed because the specified VDI could not be found in the specified SR + */ + public static class VdiLocationMissing extends XenAPIException { + public final String sr; + public final String location; + + /** + * Create a new VdiLocationMissing + * + * @param sr + * @param location + */ + public VdiLocationMissing(String sr, String location) { + super("This operation cannot be performed because the specified VDI could not be found in the specified SR"); + this.sr = sr; + this.location = location; + } + + } + + /** + * The pool failed to disable the external authentication of at least one host. + */ + public static class PoolAuthDisableFailedWrongCredentials extends XenAPIException { + public final String host; + public final String message; + + /** + * Create a new PoolAuthDisableFailedWrongCredentials + * + * @param host + * @param message + */ + public PoolAuthDisableFailedWrongCredentials(String host, String message) { + super("The pool failed to disable the external authentication of at least one host."); + this.host = host; + this.message = message; + } + + } + + /** + * VM didn't acknowledge the need to shutdown. + */ + public static class VmFailedShutdownAcknowledgment extends XenAPIException { + + /** + * Create a new VmFailedShutdownAcknowledgment + */ + public VmFailedShutdownAcknowledgment() { + super("VM didn't acknowledge the need to shutdown."); + } + + } + + /** + * The specified certificate name is invalid. + */ + public static class CertificateNameInvalid extends XenAPIException { + public final String name; + + /** + * Create a new CertificateNameInvalid + * + * @param name + */ + public CertificateNameInvalid(String name) { + super("The specified certificate name is invalid."); + this.name = name; + } + + } + + /** + * The requested bootloader is unknown + */ + public static class UnknownBootloader extends XenAPIException { + public final String vm; + public final String bootloader; + + /** + * Create a new UnknownBootloader + * + * @param vm + * @param bootloader + */ + public UnknownBootloader(String vm, String bootloader) { + super("The requested bootloader is unknown"); + this.vm = vm; + this.bootloader = bootloader; + } + + } + + /** + * You attempted to start a VM that's attached to more than one VDI with a timeoffset marked as reset-on-boot. + */ + public static class VmAttachedToMoreThanOneVdiWithTimeoffsetMarkedAsResetOnBoot extends XenAPIException { + public final String vm; + + /** + * Create a new VmAttachedToMoreThanOneVdiWithTimeoffsetMarkedAsResetOnBoot + * + * @param vm + */ + public VmAttachedToMoreThanOneVdiWithTimeoffsetMarkedAsResetOnBoot(String vm) { + super("You attempted to start a VM that's attached to more than one VDI with a timeoffset marked as reset-on-boot."); + this.vm = vm; + } + + } + + /** + * The server failed to handle your request, due to an internal error. The given message may give details useful for debugging the problem. + */ + public static class InternalError extends XenAPIException { + public final String message; + + /** + * Create a new InternalError + * + * @param message + */ + public InternalError(String message) { + super("The server failed to handle your request, due to an internal error. The given message may give details useful for debugging the problem."); + this.message = message; + } + + } + + /** + * This message has been deprecated. + */ + public static class MessageDeprecated extends XenAPIException { + + /** + * Create a new MessageDeprecated + */ + public MessageDeprecated() { + super("This message has been deprecated."); + } + + } + + /** + * The requested update could not be found. This can occur when you designate a new master or xe patch-clean. Please upload the update again + */ + public static class CannotFindPatch extends XenAPIException { + + /** + * Create a new CannotFindPatch + */ + public CannotFindPatch() { + super("The requested update could not be found. This can occur when you designate a new master or xe patch-clean. Please upload the update again"); + } + + } + + /** + * You attempted an operation on a VM that was judged to be unsafe by the server. This can happen if the VM would run on a CPU that has a potentially incompatible set of feature flags to those the VM requires. If you want to override this warning then use the 'force' option. + */ + public static class VmUnsafeBoot extends XenAPIException { + public final String vm; + + /** + * Create a new VmUnsafeBoot + * + * @param vm + */ + public VmUnsafeBoot(String vm) { + super("You attempted an operation on a VM that was judged to be unsafe by the server. This can happen if the VM would run on a CPU that has a potentially incompatible set of feature flags to those the VM requires. If you want to override this warning then use the 'force' option."); + this.vm = vm; } } @@ -6859,301 +8600,6 @@ public class Types } - /** - * The SR backend does not support the operation (check the SR's allowed operations) - */ - public static class SrOperationNotSupported extends XenAPIException { - public final String sr; - - /** - * Create a new SrOperationNotSupported - * - * @param sr - */ - public SrOperationNotSupported(String sr) { - super("The SR backend does not support the operation (check the SR's allowed operations)"); - this.sr = sr; - } - - } - - /** - * The operation could not be performed because the VBD was not connected to the VM. - */ - public static class DeviceNotAttached extends XenAPIException { - public final String VBD; - - /** - * Create a new DeviceNotAttached - * - * @param VBD - */ - public DeviceNotAttached(String VBD) { - super("The operation could not be performed because the VBD was not connected to the VM."); - this.VBD = VBD; - } - - } - - /** - * The specified host is disabled. - */ - public static class HostDisabled extends XenAPIException { - public final String host; - - /** - * Create a new HostDisabled - * - * @param host - */ - public HostDisabled(String host) { - super("The specified host is disabled."); - this.host = host; - } - - } - - /** - * You must use tar output to retrieve system status from an OEM host. - */ - public static class SystemStatusMustUseTarOnOem extends XenAPIException { - - /** - * Create a new SystemStatusMustUseTarOnOem - */ - public SystemStatusMustUseTarOnOem() { - super("You must use tar output to retrieve system status from an OEM host."); - } - - } - - /** - * An attempt to prepare VSS writers for the snapshot failed - */ - public static class XenVssReqErrorPreparingWriters extends XenAPIException { - public final String vm; - public final String errorCode; - - /** - * Create a new XenVssReqErrorPreparingWriters - * - * @param vm - * @param errorCode - */ - public XenVssReqErrorPreparingWriters(String vm, String errorCode) { - super("An attempt to prepare VSS writers for the snapshot failed"); - this.vm = vm; - this.errorCode = errorCode; - } - - } - - /** - * The host failed to enable external authentication. - */ - public static class AuthEnableFailed extends XenAPIException { - public final String message; - - /** - * Create a new AuthEnableFailed - * - * @param message - */ - public AuthEnableFailed(String message) { - super("The host failed to enable external authentication."); - this.message = message; - } - - } - - /** - * The host joining the pool cannot contain any shared storage. - */ - public static class JoiningHostCannotContainSharedSrs extends XenAPIException { - - /** - * Create a new JoiningHostCannotContainSharedSrs - */ - public JoiningHostCannotContainSharedSrs() { - super("The host joining the pool cannot contain any shared storage."); - } - - } - - /** - * You need at least 1 VCPU to start a VM - */ - public static class VmNoVcpus extends XenAPIException { - public final String vm; - - /** - * Create a new VmNoVcpus - * - * @param vm - */ - public VmNoVcpus(String vm) { - super("You need at least 1 VCPU to start a VM"); - this.vm = vm; - } - - } - - /** - * The uploaded patch file is invalid. See attached log for more details. - */ - public static class InvalidPatchWithLog extends XenAPIException { - public final String log; - - /** - * Create a new InvalidPatchWithLog - * - * @param log - */ - public InvalidPatchWithLog(String log) { - super("The uploaded patch file is invalid. See attached log for more details."); - this.log = log; - } - - } - - /** - * The SR operation cannot be performed because a device underlying the SR is in use by the host. - */ - public static class SrDeviceInUse extends XenAPIException { - - /** - * Create a new SrDeviceInUse - */ - public SrDeviceInUse() { - super("The SR operation cannot be performed because a device underlying the SR is in use by the host."); - } - - } - - /** - * The host CDROM drive does not contain a valid CD - */ - public static class HostCdDriveEmpty extends XenAPIException { - - /** - * Create a new HostCdDriveEmpty - */ - public HostCdDriveEmpty() { - super("The host CDROM drive does not contain a valid CD"); - } - - } - - /** - * The operation could not be performed while the host is still armed; it must be disarmed first - */ - public static class HaHostIsArmed extends XenAPIException { - public final String host; - - /** - * Create a new HaHostIsArmed - * - * @param host - */ - public HaHostIsArmed(String host) { - super("The operation could not be performed while the host is still armed; it must be disarmed first"); - this.host = host; - } - - } - - /** - * The server failed to parse your event subscription. Valid values include: *, class-name, class-name/object-reference. - */ - public static class EventSubscriptionParseFailure extends XenAPIException { - public final String subscription; - - /** - * Create a new EventSubscriptionParseFailure - * - * @param subscription - */ - public EventSubscriptionParseFailure(String subscription) { - super("The server failed to parse your event subscription. Valid values include: *, class-name, class-name/object-reference."); - this.subscription = subscription; - } - - } - - /** - * Your license has expired. Please contact your support representative. - */ - public static class LicenseExpired extends XenAPIException { - - /** - * Create a new LicenseExpired - */ - public LicenseExpired() { - super("Your license has expired. Please contact your support representative."); - } - - } - - /** - * The credentials given by the user are incorrect, so access has been denied, and you have not been issued a session handle. - */ - public static class SessionAuthenticationFailed extends XenAPIException { - - /** - * Create a new SessionAuthenticationFailed - */ - public SessionAuthenticationFailed() { - super("The credentials given by the user are incorrect, so access has been denied, and you have not been issued a session handle."); - } - - } - - /** - * You tried to create a VLAN on top of another VLAN - use the underlying physical PIF/bond instead - */ - public static class PifIsVlan extends XenAPIException { - public final String PIF; - - /** - * Create a new PifIsVlan - * - * @param PIF - */ - public PifIsVlan(String PIF) { - super("You tried to create a VLAN on top of another VLAN - use the underlying physical PIF/bond instead"); - this.PIF = PIF; - } - - } - - /** - * Archive more frequent than backup. - */ - public static class VmppArchiveMoreFrequentThanBackup extends XenAPIException { - - /** - * Create a new VmppArchiveMoreFrequentThanBackup - */ - public VmppArchiveMoreFrequentThanBackup() { - super("Archive more frequent than backup."); - } - - } - - /** - * There was a problem with the license daemon (v6d). Is it running? - */ - public static class V6dFailure extends XenAPIException { - - /** - * Create a new V6dFailure - */ - public V6dFailure() { - super("There was a problem with the license daemon (v6d). Is it running?"); - } - - } - /** * The host joining the pool cannot already be a master of another pool. */ @@ -7169,465 +8615,54 @@ public class Types } /** - * This host can not be forgotten because there are some user VMs still running + * Cannot import VM using chunked encoding. */ - public static class HostHasResidentVms extends XenAPIException { - public final String host; + public static class ImportErrorCannotHandleChunked extends XenAPIException { /** - * Create a new HostHasResidentVms + * Create a new ImportErrorCannotHandleChunked + */ + public ImportErrorCannotHandleChunked() { + super("Cannot import VM using chunked encoding."); + } + + } + + /** + * The pool failed to enable external authentication. + */ + public static class PoolAuthEnableFailedWrongCredentials extends XenAPIException { + public final String host; + public final String message; + + /** + * Create a new PoolAuthEnableFailedWrongCredentials * * @param host + * @param message */ - public HostHasResidentVms(String host) { - super("This host can not be forgotten because there are some user VMs still running"); + public PoolAuthEnableFailedWrongCredentials(String host, String message) { + super("The pool failed to enable external authentication."); this.host = host; - } - - } - - /** - * An error occured while saving the memory image of the specified virtual machine - */ - public static class VmCheckpointSuspendFailed extends XenAPIException { - public final String vm; - - /** - * Create a new VmCheckpointSuspendFailed - * - * @param vm - */ - public VmCheckpointSuspendFailed(String vm) { - super("An error occured while saving the memory image of the specified virtual machine"); - this.vm = vm; - } - - } - - /** - * The operation you requested cannot be performed because the specified PIF is the management interface. - */ - public static class PifIsManagementInterface extends XenAPIException { - public final String PIF; - - /** - * Create a new PifIsManagementInterface - * - * @param PIF - */ - public PifIsManagementInterface(String PIF) { - super("The operation you requested cannot be performed because the specified PIF is the management interface."); - this.PIF = PIF; - } - - } - - /** - * The MAC address specified is not valid. - */ - public static class MacInvalid extends XenAPIException { - public final String MAC; - - /** - * Create a new MacInvalid - * - * @param MAC - */ - public MacInvalid(String MAC) { - super("The MAC address specified is not valid."); - this.MAC = MAC; - } - - } - - /** - * An attempt to start a new VSS snapshot failed - */ - public static class XenVssReqErrorStartSnapshotSetFailed extends XenAPIException { - public final String vm; - public final String errorCode; - - /** - * Create a new XenVssReqErrorStartSnapshotSetFailed - * - * @param vm - * @param errorCode - */ - public XenVssReqErrorStartSnapshotSetFailed(String vm, String errorCode) { - super("An attempt to start a new VSS snapshot failed"); - this.vm = vm; - this.errorCode = errorCode; - } - - } - - /** - * Operation could not be performed because the drive is empty - */ - public static class VbdIsEmpty extends XenAPIException { - public final String vbd; - - /** - * Create a new VbdIsEmpty - * - * @param vbd - */ - public VbdIsEmpty(String vbd) { - super("Operation could not be performed because the drive is empty"); - this.vbd = vbd; - } - - } - - /** - * The patch precheck stage failed: the server is of an incorrect version. - */ - public static class PatchPrecheckFailedWrongServerVersion extends XenAPIException { - public final String patch; - public final String foundVersion; - public final String requiredVersion; - - /** - * Create a new PatchPrecheckFailedWrongServerVersion - * - * @param patch - * @param foundVersion - * @param requiredVersion - */ - public PatchPrecheckFailedWrongServerVersion(String patch, String foundVersion, String requiredVersion) { - super("The patch precheck stage failed: the server is of an incorrect version."); - this.patch = patch; - this.foundVersion = foundVersion; - this.requiredVersion = requiredVersion; - } - - } - - /** - * This operation could not be performed because the state partition could not be found - */ - public static class CannotFindStatePartition extends XenAPIException { - - /** - * Create a new CannotFindStatePartition - */ - public CannotFindStatePartition() { - super("This operation could not be performed because the state partition could not be found"); - } - - } - - /** - * The WLB server rejected our configured authentication details. - */ - public static class WlbAuthenticationFailed extends XenAPIException { - - /** - * Create a new WlbAuthenticationFailed - */ - public WlbAuthenticationFailed() { - super("The WLB server rejected our configured authentication details."); - } - - } - - /** - * Unknown type of external authentication. - */ - public static class AuthUnknownType extends XenAPIException { - public final String type; - - /** - * Create a new AuthUnknownType - * - * @param type - */ - public AuthUnknownType(String type) { - super("Unknown type of external authentication."); - this.type = type; - } - - } - - /** - * This pool is not in emergency mode. - */ - public static class NotInEmergencyMode extends XenAPIException { - - /** - * Create a new NotInEmergencyMode - */ - public NotInEmergencyMode() { - super("This pool is not in emergency mode."); - } - - } - - /** - * The host failed to disable external authentication. - */ - public static class AuthDisableFailed extends XenAPIException { - public final String message; - - /** - * Create a new AuthDisableFailed - * - * @param message - */ - public AuthDisableFailed(String message) { - super("The host failed to disable external authentication."); this.message = message; } } /** - * You tried to create a PIF, but the network you tried to attach it to is already attached to some other PIF, and so the creation failed. + * This command is only allowed on the OEM edition. */ - public static class NetworkAlreadyConnected extends XenAPIException { - public final String network; - public final String connectedPIF; + public static class OnlyAllowedOnOemEdition extends XenAPIException { + public final String command; /** - * Create a new NetworkAlreadyConnected + * Create a new OnlyAllowedOnOemEdition * - * @param network - * @param connectedPIF + * @param command */ - public NetworkAlreadyConnected(String network, String connectedPIF) { - super("You tried to create a PIF, but the network you tried to attach it to is already attached to some other PIF, and so the creation failed."); - this.network = network; - this.connectedPIF = connectedPIF; - } - - } - - /** - * This operation cannot be performed because the specified VDI is of an incompatible type (eg: an HA statefile cannot be attached to a guest) - */ - public static class VdiIncompatibleType extends XenAPIException { - public final String vdi; - public final String type; - - /** - * Create a new VdiIncompatibleType - * - * @param vdi - * @param type - */ - public VdiIncompatibleType(String vdi, String type) { - super("This operation cannot be performed because the specified VDI is of an incompatible type (eg: an HA statefile cannot be attached to a guest)"); - this.vdi = vdi; - this.type = type; - } - - } - - /** - * The configured WLB server name failed to resolve in DNS. - */ - public static class WlbUnknownHost extends XenAPIException { - - /** - * Create a new WlbUnknownHost - */ - public WlbUnknownHost() { - super("The configured WLB server name failed to resolve in DNS."); - } - - } - - /** - * The VM could not be imported. - */ - public static class ImportError extends XenAPIException { - public final String msg; - - /** - * Create a new ImportError - * - * @param msg - */ - public ImportError(String msg) { - super("The VM could not be imported."); - this.msg = msg; - } - - } - - /** - * The SR could not be connected because the driver was not recognised. - */ - public static class SrUnknownDriver extends XenAPIException { - public final String driver; - - /** - * Create a new SrUnknownDriver - * - * @param driver - */ - public SrUnknownDriver(String driver) { - super("The SR could not be connected because the driver was not recognised."); - this.driver = driver; - } - - } - - /** - * The host failed to disable external authentication. - */ - public static class AuthDisableFailedWrongCredentials extends XenAPIException { - public final String message; - - /** - * Create a new AuthDisableFailedWrongCredentials - * - * @param message - */ - public AuthDisableFailedWrongCredentials(String message) { - super("The host failed to disable external authentication."); - this.message = message; - } - - } - - /** - * The VM unexpectedly halted - */ - public static class VmHalted extends XenAPIException { - public final String vm; - - /** - * Create a new VmHalted - * - * @param vm - */ - public VmHalted(String vm) { - super("The VM unexpectedly halted"); - this.vm = vm; - } - - } - - /** - * The use of this feature is restricted. - */ - public static class FeatureRestricted extends XenAPIException { - - /** - * Create a new FeatureRestricted - */ - public FeatureRestricted() { - super("The use of this feature is restricted."); - } - - } - - /** - * The VDI could not be opened for metadata recovery as it contains the current pool's metadata. - */ - public static class VdiContainsMetadataOfThisPool extends XenAPIException { - public final String vdi; - public final String pool; - - /** - * Create a new VdiContainsMetadataOfThisPool - * - * @param vdi - * @param pool - */ - public VdiContainsMetadataOfThisPool(String vdi, String pool) { - super("The VDI could not be opened for metadata recovery as it contains the current pool's metadata."); - this.vdi = vdi; - this.pool = pool; - } - - } - - /** - * The specified CRL name is invalid. - */ - public static class CrlNameInvalid extends XenAPIException { - public final String name; - - /** - * Create a new CrlNameInvalid - * - * @param name - */ - public CrlNameInvalid(String name) { - super("The specified CRL name is invalid."); - this.name = name; - } - - } - - /** - * This operation cannot be completed as the host power on mode is disabled. - */ - public static class HostPowerOnModeDisabled extends XenAPIException { - - /** - * Create a new HostPowerOnModeDisabled - */ - public HostPowerOnModeDisabled() { - super("This operation cannot be completed as the host power on mode is disabled."); - } - - } - - /** - * An activation key can only be applied when the edition is set to 'free'. - */ - public static class ActivationWhileNotFree extends XenAPIException { - - /** - * Create a new ActivationWhileNotFree - */ - public ActivationWhileNotFree() { - super("An activation key can only be applied when the edition is set to 'free'."); - } - - } - - /** - * There was a failure communicating with the plugin. - */ - public static class XenapiPluginFailure extends XenAPIException { - public final String status; - public final String stdout; - public final String stderr; - - /** - * Create a new XenapiPluginFailure - * - * @param status - * @param stdout - * @param stderr - */ - public XenapiPluginFailure(String status, String stdout, String stderr) { - super("There was a failure communicating with the plugin."); - this.status = status; - this.stdout = stdout; - this.stderr = stderr; - } - - } - - /** - * The MAC address specified still exists on this host. - */ - public static class MacStillExists extends XenAPIException { - public final String MAC; - - /** - * Create a new MacStillExists - * - * @param MAC - */ - public MacStillExists(String MAC) { - super("The MAC address specified still exists on this host."); - this.MAC = MAC; + public OnlyAllowedOnOemEdition(String command) { + super("This command is only allowed on the OEM edition."); + this.command = command; } } @@ -7657,29 +8692,55 @@ public class Types } /** - * HA can only be enabled for 2 hosts or more. Note that 2 hosts requires a pre-configured quorum tiebreak script. + * An error occured while saving the memory image of the specified virtual machine */ - public static class HaTooFewHosts extends XenAPIException { + public static class VmCheckpointSuspendFailed extends XenAPIException { + public final String vm; /** - * Create a new HaTooFewHosts + * Create a new VmCheckpointSuspendFailed + * + * @param vm */ - public HaTooFewHosts() { - super("HA can only be enabled for 2 hosts or more. Note that 2 hosts requires a pre-configured quorum tiebreak script."); + public VmCheckpointSuspendFailed(String vm) { + super("An error occured while saving the memory image of the specified virtual machine"); + this.vm = vm; } } /** - * The connection to the WLB server was reset. + * This patch has already been applied */ - public static class WlbConnectionReset extends XenAPIException { + public static class PatchAlreadyApplied extends XenAPIException { + public final String patch; /** - * Create a new WlbConnectionReset + * Create a new PatchAlreadyApplied + * + * @param patch */ - public WlbConnectionReset() { - super("The connection to the WLB server was reset."); + public PatchAlreadyApplied(String patch) { + super("This patch has already been applied"); + this.patch = patch; + } + + } + + /** + * The operation could not be performed because the VBD was not connected to the VM. + */ + public static class DeviceNotAttached extends XenAPIException { + public final String VBD; + + /** + * Create a new DeviceNotAttached + * + * @param VBD + */ + public DeviceNotAttached(String VBD) { + super("The operation could not be performed because the VBD was not connected to the VM."); + this.VBD = VBD; } } @@ -7687,17 +8748,17 @@ public class Types /** * The pool failed to enable external authentication. */ - public static class PoolAuthEnableFailedWrongCredentials extends XenAPIException { + public static class PoolAuthEnableFailed extends XenAPIException { public final String host; public final String message; /** - * Create a new PoolAuthEnableFailedWrongCredentials + * Create a new PoolAuthEnableFailed * * @param host * @param message */ - public PoolAuthEnableFailedWrongCredentials(String host, String message) { + public PoolAuthEnableFailed(String host, String message) { super("The pool failed to enable external authentication."); this.host = host; this.message = message; @@ -7706,390 +8767,26 @@ public class Types } /** - * The specified patch is applied and cannot be destroyed. + * This operation cannot be performed because this VDI is in use by some other operation */ - public static class PatchIsApplied extends XenAPIException { - - /** - * Create a new PatchIsApplied - */ - public PatchIsApplied() { - super("The specified patch is applied and cannot be destroyed."); - } - - } - - /** - * The SR is still connected to a host via a PBD. It cannot be destroyed or forgotten. - */ - public static class SrHasPbd extends XenAPIException { - public final String sr; - - /** - * Create a new SrHasPbd - * - * @param sr - */ - public SrHasPbd(String sr) { - super("The SR is still connected to a host via a PBD. It cannot be destroyed or forgotten."); - this.sr = sr; - } - - } - - /** - * Some VMs belonging to the appliance threw an exception while carrying out the specified operation - */ - public static class OperationPartiallyFailed extends XenAPIException { + public static class VdiInUse extends XenAPIException { + public final String vdi; public final String operation; /** - * Create a new OperationPartiallyFailed + * Create a new VdiInUse * + * @param vdi * @param operation */ - public OperationPartiallyFailed(String operation) { - super("Some VMs belonging to the appliance threw an exception while carrying out the specified operation"); + public VdiInUse(String vdi, String operation) { + super("This operation cannot be performed because this VDI is in use by some other operation"); + this.vdi = vdi; this.operation = operation; } } - /** - * The WLB server rejected XenServer's request as malformed. - */ - public static class WlbMalformedRequest extends XenAPIException { - - /** - * Create a new WlbMalformedRequest - */ - public WlbMalformedRequest() { - super("The WLB server rejected XenServer's request as malformed."); - } - - } - - /** - * The host toolstack is still initialising. Please wait. - */ - public static class HostStillBooting extends XenAPIException { - - /** - * Create a new HostStillBooting - */ - public HostStillBooting() { - super("The host toolstack is still initialising. Please wait."); - } - - } - - /** - * You tried to destroy a system network: these cannot be destroyed. - */ - public static class CannotDestroySystemNetwork extends XenAPIException { - public final String network; - - /** - * Create a new CannotDestroySystemNetwork - * - * @param network - */ - public CannotDestroySystemNetwork(String network) { - super("You tried to destroy a system network: these cannot be destroyed."); - this.network = network; - } - - } - - /** - * The specified object no longer exists. - */ - public static class ObjectNolongerExists extends XenAPIException { - - /** - * Create a new ObjectNolongerExists - */ - public ObjectNolongerExists() { - super("The specified object no longer exists."); - } - - } - - /** - * This VDI was not mapped to a destination SR in VM.migrate_send operation - */ - public static class VdiNotInMap extends XenAPIException { - public final String vdi; - - /** - * Create a new VdiNotInMap - * - * @param vdi - */ - public VdiNotInMap(String vdi) { - super("This VDI was not mapped to a destination SR in VM.migrate_send operation"); - this.vdi = vdi; - } - - } - - /** - * The VDI is too small. Please resize it to at least the minimum size. - */ - public static class VdiTooSmall extends XenAPIException { - public final String vdi; - public final String minimumSize; - - /** - * Create a new VdiTooSmall - * - * @param vdi - * @param minimumSize - */ - public VdiTooSmall(String vdi, String minimumSize) { - super("The VDI is too small. Please resize it to at least the minimum size."); - this.vdi = vdi; - this.minimumSize = minimumSize; - } - - } - - /** - * The VDI is not stored using a sparse format. It is not possible to query and manipulate only the changed blocks (or 'block differences' or 'disk deltas') between two VDIs. Please select a VDI which uses a sparse-aware technology such as VHD. - */ - public static class VdiNotSparse extends XenAPIException { - public final String vdi; - - /** - * Create a new VdiNotSparse - * - * @param vdi - */ - public VdiNotSparse(String vdi) { - super("The VDI is not stored using a sparse format. It is not possible to query and manipulate only the changed blocks (or 'block differences' or 'disk deltas') between two VDIs. Please select a VDI which uses a sparse-aware technology such as VHD."); - this.vdi = vdi; - } - - } - - /** - * The hosts in this pool are not homogeneous. - */ - public static class HostsNotHomogeneous extends XenAPIException { - public final String reason; - - /** - * Create a new HostsNotHomogeneous - * - * @param reason - */ - public HostsNotHomogeneous(String reason) { - super("The hosts in this pool are not homogeneous."); - this.reason = reason; - } - - } - - /** - * The host joining the pool must have the same product version as the pool master. - */ - public static class PoolJoiningHostMustHaveSameProductVersion extends XenAPIException { - - /** - * Create a new PoolJoiningHostMustHaveSameProductVersion - */ - public PoolJoiningHostMustHaveSameProductVersion() { - super("The host joining the pool must have the same product version as the pool master."); - } - - } - - /** - * You tried to create a PIF, but it already exists. - */ - public static class PifVlanExists extends XenAPIException { - public final String PIF; - - /** - * Create a new PifVlanExists - * - * @param PIF - */ - public PifVlanExists(String PIF) { - super("You tried to create a PIF, but it already exists."); - this.PIF = PIF; - } - - } - - /** - * The license for the edition you requested is not available. - */ - public static class LicenseCheckoutError extends XenAPIException { - public final String reason; - - /** - * Create a new LicenseCheckoutError - * - * @param reason - */ - public LicenseCheckoutError(String reason) { - super("The license for the edition you requested is not available."); - this.reason = reason; - } - - } - - /** - * The certificate library is corrupt or unreadable. - */ - public static class CertificateLibraryCorrupt extends XenAPIException { - - /** - * Create a new CertificateLibraryCorrupt - */ - public CertificateLibraryCorrupt() { - super("The certificate library is corrupt or unreadable."); - } - - } - - /** - * This operation cannot be performed because the system does not manage this VDI - */ - public static class VdiNotManaged extends XenAPIException { - public final String vdi; - - /** - * Create a new VdiNotManaged - * - * @param vdi - */ - public VdiNotManaged(String vdi) { - super("This operation cannot be performed because the system does not manage this VDI"); - this.vdi = vdi; - } - - } - - /** - * The edition you supplied is invalid. - */ - public static class InvalidEdition extends XenAPIException { - public final String edition; - - /** - * Create a new InvalidEdition - * - * @param edition - */ - public InvalidEdition(String edition) { - super("The edition you supplied is invalid."); - this.edition = edition; - } - - } - - /** - * The uploaded patch file already exists - */ - public static class PatchAlreadyExists extends XenAPIException { - public final String uuid; - - /** - * Create a new PatchAlreadyExists - * - * @param uuid - */ - public PatchAlreadyExists(String uuid) { - super("The uploaded patch file already exists"); - this.uuid = uuid; - } - - } - - /** - * There is not enough space to upload the update - */ - public static class OutOfSpace extends XenAPIException { - public final String location; - - /** - * Create a new OutOfSpace - * - * @param location - */ - public OutOfSpace(String location) { - super("There is not enough space to upload the update"); - this.location = location; - } - - } - - /** - * The VM could not be imported; the end of the file was reached prematurely. - */ - public static class ImportErrorPrematureEof extends XenAPIException { - - /** - * Create a new ImportErrorPrematureEof - */ - public ImportErrorPrematureEof() { - super("The VM could not be imported; the end of the file was reached prematurely."); - } - - } - - /** - * The given VM is not registered as a system domain. This operation can only be performed on a registered system domain. - */ - public static class NotSystemDomain extends XenAPIException { - public final String vm; - - /** - * Create a new NotSystemDomain - * - * @param vm - */ - public NotSystemDomain(String vm) { - super("The given VM is not registered as a system domain. This operation can only be performed on a registered system domain."); - this.vm = vm; - } - - } - - /** - * The specified VM has too little memory to be started. - */ - public static class VmMemorySizeTooLow extends XenAPIException { - public final String vm; - - /** - * Create a new VmMemorySizeTooLow - * - * @param vm - */ - public VmMemorySizeTooLow(String vm) { - super("The specified VM has too little memory to be started."); - this.vm = vm; - } - - } - - /** - * There is at least one VM assigned to this protection policy. - */ - public static class VmppHasVm extends XenAPIException { - - /** - * Create a new VmppHasVm - */ - public VmppHasVm() { - super("There is at least one VM assigned to this protection policy."); - } - - } - /** * This operation cannot be performed because the host is not disabled. Please disable the host and then try again. */ @@ -8105,553 +8802,93 @@ public class Types } /** - * The value specified is of the wrong type + * The use of this feature is restricted. */ - public static class FieldTypeError extends XenAPIException { - public final String field; + public static class FeatureRestricted extends XenAPIException { /** - * Create a new FieldTypeError - * - * @param field + * Create a new FeatureRestricted */ - public FieldTypeError(String field) { - super("The value specified is of the wrong type"); - this.field = field; + public FeatureRestricted() { + super("The use of this feature is restricted."); } } /** - * The management interface on a slave cannot be disabled because the slave would enter emergency mode. + * You attempted to run a VM on a host which doesn't have access to an SR needed by the VM. The VM has at least one VBD attached to a VDI in the SR. */ - public static class SlaveRequiresManagementInterface extends XenAPIException { - - /** - * Create a new SlaveRequiresManagementInterface - */ - public SlaveRequiresManagementInterface() { - super("The management interface on a slave cannot be disabled because the slave would enter emergency mode."); - } - - } - - /** - * The operation attempted is not valid for a template VM - */ - public static class VmIsTemplate extends XenAPIException { + public static class VmRequiresSr extends XenAPIException { public final String vm; + public final String sr; /** - * Create a new VmIsTemplate + * Create a new VmRequiresSr * * @param vm + * @param sr */ - public VmIsTemplate(String vm) { - super("The operation attempted is not valid for a template VM"); + public VmRequiresSr(String vm, String sr) { + super("You attempted to run a VM on a host which doesn't have access to an SR needed by the VM. The VM has at least one VBD attached to a VDI in the SR."); this.vm = vm; + this.sr = sr; } } /** - * This operation cannot be performed because the specified VM is protected by xHA + * The bootloader returned an error */ - public static class VmIsProtected extends XenAPIException { + public static class BootloaderFailed extends XenAPIException { public final String vm; - - /** - * Create a new VmIsProtected - * - * @param vm - */ - public VmIsProtected(String vm) { - super("This operation cannot be performed because the specified VM is protected by xHA"); - this.vm = vm; - } - - } - - /** - * The host joining the pool cannot have any running VMs. - */ - public static class JoiningHostCannotHaveRunningVms extends XenAPIException { - - /** - * Create a new JoiningHostCannotHaveRunningVms - */ - public JoiningHostCannotHaveRunningVms() { - super("The host joining the pool cannot have any running VMs."); - } - - } - - /** - * VM cannot be started because it requires a VDI which cannot be attached - */ - public static class VmRequiresVdi extends XenAPIException { - public final String vm; - public final String vdi; - - /** - * Create a new VmRequiresVdi - * - * @param vm - * @param vdi - */ - public VmRequiresVdi(String vm, String vdi) { - super("VM cannot be started because it requires a VDI which cannot be attached"); - this.vm = vm; - this.vdi = vdi; - } - - } - - /** - * Read/write CDs are not supported - */ - public static class VbdCdsMustBeReadonly extends XenAPIException { - - /** - * Create a new VbdCdsMustBeReadonly - */ - public VbdCdsMustBeReadonly() { - super("Read/write CDs are not supported"); - } - - } - - /** - * This license file is no longer accepted. Please upgrade to the new licensing system. - */ - public static class LicenseFileDeprecated extends XenAPIException { - - /** - * Create a new LicenseFileDeprecated - */ - public LicenseFileDeprecated() { - super("This license file is no longer accepted. Please upgrade to the new licensing system."); - } - - } - - /** - * An HA statefile could not be created, perhaps because no SR with the appropriate capability was found. - */ - public static class CannotCreateStateFile extends XenAPIException { - - /** - * Create a new CannotCreateStateFile - */ - public CannotCreateStateFile() { - super("An HA statefile could not be created, perhaps because no SR with the appropriate capability was found."); - } - - } - - /** - * The host joining the pool cannot have any VMs with active tasks. - */ - public static class JoiningHostCannotHaveVmsWithCurrentOperations extends XenAPIException { - - /** - * Create a new JoiningHostCannotHaveVmsWithCurrentOperations - */ - public JoiningHostCannotHaveVmsWithCurrentOperations() { - super("The host joining the pool cannot have any VMs with active tasks."); - } - - } - - /** - * You tried to call a method with the incorrect number of parameters. The fully-qualified method name that you used, and the number of received and expected parameters are returned. - */ - public static class MessageParameterCountMismatch extends XenAPIException { - public final String method; - public final String expected; - public final String received; - - /** - * Create a new MessageParameterCountMismatch - * - * @param method - * @param expected - * @param received - */ - public MessageParameterCountMismatch(String method, String expected, String received) { - super("You tried to call a method with the incorrect number of parameters. The fully-qualified method name that you used, and the number of received and expected parameters are returned."); - this.method = method; - this.expected = expected; - this.received = received; - } - - } - - /** - * External authentication in this pool is already enabled for at least one host. - */ - public static class PoolAuthAlreadyEnabled extends XenAPIException { - public final String host; - - /** - * Create a new PoolAuthAlreadyEnabled - * - * @param host - */ - public PoolAuthAlreadyEnabled(String host) { - super("External authentication in this pool is already enabled for at least one host."); - this.host = host; - } - - } - - /** - * The restore could not be performed because this backup has been created by a different (incompatible) product version - */ - public static class RestoreIncompatibleVersion extends XenAPIException { - - /** - * Create a new RestoreIncompatibleVersion - */ - public RestoreIncompatibleVersion() { - super("The restore could not be performed because this backup has been created by a different (incompatible) product version"); - } - - } - - /** - * The VM rejected the attempt to detach the device. - */ - public static class DeviceDetachRejected extends XenAPIException { - public final String type; - public final String ref; public final String msg; /** - * Create a new DeviceDetachRejected + * Create a new BootloaderFailed * - * @param type - * @param ref + * @param vm * @param msg */ - public DeviceDetachRejected(String type, String ref, String msg) { - super("The VM rejected the attempt to detach the device."); - this.type = type; - this.ref = ref; + public BootloaderFailed(String vm, String msg) { + super("The bootloader returned an error"); + this.vm = vm; this.msg = msg; } } /** - * External authentication is disabled, unable to resolve subject name. + * PIF has no IP configuration (mode curently set to 'none') */ - public static class AuthIsDisabled extends XenAPIException { + public static class PifHasNoNetworkConfiguration extends XenAPIException { /** - * Create a new AuthIsDisabled + * Create a new PifHasNoNetworkConfiguration */ - public AuthIsDisabled() { - super("External authentication is disabled, unable to resolve subject name."); + public PifHasNoNetworkConfiguration() { + super("PIF has no IP configuration (mode curently set to 'none')"); } } /** - * The host joining the pool cannot have any running or suspended VMs. + * Operation cannot proceed while a tunnel exists on this interface. */ - public static class JoiningHostCannotHaveRunningOrSuspendedVms extends XenAPIException { - - /** - * Create a new JoiningHostCannotHaveRunningOrSuspendedVms - */ - public JoiningHostCannotHaveRunningOrSuspendedVms() { - super("The host joining the pool cannot have any running or suspended VMs."); - } - - } - - /** - * The patch precheck stage failed: prerequisite patches are missing. - */ - public static class PatchPrecheckFailedPrerequisiteMissing extends XenAPIException { - public final String patch; - public final String prerequisitePatchUuidList; - - /** - * Create a new PatchPrecheckFailedPrerequisiteMissing - * - * @param patch - * @param prerequisitePatchUuidList - */ - public PatchPrecheckFailedPrerequisiteMissing(String patch, String prerequisitePatchUuidList) { - super("The patch precheck stage failed: prerequisite patches are missing."); - this.patch = patch; - this.prerequisitePatchUuidList = prerequisitePatchUuidList; - } - - } - - /** - * This operation could not be performed, because the VM has one or more PCI devices passed through. - */ - public static class VmHasPciAttached extends XenAPIException { - public final String vm; - - /** - * Create a new VmHasPciAttached - * - * @param vm - */ - public VmHasPciAttached(String vm) { - super("This operation could not be performed, because the VM has one or more PCI devices passed through."); - this.vm = vm; - } - - } - - /** - * The VDI mirroring cannot be performed - */ - public static class MirrorFailed extends XenAPIException { - public final String vdi; - - /** - * Create a new MirrorFailed - * - * @param vdi - */ - public MirrorFailed(String vdi) { - super("The VDI mirroring cannot be performed"); - this.vdi = vdi; - } - - } - - /** - * The WLB server reported that communication with XenServer timed out. - */ - public static class WlbXenserverTimeout extends XenAPIException { - - /** - * Create a new WlbXenserverTimeout - */ - public WlbXenserverTimeout() { - super("The WLB server reported that communication with XenServer timed out."); - } - - } - - /** - * The pool failed to disable the external authentication of at least one host. - */ - public static class PoolAuthDisableFailedWrongCredentials extends XenAPIException { - public final String host; - public final String message; - - /** - * Create a new PoolAuthDisableFailedWrongCredentials - * - * @param host - * @param message - */ - public PoolAuthDisableFailedWrongCredentials(String host, String message) { - super("The pool failed to disable the external authentication of at least one host."); - this.host = host; - this.message = message; - } - - } - - /** - * The quiesced-snapshot operation failed for an unexpected reason - */ - public static class VmSnapshotWithQuiesceFailed extends XenAPIException { - public final String vm; - - /** - * Create a new VmSnapshotWithQuiesceFailed - * - * @param vm - */ - public VmSnapshotWithQuiesceFailed(String vm) { - super("The quiesced-snapshot operation failed for an unexpected reason"); - this.vm = vm; - } - - } - - /** - * The specified certificate is corrupt or unreadable. - */ - public static class CertificateCorrupt extends XenAPIException { - public final String name; - - /** - * Create a new CertificateCorrupt - * - * @param name - */ - public CertificateCorrupt(String name) { - super("The specified certificate is corrupt or unreadable."); - this.name = name; - } - - } - - /** - * The WLB server reported an internal error. - */ - public static class WlbInternalError extends XenAPIException { - - /** - * Create a new WlbInternalError - */ - public WlbInternalError() { - super("The WLB server reported an internal error."); - } - - } - - /** - * The VM unexpectedly rebooted - */ - public static class VmRebooted extends XenAPIException { - public final String vm; - - /** - * Create a new VmRebooted - * - * @param vm - */ - public VmRebooted(String vm) { - super("The VM unexpectedly rebooted"); - this.vm = vm; - } - - } - - /** - * Cannot forward messages because the host cannot be contacted. The host may be switched off or there may be network connectivity problems. - */ - public static class CannotContactHost extends XenAPIException { - public final String host; - - /** - * Create a new CannotContactHost - * - * @param host - */ - public CannotContactHost(String host) { - super("Cannot forward messages because the host cannot be contacted. The host may be switched off or there may be network connectivity problems."); - this.host = host; - } - - } - - /** - * Could not find any volumes supported by the Citrix XenServer Vss Provider - */ - public static class XenVssReqErrorNoVolumesSupported extends XenAPIException { - public final String vm; - public final String errorCode; - - /** - * Create a new XenVssReqErrorNoVolumesSupported - * - * @param vm - * @param errorCode - */ - public XenVssReqErrorNoVolumesSupported(String vm, String errorCode) { - super("Could not find any volumes supported by the Citrix XenServer Vss Provider"); - this.vm = vm; - this.errorCode = errorCode; - } - - } - - /** - * The host is its own slave. Please use pool-emergency-transition-to-master or pool-emergency-reset-master. - */ - public static class HostItsOwnSlave extends XenAPIException { - - /** - * Create a new HostItsOwnSlave - */ - public HostItsOwnSlave() { - super("The host is its own slave. Please use pool-emergency-transition-to-master or pool-emergency-reset-master."); - } - - } - - /** - * This PIF is a bond slave and cannot have a VLAN on it. - */ - public static class CannotAddVlanToBondSlave extends XenAPIException { + public static class PifTunnelStillExists extends XenAPIException { public final String PIF; /** - * Create a new CannotAddVlanToBondSlave + * Create a new PifTunnelStillExists * * @param PIF */ - public CannotAddVlanToBondSlave(String PIF) { - super("This PIF is a bond slave and cannot have a VLAN on it."); + public PifTunnelStillExists(String PIF) { + super("Operation cannot proceed while a tunnel exists on this interface."); this.PIF = PIF; } } - /** - * The operation could not be performed because a redo log is enabled on the Pool. - */ - public static class RedoLogIsEnabled extends XenAPIException { - - /** - * Create a new RedoLogIsEnabled - */ - public RedoLogIsEnabled() { - super("The operation could not be performed because a redo log is enabled on the Pool."); - } - - } - - /** - * You attempted an operation on a VM which requires PV drivers to be installed but the drivers were not detected. - */ - public static class VmMissingPvDrivers extends XenAPIException { - public final String vm; - - /** - * Create a new VmMissingPvDrivers - * - * @param vm - */ - public VmMissingPvDrivers(String vm) { - super("You attempted an operation on a VM which requires PV drivers to be installed but the drivers were not detected."); - this.vm = vm; - } - - } - - /** - * The specified certificate name is invalid. - */ - public static class CertificateNameInvalid extends XenAPIException { - public final String name; - - /** - * Create a new CertificateNameInvalid - * - * @param name - */ - public CertificateNameInvalid(String name) { - super("The specified certificate name is invalid."); - this.name = name; - } - - } - /** * The VM could not be imported because a required object could not be found. */ @@ -8671,248 +8908,7 @@ public class Types } /** - * This operation cannot be performed because the specified VDI could not be found in the specified SR - */ - public static class VdiLocationMissing extends XenAPIException { - public final String sr; - public final String location; - - /** - * Create a new VdiLocationMissing - * - * @param sr - * @param location - */ - public VdiLocationMissing(String sr, String location) { - super("This operation cannot be performed because the specified VDI could not be found in the specified SR"); - this.sr = sr; - this.location = location; - } - - } - - /** - * The host failed to enable external authentication. - */ - public static class AuthEnableFailedPermissionDenied extends XenAPIException { - public final String message; - - /** - * Create a new AuthEnableFailedPermissionDenied - * - * @param message - */ - public AuthEnableFailedPermissionDenied(String message) { - super("The host failed to enable external authentication."); - this.message = message; - } - - } - - /** - * Operation cannot proceed while a VLAN exists on this interface. - */ - public static class PifVlanStillExists extends XenAPIException { - public final String PIF; - - /** - * Create a new PifVlanStillExists - * - * @param PIF - */ - public PifVlanStillExists(String PIF) { - super("Operation cannot proceed while a VLAN exists on this interface."); - this.PIF = PIF; - } - - } - - /** - * The given VMs failed to release memory when instructed to do so - */ - public static class VmsFailedToCooperate extends XenAPIException { - - /** - * Create a new VmsFailedToCooperate - */ - public VmsFailedToCooperate() { - super("The given VMs failed to release memory when instructed to do so"); - } - - } - - /** - * You reached the maximal number of concurrently migrating VMs. - */ - public static class TooManyStorageMigrates extends XenAPIException { - public final String number; - - /** - * Create a new TooManyStorageMigrates - * - * @param number - */ - public TooManyStorageMigrates(String number) { - super("You reached the maximal number of concurrently migrating VMs."); - this.number = number; - } - - } - - /** - * The network contains active VIFs and cannot be deleted. - */ - public static class NetworkContainsVif extends XenAPIException { - public final String vifs; - - /** - * Create a new NetworkContainsVif - * - * @param vifs - */ - public NetworkContainsVif(String vifs) { - super("The network contains active VIFs and cannot be deleted."); - this.vifs = vifs; - } - - } - - /** - * The value given is invalid - */ - public static class InvalidValue extends XenAPIException { - public final String field; - public final String value; - - /** - * Create a new InvalidValue - * - * @param field - * @param value - */ - public InvalidValue(String field, String value) { - super("The value given is invalid"); - this.field = field; - this.value = value; - } - - } - - /** - * The requested plugin could not be found. - */ - public static class XenapiMissingPlugin extends XenAPIException { - public final String name; - - /** - * Create a new XenapiMissingPlugin - * - * @param name - */ - public XenapiMissingPlugin(String name) { - super("The requested plugin could not be found."); - this.name = name; - } - - } - - /** - * The restore could not be performed because the host's current management interface is not in the backup. The interfaces mentioned in the backup are: - */ - public static class RestoreTargetMgmtIfNotInBackup extends XenAPIException { - - /** - * Create a new RestoreTargetMgmtIfNotInBackup - */ - public RestoreTargetMgmtIfNotInBackup() { - super("The restore could not be performed because the host's current management interface is not in the backup. The interfaces mentioned in the backup are:"); - } - - } - - /** - * You tried to create a VLAN or tunnel on top of a tunnel access PIF - use the underlying transport PIF instead. - */ - public static class IsTunnelAccessPif extends XenAPIException { - public final String PIF; - - /** - * Create a new IsTunnelAccessPif - * - * @param PIF - */ - public IsTunnelAccessPif(String PIF) { - super("You tried to create a VLAN or tunnel on top of a tunnel access PIF - use the underlying transport PIF instead."); - this.PIF = PIF; - } - - } - - /** - * There was an error connecting to the host while joining it in the pool. - */ - public static class JoiningHostConnectionFailed extends XenAPIException { - - /** - * Create a new JoiningHostConnectionFailed - */ - public JoiningHostConnectionFailed() { - super("There was an error connecting to the host while joining it in the pool."); - } - - } - - /** - * Subject cannot be resolved by the external directory service. - */ - public static class SubjectCannotBeResolved extends XenAPIException { - - /** - * Create a new SubjectCannotBeResolved - */ - public SubjectCannotBeResolved() { - super("Subject cannot be resolved by the external directory service."); - } - - } - - /** - * Some volumes to be snapshot could not be added to the VSS snapshot set - */ - public static class XenVssReqErrorAddingVolumeToSnapsetFailed extends XenAPIException { - public final String vm; - public final String errorCode; - - /** - * Create a new XenVssReqErrorAddingVolumeToSnapsetFailed - * - * @param vm - * @param errorCode - */ - public XenVssReqErrorAddingVolumeToSnapsetFailed(String vm, String errorCode) { - super("Some volumes to be snapshot could not be added to the VSS snapshot set"); - this.vm = vm; - this.errorCode = errorCode; - } - - } - - /** - * The provision call failed because it ran out of space. - */ - public static class ProvisionFailedOutOfSpace extends XenAPIException { - - /** - * Create a new ProvisionFailedOutOfSpace - */ - public ProvisionFailedOutOfSpace() { - super("The provision call failed because it ran out of space."); - } - - } - - /** - * You attempted to migrate a VDI which is not attached to a runnning VM. + * You attempted to migrate a VDI which is not attached to a running VM. */ public static class VdiNeedsVmForMigrate extends XenAPIException { public final String vdi; @@ -8923,684 +8919,85 @@ public class Types * @param vdi */ public VdiNeedsVmForMigrate(String vdi) { - super("You attempted to migrate a VDI which is not attached to a runnning VM."); + super("You attempted to migrate a VDI which is not attached to a running VM."); this.vdi = vdi; } } /** - * An error occurred while attempting to import a database from a metadata VDI + * The SR backend does not support the operation (check the SR's allowed operations) */ - public static class CouldNotImportDatabase extends XenAPIException { - public final String reason; + public static class SrOperationNotSupported extends XenAPIException { + public final String sr; /** - * Create a new CouldNotImportDatabase + * Create a new SrOperationNotSupported * - * @param reason + * @param sr */ - public CouldNotImportDatabase(String reason) { - super("An error occurred while attempting to import a database from a metadata VDI"); - this.reason = reason; + public SrOperationNotSupported(String sr) { + super("The SR backend does not support the operation (check the SR's allowed operations)"); + this.sr = sr; } } /** - * This operation can only be performed on CD VDIs (iso files or CDROM drives) + * The VSS plug-in cannot be contacted */ - public static class VdiIsNotIso extends XenAPIException { - public final String vdi; - public final String type; - - /** - * Create a new VdiIsNotIso - * - * @param vdi - * @param type - */ - public VdiIsNotIso(String vdi, String type) { - super("This operation can only be performed on CD VDIs (iso files or CDROM drives)"); - this.vdi = vdi; - this.type = type; - } - - } - - /** - * You tried to call a method that does not exist. The method name that you used is echoed. - */ - public static class MessageMethodUnknown extends XenAPIException { - public final String method; - - /** - * Create a new MessageMethodUnknown - * - * @param method - */ - public MessageMethodUnknown(String method) { - super("You tried to call a method that does not exist. The method name that you used is echoed."); - this.method = method; - } - - } - - /** - * You cannot delete the specified default template. - */ - public static class VmCannotDeleteDefaultTemplate extends XenAPIException { + public static class VmSnapshotWithQuiescePluginDeosNotRespond extends XenAPIException { public final String vm; /** - * Create a new VmCannotDeleteDefaultTemplate + * Create a new VmSnapshotWithQuiescePluginDeosNotRespond * * @param vm */ - public VmCannotDeleteDefaultTemplate(String vm) { - super("You cannot delete the specified default template."); + public VmSnapshotWithQuiescePluginDeosNotRespond(String vm) { + super("The VSS plug-in cannot be contacted"); this.vm = vm; } } /** - * Role cannot be found. + * 3rd party xapi hook failed */ - public static class RoleNotFound extends XenAPIException { - - /** - * Create a new RoleNotFound - */ - public RoleNotFound() { - super("Role cannot be found."); - } - - } - - /** - * This command is not allowed on the OEM edition. - */ - public static class NotAllowedOnOemEdition extends XenAPIException { - public final String command; - - /** - * Create a new NotAllowedOnOemEdition - * - * @param command - */ - public NotAllowedOnOemEdition(String command) { - super("This command is not allowed on the OEM edition."); - this.command = command; - } - - } - - /** - * The restore could not be performed because the restore script failed. Is the file corrupt? - */ - public static class RestoreScriptFailed extends XenAPIException { - public final String log; - - /** - * Create a new RestoreScriptFailed - * - * @param log - */ - public RestoreScriptFailed(String log) { - super("The restore could not be performed because the restore script failed. Is the file corrupt?"); - this.log = log; - } - - } - - /** - * The server failed to handle your request, due to an internal error. The given message may give details useful for debugging the problem. - */ - public static class InternalError extends XenAPIException { - public final String message; - - /** - * Create a new InternalError - * - * @param message - */ - public InternalError(String message) { - super("The server failed to handle your request, due to an internal error. The given message may give details useful for debugging the problem."); - this.message = message; - } - - } - - /** - * XHA cannot be enabled because this host's license does not allow it - */ - public static class LicenseDoesNotSupportXha extends XenAPIException { - - /** - * Create a new LicenseDoesNotSupportXha - */ - public LicenseDoesNotSupportXha() { - super("XHA cannot be enabled because this host's license does not allow it"); - } - - } - - /** - * The primary address types are not compatible - */ - public static class PifIncompatiblePrimaryAddressType extends XenAPIException { - - /** - * Create a new PifIncompatiblePrimaryAddressType - */ - public PifIncompatiblePrimaryAddressType() { - super("The primary address types are not compatible"); - } - - } - - /** - * The device is not currently attached - */ - public static class DeviceAlreadyDetached extends XenAPIException { - public final String device; - - /** - * Create a new DeviceAlreadyDetached - * - * @param device - */ - public DeviceAlreadyDetached(String device) { - super("The device is not currently attached"); - this.device = device; - } - - } - - /** - * The host failed to enable external authentication. - */ - public static class AuthEnableFailedUnavailable extends XenAPIException { - public final String message; - - /** - * Create a new AuthEnableFailedUnavailable - * - * @param message - */ - public AuthEnableFailedUnavailable(String message) { - super("The host failed to enable external authentication."); - this.message = message; - } - - } - - /** - * Media could not be ejected because it is not removable - */ - public static class VbdNotRemovableMedia extends XenAPIException { - public final String vbd; - - /** - * Create a new VbdNotRemovableMedia - * - * @param vbd - */ - public VbdNotRemovableMedia(String vbd) { - super("Media could not be ejected because it is not removable"); - this.vbd = vbd; - } - - } - - /** - * A VDI with the specified location already exists within the SR - */ - public static class LocationNotUnique extends XenAPIException { - public final String SR; - public final String location; - - /** - * Create a new LocationNotUnique - * - * @param SR - * @param location - */ - public LocationNotUnique(String SR, String location) { - super("A VDI with the specified location already exists within the SR"); - this.SR = SR; - this.location = location; - } - - } - - /** - * The function is not implemented - */ - public static class NotImplemented extends XenAPIException { - public final String function; - - /** - * Create a new NotImplemented - * - * @param function - */ - public NotImplemented(String function) { - super("The function is not implemented"); - this.function = function; - } - - } - - /** - * Cannot plug VIF - */ - public static class CannotPlugVif extends XenAPIException { - public final String VIF; - - /** - * Create a new CannotPlugVif - * - * @param VIF - */ - public CannotPlugVif(String VIF) { - super("Cannot plug VIF"); - this.VIF = VIF; - } - - } - - /** - * Only the local superuser can execute this operation - */ - public static class UserIsNotLocalSuperuser extends XenAPIException { - public final String msg; - - /** - * Create a new UserIsNotLocalSuperuser - * - * @param msg - */ - public UserIsNotLocalSuperuser(String msg) { - super("Only the local superuser can execute this operation"); - this.msg = msg; - } - - } - - /** - * The backup could not be performed because the backup script failed. - */ - public static class BackupScriptFailed extends XenAPIException { - public final String log; - - /** - * Create a new BackupScriptFailed - * - * @param log - */ - public BackupScriptFailed(String log) { - super("The backup could not be performed because the backup script failed."); - this.log = log; - } - - } - - /** - * The VM could not be imported because the XVA file is invalid: an unexpected file was encountered. - */ - public static class ImportErrorUnexpectedFile extends XenAPIException { - public final String filenameExpected; - public final String filenameFound; - - /** - * Create a new ImportErrorUnexpectedFile - * - * @param filenameExpected - * @param filenameFound - */ - public ImportErrorUnexpectedFile(String filenameExpected, String filenameFound) { - super("The VM could not be imported because the XVA file is invalid: an unexpected file was encountered."); - this.filenameExpected = filenameExpected; - this.filenameFound = filenameFound; - } - - } - - /** - * External authentication for this host is already enabled. - */ - public static class AuthAlreadyEnabled extends XenAPIException { - public final String currentAuthType; - public final String currentServiceName; - - /** - * Create a new AuthAlreadyEnabled - * - * @param currentAuthType - * @param currentServiceName - */ - public AuthAlreadyEnabled(String currentAuthType, String currentServiceName) { - super("External authentication for this host is already enabled."); - this.currentAuthType = currentAuthType; - this.currentServiceName = currentServiceName; - } - - } - - /** - * You attempted an operation that was not allowed. - */ - public static class OperationNotAllowed extends XenAPIException { + public static class XapiHookFailed extends XenAPIException { + public final String hookName; public final String reason; - - /** - * Create a new OperationNotAllowed - * - * @param reason - */ - public OperationNotAllowed(String reason) { - super("You attempted an operation that was not allowed."); - this.reason = reason; - } - - } - - /** - * Cannot find a plan for placement of VMs as there are no other hosts available. - */ - public static class HaNoPlan extends XenAPIException { - - /** - * Create a new HaNoPlan - */ - public HaNoPlan() { - super("Cannot find a plan for placement of VMs as there are no other hosts available."); - } - - } - - /** - * Some events have been lost from the queue and cannot be retrieved. - */ - public static class EventsLost extends XenAPIException { - - /** - * Create a new EventsLost - */ - public EventsLost() { - super("Some events have been lost from the queue and cannot be retrieved."); - } - - } - - /** - * There was an SR backend failure. - */ - public static class SrBackendFailure extends XenAPIException { - public final String status; public final String stdout; - public final String stderr; + public final String exitCode; /** - * Create a new SrBackendFailure + * Create a new XapiHookFailed * - * @param status + * @param hookName + * @param reason * @param stdout - * @param stderr + * @param exitCode */ - public SrBackendFailure(String status, String stdout, String stderr) { - super("There was an SR backend failure."); - this.status = status; + public XapiHookFailed(String hookName, String reason, String stdout, String exitCode) { + super("3rd party xapi hook failed"); + this.hookName = hookName; + this.reason = reason; this.stdout = stdout; - this.stderr = stderr; + this.exitCode = exitCode; } } /** - * A timeout happened while attempting to detach a device from a VM. + * The operation could not be performed because a redo log is enabled on the Pool. */ - public static class DeviceDetachTimeout extends XenAPIException { - public final String type; - public final String ref; + public static class RedoLogIsEnabled extends XenAPIException { /** - * Create a new DeviceDetachTimeout - * - * @param type - * @param ref + * Create a new RedoLogIsEnabled */ - public DeviceDetachTimeout(String type, String ref) { - super("A timeout happened while attempting to detach a device from a VM."); - this.type = type; - this.ref = ref; - } - - } - - /** - * The specified VM has a duplicate VBD device and cannot be started. - */ - public static class VmDuplicateVbdDevice extends XenAPIException { - public final String vm; - public final String vbd; - public final String device; - - /** - * Create a new VmDuplicateVbdDevice - * - * @param vm - * @param vbd - * @param device - */ - public VmDuplicateVbdDevice(String vm, String vbd, String device) { - super("The specified VM has a duplicate VBD device and cannot be started."); - this.vm = vm; - this.vbd = vbd; - this.device = device; - } - - } - - /** - * This PIF is a bond slave and cannot be plugged. - */ - public static class CannotPlugBondSlave extends XenAPIException { - public final String PIF; - - /** - * Create a new CannotPlugBondSlave - * - * @param PIF - */ - public CannotPlugBondSlave(String PIF) { - super("This PIF is a bond slave and cannot be plugged."); - this.PIF = PIF; - } - - } - - /** - * The VM cannot be imported unforced because it is either the same version or an older version of an existing VM. - */ - public static class VmToImportIsNotNewerVersion extends XenAPIException { - public final String vm; - public final String existingVersion; - public final String versionToImport; - - /** - * Create a new VmToImportIsNotNewerVersion - * - * @param vm - * @param existingVersion - * @param versionToImport - */ - public VmToImportIsNotNewerVersion(String vm, String existingVersion, String versionToImport) { - super("The VM cannot be imported unforced because it is either the same version or an older version of an existing VM."); - this.vm = vm; - this.existingVersion = existingVersion; - this.versionToImport = versionToImport; - } - - } - - /** - * The specified CRL is corrupt or unreadable. - */ - public static class CrlCorrupt extends XenAPIException { - public final String name; - - /** - * Create a new CrlCorrupt - * - * @param name - */ - public CrlCorrupt(String name) { - super("The specified CRL is corrupt or unreadable."); - this.name = name; - } - - } - - /** - * You attempted an operation on a VM which requires a more recent version of the PV drivers. Please upgrade your PV drivers. - */ - public static class VmOldPvDrivers extends XenAPIException { - public final String vm; - public final String major; - public final String minor; - - /** - * Create a new VmOldPvDrivers - * - * @param vm - * @param major - * @param minor - */ - public VmOldPvDrivers(String vm, String major, String minor) { - super("You attempted an operation on a VM which requires a more recent version of the PV drivers. Please upgrade your PV drivers."); - this.vm = vm; - this.major = major; - this.minor = minor; - } - - } - - /** - * The operation you requested cannot be performed because the specified PIF does not allow unplug. - */ - public static class PifDoesNotAllowUnplug extends XenAPIException { - public final String PIF; - - /** - * Create a new PifDoesNotAllowUnplug - * - * @param PIF - */ - public PifDoesNotAllowUnplug(String PIF) { - super("The operation you requested cannot be performed because the specified PIF does not allow unplug."); - this.PIF = PIF; - } - - } - - /** - * The system rejected the password change request; perhaps the new password was too short? - */ - public static class ChangePasswordRejected extends XenAPIException { - public final String msg; - - /** - * Create a new ChangePasswordRejected - * - * @param msg - */ - public ChangePasswordRejected(String msg) { - super("The system rejected the password change request; perhaps the new password was too short?"); - this.msg = msg; - } - - } - - /** - * Another operation involving the object is currently in progress - */ - public static class OtherOperationInProgress extends XenAPIException { - public final String clazz; - public final String object; - - /** - * Create a new OtherOperationInProgress - * - * @param clazz - * @param object - */ - public OtherOperationInProgress(String clazz, String object) { - super("Another operation involving the object is currently in progress"); - this.clazz = clazz; - this.object = object; - } - - } - - /** - * Initialization of the VSS requestor failed - */ - public static class XenVssReqErrorInitFailed extends XenAPIException { - public final String vm; - public final String errorCode; - - /** - * Create a new XenVssReqErrorInitFailed - * - * @param vm - * @param errorCode - */ - public XenVssReqErrorInitFailed(String vm, String errorCode) { - super("Initialization of the VSS requestor failed"); - this.vm = vm; - this.errorCode = errorCode; - } - - } - - /** - * The CPU does not support masking of features. - */ - public static class CpuFeatureMaskingNotSupported extends XenAPIException { - public final String details; - - /** - * Create a new CpuFeatureMaskingNotSupported - * - * @param details - */ - public CpuFeatureMaskingNotSupported(String details) { - super("The CPU does not support masking of features."); - this.details = details; - } - - } - - /** - * The specified VM is not currently resident on the specified host. - */ - public static class VmNotResidentHere extends XenAPIException { - public final String vm; - public final String host; - - /** - * Create a new VmNotResidentHere - * - * @param vm - * @param host - */ - public VmNotResidentHere(String vm, String host) { - super("The specified VM is not currently resident on the specified host."); - this.vm = vm; - this.host = host; + public RedoLogIsEnabled() { + super("The operation could not be performed because a redo log is enabled on the Pool."); } } @@ -9624,220 +9021,194 @@ public class Types } /** - * The pool failed to disable the external authentication of at least one host. + * A CRL already exists with the specified name. */ - public static class PoolAuthDisableFailed extends XenAPIException { - public final String host; - public final String message; + public static class CrlAlreadyExists extends XenAPIException { + public final String name; /** - * Create a new PoolAuthDisableFailed + * Create a new CrlAlreadyExists * - * @param host - * @param message + * @param name */ - public PoolAuthDisableFailed(String host, String message) { - super("The pool failed to disable the external authentication of at least one host."); - this.host = host; - this.message = message; + public CrlAlreadyExists(String name) { + super("A CRL already exists with the specified name."); + this.name = name; } } /** - * The host failed to acquire an IP address on its management interface and therefore cannot contact the master. + * The remote system's SSL certificate failed to verify against our certificate library. */ - public static class HostHasNoManagementIp extends XenAPIException { - - /** - * Create a new HostHasNoManagementIp - */ - public HostHasNoManagementIp() { - super("The host failed to acquire an IP address on its management interface and therefore cannot contact the master."); - } - - } - - /** - * The tunnel transport PIF has no IP configuration set. - */ - public static class TransportPifNotConfigured extends XenAPIException { - public final String PIF; - - /** - * Create a new TransportPifNotConfigured - * - * @param PIF - */ - public TransportPifNotConfigured(String PIF) { - super("The tunnel transport PIF has no IP configuration set."); - this.PIF = PIF; - } - - } - - /** - * The operation could not be performed because HA is enabled on the Pool - */ - public static class HaIsEnabled extends XenAPIException { - - /** - * Create a new HaIsEnabled - */ - public HaIsEnabled() { - super("The operation could not be performed because HA is enabled on the Pool"); - } - - } - - /** - * An error occured while reverting the specified virtual machine to the specified snapshot - */ - public static class VmRevertFailed extends XenAPIException { - public final String vm; - public final String snapshot; - - /** - * Create a new VmRevertFailed - * - * @param vm - * @param snapshot - */ - public VmRevertFailed(String vm, String snapshot) { - super("An error occured while reverting the specified virtual machine to the specified snapshot"); - this.vm = vm; - this.snapshot = snapshot; - } - - } - - /** - * The host name is invalid. - */ - public static class HostNameInvalid extends XenAPIException { + public static class SslVerifyError extends XenAPIException { public final String reason; /** - * Create a new HostNameInvalid + * Create a new SslVerifyError * * @param reason */ - public HostNameInvalid(String reason) { - super("The host name is invalid."); + public SslVerifyError(String reason) { + super("The remote system's SSL certificate failed to verify against our certificate library."); this.reason = reason; } } /** - * The operation could not be performed because a domain still exists for the specified VM. + * Unknown type of external authentication. */ - public static class DomainExists extends XenAPIException { - public final String vm; - public final String domid; + public static class AuthUnknownType extends XenAPIException { + public final String type; /** - * Create a new DomainExists + * Create a new AuthUnknownType * - * @param vm - * @param domid + * @param type */ - public DomainExists(String vm, String domid) { - super("The operation could not be performed because a domain still exists for the specified VM."); - this.vm = vm; - this.domid = domid; + public AuthUnknownType(String type) { + super("Unknown type of external authentication."); + this.type = type; } } /** - * This host cannot join the pool because the pool has HA enabled but this host has HA disabled. + * PIF has no IPv6 configuration (mode curently set to 'none') */ - public static class HaPoolIsEnabledButHostIsDisabled extends XenAPIException { + public static class PifHasNoV6NetworkConfiguration extends XenAPIException { /** - * Create a new HaPoolIsEnabledButHostIsDisabled + * Create a new PifHasNoV6NetworkConfiguration */ - public HaPoolIsEnabledButHostIsDisabled() { - super("This host cannot join the pool because the pool has HA enabled but this host has HA disabled."); + public PifHasNoV6NetworkConfiguration() { + super("PIF has no IPv6 configuration (mode curently set to 'none')"); } } /** - * This message has been deprecated. + * Host cannot rejoin pool because it should have fenced (it is not in the master's partition) */ - public static class MessageDeprecated extends XenAPIException { + public static class HaShouldBeFenced extends XenAPIException { + public final String host; /** - * Create a new MessageDeprecated - */ - public MessageDeprecated() { - super("This message has been deprecated."); - } - - } - - /** - * This operation cannot be performed because the referenced SR is not properly shared. The SR must both be marked as shared and a currently_attached PBD must exist for each host. - */ - public static class HaConstraintViolationSrNotShared extends XenAPIException { - public final String SR; - - /** - * Create a new HaConstraintViolationSrNotShared + * Create a new HaShouldBeFenced * - * @param SR + * @param host */ - public HaConstraintViolationSrNotShared(String SR) { - super("This operation cannot be performed because the referenced SR is not properly shared. The SR must both be marked as shared and a currently_attached PBD must exist for each host."); - this.SR = SR; + public HaShouldBeFenced(String host) { + super("Host cannot rejoin pool because it should have fenced (it is not in the master's partition)"); + this.host = host; } } /** - * Cannot import VM using chunked encoding. + * There is not enough space to upload the update */ - public static class ImportErrorCannotHandleChunked extends XenAPIException { + public static class OutOfSpace extends XenAPIException { + public final String location; /** - * Create a new ImportErrorCannotHandleChunked - */ - public ImportErrorCannotHandleChunked() { - super("Cannot import VM using chunked encoding."); - } - - } - - /** - * You attempted to start a VM that's attached to more than one VDI with a timeoffset marked as reset-on-boot. - */ - public static class VmAttachedToMoreThanOneVdiWithTimeoffsetMarkedAsResetOnBoot extends XenAPIException { - public final String vm; - - /** - * Create a new VmAttachedToMoreThanOneVdiWithTimeoffsetMarkedAsResetOnBoot + * Create a new OutOfSpace * - * @param vm + * @param location */ - public VmAttachedToMoreThanOneVdiWithTimeoffsetMarkedAsResetOnBoot(String vm) { - super("You attempted to start a VM that's attached to more than one VDI with a timeoffset marked as reset-on-boot."); - this.vm = vm; + public OutOfSpace(String location) { + super("There is not enough space to upload the update"); + this.location = location; } } /** - * This operation is not supported during an upgrade. + * The SR has no attached PBDs */ - public static class NotSupportedDuringUpgrade extends XenAPIException { + public static class SrHasNoPbds extends XenAPIException { + public final String sr; /** - * Create a new NotSupportedDuringUpgrade + * Create a new SrHasNoPbds + * + * @param sr */ - public NotSupportedDuringUpgrade() { - super("This operation is not supported during an upgrade."); + public SrHasNoPbds(String sr) { + super("The SR has no attached PBDs"); + this.sr = sr; + } + + } + + /** + * RBAC permission denied. + */ + public static class RbacPermissionDenied extends XenAPIException { + public final String permission; + public final String message; + + /** + * Create a new RbacPermissionDenied + * + * @param permission + * @param message + */ + public RbacPermissionDenied(String permission, String message) { + super("RBAC permission denied."); + this.permission = permission; + this.message = message; + } + + } + + /** + * The host could not join the liveset because the HA daemon could not access the heartbeat disk. + */ + public static class HaHostCannotAccessStatefile extends XenAPIException { + + /** + * Create a new HaHostCannotAccessStatefile + */ + public HaHostCannotAccessStatefile() { + super("The host could not join the liveset because the HA daemon could not access the heartbeat disk."); + } + + } + + /** + * The communication with the WLB server timed out. + */ + public static class WlbTimeout extends XenAPIException { + public final String configuredTimeout; + + /** + * Create a new WlbTimeout + * + * @param configuredTimeout + */ + public WlbTimeout(String configuredTimeout) { + super("The communication with the WLB server timed out."); + this.configuredTimeout = configuredTimeout; + } + + } + + /** + * This host cannot accept the proposed new master setting at this time. + */ + public static class HaAbortNewMaster extends XenAPIException { + public final String reason; + + /** + * Create a new HaAbortNewMaster + * + * @param reason + */ + public HaAbortNewMaster(String reason) { + super("This host cannot accept the proposed new master setting at this time."); + this.reason = reason; } } @@ -9864,81 +9235,769 @@ public class Types } /** - * The specified interface cannot be used because it has no IP address + * You attempted to migrate a VM with more than one snapshot. */ - public static class InterfaceHasNoIp extends XenAPIException { - public final String iface; + public static class VmHasTooManySnapshots extends XenAPIException { + public final String vm; /** - * Create a new InterfaceHasNoIp + * Create a new VmHasTooManySnapshots * - * @param iface + * @param vm */ - public InterfaceHasNoIp(String iface) { - super("The specified interface cannot be used because it has no IP address"); - this.iface = iface; + public VmHasTooManySnapshots(String vm) { + super("You attempted to migrate a VM with more than one snapshot."); + this.vm = vm; } } /** - * The hosts in this pool are not compatible. + * The specified patch is applied and cannot be destroyed. */ - public static class HostsNotCompatible extends XenAPIException { + public static class PatchIsApplied extends XenAPIException { /** - * Create a new HostsNotCompatible + * Create a new PatchIsApplied */ - public HostsNotCompatible() { - super("The hosts in this pool are not compatible."); + public PatchIsApplied() { + super("The specified patch is applied and cannot be destroyed."); } } /** - * The host failed to enable external authentication. + * The VDI mirroring cannot be performed */ - public static class AuthEnableFailedWrongCredentials extends XenAPIException { + public static class MirrorFailed extends XenAPIException { + public final String vdi; + + /** + * Create a new MirrorFailed + * + * @param vdi + */ + public MirrorFailed(String vdi) { + super("The VDI mirroring cannot be performed"); + this.vdi = vdi; + } + + } + + /** + * The host failed to disable external authentication. + */ + public static class AuthDisableFailed extends XenAPIException { public final String message; /** - * Create a new AuthEnableFailedWrongCredentials + * Create a new AuthDisableFailed * * @param message */ - public AuthEnableFailedWrongCredentials(String message) { - super("The host failed to enable external authentication."); + public AuthDisableFailed(String message) { + super("The host failed to disable external authentication."); this.message = message; } } + /** + * The operation you requested cannot be performed because the specified PIF is the management interface. + */ + public static class PifIsManagementInterface extends XenAPIException { + public final String PIF; + + /** + * Create a new PifIsManagementInterface + * + * @param PIF + */ + public PifIsManagementInterface(String PIF) { + super("The operation you requested cannot be performed because the specified PIF is the management interface."); + this.PIF = PIF; + } + + } + + /** + * The specified certificate does not exist. + */ + public static class CertificateDoesNotExist extends XenAPIException { + public final String name; + + /** + * Create a new CertificateDoesNotExist + * + * @param name + */ + public CertificateDoesNotExist(String name) { + super("The specified certificate does not exist."); + this.name = name; + } + + } + + /** + * The network contains active VIFs and cannot be deleted. + */ + public static class NetworkContainsVif extends XenAPIException { + public final String vifs; + + /** + * Create a new NetworkContainsVif + * + * @param vifs + */ + public NetworkContainsVif(String vifs) { + super("The network contains active VIFs and cannot be deleted."); + this.vifs = vifs; + } + + } + + /** + * The power-state of a control domain cannot be reset. + */ + public static class CannotResetControlDomain extends XenAPIException { + public final String vm; + + /** + * Create a new CannotResetControlDomain + * + * @param vm + */ + public CannotResetControlDomain(String vm) { + super("The power-state of a control domain cannot be reset."); + this.vm = vm; + } + + } + + /** + * The WLB server rejected our configured authentication details. + */ + public static class WlbAuthenticationFailed extends XenAPIException { + + /** + * Create a new WlbAuthenticationFailed + */ + public WlbAuthenticationFailed() { + super("The WLB server rejected our configured authentication details."); + } + + } + + /** + * The WLB URL is invalid. Ensure it is in format: :. The configured/given URL is returned. + */ + public static class WlbUrlInvalid extends XenAPIException { + public final String url; + + /** + * Create a new WlbUrlInvalid + * + * @param url + */ + public WlbUrlInvalid(String url) { + super("The WLB URL is invalid. Ensure it is in format: :. The configured/given URL is returned."); + this.url = url; + } + + } + + /** + * This operation cannot be performed because the referenced SR is not properly shared. The SR must both be marked as shared and a currently_attached PBD must exist for each host. + */ + public static class HaConstraintViolationSrNotShared extends XenAPIException { + public final String SR; + + /** + * Create a new HaConstraintViolationSrNotShared + * + * @param SR + */ + public HaConstraintViolationSrNotShared(String SR) { + super("This operation cannot be performed because the referenced SR is not properly shared. The SR must both be marked as shared and a currently_attached PBD must exist for each host."); + this.SR = SR; + } + + } + + /** + * You need at least 1 VCPU to start a VM + */ + public static class VmNoVcpus extends XenAPIException { + public final String vm; + + /** + * Create a new VmNoVcpus + * + * @param vm + */ + public VmNoVcpus(String vm) { + super("You need at least 1 VCPU to start a VM"); + this.vm = vm; + } + + } + + /** + * You attempted to migrate a VM which has a checkpoint. + */ + public static class VmHasCheckpoint extends XenAPIException { + public final String vm; + + /** + * Create a new VmHasCheckpoint + * + * @param vm + */ + public VmHasCheckpoint(String vm) { + super("You attempted to migrate a VM which has a checkpoint."); + this.vm = vm; + } + + } + + /** + * This VM has locked the DVD drive tray, so the disk cannot be ejected + */ + public static class VbdTrayLocked extends XenAPIException { + public final String vbd; + + /** + * Create a new VbdTrayLocked + * + * @param vbd + */ + public VbdTrayLocked(String vbd) { + super("This VM has locked the DVD drive tray, so the disk cannot be ejected"); + this.vbd = vbd; + } + + } + + /** + * The metrics of this host could not be read. + */ + public static class HostCannotReadMetrics extends XenAPIException { + + /** + * Create a new HostCannotReadMetrics + */ + public HostCannotReadMetrics() { + super("The metrics of this host could not be read."); + } + + } + + /** + * The WLB server said something that XenServer wasn't expecting or didn't understand. The method called on the WLB server, a diagnostic reason, and the response from WLB are returned. + */ + public static class WlbMalformedResponse extends XenAPIException { + public final String method; + public final String reason; + public final String response; + + /** + * Create a new WlbMalformedResponse + * + * @param method + * @param reason + * @param response + */ + public WlbMalformedResponse(String method, String reason, String response) { + super("The WLB server said something that XenServer wasn't expecting or didn't understand. The method called on the WLB server, a diagnostic reason, and the response from WLB are returned."); + this.method = method; + this.reason = reason; + this.response = response; + } + + } + + /** + * The license-server connection details (address or port) were missing or incomplete. + */ + public static class MissingConnectionDetails extends XenAPIException { + + /** + * Create a new MissingConnectionDetails + */ + public MissingConnectionDetails() { + super("The license-server connection details (address or port) were missing or incomplete."); + } + + } + + /** + * There is insufficient capacity on this PGPU to run the VGPU. + */ + public static class PgpuInsufficientCapacityForVgpu extends XenAPIException { + public final String pgpu; + public final String vgpuType; + + /** + * Create a new PgpuInsufficientCapacityForVgpu + * + * @param pgpu + * @param vgpuType + */ + public PgpuInsufficientCapacityForVgpu(String pgpu, String vgpuType) { + super("There is insufficient capacity on this PGPU to run the VGPU."); + this.pgpu = pgpu; + this.vgpuType = vgpuType; + } + + } + + /** + * Read/write CDs are not supported + */ + public static class VbdCdsMustBeReadonly extends XenAPIException { + + /** + * Create a new VbdCdsMustBeReadonly + */ + public VbdCdsMustBeReadonly() { + super("Read/write CDs are not supported"); + } + + } + + /** + * VM failed to shutdown before the timeout expired + */ + public static class VmShutdownTimeout extends XenAPIException { + public final String vm; + public final String timeout; + + /** + * Create a new VmShutdownTimeout + * + * @param vm + * @param timeout + */ + public VmShutdownTimeout(String vm, String timeout) { + super("VM failed to shutdown before the timeout expired"); + this.vm = vm; + this.timeout = timeout; + } + + } + + /** + * The pool failed to disable the external authentication of at least one host. + */ + public static class PoolAuthDisableFailedPermissionDenied extends XenAPIException { + public final String host; + public final String message; + + /** + * Create a new PoolAuthDisableFailedPermissionDenied + * + * @param host + * @param message + */ + public PoolAuthDisableFailedPermissionDenied(String host, String message) { + super("The pool failed to disable the external authentication of at least one host."); + this.host = host; + this.message = message; + } + + } + + /** + * The VM could not be imported. + */ + public static class ImportError extends XenAPIException { + public final String msg; + + /** + * Create a new ImportError + * + * @param msg + */ + public ImportError(String msg) { + super("The VM could not be imported."); + this.msg = msg; + } + + } + + /** + * No WLB connection is configured. + */ + public static class WlbNotInitialized extends XenAPIException { + + /** + * Create a new WlbNotInitialized + */ + public WlbNotInitialized() { + super("No WLB connection is configured."); + } + + } + + /** + * You tried to create a VLAN, but the tag you gave was invalid -- it must be between 0 and 4094. The parameter echoes the VLAN tag you gave. + */ + public static class VlanTagInvalid extends XenAPIException { + public final String VLAN; + + /** + * Create a new VlanTagInvalid + * + * @param VLAN + */ + public VlanTagInvalid(String VLAN) { + super("You tried to create a VLAN, but the tag you gave was invalid -- it must be between 0 and 4094. The parameter echoes the VLAN tag you gave."); + this.VLAN = VLAN; + } + + } + + /** + * The upper limit of active redo log instances was reached. + */ + public static class NoMoreRedoLogsAllowed extends XenAPIException { + + /** + * Create a new NoMoreRedoLogsAllowed + */ + public NoMoreRedoLogsAllowed() { + super("The upper limit of active redo log instances was reached."); + } + + } + + /** + * A PBD already exists connecting the SR to the host + */ + public static class PbdExists extends XenAPIException { + public final String sr; + public final String host; + public final String pbd; + + /** + * Create a new PbdExists + * + * @param sr + * @param host + * @param pbd + */ + public PbdExists(String sr, String host, String pbd) { + super("A PBD already exists connecting the SR to the host"); + this.sr = sr; + this.host = host; + this.pbd = pbd; + } + + } + + /** + * The host failed to disable external authentication. + */ + public static class AuthDisableFailedPermissionDenied extends XenAPIException { + public final String message; + + /** + * Create a new AuthDisableFailedPermissionDenied + * + * @param message + */ + public AuthDisableFailedPermissionDenied(String message) { + super("The host failed to disable external authentication."); + this.message = message; + } + + } + + /** + * External authentication in this pool is already enabled for at least one host. + */ + public static class PoolAuthAlreadyEnabled extends XenAPIException { + public final String host; + + /** + * Create a new PoolAuthAlreadyEnabled + * + * @param host + */ + public PoolAuthAlreadyEnabled(String host) { + super("External authentication in this pool is already enabled for at least one host."); + this.host = host; + } + + } + + /** + * There were no hosts available to complete the specified operation. + */ + public static class NoHostsAvailable extends XenAPIException { + + /** + * Create a new NoHostsAvailable + */ + public NoHostsAvailable() { + super("There were no hosts available to complete the specified operation."); + } + + } + + /** + * The SR.shared flag cannot be set to false while the SR remains connected to multiple hosts + */ + public static class SrHasMultiplePbds extends XenAPIException { + public final String PBD; + + /** + * Create a new SrHasMultiplePbds + * + * @param PBD + */ + public SrHasMultiplePbds(String PBD) { + super("The SR.shared flag cannot be set to false while the SR remains connected to multiple hosts"); + this.PBD = PBD; + } + + } + + /** + * An attempt to prepare VSS writers for the snapshot failed + */ + public static class XenVssReqErrorPreparingWriters extends XenAPIException { + public final String vm; + public final String errorCode; + + /** + * Create a new XenVssReqErrorPreparingWriters + * + * @param vm + * @param errorCode + */ + public XenVssReqErrorPreparingWriters(String vm, String errorCode) { + super("An attempt to prepare VSS writers for the snapshot failed"); + this.vm = vm; + this.errorCode = errorCode; + } + + } + + /** + * There was a failure communicating with the plugin. + */ + public static class XenapiPluginFailure extends XenAPIException { + public final String status; + public final String stdout; + public final String stderr; + + /** + * Create a new XenapiPluginFailure + * + * @param status + * @param stdout + * @param stderr + */ + public XenapiPluginFailure(String status, String stdout, String stderr) { + super("There was a failure communicating with the plugin."); + this.status = status; + this.stdout = stdout; + this.stderr = stderr; + } + + } + + /** + * This PIF is a bond slave and cannot have a tunnel on it. + */ + public static class CannotAddTunnelToBondSlave extends XenAPIException { + public final String PIF; + + /** + * Create a new CannotAddTunnelToBondSlave + * + * @param PIF + */ + public CannotAddTunnelToBondSlave(String PIF) { + super("This PIF is a bond slave and cannot have a tunnel on it."); + this.PIF = PIF; + } + + } + + /** + * This operation cannot be completed as the host power on mode is disabled. + */ + public static class HostPowerOnModeDisabled extends XenAPIException { + + /** + * Create a new HostPowerOnModeDisabled + */ + public HostPowerOnModeDisabled() { + super("This operation cannot be completed as the host power on mode is disabled."); + } + + } + + /** + * The specified VBD device is not recognized: please use a non-negative integer + */ + public static class IllegalVbdDevice extends XenAPIException { + public final String vbd; + public final String device; + + /** + * Create a new IllegalVbdDevice + * + * @param vbd + * @param device + */ + public IllegalVbdDevice(String vbd, String device) { + super("The specified VBD device is not recognized: please use a non-negative integer"); + this.vbd = vbd; + this.device = device; + } + + } + + /** + * You attempted to run a VM on a host on which the vGPU required by the VM cannot be allocated on any pGPUs in the GPU_group needed by the VM. + */ + public static class VmRequiresVgpu extends XenAPIException { + public final String vm; + public final String GPUGroup; + public final String vGPUType; + + /** + * Create a new VmRequiresVgpu + * + * @param vm + * @param GPUGroup + * @param vGPUType + */ + public VmRequiresVgpu(String vm, String GPUGroup, String vGPUType) { + super("You attempted to run a VM on a host on which the vGPU required by the VM cannot be allocated on any pGPUs in the GPU_group needed by the VM."); + this.vm = vm; + this.GPUGroup = GPUGroup; + this.vGPUType = vGPUType; + } + + } + + /** + * The uploaded patch file is invalid. See attached log for more details. + */ + public static class InvalidPatchWithLog extends XenAPIException { + public final String log; + + /** + * Create a new InvalidPatchWithLog + * + * @param log + */ + public InvalidPatchWithLog(String log) { + super("The uploaded patch file is invalid. See attached log for more details."); + this.log = log; + } + + } + + /** + * You tried to create a VLAN on top of another VLAN - use the underlying physical PIF/bond instead + */ + public static class PifIsVlan extends XenAPIException { + public final String PIF; + + /** + * Create a new PifIsVlan + * + * @param PIF + */ + public PifIsVlan(String PIF) { + super("You tried to create a VLAN on top of another VLAN - use the underlying physical PIF/bond instead"); + this.PIF = PIF; + } + + } + + /** + * This operation cannot be performed because creating or deleting a bond involving the management interface is not allowed while HA is on. In order to do that, disable HA, create or delete the bond then re-enable HA. + */ + public static class HaCannotChangeBondStatusOfMgmtIface extends XenAPIException { + + /** + * Create a new HaCannotChangeBondStatusOfMgmtIface + */ + public HaCannotChangeBondStatusOfMgmtIface() { + super("This operation cannot be performed because creating or deleting a bond involving the management interface is not allowed while HA is on. In order to do that, disable HA, create or delete the bond then re-enable HA."); + } + + } + + /** + * The given VM is not registered as a system domain. This operation can only be performed on a registered system domain. + */ + public static class NotSystemDomain extends XenAPIException { + public final String vm; + + /** + * Create a new NotSystemDomain + * + * @param vm + */ + public NotSystemDomain(String vm) { + super("The given VM is not registered as a system domain. This operation can only be performed on a registered system domain."); + this.vm = vm; + } + + } + + /** + * The operation could not be performed because the HA software is not installed on this host. + */ + public static class HaNotInstalled extends XenAPIException { + public final String host; + + /** + * Create a new HaNotInstalled + * + * @param host + */ + public HaNotInstalled(String host) { + super("The operation could not be performed because the HA software is not installed on this host."); + this.host = host; + } + + } + + public static String toString(Object object) { if (object == null) { return null; } - return (String)object; + return (String) object; } public static Long toLong(Object object) { if (object == null) { return null; } - return Long.valueOf((String)object); + return Long.valueOf((String) object); } public static Double toDouble(Object object) { if (object == null) { return null; } - return (Double)object; + return (Double) object; } public static Boolean toBoolean(Object object) { if (object == null) { return null; } - return (Boolean)object; + return (Boolean) object; } public static Date toDate(Object object) { @@ -9946,11 +10005,11 @@ public class Types return null; } try { - return (Date)object; - } catch (ClassCastException e) { - //Occasionally the date comes back as an ocaml float rather than - //in the xmlrpc format! Catch this and convert. - return (new Date((long)(1000 * Double.parseDouble((String)object)))); + return (Date) object; + } catch (ClassCastException e){ + //Occasionally the date comes back as an ocaml float rather than + //in the xmlrpc format! Catch this and convert. + return (new Date((long) (1000*Double.parseDouble((String) object)))); } } @@ -9959,7 +10018,7 @@ public class Types return null; } try { - return XenAPIObjects.valueOf(((String)object).toUpperCase().replace('-', '_')); + return XenAPIObjects.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return XenAPIObjects.UNRECOGNIZED; } @@ -9970,18 +10029,29 @@ public class Types return null; } try { - return AfterApplyGuidance.valueOf(((String)object).toUpperCase().replace('-', '_')); + return AfterApplyGuidance.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return AfterApplyGuidance.UNRECOGNIZED; } } + public static Types.AllocationAlgorithm toAllocationAlgorithm(Object object) { + if (object == null) { + return null; + } + try { + return AllocationAlgorithm.valueOf(((String) object).toUpperCase().replace('-','_')); + } catch (IllegalArgumentException ex) { + return AllocationAlgorithm.UNRECOGNIZED; + } + } + public static Types.BondMode toBondMode(Object object) { if (object == null) { return null; } try { - return BondMode.valueOf(((String)object).toUpperCase().replace('-', '_')); + return BondMode.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return BondMode.UNRECOGNIZED; } @@ -9992,7 +10062,7 @@ public class Types return null; } try { - return Cls.valueOf(((String)object).toUpperCase().replace('-', '_')); + return Cls.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return Cls.UNRECOGNIZED; } @@ -10003,7 +10073,7 @@ public class Types return null; } try { - return ConsoleProtocol.valueOf(((String)object).toUpperCase().replace('-', '_')); + return ConsoleProtocol.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return ConsoleProtocol.UNRECOGNIZED; } @@ -10014,7 +10084,7 @@ public class Types return null; } try { - return EventOperation.valueOf(((String)object).toUpperCase().replace('-', '_')); + return EventOperation.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return EventOperation.UNRECOGNIZED; } @@ -10025,7 +10095,7 @@ public class Types return null; } try { - return HostAllowedOperations.valueOf(((String)object).toUpperCase().replace('-', '_')); + return HostAllowedOperations.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return HostAllowedOperations.UNRECOGNIZED; } @@ -10036,7 +10106,7 @@ public class Types return null; } try { - return IpConfigurationMode.valueOf(((String)object).toUpperCase().replace('-', '_')); + return IpConfigurationMode.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return IpConfigurationMode.UNRECOGNIZED; } @@ -10047,7 +10117,7 @@ public class Types return null; } try { - return Ipv6ConfigurationMode.valueOf(((String)object).toUpperCase().replace('-', '_')); + return Ipv6ConfigurationMode.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return Ipv6ConfigurationMode.UNRECOGNIZED; } @@ -10058,7 +10128,7 @@ public class Types return null; } try { - return NetworkDefaultLockingMode.valueOf(((String)object).toUpperCase().replace('-', '_')); + return NetworkDefaultLockingMode.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return NetworkDefaultLockingMode.UNRECOGNIZED; } @@ -10069,7 +10139,7 @@ public class Types return null; } try { - return NetworkOperations.valueOf(((String)object).toUpperCase().replace('-', '_')); + return NetworkOperations.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return NetworkOperations.UNRECOGNIZED; } @@ -10080,7 +10150,7 @@ public class Types return null; } try { - return OnBoot.valueOf(((String)object).toUpperCase().replace('-', '_')); + return OnBoot.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return OnBoot.UNRECOGNIZED; } @@ -10091,7 +10161,7 @@ public class Types return null; } try { - return OnCrashBehaviour.valueOf(((String)object).toUpperCase().replace('-', '_')); + return OnCrashBehaviour.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return OnCrashBehaviour.UNRECOGNIZED; } @@ -10102,7 +10172,7 @@ public class Types return null; } try { - return OnNormalExit.valueOf(((String)object).toUpperCase().replace('-', '_')); + return OnNormalExit.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return OnNormalExit.UNRECOGNIZED; } @@ -10113,7 +10183,7 @@ public class Types return null; } try { - return PrimaryAddressType.valueOf(((String)object).toUpperCase().replace('-', '_')); + return PrimaryAddressType.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return PrimaryAddressType.UNRECOGNIZED; } @@ -10124,7 +10194,7 @@ public class Types return null; } try { - return StorageOperations.valueOf(((String)object).toUpperCase().replace('-', '_')); + return StorageOperations.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return StorageOperations.UNRECOGNIZED; } @@ -10135,7 +10205,7 @@ public class Types return null; } try { - return TaskAllowedOperations.valueOf(((String)object).toUpperCase().replace('-', '_')); + return TaskAllowedOperations.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return TaskAllowedOperations.UNRECOGNIZED; } @@ -10146,7 +10216,7 @@ public class Types return null; } try { - return TaskStatusType.valueOf(((String)object).toUpperCase().replace('-', '_')); + return TaskStatusType.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return TaskStatusType.UNRECOGNIZED; } @@ -10157,7 +10227,7 @@ public class Types return null; } try { - return VbdMode.valueOf(((String)object).toUpperCase().replace('-', '_')); + return VbdMode.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return VbdMode.UNRECOGNIZED; } @@ -10168,7 +10238,7 @@ public class Types return null; } try { - return VbdOperations.valueOf(((String)object).toUpperCase().replace('-', '_')); + return VbdOperations.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return VbdOperations.UNRECOGNIZED; } @@ -10179,7 +10249,7 @@ public class Types return null; } try { - return VbdType.valueOf(((String)object).toUpperCase().replace('-', '_')); + return VbdType.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return VbdType.UNRECOGNIZED; } @@ -10190,7 +10260,7 @@ public class Types return null; } try { - return VdiOperations.valueOf(((String)object).toUpperCase().replace('-', '_')); + return VdiOperations.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return VdiOperations.UNRECOGNIZED; } @@ -10201,7 +10271,7 @@ public class Types return null; } try { - return VdiType.valueOf(((String)object).toUpperCase().replace('-', '_')); + return VdiType.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return VdiType.UNRECOGNIZED; } @@ -10212,7 +10282,7 @@ public class Types return null; } try { - return VifLockingMode.valueOf(((String)object).toUpperCase().replace('-', '_')); + return VifLockingMode.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return VifLockingMode.UNRECOGNIZED; } @@ -10223,7 +10293,7 @@ public class Types return null; } try { - return VifOperations.valueOf(((String)object).toUpperCase().replace('-', '_')); + return VifOperations.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return VifOperations.UNRECOGNIZED; } @@ -10234,7 +10304,7 @@ public class Types return null; } try { - return VmApplianceOperation.valueOf(((String)object).toUpperCase().replace('-', '_')); + return VmApplianceOperation.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return VmApplianceOperation.UNRECOGNIZED; } @@ -10245,7 +10315,7 @@ public class Types return null; } try { - return VmOperations.valueOf(((String)object).toUpperCase().replace('-', '_')); + return VmOperations.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return VmOperations.UNRECOGNIZED; } @@ -10256,7 +10326,7 @@ public class Types return null; } try { - return VmPowerState.valueOf(((String)object).toUpperCase().replace('-', '_')); + return VmPowerState.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return VmPowerState.UNRECOGNIZED; } @@ -10267,7 +10337,7 @@ public class Types return null; } try { - return VmppArchiveFrequency.valueOf(((String)object).toUpperCase().replace('-', '_')); + return VmppArchiveFrequency.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return VmppArchiveFrequency.UNRECOGNIZED; } @@ -10278,7 +10348,7 @@ public class Types return null; } try { - return VmppArchiveTargetType.valueOf(((String)object).toUpperCase().replace('-', '_')); + return VmppArchiveTargetType.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return VmppArchiveTargetType.UNRECOGNIZED; } @@ -10289,7 +10359,7 @@ public class Types return null; } try { - return VmppBackupFrequency.valueOf(((String)object).toUpperCase().replace('-', '_')); + return VmppBackupFrequency.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return VmppBackupFrequency.UNRECOGNIZED; } @@ -10300,7 +10370,7 @@ public class Types return null; } try { - return VmppBackupType.valueOf(((String)object).toUpperCase().replace('-', '_')); + return VmppBackupType.valueOf(((String) object).toUpperCase().replace('-','_')); } catch (IllegalArgumentException ex) { return VmppBackupType.UNRECOGNIZED; } @@ -10310,9 +10380,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { String typed = toString(item); result.add(typed); } @@ -10323,9 +10393,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { Types.AfterApplyGuidance typed = toAfterApplyGuidance(item); result.add(typed); } @@ -10336,9 +10406,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { Types.HostAllowedOperations typed = toHostAllowedOperations(item); result.add(typed); } @@ -10349,9 +10419,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { Types.NetworkOperations typed = toNetworkOperations(item); result.add(typed); } @@ -10362,9 +10432,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { Types.StorageOperations typed = toStorageOperations(item); result.add(typed); } @@ -10375,9 +10445,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { Types.TaskAllowedOperations typed = toTaskAllowedOperations(item); result.add(typed); } @@ -10388,9 +10458,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { Types.VbdOperations typed = toVbdOperations(item); result.add(typed); } @@ -10401,9 +10471,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { Types.VdiOperations typed = toVdiOperations(item); result.add(typed); } @@ -10414,9 +10484,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { Types.VifOperations typed = toVifOperations(item); result.add(typed); } @@ -10427,9 +10497,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { Types.VmApplianceOperation typed = toVmApplianceOperation(item); result.add(typed); } @@ -10440,9 +10510,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { Types.VmOperations typed = toVmOperations(item); result.add(typed); } @@ -10453,9 +10523,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { Bond typed = toBond(item); result.add(typed); } @@ -10466,9 +10536,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { DRTask typed = toDRTask(item); result.add(typed); } @@ -10479,9 +10549,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { GPUGroup typed = toGPUGroup(item); result.add(typed); } @@ -10492,9 +10562,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { PBD typed = toPBD(item); result.add(typed); } @@ -10505,9 +10575,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { PCI typed = toPCI(item); result.add(typed); } @@ -10518,9 +10588,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { PGPU typed = toPGPU(item); result.add(typed); } @@ -10531,9 +10601,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { PIF typed = toPIF(item); result.add(typed); } @@ -10544,9 +10614,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { PIFMetrics typed = toPIFMetrics(item); result.add(typed); } @@ -10557,9 +10627,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { SM typed = toSM(item); result.add(typed); } @@ -10570,9 +10640,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { SR typed = toSR(item); result.add(typed); } @@ -10583,9 +10653,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { VBD typed = toVBD(item); result.add(typed); } @@ -10596,9 +10666,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { VBDMetrics typed = toVBDMetrics(item); result.add(typed); } @@ -10609,9 +10679,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { VDI typed = toVDI(item); result.add(typed); } @@ -10622,22 +10692,35 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { VGPU typed = toVGPU(item); result.add(typed); } return result; } + public static Set toSetOfVGPUType(Object object) { + if (object == null) { + return null; + } + Object[] items = (Object[]) object; + Set result = new LinkedHashSet(); + for(Object item: items) { + VGPUType typed = toVGPUType(item); + result.add(typed); + } + return result; + } + public static Set toSetOfVIF(Object object) { if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { VIF typed = toVIF(item); result.add(typed); } @@ -10648,9 +10731,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { VIFMetrics typed = toVIFMetrics(item); result.add(typed); } @@ -10661,9 +10744,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { VLAN typed = toVLAN(item); result.add(typed); } @@ -10674,9 +10757,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { VM typed = toVM(item); result.add(typed); } @@ -10687,9 +10770,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { VMPP typed = toVMPP(item); result.add(typed); } @@ -10700,9 +10783,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { VMAppliance typed = toVMAppliance(item); result.add(typed); } @@ -10713,9 +10796,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { VMGuestMetrics typed = toVMGuestMetrics(item); result.add(typed); } @@ -10726,9 +10809,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { VMMetrics typed = toVMMetrics(item); result.add(typed); } @@ -10739,9 +10822,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { VTPM typed = toVTPM(item); result.add(typed); } @@ -10752,9 +10835,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { Blob typed = toBlob(item); result.add(typed); } @@ -10765,9 +10848,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { Console typed = toConsole(item); result.add(typed); } @@ -10778,9 +10861,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { Crashdump typed = toCrashdump(item); result.add(typed); } @@ -10791,9 +10874,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { Host typed = toHost(item); result.add(typed); } @@ -10804,9 +10887,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { HostCpu typed = toHostCpu(item); result.add(typed); } @@ -10817,9 +10900,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { HostCrashdump typed = toHostCrashdump(item); result.add(typed); } @@ -10830,9 +10913,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { HostMetrics typed = toHostMetrics(item); result.add(typed); } @@ -10843,9 +10926,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { HostPatch typed = toHostPatch(item); result.add(typed); } @@ -10856,9 +10939,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { Message typed = toMessage(item); result.add(typed); } @@ -10869,9 +10952,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { Network typed = toNetwork(item); result.add(typed); } @@ -10882,9 +10965,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { Pool typed = toPool(item); result.add(typed); } @@ -10895,9 +10978,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { PoolPatch typed = toPoolPatch(item); result.add(typed); } @@ -10908,9 +10991,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { Role typed = toRole(item); result.add(typed); } @@ -10921,9 +11004,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { Secret typed = toSecret(item); result.add(typed); } @@ -10934,9 +11017,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { Subject typed = toSubject(item); result.add(typed); } @@ -10947,9 +11030,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { Task typed = toTask(item); result.add(typed); } @@ -10960,9 +11043,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { Tunnel typed = toTunnel(item); result.add(typed); } @@ -10973,9 +11056,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { DataSource.Record typed = toDataSourceRecord(item); result.add(typed); } @@ -10986,9 +11069,9 @@ public class Types if (object == null) { return null; } - Object[] items = (Object[])object; + Object[] items = (Object[]) object; Set result = new LinkedHashSet(); - for (Object item : items) { + for(Object item: items) { Event.Record typed = toEventRecord(item); result.add(typed); } @@ -10999,10 +11082,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { String key = toString(entry.getKey()); String value = toString(entry.getValue()); result.put(key, value); @@ -11010,14 +11093,29 @@ public class Types return result; } + public static Map toMapOfStringLong(Object object) { + if (object == null) { + return null; + } + Map map = (Map) object; + Map result = new HashMap(); + Set entries = map.entrySet(); + for(Map.Entry entry: entries) { + String key = toString(entry.getKey()); + Long value = toLong(entry.getValue()); + result.put(key, value); + } + return result; + } + public static Map toMapOfStringHostAllowedOperations(Object object) { if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { String key = toString(entry.getKey()); Types.HostAllowedOperations value = toHostAllowedOperations(entry.getValue()); result.put(key, value); @@ -11029,10 +11127,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { String key = toString(entry.getKey()); Types.NetworkOperations value = toNetworkOperations(entry.getValue()); result.put(key, value); @@ -11044,10 +11142,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { String key = toString(entry.getKey()); Types.StorageOperations value = toStorageOperations(entry.getValue()); result.put(key, value); @@ -11059,10 +11157,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { String key = toString(entry.getKey()); Types.TaskAllowedOperations value = toTaskAllowedOperations(entry.getValue()); result.put(key, value); @@ -11074,10 +11172,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { String key = toString(entry.getKey()); Types.VbdOperations value = toVbdOperations(entry.getValue()); result.put(key, value); @@ -11089,10 +11187,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { String key = toString(entry.getKey()); Types.VdiOperations value = toVdiOperations(entry.getValue()); result.put(key, value); @@ -11104,10 +11202,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { String key = toString(entry.getKey()); Types.VifOperations value = toVifOperations(entry.getValue()); result.put(key, value); @@ -11119,10 +11217,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { String key = toString(entry.getKey()); Types.VmApplianceOperation value = toVmApplianceOperation(entry.getValue()); result.put(key, value); @@ -11134,10 +11232,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { String key = toString(entry.getKey()); Types.VmOperations value = toVmOperations(entry.getValue()); result.put(key, value); @@ -11149,10 +11247,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { String key = toString(entry.getKey()); Blob value = toBlob(entry.getValue()); result.put(key, value); @@ -11164,10 +11262,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { Long key = toLong(entry.getKey()); Long value = toLong(entry.getValue()); result.put(key, value); @@ -11179,10 +11277,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { Long key = toLong(entry.getKey()); Double value = toDouble(entry.getValue()); result.put(key, value); @@ -11194,10 +11292,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map> result = new HashMap>(); + Map map = (Map) object; + Map> result = new HashMap>(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { Long key = toLong(entry.getKey()); Set value = toSetOfString(entry.getValue()); result.put(key, value); @@ -11209,10 +11307,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { Types.VmOperations key = toVmOperations(entry.getKey()); String value = toString(entry.getValue()); result.put(key, value); @@ -11224,10 +11322,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { Bond key = toBond(entry.getKey()); Bond.Record value = toBondRecord(entry.getValue()); result.put(key, value); @@ -11239,10 +11337,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { DRTask key = toDRTask(entry.getKey()); DRTask.Record value = toDRTaskRecord(entry.getValue()); result.put(key, value); @@ -11254,10 +11352,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { GPUGroup key = toGPUGroup(entry.getKey()); GPUGroup.Record value = toGPUGroupRecord(entry.getValue()); result.put(key, value); @@ -11269,10 +11367,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { PBD key = toPBD(entry.getKey()); PBD.Record value = toPBDRecord(entry.getValue()); result.put(key, value); @@ -11284,10 +11382,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { PCI key = toPCI(entry.getKey()); PCI.Record value = toPCIRecord(entry.getValue()); result.put(key, value); @@ -11299,10 +11397,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { PGPU key = toPGPU(entry.getKey()); PGPU.Record value = toPGPURecord(entry.getValue()); result.put(key, value); @@ -11314,10 +11412,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { PIF key = toPIF(entry.getKey()); PIF.Record value = toPIFRecord(entry.getValue()); result.put(key, value); @@ -11329,10 +11427,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { PIFMetrics key = toPIFMetrics(entry.getKey()); PIFMetrics.Record value = toPIFMetricsRecord(entry.getValue()); result.put(key, value); @@ -11344,10 +11442,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { SM key = toSM(entry.getKey()); SM.Record value = toSMRecord(entry.getValue()); result.put(key, value); @@ -11359,10 +11457,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { SR key = toSR(entry.getKey()); SR.Record value = toSRRecord(entry.getValue()); result.put(key, value); @@ -11374,10 +11472,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { VBD key = toVBD(entry.getKey()); VBD.Record value = toVBDRecord(entry.getValue()); result.put(key, value); @@ -11389,10 +11487,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { VBDMetrics key = toVBDMetrics(entry.getKey()); VBDMetrics.Record value = toVBDMetricsRecord(entry.getValue()); result.put(key, value); @@ -11404,10 +11502,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { VDI key = toVDI(entry.getKey()); SR value = toSR(entry.getValue()); result.put(key, value); @@ -11419,10 +11517,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { VDI key = toVDI(entry.getKey()); VDI.Record value = toVDIRecord(entry.getValue()); result.put(key, value); @@ -11434,10 +11532,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { VGPU key = toVGPU(entry.getKey()); VGPU.Record value = toVGPURecord(entry.getValue()); result.put(key, value); @@ -11445,14 +11543,44 @@ public class Types return result; } + public static Map toMapOfVGPUTypeLong(Object object) { + if (object == null) { + return null; + } + Map map = (Map) object; + Map result = new HashMap(); + Set entries = map.entrySet(); + for(Map.Entry entry: entries) { + VGPUType key = toVGPUType(entry.getKey()); + Long value = toLong(entry.getValue()); + result.put(key, value); + } + return result; + } + + public static Map toMapOfVGPUTypeVGPUTypeRecord(Object object) { + if (object == null) { + return null; + } + Map map = (Map) object; + Map result = new HashMap(); + Set entries = map.entrySet(); + for(Map.Entry entry: entries) { + VGPUType key = toVGPUType(entry.getKey()); + VGPUType.Record value = toVGPUTypeRecord(entry.getValue()); + result.put(key, value); + } + return result; + } + public static Map toMapOfVIFNetwork(Object object) { if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { VIF key = toVIF(entry.getKey()); Network value = toNetwork(entry.getValue()); result.put(key, value); @@ -11464,10 +11592,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { VIF key = toVIF(entry.getKey()); VIF.Record value = toVIFRecord(entry.getValue()); result.put(key, value); @@ -11479,10 +11607,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { VIFMetrics key = toVIFMetrics(entry.getKey()); VIFMetrics.Record value = toVIFMetricsRecord(entry.getValue()); result.put(key, value); @@ -11494,10 +11622,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { VLAN key = toVLAN(entry.getKey()); VLAN.Record value = toVLANRecord(entry.getValue()); result.put(key, value); @@ -11509,10 +11637,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { VM key = toVM(entry.getKey()); String value = toString(entry.getValue()); result.put(key, value); @@ -11524,10 +11652,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map> result = new HashMap>(); + Map map = (Map) object; + Map> result = new HashMap>(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { VM key = toVM(entry.getKey()); Set value = toSetOfString(entry.getValue()); result.put(key, value); @@ -11539,10 +11667,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map> result = new HashMap>(); + Map map = (Map) object; + Map> result = new HashMap>(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { VM key = toVM(entry.getKey()); Map value = toMapOfStringString(entry.getValue()); result.put(key, value); @@ -11554,10 +11682,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { VM key = toVM(entry.getKey()); VM.Record value = toVMRecord(entry.getValue()); result.put(key, value); @@ -11569,10 +11697,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { VMPP key = toVMPP(entry.getKey()); VMPP.Record value = toVMPPRecord(entry.getValue()); result.put(key, value); @@ -11584,10 +11712,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { VMAppliance key = toVMAppliance(entry.getKey()); VMAppliance.Record value = toVMApplianceRecord(entry.getValue()); result.put(key, value); @@ -11599,10 +11727,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { VMGuestMetrics key = toVMGuestMetrics(entry.getKey()); VMGuestMetrics.Record value = toVMGuestMetricsRecord(entry.getValue()); result.put(key, value); @@ -11614,10 +11742,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { VMMetrics key = toVMMetrics(entry.getKey()); VMMetrics.Record value = toVMMetricsRecord(entry.getValue()); result.put(key, value); @@ -11629,10 +11757,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { Blob key = toBlob(entry.getKey()); Blob.Record value = toBlobRecord(entry.getValue()); result.put(key, value); @@ -11644,10 +11772,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { Console key = toConsole(entry.getKey()); Console.Record value = toConsoleRecord(entry.getValue()); result.put(key, value); @@ -11659,10 +11787,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { Crashdump key = toCrashdump(entry.getKey()); Crashdump.Record value = toCrashdumpRecord(entry.getValue()); result.put(key, value); @@ -11674,10 +11802,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map> result = new HashMap>(); + Map map = (Map) object; + Map> result = new HashMap>(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { Host key = toHost(entry.getKey()); Set value = toSetOfString(entry.getValue()); result.put(key, value); @@ -11689,10 +11817,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { Host key = toHost(entry.getKey()); Host.Record value = toHostRecord(entry.getValue()); result.put(key, value); @@ -11704,10 +11832,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { HostCpu key = toHostCpu(entry.getKey()); HostCpu.Record value = toHostCpuRecord(entry.getValue()); result.put(key, value); @@ -11719,10 +11847,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { HostCrashdump key = toHostCrashdump(entry.getKey()); HostCrashdump.Record value = toHostCrashdumpRecord(entry.getValue()); result.put(key, value); @@ -11734,10 +11862,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { HostMetrics key = toHostMetrics(entry.getKey()); HostMetrics.Record value = toHostMetricsRecord(entry.getValue()); result.put(key, value); @@ -11749,10 +11877,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { HostPatch key = toHostPatch(entry.getKey()); HostPatch.Record value = toHostPatchRecord(entry.getValue()); result.put(key, value); @@ -11764,10 +11892,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { Message key = toMessage(entry.getKey()); Message.Record value = toMessageRecord(entry.getValue()); result.put(key, value); @@ -11779,10 +11907,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { Network key = toNetwork(entry.getKey()); Network.Record value = toNetworkRecord(entry.getValue()); result.put(key, value); @@ -11794,10 +11922,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { Pool key = toPool(entry.getKey()); Pool.Record value = toPoolRecord(entry.getValue()); result.put(key, value); @@ -11809,10 +11937,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { PoolPatch key = toPoolPatch(entry.getKey()); PoolPatch.Record value = toPoolPatchRecord(entry.getValue()); result.put(key, value); @@ -11824,10 +11952,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { Role key = toRole(entry.getKey()); Role.Record value = toRoleRecord(entry.getValue()); result.put(key, value); @@ -11839,10 +11967,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { Secret key = toSecret(entry.getKey()); Secret.Record value = toSecretRecord(entry.getValue()); result.put(key, value); @@ -11854,10 +11982,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { Subject key = toSubject(entry.getKey()); Subject.Record value = toSubjectRecord(entry.getValue()); result.put(key, value); @@ -11869,10 +11997,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { Task key = toTask(entry.getKey()); Task.Record value = toTaskRecord(entry.getValue()); result.put(key, value); @@ -11884,10 +12012,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; - Map result = new HashMap(); + Map map = (Map) object; + Map result = new HashMap(); Set entries = map.entrySet(); - for (Map.Entry entry : entries) { + for(Map.Entry entry: entries) { Tunnel key = toTunnel(entry.getKey()); Tunnel.Record value = toTunnelRecord(entry.getValue()); result.put(key, value); @@ -11899,310 +12027,317 @@ public class Types if (object == null) { return null; } - return new Bond((String)object); + return new Bond((String) object); } public static DRTask toDRTask(Object object) { if (object == null) { return null; } - return new DRTask((String)object); + return new DRTask((String) object); } public static GPUGroup toGPUGroup(Object object) { if (object == null) { return null; } - return new GPUGroup((String)object); + return new GPUGroup((String) object); } public static PBD toPBD(Object object) { if (object == null) { return null; } - return new PBD((String)object); + return new PBD((String) object); } public static PCI toPCI(Object object) { if (object == null) { return null; } - return new PCI((String)object); + return new PCI((String) object); } public static PGPU toPGPU(Object object) { if (object == null) { return null; } - return new PGPU((String)object); + return new PGPU((String) object); } public static PIF toPIF(Object object) { if (object == null) { return null; } - return new PIF((String)object); + return new PIF((String) object); } public static PIFMetrics toPIFMetrics(Object object) { if (object == null) { return null; } - return new PIFMetrics((String)object); + return new PIFMetrics((String) object); } public static SM toSM(Object object) { if (object == null) { return null; } - return new SM((String)object); + return new SM((String) object); } public static SR toSR(Object object) { if (object == null) { return null; } - return new SR((String)object); + return new SR((String) object); } public static VBD toVBD(Object object) { if (object == null) { return null; } - return new VBD((String)object); + return new VBD((String) object); } public static VBDMetrics toVBDMetrics(Object object) { if (object == null) { return null; } - return new VBDMetrics((String)object); + return new VBDMetrics((String) object); } public static VDI toVDI(Object object) { if (object == null) { return null; } - return new VDI((String)object); + return new VDI((String) object); } public static VGPU toVGPU(Object object) { if (object == null) { return null; } - return new VGPU((String)object); + return new VGPU((String) object); + } + + public static VGPUType toVGPUType(Object object) { + if (object == null) { + return null; + } + return new VGPUType((String) object); } public static VIF toVIF(Object object) { if (object == null) { return null; } - return new VIF((String)object); + return new VIF((String) object); } public static VIFMetrics toVIFMetrics(Object object) { if (object == null) { return null; } - return new VIFMetrics((String)object); + return new VIFMetrics((String) object); } public static VLAN toVLAN(Object object) { if (object == null) { return null; } - return new VLAN((String)object); + return new VLAN((String) object); } public static VM toVM(Object object) { if (object == null) { return null; } - return new VM((String)object); + return new VM((String) object); } public static VMPP toVMPP(Object object) { if (object == null) { return null; } - return new VMPP((String)object); + return new VMPP((String) object); } public static VMAppliance toVMAppliance(Object object) { if (object == null) { return null; } - return new VMAppliance((String)object); + return new VMAppliance((String) object); } public static VMGuestMetrics toVMGuestMetrics(Object object) { if (object == null) { return null; } - return new VMGuestMetrics((String)object); + return new VMGuestMetrics((String) object); } public static VMMetrics toVMMetrics(Object object) { if (object == null) { return null; } - return new VMMetrics((String)object); + return new VMMetrics((String) object); } public static VTPM toVTPM(Object object) { if (object == null) { return null; } - return new VTPM((String)object); + return new VTPM((String) object); } public static Blob toBlob(Object object) { if (object == null) { return null; } - return new Blob((String)object); + return new Blob((String) object); } public static Console toConsole(Object object) { if (object == null) { return null; } - return new Console((String)object); + return new Console((String) object); } public static Crashdump toCrashdump(Object object) { if (object == null) { return null; } - return new Crashdump((String)object); + return new Crashdump((String) object); } public static Host toHost(Object object) { if (object == null) { return null; } - return new Host((String)object); + return new Host((String) object); } public static HostCpu toHostCpu(Object object) { if (object == null) { return null; } - return new HostCpu((String)object); + return new HostCpu((String) object); } public static HostCrashdump toHostCrashdump(Object object) { if (object == null) { return null; } - return new HostCrashdump((String)object); + return new HostCrashdump((String) object); } public static HostMetrics toHostMetrics(Object object) { if (object == null) { return null; } - return new HostMetrics((String)object); + return new HostMetrics((String) object); } public static HostPatch toHostPatch(Object object) { if (object == null) { return null; } - return new HostPatch((String)object); + return new HostPatch((String) object); } public static Message toMessage(Object object) { if (object == null) { return null; } - return new Message((String)object); + return new Message((String) object); } public static Network toNetwork(Object object) { if (object == null) { return null; } - return new Network((String)object); + return new Network((String) object); } public static Pool toPool(Object object) { if (object == null) { return null; } - return new Pool((String)object); + return new Pool((String) object); } public static PoolPatch toPoolPatch(Object object) { if (object == null) { return null; } - return new PoolPatch((String)object); + return new PoolPatch((String) object); } public static Role toRole(Object object) { if (object == null) { return null; } - return new Role((String)object); + return new Role((String) object); } public static Secret toSecret(Object object) { if (object == null) { return null; } - return new Secret((String)object); + return new Secret((String) object); } public static Session toSession(Object object) { if (object == null) { return null; } - return new Session((String)object); + return new Session((String) object); } public static Subject toSubject(Object object) { if (object == null) { return null; } - return new Subject((String)object); + return new Subject((String) object); } public static Task toTask(Object object) { if (object == null) { return null; } - return new Task((String)object); + return new Task((String) object); } public static Tunnel toTunnel(Object object) { if (object == null) { return null; } - return new Tunnel((String)object); + return new Tunnel((String) object); } public static User toUser(Object object) { if (object == null) { return null; } - return new User((String)object); + return new User((String) object); } public static Bond.Record toBondRecord(Object object) { if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; Bond.Record record = new Bond.Record(); - record.uuid = toString(map.get("uuid")); - record.master = toPIF(map.get("master")); - record.slaves = toSetOfPIF(map.get("slaves")); - record.otherConfig = toMapOfStringString(map.get("other_config")); - record.primarySlave = toPIF(map.get("primary_slave")); - record.mode = toBondMode(map.get("mode")); - record.properties = toMapOfStringString(map.get("properties")); - record.linksUp = toLong(map.get("links_up")); + record.uuid = toString(map.get("uuid")); + record.master = toPIF(map.get("master")); + record.slaves = toSetOfPIF(map.get("slaves")); + record.otherConfig = toMapOfStringString(map.get("other_config")); + record.primarySlave = toPIF(map.get("primary_slave")); + record.mode = toBondMode(map.get("mode")); + record.properties = toMapOfStringString(map.get("properties")); + record.linksUp = toLong(map.get("links_up")); return record; } @@ -12210,10 +12345,10 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; DRTask.Record record = new DRTask.Record(); - record.uuid = toString(map.get("uuid")); - record.introducedSRs = toSetOfSR(map.get("introduced_SRs")); + record.uuid = toString(map.get("uuid")); + record.introducedSRs = toSetOfSR(map.get("introduced_SRs")); return record; } @@ -12221,15 +12356,18 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; GPUGroup.Record record = new GPUGroup.Record(); - record.uuid = toString(map.get("uuid")); - record.nameLabel = toString(map.get("name_label")); - record.nameDescription = toString(map.get("name_description")); - record.PGPUs = toSetOfPGPU(map.get("PGPUs")); - record.VGPUs = toSetOfVGPU(map.get("VGPUs")); - record.GPUTypes = toSetOfString(map.get("GPU_types")); - record.otherConfig = toMapOfStringString(map.get("other_config")); + record.uuid = toString(map.get("uuid")); + record.nameLabel = toString(map.get("name_label")); + record.nameDescription = toString(map.get("name_description")); + record.PGPUs = toSetOfPGPU(map.get("PGPUs")); + record.VGPUs = toSetOfVGPU(map.get("VGPUs")); + record.GPUTypes = toSetOfString(map.get("GPU_types")); + record.otherConfig = toMapOfStringString(map.get("other_config")); + record.allocationAlgorithm = toAllocationAlgorithm(map.get("allocation_algorithm")); + record.supportedVGPUTypes = toSetOfVGPUType(map.get("supported_VGPU_types")); + record.enabledVGPUTypes = toSetOfVGPUType(map.get("enabled_VGPU_types")); return record; } @@ -12237,14 +12375,14 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; PBD.Record record = new PBD.Record(); - record.uuid = toString(map.get("uuid")); - record.host = toHost(map.get("host")); - record.SR = toSR(map.get("SR")); - record.deviceConfig = toMapOfStringString(map.get("device_config")); - record.currentlyAttached = toBoolean(map.get("currently_attached")); - record.otherConfig = toMapOfStringString(map.get("other_config")); + record.uuid = toString(map.get("uuid")); + record.host = toHost(map.get("host")); + record.SR = toSR(map.get("SR")); + record.deviceConfig = toMapOfStringString(map.get("device_config")); + record.currentlyAttached = toBoolean(map.get("currently_attached")); + record.otherConfig = toMapOfStringString(map.get("other_config")); return record; } @@ -12252,16 +12390,16 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; PCI.Record record = new PCI.Record(); - record.uuid = toString(map.get("uuid")); - record.clazzName = toString(map.get("class_name")); - record.vendorName = toString(map.get("vendor_name")); - record.deviceName = toString(map.get("device_name")); - record.host = toHost(map.get("host")); - record.pciId = toString(map.get("pci_id")); - record.dependencies = toSetOfPCI(map.get("dependencies")); - record.otherConfig = toMapOfStringString(map.get("other_config")); + record.uuid = toString(map.get("uuid")); + record.clazzName = toString(map.get("class_name")); + record.vendorName = toString(map.get("vendor_name")); + record.deviceName = toString(map.get("device_name")); + record.host = toHost(map.get("host")); + record.pciId = toString(map.get("pci_id")); + record.dependencies = toSetOfPCI(map.get("dependencies")); + record.otherConfig = toMapOfStringString(map.get("other_config")); return record; } @@ -12269,13 +12407,17 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; PGPU.Record record = new PGPU.Record(); - record.uuid = toString(map.get("uuid")); - record.PCI = toPCI(map.get("PCI")); - record.GPUGroup = toGPUGroup(map.get("GPU_group")); - record.host = toHost(map.get("host")); - record.otherConfig = toMapOfStringString(map.get("other_config")); + record.uuid = toString(map.get("uuid")); + record.PCI = toPCI(map.get("PCI")); + record.GPUGroup = toGPUGroup(map.get("GPU_group")); + record.host = toHost(map.get("host")); + record.otherConfig = toMapOfStringString(map.get("other_config")); + record.supportedVGPUTypes = toSetOfVGPUType(map.get("supported_VGPU_types")); + record.enabledVGPUTypes = toSetOfVGPUType(map.get("enabled_VGPU_types")); + record.residentVGPUs = toSetOfVGPU(map.get("resident_VGPUs")); + record.supportedVGPUMaxCapacities = toMapOfVGPUTypeLong(map.get("supported_VGPU_max_capacities")); return record; } @@ -12283,36 +12425,37 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; PIF.Record record = new PIF.Record(); - record.uuid = toString(map.get("uuid")); - record.device = toString(map.get("device")); - record.network = toNetwork(map.get("network")); - record.host = toHost(map.get("host")); - record.MAC = toString(map.get("MAC")); - record.MTU = toLong(map.get("MTU")); - record.VLAN = toLong(map.get("VLAN")); - record.metrics = toPIFMetrics(map.get("metrics")); - record.physical = toBoolean(map.get("physical")); - record.currentlyAttached = toBoolean(map.get("currently_attached")); - record.ipConfigurationMode = toIpConfigurationMode(map.get("ip_configuration_mode")); - record.IP = toString(map.get("IP")); - record.netmask = toString(map.get("netmask")); - record.gateway = toString(map.get("gateway")); - record.DNS = toString(map.get("DNS")); - record.bondSlaveOf = toBond(map.get("bond_slave_of")); - record.bondMasterOf = toSetOfBond(map.get("bond_master_of")); - record.VLANMasterOf = toVLAN(map.get("VLAN_master_of")); - record.VLANSlaveOf = toSetOfVLAN(map.get("VLAN_slave_of")); - record.management = toBoolean(map.get("management")); - record.otherConfig = toMapOfStringString(map.get("other_config")); - record.disallowUnplug = toBoolean(map.get("disallow_unplug")); - record.tunnelAccessPIFOf = toSetOfTunnel(map.get("tunnel_access_PIF_of")); - record.tunnelTransportPIFOf = toSetOfTunnel(map.get("tunnel_transport_PIF_of")); - record.ipv6ConfigurationMode = toIpv6ConfigurationMode(map.get("ipv6_configuration_mode")); - record.IPv6 = toSetOfString(map.get("IPv6")); - record.ipv6Gateway = toString(map.get("ipv6_gateway")); - record.primaryAddressType = toPrimaryAddressType(map.get("primary_address_type")); + record.uuid = toString(map.get("uuid")); + record.device = toString(map.get("device")); + record.network = toNetwork(map.get("network")); + record.host = toHost(map.get("host")); + record.MAC = toString(map.get("MAC")); + record.MTU = toLong(map.get("MTU")); + record.VLAN = toLong(map.get("VLAN")); + record.metrics = toPIFMetrics(map.get("metrics")); + record.physical = toBoolean(map.get("physical")); + record.currentlyAttached = toBoolean(map.get("currently_attached")); + record.ipConfigurationMode = toIpConfigurationMode(map.get("ip_configuration_mode")); + record.IP = toString(map.get("IP")); + record.netmask = toString(map.get("netmask")); + record.gateway = toString(map.get("gateway")); + record.DNS = toString(map.get("DNS")); + record.bondSlaveOf = toBond(map.get("bond_slave_of")); + record.bondMasterOf = toSetOfBond(map.get("bond_master_of")); + record.VLANMasterOf = toVLAN(map.get("VLAN_master_of")); + record.VLANSlaveOf = toSetOfVLAN(map.get("VLAN_slave_of")); + record.management = toBoolean(map.get("management")); + record.otherConfig = toMapOfStringString(map.get("other_config")); + record.disallowUnplug = toBoolean(map.get("disallow_unplug")); + record.tunnelAccessPIFOf = toSetOfTunnel(map.get("tunnel_access_PIF_of")); + record.tunnelTransportPIFOf = toSetOfTunnel(map.get("tunnel_transport_PIF_of")); + record.ipv6ConfigurationMode = toIpv6ConfigurationMode(map.get("ipv6_configuration_mode")); + record.IPv6 = toSetOfString(map.get("IPv6")); + record.ipv6Gateway = toString(map.get("ipv6_gateway")); + record.primaryAddressType = toPrimaryAddressType(map.get("primary_address_type")); + record.managed = toBoolean(map.get("managed")); return record; } @@ -12320,21 +12463,21 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; PIFMetrics.Record record = new PIFMetrics.Record(); - record.uuid = toString(map.get("uuid")); - record.ioReadKbs = toDouble(map.get("io_read_kbs")); - record.ioWriteKbs = toDouble(map.get("io_write_kbs")); - record.carrier = toBoolean(map.get("carrier")); - record.vendorId = toString(map.get("vendor_id")); - record.vendorName = toString(map.get("vendor_name")); - record.deviceId = toString(map.get("device_id")); - record.deviceName = toString(map.get("device_name")); - record.speed = toLong(map.get("speed")); - record.duplex = toBoolean(map.get("duplex")); - record.pciBusPath = toString(map.get("pci_bus_path")); - record.lastUpdated = toDate(map.get("last_updated")); - record.otherConfig = toMapOfStringString(map.get("other_config")); + record.uuid = toString(map.get("uuid")); + record.ioReadKbs = toDouble(map.get("io_read_kbs")); + record.ioWriteKbs = toDouble(map.get("io_write_kbs")); + record.carrier = toBoolean(map.get("carrier")); + record.vendorId = toString(map.get("vendor_id")); + record.vendorName = toString(map.get("vendor_name")); + record.deviceId = toString(map.get("device_id")); + record.deviceName = toString(map.get("device_name")); + record.speed = toLong(map.get("speed")); + record.duplex = toBoolean(map.get("duplex")); + record.pciBusPath = toString(map.get("pci_bus_path")); + record.lastUpdated = toDate(map.get("last_updated")); + record.otherConfig = toMapOfStringString(map.get("other_config")); return record; } @@ -12342,20 +12485,21 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; SM.Record record = new SM.Record(); - record.uuid = toString(map.get("uuid")); - record.nameLabel = toString(map.get("name_label")); - record.nameDescription = toString(map.get("name_description")); - record.type = toString(map.get("type")); - record.vendor = toString(map.get("vendor")); - record.copyright = toString(map.get("copyright")); - record.version = toString(map.get("version")); - record.requiredApiVersion = toString(map.get("required_api_version")); - record.configuration = toMapOfStringString(map.get("configuration")); - record.capabilities = toSetOfString(map.get("capabilities")); - record.otherConfig = toMapOfStringString(map.get("other_config")); - record.driverFilename = toString(map.get("driver_filename")); + record.uuid = toString(map.get("uuid")); + record.nameLabel = toString(map.get("name_label")); + record.nameDescription = toString(map.get("name_description")); + record.type = toString(map.get("type")); + record.vendor = toString(map.get("vendor")); + record.copyright = toString(map.get("copyright")); + record.version = toString(map.get("version")); + record.requiredApiVersion = toString(map.get("required_api_version")); + record.configuration = toMapOfStringString(map.get("configuration")); + record.capabilities = toSetOfString(map.get("capabilities")); + record.features = toMapOfStringLong(map.get("features")); + record.otherConfig = toMapOfStringString(map.get("other_config")); + record.driverFilename = toString(map.get("driver_filename")); return record; } @@ -12363,27 +12507,27 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; SR.Record record = new SR.Record(); - record.uuid = toString(map.get("uuid")); - record.nameLabel = toString(map.get("name_label")); - record.nameDescription = toString(map.get("name_description")); - record.allowedOperations = toSetOfStorageOperations(map.get("allowed_operations")); - record.currentOperations = toMapOfStringStorageOperations(map.get("current_operations")); - record.VDIs = toSetOfVDI(map.get("VDIs")); - record.PBDs = toSetOfPBD(map.get("PBDs")); - record.virtualAllocation = toLong(map.get("virtual_allocation")); - record.physicalUtilisation = toLong(map.get("physical_utilisation")); - record.physicalSize = toLong(map.get("physical_size")); - record.type = toString(map.get("type")); - record.contentType = toString(map.get("content_type")); - record.shared = toBoolean(map.get("shared")); - record.otherConfig = toMapOfStringString(map.get("other_config")); - record.tags = toSetOfString(map.get("tags")); - record.smConfig = toMapOfStringString(map.get("sm_config")); - record.blobs = toMapOfStringBlob(map.get("blobs")); - record.localCacheEnabled = toBoolean(map.get("local_cache_enabled")); - record.introducedBy = toDRTask(map.get("introduced_by")); + record.uuid = toString(map.get("uuid")); + record.nameLabel = toString(map.get("name_label")); + record.nameDescription = toString(map.get("name_description")); + record.allowedOperations = toSetOfStorageOperations(map.get("allowed_operations")); + record.currentOperations = toMapOfStringStorageOperations(map.get("current_operations")); + record.VDIs = toSetOfVDI(map.get("VDIs")); + record.PBDs = toSetOfPBD(map.get("PBDs")); + record.virtualAllocation = toLong(map.get("virtual_allocation")); + record.physicalUtilisation = toLong(map.get("physical_utilisation")); + record.physicalSize = toLong(map.get("physical_size")); + record.type = toString(map.get("type")); + record.contentType = toString(map.get("content_type")); + record.shared = toBoolean(map.get("shared")); + record.otherConfig = toMapOfStringString(map.get("other_config")); + record.tags = toSetOfString(map.get("tags")); + record.smConfig = toMapOfStringString(map.get("sm_config")); + record.blobs = toMapOfStringBlob(map.get("blobs")); + record.localCacheEnabled = toBoolean(map.get("local_cache_enabled")); + record.introducedBy = toDRTask(map.get("introduced_by")); return record; } @@ -12391,30 +12535,30 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; VBD.Record record = new VBD.Record(); - record.uuid = toString(map.get("uuid")); - record.allowedOperations = toSetOfVbdOperations(map.get("allowed_operations")); - record.currentOperations = toMapOfStringVbdOperations(map.get("current_operations")); - record.VM = toVM(map.get("VM")); - record.VDI = toVDI(map.get("VDI")); - record.device = toString(map.get("device")); - record.userdevice = toString(map.get("userdevice")); - record.bootable = toBoolean(map.get("bootable")); - record.mode = toVbdMode(map.get("mode")); - record.type = toVbdType(map.get("type")); - record.unpluggable = toBoolean(map.get("unpluggable")); - record.storageLock = toBoolean(map.get("storage_lock")); - record.empty = toBoolean(map.get("empty")); - record.otherConfig = toMapOfStringString(map.get("other_config")); - record.currentlyAttached = toBoolean(map.get("currently_attached")); - record.statusCode = toLong(map.get("status_code")); - record.statusDetail = toString(map.get("status_detail")); - record.runtimeProperties = toMapOfStringString(map.get("runtime_properties")); - record.qosAlgorithmType = toString(map.get("qos_algorithm_type")); - record.qosAlgorithmParams = toMapOfStringString(map.get("qos_algorithm_params")); - record.qosSupportedAlgorithms = toSetOfString(map.get("qos_supported_algorithms")); - record.metrics = toVBDMetrics(map.get("metrics")); + record.uuid = toString(map.get("uuid")); + record.allowedOperations = toSetOfVbdOperations(map.get("allowed_operations")); + record.currentOperations = toMapOfStringVbdOperations(map.get("current_operations")); + record.VM = toVM(map.get("VM")); + record.VDI = toVDI(map.get("VDI")); + record.device = toString(map.get("device")); + record.userdevice = toString(map.get("userdevice")); + record.bootable = toBoolean(map.get("bootable")); + record.mode = toVbdMode(map.get("mode")); + record.type = toVbdType(map.get("type")); + record.unpluggable = toBoolean(map.get("unpluggable")); + record.storageLock = toBoolean(map.get("storage_lock")); + record.empty = toBoolean(map.get("empty")); + record.otherConfig = toMapOfStringString(map.get("other_config")); + record.currentlyAttached = toBoolean(map.get("currently_attached")); + record.statusCode = toLong(map.get("status_code")); + record.statusDetail = toString(map.get("status_detail")); + record.runtimeProperties = toMapOfStringString(map.get("runtime_properties")); + record.qosAlgorithmType = toString(map.get("qos_algorithm_type")); + record.qosAlgorithmParams = toMapOfStringString(map.get("qos_algorithm_params")); + record.qosSupportedAlgorithms = toSetOfString(map.get("qos_supported_algorithms")); + record.metrics = toVBDMetrics(map.get("metrics")); return record; } @@ -12422,13 +12566,13 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; VBDMetrics.Record record = new VBDMetrics.Record(); - record.uuid = toString(map.get("uuid")); - record.ioReadKbs = toDouble(map.get("io_read_kbs")); - record.ioWriteKbs = toDouble(map.get("io_write_kbs")); - record.lastUpdated = toDate(map.get("last_updated")); - record.otherConfig = toMapOfStringString(map.get("other_config")); + record.uuid = toString(map.get("uuid")); + record.ioReadKbs = toDouble(map.get("io_read_kbs")); + record.ioWriteKbs = toDouble(map.get("io_write_kbs")); + record.lastUpdated = toDate(map.get("last_updated")); + record.otherConfig = toMapOfStringString(map.get("other_config")); return record; } @@ -12436,38 +12580,38 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; VDI.Record record = new VDI.Record(); - record.uuid = toString(map.get("uuid")); - record.nameLabel = toString(map.get("name_label")); - record.nameDescription = toString(map.get("name_description")); - record.allowedOperations = toSetOfVdiOperations(map.get("allowed_operations")); - record.currentOperations = toMapOfStringVdiOperations(map.get("current_operations")); - record.SR = toSR(map.get("SR")); - record.VBDs = toSetOfVBD(map.get("VBDs")); - record.crashDumps = toSetOfCrashdump(map.get("crash_dumps")); - record.virtualSize = toLong(map.get("virtual_size")); - record.physicalUtilisation = toLong(map.get("physical_utilisation")); - record.type = toVdiType(map.get("type")); - record.sharable = toBoolean(map.get("sharable")); - record.readOnly = toBoolean(map.get("read_only")); - record.otherConfig = toMapOfStringString(map.get("other_config")); - record.storageLock = toBoolean(map.get("storage_lock")); - record.location = toString(map.get("location")); - record.managed = toBoolean(map.get("managed")); - record.missing = toBoolean(map.get("missing")); - record.parent = toVDI(map.get("parent")); - record.xenstoreData = toMapOfStringString(map.get("xenstore_data")); - record.smConfig = toMapOfStringString(map.get("sm_config")); - record.isASnapshot = toBoolean(map.get("is_a_snapshot")); - record.snapshotOf = toVDI(map.get("snapshot_of")); - record.snapshots = toSetOfVDI(map.get("snapshots")); - record.snapshotTime = toDate(map.get("snapshot_time")); - record.tags = toSetOfString(map.get("tags")); - record.allowCaching = toBoolean(map.get("allow_caching")); - record.onBoot = toOnBoot(map.get("on_boot")); - record.metadataOfPool = toPool(map.get("metadata_of_pool")); - record.metadataLatest = toBoolean(map.get("metadata_latest")); + record.uuid = toString(map.get("uuid")); + record.nameLabel = toString(map.get("name_label")); + record.nameDescription = toString(map.get("name_description")); + record.allowedOperations = toSetOfVdiOperations(map.get("allowed_operations")); + record.currentOperations = toMapOfStringVdiOperations(map.get("current_operations")); + record.SR = toSR(map.get("SR")); + record.VBDs = toSetOfVBD(map.get("VBDs")); + record.crashDumps = toSetOfCrashdump(map.get("crash_dumps")); + record.virtualSize = toLong(map.get("virtual_size")); + record.physicalUtilisation = toLong(map.get("physical_utilisation")); + record.type = toVdiType(map.get("type")); + record.sharable = toBoolean(map.get("sharable")); + record.readOnly = toBoolean(map.get("read_only")); + record.otherConfig = toMapOfStringString(map.get("other_config")); + record.storageLock = toBoolean(map.get("storage_lock")); + record.location = toString(map.get("location")); + record.managed = toBoolean(map.get("managed")); + record.missing = toBoolean(map.get("missing")); + record.parent = toVDI(map.get("parent")); + record.xenstoreData = toMapOfStringString(map.get("xenstore_data")); + record.smConfig = toMapOfStringString(map.get("sm_config")); + record.isASnapshot = toBoolean(map.get("is_a_snapshot")); + record.snapshotOf = toVDI(map.get("snapshot_of")); + record.snapshots = toSetOfVDI(map.get("snapshots")); + record.snapshotTime = toDate(map.get("snapshot_time")); + record.tags = toSetOfString(map.get("tags")); + record.allowCaching = toBoolean(map.get("allow_caching")); + record.onBoot = toOnBoot(map.get("on_boot")); + record.metadataOfPool = toPool(map.get("metadata_of_pool")); + record.metadataLatest = toBoolean(map.get("metadata_latest")); return record; } @@ -12475,14 +12619,37 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; VGPU.Record record = new VGPU.Record(); - record.uuid = toString(map.get("uuid")); - record.VM = toVM(map.get("VM")); - record.GPUGroup = toGPUGroup(map.get("GPU_group")); - record.device = toString(map.get("device")); - record.currentlyAttached = toBoolean(map.get("currently_attached")); - record.otherConfig = toMapOfStringString(map.get("other_config")); + record.uuid = toString(map.get("uuid")); + record.VM = toVM(map.get("VM")); + record.GPUGroup = toGPUGroup(map.get("GPU_group")); + record.device = toString(map.get("device")); + record.currentlyAttached = toBoolean(map.get("currently_attached")); + record.otherConfig = toMapOfStringString(map.get("other_config")); + record.type = toVGPUType(map.get("type")); + record.residentOn = toPGPU(map.get("resident_on")); + return record; + } + + public static VGPUType.Record toVGPUTypeRecord(Object object) { + if (object == null) { + return null; + } + Map map = (Map) object; + VGPUType.Record record = new VGPUType.Record(); + record.uuid = toString(map.get("uuid")); + record.vendorName = toString(map.get("vendor_name")); + record.modelName = toString(map.get("model_name")); + record.framebufferSize = toLong(map.get("framebuffer_size")); + record.maxHeads = toLong(map.get("max_heads")); + record.maxResolutionX = toLong(map.get("max_resolution_x")); + record.maxResolutionY = toLong(map.get("max_resolution_y")); + record.supportedOnPGPUs = toSetOfPGPU(map.get("supported_on_PGPUs")); + record.enabledOnPGPUs = toSetOfPGPU(map.get("enabled_on_PGPUs")); + record.VGPUs = toSetOfVGPU(map.get("VGPUs")); + record.supportedOnGPUGroups = toSetOfGPUGroup(map.get("supported_on_GPU_groups")); + record.enabledOnGPUGroups = toSetOfGPUGroup(map.get("enabled_on_GPU_groups")); return record; } @@ -12490,29 +12657,29 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; VIF.Record record = new VIF.Record(); - record.uuid = toString(map.get("uuid")); - record.allowedOperations = toSetOfVifOperations(map.get("allowed_operations")); - record.currentOperations = toMapOfStringVifOperations(map.get("current_operations")); - record.device = toString(map.get("device")); - record.network = toNetwork(map.get("network")); - record.VM = toVM(map.get("VM")); - record.MAC = toString(map.get("MAC")); - record.MTU = toLong(map.get("MTU")); - record.otherConfig = toMapOfStringString(map.get("other_config")); - record.currentlyAttached = toBoolean(map.get("currently_attached")); - record.statusCode = toLong(map.get("status_code")); - record.statusDetail = toString(map.get("status_detail")); - record.runtimeProperties = toMapOfStringString(map.get("runtime_properties")); - record.qosAlgorithmType = toString(map.get("qos_algorithm_type")); - record.qosAlgorithmParams = toMapOfStringString(map.get("qos_algorithm_params")); - record.qosSupportedAlgorithms = toSetOfString(map.get("qos_supported_algorithms")); - record.metrics = toVIFMetrics(map.get("metrics")); - record.MACAutogenerated = toBoolean(map.get("MAC_autogenerated")); - record.lockingMode = toVifLockingMode(map.get("locking_mode")); - record.ipv4Allowed = toSetOfString(map.get("ipv4_allowed")); - record.ipv6Allowed = toSetOfString(map.get("ipv6_allowed")); + record.uuid = toString(map.get("uuid")); + record.allowedOperations = toSetOfVifOperations(map.get("allowed_operations")); + record.currentOperations = toMapOfStringVifOperations(map.get("current_operations")); + record.device = toString(map.get("device")); + record.network = toNetwork(map.get("network")); + record.VM = toVM(map.get("VM")); + record.MAC = toString(map.get("MAC")); + record.MTU = toLong(map.get("MTU")); + record.otherConfig = toMapOfStringString(map.get("other_config")); + record.currentlyAttached = toBoolean(map.get("currently_attached")); + record.statusCode = toLong(map.get("status_code")); + record.statusDetail = toString(map.get("status_detail")); + record.runtimeProperties = toMapOfStringString(map.get("runtime_properties")); + record.qosAlgorithmType = toString(map.get("qos_algorithm_type")); + record.qosAlgorithmParams = toMapOfStringString(map.get("qos_algorithm_params")); + record.qosSupportedAlgorithms = toSetOfString(map.get("qos_supported_algorithms")); + record.metrics = toVIFMetrics(map.get("metrics")); + record.MACAutogenerated = toBoolean(map.get("MAC_autogenerated")); + record.lockingMode = toVifLockingMode(map.get("locking_mode")); + record.ipv4Allowed = toSetOfString(map.get("ipv4_allowed")); + record.ipv6Allowed = toSetOfString(map.get("ipv6_allowed")); return record; } @@ -12520,13 +12687,13 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; VIFMetrics.Record record = new VIFMetrics.Record(); - record.uuid = toString(map.get("uuid")); - record.ioReadKbs = toDouble(map.get("io_read_kbs")); - record.ioWriteKbs = toDouble(map.get("io_write_kbs")); - record.lastUpdated = toDate(map.get("last_updated")); - record.otherConfig = toMapOfStringString(map.get("other_config")); + record.uuid = toString(map.get("uuid")); + record.ioReadKbs = toDouble(map.get("io_read_kbs")); + record.ioWriteKbs = toDouble(map.get("io_write_kbs")); + record.lastUpdated = toDate(map.get("last_updated")); + record.otherConfig = toMapOfStringString(map.get("other_config")); return record; } @@ -12534,13 +12701,13 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; VLAN.Record record = new VLAN.Record(); - record.uuid = toString(map.get("uuid")); - record.taggedPIF = toPIF(map.get("tagged_PIF")); - record.untaggedPIF = toPIF(map.get("untagged_PIF")); - record.tag = toLong(map.get("tag")); - record.otherConfig = toMapOfStringString(map.get("other_config")); + record.uuid = toString(map.get("uuid")); + record.taggedPIF = toPIF(map.get("tagged_PIF")); + record.untaggedPIF = toPIF(map.get("untagged_PIF")); + record.tag = toLong(map.get("tag")); + record.otherConfig = toMapOfStringString(map.get("other_config")); return record; } @@ -12548,82 +12715,83 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; VM.Record record = new VM.Record(); - record.uuid = toString(map.get("uuid")); - record.allowedOperations = toSetOfVmOperations(map.get("allowed_operations")); - record.currentOperations = toMapOfStringVmOperations(map.get("current_operations")); - record.powerState = toVmPowerState(map.get("power_state")); - record.nameLabel = toString(map.get("name_label")); - record.nameDescription = toString(map.get("name_description")); - record.userVersion = toLong(map.get("user_version")); - record.isATemplate = toBoolean(map.get("is_a_template")); - record.suspendVDI = toVDI(map.get("suspend_VDI")); - record.residentOn = toHost(map.get("resident_on")); - record.affinity = toHost(map.get("affinity")); - record.memoryOverhead = toLong(map.get("memory_overhead")); - record.memoryTarget = toLong(map.get("memory_target")); - record.memoryStaticMax = toLong(map.get("memory_static_max")); - record.memoryDynamicMax = toLong(map.get("memory_dynamic_max")); - record.memoryDynamicMin = toLong(map.get("memory_dynamic_min")); - record.memoryStaticMin = toLong(map.get("memory_static_min")); - record.VCPUsParams = toMapOfStringString(map.get("VCPUs_params")); - record.VCPUsMax = toLong(map.get("VCPUs_max")); - record.VCPUsAtStartup = toLong(map.get("VCPUs_at_startup")); - record.actionsAfterShutdown = toOnNormalExit(map.get("actions_after_shutdown")); - record.actionsAfterReboot = toOnNormalExit(map.get("actions_after_reboot")); - record.actionsAfterCrash = toOnCrashBehaviour(map.get("actions_after_crash")); - record.consoles = toSetOfConsole(map.get("consoles")); - record.VIFs = toSetOfVIF(map.get("VIFs")); - record.VBDs = toSetOfVBD(map.get("VBDs")); - record.crashDumps = toSetOfCrashdump(map.get("crash_dumps")); - record.VTPMs = toSetOfVTPM(map.get("VTPMs")); - record.PVBootloader = toString(map.get("PV_bootloader")); - record.PVKernel = toString(map.get("PV_kernel")); - record.PVRamdisk = toString(map.get("PV_ramdisk")); - record.PVArgs = toString(map.get("PV_args")); - record.PVBootloaderArgs = toString(map.get("PV_bootloader_args")); - record.PVLegacyArgs = toString(map.get("PV_legacy_args")); - record.HVMBootPolicy = toString(map.get("HVM_boot_policy")); - record.HVMBootParams = toMapOfStringString(map.get("HVM_boot_params")); - record.HVMShadowMultiplier = toDouble(map.get("HVM_shadow_multiplier")); - record.platform = toMapOfStringString(map.get("platform")); - record.PCIBus = toString(map.get("PCI_bus")); - record.otherConfig = toMapOfStringString(map.get("other_config")); - record.domid = toLong(map.get("domid")); - record.domarch = toString(map.get("domarch")); - record.lastBootCPUFlags = toMapOfStringString(map.get("last_boot_CPU_flags")); - record.isControlDomain = toBoolean(map.get("is_control_domain")); - record.metrics = toVMMetrics(map.get("metrics")); - record.guestMetrics = toVMGuestMetrics(map.get("guest_metrics")); - record.lastBootedRecord = toString(map.get("last_booted_record")); - record.recommendations = toString(map.get("recommendations")); - record.xenstoreData = toMapOfStringString(map.get("xenstore_data")); - record.haAlwaysRun = toBoolean(map.get("ha_always_run")); - record.haRestartPriority = toString(map.get("ha_restart_priority")); - record.isASnapshot = toBoolean(map.get("is_a_snapshot")); - record.snapshotOf = toVM(map.get("snapshot_of")); - record.snapshots = toSetOfVM(map.get("snapshots")); - record.snapshotTime = toDate(map.get("snapshot_time")); - record.transportableSnapshotId = toString(map.get("transportable_snapshot_id")); - record.blobs = toMapOfStringBlob(map.get("blobs")); - record.tags = toSetOfString(map.get("tags")); - record.blockedOperations = toMapOfVmOperationsString(map.get("blocked_operations")); - record.snapshotInfo = toMapOfStringString(map.get("snapshot_info")); - record.snapshotMetadata = toString(map.get("snapshot_metadata")); - record.parent = toVM(map.get("parent")); - record.children = toSetOfVM(map.get("children")); - record.biosStrings = toMapOfStringString(map.get("bios_strings")); - record.protectionPolicy = toVMPP(map.get("protection_policy")); - record.isSnapshotFromVmpp = toBoolean(map.get("is_snapshot_from_vmpp")); - record.appliance = toVMAppliance(map.get("appliance")); - record.startDelay = toLong(map.get("start_delay")); - record.shutdownDelay = toLong(map.get("shutdown_delay")); - record.order = toLong(map.get("order")); - record.VGPUs = toSetOfVGPU(map.get("VGPUs")); - record.attachedPCIs = toSetOfPCI(map.get("attached_PCIs")); - record.suspendSR = toSR(map.get("suspend_SR")); - record.version = toLong(map.get("version")); + record.uuid = toString(map.get("uuid")); + record.allowedOperations = toSetOfVmOperations(map.get("allowed_operations")); + record.currentOperations = toMapOfStringVmOperations(map.get("current_operations")); + record.powerState = toVmPowerState(map.get("power_state")); + record.nameLabel = toString(map.get("name_label")); + record.nameDescription = toString(map.get("name_description")); + record.userVersion = toLong(map.get("user_version")); + record.isATemplate = toBoolean(map.get("is_a_template")); + record.suspendVDI = toVDI(map.get("suspend_VDI")); + record.residentOn = toHost(map.get("resident_on")); + record.affinity = toHost(map.get("affinity")); + record.memoryOverhead = toLong(map.get("memory_overhead")); + record.memoryTarget = toLong(map.get("memory_target")); + record.memoryStaticMax = toLong(map.get("memory_static_max")); + record.memoryDynamicMax = toLong(map.get("memory_dynamic_max")); + record.memoryDynamicMin = toLong(map.get("memory_dynamic_min")); + record.memoryStaticMin = toLong(map.get("memory_static_min")); + record.VCPUsParams = toMapOfStringString(map.get("VCPUs_params")); + record.VCPUsMax = toLong(map.get("VCPUs_max")); + record.VCPUsAtStartup = toLong(map.get("VCPUs_at_startup")); + record.actionsAfterShutdown = toOnNormalExit(map.get("actions_after_shutdown")); + record.actionsAfterReboot = toOnNormalExit(map.get("actions_after_reboot")); + record.actionsAfterCrash = toOnCrashBehaviour(map.get("actions_after_crash")); + record.consoles = toSetOfConsole(map.get("consoles")); + record.VIFs = toSetOfVIF(map.get("VIFs")); + record.VBDs = toSetOfVBD(map.get("VBDs")); + record.crashDumps = toSetOfCrashdump(map.get("crash_dumps")); + record.VTPMs = toSetOfVTPM(map.get("VTPMs")); + record.PVBootloader = toString(map.get("PV_bootloader")); + record.PVKernel = toString(map.get("PV_kernel")); + record.PVRamdisk = toString(map.get("PV_ramdisk")); + record.PVArgs = toString(map.get("PV_args")); + record.PVBootloaderArgs = toString(map.get("PV_bootloader_args")); + record.PVLegacyArgs = toString(map.get("PV_legacy_args")); + record.HVMBootPolicy = toString(map.get("HVM_boot_policy")); + record.HVMBootParams = toMapOfStringString(map.get("HVM_boot_params")); + record.HVMShadowMultiplier = toDouble(map.get("HVM_shadow_multiplier")); + record.platform = toMapOfStringString(map.get("platform")); + record.PCIBus = toString(map.get("PCI_bus")); + record.otherConfig = toMapOfStringString(map.get("other_config")); + record.domid = toLong(map.get("domid")); + record.domarch = toString(map.get("domarch")); + record.lastBootCPUFlags = toMapOfStringString(map.get("last_boot_CPU_flags")); + record.isControlDomain = toBoolean(map.get("is_control_domain")); + record.metrics = toVMMetrics(map.get("metrics")); + record.guestMetrics = toVMGuestMetrics(map.get("guest_metrics")); + record.lastBootedRecord = toString(map.get("last_booted_record")); + record.recommendations = toString(map.get("recommendations")); + record.xenstoreData = toMapOfStringString(map.get("xenstore_data")); + record.haAlwaysRun = toBoolean(map.get("ha_always_run")); + record.haRestartPriority = toString(map.get("ha_restart_priority")); + record.isASnapshot = toBoolean(map.get("is_a_snapshot")); + record.snapshotOf = toVM(map.get("snapshot_of")); + record.snapshots = toSetOfVM(map.get("snapshots")); + record.snapshotTime = toDate(map.get("snapshot_time")); + record.transportableSnapshotId = toString(map.get("transportable_snapshot_id")); + record.blobs = toMapOfStringBlob(map.get("blobs")); + record.tags = toSetOfString(map.get("tags")); + record.blockedOperations = toMapOfVmOperationsString(map.get("blocked_operations")); + record.snapshotInfo = toMapOfStringString(map.get("snapshot_info")); + record.snapshotMetadata = toString(map.get("snapshot_metadata")); + record.parent = toVM(map.get("parent")); + record.children = toSetOfVM(map.get("children")); + record.biosStrings = toMapOfStringString(map.get("bios_strings")); + record.protectionPolicy = toVMPP(map.get("protection_policy")); + record.isSnapshotFromVmpp = toBoolean(map.get("is_snapshot_from_vmpp")); + record.appliance = toVMAppliance(map.get("appliance")); + record.startDelay = toLong(map.get("start_delay")); + record.shutdownDelay = toLong(map.get("shutdown_delay")); + record.order = toLong(map.get("order")); + record.VGPUs = toSetOfVGPU(map.get("VGPUs")); + record.attachedPCIs = toSetOfPCI(map.get("attached_PCIs")); + record.suspendSR = toSR(map.get("suspend_SR")); + record.version = toLong(map.get("version")); + record.generationId = toString(map.get("generation_id")); return record; } @@ -12631,28 +12799,28 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; VMPP.Record record = new VMPP.Record(); - record.uuid = toString(map.get("uuid")); - record.nameLabel = toString(map.get("name_label")); - record.nameDescription = toString(map.get("name_description")); - record.isPolicyEnabled = toBoolean(map.get("is_policy_enabled")); - record.backupType = toVmppBackupType(map.get("backup_type")); - record.backupRetentionValue = toLong(map.get("backup_retention_value")); - record.backupFrequency = toVmppBackupFrequency(map.get("backup_frequency")); - record.backupSchedule = toMapOfStringString(map.get("backup_schedule")); - record.isBackupRunning = toBoolean(map.get("is_backup_running")); - record.backupLastRunTime = toDate(map.get("backup_last_run_time")); - record.archiveTargetType = toVmppArchiveTargetType(map.get("archive_target_type")); - record.archiveTargetConfig = toMapOfStringString(map.get("archive_target_config")); - record.archiveFrequency = toVmppArchiveFrequency(map.get("archive_frequency")); - record.archiveSchedule = toMapOfStringString(map.get("archive_schedule")); - record.isArchiveRunning = toBoolean(map.get("is_archive_running")); - record.archiveLastRunTime = toDate(map.get("archive_last_run_time")); - record.VMs = toSetOfVM(map.get("VMs")); - record.isAlarmEnabled = toBoolean(map.get("is_alarm_enabled")); - record.alarmConfig = toMapOfStringString(map.get("alarm_config")); - record.recentAlerts = toSetOfString(map.get("recent_alerts")); + record.uuid = toString(map.get("uuid")); + record.nameLabel = toString(map.get("name_label")); + record.nameDescription = toString(map.get("name_description")); + record.isPolicyEnabled = toBoolean(map.get("is_policy_enabled")); + record.backupType = toVmppBackupType(map.get("backup_type")); + record.backupRetentionValue = toLong(map.get("backup_retention_value")); + record.backupFrequency = toVmppBackupFrequency(map.get("backup_frequency")); + record.backupSchedule = toMapOfStringString(map.get("backup_schedule")); + record.isBackupRunning = toBoolean(map.get("is_backup_running")); + record.backupLastRunTime = toDate(map.get("backup_last_run_time")); + record.archiveTargetType = toVmppArchiveTargetType(map.get("archive_target_type")); + record.archiveTargetConfig = toMapOfStringString(map.get("archive_target_config")); + record.archiveFrequency = toVmppArchiveFrequency(map.get("archive_frequency")); + record.archiveSchedule = toMapOfStringString(map.get("archive_schedule")); + record.isArchiveRunning = toBoolean(map.get("is_archive_running")); + record.archiveLastRunTime = toDate(map.get("archive_last_run_time")); + record.VMs = toSetOfVM(map.get("VMs")); + record.isAlarmEnabled = toBoolean(map.get("is_alarm_enabled")); + record.alarmConfig = toMapOfStringString(map.get("alarm_config")); + record.recentAlerts = toSetOfString(map.get("recent_alerts")); return record; } @@ -12660,14 +12828,14 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; VMAppliance.Record record = new VMAppliance.Record(); - record.uuid = toString(map.get("uuid")); - record.nameLabel = toString(map.get("name_label")); - record.nameDescription = toString(map.get("name_description")); - record.allowedOperations = toSetOfVmApplianceOperation(map.get("allowed_operations")); - record.currentOperations = toMapOfStringVmApplianceOperation(map.get("current_operations")); - record.VMs = toSetOfVM(map.get("VMs")); + record.uuid = toString(map.get("uuid")); + record.nameLabel = toString(map.get("name_label")); + record.nameDescription = toString(map.get("name_description")); + record.allowedOperations = toSetOfVmApplianceOperation(map.get("allowed_operations")); + record.currentOperations = toMapOfStringVmApplianceOperation(map.get("current_operations")); + record.VMs = toSetOfVM(map.get("VMs")); return record; } @@ -12675,19 +12843,19 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; VMGuestMetrics.Record record = new VMGuestMetrics.Record(); - record.uuid = toString(map.get("uuid")); - record.osVersion = toMapOfStringString(map.get("os_version")); - record.PVDriversVersion = toMapOfStringString(map.get("PV_drivers_version")); - record.PVDriversUpToDate = toBoolean(map.get("PV_drivers_up_to_date")); - record.memory = toMapOfStringString(map.get("memory")); - record.disks = toMapOfStringString(map.get("disks")); - record.networks = toMapOfStringString(map.get("networks")); - record.other = toMapOfStringString(map.get("other")); - record.lastUpdated = toDate(map.get("last_updated")); - record.otherConfig = toMapOfStringString(map.get("other_config")); - record.live = toBoolean(map.get("live")); + record.uuid = toString(map.get("uuid")); + record.osVersion = toMapOfStringString(map.get("os_version")); + record.PVDriversVersion = toMapOfStringString(map.get("PV_drivers_version")); + record.PVDriversUpToDate = toBoolean(map.get("PV_drivers_up_to_date")); + record.memory = toMapOfStringString(map.get("memory")); + record.disks = toMapOfStringString(map.get("disks")); + record.networks = toMapOfStringString(map.get("networks")); + record.other = toMapOfStringString(map.get("other")); + record.lastUpdated = toDate(map.get("last_updated")); + record.otherConfig = toMapOfStringString(map.get("other_config")); + record.live = toBoolean(map.get("live")); return record; } @@ -12695,20 +12863,20 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; VMMetrics.Record record = new VMMetrics.Record(); - record.uuid = toString(map.get("uuid")); - record.memoryActual = toLong(map.get("memory_actual")); - record.VCPUsNumber = toLong(map.get("VCPUs_number")); - record.VCPUsUtilisation = toMapOfLongDouble(map.get("VCPUs_utilisation")); - record.VCPUsCPU = toMapOfLongLong(map.get("VCPUs_CPU")); - record.VCPUsParams = toMapOfStringString(map.get("VCPUs_params")); - record.VCPUsFlags = toMapOfLongSetOfString(map.get("VCPUs_flags")); - record.state = toSetOfString(map.get("state")); - record.startTime = toDate(map.get("start_time")); - record.installTime = toDate(map.get("install_time")); - record.lastUpdated = toDate(map.get("last_updated")); - record.otherConfig = toMapOfStringString(map.get("other_config")); + record.uuid = toString(map.get("uuid")); + record.memoryActual = toLong(map.get("memory_actual")); + record.VCPUsNumber = toLong(map.get("VCPUs_number")); + record.VCPUsUtilisation = toMapOfLongDouble(map.get("VCPUs_utilisation")); + record.VCPUsCPU = toMapOfLongLong(map.get("VCPUs_CPU")); + record.VCPUsParams = toMapOfStringString(map.get("VCPUs_params")); + record.VCPUsFlags = toMapOfLongSetOfString(map.get("VCPUs_flags")); + record.state = toSetOfString(map.get("state")); + record.startTime = toDate(map.get("start_time")); + record.installTime = toDate(map.get("install_time")); + record.lastUpdated = toDate(map.get("last_updated")); + record.otherConfig = toMapOfStringString(map.get("other_config")); return record; } @@ -12716,11 +12884,11 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; VTPM.Record record = new VTPM.Record(); - record.uuid = toString(map.get("uuid")); - record.VM = toVM(map.get("VM")); - record.backend = toVM(map.get("backend")); + record.uuid = toString(map.get("uuid")); + record.VM = toVM(map.get("VM")); + record.backend = toVM(map.get("backend")); return record; } @@ -12728,15 +12896,15 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; Blob.Record record = new Blob.Record(); - record.uuid = toString(map.get("uuid")); - record.nameLabel = toString(map.get("name_label")); - record.nameDescription = toString(map.get("name_description")); - record.size = toLong(map.get("size")); - record._public = toBoolean(map.get("public")); - record.lastUpdated = toDate(map.get("last_updated")); - record.mimeType = toString(map.get("mime_type")); + record.uuid = toString(map.get("uuid")); + record.nameLabel = toString(map.get("name_label")); + record.nameDescription = toString(map.get("name_description")); + record.size = toLong(map.get("size")); + record._public = toBoolean(map.get("public")); + record.lastUpdated = toDate(map.get("last_updated")); + record.mimeType = toString(map.get("mime_type")); return record; } @@ -12744,13 +12912,13 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; Console.Record record = new Console.Record(); - record.uuid = toString(map.get("uuid")); - record.protocol = toConsoleProtocol(map.get("protocol")); - record.location = toString(map.get("location")); - record.VM = toVM(map.get("VM")); - record.otherConfig = toMapOfStringString(map.get("other_config")); + record.uuid = toString(map.get("uuid")); + record.protocol = toConsoleProtocol(map.get("protocol")); + record.location = toString(map.get("location")); + record.VM = toVM(map.get("VM")); + record.otherConfig = toMapOfStringString(map.get("other_config")); return record; } @@ -12758,12 +12926,12 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; Crashdump.Record record = new Crashdump.Record(); - record.uuid = toString(map.get("uuid")); - record.VM = toVM(map.get("VM")); - record.VDI = toVDI(map.get("VDI")); - record.otherConfig = toMapOfStringString(map.get("other_config")); + record.uuid = toString(map.get("uuid")); + record.VM = toVM(map.get("VM")); + record.VDI = toVDI(map.get("VDI")); + record.otherConfig = toMapOfStringString(map.get("other_config")); return record; } @@ -12771,16 +12939,16 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; DataSource.Record record = new DataSource.Record(); - record.nameLabel = toString(map.get("name_label")); - record.nameDescription = toString(map.get("name_description")); - record.enabled = toBoolean(map.get("enabled")); - record.standard = toBoolean(map.get("standard")); - record.units = toString(map.get("units")); - record.min = toDouble(map.get("min")); - record.max = toDouble(map.get("max")); - record.value = toDouble(map.get("value")); + record.nameLabel = toString(map.get("name_label")); + record.nameDescription = toString(map.get("name_description")); + record.enabled = toBoolean(map.get("enabled")); + record.standard = toBoolean(map.get("standard")); + record.units = toString(map.get("units")); + record.min = toDouble(map.get("min")); + record.max = toDouble(map.get("max")); + record.value = toDouble(map.get("value")); return record; } @@ -12788,153 +12956,66 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; Event.Record record = new Event.Record(); - record.id = toLong(map.get("id")); - record.timestamp = toDate(map.get("timestamp")); - record.clazz = toString(map.get("class")); - record.operation = toEventOperation(map.get("operation")); - record.ref = toString(map.get("ref")); - record.objUuid = toString(map.get("obj_uuid")); + record.id = toLong(map.get("id")); + record.timestamp = toDate(map.get("timestamp")); + record.clazz = toString(map.get("class")); + record.operation = toEventOperation(map.get("operation")); + record.ref = toString(map.get("ref")); + record.objUuid = toString(map.get("obj_uuid")); - Object a, b; - a = map.get("snapshot"); - switch (toXenAPIObjects(record.clazz)) + + Object a,b; + a=map.get("snapshot"); + switch(toXenAPIObjects(record.clazz)) { - case SESSION: - b = toSessionRecord(a); - break; - case SUBJECT: - b = toSubjectRecord(a); - break; - case ROLE: - b = toRoleRecord(a); - break; - case TASK: - b = toTaskRecord(a); - break; - case EVENT: - b = toEventRecord(a); - break; - case POOL: - b = toPoolRecord(a); - break; - case POOL_PATCH: - b = toPoolPatchRecord(a); - break; - case VM: - b = toVMRecord(a); - break; - case VM_METRICS: - b = toVMMetricsRecord(a); - break; - case VM_GUEST_METRICS: - b = toVMGuestMetricsRecord(a); - break; - case VMPP: - b = toVMPPRecord(a); - break; - case VM_APPLIANCE: - b = toVMApplianceRecord(a); - break; - case DR_TASK: - b = toDRTaskRecord(a); - break; - case HOST: - b = toHostRecord(a); - break; - case HOST_CRASHDUMP: - b = toHostCrashdumpRecord(a); - break; - case HOST_PATCH: - b = toHostPatchRecord(a); - break; - case HOST_METRICS: - b = toHostMetricsRecord(a); - break; - case HOST_CPU: - b = toHostCpuRecord(a); - break; - case NETWORK: - b = toNetworkRecord(a); - break; - case VIF: - b = toVIFRecord(a); - break; - case VIF_METRICS: - b = toVIFMetricsRecord(a); - break; - case PIF: - b = toPIFRecord(a); - break; - case PIF_METRICS: - b = toPIFMetricsRecord(a); - break; - case BOND: - b = toBondRecord(a); - break; - case VLAN: - b = toVLANRecord(a); - break; - case SM: - b = toSMRecord(a); - break; - case SR: - b = toSRRecord(a); - break; - case VDI: - b = toVDIRecord(a); - break; - case VBD: - b = toVBDRecord(a); - break; - case VBD_METRICS: - b = toVBDMetricsRecord(a); - break; - case PBD: - b = toPBDRecord(a); - break; - case CRASHDUMP: - b = toCrashdumpRecord(a); - break; - case VTPM: - b = toVTPMRecord(a); - break; - case CONSOLE: - b = toConsoleRecord(a); - break; - case USER: - b = toUserRecord(a); - break; - case DATA_SOURCE: - b = toDataSourceRecord(a); - break; - case BLOB: - b = toBlobRecord(a); - break; - case MESSAGE: - b = toMessageRecord(a); - break; - case SECRET: - b = toSecretRecord(a); - break; - case TUNNEL: - b = toTunnelRecord(a); - break; - case PCI: - b = toPCIRecord(a); - break; - case PGPU: - b = toPGPURecord(a); - break; - case GPU_GROUP: - b = toGPUGroupRecord(a); - break; - case VGPU: - b = toVGPURecord(a); - break; - default: - throw new RuntimeException("Internal error in auto-generated code whilst unmarshalling event snapshot"); + case SESSION: b = toSessionRecord(a); break; + case SUBJECT: b = toSubjectRecord(a); break; + case ROLE: b = toRoleRecord(a); break; + case TASK: b = toTaskRecord(a); break; + case EVENT: b = toEventRecord(a); break; + case POOL: b = toPoolRecord(a); break; + case POOL_PATCH: b = toPoolPatchRecord(a); break; + case VM: b = toVMRecord(a); break; + case VM_METRICS: b = toVMMetricsRecord(a); break; + case VM_GUEST_METRICS: b = toVMGuestMetricsRecord(a); break; + case VMPP: b = toVMPPRecord(a); break; + case VM_APPLIANCE: b = toVMApplianceRecord(a); break; + case DR_TASK: b = toDRTaskRecord(a); break; + case HOST: b = toHostRecord(a); break; + case HOST_CRASHDUMP: b = toHostCrashdumpRecord(a); break; + case HOST_PATCH: b = toHostPatchRecord(a); break; + case HOST_METRICS: b = toHostMetricsRecord(a); break; + case HOST_CPU: b = toHostCpuRecord(a); break; + case NETWORK: b = toNetworkRecord(a); break; + case VIF: b = toVIFRecord(a); break; + case VIF_METRICS: b = toVIFMetricsRecord(a); break; + case PIF: b = toPIFRecord(a); break; + case PIF_METRICS: b = toPIFMetricsRecord(a); break; + case BOND: b = toBondRecord(a); break; + case VLAN: b = toVLANRecord(a); break; + case SM: b = toSMRecord(a); break; + case SR: b = toSRRecord(a); break; + case VDI: b = toVDIRecord(a); break; + case VBD: b = toVBDRecord(a); break; + case VBD_METRICS: b = toVBDMetricsRecord(a); break; + case PBD: b = toPBDRecord(a); break; + case CRASHDUMP: b = toCrashdumpRecord(a); break; + case VTPM: b = toVTPMRecord(a); break; + case CONSOLE: b = toConsoleRecord(a); break; + case USER: b = toUserRecord(a); break; + case DATA_SOURCE: b = toDataSourceRecord(a); break; + case BLOB: b = toBlobRecord(a); break; + case MESSAGE: b = toMessageRecord(a); break; + case SECRET: b = toSecretRecord(a); break; + case TUNNEL: b = toTunnelRecord(a); break; + case PCI: b = toPCIRecord(a); break; + case PGPU: b = toPGPURecord(a); break; + case GPU_GROUP: b = toGPUGroupRecord(a); break; + case VGPU: b = toVGPURecord(a); break; + case VGPU_TYPE: b = toVGPUTypeRecord(a); break; + default: throw new RuntimeException("Internal error in auto-generated code whilst unmarshalling event snapshot"); } record.snapshot = b; return record; @@ -12944,55 +13025,56 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; Host.Record record = new Host.Record(); - record.uuid = toString(map.get("uuid")); - record.nameLabel = toString(map.get("name_label")); - record.nameDescription = toString(map.get("name_description")); - record.memoryOverhead = toLong(map.get("memory_overhead")); - record.allowedOperations = toSetOfHostAllowedOperations(map.get("allowed_operations")); - record.currentOperations = toMapOfStringHostAllowedOperations(map.get("current_operations")); - record.APIVersionMajor = toLong(map.get("API_version_major")); - record.APIVersionMinor = toLong(map.get("API_version_minor")); - record.APIVersionVendor = toString(map.get("API_version_vendor")); - record.APIVersionVendorImplementation = toMapOfStringString(map.get("API_version_vendor_implementation")); - record.enabled = toBoolean(map.get("enabled")); - record.softwareVersion = toMapOfStringString(map.get("software_version")); - record.otherConfig = toMapOfStringString(map.get("other_config")); - record.capabilities = toSetOfString(map.get("capabilities")); - record.cpuConfiguration = toMapOfStringString(map.get("cpu_configuration")); - record.schedPolicy = toString(map.get("sched_policy")); - record.supportedBootloaders = toSetOfString(map.get("supported_bootloaders")); - record.residentVMs = toSetOfVM(map.get("resident_VMs")); - record.logging = toMapOfStringString(map.get("logging")); - record.PIFs = toSetOfPIF(map.get("PIFs")); - record.suspendImageSr = toSR(map.get("suspend_image_sr")); - record.crashDumpSr = toSR(map.get("crash_dump_sr")); - record.crashdumps = toSetOfHostCrashdump(map.get("crashdumps")); - record.patches = toSetOfHostPatch(map.get("patches")); - record.PBDs = toSetOfPBD(map.get("PBDs")); - record.hostCPUs = toSetOfHostCpu(map.get("host_CPUs")); - record.cpuInfo = toMapOfStringString(map.get("cpu_info")); - record.hostname = toString(map.get("hostname")); - record.address = toString(map.get("address")); - record.metrics = toHostMetrics(map.get("metrics")); - record.licenseParams = toMapOfStringString(map.get("license_params")); - record.haStatefiles = toSetOfString(map.get("ha_statefiles")); - record.haNetworkPeers = toSetOfString(map.get("ha_network_peers")); - record.blobs = toMapOfStringBlob(map.get("blobs")); - record.tags = toSetOfString(map.get("tags")); - record.externalAuthType = toString(map.get("external_auth_type")); - record.externalAuthServiceName = toString(map.get("external_auth_service_name")); - record.externalAuthConfiguration = toMapOfStringString(map.get("external_auth_configuration")); - record.edition = toString(map.get("edition")); - record.licenseServer = toMapOfStringString(map.get("license_server")); - record.biosStrings = toMapOfStringString(map.get("bios_strings")); - record.powerOnMode = toString(map.get("power_on_mode")); - record.powerOnConfig = toMapOfStringString(map.get("power_on_config")); - record.localCacheSr = toSR(map.get("local_cache_sr")); - record.chipsetInfo = toMapOfStringString(map.get("chipset_info")); - record.PCIs = toSetOfPCI(map.get("PCIs")); - record.PGPUs = toSetOfPGPU(map.get("PGPUs")); + record.uuid = toString(map.get("uuid")); + record.nameLabel = toString(map.get("name_label")); + record.nameDescription = toString(map.get("name_description")); + record.memoryOverhead = toLong(map.get("memory_overhead")); + record.allowedOperations = toSetOfHostAllowedOperations(map.get("allowed_operations")); + record.currentOperations = toMapOfStringHostAllowedOperations(map.get("current_operations")); + record.APIVersionMajor = toLong(map.get("API_version_major")); + record.APIVersionMinor = toLong(map.get("API_version_minor")); + record.APIVersionVendor = toString(map.get("API_version_vendor")); + record.APIVersionVendorImplementation = toMapOfStringString(map.get("API_version_vendor_implementation")); + record.enabled = toBoolean(map.get("enabled")); + record.softwareVersion = toMapOfStringString(map.get("software_version")); + record.otherConfig = toMapOfStringString(map.get("other_config")); + record.capabilities = toSetOfString(map.get("capabilities")); + record.cpuConfiguration = toMapOfStringString(map.get("cpu_configuration")); + record.schedPolicy = toString(map.get("sched_policy")); + record.supportedBootloaders = toSetOfString(map.get("supported_bootloaders")); + record.residentVMs = toSetOfVM(map.get("resident_VMs")); + record.logging = toMapOfStringString(map.get("logging")); + record.PIFs = toSetOfPIF(map.get("PIFs")); + record.suspendImageSr = toSR(map.get("suspend_image_sr")); + record.crashDumpSr = toSR(map.get("crash_dump_sr")); + record.crashdumps = toSetOfHostCrashdump(map.get("crashdumps")); + record.patches = toSetOfHostPatch(map.get("patches")); + record.PBDs = toSetOfPBD(map.get("PBDs")); + record.hostCPUs = toSetOfHostCpu(map.get("host_CPUs")); + record.cpuInfo = toMapOfStringString(map.get("cpu_info")); + record.hostname = toString(map.get("hostname")); + record.address = toString(map.get("address")); + record.metrics = toHostMetrics(map.get("metrics")); + record.licenseParams = toMapOfStringString(map.get("license_params")); + record.haStatefiles = toSetOfString(map.get("ha_statefiles")); + record.haNetworkPeers = toSetOfString(map.get("ha_network_peers")); + record.blobs = toMapOfStringBlob(map.get("blobs")); + record.tags = toSetOfString(map.get("tags")); + record.externalAuthType = toString(map.get("external_auth_type")); + record.externalAuthServiceName = toString(map.get("external_auth_service_name")); + record.externalAuthConfiguration = toMapOfStringString(map.get("external_auth_configuration")); + record.edition = toString(map.get("edition")); + record.licenseServer = toMapOfStringString(map.get("license_server")); + record.biosStrings = toMapOfStringString(map.get("bios_strings")); + record.powerOnMode = toString(map.get("power_on_mode")); + record.powerOnConfig = toMapOfStringString(map.get("power_on_config")); + record.localCacheSr = toSR(map.get("local_cache_sr")); + record.chipsetInfo = toMapOfStringString(map.get("chipset_info")); + record.PCIs = toSetOfPCI(map.get("PCIs")); + record.PGPUs = toSetOfPGPU(map.get("PGPUs")); + record.guestVCPUsParams = toMapOfStringString(map.get("guest_VCPUs_params")); return record; } @@ -13000,21 +13082,21 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; HostCpu.Record record = new HostCpu.Record(); - record.uuid = toString(map.get("uuid")); - record.host = toHost(map.get("host")); - record.number = toLong(map.get("number")); - record.vendor = toString(map.get("vendor")); - record.speed = toLong(map.get("speed")); - record.modelname = toString(map.get("modelname")); - record.family = toLong(map.get("family")); - record.model = toLong(map.get("model")); - record.stepping = toString(map.get("stepping")); - record.flags = toString(map.get("flags")); - record.features = toString(map.get("features")); - record.utilisation = toDouble(map.get("utilisation")); - record.otherConfig = toMapOfStringString(map.get("other_config")); + record.uuid = toString(map.get("uuid")); + record.host = toHost(map.get("host")); + record.number = toLong(map.get("number")); + record.vendor = toString(map.get("vendor")); + record.speed = toLong(map.get("speed")); + record.modelname = toString(map.get("modelname")); + record.family = toLong(map.get("family")); + record.model = toLong(map.get("model")); + record.stepping = toString(map.get("stepping")); + record.flags = toString(map.get("flags")); + record.features = toString(map.get("features")); + record.utilisation = toDouble(map.get("utilisation")); + record.otherConfig = toMapOfStringString(map.get("other_config")); return record; } @@ -13022,13 +13104,13 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; HostCrashdump.Record record = new HostCrashdump.Record(); - record.uuid = toString(map.get("uuid")); - record.host = toHost(map.get("host")); - record.timestamp = toDate(map.get("timestamp")); - record.size = toLong(map.get("size")); - record.otherConfig = toMapOfStringString(map.get("other_config")); + record.uuid = toString(map.get("uuid")); + record.host = toHost(map.get("host")); + record.timestamp = toDate(map.get("timestamp")); + record.size = toLong(map.get("size")); + record.otherConfig = toMapOfStringString(map.get("other_config")); return record; } @@ -13036,14 +13118,14 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; HostMetrics.Record record = new HostMetrics.Record(); - record.uuid = toString(map.get("uuid")); - record.memoryTotal = toLong(map.get("memory_total")); - record.memoryFree = toLong(map.get("memory_free")); - record.live = toBoolean(map.get("live")); - record.lastUpdated = toDate(map.get("last_updated")); - record.otherConfig = toMapOfStringString(map.get("other_config")); + record.uuid = toString(map.get("uuid")); + record.memoryTotal = toLong(map.get("memory_total")); + record.memoryFree = toLong(map.get("memory_free")); + record.live = toBoolean(map.get("live")); + record.lastUpdated = toDate(map.get("last_updated")); + record.otherConfig = toMapOfStringString(map.get("other_config")); return record; } @@ -13051,18 +13133,18 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; HostPatch.Record record = new HostPatch.Record(); - record.uuid = toString(map.get("uuid")); - record.nameLabel = toString(map.get("name_label")); - record.nameDescription = toString(map.get("name_description")); - record.version = toString(map.get("version")); - record.host = toHost(map.get("host")); - record.applied = toBoolean(map.get("applied")); - record.timestampApplied = toDate(map.get("timestamp_applied")); - record.size = toLong(map.get("size")); - record.poolPatch = toPoolPatch(map.get("pool_patch")); - record.otherConfig = toMapOfStringString(map.get("other_config")); + record.uuid = toString(map.get("uuid")); + record.nameLabel = toString(map.get("name_label")); + record.nameDescription = toString(map.get("name_description")); + record.version = toString(map.get("version")); + record.host = toHost(map.get("host")); + record.applied = toBoolean(map.get("applied")); + record.timestampApplied = toDate(map.get("timestamp_applied")); + record.size = toLong(map.get("size")); + record.poolPatch = toPoolPatch(map.get("pool_patch")); + record.otherConfig = toMapOfStringString(map.get("other_config")); return record; } @@ -13070,15 +13152,15 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; Message.Record record = new Message.Record(); - record.uuid = toString(map.get("uuid")); - record.name = toString(map.get("name")); - record.priority = toLong(map.get("priority")); - record.cls = toCls(map.get("cls")); - record.objUuid = toString(map.get("obj_uuid")); - record.timestamp = toDate(map.get("timestamp")); - record.body = toString(map.get("body")); + record.uuid = toString(map.get("uuid")); + record.name = toString(map.get("name")); + record.priority = toLong(map.get("priority")); + record.cls = toCls(map.get("cls")); + record.objUuid = toString(map.get("obj_uuid")); + record.timestamp = toDate(map.get("timestamp")); + record.body = toString(map.get("body")); return record; } @@ -13086,21 +13168,21 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; Network.Record record = new Network.Record(); - record.uuid = toString(map.get("uuid")); - record.nameLabel = toString(map.get("name_label")); - record.nameDescription = toString(map.get("name_description")); - record.allowedOperations = toSetOfNetworkOperations(map.get("allowed_operations")); - record.currentOperations = toMapOfStringNetworkOperations(map.get("current_operations")); - record.VIFs = toSetOfVIF(map.get("VIFs")); - record.PIFs = toSetOfPIF(map.get("PIFs")); - record.MTU = toLong(map.get("MTU")); - record.otherConfig = toMapOfStringString(map.get("other_config")); - record.bridge = toString(map.get("bridge")); - record.blobs = toMapOfStringBlob(map.get("blobs")); - record.tags = toSetOfString(map.get("tags")); - record.defaultLockingMode = toNetworkDefaultLockingMode(map.get("default_locking_mode")); + record.uuid = toString(map.get("uuid")); + record.nameLabel = toString(map.get("name_label")); + record.nameDescription = toString(map.get("name_description")); + record.allowedOperations = toSetOfNetworkOperations(map.get("allowed_operations")); + record.currentOperations = toMapOfStringNetworkOperations(map.get("current_operations")); + record.VIFs = toSetOfVIF(map.get("VIFs")); + record.PIFs = toSetOfPIF(map.get("PIFs")); + record.MTU = toLong(map.get("MTU")); + record.otherConfig = toMapOfStringString(map.get("other_config")); + record.bridge = toString(map.get("bridge")); + record.blobs = toMapOfStringBlob(map.get("blobs")); + record.tags = toSetOfString(map.get("tags")); + record.defaultLockingMode = toNetworkDefaultLockingMode(map.get("default_locking_mode")); return record; } @@ -13108,35 +13190,35 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; Pool.Record record = new Pool.Record(); - record.uuid = toString(map.get("uuid")); - record.nameLabel = toString(map.get("name_label")); - record.nameDescription = toString(map.get("name_description")); - record.master = toHost(map.get("master")); - record.defaultSR = toSR(map.get("default_SR")); - record.suspendImageSR = toSR(map.get("suspend_image_SR")); - record.crashDumpSR = toSR(map.get("crash_dump_SR")); - record.otherConfig = toMapOfStringString(map.get("other_config")); - record.haEnabled = toBoolean(map.get("ha_enabled")); - record.haConfiguration = toMapOfStringString(map.get("ha_configuration")); - record.haStatefiles = toSetOfString(map.get("ha_statefiles")); - record.haHostFailuresToTolerate = toLong(map.get("ha_host_failures_to_tolerate")); - record.haPlanExistsFor = toLong(map.get("ha_plan_exists_for")); - record.haAllowOvercommit = toBoolean(map.get("ha_allow_overcommit")); - record.haOvercommitted = toBoolean(map.get("ha_overcommitted")); - record.blobs = toMapOfStringBlob(map.get("blobs")); - record.tags = toSetOfString(map.get("tags")); - record.guiConfig = toMapOfStringString(map.get("gui_config")); - record.wlbUrl = toString(map.get("wlb_url")); - record.wlbUsername = toString(map.get("wlb_username")); - record.wlbEnabled = toBoolean(map.get("wlb_enabled")); - record.wlbVerifyCert = toBoolean(map.get("wlb_verify_cert")); - record.redoLogEnabled = toBoolean(map.get("redo_log_enabled")); - record.redoLogVdi = toVDI(map.get("redo_log_vdi")); - record.vswitchController = toString(map.get("vswitch_controller")); - record.restrictions = toMapOfStringString(map.get("restrictions")); - record.metadataVDIs = toSetOfVDI(map.get("metadata_VDIs")); + record.uuid = toString(map.get("uuid")); + record.nameLabel = toString(map.get("name_label")); + record.nameDescription = toString(map.get("name_description")); + record.master = toHost(map.get("master")); + record.defaultSR = toSR(map.get("default_SR")); + record.suspendImageSR = toSR(map.get("suspend_image_SR")); + record.crashDumpSR = toSR(map.get("crash_dump_SR")); + record.otherConfig = toMapOfStringString(map.get("other_config")); + record.haEnabled = toBoolean(map.get("ha_enabled")); + record.haConfiguration = toMapOfStringString(map.get("ha_configuration")); + record.haStatefiles = toSetOfString(map.get("ha_statefiles")); + record.haHostFailuresToTolerate = toLong(map.get("ha_host_failures_to_tolerate")); + record.haPlanExistsFor = toLong(map.get("ha_plan_exists_for")); + record.haAllowOvercommit = toBoolean(map.get("ha_allow_overcommit")); + record.haOvercommitted = toBoolean(map.get("ha_overcommitted")); + record.blobs = toMapOfStringBlob(map.get("blobs")); + record.tags = toSetOfString(map.get("tags")); + record.guiConfig = toMapOfStringString(map.get("gui_config")); + record.wlbUrl = toString(map.get("wlb_url")); + record.wlbUsername = toString(map.get("wlb_username")); + record.wlbEnabled = toBoolean(map.get("wlb_enabled")); + record.wlbVerifyCert = toBoolean(map.get("wlb_verify_cert")); + record.redoLogEnabled = toBoolean(map.get("redo_log_enabled")); + record.redoLogVdi = toVDI(map.get("redo_log_vdi")); + record.vswitchController = toString(map.get("vswitch_controller")); + record.restrictions = toMapOfStringString(map.get("restrictions")); + record.metadataVDIs = toSetOfVDI(map.get("metadata_VDIs")); return record; } @@ -13144,17 +13226,17 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; PoolPatch.Record record = new PoolPatch.Record(); - record.uuid = toString(map.get("uuid")); - record.nameLabel = toString(map.get("name_label")); - record.nameDescription = toString(map.get("name_description")); - record.version = toString(map.get("version")); - record.size = toLong(map.get("size")); - record.poolApplied = toBoolean(map.get("pool_applied")); - record.hostPatches = toSetOfHostPatch(map.get("host_patches")); - record.afterApplyGuidance = toSetOfAfterApplyGuidance(map.get("after_apply_guidance")); - record.otherConfig = toMapOfStringString(map.get("other_config")); + record.uuid = toString(map.get("uuid")); + record.nameLabel = toString(map.get("name_label")); + record.nameDescription = toString(map.get("name_description")); + record.version = toString(map.get("version")); + record.size = toLong(map.get("size")); + record.poolApplied = toBoolean(map.get("pool_applied")); + record.hostPatches = toSetOfHostPatch(map.get("host_patches")); + record.afterApplyGuidance = toSetOfAfterApplyGuidance(map.get("after_apply_guidance")); + record.otherConfig = toMapOfStringString(map.get("other_config")); return record; } @@ -13162,12 +13244,12 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; Role.Record record = new Role.Record(); - record.uuid = toString(map.get("uuid")); - record.nameLabel = toString(map.get("name_label")); - record.nameDescription = toString(map.get("name_description")); - record.subroles = toSetOfRole(map.get("subroles")); + record.uuid = toString(map.get("uuid")); + record.nameLabel = toString(map.get("name_label")); + record.nameDescription = toString(map.get("name_description")); + record.subroles = toSetOfRole(map.get("subroles")); return record; } @@ -13175,11 +13257,11 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; Secret.Record record = new Secret.Record(); - record.uuid = toString(map.get("uuid")); - record.value = toString(map.get("value")); - record.otherConfig = toMapOfStringString(map.get("other_config")); + record.uuid = toString(map.get("uuid")); + record.value = toString(map.get("value")); + record.otherConfig = toMapOfStringString(map.get("other_config")); return record; } @@ -13187,22 +13269,22 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; Session.Record record = new Session.Record(); - record.uuid = toString(map.get("uuid")); - record.thisHost = toHost(map.get("this_host")); - record.thisUser = toUser(map.get("this_user")); - record.lastActive = toDate(map.get("last_active")); - record.pool = toBoolean(map.get("pool")); - record.otherConfig = toMapOfStringString(map.get("other_config")); - record.isLocalSuperuser = toBoolean(map.get("is_local_superuser")); - record.subject = toSubject(map.get("subject")); - record.validationTime = toDate(map.get("validation_time")); - record.authUserSid = toString(map.get("auth_user_sid")); - record.authUserName = toString(map.get("auth_user_name")); - record.rbacPermissions = toSetOfString(map.get("rbac_permissions")); - record.tasks = toSetOfTask(map.get("tasks")); - record.parent = toSession(map.get("parent")); + record.uuid = toString(map.get("uuid")); + record.thisHost = toHost(map.get("this_host")); + record.thisUser = toUser(map.get("this_user")); + record.lastActive = toDate(map.get("last_active")); + record.pool = toBoolean(map.get("pool")); + record.otherConfig = toMapOfStringString(map.get("other_config")); + record.isLocalSuperuser = toBoolean(map.get("is_local_superuser")); + record.subject = toSubject(map.get("subject")); + record.validationTime = toDate(map.get("validation_time")); + record.authUserSid = toString(map.get("auth_user_sid")); + record.authUserName = toString(map.get("auth_user_name")); + record.rbacPermissions = toSetOfString(map.get("rbac_permissions")); + record.tasks = toSetOfTask(map.get("tasks")); + record.parent = toSession(map.get("parent")); return record; } @@ -13210,12 +13292,12 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; Subject.Record record = new Subject.Record(); - record.uuid = toString(map.get("uuid")); - record.subjectIdentifier = toString(map.get("subject_identifier")); - record.otherConfig = toMapOfStringString(map.get("other_config")); - record.roles = toSetOfRole(map.get("roles")); + record.uuid = toString(map.get("uuid")); + record.subjectIdentifier = toString(map.get("subject_identifier")); + record.otherConfig = toMapOfStringString(map.get("other_config")); + record.roles = toSetOfRole(map.get("roles")); return record; } @@ -13223,24 +13305,24 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; Task.Record record = new Task.Record(); - record.uuid = toString(map.get("uuid")); - record.nameLabel = toString(map.get("name_label")); - record.nameDescription = toString(map.get("name_description")); - record.allowedOperations = toSetOfTaskAllowedOperations(map.get("allowed_operations")); - record.currentOperations = toMapOfStringTaskAllowedOperations(map.get("current_operations")); - record.created = toDate(map.get("created")); - record.finished = toDate(map.get("finished")); - record.status = toTaskStatusType(map.get("status")); - record.residentOn = toHost(map.get("resident_on")); - record.progress = toDouble(map.get("progress")); - record.type = toString(map.get("type")); - record.result = toString(map.get("result")); - record.errorInfo = toSetOfString(map.get("error_info")); - record.otherConfig = toMapOfStringString(map.get("other_config")); - record.subtaskOf = toTask(map.get("subtask_of")); - record.subtasks = toSetOfTask(map.get("subtasks")); + record.uuid = toString(map.get("uuid")); + record.nameLabel = toString(map.get("name_label")); + record.nameDescription = toString(map.get("name_description")); + record.allowedOperations = toSetOfTaskAllowedOperations(map.get("allowed_operations")); + record.currentOperations = toMapOfStringTaskAllowedOperations(map.get("current_operations")); + record.created = toDate(map.get("created")); + record.finished = toDate(map.get("finished")); + record.status = toTaskStatusType(map.get("status")); + record.residentOn = toHost(map.get("resident_on")); + record.progress = toDouble(map.get("progress")); + record.type = toString(map.get("type")); + record.result = toString(map.get("result")); + record.errorInfo = toSetOfString(map.get("error_info")); + record.otherConfig = toMapOfStringString(map.get("other_config")); + record.subtaskOf = toTask(map.get("subtask_of")); + record.subtasks = toSetOfTask(map.get("subtasks")); return record; } @@ -13248,13 +13330,13 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; Tunnel.Record record = new Tunnel.Record(); - record.uuid = toString(map.get("uuid")); - record.accessPIF = toPIF(map.get("access_PIF")); - record.transportPIF = toPIF(map.get("transport_PIF")); - record.status = toMapOfStringString(map.get("status")); - record.otherConfig = toMapOfStringString(map.get("other_config")); + record.uuid = toString(map.get("uuid")); + record.accessPIF = toPIF(map.get("access_PIF")); + record.transportPIF = toPIF(map.get("transport_PIF")); + record.status = toMapOfStringString(map.get("status")); + record.otherConfig = toMapOfStringString(map.get("other_config")); return record; } @@ -13262,181 +13344,186 @@ public class Types if (object == null) { return null; } - Map map = (Map)object; + Map map = (Map) object; User.Record record = new User.Record(); - record.uuid = toString(map.get("uuid")); - record.shortName = toString(map.get("short_name")); - record.fullname = toString(map.get("fullname")); - record.otherConfig = toMapOfStringString(map.get("other_config")); + record.uuid = toString(map.get("uuid")); + record.shortName = toString(map.get("short_name")); + record.fullname = toString(map.get("fullname")); + record.otherConfig = toMapOfStringString(map.get("other_config")); return record; } - public static Bond toBond(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toBond(parseResult(task.getResult(connection))); + + public static Bond toBond(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toBond(parseResult(task.getResult(connection))); } - public static DRTask toDRTask(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toDRTask(parseResult(task.getResult(connection))); + public static DRTask toDRTask(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toDRTask(parseResult(task.getResult(connection))); } - public static GPUGroup toGPUGroup(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toGPUGroup(parseResult(task.getResult(connection))); + public static GPUGroup toGPUGroup(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toGPUGroup(parseResult(task.getResult(connection))); } - public static PBD toPBD(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toPBD(parseResult(task.getResult(connection))); + public static PBD toPBD(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toPBD(parseResult(task.getResult(connection))); } - public static PCI toPCI(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toPCI(parseResult(task.getResult(connection))); + public static PCI toPCI(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toPCI(parseResult(task.getResult(connection))); } - public static PGPU toPGPU(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toPGPU(parseResult(task.getResult(connection))); + public static PGPU toPGPU(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toPGPU(parseResult(task.getResult(connection))); } - public static PIF toPIF(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toPIF(parseResult(task.getResult(connection))); + public static PIF toPIF(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toPIF(parseResult(task.getResult(connection))); } - public static PIFMetrics toPIFMetrics(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toPIFMetrics(parseResult(task.getResult(connection))); + public static PIFMetrics toPIFMetrics(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toPIFMetrics(parseResult(task.getResult(connection))); } - public static SM toSM(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toSM(parseResult(task.getResult(connection))); + public static SM toSM(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toSM(parseResult(task.getResult(connection))); } - public static SR toSR(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toSR(parseResult(task.getResult(connection))); + public static SR toSR(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toSR(parseResult(task.getResult(connection))); } - public static VBD toVBD(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toVBD(parseResult(task.getResult(connection))); + public static VBD toVBD(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toVBD(parseResult(task.getResult(connection))); } - public static VBDMetrics toVBDMetrics(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toVBDMetrics(parseResult(task.getResult(connection))); + public static VBDMetrics toVBDMetrics(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toVBDMetrics(parseResult(task.getResult(connection))); } - public static VDI toVDI(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toVDI(parseResult(task.getResult(connection))); + public static VDI toVDI(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toVDI(parseResult(task.getResult(connection))); } - public static VGPU toVGPU(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toVGPU(parseResult(task.getResult(connection))); + public static VGPU toVGPU(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toVGPU(parseResult(task.getResult(connection))); } - public static VIF toVIF(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toVIF(parseResult(task.getResult(connection))); + public static VGPUType toVGPUType(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toVGPUType(parseResult(task.getResult(connection))); } - public static VIFMetrics toVIFMetrics(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toVIFMetrics(parseResult(task.getResult(connection))); + public static VIF toVIF(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toVIF(parseResult(task.getResult(connection))); } - public static VLAN toVLAN(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toVLAN(parseResult(task.getResult(connection))); + public static VIFMetrics toVIFMetrics(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toVIFMetrics(parseResult(task.getResult(connection))); } - public static VM toVM(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toVM(parseResult(task.getResult(connection))); + public static VLAN toVLAN(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toVLAN(parseResult(task.getResult(connection))); } - public static VMPP toVMPP(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toVMPP(parseResult(task.getResult(connection))); + public static VM toVM(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toVM(parseResult(task.getResult(connection))); } - public static VMAppliance toVMAppliance(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toVMAppliance(parseResult(task.getResult(connection))); + public static VMPP toVMPP(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toVMPP(parseResult(task.getResult(connection))); } - public static VMGuestMetrics toVMGuestMetrics(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toVMGuestMetrics(parseResult(task.getResult(connection))); + public static VMAppliance toVMAppliance(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toVMAppliance(parseResult(task.getResult(connection))); } - public static VMMetrics toVMMetrics(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toVMMetrics(parseResult(task.getResult(connection))); + public static VMGuestMetrics toVMGuestMetrics(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toVMGuestMetrics(parseResult(task.getResult(connection))); } - public static VTPM toVTPM(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toVTPM(parseResult(task.getResult(connection))); + public static VMMetrics toVMMetrics(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toVMMetrics(parseResult(task.getResult(connection))); } - public static Blob toBlob(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toBlob(parseResult(task.getResult(connection))); + public static VTPM toVTPM(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toVTPM(parseResult(task.getResult(connection))); } - public static Console toConsole(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toConsole(parseResult(task.getResult(connection))); + public static Blob toBlob(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toBlob(parseResult(task.getResult(connection))); } - public static Crashdump toCrashdump(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toCrashdump(parseResult(task.getResult(connection))); + public static Console toConsole(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toConsole(parseResult(task.getResult(connection))); } - public static Host toHost(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toHost(parseResult(task.getResult(connection))); + public static Crashdump toCrashdump(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toCrashdump(parseResult(task.getResult(connection))); } - public static HostCpu toHostCpu(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toHostCpu(parseResult(task.getResult(connection))); + public static Host toHost(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toHost(parseResult(task.getResult(connection))); } - public static HostCrashdump toHostCrashdump(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toHostCrashdump(parseResult(task.getResult(connection))); + public static HostCpu toHostCpu(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toHostCpu(parseResult(task.getResult(connection))); } - public static HostMetrics toHostMetrics(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toHostMetrics(parseResult(task.getResult(connection))); + public static HostCrashdump toHostCrashdump(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toHostCrashdump(parseResult(task.getResult(connection))); } - public static HostPatch toHostPatch(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toHostPatch(parseResult(task.getResult(connection))); + public static HostMetrics toHostMetrics(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toHostMetrics(parseResult(task.getResult(connection))); } - public static Message toMessage(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toMessage(parseResult(task.getResult(connection))); + public static HostPatch toHostPatch(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toHostPatch(parseResult(task.getResult(connection))); } - public static Network toNetwork(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toNetwork(parseResult(task.getResult(connection))); + public static Message toMessage(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toMessage(parseResult(task.getResult(connection))); } - public static Pool toPool(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toPool(parseResult(task.getResult(connection))); + public static Network toNetwork(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toNetwork(parseResult(task.getResult(connection))); } - public static PoolPatch toPoolPatch(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toPoolPatch(parseResult(task.getResult(connection))); + public static Pool toPool(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toPool(parseResult(task.getResult(connection))); } - public static Role toRole(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toRole(parseResult(task.getResult(connection))); + public static PoolPatch toPoolPatch(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toPoolPatch(parseResult(task.getResult(connection))); } - public static Secret toSecret(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toSecret(parseResult(task.getResult(connection))); + public static Role toRole(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toRole(parseResult(task.getResult(connection))); } - public static Session toSession(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toSession(parseResult(task.getResult(connection))); + public static Secret toSecret(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toSecret(parseResult(task.getResult(connection))); } - public static Subject toSubject(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toSubject(parseResult(task.getResult(connection))); + public static Session toSession(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toSession(parseResult(task.getResult(connection))); } - public static Task toTask(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toTask(parseResult(task.getResult(connection))); + public static Subject toSubject(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toSubject(parseResult(task.getResult(connection))); } - public static Tunnel toTunnel(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toTunnel(parseResult(task.getResult(connection))); + public static Task toTask(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toTask(parseResult(task.getResult(connection))); } - public static User toUser(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult { - return Types.toUser(parseResult(task.getResult(connection))); + public static Tunnel toTunnel(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toTunnel(parseResult(task.getResult(connection))); + } + + public static User toUser(Task task, Connection connection) throws XenAPIException, BadServerResponse, XmlRpcException, BadAsyncResult{ + return Types.toUser(parseResult(task.getResult(connection))); } } diff --git a/deps/XenServerJava/src/com/xensource/xenapi/User.java b/deps/XenServerJava/src/com/xensource/xenapi/User.java index dff27f5b367..4a01d60e2e8 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/User.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/User.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class User extends XenAPIObject { * For internal use only. */ User(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class User extends XenAPIObject { { if (obj != null && obj instanceof User) { - User other = (User)obj; + User other = (User) obj; return other.ref.equals(this.ref); } else { @@ -109,8 +110,8 @@ public class User extends XenAPIObject { /** * Convert a user.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("short_name", this.shortName == null ? "" : this.shortName); map.put("fullname", this.fullname == null ? "" : this.fullname); @@ -142,17 +143,16 @@ public class User extends XenAPIObject { * * @return all fields from the object */ - @Deprecated - public User.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public User.Record getRecord(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "user.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toUserRecord(result); + return Types.toUserRecord(result); } /** @@ -162,17 +162,16 @@ public class User extends XenAPIObject { * @param uuid UUID of object to return * @return reference to the object */ - @Deprecated - public static User getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public static User getByUuid(Connection c, String uuid) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "user.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toUser(result); + return Types.toUser(result); } /** @@ -182,11 +181,10 @@ public class User extends XenAPIObject { * @param record All constructor arguments * @return Task */ - @Deprecated - public static Task createAsync(Connection c, User.Record record) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public static Task createAsync(Connection c, User.Record record) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.user.create"; String session = c.getSessionReference(); Map record_map = record.toMap(); @@ -203,18 +201,17 @@ public class User extends XenAPIObject { * @param record All constructor arguments * @return reference to the newly created object */ - @Deprecated - public static User create(Connection c, User.Record record) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public static User create(Connection c, User.Record record) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "user.create"; String session = c.getSessionReference(); Map record_map = record.toMap(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toUser(result); + return Types.toUser(result); } /** @@ -223,11 +220,10 @@ public class User extends XenAPIObject { * * @return Task */ - @Deprecated - public Task destroyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public Task destroyAsync(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.user.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -241,11 +237,10 @@ public class User extends XenAPIObject { * @deprecated * */ - @Deprecated - public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public void destroy(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "user.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -259,15 +254,15 @@ public class User extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "user.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -276,15 +271,15 @@ public class User extends XenAPIObject { * @return value of the field */ public String getShortName(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "user.get_short_name"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -293,15 +288,15 @@ public class User extends XenAPIObject { * @return value of the field */ public String getFullname(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "user.get_fullname"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -310,15 +305,15 @@ public class User extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "user.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -327,9 +322,9 @@ public class User extends XenAPIObject { * @param fullname New value to set */ public void setFullname(Connection c, String fullname) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "user.set_fullname"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(fullname)}; @@ -343,9 +338,9 @@ public class User extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "user.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -360,9 +355,9 @@ public class User extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "user.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -376,9 +371,9 @@ public class User extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "user.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; diff --git a/deps/XenServerJava/src/com/xensource/xenapi/VBD.java b/deps/XenServerJava/src/com/xensource/xenapi/VBD.java index 56e6f4b3d0e..72edf38cf7c 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/VBD.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/VBD.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class VBD extends XenAPIObject { * For internal use only. */ VBD(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class VBD extends XenAPIObject { { if (obj != null && obj instanceof VBD) { - VBD other = (VBD)obj; + VBD other = (VBD) obj; return other.ref.equals(this.ref); } else { @@ -127,8 +128,8 @@ public class VBD extends XenAPIObject { /** * Convert a VBD.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("allowed_operations", this.allowedOperations == null ? new LinkedHashSet() : this.allowedOperations); map.put("current_operations", this.currentOperations == null ? new HashMap() : this.currentOperations); @@ -250,15 +251,15 @@ public class VBD extends XenAPIObject { * @return all fields from the object */ public VBD.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVBDRecord(result); + return Types.toVBDRecord(result); } /** @@ -268,15 +269,15 @@ public class VBD extends XenAPIObject { * @return reference to the object */ public static VBD getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVBD(result); + return Types.toVBD(result); } /** @@ -286,9 +287,9 @@ public class VBD extends XenAPIObject { * @return Task */ public static Task createAsync(Connection c, VBD.Record record) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VBD.create"; String session = c.getSessionReference(); Map record_map = record.toMap(); @@ -305,16 +306,16 @@ public class VBD extends XenAPIObject { * @return reference to the newly created object */ public static VBD create(Connection c, VBD.Record record) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.create"; String session = c.getSessionReference(); Map record_map = record.toMap(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVBD(result); + return Types.toVBD(result); } /** @@ -323,9 +324,9 @@ public class VBD extends XenAPIObject { * @return Task */ public Task destroyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VBD.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -339,9 +340,9 @@ public class VBD extends XenAPIObject { * */ public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -355,15 +356,15 @@ public class VBD extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -372,15 +373,15 @@ public class VBD extends XenAPIObject { * @return value of the field */ public Set getAllowedOperations(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.get_allowed_operations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVbdOperations(result); + return Types.toSetOfVbdOperations(result); } /** @@ -389,15 +390,15 @@ public class VBD extends XenAPIObject { * @return value of the field */ public Map getCurrentOperations(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.get_current_operations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringVbdOperations(result); + return Types.toMapOfStringVbdOperations(result); } /** @@ -406,15 +407,15 @@ public class VBD extends XenAPIObject { * @return value of the field */ public VM getVM(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.get_VM"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVM(result); + return Types.toVM(result); } /** @@ -423,15 +424,15 @@ public class VBD extends XenAPIObject { * @return value of the field */ public VDI getVDI(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.get_VDI"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVDI(result); + return Types.toVDI(result); } /** @@ -440,15 +441,15 @@ public class VBD extends XenAPIObject { * @return value of the field */ public String getDevice(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.get_device"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -457,15 +458,15 @@ public class VBD extends XenAPIObject { * @return value of the field */ public String getUserdevice(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.get_userdevice"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -474,15 +475,15 @@ public class VBD extends XenAPIObject { * @return value of the field */ public Boolean getBootable(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.get_bootable"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -491,15 +492,15 @@ public class VBD extends XenAPIObject { * @return value of the field */ public Types.VbdMode getMode(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.get_mode"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVbdMode(result); + return Types.toVbdMode(result); } /** @@ -508,15 +509,15 @@ public class VBD extends XenAPIObject { * @return value of the field */ public Types.VbdType getType(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.get_type"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVbdType(result); + return Types.toVbdType(result); } /** @@ -525,15 +526,15 @@ public class VBD extends XenAPIObject { * @return value of the field */ public Boolean getUnpluggable(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.get_unpluggable"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -542,15 +543,15 @@ public class VBD extends XenAPIObject { * @return value of the field */ public Boolean getStorageLock(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.get_storage_lock"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -559,15 +560,15 @@ public class VBD extends XenAPIObject { * @return value of the field */ public Boolean getEmpty(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.get_empty"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -576,15 +577,15 @@ public class VBD extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -593,15 +594,15 @@ public class VBD extends XenAPIObject { * @return value of the field */ public Boolean getCurrentlyAttached(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.get_currently_attached"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -610,15 +611,15 @@ public class VBD extends XenAPIObject { * @return value of the field */ public Long getStatusCode(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.get_status_code"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -627,15 +628,15 @@ public class VBD extends XenAPIObject { * @return value of the field */ public String getStatusDetail(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.get_status_detail"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -644,15 +645,15 @@ public class VBD extends XenAPIObject { * @return value of the field */ public Map getRuntimeProperties(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.get_runtime_properties"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -661,15 +662,15 @@ public class VBD extends XenAPIObject { * @return value of the field */ public String getQosAlgorithmType(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.get_qos_algorithm_type"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -678,15 +679,15 @@ public class VBD extends XenAPIObject { * @return value of the field */ public Map getQosAlgorithmParams(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.get_qos_algorithm_params"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -695,15 +696,15 @@ public class VBD extends XenAPIObject { * @return value of the field */ public Set getQosSupportedAlgorithms(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.get_qos_supported_algorithms"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -712,15 +713,15 @@ public class VBD extends XenAPIObject { * @return value of the field */ public VBDMetrics getMetrics(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.get_metrics"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVBDMetrics(result); + return Types.toVBDMetrics(result); } /** @@ -729,9 +730,9 @@ public class VBD extends XenAPIObject { * @param userdevice New value to set */ public void setUserdevice(Connection c, String userdevice) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.set_userdevice"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(userdevice)}; @@ -745,9 +746,9 @@ public class VBD extends XenAPIObject { * @param bootable New value to set */ public void setBootable(Connection c, Boolean bootable) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.set_bootable"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(bootable)}; @@ -761,9 +762,9 @@ public class VBD extends XenAPIObject { * @param mode New value to set */ public void setMode(Connection c, Types.VbdMode mode) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.set_mode"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(mode)}; @@ -777,9 +778,9 @@ public class VBD extends XenAPIObject { * @param type New value to set */ public void setType(Connection c, Types.VbdType type) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.set_type"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(type)}; @@ -793,9 +794,9 @@ public class VBD extends XenAPIObject { * @param unpluggable New value to set */ public void setUnpluggable(Connection c, Boolean unpluggable) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.set_unpluggable"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(unpluggable)}; @@ -809,9 +810,9 @@ public class VBD extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -826,9 +827,9 @@ public class VBD extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -842,9 +843,9 @@ public class VBD extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -858,9 +859,9 @@ public class VBD extends XenAPIObject { * @param algorithmType New value to set */ public void setQosAlgorithmType(Connection c, String algorithmType) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.set_qos_algorithm_type"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(algorithmType)}; @@ -874,9 +875,9 @@ public class VBD extends XenAPIObject { * @param algorithmParams New value to set */ public void setQosAlgorithmParams(Connection c, Map algorithmParams) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.set_qos_algorithm_params"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(algorithmParams)}; @@ -891,9 +892,9 @@ public class VBD extends XenAPIObject { * @param value Value to add */ public void addToQosAlgorithmParams(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.add_to_qos_algorithm_params"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -907,9 +908,9 @@ public class VBD extends XenAPIObject { * @param key Key to remove */ public void removeFromQosAlgorithmParams(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.remove_from_qos_algorithm_params"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -923,11 +924,11 @@ public class VBD extends XenAPIObject { * @return Task */ public Task ejectAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VbdNotRemovableMedia, - Types.VbdIsEmpty { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VbdNotRemovableMedia, + Types.VbdIsEmpty { String method_call = "Async.VBD.eject"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -941,11 +942,11 @@ public class VBD extends XenAPIObject { * */ public void eject(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VbdNotRemovableMedia, - Types.VbdIsEmpty { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VbdNotRemovableMedia, + Types.VbdIsEmpty { String method_call = "VBD.eject"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -960,11 +961,11 @@ public class VBD extends XenAPIObject { * @return Task */ public Task insertAsync(Connection c, VDI vdi) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VbdNotRemovableMedia, - Types.VbdNotEmpty { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VbdNotRemovableMedia, + Types.VbdNotEmpty { String method_call = "Async.VBD.insert"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(vdi)}; @@ -979,11 +980,11 @@ public class VBD extends XenAPIObject { * @param vdi The new VDI to 'insert' */ public void insert(Connection c, VDI vdi) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VbdNotRemovableMedia, - Types.VbdNotEmpty { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VbdNotRemovableMedia, + Types.VbdNotEmpty { String method_call = "VBD.insert"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(vdi)}; @@ -997,9 +998,9 @@ public class VBD extends XenAPIObject { * @return Task */ public Task plugAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VBD.plug"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1013,9 +1014,9 @@ public class VBD extends XenAPIObject { * */ public void plug(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.plug"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1029,11 +1030,11 @@ public class VBD extends XenAPIObject { * @return Task */ public Task unplugAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.DeviceDetachRejected, - Types.DeviceAlreadyDetached { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.DeviceDetachRejected, + Types.DeviceAlreadyDetached { String method_call = "Async.VBD.unplug"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1047,11 +1048,11 @@ public class VBD extends XenAPIObject { * */ public void unplug(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.DeviceDetachRejected, - Types.DeviceAlreadyDetached { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.DeviceDetachRejected, + Types.DeviceAlreadyDetached { String method_call = "VBD.unplug"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1065,9 +1066,9 @@ public class VBD extends XenAPIObject { * @return Task */ public Task unplugForceAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VBD.unplug_force"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1081,9 +1082,9 @@ public class VBD extends XenAPIObject { * */ public void unplugForce(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.unplug_force"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1097,9 +1098,9 @@ public class VBD extends XenAPIObject { * @return Task */ public Task assertAttachableAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VBD.assert_attachable"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1113,9 +1114,9 @@ public class VBD extends XenAPIObject { * */ public void assertAttachable(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.assert_attachable"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1129,15 +1130,15 @@ public class VBD extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVBD(result); + return Types.toSetOfVBD(result); } /** @@ -1146,15 +1147,15 @@ public class VBD extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfVBDVBDRecord(result); + return Types.toMapOfVBDVBDRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/VBDMetrics.java b/deps/XenServerJava/src/com/xensource/xenapi/VBDMetrics.java index 1f678faecdb..a58e5e0e614 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/VBDMetrics.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/VBDMetrics.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class VBDMetrics extends XenAPIObject { * For internal use only. */ VBDMetrics(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class VBDMetrics extends XenAPIObject { { if (obj != null && obj instanceof VBDMetrics) { - VBDMetrics other = (VBDMetrics)obj; + VBDMetrics other = (VBDMetrics) obj; return other.ref.equals(this.ref); } else { @@ -110,8 +111,8 @@ public class VBDMetrics extends XenAPIObject { /** * Convert a VBD_metrics.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("io_read_kbs", this.ioReadKbs == null ? 0.0 : this.ioReadKbs); map.put("io_write_kbs", this.ioWriteKbs == null ? 0.0 : this.ioWriteKbs); @@ -148,15 +149,15 @@ public class VBDMetrics extends XenAPIObject { * @return all fields from the object */ public VBDMetrics.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD_metrics.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVBDMetricsRecord(result); + return Types.toVBDMetricsRecord(result); } /** @@ -166,15 +167,15 @@ public class VBDMetrics extends XenAPIObject { * @return reference to the object */ public static VBDMetrics getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD_metrics.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVBDMetrics(result); + return Types.toVBDMetrics(result); } /** @@ -183,15 +184,15 @@ public class VBDMetrics extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD_metrics.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -200,15 +201,15 @@ public class VBDMetrics extends XenAPIObject { * @return value of the field */ public Double getIoReadKbs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD_metrics.get_io_read_kbs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDouble(result); + return Types.toDouble(result); } /** @@ -217,15 +218,15 @@ public class VBDMetrics extends XenAPIObject { * @return value of the field */ public Double getIoWriteKbs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD_metrics.get_io_write_kbs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDouble(result); + return Types.toDouble(result); } /** @@ -234,15 +235,15 @@ public class VBDMetrics extends XenAPIObject { * @return value of the field */ public Date getLastUpdated(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD_metrics.get_last_updated"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDate(result); + return Types.toDate(result); } /** @@ -251,15 +252,15 @@ public class VBDMetrics extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD_metrics.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -268,9 +269,9 @@ public class VBDMetrics extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD_metrics.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -285,9 +286,9 @@ public class VBDMetrics extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD_metrics.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -301,9 +302,9 @@ public class VBDMetrics extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD_metrics.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -317,15 +318,15 @@ public class VBDMetrics extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD_metrics.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVBDMetrics(result); + return Types.toSetOfVBDMetrics(result); } /** @@ -334,15 +335,15 @@ public class VBDMetrics extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VBD_metrics.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfVBDMetricsVBDMetricsRecord(result); + return Types.toMapOfVBDMetricsVBDMetricsRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/VDI.java b/deps/XenServerJava/src/com/xensource/xenapi/VDI.java index 992a6a6d898..1431ce04a80 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/VDI.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/VDI.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class VDI extends XenAPIObject { * For internal use only. */ VDI(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class VDI extends XenAPIObject { { if (obj != null && obj instanceof VDI) { - VDI other = (VDI)obj; + VDI other = (VDI) obj; return other.ref.equals(this.ref); } else { @@ -135,8 +136,8 @@ public class VDI extends XenAPIObject { /** * Convert a VDI.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("name_label", this.nameLabel == null ? "" : this.nameLabel); map.put("name_description", this.nameDescription == null ? "" : this.nameDescription); @@ -235,7 +236,7 @@ public class VDI extends XenAPIObject { */ public String location; /** - * + * */ public Boolean managed; /** @@ -298,15 +299,15 @@ public class VDI extends XenAPIObject { * @return all fields from the object */ public VDI.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVDIRecord(result); + return Types.toVDIRecord(result); } /** @@ -316,15 +317,15 @@ public class VDI extends XenAPIObject { * @return reference to the object */ public static VDI getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVDI(result); + return Types.toVDI(result); } /** @@ -334,9 +335,9 @@ public class VDI extends XenAPIObject { * @return Task */ public static Task createAsync(Connection c, VDI.Record record) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VDI.create"; String session = c.getSessionReference(); Map record_map = record.toMap(); @@ -353,16 +354,16 @@ public class VDI extends XenAPIObject { * @return reference to the newly created object */ public static VDI create(Connection c, VDI.Record record) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.create"; String session = c.getSessionReference(); Map record_map = record.toMap(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVDI(result); + return Types.toVDI(result); } /** @@ -371,9 +372,9 @@ public class VDI extends XenAPIObject { * @return Task */ public Task destroyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VDI.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -387,9 +388,9 @@ public class VDI extends XenAPIObject { * */ public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -404,15 +405,15 @@ public class VDI extends XenAPIObject { * @return references to objects with matching names */ public static Set getByNameLabel(Connection c, String label) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_by_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVDI(result); + return Types.toSetOfVDI(result); } /** @@ -421,15 +422,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -438,15 +439,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public String getNameLabel(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -455,15 +456,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public String getNameDescription(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -472,15 +473,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public Set getAllowedOperations(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_allowed_operations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVdiOperations(result); + return Types.toSetOfVdiOperations(result); } /** @@ -489,15 +490,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public Map getCurrentOperations(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_current_operations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringVdiOperations(result); + return Types.toMapOfStringVdiOperations(result); } /** @@ -506,15 +507,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public SR getSR(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_SR"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSR(result); + return Types.toSR(result); } /** @@ -523,15 +524,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public Set getVBDs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_VBDs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVBD(result); + return Types.toSetOfVBD(result); } /** @@ -540,15 +541,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public Set getCrashDumps(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_crash_dumps"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfCrashdump(result); + return Types.toSetOfCrashdump(result); } /** @@ -557,15 +558,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public Long getVirtualSize(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_virtual_size"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -574,15 +575,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public Long getPhysicalUtilisation(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_physical_utilisation"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -591,15 +592,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public Types.VdiType getType(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_type"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVdiType(result); + return Types.toVdiType(result); } /** @@ -608,15 +609,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public Boolean getSharable(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_sharable"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -625,15 +626,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public Boolean getReadOnly(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_read_only"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -642,15 +643,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -659,15 +660,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public Boolean getStorageLock(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_storage_lock"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -676,15 +677,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public String getLocation(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_location"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -693,15 +694,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public Boolean getManaged(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_managed"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -710,15 +711,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public Boolean getMissing(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_missing"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -727,15 +728,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public VDI getParent(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_parent"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVDI(result); + return Types.toVDI(result); } /** @@ -744,15 +745,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public Map getXenstoreData(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_xenstore_data"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -761,15 +762,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public Map getSmConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_sm_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -778,15 +779,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public Boolean getIsASnapshot(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_is_a_snapshot"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -795,15 +796,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public VDI getSnapshotOf(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_snapshot_of"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVDI(result); + return Types.toVDI(result); } /** @@ -812,15 +813,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public Set getSnapshots(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_snapshots"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVDI(result); + return Types.toSetOfVDI(result); } /** @@ -829,15 +830,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public Date getSnapshotTime(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_snapshot_time"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDate(result); + return Types.toDate(result); } /** @@ -846,15 +847,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public Set getTags(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_tags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -863,15 +864,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public Boolean getAllowCaching(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_allow_caching"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -880,15 +881,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public Types.OnBoot getOnBoot(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_on_boot"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toOnBoot(result); + return Types.toOnBoot(result); } /** @@ -897,15 +898,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public Pool getMetadataOfPool(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_metadata_of_pool"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPool(result); + return Types.toPool(result); } /** @@ -914,15 +915,15 @@ public class VDI extends XenAPIObject { * @return value of the field */ public Boolean getMetadataLatest(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_metadata_latest"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -931,9 +932,9 @@ public class VDI extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -948,9 +949,9 @@ public class VDI extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -964,9 +965,9 @@ public class VDI extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -980,9 +981,9 @@ public class VDI extends XenAPIObject { * @param xenstoreData New value to set */ public void setXenstoreData(Connection c, Map xenstoreData) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.set_xenstore_data"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(xenstoreData)}; @@ -997,9 +998,9 @@ public class VDI extends XenAPIObject { * @param value Value to add */ public void addToXenstoreData(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.add_to_xenstore_data"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -1013,9 +1014,9 @@ public class VDI extends XenAPIObject { * @param key Key to remove */ public void removeFromXenstoreData(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.remove_from_xenstore_data"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -1029,9 +1030,9 @@ public class VDI extends XenAPIObject { * @param smConfig New value to set */ public void setSmConfig(Connection c, Map smConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.set_sm_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(smConfig)}; @@ -1046,9 +1047,9 @@ public class VDI extends XenAPIObject { * @param value Value to add */ public void addToSmConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.add_to_sm_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -1062,9 +1063,9 @@ public class VDI extends XenAPIObject { * @param key Key to remove */ public void removeFromSmConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.remove_from_sm_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -1078,9 +1079,9 @@ public class VDI extends XenAPIObject { * @param tags New value to set */ public void setTags(Connection c, Set tags) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.set_tags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(tags)}; @@ -1094,9 +1095,9 @@ public class VDI extends XenAPIObject { * @param value New value to add */ public void addTags(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.add_tags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1110,9 +1111,9 @@ public class VDI extends XenAPIObject { * @param value Value to remove */ public void removeTags(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.remove_tags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1127,38 +1128,9 @@ public class VDI extends XenAPIObject { * @return Task */ public Task snapshotAsync(Connection c, Map driverParams) throws - BadServerResponse, - VersionException, - XenAPIException, - XmlRpcException { - - if (c.rioConnection) { - if (driverParams.isEmpty()) { - return rioSnapshotAsync(c); - } else { - throw new Types.VersionException("driverParams parameter must be empty map for Rio (legacy XenServer) host"); - } - } else { - return miamiSnapshotAsync(c, driverParams); - } - } - - private Task rioSnapshotAsync(Connection c) throws - BadServerResponse, - XmlRpcException, - XenAPIException { - String method_call = "Async.VDI.snapshot"; - String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; - Map response = c.dispatch(method_call, method_params); - Object result = response.get("Value"); - return Types.toTask(result); - } - - private Task miamiSnapshotAsync(Connection c, Map driverParams) throws - BadServerResponse, - XmlRpcException, - XenAPIException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VDI.snapshot"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(driverParams)}; @@ -1174,44 +1146,15 @@ public class VDI extends XenAPIObject { * @return The ID of the newly created VDI. */ public VDI snapshot(Connection c, Map driverParams) throws - BadServerResponse, - VersionException, - XenAPIException, - XmlRpcException { - - if (c.rioConnection) { - if (driverParams.isEmpty()) { - return rioSnapshot(c); - } else { - throw new Types.VersionException("driverParams parameter must be empty map for Rio (legacy XenServer) host"); - } - } else { - return miamiSnapshot(c, driverParams); - } - } - - private VDI rioSnapshot(Connection c) throws - BadServerResponse, - XmlRpcException, - XenAPIException { - String method_call = "VDI.snapshot"; - String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; - Map response = c.dispatch(method_call, method_params); - Object result = response.get("Value"); - return Types.toVDI(result); - } - - private VDI miamiSnapshot(Connection c, Map driverParams) throws - BadServerResponse, - XmlRpcException, - XenAPIException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.snapshot"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(driverParams)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVDI(result); + return Types.toVDI(result); } /** @@ -1221,38 +1164,9 @@ public class VDI extends XenAPIObject { * @return Task */ public Task createCloneAsync(Connection c, Map driverParams) throws - BadServerResponse, - VersionException, - XenAPIException, - XmlRpcException { - - if (c.rioConnection) { - if (driverParams.isEmpty()) { - return rioCreateCloneAsync(c); - } else { - throw new Types.VersionException("driverParams parameter must be empty map for Rio (legacy XenServer) host"); - } - } else { - return miamiCreateCloneAsync(c, driverParams); - } - } - - private Task rioCreateCloneAsync(Connection c) throws - BadServerResponse, - XmlRpcException, - XenAPIException { - String method_call = "Async.VDI.clone"; - String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; - Map response = c.dispatch(method_call, method_params); - Object result = response.get("Value"); - return Types.toTask(result); - } - - private Task miamiCreateCloneAsync(Connection c, Map driverParams) throws - BadServerResponse, - XmlRpcException, - XenAPIException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VDI.clone"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(driverParams)}; @@ -1268,44 +1182,15 @@ public class VDI extends XenAPIObject { * @return The ID of the newly created VDI. */ public VDI createClone(Connection c, Map driverParams) throws - BadServerResponse, - VersionException, - XenAPIException, - XmlRpcException { - - if (c.rioConnection) { - if (driverParams.isEmpty()) { - return rioCreateClone(c); - } else { - throw new Types.VersionException("driverParams parameter must be empty map for Rio (legacy XenServer) host"); - } - } else { - return miamiCreateClone(c, driverParams); - } - } - - private VDI rioCreateClone(Connection c) throws - BadServerResponse, - XmlRpcException, - XenAPIException { - String method_call = "VDI.clone"; - String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; - Map response = c.dispatch(method_call, method_params); - Object result = response.get("Value"); - return Types.toVDI(result); - } - - private VDI miamiCreateClone(Connection c, Map driverParams) throws - BadServerResponse, - XmlRpcException, - XenAPIException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.clone"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(driverParams)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVDI(result); + return Types.toVDI(result); } /** @@ -1315,9 +1200,9 @@ public class VDI extends XenAPIObject { * @return Task */ public Task resizeAsync(Connection c, Long size) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VDI.resize"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(size)}; @@ -1332,9 +1217,9 @@ public class VDI extends XenAPIObject { * @param size The new size of the VDI */ public void resize(Connection c, Long size) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.resize"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(size)}; @@ -1349,9 +1234,9 @@ public class VDI extends XenAPIObject { * @return Task */ public Task resizeOnlineAsync(Connection c, Long size) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VDI.resize_online"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(size)}; @@ -1366,9 +1251,9 @@ public class VDI extends XenAPIObject { * @param size The new size of the VDI */ public void resizeOnline(Connection c, Long size) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.resize_online"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(size)}; @@ -1399,20 +1284,14 @@ public class VDI extends XenAPIObject { * @param snapshotOf Storage-specific config * @return Task */ - public static Task introduceAsync(Connection c, String uuid, String nameLabel, String nameDescription, SR SR, Types.VdiType type, Boolean sharable, Boolean readOnly, - Map otherConfig, String location, Map xenstoreData, Map smConfig, Boolean managed, Long virtualSize, - Long physicalUtilisation, Pool metadataOfPool, Boolean isASnapshot, Date snapshotTime, VDI snapshotOf) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.SrOperationNotSupported { + public static Task introduceAsync(Connection c, String uuid, String nameLabel, String nameDescription, SR SR, Types.VdiType type, Boolean sharable, Boolean readOnly, Map otherConfig, String location, Map xenstoreData, Map smConfig, Boolean managed, Long virtualSize, Long physicalUtilisation, Pool metadataOfPool, Boolean isASnapshot, Date snapshotTime, VDI snapshotOf) throws + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.SrOperationNotSupported { String method_call = "Async.VDI.introduce"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), - Marshalling.toXMLRPC(SR), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(sharable), Marshalling.toXMLRPC(readOnly), Marshalling.toXMLRPC(otherConfig), - Marshalling.toXMLRPC(location), Marshalling.toXMLRPC(xenstoreData), Marshalling.toXMLRPC(smConfig), Marshalling.toXMLRPC(managed), - Marshalling.toXMLRPC(virtualSize), Marshalling.toXMLRPC(physicalUtilisation), Marshalling.toXMLRPC(metadataOfPool), Marshalling.toXMLRPC(isASnapshot), - Marshalling.toXMLRPC(snapshotTime), Marshalling.toXMLRPC(snapshotOf)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(SR), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(sharable), Marshalling.toXMLRPC(readOnly), Marshalling.toXMLRPC(otherConfig), Marshalling.toXMLRPC(location), Marshalling.toXMLRPC(xenstoreData), Marshalling.toXMLRPC(smConfig), Marshalling.toXMLRPC(managed), Marshalling.toXMLRPC(virtualSize), Marshalling.toXMLRPC(physicalUtilisation), Marshalling.toXMLRPC(metadataOfPool), Marshalling.toXMLRPC(isASnapshot), Marshalling.toXMLRPC(snapshotTime), Marshalling.toXMLRPC(snapshotOf)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -1441,23 +1320,17 @@ public class VDI extends XenAPIObject { * @param snapshotOf Storage-specific config * @return The ref of the newly created VDI record. */ - public static VDI introduce(Connection c, String uuid, String nameLabel, String nameDescription, SR SR, Types.VdiType type, Boolean sharable, Boolean readOnly, - Map otherConfig, String location, Map xenstoreData, Map smConfig, Boolean managed, Long virtualSize, - Long physicalUtilisation, Pool metadataOfPool, Boolean isASnapshot, Date snapshotTime, VDI snapshotOf) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.SrOperationNotSupported { + public static VDI introduce(Connection c, String uuid, String nameLabel, String nameDescription, SR SR, Types.VdiType type, Boolean sharable, Boolean readOnly, Map otherConfig, String location, Map xenstoreData, Map smConfig, Boolean managed, Long virtualSize, Long physicalUtilisation, Pool metadataOfPool, Boolean isASnapshot, Date snapshotTime, VDI snapshotOf) throws + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.SrOperationNotSupported { String method_call = "VDI.introduce"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), - Marshalling.toXMLRPC(SR), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(sharable), Marshalling.toXMLRPC(readOnly), Marshalling.toXMLRPC(otherConfig), - Marshalling.toXMLRPC(location), Marshalling.toXMLRPC(xenstoreData), Marshalling.toXMLRPC(smConfig), Marshalling.toXMLRPC(managed), - Marshalling.toXMLRPC(virtualSize), Marshalling.toXMLRPC(physicalUtilisation), Marshalling.toXMLRPC(metadataOfPool), Marshalling.toXMLRPC(isASnapshot), - Marshalling.toXMLRPC(snapshotTime), Marshalling.toXMLRPC(snapshotOf)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(SR), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(sharable), Marshalling.toXMLRPC(readOnly), Marshalling.toXMLRPC(otherConfig), Marshalling.toXMLRPC(location), Marshalling.toXMLRPC(xenstoreData), Marshalling.toXMLRPC(smConfig), Marshalling.toXMLRPC(managed), Marshalling.toXMLRPC(virtualSize), Marshalling.toXMLRPC(physicalUtilisation), Marshalling.toXMLRPC(metadataOfPool), Marshalling.toXMLRPC(isASnapshot), Marshalling.toXMLRPC(snapshotTime), Marshalling.toXMLRPC(snapshotOf)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVDI(result); + return Types.toVDI(result); } /** @@ -1483,19 +1356,13 @@ public class VDI extends XenAPIObject { * @param snapshotOf Storage-specific config * @return Task */ - public static Task dbIntroduceAsync(Connection c, String uuid, String nameLabel, String nameDescription, SR SR, Types.VdiType type, Boolean sharable, - Boolean readOnly, Map otherConfig, String location, Map xenstoreData, Map smConfig, Boolean managed, - Long virtualSize, Long physicalUtilisation, Pool metadataOfPool, Boolean isASnapshot, Date snapshotTime, VDI snapshotOf) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + public static Task dbIntroduceAsync(Connection c, String uuid, String nameLabel, String nameDescription, SR SR, Types.VdiType type, Boolean sharable, Boolean readOnly, Map otherConfig, String location, Map xenstoreData, Map smConfig, Boolean managed, Long virtualSize, Long physicalUtilisation, Pool metadataOfPool, Boolean isASnapshot, Date snapshotTime, VDI snapshotOf) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VDI.db_introduce"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), - Marshalling.toXMLRPC(SR), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(sharable), Marshalling.toXMLRPC(readOnly), Marshalling.toXMLRPC(otherConfig), - Marshalling.toXMLRPC(location), Marshalling.toXMLRPC(xenstoreData), Marshalling.toXMLRPC(smConfig), Marshalling.toXMLRPC(managed), - Marshalling.toXMLRPC(virtualSize), Marshalling.toXMLRPC(physicalUtilisation), Marshalling.toXMLRPC(metadataOfPool), Marshalling.toXMLRPC(isASnapshot), - Marshalling.toXMLRPC(snapshotTime), Marshalling.toXMLRPC(snapshotOf)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(SR), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(sharable), Marshalling.toXMLRPC(readOnly), Marshalling.toXMLRPC(otherConfig), Marshalling.toXMLRPC(location), Marshalling.toXMLRPC(xenstoreData), Marshalling.toXMLRPC(smConfig), Marshalling.toXMLRPC(managed), Marshalling.toXMLRPC(virtualSize), Marshalling.toXMLRPC(physicalUtilisation), Marshalling.toXMLRPC(metadataOfPool), Marshalling.toXMLRPC(isASnapshot), Marshalling.toXMLRPC(snapshotTime), Marshalling.toXMLRPC(snapshotOf)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -1524,22 +1391,16 @@ public class VDI extends XenAPIObject { * @param snapshotOf Storage-specific config * @return The ref of the newly created VDI record. */ - public static VDI dbIntroduce(Connection c, String uuid, String nameLabel, String nameDescription, SR SR, Types.VdiType type, Boolean sharable, Boolean readOnly, - Map otherConfig, String location, Map xenstoreData, Map smConfig, Boolean managed, Long virtualSize, - Long physicalUtilisation, Pool metadataOfPool, Boolean isASnapshot, Date snapshotTime, VDI snapshotOf) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + public static VDI dbIntroduce(Connection c, String uuid, String nameLabel, String nameDescription, SR SR, Types.VdiType type, Boolean sharable, Boolean readOnly, Map otherConfig, String location, Map xenstoreData, Map smConfig, Boolean managed, Long virtualSize, Long physicalUtilisation, Pool metadataOfPool, Boolean isASnapshot, Date snapshotTime, VDI snapshotOf) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.db_introduce"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), - Marshalling.toXMLRPC(SR), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(sharable), Marshalling.toXMLRPC(readOnly), Marshalling.toXMLRPC(otherConfig), - Marshalling.toXMLRPC(location), Marshalling.toXMLRPC(xenstoreData), Marshalling.toXMLRPC(smConfig), Marshalling.toXMLRPC(managed), - Marshalling.toXMLRPC(virtualSize), Marshalling.toXMLRPC(physicalUtilisation), Marshalling.toXMLRPC(metadataOfPool), Marshalling.toXMLRPC(isASnapshot), - Marshalling.toXMLRPC(snapshotTime), Marshalling.toXMLRPC(snapshotOf)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(SR), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(sharable), Marshalling.toXMLRPC(readOnly), Marshalling.toXMLRPC(otherConfig), Marshalling.toXMLRPC(location), Marshalling.toXMLRPC(xenstoreData), Marshalling.toXMLRPC(smConfig), Marshalling.toXMLRPC(managed), Marshalling.toXMLRPC(virtualSize), Marshalling.toXMLRPC(physicalUtilisation), Marshalling.toXMLRPC(metadataOfPool), Marshalling.toXMLRPC(isASnapshot), Marshalling.toXMLRPC(snapshotTime), Marshalling.toXMLRPC(snapshotOf)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVDI(result); + return Types.toVDI(result); } /** @@ -1548,9 +1409,9 @@ public class VDI extends XenAPIObject { * @return Task */ public Task dbForgetAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VDI.db_forget"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1564,9 +1425,9 @@ public class VDI extends XenAPIObject { * */ public void dbForget(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.db_forget"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1580,10 +1441,10 @@ public class VDI extends XenAPIObject { * @return Task */ public Task updateAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.SrOperationNotSupported { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.SrOperationNotSupported { String method_call = "Async.VDI.update"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1597,10 +1458,10 @@ public class VDI extends XenAPIObject { * */ public void update(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.SrOperationNotSupported { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.SrOperationNotSupported { String method_call = "VDI.update"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1617,12 +1478,10 @@ public class VDI extends XenAPIObject { * @return Task */ public Task copyAsync2(Connection c, SR sr, VDI baseVdi, VDI intoVdi) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VdiReadonly, - Types.VdiTooSmall, - Types.VdiNotSparse { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VdiReadonly { String method_call = "Async.VDI.copy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(sr), Marshalling.toXMLRPC(baseVdi), Marshalling.toXMLRPC(intoVdi)}; @@ -1638,9 +1497,9 @@ public class VDI extends XenAPIObject { * @return Task */ public Task copyAsync(Connection c, SR sr) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VDI.copy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(sr)}; @@ -1656,15 +1515,15 @@ public class VDI extends XenAPIObject { * @return The reference of the newly created VDI. */ public VDI copy(Connection c, SR sr) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.copy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(sr)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVDI(result); + return Types.toVDI(result); } /** @@ -1673,9 +1532,9 @@ public class VDI extends XenAPIObject { * @param value The new value of the VDI's managed field */ public void setManaged(Connection c, Boolean value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.set_managed"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1689,9 +1548,9 @@ public class VDI extends XenAPIObject { * @return Task */ public Task forgetAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VDI.forget"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1705,9 +1564,9 @@ public class VDI extends XenAPIObject { * */ public void forget(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.forget"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -1721,9 +1580,9 @@ public class VDI extends XenAPIObject { * @param value The new value of the VDI's sharable field */ public void setSharable(Connection c, Boolean value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.set_sharable"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1737,9 +1596,9 @@ public class VDI extends XenAPIObject { * @param value The new value of the VDI's read_only field */ public void setReadOnly(Connection c, Boolean value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.set_read_only"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1753,9 +1612,9 @@ public class VDI extends XenAPIObject { * @param value The new value of the VDI's missing field */ public void setMissing(Connection c, Boolean value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.set_missing"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1769,9 +1628,9 @@ public class VDI extends XenAPIObject { * @param value The new value of the VDI's virtual size */ public void setVirtualSize(Connection c, Long value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.set_virtual_size"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1785,9 +1644,9 @@ public class VDI extends XenAPIObject { * @param value The new value of the VDI's physical utilisation */ public void setPhysicalUtilisation(Connection c, Long value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.set_physical_utilisation"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1801,9 +1660,9 @@ public class VDI extends XenAPIObject { * @param value The new value indicating whether this VDI is a snapshot */ public void setIsASnapshot(Connection c, Boolean value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.set_is_a_snapshot"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1817,9 +1676,9 @@ public class VDI extends XenAPIObject { * @param value The VDI of which this VDI is a snapshot */ public void setSnapshotOf(Connection c, VDI value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.set_snapshot_of"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1833,9 +1692,9 @@ public class VDI extends XenAPIObject { * @param value The snapshot time of this VDI. */ public void setSnapshotTime(Connection c, Date value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.set_snapshot_time"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1849,9 +1708,9 @@ public class VDI extends XenAPIObject { * @param value The pool whose metadata is contained by this VDI */ public void setMetadataOfPool(Connection c, Pool value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.set_metadata_of_pool"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1866,9 +1725,9 @@ public class VDI extends XenAPIObject { * @return Task */ public Task setNameLabelAsync(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VDI.set_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1883,9 +1742,9 @@ public class VDI extends XenAPIObject { * @param value The name lable for the VDI */ public void setNameLabel(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.set_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1900,9 +1759,9 @@ public class VDI extends XenAPIObject { * @return Task */ public Task setNameDescriptionAsync(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VDI.set_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1917,9 +1776,9 @@ public class VDI extends XenAPIObject { * @param value The name description for the VDI */ public void setNameDescription(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.set_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1934,9 +1793,9 @@ public class VDI extends XenAPIObject { * @return Task */ public Task setOnBootAsync(Connection c, Types.OnBoot value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VDI.set_on_boot"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1951,9 +1810,9 @@ public class VDI extends XenAPIObject { * @param value The value to set */ public void setOnBoot(Connection c, Types.OnBoot value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.set_on_boot"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1968,9 +1827,9 @@ public class VDI extends XenAPIObject { * @return Task */ public Task setAllowCachingAsync(Connection c, Boolean value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VDI.set_allow_caching"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1985,9 +1844,9 @@ public class VDI extends XenAPIObject { * @param value The value to set */ public void setAllowCaching(Connection c, Boolean value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.set_allow_caching"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -2001,9 +1860,9 @@ public class VDI extends XenAPIObject { * @return Task */ public Task openDatabaseAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VDI.open_database"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2018,15 +1877,15 @@ public class VDI extends XenAPIObject { * @return A session which can be used to query the database */ public Session openDatabase(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.open_database"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSession(result); + return Types.toSession(result); } /** @@ -2035,9 +1894,9 @@ public class VDI extends XenAPIObject { * @return Task */ public Task readDatabasePoolUuidAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VDI.read_database_pool_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2052,15 +1911,15 @@ public class VDI extends XenAPIObject { * @return The cached pool UUID of the database on the VDI. */ public String readDatabasePoolUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.read_database_pool_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -2071,9 +1930,9 @@ public class VDI extends XenAPIObject { * @return Task */ public Task poolMigrateAsync(Connection c, SR sr, Map options) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VDI.pool_migrate"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(sr), Marshalling.toXMLRPC(options)}; @@ -2090,15 +1949,15 @@ public class VDI extends XenAPIObject { * @return The new reference of the migrated VDI. */ public VDI poolMigrate(Connection c, SR sr, Map options) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.pool_migrate"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(sr), Marshalling.toXMLRPC(options)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVDI(result); + return Types.toVDI(result); } /** @@ -2107,15 +1966,15 @@ public class VDI extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVDI(result); + return Types.toSetOfVDI(result); } /** @@ -2124,15 +1983,15 @@ public class VDI extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VDI.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfVDIVDIRecord(result); + return Types.toMapOfVDIVDIRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/VGPU.java b/deps/XenServerJava/src/com/xensource/xenapi/VGPU.java index 19c88fd4561..ebd0a64e173 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/VGPU.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/VGPU.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class VGPU extends XenAPIObject { * For internal use only. */ VGPU(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class VGPU extends XenAPIObject { { if (obj != null && obj instanceof VGPU) { - VGPU other = (VGPU)obj; + VGPU other = (VGPU) obj; return other.ref.equals(this.ref); } else { @@ -105,20 +106,24 @@ public class VGPU extends XenAPIObject { print.printf("%1$20s: %2$s\n", "device", this.device); print.printf("%1$20s: %2$s\n", "currentlyAttached", this.currentlyAttached); print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig); + print.printf("%1$20s: %2$s\n", "type", this.type); + print.printf("%1$20s: %2$s\n", "residentOn", this.residentOn); return writer.toString(); } /** * Convert a VGPU.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("VM", this.VM == null ? new VM("OpaqueRef:NULL") : this.VM); map.put("GPU_group", this.GPUGroup == null ? new GPUGroup("OpaqueRef:NULL") : this.GPUGroup); map.put("device", this.device == null ? "" : this.device); map.put("currently_attached", this.currentlyAttached == null ? false : this.currentlyAttached); map.put("other_config", this.otherConfig == null ? new HashMap() : this.otherConfig); + map.put("type", this.type == null ? new VGPUType("OpaqueRef:NULL") : this.type); + map.put("resident_on", this.residentOn == null ? new PGPU("OpaqueRef:NULL") : this.residentOn); return map; } @@ -146,6 +151,14 @@ public class VGPU extends XenAPIObject { * Additional configuration */ public Map otherConfig; + /** + * Preset type for this VGPU + */ + public VGPUType type; + /** + * The PGPU on which this VGPU is running + */ + public PGPU residentOn; } /** @@ -154,15 +167,15 @@ public class VGPU extends XenAPIObject { * @return all fields from the object */ public VGPU.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VGPU.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVGPURecord(result); + return Types.toVGPURecord(result); } /** @@ -172,15 +185,15 @@ public class VGPU extends XenAPIObject { * @return reference to the object */ public static VGPU getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VGPU.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVGPU(result); + return Types.toVGPU(result); } /** @@ -189,15 +202,15 @@ public class VGPU extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VGPU.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -206,15 +219,15 @@ public class VGPU extends XenAPIObject { * @return value of the field */ public VM getVM(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VGPU.get_VM"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVM(result); + return Types.toVM(result); } /** @@ -223,15 +236,15 @@ public class VGPU extends XenAPIObject { * @return value of the field */ public GPUGroup getGPUGroup(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VGPU.get_GPU_group"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toGPUGroup(result); + return Types.toGPUGroup(result); } /** @@ -240,15 +253,15 @@ public class VGPU extends XenAPIObject { * @return value of the field */ public String getDevice(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VGPU.get_device"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -257,15 +270,15 @@ public class VGPU extends XenAPIObject { * @return value of the field */ public Boolean getCurrentlyAttached(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VGPU.get_currently_attached"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -274,15 +287,49 @@ public class VGPU extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VGPU.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); + } + + /** + * Get the type field of the given VGPU. + * + * @return value of the field + */ + public VGPUType getType(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "VGPU.get_type"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toVGPUType(result); + } + + /** + * Get the resident_on field of the given VGPU. + * + * @return value of the field + */ + public PGPU getResidentOn(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "VGPU.get_resident_on"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toPGPU(result); } /** @@ -291,9 +338,9 @@ public class VGPU extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VGPU.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -308,9 +355,9 @@ public class VGPU extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VGPU.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -324,9 +371,9 @@ public class VGPU extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VGPU.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -335,58 +382,58 @@ public class VGPU extends XenAPIObject { } /** + * * - * - * @param VM - * @param GPUGroup - * @param device - * @param otherConfig + * @param VM + * @param GPUGroup + * @param device + * @param otherConfig + * @param type * @return Task */ - public static Task createAsync(Connection c, VM VM, GPUGroup GPUGroup, String device, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + public static Task createAsync(Connection c, VM VM, GPUGroup GPUGroup, String device, Map otherConfig, VGPUType type) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VGPU.create"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(VM), Marshalling.toXMLRPC(GPUGroup), Marshalling.toXMLRPC(device), - Marshalling.toXMLRPC(otherConfig)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(VM), Marshalling.toXMLRPC(GPUGroup), Marshalling.toXMLRPC(device), Marshalling.toXMLRPC(otherConfig), Marshalling.toXMLRPC(type)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); } /** + * * - * - * @param VM - * @param GPUGroup - * @param device - * @param otherConfig + * @param VM + * @param GPUGroup + * @param device + * @param otherConfig + * @param type * @return reference to the newly created object */ - public static VGPU create(Connection c, VM VM, GPUGroup GPUGroup, String device, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + public static VGPU create(Connection c, VM VM, GPUGroup GPUGroup, String device, Map otherConfig, VGPUType type) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VGPU.create"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(VM), Marshalling.toXMLRPC(GPUGroup), Marshalling.toXMLRPC(device), - Marshalling.toXMLRPC(otherConfig)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(VM), Marshalling.toXMLRPC(GPUGroup), Marshalling.toXMLRPC(device), Marshalling.toXMLRPC(otherConfig), Marshalling.toXMLRPC(type)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVGPU(result); + return Types.toVGPU(result); } /** - * + * * * @return Task */ public Task destroyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VGPU.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -396,13 +443,13 @@ public class VGPU extends XenAPIObject { } /** - * + * * */ public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VGPU.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -416,15 +463,15 @@ public class VGPU extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VGPU.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVGPU(result); + return Types.toSetOfVGPU(result); } /** @@ -433,15 +480,15 @@ public class VGPU extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VGPU.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfVGPUVGPURecord(result); + return Types.toMapOfVGPUVGPURecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/VGPUType.java b/deps/XenServerJava/src/com/xensource/xenapi/VGPUType.java new file mode 100644 index 00000000000..075ec187c93 --- /dev/null +++ b/deps/XenServerJava/src/com/xensource/xenapi/VGPUType.java @@ -0,0 +1,461 @@ +/* + * Copyright (c) Citrix Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1) Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2) Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +package com.xensource.xenapi; + +import com.xensource.xenapi.Types.BadServerResponse; +import com.xensource.xenapi.Types.VersionException; +import com.xensource.xenapi.Types.XenAPIException; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedHashSet; +import java.util.Map; +import java.util.Set; + +import org.apache.xmlrpc.XmlRpcException; + +/** + * A type of virtual GPU + * + * @author Citrix Systems, Inc. + */ +public class VGPUType extends XenAPIObject { + + /** + * The XenAPI reference (OpaqueRef) to this object. + */ + protected final String ref; + + /** + * For internal use only. + */ + VGPUType(String ref) { + this.ref = ref; + } + + /** + * @return The XenAPI reference (OpaqueRef) to this object. + */ + public String toWireString() { + return this.ref; + } + + /** + * If obj is a VGPUType, compares XenAPI references for equality. + */ + @Override + public boolean equals(Object obj) + { + if (obj != null && obj instanceof VGPUType) + { + VGPUType other = (VGPUType) obj; + return other.ref.equals(this.ref); + } else + { + return false; + } + } + + @Override + public int hashCode() + { + return ref.hashCode(); + } + + /** + * Represents all the fields in a VGPUType + */ + public static class Record implements Types.Record { + public String toString() { + StringWriter writer = new StringWriter(); + PrintWriter print = new PrintWriter(writer); + print.printf("%1$20s: %2$s\n", "uuid", this.uuid); + print.printf("%1$20s: %2$s\n", "vendorName", this.vendorName); + print.printf("%1$20s: %2$s\n", "modelName", this.modelName); + print.printf("%1$20s: %2$s\n", "framebufferSize", this.framebufferSize); + print.printf("%1$20s: %2$s\n", "maxHeads", this.maxHeads); + print.printf("%1$20s: %2$s\n", "maxResolutionX", this.maxResolutionX); + print.printf("%1$20s: %2$s\n", "maxResolutionY", this.maxResolutionY); + print.printf("%1$20s: %2$s\n", "supportedOnPGPUs", this.supportedOnPGPUs); + print.printf("%1$20s: %2$s\n", "enabledOnPGPUs", this.enabledOnPGPUs); + print.printf("%1$20s: %2$s\n", "VGPUs", this.VGPUs); + print.printf("%1$20s: %2$s\n", "supportedOnGPUGroups", this.supportedOnGPUGroups); + print.printf("%1$20s: %2$s\n", "enabledOnGPUGroups", this.enabledOnGPUGroups); + return writer.toString(); + } + + /** + * Convert a VGPU_type.Record to a Map + */ + public Map toMap() { + Map map = new HashMap(); + map.put("uuid", this.uuid == null ? "" : this.uuid); + map.put("vendor_name", this.vendorName == null ? "" : this.vendorName); + map.put("model_name", this.modelName == null ? "" : this.modelName); + map.put("framebuffer_size", this.framebufferSize == null ? 0 : this.framebufferSize); + map.put("max_heads", this.maxHeads == null ? 0 : this.maxHeads); + map.put("max_resolution_x", this.maxResolutionX == null ? 0 : this.maxResolutionX); + map.put("max_resolution_y", this.maxResolutionY == null ? 0 : this.maxResolutionY); + map.put("supported_on_PGPUs", this.supportedOnPGPUs == null ? new LinkedHashSet() : this.supportedOnPGPUs); + map.put("enabled_on_PGPUs", this.enabledOnPGPUs == null ? new LinkedHashSet() : this.enabledOnPGPUs); + map.put("VGPUs", this.VGPUs == null ? new LinkedHashSet() : this.VGPUs); + map.put("supported_on_GPU_groups", this.supportedOnGPUGroups == null ? new LinkedHashSet() : this.supportedOnGPUGroups); + map.put("enabled_on_GPU_groups", this.enabledOnGPUGroups == null ? new LinkedHashSet() : this.enabledOnGPUGroups); + return map; + } + + /** + * Unique identifier/object reference + */ + public String uuid; + /** + * Name of VGPU vendor + */ + public String vendorName; + /** + * Model name associated with the VGPU type + */ + public String modelName; + /** + * Framebuffer size of the VGPU type, in bytes + */ + public Long framebufferSize; + /** + * Maximum number of displays supported by the VGPU type + */ + public Long maxHeads; + /** + * Maximum resultion (width) supported by the VGPU type + */ + public Long maxResolutionX; + /** + * Maximum resoltion (height) supported by the VGPU type + */ + public Long maxResolutionY; + /** + * List of PGPUs that support this VGPU type + */ + public Set supportedOnPGPUs; + /** + * List of PGPUs that have this VGPU type enabled + */ + public Set enabledOnPGPUs; + /** + * List of VGPUs of this type + */ + public Set VGPUs; + /** + * List of GPU groups in which at least one PGPU supports this VGPU type + */ + public Set supportedOnGPUGroups; + /** + * List of GPU groups in which at least one have this VGPU type enabled + */ + public Set enabledOnGPUGroups; + } + + /** + * Get a record containing the current state of the given VGPU_type. + * + * @return all fields from the object + */ + public VGPUType.Record getRecord(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "VGPU_type.get_record"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toVGPUTypeRecord(result); + } + + /** + * Get a reference to the VGPU_type instance with the specified UUID. + * + * @param uuid UUID of object to return + * @return reference to the object + */ + public static VGPUType getByUuid(Connection c, String uuid) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "VGPU_type.get_by_uuid"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toVGPUType(result); + } + + /** + * Get the uuid field of the given VGPU_type. + * + * @return value of the field + */ + public String getUuid(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "VGPU_type.get_uuid"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toString(result); + } + + /** + * Get the vendor_name field of the given VGPU_type. + * + * @return value of the field + */ + public String getVendorName(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "VGPU_type.get_vendor_name"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toString(result); + } + + /** + * Get the model_name field of the given VGPU_type. + * + * @return value of the field + */ + public String getModelName(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "VGPU_type.get_model_name"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toString(result); + } + + /** + * Get the framebuffer_size field of the given VGPU_type. + * + * @return value of the field + */ + public Long getFramebufferSize(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "VGPU_type.get_framebuffer_size"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toLong(result); + } + + /** + * Get the max_heads field of the given VGPU_type. + * + * @return value of the field + */ + public Long getMaxHeads(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "VGPU_type.get_max_heads"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toLong(result); + } + + /** + * Get the max_resolution_x field of the given VGPU_type. + * + * @return value of the field + */ + public Long getMaxResolutionX(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "VGPU_type.get_max_resolution_x"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toLong(result); + } + + /** + * Get the max_resolution_y field of the given VGPU_type. + * + * @return value of the field + */ + public Long getMaxResolutionY(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "VGPU_type.get_max_resolution_y"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toLong(result); + } + + /** + * Get the supported_on_PGPUs field of the given VGPU_type. + * + * @return value of the field + */ + public Set getSupportedOnPGPUs(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "VGPU_type.get_supported_on_PGPUs"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toSetOfPGPU(result); + } + + /** + * Get the enabled_on_PGPUs field of the given VGPU_type. + * + * @return value of the field + */ + public Set getEnabledOnPGPUs(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "VGPU_type.get_enabled_on_PGPUs"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toSetOfPGPU(result); + } + + /** + * Get the VGPUs field of the given VGPU_type. + * + * @return value of the field + */ + public Set getVGPUs(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "VGPU_type.get_VGPUs"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toSetOfVGPU(result); + } + + /** + * Get the supported_on_GPU_groups field of the given VGPU_type. + * + * @return value of the field + */ + public Set getSupportedOnGPUGroups(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "VGPU_type.get_supported_on_GPU_groups"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toSetOfGPUGroup(result); + } + + /** + * Get the enabled_on_GPU_groups field of the given VGPU_type. + * + * @return value of the field + */ + public Set getEnabledOnGPUGroups(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "VGPU_type.get_enabled_on_GPU_groups"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toSetOfGPUGroup(result); + } + + /** + * Return a list of all the VGPU_types known to the system. + * + * @return references to all objects + */ + public static Set getAll(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "VGPU_type.get_all"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toSetOfVGPUType(result); + } + + /** + * Return a map of VGPU_type references to VGPU_type records for all VGPU_types known to the system. + * + * @return records of all objects + */ + public static Map getAllRecords(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "VGPU_type.get_all_records"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toMapOfVGPUTypeVGPUTypeRecord(result); + } + +} \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/VIF.java b/deps/XenServerJava/src/com/xensource/xenapi/VIF.java index 8302800686d..c755dc4b100 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/VIF.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/VIF.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class VIF extends XenAPIObject { * For internal use only. */ VIF(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class VIF extends XenAPIObject { { if (obj != null && obj instanceof VIF) { - VIF other = (VIF)obj; + VIF other = (VIF) obj; return other.ref.equals(this.ref); } else { @@ -126,8 +127,8 @@ public class VIF extends XenAPIObject { /** * Convert a VIF.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("allowed_operations", this.allowedOperations == null ? new LinkedHashSet() : this.allowedOperations); map.put("current_operations", this.currentOperations == null ? new HashMap() : this.currentOperations); @@ -146,7 +147,7 @@ public class VIF extends XenAPIObject { map.put("qos_supported_algorithms", this.qosSupportedAlgorithms == null ? new LinkedHashSet() : this.qosSupportedAlgorithms); map.put("metrics", this.metrics == null ? new VIFMetrics("OpaqueRef:NULL") : this.metrics); map.put("MAC_autogenerated", this.MACAutogenerated == null ? false : this.MACAutogenerated); - map.put("locking_mode", this.lockingMode == null ? Types.VifLockingMode.UNRECOGNIZED : this.lockingMode); + map.put("locking_mode", this.lockingMode == null ? Types.VifLockingMode.NETWORK_DEFAULT : this.lockingMode); map.put("ipv4_allowed", this.ipv4Allowed == null ? new LinkedHashSet() : this.ipv4Allowed); map.put("ipv6_allowed", this.ipv6Allowed == null ? new LinkedHashSet() : this.ipv6Allowed); return map; @@ -244,15 +245,15 @@ public class VIF extends XenAPIObject { * @return all fields from the object */ public VIF.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVIFRecord(result); + return Types.toVIFRecord(result); } /** @@ -262,15 +263,15 @@ public class VIF extends XenAPIObject { * @return reference to the object */ public static VIF getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVIF(result); + return Types.toVIF(result); } /** @@ -280,9 +281,9 @@ public class VIF extends XenAPIObject { * @return Task */ public static Task createAsync(Connection c, VIF.Record record) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VIF.create"; String session = c.getSessionReference(); Map record_map = record.toMap(); @@ -299,16 +300,16 @@ public class VIF extends XenAPIObject { * @return reference to the newly created object */ public static VIF create(Connection c, VIF.Record record) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.create"; String session = c.getSessionReference(); Map record_map = record.toMap(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVIF(result); + return Types.toVIF(result); } /** @@ -317,9 +318,9 @@ public class VIF extends XenAPIObject { * @return Task */ public Task destroyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VIF.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -333,9 +334,9 @@ public class VIF extends XenAPIObject { * */ public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -349,15 +350,15 @@ public class VIF extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -366,15 +367,15 @@ public class VIF extends XenAPIObject { * @return value of the field */ public Set getAllowedOperations(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.get_allowed_operations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVifOperations(result); + return Types.toSetOfVifOperations(result); } /** @@ -383,15 +384,15 @@ public class VIF extends XenAPIObject { * @return value of the field */ public Map getCurrentOperations(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.get_current_operations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringVifOperations(result); + return Types.toMapOfStringVifOperations(result); } /** @@ -400,15 +401,15 @@ public class VIF extends XenAPIObject { * @return value of the field */ public String getDevice(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.get_device"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -417,15 +418,15 @@ public class VIF extends XenAPIObject { * @return value of the field */ public Network getNetwork(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.get_network"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toNetwork(result); + return Types.toNetwork(result); } /** @@ -434,15 +435,15 @@ public class VIF extends XenAPIObject { * @return value of the field */ public VM getVM(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.get_VM"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVM(result); + return Types.toVM(result); } /** @@ -451,15 +452,15 @@ public class VIF extends XenAPIObject { * @return value of the field */ public String getMAC(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.get_MAC"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -468,15 +469,15 @@ public class VIF extends XenAPIObject { * @return value of the field */ public Long getMTU(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.get_MTU"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -485,15 +486,15 @@ public class VIF extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -502,15 +503,15 @@ public class VIF extends XenAPIObject { * @return value of the field */ public Boolean getCurrentlyAttached(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.get_currently_attached"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -519,15 +520,15 @@ public class VIF extends XenAPIObject { * @return value of the field */ public Long getStatusCode(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.get_status_code"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -536,15 +537,15 @@ public class VIF extends XenAPIObject { * @return value of the field */ public String getStatusDetail(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.get_status_detail"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -553,15 +554,15 @@ public class VIF extends XenAPIObject { * @return value of the field */ public Map getRuntimeProperties(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.get_runtime_properties"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -570,15 +571,15 @@ public class VIF extends XenAPIObject { * @return value of the field */ public String getQosAlgorithmType(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.get_qos_algorithm_type"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -587,15 +588,15 @@ public class VIF extends XenAPIObject { * @return value of the field */ public Map getQosAlgorithmParams(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.get_qos_algorithm_params"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -604,15 +605,15 @@ public class VIF extends XenAPIObject { * @return value of the field */ public Set getQosSupportedAlgorithms(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.get_qos_supported_algorithms"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -621,15 +622,15 @@ public class VIF extends XenAPIObject { * @return value of the field */ public VIFMetrics getMetrics(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.get_metrics"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVIFMetrics(result); + return Types.toVIFMetrics(result); } /** @@ -638,15 +639,15 @@ public class VIF extends XenAPIObject { * @return value of the field */ public Boolean getMACAutogenerated(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.get_MAC_autogenerated"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -655,15 +656,15 @@ public class VIF extends XenAPIObject { * @return value of the field */ public Types.VifLockingMode getLockingMode(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.get_locking_mode"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVifLockingMode(result); + return Types.toVifLockingMode(result); } /** @@ -672,15 +673,15 @@ public class VIF extends XenAPIObject { * @return value of the field */ public Set getIpv4Allowed(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.get_ipv4_allowed"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -689,15 +690,15 @@ public class VIF extends XenAPIObject { * @return value of the field */ public Set getIpv6Allowed(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.get_ipv6_allowed"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -706,9 +707,9 @@ public class VIF extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -723,9 +724,9 @@ public class VIF extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -739,9 +740,9 @@ public class VIF extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -755,9 +756,9 @@ public class VIF extends XenAPIObject { * @param algorithmType New value to set */ public void setQosAlgorithmType(Connection c, String algorithmType) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.set_qos_algorithm_type"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(algorithmType)}; @@ -771,9 +772,9 @@ public class VIF extends XenAPIObject { * @param algorithmParams New value to set */ public void setQosAlgorithmParams(Connection c, Map algorithmParams) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.set_qos_algorithm_params"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(algorithmParams)}; @@ -788,9 +789,9 @@ public class VIF extends XenAPIObject { * @param value Value to add */ public void addToQosAlgorithmParams(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.add_to_qos_algorithm_params"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -804,9 +805,9 @@ public class VIF extends XenAPIObject { * @param key Key to remove */ public void removeFromQosAlgorithmParams(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.remove_from_qos_algorithm_params"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -820,9 +821,9 @@ public class VIF extends XenAPIObject { * @return Task */ public Task plugAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VIF.plug"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -836,9 +837,9 @@ public class VIF extends XenAPIObject { * */ public void plug(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.plug"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -852,9 +853,9 @@ public class VIF extends XenAPIObject { * @return Task */ public Task unplugAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VIF.unplug"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -868,9 +869,9 @@ public class VIF extends XenAPIObject { * */ public void unplug(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.unplug"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -884,9 +885,9 @@ public class VIF extends XenAPIObject { * @return Task */ public Task unplugForceAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VIF.unplug_force"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -900,9 +901,9 @@ public class VIF extends XenAPIObject { * */ public void unplugForce(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.unplug_force"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -917,9 +918,9 @@ public class VIF extends XenAPIObject { * @return Task */ public Task setLockingModeAsync(Connection c, Types.VifLockingMode value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VIF.set_locking_mode"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -934,9 +935,9 @@ public class VIF extends XenAPIObject { * @param value The new locking mode for the VIF */ public void setLockingMode(Connection c, Types.VifLockingMode value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.set_locking_mode"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -951,9 +952,9 @@ public class VIF extends XenAPIObject { * @return Task */ public Task setIpv4AllowedAsync(Connection c, Set value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VIF.set_ipv4_allowed"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -968,9 +969,9 @@ public class VIF extends XenAPIObject { * @param value The IP addresses which will be associated with the VIF */ public void setIpv4Allowed(Connection c, Set value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.set_ipv4_allowed"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -985,9 +986,9 @@ public class VIF extends XenAPIObject { * @return Task */ public Task addIpv4AllowedAsync(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VIF.add_ipv4_allowed"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1002,9 +1003,9 @@ public class VIF extends XenAPIObject { * @param value The IP address which will be associated with the VIF */ public void addIpv4Allowed(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.add_ipv4_allowed"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1019,9 +1020,9 @@ public class VIF extends XenAPIObject { * @return Task */ public Task removeIpv4AllowedAsync(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VIF.remove_ipv4_allowed"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1036,9 +1037,9 @@ public class VIF extends XenAPIObject { * @param value The IP address which will be removed from the VIF */ public void removeIpv4Allowed(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.remove_ipv4_allowed"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1053,9 +1054,9 @@ public class VIF extends XenAPIObject { * @return Task */ public Task setIpv6AllowedAsync(Connection c, Set value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VIF.set_ipv6_allowed"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1070,9 +1071,9 @@ public class VIF extends XenAPIObject { * @param value The IP addresses which will be associated with the VIF */ public void setIpv6Allowed(Connection c, Set value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.set_ipv6_allowed"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1087,9 +1088,9 @@ public class VIF extends XenAPIObject { * @return Task */ public Task addIpv6AllowedAsync(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VIF.add_ipv6_allowed"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1104,9 +1105,9 @@ public class VIF extends XenAPIObject { * @param value The IP address which will be associated with the VIF */ public void addIpv6Allowed(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.add_ipv6_allowed"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1121,9 +1122,9 @@ public class VIF extends XenAPIObject { * @return Task */ public Task removeIpv6AllowedAsync(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VIF.remove_ipv6_allowed"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1138,9 +1139,9 @@ public class VIF extends XenAPIObject { * @param value The IP address which will be removed from the VIF */ public void removeIpv6Allowed(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.remove_ipv6_allowed"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1154,15 +1155,15 @@ public class VIF extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVIF(result); + return Types.toSetOfVIF(result); } /** @@ -1171,15 +1172,15 @@ public class VIF extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfVIFVIFRecord(result); + return Types.toMapOfVIFVIFRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/VIFMetrics.java b/deps/XenServerJava/src/com/xensource/xenapi/VIFMetrics.java index 0c17217956d..c051e53180b 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/VIFMetrics.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/VIFMetrics.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class VIFMetrics extends XenAPIObject { * For internal use only. */ VIFMetrics(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class VIFMetrics extends XenAPIObject { { if (obj != null && obj instanceof VIFMetrics) { - VIFMetrics other = (VIFMetrics)obj; + VIFMetrics other = (VIFMetrics) obj; return other.ref.equals(this.ref); } else { @@ -110,8 +111,8 @@ public class VIFMetrics extends XenAPIObject { /** * Convert a VIF_metrics.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("io_read_kbs", this.ioReadKbs == null ? 0.0 : this.ioReadKbs); map.put("io_write_kbs", this.ioWriteKbs == null ? 0.0 : this.ioWriteKbs); @@ -148,15 +149,15 @@ public class VIFMetrics extends XenAPIObject { * @return all fields from the object */ public VIFMetrics.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF_metrics.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVIFMetricsRecord(result); + return Types.toVIFMetricsRecord(result); } /** @@ -166,15 +167,15 @@ public class VIFMetrics extends XenAPIObject { * @return reference to the object */ public static VIFMetrics getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF_metrics.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVIFMetrics(result); + return Types.toVIFMetrics(result); } /** @@ -183,15 +184,15 @@ public class VIFMetrics extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF_metrics.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -200,15 +201,15 @@ public class VIFMetrics extends XenAPIObject { * @return value of the field */ public Double getIoReadKbs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF_metrics.get_io_read_kbs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDouble(result); + return Types.toDouble(result); } /** @@ -217,15 +218,15 @@ public class VIFMetrics extends XenAPIObject { * @return value of the field */ public Double getIoWriteKbs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF_metrics.get_io_write_kbs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDouble(result); + return Types.toDouble(result); } /** @@ -234,15 +235,15 @@ public class VIFMetrics extends XenAPIObject { * @return value of the field */ public Date getLastUpdated(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF_metrics.get_last_updated"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDate(result); + return Types.toDate(result); } /** @@ -251,15 +252,15 @@ public class VIFMetrics extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF_metrics.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -268,9 +269,9 @@ public class VIFMetrics extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF_metrics.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -285,9 +286,9 @@ public class VIFMetrics extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF_metrics.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -301,9 +302,9 @@ public class VIFMetrics extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF_metrics.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -317,15 +318,15 @@ public class VIFMetrics extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF_metrics.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVIFMetrics(result); + return Types.toSetOfVIFMetrics(result); } /** @@ -334,15 +335,15 @@ public class VIFMetrics extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VIF_metrics.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfVIFMetricsVIFMetricsRecord(result); + return Types.toMapOfVIFMetricsVIFMetricsRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/VLAN.java b/deps/XenServerJava/src/com/xensource/xenapi/VLAN.java index 9bea0399a45..f0abe2944ae 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/VLAN.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/VLAN.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class VLAN extends XenAPIObject { * For internal use only. */ VLAN(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class VLAN extends XenAPIObject { { if (obj != null && obj instanceof VLAN) { - VLAN other = (VLAN)obj; + VLAN other = (VLAN) obj; return other.ref.equals(this.ref); } else { @@ -110,8 +111,8 @@ public class VLAN extends XenAPIObject { /** * Convert a VLAN.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("tagged_PIF", this.taggedPIF == null ? new PIF("OpaqueRef:NULL") : this.taggedPIF); map.put("untagged_PIF", this.untaggedPIF == null ? new PIF("OpaqueRef:NULL") : this.untaggedPIF); @@ -148,15 +149,15 @@ public class VLAN extends XenAPIObject { * @return all fields from the object */ public VLAN.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VLAN.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVLANRecord(result); + return Types.toVLANRecord(result); } /** @@ -166,15 +167,15 @@ public class VLAN extends XenAPIObject { * @return reference to the object */ public static VLAN getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VLAN.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVLAN(result); + return Types.toVLAN(result); } /** @@ -183,15 +184,15 @@ public class VLAN extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VLAN.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -200,15 +201,15 @@ public class VLAN extends XenAPIObject { * @return value of the field */ public PIF getTaggedPIF(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VLAN.get_tagged_PIF"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPIF(result); + return Types.toPIF(result); } /** @@ -217,15 +218,15 @@ public class VLAN extends XenAPIObject { * @return value of the field */ public PIF getUntaggedPIF(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VLAN.get_untagged_PIF"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toPIF(result); + return Types.toPIF(result); } /** @@ -234,15 +235,15 @@ public class VLAN extends XenAPIObject { * @return value of the field */ public Long getTag(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VLAN.get_tag"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -251,15 +252,15 @@ public class VLAN extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VLAN.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -268,9 +269,9 @@ public class VLAN extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VLAN.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -285,9 +286,9 @@ public class VLAN extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VLAN.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -301,9 +302,9 @@ public class VLAN extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VLAN.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -320,9 +321,9 @@ public class VLAN extends XenAPIObject { * @return Task */ public static Task createAsync(Connection c, PIF taggedPIF, Long tag, Network network) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VLAN.create"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(taggedPIF), Marshalling.toXMLRPC(tag), Marshalling.toXMLRPC(network)}; @@ -340,15 +341,15 @@ public class VLAN extends XenAPIObject { * @return The reference of the created VLAN object */ public static VLAN create(Connection c, PIF taggedPIF, Long tag, Network network) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VLAN.create"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(taggedPIF), Marshalling.toXMLRPC(tag), Marshalling.toXMLRPC(network)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVLAN(result); + return Types.toVLAN(result); } /** @@ -357,9 +358,9 @@ public class VLAN extends XenAPIObject { * @return Task */ public Task destroyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VLAN.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -373,9 +374,9 @@ public class VLAN extends XenAPIObject { * */ public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VLAN.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -389,15 +390,15 @@ public class VLAN extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VLAN.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVLAN(result); + return Types.toSetOfVLAN(result); } /** @@ -406,15 +407,15 @@ public class VLAN extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VLAN.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfVLANVLANRecord(result); + return Types.toMapOfVLANVLANRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/VM.java b/deps/XenServerJava/src/com/xensource/xenapi/VM.java index cfa5e6c97c7..6ed76af95d5 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/VM.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/VM.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class VM extends XenAPIObject { * For internal use only. */ VM(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class VM extends XenAPIObject { { if (obj != null && obj instanceof VM) { - VM other = (VM)obj; + VM other = (VM) obj; return other.ref.equals(this.ref); } else { @@ -173,14 +174,15 @@ public class VM extends XenAPIObject { print.printf("%1$20s: %2$s\n", "attachedPCIs", this.attachedPCIs); print.printf("%1$20s: %2$s\n", "suspendSR", this.suspendSR); print.printf("%1$20s: %2$s\n", "version", this.version); + print.printf("%1$20s: %2$s\n", "generationId", this.generationId); return writer.toString(); } /** * Convert a VM.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("allowed_operations", this.allowedOperations == null ? new LinkedHashSet() : this.allowedOperations); map.put("current_operations", this.currentOperations == null ? new HashMap() : this.currentOperations); @@ -255,6 +257,7 @@ public class VM extends XenAPIObject { map.put("attached_PCIs", this.attachedPCIs == null ? new LinkedHashSet() : this.attachedPCIs); map.put("suspend_SR", this.suspendSR == null ? new SR("OpaqueRef:NULL") : this.suspendSR); map.put("version", this.version == null ? 0 : this.version); + map.put("generation_id", this.generationId == null ? "" : this.generationId); return map; } @@ -554,6 +557,10 @@ public class VM extends XenAPIObject { * The number of times this VM has been recovered */ public Long version; + /** + * Generation ID of the VM + */ + public String generationId; } /** @@ -562,15 +569,15 @@ public class VM extends XenAPIObject { * @return all fields from the object */ public VM.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVMRecord(result); + return Types.toVMRecord(result); } /** @@ -580,15 +587,15 @@ public class VM extends XenAPIObject { * @return reference to the object */ public static VM getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVM(result); + return Types.toVM(result); } /** @@ -598,9 +605,9 @@ public class VM extends XenAPIObject { * @return Task */ public static Task createAsync(Connection c, VM.Record record) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.create"; String session = c.getSessionReference(); Map record_map = record.toMap(); @@ -617,16 +624,16 @@ public class VM extends XenAPIObject { * @return reference to the newly created object */ public static VM create(Connection c, VM.Record record) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.create"; String session = c.getSessionReference(); Map record_map = record.toMap(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVM(result); + return Types.toVM(result); } /** @@ -635,9 +642,9 @@ public class VM extends XenAPIObject { * @return Task */ public Task destroyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -651,9 +658,9 @@ public class VM extends XenAPIObject { * */ public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -668,15 +675,15 @@ public class VM extends XenAPIObject { * @return references to objects with matching names */ public static Set getByNameLabel(Connection c, String label) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_by_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVM(result); + return Types.toSetOfVM(result); } /** @@ -685,15 +692,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -702,15 +709,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Set getAllowedOperations(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_allowed_operations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVmOperations(result); + return Types.toSetOfVmOperations(result); } /** @@ -719,15 +726,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Map getCurrentOperations(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_current_operations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringVmOperations(result); + return Types.toMapOfStringVmOperations(result); } /** @@ -736,15 +743,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Types.VmPowerState getPowerState(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_power_state"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVmPowerState(result); + return Types.toVmPowerState(result); } /** @@ -753,15 +760,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public String getNameLabel(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -770,15 +777,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public String getNameDescription(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -787,15 +794,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Long getUserVersion(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_user_version"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -804,15 +811,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Boolean getIsATemplate(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_is_a_template"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -821,15 +828,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public VDI getSuspendVDI(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_suspend_VDI"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVDI(result); + return Types.toVDI(result); } /** @@ -838,15 +845,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Host getResidentOn(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_resident_on"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toHost(result); + return Types.toHost(result); } /** @@ -855,15 +862,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Host getAffinity(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_affinity"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toHost(result); + return Types.toHost(result); } /** @@ -872,15 +879,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Long getMemoryOverhead(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_memory_overhead"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -889,17 +896,16 @@ public class VM extends XenAPIObject { * * @return value of the field */ - @Deprecated - public Long getMemoryTarget(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public Long getMemoryTarget(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_memory_target"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -908,15 +914,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Long getMemoryStaticMax(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_memory_static_max"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -925,15 +931,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Long getMemoryDynamicMax(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_memory_dynamic_max"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -942,15 +948,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Long getMemoryDynamicMin(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_memory_dynamic_min"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -959,15 +965,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Long getMemoryStaticMin(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_memory_static_min"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -976,15 +982,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Map getVCPUsParams(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_VCPUs_params"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -993,15 +999,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Long getVCPUsMax(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_VCPUs_max"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -1010,15 +1016,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Long getVCPUsAtStartup(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_VCPUs_at_startup"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -1027,15 +1033,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Types.OnNormalExit getActionsAfterShutdown(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_actions_after_shutdown"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toOnNormalExit(result); + return Types.toOnNormalExit(result); } /** @@ -1044,15 +1050,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Types.OnNormalExit getActionsAfterReboot(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_actions_after_reboot"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toOnNormalExit(result); + return Types.toOnNormalExit(result); } /** @@ -1061,15 +1067,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Types.OnCrashBehaviour getActionsAfterCrash(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_actions_after_crash"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toOnCrashBehaviour(result); + return Types.toOnCrashBehaviour(result); } /** @@ -1078,15 +1084,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Set getConsoles(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_consoles"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfConsole(result); + return Types.toSetOfConsole(result); } /** @@ -1095,15 +1101,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Set getVIFs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_VIFs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVIF(result); + return Types.toSetOfVIF(result); } /** @@ -1112,15 +1118,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Set getVBDs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_VBDs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVBD(result); + return Types.toSetOfVBD(result); } /** @@ -1129,15 +1135,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Set getCrashDumps(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_crash_dumps"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfCrashdump(result); + return Types.toSetOfCrashdump(result); } /** @@ -1146,15 +1152,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Set getVTPMs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_VTPMs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVTPM(result); + return Types.toSetOfVTPM(result); } /** @@ -1163,15 +1169,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public String getPVBootloader(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_PV_bootloader"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -1180,15 +1186,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public String getPVKernel(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_PV_kernel"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -1197,15 +1203,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public String getPVRamdisk(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_PV_ramdisk"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -1214,15 +1220,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public String getPVArgs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_PV_args"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -1231,15 +1237,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public String getPVBootloaderArgs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_PV_bootloader_args"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -1248,15 +1254,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public String getPVLegacyArgs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_PV_legacy_args"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -1265,15 +1271,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public String getHVMBootPolicy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_HVM_boot_policy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -1282,15 +1288,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Map getHVMBootParams(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_HVM_boot_params"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -1299,15 +1305,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Double getHVMShadowMultiplier(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_HVM_shadow_multiplier"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDouble(result); + return Types.toDouble(result); } /** @@ -1316,15 +1322,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Map getPlatform(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_platform"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -1333,17 +1339,16 @@ public class VM extends XenAPIObject { * * @return value of the field */ - @Deprecated - public String getPCIBus(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public String getPCIBus(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_PCI_bus"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -1352,15 +1357,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -1369,15 +1374,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Long getDomid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_domid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -1386,15 +1391,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public String getDomarch(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_domarch"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -1403,15 +1408,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Map getLastBootCPUFlags(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_last_boot_CPU_flags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -1420,15 +1425,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Boolean getIsControlDomain(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_is_control_domain"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -1437,15 +1442,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public VMMetrics getMetrics(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_metrics"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVMMetrics(result); + return Types.toVMMetrics(result); } /** @@ -1454,15 +1459,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public VMGuestMetrics getGuestMetrics(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_guest_metrics"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVMGuestMetrics(result); + return Types.toVMGuestMetrics(result); } /** @@ -1471,15 +1476,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public String getLastBootedRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_last_booted_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -1488,15 +1493,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public String getRecommendations(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_recommendations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -1505,15 +1510,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Map getXenstoreData(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_xenstore_data"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -1522,17 +1527,16 @@ public class VM extends XenAPIObject { * * @return value of the field */ - @Deprecated - public Boolean getHaAlwaysRun(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public Boolean getHaAlwaysRun(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_ha_always_run"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -1541,15 +1545,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public String getHaRestartPriority(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_ha_restart_priority"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -1558,15 +1562,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Boolean getIsASnapshot(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_is_a_snapshot"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -1575,15 +1579,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public VM getSnapshotOf(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_snapshot_of"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVM(result); + return Types.toVM(result); } /** @@ -1592,15 +1596,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Set getSnapshots(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_snapshots"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVM(result); + return Types.toSetOfVM(result); } /** @@ -1609,15 +1613,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Date getSnapshotTime(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_snapshot_time"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDate(result); + return Types.toDate(result); } /** @@ -1626,15 +1630,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public String getTransportableSnapshotId(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_transportable_snapshot_id"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -1643,15 +1647,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Map getBlobs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_blobs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringBlob(result); + return Types.toMapOfStringBlob(result); } /** @@ -1660,15 +1664,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Set getTags(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_tags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -1677,15 +1681,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Map getBlockedOperations(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_blocked_operations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfVmOperationsString(result); + return Types.toMapOfVmOperationsString(result); } /** @@ -1694,15 +1698,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Map getSnapshotInfo(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_snapshot_info"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -1711,15 +1715,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public String getSnapshotMetadata(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_snapshot_metadata"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -1728,15 +1732,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public VM getParent(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_parent"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVM(result); + return Types.toVM(result); } /** @@ -1745,15 +1749,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Set getChildren(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_children"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVM(result); + return Types.toSetOfVM(result); } /** @@ -1762,49 +1766,51 @@ public class VM extends XenAPIObject { * @return value of the field */ public Map getBiosStrings(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_bios_strings"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** * Get the protection_policy field of the given VM. + * @deprecated * * @return value of the field */ - public VMPP getProtectionPolicy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public VMPP getProtectionPolicy(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_protection_policy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVMPP(result); + return Types.toVMPP(result); } /** * Get the is_snapshot_from_vmpp field of the given VM. + * @deprecated * * @return value of the field */ - public Boolean getIsSnapshotFromVmpp(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public Boolean getIsSnapshotFromVmpp(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_is_snapshot_from_vmpp"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -1813,15 +1819,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public VMAppliance getAppliance(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_appliance"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVMAppliance(result); + return Types.toVMAppliance(result); } /** @@ -1830,15 +1836,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Long getStartDelay(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_start_delay"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -1847,15 +1853,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Long getShutdownDelay(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_shutdown_delay"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -1864,15 +1870,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Long getOrder(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_order"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -1881,15 +1887,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Set getVGPUs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_VGPUs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVGPU(result); + return Types.toSetOfVGPU(result); } /** @@ -1898,15 +1904,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public Set getAttachedPCIs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_attached_PCIs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfPCI(result); + return Types.toSetOfPCI(result); } /** @@ -1915,15 +1921,15 @@ public class VM extends XenAPIObject { * @return value of the field */ public SR getSuspendSR(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_suspend_SR"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSR(result); + return Types.toSR(result); } /** @@ -1932,15 +1938,32 @@ public class VM extends XenAPIObject { * @return value of the field */ public Long getVersion(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_version"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); + } + + /** + * Get the generation_id field of the given VM. + * + * @return value of the field + */ + public String getGenerationId(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { + String method_call = "VM.get_generation_id"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toString(result); } /** @@ -1949,9 +1972,9 @@ public class VM extends XenAPIObject { * @param label New value to set */ public void setNameLabel(Connection c, String label) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(label)}; @@ -1965,9 +1988,9 @@ public class VM extends XenAPIObject { * @param description New value to set */ public void setNameDescription(Connection c, String description) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(description)}; @@ -1981,9 +2004,9 @@ public class VM extends XenAPIObject { * @param userVersion New value to set */ public void setUserVersion(Connection c, Long userVersion) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_user_version"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(userVersion)}; @@ -1997,9 +2020,9 @@ public class VM extends XenAPIObject { * @param isATemplate New value to set */ public void setIsATemplate(Connection c, Boolean isATemplate) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_is_a_template"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(isATemplate)}; @@ -2013,9 +2036,9 @@ public class VM extends XenAPIObject { * @param affinity New value to set */ public void setAffinity(Connection c, Host affinity) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_affinity"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(affinity)}; @@ -2029,9 +2052,9 @@ public class VM extends XenAPIObject { * @param params New value to set */ public void setVCPUsParams(Connection c, Map params) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_VCPUs_params"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(params)}; @@ -2046,9 +2069,9 @@ public class VM extends XenAPIObject { * @param value Value to add */ public void addToVCPUsParams(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.add_to_VCPUs_params"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -2062,9 +2085,9 @@ public class VM extends XenAPIObject { * @param key Key to remove */ public void removeFromVCPUsParams(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.remove_from_VCPUs_params"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -2078,9 +2101,9 @@ public class VM extends XenAPIObject { * @param afterShutdown New value to set */ public void setActionsAfterShutdown(Connection c, Types.OnNormalExit afterShutdown) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_actions_after_shutdown"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(afterShutdown)}; @@ -2094,9 +2117,9 @@ public class VM extends XenAPIObject { * @param afterReboot New value to set */ public void setActionsAfterReboot(Connection c, Types.OnNormalExit afterReboot) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_actions_after_reboot"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(afterReboot)}; @@ -2110,9 +2133,9 @@ public class VM extends XenAPIObject { * @param afterCrash New value to set */ public void setActionsAfterCrash(Connection c, Types.OnCrashBehaviour afterCrash) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_actions_after_crash"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(afterCrash)}; @@ -2126,9 +2149,9 @@ public class VM extends XenAPIObject { * @param bootloader New value to set */ public void setPVBootloader(Connection c, String bootloader) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_PV_bootloader"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(bootloader)}; @@ -2142,9 +2165,9 @@ public class VM extends XenAPIObject { * @param kernel New value to set */ public void setPVKernel(Connection c, String kernel) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_PV_kernel"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(kernel)}; @@ -2158,9 +2181,9 @@ public class VM extends XenAPIObject { * @param ramdisk New value to set */ public void setPVRamdisk(Connection c, String ramdisk) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_PV_ramdisk"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(ramdisk)}; @@ -2174,9 +2197,9 @@ public class VM extends XenAPIObject { * @param args New value to set */ public void setPVArgs(Connection c, String args) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_PV_args"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(args)}; @@ -2190,9 +2213,9 @@ public class VM extends XenAPIObject { * @param bootloaderArgs New value to set */ public void setPVBootloaderArgs(Connection c, String bootloaderArgs) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_PV_bootloader_args"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(bootloaderArgs)}; @@ -2206,9 +2229,9 @@ public class VM extends XenAPIObject { * @param legacyArgs New value to set */ public void setPVLegacyArgs(Connection c, String legacyArgs) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_PV_legacy_args"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(legacyArgs)}; @@ -2222,9 +2245,9 @@ public class VM extends XenAPIObject { * @param bootPolicy New value to set */ public void setHVMBootPolicy(Connection c, String bootPolicy) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_HVM_boot_policy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(bootPolicy)}; @@ -2238,9 +2261,9 @@ public class VM extends XenAPIObject { * @param bootParams New value to set */ public void setHVMBootParams(Connection c, Map bootParams) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_HVM_boot_params"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(bootParams)}; @@ -2255,9 +2278,9 @@ public class VM extends XenAPIObject { * @param value Value to add */ public void addToHVMBootParams(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.add_to_HVM_boot_params"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -2271,9 +2294,9 @@ public class VM extends XenAPIObject { * @param key Key to remove */ public void removeFromHVMBootParams(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.remove_from_HVM_boot_params"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -2287,9 +2310,9 @@ public class VM extends XenAPIObject { * @param platform New value to set */ public void setPlatform(Connection c, Map platform) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_platform"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(platform)}; @@ -2304,9 +2327,9 @@ public class VM extends XenAPIObject { * @param value Value to add */ public void addToPlatform(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.add_to_platform"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -2320,9 +2343,9 @@ public class VM extends XenAPIObject { * @param key Key to remove */ public void removeFromPlatform(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.remove_from_platform"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -2336,11 +2359,10 @@ public class VM extends XenAPIObject { * * @param PCIBus New value to set */ - @Deprecated - public void setPCIBus(Connection c, String PCIBus) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public void setPCIBus(Connection c, String PCIBus) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_PCI_bus"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(PCIBus)}; @@ -2354,9 +2376,9 @@ public class VM extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -2371,9 +2393,9 @@ public class VM extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -2387,9 +2409,9 @@ public class VM extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -2403,9 +2425,9 @@ public class VM extends XenAPIObject { * @param recommendations New value to set */ public void setRecommendations(Connection c, String recommendations) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_recommendations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(recommendations)}; @@ -2419,9 +2441,9 @@ public class VM extends XenAPIObject { * @param xenstoreData New value to set */ public void setXenstoreData(Connection c, Map xenstoreData) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_xenstore_data"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(xenstoreData)}; @@ -2436,9 +2458,9 @@ public class VM extends XenAPIObject { * @param value Value to add */ public void addToXenstoreData(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.add_to_xenstore_data"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -2452,9 +2474,9 @@ public class VM extends XenAPIObject { * @param key Key to remove */ public void removeFromXenstoreData(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.remove_from_xenstore_data"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -2468,9 +2490,9 @@ public class VM extends XenAPIObject { * @param tags New value to set */ public void setTags(Connection c, Set tags) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_tags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(tags)}; @@ -2484,9 +2506,9 @@ public class VM extends XenAPIObject { * @param value New value to add */ public void addTags(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.add_tags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -2500,9 +2522,9 @@ public class VM extends XenAPIObject { * @param value Value to remove */ public void removeTags(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.remove_tags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -2516,9 +2538,9 @@ public class VM extends XenAPIObject { * @param blockedOperations New value to set */ public void setBlockedOperations(Connection c, Map blockedOperations) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_blocked_operations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(blockedOperations)}; @@ -2533,9 +2555,9 @@ public class VM extends XenAPIObject { * @param value Value to add */ public void addToBlockedOperations(Connection c, Types.VmOperations key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.add_to_blocked_operations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -2549,9 +2571,9 @@ public class VM extends XenAPIObject { * @param key Key to remove */ public void removeFromBlockedOperations(Connection c, Types.VmOperations key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.remove_from_blocked_operations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -2565,9 +2587,9 @@ public class VM extends XenAPIObject { * @param suspendSR New value to set */ public void setSuspendSR(Connection c, SR suspendSR) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_suspend_SR"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(suspendSR)}; @@ -2582,12 +2604,12 @@ public class VM extends XenAPIObject { * @return Task */ public Task snapshotAsync(Connection c, String newName) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.SrFull, - Types.OperationNotAllowed { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.SrFull, + Types.OperationNotAllowed { String method_call = "Async.VM.snapshot"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(newName)}; @@ -2603,18 +2625,18 @@ public class VM extends XenAPIObject { * @return The reference of the newly created VM. */ public VM snapshot(Connection c, String newName) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.SrFull, - Types.OperationNotAllowed { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.SrFull, + Types.OperationNotAllowed { String method_call = "VM.snapshot"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(newName)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVM(result); + return Types.toVM(result); } /** @@ -2624,16 +2646,16 @@ public class VM extends XenAPIObject { * @return Task */ public Task snapshotWithQuiesceAsync(Connection c, String newName) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.SrFull, - Types.OperationNotAllowed, - Types.VmSnapshotWithQuiesceFailed, - Types.VmSnapshotWithQuiesceTimeout, - Types.VmSnapshotWithQuiescePluginDeosNotRespond, - Types.VmSnapshotWithQuiesceNotSupported { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.SrFull, + Types.OperationNotAllowed, + Types.VmSnapshotWithQuiesceFailed, + Types.VmSnapshotWithQuiesceTimeout, + Types.VmSnapshotWithQuiescePluginDeosNotRespond, + Types.VmSnapshotWithQuiesceNotSupported { String method_call = "Async.VM.snapshot_with_quiesce"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(newName)}; @@ -2649,22 +2671,22 @@ public class VM extends XenAPIObject { * @return The reference of the newly created VM. */ public VM snapshotWithQuiesce(Connection c, String newName) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.SrFull, - Types.OperationNotAllowed, - Types.VmSnapshotWithQuiesceFailed, - Types.VmSnapshotWithQuiesceTimeout, - Types.VmSnapshotWithQuiescePluginDeosNotRespond, - Types.VmSnapshotWithQuiesceNotSupported { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.SrFull, + Types.OperationNotAllowed, + Types.VmSnapshotWithQuiesceFailed, + Types.VmSnapshotWithQuiesceTimeout, + Types.VmSnapshotWithQuiescePluginDeosNotRespond, + Types.VmSnapshotWithQuiesceNotSupported { String method_call = "VM.snapshot_with_quiesce"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(newName)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVM(result); + return Types.toVM(result); } /** @@ -2674,12 +2696,12 @@ public class VM extends XenAPIObject { * @return Task */ public Task createCloneAsync(Connection c, String newName) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.SrFull, - Types.OperationNotAllowed { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.SrFull, + Types.OperationNotAllowed { String method_call = "Async.VM.clone"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(newName)}; @@ -2695,18 +2717,18 @@ public class VM extends XenAPIObject { * @return The reference of the newly created VM. */ public VM createClone(Connection c, String newName) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.SrFull, - Types.OperationNotAllowed { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.SrFull, + Types.OperationNotAllowed { String method_call = "VM.clone"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(newName)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVM(result); + return Types.toVM(result); } /** @@ -2717,12 +2739,12 @@ public class VM extends XenAPIObject { * @return Task */ public Task copyAsync(Connection c, String newName, SR sr) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.SrFull, - Types.OperationNotAllowed { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.SrFull, + Types.OperationNotAllowed { String method_call = "Async.VM.copy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(newName), Marshalling.toXMLRPC(sr)}; @@ -2739,18 +2761,18 @@ public class VM extends XenAPIObject { * @return The reference of the newly created VM. */ public VM copy(Connection c, String newName, SR sr) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.SrFull, - Types.OperationNotAllowed { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.SrFull, + Types.OperationNotAllowed { String method_call = "VM.copy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(newName), Marshalling.toXMLRPC(sr)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVM(result); + return Types.toVM(result); } /** @@ -2759,13 +2781,13 @@ public class VM extends XenAPIObject { * @return Task */ public Task revertAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.OperationNotAllowed, - Types.SrFull, - Types.VmRevertFailed { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.OperationNotAllowed, + Types.SrFull, + Types.VmRevertFailed { String method_call = "Async.VM.revert"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2779,13 +2801,13 @@ public class VM extends XenAPIObject { * */ public void revert(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.OperationNotAllowed, - Types.SrFull, - Types.VmRevertFailed { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.OperationNotAllowed, + Types.SrFull, + Types.VmRevertFailed { String method_call = "VM.revert"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2800,14 +2822,14 @@ public class VM extends XenAPIObject { * @return Task */ public Task checkpointAsync(Connection c, String newName) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.SrFull, - Types.OperationNotAllowed, - Types.VmCheckpointSuspendFailed, - Types.VmCheckpointResumeFailed { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.SrFull, + Types.OperationNotAllowed, + Types.VmCheckpointSuspendFailed, + Types.VmCheckpointResumeFailed { String method_call = "Async.VM.checkpoint"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(newName)}; @@ -2823,20 +2845,20 @@ public class VM extends XenAPIObject { * @return The reference of the newly created VM. */ public VM checkpoint(Connection c, String newName) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.SrFull, - Types.OperationNotAllowed, - Types.VmCheckpointSuspendFailed, - Types.VmCheckpointResumeFailed { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.SrFull, + Types.OperationNotAllowed, + Types.VmCheckpointSuspendFailed, + Types.VmCheckpointResumeFailed { String method_call = "VM.checkpoint"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(newName)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVM(result); + return Types.toVM(result); } /** @@ -2845,12 +2867,12 @@ public class VM extends XenAPIObject { * @return Task */ public Task provisionAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.SrFull, - Types.OperationNotAllowed { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.SrFull, + Types.OperationNotAllowed { String method_call = "Async.VM.provision"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2864,12 +2886,12 @@ public class VM extends XenAPIObject { * */ public void provision(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.SrFull, - Types.OperationNotAllowed { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.SrFull, + Types.OperationNotAllowed { String method_call = "VM.provision"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -2885,18 +2907,18 @@ public class VM extends XenAPIObject { * @return Task */ public Task startAsync(Connection c, Boolean startPaused, Boolean force) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.VmHvmRequired, - Types.VmIsTemplate, - Types.OtherOperationInProgress, - Types.OperationNotAllowed, - Types.BootloaderFailed, - Types.UnknownBootloader, - Types.NoHostsAvailable, - Types.LicenceRestriction { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.VmHvmRequired, + Types.VmIsTemplate, + Types.OtherOperationInProgress, + Types.OperationNotAllowed, + Types.BootloaderFailed, + Types.UnknownBootloader, + Types.NoHostsAvailable, + Types.LicenceRestriction { String method_call = "Async.VM.start"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(startPaused), Marshalling.toXMLRPC(force)}; @@ -2912,18 +2934,18 @@ public class VM extends XenAPIObject { * @param force Attempt to force the VM to start. If this flag is false then the VM may fail pre-boot safety checks (e.g. if the CPU the VM last booted on looks substantially different to the current one) */ public void start(Connection c, Boolean startPaused, Boolean force) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.VmHvmRequired, - Types.VmIsTemplate, - Types.OtherOperationInProgress, - Types.OperationNotAllowed, - Types.BootloaderFailed, - Types.UnknownBootloader, - Types.NoHostsAvailable, - Types.LicenceRestriction { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.VmHvmRequired, + Types.VmIsTemplate, + Types.OtherOperationInProgress, + Types.OperationNotAllowed, + Types.BootloaderFailed, + Types.UnknownBootloader, + Types.NoHostsAvailable, + Types.LicenceRestriction { String method_call = "VM.start"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(startPaused), Marshalling.toXMLRPC(force)}; @@ -2940,19 +2962,18 @@ public class VM extends XenAPIObject { * @return Task */ public Task startOnAsync(Connection c, Host host, Boolean startPaused, Boolean force) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.VmIsTemplate, - Types.OtherOperationInProgress, - Types.OperationNotAllowed, - Types.BootloaderFailed, - Types.UnknownBootloader { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.VmIsTemplate, + Types.OtherOperationInProgress, + Types.OperationNotAllowed, + Types.BootloaderFailed, + Types.UnknownBootloader { String method_call = "Async.VM.start_on"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(startPaused), - Marshalling.toXMLRPC(force)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(startPaused), Marshalling.toXMLRPC(force)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -2966,19 +2987,18 @@ public class VM extends XenAPIObject { * @param force Attempt to force the VM to start. If this flag is false then the VM may fail pre-boot safety checks (e.g. if the CPU the VM last booted on looks substantially different to the current one) */ public void startOn(Connection c, Host host, Boolean startPaused, Boolean force) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.VmIsTemplate, - Types.OtherOperationInProgress, - Types.OperationNotAllowed, - Types.BootloaderFailed, - Types.UnknownBootloader { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.VmIsTemplate, + Types.OtherOperationInProgress, + Types.OperationNotAllowed, + Types.BootloaderFailed, + Types.UnknownBootloader { String method_call = "VM.start_on"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(startPaused), - Marshalling.toXMLRPC(force)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(startPaused), Marshalling.toXMLRPC(force)}; Map response = c.dispatch(method_call, method_params); return; } @@ -2989,13 +3009,13 @@ public class VM extends XenAPIObject { * @return Task */ public Task pauseAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.OtherOperationInProgress, - Types.OperationNotAllowed, - Types.VmIsTemplate { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.OtherOperationInProgress, + Types.OperationNotAllowed, + Types.VmIsTemplate { String method_call = "Async.VM.pause"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -3009,13 +3029,13 @@ public class VM extends XenAPIObject { * */ public void pause(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.OtherOperationInProgress, - Types.OperationNotAllowed, - Types.VmIsTemplate { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.OtherOperationInProgress, + Types.OperationNotAllowed, + Types.VmIsTemplate { String method_call = "VM.pause"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -3029,12 +3049,12 @@ public class VM extends XenAPIObject { * @return Task */ public Task unpauseAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.OperationNotAllowed, - Types.VmIsTemplate { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.OperationNotAllowed, + Types.VmIsTemplate { String method_call = "Async.VM.unpause"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -3048,12 +3068,12 @@ public class VM extends XenAPIObject { * */ public void unpause(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.OperationNotAllowed, - Types.VmIsTemplate { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.OperationNotAllowed, + Types.VmIsTemplate { String method_call = "VM.unpause"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -3067,13 +3087,13 @@ public class VM extends XenAPIObject { * @return Task */ public Task cleanShutdownAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.OtherOperationInProgress, - Types.OperationNotAllowed, - Types.VmIsTemplate { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.OtherOperationInProgress, + Types.OperationNotAllowed, + Types.VmIsTemplate { String method_call = "Async.VM.clean_shutdown"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -3087,13 +3107,13 @@ public class VM extends XenAPIObject { * */ public void cleanShutdown(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.OtherOperationInProgress, - Types.OperationNotAllowed, - Types.VmIsTemplate { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.OtherOperationInProgress, + Types.OperationNotAllowed, + Types.VmIsTemplate { String method_call = "VM.clean_shutdown"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -3101,19 +3121,59 @@ public class VM extends XenAPIObject { return; } + /** + * Attempts to first clean shutdown a VM and if it should fail then perform a hard shutdown on it. + * + * @return Task + */ + public Task shutdownAsync(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.OtherOperationInProgress, + Types.OperationNotAllowed, + Types.VmIsTemplate { + String method_call = "Async.VM.shutdown"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + Object result = response.get("Value"); + return Types.toTask(result); + } + + /** + * Attempts to first clean shutdown a VM and if it should fail then perform a hard shutdown on it. + * + */ + public void shutdown(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.OtherOperationInProgress, + Types.OperationNotAllowed, + Types.VmIsTemplate { + String method_call = "VM.shutdown"; + String session = c.getSessionReference(); + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; + Map response = c.dispatch(method_call, method_params); + return; + } + /** * Attempt to cleanly shutdown the specified VM (Note: this may not be supported---e.g. if a guest agent is not installed). This can only be called when the specified VM is in the Running state. * * @return Task */ public Task cleanRebootAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.OtherOperationInProgress, - Types.OperationNotAllowed, - Types.VmIsTemplate { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.OtherOperationInProgress, + Types.OperationNotAllowed, + Types.VmIsTemplate { String method_call = "Async.VM.clean_reboot"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -3127,13 +3187,13 @@ public class VM extends XenAPIObject { * */ public void cleanReboot(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.OtherOperationInProgress, - Types.OperationNotAllowed, - Types.VmIsTemplate { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.OtherOperationInProgress, + Types.OperationNotAllowed, + Types.VmIsTemplate { String method_call = "VM.clean_reboot"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -3147,13 +3207,13 @@ public class VM extends XenAPIObject { * @return Task */ public Task hardShutdownAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.OtherOperationInProgress, - Types.OperationNotAllowed, - Types.VmIsTemplate { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.OtherOperationInProgress, + Types.OperationNotAllowed, + Types.VmIsTemplate { String method_call = "Async.VM.hard_shutdown"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -3167,13 +3227,13 @@ public class VM extends XenAPIObject { * */ public void hardShutdown(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.OtherOperationInProgress, - Types.OperationNotAllowed, - Types.VmIsTemplate { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.OtherOperationInProgress, + Types.OperationNotAllowed, + Types.VmIsTemplate { String method_call = "VM.hard_shutdown"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -3187,9 +3247,9 @@ public class VM extends XenAPIObject { * @return Task */ public Task powerStateResetAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.power_state_reset"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -3203,9 +3263,9 @@ public class VM extends XenAPIObject { * */ public void powerStateReset(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.power_state_reset"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -3219,13 +3279,13 @@ public class VM extends XenAPIObject { * @return Task */ public Task hardRebootAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.OtherOperationInProgress, - Types.OperationNotAllowed, - Types.VmIsTemplate { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.OtherOperationInProgress, + Types.OperationNotAllowed, + Types.VmIsTemplate { String method_call = "Async.VM.hard_reboot"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -3239,13 +3299,13 @@ public class VM extends XenAPIObject { * */ public void hardReboot(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.OtherOperationInProgress, - Types.OperationNotAllowed, - Types.VmIsTemplate { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.OtherOperationInProgress, + Types.OperationNotAllowed, + Types.VmIsTemplate { String method_call = "VM.hard_reboot"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -3259,13 +3319,13 @@ public class VM extends XenAPIObject { * @return Task */ public Task suspendAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.OtherOperationInProgress, - Types.OperationNotAllowed, - Types.VmIsTemplate { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.OtherOperationInProgress, + Types.OperationNotAllowed, + Types.VmIsTemplate { String method_call = "Async.VM.suspend"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -3279,13 +3339,13 @@ public class VM extends XenAPIObject { * */ public void suspend(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.OtherOperationInProgress, - Types.OperationNotAllowed, - Types.VmIsTemplate { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.OtherOperationInProgress, + Types.OperationNotAllowed, + Types.VmIsTemplate { String method_call = "VM.suspend"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -3301,12 +3361,12 @@ public class VM extends XenAPIObject { * @return Task */ public Task resumeAsync(Connection c, Boolean startPaused, Boolean force) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.OperationNotAllowed, - Types.VmIsTemplate { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.OperationNotAllowed, + Types.VmIsTemplate { String method_call = "Async.VM.resume"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(startPaused), Marshalling.toXMLRPC(force)}; @@ -3322,12 +3382,12 @@ public class VM extends XenAPIObject { * @param force Attempt to force the VM to resume. If this flag is false then the VM may fail pre-resume safety checks (e.g. if the CPU the VM was running on looks substantially different to the current one) */ public void resume(Connection c, Boolean startPaused, Boolean force) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.OperationNotAllowed, - Types.VmIsTemplate { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.OperationNotAllowed, + Types.VmIsTemplate { String method_call = "VM.resume"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(startPaused), Marshalling.toXMLRPC(force)}; @@ -3344,16 +3404,15 @@ public class VM extends XenAPIObject { * @return Task */ public Task resumeOnAsync(Connection c, Host host, Boolean startPaused, Boolean force) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.OperationNotAllowed, - Types.VmIsTemplate { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.OperationNotAllowed, + Types.VmIsTemplate { String method_call = "Async.VM.resume_on"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(startPaused), - Marshalling.toXMLRPC(force)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(startPaused), Marshalling.toXMLRPC(force)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -3367,16 +3426,15 @@ public class VM extends XenAPIObject { * @param force Attempt to force the VM to resume. If this flag is false then the VM may fail pre-resume safety checks (e.g. if the CPU the VM was running on looks substantially different to the current one) */ public void resumeOn(Connection c, Host host, Boolean startPaused, Boolean force) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.OperationNotAllowed, - Types.VmIsTemplate { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.OperationNotAllowed, + Types.VmIsTemplate { String method_call = "VM.resume_on"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(startPaused), - Marshalling.toXMLRPC(force)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(startPaused), Marshalling.toXMLRPC(force)}; Map response = c.dispatch(method_call, method_params); return; } @@ -3389,15 +3447,15 @@ public class VM extends XenAPIObject { * @return Task */ public Task poolMigrateAsync(Connection c, Host host, Map options) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.OtherOperationInProgress, - Types.VmIsTemplate, - Types.OperationNotAllowed, - Types.VmMigrateFailed, - Types.VmMissingPvDrivers { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.OtherOperationInProgress, + Types.VmIsTemplate, + Types.OperationNotAllowed, + Types.VmMigrateFailed, + Types.VmMissingPvDrivers { String method_call = "Async.VM.pool_migrate"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(options)}; @@ -3413,15 +3471,15 @@ public class VM extends XenAPIObject { * @param options Extra configuration operations */ public void poolMigrate(Connection c, Host host, Map options) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState, - Types.OtherOperationInProgress, - Types.VmIsTemplate, - Types.OperationNotAllowed, - Types.VmMigrateFailed, - Types.VmMissingPvDrivers { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState, + Types.OtherOperationInProgress, + Types.VmIsTemplate, + Types.OperationNotAllowed, + Types.VmMigrateFailed, + Types.VmMissingPvDrivers { String method_call = "VM.pool_migrate"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(options)}; @@ -3436,9 +3494,9 @@ public class VM extends XenAPIObject { * @return Task */ public Task setVCPUsNumberLiveAsync(Connection c, Long nvcpu) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.set_VCPUs_number_live"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(nvcpu)}; @@ -3453,9 +3511,9 @@ public class VM extends XenAPIObject { * @param nvcpu The number of VCPUs */ public void setVCPUsNumberLive(Connection c, Long nvcpu) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_VCPUs_number_live"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(nvcpu)}; @@ -3471,9 +3529,9 @@ public class VM extends XenAPIObject { * @return Task */ public Task addToVCPUsParamsLiveAsync(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.add_to_VCPUs_params_live"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -3489,9 +3547,9 @@ public class VM extends XenAPIObject { * @param value The value */ public void addToVCPUsParamsLive(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.add_to_VCPUs_params_live"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -3505,9 +3563,9 @@ public class VM extends XenAPIObject { * @param value The value */ public void setHaRestartPriority(Connection c, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_ha_restart_priority"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -3521,11 +3579,10 @@ public class VM extends XenAPIObject { * * @param value The value */ - @Deprecated - public void setHaAlwaysRun(Connection c, Boolean value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public void setHaAlwaysRun(Connection c, Boolean value) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_ha_always_run"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -3539,9 +3596,9 @@ public class VM extends XenAPIObject { * @return Task */ public Task computeMemoryOverheadAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.compute_memory_overhead"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -3556,15 +3613,15 @@ public class VM extends XenAPIObject { * @return the virtualization memory overhead of the VM. */ public Long computeMemoryOverhead(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.compute_memory_overhead"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -3573,9 +3630,9 @@ public class VM extends XenAPIObject { * @param value The new value of memory_dynamic_max */ public void setMemoryDynamicMax(Connection c, Long value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_memory_dynamic_max"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -3589,9 +3646,9 @@ public class VM extends XenAPIObject { * @param value The new value of memory_dynamic_min */ public void setMemoryDynamicMin(Connection c, Long value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_memory_dynamic_min"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -3607,9 +3664,9 @@ public class VM extends XenAPIObject { * @return Task */ public Task setMemoryDynamicRangeAsync(Connection c, Long min, Long max) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.set_memory_dynamic_range"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(min), Marshalling.toXMLRPC(max)}; @@ -3625,9 +3682,9 @@ public class VM extends XenAPIObject { * @param max The new maximum value */ public void setMemoryDynamicRange(Connection c, Long min, Long max) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_memory_dynamic_range"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(min), Marshalling.toXMLRPC(max)}; @@ -3641,10 +3698,10 @@ public class VM extends XenAPIObject { * @param value The new value of memory_static_max */ public void setMemoryStaticMax(Connection c, Long value) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.HaOperationWouldBreakFailoverPlan { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.HaOperationWouldBreakFailoverPlan { String method_call = "VM.set_memory_static_max"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -3658,9 +3715,9 @@ public class VM extends XenAPIObject { * @param value The new value of memory_static_min */ public void setMemoryStaticMin(Connection c, Long value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_memory_static_min"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -3676,9 +3733,9 @@ public class VM extends XenAPIObject { * @return Task */ public Task setMemoryStaticRangeAsync(Connection c, Long min, Long max) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.set_memory_static_range"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(min), Marshalling.toXMLRPC(max)}; @@ -3694,9 +3751,9 @@ public class VM extends XenAPIObject { * @param max The new maximum value */ public void setMemoryStaticRange(Connection c, Long min, Long max) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_memory_static_range"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(min), Marshalling.toXMLRPC(max)}; @@ -3714,13 +3771,12 @@ public class VM extends XenAPIObject { * @return Task */ public Task setMemoryLimitsAsync(Connection c, Long staticMin, Long staticMax, Long dynamicMin, Long dynamicMax) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.set_memory_limits"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(staticMin), Marshalling.toXMLRPC(staticMax), - Marshalling.toXMLRPC(dynamicMin), Marshalling.toXMLRPC(dynamicMax)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(staticMin), Marshalling.toXMLRPC(staticMax), Marshalling.toXMLRPC(dynamicMin), Marshalling.toXMLRPC(dynamicMax)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -3735,13 +3791,12 @@ public class VM extends XenAPIObject { * @param dynamicMax The new value of memory_dynamic_max. */ public void setMemoryLimits(Connection c, Long staticMin, Long staticMax, Long dynamicMin, Long dynamicMax) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_memory_limits"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(staticMin), Marshalling.toXMLRPC(staticMax), - Marshalling.toXMLRPC(dynamicMin), Marshalling.toXMLRPC(dynamicMax)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(staticMin), Marshalling.toXMLRPC(staticMax), Marshalling.toXMLRPC(dynamicMin), Marshalling.toXMLRPC(dynamicMax)}; Map response = c.dispatch(method_call, method_params); return; } @@ -3753,11 +3808,10 @@ public class VM extends XenAPIObject { * @param target The target in bytes * @return Task */ - @Deprecated - public Task setMemoryTargetLiveAsync(Connection c, Long target) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public Task setMemoryTargetLiveAsync(Connection c, Long target) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.set_memory_target_live"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(target)}; @@ -3772,11 +3826,10 @@ public class VM extends XenAPIObject { * * @param target The target in bytes */ - @Deprecated - public void setMemoryTargetLive(Connection c, Long target) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public void setMemoryTargetLive(Connection c, Long target) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_memory_target_live"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(target)}; @@ -3790,11 +3843,10 @@ public class VM extends XenAPIObject { * * @return Task */ - @Deprecated - public Task waitMemoryTargetLiveAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public Task waitMemoryTargetLiveAsync(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.wait_memory_target_live"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -3808,11 +3860,10 @@ public class VM extends XenAPIObject { * @deprecated * */ - @Deprecated - public void waitMemoryTargetLive(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public void waitMemoryTargetLive(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.wait_memory_target_live"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -3826,11 +3877,10 @@ public class VM extends XenAPIObject { * * @return Task */ - @Deprecated - public Task getCooperativeAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public Task getCooperativeAsync(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.get_cooperative"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -3845,17 +3895,16 @@ public class VM extends XenAPIObject { * * @return true if the VM is currently 'co-operative'; false otherwise */ - @Deprecated - public Boolean getCooperative(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + @Deprecated public Boolean getCooperative(Connection c) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_cooperative"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -3864,9 +3913,9 @@ public class VM extends XenAPIObject { * @param value The new shadow memory multiplier to set */ public void setHVMShadowMultiplier(Connection c, Double value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_HVM_shadow_multiplier"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -3881,9 +3930,9 @@ public class VM extends XenAPIObject { * @return Task */ public Task setShadowMultiplierLiveAsync(Connection c, Double multiplier) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.set_shadow_multiplier_live"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(multiplier)}; @@ -3898,9 +3947,9 @@ public class VM extends XenAPIObject { * @param multiplier The new shadow memory multiplier to set */ public void setShadowMultiplierLive(Connection c, Double multiplier) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_shadow_multiplier_live"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(multiplier)}; @@ -3914,9 +3963,9 @@ public class VM extends XenAPIObject { * @param value The new maximum number of VCPUs */ public void setVCPUsMax(Connection c, Long value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_VCPUs_max"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -3930,9 +3979,9 @@ public class VM extends XenAPIObject { * @param value The new maximum number of VCPUs */ public void setVCPUsAtStartup(Connection c, Long value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_VCPUs_at_startup"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -3947,10 +3996,10 @@ public class VM extends XenAPIObject { * @return Task */ public Task sendSysrqAsync(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState { String method_call = "Async.VM.send_sysrq"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -3965,10 +4014,10 @@ public class VM extends XenAPIObject { * @param key The key to send */ public void sendSysrq(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState { String method_call = "VM.send_sysrq"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -3983,10 +4032,10 @@ public class VM extends XenAPIObject { * @return Task */ public Task sendTriggerAsync(Connection c, String trigger) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState { String method_call = "Async.VM.send_trigger"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(trigger)}; @@ -4001,10 +4050,10 @@ public class VM extends XenAPIObject { * @param trigger The trigger to send */ public void sendTrigger(Connection c, String trigger) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState { String method_call = "VM.send_trigger"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(trigger)}; @@ -4020,9 +4069,9 @@ public class VM extends XenAPIObject { * @return Task */ public Task maximiseMemoryAsync(Connection c, Long total, Boolean approximate) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.maximise_memory"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(total), Marshalling.toXMLRPC(approximate)}; @@ -4039,15 +4088,15 @@ public class VM extends XenAPIObject { * @return The maximum possible static-max */ public Long maximiseMemory(Connection c, Long total, Boolean approximate) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.maximise_memory"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(total), Marshalling.toXMLRPC(approximate)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -4061,14 +4110,13 @@ public class VM extends XenAPIObject { * @return Task */ public Task migrateSendAsync(Connection c, Map dest, Boolean live, Map vdiMap, Map vifMap, Map options) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState { String method_call = "Async.VM.migrate_send"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(dest), Marshalling.toXMLRPC(live), - Marshalling.toXMLRPC(vdiMap), Marshalling.toXMLRPC(vifMap), Marshalling.toXMLRPC(options)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(dest), Marshalling.toXMLRPC(live), Marshalling.toXMLRPC(vdiMap), Marshalling.toXMLRPC(vifMap), Marshalling.toXMLRPC(options)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -4084,14 +4132,13 @@ public class VM extends XenAPIObject { * @param options Other parameters */ public void migrateSend(Connection c, Map dest, Boolean live, Map vdiMap, Map vifMap, Map options) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmBadPowerState { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmBadPowerState { String method_call = "VM.migrate_send"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(dest), Marshalling.toXMLRPC(live), - Marshalling.toXMLRPC(vdiMap), Marshalling.toXMLRPC(vifMap), Marshalling.toXMLRPC(options)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(dest), Marshalling.toXMLRPC(live), Marshalling.toXMLRPC(vdiMap), Marshalling.toXMLRPC(vifMap), Marshalling.toXMLRPC(options)}; Map response = c.dispatch(method_call, method_params); return; } @@ -4106,15 +4153,13 @@ public class VM extends XenAPIObject { * @param options Other parameters * @return Task */ - public Task assertCanMigrateAsync(Connection c, Map dest, Boolean live, Map vdiMap, Map vifMap, Map options) - throws - BadServerResponse, - XenAPIException, - XmlRpcException { + public Task assertCanMigrateAsync(Connection c, Map dest, Boolean live, Map vdiMap, Map vifMap, Map options) throws + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.assert_can_migrate"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(dest), Marshalling.toXMLRPC(live), - Marshalling.toXMLRPC(vdiMap), Marshalling.toXMLRPC(vifMap), Marshalling.toXMLRPC(options)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(dest), Marshalling.toXMLRPC(live), Marshalling.toXMLRPC(vdiMap), Marshalling.toXMLRPC(vifMap), Marshalling.toXMLRPC(options)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -4130,13 +4175,12 @@ public class VM extends XenAPIObject { * @param options Other parameters */ public void assertCanMigrate(Connection c, Map dest, Boolean live, Map vdiMap, Map vifMap, Map options) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.assert_can_migrate"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(dest), Marshalling.toXMLRPC(live), - Marshalling.toXMLRPC(vdiMap), Marshalling.toXMLRPC(vifMap), Marshalling.toXMLRPC(options)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(dest), Marshalling.toXMLRPC(live), Marshalling.toXMLRPC(vdiMap), Marshalling.toXMLRPC(vifMap), Marshalling.toXMLRPC(options)}; Map response = c.dispatch(method_call, method_params); return; } @@ -4147,32 +4191,32 @@ public class VM extends XenAPIObject { * @return A record describing the VM */ public VM.Record getBootRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_boot_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVMRecord(result); + return Types.toVMRecord(result); } /** - * + * * * @return A set of data sources */ public Set getDataSources(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_data_sources"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfDataSourceRecord(result); + return Types.toSetOfDataSourceRecord(result); } /** @@ -4181,9 +4225,9 @@ public class VM extends XenAPIObject { * @param dataSource The data source to record */ public void recordDataSource(Connection c, String dataSource) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.record_data_source"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(dataSource)}; @@ -4198,15 +4242,15 @@ public class VM extends XenAPIObject { * @return The latest value, averaged over the last 5 seconds */ public Double queryDataSource(Connection c, String dataSource) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.query_data_source"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(dataSource)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDouble(result); + return Types.toDouble(result); } /** @@ -4215,9 +4259,9 @@ public class VM extends XenAPIObject { * @param dataSource The data source whose archives are to be forgotten */ public void forgetDataSourceArchives(Connection c, String dataSource) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.forget_data_source_archives"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(dataSource)}; @@ -4232,9 +4276,9 @@ public class VM extends XenAPIObject { * @return Task */ public Task assertOperationValidAsync(Connection c, Types.VmOperations op) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.assert_operation_valid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(op)}; @@ -4249,9 +4293,9 @@ public class VM extends XenAPIObject { * @param op proposed operation */ public void assertOperationValid(Connection c, Types.VmOperations op) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.assert_operation_valid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(op)}; @@ -4265,9 +4309,9 @@ public class VM extends XenAPIObject { * @return Task */ public Task updateAllowedOperationsAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.update_allowed_operations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -4281,9 +4325,9 @@ public class VM extends XenAPIObject { * */ public void updateAllowedOperations(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.update_allowed_operations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -4297,15 +4341,15 @@ public class VM extends XenAPIObject { * @return The allowed values */ public Set getAllowedVBDDevices(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_allowed_VBD_devices"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -4314,15 +4358,15 @@ public class VM extends XenAPIObject { * @return The allowed values */ public Set getAllowedVIFDevices(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_allowed_VIF_devices"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -4331,9 +4375,9 @@ public class VM extends XenAPIObject { * @return Task */ public Task getPossibleHostsAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.get_possible_hosts"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -4348,15 +4392,15 @@ public class VM extends XenAPIObject { * @return The possible hosts */ public Set getPossibleHosts(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_possible_hosts"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfHost(result); + return Types.toSetOfHost(result); } /** @@ -4366,12 +4410,12 @@ public class VM extends XenAPIObject { * @return Task */ public Task assertCanBootHereAsync(Connection c, Host host) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.HostNotEnoughFreeMemory, - Types.VmRequiresSr, - Types.VmHostIncompatibleVersion { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.HostNotEnoughFreeMemory, + Types.VmRequiresSr, + Types.VmHostIncompatibleVersion { String method_call = "Async.VM.assert_can_boot_here"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host)}; @@ -4386,12 +4430,12 @@ public class VM extends XenAPIObject { * @param host The host */ public void assertCanBootHere(Connection c, Host host) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.HostNotEnoughFreeMemory, - Types.VmRequiresSr, - Types.VmHostIncompatibleVersion { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.HostNotEnoughFreeMemory, + Types.VmRequiresSr, + Types.VmHostIncompatibleVersion { String method_call = "VM.assert_can_boot_here"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host)}; @@ -4408,13 +4452,12 @@ public class VM extends XenAPIObject { * @return Task */ public Task createNewBlobAsync(Connection c, String name, String mimeType, Boolean _public) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.create_new_blob"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), - Marshalling.toXMLRPC(_public)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), Marshalling.toXMLRPC(_public)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -4429,16 +4472,15 @@ public class VM extends XenAPIObject { * @return The reference of the blob, needed for populating its data */ public Blob createNewBlob(Connection c, String name, String mimeType, Boolean _public) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.create_new_blob"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), - Marshalling.toXMLRPC(_public)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), Marshalling.toXMLRPC(_public)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBlob(result); + return Types.toBlob(result); } /** @@ -4447,9 +4489,9 @@ public class VM extends XenAPIObject { * @return Task */ public Task assertAgileAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.assert_agile"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -4463,9 +4505,9 @@ public class VM extends XenAPIObject { * */ public void assertAgile(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.assert_agile"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -4479,9 +4521,9 @@ public class VM extends XenAPIObject { * @return Task */ public Task retrieveWlbRecommendationsAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.retrieve_wlb_recommendations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -4496,15 +4538,15 @@ public class VM extends XenAPIObject { * @return The potential hosts and their corresponding recommendations or errors */ public Map> retrieveWlbRecommendations(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.retrieve_wlb_recommendations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfHostSetOfString(result); + return Types.toMapOfHostSetOfString(result); } /** @@ -4514,9 +4556,9 @@ public class VM extends XenAPIObject { * @return Task */ public Task copyBiosStringsAsync(Connection c, Host host) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.copy_bios_strings"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host)}; @@ -4531,9 +4573,9 @@ public class VM extends XenAPIObject { * @param host The host to copy the BIOS strings from */ public void copyBiosStrings(Connection c, Host host) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.copy_bios_strings"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host)}; @@ -4547,9 +4589,9 @@ public class VM extends XenAPIObject { * @param value The value */ public void setProtectionPolicy(Connection c, VMPP value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_protection_policy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -4564,9 +4606,9 @@ public class VM extends XenAPIObject { * @return Task */ public Task setStartDelayAsync(Connection c, Long value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.set_start_delay"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -4581,9 +4623,9 @@ public class VM extends XenAPIObject { * @param value This VM's start delay in seconds */ public void setStartDelay(Connection c, Long value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_start_delay"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -4598,9 +4640,9 @@ public class VM extends XenAPIObject { * @return Task */ public Task setShutdownDelayAsync(Connection c, Long value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.set_shutdown_delay"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -4615,9 +4657,9 @@ public class VM extends XenAPIObject { * @param value This VM's shutdown delay in seconds */ public void setShutdownDelay(Connection c, Long value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_shutdown_delay"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -4632,9 +4674,9 @@ public class VM extends XenAPIObject { * @return Task */ public Task setOrderAsync(Connection c, Long value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.set_order"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -4649,9 +4691,9 @@ public class VM extends XenAPIObject { * @param value This VM's boot order */ public void setOrder(Connection c, Long value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_order"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -4666,9 +4708,9 @@ public class VM extends XenAPIObject { * @return Task */ public Task setSuspendVDIAsync(Connection c, VDI value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.set_suspend_VDI"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -4683,9 +4725,9 @@ public class VM extends XenAPIObject { * @param value The suspend VDI uuid */ public void setSuspendVDI(Connection c, VDI value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_suspend_VDI"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -4700,11 +4742,11 @@ public class VM extends XenAPIObject { * @return Task */ public Task assertCanBeRecoveredAsync(Connection c, Session sessionTo) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmIsPartOfAnAppliance, - Types.VmRequiresSr { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmIsPartOfAnAppliance, + Types.VmRequiresSr { String method_call = "Async.VM.assert_can_be_recovered"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(sessionTo)}; @@ -4719,11 +4761,11 @@ public class VM extends XenAPIObject { * @param sessionTo The session to which the VM is to be recovered. */ public void assertCanBeRecovered(Connection c, Session sessionTo) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmIsPartOfAnAppliance, - Types.VmRequiresSr { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmIsPartOfAnAppliance, + Types.VmRequiresSr { String method_call = "VM.assert_can_be_recovered"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(sessionTo)}; @@ -4739,9 +4781,9 @@ public class VM extends XenAPIObject { * @return Task */ public Task recoverAsync(Connection c, Session sessionTo, Boolean force) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.recover"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(sessionTo), Marshalling.toXMLRPC(force)}; @@ -4757,9 +4799,9 @@ public class VM extends XenAPIObject { * @param force Whether the VM should replace newer versions of itself. */ public void recover(Connection c, Session sessionTo, Boolean force) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.recover"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(sessionTo), Marshalling.toXMLRPC(force)}; @@ -4778,13 +4820,12 @@ public class VM extends XenAPIObject { * @return Task */ public static Task importConvertAsync(Connection c, String type, String username, String password, SR sr, Map remoteConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.import_convert"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(username), Marshalling.toXMLRPC(password), - Marshalling.toXMLRPC(sr), Marshalling.toXMLRPC(remoteConfig)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(username), Marshalling.toXMLRPC(password), Marshalling.toXMLRPC(sr), Marshalling.toXMLRPC(remoteConfig)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); @@ -4800,13 +4841,12 @@ public class VM extends XenAPIObject { * @param remoteConfig Remote configuration options */ public static void importConvert(Connection c, String type, String username, String password, SR sr, Map remoteConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.import_convert"; String session = c.getSessionReference(); - Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(username), Marshalling.toXMLRPC(password), - Marshalling.toXMLRPC(sr), Marshalling.toXMLRPC(remoteConfig)}; + Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(username), Marshalling.toXMLRPC(password), Marshalling.toXMLRPC(sr), Marshalling.toXMLRPC(remoteConfig)}; Map response = c.dispatch(method_call, method_params); return; } @@ -4818,9 +4858,9 @@ public class VM extends XenAPIObject { * @return Task */ public Task setApplianceAsync(Connection c, VMAppliance value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.set_appliance"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -4835,9 +4875,9 @@ public class VM extends XenAPIObject { * @param value The appliance to which this VM should be assigned. */ public void setAppliance(Connection c, VMAppliance value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.set_appliance"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -4851,9 +4891,9 @@ public class VM extends XenAPIObject { * @return Task */ public Task queryServicesAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM.query_services"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -4868,15 +4908,15 @@ public class VM extends XenAPIObject { * @return map of service type to name */ public Map queryServices(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.query_services"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -4885,15 +4925,15 @@ public class VM extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVM(result); + return Types.toSetOfVM(result); } /** @@ -4902,15 +4942,15 @@ public class VM extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfVMVMRecord(result); + return Types.toMapOfVMVMRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/VMAppliance.java b/deps/XenServerJava/src/com/xensource/xenapi/VMAppliance.java index b7e7e36684e..a0eb0d6f55e 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/VMAppliance.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/VMAppliance.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class VMAppliance extends XenAPIObject { * For internal use only. */ VMAppliance(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class VMAppliance extends XenAPIObject { { if (obj != null && obj instanceof VMAppliance) { - VMAppliance other = (VMAppliance)obj; + VMAppliance other = (VMAppliance) obj; return other.ref.equals(this.ref); } else { @@ -111,8 +112,8 @@ public class VMAppliance extends XenAPIObject { /** * Convert a VM_appliance.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("name_label", this.nameLabel == null ? "" : this.nameLabel); map.put("name_description", this.nameDescription == null ? "" : this.nameDescription); @@ -154,15 +155,15 @@ public class VMAppliance extends XenAPIObject { * @return all fields from the object */ public VMAppliance.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_appliance.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVMApplianceRecord(result); + return Types.toVMApplianceRecord(result); } /** @@ -172,15 +173,15 @@ public class VMAppliance extends XenAPIObject { * @return reference to the object */ public static VMAppliance getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_appliance.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVMAppliance(result); + return Types.toVMAppliance(result); } /** @@ -190,9 +191,9 @@ public class VMAppliance extends XenAPIObject { * @return Task */ public static Task createAsync(Connection c, VMAppliance.Record record) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM_appliance.create"; String session = c.getSessionReference(); Map record_map = record.toMap(); @@ -209,16 +210,16 @@ public class VMAppliance extends XenAPIObject { * @return reference to the newly created object */ public static VMAppliance create(Connection c, VMAppliance.Record record) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_appliance.create"; String session = c.getSessionReference(); Map record_map = record.toMap(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVMAppliance(result); + return Types.toVMAppliance(result); } /** @@ -227,9 +228,9 @@ public class VMAppliance extends XenAPIObject { * @return Task */ public Task destroyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VM_appliance.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -243,9 +244,9 @@ public class VMAppliance extends XenAPIObject { * */ public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_appliance.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -260,15 +261,15 @@ public class VMAppliance extends XenAPIObject { * @return references to objects with matching names */ public static Set getByNameLabel(Connection c, String label) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_appliance.get_by_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVMAppliance(result); + return Types.toSetOfVMAppliance(result); } /** @@ -277,15 +278,15 @@ public class VMAppliance extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_appliance.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -294,15 +295,15 @@ public class VMAppliance extends XenAPIObject { * @return value of the field */ public String getNameLabel(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_appliance.get_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -311,15 +312,15 @@ public class VMAppliance extends XenAPIObject { * @return value of the field */ public String getNameDescription(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_appliance.get_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -328,15 +329,15 @@ public class VMAppliance extends XenAPIObject { * @return value of the field */ public Set getAllowedOperations(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_appliance.get_allowed_operations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVmApplianceOperation(result); + return Types.toSetOfVmApplianceOperation(result); } /** @@ -345,15 +346,15 @@ public class VMAppliance extends XenAPIObject { * @return value of the field */ public Map getCurrentOperations(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_appliance.get_current_operations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringVmApplianceOperation(result); + return Types.toMapOfStringVmApplianceOperation(result); } /** @@ -362,15 +363,15 @@ public class VMAppliance extends XenAPIObject { * @return value of the field */ public Set getVMs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_appliance.get_VMs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVM(result); + return Types.toSetOfVM(result); } /** @@ -379,9 +380,9 @@ public class VMAppliance extends XenAPIObject { * @param label New value to set */ public void setNameLabel(Connection c, String label) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_appliance.set_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(label)}; @@ -395,9 +396,9 @@ public class VMAppliance extends XenAPIObject { * @param description New value to set */ public void setNameDescription(Connection c, String description) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_appliance.set_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(description)}; @@ -412,10 +413,10 @@ public class VMAppliance extends XenAPIObject { * @return Task */ public Task startAsync(Connection c, Boolean paused) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.OperationPartiallyFailed { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.OperationPartiallyFailed { String method_call = "Async.VM_appliance.start"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(paused)}; @@ -430,10 +431,10 @@ public class VMAppliance extends XenAPIObject { * @param paused Instantiate all VMs belonging to this appliance in paused state if set to true. */ public void start(Connection c, Boolean paused) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.OperationPartiallyFailed { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.OperationPartiallyFailed { String method_call = "VM_appliance.start"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(paused)}; @@ -447,10 +448,10 @@ public class VMAppliance extends XenAPIObject { * @return Task */ public Task cleanShutdownAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.OperationPartiallyFailed { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.OperationPartiallyFailed { String method_call = "Async.VM_appliance.clean_shutdown"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -464,10 +465,10 @@ public class VMAppliance extends XenAPIObject { * */ public void cleanShutdown(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.OperationPartiallyFailed { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.OperationPartiallyFailed { String method_call = "VM_appliance.clean_shutdown"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -481,10 +482,10 @@ public class VMAppliance extends XenAPIObject { * @return Task */ public Task hardShutdownAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.OperationPartiallyFailed { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.OperationPartiallyFailed { String method_call = "Async.VM_appliance.hard_shutdown"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -498,10 +499,10 @@ public class VMAppliance extends XenAPIObject { * */ public void hardShutdown(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.OperationPartiallyFailed { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.OperationPartiallyFailed { String method_call = "VM_appliance.hard_shutdown"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -515,10 +516,10 @@ public class VMAppliance extends XenAPIObject { * @return Task */ public Task shutdownAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.OperationPartiallyFailed { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.OperationPartiallyFailed { String method_call = "Async.VM_appliance.shutdown"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -532,10 +533,10 @@ public class VMAppliance extends XenAPIObject { * */ public void shutdown(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.OperationPartiallyFailed { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.OperationPartiallyFailed { String method_call = "VM_appliance.shutdown"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -550,10 +551,10 @@ public class VMAppliance extends XenAPIObject { * @return Task */ public Task assertCanBeRecoveredAsync(Connection c, Session sessionTo) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmRequiresSr { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmRequiresSr { String method_call = "Async.VM_appliance.assert_can_be_recovered"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(sessionTo)}; @@ -568,10 +569,10 @@ public class VMAppliance extends XenAPIObject { * @param sessionTo The session to which the VM appliance is to be recovered. */ public void assertCanBeRecovered(Connection c, Session sessionTo) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmRequiresSr { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmRequiresSr { String method_call = "VM_appliance.assert_can_be_recovered"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(sessionTo)}; @@ -587,10 +588,10 @@ public class VMAppliance extends XenAPIObject { * @return Task */ public Task recoverAsync(Connection c, Session sessionTo, Boolean force) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmRequiresSr { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmRequiresSr { String method_call = "Async.VM_appliance.recover"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(sessionTo), Marshalling.toXMLRPC(force)}; @@ -606,10 +607,10 @@ public class VMAppliance extends XenAPIObject { * @param force Whether the VMs should replace newer versions of themselves. */ public void recover(Connection c, Session sessionTo, Boolean force) throws - BadServerResponse, - XenAPIException, - XmlRpcException, - Types.VmRequiresSr { + BadServerResponse, + XenAPIException, + XmlRpcException, + Types.VmRequiresSr { String method_call = "VM_appliance.recover"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(sessionTo), Marshalling.toXMLRPC(force)}; @@ -623,15 +624,15 @@ public class VMAppliance extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_appliance.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVMAppliance(result); + return Types.toSetOfVMAppliance(result); } /** @@ -640,15 +641,15 @@ public class VMAppliance extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_appliance.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfVMApplianceVMApplianceRecord(result); + return Types.toMapOfVMApplianceVMApplianceRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/VMGuestMetrics.java b/deps/XenServerJava/src/com/xensource/xenapi/VMGuestMetrics.java index 08d88e3641c..024f6c4d7e9 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/VMGuestMetrics.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/VMGuestMetrics.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class VMGuestMetrics extends XenAPIObject { * For internal use only. */ VMGuestMetrics(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class VMGuestMetrics extends XenAPIObject { { if (obj != null && obj instanceof VMGuestMetrics) { - VMGuestMetrics other = (VMGuestMetrics)obj; + VMGuestMetrics other = (VMGuestMetrics) obj; return other.ref.equals(this.ref); } else { @@ -116,8 +117,8 @@ public class VMGuestMetrics extends XenAPIObject { /** * Convert a VM_guest_metrics.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("os_version", this.osVersion == null ? new HashMap() : this.osVersion); map.put("PV_drivers_version", this.PVDriversVersion == null ? new HashMap() : this.PVDriversVersion); @@ -184,15 +185,15 @@ public class VMGuestMetrics extends XenAPIObject { * @return all fields from the object */ public VMGuestMetrics.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_guest_metrics.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVMGuestMetricsRecord(result); + return Types.toVMGuestMetricsRecord(result); } /** @@ -202,15 +203,15 @@ public class VMGuestMetrics extends XenAPIObject { * @return reference to the object */ public static VMGuestMetrics getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_guest_metrics.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVMGuestMetrics(result); + return Types.toVMGuestMetrics(result); } /** @@ -219,15 +220,15 @@ public class VMGuestMetrics extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_guest_metrics.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -236,15 +237,15 @@ public class VMGuestMetrics extends XenAPIObject { * @return value of the field */ public Map getOsVersion(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_guest_metrics.get_os_version"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -253,15 +254,15 @@ public class VMGuestMetrics extends XenAPIObject { * @return value of the field */ public Map getPVDriversVersion(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_guest_metrics.get_PV_drivers_version"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -270,15 +271,15 @@ public class VMGuestMetrics extends XenAPIObject { * @return value of the field */ public Boolean getPVDriversUpToDate(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_guest_metrics.get_PV_drivers_up_to_date"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -287,15 +288,15 @@ public class VMGuestMetrics extends XenAPIObject { * @return value of the field */ public Map getMemory(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_guest_metrics.get_memory"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -304,15 +305,15 @@ public class VMGuestMetrics extends XenAPIObject { * @return value of the field */ public Map getDisks(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_guest_metrics.get_disks"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -321,15 +322,15 @@ public class VMGuestMetrics extends XenAPIObject { * @return value of the field */ public Map getNetworks(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_guest_metrics.get_networks"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -338,15 +339,15 @@ public class VMGuestMetrics extends XenAPIObject { * @return value of the field */ public Map getOther(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_guest_metrics.get_other"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -355,15 +356,15 @@ public class VMGuestMetrics extends XenAPIObject { * @return value of the field */ public Date getLastUpdated(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_guest_metrics.get_last_updated"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDate(result); + return Types.toDate(result); } /** @@ -372,15 +373,15 @@ public class VMGuestMetrics extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_guest_metrics.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -389,15 +390,15 @@ public class VMGuestMetrics extends XenAPIObject { * @return value of the field */ public Boolean getLive(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_guest_metrics.get_live"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -406,9 +407,9 @@ public class VMGuestMetrics extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_guest_metrics.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -423,9 +424,9 @@ public class VMGuestMetrics extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_guest_metrics.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -439,9 +440,9 @@ public class VMGuestMetrics extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_guest_metrics.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -455,15 +456,15 @@ public class VMGuestMetrics extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_guest_metrics.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVMGuestMetrics(result); + return Types.toSetOfVMGuestMetrics(result); } /** @@ -472,15 +473,15 @@ public class VMGuestMetrics extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_guest_metrics.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfVMGuestMetricsVMGuestMetricsRecord(result); + return Types.toMapOfVMGuestMetricsVMGuestMetricsRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/VMMetrics.java b/deps/XenServerJava/src/com/xensource/xenapi/VMMetrics.java index 5f9a7a42c7c..30f49845158 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/VMMetrics.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/VMMetrics.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class VMMetrics extends XenAPIObject { * For internal use only. */ VMMetrics(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class VMMetrics extends XenAPIObject { { if (obj != null && obj instanceof VMMetrics) { - VMMetrics other = (VMMetrics)obj; + VMMetrics other = (VMMetrics) obj; return other.ref.equals(this.ref); } else { @@ -117,8 +118,8 @@ public class VMMetrics extends XenAPIObject { /** * Convert a VM_metrics.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("memory_actual", this.memoryActual == null ? 0 : this.memoryActual); map.put("VCPUs_number", this.VCPUsNumber == null ? 0 : this.VCPUsNumber); @@ -190,15 +191,15 @@ public class VMMetrics extends XenAPIObject { * @return all fields from the object */ public VMMetrics.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_metrics.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVMMetricsRecord(result); + return Types.toVMMetricsRecord(result); } /** @@ -208,15 +209,15 @@ public class VMMetrics extends XenAPIObject { * @return reference to the object */ public static VMMetrics getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_metrics.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVMMetrics(result); + return Types.toVMMetrics(result); } /** @@ -225,15 +226,15 @@ public class VMMetrics extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_metrics.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -242,15 +243,15 @@ public class VMMetrics extends XenAPIObject { * @return value of the field */ public Long getMemoryActual(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_metrics.get_memory_actual"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -259,15 +260,15 @@ public class VMMetrics extends XenAPIObject { * @return value of the field */ public Long getVCPUsNumber(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_metrics.get_VCPUs_number"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -276,15 +277,15 @@ public class VMMetrics extends XenAPIObject { * @return value of the field */ public Map getVCPUsUtilisation(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_metrics.get_VCPUs_utilisation"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfLongDouble(result); + return Types.toMapOfLongDouble(result); } /** @@ -293,15 +294,15 @@ public class VMMetrics extends XenAPIObject { * @return value of the field */ public Map getVCPUsCPU(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_metrics.get_VCPUs_CPU"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfLongLong(result); + return Types.toMapOfLongLong(result); } /** @@ -310,15 +311,15 @@ public class VMMetrics extends XenAPIObject { * @return value of the field */ public Map getVCPUsParams(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_metrics.get_VCPUs_params"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -327,15 +328,15 @@ public class VMMetrics extends XenAPIObject { * @return value of the field */ public Map> getVCPUsFlags(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_metrics.get_VCPUs_flags"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfLongSetOfString(result); + return Types.toMapOfLongSetOfString(result); } /** @@ -344,15 +345,15 @@ public class VMMetrics extends XenAPIObject { * @return value of the field */ public Set getState(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_metrics.get_state"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -361,15 +362,15 @@ public class VMMetrics extends XenAPIObject { * @return value of the field */ public Date getStartTime(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_metrics.get_start_time"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDate(result); + return Types.toDate(result); } /** @@ -378,15 +379,15 @@ public class VMMetrics extends XenAPIObject { * @return value of the field */ public Date getInstallTime(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_metrics.get_install_time"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDate(result); + return Types.toDate(result); } /** @@ -395,15 +396,15 @@ public class VMMetrics extends XenAPIObject { * @return value of the field */ public Date getLastUpdated(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_metrics.get_last_updated"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDate(result); + return Types.toDate(result); } /** @@ -412,15 +413,15 @@ public class VMMetrics extends XenAPIObject { * @return value of the field */ public Map getOtherConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_metrics.get_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -429,9 +430,9 @@ public class VMMetrics extends XenAPIObject { * @param otherConfig New value to set */ public void setOtherConfig(Connection c, Map otherConfig) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_metrics.set_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)}; @@ -446,9 +447,9 @@ public class VMMetrics extends XenAPIObject { * @param value Value to add */ public void addToOtherConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_metrics.add_to_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -462,9 +463,9 @@ public class VMMetrics extends XenAPIObject { * @param key Key to remove */ public void removeFromOtherConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_metrics.remove_from_other_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -478,15 +479,15 @@ public class VMMetrics extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_metrics.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVMMetrics(result); + return Types.toSetOfVMMetrics(result); } /** @@ -495,15 +496,15 @@ public class VMMetrics extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VM_metrics.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfVMMetricsVMMetricsRecord(result); + return Types.toMapOfVMMetricsVMMetricsRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/VMPP.java b/deps/XenServerJava/src/com/xensource/xenapi/VMPP.java index 0ee0b3e7439..f49019bbcec 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/VMPP.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/VMPP.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class VMPP extends XenAPIObject { * For internal use only. */ VMPP(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class VMPP extends XenAPIObject { { if (obj != null && obj instanceof VMPP) { - VMPP other = (VMPP)obj; + VMPP other = (VMPP) obj; return other.ref.equals(this.ref); } else { @@ -125,8 +126,8 @@ public class VMPP extends XenAPIObject { /** * Convert a VMPP.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("name_label", this.nameLabel == null ? "" : this.nameLabel); map.put("name_description", this.nameDescription == null ? "" : this.nameDescription); @@ -238,15 +239,15 @@ public class VMPP extends XenAPIObject { * @return all fields from the object */ public VMPP.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVMPPRecord(result); + return Types.toVMPPRecord(result); } /** @@ -256,15 +257,15 @@ public class VMPP extends XenAPIObject { * @return reference to the object */ public static VMPP getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVMPP(result); + return Types.toVMPP(result); } /** @@ -274,9 +275,9 @@ public class VMPP extends XenAPIObject { * @return Task */ public static Task createAsync(Connection c, VMPP.Record record) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VMPP.create"; String session = c.getSessionReference(); Map record_map = record.toMap(); @@ -293,16 +294,16 @@ public class VMPP extends XenAPIObject { * @return reference to the newly created object */ public static VMPP create(Connection c, VMPP.Record record) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.create"; String session = c.getSessionReference(); Map record_map = record.toMap(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVMPP(result); + return Types.toVMPP(result); } /** @@ -311,9 +312,9 @@ public class VMPP extends XenAPIObject { * @return Task */ public Task destroyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VMPP.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -327,9 +328,9 @@ public class VMPP extends XenAPIObject { * */ public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -344,15 +345,15 @@ public class VMPP extends XenAPIObject { * @return references to objects with matching names */ public static Set getByNameLabel(Connection c, String label) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.get_by_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVMPP(result); + return Types.toSetOfVMPP(result); } /** @@ -361,15 +362,15 @@ public class VMPP extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -378,15 +379,15 @@ public class VMPP extends XenAPIObject { * @return value of the field */ public String getNameLabel(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.get_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -395,15 +396,15 @@ public class VMPP extends XenAPIObject { * @return value of the field */ public String getNameDescription(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.get_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -412,15 +413,15 @@ public class VMPP extends XenAPIObject { * @return value of the field */ public Boolean getIsPolicyEnabled(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.get_is_policy_enabled"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -429,15 +430,15 @@ public class VMPP extends XenAPIObject { * @return value of the field */ public Types.VmppBackupType getBackupType(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.get_backup_type"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVmppBackupType(result); + return Types.toVmppBackupType(result); } /** @@ -446,15 +447,15 @@ public class VMPP extends XenAPIObject { * @return value of the field */ public Long getBackupRetentionValue(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.get_backup_retention_value"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toLong(result); + return Types.toLong(result); } /** @@ -463,15 +464,15 @@ public class VMPP extends XenAPIObject { * @return value of the field */ public Types.VmppBackupFrequency getBackupFrequency(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.get_backup_frequency"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVmppBackupFrequency(result); + return Types.toVmppBackupFrequency(result); } /** @@ -480,15 +481,15 @@ public class VMPP extends XenAPIObject { * @return value of the field */ public Map getBackupSchedule(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.get_backup_schedule"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -497,15 +498,15 @@ public class VMPP extends XenAPIObject { * @return value of the field */ public Boolean getIsBackupRunning(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.get_is_backup_running"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -514,15 +515,15 @@ public class VMPP extends XenAPIObject { * @return value of the field */ public Date getBackupLastRunTime(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.get_backup_last_run_time"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDate(result); + return Types.toDate(result); } /** @@ -531,15 +532,15 @@ public class VMPP extends XenAPIObject { * @return value of the field */ public Types.VmppArchiveTargetType getArchiveTargetType(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.get_archive_target_type"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVmppArchiveTargetType(result); + return Types.toVmppArchiveTargetType(result); } /** @@ -548,15 +549,15 @@ public class VMPP extends XenAPIObject { * @return value of the field */ public Map getArchiveTargetConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.get_archive_target_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -565,15 +566,15 @@ public class VMPP extends XenAPIObject { * @return value of the field */ public Types.VmppArchiveFrequency getArchiveFrequency(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.get_archive_frequency"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVmppArchiveFrequency(result); + return Types.toVmppArchiveFrequency(result); } /** @@ -582,15 +583,15 @@ public class VMPP extends XenAPIObject { * @return value of the field */ public Map getArchiveSchedule(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.get_archive_schedule"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -599,15 +600,15 @@ public class VMPP extends XenAPIObject { * @return value of the field */ public Boolean getIsArchiveRunning(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.get_is_archive_running"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -616,15 +617,15 @@ public class VMPP extends XenAPIObject { * @return value of the field */ public Date getArchiveLastRunTime(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.get_archive_last_run_time"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toDate(result); + return Types.toDate(result); } /** @@ -633,15 +634,15 @@ public class VMPP extends XenAPIObject { * @return value of the field */ public Set getVMs(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.get_VMs"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVM(result); + return Types.toSetOfVM(result); } /** @@ -650,15 +651,15 @@ public class VMPP extends XenAPIObject { * @return value of the field */ public Boolean getIsAlarmEnabled(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.get_is_alarm_enabled"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toBoolean(result); + return Types.toBoolean(result); } /** @@ -667,15 +668,15 @@ public class VMPP extends XenAPIObject { * @return value of the field */ public Map getAlarmConfig(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.get_alarm_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfStringString(result); + return Types.toMapOfStringString(result); } /** @@ -684,15 +685,15 @@ public class VMPP extends XenAPIObject { * @return value of the field */ public Set getRecentAlerts(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.get_recent_alerts"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** @@ -701,9 +702,9 @@ public class VMPP extends XenAPIObject { * @param label New value to set */ public void setNameLabel(Connection c, String label) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.set_name_label"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(label)}; @@ -717,9 +718,9 @@ public class VMPP extends XenAPIObject { * @param description New value to set */ public void setNameDescription(Connection c, String description) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.set_name_description"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(description)}; @@ -733,9 +734,9 @@ public class VMPP extends XenAPIObject { * @param isPolicyEnabled New value to set */ public void setIsPolicyEnabled(Connection c, Boolean isPolicyEnabled) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.set_is_policy_enabled"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(isPolicyEnabled)}; @@ -749,9 +750,9 @@ public class VMPP extends XenAPIObject { * @param backupType New value to set */ public void setBackupType(Connection c, Types.VmppBackupType backupType) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.set_backup_type"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(backupType)}; @@ -765,15 +766,15 @@ public class VMPP extends XenAPIObject { * @return An XMLRPC result */ public String protectNow(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.protect_now"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -783,15 +784,15 @@ public class VMPP extends XenAPIObject { * @return An XMLRPC result */ public static String archiveNow(Connection c, VM snapshot) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.archive_now"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(snapshot)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -801,26 +802,26 @@ public class VMPP extends XenAPIObject { * @return A list of alerts encoded in xml */ public Set getAlerts(Connection c, Long hoursFromNow) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.get_alerts"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(hoursFromNow)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfString(result); + return Types.toSetOfString(result); } /** - * + * * * @param value the value to set */ public void setBackupRetentionValue(Connection c, Long value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.set_backup_retention_value"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -834,9 +835,9 @@ public class VMPP extends XenAPIObject { * @param value the backup frequency */ public void setBackupFrequency(Connection c, Types.VmppBackupFrequency value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.set_backup_frequency"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -845,14 +846,14 @@ public class VMPP extends XenAPIObject { } /** - * + * * * @param value the value to set */ public void setBackupSchedule(Connection c, Map value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.set_backup_schedule"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -866,9 +867,9 @@ public class VMPP extends XenAPIObject { * @param value the archive frequency */ public void setArchiveFrequency(Connection c, Types.VmppArchiveFrequency value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.set_archive_frequency"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -877,14 +878,14 @@ public class VMPP extends XenAPIObject { } /** - * + * * * @param value the value to set */ public void setArchiveSchedule(Connection c, Map value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.set_archive_schedule"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -898,9 +899,9 @@ public class VMPP extends XenAPIObject { * @param value the archive target config type */ public void setArchiveTargetType(Connection c, Types.VmppArchiveTargetType value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.set_archive_target_type"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -909,14 +910,14 @@ public class VMPP extends XenAPIObject { } /** - * + * * * @param value the value to set */ public void setArchiveTargetConfig(Connection c, Map value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.set_archive_target_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -930,9 +931,9 @@ public class VMPP extends XenAPIObject { * @param value true if alarm is enabled for this policy */ public void setIsAlarmEnabled(Connection c, Boolean value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.set_is_alarm_enabled"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -941,14 +942,14 @@ public class VMPP extends XenAPIObject { } /** - * + * * * @param value the value to set */ public void setAlarmConfig(Connection c, Map value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.set_alarm_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -957,15 +958,15 @@ public class VMPP extends XenAPIObject { } /** - * + * * * @param key the key to add * @param value the value to add */ public void addToBackupSchedule(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.add_to_backup_schedule"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -974,15 +975,15 @@ public class VMPP extends XenAPIObject { } /** - * + * * * @param key the key to add * @param value the value to add */ public void addToArchiveTargetConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.add_to_archive_target_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -991,15 +992,15 @@ public class VMPP extends XenAPIObject { } /** - * + * * * @param key the key to add * @param value the value to add */ public void addToArchiveSchedule(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.add_to_archive_schedule"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -1008,15 +1009,15 @@ public class VMPP extends XenAPIObject { } /** - * + * * * @param key the key to add * @param value the value to add */ public void addToAlarmConfig(Connection c, String key, String value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.add_to_alarm_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)}; @@ -1025,14 +1026,14 @@ public class VMPP extends XenAPIObject { } /** - * + * * * @param key the key to remove */ public void removeFromBackupSchedule(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.remove_from_backup_schedule"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -1041,14 +1042,14 @@ public class VMPP extends XenAPIObject { } /** - * + * * * @param key the key to remove */ public void removeFromArchiveTargetConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.remove_from_archive_target_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -1057,14 +1058,14 @@ public class VMPP extends XenAPIObject { } /** - * + * * * @param key the key to remove */ public void removeFromArchiveSchedule(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.remove_from_archive_schedule"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -1073,14 +1074,14 @@ public class VMPP extends XenAPIObject { } /** - * + * * * @param key the key to remove */ public void removeFromAlarmConfig(Connection c, String key) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.remove_from_alarm_config"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)}; @@ -1089,14 +1090,14 @@ public class VMPP extends XenAPIObject { } /** - * + * * * @param value the value to set */ public void setBackupLastRunTime(Connection c, Date value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.set_backup_last_run_time"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1105,14 +1106,14 @@ public class VMPP extends XenAPIObject { } /** - * + * * * @param value the value to set */ public void setArchiveLastRunTime(Connection c, Date value) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.set_archive_last_run_time"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)}; @@ -1126,15 +1127,15 @@ public class VMPP extends XenAPIObject { * @return references to all objects */ public static Set getAll(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.get_all"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toSetOfVMPP(result); + return Types.toSetOfVMPP(result); } /** @@ -1143,15 +1144,15 @@ public class VMPP extends XenAPIObject { * @return records of all objects */ public static Map getAllRecords(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VMPP.get_all_records"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toMapOfVMPPVMPPRecord(result); + return Types.toMapOfVMPPVMPPRecord(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/VTPM.java b/deps/XenServerJava/src/com/xensource/xenapi/VTPM.java index 25c332081ef..4ee7b2f366e 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/VTPM.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/VTPM.java @@ -1,19 +1,19 @@ /* * Copyright (c) Citrix Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -28,6 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ + package com.xensource.xenapi; import com.xensource.xenapi.Types.BadServerResponse; @@ -60,14 +61,14 @@ public class VTPM extends XenAPIObject { * For internal use only. */ VTPM(String ref) { - this.ref = ref; + this.ref = ref; } /** * @return The XenAPI reference (OpaqueRef) to this object. */ public String toWireString() { - return this.ref; + return this.ref; } /** @@ -78,7 +79,7 @@ public class VTPM extends XenAPIObject { { if (obj != null && obj instanceof VTPM) { - VTPM other = (VTPM)obj; + VTPM other = (VTPM) obj; return other.ref.equals(this.ref); } else { @@ -108,8 +109,8 @@ public class VTPM extends XenAPIObject { /** * Convert a VTPM.Record to a Map */ - public Map toMap() { - Map map = new HashMap(); + public Map toMap() { + Map map = new HashMap(); map.put("uuid", this.uuid == null ? "" : this.uuid); map.put("VM", this.VM == null ? new VM("OpaqueRef:NULL") : this.VM); map.put("backend", this.backend == null ? new VM("OpaqueRef:NULL") : this.backend); @@ -136,15 +137,15 @@ public class VTPM extends XenAPIObject { * @return all fields from the object */ public VTPM.Record getRecord(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VTPM.get_record"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVTPMRecord(result); + return Types.toVTPMRecord(result); } /** @@ -154,15 +155,15 @@ public class VTPM extends XenAPIObject { * @return reference to the object */ public static VTPM getByUuid(Connection c, String uuid) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VTPM.get_by_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVTPM(result); + return Types.toVTPM(result); } /** @@ -172,9 +173,9 @@ public class VTPM extends XenAPIObject { * @return Task */ public static Task createAsync(Connection c, VTPM.Record record) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VTPM.create"; String session = c.getSessionReference(); Map record_map = record.toMap(); @@ -191,16 +192,16 @@ public class VTPM extends XenAPIObject { * @return reference to the newly created object */ public static VTPM create(Connection c, VTPM.Record record) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VTPM.create"; String session = c.getSessionReference(); Map record_map = record.toMap(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVTPM(result); + return Types.toVTPM(result); } /** @@ -209,9 +210,9 @@ public class VTPM extends XenAPIObject { * @return Task */ public Task destroyAsync(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "Async.VTPM.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -225,9 +226,9 @@ public class VTPM extends XenAPIObject { * */ public void destroy(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VTPM.destroy"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; @@ -241,15 +242,15 @@ public class VTPM extends XenAPIObject { * @return value of the field */ public String getUuid(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VTPM.get_uuid"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toString(result); + return Types.toString(result); } /** @@ -258,15 +259,15 @@ public class VTPM extends XenAPIObject { * @return value of the field */ public VM getVM(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VTPM.get_VM"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVM(result); + return Types.toVM(result); } /** @@ -275,15 +276,15 @@ public class VTPM extends XenAPIObject { * @return value of the field */ public VM getBackend(Connection c) throws - BadServerResponse, - XenAPIException, - XmlRpcException { + BadServerResponse, + XenAPIException, + XmlRpcException { String method_call = "VTPM.get_backend"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); - return Types.toVM(result); + return Types.toVM(result); } } \ No newline at end of file diff --git a/deps/XenServerJava/src/com/xensource/xenapi/XenAPIObject.java b/deps/XenServerJava/src/com/xensource/xenapi/XenAPIObject.java old mode 100644 new mode 100755 index b9821ee6b7c..815a8746dbb --- a/deps/XenServerJava/src/com/xensource/xenapi/XenAPIObject.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/XenAPIObject.java @@ -1,18 +1,36 @@ -// Copyright 2012 Citrix Systems, Inc. Licensed under the -// Apache License, Version 2.0 (the "License"); you may not use this -// file except in compliance with the License. Citrix Systems, Inc. -// reserves all rights not expressly granted by the License. -// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Automatically generated by addcopyright.py at 04/03/2012 +/* + * Copyright (c) Citrix Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1) Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2) Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + package com.xensource.xenapi; public abstract class XenAPIObject { - public abstract String toWireString(); + public abstract String toWireString(); } diff --git a/developer/pom.xml b/developer/pom.xml index 3b3ed19a6cf..74161206158 100644 --- a/developer/pom.xml +++ b/developer/pom.xml @@ -21,12 +21,6 @@ 4.4.0-SNAPSHOT - - - mysql - mysql-connector-java - runtime - commons-dbcp commons-dbcp @@ -114,6 +108,14 @@ org.codehaus.mojo exec-maven-plugin 1.2.1 + + + + mysql + mysql-connector-java + ${cs.mysql.version} + + process-resources @@ -125,6 +127,7 @@ com.cloud.upgrade.DatabaseCreator + true ${basedir}/../utils/conf/db.properties @@ -182,6 +185,13 @@ org.codehaus.mojo exec-maven-plugin + + + mysql + mysql-connector-java + ${cs.mysql.version} + + 1.2.1 @@ -194,6 +204,7 @@ com.cloud.upgrade.DatabaseCreator + true ${basedir}/../utils/conf/db.properties diff --git a/engine/api/src/com/cloud/vm/VirtualMachineManager.java b/engine/api/src/com/cloud/vm/VirtualMachineManager.java index ac79860df31..3535a320b4c 100644 --- a/engine/api/src/com/cloud/vm/VirtualMachineManager.java +++ b/engine/api/src/com/cloud/vm/VirtualMachineManager.java @@ -18,6 +18,7 @@ package com.cloud.vm; import java.net.URI; import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; import org.apache.cloudstack.framework.config.ConfigKey; @@ -76,11 +77,11 @@ public interface VirtualMachineManager extends Manager { * @throws InsufficientCapacityException If there are insufficient capacity to deploy this vm. */ void allocate(String vmInstanceName, VirtualMachineTemplate template, ServiceOffering serviceOffering, Pair rootDiskOffering, - LinkedHashMap dataDiskOfferings, LinkedHashMap auxiliaryNetworks, DeploymentPlan plan, + LinkedHashMap dataDiskOfferings, LinkedHashMap> auxiliaryNetworks, DeploymentPlan plan, HypervisorType hyperType) throws InsufficientCapacityException; void allocate(String vmInstanceName, VirtualMachineTemplate template, ServiceOffering serviceOffering, - LinkedHashMap networkProfiles, DeploymentPlan plan, HypervisorType hyperType) throws InsufficientCapacityException; + LinkedHashMap> networkProfiles, DeploymentPlan plan, HypervisorType hyperType) throws InsufficientCapacityException; void start(String vmUuid, Map params); @@ -109,7 +110,7 @@ public interface VirtualMachineManager extends Manager { void destroy(String vmUuid) throws AgentUnavailableException, OperationTimedoutException, ConcurrentOperationException; - void migrateAway(String vmUuid, long hostId, DeploymentPlanner planner) throws InsufficientServerCapacityException; + void migrateAway(String vmUuid, long hostId) throws InsufficientServerCapacityException; void migrate(String vmUuid, long srcHostId, DeployDestination dest) throws ResourceUnavailableException, ConcurrentOperationException; diff --git a/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java b/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java index a50c184a5e0..1061c4d007a 100755 --- a/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java +++ b/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java @@ -77,7 +77,7 @@ public interface NetworkOrchestrationService { boolean errorIfAlreadySetup, Long domainId, ACLType aclType, Boolean subdomainAccess, Long vpcId, Boolean isDisplayNetworkEnabled) throws ConcurrentOperationException; - void allocate(VirtualMachineProfile vm, LinkedHashMap networks) throws InsufficientCapacityException, + void allocate(VirtualMachineProfile vm, LinkedHashMap> networks) throws InsufficientCapacityException, ConcurrentOperationException; void prepare(VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) throws InsufficientCapacityException, ConcurrentOperationException, diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/VolumeTypeBase.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/VolumeTypeBase.java index 78ac8e23966..1d6a65c6921 100644 --- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/VolumeTypeBase.java +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/VolumeTypeBase.java @@ -17,31 +17,36 @@ package org.apache.cloudstack.engine.subsystem.api.storage.type; public class VolumeTypeBase implements VolumeType { + protected String type = "Unknown"; @Override - public boolean equals(Object that) { - if (this == that) { + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((type == null) ? 0 : type.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; - } - if (that instanceof String) { - if (this.toString().equalsIgnoreCase((String)that)) { - return true; - } - } else if (that instanceof VolumeTypeBase) { - VolumeTypeBase th = (VolumeTypeBase)that; - if (this.toString().equalsIgnoreCase(th.toString())) { - return true; - } - } else { + if (obj == null) return false; - } - return false; + if (getClass() != obj.getClass()) + return false; + VolumeTypeBase other = (VolumeTypeBase) obj; + if (type == null) { + if (other.type != null) + return false; + } else if (!type.equals(other.type)) + return false; + return true; } @Override public String toString() { return type; } - -} +} \ No newline at end of file diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/VolumeTypeHelper.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/VolumeTypeHelper.java index 50572033042..6b8437980b6 100644 --- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/VolumeTypeHelper.java +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/VolumeTypeHelper.java @@ -16,26 +16,33 @@ // under the License. package org.apache.cloudstack.engine.subsystem.api.storage.type; +import java.util.Hashtable; import java.util.List; +import java.util.Map; import javax.inject.Inject; public class VolumeTypeHelper { - static private List types; + private static VolumeType defaultType = new Unknown(); + private List types; + private final Map mapTypes = new Hashtable(); + @Inject public void setTypes(List types) { - VolumeTypeHelper.types = types; + this.types = types; + + mapTypes.clear(); + for (VolumeType ty : this.types) { + mapTypes.put(ty.getClass().getSimpleName().toUpperCase(), ty); + } } - public static VolumeType getType(String type) { - for (VolumeType ty : types) { - if (ty.equals(type)) { - return ty; - } + public VolumeType getType(String type) { + if (mapTypes.containsKey(type.toUpperCase())) { + return mapTypes.get(type.toUpperCase()); } return VolumeTypeHelper.defaultType; } - -} +} \ No newline at end of file diff --git a/engine/api/test/org/apache/cloudstack/engine/subsystem/api/storage/type/VolumeTypeHelperTest.java b/engine/api/test/org/apache/cloudstack/engine/subsystem/api/storage/type/VolumeTypeHelperTest.java new file mode 100644 index 00000000000..32df84ff984 --- /dev/null +++ b/engine/api/test/org/apache/cloudstack/engine/subsystem/api/storage/type/VolumeTypeHelperTest.java @@ -0,0 +1,101 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.engine.subsystem.api.storage.type; + +import java.util.ArrayList; +import java.util.List; + +import junit.framework.Assert; + +import org.junit.Before; +import org.junit.Test; + +public class VolumeTypeHelperTest { + + private VolumeTypeHelper helper; + + @Before + public void setu() { + helper = new VolumeTypeHelper(); + + List types = new ArrayList(); + types.add(new BaseImage()); + types.add(new DataDisk()); + types.add(new Iso()); + types.add(new Unknown()); + types.add(new RootDisk()); + types.add(new VolumeTypeBase()); + + helper.setTypes(types); + } + + @Test + public void testGetTypeBaseImage() throws Exception { + VolumeType type = helper.getType("BaseImage"); + + Assert.assertTrue(type instanceof BaseImage); + } + + @Test + public void testGetTypeDataDisk() throws Exception { + VolumeType type = helper.getType("DataDisk"); + + Assert.assertTrue(type instanceof DataDisk); + } + + @Test + public void testGetTypeIso() throws Exception { + VolumeType type = helper.getType("Iso"); + + Assert.assertTrue(type instanceof Iso); + } + + @Test + public void testGetTypeUnknown() throws Exception { + VolumeType type = helper.getType("Unknown"); + + Assert.assertTrue(type instanceof Unknown); + } + + @Test + public void testGetTypeRootDisk() throws Exception { + VolumeType type = helper.getType("RootDisk"); + + Assert.assertTrue(type instanceof RootDisk); + } + + @Test + public void testGetTypeVolumeTypeBase() throws Exception { + VolumeType type = helper.getType("VolumeTypeBase"); + + Assert.assertTrue(type instanceof VolumeTypeBase); + } + + @Test + public void testGetTypeVolumeString() throws Exception { + VolumeType type = helper.getType("String"); + + Assert.assertTrue(type instanceof Unknown); + } + + @Test(expected = NullPointerException.class) + public void testGetTypeVolumeNull() throws Exception { + helper.getType(null); + } +} \ No newline at end of file diff --git a/engine/components-api/src/com/cloud/ha/HighAvailabilityManager.java b/engine/components-api/src/com/cloud/ha/HighAvailabilityManager.java index e1b308a1632..eb60f3eadf1 100644 --- a/engine/components-api/src/com/cloud/ha/HighAvailabilityManager.java +++ b/engine/components-api/src/com/cloud/ha/HighAvailabilityManager.java @@ -18,6 +18,7 @@ package com.cloud.ha; import java.util.List; +import com.cloud.deploy.DeploymentPlanner; import com.cloud.host.HostVO; import com.cloud.host.Status; import com.cloud.utils.component.Manager; @@ -103,4 +104,6 @@ public interface HighAvailabilityManager extends Manager { * @return */ String getHaTag(); + + DeploymentPlanner getHAPlanner(); } diff --git a/engine/components-api/src/com/cloud/network/IpAddressManager.java b/engine/components-api/src/com/cloud/network/IpAddressManager.java index 9ccc9466f70..98ff55cad73 100644 --- a/engine/components-api/src/com/cloud/network/IpAddressManager.java +++ b/engine/components-api/src/com/cloud/network/IpAddressManager.java @@ -160,7 +160,7 @@ public interface IpAddressManager { PublicIp assignDedicateIpAddress(Account owner, Long guestNtwkId, Long vpcId, long dcId, boolean isSourceNat) throws ConcurrentOperationException, InsufficientAddressCapacityException; - IpAddress allocateIp(Account ipOwner, boolean isSystem, Account caller, long callerId, DataCenter zone) throws ConcurrentOperationException, + IpAddress allocateIp(Account ipOwner, boolean isSystem, Account caller, long callerId, DataCenter zone, Boolean displayIp) throws ConcurrentOperationException, ResourceAllocationException, InsufficientAddressCapacityException; PublicIp assignPublicIpAddressFromVlans(long dcId, Long podId, Account owner, VlanType type, List vlanDbIds, Long networkId, String requestedIp, diff --git a/engine/components-api/src/com/cloud/network/addr/PublicIp.java b/engine/components-api/src/com/cloud/network/addr/PublicIp.java index eee7516196f..ff11b3349a2 100644 --- a/engine/components-api/src/com/cloud/network/addr/PublicIp.java +++ b/engine/components-api/src/com/cloud/network/addr/PublicIp.java @@ -234,6 +234,11 @@ public class PublicIp implements PublicIpAddress { return _addr.getMacAddress(); } + @Override + public boolean isDisplay() { + return _addr.isDisplay(); + } + @Override public IAMEntityType getEntityType() { return IAMEntityType.PublicIpAddress; diff --git a/engine/components-api/src/com/cloud/network/lb/LoadBalancingRulesManager.java b/engine/components-api/src/com/cloud/network/lb/LoadBalancingRulesManager.java index 6b3ae02da02..945ee9783b5 100644 --- a/engine/components-api/src/com/cloud/network/lb/LoadBalancingRulesManager.java +++ b/engine/components-api/src/com/cloud/network/lb/LoadBalancingRulesManager.java @@ -34,7 +34,7 @@ import com.cloud.user.Account; public interface LoadBalancingRulesManager { LoadBalancer createPublicLoadBalancer(String xId, String name, String description, int srcPort, int destPort, long sourceIpId, String protocol, String algorithm, - boolean openFirewall, CallContext caller, String lbProtocol) throws NetworkRuleConflictException; + boolean openFirewall, CallContext caller, String lbProtocol, Boolean forDisplay) throws NetworkRuleConflictException; boolean removeAllLoadBalanacersForIp(long ipId, Account caller, long callerUserId); diff --git a/engine/components-api/src/com/cloud/network/rules/StaticNatRuleImpl.java b/engine/components-api/src/com/cloud/network/rules/StaticNatRuleImpl.java index aac2f3ffdf9..bdaf2bc1b20 100644 --- a/engine/components-api/src/com/cloud/network/rules/StaticNatRuleImpl.java +++ b/engine/components-api/src/com/cloud/network/rules/StaticNatRuleImpl.java @@ -33,6 +33,7 @@ public class StaticNatRuleImpl implements StaticNatRule { long networkId; long sourceIpAddressId; String destIpAddress; + boolean forDisplay; public StaticNatRuleImpl(FirewallRuleVO rule, String dstIp) { id = rule.getId(); @@ -47,6 +48,7 @@ public class StaticNatRuleImpl implements StaticNatRule { networkId = rule.getNetworkId(); sourceIpAddressId = rule.getSourceIpAddressId(); destIpAddress = dstIp; + forDisplay = rule.isDisplay(); } @Override @@ -144,9 +146,13 @@ public class StaticNatRuleImpl implements StaticNatRule { return null; } + @Override + public boolean isDisplay() { + return forDisplay; + } + @Override public IAMEntityType getEntityType() { return IAMEntityType.FirewallRule; } - } diff --git a/engine/components-api/src/com/cloud/network/vpc/NetworkACLManager.java b/engine/components-api/src/com/cloud/network/vpc/NetworkACLManager.java index dee8c4a5762..0377c5f74d8 100644 --- a/engine/components-api/src/com/cloud/network/vpc/NetworkACLManager.java +++ b/engine/components-api/src/com/cloud/network/vpc/NetworkACLManager.java @@ -28,9 +28,10 @@ public interface NetworkACLManager { * @param name * @param description * @param vpcId + * @param forDisplay TODO * @return */ - NetworkACL createNetworkACL(String name, String description, long vpcId); + NetworkACL createNetworkACL(String name, String description, long vpcId, Boolean forDisplay); /** * Fetches Network ACL with specified Id @@ -74,10 +75,11 @@ public interface NetworkACLManager { * @param aclId * @param action * @param number + * @param forDisplay TODO * @return */ NetworkACLItem createNetworkACLItem(Integer sourcePortStart, Integer sourcePortEnd, String protocol, List sourceCidrList, Integer icmpCode, Integer icmpType, - NetworkACLItem.TrafficType trafficType, Long aclId, String action, Integer number); + NetworkACLItem.TrafficType trafficType, Long aclId, String action, Integer number, Boolean forDisplay); /** * Returns Network ACL Item with specified Id @@ -131,11 +133,12 @@ public interface NetworkACLManager { * @param icmpCode * @param icmpType * @param customId TODO + * @param forDisplay TODO * @return * @throws ResourceUnavailableException */ NetworkACLItem updateNetworkACLItem(Long id, String protocol, List sourceCidrList, NetworkACLItem.TrafficType trafficType, String action, Integer number, - Integer sourcePortStart, Integer sourcePortEnd, Integer icmpCode, Integer icmpType, String customId) throws ResourceUnavailableException; + Integer sourcePortStart, Integer sourcePortEnd, Integer icmpCode, Integer icmpType, String customId, Boolean forDisplay) throws ResourceUnavailableException; /** * Associates acl with a network and applies the ACLItems diff --git a/engine/components-api/src/com/cloud/template/TemplateManager.java b/engine/components-api/src/com/cloud/template/TemplateManager.java index 9dcc91625c3..5987ac0ee5b 100755 --- a/engine/components-api/src/com/cloud/template/TemplateManager.java +++ b/engine/components-api/src/com/cloud/template/TemplateManager.java @@ -31,6 +31,7 @@ import com.cloud.storage.VMTemplateHostVO; import com.cloud.storage.VMTemplateStoragePoolVO; import com.cloud.storage.VMTemplateVO; import com.cloud.utils.Pair; +import com.cloud.vm.VirtualMachineProfile; /** * TemplateManager manages the templates stored on secondary storage. It is responsible for creating private/public templates. @@ -113,6 +114,15 @@ public interface TemplateManager { TemplateInfo prepareIso(long isoId, long dcId); + + /** + * Adds ISO definition to given vm profile + * + * @param VirtualMachineProfile + */ + void prepareIsoForVmProfile(VirtualMachineProfile profile); + public static final String MESSAGE_REGISTER_PUBLIC_TEMPLATE_EVENT = "Message.RegisterPublicTemplate.Event"; public static final String MESSAGE_RESET_TEMPLATE_PERMISSION_EVENT = "Message.ResetTemplatePermission.Event"; + } diff --git a/engine/orchestration/src/com/cloud/agent/manager/AgentAttache.java b/engine/orchestration/src/com/cloud/agent/manager/AgentAttache.java index 3ebaf4aa7ae..fd1531e25a6 100755 --- a/engine/orchestration/src/com/cloud/agent/manager/AgentAttache.java +++ b/engine/orchestration/src/com/cloud/agent/manager/AgentAttache.java @@ -32,9 +32,8 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import org.apache.log4j.Logger; - import org.apache.cloudstack.managed.context.ManagedContextRunnable; +import org.apache.log4j.Logger; import com.cloud.agent.Listener; import com.cloud.agent.api.Answer; @@ -72,7 +71,7 @@ public abstract class AgentAttache { protected static final Comparator s_reqComparator = new Comparator() { @Override - public int compare(Request o1, Request o2) { + public int compare(final Request o1, final Request o2) { long seq1 = o1.getSequence(); long seq2 = o2.getSequence(); if (seq1 < seq2) { @@ -87,7 +86,7 @@ public abstract class AgentAttache { protected static final Comparator s_seqComparator = new Comparator() { @Override - public int compare(Object o1, Object o2) { + public int compare(final Object o1, final Object o2) { long seq1 = ((Request)o1).getSequence(); long seq2 = (Long)o2; if (seq1 < seq2) { @@ -122,7 +121,7 @@ public abstract class AgentAttache { Arrays.sort(s_commandsNotAllowedInConnectingMode); } - protected AgentAttache(AgentManagerImpl agentMgr, final long id, final String name, boolean maintenance) { + protected AgentAttache(final AgentManagerImpl agentMgr, final long id, final String name, final boolean maintenance) { _id = id; _name = name; _waitForList = new ConcurrentHashMap(); @@ -180,13 +179,13 @@ public abstract class AgentAttache { } } - protected synchronized void addRequest(Request req) { + protected synchronized void addRequest(final Request req) { int index = findRequest(req); assert (index < 0) : "How can we get index again? " + index + ":" + req.toString(); _requests.add(-index - 1, req); } - protected void cancel(Request req) { + protected void cancel(final Request req) { long seq = req.getSequence(); cancel(seq); } @@ -205,11 +204,11 @@ public abstract class AgentAttache { } } - protected synchronized int findRequest(Request req) { + protected synchronized int findRequest(final Request req) { return Collections.binarySearch(_requests, req, s_reqComparator); } - protected synchronized int findRequest(long seq) { + protected synchronized int findRequest(final long seq) { return Collections.binarySearch(_requests, seq, s_seqComparator); } @@ -331,17 +330,20 @@ public abstract class AgentAttache { } @Override - public boolean equals(Object obj) { - try { - AgentAttache that = (AgentAttache)obj; - return _id == that._id; - } catch (ClassCastException e) { - assert false : "Who's sending an " + obj.getClass().getSimpleName() + " to AgentAttache.equals()? "; + public boolean equals(final Object obj) { + // Return false straight away. + if (obj == null) { return false; } + // No need to handle a ClassCastException. If the classes are different, then equals can return false straight ahead. + if (this.getClass() != obj.getClass()) { + return false; + } + AgentAttache that = (AgentAttache)obj; + return _id == that._id; } - public void send(Request req, final Listener listener) throws AgentUnavailableException { + public void send(final Request req, final Listener listener) throws AgentUnavailableException { checkAvailability(req.getCommands()); long seq = req.getSequence(); @@ -387,7 +389,7 @@ public abstract class AgentAttache { } } - public Answer[] send(Request req, int wait) throws AgentUnavailableException, OperationTimedoutException { + public Answer[] send(final Request req, final int wait) throws AgentUnavailableException, OperationTimedoutException { SynchronousListener sl = new SynchronousListener(null); long seq = req.getSequence(); @@ -478,7 +480,7 @@ public abstract class AgentAttache { _currentSequence = req.getSequence(); } - public void process(Answer[] answers) { + public void process(final Answer[] answers) { //do nothing } @@ -505,7 +507,7 @@ public abstract class AgentAttache { protected class Alarm extends ManagedContextRunnable { long _seq; - public Alarm(long seq) { + public Alarm(final long seq) { _seq = seq; } diff --git a/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java b/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java index d51df220195..0d41bc1b3bf 100755 --- a/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java +++ b/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java @@ -118,6 +118,12 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl protected static final Logger s_logger = Logger.getLogger(AgentManagerImpl.class); protected static final Logger status_logger = Logger.getLogger(Status.class); + /** + * _agents is a ConcurrentHashMap, but it is used from within a synchronized block. + * This will be reported by findbugs as JLM_JSR166_UTILCONCURRENT_MONITORENTER. + * Maybe a ConcurrentHashMap is not the right thing to use here, but i'm not sure + * so i leave it alone. + */ protected ConcurrentHashMap _agents = new ConcurrentHashMap(10007); protected List> _hostMonitors = new ArrayList>(17); protected List> _cmdMonitors = new ArrayList>(17); @@ -167,20 +173,20 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl ResourceManager _resourceMgr; protected final ConfigKey Workers = new ConfigKey(Integer.class, "workers", "Advanced", "5", - "Number of worker threads handling remote agent connections.", false); + "Number of worker threads handling remote agent connections.", false); protected final ConfigKey Port = new ConfigKey(Integer.class, "port", "Advanced", "8250", "Port to listen on for remote agent connections.", false); protected final ConfigKey PingInterval = new ConfigKey(Integer.class, "ping.interval", "Advanced", "60", - "Interval to send application level pings to make sure the connection is still working", false); + "Interval to send application level pings to make sure the connection is still working", false); protected final ConfigKey PingTimeout = new ConfigKey(Float.class, "ping.timeout", "Advanced", "2.5", - "Multiplier to ping.interval before announcing an agent has timed out", true); + "Multiplier to ping.interval before announcing an agent has timed out", true); protected final ConfigKey AlertWait = new ConfigKey(Integer.class, "alert.wait", "Advanced", "1800", - "Seconds to wait before alerting on a disconnected agent", true); + "Seconds to wait before alerting on a disconnected agent", true); protected final ConfigKey DirectAgentLoadSize = new ConfigKey(Integer.class, "direct.agent.load.size", "Advanced", "16", - "The number of direct agents to load each time", false); + "The number of direct agents to load each time", false); protected final ConfigKey DirectAgentPoolSize = new ConfigKey(Integer.class, "direct.agent.pool.size", "Advanced", "500", - "Default size for DirectAgentPool", false); + "Default size for DirectAgentPool", false); protected final ConfigKey DirectAgentThreadCap = new ConfigKey(Float.class, "direct.agent.thread.cap", "Advanced", "0.1", - "Percentage (as a value between 0 and 1) of direct.agent.pool.size to be used as upper thread cap for a single direct agent to process requests", false); + "Percentage (as a value between 0 and 1) of direct.agent.pool.size to be used as upper thread cap for a single direct agent to process requests", false); @Override public boolean configure(final String name, final Map params) throws ConfigurationException { @@ -495,12 +501,12 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl ConnectionException ce = (ConnectionException)e; if (ce.isSetupError()) { s_logger.warn("Monitor " + monitor.second().getClass().getSimpleName() + " says there is an error in the connect process for " + hostId + - " due to " + e.getMessage()); + " due to " + e.getMessage()); handleDisconnectWithoutInvestigation(attache, Event.AgentDisconnected, true, true); throw ce; } else { s_logger.info("Monitor " + monitor.second().getClass().getSimpleName() + " says not to continue the connect process for " + hostId + - " due to " + e.getMessage()); + " due to " + e.getMessage()); handleDisconnectWithoutInvestigation(attache, Event.ShutdownRequested, true, true); return attache; } @@ -509,7 +515,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl throw new CloudRuntimeException("Unable to connect " + attache.getId(), e); } else { s_logger.error("Monitor " + monitor.second().getClass().getSimpleName() + " says there is an error in the connect process for " + hostId + - " due to " + e.getMessage(), e); + " due to " + e.getMessage(), e); handleDisconnectWithoutInvestigation(attache, Event.AgentDisconnected, true, true); throw new CloudRuntimeException("Unable to connect " + attache.getId(), e); } @@ -770,6 +776,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl protected boolean handleDisconnectWithInvestigation(AgentAttache attache, Status.Event event) { long hostId = attache.getId(); HostVO host = _hostDao.findById(hostId); + if (host != null) { Status nextStatus = null; try { @@ -819,7 +826,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl String hostDesc = "name: " + host.getName() + " (id:" + host.getId() + "), availability zone: " + dcVO.getName() + ", pod: " + podVO.getName(); if ((host.getType() != Host.Type.SecondaryStorage) && (host.getType() != Host.Type.ConsoleProxy)) { _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(), "Host disconnected, " + hostDesc, - "If the agent for host [" + hostDesc + "] is not restarted within " + AlertWait + " seconds, HA will begin on the VMs"); + "If the agent for host [" + hostDesc + "] is not restarted within " + AlertWait + " seconds, HA will begin on the VMs"); } event = Status.Event.AgentDisconnected; } @@ -829,7 +836,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl HostPodVO podVO = _podDao.findById(host.getPodId()); String hostDesc = "name: " + host.getName() + " (id:" + host.getId() + "), availability zone: " + dcVO.getName() + ", pod: " + podVO.getName(); _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(), "Host in ALERT state, " + hostDesc, - "In availability zone " + host.getDataCenterId() + "In availability zone " + host.getDataCenterId() + ", host is in alert state: " + host.getId() + "-" + host.getName()); } } else { @@ -838,8 +845,8 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl } handleDisconnectWithoutInvestigation(attache, event, true, true); - host = _hostDao.findById(host.getId()); - if (host.getStatus() == Status.Alert || host.getStatus() == Status.Down) { + host = _hostDao.findById(hostId); // Maybe the host magically reappeared? + if (host != null && (host.getStatus() == Status.Alert || host.getStatus() == Status.Down)) { _haMgr.scheduleRestartForVmsOnHost(host, true); } @@ -1093,7 +1100,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl for (int i = 0; i < cmds.length; i++) { cmd = cmds[i]; if ((cmd instanceof StartupRoutingCommand) || (cmd instanceof StartupProxyCommand) || (cmd instanceof StartupSecondaryStorageCommand) || - (cmd instanceof StartupStorageCommand)) { + (cmd instanceof StartupStorageCommand)) { answers[i] = new StartupAnswer((StartupCommand)cmds[i], 0, getPingInterval()); break; } @@ -1172,7 +1179,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl final ShutdownCommand shutdown = (ShutdownCommand)cmd; final String reason = shutdown.getReason(); s_logger.info("Host " + attache.getId() + " has informed us that it is shutting down with reason " + reason + " and detail " + - shutdown.getDetail()); + shutdown.getDetail()); if (reason.equals(ShutdownCommand.Update)) { //disconnectWithoutInvestigation(attache, Event.UpdateNeeded); throw new CloudRuntimeException("Agent update not implemented"); @@ -1200,17 +1207,17 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl DataCenterVO dcVO = _dcDao.findById(host.getDataCenterId()); HostPodVO podVO = _podDao.findById(host.getPodId()); String hostDesc = - "name: " + host.getName() + " (id:" + host.getId() + "), availability zone: " + dcVO.getName() + ", pod: " + podVO.getName(); + "name: " + host.getName() + " (id:" + host.getId() + "), availability zone: " + dcVO.getName() + ", pod: " + podVO.getName(); _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_ROUTING, host.getDataCenterId(), host.getPodId(), - "Host lost connection to gateway, " + hostDesc, "Host [" + hostDesc + + "Host lost connection to gateway, " + hostDesc, "Host [" + hostDesc + "] lost connection to gateway (default route) and is possibly having network connection issues."); } else { _alertMgr.clearAlert(AlertManager.AlertType.ALERT_TYPE_ROUTING, host.getDataCenterId(), host.getPodId()); } } else { s_logger.debug("Not processing " + PingRoutingCommand.class.getSimpleName() + " for agent id=" + cmdHostId + - "; can't find the host in the DB"); + "; can't find the host in the DB"); } } answer = new PingAnswer((PingCommand)cmd); @@ -1252,9 +1259,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl final AgentAttache attache = (AgentAttache)link.attachment(); if (attache == null) { s_logger.warn("Unable to process: " + response); - } - - if (!attache.processAnswers(response.getSequence(), response)) { + } else if (!attache.processAnswers(response.getSequence(), response)) { s_logger.info("Host " + attache.getId() + " - Seq " + response.getSequence() + ": Response is not processed: " + response); } } @@ -1334,9 +1339,9 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl return _statusStateMachine.transitTo(host, e, host.getId(), _hostDao); } catch (NoTransitionException e1) { status_logger.debug("Cannot transit agent status with event " + e + " for host " + host.getId() + ", name=" + host.getName() + - ", mangement server id is " + msId); + ", mangement server id is " + msId); throw new CloudRuntimeException("Cannot transit agent status with event " + e + " for host " + host.getId() + ", mangement server id is " + msId + "," + - e1.getMessage()); + e1.getMessage()); } } finally { _agentStatusLock.unlock(); @@ -1464,8 +1469,16 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl status_logger.debug("Ping timeout but host " + agentId + " is in resource state of " + resourceState + ", so no investigation"); disconnectWithoutInvestigation(agentId, Event.ShutdownRequested); } else { - status_logger.debug("Ping timeout for host " + agentId + ", do invstigation"); - disconnectWithInvestigation(agentId, Event.PingTimeout); + HostVO host = _hostDao.findById(agentId); + if (host != null && (host.getType() == Host.Type.ConsoleProxy || host.getType() == Host.Type.SecondaryStorageVM + || host.getType() == Host.Type.SecondaryStorageCmdExecutor)) { + + s_logger.warn("Disconnect agent for CPVM/SSVM due to physical connection close. host: " + host.getId()); + disconnectWithoutInvestigation(agentId, Event.ShutdownRequested); + } else { + status_logger.debug("Ping timeout for host " + agentId + ", do invstigation"); + disconnectWithInvestigation(agentId, Event.PingTimeout); + } } } } diff --git a/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentAttache.java b/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentAttache.java index 23c3f7694bc..306c47ff60c 100755 --- a/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentAttache.java +++ b/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentAttache.java @@ -42,17 +42,17 @@ public class ClusteredAgentAttache extends ConnectedAgentAttache implements Rout protected final LinkedList _transferRequests; protected boolean _transferMode = false; - static public void initialize(ClusteredAgentManagerImpl agentMgr) { + static public void initialize(final ClusteredAgentManagerImpl agentMgr) { s_clusteredAgentMgr = agentMgr; } - public ClusteredAgentAttache(AgentManagerImpl agentMgr, long id, String name) { + public ClusteredAgentAttache(final AgentManagerImpl agentMgr, final long id, final String name) { super(agentMgr, id, name, null, false); _forward = true; _transferRequests = new LinkedList(); } - public ClusteredAgentAttache(AgentManagerImpl agentMgr, long id, String name, Link link, boolean maintenance) { + public ClusteredAgentAttache(final AgentManagerImpl agentMgr, final long id, final String name, final Link link, final boolean maintenance) { super(agentMgr, id, name, link, maintenance); _forward = link == null; _transferRequests = new LinkedList(); @@ -84,7 +84,7 @@ public class ClusteredAgentAttache extends ConnectedAgentAttache implements Rout } @Override - public void cancel(long seq) { + public void cancel(final long seq) { if (forForward()) { Listener listener = getListener(seq); if (listener != null && listener instanceof SynchronousListener) { @@ -106,7 +106,7 @@ public class ClusteredAgentAttache extends ConnectedAgentAttache implements Rout } @Override - public void routeToAgent(byte[] data) throws AgentUnavailableException { + public void routeToAgent(final byte[] data) throws AgentUnavailableException { if (s_logger.isDebugEnabled()) { s_logger.debug(log(Request.getSequence(data), "Routing from " + Request.getManagementServerId(data))); } @@ -136,7 +136,7 @@ public class ClusteredAgentAttache extends ConnectedAgentAttache implements Rout } @Override - public void send(Request req, Listener listener) throws AgentUnavailableException { + public void send(final Request req, final Listener listener) throws AgentUnavailableException { if (_link != null) { super.send(req, listener); return; @@ -220,7 +220,7 @@ public class ClusteredAgentAttache extends ConnectedAgentAttache implements Rout _transferMode = transfer; } - public boolean getTransferMode() { + public synchronized boolean getTransferMode() { return _transferMode; } @@ -232,13 +232,13 @@ public class ClusteredAgentAttache extends ConnectedAgentAttache implements Rout } } - protected synchronized void addRequestToTransfer(Request req) { + protected synchronized void addRequestToTransfer(final Request req) { int index = findTransferRequest(req); assert (index < 0) : "How can we get index again? " + index + ":" + req.toString(); _transferRequests.add(-index - 1, req); } - protected synchronized int findTransferRequest(Request req) { + protected synchronized int findTransferRequest(final Request req) { return Collections.binarySearch(_transferRequests, req, s_reqComparator); } diff --git a/engine/orchestration/src/com/cloud/agent/manager/ConnectedAgentAttache.java b/engine/orchestration/src/com/cloud/agent/manager/ConnectedAgentAttache.java index 00d54bb2450..f11a105b2a1 100755 --- a/engine/orchestration/src/com/cloud/agent/manager/ConnectedAgentAttache.java +++ b/engine/orchestration/src/com/cloud/agent/manager/ConnectedAgentAttache.java @@ -33,13 +33,13 @@ public class ConnectedAgentAttache extends AgentAttache { protected Link _link; - public ConnectedAgentAttache(AgentManagerImpl agentMgr, final long id, final String name, final Link link, boolean maintenance) { + public ConnectedAgentAttache(final AgentManagerImpl agentMgr, final long id, final String name, final Link link, final boolean maintenance) { super(agentMgr, id, name, maintenance); _link = link; } @Override - public synchronized void send(Request req) throws AgentUnavailableException { + public synchronized void send(final Request req) throws AgentUnavailableException { try { _link.send(req.toBytes()); } catch (ClosedChannelException e) { @@ -67,14 +67,31 @@ public class ConnectedAgentAttache extends AgentAttache { } @Override - public boolean equals(Object obj) { - try { - ConnectedAgentAttache that = (ConnectedAgentAttache)obj; - return super.equals(obj) && _link == that._link && _link != null; - } catch (ClassCastException e) { - assert false : "Who's sending an " + obj.getClass().getSimpleName() + " to " + this.getClass().getSimpleName() + ".equals()? "; + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((_link == null) ? 0 : _link.hashCode()); + return result; + } + + @Override + public boolean equals(final Object obj) { + // Return false straight away. + if (obj == null) { return false; } + // No need to handle a ClassCastException. If the classes are different, then equals can return false straight ahead. + if (this.getClass() != obj.getClass()) { + return false; + } + // This should not be part of the equals() method, but I'm keeping it because it is expected behaviour based + // on the previous implementation. The link attribute of the other object should be checked here as well + // to verify if it's not null whilst the this is null. + if (_link == null) { + return false; + } + ConnectedAgentAttache that = (ConnectedAgentAttache)obj; + return super.equals(obj) && _link == that._link; } @Override diff --git a/engine/orchestration/src/com/cloud/agent/manager/DirectAgentAttache.java b/engine/orchestration/src/com/cloud/agent/manager/DirectAgentAttache.java index ef002d0f3eb..354da4b1c48 100755 --- a/engine/orchestration/src/com/cloud/agent/manager/DirectAgentAttache.java +++ b/engine/orchestration/src/com/cloud/agent/manager/DirectAgentAttache.java @@ -182,7 +182,7 @@ public class DirectAgentAttache extends AgentAttache { Command[] cmds = _req.getCommands(); ArrayList answers = new ArrayList(cmds.length); for (Command cmd : cmds) { - Answer answer = new Answer(cmd, false, "Bailed out as maximum oustanding task limit reached"); + Answer answer = new Answer(cmd, false, "Bailed out as maximum outstanding task limit reached"); answers.add(answer); } Response resp = new Response(_req, answers.toArray(new Answer[answers.size()])); diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java index 8b4433e6a09..3c272e48e55 100755 --- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -47,6 +47,7 @@ import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; import org.apache.cloudstack.engine.orchestration.service.VolumeOrchestrationService; import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo; import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator; import org.apache.cloudstack.framework.config.ConfigDepot; import org.apache.cloudstack.framework.config.ConfigKey; @@ -322,36 +323,36 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac protected StateMachine2 _stateMachine; static final ConfigKey StartRetry = new ConfigKey("Advanced", Integer.class, "start.retry", "10", - "Number of times to retry create and start commands", true); + "Number of times to retry create and start commands", true); static final ConfigKey VmOpWaitInterval = new ConfigKey("Advanced", Integer.class, "vm.op.wait.interval", "120", - "Time (in seconds) to wait before checking if a previous operation has succeeded", true); + "Time (in seconds) to wait before checking if a previous operation has succeeded", true); static final ConfigKey VmOpLockStateRetry = new ConfigKey("Advanced", Integer.class, "vm.op.lock.state.retry", "5", - "Times to retry locking the state of a VM for operations, -1 means forever", true); + "Times to retry locking the state of a VM for operations, -1 means forever", true); static final ConfigKey VmOpCleanupInterval = new ConfigKey("Advanced", Long.class, "vm.op.cleanup.interval", "86400", - "Interval to run the thread that cleans up the vm operations (in seconds)", false); + "Interval to run the thread that cleans up the vm operations (in seconds)", false); static final ConfigKey VmOpCleanupWait = new ConfigKey("Advanced", Long.class, "vm.op.cleanup.wait", "3600", - "Time (in seconds) to wait before cleanuping up any vm work items", true); + "Time (in seconds) to wait before cleanuping up any vm work items", true); static final ConfigKey VmOpCancelInterval = new ConfigKey("Advanced", Long.class, "vm.op.cancel.interval", "3600", - "Time (in seconds) to wait before cancelling a operation", false); + "Time (in seconds) to wait before cancelling a operation", false); static final ConfigKey VmDestroyForcestop = new ConfigKey("Advanced", Boolean.class, "vm.destroy.forcestop", "false", - "On destroy, force-stop takes this value ", true); + "On destroy, force-stop takes this value ", true); static final ConfigKey ClusterDeltaSyncInterval = new ConfigKey("Advanced", Integer.class, "sync.interval", "60", - "Cluster Delta sync interval in seconds", - false); + "Cluster Delta sync interval in seconds", + false); static final ConfigKey VmJobEnabled = new ConfigKey("Advanced", - Boolean.class, "vm.job.enabled", "false", - "True to enable new VM sync model. false to use the old way", false); + Boolean.class, "vm.job.enabled", "true", + "True to enable new VM sync model. false to use the old way", false); static final ConfigKey VmJobCheckInterval = new ConfigKey("Advanced", - Long.class, "vm.job.check.interval", "3000", - "Interval in milliseconds to check if the job is complete", false); + Long.class, "vm.job.check.interval", "3000", + "Interval in milliseconds to check if the job is complete", false); static final ConfigKey VmJobTimeout = new ConfigKey("Advanced", - Long.class, "vm.job.timeout", "600000", - "Time in milliseconds to wait before attempting to cancel a job", false); + Long.class, "vm.job.timeout", "600000", + "Time in milliseconds to wait before attempting to cancel a job", false); static final ConfigKey VmJobStateReportInterval = new ConfigKey("Advanced", - Integer.class, "vm.job.report.interval", "60", - "Interval to send application level pings to make sure the connection is still working", false); + Integer.class, "vm.job.report.interval", "60", + "Interval to send application level pings to make sure the connection is still working", false); ScheduledExecutorService _executor = null; @@ -367,9 +368,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac @Override @DB public void allocate(String vmInstanceName, final VirtualMachineTemplate template, ServiceOffering serviceOffering, - final Pair rootDiskOffering, LinkedHashMap dataDiskOfferings, - final LinkedHashMap auxiliaryNetworks, DeploymentPlan plan, HypervisorType hyperType) - throws InsufficientCapacityException { + final Pair rootDiskOffering, LinkedHashMap dataDiskOfferings, + final LinkedHashMap> auxiliaryNetworks, DeploymentPlan plan, HypervisorType hyperType) + throws InsufficientCapacityException { VMInstanceVO vm = _vmDao.findVMByInstanceName(vmInstanceName); final Account owner = _entityMgr.findById(Account.class, vm.getAccountId()); @@ -385,49 +386,49 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac assert (plan.getClusterId() == null && plan.getPoolId() == null) : "We currently don't support cluster and pool preset yet"; final VMInstanceVO vmFinal = _vmDao.persist(vm); final LinkedHashMap dataDiskOfferingsFinal = - dataDiskOfferings == null ? new LinkedHashMap() : dataDiskOfferings; + dataDiskOfferings == null ? new LinkedHashMap() : dataDiskOfferings; - final VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(vmFinal, template, serviceOffering, null, null); + final VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(vmFinal, template, serviceOffering, null, null); - Transaction.execute(new TransactionCallbackWithExceptionNoReturn() { - @Override - public void doInTransactionWithoutResult(TransactionStatus status) throws InsufficientCapacityException { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Allocating nics for " + vmFinal); - } + Transaction.execute(new TransactionCallbackWithExceptionNoReturn() { + @Override + public void doInTransactionWithoutResult(TransactionStatus status) throws InsufficientCapacityException { + if (s_logger.isDebugEnabled()) { + s_logger.debug("Allocating nics for " + vmFinal); + } - try { - _networkMgr.allocate(vmProfile, auxiliaryNetworks); - } catch (ConcurrentOperationException e) { - throw new CloudRuntimeException("Concurrent operation while trying to allocate resources for the VM", e); - } + try { + _networkMgr.allocate(vmProfile, auxiliaryNetworks); + } catch (ConcurrentOperationException e) { + throw new CloudRuntimeException("Concurrent operation while trying to allocate resources for the VM", e); + } + + if (s_logger.isDebugEnabled()) { + s_logger.debug("Allocating disks for " + vmFinal); + } + + if (template.getFormat() == ImageFormat.ISO) { + volumeMgr.allocateRawVolume(Type.ROOT, "ROOT-" + vmFinal.getId(), rootDiskOffering.first(), rootDiskOffering.second(), vmFinal, template, owner); + } else if (template.getFormat() == ImageFormat.BAREMETAL) { + // Do nothing + } else { + volumeMgr.allocateTemplatedVolume(Type.ROOT, "ROOT-" + vmFinal.getId(), rootDiskOffering.first(), rootDiskOffering.second(), template, vmFinal, owner); + } + + for (Map.Entry offering : dataDiskOfferingsFinal.entrySet()) { + volumeMgr.allocateRawVolume(Type.DATADISK, "DATA-" + vmFinal.getId(), offering.getKey(), offering.getValue(), vmFinal, template, owner); + } + } + }); if (s_logger.isDebugEnabled()) { - s_logger.debug("Allocating disks for " + vmFinal); + s_logger.debug("Allocation completed for VM: " + vmFinal); } - - if (template.getFormat() == ImageFormat.ISO) { - volumeMgr.allocateRawVolume(Type.ROOT, "ROOT-" + vmFinal.getId(), rootDiskOffering.first(), rootDiskOffering.second(), vmFinal, template, owner); - } else if (template.getFormat() == ImageFormat.BAREMETAL) { - // Do nothing - } else { - volumeMgr.allocateTemplatedVolume(Type.ROOT, "ROOT-" + vmFinal.getId(), rootDiskOffering.first(), rootDiskOffering.second(), template, vmFinal, owner); - } - - for (Map.Entry offering : dataDiskOfferingsFinal.entrySet()) { - volumeMgr.allocateRawVolume(Type.DATADISK, "DATA-" + vmFinal.getId(), offering.getKey(), offering.getValue(), vmFinal, template, owner); - } - } - }); - - if (s_logger.isDebugEnabled()) { - s_logger.debug("Allocation completed for VM: " + vmFinal); - } } @Override public void allocate(String vmInstanceName, VirtualMachineTemplate template, ServiceOffering serviceOffering, - LinkedHashMap networks, DeploymentPlan plan, HypervisorType hyperType) throws InsufficientCapacityException { + LinkedHashMap> networks, DeploymentPlan plan, HypervisorType hyperType) throws InsufficientCapacityException { allocate(vmInstanceName, template, serviceOffering, new Pair(serviceOffering, null), null, networks, plan, hyperType); } @@ -576,6 +577,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac public boolean configure(String name, Map xmlParams) throws ConfigurationException { ReservationContextImpl.init(_entityMgr); VirtualMachineProfileImpl.init(_entityMgr); + VmWorkMigrate.init(_entityMgr); _executor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("Vm-Operations-Cleanup")); _nodeId = ManagementServerNode.getManagementServerId(); @@ -634,7 +636,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac } try { - Thread.sleep(VmOpWaitInterval.value()); + Thread.sleep(VmOpWaitInterval.value()*1000); } catch (InterruptedException e) { s_logger.info("Waiting for " + vm + " but is interrupted"); throw new ConcurrentOperationException("Waiting for " + vm + " but is interrupted"); @@ -646,7 +648,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac @DB protected Ternary changeToStartState(VirtualMachineGuru vmGuru, final VMInstanceVO vm, final User caller, - final Account account) throws ConcurrentOperationException { + final Account account) throws ConcurrentOperationException { long vmId = vm.getId(); ItWorkVO work = new ItWorkVO(UUID.randomUUID().toString(), _nodeId, State.Starting, vm.getType(), vm.getId()); @@ -655,23 +657,23 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac try { final ItWorkVO workFinal = work; Ternary result = - Transaction.execute(new TransactionCallbackWithException, NoTransitionException>() { - @Override - public Ternary doInTransaction(TransactionStatus status) throws NoTransitionException { - Journal journal = new Journal.LogJournal("Creating " + vm, s_logger); - ItWorkVO work = _workDao.persist(workFinal); - ReservationContextImpl context = new ReservationContextImpl(work.getId(), journal, caller, account); + Transaction.execute(new TransactionCallbackWithException, NoTransitionException>() { + @Override + public Ternary doInTransaction(TransactionStatus status) throws NoTransitionException { + Journal journal = new Journal.LogJournal("Creating " + vm, s_logger); + ItWorkVO work = _workDao.persist(workFinal); + ReservationContextImpl context = new ReservationContextImpl(work.getId(), journal, caller, account); - if (stateTransitTo(vm, Event.StartRequested, null, work.getId())) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Successfully transitioned to start state for " + vm + " reservation id = " + work.getId()); + if (stateTransitTo(vm, Event.StartRequested, null, work.getId())) { + if (s_logger.isDebugEnabled()) { + s_logger.debug("Successfully transitioned to start state for " + vm + " reservation id = " + work.getId()); + } + return new Ternary(vm, context, work); } - return new Ternary(vm, context, work); - } - return new Ternary(null, null, work); - } - }); + return new Ternary(null, null, work); + } + }); work = result.third(); if (result.first() != null) @@ -743,13 +745,13 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac @Override public void advanceStart(String vmUuid, Map params, DeploymentPlanner planner) - throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException { + throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException { advanceStart(vmUuid, params, null, planner); } @Override - public void advanceStart(String vmUuid, Map params, DeploymentPlan planToDeploy, DeploymentPlanner planner) throws InsufficientCapacityException, - ConcurrentOperationException, ResourceUnavailableException { + public void advanceStart(String vmUuid, Map params, DeploymentPlan planToDeploy, DeploymentPlanner planner) + throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException { AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext(); if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) { @@ -782,6 +784,12 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac throw (ConcurrentOperationException)jobResult; else if (jobResult instanceof ResourceUnavailableException) throw (ResourceUnavailableException)jobResult; + else if (jobResult instanceof InsufficientCapacityException) + throw (InsufficientCapacityException)jobResult; + else if (jobResult instanceof RuntimeException) + throw (RuntimeException)jobResult; + else if (jobResult instanceof Throwable) + throw new RuntimeException("Unexpected exception", (Throwable)jobResult); } } } @@ -819,11 +827,11 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac if (planToDeploy != null && planToDeploy.getDataCenterId() != 0) { if (s_logger.isDebugEnabled()) { s_logger.debug("advanceStart: DeploymentPlan is provided, using dcId:" + planToDeploy.getDataCenterId() + ", podId: " + planToDeploy.getPodId() + - ", clusterId: " + planToDeploy.getClusterId() + ", hostId: " + planToDeploy.getHostId() + ", poolId: " + planToDeploy.getPoolId()); + ", clusterId: " + planToDeploy.getClusterId() + ", hostId: " + planToDeploy.getHostId() + ", poolId: " + planToDeploy.getPoolId()); } plan = - new DataCenterDeployment(planToDeploy.getDataCenterId(), planToDeploy.getPodId(), planToDeploy.getClusterId(), planToDeploy.getHostId(), - planToDeploy.getPoolId(), planToDeploy.getPhysicalNetworkId(), ctx); + new DataCenterDeployment(planToDeploy.getDataCenterId(), planToDeploy.getPodId(), planToDeploy.getClusterId(), planToDeploy.getHostId(), + planToDeploy.getPoolId(), planToDeploy.getPhysicalNetworkId(), ctx); } HypervisorGuru hvGuru = _hvGuruMgr.getGuru(vm.getHypervisorType()); @@ -881,21 +889,21 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac // planner if (s_logger.isDebugEnabled()) { s_logger.debug("Cannot satisfy the deployment plan passed in since the ready Root volume is in different cluster. volume's cluster: " + - rootVolClusterId + ", cluster specified: " + clusterIdSpecified); + rootVolClusterId + ", cluster specified: " + clusterIdSpecified); } throw new ResourceUnavailableException( - "Root volume is ready in different cluster, Deployment plan provided cannot be satisfied, unable to create a deployment for " + - vm, Cluster.class, clusterIdSpecified); + "Root volume is ready in different cluster, Deployment plan provided cannot be satisfied, unable to create a deployment for " + + vm, Cluster.class, clusterIdSpecified); } } plan = - new DataCenterDeployment(planToDeploy.getDataCenterId(), planToDeploy.getPodId(), planToDeploy.getClusterId(), - planToDeploy.getHostId(), vol.getPoolId(), null, ctx); + new DataCenterDeployment(planToDeploy.getDataCenterId(), planToDeploy.getPodId(), planToDeploy.getClusterId(), + planToDeploy.getHostId(), vol.getPoolId(), null, ctx); } else { plan = new DataCenterDeployment(rootVolDcId, rootVolPodId, rootVolClusterId, null, vol.getPoolId(), null, ctx); if (s_logger.isDebugEnabled()) { s_logger.debug(vol + " is READY, changing deployment plan to use this pool's dcId: " + rootVolDcId + " , podId: " + rootVolPodId + - " , and clusterId: " + rootVolClusterId); + " , and clusterId: " + rootVolClusterId); } planChangedByVolume = true; } @@ -923,7 +931,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac continue; } throw new InsufficientServerCapacityException("Unable to create a deployment for " + vmProfile, DataCenter.class, plan.getDataCenterId(), - areAffinityGroupsAssociated(vmProfile)); + areAffinityGroupsAssociated(vmProfile)); } if (dest != null) { @@ -938,12 +946,12 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac ClusterDetailsVO cluster_detail_ram = _clusterDetailsDao.findDetail(cluster_id, "memoryOvercommitRatio"); //storing the value of overcommit in the vm_details table for doing a capacity check in case the cluster overcommit ratio is changed. if (_uservmDetailsDao.findDetail(vm.getId(), "cpuOvercommitRatio") == null && - ((Float.parseFloat(cluster_detail_cpu.getValue()) > 1f || Float.parseFloat(cluster_detail_ram.getValue()) > 1f))) { - _uservmDetailsDao.addDetail(vm.getId(), "cpuOvercommitRatio", cluster_detail_cpu.getValue()); - _uservmDetailsDao.addDetail(vm.getId(), "memoryOvercommitRatio", cluster_detail_ram.getValue()); + ((Float.parseFloat(cluster_detail_cpu.getValue()) > 1f || Float.parseFloat(cluster_detail_ram.getValue()) > 1f))) { + _uservmDetailsDao.addDetail(vm.getId(), "cpuOvercommitRatio", cluster_detail_cpu.getValue(), true); + _uservmDetailsDao.addDetail(vm.getId(), "memoryOvercommitRatio", cluster_detail_ram.getValue(), true); } else if (_uservmDetailsDao.findDetail(vm.getId(), "cpuOvercommitRatio") != null) { - _uservmDetailsDao.addDetail(vm.getId(), "cpuOvercommitRatio", cluster_detail_cpu.getValue()); - _uservmDetailsDao.addDetail(vm.getId(), "memoryOvercommitRatio", cluster_detail_ram.getValue()); + _uservmDetailsDao.addDetail(vm.getId(), "cpuOvercommitRatio", cluster_detail_cpu.getValue(), true); + _uservmDetailsDao.addDetail(vm.getId(), "memoryOvercommitRatio", cluster_detail_ram.getValue(), true); } vmProfile.setCpuOvercommitRatio(Float.parseFloat(cluster_detail_cpu.getValue())); vmProfile.setMemoryOvercommitRatio(Float.parseFloat(cluster_detail_ram.getValue())); @@ -1205,13 +1213,18 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac _userVmDao.saveDetails(userVm); } } - } - if (!answer.getResult()) { - s_logger.debug("Unable to stop VM due to " + answer.getDetails()); + + if (!answer.getResult()) { + s_logger.debug("Unable to stop VM due to " + answer.getDetails()); + return false; + } + + guru.finalizeStop(profile, answer); + } else { + s_logger.error("Invalid answer received in response to a StopCommand for " + vm.getInstanceName()); return false; } - guru.finalizeStop(profile, answer); } catch (AgentUnavailableException e) { if (!force) { return false; @@ -1327,6 +1340,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac throw (ConcurrentOperationException)jobResult; else if (jobResult instanceof OperationTimedoutException) throw (OperationTimedoutException)jobResult; + else if (jobResult instanceof RuntimeException) + throw (RuntimeException)jobResult; + else if (jobResult instanceof Throwable) + throw new RuntimeException("Unexpected exception", (Throwable)jobResult); } } } @@ -1338,7 +1355,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac } private void advanceStop(VMInstanceVO vm, boolean cleanUpEvenIfUnableToStop) throws AgentUnavailableException, OperationTimedoutException, - ConcurrentOperationException { + ConcurrentOperationException { State state = vm.getState(); if (state == State.Stopped) { if (s_logger.isDebugEnabled()) { @@ -1454,12 +1471,14 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac _userVmDao.saveDetails(userVm); } } + stopped = answer.getResult(); + if (!stopped) { + throw new CloudRuntimeException("Unable to stop the virtual machine due to " + answer.getDetails()); + } + vmGuru.finalizeStop(profile, answer); + } else { + throw new CloudRuntimeException("Invalid answer received in response to a StopCommand on " + vm.instanceName); } - stopped = answer.getResult(); - if (!stopped) { - throw new CloudRuntimeException("Unable to stop the virtual machine due to " + answer.getDetails()); - } - vmGuru.finalizeStop(profile, answer); } catch (AgentUnavailableException e) { s_logger.warn("Unable to stop vm, agent unavailable: " + e.toString()); @@ -1526,10 +1545,15 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac protected boolean stateTransitTo(VMInstanceVO vm, VirtualMachine.Event e, Long hostId, String reservationId) throws NoTransitionException { // if there are active vm snapshots task, state change is not allowed - if (_vmSnapshotMgr.hasActiveVMSnapshotTasks(vm.getId())) { - s_logger.error("State transit with event: " + e + " failed due to: " + vm.getInstanceName() + " has active VM snapshots tasks"); - return false; - } + + // Disable this hacking thing, VM snapshot task need to be managed by its orchestartion flow istelf instead of + // hacking it here at general VM manager + /* + if (_vmSnapshotMgr.hasActiveVMSnapshotTasks(vm.getId())) { + s_logger.error("State transit with event: " + e + " failed due to: " + vm.getInstanceName() + " has active VM snapshots tasks"); + return false; + } + */ vm.setReservationId(reservationId); return _stateMachine.transitTo(vm, e, new Pair(vm.getHostId(), hostId), _vmDao); } @@ -1537,11 +1561,15 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac @Override public boolean stateTransitTo(VirtualMachine vm1, VirtualMachine.Event e, Long hostId) throws NoTransitionException { VMInstanceVO vm = (VMInstanceVO)vm1; - // if there are active vm snapshots task, state change is not allowed - if (_vmSnapshotMgr.hasActiveVMSnapshotTasks(vm.getId())) { - s_logger.error("State transit with event: " + e + " failed due to: " + vm.getInstanceName() + " has active VM snapshots tasks"); - return false; - } + + /* + * Remove the hacking logic here. + // if there are active vm snapshots task, state change is not allowed + if (_vmSnapshotMgr.hasActiveVMSnapshotTasks(vm.getId())) { + s_logger.error("State transit with event: " + e + " failed due to: " + vm.getInstanceName() + " has active VM snapshots tasks"); + return false; + } + */ State oldState = vm.getState(); if (oldState == State.Starting) { @@ -1630,6 +1658,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac if (jobResult != null) { if (jobResult instanceof RuntimeException) throw (RuntimeException)jobResult; + else if (jobResult instanceof Throwable) + throw new RuntimeException("Unexpected exception", (Throwable)jobResult); } } } @@ -1726,6 +1756,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac throw (ConcurrentOperationException)jobResult; else if (jobResult instanceof RuntimeException) throw (RuntimeException)jobResult; + else if (jobResult instanceof Throwable) + throw new RuntimeException("Unexpected exception", (Throwable)jobResult); + } } } @@ -1869,8 +1902,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac _networkMgr.rollbackNicForMigration(vmSrc, profile); _alertMgr.sendAlert(alertType, fromHost.getDataCenterId(), fromHost.getPodId(), - "Unable to migrate vm " + vm.getInstanceName() + " from host " + fromHost.getName() + " in zone " + dest.getDataCenter().getName() + " and pod " + - dest.getPod().getName(), "Migrate Command failed. Please check logs."); + "Unable to migrate vm " + vm.getInstanceName() + " from host " + fromHost.getName() + " in zone " + dest.getDataCenter().getName() + " and pod " + + dest.getPod().getName(), "Migrate Command failed. Please check logs."); try { _agentMgr.send(dstHostId, new Commands(cleanup(vm)), null); } catch (AgentUnavailableException ae) { @@ -1903,8 +1936,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac if (_poolHostDao.findByPoolHost(pool.getId(), host.getId()) == null || pool.isLocal() != diskOffering.getUseLocalStorage()) { // Cannot find a pool for the volume. Throw an exception. throw new CloudRuntimeException("Cannot migrate volume " + volume + " to storage pool " + pool + " while migrating vm to host " + host + - ". Either the pool is not accessible from the " + "host or because of the offering with which the volume is created it cannot be placed on " + - "the given pool."); + ". Either the pool is not accessible from the " + "host or because of the offering with which the volume is created it cannot be placed on " + + "the given pool."); } else if (pool.getId() == currentPool.getId()) { // If the pool to migrate too is the same as current pool, remove the volume from the list of // volumes to be migrated. @@ -1936,7 +1969,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac if (!currentPoolAvailable && !volumeToPool.containsKey(volume)) { // Cannot find a pool for the volume. Throw an exception. throw new CloudRuntimeException("Cannot find a storage pool which is available for volume " + volume + " while migrating virtual machine " + - profile.getVirtualMachine() + " to host " + host); + profile.getVirtualMachine() + " to host " + host); } } } @@ -2007,12 +2040,16 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac throw (ResourceUnavailableException)jobException; else if (jobException instanceof ConcurrentOperationException) throw (ConcurrentOperationException)jobException; - } + else if (jobException instanceof RuntimeException) + throw (RuntimeException)jobException; + else if (jobException instanceof Throwable) + throw new RuntimeException("Unexpected exception", (Throwable)jobException); + } } } private void orchestrateMigrateWithStorage(String vmUuid, long srcHostId, long destHostId, Map volumeToPool) throws ResourceUnavailableException, - ConcurrentOperationException { + ConcurrentOperationException { VMInstanceVO vm = _vmDao.findByUuid(vmUuid); @@ -2033,7 +2070,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac // a vm and not migrating a vm with storage. if (volumeToPool.isEmpty()) { throw new InvalidParameterValueException("Migration of the vm " + vm + "from host " + srcHost + " to destination host " + destHost + - " doesn't involve migrating the volumes."); + " doesn't involve migrating the volumes."); } AlertManager.AlertType alertType = AlertManager.AlertType.ALERT_TYPE_USERVM_MIGRATE; @@ -2086,8 +2123,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac if (!migrated) { s_logger.info("Migration was unsuccessful. Cleaning up: " + vm); _alertMgr.sendAlert(alertType, srcHost.getDataCenterId(), srcHost.getPodId(), - "Unable to migrate vm " + vm.getInstanceName() + " from host " + srcHost.getName() + " in zone " + dc.getName() + " and pod " + dc.getName(), - "Migrate Command failed. Please check logs."); + "Unable to migrate vm " + vm.getInstanceName() + " from host " + srcHost.getName() + " in zone " + dc.getName() + " and pod " + dc.getName(), + "Migrate Command failed. Please check logs."); try { _agentMgr.send(destHostId, new Commands(cleanup(vm.getInstanceName())), null); stateTransitTo(vm, Event.OperationFailed, srcHostId); @@ -2125,10 +2162,12 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac if (work.getType() == State.Starting) { _haMgr.scheduleRestart(vm, true); work.setManagementServerId(_nodeId); + work.setStep(Step.Done); _workDao.update(work.getId(), work); } else if (work.getType() == State.Stopping) { _haMgr.scheduleStop(vm, vm.getHostId(), WorkType.CheckStop); work.setManagementServerId(_nodeId); + work.setStep(Step.Done); _workDao.update(work.getId(), work); } else if (work.getType() == State.Migrating) { _haMgr.scheduleMigration(vm); @@ -2150,7 +2189,53 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac } @Override - public void migrateAway(String vmUuid, long srcHostId, DeploymentPlanner planner) throws InsufficientServerCapacityException { + public void migrateAway(String vmUuid, long srcHostId) throws InsufficientServerCapacityException { + AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext(); + if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) { + // avoid re-entrance + + VmWorkJobVO placeHolder = null; + if (VmJobEnabled.value()) { + VirtualMachine vm = _vmDao.findByUuid(vmUuid); + placeHolder = createPlaceHolderWork(vm.getId()); + } + try { + try { + orchestrateMigrateAway(vmUuid, srcHostId, null); + } catch (InsufficientServerCapacityException e) { + s_logger.warn("Failed to deploy vm " + vmUuid + " with original planner, sending HAPlanner"); + orchestrateMigrateAway(vmUuid, srcHostId, _haMgr.getHAPlanner()); + } + } finally { + if (VmJobEnabled.value()) + _workJobDao.expunge(placeHolder.getId()); + } + } else { + Outcome outcome = migrateVmAwayThroughJobQueue(vmUuid, srcHostId); + + try { + VirtualMachine vm = outcome.get(); + } catch (InterruptedException e) { + throw new RuntimeException("Operation is interrupted", e); + } catch (java.util.concurrent.ExecutionException e) { + throw new RuntimeException("Execution excetion", e); + } + + Object jobException = _jobMgr.unmarshallResultObject(outcome.getJob()); + if (jobException != null) { + if (jobException instanceof InsufficientServerCapacityException) + throw (InsufficientServerCapacityException)jobException; + else if (jobException instanceof ConcurrentOperationException) + throw (ConcurrentOperationException)jobException; + else if (jobException instanceof RuntimeException) + throw (RuntimeException)jobException; + else if (jobException instanceof Throwable) + throw new RuntimeException("Unexpected exception", (Throwable)jobException); + } + } + } + + private void orchestrateMigrateAway(String vmUuid, long srcHostId, DeploymentPlanner planner) throws InsufficientServerCapacityException { VMInstanceVO vm = _vmDao.findByUuid(vmUuid); if (vm == null) { s_logger.debug("Unable to find a VM for " + vmUuid); @@ -2302,6 +2387,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac throw (ConcurrentOperationException)jobResult; else if (jobResult instanceof InsufficientCapacityException) throw (InsufficientCapacityException)jobResult; + else if (jobResult instanceof RuntimeException) + throw (RuntimeException)jobResult; + else if (jobResult instanceof Throwable) + throw new RuntimeException("Unexpected exception", (Throwable)jobResult); } } } @@ -2312,10 +2401,11 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac DataCenter dc = _entityMgr.findById(DataCenter.class, vm.getDataCenterId()); Host host = _hostDao.findById(vm.getHostId()); - Cluster cluster = null; - if (host != null) { - cluster = _entityMgr.findById(Cluster.class, host.getClusterId()); + if (host == null) { + // Should findById throw an Exception is the host is not found? + throw new CloudRuntimeException("Unable to retrieve host with id " + vm.getHostId()); } + Cluster cluster = _entityMgr.findById(Cluster.class, host.getClusterId()); Pod pod = _entityMgr.findById(Pod.class, host.getPodId()); DeployDestination dest = new DeployDestination(dc, pod, cluster, host); @@ -2356,7 +2446,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac // sync VM Snapshots related transient states List vmSnapshotsInTrasientStates = - _vmSnapshotDao.listByInstanceId(vm.getId(), VMSnapshot.State.Expunging, VMSnapshot.State.Reverting, VMSnapshot.State.Creating); + _vmSnapshotDao.listByInstanceId(vm.getId(), VMSnapshot.State.Expunging, VMSnapshot.State.Reverting, VMSnapshot.State.Creating); if (vmSnapshotsInTrasientStates.size() > 1) { s_logger.info("Found vm " + vm.getInstanceName() + " with VM snapshots in transient states, needs to sync VM snapshot state"); if (!_vmSnapshotMgr.syncVMSnapshot(vm, hostId)) { @@ -2479,7 +2569,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac // sync VM Snapshots related transient states List vmSnapshotsInExpungingStates = - _vmSnapshotDao.listByInstanceId(vm.getId(), VMSnapshot.State.Expunging, VMSnapshot.State.Creating, VMSnapshot.State.Reverting); + _vmSnapshotDao.listByInstanceId(vm.getId(), VMSnapshot.State.Expunging, VMSnapshot.State.Creating, VMSnapshot.State.Reverting); if (vmSnapshotsInExpungingStates.size() > 0) { s_logger.info("Found vm " + vm.getInstanceName() + " in state. " + vm.getState() + ", needs to sync VM snapshot state"); Long hostId = null; @@ -2497,9 +2587,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac } if ((info == null && (vm.getState() == State.Running || vm.getState() == State.Starting)) || - (info != null && (info.state == State.Running && vm.getState() == State.Starting))) { + (info != null && (info.state == State.Running && vm.getState() == State.Starting))) { s_logger.info("Found vm " + vm.getInstanceName() + " in inconsistent state. " + vm.getState() + " on CS while " + (info == null ? "Stopped" : "Running") + - " on agent"); + " on agent"); info = new AgentVmInfo(vm.getInstanceName(), vm, State.Stopped); // Bug 13850- grab outstanding work item if any for this VM state so that we mark it as DONE after we change VM state, else it will remain pending @@ -2536,7 +2626,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac e.printStackTrace(); } } else if (info != null && - (vm.getState() == State.Stopped || vm.getState() == State.Stopping || vm.isRemoved() || vm.getState() == State.Destroyed || vm.getState() == State.Expunging)) { + (vm.getState() == State.Stopped || vm.getState() == State.Stopping || vm.isRemoved() || vm.getState() == State.Destroyed || vm.getState() == State.Expunging)) { Host host = _hostDao.findByGuid(info.getHostUuid()); if (host != null) { s_logger.warn("Stopping a VM which is stopped/stopping/destroyed/expunging " + info.name); @@ -2555,19 +2645,19 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac } } } else - // host id can change - if (info != null && vm.getState() == State.Running) { - // check for host id changes - Host host = _hostDao.findByGuid(info.getHostUuid()); - if (host != null && (vm.getHostId() == null || host.getId() != vm.getHostId())) { - s_logger.info("Found vm " + vm.getInstanceName() + " with inconsistent host in db, new host is " + host.getId()); - try { - stateTransitTo(vm, VirtualMachine.Event.AgentReportMigrated, host.getId()); - } catch (NoTransitionException e) { - s_logger.warn(e.getMessage()); + // host id can change + if (info != null && vm.getState() == State.Running) { + // check for host id changes + Host host = _hostDao.findByGuid(info.getHostUuid()); + if (host != null && (vm.getHostId() == null || host.getId() != vm.getHostId())) { + s_logger.info("Found vm " + vm.getInstanceName() + " with inconsistent host in db, new host is " + host.getId()); + try { + stateTransitTo(vm, VirtualMachine.Event.AgentReportMigrated, host.getId()); + } catch (NoTransitionException e) { + s_logger.warn(e.getMessage()); + } } } - } /* else if(info == null && vm.getState() == State.Stopping) { //Handling CS-13376 s_logger.warn("Marking the VM as Stopped as it was still stopping on the CS" +vm.getName()); vm.setState(State.Stopped); // Setting the VM as stopped on the DB and clearing it from the host @@ -2691,8 +2781,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac String hostDesc = "name: " + hostVO.getName() + " (id:" + hostVO.getId() + "), availability zone: " + dcVO.getName() + ", pod: " + podVO.getName(); _alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodIdToDeployIn(), "VM (name: " + vm.getInstanceName() + ", id: " + vm.getId() + - ") stopped on host " + hostDesc + " due to storage failure", "Virtual Machine " + vm.getInstanceName() + " (id: " + vm.getId() + ") running on host [" + - vm.getHostId() + "] stopped due to storage failure."); + ") stopped on host " + hostDesc + " due to storage failure", "Virtual Machine " + vm.getInstanceName() + " (id: " + vm.getId() + ") running on host [" + + vm.getHostId() + "] stopped due to storage failure."); } // track platform info if (info.platform != null && !info.platform.isEmpty()) { @@ -2708,7 +2798,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac if (serverState == State.Starting) { if (vm.getHostId() != null && vm.getHostId() != hostId) { s_logger.info("CloudStack is starting VM on host " + vm.getHostId() + ", but status report comes from a different host " + hostId + - ", skip status sync for vm: " + vm.getInstanceName()); + ", skip status sync for vm: " + vm.getInstanceName()); return null; } } @@ -2733,7 +2823,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac if (serverState == State.Starting) { if (vm.getHostId() != null && vm.getHostId() != hostId) { s_logger.info("CloudStack is starting VM on host " + vm.getHostId() + ", but status report comes from a different host " + hostId + - ", skip status sync for vm: " + vm.getInstanceName()); + ", skip status sync for vm: " + vm.getInstanceName()); return null; } } @@ -2749,7 +2839,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac if (vm.getHostId() == null || hostId != vm.getHostId()) { if (s_logger.isDebugEnabled()) { s_logger.debug("detected host change when VM " + vm + " is at running state, VM could be live-migrated externally from host " + - vm.getHostId() + " to host " + hostId); + vm.getHostId() + " to host " + hostId); } stateTransitTo(vm, VirtualMachine.Event.AgentReportMigrated, hostId); @@ -2847,7 +2937,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac } private void ensureVmRunningContext(long hostId, VMInstanceVO vm, Event cause) throws OperationTimedoutException, ResourceUnavailableException, - NoTransitionException, InsufficientAddressCapacityException { + NoTransitionException, InsufficientAddressCapacityException { VirtualMachineGuru vmGuru = getVmGuru(vm); s_logger.debug("VM state is starting on full sync so updating it to running"); @@ -2876,8 +2966,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac for (NicVO nic : nics) { Network network = _networkModel.getNetwork(nic.getNetworkId()); NicProfile nicProfile = - new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), null, _networkModel.isSecurityGroupSupportedInNetwork(network), - _networkModel.getNetworkTag(profile.getHypervisorType(), network)); + new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), null, _networkModel.isSecurityGroupSupportedInNetwork(network), + _networkModel.getNetworkTag(profile.getHypervisorType(), network)); profile.addNic(nicProfile); } @@ -2914,12 +3004,14 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac @Override public boolean processAnswers(long agentId, long seq, Answer[] answers) { - for (final Answer answer : answers) { - if (answer instanceof ClusterSyncAnswer) { - ClusterSyncAnswer hs = (ClusterSyncAnswer)answer; - if (!hs.isExceuted()) { - deltaSync(hs.getNewStates()); - hs.setExecuted(); + if (!VmJobEnabled.value()) { + for (final Answer answer : answers) { + if (answer instanceof ClusterSyncAnswer) { + ClusterSyncAnswer hs = (ClusterSyncAnswer)answer; + if (!hs.isExceuted()) { + deltaSync(hs.getNewStates()); + hs.setExecuted(); + } } } } @@ -2943,18 +3035,20 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac if (cmd instanceof PingRoutingCommand) { PingRoutingCommand ping = (PingRoutingCommand)cmd; if (ping.getNewStates() != null && ping.getNewStates().size() > 0) { - Commands commands = deltaHostSync(agentId, ping.getNewStates()); - if (commands.size() > 0) { - try { - _agentMgr.send(agentId, commands, this); - } catch (final AgentUnavailableException e) { - s_logger.warn("Agent is now unavailable", e); + if (!VmJobEnabled.value()) { + Commands commands = deltaHostSync(agentId, ping.getNewStates()); + if (commands.size() > 0) { + try { + _agentMgr.send(agentId, commands, this); + } catch (final AgentUnavailableException e) { + s_logger.warn("Agent is now unavailable", e); + } } } } if(VmJobEnabled.value()) { - if (ping.getHostVmStateReport() != null && ping.getHostVmStateReport().size() > 0) { + if (ping.getHostVmStateReport() != null) { _syncMgr.processHostVmStatePingReport(agentId, ping.getHostVmStateReport()); } } @@ -2984,10 +3078,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac return; } - if (s_logger.isDebugEnabled()) + if(s_logger.isDebugEnabled()) s_logger.debug("Received startup command from hypervisor host. host id: " + agent.getId()); - if (VmJobEnabled.value()) { + if(VmJobEnabled.value()) { _syncMgr.resetHostSyncState(agent.getId()); } @@ -3005,48 +3099,51 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac long agentId = agent.getId(); if (agent.getHypervisorType() == HypervisorType.XenServer) { // only for Xen - StartupRoutingCommand startup = (StartupRoutingCommand)cmd; - HashMap> allStates = startup.getClusterVMStateChanges(); - if (allStates != null) { - fullSync(clusterId, allStates); - } - - // initiate the cron job - ClusterSyncCommand syncCmd = new ClusterSyncCommand(ClusterDeltaSyncInterval.value(), clusterId); - try { - long seq_no = _agentMgr.send(agentId, new Commands(syncCmd), this); - s_logger.debug("Cluster VM sync started with jobid " + seq_no); - } catch (AgentUnavailableException e) { - s_logger.fatal("The Cluster VM sync process failed for cluster id " + clusterId + " with ", e); - } - } else { // for others KVM and VMWare - StartupRoutingCommand startup = (StartupRoutingCommand)cmd; - Commands commands = fullHostSync(agentId, startup); - - if (commands.size() > 0) { - s_logger.debug("Sending clean commands to the agent"); + if (!VmJobEnabled.value()) { + StartupRoutingCommand startup = (StartupRoutingCommand)cmd; + HashMap> allStates = startup.getClusterVMStateChanges(); + if (allStates != null) { + fullSync(clusterId, allStates); + } + // initiate the cron job + ClusterSyncCommand syncCmd = new ClusterSyncCommand(ClusterDeltaSyncInterval.value(), clusterId); try { - boolean error = false; - Answer[] answers = _agentMgr.send(agentId, commands); - for (Answer answer : answers) { - if (!answer.getResult()) { - s_logger.warn("Unable to stop a VM due to " + answer.getDetails()); - error = true; - } - } - if (error) { - throw new ConnectionException(true, "Unable to stop VMs"); - } - } catch (final AgentUnavailableException e) { - s_logger.warn("Agent is unavailable now", e); - throw new ConnectionException(true, "Unable to sync", e); - } catch (final OperationTimedoutException e) { - s_logger.warn("Agent is unavailable now", e); - throw new ConnectionException(true, "Unable to sync", e); + long seq_no = _agentMgr.send(agentId, new Commands(syncCmd), this); + s_logger.debug("Cluster VM sync started with jobid " + seq_no); + } catch (AgentUnavailableException e) { + s_logger.fatal("The Cluster VM sync process failed for cluster id " + clusterId + " with ", e); } } + } else { // for others KVM and VMWare + if (!VmJobEnabled.value()) { + StartupRoutingCommand startup = (StartupRoutingCommand)cmd; + Commands commands = fullHostSync(agentId, startup); + if (commands.size() > 0) { + s_logger.debug("Sending clean commands to the agent"); + + try { + boolean error = false; + Answer[] answers = _agentMgr.send(agentId, commands); + for (Answer answer : answers) { + if (!answer.getResult()) { + s_logger.warn("Unable to stop a VM due to " + answer.getDetails()); + error = true; + } + } + if (error) { + throw new ConnectionException(true, "Unable to stop VMs"); + } + } catch (final AgentUnavailableException e) { + s_logger.warn("Agent is unavailable now", e); + throw new ConnectionException(true, "Unable to sync", e); + } catch (final OperationTimedoutException e) { + s_logger.warn("Agent is unavailable now", e); + throw new ConnectionException(true, "Unable to sync", e); + } + } + } } } @@ -3125,25 +3222,25 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac @Override public void checkIfCanUpgrade(VirtualMachine vmInstance, ServiceOffering newServiceOffering) { if (newServiceOffering == null) { - throw new InvalidParameterValueException("Unable to find a service offering with id " + newServiceOffering.getId()); + throw new InvalidParameterValueException("Invalid parameter, newServiceOffering can't be null"); } // Check that the VM is stopped / running if (!(vmInstance.getState().equals(State.Stopped) || vmInstance.getState().equals(State.Running))) { s_logger.warn("Unable to upgrade virtual machine " + vmInstance.toString() + " in state " + vmInstance.getState()); throw new InvalidParameterValueException("Unable to upgrade virtual machine " + vmInstance.toString() + " " + " in state " + vmInstance.getState() + - "; make sure the virtual machine is stopped/running"); + "; make sure the virtual machine is stopped/running"); } // Check if the service offering being upgraded to is what the VM is already running with if (!newServiceOffering.isDynamic() && vmInstance.getServiceOfferingId() == newServiceOffering.getId()) { if (s_logger.isInfoEnabled()) { s_logger.info("Not upgrading vm " + vmInstance.toString() + " since it already has the requested " + "service offering (" + newServiceOffering.getName() + - ")"); + ")"); } throw new InvalidParameterValueException("Not upgrading vm " + vmInstance.toString() + " since it already " + "has the requested service offering (" + - newServiceOffering.getName() + ")"); + newServiceOffering.getName() + ")"); } ServiceOfferingVO currentServiceOffering = _offeringDao.findByIdIncludingRemoved(vmInstance.getId(), vmInstance.getServiceOfferingId()); @@ -3161,8 +3258,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac // offering if (currentServiceOffering.getUseLocalStorage() != newServiceOffering.getUseLocalStorage()) { throw new InvalidParameterValueException("Unable to upgrade virtual machine " + vmInstance.toString() + - ", cannot switch between local storage and shared storage service offerings. Current offering " + "useLocalStorage=" + - currentServiceOffering.getUseLocalStorage() + ", target offering useLocalStorage=" + newServiceOffering.getUseLocalStorage()); + ", cannot switch between local storage and shared storage service offerings. Current offering " + "useLocalStorage=" + + currentServiceOffering.getUseLocalStorage() + ", target offering useLocalStorage=" + newServiceOffering.getUseLocalStorage()); } // if vm is a system vm, check if it is a system service offering, if yes return with error as it cannot be used for user vms @@ -3173,7 +3270,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac // Check that there are enough resources to upgrade the service offering if (!isVirtualMachineUpgradable(vmInstance, newServiceOffering)) { throw new InvalidParameterValueException("Unable to upgrade virtual machine, not enough resources available " + "for an offering of " + - newServiceOffering.getCpu() + " cpu(s) at " + newServiceOffering.getSpeed() + " Mhz, and " + newServiceOffering.getRamSize() + " MB of memory"); + newServiceOffering.getCpu() + " cpu(s) at " + newServiceOffering.getSpeed() + " Mhz, and " + newServiceOffering.getRamSize() + " MB of memory"); } // Check that the service offering being upgraded to has all the tags of the current service offering @@ -3181,7 +3278,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac List newTags = StringUtils.csvTagsToList(newServiceOffering.getTags()); if (!newTags.containsAll(currentTags)) { throw new InvalidParameterValueException("Unable to upgrade virtual machine; the new service offering " + "does not have all the tags of the " + - "current service offering. Current service offering tags: " + currentTags + "; " + "new service " + "offering tags: " + newTags); + "current service offering. Current service offering tags: " + currentTags + "; " + "new service " + "offering tags: " + newTags); } } @@ -3234,8 +3331,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac throw (InsufficientCapacityException)jobException; else if (jobException instanceof RuntimeException) throw (RuntimeException)jobException; - else if (jobException instanceof Long) - return requested; + else if (jobException instanceof Throwable) + throw new RuntimeException("Unexpected exception", (Throwable)jobException); + else if (jobException instanceof NicProfile) + return (NicProfile)jobException; } throw new RuntimeException("Unexpected job execution result"); @@ -3279,7 +3378,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac long isDefault = (nic.isDefaultNic()) ? 1 : 0; // insert nic's Id into DB as resource_name UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_ASSIGN, vmVO.getAccountId(), vmVO.getDataCenterId(), vmVO.getId(), - Long.toString(nic.getId()), network.getNetworkOfferingId(), null, isDefault, VirtualMachine.class.getName(), vmVO.getUuid()); + Long.toString(nic.getId()), network.getNetworkOfferingId(), null, isDefault, VirtualMachine.class.getName(), vmVO.getUuid()); return nic; } else { s_logger.warn("Failed to plug nic to the vm " + vm + " in network " + network); @@ -3345,6 +3444,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac throw (ConcurrentOperationException)jobResult; else if (jobResult instanceof RuntimeException) throw (RuntimeException)jobResult; + else if (jobResult instanceof Throwable) + throw new RuntimeException("Unexpected exception", (Throwable)jobResult); else if (jobResult instanceof Boolean) return (Boolean)jobResult; } @@ -3376,12 +3477,12 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac // if specified nic is associated with PF/LB/Static NAT if (rulesMgr.listAssociatedRulesForGuestNic(nic).size() > 0) { throw new CloudRuntimeException("Failed to remove nic from " + vm + " in " + network + - ", nic has associated Port forwarding or Load balancer or Static NAT rules."); + ", nic has associated Port forwarding or Load balancer or Static NAT rules."); } NicProfile nicProfile = - new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), _networkModel.getNetworkRate(network.getId(), vm.getId()), - _networkModel.isSecurityGroupSupportedInNetwork(network), _networkModel.getNetworkTag(vmProfile.getVirtualMachine().getHypervisorType(), network)); + new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), _networkModel.getNetworkRate(network.getId(), vm.getId()), + _networkModel.isSecurityGroupSupportedInNetwork(network), _networkModel.getNetworkTag(vmProfile.getVirtualMachine().getHypervisorType(), network)); //1) Unplug the nic if (vm.getState() == State.Running) { @@ -3392,7 +3493,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac s_logger.debug("Nic is unplugged successfully for vm " + vm + " in network " + network); long isDefault = (nic.isDefaultNic()) ? 1 : 0; UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_REMOVE, vm.getAccountId(), vm.getDataCenterId(), vm.getId(), - Long.toString(nic.getId()), network.getNetworkOfferingId(), null, isDefault, VirtualMachine.class.getName(), vm.getUuid()); + Long.toString(nic.getId()), network.getNetworkOfferingId(), null, isDefault, VirtualMachine.class.getName(), vm.getUuid()); } else { s_logger.warn("Failed to unplug nic for the vm " + vm + " from network " + network); return false; @@ -3470,8 +3571,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac try { NicProfile nicProfile = - new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), _networkModel.getNetworkRate(network.getId(), vm.getId()), - _networkModel.isSecurityGroupSupportedInNetwork(network), _networkModel.getNetworkTag(vmProfile.getVirtualMachine().getHypervisorType(), network)); + new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), _networkModel.getNetworkRate(network.getId(), vm.getId()), + _networkModel.isSecurityGroupSupportedInNetwork(network), _networkModel.getNetworkTag(vmProfile.getVirtualMachine().getHypervisorType(), network)); //1) Unplug the nic if (vm.getState() == State.Running) { @@ -3508,7 +3609,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac @Override public void findHostAndMigrate(String vmUuid, Long newSvcOfferingId, ExcludeList excludes) throws InsufficientCapacityException, ConcurrentOperationException, - ResourceUnavailableException { + ResourceUnavailableException { VMInstanceVO vm = _vmDao.findByUuid(vmUuid); if (vm == null) { @@ -3592,6 +3693,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac throw (ResourceUnavailableException)jobResult; else if (jobResult instanceof ConcurrentOperationException) throw (ConcurrentOperationException)jobResult; + else if (jobResult instanceof RuntimeException) + throw (RuntimeException)jobResult; + else if (jobResult instanceof Throwable) + throw new RuntimeException("Unexpected exception", (Throwable)jobResult); } } } @@ -3732,8 +3837,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac s_logger.info("Migration was unsuccessful. Cleaning up: " + vm); _alertMgr.sendAlert(alertType, fromHost.getDataCenterId(), fromHost.getPodId(), - "Unable to migrate vm " + vm.getInstanceName() + " from host " + fromHost.getName() + " in zone " + dest.getDataCenter().getName() + " and pod " + - dest.getPod().getName(), "Migrate Command failed. Please check logs."); + "Unable to migrate vm " + vm.getInstanceName() + " from host " + fromHost.getName() + " in zone " + dest.getDataCenter().getName() + " and pod " + + dest.getPod().getName(), "Migrate Command failed. Please check logs."); try { _agentMgr.send(dstHostId, new Commands(cleanup(vm.getInstanceName())), null); } catch (AgentUnavailableException ae) { @@ -3753,7 +3858,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac } public boolean plugNic(Network network, NicTO nic, VirtualMachineTO vm, ReservationContext context, DeployDestination dest) throws ConcurrentOperationException, - ResourceUnavailableException, InsufficientCapacityException { + ResourceUnavailableException, InsufficientCapacityException { boolean result = true; VMInstanceVO router = _vmDao.findById(vm.getId()); @@ -3776,14 +3881,14 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac s_logger.warn("Unable to apply PlugNic, vm " + router + " is not in the right state " + router.getState()); throw new ResourceUnavailableException("Unable to apply PlugNic on the backend," + " vm " + vm + " is not in the right state", DataCenter.class, - router.getDataCenterId()); + router.getDataCenterId()); } return result; } public boolean unplugNic(Network network, NicTO nic, VirtualMachineTO vm, ReservationContext context, DeployDestination dest) throws ConcurrentOperationException, - ResourceUnavailableException { + ResourceUnavailableException { boolean result = true; VMInstanceVO router = _vmDao.findById(vm.getId()); @@ -3809,7 +3914,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac s_logger.warn("Unable to apply unplug nic, Vm " + router + " is not in the right state " + router.getState()); throw new ResourceUnavailableException("Unable to apply unplug nic on the backend," + " vm " + router + " is not in the right state", DataCenter.class, - router.getDataCenterId()); + router.getDataCenterId()); } return result; @@ -3876,8 +3981,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac Float cpuOvercommitRatio = CapacityManager.CpuOverprovisioningFactor.valueIn(hostVo.getClusterId()); long minMemory = (long)(newServiceOffering.getRamSize() / memoryOvercommitRatio); ScaleVmCommand reconfigureCmd = - new ScaleVmCommand(vm.getInstanceName(), newServiceOffering.getCpu(), (int)(newServiceOffering.getSpeed() / cpuOvercommitRatio), - newServiceOffering.getSpeed(), minMemory * 1024L * 1024L, newServiceOffering.getRamSize() * 1024L * 1024L, newServiceOffering.getLimitCpuUse()); + new ScaleVmCommand(vm.getInstanceName(), newServiceOffering.getCpu(), (int)(newServiceOffering.getSpeed() / cpuOvercommitRatio), + newServiceOffering.getSpeed(), minMemory * 1024L * 1024L, newServiceOffering.getRamSize() * 1024L * 1024L, newServiceOffering.getLimitCpuUse()); Long dstHostId = vm.getHostId(); ItWorkVO work = new ItWorkVO(UUID.randomUUID().toString(), _nodeId, State.Running, vm.getType(), vm.getId()); @@ -3927,8 +4032,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac @Override public ConfigKey[] getConfigKeys() { return new ConfigKey[] {ClusterDeltaSyncInterval, StartRetry, VmDestroyForcestop, VmOpCancelInterval, VmOpCleanupInterval, VmOpCleanupWait, - VmOpLockStateRetry, - VmOpWaitInterval, ExecuteInSequence, VmJobCheckInterval, VmJobTimeout, VmJobStateReportInterval}; + VmOpLockStateRetry, + VmOpWaitInterval, ExecuteInSequence, VmJobCheckInterval, VmJobTimeout, VmJobStateReportInterval}; } public List getStoragePoolAllocators() { @@ -3961,6 +4066,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac break; case PowerOff: + case PowerReportMissing: handlePowerOffReportWithNoPendingJobsOnVM(vm); break; @@ -3975,6 +4081,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac s_logger.warn("VM " + vmId + " no longer exists when processing VM state report"); } } else { + s_logger.info("There is pending job working on the VM. vm id: " + vmId + ", postpone power-change report by resetting power-change counters"); + // reset VM power state tracking so that we won't lost signal when VM has // been translated to _vmDao.resetVmPowerStateTracking(vmId); @@ -3983,19 +4091,23 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac private void handlePowerOnReportWithNoPendingJobsOnVM(VMInstanceVO vm) { // - // 1) handle left-over transitional VM states + // 1) handle left-over transitional VM states // 2) handle out of band VM live migration // 3) handle out of sync stationary states, marking VM from Stopped to Running with // alert messages // switch (vm.getState()) { case Starting: + s_logger.info("VM " + vm.getInstanceName() + " is at " + vm.getState() + " and we received a power-on report while there is no pending jobs on it"); + try { stateTransitTo(vm, VirtualMachine.Event.FollowAgentPowerOnReport, vm.getPowerHostId()); } catch (NoTransitionException e) { s_logger.warn("Unexpected VM state transition exception, race-condition?", e); } + s_logger.info("VM " + vm.getInstanceName() + " is sync-ed to at Running state according to power-on report from hypervisor"); + // we need to alert admin or user about this risky state transition _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SYNC, vm.getDataCenterId(), vm.getPodIdToDeployIn(), VM_SYNC_ALERT_SUBJECT, "VM " + vm.getHostName() + "(" + vm.getInstanceName() @@ -4010,10 +4122,13 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac } catch (NoTransitionException e) { s_logger.warn("Unexpected VM state transition exception, race-condition?", e); } + break; case Stopping: case Stopped: + s_logger.info("VM " + vm.getInstanceName() + " is at " + vm.getState() + " and we received a power-on report while there is no pending jobs on it"); + try { stateTransitTo(vm, VirtualMachine.Event.FollowAgentPowerOnReport, vm.getPowerHostId()); } catch (NoTransitionException e) { @@ -4022,6 +4137,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SYNC, vm.getDataCenterId(), vm.getPodIdToDeployIn(), VM_SYNC_ALERT_SUBJECT, "VM " + vm.getHostName() + "(" + vm.getInstanceName() + ") state is sync-ed (" + vm.getState() + " -> Running) from out-of-context transition. VM network environment may need to be reset"); + + s_logger.info("VM " + vm.getInstanceName() + " is sync-ed to at Running state according to power-on report from hypervisor"); break; case Destroyed: @@ -4031,11 +4148,13 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac break; case Migrating: + s_logger.info("VM " + vm.getInstanceName() + " is at " + vm.getState() + " and we received a power-on report while there is no pending jobs on it"); try { stateTransitTo(vm, VirtualMachine.Event.FollowAgentPowerOnReport, vm.getPowerHostId()); } catch (NoTransitionException e) { s_logger.warn("Unexpected VM state transition exception, race-condition?", e); } + s_logger.info("VM " + vm.getInstanceName() + " is sync-ed to at Running state according to power-on report from hypervisor"); break; case Error: @@ -4048,7 +4167,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac private void handlePowerOffReportWithNoPendingJobsOnVM(VMInstanceVO vm) { - // 1) handle left-over transitional VM states + // 1) handle left-over transitional VM states // 2) handle out of sync stationary states, schedule force-stop to release resources // switch (vm.getState()) { @@ -4057,15 +4176,22 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac case Running: case Stopped: case Migrating: + s_logger.info("VM " + vm.getInstanceName() + " is at " + vm.getState() + " and we received a power-off report while there is no pending jobs on it"); try { - stateTransitTo(vm, VirtualMachine.Event.FollowAgentPowerOffReport, vm.getPowerHostId()); + stateTransitTo(vm, VirtualMachine.Event.FollowAgentPowerOffReport, null); } catch (NoTransitionException e) { s_logger.warn("Unexpected VM state transition exception, race-condition?", e); } + _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SYNC, vm.getDataCenterId(), vm.getPodIdToDeployIn(), VM_SYNC_ALERT_SUBJECT, "VM " + vm.getHostName() + "(" + vm.getInstanceName() + ") state is sync-ed (" + vm.getState() + " -> Stopped) from out-of-context transition."); - // TODO: we need to forcely release all resource allocation + + s_logger.info("VM " + vm.getInstanceName() + " is sync-ed to at Stopped state according to power-off report from hypervisor"); + + VirtualMachineGuru vmGuru = getVmGuru(vm); + VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm); + sendStop(vmGuru, profile, true); break; case Destroyed: @@ -4091,7 +4217,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac // however, if VM is missing from the host report (it may happen in out of band changes // or from designed behave of XS/KVM), the VM may not get a chance to run the state-sync logic // - // Therefor, we will scan thoses VMs on UP host based on last update timestamp, if the host is UP + // Therefore, we will scan thoses VMs on UP host based on last update timestamp, if the host is UP // and a VM stalls for status update, we will consider them to be powered off // (which is relatively safe to do so) @@ -4293,36 +4419,40 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac public Object[] doInTransaction(TransactionStatus status) { VmWorkJobVO workJob = null; - _vmDao.lockRow(vm.getId(), true); - List pendingWorkJobs = _workJobDao.listPendingWorkJobs(VirtualMachine.Type.Instance, - vm.getId(), VmWorkStart.class.getName()); + _vmDao.lockInLockTable(String.valueOf(vm.getId()), Integer.MAX_VALUE); + try { + List pendingWorkJobs = _workJobDao.listPendingWorkJobs(VirtualMachine.Type.Instance, + vm.getId(), VmWorkStart.class.getName()); - if (pendingWorkJobs.size() > 0) { - assert (pendingWorkJobs.size() == 1); - workJob = pendingWorkJobs.get(0); - } else { - workJob = new VmWorkJobVO(context.getContextId()); + if (pendingWorkJobs.size() > 0) { + assert (pendingWorkJobs.size() == 1); + workJob = pendingWorkJobs.get(0); + } else { + workJob = new VmWorkJobVO(context.getContextId()); - workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); - workJob.setCmd(VmWorkStart.class.getName()); + workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); + workJob.setCmd(VmWorkStart.class.getName()); - workJob.setAccountId(callingAccount.getId()); - workJob.setUserId(callingUser.getId()); - workJob.setStep(VmWorkJobVO.Step.Starting); - workJob.setVmType(VirtualMachine.Type.Instance); - workJob.setVmInstanceId(vm.getId()); - workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); + workJob.setAccountId(callingAccount.getId()); + workJob.setUserId(callingUser.getId()); + workJob.setStep(VmWorkJobVO.Step.Starting); + workJob.setVmType(VirtualMachine.Type.Instance); + workJob.setVmInstanceId(vm.getId()); + workJob.setRelated(AsyncJobExecutionContext.getOriginJobId()); - // save work context info (there are some duplications) - VmWorkStart workInfo = new VmWorkStart(callingUser.getId(), callingAccount.getId(), vm.getId(), VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER); - workInfo.setPlan(planToDeploy); - workInfo.setParams(params); - workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); + // save work context info (there are some duplications) + VmWorkStart workInfo = new VmWorkStart(callingUser.getId(), callingAccount.getId(), vm.getId(), VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER); + workInfo.setPlan(planToDeploy); + workInfo.setParams(params); + workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); - _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); + _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); + } + + return new Object[] {workJob, new Long(workJob.getId())}; + } finally { + _vmDao.unlockFromLockTable(String.valueOf(vm.getId())); } - - return new Object[] {workJob, workJob.getId()}; } }); @@ -4343,37 +4473,41 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac Object[] result = Transaction.execute(new TransactionCallback() { @Override public Object[] doInTransaction(TransactionStatus status) { - _vmDao.lockRow(vm.getId(), true); + _vmDao.lockInLockTable(String.valueOf(vm.getId()), Integer.MAX_VALUE); - List pendingWorkJobs = _workJobDao.listPendingWorkJobs( - vm.getType(), vm.getId(), - VmWorkStop.class.getName()); + try { + List pendingWorkJobs = _workJobDao.listPendingWorkJobs( + vm.getType(), vm.getId(), + VmWorkStop.class.getName()); - VmWorkJobVO workJob = null; - if (pendingWorkJobs != null && pendingWorkJobs.size() > 0) { - assert (pendingWorkJobs.size() == 1); - workJob = pendingWorkJobs.get(0); - } else { - workJob = new VmWorkJobVO(context.getContextId()); + VmWorkJobVO workJob = null; + if (pendingWorkJobs != null && pendingWorkJobs.size() > 0) { + assert (pendingWorkJobs.size() == 1); + workJob = pendingWorkJobs.get(0); + } else { + workJob = new VmWorkJobVO(context.getContextId()); - workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); - workJob.setCmd(VmWorkStop.class.getName()); + workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); + workJob.setCmd(VmWorkStop.class.getName()); - workJob.setAccountId(account.getId()); - workJob.setUserId(user.getId()); - workJob.setStep(VmWorkJobVO.Step.Prepare); - workJob.setVmType(VirtualMachine.Type.Instance); - workJob.setVmInstanceId(vm.getId()); - workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); + workJob.setAccountId(account.getId()); + workJob.setUserId(user.getId()); + workJob.setStep(VmWorkJobVO.Step.Prepare); + workJob.setVmType(VirtualMachine.Type.Instance); + workJob.setVmInstanceId(vm.getId()); + workJob.setRelated(AsyncJobExecutionContext.getOriginJobId()); - // save work context info (there are some duplications) - VmWorkStop workInfo = new VmWorkStop(user.getId(), account.getId(), vm.getId(), VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER, cleanup); - workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); + // save work context info (there are some duplications) + VmWorkStop workInfo = new VmWorkStop(user.getId(), account.getId(), vm.getId(), VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER, cleanup); + workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); - _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); + _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); + } + + return new Object[] {workJob, new Long(workJob.getId())}; + } finally { + _vmDao.unlockFromLockTable(String.valueOf(vm.getId())); } - - return new Object[] {workJob, workJob.getId()}; } }); @@ -4396,37 +4530,40 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac Object[] result = Transaction.execute(new TransactionCallback() { @Override public Object[] doInTransaction(TransactionStatus status) { - _vmDao.lockRow(vm.getId(), true); + _vmDao.lockInLockTable(String.valueOf(vm.getId()), Integer.MAX_VALUE); + try { + List pendingWorkJobs = _workJobDao.listPendingWorkJobs( + VirtualMachine.Type.Instance, vm.getId(), + VmWorkReboot.class.getName()); - List pendingWorkJobs = _workJobDao.listPendingWorkJobs( - VirtualMachine.Type.Instance, vm.getId(), - VmWorkReboot.class.getName()); + VmWorkJobVO workJob = null; + if (pendingWorkJobs != null && pendingWorkJobs.size() > 0) { + assert (pendingWorkJobs.size() == 1); + workJob = pendingWorkJobs.get(0); + } else { + workJob = new VmWorkJobVO(context.getContextId()); - VmWorkJobVO workJob = null; - if (pendingWorkJobs != null && pendingWorkJobs.size() > 0) { - assert (pendingWorkJobs.size() == 1); - workJob = pendingWorkJobs.get(0); - } else { - workJob = new VmWorkJobVO(context.getContextId()); + workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); + workJob.setCmd(VmWorkReboot.class.getName()); - workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); - workJob.setCmd(VmWorkReboot.class.getName()); + workJob.setAccountId(account.getId()); + workJob.setUserId(user.getId()); + workJob.setStep(VmWorkJobVO.Step.Prepare); + workJob.setVmType(VirtualMachine.Type.Instance); + workJob.setVmInstanceId(vm.getId()); + workJob.setRelated(AsyncJobExecutionContext.getOriginJobId()); - workJob.setAccountId(account.getId()); - workJob.setUserId(user.getId()); - workJob.setStep(VmWorkJobVO.Step.Prepare); - workJob.setVmType(VirtualMachine.Type.Instance); - workJob.setVmInstanceId(vm.getId()); - workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); + // save work context info (there are some duplications) + VmWorkReboot workInfo = new VmWorkReboot(user.getId(), account.getId(), vm.getId(), VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER, params); + workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); - // save work context info (there are some duplications) - VmWorkReboot workInfo = new VmWorkReboot(user.getId(), account.getId(), vm.getId(), VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER, params); - workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); + _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); + } - _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); + return new Object[] {workJob, new Long(workJob.getId())}; + } finally { + _vmDao.unlockFromLockTable(String.valueOf(vm.getId())); } - - return new Object[] {workJob, workJob.getId()}; } }); @@ -4448,34 +4585,91 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac @Override public Object[] doInTransaction(TransactionStatus status) { - List pendingWorkJobs = _workJobDao.listPendingWorkJobs( - VirtualMachine.Type.Instance, vm.getId(), - VmWorkMigrate.class.getName()); + _vmDao.lockInLockTable(String.valueOf(vm.getId()), Integer.MAX_VALUE); + try { + List pendingWorkJobs = _workJobDao.listPendingWorkJobs( + VirtualMachine.Type.Instance, vm.getId(), + VmWorkMigrate.class.getName()); - VmWorkJobVO workJob = null; - if (pendingWorkJobs != null && pendingWorkJobs.size() > 0) { - assert (pendingWorkJobs.size() == 1); - workJob = pendingWorkJobs.get(0); - } else { + VmWorkJobVO workJob = null; + if (pendingWorkJobs != null && pendingWorkJobs.size() > 0) { + assert (pendingWorkJobs.size() == 1); + workJob = pendingWorkJobs.get(0); + } else { - workJob = new VmWorkJobVO(context.getContextId()); + workJob = new VmWorkJobVO(context.getContextId()); - workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); - workJob.setCmd(VmWorkMigrate.class.getName()); + workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); + workJob.setCmd(VmWorkMigrate.class.getName()); - workJob.setAccountId(account.getId()); - workJob.setUserId(user.getId()); - workJob.setVmType(VirtualMachine.Type.Instance); - workJob.setVmInstanceId(vm.getId()); - workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); + workJob.setAccountId(account.getId()); + workJob.setUserId(user.getId()); + workJob.setVmType(VirtualMachine.Type.Instance); + workJob.setVmInstanceId(vm.getId()); + workJob.setRelated(AsyncJobExecutionContext.getOriginJobId()); - // save work context info (there are some duplications) - VmWorkMigrate workInfo = new VmWorkMigrate(user.getId(), account.getId(), vm.getId(), VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER, srcHostId, dest); - workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); + // save work context info (there are some duplications) + VmWorkMigrate workInfo = new VmWorkMigrate(user.getId(), account.getId(), vm.getId(), VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER, srcHostId, dest); + workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); - _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); + _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); + } + return new Object[] {workJob, new Long(workJob.getId())}; + } finally { + _vmDao.unlockFromLockTable(String.valueOf(vm.getId())); + } + } + }); + + final long jobId = (Long)result[1]; + AsyncJobExecutionContext.getCurrentExecutionContext().joinJob(jobId); + + return new VmStateSyncOutcome((VmWorkJobVO)result[0], + VirtualMachine.PowerState.PowerOn, vm.getId(), vm.getPowerHostId()); + } + + public Outcome migrateVmAwayThroughJobQueue(final String vmUuid, final long srcHostId) { + final CallContext context = CallContext.current(); + final User user = context.getCallingUser(); + final Account account = context.getCallingAccount(); + + final VMInstanceVO vm = _vmDao.findByUuid(vmUuid); + + Object[] result = Transaction.execute(new TransactionCallback() { + @Override + public Object[] doInTransaction(TransactionStatus status) { + _vmDao.lockInLockTable(String.valueOf(vm.getId()), Integer.MAX_VALUE); + try { + List pendingWorkJobs = _workJobDao.listPendingWorkJobs( + VirtualMachine.Type.Instance, vm.getId(), + VmWorkMigrateAway.class.getName()); + + VmWorkJobVO workJob = null; + if (pendingWorkJobs != null && pendingWorkJobs.size() > 0) { + assert (pendingWorkJobs.size() == 1); + workJob = pendingWorkJobs.get(0); + } else { + workJob = new VmWorkJobVO(context.getContextId()); + + workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); + workJob.setCmd(VmWorkMigrateAway.class.getName()); + + workJob.setAccountId(account.getId()); + workJob.setUserId(user.getId()); + workJob.setVmType(VirtualMachine.Type.Instance); + workJob.setVmInstanceId(vm.getId()); + workJob.setRelated(AsyncJobExecutionContext.getOriginJobId()); + + // save work context info (there are some duplications) + VmWorkMigrateAway workInfo = new VmWorkMigrateAway(user.getId(), account.getId(), vm.getId(), VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER, srcHostId); + workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); + + _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); + } + return new Object[] {workJob, new Long(workJob.getId())}; + } finally { + _vmDao.unlockFromLockTable(String.valueOf(vm.getId())); } - return new Object[] {workJob, workJob.getId()}; } }); @@ -4500,37 +4694,40 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac @Override public Object[] doInTransaction(TransactionStatus status) { - _vmDao.lockRow(vm.getId(), true); + _vmDao.lockInLockTable(String.valueOf(vm.getId()), Integer.MAX_VALUE); + try { + List pendingWorkJobs = _workJobDao.listPendingWorkJobs( + VirtualMachine.Type.Instance, vm.getId(), + VmWorkMigrateWithStorage.class.getName()); - List pendingWorkJobs = _workJobDao.listPendingWorkJobs( - VirtualMachine.Type.Instance, vm.getId(), - VmWorkMigrateWithStorage.class.getName()); + VmWorkJobVO workJob = null; + if (pendingWorkJobs != null && pendingWorkJobs.size() > 0) { + assert (pendingWorkJobs.size() == 1); + workJob = pendingWorkJobs.get(0); + } else { - VmWorkJobVO workJob = null; - if (pendingWorkJobs != null && pendingWorkJobs.size() > 0) { - assert (pendingWorkJobs.size() == 1); - workJob = pendingWorkJobs.get(0); - } else { + workJob = new VmWorkJobVO(context.getContextId()); - workJob = new VmWorkJobVO(context.getContextId()); + workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); + workJob.setCmd(VmWorkMigrate.class.getName()); - workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); - workJob.setCmd(VmWorkMigrate.class.getName()); + workJob.setAccountId(account.getId()); + workJob.setUserId(user.getId()); + workJob.setVmType(VirtualMachine.Type.Instance); + workJob.setVmInstanceId(vm.getId()); + workJob.setRelated(AsyncJobExecutionContext.getOriginJobId()); - workJob.setAccountId(account.getId()); - workJob.setUserId(user.getId()); - workJob.setVmType(VirtualMachine.Type.Instance); - workJob.setVmInstanceId(vm.getId()); - workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); + // save work context info (there are some duplications) + VmWorkMigrateWithStorage workInfo = new VmWorkMigrateWithStorage(user.getId(), account.getId(), vm.getId(), + VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER, srcHostId, destHostId, volumeToPool); + workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); - // save work context info (there are some duplications) - VmWorkMigrateWithStorage workInfo = new VmWorkMigrateWithStorage(user.getId(), account.getId(), vm.getId(), - VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER, srcHostId, destHostId, volumeToPool); - workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); - - _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); + _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); + } + return new Object[] {workJob, new Long(workJob.getId())}; + } finally { + _vmDao.unlockFromLockTable(String.valueOf(vm.getId())); } - return new Object[] {workJob, workJob.getId()}; } }); @@ -4554,36 +4751,41 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac @Override public Object[] doInTransaction(TransactionStatus status) { - List pendingWorkJobs = _workJobDao.listPendingWorkJobs( - VirtualMachine.Type.Instance, vm.getId(), - VmWorkMigrateForScale.class.getName()); + _vmDao.lockInLockTable(String.valueOf(vm.getId()), Integer.MAX_VALUE); + try { + List pendingWorkJobs = _workJobDao.listPendingWorkJobs( + VirtualMachine.Type.Instance, vm.getId(), + VmWorkMigrateForScale.class.getName()); - VmWorkJobVO workJob = null; - if (pendingWorkJobs != null && pendingWorkJobs.size() > 0) { - assert (pendingWorkJobs.size() == 1); - workJob = pendingWorkJobs.get(0); - } else { + VmWorkJobVO workJob = null; + if (pendingWorkJobs != null && pendingWorkJobs.size() > 0) { + assert (pendingWorkJobs.size() == 1); + workJob = pendingWorkJobs.get(0); + } else { - workJob = new VmWorkJobVO(context.getContextId()); + workJob = new VmWorkJobVO(context.getContextId()); - workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); - workJob.setCmd(VmWorkMigrate.class.getName()); + workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); + workJob.setCmd(VmWorkMigrate.class.getName()); - workJob.setAccountId(account.getId()); - workJob.setUserId(user.getId()); - workJob.setVmType(VirtualMachine.Type.Instance); - workJob.setVmInstanceId(vm.getId()); - workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); + workJob.setAccountId(account.getId()); + workJob.setUserId(user.getId()); + workJob.setVmType(VirtualMachine.Type.Instance); + workJob.setVmInstanceId(vm.getId()); + workJob.setRelated(AsyncJobExecutionContext.getOriginJobId()); - // save work context info (there are some duplications) - VmWorkMigrateForScale workInfo = new VmWorkMigrateForScale(user.getId(), account.getId(), vm.getId(), - VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER, srcHostId, dest, newSvcOfferingId); - workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); + // save work context info (there are some duplications) + VmWorkMigrateForScale workInfo = new VmWorkMigrateForScale(user.getId(), account.getId(), vm.getId(), + VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER, srcHostId, dest, newSvcOfferingId); + workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); - _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); + _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); + } + + return new Object[] {workJob, new Long(workJob.getId())}; + } finally { + _vmDao.unlockFromLockTable(String.valueOf(vm.getId())); } - - return new Object[] {workJob, workJob.getId()}; } }); @@ -4606,36 +4808,41 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac @Override public Object[] doInTransaction(TransactionStatus status) { - List pendingWorkJobs = _workJobDao.listPendingWorkJobs( - VirtualMachine.Type.Instance, vm.getId(), - VmWorkStorageMigration.class.getName()); + _vmDao.lockInLockTable(String.valueOf(vm.getId()), Integer.MAX_VALUE); + try { + List pendingWorkJobs = _workJobDao.listPendingWorkJobs( + VirtualMachine.Type.Instance, vm.getId(), + VmWorkStorageMigration.class.getName()); - VmWorkJobVO workJob = null; - if (pendingWorkJobs != null && pendingWorkJobs.size() > 0) { - assert (pendingWorkJobs.size() == 1); - workJob = pendingWorkJobs.get(0); - } else { + VmWorkJobVO workJob = null; + if (pendingWorkJobs != null && pendingWorkJobs.size() > 0) { + assert (pendingWorkJobs.size() == 1); + workJob = pendingWorkJobs.get(0); + } else { - workJob = new VmWorkJobVO(context.getContextId()); + workJob = new VmWorkJobVO(context.getContextId()); - workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); - workJob.setCmd(VmWorkStorageMigration.class.getName()); + workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); + workJob.setCmd(VmWorkStorageMigration.class.getName()); - workJob.setAccountId(account.getId()); - workJob.setUserId(user.getId()); - workJob.setVmType(VirtualMachine.Type.Instance); - workJob.setVmInstanceId(vm.getId()); - workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); + workJob.setAccountId(account.getId()); + workJob.setUserId(user.getId()); + workJob.setVmType(VirtualMachine.Type.Instance); + workJob.setVmInstanceId(vm.getId()); + workJob.setRelated(AsyncJobExecutionContext.getOriginJobId()); - // save work context info (there are some duplications) - VmWorkStorageMigration workInfo = new VmWorkStorageMigration(user.getId(), account.getId(), vm.getId(), - VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER, destPool); - workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); + // save work context info (there are some duplications) + VmWorkStorageMigration workInfo = new VmWorkStorageMigration(user.getId(), account.getId(), vm.getId(), + VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER, destPool.getId()); + workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); - _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); + _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); + } + + return new Object[] {workJob, new Long(workJob.getId())}; + } finally { + _vmDao.unlockFromLockTable(String.valueOf(vm.getId())); } - - return new Object[] {workJob, workJob.getId()}; } }); @@ -4656,35 +4863,41 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac @Override public Object[] doInTransaction(TransactionStatus status) { - List pendingWorkJobs = _workJobDao.listPendingWorkJobs( - VirtualMachine.Type.Instance, vm.getId(), - VmWorkAddVmToNetwork.class.getName()); + _vmDao.lockInLockTable(String.valueOf(vm.getId()), Integer.MAX_VALUE); - VmWorkJobVO workJob = null; - if (pendingWorkJobs != null && pendingWorkJobs.size() > 0) { - assert (pendingWorkJobs.size() == 1); - workJob = pendingWorkJobs.get(0); - } else { + try { + List pendingWorkJobs = _workJobDao.listPendingWorkJobs( + VirtualMachine.Type.Instance, vm.getId(), + VmWorkAddVmToNetwork.class.getName()); - workJob = new VmWorkJobVO(context.getContextId()); + VmWorkJobVO workJob = null; + if (pendingWorkJobs != null && pendingWorkJobs.size() > 0) { + assert (pendingWorkJobs.size() == 1); + workJob = pendingWorkJobs.get(0); + } else { - workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); - workJob.setCmd(VmWorkAddVmToNetwork.class.getName()); + workJob = new VmWorkJobVO(context.getContextId()); - workJob.setAccountId(account.getId()); - workJob.setUserId(user.getId()); - workJob.setVmType(VirtualMachine.Type.Instance); - workJob.setVmInstanceId(vm.getId()); - workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); + workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); + workJob.setCmd(VmWorkAddVmToNetwork.class.getName()); - // save work context info (there are some duplications) - VmWorkAddVmToNetwork workInfo = new VmWorkAddVmToNetwork(user.getId(), account.getId(), vm.getId(), - VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER, network.getId(), requested); - workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); + workJob.setAccountId(account.getId()); + workJob.setUserId(user.getId()); + workJob.setVmType(VirtualMachine.Type.Instance); + workJob.setVmInstanceId(vm.getId()); + workJob.setRelated(AsyncJobExecutionContext.getOriginJobId()); - _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); + // save work context info (there are some duplications) + VmWorkAddVmToNetwork workInfo = new VmWorkAddVmToNetwork(user.getId(), account.getId(), vm.getId(), + VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER, network.getId(), requested); + workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); + + _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); + } + return new Object[] {workJob, new Long(workJob.getId())}; + } finally { + _vmDao.unlockFromLockTable(String.valueOf(vm.getId())); } - return new Object[] {workJob, workJob.getId()}; } }); @@ -4705,35 +4918,40 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac @Override public Object[] doInTransaction(TransactionStatus status) { - List pendingWorkJobs = _workJobDao.listPendingWorkJobs( - VirtualMachine.Type.Instance, vm.getId(), - VmWorkRemoveNicFromVm.class.getName()); + _vmDao.lockInLockTable(String.valueOf(vm.getId()), Integer.MAX_VALUE); + try { + List pendingWorkJobs = _workJobDao.listPendingWorkJobs( + VirtualMachine.Type.Instance, vm.getId(), + VmWorkRemoveNicFromVm.class.getName()); - VmWorkJobVO workJob = null; - if (pendingWorkJobs != null && pendingWorkJobs.size() > 0) { - assert (pendingWorkJobs.size() == 1); - workJob = pendingWorkJobs.get(0); - } else { + VmWorkJobVO workJob = null; + if (pendingWorkJobs != null && pendingWorkJobs.size() > 0) { + assert (pendingWorkJobs.size() == 1); + workJob = pendingWorkJobs.get(0); + } else { - workJob = new VmWorkJobVO(context.getContextId()); + workJob = new VmWorkJobVO(context.getContextId()); - workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); - workJob.setCmd(VmWorkRemoveNicFromVm.class.getName()); + workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); + workJob.setCmd(VmWorkRemoveNicFromVm.class.getName()); - workJob.setAccountId(account.getId()); - workJob.setUserId(user.getId()); - workJob.setVmType(VirtualMachine.Type.Instance); - workJob.setVmInstanceId(vm.getId()); - workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); + workJob.setAccountId(account.getId()); + workJob.setUserId(user.getId()); + workJob.setVmType(VirtualMachine.Type.Instance); + workJob.setVmInstanceId(vm.getId()); + workJob.setRelated(AsyncJobExecutionContext.getOriginJobId()); - // save work context info (there are some duplications) - VmWorkRemoveNicFromVm workInfo = new VmWorkRemoveNicFromVm(user.getId(), account.getId(), vm.getId(), - VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER, nic.getId()); - workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); + // save work context info (there are some duplications) + VmWorkRemoveNicFromVm workInfo = new VmWorkRemoveNicFromVm(user.getId(), account.getId(), vm.getId(), + VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER, nic.getId()); + workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); - _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); + _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); + } + return new Object[] {workJob, new Long(workJob.getId())}; + } finally { + _vmDao.unlockFromLockTable(String.valueOf(vm.getId())); } - return new Object[] {workJob, workJob.getId()}; } }); @@ -4754,35 +4972,40 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac @Override public Object[] doInTransaction(TransactionStatus status) { - List pendingWorkJobs = _workJobDao.listPendingWorkJobs( - VirtualMachine.Type.Instance, vm.getId(), - VmWorkRemoveVmFromNetwork.class.getName()); + _vmDao.lockInLockTable(String.valueOf(vm.getId()), Integer.MAX_VALUE); + try { + List pendingWorkJobs = _workJobDao.listPendingWorkJobs( + VirtualMachine.Type.Instance, vm.getId(), + VmWorkRemoveVmFromNetwork.class.getName()); - VmWorkJobVO workJob = null; - if (pendingWorkJobs != null && pendingWorkJobs.size() > 0) { - assert (pendingWorkJobs.size() == 1); - workJob = pendingWorkJobs.get(0); - } else { + VmWorkJobVO workJob = null; + if (pendingWorkJobs != null && pendingWorkJobs.size() > 0) { + assert (pendingWorkJobs.size() == 1); + workJob = pendingWorkJobs.get(0); + } else { - workJob = new VmWorkJobVO(context.getContextId()); + workJob = new VmWorkJobVO(context.getContextId()); - workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); - workJob.setCmd(VmWorkRemoveVmFromNetwork.class.getName()); + workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); + workJob.setCmd(VmWorkRemoveVmFromNetwork.class.getName()); - workJob.setAccountId(account.getId()); - workJob.setUserId(user.getId()); - workJob.setVmType(VirtualMachine.Type.Instance); - workJob.setVmInstanceId(vm.getId()); - workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); + workJob.setAccountId(account.getId()); + workJob.setUserId(user.getId()); + workJob.setVmType(VirtualMachine.Type.Instance); + workJob.setVmInstanceId(vm.getId()); + workJob.setRelated(AsyncJobExecutionContext.getOriginJobId()); - // save work context info (there are some duplications) - VmWorkRemoveVmFromNetwork workInfo = new VmWorkRemoveVmFromNetwork(user.getId(), account.getId(), vm.getId(), - VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER, network, broadcastUri); - workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); + // save work context info (there are some duplications) + VmWorkRemoveVmFromNetwork workInfo = new VmWorkRemoveVmFromNetwork(user.getId(), account.getId(), vm.getId(), + VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER, network, broadcastUri); + workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); - _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); + _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); + } + return new Object[] {workJob, new Long(workJob.getId())}; + } finally { + _vmDao.unlockFromLockTable(String.valueOf(vm.getId())); } - return new Object[] {workJob, workJob.getId()}; } }); @@ -4805,35 +5028,40 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac @Override public Object[] doInTransaction(TransactionStatus status) { - List pendingWorkJobs = _workJobDao.listPendingWorkJobs( - VirtualMachine.Type.Instance, vm.getId(), - VmWorkReconfigure.class.getName()); + _vmDao.lockInLockTable(String.valueOf(vm.getId()), Integer.MAX_VALUE); + try { + List pendingWorkJobs = _workJobDao.listPendingWorkJobs( + VirtualMachine.Type.Instance, vm.getId(), + VmWorkReconfigure.class.getName()); - VmWorkJobVO workJob = null; - if (pendingWorkJobs != null && pendingWorkJobs.size() > 0) { - assert (pendingWorkJobs.size() == 1); - workJob = pendingWorkJobs.get(0); - } else { + VmWorkJobVO workJob = null; + if (pendingWorkJobs != null && pendingWorkJobs.size() > 0) { + assert (pendingWorkJobs.size() == 1); + workJob = pendingWorkJobs.get(0); + } else { - workJob = new VmWorkJobVO(context.getContextId()); + workJob = new VmWorkJobVO(context.getContextId()); - workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); - workJob.setCmd(VmWorkReconfigure.class.getName()); + workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); + workJob.setCmd(VmWorkReconfigure.class.getName()); - workJob.setAccountId(account.getId()); - workJob.setUserId(user.getId()); - workJob.setVmType(VirtualMachine.Type.Instance); - workJob.setVmInstanceId(vm.getId()); - workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); + workJob.setAccountId(account.getId()); + workJob.setUserId(user.getId()); + workJob.setVmType(VirtualMachine.Type.Instance); + workJob.setVmInstanceId(vm.getId()); + workJob.setRelated(AsyncJobExecutionContext.getOriginJobId()); - // save work context info (there are some duplications) - VmWorkReconfigure workInfo = new VmWorkReconfigure(user.getId(), account.getId(), vm.getId(), - VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER, newServiceOffering.getId(), reconfiguringOnExistingHost); - workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); + // save work context info (there are some duplications) + VmWorkReconfigure workInfo = new VmWorkReconfigure(user.getId(), account.getId(), vm.getId(), + VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER, newServiceOffering.getId(), reconfiguringOnExistingHost); + workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); - _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); + _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); + } + return new Object[] {workJob, new Long(workJob.getId())}; + } finally { + _vmDao.unlockFromLockTable(String.valueOf(vm.getId())); } - return new Object[] {workJob, workJob.getId()}; } }); @@ -4876,6 +5104,23 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac return new Pair(JobInfo.Status.SUCCEEDED, null); } + private Pair orchestrateMigrateAway(VmWorkMigrateAway work) throws Exception { + VMInstanceVO vm = _entityMgr.findById(VMInstanceVO.class, work.getVmId()); + if (vm == null) { + s_logger.info("Unable to find vm " + work.getVmId()); + } + assert (vm != null); + + try { + orchestrateMigrateAway(vm.getUuid(), work.getSrcHostId(), null); + } catch (InsufficientServerCapacityException e) { + s_logger.warn("Failed to deploy vm " + vm.getId() + " with original planner, sending HAPlanner"); + orchestrateMigrateAway(vm.getUuid(), work.getSrcHostId(), _haMgr.getHAPlanner()); + } + + return new Pair(JobInfo.Status.SUCCEEDED, null); + } + private Pair orchestrateMigrateWithStorage(VmWorkMigrateWithStorage work) throws Exception { VMInstanceVO vm = _entityMgr.findById(VMInstanceVO.class, work.getVmId()); if (vm == null) { @@ -4923,7 +5168,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac NicProfile nic = orchestrateAddVmToNetwork(vm, network, work.getRequestedNicProfile()); - return new Pair(JobInfo.Status.SUCCEEDED, _jobMgr.marshallResultObject(nic.getId())); + return new Pair(JobInfo.Status.SUCCEEDED, _jobMgr.marshallResultObject(nic)); } private Pair orchestrateRemoveNicFromVm(VmWorkRemoveNicFromVm work) throws Exception { @@ -4970,7 +5215,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac s_logger.info("Unable to find vm " + work.getVmId()); } assert (vm != null); - orchestrateStorageMigration(vm.getUuid(), work.getDestStoragePool()); + StoragePool pool = (PrimaryDataStoreInfo)dataStoreMgr.getPrimaryDataStore(work.getDestStoragePoolId()); + orchestrateStorageMigration(vm.getUuid(), pool); + return new Pair(JobInfo.Status.SUCCEEDED, null); } diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java index 453890c4279..633295884bc 100644 --- a/engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java +++ b/engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java @@ -17,6 +17,7 @@ package com.cloud.vm; import java.util.HashMap; +import java.util.List; import java.util.Map; import javax.inject.Inject; @@ -65,6 +66,9 @@ public class VirtualMachinePowerStateSyncImpl implements VirtualMachinePowerStat private void processReport(long hostId, Map translatedInfo) { + if (s_logger.isDebugEnabled()) + s_logger.debug("Process VM state report. host: " + hostId + ", number of records in report: " + translatedInfo.size()); + for (Map.Entry entry : translatedInfo.entrySet()) { if (s_logger.isDebugEnabled()) @@ -80,6 +84,33 @@ public class VirtualMachinePowerStateSyncImpl implements VirtualMachinePowerStat s_logger.debug("VM power state does not change, skip DB writing. vm id: " + entry.getKey()); } } + + // for all running/stopping VMs, we provide monitoring of missing report + List vmsThatAreMissingReport = _instanceDao.findByHostInStates(hostId, VirtualMachine.State.Running, + VirtualMachine.State.Stopping, VirtualMachine.State.Starting); + java.util.Iterator it = vmsThatAreMissingReport.iterator(); + while (it.hasNext()) { + VMInstanceVO instance = it.next(); + if (translatedInfo.get(instance.getId()) != null) + it.remove(); + } + + if (vmsThatAreMissingReport.size() > 0) { + for (VMInstanceVO instance : vmsThatAreMissingReport) { + if (_instanceDao.updatePowerState(instance.getId(), hostId, VirtualMachine.PowerState.PowerReportMissing)) { + if (s_logger.isDebugEnabled()) + s_logger.debug("VM state report is updated. host: " + hostId + ", vm id: " + instance.getId() + ", power state: PowerReportMissing "); + + _messageBus.publish(null, VirtualMachineManager.Topics.VM_POWER_STATE, PublishScope.GLOBAL, instance.getId()); + } else { + if (s_logger.isDebugEnabled()) + s_logger.debug("VM power state does not change, skip DB writing. vm id: " + instance.getId()); + } + } + } + + if (s_logger.isDebugEnabled()) + s_logger.debug("Done with process of VM state report. host: " + hostId); } @Override diff --git a/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java b/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java index 31b2d9ca2d2..f3020021840 100644 --- a/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java +++ b/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java @@ -96,10 +96,14 @@ public class VmWorkJobDispatcher extends AdapterBase implements AsyncJobDispatch return; } - CallContext.register(work.getUserId(), work.getAccountId(), job.getRelated()); + CallContext.register(work.getUserId(), work.getAccountId()); - Pair result = handler.handleVmWorkJob(work); - _asyncJobMgr.completeAsyncJob(job.getId(), result.first(), 0, result.second()); + try { + Pair result = handler.handleVmWorkJob(work); + _asyncJobMgr.completeAsyncJob(job.getId(), result.first(), 0, result.second()); + } finally { + CallContext.unregister(); + } } finally { if (s_logger.isDebugEnabled()) s_logger.debug("Done with run of VM work job: " + cmd + " for VM " + work.getVmId() + ", job origin: " + job.getRelated()); @@ -109,8 +113,6 @@ public class VmWorkJobDispatcher extends AdapterBase implements AsyncJobDispatch RuntimeException ex = new RuntimeException("Job failed due to exception " + e.getMessage()); _asyncJobMgr.completeAsyncJob(job.getId(), JobInfo.Status.FAILED, 0, _asyncJobMgr.marshallResultObject(ex)); - } finally { - CallContext.unregister(); } } } diff --git a/engine/orchestration/src/com/cloud/vm/VmWorkMigrateAway.java b/engine/orchestration/src/com/cloud/vm/VmWorkMigrateAway.java new file mode 100644 index 00000000000..92189edca4d --- /dev/null +++ b/engine/orchestration/src/com/cloud/vm/VmWorkMigrateAway.java @@ -0,0 +1,36 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package com.cloud.vm; + +public class VmWorkMigrateAway extends VmWork { + + private static final long serialVersionUID = -5917512239025814373L; + + private long srcHostId; + + public VmWorkMigrateAway(long userId, long accountId, long vmId, String handlerName, + long srcHostId) { + super(userId, accountId, vmId, handlerName); + + this.srcHostId = srcHostId; + } + + public long getSrcHostId() { + return srcHostId; + } +} diff --git a/engine/orchestration/src/com/cloud/vm/VmWorkStorageMigration.java b/engine/orchestration/src/com/cloud/vm/VmWorkStorageMigration.java index 2b2f8e841ed..1d7d55ec171 100644 --- a/engine/orchestration/src/com/cloud/vm/VmWorkStorageMigration.java +++ b/engine/orchestration/src/com/cloud/vm/VmWorkStorageMigration.java @@ -16,20 +16,18 @@ // under the License. package com.cloud.vm; -import com.cloud.storage.StoragePool; - public class VmWorkStorageMigration extends VmWork { private static final long serialVersionUID = -8677979691741157474L; - StoragePool destPool; + Long destPoolId; - public VmWorkStorageMigration(long userId, long accountId, long vmId, String handlerName, StoragePool destPool) { + public VmWorkStorageMigration(long userId, long accountId, long vmId, String handlerName, Long destPoolId) { super(userId, accountId, vmId, handlerName); - this.destPool = destPool; + this.destPoolId = destPoolId; } - public StoragePool getDestStoragePool() { - return destPool; + public Long getDestStoragePoolId() { + return destPoolId; } } diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/CloudOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/CloudOrchestrator.java index f55f58ce542..b00b5ad7499 100755 --- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/CloudOrchestrator.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/CloudOrchestrator.java @@ -20,14 +20,13 @@ package org.apache.cloudstack.engine.orchestration; import java.net.URL; import java.util.ArrayList; +import java.util.Arrays; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import javax.inject.Inject; -import org.springframework.stereotype.Component; - import org.apache.cloudstack.engine.cloud.entity.api.NetworkEntity; import org.apache.cloudstack.engine.cloud.entity.api.TemplateEntity; import org.apache.cloudstack.engine.cloud.entity.api.VMEntityManager; @@ -36,6 +35,7 @@ import org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntityImpl; import org.apache.cloudstack.engine.cloud.entity.api.VolumeEntity; import org.apache.cloudstack.engine.orchestration.service.VolumeOrchestrationService; import org.apache.cloudstack.engine.service.api.OrchestrationService; +import org.springframework.stereotype.Component; import com.cloud.deploy.DeploymentPlan; import com.cloud.exception.InsufficientCapacityException; @@ -157,11 +157,11 @@ public class CloudOrchestrator implements OrchestrationService { // VirtualMachineEntityImpl vmEntity = new VirtualMachineEntityImpl(id, owner, hostName, displayName, cpu, speed, memory, computeTags, rootDiskTags, networks, // vmEntityManager); - LinkedHashMap networkIpMap = new LinkedHashMap(); + LinkedHashMap> networkIpMap = new LinkedHashMap>(); for (String uuid : networkNicMap.keySet()) { NetworkVO network = _networkDao.findByUuid(uuid); - if (network != null) { - networkIpMap.put(network, networkNicMap.get(uuid)); + if(network != null){ + networkIpMap.put(network, new ArrayList(Arrays.asList(networkNicMap.get(uuid)))); } } @@ -241,11 +241,11 @@ public class CloudOrchestrator implements OrchestrationService { rootDiskOffering.first(diskOffering); rootDiskOffering.second(size); - LinkedHashMap networkIpMap = new LinkedHashMap(); + LinkedHashMap> networkIpMap = new LinkedHashMap>(); for (String uuid : networkNicMap.keySet()) { NetworkVO network = _networkDao.findByUuid(uuid); - if (network != null) { - networkIpMap.put(network, networkNicMap.get(uuid)); + if(network != null){ + networkIpMap.put(network, new ArrayList(Arrays.asList(networkNicMap.get(uuid)))); } } diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java index 00059837b31..6e55bd2881c 100755 --- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java @@ -699,24 +699,40 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra @Override @DB - public void allocate(final VirtualMachineProfile vm, final LinkedHashMap networks) throws InsufficientCapacityException, + public void allocate(final VirtualMachineProfile vm, final LinkedHashMap> networks) throws InsufficientCapacityException, ConcurrentOperationException { Transaction.execute(new TransactionCallbackWithExceptionNoReturn() { @Override public void doInTransactionWithoutResult(TransactionStatus status) throws InsufficientCapacityException { int deviceId = 0; + int size = 0; + for (Network ntwk : networks.keySet()) { + List profiles = networks.get(ntwk); + if (profiles != null && !profiles.isEmpty()) { + size = size + profiles.size(); + } else { + size = size + 1; + } + } - boolean[] deviceIds = new boolean[networks.size()]; + boolean[] deviceIds = new boolean[size]; Arrays.fill(deviceIds, false); - List nics = new ArrayList(networks.size()); + List nics = new ArrayList(size); NicProfile defaultNic = null; - for (Map.Entry network : networks.entrySet()) { + for (Map.Entry> network : networks.entrySet()) { Network config = network.getKey(); - NicProfile requested = network.getValue(); + List requestedProfiles = network.getValue(); + if (requestedProfiles == null) { + requestedProfiles = new ArrayList(); + } + if (requestedProfiles.isEmpty()) { + requestedProfiles.add(null); + } + for (NicProfile requested : requestedProfiles) { Boolean isDefaultNic = false; if (vm != null && (requested != null && requested.isDefaultNic())) { isDefaultNic = true; @@ -754,12 +770,11 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra nics.add(vmNic); vm.addNic(vmNic); - } - - if (nics.size() != networks.size()) { - s_logger.warn("Number of nics " + nics.size() + " doesn't match number of requested networks " + networks.size()); - throw new CloudRuntimeException("Number of nics " + nics.size() + " doesn't match number of requested networks " + networks.size()); + } + if (nics.size() != size) { + s_logger.warn("Number of nics " + nics.size() + " doesn't match number of requested nics " + size); + throw new CloudRuntimeException("Number of nics " + nics.size() + " doesn't match number of requested networks " + size); } if (nics.size() == 1) { @@ -782,14 +797,14 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra requested.setMode(network.getMode()); } NicProfile profile = guru.allocate(network, requested, vm); - if (isDefaultNic != null) { - profile.setDefaultNic(isDefaultNic); - } - if (profile == null) { return null; } + if (isDefaultNic != null) { + profile.setDefaultNic(isDefaultNic); + } + if (requested != null && requested.getMode() == null) { profile.setMode(requested.getMode()); } else { @@ -1010,11 +1025,6 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra } } - @Override - public boolean equals(Object o) { - return super.equals(o); //To change body of overridden methods use File | Settings | File Templates. - } - @Override public void implementNetworkElementsAndResources(DeployDestination dest, ReservationContext context, Network network, NetworkOffering offering) throws ConcurrentOperationException, InsufficientAddressCapacityException, ResourceUnavailableException, InsufficientCapacityException { @@ -1552,16 +1562,19 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra } } + if (vm.getType() == Type.User + && _networkModel.areServicesSupportedInNetwork(network.getId(), Service.Dhcp) + && network.getTrafficType() == TrafficType.Guest + && network.getGuestType() == GuestType.Shared + && isLastNicInSubnet(nic)) { // remove the dhcpservice ip if this is the last nic in subnet. DhcpServiceProvider dhcpServiceProvider = getDhcpServiceProvider(network); if (dhcpServiceProvider != null - && vm.getType() == Type.User - && isDhcpAccrossMultipleSubnetsSupported(dhcpServiceProvider) - && isLastNicInSubnet(nic) - && network.getTrafficType() == TrafficType.Guest - && network.getGuestType() == GuestType.Shared) { + && isDhcpAccrossMultipleSubnetsSupported(dhcpServiceProvider)) { removeDhcpServiceInSubnet(nic); } + } + NetworkGuru guru = AdapterBase.getAdapterByName(networkGurus, network.getGuruName()); guru.deallocate(network, profile, vm); _nicDao.remove(nic.getId()); @@ -2450,7 +2463,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra NetworkElement element = _networkModel.getElementImplementingProvider(DhcpProvider); if ( element instanceof DhcpServiceProvider ) { - return (DhcpServiceProvider)_networkModel.getElementImplementingProvider(DhcpProvider); + return (DhcpServiceProvider)element; } else { return null; } @@ -2498,8 +2511,8 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra if (dc.getNetworkType() == NetworkType.Basic) { List nics = _nicDao.listByVmId(vmInstance.getId()); NetworkVO network = _networksDao.findById(nics.get(0).getNetworkId()); - final LinkedHashMap profiles = new LinkedHashMap(); - profiles.put(network, null); + final LinkedHashMap> profiles = new LinkedHashMap>(); + profiles.put(network, new ArrayList()); Transaction.execute(new TransactionCallbackWithExceptionNoReturn() { @Override diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java index d51ed191b9d..d3eda8a3721 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java @@ -693,11 +693,14 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati vol = copyVolume(rootDiskPool, volume, vm, rootDiskTmplt, dcVO, pod, diskVO, svo, rootDiskHyperType); if (vol != null) { // Moving of Volume is successful, decrement the volume resource count from secondary for an account and increment it into primary storage under same account. - _resourceLimitMgr.decrementResourceCount(volume.getAccountId(), ResourceType.secondary_storage, new Long(volume.getSize())); - _resourceLimitMgr.incrementResourceCount(volume.getAccountId(), ResourceType.primary_storage, new Long(volume.getSize())); + _resourceLimitMgr.decrementResourceCount(volume.getAccountId(), ResourceType.secondary_storage, volume.getSize()); + _resourceLimitMgr.incrementResourceCount(volume.getAccountId(), ResourceType.primary_storage, volume.getSize()); } } + if (vol == null) { + throw new CloudRuntimeException("Volume shouldn't be null " + volume.getId()); + } VolumeVO volVO = _volsDao.findById(vol.getId()); volVO.setFormat(getSupportedImageFormatForCluster(rootDiskHyperType)); _volsDao.update(volVO.getId(), volVO); @@ -943,10 +946,12 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati vm.addDisk(disk); } - if (vm.getType() == VirtualMachine.Type.User && vm.getTemplate().getFormat() == ImageFormat.ISO) { - DataTO dataTO = tmplFactory.getTemplate(vm.getTemplate().getId(), DataStoreRole.Image, vm.getVirtualMachine().getDataCenterId()).getTO(); - DiskTO iso = new DiskTO(dataTO, 3L, null, Volume.Type.ISO); - vm.addDisk(iso); + //if (vm.getType() == VirtualMachine.Type.User && vm.getTemplate().getFormat() == ImageFormat.ISO) { + if (vm.getType() == VirtualMachine.Type.User) { + _tmpltMgr.prepareIsoForVmProfile(vm); + //DataTO dataTO = tmplFactory.getTemplate(vm.getTemplate().getId(), DataStoreRole.Image, vm.getVirtualMachine().getDataCenterId()).getTO(); + //DiskTO iso = new DiskTO(dataTO, 3L, null, Volume.Type.ISO); + //vm.addDisk(iso); } } diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/service/api/ProvisioningServiceImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/service/api/ProvisioningServiceImpl.java index 86eab58ff0b..51e87663919 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/service/api/ProvisioningServiceImpl.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/service/api/ProvisioningServiceImpl.java @@ -25,9 +25,6 @@ import java.util.Map; import javax.inject.Inject; import javax.ws.rs.Path; -import org.springframework.stereotype.Component; -import org.springframework.stereotype.Service; - import org.apache.cloudstack.engine.datacenter.entity.api.ClusterEntity; import org.apache.cloudstack.engine.datacenter.entity.api.ClusterEntityImpl; import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceManager; @@ -38,6 +35,8 @@ import org.apache.cloudstack.engine.datacenter.entity.api.PodEntityImpl; import org.apache.cloudstack.engine.datacenter.entity.api.StorageEntity; import org.apache.cloudstack.engine.datacenter.entity.api.ZoneEntity; import org.apache.cloudstack.engine.datacenter.entity.api.ZoneEntityImpl; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; import com.cloud.host.Host; import com.cloud.host.Status; @@ -52,13 +51,13 @@ public class ProvisioningServiceImpl implements ProvisioningService { DataCenterResourceManager manager; @Override - public StorageEntity registerStorage(String name, List tags, Map details) { + public StorageEntity registerStorage(final String name, final List tags, final Map details) { // TODO Auto-generated method stub return null; } @Override - public ZoneEntity registerZone(String zoneUuid, String name, String owner, List tags, Map details) { + public ZoneEntity registerZone(final String zoneUuid, final String name, final String owner, final List tags, final Map details) { ZoneEntityImpl zoneEntity = new ZoneEntityImpl(zoneUuid, manager); zoneEntity.setName(name); zoneEntity.setOwner(owner); @@ -68,7 +67,7 @@ public class ProvisioningServiceImpl implements ProvisioningService { } @Override - public PodEntity registerPod(String podUuid, String name, String owner, String zoneUuid, List tags, Map details) { + public PodEntity registerPod(final String podUuid, final String name, final String owner, final String zoneUuid, final List tags, final Map details) { PodEntityImpl podEntity = new PodEntityImpl(podUuid, manager); podEntity.setOwner(owner); podEntity.setName(name); @@ -77,7 +76,7 @@ public class ProvisioningServiceImpl implements ProvisioningService { } @Override - public ClusterEntity registerCluster(String clusterUuid, String name, String owner, List tags, Map details) { + public ClusterEntity registerCluster(final String clusterUuid, final String name, final String owner, final List tags, final Map details) { ClusterEntityImpl clusterEntity = new ClusterEntityImpl(clusterUuid, manager); clusterEntity.setOwner(owner); clusterEntity.setName(name); @@ -86,7 +85,7 @@ public class ProvisioningServiceImpl implements ProvisioningService { } @Override - public HostEntity registerHost(String hostUuid, String name, String owner, List tags, Map details) { + public HostEntity registerHost(final String hostUuid, final String name, final String owner, final List tags, final Map details) { HostEntityImpl hostEntity = new HostEntityImpl(hostUuid, manager); hostEntity.setOwner(owner); hostEntity.setName(name); @@ -97,38 +96,38 @@ public class ProvisioningServiceImpl implements ProvisioningService { } @Override - public void deregisterStorage(String uuid) { + public void deregisterStorage(final String uuid) { // TODO Auto-generated method stub } @Override - public void deregisterZone(String uuid) { + public void deregisterZone(final String uuid) { ZoneEntityImpl zoneEntity = new ZoneEntityImpl(uuid, manager); zoneEntity.disable(); } @Override - public void deregisterPod(String uuid) { + public void deregisterPod(final String uuid) { PodEntityImpl podEntity = new PodEntityImpl(uuid, manager); podEntity.disable(); } @Override - public void deregisterCluster(String uuid) { + public void deregisterCluster(final String uuid) { ClusterEntityImpl clusterEntity = new ClusterEntityImpl(uuid, manager); clusterEntity.disable(); } @Override - public void deregisterHost(String uuid) { + public void deregisterHost(final String uuid) { HostEntityImpl hostEntity = new HostEntityImpl(uuid, manager); hostEntity.disable(); } @Override - public void changeState(String type, String entity, Status state) { + public void changeState(final String type, final String entity, final Status state) { // TODO Auto-generated method stub } @@ -141,7 +140,10 @@ public class ProvisioningServiceImpl implements ProvisioningService { @Override public List listPods() { - List pods = new ArrayList(); + /* + * Not in use now, just commented out. + */ + //List pods = new ArrayList(); //pods.add(new PodEntityImpl("pod-uuid-1", "pod1")); //pods.add(new PodEntityImpl("pod-uuid-2", "pod2")); return null; @@ -162,7 +164,7 @@ public class ProvisioningServiceImpl implements ProvisioningService { } @Override - public ZoneEntity getZone(String uuid) { + public ZoneEntity getZone(final String uuid) { ZoneEntityImpl impl = new ZoneEntityImpl(uuid, manager); return impl; } diff --git a/engine/orchestration/test/com/cloud/agent/manager/ConnectedAgentAttacheTest.java b/engine/orchestration/test/com/cloud/agent/manager/ConnectedAgentAttacheTest.java new file mode 100644 index 00000000000..e0e97c51049 --- /dev/null +++ b/engine/orchestration/test/com/cloud/agent/manager/ConnectedAgentAttacheTest.java @@ -0,0 +1,82 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.agent.manager; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; + +import org.junit.Test; + +import com.cloud.utils.nio.Link; + +public class ConnectedAgentAttacheTest { + + @Test + public void testEquals() throws Exception { + + Link link = mock(Link.class); + + ConnectedAgentAttache agentAttache1 = new ConnectedAgentAttache(null, 0, null, link, false); + ConnectedAgentAttache agentAttache2 = new ConnectedAgentAttache(null, 0, null, link, false); + + assertTrue(agentAttache1.equals(agentAttache2)); + } + + @Test + public void testEqualsFalseNull() throws Exception { + + Link link = mock(Link.class); + + ConnectedAgentAttache agentAttache1 = new ConnectedAgentAttache(null, 0, null, link, false); + + assertFalse(agentAttache1.equals(null)); + } + + @Test + public void testEqualsFalseDiffLink() throws Exception { + + Link link1 = mock(Link.class); + Link link2 = mock(Link.class); + + ConnectedAgentAttache agentAttache1 = new ConnectedAgentAttache(null, 0, null, link1, false); + ConnectedAgentAttache agentAttache2 = new ConnectedAgentAttache(null, 0, null, link2, false); + + assertFalse(agentAttache1.equals(agentAttache2)); + } + + @Test + public void testEqualsFalseDiffId() throws Exception { + + Link link1 = mock(Link.class); + + ConnectedAgentAttache agentAttache1 = new ConnectedAgentAttache(null, 1, null, link1, false); + ConnectedAgentAttache agentAttache2 = new ConnectedAgentAttache(null, 2, null, link1, false); + + assertFalse(agentAttache1.equals(agentAttache2)); + } + + @Test + public void testEqualsFalseDiffClass() throws Exception { + + Link link1 = mock(Link.class); + + ConnectedAgentAttache agentAttache1 = new ConnectedAgentAttache(null, 1, null, link1, false); + + assertFalse(agentAttache1.equals("abc")); + } +} \ No newline at end of file diff --git a/engine/orchestration/test/com/cloud/vm/VirtualMachineManagerImplTest.java b/engine/orchestration/test/com/cloud/vm/VirtualMachineManagerImplTest.java index 997855d2b24..49b2fc5fb11 100644 --- a/engine/orchestration/test/com/cloud/vm/VirtualMachineManagerImplTest.java +++ b/engine/orchestration/test/com/cloud/vm/VirtualMachineManagerImplTest.java @@ -30,6 +30,8 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import junit.framework.Assert; + import org.junit.Before; import org.junit.Test; import org.mockito.Matchers; @@ -46,9 +48,9 @@ import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; import com.cloud.agent.AgentManager; -import com.cloud.agent.api.Answer; import com.cloud.agent.api.CheckVirtualMachineAnswer; import com.cloud.agent.api.CheckVirtualMachineCommand; +import com.cloud.agent.api.Command; import com.cloud.agent.api.MigrateWithStorageAnswer; import com.cloud.agent.api.MigrateWithStorageCommand; import com.cloud.agent.api.MigrateWithStorageCompleteAnswer; @@ -61,6 +63,8 @@ import com.cloud.agent.api.PrepareForMigrationAnswer; import com.cloud.agent.api.PrepareForMigrationCommand; import com.cloud.agent.api.ScaleVmAnswer; import com.cloud.agent.api.ScaleVmCommand; +import com.cloud.agent.api.StopAnswer; +import com.cloud.agent.api.StopCommand; import com.cloud.capacity.CapacityManager; import com.cloud.dc.dao.ClusterDao; import com.cloud.dc.dao.DataCenterDao; @@ -257,9 +261,7 @@ public class VirtualMachineManagerImplTest { @Test(expected = CloudRuntimeException.class) public void testScaleVM2() throws Exception { - DeployDestination dest = new DeployDestination(null, null, null, _host); - long l = 1L; - + new DeployDestination(null, null, null, _host); doReturn(3L).when(_vmInstance).getId(); when(_vmInstanceDao.findById(anyLong())).thenReturn(_vmInstance); ServiceOfferingVO newServiceOffering = getSvcoffering(512); @@ -269,9 +271,9 @@ public class VirtualMachineManagerImplTest { doReturn(1L).when(hostVO).getClusterId(); when(CapacityManager.CpuOverprovisioningFactor.valueIn(1L)).thenReturn(1.0f); ScaleVmCommand reconfigureCmd = - new ScaleVmCommand("myVmName", newServiceOffering.getCpu(), newServiceOffering.getSpeed(), newServiceOffering.getSpeed(), newServiceOffering.getRamSize(), - newServiceOffering.getRamSize(), newServiceOffering.getLimitCpuUse()); - Answer answer = new ScaleVmAnswer(reconfigureCmd, true, "details"); + new ScaleVmCommand("myVmName", newServiceOffering.getCpu(), newServiceOffering.getSpeed(), newServiceOffering.getSpeed(), newServiceOffering.getRamSize(), + newServiceOffering.getRamSize(), newServiceOffering.getLimitCpuUse()); + new ScaleVmAnswer(reconfigureCmd, true, "details"); when(_agentMgr.send(2l, reconfigureCmd)).thenReturn(null); _vmMgr.reConfigureVm(_vmInstance.getUuid(), getSvcoffering(256), false); @@ -298,7 +300,6 @@ public class VirtualMachineManagerImplTest { private ServiceOfferingVO getSvcoffering(int ramSize) { - long id = 4L; String name = "name"; String displayText = "displayText"; int cpu = 1; @@ -309,7 +310,7 @@ public class VirtualMachineManagerImplTest { boolean useLocalStorage = false; ServiceOfferingVO serviceOffering = - new ServiceOfferingVO(name, cpu, ramSize, speed, null, null, ha, displayText, useLocalStorage, false, null, false, null, false); + new ServiceOfferingVO(name, cpu, ramSize, speed, null, null, ha, displayText, useLocalStorage, false, null, false, null, false); return serviceOffering; } @@ -408,7 +409,7 @@ public class VirtualMachineManagerImplTest { // Check migration of a vm with its volumes within a cluster. @Test public void testMigrateWithVolumeWithinCluster() throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, - VirtualMachineMigrationException, OperationTimedoutException { + VirtualMachineMigrationException, OperationTimedoutException { initializeMockConfigForMigratingVmWithVolumes(); when(_srcHostMock.getClusterId()).thenReturn(3L); @@ -420,7 +421,7 @@ public class VirtualMachineManagerImplTest { // Check migration of a vm with its volumes across a cluster. @Test public void testMigrateWithVolumeAcrossCluster() throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, - VirtualMachineMigrationException, OperationTimedoutException { + VirtualMachineMigrationException, OperationTimedoutException { initializeMockConfigForMigratingVmWithVolumes(); when(_srcHostMock.getClusterId()).thenReturn(3L); @@ -433,7 +434,7 @@ public class VirtualMachineManagerImplTest { // other is local. @Test(expected = CloudRuntimeException.class) public void testMigrateWithVolumeFail1() throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, - VirtualMachineMigrationException, OperationTimedoutException { + VirtualMachineMigrationException, OperationTimedoutException { initializeMockConfigForMigratingVmWithVolumes(); when(_srcHostMock.getClusterId()).thenReturn(3L); @@ -448,7 +449,7 @@ public class VirtualMachineManagerImplTest { // Check migration of a vm fails when vm is not in Running state. @Test(expected = ConcurrentOperationException.class) public void testMigrateWithVolumeFail2() throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, - VirtualMachineMigrationException, OperationTimedoutException { + VirtualMachineMigrationException, OperationTimedoutException { initializeMockConfigForMigratingVmWithVolumes(); when(_srcHostMock.getClusterId()).thenReturn(3L); @@ -458,4 +459,48 @@ public class VirtualMachineManagerImplTest { _vmMgr.migrateWithStorage(_vmInstance.getUuid(), _srcHostMock.getId(), _destHostMock.getId(), _volumeToPoolMock); } + + @Test + public void testSendStopWithOkAnswer() throws Exception { + VirtualMachineGuru guru = mock(VirtualMachineGuru.class); + VirtualMachine vm = mock(VirtualMachine.class); + VirtualMachineProfile profile = mock(VirtualMachineProfile.class); + StopAnswer answer = new StopAnswer(new StopCommand(vm, false), "ok", true); + when(profile.getVirtualMachine()).thenReturn(vm); + when(vm.getHostId()).thenReturn(1L); + when(_agentMgr.send(anyLong(), (Command)any())).thenReturn(answer); + + boolean actual = _vmMgr.sendStop(guru, profile, false); + + Assert.assertTrue(actual); + } + + @Test + public void testSendStopWithFailAnswer() throws Exception { + VirtualMachineGuru guru = mock(VirtualMachineGuru.class); + VirtualMachine vm = mock(VirtualMachine.class); + VirtualMachineProfile profile = mock(VirtualMachineProfile.class); + StopAnswer answer = new StopAnswer(new StopCommand(vm, false), "fail", false); + when(profile.getVirtualMachine()).thenReturn(vm); + when(vm.getHostId()).thenReturn(1L); + when(_agentMgr.send(anyLong(), (Command)any())).thenReturn(answer); + + boolean actual = _vmMgr.sendStop(guru, profile, false); + + Assert.assertFalse(actual); + } + + @Test + public void testSendStopWithNullAnswer() throws Exception { + VirtualMachineGuru guru = mock(VirtualMachineGuru.class); + VirtualMachine vm = mock(VirtualMachine.class); + VirtualMachineProfile profile = mock(VirtualMachineProfile.class); + when(profile.getVirtualMachine()).thenReturn(vm); + when(vm.getHostId()).thenReturn(1L); + when(_agentMgr.send(anyLong(), (Command)any())).thenReturn(null); + + boolean actual = _vmMgr.sendStop(guru, profile, false); + + Assert.assertFalse(actual); + } } diff --git a/engine/orchestration/test/org/apache/cloudstack/engine/orchestration/NetworkOrchestratorTest.java b/engine/orchestration/test/org/apache/cloudstack/engine/orchestration/NetworkOrchestratorTest.java new file mode 100755 index 00000000000..04233df5dbb --- /dev/null +++ b/engine/orchestration/test/org/apache/cloudstack/engine/orchestration/NetworkOrchestratorTest.java @@ -0,0 +1,164 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.engine.orchestration; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.when; + +import java.util.HashMap; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; + +import junit.framework.TestCase; + +import org.apache.log4j.Logger; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Matchers; + +import com.cloud.network.Network; + +import com.cloud.network.NetworkModel; +import com.cloud.network.Network.GuestType; +import com.cloud.network.Network.Service; +import com.cloud.network.Networks.TrafficType; +import com.cloud.network.dao.NetworkDao; +import com.cloud.network.dao.NetworkServiceMapDao; +import com.cloud.network.dao.NetworkVO; +import com.cloud.network.element.DhcpServiceProvider; +import com.cloud.network.guru.NetworkGuru; + +import com.cloud.vm.Nic; +import com.cloud.vm.NicVO; +import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachineProfile; +import com.cloud.vm.VirtualMachine.Type; +import com.cloud.vm.dao.NicDao; +import com.cloud.vm.dao.NicIpAliasDao; +import com.cloud.vm.dao.NicSecondaryIpDao; + +/** + * NetworkManagerImpl implements NetworkManager. + */ +public class NetworkOrchestratorTest extends TestCase { + static final Logger s_logger = Logger.getLogger(NetworkOrchestratorTest.class); + + NetworkOrchestrator testOrchastrator = new NetworkOrchestrator(); + + String guruName = "GuestNetworkGuru"; + String dhcpProvider = "VirtualRouter"; + NetworkGuru guru = mock(NetworkGuru.class); + + @Override + @Before + public void setUp() { + // make class-scope mocks + testOrchastrator._nicDao = mock(NicDao.class); + testOrchastrator._networksDao = mock(NetworkDao.class); + testOrchastrator._networkModel = mock(NetworkModel.class); + testOrchastrator._nicSecondaryIpDao = mock(NicSecondaryIpDao.class); + testOrchastrator._ntwkSrvcDao = mock(NetworkServiceMapDao.class); + testOrchastrator._nicIpAliasDao = mock(NicIpAliasDao.class); + DhcpServiceProvider provider = mock(DhcpServiceProvider.class); + + Map capabilities = new HashMap(); + Map> services = new HashMap>(); + services.put(Network.Service.Dhcp,capabilities); + when(provider.getCapabilities()).thenReturn(services); + capabilities.put(Network.Capability.DhcpAccrossMultipleSubnets, "true"); + + when(testOrchastrator._ntwkSrvcDao.getProviderForServiceInNetwork(Matchers.anyLong(), Matchers.eq(Service.Dhcp))).thenReturn(dhcpProvider); + when(testOrchastrator._networkModel.getElementImplementingProvider(dhcpProvider)).thenReturn(provider); + + when(guru.getName()).thenReturn(guruName); + List networkGurus = new ArrayList(); + networkGurus.add(guru); + testOrchastrator.networkGurus = networkGurus; + } + + @Test + public void testRemoveDhcpServiceWithNic() { + // make local mocks + VirtualMachineProfile vm = mock(VirtualMachineProfile.class); + NicVO nic = mock(NicVO.class); + NetworkVO network = mock(NetworkVO.class); + + // make sure that release dhcp will be called + when(vm.getType()).thenReturn(Type.User); + when(testOrchastrator._networkModel.areServicesSupportedInNetwork(network.getId(), Service.Dhcp)).thenReturn(true); + when(network.getTrafficType()).thenReturn(TrafficType.Guest); + when(network.getGuestType()).thenReturn(GuestType.Shared); + when(testOrchastrator._nicDao.listByNetworkIdTypeAndGatewayAndBroadcastUri(nic.getNetworkId(), VirtualMachine.Type.User, nic.getGateway(), nic.getBroadcastUri())).thenReturn(new ArrayList()); + + + + when(network.getGuruName()).thenReturn(guruName); + when(testOrchastrator._networksDao.findById(nic.getNetworkId())).thenReturn(network); + + testOrchastrator.removeNic(vm, nic); + + verify(nic, times(1)).setState(Nic.State.Deallocating); + verify(testOrchastrator._networkModel, times(2)).getElementImplementingProvider(dhcpProvider); + verify(testOrchastrator._ntwkSrvcDao, times(2)).getProviderForServiceInNetwork(network.getId(), Service.Dhcp); + verify(testOrchastrator._networksDao, times(2)).findById(nic.getNetworkId()); + } + @Test + public void testDontRemoveDhcpServiceFromDomainRouter() { + // make local mocks + VirtualMachineProfile vm = mock(VirtualMachineProfile.class); + NicVO nic = mock(NicVO.class); + NetworkVO network = mock(NetworkVO.class); + + // make sure that release dhcp won't be called + when(vm.getType()).thenReturn(Type.DomainRouter); + + when(network.getGuruName()).thenReturn(guruName); + when(testOrchastrator._networksDao.findById(nic.getNetworkId())).thenReturn(network); + + testOrchastrator.removeNic(vm, nic); + + verify(nic, times(1)).setState(Nic.State.Deallocating); + verify(testOrchastrator._networkModel, never()).getElementImplementingProvider(dhcpProvider); + verify(testOrchastrator._ntwkSrvcDao, never()).getProviderForServiceInNetwork(network.getId(), Service.Dhcp); + verify(testOrchastrator._networksDao, times(1)).findById(nic.getNetworkId()); + } + @Test + public void testDontRemoveDhcpServiceWhenNotProvided() { + // make local mocks + VirtualMachineProfile vm = mock(VirtualMachineProfile.class); + NicVO nic = mock(NicVO.class); + NetworkVO network = mock(NetworkVO.class); + + // make sure that release dhcp will *not* be called + when(vm.getType()).thenReturn(Type.User); + when(testOrchastrator._networkModel.areServicesSupportedInNetwork(network.getId(), Service.Dhcp)).thenReturn(false); + + when(network.getGuruName()).thenReturn(guruName); + when(testOrchastrator._networksDao.findById(nic.getNetworkId())).thenReturn(network); + + testOrchastrator.removeNic(vm, nic); + + verify(nic, times(1)).setState(Nic.State.Deallocating); + verify(testOrchastrator._networkModel, never()).getElementImplementingProvider(dhcpProvider); + verify(testOrchastrator._ntwkSrvcDao, never()).getProviderForServiceInNetwork(network.getId(), Service.Dhcp); + verify(testOrchastrator._networksDao, times(1)).findById(nic.getNetworkId()); + } +} diff --git a/engine/pom.xml b/engine/pom.xml index f95007cae83..5f1b95b9116 100644 --- a/engine/pom.xml +++ b/engine/pom.xml @@ -29,6 +29,19 @@ install + + + org.apache.maven.plugins + maven-checkstyle-plugin + + + cloudstack-checkstyle + none + false + + + + api diff --git a/engine/schema/src/com/cloud/dc/DataCenterDetailVO.java b/engine/schema/src/com/cloud/dc/DataCenterDetailVO.java index e9bf611d63f..5e08fac58ee 100644 --- a/engine/schema/src/com/cloud/dc/DataCenterDetailVO.java +++ b/engine/schema/src/com/cloud/dc/DataCenterDetailVO.java @@ -43,15 +43,16 @@ public class DataCenterDetailVO implements ResourceDetail { private String value; @Column(name = "display") - private boolean display; + private boolean display = true; protected DataCenterDetailVO() { } - public DataCenterDetailVO(long dcId, String name, String value) { + public DataCenterDetailVO(long dcId, String name, String value, boolean display) { this.resourceId = dcId; this.name = name; this.value = value; + this.display = display; } @Override diff --git a/engine/schema/src/com/cloud/dc/dao/DataCenterDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/DataCenterDaoImpl.java index a355a9ca99f..ea5039fea80 100755 --- a/engine/schema/src/com/cloud/dc/dao/DataCenterDaoImpl.java +++ b/engine/schema/src/com/cloud/dc/dao/DataCenterDaoImpl.java @@ -375,7 +375,7 @@ public class DataCenterDaoImpl extends GenericDaoBase implem List resourceDetails = new ArrayList(); for (String key : details.keySet()) { - resourceDetails.add(new DataCenterDetailVO(zone.getId(), key, details.get(key))); + resourceDetails.add(new DataCenterDetailVO(zone.getId(), key, details.get(key), true)); } _detailsDao.saveDetails(resourceDetails); diff --git a/engine/schema/src/com/cloud/dc/dao/DataCenterDetailsDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/DataCenterDetailsDaoImpl.java index 86959889f46..f3b9efe4851 100644 --- a/engine/schema/src/com/cloud/dc/dao/DataCenterDetailsDaoImpl.java +++ b/engine/schema/src/com/cloud/dc/dao/DataCenterDetailsDaoImpl.java @@ -41,8 +41,8 @@ public class DataCenterDetailsDaoImpl extends ResourceDetailsDaoBase implemen address.setVpcId(null); address.setSystem(false); address.setVmIp(null); + address.setDisplay(true); update(ipAddressId, address); } diff --git a/engine/schema/src/com/cloud/network/dao/IPAddressVO.java b/engine/schema/src/com/cloud/network/dao/IPAddressVO.java index d3fca876d94..d06b8c51d7b 100644 --- a/engine/schema/src/com/cloud/network/dao/IPAddressVO.java +++ b/engine/schema/src/com/cloud/network/dao/IPAddressVO.java @@ -116,6 +116,9 @@ public class IPAddressVO implements IpAddress { @Column(name = "is_portable") private boolean portable = false; + @Column(name = "display", updatable = true, nullable = false) + protected boolean display = true; + protected IPAddressVO() { uuid = UUID.randomUUID().toString(); } @@ -337,6 +340,15 @@ public class IPAddressVO implements IpAddress { return sourceNetworkId; } + @Override + public boolean isDisplay() { + return display; + } + + public void setDisplay(boolean display) { + this.display = display; + } + @Override public IAMEntityType getEntityType() { return IAMEntityType.IpAddress; diff --git a/engine/schema/src/com/cloud/network/dao/MonitoringServiceVO.java b/engine/schema/src/com/cloud/network/dao/MonitoringServiceVO.java index f1db7f41734..999fdfc649b 100644 --- a/engine/schema/src/com/cloud/network/dao/MonitoringServiceVO.java +++ b/engine/schema/src/com/cloud/network/dao/MonitoringServiceVO.java @@ -123,5 +123,4 @@ public class MonitoringServiceVO implements MonitoringService { public IAMEntityType getEntityType() { return IAMEntityType.MonitorService; } - } diff --git a/engine/schema/src/com/cloud/network/dao/NetworkDetailVO.java b/engine/schema/src/com/cloud/network/dao/NetworkDetailVO.java index 5228e33c37a..e6cad17210d 100644 --- a/engine/schema/src/com/cloud/network/dao/NetworkDetailVO.java +++ b/engine/schema/src/com/cloud/network/dao/NetworkDetailVO.java @@ -43,15 +43,16 @@ public class NetworkDetailVO implements ResourceDetail { private String value; @Column(name = "display") - private boolean display; + private boolean display = true; public NetworkDetailVO() { } - public NetworkDetailVO(long networkId, String name, String value) { + public NetworkDetailVO(long networkId, String name, String value, boolean display) { this.resourceId = networkId; this.name = name; this.value = value; + this.display = display; } @Override diff --git a/engine/schema/src/com/cloud/network/dao/NetworkDetailsDaoImpl.java b/engine/schema/src/com/cloud/network/dao/NetworkDetailsDaoImpl.java index c4fb4811661..0874a3b22d0 100644 --- a/engine/schema/src/com/cloud/network/dao/NetworkDetailsDaoImpl.java +++ b/engine/schema/src/com/cloud/network/dao/NetworkDetailsDaoImpl.java @@ -27,8 +27,8 @@ import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase; public class NetworkDetailsDaoImpl extends ResourceDetailsDaoBase implements NetworkDetailsDao { @Override - public void addDetail(long resourceId, String key, String value) { - super.addDetail(new NetworkDetailVO(resourceId, key, value)); + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new NetworkDetailVO(resourceId, key, value, display)); } } diff --git a/engine/schema/src/com/cloud/network/dao/NetworkVO.java b/engine/schema/src/com/cloud/network/dao/NetworkVO.java index c97a522c340..13e8dbff09e 100644 --- a/engine/schema/src/com/cloud/network/dao/NetworkVO.java +++ b/engine/schema/src/com/cloud/network/dao/NetworkVO.java @@ -29,8 +29,8 @@ import javax.persistence.Table; import javax.persistence.TableGenerator; import javax.persistence.Transient; -import org.apache.cloudstack.acl.IAMEntityType; import org.apache.cloudstack.acl.ControlledEntity; +import org.apache.cloudstack.acl.IAMEntityType; import com.cloud.network.Network; import com.cloud.network.Networks.BroadcastDomainType; diff --git a/engine/schema/src/com/cloud/network/dao/RemoteAccessVpnVO.java b/engine/schema/src/com/cloud/network/dao/RemoteAccessVpnVO.java index c882d5d7840..8f95f184c40 100644 --- a/engine/schema/src/com/cloud/network/dao/RemoteAccessVpnVO.java +++ b/engine/schema/src/com/cloud/network/dao/RemoteAccessVpnVO.java @@ -67,6 +67,9 @@ public class RemoteAccessVpnVO implements RemoteAccessVpn { @Column(name = "vpc_id") private Long vpcId; + @Column(name = "display", updatable = true, nullable = false) + protected boolean display = true; + public RemoteAccessVpnVO() { uuid = UUID.randomUUID().toString(); } @@ -155,6 +158,15 @@ public class RemoteAccessVpnVO implements RemoteAccessVpn { this.uuid = uuid; } + public void setDisplay(boolean display) { + this.display = display; + } + + @Override + public boolean isDisplay() { + return display; + } + @Override public IAMEntityType getEntityType() { return IAMEntityType.RemoteAccessVpn; diff --git a/engine/schema/src/com/cloud/network/dao/Site2SiteVpnConnectionVO.java b/engine/schema/src/com/cloud/network/dao/Site2SiteVpnConnectionVO.java index 19309c3a5cc..f0074c04dc1 100644 --- a/engine/schema/src/com/cloud/network/dao/Site2SiteVpnConnectionVO.java +++ b/engine/schema/src/com/cloud/network/dao/Site2SiteVpnConnectionVO.java @@ -71,6 +71,9 @@ public class Site2SiteVpnConnectionVO implements Site2SiteVpnConnection, Interna @Column(name = "passive") private boolean passive; + @Column(name = "display", updatable = true, nullable = false) + protected boolean display = true; + public Site2SiteVpnConnectionVO() { } @@ -162,6 +165,15 @@ public class Site2SiteVpnConnectionVO implements Site2SiteVpnConnection, Interna this.uuid = uuid; } + public void setDisplay(boolean display) { + this.display = display; + } + + @Override + public boolean isDisplay() { + return display; + } + @Override public IAMEntityType getEntityType() { return IAMEntityType.Site2SiteVpnConnection; diff --git a/engine/schema/src/com/cloud/network/dao/Site2SiteVpnGatewayVO.java b/engine/schema/src/com/cloud/network/dao/Site2SiteVpnGatewayVO.java index 842912e0bad..33236b9d682 100644 --- a/engine/schema/src/com/cloud/network/dao/Site2SiteVpnGatewayVO.java +++ b/engine/schema/src/com/cloud/network/dao/Site2SiteVpnGatewayVO.java @@ -58,6 +58,9 @@ public class Site2SiteVpnGatewayVO implements Site2SiteVpnGateway { @Column(name = GenericDao.REMOVED_COLUMN) private Date removed; + @Column(name = "display", updatable = true, nullable = false) + protected boolean display = true; + public Site2SiteVpnGatewayVO() { } @@ -120,6 +123,15 @@ public class Site2SiteVpnGatewayVO implements Site2SiteVpnGateway { this.uuid = uuid; } + public void setDisplay(boolean display) { + this.display = display; + } + + @Override + public boolean isDisplay() { + return display; + } + @Override public IAMEntityType getEntityType() { return IAMEntityType.Site2SiteVpnGateway; diff --git a/engine/schema/src/com/cloud/network/rules/FirewallRuleVO.java b/engine/schema/src/com/cloud/network/rules/FirewallRuleVO.java index 7d0ca792e82..5e22dd4f4e2 100644 --- a/engine/schema/src/com/cloud/network/rules/FirewallRuleVO.java +++ b/engine/schema/src/com/cloud/network/rules/FirewallRuleVO.java @@ -103,6 +103,9 @@ public class FirewallRuleVO implements FirewallRule { @Enumerated(value = EnumType.STRING) TrafficType trafficType; + @Column(name = "display", updatable = true, nullable = false) + protected boolean display = true; + // This is a delayed load value. If the value is null, // then this field has not been loaded yet. // Call firewallrules dao to load it. @@ -190,7 +193,7 @@ public class FirewallRuleVO implements FirewallRule { } protected FirewallRuleVO() { - this.uuid = UUID.randomUUID().toString(); + uuid = UUID.randomUUID().toString(); } public FirewallRuleVO(String xId, Long ipAddressId, Integer portStart, Integer portEnd, String protocol, long networkId, long accountId, long domainId, @@ -201,13 +204,13 @@ public class FirewallRuleVO implements FirewallRule { } this.accountId = accountId; this.domainId = domainId; - this.sourceIpAddressId = ipAddressId; - this.sourcePortStart = portStart; - this.sourcePortEnd = portEnd; + sourceIpAddressId = ipAddressId; + sourcePortStart = portStart; + sourcePortEnd = portEnd; this.protocol = protocol; this.purpose = purpose; this.networkId = networkId; - this.state = State.Staged; + state = State.Staged; this.icmpCode = icmpCode; this.icmpType = icmpType; this.sourceCidrs = sourceCidrs; @@ -217,8 +220,8 @@ public class FirewallRuleVO implements FirewallRule { } this.related = related; - this.uuid = UUID.randomUUID().toString(); - this.type = FirewallRuleType.User; + uuid = UUID.randomUUID().toString(); + type = FirewallRuleType.User; this.trafficType = trafficType; } @@ -255,7 +258,7 @@ public class FirewallRuleVO implements FirewallRule { @Override public String getUuid() { - return this.uuid; + return uuid; } public void setUuid(String uuid) { @@ -271,6 +274,16 @@ public class FirewallRuleVO implements FirewallRule { return trafficType; } + + public void setDisplay(boolean display) { + this.display = display; + } + + @Override + public boolean isDisplay() { + return display; + } + @Override public IAMEntityType getEntityType() { return IAMEntityType.FirewallRule; diff --git a/engine/schema/src/com/cloud/network/vpc/NetworkACLItemVO.java b/engine/schema/src/com/cloud/network/vpc/NetworkACLItemVO.java index 7cd094634c2..24ec1b9f71b 100644 --- a/engine/schema/src/com/cloud/network/vpc/NetworkACLItemVO.java +++ b/engine/schema/src/com/cloud/network/vpc/NetworkACLItemVO.java @@ -84,6 +84,9 @@ public class NetworkACLItemVO implements NetworkACLItem { @Enumerated(value = EnumType.STRING) Action action; + @Column(name = "display", updatable = true, nullable = false) + protected boolean display = true; + public NetworkACLItemVO() { this.uuid = UUID.randomUUID().toString(); } @@ -245,4 +248,13 @@ public class NetworkACLItemVO implements NetworkACLItem { public void setUuid(String uuid) { this.uuid = uuid; } + + public void setDisplay(boolean display) { + this.display = display; + } + + @Override + public boolean isDisplay() { + return display; + } } diff --git a/engine/schema/src/com/cloud/network/vpc/NetworkACLVO.java b/engine/schema/src/com/cloud/network/vpc/NetworkACLVO.java index a0b77c7f990..b6ed5cbd2cb 100644 --- a/engine/schema/src/com/cloud/network/vpc/NetworkACLVO.java +++ b/engine/schema/src/com/cloud/network/vpc/NetworkACLVO.java @@ -47,6 +47,9 @@ public class NetworkACLVO implements NetworkACL { @Column(name = "description") private String description; + @Column(name = "display", updatable = true, nullable = false) + protected boolean display = true; + public NetworkACLVO() { } @@ -85,4 +88,13 @@ public class NetworkACLVO implements NetworkACL { public void setUuid(String uuid) { this.uuid = uuid; } + + public void setDisplay(boolean display) { + this.display = display; + } + + @Override + public boolean isDisplay() { + return display; + } } diff --git a/engine/schema/src/com/cloud/network/vpc/VpcGatewayVO.java b/engine/schema/src/com/cloud/network/vpc/VpcGatewayVO.java index 723ec3b9b8d..48238b19719 100644 --- a/engine/schema/src/com/cloud/network/vpc/VpcGatewayVO.java +++ b/engine/schema/src/com/cloud/network/vpc/VpcGatewayVO.java @@ -92,7 +92,7 @@ public class VpcGatewayVO implements VpcGateway { long networkACLId; protected VpcGatewayVO() { - this.uuid = UUID.randomUUID().toString(); + uuid = UUID.randomUUID().toString(); } /** @@ -119,10 +119,10 @@ public class VpcGatewayVO implements VpcGateway { this.broadcastUri = broadcastUri; this.gateway = gateway; this.netmask = netmask; - this.uuid = UUID.randomUUID().toString(); + uuid = UUID.randomUUID().toString(); this.accountId = accountId; this.domainId = domainId; - this.state = State.Creating; + state = State.Creating; this.sourceNat = sourceNat; this.networkACLId = networkACLId; @@ -130,7 +130,7 @@ public class VpcGatewayVO implements VpcGateway { @Override public String getUuid() { - return this.uuid; + return uuid; } @Override @@ -206,7 +206,7 @@ public class VpcGatewayVO implements VpcGateway { @Override public boolean getSourceNat() { - return this.sourceNat; + return sourceNat; } public void setNetworkACLId(long networkACLId) { diff --git a/engine/schema/src/com/cloud/network/vpc/VpcVO.java b/engine/schema/src/com/cloud/network/vpc/VpcVO.java index edd984a5152..39bea77e99e 100644 --- a/engine/schema/src/com/cloud/network/vpc/VpcVO.java +++ b/engine/schema/src/com/cloud/network/vpc/VpcVO.java @@ -78,6 +78,9 @@ public class VpcVO implements Vpc { @Column(name = "restart_required") boolean restartRequired = false; + @Column(name = "display", updatable = true, nullable = false) + protected boolean display = true; + public VpcVO() { uuid = UUID.randomUUID().toString(); } @@ -185,6 +188,16 @@ public class VpcVO implements Vpc { this.uuid = uuid; } + + public void setDisplay(boolean display) { + this.display = display; + } + + @Override + public boolean isDisplay() { + return display; + } + @Override public IAMEntityType getEntityType() { return IAMEntityType.Vpc; diff --git a/engine/schema/src/com/cloud/service/ServiceOfferingDetailsVO.java b/engine/schema/src/com/cloud/service/ServiceOfferingDetailsVO.java index a707955dbcd..ed8090b3bc7 100644 --- a/engine/schema/src/com/cloud/service/ServiceOfferingDetailsVO.java +++ b/engine/schema/src/com/cloud/service/ServiceOfferingDetailsVO.java @@ -43,15 +43,16 @@ public class ServiceOfferingDetailsVO implements ResourceDetail { private String value; @Column(name = "display") - boolean display; + private boolean display = true; protected ServiceOfferingDetailsVO() { } - public ServiceOfferingDetailsVO(long serviceOfferingId, String name, String value) { + public ServiceOfferingDetailsVO(long serviceOfferingId, String name, String value, boolean display) { this.resourceId = serviceOfferingId; this.name = name; this.value = value; + this.display = display; } @Override diff --git a/engine/schema/src/com/cloud/service/dao/ServiceOfferingDaoImpl.java b/engine/schema/src/com/cloud/service/dao/ServiceOfferingDaoImpl.java index 1905d9e41f6..a3ff45ca3ad 100644 --- a/engine/schema/src/com/cloud/service/dao/ServiceOfferingDaoImpl.java +++ b/engine/schema/src/com/cloud/service/dao/ServiceOfferingDaoImpl.java @@ -182,7 +182,7 @@ public class ServiceOfferingDaoImpl extends GenericDaoBase resourceDetails = new ArrayList(); for (String key : details.keySet()) { - resourceDetails.add(new ServiceOfferingDetailsVO(serviceOffering.getId(), key, details.get(key))); + resourceDetails.add(new ServiceOfferingDetailsVO(serviceOffering.getId(), key, details.get(key), true)); } detailsDao.saveDetails(resourceDetails); diff --git a/engine/schema/src/com/cloud/service/dao/ServiceOfferingDetailsDaoImpl.java b/engine/schema/src/com/cloud/service/dao/ServiceOfferingDetailsDaoImpl.java index 59c5e33f955..6e504bce13b 100644 --- a/engine/schema/src/com/cloud/service/dao/ServiceOfferingDetailsDaoImpl.java +++ b/engine/schema/src/com/cloud/service/dao/ServiceOfferingDetailsDaoImpl.java @@ -29,8 +29,8 @@ import com.cloud.service.ServiceOfferingDetailsVO; public class ServiceOfferingDetailsDaoImpl extends ResourceDetailsDaoBase implements ServiceOfferingDetailsDao { @Override - public void addDetail(long resourceId, String key, String value) { - super.addDetail(new ServiceOfferingDetailsVO(resourceId, key, value)); + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new ServiceOfferingDetailsVO(resourceId, key, value, display)); } } diff --git a/engine/schema/src/com/cloud/storage/VMTemplateDetailVO.java b/engine/schema/src/com/cloud/storage/VMTemplateDetailVO.java index 5689e7db5e7..f988abab399 100644 --- a/engine/schema/src/com/cloud/storage/VMTemplateDetailVO.java +++ b/engine/schema/src/com/cloud/storage/VMTemplateDetailVO.java @@ -43,15 +43,16 @@ public class VMTemplateDetailVO implements ResourceDetail { private String value; @Column(name = "display") - private boolean display; + private boolean display = true; public VMTemplateDetailVO() { } - public VMTemplateDetailVO(long templateId, String name, String value) { + public VMTemplateDetailVO(long templateId, String name, String value, boolean display) { this.resourceId = templateId; this.name = name; this.value = value; + this.display = display; } @Override diff --git a/engine/schema/src/com/cloud/storage/VMTemplateVO.java b/engine/schema/src/com/cloud/storage/VMTemplateVO.java index 65017303209..d9d437b6e81 100755 --- a/engine/schema/src/com/cloud/storage/VMTemplateVO.java +++ b/engine/schema/src/com/cloud/storage/VMTemplateVO.java @@ -638,5 +638,4 @@ public class VMTemplateVO implements VirtualMachineTemplate { public IAMEntityType getEntityType() { return IAMEntityType.VirtualMachineTemplate; } - } diff --git a/engine/schema/src/com/cloud/storage/VolumeDetailVO.java b/engine/schema/src/com/cloud/storage/VolumeDetailVO.java index 598a3505b2b..6723f0b8bc1 100644 --- a/engine/schema/src/com/cloud/storage/VolumeDetailVO.java +++ b/engine/schema/src/com/cloud/storage/VolumeDetailVO.java @@ -43,15 +43,16 @@ public class VolumeDetailVO implements ResourceDetail { private String value; @Column(name = "display") - private boolean display; + private boolean display = true; public VolumeDetailVO() { } - public VolumeDetailVO(long volumeId, String name, String value) { + public VolumeDetailVO(long volumeId, String name, String value, boolean display) { this.resourceId = volumeId; this.name = name; this.value = value; + this.display = display; } @Override diff --git a/engine/schema/src/com/cloud/storage/VolumeVO.java b/engine/schema/src/com/cloud/storage/VolumeVO.java index af80af849a7..af99a16ffa8 100755 --- a/engine/schema/src/com/cloud/storage/VolumeVO.java +++ b/engine/schema/src/com/cloud/storage/VolumeVO.java @@ -549,6 +549,7 @@ public class VolumeVO implements Volume { _iScsiName = iScsiName; } + @Override public boolean isDisplayVolume() { return displayVolume; } @@ -589,11 +590,6 @@ public class VolumeVO implements Volume { this.state = state; } - @Override - public IAMEntityType getEntityType() { - return IAMEntityType.Volume; - } - public void setHypervisorSnapshotReserve(Integer hypervisorSnapshotReserve) { this.hypervisorSnapshotReserve = hypervisorSnapshotReserve; } @@ -603,4 +599,9 @@ public class VolumeVO implements Volume { return hypervisorSnapshotReserve; } + + @Override + public IAMEntityType getEntityType() { + return IAMEntityType.Volume; + } } diff --git a/engine/schema/src/com/cloud/storage/dao/SnapshotDetailsDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/SnapshotDetailsDaoImpl.java index f8d3813d64d..e4ae22cd021 100644 --- a/engine/schema/src/com/cloud/storage/dao/SnapshotDetailsDaoImpl.java +++ b/engine/schema/src/com/cloud/storage/dao/SnapshotDetailsDaoImpl.java @@ -22,7 +22,7 @@ import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase; public class SnapshotDetailsDaoImpl extends ResourceDetailsDaoBase implements SnapshotDetailsDao { @Override - public void addDetail(long resourceId, String key, String value) { - super.addDetail(new SnapshotDetailsVO(resourceId, key, value)); + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new SnapshotDetailsVO(resourceId, key, value, display)); } } diff --git a/engine/schema/src/com/cloud/storage/dao/SnapshotDetailsVO.java b/engine/schema/src/com/cloud/storage/dao/SnapshotDetailsVO.java index 35a724435e7..f217501a302 100644 --- a/engine/schema/src/com/cloud/storage/dao/SnapshotDetailsVO.java +++ b/engine/schema/src/com/cloud/storage/dao/SnapshotDetailsVO.java @@ -44,14 +44,17 @@ public class SnapshotDetailsVO implements ResourceDetail { @Column(name = "value") String value; - public SnapshotDetailsVO() { + @Column(name = "display") + private boolean display = true; + public SnapshotDetailsVO() { } - public SnapshotDetailsVO(Long resourceId, String name, String value) { + public SnapshotDetailsVO(Long resourceId, String name, String value, boolean display) { this.resourceId = resourceId; this.name = name; this.value = value; + this.display = display; } @Override @@ -71,7 +74,7 @@ public class SnapshotDetailsVO implements ResourceDetail { @Override public boolean isDisplay() { - return false; + return display; } @Override diff --git a/engine/schema/src/com/cloud/storage/dao/StoragePoolDetailsDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/StoragePoolDetailsDaoImpl.java index 9d1214342f5..de7141ffb06 100644 --- a/engine/schema/src/com/cloud/storage/dao/StoragePoolDetailsDaoImpl.java +++ b/engine/schema/src/com/cloud/storage/dao/StoragePoolDetailsDaoImpl.java @@ -43,7 +43,7 @@ public class StoragePoolDetailsDaoImpl extends ResourceDetailsDaoBase implem } List details = new ArrayList(); for (String key : detailsStr.keySet()) { - VMTemplateDetailVO detail = new VMTemplateDetailVO(tmpl.getId(), key, detailsStr.get(key)); + VMTemplateDetailVO detail = new VMTemplateDetailVO(tmpl.getId(), key, detailsStr.get(key), true); details.add(detail); } @@ -752,7 +751,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase implem if (tmplt.getDetails() != null) { List details = new ArrayList(); for (String key : tmplt.getDetails().keySet()) { - details.add(new VMTemplateDetailVO(tmplt.getId(), key, tmplt.getDetails().get(key))); + details.add(new VMTemplateDetailVO(tmplt.getId(), key, tmplt.getDetails().get(key), true)); } _templateDetailsDao.saveDetails(details); } diff --git a/engine/schema/src/com/cloud/storage/dao/VMTemplateDetailsDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/VMTemplateDetailsDaoImpl.java index c1619be8661..456cdc66433 100644 --- a/engine/schema/src/com/cloud/storage/dao/VMTemplateDetailsDaoImpl.java +++ b/engine/schema/src/com/cloud/storage/dao/VMTemplateDetailsDaoImpl.java @@ -29,7 +29,7 @@ import com.cloud.storage.VMTemplateDetailVO; public class VMTemplateDetailsDaoImpl extends ResourceDetailsDaoBase implements VMTemplateDetailsDao { @Override - public void addDetail(long resourceId, String key, String value) { - super.addDetail(new VMTemplateDetailVO(resourceId, key, value)); + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new VMTemplateDetailVO(resourceId, key, value, display)); } } diff --git a/engine/schema/src/com/cloud/storage/dao/VolumeDao.java b/engine/schema/src/com/cloud/storage/dao/VolumeDao.java index 8dc0328a5ea..da0a5de2d17 100755 --- a/engine/schema/src/com/cloud/storage/dao/VolumeDao.java +++ b/engine/schema/src/com/cloud/storage/dao/VolumeDao.java @@ -105,4 +105,12 @@ public interface VolumeDao extends GenericDao, StateDao implements Vol return result; } + @Override + @DB + public boolean updateUuid(long srcVolId, long destVolId) { + TransactionLegacy txn = TransactionLegacy.currentTxn(); + txn.start(); + try { + VolumeVO srcVol = findById(srcVolId); + VolumeVO destVol = findById(destVolId); + String uuid = srcVol.getUuid(); + srcVol.setUuid(null); + destVol.setUuid(uuid); + update(srcVolId, srcVol); + update(destVolId, destVol); + } catch (Exception e) { + throw new CloudRuntimeException("Unable to persist the sequence number for this host"); + } + txn.commit(); + return true; + } + @Override public ScopeType getVolumeStoragePoolScope(long volumeId) { // finding the storage scope where the volume is present diff --git a/engine/schema/src/com/cloud/storage/dao/VolumeDetailsDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/VolumeDetailsDaoImpl.java index d045b9b4b29..15c020dacb5 100644 --- a/engine/schema/src/com/cloud/storage/dao/VolumeDetailsDaoImpl.java +++ b/engine/schema/src/com/cloud/storage/dao/VolumeDetailsDaoImpl.java @@ -29,8 +29,8 @@ import com.cloud.storage.VolumeDetailVO; public class VolumeDetailsDaoImpl extends ResourceDetailsDaoBase implements VolumeDetailsDao { @Override - public void addDetail(long resourceId, String key, String value) { - super.addDetail(new VolumeDetailVO(resourceId, key, value)); + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new VolumeDetailVO(resourceId, key, value, display)); } } diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java index dcf810e32d8..922a892be04 100644 --- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java +++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java @@ -162,7 +162,7 @@ public class Upgrade430to440 implements DbUpgrade { if (networkRs.next()) { String guesttype = networkRs.getString(1); - if (guesttype == Network.GuestType.Shared.toString()) { + if (guesttype.equals(Network.GuestType.Shared.toString())) { pstmtUpdate = conn.prepareStatement("UPDATE `cloud`.`user_ip_address` SET account_id = ?, domain_id= ? WHERE public_ip_address = ?"); pstmtUpdate.setLong(1,vmAccountId); pstmtUpdate.setLong(2,vmDomainId); diff --git a/engine/schema/src/com/cloud/user/SSHKeyPairVO.java b/engine/schema/src/com/cloud/user/SSHKeyPairVO.java index 1f649117e55..4dc03c45b0f 100644 --- a/engine/schema/src/com/cloud/user/SSHKeyPairVO.java +++ b/engine/schema/src/com/cloud/user/SSHKeyPairVO.java @@ -120,5 +120,4 @@ public class SSHKeyPairVO implements SSHKeyPair { public IAMEntityType getEntityType() { return IAMEntityType.SSHKeyPair; } - } diff --git a/engine/schema/src/com/cloud/vm/NicDetailVO.java b/engine/schema/src/com/cloud/vm/NicDetailVO.java index 6df9d577493..7dc72159f3f 100644 --- a/engine/schema/src/com/cloud/vm/NicDetailVO.java +++ b/engine/schema/src/com/cloud/vm/NicDetailVO.java @@ -43,15 +43,16 @@ public class NicDetailVO implements ResourceDetail { private String value; @Column(name = "display") - private boolean display; + private boolean display = true; public NicDetailVO() { } - public NicDetailVO(long nicId, String name, String value) { + public NicDetailVO(long nicId, String name, String value, boolean display) { this.resourceId = nicId; this.name = name; this.value = value; + this.display = display; } @Override diff --git a/engine/schema/src/com/cloud/vm/UserVmDetailVO.java b/engine/schema/src/com/cloud/vm/UserVmDetailVO.java index 2e199ccd8e8..d1a6e63fbc4 100644 --- a/engine/schema/src/com/cloud/vm/UserVmDetailVO.java +++ b/engine/schema/src/com/cloud/vm/UserVmDetailVO.java @@ -43,15 +43,16 @@ public class UserVmDetailVO implements ResourceDetail { private String value; @Column(name = "display") - private boolean display; + private boolean display = true; public UserVmDetailVO() { } - public UserVmDetailVO(long vmId, String name, String value) { + public UserVmDetailVO(long vmId, String name, String value, boolean display) { this.resourceId = vmId; this.name = name; this.value = value; + this.display = display; } @Override diff --git a/engine/schema/src/com/cloud/vm/VMInstanceVO.java b/engine/schema/src/com/cloud/vm/VMInstanceVO.java index a09c34f91c3..ddeebfeb753 100644 --- a/engine/schema/src/com/cloud/vm/VMInstanceVO.java +++ b/engine/schema/src/com/cloud/vm/VMInstanceVO.java @@ -55,7 +55,7 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject implements NicDao { List results = customSearch(sc, null); return results.get(0); } - } diff --git a/engine/schema/src/com/cloud/vm/dao/NicDetailsDaoImpl.java b/engine/schema/src/com/cloud/vm/dao/NicDetailsDaoImpl.java index 8c95a0e8fb9..2bad56d2625 100644 --- a/engine/schema/src/com/cloud/vm/dao/NicDetailsDaoImpl.java +++ b/engine/schema/src/com/cloud/vm/dao/NicDetailsDaoImpl.java @@ -29,7 +29,7 @@ import com.cloud.vm.NicDetailVO; public class NicDetailsDaoImpl extends ResourceDetailsDaoBase implements NicDetailsDao { @Override - public void addDetail(long resourceId, String key, String value) { - super.addDetail(new NicDetailVO(resourceId, key, value)); + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new NicDetailVO(resourceId, key, value, display)); } } diff --git a/engine/schema/src/com/cloud/vm/dao/NicIpAliasVO.java b/engine/schema/src/com/cloud/vm/dao/NicIpAliasVO.java index 9517b7f76bd..3df99096207 100644 --- a/engine/schema/src/com/cloud/vm/dao/NicIpAliasVO.java +++ b/engine/schema/src/com/cloud/vm/dao/NicIpAliasVO.java @@ -238,5 +238,4 @@ public class NicIpAliasVO implements NicIpAlias { public IAMEntityType getEntityType() { return IAMEntityType.NicIpAlias; } - } diff --git a/engine/schema/src/com/cloud/vm/dao/NicSecondaryIpVO.java b/engine/schema/src/com/cloud/vm/dao/NicSecondaryIpVO.java index 584f189633f..995da17ddcd 100644 --- a/engine/schema/src/com/cloud/vm/dao/NicSecondaryIpVO.java +++ b/engine/schema/src/com/cloud/vm/dao/NicSecondaryIpVO.java @@ -127,10 +127,6 @@ public class NicSecondaryIpVO implements NicSecondaryIp { return vmId; } - public void setVmId(Long vmId) { - this.vmId = vmId; - } - @Override public IAMEntityType getEntityType() { return IAMEntityType.NicSecondaryIp; diff --git a/engine/schema/src/com/cloud/vm/dao/UserVmDao.java b/engine/schema/src/com/cloud/vm/dao/UserVmDao.java index 0a4acbbe8b0..884d0a3f049 100755 --- a/engine/schema/src/com/cloud/vm/dao/UserVmDao.java +++ b/engine/schema/src/com/cloud/vm/dao/UserVmDao.java @@ -43,8 +43,9 @@ public interface UserVmDao extends GenericDao { * @param userData updates the userData of the vm * @param displayVm updates the displayvm attribute signifying whether it has to be displayed to the end user or not. * @param customId + * @param hostName TODO */ - void updateVM(long id, String displayName, boolean enable, Long osTypeId, String userData, boolean displayVm, boolean isDynamicallyScalable, String customId); + void updateVM(long id, String displayName, boolean enable, Long osTypeId, String userData, boolean displayVm, boolean isDynamicallyScalable, String customId, String hostName); List findDestroyedVms(Date date); diff --git a/engine/schema/src/com/cloud/vm/dao/UserVmDaoImpl.java b/engine/schema/src/com/cloud/vm/dao/UserVmDaoImpl.java index 812e628e1b2..7a05be8f604 100755 --- a/engine/schema/src/com/cloud/vm/dao/UserVmDaoImpl.java +++ b/engine/schema/src/com/cloud/vm/dao/UserVmDaoImpl.java @@ -216,7 +216,7 @@ public class UserVmDaoImpl extends GenericDaoBase implements Use } @Override - public void updateVM(long id, String displayName, boolean enable, Long osTypeId, String userData, boolean displayVm, boolean isDynamicallyScalable, String customId) { + public void updateVM(long id, String displayName, boolean enable, Long osTypeId, String userData, boolean displayVm, boolean isDynamicallyScalable, String customId, String hostName) { UserVmVO vo = createForUpdate(); vo.setDisplayName(displayName); vo.setHaEnabled(enable); @@ -224,6 +224,9 @@ public class UserVmDaoImpl extends GenericDaoBase implements Use vo.setUserData(userData); vo.setDisplayVm(displayVm); vo.setDynamicallyScalable(isDynamicallyScalable); + if (hostName != null) { + vo.setHostName(hostName); + } if (customId != null) { vo.setUuid(customId); } @@ -343,7 +346,7 @@ public class UserVmDaoImpl extends GenericDaoBase implements Use } List details = new ArrayList(); for (String key : detailsStr.keySet()) { - details.add(new UserVmDetailVO(vm.getId(), key, detailsStr.get(key))); + details.add(new UserVmDetailVO(vm.getId(), key, detailsStr.get(key), true)); } _detailsDao.saveDetails(details); diff --git a/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDaoImpl.java b/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDaoImpl.java index 3f931208417..5800cd5f914 100644 --- a/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDaoImpl.java +++ b/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDaoImpl.java @@ -29,8 +29,8 @@ import com.cloud.vm.UserVmDetailVO; public class UserVmDetailsDaoImpl extends ResourceDetailsDaoBase implements UserVmDetailsDao { @Override - public void addDetail(long resourceId, String key, String value) { - super.addDetail(new UserVmDetailVO(resourceId, key, value)); + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new UserVmDetailVO(resourceId, key, value, display)); } } diff --git a/engine/schema/src/com/cloud/vm/snapshot/VMSnapshotDetailsVO.java b/engine/schema/src/com/cloud/vm/snapshot/VMSnapshotDetailsVO.java index 4531393ab52..b7a1c7bd3b1 100644 --- a/engine/schema/src/com/cloud/vm/snapshot/VMSnapshotDetailsVO.java +++ b/engine/schema/src/com/cloud/vm/snapshot/VMSnapshotDetailsVO.java @@ -44,14 +44,17 @@ public class VMSnapshotDetailsVO implements ResourceDetail { @Column(name = "value") String value; - public VMSnapshotDetailsVO() { + @Column(name = "display") + private boolean display = true; + public VMSnapshotDetailsVO() { } - public VMSnapshotDetailsVO(long vmSnapshotId, String name, String value) { + public VMSnapshotDetailsVO(long vmSnapshotId, String name, String value, boolean display) { this.resourceId = vmSnapshotId; this.name = name; this.value = value; + this.display = display; } @Override @@ -76,6 +79,6 @@ public class VMSnapshotDetailsVO implements ResourceDetail { @Override public boolean isDisplay() { - return false; + return display; } } diff --git a/engine/schema/src/com/cloud/vm/snapshot/dao/VMSnapshotDetailsDaoImpl.java b/engine/schema/src/com/cloud/vm/snapshot/dao/VMSnapshotDetailsDaoImpl.java index bfa912d0327..a3cba7a94d1 100644 --- a/engine/schema/src/com/cloud/vm/snapshot/dao/VMSnapshotDetailsDaoImpl.java +++ b/engine/schema/src/com/cloud/vm/snapshot/dao/VMSnapshotDetailsDaoImpl.java @@ -25,7 +25,7 @@ import com.cloud.vm.snapshot.VMSnapshotDetailsVO; public class VMSnapshotDetailsDaoImpl extends ResourceDetailsDaoBase implements VMSnapshotDetailsDao { @Override - public void addDetail(long resourceId, String key, String value) { - super.addDetail(new VMSnapshotDetailsVO(resourceId, key, value)); + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new VMSnapshotDetailsVO(resourceId, key, value, display)); } } diff --git a/engine/schema/src/org/apache/cloudstack/affinity/AffinityGroupVO.java b/engine/schema/src/org/apache/cloudstack/affinity/AffinityGroupVO.java index ec267ee305e..b9fda8e9e32 100644 --- a/engine/schema/src/org/apache/cloudstack/affinity/AffinityGroupVO.java +++ b/engine/schema/src/org/apache/cloudstack/affinity/AffinityGroupVO.java @@ -27,8 +27,8 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; -import org.apache.cloudstack.acl.IAMEntityType; import org.apache.cloudstack.acl.ControlledEntity; +import org.apache.cloudstack.acl.IAMEntityType; @Entity @Table(name = ("affinity_group")) diff --git a/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMEntityVO.java b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMEntityVO.java index 4a4fd4751b2..7403d62fcf6 100644 --- a/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMEntityVO.java +++ b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMEntityVO.java @@ -541,5 +541,4 @@ public class VMEntityVO implements VirtualMachine, FiniteStateObject extends GenericDao public void saveDetails(List details); - public void addDetail(long resourceId, String key, String value); + public void addDetail(long resourceId, String key, String value, boolean display); } diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/Site2SiteCustomerGatewayDetailVO.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/Site2SiteCustomerGatewayDetailVO.java index 1a2743cab81..5c4c92d8cbb 100644 --- a/engine/schema/src/org/apache/cloudstack/resourcedetail/Site2SiteCustomerGatewayDetailVO.java +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/Site2SiteCustomerGatewayDetailVO.java @@ -43,15 +43,16 @@ public class Site2SiteCustomerGatewayDetailVO implements ResourceDetail { private String value; @Column(name = "display") - private boolean display; + private boolean display = true; public Site2SiteCustomerGatewayDetailVO() { } - public Site2SiteCustomerGatewayDetailVO(long id, String name, String value) { + public Site2SiteCustomerGatewayDetailVO(long id, String name, String value, boolean display) { this.resourceId = id; this.name = name; this.value = value; + this.display = display; } @Override diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/Site2SiteVpnConnectionDetailVO.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/Site2SiteVpnConnectionDetailVO.java index 9a4b616624b..17e08f21d00 100644 --- a/engine/schema/src/org/apache/cloudstack/resourcedetail/Site2SiteVpnConnectionDetailVO.java +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/Site2SiteVpnConnectionDetailVO.java @@ -43,15 +43,16 @@ public class Site2SiteVpnConnectionDetailVO implements ResourceDetail { private String value; @Column(name = "display") - private boolean display; + private boolean display = true; public Site2SiteVpnConnectionDetailVO() { } - public Site2SiteVpnConnectionDetailVO(long id, String name, String value) { + public Site2SiteVpnConnectionDetailVO(long id, String name, String value, boolean display) { this.resourceId = id; this.name = name; this.value = value; + this.display = display; } @Override diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/Site2SiteVpnGatewayDetailVO.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/Site2SiteVpnGatewayDetailVO.java index 244e218218a..7906655b909 100644 --- a/engine/schema/src/org/apache/cloudstack/resourcedetail/Site2SiteVpnGatewayDetailVO.java +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/Site2SiteVpnGatewayDetailVO.java @@ -43,15 +43,16 @@ public class Site2SiteVpnGatewayDetailVO implements ResourceDetail { private String value; @Column(name = "display") - private boolean display; + private boolean display = true; public Site2SiteVpnGatewayDetailVO() { } - public Site2SiteVpnGatewayDetailVO(long id, String name, String value) { + public Site2SiteVpnGatewayDetailVO(long id, String name, String value, boolean display) { this.resourceId = id; this.name = name; this.value = value; + this.display = display; } @Override diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/UserDetailVO.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/UserDetailVO.java index 69f44739a5e..79115a2a1f3 100644 --- a/engine/schema/src/org/apache/cloudstack/resourcedetail/UserDetailVO.java +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/UserDetailVO.java @@ -43,7 +43,7 @@ public class UserDetailVO implements ResourceDetail { private String value; @Column(name = "display") - private boolean display; + private boolean display = true; public UserDetailVO() { } diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/UserIpAddressDetailVO.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/UserIpAddressDetailVO.java index 2bbadcb8cc1..80393e083b9 100644 --- a/engine/schema/src/org/apache/cloudstack/resourcedetail/UserIpAddressDetailVO.java +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/UserIpAddressDetailVO.java @@ -43,15 +43,16 @@ public class UserIpAddressDetailVO implements ResourceDetail { private String value; @Column(name = "display") - private boolean display; + private boolean display = true; public UserIpAddressDetailVO() { } - public UserIpAddressDetailVO(long id, String name, String value) { + public UserIpAddressDetailVO(long id, String name, String value, boolean display) { this.resourceId = id; this.name = name; this.value = value; + this.display = display; } @Override diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/VpcDetailVO.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/VpcDetailVO.java index beb38b50d1b..1952e238a08 100644 --- a/engine/schema/src/org/apache/cloudstack/resourcedetail/VpcDetailVO.java +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/VpcDetailVO.java @@ -43,15 +43,16 @@ public class VpcDetailVO implements ResourceDetail { private String value; @Column(name = "display") - private boolean display; + private boolean display = true; public VpcDetailVO() { } - public VpcDetailVO(long id, String name, String value) { + public VpcDetailVO(long id, String name, String value, boolean display) { this.resourceId = id; this.name = name; this.value = value; + this.display = display; } @Override diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/VpcGatewayDetailVO.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/VpcGatewayDetailVO.java index b78bfa8b5db..0f4b2aff4fd 100644 --- a/engine/schema/src/org/apache/cloudstack/resourcedetail/VpcGatewayDetailVO.java +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/VpcGatewayDetailVO.java @@ -43,15 +43,16 @@ public class VpcGatewayDetailVO implements ResourceDetail { private String value; @Column(name = "display") - private boolean display; + private boolean display = true; public VpcGatewayDetailVO() { } - public VpcGatewayDetailVO(long id, String name, String value) { + public VpcGatewayDetailVO(long id, String name, String value, boolean display) { this.resourceId = id; this.name = name; this.value = value; + this.display = display; } @Override diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/AutoScaleVmGroupDetailsDaoImpl.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/AutoScaleVmGroupDetailsDaoImpl.java index b4c82bc06a1..3d32a680cf9 100644 --- a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/AutoScaleVmGroupDetailsDaoImpl.java +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/AutoScaleVmGroupDetailsDaoImpl.java @@ -27,7 +27,7 @@ import org.springframework.stereotype.Component; public class AutoScaleVmGroupDetailsDaoImpl extends ResourceDetailsDaoBase implements AutoScaleVmGroupDetailsDao { @Override - public void addDetail(long resourceId, String key, String value) { - super.addDetail(new AutoScaleVmGroupDetailVO(resourceId, key, value)); + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new AutoScaleVmGroupDetailVO(resourceId, key, value, display)); } } \ No newline at end of file diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/AutoScaleVmProfileDetailsDaoImpl.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/AutoScaleVmProfileDetailsDaoImpl.java index 17e0316bc98..736acefb4b2 100644 --- a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/AutoScaleVmProfileDetailsDaoImpl.java +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/AutoScaleVmProfileDetailsDaoImpl.java @@ -27,7 +27,7 @@ import org.springframework.stereotype.Component; public class AutoScaleVmProfileDetailsDaoImpl extends ResourceDetailsDaoBase implements AutoScaleVmProfileDetailsDao { @Override - public void addDetail(long resourceId, String key, String value) { - super.addDetail(new AutoScaleVmProfileDetailVO(resourceId, key, value)); + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new AutoScaleVmProfileDetailVO(resourceId, key, value, display)); } } \ No newline at end of file diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/DiskOfferingDetailsDaoImpl.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/DiskOfferingDetailsDaoImpl.java index e2fc26e722a..c7c7e6cadce 100644 --- a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/DiskOfferingDetailsDaoImpl.java +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/DiskOfferingDetailsDaoImpl.java @@ -27,7 +27,7 @@ import org.springframework.stereotype.Component; public class DiskOfferingDetailsDaoImpl extends ResourceDetailsDaoBase implements DiskOfferingDetailsDao { @Override - public void addDetail(long resourceId, String key, String value) { - super.addDetail(new DiskOfferingDetailVO(resourceId, key, value)); + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new DiskOfferingDetailVO(resourceId, key, value, display)); } } \ No newline at end of file diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/FirewallRuleDetailsDaoImpl.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/FirewallRuleDetailsDaoImpl.java index 1c1e83910f2..fa904932530 100644 --- a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/FirewallRuleDetailsDaoImpl.java +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/FirewallRuleDetailsDaoImpl.java @@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase; public class FirewallRuleDetailsDaoImpl extends ResourceDetailsDaoBase implements FirewallRuleDetailsDao { @Override - public void addDetail(long resourceId, String key, String value) { - super.addDetail(new FirewallRuleDetailVO(resourceId, key, value)); + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new FirewallRuleDetailVO(resourceId, key, value, display)); } } diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/NetworkACLItemDetailsDaoImpl.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/NetworkACLItemDetailsDaoImpl.java index 03d12820e32..d8686a21bfb 100644 --- a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/NetworkACLItemDetailsDaoImpl.java +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/NetworkACLItemDetailsDaoImpl.java @@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase; public class NetworkACLItemDetailsDaoImpl extends ResourceDetailsDaoBase implements NetworkACLItemDetailsDao { @Override - public void addDetail(long resourceId, String key, String value) { - super.addDetail(new NetworkACLItemDetailVO(resourceId, key, value)); + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new NetworkACLItemDetailVO(resourceId, key, value, display)); } } \ No newline at end of file diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/NetworkACLListDetailsDaoImpl.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/NetworkACLListDetailsDaoImpl.java index e07110f3ab0..b204ce2246f 100644 --- a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/NetworkACLListDetailsDaoImpl.java +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/NetworkACLListDetailsDaoImpl.java @@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase; public class NetworkACLListDetailsDaoImpl extends ResourceDetailsDaoBase implements NetworkACLListDetailsDao { @Override - public void addDetail(long resourceId, String key, String value) { - super.addDetail(new NetworkACLListDetailVO(resourceId, key, value)); + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new NetworkACLListDetailVO(resourceId, key, value, display)); } } diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/RemoteAccessVpnDetailsDaoImpl.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/RemoteAccessVpnDetailsDaoImpl.java index e8f312e054f..125369be6a9 100644 --- a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/RemoteAccessVpnDetailsDaoImpl.java +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/RemoteAccessVpnDetailsDaoImpl.java @@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase; public class RemoteAccessVpnDetailsDaoImpl extends ResourceDetailsDaoBase implements RemoteAccessVpnDetailsDao { @Override - public void addDetail(long resourceId, String key, String value) { - super.addDetail(new RemoteAccessVpnDetailVO(resourceId, key, value)); + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new RemoteAccessVpnDetailVO(resourceId, key, value, display)); } } diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/Site2SiteCustomerGatewayDetailsDaoImpl.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/Site2SiteCustomerGatewayDetailsDaoImpl.java index 71e810ee33d..73650fe48f3 100644 --- a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/Site2SiteCustomerGatewayDetailsDaoImpl.java +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/Site2SiteCustomerGatewayDetailsDaoImpl.java @@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.Site2SiteCustomerGatewayDetailVO; public class Site2SiteCustomerGatewayDetailsDaoImpl extends ResourceDetailsDaoBase implements Site2SiteCustomerGatewayDetailsDao { @Override - public void addDetail(long resourceId, String key, String value) { - super.addDetail(new Site2SiteCustomerGatewayDetailVO(resourceId, key, value)); + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new Site2SiteCustomerGatewayDetailVO(resourceId, key, value, display)); } } diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/Site2SiteVpnConnectionDetailsDaoImpl.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/Site2SiteVpnConnectionDetailsDaoImpl.java index 7261df8ea1f..099977d46b2 100644 --- a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/Site2SiteVpnConnectionDetailsDaoImpl.java +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/Site2SiteVpnConnectionDetailsDaoImpl.java @@ -26,7 +26,7 @@ import org.springframework.stereotype.Component; public class Site2SiteVpnConnectionDetailsDaoImpl extends ResourceDetailsDaoBase implements Site2SiteVpnConnectionDetailsDao { @Override - public void addDetail(long resourceId, String key, String value) { - super.addDetail(new Site2SiteVpnConnectionDetailVO(resourceId, key, value)); + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new Site2SiteVpnConnectionDetailVO(resourceId, key, value, display)); } } diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/Site2SiteVpnGatewayDetailsDaoImpl.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/Site2SiteVpnGatewayDetailsDaoImpl.java index 1e6b4809ca8..9502b65460b 100644 --- a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/Site2SiteVpnGatewayDetailsDaoImpl.java +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/Site2SiteVpnGatewayDetailsDaoImpl.java @@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.Site2SiteVpnGatewayDetailVO; public class Site2SiteVpnGatewayDetailsDaoImpl extends ResourceDetailsDaoBase implements Site2SiteVpnGatewayDetailsDao { @Override - public void addDetail(long resourceId, String key, String value) { - super.addDetail(new Site2SiteVpnGatewayDetailVO(resourceId, key, value)); + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new Site2SiteVpnGatewayDetailVO(resourceId, key, value, display)); } } diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/UserDetailsDaoImpl.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/UserDetailsDaoImpl.java index 508185297a8..d77ee873d26 100644 --- a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/UserDetailsDaoImpl.java +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/UserDetailsDaoImpl.java @@ -27,7 +27,7 @@ import org.springframework.stereotype.Component; public class UserDetailsDaoImpl extends ResourceDetailsDaoBase implements UserDetailsDao { @Override - public void addDetail(long resourceId, String key, String value) { + public void addDetail(long resourceId, String key, String value, boolean display) { super.addDetail(new UserDetailVO(resourceId, key, value)); } } \ No newline at end of file diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/UserIpAddressDetailsDaoImpl.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/UserIpAddressDetailsDaoImpl.java index a8d211ec745..4444da0faf9 100644 --- a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/UserIpAddressDetailsDaoImpl.java +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/UserIpAddressDetailsDaoImpl.java @@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.UserIpAddressDetailVO; public class UserIpAddressDetailsDaoImpl extends ResourceDetailsDaoBase implements UserIpAddressDetailsDao { @Override - public void addDetail(long resourceId, String key, String value) { - super.addDetail(new UserIpAddressDetailVO(resourceId, key, value)); + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new UserIpAddressDetailVO(resourceId, key, value, display)); } } diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/VpcDetailsDaoImpl.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/VpcDetailsDaoImpl.java index fb22c7c18b2..b455656cae3 100644 --- a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/VpcDetailsDaoImpl.java +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/VpcDetailsDaoImpl.java @@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.VpcDetailVO; public class VpcDetailsDaoImpl extends ResourceDetailsDaoBase implements VpcDetailsDao { @Override - public void addDetail(long resourceId, String key, String value) { - super.addDetail(new VpcDetailVO(resourceId, key, value)); + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new VpcDetailVO(resourceId, key, value, display)); } } diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/VpcGatewayDetailsDaoImpl.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/VpcGatewayDetailsDaoImpl.java index 871c3631941..e8d632dd24a 100644 --- a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/VpcGatewayDetailsDaoImpl.java +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/VpcGatewayDetailsDaoImpl.java @@ -28,7 +28,7 @@ import org.apache.cloudstack.resourcedetail.VpcGatewayDetailVO; public class VpcGatewayDetailsDaoImpl extends ResourceDetailsDaoBase implements VpcGatewayDetailsDao { @Override - public void addDetail(long resourceId, String key, String value) { - super.addDetail(new VpcGatewayDetailVO(resourceId, key, value)); + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new VpcGatewayDetailVO(resourceId, key, value, display)); } } \ No newline at end of file diff --git a/engine/schema/src/org/apache/cloudstack/storage/datastore/db/ImageStoreVO.java b/engine/schema/src/org/apache/cloudstack/storage/datastore/db/ImageStoreVO.java index 36cc57c5d92..2d1a3eddd69 100644 --- a/engine/schema/src/org/apache/cloudstack/storage/datastore/db/ImageStoreVO.java +++ b/engine/schema/src/org/apache/cloudstack/storage/datastore/db/ImageStoreVO.java @@ -159,9 +159,6 @@ public class ImageStoreVO implements ImageStore { public void setUrl(String url) { this.url = url; - if ("cifs".equalsIgnoreCase(this.protocol)) { - this.url = UriUtils.getUpdateUri(url, true); - } } public Date getCreated() { diff --git a/engine/schema/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java b/engine/schema/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java index 1a5949459ea..57afa16b501 100644 --- a/engine/schema/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java +++ b/engine/schema/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java @@ -232,7 +232,7 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase pool = super.persist(pool); if (details != null) { for (Map.Entry detail : details.entrySet()) { - StoragePoolDetailVO vo = new StoragePoolDetailVO(pool.getId(), detail.getKey(), detail.getValue()); + StoragePoolDetailVO vo = new StoragePoolDetailVO(pool.getId(), detail.getKey(), detail.getValue(), true); _detailsDao.persist(vo); } } @@ -388,7 +388,7 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase if (details != null) { List detailsVO = new ArrayList(); for (String key : details.keySet()) { - detailsVO.add(new StoragePoolDetailVO(poolId, key, details.get(key))); + detailsVO.add(new StoragePoolDetailVO(poolId, key, details.get(key), true)); } _detailsDao.saveDetails(detailsVO); } diff --git a/engine/schema/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailVO.java b/engine/schema/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailVO.java index a7998b3145c..5351959ea1a 100644 --- a/engine/schema/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailVO.java +++ b/engine/schema/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailVO.java @@ -43,12 +43,13 @@ public class PrimaryDataStoreDetailVO implements ResourceDetail { String value; @Column(name = "display") - private boolean display; + private boolean display = true; - public PrimaryDataStoreDetailVO(long poolId, String name, String value) { + public PrimaryDataStoreDetailVO(long poolId, String name, String value, boolean display) { this.resourceId = poolId; this.name = name; this.value = value; + this.display = display; } protected PrimaryDataStoreDetailVO() { diff --git a/engine/schema/src/org/apache/cloudstack/storage/datastore/db/StoragePoolDetailVO.java b/engine/schema/src/org/apache/cloudstack/storage/datastore/db/StoragePoolDetailVO.java index f2d209840c2..8a746ff9d1d 100644 --- a/engine/schema/src/org/apache/cloudstack/storage/datastore/db/StoragePoolDetailVO.java +++ b/engine/schema/src/org/apache/cloudstack/storage/datastore/db/StoragePoolDetailVO.java @@ -43,12 +43,13 @@ public class StoragePoolDetailVO implements ResourceDetail { String value; @Column(name = "display") - private boolean display; + private boolean display = true; - public StoragePoolDetailVO(long poolId, String name, String value) { + public StoragePoolDetailVO(long poolId, String name, String value, boolean display) { this.resourceId = poolId; this.name = name; this.value = value; + this.display = display; } public StoragePoolDetailVO() { diff --git a/engine/schema/src/org/apache/cloudstack/storage/datastore/db/StoragePoolVO.java b/engine/schema/src/org/apache/cloudstack/storage/datastore/db/StoragePoolVO.java index e1e21e1178d..1508ce0b28c 100644 --- a/engine/schema/src/org/apache/cloudstack/storage/datastore/db/StoragePoolVO.java +++ b/engine/schema/src/org/apache/cloudstack/storage/datastore/db/StoragePoolVO.java @@ -298,9 +298,6 @@ public class StoragePoolVO implements StoragePool { public void setPath(String path) { this.path = path; - if (this.poolType == StoragePoolType.SMB) { - this.path = UriUtils.getUpdateUri(this.path, true); - } } public void setUserInfo(String userInfo) { diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java index 2b77ac9334f..8db21ccbf7a 100644 --- a/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java +++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java @@ -441,5 +441,4 @@ public class TemplateObject implements TemplateInfo { public IAMEntityType getEntityType() { return IAMEntityType.VirtualMachineTemplate; } - } diff --git a/engine/storage/integration-test/pom.xml b/engine/storage/integration-test/pom.xml index 7bb27e060e4..7b40f82b7d4 100644 --- a/engine/storage/integration-test/pom.xml +++ b/engine/storage/integration-test/pom.xml @@ -121,11 +121,6 @@ httpclient compile - - mysql - mysql-connector-java - provided - org.testng testng diff --git a/engine/storage/integration-test/test/com/cloud/vm/snapshot/dao/VmSnapshotDaoTest.java b/engine/storage/integration-test/test/com/cloud/vm/snapshot/dao/VmSnapshotDaoTest.java index a16a3334d1e..38b4f29a324 100644 --- a/engine/storage/integration-test/test/com/cloud/vm/snapshot/dao/VmSnapshotDaoTest.java +++ b/engine/storage/integration-test/test/com/cloud/vm/snapshot/dao/VmSnapshotDaoTest.java @@ -41,7 +41,7 @@ public class VmSnapshotDaoTest extends CloudStackTestNGBase { @Test public void testVmSnapshotDetails() { - VMSnapshotDetailsVO detailsVO = new VMSnapshotDetailsVO(1L, "test", "foo"); + VMSnapshotDetailsVO detailsVO = new VMSnapshotDetailsVO(1L, "test", "foo", display); vmsnapshotDetailsDao.persist(detailsVO); Map details = vmsnapshotDetailsDao.listDetailsKeyPairs(1L); Assert.assertTrue(details.containsKey("test")); diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java index bb74a3780f0..a03125dd6c4 100644 --- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java +++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java @@ -251,7 +251,7 @@ public class StorageAllocatorTest { public void testClusterAllocatorWithTags() { try { createDb(); - StoragePoolDetailVO detailVO = new StoragePoolDetailVO(this.storagePoolId, "high", "true"); + StoragePoolDetailVO detailVO = new StoragePoolDetailVO(this.storagePoolId, "high", "true", display); poolDetailsDao.persist(detailVO); DiskOfferingVO diskOff = this.diskOfferingDao.findById(diskOffering.getId()); List tags = new ArrayList(); @@ -285,7 +285,7 @@ public class StorageAllocatorTest { public void testClusterAllocatorWithWrongTag() { try { createDb(); - StoragePoolDetailVO detailVO = new StoragePoolDetailVO(this.storagePoolId, "high", "true"); + StoragePoolDetailVO detailVO = new StoragePoolDetailVO(this.storagePoolId, "high", "true", display); poolDetailsDao.persist(detailVO); DiskOfferingVO diskOff = this.diskOfferingDao.findById(diskOffering.getId()); List tags = new ArrayList(); diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/TemplateEntityImpl.java b/engine/storage/src/org/apache/cloudstack/storage/image/TemplateEntityImpl.java index da7677c6a14..fd90ac98af5 100644 --- a/engine/storage/src/org/apache/cloudstack/storage/image/TemplateEntityImpl.java +++ b/engine/storage/src/org/apache/cloudstack/storage/image/TemplateEntityImpl.java @@ -288,8 +288,6 @@ public class TemplateEntityImpl implements TemplateEntity { @Override public IAMEntityType getEntityType() { - // TODO Auto-generated method stub - return null; + return IAMEntityType.VirtualMachineTemplate; } - } diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreHelper.java b/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreHelper.java index a4c423c861b..5e29f7136aa 100644 --- a/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreHelper.java +++ b/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreHelper.java @@ -18,6 +18,8 @@ */ package org.apache.cloudstack.storage.image.datastore; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; import java.util.Iterator; import java.util.Map; import java.util.UUID; @@ -34,6 +36,7 @@ import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailsDao; import org.apache.cloudstack.storage.datastore.db.ImageStoreVO; import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao; +import com.cloud.exception.InvalidParameterValueException; import com.cloud.storage.DataStoreRole; import com.cloud.storage.ScopeType; import com.cloud.utils.crypt.DBEncryptionUtil; @@ -95,7 +98,30 @@ public class ImageStoreHelper { if (store.getName() == null) { store.setName(store.getUuid()); } + store.setRole((DataStoreRole)params.get("role")); + + if ("cifs".equalsIgnoreCase((String) params.get("protocol")) && details != null) { + String user = details.get("user"); + String password = details.get("password"); + String domain = details.get("domain"); + String updatedPath = (String) params.get("url"); + + if (user == null || password == null) { + String errMsg = "Missing cifs user and password details. Add them as details parameter."; + throw new InvalidParameterValueException(errMsg); + } else { + try { + password = DBEncryptionUtil.encrypt(URLEncoder.encode(password, "UTF-8")); + details.put("password", password); + updatedPath += "?user=" + user + "&password=" + password + "&domain=" + domain; + } catch (UnsupportedEncodingException e) { + throw new CloudRuntimeException("Error while generating the cifs url. " + e.getMessage()); + } + store.setUrl(updatedPath); + } + } + store = imageStoreDao.persist(store); // persist details diff --git a/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotEntityImpl.java b/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotEntityImpl.java index 103c0dbecf8..848b1658937 100644 --- a/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotEntityImpl.java +++ b/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotEntityImpl.java @@ -188,5 +188,4 @@ public class SnapshotEntityImpl implements SnapshotEntity { public IAMEntityType getEntityType() { return IAMEntityType.Snapshot; } - } diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java b/engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java index 99128421197..6b129755009 100644 --- a/engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java +++ b/engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java @@ -18,6 +18,8 @@ */ package org.apache.cloudstack.storage.volume.datastore; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; import java.util.List; import java.util.Map; @@ -38,12 +40,15 @@ import com.cloud.capacity.Capacity; import com.cloud.capacity.CapacityVO; import com.cloud.capacity.dao.CapacityDao; import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.exception.InvalidParameterValueException; import com.cloud.storage.DataStoreRole; import com.cloud.storage.ScopeType; import com.cloud.storage.StorageManager; import com.cloud.storage.StoragePoolHostVO; import com.cloud.storage.StoragePoolStatus; +import com.cloud.storage.Storage.StoragePoolType; import com.cloud.storage.dao.StoragePoolHostDao; +import com.cloud.utils.crypt.DBEncryptionUtil; import com.cloud.utils.db.TransactionLegacy; import com.cloud.utils.exception.CloudRuntimeException; @@ -87,6 +92,29 @@ public class PrimaryDataStoreHelper { dataStoreVO.setHypervisor(params.getHypervisorType()); Map details = params.getDetails(); + if (params.getType() == StoragePoolType.SMB && details != null) { + String user = details.get("user"); + String password = details.get("password"); + String domain = details.get("domain"); + String updatedPath = params.getPath(); + + if (user == null || password == null) { + String errMsg = "Missing cifs user and password details. Add them as details parameter."; + s_logger.warn(errMsg); + throw new InvalidParameterValueException(errMsg); + } else { + try { + password = DBEncryptionUtil.encrypt(URLEncoder.encode(password, "UTF-8")); + details.put("password", password); + updatedPath += "?user=" + user + "&password=" + password + "&domain=" + domain; + } catch (UnsupportedEncodingException e) { + throw new CloudRuntimeException("Error while generating the cifs url. " + e.getMessage()); + } + } + + dataStoreVO.setPath(updatedPath); + } + String tags = params.getTags(); if (tags != null) { String[] tokens = tags.split(","); diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/db/PrimaryDataStoreDetailsDaoImpl.java b/engine/storage/src/org/apache/cloudstack/storage/volume/db/PrimaryDataStoreDetailsDaoImpl.java index 8ba3e12a1a0..a520e3216bf 100644 --- a/engine/storage/src/org/apache/cloudstack/storage/volume/db/PrimaryDataStoreDetailsDaoImpl.java +++ b/engine/storage/src/org/apache/cloudstack/storage/volume/db/PrimaryDataStoreDetailsDaoImpl.java @@ -26,8 +26,8 @@ import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDetailsDao; public class PrimaryDataStoreDetailsDaoImpl extends ResourceDetailsDaoBase implements PrimaryDataStoreDetailsDao { @Override - public void addDetail(long resourceId, String key, String value) { - super.addDetail(new PrimaryDataStoreDetailVO(resourceId, key, value)); + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new PrimaryDataStoreDetailVO(resourceId, key, value, display)); } } diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java index dc05278fdcc..1f05be21f2a 100644 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java @@ -163,6 +163,11 @@ public class VolumeObject implements VolumeInfo { return volumeVO.getHypervisorSnapshotReserve(); } + @Override + public boolean isDisplayVolume() { + return volumeVO.isDisplayVolume(); + } + public long getVolumeId() { return volumeVO.getId(); } diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java index 3e315da4b48..fa0fd956a7a 100644 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java @@ -853,6 +853,7 @@ public class VolumeServiceImpl implements VolumeService { } srcVolume.processEvent(Event.OperationSuccessed); destVolume.processEvent(Event.OperationSuccessed, result.getAnswer()); + _volumeDao.updateUuid(srcVolume.getId(), destVolume.getId()); destroyVolume(srcVolume.getId()); srcVolume = volFactory.getVolume(srcVolume.getId()); AsyncCallFuture destroyFuture = expungeVolumeAsync(srcVolume); diff --git a/framework/db/pom.xml b/framework/db/pom.xml index a0edf20abfe..8b41703f230 100644 --- a/framework/db/pom.xml +++ b/framework/db/pom.xml @@ -48,11 +48,6 @@ cloud-utils ${project.version} - - mysql - mysql-connector-java - compile - diff --git a/framework/db/src/com/cloud/dao/EntityManagerImpl.java b/framework/db/src/com/cloud/dao/EntityManagerImpl.java index 499ee3e6405..b531d1a646c 100644 --- a/framework/db/src/com/cloud/dao/EntityManagerImpl.java +++ b/framework/db/src/com/cloud/dao/EntityManagerImpl.java @@ -45,6 +45,7 @@ public class EntityManagerImpl extends ManagerBase implements EntityManager { return dao.findById(id); } + @Override public T findByIdIncludingRemoved(Class entityType, K id) { GenericDao dao = (GenericDao)GenericDaoBase.getDao(entityType); return dao.findByIdIncludingRemoved(id); diff --git a/framework/db/src/com/cloud/utils/db/Filter.java b/framework/db/src/com/cloud/utils/db/Filter.java index b2482fdb3a2..fdcad9c3e54 100755 --- a/framework/db/src/com/cloud/utils/db/Filter.java +++ b/framework/db/src/com/cloud/utils/db/Filter.java @@ -79,7 +79,7 @@ public class Filter { String name = column != null ? column.name() : field; StringBuilder order = new StringBuilder(); - if (column.table() == null || column.table().length() == 0) { + if (column == null || column.table() == null || column.table().length() == 0) { order.append(DbUtil.getTableName(clazz)); } else { order.append(column.table()); diff --git a/framework/db/src/com/cloud/utils/db/GenericDaoBase.java b/framework/db/src/com/cloud/utils/db/GenericDaoBase.java index f282428b8de..cecea84e38e 100755 --- a/framework/db/src/com/cloud/utils/db/GenericDaoBase.java +++ b/framework/db/src/com/cloud/utils/db/GenericDaoBase.java @@ -396,10 +396,10 @@ public abstract class GenericDaoBase extends Compone final List result = new ArrayList(); try { pstmt = txn.prepareAutoCloseStatement(sql); - int i = 0; + int i = 1; if (clause != null) { for (final Pair value : sc.getValues()) { - prepareAttribute(++i, pstmt, value.first(), value.second()); + prepareAttribute(i++, pstmt, value.first(), value.second()); } } @@ -431,10 +431,13 @@ public abstract class GenericDaoBase extends Compone @Override @SuppressWarnings("unchecked") public List customSearchIncludingRemoved(SearchCriteria sc, final Filter filter) { + if (sc == null) { + throw new CloudRuntimeException("Call to customSearchIncludingRemoved with null search Criteria"); + } if (sc.isSelectAll()) { return (List)searchIncludingRemoved((SearchCriteria)sc, filter, null, false); } - String clause = sc != null ? sc.getWhereClause() : null; + String clause = sc.getWhereClause(); if (clause != null && clause.length() == 0) { clause = null; } @@ -445,11 +448,9 @@ public abstract class GenericDaoBase extends Compone } Collection>> joins = null; - if (sc != null) { - joins = sc.getJoins(); - if (joins != null) { - addJoins(str, joins); - } + joins = sc.getJoins(); + if (joins != null) { + addJoins(str, joins); } List groupByValues = addGroupBy(str, sc); @@ -461,10 +462,10 @@ public abstract class GenericDaoBase extends Compone PreparedStatement pstmt = null; try { pstmt = txn.prepareAutoCloseStatement(sql); - int i = 0; + int i = 1; if (clause != null) { for (final Pair value : sc.getValues()) { - prepareAttribute(++i, pstmt, value.first(), value.second()); + prepareAttribute(i++, pstmt, value.first(), value.second()); } } @@ -553,7 +554,7 @@ public abstract class GenericDaoBase extends Compone final Enum[] enums = (Enum[])field.getType().getEnumConstants(); for (final Enum e : enums) { if ((enumType == EnumType.STRING && e.name().equalsIgnoreCase(rs.getString(index))) || - (enumType == EnumType.ORDINAL && e.ordinal() == rs.getInt(index))) { + (enumType == EnumType.ORDINAL && e.ordinal() == rs.getInt(index))) { field.set(entity, e); return; } @@ -767,7 +768,7 @@ public abstract class GenericDaoBase extends Compone protected int addJoinAttributes(int count, PreparedStatement pstmt, Collection>> joins) throws SQLException { for (JoinBuilder> join : joins) { for (final Pair value : join.getT().getValues()) { - prepareAttribute(++count, pstmt, value.first(), value.second()); + prepareAttribute(count++, pstmt, value.first(), value.second()); } } @@ -1070,6 +1071,8 @@ public abstract class GenericDaoBase extends Compone @DB() protected List addGroupBy(final StringBuilder sql, SearchCriteria sc) { + if (sc == null) + return null; Pair, List> groupBys = sc.getGroupBy(); if (groupBys != null) { groupBys.first().toSql(sql); @@ -1179,6 +1182,10 @@ public abstract class GenericDaoBase extends Compone // FIXME: Does not work for joins. @Override public int expunge(final SearchCriteria sc) { + if (sc == null) { + throw new CloudRuntimeException("Call to throw new expunge with null search Criteria"); + } + final StringBuilder str = new StringBuilder("DELETE FROM "); str.append(_table); str.append(" WHERE "); @@ -1248,18 +1255,18 @@ public abstract class GenericDaoBase extends Compone for (JoinBuilder> join : joins) { StringBuilder onClause = new StringBuilder(); onClause.append(" ") - .append(join.getType().getName()) - .append(" ") - .append(join.getSecondAttribute().table) - .append(" ON ") - .append(join.getFirstAttribute().table) - .append(".") - .append(join.getFirstAttribute().columnName) - .append("=") - .append(join.getSecondAttribute().table) - .append(".") - .append(join.getSecondAttribute().columnName) - .append(" "); + .append(join.getType().getName()) + .append(" ") + .append(join.getSecondAttribute().table) + .append(" ON ") + .append(join.getFirstAttribute().table) + .append(".") + .append(join.getFirstAttribute().columnName) + .append("=") + .append(join.getSecondAttribute().table) + .append(".") + .append(join.getSecondAttribute().columnName) + .append(" "); str.insert(fromIndex, onClause); String whereClause = join.getT().getWhereClause(); if ((whereClause != null) && !"".equals(whereClause)) { @@ -1871,10 +1878,10 @@ public abstract class GenericDaoBase extends Compone PreparedStatement pstmt = null; try { pstmt = txn.prepareAutoCloseStatement(sql); - int i = 0; + int i = 1; if (clause != null) { for (final Pair value : sc.getValues()) { - prepareAttribute(++i, pstmt, value.first(), value.second()); + prepareAttribute(i++, pstmt, value.first(), value.second()); } } diff --git a/framework/db/src/com/cloud/utils/db/GroupBy.java b/framework/db/src/com/cloud/utils/db/GroupBy.java index 716b585ada1..00c0acbe48b 100644 --- a/framework/db/src/com/cloud/utils/db/GroupBy.java +++ b/framework/db/src/com/cloud/utils/db/GroupBy.java @@ -28,31 +28,35 @@ public class GroupBy, T, R> { List> _groupBys; Having _having; - public GroupBy(J builder) { + public GroupBy(final J builder) { + init(builder); + } + + protected void init(final J builder) { _builder = builder; _groupBys = new ArrayList>(); _having = null; - for (Attribute attr : _builder.getSpecifiedAttributes()) { + for (final Attribute attr : _builder.getSpecifiedAttributes()) { _groupBys.add(new Pair(null, attr)); } _builder.getSpecifiedAttributes().clear(); } - public GroupBy group(Object useless) { + public GroupBy group(final Object useless) { _groupBys.add(new Pair(null, _builder.getSpecifiedAttributes().get(0))); _builder.getSpecifiedAttributes().clear(); return this; } - public GroupBy group(Func func, Object useless) { + public GroupBy group(final Func func, final Object useless) { _groupBys.add(new Pair(func, _builder.getSpecifiedAttributes().get(0))); _builder.getSpecifiedAttributes().clear(); return this; } - public J having(Func func, Object obj, Op op, Object value) { + public J having(final Func func, final Object obj, final Op op, final Object value) { assert (_having == null) : "You can only specify one having in a group by"; - List attrs = _builder.getSpecifiedAttributes(); + final List attrs = _builder.getSpecifiedAttributes(); assert attrs.size() == 1 : "You didn't specified an attribute"; _having = new Having(func, attrs.get(0), op, value); @@ -60,12 +64,12 @@ public class GroupBy, T, R> { return _builder; } - public void toSql(StringBuilder builder) { + public void toSql(final StringBuilder builder) { builder.append(" GROUP BY "); - for (Pair groupBy : _groupBys) { + for (final Pair groupBy : _groupBys) { if (groupBy.first() != null) { String func = groupBy.first().toString(); - func.replaceFirst("@", groupBy.second().table + "." + groupBy.second().columnName); + func = func.replaceFirst("@", groupBy.second().table + "." + groupBy.second().columnName); builder.append(func); } else { builder.append(groupBy.second().table + "." + groupBy.second().columnName); @@ -86,18 +90,19 @@ public class GroupBy, T, R> { public Op op; public Object value; - public Having(Func func, Attribute attr, Op op, Object value) { + public Having(final Func func, final Attribute attr, final Op op, final Object value) { this.func = func; this.attr = attr; this.op = op; this.value = value; } - public void toSql(StringBuilder builder) { + public void toSql(final StringBuilder builder) { + builder.append(" HAVING "); if (func != null) { String f = func.toString(); - f.replaceFirst("@", attr.toString()); - builder.append(func); + f = f.replaceFirst("@", attr.toString()); + builder.append(f); } else { builder.append(attr.toString()); } diff --git a/framework/db/src/com/cloud/utils/db/SearchBase.java b/framework/db/src/com/cloud/utils/db/SearchBase.java index da8e19e6c3f..4ec9a41fd48 100644 --- a/framework/db/src/com/cloud/utils/db/SearchBase.java +++ b/framework/db/src/com/cloud/utils/db/SearchBase.java @@ -52,13 +52,13 @@ import com.cloud.utils.exception.CloudRuntimeException; */ public abstract class SearchBase, T, K> { - final Map _attrs; - final Class _entityBeanType; - final Class _resultType; - final GenericDaoBase _dao; + Map _attrs; + Class _entityBeanType; + Class _resultType; + GenericDaoBase _dao; - final ArrayList _conditions; - final ArrayList _specifiedAttrs; + ArrayList _conditions; + ArrayList _specifiedAttrs; protected HashMap>> _joins; protected ArrayList(); } - for (Attribute attr : _specifiedAttrs) { + for (final Attribute attr : _specifiedAttrs) { Field field = null; try { field = _resultType.getDeclaredField(attr.field.getName()); field.setAccessible(true); - } catch (SecurityException e) { - } catch (NoSuchFieldException e) { + } catch (final SecurityException e) { + } catch (final NoSuchFieldException e) { } _selects.add(new Select(Func.NATIVE, attr, field, null)); } @@ -192,14 +195,14 @@ public abstract class SearchBase, T, K> { * @return itself */ @SuppressWarnings("unchecked") - public J join(String name, SearchBase builder, Object joinField1, Object joinField2, JoinBuilder.JoinType joinType) { + public J join(final String name, final SearchBase builder, final Object joinField1, final Object joinField2, final JoinBuilder.JoinType joinType) { assert _entity != null : "SearchBuilder cannot be modified once it has been setup"; assert _specifiedAttrs.size() == 1 : "You didn't select the attribute."; assert builder._entity != null : "SearchBuilder cannot be modified once it has been setup"; assert builder._specifiedAttrs.size() == 1 : "You didn't select the attribute."; assert builder != this : "You can't add yourself, can you? Really think about it!"; - JoinBuilder> t = new JoinBuilder>(builder, _specifiedAttrs.get(0), builder._specifiedAttrs.get(0), joinType); + final JoinBuilder> t = new JoinBuilder>(builder, _specifiedAttrs.get(0), builder._specifiedAttrs.get(0), joinType); if (_joins == null) { _joins = new HashMap>>(); } @@ -214,8 +217,8 @@ public abstract class SearchBase, T, K> { return _selectType; } - protected void set(String name) { - Attribute attr = _attrs.get(name); + protected void set(final String name) { + final Attribute attr = _attrs.get(name); assert (attr != null) : "Searching for a field that's not there: " + name; _specifiedAttrs.add(attr); } @@ -249,12 +252,12 @@ public abstract class SearchBase, T, K> { return _specifiedAttrs; } - protected Condition constructCondition(String conditionName, String cond, Attribute attr, Op op) { + protected Condition constructCondition(final String conditionName, final String cond, final Attribute attr, final Op op) { assert _entity != null : "SearchBuilder cannot be modified once it has been setup"; assert op == null || _specifiedAttrs.size() == 1 : "You didn't select the attribute."; assert op != Op.SC : "Call join"; - Condition condition = new Condition(conditionName, cond, attr, op); + final Condition condition = new Condition(conditionName, cond, attr, op); _conditions.add(condition); _specifiedAttrs.clear(); return condition; @@ -314,7 +317,7 @@ public abstract class SearchBase, T, K> { */ @SuppressWarnings("unchecked") public J cp() { - Condition condition = new Condition(null, " ) ", null, Op.RP); + final Condition condition = new Condition(null, " ) ", null, Op.RP); _conditions.add(condition); return (J)this; } @@ -325,7 +328,7 @@ public abstract class SearchBase, T, K> { */ @SuppressWarnings("unchecked") public J op() { - Condition condition = new Condition(null, " ( ", null, Op.RP); + final Condition condition = new Condition(null, " ( ", null, Op.RP); _conditions.add(condition); return (J)this; } @@ -336,13 +339,13 @@ public abstract class SearchBase, T, K> { @Override protected synchronized void finalize() { if (_entity != null) { - Factory factory = (Factory)_entity; + final Factory factory = (Factory)_entity; factory.setCallback(0, null); _entity = null; } if (_joins != null) { - for (JoinBuilder> join : _joins.values()) { + for (final JoinBuilder> join : _joins.values()) { join.getT().finalize(); } } @@ -353,7 +356,7 @@ public abstract class SearchBase, T, K> { return; } - for (Select select : _selects) { + for (final Select select : _selects) { if (select.field == null) { assert (_selects.size() == 1) : "You didn't specify any fields to put the result in but you're specifying more than one select so where should I put the selects?"; _selectType = SelectType.Single; @@ -375,11 +378,11 @@ public abstract class SearchBase, T, K> { protected final Attribute attr; protected Object[] presets; - protected Condition(String name) { + protected Condition(final String name) { this(name, null, null, null); } - public Condition(String name, String cond, Attribute attr, Op op) { + public Condition(final String name, final String cond, final Attribute attr, final Op op) { this.name = name; this.attr = attr; this.cond = cond; @@ -391,7 +394,7 @@ public abstract class SearchBase, T, K> { return presets != null; } - public void setPresets(Object... presets) { + public void setPresets(final Object... presets) { this.presets = presets; } @@ -399,7 +402,7 @@ public abstract class SearchBase, T, K> { return presets; } - public void toSql(StringBuilder sql, Object[] params, int count) { + public void toSql(final StringBuilder sql, final Object[] params, final int count) { if (count > 0) { sql.append(cond); } @@ -448,12 +451,12 @@ public abstract class SearchBase, T, K> { } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if (!(obj instanceof Condition)) { return false; } - Condition condition = (Condition)obj; + final Condition condition = (Condition)obj; return name.equals(condition.name); } } @@ -467,7 +470,7 @@ public abstract class SearchBase, T, K> { protected Select() { } - public Select(Func func, Attribute attr, Field field, Object[] params) { + public Select(final Func func, final Attribute attr, final Field field, final Object[] params) { this.func = func; this.attr = attr; this.params = params; @@ -477,22 +480,22 @@ public abstract class SearchBase, T, K> { protected class Interceptor implements MethodInterceptor { @Override - public Object intercept(Object object, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { - String name = method.getName(); + public Object intercept(final Object object, final Method method, final Object[] args, final MethodProxy methodProxy) throws Throwable { + final String name = method.getName(); if (method.getAnnotation(Transient.class) == null) { if (name.startsWith("get")) { - String fieldName = Character.toLowerCase(name.charAt(3)) + name.substring(4); + final String fieldName = Character.toLowerCase(name.charAt(3)) + name.substring(4); set(fieldName); return null; } else if (name.startsWith("is")) { - String fieldName = Character.toLowerCase(name.charAt(2)) + name.substring(3); + final String fieldName = Character.toLowerCase(name.charAt(2)) + name.substring(3); set(fieldName); return null; } else { - Column ann = method.getAnnotation(Column.class); + final Column ann = method.getAnnotation(Column.class); if (ann != null) { - String colName = ann.name(); - for (Map.Entry attr : _attrs.entrySet()) { + final String colName = ann.name(); + for (final Map.Entry attr : _attrs.entrySet()) { if (colName.equals(attr.getValue().columnName)) { set(attr.getKey()); return null; diff --git a/framework/db/test/com/cloud/utils/db/GroupByTest.java b/framework/db/test/com/cloud/utils/db/GroupByTest.java new file mode 100644 index 00000000000..d394c73c3fa --- /dev/null +++ b/framework/db/test/com/cloud/utils/db/GroupByTest.java @@ -0,0 +1,81 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// + +package com.cloud.utils.db; + +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; + +import org.junit.Test; + +import com.cloud.utils.Pair; +import com.cloud.utils.db.SearchCriteria.Func; +import com.cloud.utils.db.SearchCriteria.Op; + + +public class GroupByTest { + + protected static final String EXPECTED_QUERY = "BASE GROUP BY FIRST(TEST_TABLE.TEST_COLUMN), MAX(TEST_TABLE.TEST_COLUMN) HAVING COUNT(TEST_TABLE2.TEST_COLUMN2) > ? "; + @Test + public void testToSql() { + // Prepare + final StringBuilder sb = new StringBuilder("BASE"); + final GroupByExtension groupBy = new GroupByExtension(new SearchBaseExtension(String.class, String.class)); + + final Attribute att = new Attribute("TEST_TABLE", "TEST_COLUMN"); + final Pair pair1 = new Pair(SearchCriteria.Func.FIRST, att); + final Pair pair2 = new Pair(SearchCriteria.Func.MAX, att); + groupBy._groupBys = new ArrayList>(); + groupBy._groupBys.add(pair1); + groupBy._groupBys.add(pair2); + groupBy.having(SearchCriteria.Func.COUNT, att, Op.GT, "SOME_VALUE"); + + // Execute + groupBy.toSql(sb); + + // Assert + assertTrue("It didn't create the expected SQL query.", sb.toString().equals(EXPECTED_QUERY)); + } +} + +class GroupByExtension extends GroupBy { + + public GroupByExtension(final SearchBaseExtension builder) { + super(builder); + _builder = builder; + } + + @Override + protected void init(final SearchBaseExtension builder) { + } +} + +@SuppressWarnings({"rawtypes", "unchecked"}) +class SearchBaseExtension extends SearchBase{ + + SearchBaseExtension(final Class entityType, final Class resultType) { + super(entityType, resultType); + _specifiedAttrs = new ArrayList(); + _specifiedAttrs.add(new Attribute("TEST_TABLE2", "TEST_COLUMN2")); + } + + @Override + protected void init(final Class entityType, final Class resultType) { + } +} diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/AsyncJobExecutionContext.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/AsyncJobExecutionContext.java index 20125f43e66..86c65421fde 100644 --- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/AsyncJobExecutionContext.java +++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/AsyncJobExecutionContext.java @@ -29,6 +29,8 @@ import org.apache.cloudstack.managed.threadlocal.ManagedThreadLocal; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.ResourceUnavailableException; +import com.cloud.user.Account; +import com.cloud.user.User; public class AsyncJobExecutionContext { private static final Logger s_logger = Logger.getLogger(AsyncJobExecutionContext.class); @@ -167,10 +169,15 @@ public class AsyncJobExecutionContext { public static AsyncJobExecutionContext getCurrentExecutionContext() { AsyncJobExecutionContext context = s_currentExectionContext.get(); if (context == null) { - // TODO, this has security implicitions + // TODO, this has security implications, operations carried from API layer should always + // set its context, otherwise, the fall-back here will use system security context + // s_logger.warn("Job is executed without a context, setup psudo job for the executing thread"); - context = registerPseudoExecutionContext(CallContext.current().getCallingAccountId(), - CallContext.current().getCallingUserId()); + if (CallContext.current() != null) + context = registerPseudoExecutionContext(CallContext.current().getCallingAccountId(), + CallContext.current().getCallingUserId()); + else + context = registerPseudoExecutionContext(Account.ACCOUNT_ID_SYSTEM, User.UID_SYSTEM); } return context; } @@ -197,7 +204,11 @@ public class AsyncJobExecutionContext { s_currentExectionContext.set(currentContext); } - public static String getOriginJobContextId() { - return String.valueOf(CallContext.current().getContextId()); + public static String getOriginJobId() { + AsyncJobExecutionContext context = AsyncJobExecutionContext.getCurrentExecutionContext(); + if (context != null && context.getJob() != null) + return "" + context.getJob().getId(); + + return ""; } } diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/SyncQueueItemDao.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/SyncQueueItemDao.java index f5ac7b12a9f..7b6eed75a00 100644 --- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/SyncQueueItemDao.java +++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/SyncQueueItemDao.java @@ -24,6 +24,7 @@ import com.cloud.utils.db.GenericDao; public interface SyncQueueItemDao extends GenericDao { public SyncQueueItemVO getNextQueueItem(long queueId); + public int getActiveQueueItemCount(long queueId); public List getNextQueueItems(int maxItems); diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/SyncQueueItemDaoImpl.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/SyncQueueItemDaoImpl.java index 73637634589..41f14190f36 100644 --- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/SyncQueueItemDaoImpl.java +++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/SyncQueueItemDaoImpl.java @@ -36,6 +36,7 @@ import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.GenericSearchBuilder; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.SearchCriteria.Func; import com.cloud.utils.db.SearchCriteria.Op; import com.cloud.utils.db.TransactionLegacy; @@ -43,6 +44,7 @@ import com.cloud.utils.db.TransactionLegacy; public class SyncQueueItemDaoImpl extends GenericDaoBase implements SyncQueueItemDao { private static final Logger s_logger = Logger.getLogger(SyncQueueItemDaoImpl.class); final GenericSearchBuilder queueIdSearch; + final GenericSearchBuilder queueActiveItemSearch; public SyncQueueItemDaoImpl() { super(); @@ -51,6 +53,12 @@ public class SyncQueueItemDaoImpl extends GenericDaoBase queueIdSearch.and("contentType", queueIdSearch.entity().getContentType(), Op.EQ); queueIdSearch.selectFields(queueIdSearch.entity().getId()); queueIdSearch.done(); + + queueActiveItemSearch = createSearchBuilder(Integer.class); + queueActiveItemSearch.and("queueId", queueActiveItemSearch.entity().getQueueId(), Op.EQ); + queueActiveItemSearch.and("processNumber", queueActiveItemSearch.entity().getLastProcessNumber(), Op.NNULL); + queueActiveItemSearch.select(null, Func.COUNT, queueActiveItemSearch.entity().getId()); + queueActiveItemSearch.done(); } @Override @@ -66,19 +74,31 @@ public class SyncQueueItemDaoImpl extends GenericDaoBase Filter filter = new Filter(SyncQueueItemVO.class, "created", true, 0L, 1L); List l = listBy(sc, filter); - if (l != null && l.size() > 0) + if(l != null && l.size() > 0) return l.get(0); return null; } + @Override + public int getActiveQueueItemCount(long queueId) { + SearchCriteria sc = queueActiveItemSearch.create(); + sc.setParameters("queueId", queueId); + + List count = customSearch(sc, null); + return count.get(0); + } + @Override public List getNextQueueItems(int maxItems) { List l = new ArrayList(); - String sql = - "SELECT i.id, i.queue_id, i.content_type, i.content_id, i.created " + " FROM sync_queue AS q JOIN sync_queue_item AS i ON q.id = i.queue_id " - + " WHERE i.queue_proc_number IS NULL " + " GROUP BY q.id " + " ORDER BY i.id " + " LIMIT 0, ?"; + String sql = "SELECT i.id, i.queue_id, i.content_type, i.content_id, i.created " + + " FROM sync_queue AS q JOIN sync_queue_item AS i ON q.id = i.queue_id " + + " WHERE i.queue_proc_number IS NULL " + + " GROUP BY q.id " + + " ORDER BY i.id " + + " LIMIT 0, ?"; TransactionLegacy txn = TransactionLegacy.currentTxn(); PreparedStatement pstmt = null; @@ -86,7 +106,7 @@ public class SyncQueueItemDaoImpl extends GenericDaoBase pstmt = txn.prepareAutoCloseStatement(sql); pstmt.setInt(1, maxItems); ResultSet rs = pstmt.executeQuery(); - while (rs.next()) { + while(rs.next()) { SyncQueueItemVO item = new SyncQueueItemVO(); item.setId(rs.getLong(1)); item.setQueueId(rs.getLong(2)); @@ -106,7 +126,8 @@ public class SyncQueueItemDaoImpl extends GenericDaoBase @Override public List getActiveQueueItems(Long msid, boolean exclusive) { SearchBuilder sb = createSearchBuilder(); - sb.and("lastProcessMsid", sb.entity().getLastProcessMsid(), SearchCriteria.Op.EQ); + sb.and("lastProcessMsid", sb.entity().getLastProcessMsid(), + SearchCriteria.Op.EQ); sb.done(); SearchCriteria sc = sb.create(); @@ -134,7 +155,7 @@ public class SyncQueueItemDaoImpl extends GenericDaoBase SearchCriteria sc = sbItem.create(); sc.setParameters("lastProcessTime2", new Date(cutTime.getTime() - thresholdMs)); - if (exclusive) + if(exclusive) return lockRows(sc, null, true); return listBy(sc, null); } diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java index c3ac0e67b8f..b9246aa395d 100644 --- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java +++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java @@ -24,7 +24,6 @@ import java.util.Date; import java.util.List; import java.util.Map; import java.util.Properties; -import java.util.Random; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.RejectedExecutionException; @@ -35,8 +34,10 @@ import javax.inject.Inject; import javax.naming.ConfigurationException; import org.apache.log4j.Logger; +import org.apache.log4j.NDC; import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.framework.config.ConfigDepot; import org.apache.cloudstack.framework.config.ConfigKey; import org.apache.cloudstack.framework.config.Configurable; @@ -84,12 +85,11 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager, private static final ConfigKey JobExpireMinutes = new ConfigKey(Long.class, "job.expire.minutes", "Advanced", "1440", "Time (in minutes) for async-jobs to be kept in system", true, ConfigKey.Scope.Global, 60l); private static final ConfigKey JobCancelThresholdMinutes = new ConfigKey(Long.class, "job.cancel.threshold.minutes", "Advanced", "60", - "Time (in minutes) for async-jobs to be forcely cancelled if it has been in process for long", true, ConfigKey.Scope.Global, 60l); + "Time (in minutes) for async-jobs to be forcely cancelled if it has been in process for long", true, ConfigKey.Scope.Global, 240l); private static final Logger s_logger = Logger.getLogger(AsyncJobManagerImpl.class); private static final int ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION = 3; // 3 seconds - private static final int ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_SYNC = 60; // 60 seconds private static final int MAX_ONETIME_SCHEDULE_SIZE = 50; private static final int HEARTBEAT_INTERVAL = 2000; @@ -365,23 +365,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager, } SyncQueueVO queue = null; - - // to deal with temporary DB exceptions like DB deadlock/Lock-wait time out cased rollbacks - // we retry five times until we throw an exception - Random random = new Random(); - - for (int i = 0; i < 5; i++) { - queue = _queueMgr.queue(syncObjType, syncObjId, SyncQueueItem.AsyncJobContentType, job.getId(), queueSizeLimit); - if (queue != null) { - break; - } - - try { - Thread.sleep(1000 + random.nextInt(5000)); - } catch (InterruptedException e) { - } - } - + queue = _queueMgr.queue(syncObjType, syncObjId, SyncQueueItem.AsyncJobContentType, job.getId(), queueSizeLimit); if (queue == null) throw new CloudRuntimeException("Unable to insert queue item into database, DB is full?"); } @@ -445,6 +429,24 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager, private Runnable getExecutorRunnable(final AsyncJob job) { return new ManagedContextRunnable() { + + @Override + public void run() { + // register place-holder context to avoid installing system account call context + if (CallContext.current() == null) + CallContext.registerPlaceHolderContext(); + + if (job.getRelated() != null && !job.getRelated().isEmpty()) + NDC.push("Job-" + job.getRelated() + "/" + "Job-" + job.getId()); + else + NDC.push("Job-" + job.getId()); + try { + super.run(); + } finally { + NDC.pop(); + } + } + @Override protected void runInContext() { long runNumber = getJobRunNumber(); @@ -703,14 +705,16 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager, try { s_logger.trace("Begin cleanup expired async-jobs"); - Date cutTime = new Date(DateUtil.currentGMTTime().getTime() - JobExpireMinutes.value() * 1000); + Date cutTime = new Date(DateUtil.currentGMTTime().getTime() - JobExpireMinutes.value() * 60000); // limit to 100 jobs per turn, this gives cleanup throughput as 600 jobs per minute // hopefully this will be fast enough to balance potential growth of job table //1) Expire unfinished jobs that weren't processed yet List l = _jobDao.getExpiredUnfinishedJobs(cutTime, 100); for (AsyncJobVO job : l) { - s_logger.trace("Expunging unfinished job " + job); + s_logger.info("Expunging unfinished job " + job); + + _jobMonitor.unregisterByJobId(job.getId()); expungeAsyncJob(job); } @@ -718,15 +722,19 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager, List completedJobs = _jobDao.getExpiredCompletedJobs(cutTime, 100); for (AsyncJobVO job : completedJobs) { s_logger.trace("Expunging completed job " + job); + expungeAsyncJob(job); } // forcefully cancel blocking queue items if they've been staying there for too long - List blockItems = _queueMgr.getBlockedQueueItems(JobCancelThresholdMinutes.value() * 1000, false); + List blockItems = _queueMgr.getBlockedQueueItems(JobCancelThresholdMinutes.value() * 60000, false); if (blockItems != null && blockItems.size() > 0) { for (SyncQueueItemVO item : blockItems) { if (item.getContentType().equalsIgnoreCase(SyncQueueItem.AsyncJobContentType)) { + s_logger.info("Remove Job-" + item.getContentId() + " from Queue-" + item.getId() + " since it has been blocked for too long"); completeAsyncJob(item.getContentId(), JobInfo.Status.FAILED, 0, "Job is cancelled as it has been blocking others for too long"); + + _jobMonitor.unregisterByJobId(item.getContentId()); } // purge the item and resume queue processing diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobMonitor.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobMonitor.java index 671818130f9..0b6f7a582b0 100644 --- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobMonitor.java +++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobMonitor.java @@ -17,6 +17,7 @@ package org.apache.cloudstack.framework.jobs.impl; import java.util.HashMap; +import java.util.Iterator; import java.util.Map; import java.util.Timer; import java.util.concurrent.atomic.AtomicInteger; @@ -38,8 +39,7 @@ import com.cloud.utils.component.ManagerBase; public class AsyncJobMonitor extends ManagerBase { public static final Logger s_logger = Logger.getLogger(AsyncJobMonitor.class); - @Inject - private MessageBus _messageBus; + @Inject private MessageBus _messageBus; private final Map _activeTasks = new HashMap(); private final Timer _timer = new Timer(); @@ -86,15 +86,16 @@ public class AsyncJobMonitor extends ManagerBase { synchronized (this) { for (Map.Entry entry : _activeTasks.entrySet()) { if (entry.getValue().millisSinceLastJobHeartbeat() > _inactivityWarningThresholdMs) { - s_logger.warn("Task (job-" + entry.getValue().getJobId() + ") has been pending for " + entry.getValue().millisSinceLastJobHeartbeat() / 1000 + - " seconds"); + s_logger.warn("Task (job-" + entry.getValue().getJobId() + ") has been pending for " + + entry.getValue().millisSinceLastJobHeartbeat() / 1000 + " seconds"); } } } } @Override - public boolean configure(String name, Map params) throws ConfigurationException { + public boolean configure(String name, Map params) + throws ConfigurationException { _messageBus.subscribe(AsyncJob.Topics.JOB_HEARTBEAT, MessageDispatcher.getDispatcher(this)); _timer.scheduleAtFixedRate(new ManagedContextTimerTask() { @@ -141,6 +142,25 @@ public class AsyncJobMonitor extends ManagerBase { } } + public void unregisterByJobId(long jobId) { + synchronized (this) { + Iterator> it = _activeTasks.entrySet().iterator(); + while (it.hasNext()) { + Map.Entry entry = it.next(); + if (entry.getValue().getJobId() == jobId) { + s_logger.info("Remove Job-" + entry.getValue().getJobId() + " from job monitoring due to job cancelling"); + + if (entry.getValue().isPoolThread()) + _activePoolThreads.decrementAndGet(); + else + _activeInplaceThreads.decrementAndGet(); + + it.remove(); + } + } + } + } + public int getActivePoolThreads() { return _activePoolThreads.get(); } diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobVO.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobVO.java index 24af392f0f4..d1ee2df7598 100644 --- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobVO.java +++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobVO.java @@ -132,7 +132,7 @@ public class AsyncJobVO implements AsyncJob, JobInfo { public AsyncJobVO() { uuid = UUID.randomUUID().toString(); - related = UUID.randomUUID().toString(); + related = ""; status = Status.IN_PROGRESS; } diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/SyncQueueManagerImpl.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/SyncQueueManagerImpl.java index 09974a1c133..d8e26748e18 100644 --- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/SyncQueueManagerImpl.java +++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/SyncQueueManagerImpl.java @@ -242,18 +242,15 @@ public class SyncQueueManagerImpl extends ManagerBase implements SyncQueueManage } private boolean queueReadyToProcess(SyncQueueVO queueVO) { - return true; + int nActiveItems = _syncQueueItemDao.getActiveQueueItemCount(queueVO.getId()); + if (nActiveItems < queueVO.getQueueSizeLimit()) + return true; - // - // TODO - // - // Need to disable concurrency disable at queue level due to the need to support - // job wake-up dispatching task - // - // Concurrency control is better done at higher level and leave the job scheduling/serializing simpler - // - - // return queueVO.getQueueSize() < queueVO.getQueueSizeLimit(); + if (s_logger.isDebugEnabled()) + s_logger.debug("Queue (queue id, sync type, sync id) - (" + queueVO.getId() + + "," + queueVO.getSyncObjType() + ", " + queueVO.getSyncObjId() + + ") is reaching concurrency limit " + queueVO.getQueueSizeLimit()); + return false; } @Override diff --git a/framework/managed-context/src/main/java/org/apache/cloudstack/managed/context/ManagedContextRunnable.java b/framework/managed-context/src/main/java/org/apache/cloudstack/managed/context/ManagedContextRunnable.java index d33521501f4..b4a9758420b 100644 --- a/framework/managed-context/src/main/java/org/apache/cloudstack/managed/context/ManagedContextRunnable.java +++ b/framework/managed-context/src/main/java/org/apache/cloudstack/managed/context/ManagedContextRunnable.java @@ -42,7 +42,7 @@ public abstract class ManagedContextRunnable implements Runnable { } @Override - final public void run() { + public void run() { getContext().runWithContext(new Runnable() { @Override public void run() { diff --git a/framework/pom.xml b/framework/pom.xml index 505c49e99c4..a1f4321e98f 100644 --- a/framework/pom.xml +++ b/framework/pom.xml @@ -28,6 +28,19 @@ install + + + org.apache.maven.plugins + maven-checkstyle-plugin + + + cloudstack-checkstyle + none + false + + + + ipc diff --git a/packaging/centos63/cloud-agent.rc b/packaging/centos63/cloud-agent.rc index ab49524af4b..40c358e36b6 100755 --- a/packaging/centos63/cloud-agent.rc +++ b/packaging/centos63/cloud-agent.rc @@ -24,12 +24,10 @@ . /etc/rc.d/init.d/functions -whatami=cloudstack-agent - # set environment variables -SHORTNAME="$whatami" -PIDFILE=/var/run/"$whatami".pid +SHORTNAME="$0" +PIDFILE=/var/run/"$SHORTNAME".pid LOCKFILE=/var/lock/subsys/"$SHORTNAME" LOGDIR=/var/log/cloudstack/agent LOGFILE=${LOGDIR}/agent.log @@ -112,7 +110,7 @@ case "$1" in fi ;; *) - echo $"Usage: $whatami {start|stop|restart|condrestart|status|help}" + echo $"Usage: $SHORTNAME {start|stop|restart|condrestart|status|help}" RETVAL=3 esac diff --git a/packaging/centos63/cloud-ipallocator.rc b/packaging/centos63/cloud-ipallocator.rc index 08cf9c88a0f..9a24d8dfc8a 100755 --- a/packaging/centos63/cloud-ipallocator.rc +++ b/packaging/centos63/cloud-ipallocator.rc @@ -23,12 +23,10 @@ . /etc/rc.d/init.d/functions -whatami=cloud-external-ipallocator - # set environment variables -SHORTNAME="$whatami" -PIDFILE=/var/run/"$whatami".pid +SHORTNAME="$0" +PIDFILE=/var/run/"$SHORTNAME".pid LOCKFILE=/var/lock/subsys/"$SHORTNAME" LOGFILE=/var/log/cloudstack/ipallocator/ipallocator.log PROGNAME="External IPAllocator" @@ -90,7 +88,7 @@ case "$1" in fi ;; *) - echo $"Usage: $whatami {start|stop|restart|condrestart|status|help}" + echo $"Usage: $SHORTNAME {start|stop|restart|condrestart|status|help}" RETVAL=3 esac diff --git a/packaging/centos63/package.sh b/packaging/centos63/package.sh index 04b92586514..fa004afff33 100755 --- a/packaging/centos63/package.sh +++ b/packaging/centos63/package.sh @@ -17,101 +17,93 @@ # under the License. function usage() { - echo "" - echo "usage: ./package.sh [-p|--pack] [-h|--help] [ARGS]" - echo "" - echo "The commonly used Arguments are:" - echo "oss|OSS To package with only redistributable libraries (default)" - echo "noredist|NOREDIST To package with non-redistributable libraries" - echo "" - echo "Examples: ./package.sh -p|--pack oss|OSS" - echo " ./package.sh -p|--pack noredist|NOREDIST" - echo " ./package.sh (Default OSS)" - exit 1 + echo "" + echo "usage: ./package.sh [-p|--pack] [-h|--help] [ARGS]" + echo "" + echo "The commonly used Arguments are:" + echo "oss|OSS To package with only redistributable libraries (default)" + echo "noredist|NOREDIST To package with non-redistributable libraries" + echo "" + echo "Examples: ./package.sh -p|--pack oss|OSS" + echo " ./package.sh -p|--pack noredist|NOREDIST" + echo " ./package.sh (Default OSS)" + exit 1 } function packaging() { - -CWD=`pwd` -RPMDIR=$CWD/../../dist/rpmbuild -PACK_PROJECT=cloudstack -if [ -n "$1" ] ; then - DEFOSSNOSS="-D_ossnoss $packageval" -fi + CWD=`pwd` + RPMDIR=$CWD/../../dist/rpmbuild + PACK_PROJECT=cloudstack + if [ -n "$1" ] ; then + DEFOSSNOSS="-D_ossnoss $packageval" + fi + VERSION=`(cd ../../; mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version) | grep --color=none '^[0-9]\.'` + if echo $VERSION | grep SNAPSHOT ; then + REALVER=`echo $VERSION | cut -d '-' -f 1` + DEFVER="-D_ver $REALVER" + DEFPRE="-D_prerelease 1" + DEFREL="-D_rel SNAPSHOT" + else + REALVER=`echo $VERSION` + DEFVER="-D_ver $REALVER" + DEFREL="-D_rel 1" + fi -VERSION=`(cd ../../; mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version) | grep '^[0-9]\.'` -if echo $VERSION | grep SNAPSHOT ; then - REALVER=`echo $VERSION | cut -d '-' -f 1` - DEFVER="-D_ver $REALVER" - DEFPRE="-D_prerelease 1" - DEFREL="-D_rel SNAPSHOT" -else - REALVER=`echo $VERSION` - DEFVER="-D_ver $REALVER" - DEFREL="-D_rel 1" -fi + mkdir -p $RPMDIR/SPECS + mkdir -p $RPMDIR/BUILD + mkdir -p $RPMDIR/RPMS + mkdir -p $RPMDIR/SRPMS + mkdir -p $RPMDIR/SOURCES/$PACK_PROJECT-$VERSION -mkdir -p $RPMDIR/SPECS -mkdir -p $RPMDIR/BUILD -mkdir -p $RPMDIR/RPMS -mkdir -p $RPMDIR/SRPMS -mkdir -p $RPMDIR/SOURCES/$PACK_PROJECT-$VERSION + (cd ../../; tar -c --exclude .git --exclude dist . | tar -C $RPMDIR/SOURCES/$PACK_PROJECT-$VERSION -x ) + (cd $RPMDIR/SOURCES/; tar -czf $PACK_PROJECT-$VERSION.tgz $PACK_PROJECT-$VERSION) + cp cloud.spec $RPMDIR/SPECS -(cd ../../; tar -c --exclude .git --exclude dist . | tar -C $RPMDIR/SOURCES/$PACK_PROJECT-$VERSION -x ) -(cd $RPMDIR/SOURCES/; tar -czf $PACK_PROJECT-$VERSION.tgz $PACK_PROJECT-$VERSION) + (cd $RPMDIR; rpmbuild --define "_topdir $RPMDIR" "${DEFVER}" "${DEFREL}" ${DEFPRE+"${DEFPRE}"} ${DEFOSSNOSS+"$DEFOSSNOSS"} -bb SPECS/cloud.spec) -cp cloud.spec $RPMDIR/SPECS - -(cd $RPMDIR; rpmbuild --define "_topdir $RPMDIR" "${DEFVER}" "${DEFREL}" ${DEFPRE+"${DEFPRE}"} ${DEFOSSNOSS+"$DEFOSSNOSS"} -bb SPECS/cloud.spec) - -exit + exit } - if [ $# -lt 1 ] ; then - - packaging - + packaging elif [ $# -gt 0 ] ; then + SHORTOPTS="hp:" + LONGOPTS="help,pack:" - SHORTOPTS="hp:" - LONGOPTS="help,pack:" - - ARGS=$(getopt -s bash -u -a --options $SHORTOPTS --longoptions $LONGOPTS --name $0 -- "$@" ) - eval set -- "$ARGS" - - while [ $# -gt 0 ] ; do - case "$1" in - -h | --help) - usage - exit 0 - ;; - -p | --pack) - echo "Doing CloudStack Packaging ....." - packageval=$2 - if [ "$packageval" == "oss" -o "$packageval" == "OSS" ] ; then - packaging - elif [ "$packageval" == "noredist" -o "$packageval" == "NOREDIST" ] ; then - packaging noredist - else - echo "Error: Incorrect value provided in package.sh script, Please see help ./package.sh --help|-h for more details." - exit 1 - fi - ;; - -) - echo "Unrecognized option..." - usage - exit 1 - ;; - *) - shift - ;; - esac - done + ARGS=$(getopt -s bash -u -a --options $SHORTOPTS --longoptions $LONGOPTS --name $0 -- "$@" ) + eval set -- "$ARGS" + while [ $# -gt 0 ] ; do + case "$1" in + -h | --help) + usage + exit 0 + ;; + -p | --pack) + echo "Doing CloudStack Packaging ....." + packageval=$2 + if [ "$packageval" == "oss" -o "$packageval" == "OSS" ] ; then + packaging + elif [ "$packageval" == "noredist" -o "$packageval" == "NOREDIST" ] ; then + packaging noredist + else + echo "Error: Incorrect value provided in package.sh script, Please see help ./package.sh --help|-h for more details." + exit 1 + fi + ;; + -) + echo "Unrecognized option..." + usage + exit 1 + ;; + *) + shift + ;; + esac + done else - echo "Incorrect choice. Nothing to do." >&2 - echo "Please, execute ./package.sh --help for more help" + echo "Incorrect choice. Nothing to do." >&2 + echo "Please, execute ./package.sh --help for more help" fi diff --git a/plugins/api/discovery/src/org/apache/cloudstack/api/command/user/discovery/ListApisCmd.java b/plugins/api/discovery/src/org/apache/cloudstack/api/command/user/discovery/ListApisCmd.java index 206d79322f3..be0d5d53260 100644 --- a/plugins/api/discovery/src/org/apache/cloudstack/api/command/user/discovery/ListApisCmd.java +++ b/plugins/api/discovery/src/org/apache/cloudstack/api/command/user/discovery/ListApisCmd.java @@ -36,7 +36,9 @@ import com.cloud.user.User; @APICommand(name = "listApis", responseObject = ApiDiscoveryResponse.class, description = "lists all available apis on the server, provided by the Api Discovery plugin", - since = "4.1.0") + since = "4.1.0", + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class ListApisCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(ListApisCmd.class.getName()); diff --git a/plugins/api/rate-limit/src/org/apache/cloudstack/api/command/admin/ratelimit/ResetApiLimitCmd.java b/plugins/api/rate-limit/src/org/apache/cloudstack/api/command/admin/ratelimit/ResetApiLimitCmd.java index 9e415e64510..fab68e3856c 100644 --- a/plugins/api/rate-limit/src/org/apache/cloudstack/api/command/admin/ratelimit/ResetApiLimitCmd.java +++ b/plugins/api/rate-limit/src/org/apache/cloudstack/api/command/admin/ratelimit/ResetApiLimitCmd.java @@ -37,7 +37,8 @@ import org.apache.cloudstack.ratelimit.ApiRateLimitService; import com.cloud.configuration.Config; import com.cloud.user.Account; -@APICommand(name = "resetApiLimit", responseObject = ApiLimitResponse.class, description = "Reset api count") +@APICommand(name = "resetApiLimit", responseObject = ApiLimitResponse.class, description = "Reset api count", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ResetApiLimitCmd extends BaseCmd { private static final Logger s_logger = Logger.getLogger(ResetApiLimitCmd.class.getName()); diff --git a/plugins/api/rate-limit/src/org/apache/cloudstack/api/command/user/ratelimit/GetApiLimitCmd.java b/plugins/api/rate-limit/src/org/apache/cloudstack/api/command/user/ratelimit/GetApiLimitCmd.java index 24288957563..51b2064fa90 100644 --- a/plugins/api/rate-limit/src/org/apache/cloudstack/api/command/user/ratelimit/GetApiLimitCmd.java +++ b/plugins/api/rate-limit/src/org/apache/cloudstack/api/command/user/ratelimit/GetApiLimitCmd.java @@ -32,7 +32,8 @@ import org.apache.cloudstack.ratelimit.ApiRateLimitService; import com.cloud.configuration.Config; import com.cloud.user.Account; -@APICommand(name = "getApiLimit", responseObject = ApiLimitResponse.class, description = "Get API limit count for the caller") +@APICommand(name = "getApiLimit", responseObject = ApiLimitResponse.class, description = "Get API limit count for the caller", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class GetApiLimitCmd extends BaseCmd { private static final Logger s_logger = Logger.getLogger(GetApiLimitCmd.class.getName()); diff --git a/plugins/database/mysql-ha/pom.xml b/plugins/database/mysql-ha/pom.xml new file mode 100644 index 00000000000..5ce6d6f52b1 --- /dev/null +++ b/plugins/database/mysql-ha/pom.xml @@ -0,0 +1,28 @@ + + + 4.0.0 + cloud-plugin-database-mysqlha + Apache CloudStack Plugin - MySQL HA Strategy + + org.apache.cloudstack + cloudstack-plugins + 4.4.0-SNAPSHOT + ../pom.xml + + + + mysql + mysql-connector-java + provided + + + diff --git a/framework/db/src/com/cloud/utils/db/StaticStrategy.java b/plugins/database/mysql-ha/src/com/cloud/utils/db/StaticStrategy.java similarity index 100% rename from framework/db/src/com/cloud/utils/db/StaticStrategy.java rename to plugins/database/mysql-ha/src/com/cloud/utils/db/StaticStrategy.java diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicateClusterCmd.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicateClusterCmd.java index 4f8cd8ca570..9ef642e8d31 100644 --- a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicateClusterCmd.java +++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicateClusterCmd.java @@ -39,7 +39,8 @@ import com.cloud.dc.DedicatedResources; import com.cloud.event.EventTypes; import com.cloud.user.Account; -@APICommand(name = "dedicateCluster", description = "Dedicate an existing cluster", responseObject = DedicateClusterResponse.class) +@APICommand(name = "dedicateCluster", description = "Dedicate an existing cluster", responseObject = DedicateClusterResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DedicateClusterCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DedicateClusterCmd.class.getName()); diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicateHostCmd.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicateHostCmd.java index d3cce5ae5e7..978821a1f0c 100644 --- a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicateHostCmd.java +++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicateHostCmd.java @@ -39,7 +39,8 @@ import com.cloud.dc.DedicatedResources; import com.cloud.event.EventTypes; import com.cloud.user.Account; -@APICommand(name = "dedicateHost", description = "Dedicates a host.", responseObject = DedicateHostResponse.class) +@APICommand(name = "dedicateHost", description = "Dedicates a host.", responseObject = DedicateHostResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DedicateHostCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DedicateHostCmd.class.getName()); private static final String s_name = "dedicatehostresponse"; diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicatePodCmd.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicatePodCmd.java index e823fd55491..d18f02d686f 100644 --- a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicatePodCmd.java +++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicatePodCmd.java @@ -39,7 +39,8 @@ import com.cloud.dc.DedicatedResources; import com.cloud.event.EventTypes; import com.cloud.user.Account; -@APICommand(name = "dedicatePod", description = "Dedicates a Pod.", responseObject = DedicatePodResponse.class) +@APICommand(name = "dedicatePod", description = "Dedicates a Pod.", responseObject = DedicatePodResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DedicatePodCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DedicatePodCmd.class.getName()); diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicateZoneCmd.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicateZoneCmd.java index 0e427aaa26d..ee71dfecc41 100644 --- a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicateZoneCmd.java +++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/DedicateZoneCmd.java @@ -39,7 +39,8 @@ import com.cloud.dc.DedicatedResources; import com.cloud.event.EventTypes; import com.cloud.user.Account; -@APICommand(name = "dedicateZone", description = "Dedicates a zones.", responseObject = DedicateZoneResponse.class) +@APICommand(name = "dedicateZone", description = "Dedicates a zones.", responseObject = DedicateZoneResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DedicateZoneCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DedicateZoneCmd.class.getName()); diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedClustersCmd.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedClustersCmd.java index a2022a53e0b..a8c192dcd8e 100644 --- a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedClustersCmd.java +++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedClustersCmd.java @@ -40,7 +40,8 @@ import com.cloud.dc.DedicatedResourceVO; import com.cloud.dc.DedicatedResources; import com.cloud.utils.Pair; -@APICommand(name = "listDedicatedClusters", description = "Lists dedicated clusters.", responseObject = DedicateClusterResponse.class) +@APICommand(name = "listDedicatedClusters", description = "Lists dedicated clusters.", responseObject = DedicateClusterResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListDedicatedClustersCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListDedicatedClustersCmd.class.getName()); diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedHostsCmd.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedHostsCmd.java index d3b326d5a29..3c167e8966a 100644 --- a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedHostsCmd.java +++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedHostsCmd.java @@ -40,7 +40,8 @@ import com.cloud.dc.DedicatedResourceVO; import com.cloud.dc.DedicatedResources; import com.cloud.utils.Pair; -@APICommand(name = "listDedicatedHosts", description = "Lists dedicated hosts.", responseObject = DedicateHostResponse.class) +@APICommand(name = "listDedicatedHosts", description = "Lists dedicated hosts.", responseObject = DedicateHostResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListDedicatedHostsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListDedicatedHostsCmd.class.getName()); diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedPodsCmd.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedPodsCmd.java index d7cd4c26f16..5198e49e7a3 100644 --- a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedPodsCmd.java +++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedPodsCmd.java @@ -40,7 +40,8 @@ import com.cloud.dc.DedicatedResourceVO; import com.cloud.dc.DedicatedResources; import com.cloud.utils.Pair; -@APICommand(name = "listDedicatedPods", description = "Lists dedicated pods.", responseObject = DedicatePodResponse.class) +@APICommand(name = "listDedicatedPods", description = "Lists dedicated pods.", responseObject = DedicatePodResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListDedicatedPodsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListDedicatedPodsCmd.class.getName()); diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedZonesCmd.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedZonesCmd.java index 07b8b19bb75..e75b73b2e4b 100644 --- a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedZonesCmd.java +++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ListDedicatedZonesCmd.java @@ -40,7 +40,8 @@ import com.cloud.dc.DedicatedResourceVO; import com.cloud.dc.DedicatedResources; import com.cloud.utils.Pair; -@APICommand(name = "listDedicatedZones", description = "List dedicated zones.", responseObject = DedicateZoneResponse.class) +@APICommand(name = "listDedicatedZones", description = "List dedicated zones.", responseObject = DedicateZoneResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListDedicatedZonesCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListDedicatedZonesCmd.class.getName()); diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedClusterCmd.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedClusterCmd.java index e065da2c0c2..b1ec3605da5 100644 --- a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedClusterCmd.java +++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedClusterCmd.java @@ -33,7 +33,8 @@ import org.apache.cloudstack.dedicated.DedicatedService; import com.cloud.event.EventTypes; import com.cloud.user.Account; -@APICommand(name = "releaseDedicatedCluster", description = "Release the dedication for cluster", responseObject = SuccessResponse.class) +@APICommand(name = "releaseDedicatedCluster", description = "Release the dedication for cluster", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ReleaseDedicatedClusterCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ReleaseDedicatedClusterCmd.class.getName()); diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedHostCmd.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedHostCmd.java index 41e668c0e41..bddef135688 100644 --- a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedHostCmd.java +++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedHostCmd.java @@ -33,7 +33,8 @@ import org.apache.cloudstack.dedicated.DedicatedService; import com.cloud.event.EventTypes; import com.cloud.user.Account; -@APICommand(name = "releaseDedicatedHost", description = "Release the dedication for host", responseObject = SuccessResponse.class) +@APICommand(name = "releaseDedicatedHost", description = "Release the dedication for host", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ReleaseDedicatedHostCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ReleaseDedicatedHostCmd.class.getName()); diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedPodCmd.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedPodCmd.java index 47ea475e0fc..f764e8abed1 100644 --- a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedPodCmd.java +++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedPodCmd.java @@ -33,7 +33,8 @@ import org.apache.cloudstack.dedicated.DedicatedService; import com.cloud.event.EventTypes; import com.cloud.user.Account; -@APICommand(name = "releaseDedicatedPod", description = "Release the dedication for the pod", responseObject = SuccessResponse.class) +@APICommand(name = "releaseDedicatedPod", description = "Release the dedication for the pod", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ReleaseDedicatedPodCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ReleaseDedicatedPodCmd.class.getName()); diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedZoneCmd.java b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedZoneCmd.java index 69185d62dc9..df04491e2c7 100644 --- a/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedZoneCmd.java +++ b/plugins/dedicated-resources/src/org/apache/cloudstack/api/commands/ReleaseDedicatedZoneCmd.java @@ -33,7 +33,8 @@ import org.apache.cloudstack.dedicated.DedicatedService; import com.cloud.event.EventTypes; import com.cloud.user.Account; -@APICommand(name = "releaseDedicatedZone", description = "Release dedication of zone", responseObject = SuccessResponse.class) +@APICommand(name = "releaseDedicatedZone", description = "Release dedication of zone", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ReleaseDedicatedZoneCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ReleaseDedicatedZoneCmd.class.getName()); diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/dedicated/DedicatedResourceManagerImpl.java b/plugins/dedicated-resources/src/org/apache/cloudstack/dedicated/DedicatedResourceManagerImpl.java index b82b361f7e8..1e584c38bd6 100755 --- a/plugins/dedicated-resources/src/org/apache/cloudstack/dedicated/DedicatedResourceManagerImpl.java +++ b/plugins/dedicated-resources/src/org/apache/cloudstack/dedicated/DedicatedResourceManagerImpl.java @@ -158,14 +158,14 @@ public class DedicatedResourceManagerImpl implements DedicatedService { throw new CloudRuntimeException("Pod " + pod.getName() + " under this Zone " + dc.getName() + " is dedicated to different account/domain"); } if (accountId != null) { - if (dPod.getAccountId() == accountId) { + if (dPod.getAccountId().equals(accountId)) { podsToRelease.add(dPod); } else { s_logger.error("Pod " + pod.getName() + " under this Zone " + dc.getName() + " is dedicated to different account/domain"); throw new CloudRuntimeException("Pod " + pod.getName() + " under this Zone " + dc.getName() + " is dedicated to different account/domain"); } } else { - if (dPod.getAccountId() == null && dPod.getDomainId() == domainId) { + if (dPod.getAccountId() == null && dPod.getDomainId().equals(domainId)) { podsToRelease.add(dPod); } } @@ -184,7 +184,7 @@ public class DedicatedResourceManagerImpl implements DedicatedService { throw new CloudRuntimeException("Cluster " + cluster.getName() + " under this Zone " + dc.getName() + " is dedicated to different account/domain"); } if (accountId != null) { - if (dCluster.getAccountId() == accountId) { + if (dCluster.getAccountId().equals(accountId)) { clustersToRelease.add(dCluster); } else { s_logger.error("Cluster " + cluster.getName() + " under this Zone " + dc.getName() + " is dedicated to different account/domain"); @@ -192,7 +192,7 @@ public class DedicatedResourceManagerImpl implements DedicatedService { " is dedicated to different account/domain"); } } else { - if (dCluster.getAccountId() == null && dCluster.getDomainId() == domainId) { + if (dCluster.getAccountId() == null && dCluster.getDomainId().equals(domainId)) { clustersToRelease.add(dCluster); } } @@ -211,14 +211,14 @@ public class DedicatedResourceManagerImpl implements DedicatedService { throw new CloudRuntimeException("Host " + host.getName() + " under this Zone " + dc.getName() + " is dedicated to different account/domain"); } if (accountId != null) { - if (dHost.getAccountId() == accountId) { + if (dHost.getAccountId().equals(accountId)) { hostsToRelease.add(dHost); } else { s_logger.error("Host " + host.getName() + " under this Zone " + dc.getName() + " is dedicated to different account/domain"); throw new CloudRuntimeException("Host " + host.getName() + " under this Zone " + dc.getName() + " is dedicated to different account/domain"); } } else { - if (dHost.getAccountId() == null && dHost.getDomainId() == domainId) { + if (dHost.getAccountId() == null && dHost.getDomainId().equals(domainId)) { hostsToRelease.add(dHost); } } @@ -300,7 +300,7 @@ public class DedicatedResourceManagerImpl implements DedicatedService { boolean domainIdInChildreanList = getDomainChildIds(dedicatedZoneOfPod.getDomainId()).contains(domainId); //can dedicate a pod to an account/domain if zone is dedicated to parent-domain if (dedicatedZoneOfPod.getAccountId() != null || (accountId == null && !domainIdInChildreanList) || - (accountId != null && !(dedicatedZoneOfPod.getDomainId() == domainId || domainIdInChildreanList))) { + (accountId != null && !(dedicatedZoneOfPod.getDomainId().equals(domainId) || domainIdInChildreanList))) { DataCenterVO zone = _zoneDao.findById(pod.getDataCenterId()); s_logger.error("Cannot dedicate Pod. Its zone is already dedicated"); throw new CloudRuntimeException("Pod's Zone " + zone.getName() + " is already dedicated"); @@ -320,7 +320,7 @@ public class DedicatedResourceManagerImpl implements DedicatedService { /*if all dedicated resources belongs to same account and domain then we should release dedication and make new entry for this Pod*/ if (accountId != null) { - if (dCluster.getAccountId() == accountId) { + if (dCluster.getAccountId().equals(accountId)) { clustersToRelease.add(dCluster); } else { s_logger.error("Cluster " + cluster.getName() + " under this Pod " + pod.getName() + " is dedicated to different account/domain"); @@ -328,7 +328,7 @@ public class DedicatedResourceManagerImpl implements DedicatedService { " is dedicated to different account/domain"); } } else { - if (dCluster.getAccountId() == null && dCluster.getDomainId() == domainId) { + if (dCluster.getAccountId() == null && dCluster.getDomainId().equals(domainId)) { clustersToRelease.add(dCluster); } } @@ -347,14 +347,14 @@ public class DedicatedResourceManagerImpl implements DedicatedService { throw new CloudRuntimeException("Host " + host.getName() + " under this Pod " + pod.getName() + " is dedicated to different account/domain"); } if (accountId != null) { - if (dHost.getAccountId() == accountId) { + if (dHost.getAccountId().equals(accountId)) { hostsToRelease.add(dHost); } else { s_logger.error("Host " + host.getName() + " under this Pod " + pod.getName() + " is dedicated to different account/domain"); throw new CloudRuntimeException("Host " + host.getName() + " under this Pod " + pod.getName() + " is dedicated to different account/domain"); } } else { - if (dHost.getAccountId() == null && dHost.getDomainId() == domainId) { + if (dHost.getAccountId() == null && dHost.getDomainId().equals(domainId)) { hostsToRelease.add(dHost); } } @@ -429,7 +429,7 @@ public class DedicatedResourceManagerImpl implements DedicatedService { boolean domainIdInChildreanList = getDomainChildIds(dedicatedPodOfCluster.getDomainId()).contains(domainId); //can dedicate a cluster to an account/domain if pod is dedicated to parent-domain if (dedicatedPodOfCluster.getAccountId() != null || (accountId == null && !domainIdInChildreanList) || - (accountId != null && !(dedicatedPodOfCluster.getDomainId() == domainId || domainIdInChildreanList))) { + (accountId != null && !(dedicatedPodOfCluster.getDomainId().equals(domainId) || domainIdInChildreanList))) { s_logger.error("Cannot dedicate Cluster. Its Pod is already dedicated"); HostPodVO pod = _podDao.findById(cluster.getPodId()); throw new CloudRuntimeException("Cluster's Pod " + pod.getName() + " is already dedicated"); @@ -440,7 +440,7 @@ public class DedicatedResourceManagerImpl implements DedicatedService { boolean domainIdInChildreanList = getDomainChildIds(dedicatedZoneOfCluster.getDomainId()).contains(domainId); //can dedicate a cluster to an account/domain if zone is dedicated to parent-domain if (dedicatedZoneOfCluster.getAccountId() != null || (accountId == null && !domainIdInChildreanList) || - (accountId != null && !(dedicatedZoneOfCluster.getDomainId() == domainId || domainIdInChildreanList))) { + (accountId != null && !(dedicatedZoneOfCluster.getDomainId().equals(domainId) || domainIdInChildreanList))) { s_logger.error("Cannot dedicate Cluster. Its zone is already dedicated"); DataCenterVO zone = _zoneDao.findById(cluster.getDataCenterId()); throw new CloudRuntimeException("Cluster's Zone " + zone.getName() + " is already dedicated"); @@ -460,14 +460,14 @@ public class DedicatedResourceManagerImpl implements DedicatedService { /*if all dedicated resources belongs to same account and domain then we should release dedication and make new entry for this cluster */ if (accountId != null) { - if (dHost.getAccountId() == accountId) { + if (dHost.getAccountId().equals(accountId)) { hostsToRelease.add(dHost); } else { s_logger.error("Cannot dedicate Cluster " + cluster.getName() + " to account" + accountName); throw new CloudRuntimeException("Cannot dedicate Cluster " + cluster.getName() + " to account" + accountName); } } else { - if (dHost.getAccountId() == null && dHost.getDomainId() == domainId) { + if (dHost.getAccountId() == null && dHost.getDomainId().equals(domainId)) { hostsToRelease.add(dHost); } } @@ -544,7 +544,7 @@ public class DedicatedResourceManagerImpl implements DedicatedService { boolean domainIdInChildreanList = getDomainChildIds(dedicatedClusterOfHost.getDomainId()).contains(domainId); //can dedicate a host to an account/domain if cluster is dedicated to parent-domain if (dedicatedClusterOfHost.getAccountId() != null || (accountId == null && !domainIdInChildreanList) || - (accountId != null && !(dedicatedClusterOfHost.getDomainId() == domainId || domainIdInChildreanList))) { + (accountId != null && !(dedicatedClusterOfHost.getDomainId().equals(domainId) || domainIdInChildreanList))) { ClusterVO cluster = _clusterDao.findById(host.getClusterId()); s_logger.error("Host's Cluster " + cluster.getName() + " is already dedicated"); throw new CloudRuntimeException("Host's Cluster " + cluster.getName() + " is already dedicated"); @@ -555,7 +555,7 @@ public class DedicatedResourceManagerImpl implements DedicatedService { boolean domainIdInChildreanList = getDomainChildIds(dedicatedPodOfHost.getDomainId()).contains(domainId); //can dedicate a host to an account/domain if pod is dedicated to parent-domain if (dedicatedPodOfHost.getAccountId() != null || (accountId == null && !domainIdInChildreanList) || - (accountId != null && !(dedicatedPodOfHost.getDomainId() == domainId || domainIdInChildreanList))) { + (accountId != null && !(dedicatedPodOfHost.getDomainId().equals(domainId) || domainIdInChildreanList))) { HostPodVO pod = _podDao.findById(host.getPodId()); s_logger.error("Host's Pod " + pod.getName() + " is already dedicated"); throw new CloudRuntimeException("Host's Pod " + pod.getName() + " is already dedicated"); @@ -566,7 +566,7 @@ public class DedicatedResourceManagerImpl implements DedicatedService { boolean domainIdInChildreanList = getDomainChildIds(dedicatedZoneOfHost.getDomainId()).contains(domainId); //can dedicate a host to an account/domain if zone is dedicated to parent-domain if (dedicatedZoneOfHost.getAccountId() != null || (accountId == null && !domainIdInChildreanList) || - (accountId != null && !(dedicatedZoneOfHost.getDomainId() == domainId || domainIdInChildreanList))) { + (accountId != null && !(dedicatedZoneOfHost.getDomainId().equals(domainId) || domainIdInChildreanList))) { DataCenterVO zone = _zoneDao.findById(host.getDataCenterId()); s_logger.error("Host's Data Center " + zone.getName() + " is already dedicated"); throw new CloudRuntimeException("Host's Data Center " + zone.getName() + " is already dedicated"); @@ -701,7 +701,7 @@ public class DedicatedResourceManagerImpl implements DedicatedService { if (accountId != null) { AccountVO account = _accountDao.findById(accountId); if (account == null || domainId != account.getDomainId()) { - throw new InvalidParameterValueException("Please specify the domain id of the account: " + account.getAccountName()); + throw new InvalidParameterValueException("Please specify the domain id of the account id " + accountId); } } } diff --git a/plugins/event-bus/inmemory/src/org/apache/cloudstack/mom/inmemory/InMemoryEventBus.java b/plugins/event-bus/inmemory/src/org/apache/cloudstack/mom/inmemory/InMemoryEventBus.java index 99d0a12eb3b..9a57ff067bf 100644 --- a/plugins/event-bus/inmemory/src/org/apache/cloudstack/mom/inmemory/InMemoryEventBus.java +++ b/plugins/event-bus/inmemory/src/org/apache/cloudstack/mom/inmemory/InMemoryEventBus.java @@ -26,33 +26,36 @@ import java.util.concurrent.ConcurrentHashMap; import javax.ejb.Local; import javax.naming.ConfigurationException; -import com.cloud.utils.Pair; -import org.apache.log4j.Logger; - import org.apache.cloudstack.framework.events.Event; import org.apache.cloudstack.framework.events.EventBus; import org.apache.cloudstack.framework.events.EventBusException; import org.apache.cloudstack.framework.events.EventSubscriber; import org.apache.cloudstack.framework.events.EventTopic; +import org.apache.log4j.Logger; +import com.cloud.utils.Pair; import com.cloud.utils.component.ManagerBase; @Local(value = EventBus.class) public class InMemoryEventBus extends ManagerBase implements EventBus { - private String name; private static final Logger s_logger = Logger.getLogger(InMemoryEventBus.class); - private static ConcurrentHashMap> s_subscribers; + + private final static ConcurrentHashMap> subscribers; + + static { + subscribers = new ConcurrentHashMap>(); + } @Override public boolean configure(String name, Map params) throws ConfigurationException { - s_subscribers = new ConcurrentHashMap>(); + _name = name; return true; } @Override public void setName(String name) { - this.name = name; + _name = name; } @Override @@ -62,29 +65,35 @@ public class InMemoryEventBus extends ManagerBase implements EventBus { } UUID subscriberId = UUID.randomUUID(); - s_subscribers.put(subscriberId, new Pair(topic, subscriber)); + subscribers.put(subscriberId, new Pair(topic, subscriber)); return subscriberId; } @Override public void unsubscribe(UUID subscriberId, EventSubscriber subscriber) throws EventBusException { - if (s_subscribers != null && s_subscribers.isEmpty()) { + if (subscriberId == null) { + throw new EventBusException("Cannot unregister a null subscriberId."); + } + + if (subscribers.isEmpty()) { throw new EventBusException("There are no registered subscribers to unregister."); } - if (s_subscribers.get(subscriberId) == null) { + + if (!subscribers.containsKey(subscriberId)) { throw new EventBusException("No subscriber found with subscriber id " + subscriberId); + } else { + subscribers.remove(subscriberId); } - s_subscribers.remove(subscriberId); } @Override public void publish(Event event) throws EventBusException { - if (s_subscribers == null || s_subscribers.isEmpty()) { + if (subscribers == null || subscribers.isEmpty()) { return; // no subscriber to publish to, so just return } - for (UUID subscriberId : s_subscribers.keySet()) { - Pair subscriberDetails = s_subscribers.get(subscriberId); + for (UUID subscriberId : subscribers.keySet()) { + Pair subscriberDetails = subscribers.get(subscriberId); // if the event matches subscribers interested event topic then call back the subscriber with the event if (isEventMatchesTopic(event, subscriberDetails.first())) { EventSubscriber subscriber = subscriberDetails.second(); @@ -108,6 +117,10 @@ public class InMemoryEventBus extends ManagerBase implements EventBus { return true; } + public int totalSubscribers() { + return subscribers.size(); + } + private String replaceNullWithWildcard(String key) { if (key == null || key.isEmpty()) { return "*"; @@ -122,7 +135,7 @@ public class InMemoryEventBus extends ManagerBase implements EventBus { eventTopicSource = eventTopicSource.replace(".", "-"); String eventSource = replaceNullWithWildcard(event.getEventSource()); eventSource = eventSource.replace(".", "-"); - if (eventTopicSource != "*" && eventSource != "*" && !eventTopicSource.equalsIgnoreCase(eventSource)) { + if (!eventTopicSource.equals("*") && !eventSource.equals("*") && !eventTopicSource.equalsIgnoreCase(eventSource)) { return false; } @@ -130,7 +143,7 @@ public class InMemoryEventBus extends ManagerBase implements EventBus { eventTopicCategory = eventTopicCategory.replace(".", "-"); String eventCategory = replaceNullWithWildcard(event.getEventCategory()); eventCategory = eventCategory.replace(".", "-"); - if (eventTopicCategory != "*" && eventCategory != "*" && !eventTopicCategory.equalsIgnoreCase(eventCategory)) { + if (!eventTopicCategory.equals("*") && !eventCategory.equals("*") && !eventTopicCategory.equalsIgnoreCase(eventCategory)) { return false; } @@ -138,7 +151,7 @@ public class InMemoryEventBus extends ManagerBase implements EventBus { eventTopicType = eventTopicType.replace(".", "-"); String eventType = replaceNullWithWildcard(event.getEventType()); eventType = eventType.replace(".", "-"); - if (eventTopicType != "*" && eventType != "*" && !eventTopicType.equalsIgnoreCase(eventType)) { + if (!eventTopicType.equals("*") && !eventType.equals("*") && !eventTopicType.equalsIgnoreCase(eventType)) { return false; } @@ -146,7 +159,7 @@ public class InMemoryEventBus extends ManagerBase implements EventBus { eventTopicResourceType = eventTopicResourceType.replace(".", "-"); String resourceType = replaceNullWithWildcard(event.getResourceType()); resourceType = resourceType.replace(".", "-"); - if (eventTopicResourceType != "*" && resourceType != "*" && !eventTopicResourceType.equalsIgnoreCase(resourceType)) { + if (!eventTopicResourceType.equals("*") && !resourceType.equals("*") && !eventTopicResourceType.equalsIgnoreCase(resourceType)) { return false; } @@ -154,10 +167,10 @@ public class InMemoryEventBus extends ManagerBase implements EventBus { resourceUuid = resourceUuid.replace(".", "-"); String eventTopicresourceUuid = replaceNullWithWildcard(topic.getResourceUUID()); eventTopicresourceUuid = eventTopicresourceUuid.replace(".", "-"); - if (resourceUuid != "*" && eventTopicresourceUuid != "*" && !resourceUuid.equalsIgnoreCase(eventTopicresourceUuid)) { + if (!resourceUuid.equals("*") && !eventTopicresourceUuid.equals("*") && !resourceUuid.equalsIgnoreCase(eventTopicresourceUuid)) { return false; } return true; } -} +} \ No newline at end of file diff --git a/plugins/event-bus/inmemory/test/org/apache/cloudstack/mom/inmemory/InMemoryEventBusTest.java b/plugins/event-bus/inmemory/test/org/apache/cloudstack/mom/inmemory/InMemoryEventBusTest.java new file mode 100644 index 00000000000..a967f8934ef --- /dev/null +++ b/plugins/event-bus/inmemory/test/org/apache/cloudstack/mom/inmemory/InMemoryEventBusTest.java @@ -0,0 +1,162 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.cloudstack.mom.inmemory; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.UUID; + +import org.apache.cloudstack.framework.events.Event; +import org.apache.cloudstack.framework.events.EventBusException; +import org.apache.cloudstack.framework.events.EventSubscriber; +import org.apache.cloudstack.framework.events.EventTopic; +import org.junit.Test; + +import com.cloud.utils.UuidUtils; + +public class InMemoryEventBusTest { + + @Test + public void testConfigure() throws Exception { + String name = "test001"; + + InMemoryEventBus bus = new InMemoryEventBus(); + boolean success = bus.configure(name, null); + + assertTrue(success); + assertTrue(name.equals(bus.getName())); + } + + @Test + public void testSubscribe() throws Exception { + EventTopic topic = mock(EventTopic.class); + EventSubscriber subscriber = mock(EventSubscriber.class); + + InMemoryEventBus bus = new InMemoryEventBus(); + + UUID uuid = bus.subscribe(topic, subscriber); + assertNotNull(uuid); + + String uuidStr = uuid.toString(); + assertTrue(UuidUtils.validateUUID(uuidStr)); + assertTrue(bus.totalSubscribers() == 1); + + bus.unsubscribe(uuid, subscriber); + assertTrue(bus.totalSubscribers() == 0); + } + + @Test(expected = EventBusException.class) + public void testSubscribeFailTopic() throws Exception { + EventSubscriber subscriber = mock(EventSubscriber.class); + + InMemoryEventBus bus = new InMemoryEventBus(); + + bus.subscribe(null, subscriber); + } + + @Test(expected = EventBusException.class) + public void testSubscribeFailSubscriber() throws Exception { + EventTopic topic = mock(EventTopic.class); + + InMemoryEventBus bus = new InMemoryEventBus(); + + bus.subscribe(topic, null); + } + + @Test + public void testUnsubscribe() throws Exception { + EventTopic topic = mock(EventTopic.class); + EventSubscriber subscriber = mock(EventSubscriber.class); + + InMemoryEventBus bus = new InMemoryEventBus(); + + UUID uuid = bus.subscribe(topic, subscriber); + assertNotNull(uuid); + + String uuidStr = uuid.toString(); + + assertTrue(UuidUtils.validateUUID(uuidStr)); + assertTrue(bus.totalSubscribers() == 1); + // + bus.unsubscribe(uuid, subscriber); + assertTrue(bus.totalSubscribers() == 0); + } + + @Test(expected = EventBusException.class) + public void testUnsubscribeFailEmpty() throws Exception { + UUID uuid = UUID.randomUUID(); + + InMemoryEventBus bus = new InMemoryEventBus(); + bus.unsubscribe(uuid, null); + } + + @Test(expected = EventBusException.class) + public void testUnsubscribeFailNull() throws Exception { + InMemoryEventBus bus = new InMemoryEventBus(); + bus.unsubscribe(null, null); + } + + @Test(expected = EventBusException.class) + public void testUnsubscribeFailWrongUUID() throws Exception { + EventSubscriber subscriber = mock(EventSubscriber.class); + InMemoryEventBus bus = new InMemoryEventBus(); + UUID uuid = UUID.randomUUID(); + + bus.unsubscribe(uuid, subscriber); + } + + @Test + public void testPublish() throws Exception { + EventTopic topic = mock(EventTopic.class); + EventSubscriber subscriber = mock(EventSubscriber.class); + Event event = mock(Event.class); + + InMemoryEventBus bus = new InMemoryEventBus(); + + UUID uuid = bus.subscribe(topic, subscriber); + assertNotNull(uuid); + + String uuidStr = uuid.toString(); + assertTrue(UuidUtils.validateUUID(uuidStr)); + assertTrue(bus.totalSubscribers() == 1); + + bus.publish(event); + + verify(subscriber, times(1)).onEvent(event); + + bus.unsubscribe(uuid, subscriber); + assertTrue(bus.totalSubscribers() == 0); + } + + @Test + public void testPublishEmpty() throws Exception { + EventSubscriber subscriber = mock(EventSubscriber.class); + Event event = mock(Event.class); + + InMemoryEventBus bus = new InMemoryEventBus(); + bus.publish(event); + + verify(subscriber, times(0)).onEvent(event); + } +} \ No newline at end of file diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/AssociateLunCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/AssociateLunCmd.java index b698daa876f..dadfe44eb9d 100644 --- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/AssociateLunCmd.java +++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/AssociateLunCmd.java @@ -33,7 +33,8 @@ import com.cloud.exception.InvalidParameterValueException; import com.cloud.netapp.NetappManager; import com.cloud.server.api.response.netapp.AssociateLunCmdResponse; -@APICommand(name = "associateLun", description = "Associate a LUN with a guest IQN", responseObject = AssociateLunCmdResponse.class) +@APICommand(name = "associateLun", description = "Associate a LUN with a guest IQN", responseObject = AssociateLunCmdResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AssociateLunCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(AssociateLunCmd.class.getName()); private static final String s_name = "associatelunresponse"; diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateLunCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateLunCmd.java index 86b2497f942..67004792f63 100644 --- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateLunCmd.java +++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateLunCmd.java @@ -37,7 +37,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.netapp.NetappManager; import com.cloud.server.api.response.netapp.CreateLunCmdResponse; -@APICommand(name = "createLunOnFiler", description = "Create a LUN from a pool", responseObject = CreateLunCmdResponse.class) +@APICommand(name = "createLunOnFiler", description = "Create a LUN from a pool", responseObject = CreateLunCmdResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateLunCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(CreateLunCmd.class.getName()); private static final String s_name = "createlunresponse"; diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumeOnFilerCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumeOnFilerCmd.java index e79aa14dbf7..b1e6a299fed 100644 --- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumeOnFilerCmd.java +++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumeOnFilerCmd.java @@ -36,7 +36,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.netapp.NetappManager; import com.cloud.server.api.response.netapp.CreateVolumeOnFilerCmdResponse; -@APICommand(name = "createVolumeOnFiler", description = "Create a volume", responseObject = CreateVolumeOnFilerCmdResponse.class) +@APICommand(name = "createVolumeOnFiler", description = "Create a volume", responseObject = CreateVolumeOnFilerCmdResponse.class, + requestHasSensitiveInfo = true, responseHasSensitiveInfo = false) public class CreateVolumeOnFilerCmd extends BaseCmd { private static final String s_name = "createvolumeresponse"; diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumePoolCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumePoolCmd.java index ba7493305c7..d2eeb875a74 100644 --- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumePoolCmd.java +++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumePoolCmd.java @@ -35,7 +35,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.netapp.NetappManager; import com.cloud.server.api.response.netapp.CreateVolumePoolCmdResponse; -@APICommand(name = "createPool", description = "Create a pool", responseObject = CreateVolumePoolCmdResponse.class) +@APICommand(name = "createPool", description = "Create a pool", responseObject = CreateVolumePoolCmdResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateVolumePoolCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(CreateVolumePoolCmd.class.getName()); private static final String s_name = "createpoolresponse"; diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DeleteVolumePoolCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DeleteVolumePoolCmd.java index 1d221e9ebc6..6f51cc6e2a7 100644 --- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DeleteVolumePoolCmd.java +++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DeleteVolumePoolCmd.java @@ -36,7 +36,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.netapp.NetappManager; import com.cloud.server.api.response.netapp.DeleteVolumePoolCmdResponse; -@APICommand(name = "deletePool", description = "Delete a pool", responseObject = DeleteVolumePoolCmdResponse.class) +@APICommand(name = "deletePool", description = "Delete a pool", responseObject = DeleteVolumePoolCmdResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteVolumePoolCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeleteVolumePoolCmd.class.getName()); private static final String s_name = "deletepoolresponse"; diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyLunCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyLunCmd.java index e0c0eb7f064..cfdc1dacd88 100644 --- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyLunCmd.java +++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyLunCmd.java @@ -37,7 +37,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.netapp.NetappManager; import com.cloud.server.api.response.netapp.DeleteLUNCmdResponse; -@APICommand(name = "destroyLunOnFiler", description = "Destroy a LUN", responseObject = DeleteLUNCmdResponse.class) +@APICommand(name = "destroyLunOnFiler", description = "Destroy a LUN", responseObject = DeleteLUNCmdResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DestroyLunCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DestroyLunCmd.class.getName()); diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyVolumeOnFilerCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyVolumeOnFilerCmd.java index 680c4e51147..500a84c50db 100644 --- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyVolumeOnFilerCmd.java +++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyVolumeOnFilerCmd.java @@ -38,7 +38,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.netapp.NetappManager; import com.cloud.server.api.response.netapp.DeleteVolumeOnFilerCmdResponse; -@APICommand(name = "destroyVolumeOnFiler", description = "Destroy a Volume", responseObject = DeleteVolumeOnFilerCmdResponse.class) +@APICommand(name = "destroyVolumeOnFiler", description = "Destroy a Volume", responseObject = DeleteVolumeOnFilerCmdResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DestroyVolumeOnFilerCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DestroyVolumeOnFilerCmd.class.getName()); private static final String s_name = "destroyvolumeresponse"; diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DissociateLunCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DissociateLunCmd.java index 4ea9684f0a1..d5c53a18739 100644 --- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DissociateLunCmd.java +++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DissociateLunCmd.java @@ -37,7 +37,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.netapp.NetappManager; import com.cloud.server.api.response.netapp.DissociateLunCmdResponse; -@APICommand(name = "dissociateLun", description = "Dissociate a LUN", responseObject = DissociateLunCmdResponse.class) +@APICommand(name = "dissociateLun", description = "Dissociate a LUN", responseObject = DissociateLunCmdResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DissociateLunCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DissociateLunCmd.class.getName()); private static final String s_name = "dissociatelunresponse"; diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListLunsCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListLunsCmd.java index 04e64f38514..c1e1fb87b76 100644 --- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListLunsCmd.java +++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListLunsCmd.java @@ -40,7 +40,8 @@ import com.cloud.netapp.LunVO; import com.cloud.netapp.NetappManager; import com.cloud.server.api.response.netapp.ListLunsCmdResponse; -@APICommand(name = "listLunsOnFiler", description = "List LUN", responseObject = ListLunsCmdResponse.class) +@APICommand(name = "listLunsOnFiler", description = "List LUN", responseObject = ListLunsCmdResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListLunsCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(ListLunsCmd.class.getName()); private static final String s_name = "listlunresponse"; diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumePoolsCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumePoolsCmd.java index 9e650e035ee..f6d17c06e60 100644 --- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumePoolsCmd.java +++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumePoolsCmd.java @@ -38,7 +38,8 @@ import com.cloud.netapp.NetappManager; import com.cloud.netapp.PoolVO; import com.cloud.server.api.response.netapp.ListVolumePoolsCmdResponse; -@APICommand(name = "listPools", description = "List Pool", responseObject = ListVolumePoolsCmdResponse.class) +@APICommand(name = "listPools", description = "List Pool", responseObject = ListVolumePoolsCmdResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListVolumePoolsCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(ListVolumePoolsCmd.class.getName()); private static final String s_name = "listpoolresponse"; diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumesOnFilerCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumesOnFilerCmd.java index 38c91b75819..bf72b3afbec 100644 --- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumesOnFilerCmd.java +++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumesOnFilerCmd.java @@ -40,7 +40,8 @@ import com.cloud.netapp.NetappManager; import com.cloud.netapp.NetappVolumeVO; import com.cloud.server.api.response.netapp.ListVolumesOnFilerCmdResponse; -@APICommand(name = "listVolumesOnFiler", description = "List Volumes", responseObject = ListVolumesOnFilerCmdResponse.class) +@APICommand(name = "listVolumesOnFiler", description = "List Volumes", responseObject = ListVolumesOnFilerCmdResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListVolumesOnFilerCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(ListVolumesOnFilerCmd.class.getName()); private static final String s_name = "listvolumesresponse"; diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ModifyVolumePoolCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ModifyVolumePoolCmd.java index 94d5de593d7..a5849df3492 100644 --- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ModifyVolumePoolCmd.java +++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ModifyVolumePoolCmd.java @@ -33,7 +33,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.netapp.NetappManager; import com.cloud.server.api.response.netapp.ModifyVolumePoolCmdResponse; -@APICommand(name = "modifyPool", description = "Modify pool", responseObject = ModifyVolumePoolCmdResponse.class) +@APICommand(name = "modifyPool", description = "Modify pool", responseObject = ModifyVolumePoolCmdResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ModifyVolumePoolCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(ModifyVolumePoolCmd.class.getName()); private static final String s_name = "modifypoolresponse"; diff --git a/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/AddBaremetalDhcpCmd.java b/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/AddBaremetalDhcpCmd.java index 529f988b519..ab014d09809 100755 --- a/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/AddBaremetalDhcpCmd.java +++ b/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/AddBaremetalDhcpCmd.java @@ -35,7 +35,8 @@ import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -@APICommand(name = "addBaremetalDhcp", description = "adds a baremetal dhcp server", responseObject = BaremetalDhcpResponse.class) +@APICommand(name = "addBaremetalDhcp", description = "adds a baremetal dhcp server", responseObject = BaremetalDhcpResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AddBaremetalDhcpCmd extends BaseAsyncCmd { private static final String s_name = "addbaremetaldhcpresponse"; public static final Logger s_logger = Logger.getLogger(AddBaremetalDhcpCmd.class); diff --git a/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/AddBaremetalHostCmd.java b/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/AddBaremetalHostCmd.java index 40ee6ded923..b876c68f53b 100755 --- a/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/AddBaremetalHostCmd.java +++ b/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/AddBaremetalHostCmd.java @@ -23,7 +23,8 @@ import org.apache.cloudstack.api.response.HostResponse; import com.cloud.baremetal.manager.BareMetalDiscoverer; -@APICommand(name = "addBaremetalHost", description = "add a baremetal host", responseObject = HostResponse.class) +@APICommand(name = "addBaremetalHost", description = "add a baremetal host", responseObject = HostResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AddBaremetalHostCmd extends AddHostCmd { @Parameter(name = ApiConstants.IP_ADDRESS, type = CommandType.STRING, description = "ip address intentionally allocated to this host after provisioning") diff --git a/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/AddBaremetalKickStartPxeCmd.java b/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/AddBaremetalKickStartPxeCmd.java index ac8d9c7c0cc..2c3a68cd5ac 100755 --- a/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/AddBaremetalKickStartPxeCmd.java +++ b/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/AddBaremetalKickStartPxeCmd.java @@ -20,7 +20,8 @@ package org.apache.cloudstack.api; import com.cloud.baremetal.networkservice.BaremetalPxeKickStartResponse; -@APICommand(name = "addBaremetalPxeKickStartServer", description = "add a baremetal pxe server", responseObject = BaremetalPxeKickStartResponse.class) +@APICommand(name = "addBaremetalPxeKickStartServer", description = "add a baremetal pxe server", responseObject = BaremetalPxeKickStartResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AddBaremetalKickStartPxeCmd extends AddBaremetalPxeCmd { @Parameter(name = ApiConstants.TFTP_DIR, type = CommandType.STRING, required = true, description = "Tftp root directory of PXE server") private String tftpDir; diff --git a/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/AddBaremetalPxePingServerCmd.java b/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/AddBaremetalPxePingServerCmd.java index b128a62410d..32f6faea0a9 100755 --- a/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/AddBaremetalPxePingServerCmd.java +++ b/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/AddBaremetalPxePingServerCmd.java @@ -20,7 +20,8 @@ package org.apache.cloudstack.api; import com.cloud.baremetal.networkservice.BaremetalPxePingResponse; -@APICommand(name = "addBaremetalPxePingServer", description = "add a baremetal ping pxe server", responseObject = BaremetalPxePingResponse.class) +@APICommand(name = "addBaremetalPxePingServer", description = "add a baremetal ping pxe server", responseObject = BaremetalPxePingResponse.class, + requestHasSensitiveInfo = true, responseHasSensitiveInfo = false) public class AddBaremetalPxePingServerCmd extends AddBaremetalPxeCmd { @Parameter(name = ApiConstants.PING_STORAGE_SERVER_IP, type = CommandType.STRING, required = true, description = "PING storage server ip") diff --git a/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalDhcpCmd.java b/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalDhcpCmd.java index 7d0aba387d4..b159810ec6a 100755 --- a/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalDhcpCmd.java +++ b/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalDhcpCmd.java @@ -34,7 +34,8 @@ import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -@APICommand(name = "listBaremetalDhcp", description = "list baremetal dhcp servers", responseObject = BaremetalDhcpResponse.class) +@APICommand(name = "listBaremetalDhcp", description = "list baremetal dhcp servers", responseObject = BaremetalDhcpResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListBaremetalDhcpCmd extends BaseListCmd { private static final Logger s_logger = Logger.getLogger(ListBaremetalDhcpCmd.class); private static final String s_name = "listbaremetaldhcpresponse"; diff --git a/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalPxeServersCmd.java b/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalPxeServersCmd.java index 437fa3f2cd8..166366303da 100755 --- a/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalPxeServersCmd.java +++ b/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalPxeServersCmd.java @@ -34,7 +34,8 @@ import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -@APICommand(name = "listBaremetalPxeServers", description = "list baremetal pxe server", responseObject = BaremetalPxeResponse.class) +@APICommand(name = "listBaremetalPxeServers", description = "list baremetal pxe server", responseObject = BaremetalPxeResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListBaremetalPxeServersCmd extends BaseListCmd { private static final Logger s_logger = Logger.getLogger(ListBaremetalPxeServersCmd.class); private static final String s_name = "listbaremetalpxeserversresponse"; diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs index c2421efb7e6..869f1088469 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs @@ -173,11 +173,11 @@ namespace HypervResource PrimaryDataStoreTO store = this.primaryDataStore; if (store.isLocal) { - fileName = Path.Combine(store.Path, this.name); + fileName = Path.Combine(store.Path, this.uuid); } else { - fileName = @"\\" + store.uri.Host + store.uri.LocalPath + @"\" + this.name; + fileName = @"\\" + store.uri.Host + store.uri.LocalPath + @"\" + this.uuid; fileName = Utils.NormalizePath(fileName); } } @@ -198,7 +198,7 @@ namespace HypervResource fileName = Utils.NormalizePath(fileName); if (Directory.Exists(fileName)) { - fileName = Utils.NormalizePath(fileName + @"\" + this.name); + fileName = Utils.NormalizePath(fileName + @"\" + this.uuid); } } } @@ -300,11 +300,11 @@ namespace HypervResource path = Utils.NormalizePath(path); if (Directory.Exists(path)) { - string[] choices = choices = Directory.GetFiles(path, volInfo.name + ".vhd*"); + string[] choices = choices = Directory.GetFiles(path, volInfo.uuid + ".vhd*"); if (choices.Length != 1) { String errMsg = "Tried to guess file extension, but cannot find file corresponding to " + - Path.Combine(volInfo.primaryDataStore.Path, volInfo.name); + Path.Combine(volInfo.primaryDataStore.Path, volInfo.uuid); logger.Debug(errMsg); } else @@ -334,18 +334,18 @@ namespace HypervResource PrimaryDataStoreTO store = this.primaryDataStore; if (store.isLocal) { - fileName = Path.Combine(store.Path, this.name); + fileName = Path.Combine(store.Path, this.uuid); } else { - fileName = @"\\" + store.uri.Host + store.uri.LocalPath + @"\" + this.name; + fileName = @"\\" + store.uri.Host + store.uri.LocalPath + @"\" + this.uuid; } fileName = fileName + '.' + this.format.ToLowerInvariant(); } else if (this.nfsDataStoreTO != null) { NFSTO store = this.nfsDataStoreTO; - fileName = store.UncPath + @"\" + this.path + @"\" + this.name; + fileName = store.UncPath + @"\" + this.path + @"\" + this.uuid; if (!this.format.Equals("RAW")) { fileName = fileName + '.' + this.format.ToLowerInvariant(); @@ -918,5 +918,6 @@ namespace HypervResource public const string DeleteCommand = "org.apache.cloudstack.storage.command.DeleteCommand"; public const string DettachAnswer = "org.apache.cloudstack.storage.command.DettachAnswer"; public const string DettachCommand = "org.apache.cloudstack.storage.command.DettachCommand"; + public const string HostVmStateReportCommand = "org.apache.cloudstack.HostVmStateReportCommand"; } } diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs index 718ef0504eb..e233d0340d8 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs @@ -1168,13 +1168,13 @@ namespace HypervResource bool result = false; string details = null; - + object newData = null; try { VolumeObjectTO volume = VolumeObjectTO.ParseJson(cmd.data); PrimaryDataStoreTO primary = volume.primaryDataStore; ulong volumeSize = volume.size; - string volumeName = volume.name + ".vhd"; + string volumeName = volume.uuid + ".vhd"; string volumePath = null; if (primary.isLocal) @@ -1187,11 +1187,13 @@ namespace HypervResource volumePath = Utils.NormalizePath(volumePath); Utils.ConnectToRemote(primary.UncPath, primary.Domain, primary.User, primary.Password); } - + volume.path = volumePath; wmiCallsV2.CreateDynamicVirtualHardDisk(volumeSize, volumePath); if (File.Exists(volumePath)) { result = true; + JObject ansObj = Utils.CreateCloudStackObject(CloudStackTypes.VolumeObjectTO, volume); + newData = ansObj; } else { @@ -1209,7 +1211,7 @@ namespace HypervResource { result = result, details = details, - data = cmd.data, + data = newData, contextMap = contextMap }; @@ -2103,42 +2105,76 @@ namespace HypervResource } } - // POST api/HypervResource/GetVncPortCommand + // POST api/HypervResource/GetVncPortCommand + [HttpPost] + [ActionName(CloudStackTypes.GetVncPortCommand)] + public JContainer GetVncPortCommand([FromBody]dynamic cmd) + { + using (log4net.NDC.Push(Guid.NewGuid().ToString())) + { + logger.Info(CloudStackTypes.GetVncPortCommand + cmd.ToString()); + + string details = null; + bool result = false; + string address = null; + int port = -9; + + try + { + string vmName = (string)cmd.name; + var sys = wmiCallsV2.GetComputerSystem(vmName); + address = "instanceId=" + sys.Name ; + result = true; + } + catch (Exception sysEx) + { + details = CloudStackTypes.GetVncPortAnswer + " failed due to " + sysEx.Message; + logger.Error(details, sysEx); + } + + object ansContent = new + { + result = result, + details = details, + address = address, + port = port + }; + + return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.GetVncPortAnswer); + } + } + + // POST api/HypervResource/HostVmStateReportCommand [HttpPost] - [ActionName(CloudStackTypes.GetVncPortCommand)] - public JContainer GetVncPortCommand([FromBody]dynamic cmd) + [ActionName(CloudStackTypes.HostVmStateReportCommand)] + public JContainer HostVmStateReportCommand([FromBody]dynamic cmd) { using (log4net.NDC.Push(Guid.NewGuid().ToString())) { - logger.Info(CloudStackTypes.GetVncPortCommand + cmd.ToString()); + logger.Info(CloudStackTypes.HostVmStateReportCommand + cmd.ToString()); string details = null; - bool result = false; - string address = null; - int port = -9; + Dictionary[] hostVmStateReport = null; try { - string vmName = (string)cmd.name; - var sys = wmiCallsV2.GetComputerSystem(vmName); - address = "instanceId=" + sys.Name ; - result = true; + var vmCollection = wmiCallsV2.GetComputerSystemCollection(); + hostVmStateReport = new Dictionary[vmCollection.Count]; + int i = 0; + foreach (ComputerSystem vm in vmCollection) + { + var dict = new Dictionary(); + dict.Add(vm.ElementName, EnabledState.ToCloudStackPowerState(vm.EnabledState)); + hostVmStateReport[i++] = dict; + } } catch (Exception sysEx) { - details = CloudStackTypes.GetVncPortAnswer + " failed due to " + sysEx.Message; + details = CloudStackTypes.HostVmStateReportCommand + " failed due to " + sysEx.Message; logger.Error(details, sysEx); } - object ansContent = new - { - result = result, - details = details, - address = address, - port = port - }; - - return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.GetVncPortAnswer); + return JArray.FromObject(hostVmStateReport); } } diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/IWmiCallsV2.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/IWmiCallsV2.cs index 9042d7c5e12..da6ad838757 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/IWmiCallsV2.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/IWmiCallsV2.cs @@ -42,6 +42,7 @@ namespace HypervResource void MigrateVm(string vmName, string destination); void DetachDisk(string displayName, string diskFileName); ComputerSystem GetComputerSystem(string displayName); + ComputerSystem.ComputerSystemCollection GetComputerSystemCollection(); string GetDefaultDataRoot(); string GetDefaultVirtualDiskFolder(); ResourceAllocationSettingData GetDvdDriveSettings(VirtualSystemSettingData vmSettings); diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs index dde6e214f09..d2b9ce19760 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs @@ -1874,6 +1874,12 @@ namespace HypervResource return null; } + public ComputerSystem.ComputerSystemCollection GetComputerSystemCollection() + { + var wmiQuery = String.Format("Caption=\"Virtual Machine\""); + return ComputerSystem.GetInstances(wmiQuery); + } + public Dictionary GetVmSync(String privateIpAddress) { List vms = GetVmElementNames(); @@ -2474,5 +2480,24 @@ namespace HypervResource } return result; } + + public static string ToCloudStackPowerState(UInt16 value) + { + string result = "Unknown"; + switch (value) + { + case Enabled: result = "PowerOn"; break; + case Disabled: result = "PowerOff"; break; + case Paused: result = "PowerUnknown"; break; + case Suspended: result = "PowerUnknown"; break; + case Starting: result = "PowerOn"; break; + case Snapshotting: result = "PowerUnknown"; break; // NOT used + case Saving: result = "PowerOn"; break; + case Stopping: result = "PowerOff"; break; + case Pausing: result = "PowerUnknown"; break; + case Resuming: result = "PowerOn"; break; + } + return result; + } } } diff --git a/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java b/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java index 2f645906317..c79373a0eee 100644 --- a/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java +++ b/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java @@ -62,6 +62,7 @@ import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger; import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; import com.cloud.agent.api.Answer; import com.cloud.agent.api.CheckRouterAnswer; @@ -139,6 +140,7 @@ import com.cloud.utils.StringUtils; import com.cloud.utils.net.NetUtils; import com.cloud.utils.ssh.SshHelper; import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachine.PowerState; import com.cloud.vm.VirtualMachineName; @@ -148,6 +150,7 @@ import com.cloud.vm.VirtualMachineName; @Local(value = ServerResource.class) public class HypervDirectConnectResource extends ServerResourceBase implements ServerResource { public static final int DEFAULT_AGENT_PORT = 8250; + public static final String HOST_VM_STATE_REPORT_COMMAND = "org.apache.cloudstack.HostVmStateReportCommand"; private static final Logger s_logger = Logger.getLogger(HypervDirectConnectResource.class.getName()); private static final Gson s_gson = GsonHelper.getGson(); @@ -209,6 +212,7 @@ public class HypervDirectConnectResource extends ServerResourceBase implements S defaultStartRoutCmd.setPrivateIpAddress(_agentIp); defaultStartRoutCmd.setStorageIpAddress(_agentIp); defaultStartRoutCmd.setPool(_clusterGuid); + defaultStartRoutCmd.setHostVmStateReport(getHostVmStateReport()); s_logger.debug("Generated StartupRoutingCommand for _agentIp \"" + _agentIp + "\""); @@ -300,8 +304,7 @@ public class HypervDirectConnectResource extends ServerResourceBase implements S @Override public final PingCommand getCurrentStatus(final long id) { - // TODO, need to report VM states on host - PingCommand pingCmd = new PingRoutingCommand(getType(), id, null, null); + PingCommand pingCmd = new PingRoutingCommand(getType(), id, null, getHostVmStateReport()); if (s_logger.isDebugEnabled()) { s_logger.debug("Ping host " + _name + " (IP " + _agentIp + ")"); @@ -316,6 +319,50 @@ public class HypervDirectConnectResource extends ServerResourceBase implements S return pingCmd; } + public final ArrayList> requestHostVmStateReport() { + URI agentUri = null; + try { + agentUri = new URI("https", null, _agentIp, _port, "/api/HypervResource/" + HOST_VM_STATE_REPORT_COMMAND, null, null); + } catch (URISyntaxException e) { + String errMsg = "Could not generate URI for Hyper-V agent"; + s_logger.error(errMsg, e); + return null; + } + String incomingCmd = postHttpRequest("{}", agentUri); + + if (incomingCmd == null) { + return null; + } + ArrayList> result = null; + try { + result = s_gson.fromJson(incomingCmd, new TypeToken>>() { + }.getType()); + } catch (Exception ex) { + String errMsg = "Failed to deserialize Command[] " + incomingCmd; + s_logger.error(errMsg, ex); + } + s_logger.debug("HostVmStateReportCommand received response " + + s_gson.toJson(result)); + if (!result.isEmpty()) { + return result; + } + return null; + } + + protected HashMap getHostVmStateReport() { + final HashMap vmStates = new HashMap(); + ArrayList> vmList = requestHostVmStateReport(); + if (vmList == null || vmList.isEmpty()) { + return null; + } + + for (Map vmMap : vmList) { + String name = (String)vmMap.keySet().toArray()[0]; + vmStates.put(name, new HostVmStateReportEntry(PowerState.valueOf(vmMap.get(name)), _guid, null)); + } + return vmStates; + } + // TODO: Is it valid to return NULL, or should we throw on error? // Returns StartupCommand with fields revised with values known only to the // host diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMGuestOsMapper.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMGuestOsMapper.java index f76b8a725f1..11d1e166f05 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMGuestOsMapper.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMGuestOsMapper.java @@ -126,6 +126,8 @@ public class KVMGuestOsMapper { s_mapper.put("Windows NT 4", "Windows NT"); s_mapper.put("Windows 3.1", "Windows 3.1"); s_mapper.put("Windows PV", "Other PV"); + s_mapper.put("FreeBSD 10 (32-bit)", "FreeBSD 10"); + s_mapper.put("FreeBSD 10 (64-bits", "FreeBSD 10"); s_mapper.put("Other PV (32-bit)", "Other PV"); s_mapper.put("Other PV (64-bit)", "Other PV"); diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMHABase.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMHABase.java index fdaaeb31c45..b829f78f625 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMHABase.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMHABase.java @@ -48,11 +48,11 @@ public class KVMHABase { PoolType _type; public NfsStoragePool(String poolUUID, String poolIp, String poolSourcePath, String mountDestPath, PoolType type) { - this._poolUUID = poolUUID; - this._poolIp = poolIp; - this._poolMountSourcePath = poolSourcePath; - this._mountDestPath = mountDestPath; - this._type = type; + _poolUUID = poolUUID; + _poolIp = poolIp; + _poolMountSourcePath = poolSourcePath; + _mountDestPath = mountDestPath; + _type = type; } } @@ -115,8 +115,9 @@ public class KVMHABase { * the storage pool still running */ } + poolName = pool.getName(); } - poolName = pool.getName(); + } catch (LibvirtException e) { s_logger.debug("Ignoring libvirt error.", e); } finally { diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java index 6289dea4910..1056bcf21f2 100755 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java @@ -199,6 +199,7 @@ import com.cloud.vm.DiskProfile; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachine.PowerState; import com.cloud.vm.VirtualMachine.State; + import org.apache.cloudstack.storage.command.StorageSubSystemCommand; import org.apache.cloudstack.storage.to.PrimaryDataStoreTO; import org.apache.cloudstack.storage.to.VolumeObjectTO; @@ -207,6 +208,7 @@ import org.apache.cloudstack.utils.qemu.QemuImg.PhysicalDiskFormat; import org.apache.cloudstack.utils.qemu.QemuImgException; import org.apache.cloudstack.utils.qemu.QemuImgFile; import org.apache.commons.io.FileUtils; +import org.apache.commons.io.IOUtils; import org.apache.log4j.Logger; import org.libvirt.Connect; import org.libvirt.Domain; @@ -220,6 +222,7 @@ import org.libvirt.StorageVol; import javax.ejb.Local; import javax.naming.ConfigurationException; + import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.File; @@ -229,6 +232,7 @@ import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.io.Reader; import java.net.InetAddress; import java.net.URI; import java.net.URISyntaxException; @@ -368,6 +372,9 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv @Override public ExecutionResult cleanupCommand(NetworkElementCommand cmd) { + if (cmd instanceof IpAssocCommand && !(cmd instanceof IpAssocVpcCommand)) { + return cleanupNetworkElementCommand((IpAssocCommand)cmd); + } return new ExecutionResult(true, null); } @@ -1152,12 +1159,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv Script command = new Script("/bin/sh", _timeout); command.add("-c"); command.add("ovs-vsctl br-exists " + networkName); - String result = command.execute(null); - if ("0".equals(result)) { - return true; - } else { - return false; - } + return "0".equals(command.execute(null)); } private boolean passCmdLine(String vmName, String cmdLine) throws InternalErrorException { @@ -1314,7 +1316,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv } else if (cmd instanceof UnPlugNicCommand) { return execute((UnPlugNicCommand)cmd); } else if (cmd instanceof NetworkElementCommand) { - return _virtRouterResource.executeRequest(cmd); + return _virtRouterResource.executeRequest((NetworkElementCommand)cmd); } else if (cmd instanceof CheckSshCommand) { return execute((CheckSshCommand)cmd); } else if (cmd instanceof NetworkUsageCommand) { @@ -1751,8 +1753,11 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv if (pool.getType() == StoragePoolType.CLVM && volFormat == PhysicalDiskFormat.RAW) { return "CLVM"; - } else if ((poolType == StoragePoolType.NetworkFilesystem || poolType == StoragePoolType.SharedMountPoint || poolType == StoragePoolType.Filesystem) && - volFormat == PhysicalDiskFormat.QCOW2) { + } else if ((poolType == StoragePoolType.NetworkFilesystem + || poolType == StoragePoolType.SharedMountPoint + || poolType == StoragePoolType.Filesystem + || poolType == StoragePoolType.Gluster) + && volFormat == PhysicalDiskFormat.QCOW2 ) { return "QCOW2"; } return null; @@ -1936,6 +1941,24 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv vm.attachDevice(getVifDriver(nicTO.getType()).plug(nicTO, "Other PV (32-bit)").toString()); } + + private void vifHotUnPlug (Connect conn, String vmName, String macAddr) throws InternalErrorException, LibvirtException { + + Domain vm = null; + vm = getDomain(conn, vmName); + List pluggedNics = getInterfaces(conn, vmName); + for (InterfaceDef pluggedNic : pluggedNics) { + if (pluggedNic.getMacAddress().equalsIgnoreCase(macAddr)) { + vm.detachDevice(pluggedNic.toString()); + // We don't know which "traffic type" is associated with + // each interface at this point, so inform all vif drivers + for (VifDriver vifDriver : getAllVifDrivers()) { + vifDriver.unplug(pluggedNic); + } + } + } + } + private PlugNicAnswer execute(PlugNicCommand cmd) { NicTO nic = cmd.getNic(); String vmName = cmd.getVmName(); @@ -2162,6 +2185,65 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv } } + protected ExecutionResult cleanupNetworkElementCommand(IpAssocCommand cmd) { + + String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME); + String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); + Connect conn; + + + try{ + conn = LibvirtConnection.getConnectionByVmName(routerName); + List nics = getInterfaces(conn, routerName); + Map broadcastUriAllocatedToVM = new HashMap(); + + Integer nicPos = 0; + for (InterfaceDef nic : nics) { + if (nic.getBrName().equalsIgnoreCase(_linkLocalBridgeName)) { + broadcastUriAllocatedToVM.put("LinkLocal", nicPos); + } else { + if (nic.getBrName().equalsIgnoreCase(_publicBridgeName) || nic.getBrName().equalsIgnoreCase(_privBridgeName) || + nic.getBrName().equalsIgnoreCase(_guestBridgeName)) { + broadcastUriAllocatedToVM.put(BroadcastDomainType.Vlan.toUri(Vlan.UNTAGGED).toString(), nicPos); + } else { + String broadcastUri = getBroadcastUriFromBridge(nic.getBrName()); + broadcastUriAllocatedToVM.put(broadcastUri, nicPos); + } + } + nicPos++; + } + + IpAddressTO[] ips = cmd.getIpAddresses(); + int numOfIps = ips.length; + int nicNum = 0; + for (IpAddressTO ip : ips) { + + boolean newNic = false; + if (!broadcastUriAllocatedToVM.containsKey(ip.getBroadcastUri())) { + /* plug a vif into router */ + VifHotPlug(conn, routerName, ip.getBroadcastUri(), ip.getVifMacAddress()); + broadcastUriAllocatedToVM.put(ip.getBroadcastUri(), nicPos++); + newNic = true; + } + nicNum = broadcastUriAllocatedToVM.get(ip.getBroadcastUri()); + + if (numOfIps == 1 && !ip.isAdd()) { + vifHotUnPlug(conn, routerName, ip.getVifMacAddress()); + networkUsage(routerIp, "deleteVif", "eth" + nicNum); + } + } + + } catch (LibvirtException e) { + s_logger.error("ipassoccmd failed", e); + return new ExecutionResult(false, e.getMessage()); + } catch (InternalErrorException e) { + s_logger.error("ipassoccmd failed", e); + return new ExecutionResult(false, e.getMessage()); + } + + return new ExecutionResult(true, null); + } + protected ManageSnapshotAnswer execute(final ManageSnapshotCommand cmd) { String snapshotName = cmd.getSnapshotName(); String snapshotPath = cmd.getSnapshotPath(); @@ -2896,6 +2978,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv } List ifaces = null; + List disks = null; Domain dm = null; Connect dconn = null; @@ -2905,6 +2988,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv try { conn = LibvirtConnection.getConnectionByVmName(cmd.getVmName()); ifaces = getInterfaces(conn, vmName); + disks = getDisks(conn, vmName); dm = conn.domainLookupByName(vmName); /* We replace the private IP address with the address of the destination host. @@ -2927,7 +3011,9 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv */ destDomain = dm.migrate(dconn, (1 << 0), xmlDesc, vmName, "tcp:" + cmd.getDestinationIp(), _migrateSpeed); - _storagePoolMgr.disconnectPhysicalDisksViaVmSpec(cmd.getVirtualMachine()); + for (DiskDef disk : disks) { + cleanupDisk(disk); + } } catch (LibvirtException e) { s_logger.debug("Can't migrate domain: " + e.getMessage()); result = e.getMessage(); @@ -2977,7 +3063,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv NicTO[] nics = vm.getNics(); - boolean success = false; + boolean skipDisconnect = false; try { Connect conn = LibvirtConnection.getConnectionByVmName(vm.getName()); @@ -2993,13 +3079,16 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv } } - _storagePoolMgr.connectPhysicalDisksViaVmSpec(vm); + if (!_storagePoolMgr.connectPhysicalDisksViaVmSpec(vm)) { + skipDisconnect = true; + return new PrepareForMigrationAnswer(cmd, "failed to connect physical disks to host"); + } synchronized (_vms) { _vms.put(vm.getName(), State.Migrating); } - success = true; + skipDisconnect = true; return new PrepareForMigrationAnswer(cmd); } catch (LibvirtException e) { @@ -3009,7 +3098,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv } catch (URISyntaxException e) { return new PrepareForMigrationAnswer(cmd, e.toString()); } finally { - if (!success) { + if (!skipDisconnect) { _storagePoolMgr.disconnectPhysicalDisksViaVmSpec(vm); } } @@ -3320,13 +3409,11 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv } if (pubKeyFile.exists()) { - String pubKey = cmd.getPubKey(); - try { - FileOutputStream pubkStream = new FileOutputStream(pubKeyFile); - pubkStream.write(pubKey.getBytes()); - pubkStream.close(); + try (FileOutputStream pubkStream = new FileOutputStream(pubKeyFile)) { + pubkStream.write(cmd.getPubKey().getBytes()); } catch (FileNotFoundException e) { - result = "File" + SSHPUBKEYPATH + "is not found:" + e.toString(); + result = "File" + SSHPUBKEYPATH + "is not found:" + + e.toString(); s_logger.debug(result); } catch (IOException e) { result = "Write file " + SSHPUBKEYPATH + ":" + e.toString(); @@ -3544,7 +3631,9 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv createVbd(conn, vmSpec, vmName, vm); - _storagePoolMgr.connectPhysicalDisksViaVmSpec(vmSpec); + if (!_storagePoolMgr.connectPhysicalDisksViaVmSpec(vmSpec)) { + return new StartAnswer(cmd, "Failed to connect physical disks to host"); + } createVifs(vmSpec, vm); @@ -3700,7 +3789,13 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv we pass the pool's UUID as the authSecret */ disk.defNetworkBasedDisk(physicalDisk.getPath().replace("rbd:", ""), pool.getSourceHost(), pool.getSourcePort(), pool.getAuthUserName(), - pool.getUuid(), devId, diskBusType, diskProtocol.RBD); + pool.getUuid(), devId, diskBusType, diskProtocol.RBD, DiskDef.diskFmtType.RAW); + } else if (pool.getType() == StoragePoolType.Gluster) { + String mountpoint = pool.getLocalPath(); + String path = physicalDisk.getPath(); + String glusterVolume = pool.getSourceDir().replace("/", ""); + disk.defNetworkBasedDisk(glusterVolume + path.replace(mountpoint, ""), pool.getSourceHost(), pool.getSourcePort(), null, + null, devId, diskBusType, diskProtocol.GLUSTER, DiskDef.diskFmtType.QCOW2); } else if (pool.getType() == StoragePoolType.CLVM || physicalDisk.getFormat() == PhysicalDiskFormat.RAW) { disk.defBlockBasedDisk(physicalDisk.getPath(), devId, diskBusType); } else { @@ -3857,7 +3952,10 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv diskdef = new DiskDef(); if (attachingPool.getType() == StoragePoolType.RBD) { diskdef.defNetworkBasedDisk(attachingDisk.getPath(), attachingPool.getSourceHost(), attachingPool.getSourcePort(), attachingPool.getAuthUserName(), - attachingPool.getUuid(), devId, DiskDef.diskBus.VIRTIO, diskProtocol.RBD); + attachingPool.getUuid(), devId, DiskDef.diskBus.VIRTIO, diskProtocol.RBD, DiskDef.diskFmtType.RAW); + } else if (attachingPool.getType() == StoragePoolType.Gluster) { + diskdef.defNetworkBasedDisk(attachingDisk.getPath(), attachingPool.getSourceHost(), attachingPool.getSourcePort(), null, + null, devId, DiskDef.diskBus.VIRTIO, diskProtocol.GLUSTER, DiskDef.diskFmtType.QCOW2); } else if (attachingDisk.getFormat() == PhysicalDiskFormat.QCOW2) { diskdef.defFileBasedDisk(attachingDisk.getPath(), devId, DiskDef.diskBus.VIRTIO, DiskDef.diskFmtType.QCOW2); } else if (attachingDisk.getFormat() == PhysicalDiskFormat.RAW) { @@ -4343,7 +4441,13 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv s_logger.trace("VM " + dm.getName() + ": powerstate = " + ps + "; vm state=" + state.toString()); String vmName = dm.getName(); - vmStates.put(vmName, new HostVmStateReportEntry(state, conn.getHostName(), null)); + + // TODO : for XS/KVM (host-based resource), we require to remove + // VM completely from host, for some reason, KVM seems to still keep + // Stopped VM around, to work-around that, reporting only powered-on VM + // + if (state == PowerState.PowerOn) + vmStates.put(vmName, new HostVmStateReportEntry(state, conn.getHostName(), null)); } catch (final LibvirtException e) { s_logger.warn("Unable to get vms", e); } finally { @@ -4367,7 +4471,12 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv String vmName = dm.getName(); s_logger.trace("VM " + vmName + ": powerstate = " + ps + "; vm state=" + state.toString()); - vmStates.put(vmName, new HostVmStateReportEntry(state, conn.getHostName(), null)); + // TODO : for XS/KVM (host-based resource), we require to remove + // VM completely from host, for some reason, KVM seems to still keep + // Stopped VM around, to work-around that, reporting only powered-on VM + // + if (state == PowerState.PowerOn) + vmStates.put(vmName, new HostVmStateReportEntry(state, conn.getHostName(), null)); } catch (final LibvirtException e) { s_logger.warn("Unable to get vms", e); } finally { @@ -4392,24 +4501,9 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv int cpuSockets = 0; String cap = null; try { - Connect conn = LibvirtConnection.getConnection(); + final Connect conn = LibvirtConnection.getConnection(); final NodeInfo hosts = conn.nodeInfo(); - boolean result = false; - try { - BufferedReader in = new BufferedReader(new FileReader("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq")); - speed = Long.parseLong(in.readLine()) / 1000; - result = true; - } catch (FileNotFoundException e) { - - } catch (IOException e) { - - } catch (NumberFormatException e) { - - } - - if (!result) { - speed = hosts.mhz; - } + speed = getCpuSpeed(hosts); cpuSockets = hosts.sockets; cpus = hosts.cpus; @@ -4450,6 +4544,16 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv return info; } + protected static long getCpuSpeed(final NodeInfo nodeInfo) { + try (final Reader reader = new FileReader( + "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq")) { + return Long.parseLong(IOUtils.toString(reader).trim()) / 1000; + } catch (IOException | NumberFormatException e) { + s_logger.warn("Could not read cpuinfo_max_freq"); + return nodeInfo.mhz; + } + } + protected String rebootVM(Connect conn, String vmName) { Domain dm = null; String msg = null; @@ -4686,7 +4790,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv guestOSName.startsWith("CentOS 5.5") || guestOS.startsWith("CentOS") || guestOS.startsWith("Fedora") || guestOSName.startsWith("Red Hat Enterprise Linux 5.3") || guestOSName.startsWith("Red Hat Enterprise Linux 5.4") || guestOSName.startsWith("Red Hat Enterprise Linux 5.5") || guestOSName.startsWith("Red Hat Enterprise Linux 6") || guestOS.startsWith("Debian GNU/Linux") || - guestOSName.startsWith("Other PV")) { + guestOSName.startsWith("FreeBSD 10") || guestOSName.startsWith("Other PV")) { return true; } else { return false; diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java index 9fb63ce2425..fabe9a881db 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java @@ -64,6 +64,7 @@ public class LibvirtDomainXMLParser { String type = disk.getAttribute("type"); DiskDef def = new DiskDef(); if (type.equalsIgnoreCase("network")) { + String diskFmtType = getAttrValue("driver", "type", disk); String diskCacheMode = getAttrValue("driver", "cache", disk); String diskPath = getAttrValue("source", "name", disk); String protocol = getAttrValue("source", "protocol", disk); @@ -73,9 +74,15 @@ public class LibvirtDomainXMLParser { int port = Integer.parseInt(getAttrValue("host", "port", disk)); String diskLabel = getAttrValue("target", "dev", disk); String bus = getAttrValue("target", "bus", disk); + + DiskDef.diskFmtType fmt = null; + if (diskFmtType != null) { + fmt = DiskDef.diskFmtType.valueOf(diskFmtType.toUpperCase()); + } + def.defNetworkBasedDisk(diskPath, host, port, authUserName, poolUuid, diskLabel, DiskDef.diskBus.valueOf(bus.toUpperCase()), - DiskDef.diskProtocol.valueOf(protocol.toUpperCase())); + DiskDef.diskProtocol.valueOf(protocol.toUpperCase()), fmt); def.setCacheMode(DiskDef.diskCacheMode.valueOf(diskCacheMode.toUpperCase())); } else { String diskFmtType = getAttrValue("driver", "type", disk); @@ -145,8 +152,9 @@ public class LibvirtDomainXMLParser { if ((bandwidth != null) && (bandwidth.getLength() != 0)) { Integer inbound = Integer.valueOf(getAttrValue("inbound", "average", (Element)bandwidth.item(0))); Integer outbound = Integer.valueOf(getAttrValue("outbound", "average", (Element)bandwidth.item(0))); - if (inbound == outbound) + if (inbound.equals(outbound)) { networkRateKBps = inbound; + } } if (type.equalsIgnoreCase("network")) { String network = getAttrValue("source", "network", nic); diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolDef.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolDef.java index dbe5d4b7835..7631169f2b5 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolDef.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolDef.java @@ -18,7 +18,7 @@ package com.cloud.hypervisor.kvm.resource; public class LibvirtStoragePoolDef { public enum poolType { - ISCSI("iscsi"), NETFS("netfs"), LOGICAL("logical"), DIR("dir"), RBD("rbd"); + ISCSI("iscsi"), NETFS("netfs"), LOGICAL("logical"), DIR("dir"), RBD("rbd"), GLUSTERFS("glusterfs"); String _poolType; poolType(String poolType) { @@ -127,7 +127,15 @@ public class LibvirtStoragePoolDef { @Override public String toString() { StringBuilder storagePoolBuilder = new StringBuilder(); - storagePoolBuilder.append("\n"); + if (_poolType == poolType.GLUSTERFS) { + /* libvirt mounts a Gluster volume, similar to NFS */ + storagePoolBuilder.append("\n"); + } else { + storagePoolBuilder.append("\n"); + } + storagePoolBuilder.append("" + _poolName + "\n"); if (_uuid != null) storagePoolBuilder.append("" + _uuid + "\n"); @@ -148,6 +156,23 @@ public class LibvirtStoragePoolDef { } storagePoolBuilder.append("\n"); } + if (_poolType == poolType.GLUSTERFS) { + storagePoolBuilder.append("\n"); + storagePoolBuilder.append("\n"); + storagePoolBuilder.append("\n"); + storagePoolBuilder.append("\n"); + storagePoolBuilder.append("\n"); + } if (_poolType != poolType.RBD) { storagePoolBuilder.append("\n"); storagePoolBuilder.append("" + _targetPath + "\n"); diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolXMLParser.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolXMLParser.java index a6186f6ba69..6199e5da2c8 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolXMLParser.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolXMLParser.java @@ -52,6 +52,7 @@ public class LibvirtStoragePoolXMLParser { Element source = (Element)rootElement.getElementsByTagName("source").item(0); String host = getAttrValue("host", "name", source); + String format = getAttrValue("format", "type", source); if (type.equalsIgnoreCase("rbd")) { int port = Integer.parseInt(getAttrValue("host", "port", source)); @@ -63,10 +64,27 @@ public class LibvirtStoragePoolXMLParser { String authUsername = auth.getAttribute("username"); String authType = auth.getAttribute("type"); return new LibvirtStoragePoolDef(LibvirtStoragePoolDef.poolType.valueOf(type.toUpperCase()), poolName, uuid, host, port, pool, authUsername, - LibvirtStoragePoolDef.authType.valueOf(authType.toUpperCase()), uuid); + LibvirtStoragePoolDef.authType.valueOf(authType.toUpperCase()), uuid); } else { return new LibvirtStoragePoolDef(LibvirtStoragePoolDef.poolType.valueOf(type.toUpperCase()), poolName, uuid, host, port, pool, ""); } + /* Gluster is a sub-type of LibvirtStoragePoolDef.poolType.NETFS, need to check format */ + } else if (format != null && format.equalsIgnoreCase("glusterfs")) { + /* libvirt does not return the default port, but requires it for a disk-definition */ + int port = 24007; + + String path = getAttrValue("dir", "path", source); + + Element target = (Element) rootElement.getElementsByTagName( + "target").item(0); + String targetPath = getTagValue("path", target); + + String portValue = getAttrValue("host", "port", source); + if (portValue != null && !portValue.isEmpty()) + port = Integer.parseInt(portValue); + + return new LibvirtStoragePoolDef(LibvirtStoragePoolDef.poolType.valueOf(format.toUpperCase()), + poolName, uuid, host, port, path, targetPath); } else { String path = getAttrValue("dir", "path", source); diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java index ff75d61e0b5..4032305b032 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java @@ -378,7 +378,7 @@ public class LibvirtVMDef { } public enum diskProtocol { - RBD("rbd"), SHEEPDOG("sheepdog"); + RBD("rbd"), SHEEPDOG("sheepdog"), GLUSTER("gluster"); String _diskProtocol; diskProtocol(String protocol) { @@ -530,10 +530,10 @@ public class LibvirtVMDef { } public void defNetworkBasedDisk(String diskName, String sourceHost, int sourcePort, String authUserName, String authSecretUUID, int devId, diskBus bus, - diskProtocol protocol) { + diskProtocol protocol, diskFmtType diskFmtType) { _diskType = diskType.NETWORK; _deviceType = deviceType.DISK; - _diskFmtType = diskFmtType.RAW; + _diskFmtType = diskFmtType; _diskCacheMode = diskCacheMode.NONE; _sourcePath = diskName; _sourceHost = sourceHost; @@ -546,10 +546,10 @@ public class LibvirtVMDef { } public void defNetworkBasedDisk(String diskName, String sourceHost, int sourcePort, String authUserName, String authSecretUUID, String diskLabel, diskBus bus, - diskProtocol protocol) { + diskProtocol protocol, diskFmtType diskFmtType) { _diskType = diskType.NETWORK; _deviceType = deviceType.DISK; - _diskFmtType = diskFmtType.RAW; + _diskFmtType = diskFmtType; _diskCacheMode = diskCacheMode.NONE; _sourcePath = diskName; _sourceHost = sourceHost; @@ -664,7 +664,13 @@ public class LibvirtVMDef { diskBuilder.append(" protocol='" + _diskProtocol + "'"); diskBuilder.append(" name='" + _sourcePath + "'"); diskBuilder.append(">\n"); - diskBuilder.append("\n"); + diskBuilder.append("\n"); diskBuilder.append("\n"); if (_authUserName != null) { diskBuilder.append("\n"); diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java index 8c3713fcce1..2ea3b42d0fa 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java @@ -18,6 +18,7 @@ */ package com.cloud.hypervisor.kvm.storage; +import static com.cloud.utils.S3Utils.mputFile; import static com.cloud.utils.S3Utils.putFile; import java.io.BufferedOutputStream; @@ -547,18 +548,22 @@ public class KVMStorageProcessor implements StorageProcessor { return null; //To change body of implemented methods use File | Settings | File Templates. } - protected String copyToS3(File srcFile, S3TO destStore, String destPath) { + protected String copyToS3(File srcFile, S3TO destStore, String destPath) throws InterruptedException { final String bucket = destStore.getBucketName(); + long srcSize = srcFile.length(); String key = destPath + S3Utils.SEPARATOR + srcFile.getName(); - putFile(destStore, srcFile, bucket, key); + if (!destStore.getSingleUpload(srcSize)) { + mputFile(destStore, srcFile, bucket, key); + } else { + putFile(destStore, srcFile, bucket, key); + } return key; } protected Answer copyToObjectStore(CopyCommand cmd) { DataTO srcData = cmd.getSrcTO(); DataTO destData = cmd.getDestTO(); - SnapshotObjectTO snapshot = (SnapshotObjectTO)srcData; DataStoreTO imageStore = destData.getDataStore(); NfsTO srcStore = (NfsTO)srcData.getDataStore(); String srcPath = srcData.getPath(); @@ -585,6 +590,9 @@ public class KVMStorageProcessor implements StorageProcessor { SnapshotObjectTO newSnapshot = new SnapshotObjectTO(); newSnapshot.setPath(destPath); return new CopyCmdAnswer(newSnapshot); + } catch (Exception e) { + s_logger.error("failed to upload" + srcPath, e); + return new CopyCmdAnswer("failed to upload" + srcPath + e.toString()); } finally { try { if (srcFile != null) { @@ -600,9 +608,7 @@ public class KVMStorageProcessor implements StorageProcessor { } protected Answer backupSnapshotForObjectStore(CopyCommand cmd) { - DataTO srcData = cmd.getSrcTO(); DataTO destData = cmd.getDestTO(); - SnapshotObjectTO snapshot = (SnapshotObjectTO)srcData; DataStoreTO imageStore = destData.getDataStore(); DataTO cacheData = cmd.getCacheTO(); if (cacheData == null) { @@ -683,8 +689,6 @@ public class KVMStorageProcessor implements StorageProcessor { Rbd rbd = new Rbd(io); RbdImage image = rbd.open(snapshotDisk.getName(), snapshotName); - long startTime = System.currentTimeMillis() / 1000; - File snapDir = new File(snapshotDestPath); s_logger.debug("Attempting to create " + snapDir.getAbsolutePath() + " recursively"); FileUtils.forceMkdir(snapDir); @@ -935,7 +939,13 @@ public class KVMStorageProcessor implements StorageProcessor { diskdef = new DiskDef(); if (attachingPool.getType() == StoragePoolType.RBD) { diskdef.defNetworkBasedDisk(attachingDisk.getPath(), attachingPool.getSourceHost(), attachingPool.getSourcePort(), attachingPool.getAuthUserName(), - attachingPool.getUuid(), devId, DiskDef.diskBus.VIRTIO, diskProtocol.RBD); + attachingPool.getUuid(), devId, DiskDef.diskBus.VIRTIO, diskProtocol.RBD, DiskDef.diskFmtType.RAW); + } else if (attachingPool.getType() == StoragePoolType.Gluster) { + String mountpoint = attachingPool.getLocalPath(); + String path = attachingDisk.getPath(); + String glusterVolume = attachingPool.getSourceDir().replace("/", ""); + diskdef.defNetworkBasedDisk(glusterVolume + path.replace(mountpoint, ""), attachingPool.getSourceHost(), attachingPool.getSourcePort(), null, + null, devId, DiskDef.diskBus.VIRTIO, diskProtocol.GLUSTER, DiskDef.diskFmtType.QCOW2); } else if (attachingDisk.getFormat() == PhysicalDiskFormat.QCOW2) { diskdef.defFileBasedDisk(attachingDisk.getPath(), devId, DiskDef.diskBus.VIRTIO, DiskDef.diskFmtType.QCOW2); } else if (attachingDisk.getFormat() == PhysicalDiskFormat.RAW) { @@ -970,6 +980,7 @@ public class KVMStorageProcessor implements StorageProcessor { return new AttachAnswer(disk); } catch (LibvirtException e) { s_logger.debug("Failed to attach volume: " + vol.getPath() + ", due to " + e.toString()); + storagePoolMgr.disconnectPhysicalDisk(primaryStore.getPoolType(), primaryStore.getUuid(), vol.getPath()); return new AttachAnswer(e.toString()); } catch (InternalErrorException e) { s_logger.debug("Failed to attach volume: " + vol.getPath() + ", due to " + e.toString()); diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java index c66c51ade13..38ce32b69ea 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java @@ -129,9 +129,9 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { } } - private StoragePool createNfsStoragePool(Connect conn, String uuid, String host, String path) throws LibvirtException { + private StoragePool createNetfsStoragePool(poolType fsType, Connect conn, String uuid, String host, String path) throws LibvirtException { String targetPath = _mountPoint + File.separator + uuid; - LibvirtStoragePoolDef spd = new LibvirtStoragePoolDef(poolType.NETFS, uuid, uuid, host, path, targetPath); + LibvirtStoragePoolDef spd = new LibvirtStoragePoolDef(fsType, uuid, uuid, host, path, targetPath); _storageLayer.mkdir(targetPath); StoragePool sp = null; try { @@ -170,7 +170,7 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { } sp.free(); } catch (LibvirtException l) { - s_logger.debug("Failed to undefine nfs storage pool with: " + l.toString()); + s_logger.debug("Failed to undefine " + fsType.toString() + " storage pool with: " + l.toString()); } } return null; @@ -244,13 +244,12 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { LibvirtStoragePoolDef spd; StoragePool sp = null; + Secret s = null; String[] userInfoTemp = userInfo.split(":"); if (userInfoTemp.length == 2) { LibvirtSecretDef sd = new LibvirtSecretDef(usage.CEPH, uuid); - Secret s = null; - sd.setCephName(userInfoTemp[0] + "@" + host + ":" + port + "/" + path); try { @@ -258,15 +257,16 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { s = conn.secretDefineXML(sd.toString()); s.setValue(Base64.decodeBase64(userInfoTemp[1])); } catch (LibvirtException e) { - s_logger.error(e.toString()); + s_logger.error("Failed to define the libvirt secret: " + e.toString()); if (s != null) { try { s.undefine(); s.free(); } catch (LibvirtException l) { - s_logger.debug("Failed to define secret with: " + l.toString()); + s_logger.debug("Failed to undefine the libvirt secret: " + l.toString()); } } + return null; } spd = new LibvirtStoragePoolDef(poolType.RBD, uuid, uuid, host, port, path, userInfoTemp[0], authType.CEPH, uuid); } else { @@ -278,7 +278,7 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { sp = conn.storagePoolCreateXML(spd.toString(), 0); return sp; } catch (LibvirtException e) { - s_logger.debug(e.toString()); + s_logger.debug("Failed to create RBD storage pool: " + e.toString()); if (sp != null) { try { if (sp.isPersistent() == 1) { @@ -289,9 +289,20 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { } sp.free(); } catch (LibvirtException l) { - s_logger.debug("Failed to define RBD storage pool with: " + l.toString()); + s_logger.debug("Failed to undefine RBD storage pool: " + l.toString()); } } + + if (s != null) { + try { + s_logger.debug("Failed to create the RBD storage pool, cleaning up the libvirt secret"); + s.undefine(); + s.free(); + } catch (LibvirtException se) { + s_logger.debug("Failed to remove the libvirt secret: " + se.toString()); + } + } + return null; } } @@ -310,11 +321,7 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { throw new InternalErrorException("volume:" + srcPath + " is not exits"); } String result = Script.runSimpleBashScript("cp " + srcPath + " " + destPath + File.separator + volumeName, timeout); - if (result != null) { - return false; - } else { - return true; - } + return result == null; } public LibvirtStoragePoolDef getStoragePoolDef(Connect conn, StoragePool pool) throws LibvirtException { @@ -349,14 +356,19 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { type = StoragePoolType.RBD; } else if (spd.getPoolType() == LibvirtStoragePoolDef.poolType.LOGICAL) { type = StoragePoolType.CLVM; + } else if (spd.getPoolType() == LibvirtStoragePoolDef.poolType.GLUSTERFS) { + type = StoragePoolType.Gluster; } LibvirtStoragePool pool = new LibvirtStoragePool(uuid, storage.getName(), type, this, storage); - if (pool.getType() != StoragePoolType.RBD) { + if (pool.getType() != StoragePoolType.RBD) pool.setLocalPath(spd.getTargetPath()); - } else { + else pool.setLocalPath(""); + + if (pool.getType() == StoragePoolType.RBD + || pool.getType() == StoragePoolType.Gluster) { pool.setSourceHost(spd.getSourceHost()); pool.setSourcePort(spd.getSourcePort()); pool.setSourceDir(spd.getSourceDir()); @@ -488,9 +500,17 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { if (type == StoragePoolType.NetworkFilesystem) { try { - sp = createNfsStoragePool(conn, name, host, path); + sp = createNetfsStoragePool(poolType.NETFS, conn, name, host, path); } catch (LibvirtException e) { - s_logger.error("Failed to create mount"); + s_logger.error("Failed to create netfs mount: " + host + ":" + path , e); + s_logger.error(e.getStackTrace()); + throw new CloudRuntimeException(e.toString()); + } + } else if (type == StoragePoolType.Gluster) { + try { + sp = createNetfsStoragePool(poolType.GLUSTERFS, conn, name, host, path); + } catch (LibvirtException e) { + s_logger.error("Failed to create glusterfs mount: " + host + ":" + path , e); s_logger.error(e.getStackTrace()); throw new CloudRuntimeException(e.toString()); } @@ -503,6 +523,10 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { } } + if (sp == null) { + throw new CloudRuntimeException("Failed to create storage pool: " + name); + } + try { if (sp.isActive() == 0) { s_logger.debug("attempting to activate pool " + name); diff --git a/plugins/hypervisors/kvm/src/org/apache/cloudstack/utils/qemu/QemuImg.java b/plugins/hypervisors/kvm/src/org/apache/cloudstack/utils/qemu/QemuImg.java index a948ca1899f..b380815d04b 100644 --- a/plugins/hypervisors/kvm/src/org/apache/cloudstack/utils/qemu/QemuImg.java +++ b/plugins/hypervisors/kvm/src/org/apache/cloudstack/utils/qemu/QemuImg.java @@ -90,11 +90,11 @@ public class QemuImg { if (options != null && !options.isEmpty()) { s.add("-o"); - String optionsStr = ""; + final StringBuilder optionsStr = new StringBuilder(); for (Map.Entry option : options.entrySet()) { - optionsStr += option.getKey() + "=" + option.getValue() + ","; + optionsStr.append(option.getKey()).append('=').append(option.getValue()).append(','); } - s.add(optionsStr); + s.add(optionsStr.toString()); } /* diff --git a/plugins/hypervisors/kvm/src/org/apache/cloudstack/utils/qemu/QemuImgFile.java b/plugins/hypervisors/kvm/src/org/apache/cloudstack/utils/qemu/QemuImgFile.java index 90d925dd085..034c31bde5f 100644 --- a/plugins/hypervisors/kvm/src/org/apache/cloudstack/utils/qemu/QemuImgFile.java +++ b/plugins/hypervisors/kvm/src/org/apache/cloudstack/utils/qemu/QemuImgFile.java @@ -41,7 +41,6 @@ public class QemuImgFile { public QemuImgFile(String fileName, PhysicalDiskFormat format) { this.fileName = fileName; - this.size = size; this.format = format; } diff --git a/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java b/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java index c8af7f8b82b..bf4546c63d1 100644 --- a/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java +++ b/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java @@ -447,4 +447,11 @@ public class LibvirtComputingResourceTest { Assert.assertTrue(vmStat.getDiskReadKBs() > 0); Assert.assertTrue(vmStat.getDiskWriteKBs() > 0); } + + @Test + public void getCpuSpeed() { + Assume.assumeTrue(SystemUtils.IS_OS_LINUX); + NodeInfo nodeInfo = Mockito.mock(NodeInfo.class); + LibvirtComputingResource.getCpuSpeed(nodeInfo); + } } diff --git a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockNetworkManager.java b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockNetworkManager.java index 554af68ebd6..e7a7a956fd0 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockNetworkManager.java +++ b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockNetworkManager.java @@ -25,7 +25,6 @@ import com.cloud.agent.api.NetworkUsageCommand; import com.cloud.agent.api.PlugNicAnswer; import com.cloud.agent.api.PlugNicCommand; import com.cloud.agent.api.PvlanSetupCommand; -import com.cloud.agent.api.SetupGuestNetworkAnswer; import com.cloud.agent.api.SetupGuestNetworkCommand; import com.cloud.agent.api.UnPlugNicAnswer; import com.cloud.agent.api.UnPlugNicCommand; @@ -79,7 +78,7 @@ public interface MockNetworkManager extends Manager { SetPortForwardingRulesAnswer setVpcPortForwards(SetPortForwardingRulesVpcCommand cmd); - SetupGuestNetworkAnswer setUpGuestNetwork(SetupGuestNetworkCommand cmd); + Answer setUpGuestNetwork(SetupGuestNetworkCommand cmd); SetStaticNatRulesAnswer setVPCStaticNatRules(SetStaticNatRulesCommand cmd); diff --git a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockNetworkManagerImpl.java b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockNetworkManagerImpl.java index a4ffd953ea5..c76ef4d80b0 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockNetworkManagerImpl.java +++ b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockNetworkManagerImpl.java @@ -30,7 +30,6 @@ import com.cloud.agent.api.NetworkUsageCommand; import com.cloud.agent.api.PlugNicAnswer; import com.cloud.agent.api.PlugNicCommand; import com.cloud.agent.api.PvlanSetupCommand; -import com.cloud.agent.api.SetupGuestNetworkAnswer; import com.cloud.agent.api.SetupGuestNetworkCommand; import com.cloud.agent.api.UnPlugNicAnswer; import com.cloud.agent.api.UnPlugNicCommand; @@ -203,18 +202,18 @@ public class MockNetworkManagerImpl extends ManagerBase implements MockNetworkMa } @Override - public SetupGuestNetworkAnswer setUpGuestNetwork(SetupGuestNetworkCommand cmd) { + public Answer setUpGuestNetwork(SetupGuestNetworkCommand cmd) { String domrName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME); try { MockVMVO vms = _mockVmDao.findByVmName(domrName); if (vms == null) { - return new SetupGuestNetworkAnswer(cmd, false, "Can not find VM " + domrName); + return new Answer(cmd, false, "Can not find VM " + domrName); } - return new SetupGuestNetworkAnswer(cmd, true, "success"); + return new Answer(cmd, true, "success"); } catch (Exception e) { String msg = "Creating guest network failed due to " + e.toString(); s_logger.warn(msg, e); - return new SetupGuestNetworkAnswer(cmd, false, msg); + return new Answer(cmd, false, msg); } } diff --git a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java index 37394816d24..6fe9b40fa64 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java +++ b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java @@ -87,6 +87,7 @@ import com.cloud.agent.api.routing.DhcpEntryCommand; import com.cloud.agent.api.routing.IpAssocCommand; import com.cloud.agent.api.routing.IpAssocVpcCommand; import com.cloud.agent.api.routing.LoadBalancerConfigCommand; +import com.cloud.agent.api.routing.RemoteAccessVpnCfgCommand; import com.cloud.agent.api.routing.SavePasswordCommand; import com.cloud.agent.api.routing.SetFirewallRulesCommand; import com.cloud.agent.api.routing.SetNetworkACLCommand; @@ -97,6 +98,7 @@ import com.cloud.agent.api.routing.SetStaticNatRulesCommand; import com.cloud.agent.api.routing.SetStaticRouteCommand; import com.cloud.agent.api.routing.Site2SiteVpnCfgCommand; import com.cloud.agent.api.routing.VmDataCommand; +import com.cloud.agent.api.routing.VpnUsersCfgCommand; import com.cloud.agent.api.storage.CopyVolumeCommand; import com.cloud.agent.api.storage.CreateCommand; import com.cloud.agent.api.storage.DestroyCommand; @@ -365,7 +367,9 @@ public class SimulatorManagerImpl extends ManagerBase implements SimulatorManage } else if (cmd instanceof PvlanSetupCommand) { return _mockNetworkMgr.setupPVLAN((PvlanSetupCommand)cmd); } else if (cmd instanceof StorageSubSystemCommand) { - return this.storageHandler.handleStorageCommands((StorageSubSystemCommand)cmd); + return this.storageHandler.handleStorageCommands((StorageSubSystemCommand) cmd); + } else if (cmd instanceof VpnUsersCfgCommand || cmd instanceof RemoteAccessVpnCfgCommand) { + return new Answer(cmd); } else { s_logger.error("Simulator does not implement command of type " + cmd.toString()); return Answer.createUnsupportedCommandAnswer(cmd); diff --git a/plugins/hypervisors/simulator/src/com/cloud/api/commands/ConfigureSimulatorCmd.java b/plugins/hypervisors/simulator/src/com/cloud/api/commands/ConfigureSimulatorCmd.java index c27a363e51c..65bc7be0ec0 100755 --- a/plugins/hypervisors/simulator/src/com/cloud/api/commands/ConfigureSimulatorCmd.java +++ b/plugins/hypervisors/simulator/src/com/cloud/api/commands/ConfigureSimulatorCmd.java @@ -35,7 +35,8 @@ import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.Account; -@APICommand(name = "configureSimulator", description = "configure simulator", responseObject = SuccessResponse.class) +@APICommand(name = "configureSimulator", description = "configure simulator", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ConfigureSimulatorCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(ConfigureSimulatorCmd.class.getName()); private static final String s_name = "configuresimulatorresponse"; diff --git a/plugins/hypervisors/simulator/src/org/apache/cloudstack/storage/datastore/driver/SimulatorImageStoreDriverImpl.java b/plugins/hypervisors/simulator/src/org/apache/cloudstack/storage/datastore/driver/SimulatorImageStoreDriverImpl.java index ff5c3a6fc6d..4497448af09 100644 --- a/plugins/hypervisors/simulator/src/org/apache/cloudstack/storage/datastore/driver/SimulatorImageStoreDriverImpl.java +++ b/plugins/hypervisors/simulator/src/org/apache/cloudstack/storage/datastore/driver/SimulatorImageStoreDriverImpl.java @@ -23,6 +23,7 @@ import java.util.UUID; import javax.inject.Inject; +import org.apache.cloudstack.storage.command.CommandResult; import org.apache.log4j.Logger; import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult; @@ -78,6 +79,11 @@ public class SimulatorImageStoreDriverImpl extends BaseImageStoreDriverImpl { } } + @Override + public void deleteAsync(DataStore dataStore, DataObject data, AsyncCompletionCallback callback) { + callback.complete(new CommandResult()); + } + protected void createTemplate(DataObject data, AsyncCompletionCallback callback) { CreateContext context = new CreateContext(callback, data); AsyncCallbackDispatcher caller = AsyncCallbackDispatcher.create(this); diff --git a/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/AddUcsManagerCmd.java b/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/AddUcsManagerCmd.java index 17cd3ab4c59..5cb0b6464f8 100755 --- a/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/AddUcsManagerCmd.java +++ b/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/AddUcsManagerCmd.java @@ -32,7 +32,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.ucs.manager.UcsManager; import com.cloud.user.Account; -@APICommand(name = "addUcsManager", description = "Adds a Ucs manager", responseObject = UcsManagerResponse.class) +@APICommand(name = "addUcsManager", description = "Adds a Ucs manager", responseObject = UcsManagerResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AddUcsManagerCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(AddUcsManagerCmd.class); diff --git a/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/AssociateUcsProfileToBladeCmd.java b/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/AssociateUcsProfileToBladeCmd.java index caea0bec21e..a310037a8a2 100755 --- a/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/AssociateUcsProfileToBladeCmd.java +++ b/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/AssociateUcsProfileToBladeCmd.java @@ -33,7 +33,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.ucs.manager.UcsManager; import com.cloud.user.Account; -@APICommand(name = "associateUcsProfileToBlade", description = "associate a profile to a blade", responseObject = UcsBladeResponse.class) +@APICommand(name = "associateUcsProfileToBlade", description = "associate a profile to a blade", responseObject = UcsBladeResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AssociateUcsProfileToBladeCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(AssociateUcsProfileToBladeCmd.class); diff --git a/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/DeleteUcsManagerCmd.java b/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/DeleteUcsManagerCmd.java index 566ee30458b..12dd6a071fc 100644 --- a/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/DeleteUcsManagerCmd.java +++ b/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/DeleteUcsManagerCmd.java @@ -32,7 +32,8 @@ import com.cloud.ucs.manager.UcsManager; import com.cloud.user.Account; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "deleteUcsManager", description = "Delete a Ucs manager", responseObject = SuccessResponse.class) +@APICommand(name = "deleteUcsManager", description = "Delete a Ucs manager", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteUcsManagerCmd extends BaseCmd { private static final Logger logger = Logger.getLogger(DeleteUcsManagerCmd.class); diff --git a/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/ListUcsBladeCmd.java b/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/ListUcsBladeCmd.java index 41c7cc1f6ba..b48ba018800 100755 --- a/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/ListUcsBladeCmd.java +++ b/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/ListUcsBladeCmd.java @@ -32,7 +32,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.ucs.manager.UcsManager; import com.cloud.user.Account; -@APICommand(name = "listUcsBlades", description = "List ucs blades", responseObject = UcsBladeResponse.class) +@APICommand(name = "listUcsBlades", description = "List ucs blades", responseObject = UcsBladeResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListUcsBladeCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListUcsBladeCmd.class); diff --git a/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/ListUcsManagerCmd.java b/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/ListUcsManagerCmd.java index 767682fb0c6..1af039147fd 100755 --- a/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/ListUcsManagerCmd.java +++ b/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/ListUcsManagerCmd.java @@ -41,7 +41,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.ucs.manager.UcsManager; import com.cloud.user.Account; -@APICommand(name = "listUcsManagers", description = "List ucs manager", responseObject = UcsManagerResponse.class) +@APICommand(name = "listUcsManagers", description = "List ucs manager", responseObject = UcsManagerResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListUcsManagerCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListUcsManagerCmd.class); diff --git a/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/ListUcsProfileCmd.java b/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/ListUcsProfileCmd.java index cc49cef5520..b52cb775def 100755 --- a/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/ListUcsProfileCmd.java +++ b/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/ListUcsProfileCmd.java @@ -33,7 +33,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.ucs.manager.UcsManager; import com.cloud.user.Account; -@APICommand(name = "listUcsProfiles", description = "List profile in ucs manager", responseObject = UcsProfileResponse.class) +@APICommand(name = "listUcsProfiles", description = "List profile in ucs manager", responseObject = UcsProfileResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListUcsProfileCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListUcsProfileCmd.class); diff --git a/plugins/hypervisors/vmware/src/com/cloud/api/commands/DeleteCiscoNexusVSMCmd.java b/plugins/hypervisors/vmware/src/com/cloud/api/commands/DeleteCiscoNexusVSMCmd.java index 9e19719a6b7..2e0e08ede68 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/api/commands/DeleteCiscoNexusVSMCmd.java +++ b/plugins/hypervisors/vmware/src/com/cloud/api/commands/DeleteCiscoNexusVSMCmd.java @@ -38,7 +38,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.element.CiscoNexusVSMElementService; import com.cloud.user.Account; -@APICommand(name = "deleteCiscoNexusVSM", responseObject = SuccessResponse.class, description = " delete a Cisco Nexus VSM device") +@APICommand(name = "deleteCiscoNexusVSM", responseObject = SuccessResponse.class, description = " delete a Cisco Nexus VSM device", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteCiscoNexusVSMCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteCiscoNexusVSMCmd.class.getName()); diff --git a/plugins/hypervisors/vmware/src/com/cloud/api/commands/DisableCiscoNexusVSMCmd.java b/plugins/hypervisors/vmware/src/com/cloud/api/commands/DisableCiscoNexusVSMCmd.java index 0e4d306b934..3c246dee3e5 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/api/commands/DisableCiscoNexusVSMCmd.java +++ b/plugins/hypervisors/vmware/src/com/cloud/api/commands/DisableCiscoNexusVSMCmd.java @@ -38,7 +38,8 @@ import com.cloud.network.CiscoNexusVSMDevice; import com.cloud.network.element.CiscoNexusVSMElementService; import com.cloud.user.Account; -@APICommand(name = "disableCiscoNexusVSM", responseObject = CiscoNexusVSMResponse.class, description = "disable a Cisco Nexus VSM device") +@APICommand(name = "disableCiscoNexusVSM", responseObject = CiscoNexusVSMResponse.class, description = "disable a Cisco Nexus VSM device", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DisableCiscoNexusVSMCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DisableCiscoNexusVSMCmd.class.getName()); diff --git a/plugins/hypervisors/vmware/src/com/cloud/api/commands/EnableCiscoNexusVSMCmd.java b/plugins/hypervisors/vmware/src/com/cloud/api/commands/EnableCiscoNexusVSMCmd.java index 63c79fb4c96..85e4584f855 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/api/commands/EnableCiscoNexusVSMCmd.java +++ b/plugins/hypervisors/vmware/src/com/cloud/api/commands/EnableCiscoNexusVSMCmd.java @@ -38,7 +38,8 @@ import com.cloud.network.CiscoNexusVSMDevice; import com.cloud.network.element.CiscoNexusVSMElementService; import com.cloud.user.Account; -@APICommand(name = "enableCiscoNexusVSM", responseObject = CiscoNexusVSMResponse.class, description = "Enable a Cisco Nexus VSM device") +@APICommand(name = "enableCiscoNexusVSM", responseObject = CiscoNexusVSMResponse.class, description = "Enable a Cisco Nexus VSM device", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class EnableCiscoNexusVSMCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(EnableCiscoNexusVSMCmd.class.getName()); diff --git a/plugins/hypervisors/vmware/src/com/cloud/api/commands/ListCiscoNexusVSMsCmd.java b/plugins/hypervisors/vmware/src/com/cloud/api/commands/ListCiscoNexusVSMsCmd.java index 381bfc918e5..f6604b4b942 100755 --- a/plugins/hypervisors/vmware/src/com/cloud/api/commands/ListCiscoNexusVSMsCmd.java +++ b/plugins/hypervisors/vmware/src/com/cloud/api/commands/ListCiscoNexusVSMsCmd.java @@ -45,7 +45,8 @@ import com.cloud.user.Account; @APICommand(name = "listCiscoNexusVSMs", responseObject = CiscoNexusVSMResponse.class, - description = "Retrieves a Cisco Nexus 1000v Virtual Switch Manager device associated with a Cluster") + description = "Retrieves a Cisco Nexus 1000v Virtual Switch Manager device associated with a Cluster", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListCiscoNexusVSMsCmd extends BaseListCmd { /** diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java index 9a30f189062..9cb37f576bb 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java @@ -83,12 +83,11 @@ import com.cloud.utils.Pair; import com.cloud.utils.db.DB; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.net.NetUtils; -import com.cloud.vm.ConsoleProxyVO; -import com.cloud.vm.DomainRouterVO; import com.cloud.vm.NicProfile; import com.cloud.vm.NicVO; import com.cloud.vm.SecondaryStorageVmVO; import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachine.Type; import com.cloud.vm.VirtualMachineProfile; import com.cloud.vm.VmDetailConstants; import com.cloud.vm.dao.NicDao; @@ -151,9 +150,12 @@ public class VMwareGuru extends HypervisorGuruBase implements HypervisorGuru, Co if (details == null) details = new HashMap(); + Type vmType = vm.getType(); + boolean userVm = !(vmType.equals(VirtualMachine.Type.DomainRouter) || vmType.equals(VirtualMachine.Type.ConsoleProxy) + || vmType.equals(VirtualMachine.Type.SecondaryStorageVm)); + String nicDeviceType = details.get(VmDetailConstants.NIC_ADAPTER); - if (vm.getVirtualMachine() instanceof DomainRouterVO || vm.getVirtualMachine() instanceof ConsoleProxyVO || - vm.getVirtualMachine() instanceof SecondaryStorageVmVO) { + if (!userVm) { if (nicDeviceType == null) { details.put(VmDetailConstants.NIC_ADAPTER, _vmwareMgr.getSystemVMDefaultNicAdapterType()); @@ -180,8 +182,7 @@ public class VMwareGuru extends HypervisorGuruBase implements HypervisorGuru, Co } String diskDeviceType = details.get(VmDetailConstants.ROOK_DISK_CONTROLLER); - if (!(vm.getVirtualMachine() instanceof DomainRouterVO || vm.getVirtualMachine() instanceof ConsoleProxyVO || vm.getVirtualMachine() instanceof SecondaryStorageVmVO)) { - // user vm + if (userVm) { if (diskDeviceType == null) { details.put(VmDetailConstants.ROOK_DISK_CONTROLLER, _vmwareMgr.getRootDiskController()); } @@ -203,7 +204,7 @@ public class VMwareGuru extends HypervisorGuruBase implements HypervisorGuru, Co details.put(Config.VmwareReserveMem.key(), VmwareReserveMemory.valueIn(clusterId).toString()); to.setDetails(details); - if (vm.getVirtualMachine() instanceof DomainRouterVO) { + if (vmType.equals(VirtualMachine.Type.DomainRouter)) { NicProfile publicNicProfile = null; for (NicProfile nicProfile : nicProfiles) { @@ -269,15 +270,17 @@ public class VMwareGuru extends HypervisorGuruBase implements HypervisorGuru, Co for (NicTO nicTo : sortNicsByDeviceId(to.getNics())) { sbMacSequence.append(nicTo.getMac()).append("|"); } - sbMacSequence.deleteCharAt(sbMacSequence.length() - 1); - String bootArgs = to.getBootArgs(); - to.setBootArgs(bootArgs + " nic_macs=" + sbMacSequence.toString()); + if (!sbMacSequence.toString().isEmpty()) { + sbMacSequence.deleteCharAt(sbMacSequence.length() - 1); + String bootArgs = to.getBootArgs(); + to.setBootArgs(bootArgs + " nic_macs=" + sbMacSequence.toString()); + } } // Don't do this if the virtual machine is one of the special types // Should only be done on user machines - if (!(vm.getVirtualMachine() instanceof DomainRouterVO || vm.getVirtualMachine() instanceof ConsoleProxyVO || vm.getVirtualMachine() instanceof SecondaryStorageVmVO)) { + if (userVm) { String nestedVirt = _configDao.getValue(Config.VmwareEnableNestedVirtualization.key()); if (nestedVirt != null) { s_logger.debug("Nested virtualization requested, adding flag to vm configuration"); diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java index e6ecbc9adbc..5ab5af0e041 100755 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java @@ -42,14 +42,12 @@ import com.cloud.dc.ClusterDetailsDao; import com.cloud.dc.ClusterVO; import com.cloud.dc.DataCenter.NetworkType; import com.cloud.dc.DataCenterVO; -import com.cloud.dc.dao.ClusterDao; import com.cloud.dc.dao.DataCenterDao; import com.cloud.exception.DiscoveredWithErrorException; import com.cloud.exception.DiscoveryException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceInUseException; import com.cloud.host.HostVO; -import com.cloud.host.dao.HostDao; import com.cloud.hypervisor.Hypervisor; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.hypervisor.dao.HypervisorCapabilitiesDao; @@ -87,8 +85,6 @@ import com.cloud.utils.UriUtils; public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer, ResourceStateAdapter { private static final Logger s_logger = Logger.getLogger(VmwareServerDiscoverer.class); - @Inject - ClusterDao _clusterDao; @Inject VmwareManager _vmwareMgr; @Inject @@ -98,8 +94,6 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer @Inject ClusterDetailsDao _clusterDetailsDao; @Inject - HostDao _hostDao; - @Inject DataCenterDao _dcDao; @Inject ResourceManager _resourceMgr; diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java index 4f443bbb4a7..67d3963cdc5 100755 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java @@ -382,10 +382,10 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw @Override public List addHostToPodCluster(VmwareContext serviceContext, long dcId, Long podId, Long clusterId, String hostInventoryPath) throws Exception { - ManagedObjectReference mor = null; - if (serviceContext != null) { - mor = serviceContext.getHostMorByPath(hostInventoryPath); + if (serviceContext == null) { + throw new CloudRuntimeException("Invalid serviceContext"); } + ManagedObjectReference mor = serviceContext.getHostMorByPath(hostInventoryPath); String privateTrafficLabel = null; privateTrafficLabel = serviceContext.getStockObject("privateTrafficLabel"); if (privateTrafficLabel == null) { diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java index c609686efa1..3eac0fc8b7b 100755 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java @@ -247,6 +247,7 @@ import com.cloud.hypervisor.vmware.mo.HostMO; import com.cloud.hypervisor.vmware.mo.HostStorageSystemMO; import com.cloud.hypervisor.vmware.mo.HypervisorHostHelper; import com.cloud.hypervisor.vmware.mo.NetworkDetails; +import com.cloud.hypervisor.vmware.mo.TaskMO; import com.cloud.hypervisor.vmware.mo.VirtualEthernetCardType; import com.cloud.hypervisor.vmware.mo.VirtualMachineDiskInfo; import com.cloud.hypervisor.vmware.mo.VirtualMachineDiskInfoBuilder; @@ -394,7 +395,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa if (clz == CreateCommand.class) { answer = execute((CreateCommand)cmd); } else if (cmd instanceof NetworkElementCommand) { - return _vrResource.executeRequest(cmd); + return _vrResource.executeRequest((NetworkElementCommand)cmd); } else if (clz == ReadyCommand.class) { answer = execute((ReadyCommand)cmd); } else if (clz == GetHostStatsCommand.class) { @@ -538,6 +539,33 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa return answer; } + /** + * Registers the vm to the inventory given the vmx file. + */ + private void registerVm(String vmName, DatastoreMO dsMo) throws Exception{ + + //1st param + VmwareHypervisorHost hyperHost = getHyperHost(getServiceContext()); + ManagedObjectReference dcMor = hyperHost.getHyperHostDatacenter(); + DatacenterMO dataCenterMo = new DatacenterMO(getServiceContext(), dcMor); + ManagedObjectReference vmFolderMor = dataCenterMo.getVmFolder(); + + //2nd param + String vmxFilePath = dsMo.searchFileInSubFolders(vmName + ".vmx", false); + + // 5th param + ManagedObjectReference morPool = hyperHost.getHyperHostOwnerResourcePool(); + + ManagedObjectReference morTask = getServiceContext().getService().registerVMTask(vmFolderMor, vmxFilePath, vmName, false, morPool, hyperHost.getMor()); + boolean result = getServiceContext().getVimClient().waitForTask(morTask); + if (!result) { + throw new Exception("Unable to register vm due to " + TaskMO.getTaskFailureInfo(getServiceContext(), morTask)); + } else { + getServiceContext().waitForTaskProgressDone(morTask); + } + + } + private Answer execute(ResizeVolumeCommand cmd) { String path = cmd.getPath(); String vmName = cmd.getInstanceName(); @@ -663,8 +691,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa public ExecutionResult createFileInVR(String routerIp, String filePath, String fileName, String content) { VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); File keyFile = mgr.getSystemVMKeyFile(); - boolean result = true; - try { SshHelper.scpTo(routerIp, 3922, "root", keyFile, null, filePath, content.getBytes(), fileName, null); } catch (Exception e) { @@ -1065,9 +1091,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } private ExecutionResult prepareNetworkElementCommand(IpAssocCommand cmd) { - int i = 0; - String[] results = new String[cmd.getIpAddresses().length]; - VmwareContext context = getServiceContext(); try { VmwareHypervisorHost hyperHost = getHyperHost(context); @@ -1142,15 +1165,13 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } private ExecutionResult NetworkElementCommandnup(IpAssocCommand cmd) { - String[] results = new String[cmd.getIpAddresses().length]; - VmwareContext context = getServiceContext(); try { VmwareHypervisorHost hyperHost = getHyperHost(context); IpAddressTO[] ips = cmd.getIpAddresses(); String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME); - String controlIp = VmwareResource.getRouterSshControlIp(cmd); + VmwareResource.getRouterSshControlIp(cmd); VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(routerName); @@ -1457,12 +1478,10 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa assert (vmSpec.getMinSpeed() != null) && (rootDiskDataStoreDetails != null); if (rootDiskDataStoreDetails.second().folderExists(String.format("[%s]", rootDiskDataStoreDetails.second().getName()), vmNameOnVcenter)) { - s_logger.warn("WARN!!! Folder already exists on datastore for new VM " + vmNameOnVcenter + ", erase it"); - rootDiskDataStoreDetails.second().deleteFile(String.format("[%s] %s/", rootDiskDataStoreDetails.second().getName(), vmNameOnVcenter), - dcMo.getMor(), false); - } - - if (!hyperHost.createBlankVm(vmNameOnVcenter, vmInternalCSName, vmSpec.getCpus(), vmSpec.getMaxSpeed().intValue(), + registerVm(vmNameOnVcenter, dsRootVolumeIsOn); + vmMo = hyperHost.findVmOnHyperHost(vmInternalCSName); + tearDownVm(vmMo); + }else if (!hyperHost.createBlankVm(vmNameOnVcenter, vmInternalCSName, vmSpec.getCpus(), vmSpec.getMaxSpeed().intValue(), getReservedCpuMHZ(vmSpec), vmSpec.getLimitCpuUse(), (int)(vmSpec.getMaxRam() / (1024 * 1024)), getReservedMemoryMb(vmSpec), translateGuestOsIdentifier(vmSpec.getArch(), vmSpec.getOs()).value(), rootDiskDataStoreDetails.first(), false)) { throw new Exception("Failed to create VM. vmName: " + vmInternalCSName); @@ -1774,6 +1793,19 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } } + private void tearDownVm(VirtualMachineMO vmMo) throws Exception{ + + if(vmMo == null) return; + + boolean hasSnapshot = false; + hasSnapshot = vmMo.hasSnapshot(); + if (!hasSnapshot) + vmMo.tearDownDevices(new Class[] {VirtualDisk.class, VirtualEthernetCard.class}); + else + vmMo.tearDownDevices(new Class[] {VirtualEthernetCard.class}); + vmMo.ensureScsiDeviceController(); + } + @Override public ManagedObjectReference prepareManagedStorage(VmwareHypervisorHost hyperHost, String iScsiName, String storageHost, int storagePort, String chapInitiatorUsername, String chapInitiatorSecret, @@ -2956,6 +2988,8 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa VolumeTO volume; StorageFilerTO filerTo; Set mountedDatastoresAtSource = new HashSet(); + List volumeToList = new ArrayList(); + Map volumeDeviceKey = new HashMap(); Map volToFiler = cmd.getVolumeToFiler(); String tgtHost = cmd.getTargetHost(); @@ -3017,9 +3051,11 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa ".vmdk"); diskLocator = new VirtualMachineRelocateSpecDiskLocator(); diskLocator.setDatastore(morDsAtSource); - diskLocator.setDiskId(getVirtualDiskInfo(vmMo, volume.getPath() + ".vmdk")); + int diskId = getVirtualDiskInfo(vmMo, volume.getPath() + ".vmdk"); + diskLocator.setDiskId(diskId); diskLocators.add(diskLocator); + volumeDeviceKey.put(volume.getId(), diskId); } relocateSpec.getDisk().addAll(diskLocators); @@ -3051,6 +3087,22 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa s_logger.debug("Successfully migrated storage of VM " + vmName + " to target datastore(s)"); } + // Update and return volume path for every disk because that could have changed after migration + for (Entry entry : volToFiler.entrySet()) { + volume = entry.getKey(); + long volumeId = volume.getId(); + VirtualDisk[] disks = vmMo.getAllDiskDevice(); + for (VirtualDisk disk : disks) { + if (volumeDeviceKey.get(volumeId) == disk.getKey()) { + VolumeObjectTO newVol = new VolumeObjectTO(); + newVol.setId(volumeId); + newVol.setPath(vmMo.getVmdkFileBaseName(disk)); + volumeToList.add(newVol); + break; + } + } + } + // Change host ManagedObjectReference morPool = tgtHyperHost.getHyperHostOwnerResourcePool(); if (!vmMo.migrate(morPool, tgtHyperHost.getMor())) { @@ -3060,7 +3112,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } state = State.Stopping; - List volumeToList = null; return new MigrateWithStorageAnswer(cmd, volumeToList); } catch (Throwable e) { if (e instanceof RemoteException) { @@ -3131,10 +3182,12 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa throw new Exception(msg); } - VmwareStorageLayoutHelper.getVmwareDatastorePathFromVmdkFileName(new DatastoreMO(srcHyperHost.getContext(), morDs), vmName, volumePath + ".vmdk"); + DatastoreMO targetDsMo = new DatastoreMO(srcHyperHost.getContext(), morDs); + String fullVolumePath = VmwareStorageLayoutHelper.getVmwareDatastorePathFromVmdkFileName(targetDsMo, vmName, volumePath + ".vmdk"); + int diskId = getVirtualDiskInfo(vmMo, volumePath + ".vmdk"); diskLocator = new VirtualMachineRelocateSpecDiskLocator(); diskLocator.setDatastore(morDs); - diskLocator.setDiskId(getVirtualDiskInfo(vmMo, volumePath + ".vmdk")); + diskLocator.setDiskId(diskId); diskLocators.add(diskLocator); relocateSpec.getDisk().add(diskLocator); @@ -3146,6 +3199,15 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa s_logger.debug("Successfully migrated volume " + volumePath + " to target datastore " + tgtDsName); } + // Update and return volume path because that could have changed after migration + if (!targetDsMo.fileExists(fullVolumePath)) { + VirtualDisk[] disks = vmMo.getAllDiskDevice(); + for (VirtualDisk disk : disks) + if (disk.getKey() == diskId) { + volumePath = vmMo.getVmdkFileBaseName(disk); + } + } + return new MigrateVolumeAnswer(cmd, true, null, volumePath); } catch (Exception e) { String msg = "Catch Exception " + e.getClass().getName() + " due to " + e.toString(); @@ -3155,7 +3217,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } private int getVirtualDiskInfo(VirtualMachineMO vmMo, String srcDiskName) throws Exception { - Pair deviceInfo = vmMo.getDiskDevice(srcDiskName, false); + Pair deviceInfo = vmMo.getDiskDevice(srcDiskName, true); if (deviceInfo == null) { throw new Exception("No such disk device: " + srcDiskName); } @@ -4035,18 +4097,47 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa if (s_logger.isInfoEnabled()) { s_logger.info("Executing resource PingTestCommand: " + _gson.toJson(cmd)); } + String controlIp = cmd.getRouterIp(); - String args = " -c 1 -n -q " + cmd.getPrivateIp(); - try { - VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); - Pair result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/bin/ping" + args); - if (result.first()) - return new Answer(cmd); - } catch (Exception e) { - s_logger.error( - "Unable to execute ping command on DomR (" + controlIp + "), domR may not be ready yet. failure due to " + VmwareHelper.getExceptionMessage(e), e); + if (controlIp != null) { + String args = " -c 1 -n -q " + cmd.getPrivateIp(); + try { + VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); + Pair result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/bin/ping" + args); + if (result.first()) + return new Answer(cmd); + } catch (Exception e) { + s_logger.error("Unable to execute ping command on DomR (" + controlIp + "), domR may not be ready yet. failure due to " + + VmwareHelper.getExceptionMessage(e), e); + } + return new Answer(cmd, false, "PingTestCommand failed"); + } else { + VmwareContext context = getServiceContext(); + VmwareHypervisorHost hyperHost = getHyperHost(context); + + try { + HostMO hostMo = (HostMO)hyperHost; + ClusterMO clusterMo = new ClusterMO(context, hostMo.getHyperHostCluster()); + VmwareManager mgr = context.getStockObject(VmwareManager.CONTEXT_STOCK_NAME); + + List> hosts = clusterMo.getClusterHosts(); + for (Pair entry : hosts) { + HostMO hostInCluster = new HostMO(context, entry.first()); + String hostIp = hostInCluster.getHostManagementIp(mgr.getManagementPortGroupName()); + if (hostIp != null && hostIp.equals(cmd.getComputingHostIp())) { + if (hostInCluster.isHyperHostConnected()) + return new Answer(cmd); + else + new Answer(cmd, false, "PingTestCommand failed"); + } + } + } catch (Exception e) { + s_logger.error("Unable to execute ping command on host (" + cmd.getComputingHostIp() + "). failure due to " + + VmwareHelper.getExceptionMessage(e), e); + } + + return new Answer(cmd, false, "PingTestCommand failed"); } - return new Answer(cmd, false, "PingTestCommand failed"); } protected Answer execute(CheckOnHostCommand cmd) { @@ -4477,10 +4568,13 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa null); return new CreateAnswer(cmd, vol); } finally { - vmMo.detachAllDisks(); s_logger.info("Destroy dummy VM after volume creation"); - vmMo.destroy(); + if (vmMo != null) { + s_logger.warn("Unable to destroy a null VM ManagedObjectReference"); + vmMo.detachAllDisks(); + vmMo.destroy(); + } } } else { VirtualMachineMO vmTemplate = VmwareHelper.pickOneVmOnRunningHost(dcMo.findVmByNameAndLabel(cmd.getTemplateUrl()), true); @@ -4537,8 +4631,11 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa return new CreateAnswer(cmd, vol); } finally { s_logger.info("Destroy dummy VM after volume creation"); - vmMo.detachAllDisks(); - vmMo.destroy(); + if (vmMo != null) { + s_logger.warn("Unable to destroy a null VM ManagedObjectReference"); + vmMo.detachAllDisks(); + vmMo.destroy(); + } } } } catch (Throwable e) { @@ -4574,6 +4671,17 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa if (newStates == null) { return null; } + + VmwareContext context = getServiceContext(); + VmwareHypervisorHost hyperHost = getHyperHost(context); + try { + if (!hyperHost.isHyperHostConnected()) { + return null; + } + } catch (Exception e) { + s_logger.error("Unexpected exception", e); + return null; + } return new PingRoutingCommand(getType(), id, newStates, syncHostVmStates()); } diff --git a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java index 2dbda5df961..9d86b16d6a4 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java +++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java @@ -123,17 +123,17 @@ public class VmwareStorageProcessor implements StorageProcessor { } private void copyTemplateFromSecondaryToPrimary(VmwareHypervisorHost hyperHost, DatastoreMO datastoreMo, String secondaryStorageUrl, - String templatePathAtSecondaryStorage, String templateName, String templateUuid) throws Exception { + String templatePathAtSecondaryStorage, String templateName, String templateUuid) throws Exception { s_logger.info("Executing copyTemplateFromSecondaryToPrimary. secondaryStorage: " + secondaryStorageUrl + ", templatePathAtSecondaryStorage: " + - templatePathAtSecondaryStorage + ", templateName: " + templateName); + templatePathAtSecondaryStorage + ", templateName: " + templateName); String secondaryMountPoint = mountService.getMountPoint(secondaryStorageUrl); s_logger.info("Secondary storage mount point: " + secondaryMountPoint); String srcOVAFileName = - VmwareStorageLayoutHelper.getTemplateOnSecStorageFilePath(secondaryMountPoint, templatePathAtSecondaryStorage, templateName, - ImageFormat.OVA.getFileExtension()); + VmwareStorageLayoutHelper.getTemplateOnSecStorageFilePath(secondaryMountPoint, templatePathAtSecondaryStorage, templateName, + ImageFormat.OVA.getFileExtension()); String srcFileName = getOVFFilePath(srcOVAFileName); if (srcFileName == null) { @@ -163,7 +163,7 @@ public class VmwareStorageProcessor implements StorageProcessor { VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(vmName); if (vmMo == null) { String msg = - "Failed to import OVA template. secondaryStorage: " + secondaryStorageUrl + ", templatePathAtSecondaryStorage: " + templatePathAtSecondaryStorage + + "Failed to import OVA template. secondaryStorage: " + secondaryStorageUrl + ", templatePathAtSecondaryStorage: " + templatePathAtSecondaryStorage + ", templateName: " + templateName + ", templateUuid: " + templateUuid; s_logger.error(msg); throw new Exception(msg); @@ -218,7 +218,7 @@ public class VmwareStorageProcessor implements StorageProcessor { DatastoreMO primaryStorageDatastoreMo = new DatastoreMO(context, morDs); copyTemplateFromSecondaryToPrimary(hyperHost, primaryStorageDatastoreMo, secondaryStorageUrl, templateInfo.first(), templateInfo.second(), - templateUuidName); + templateUuidName); } else { s_logger.info("Template " + templateInfo.second() + " has already been setup, skip the template setup process in primary storage"); } @@ -238,7 +238,7 @@ public class VmwareStorageProcessor implements StorageProcessor { } private boolean createVMLinkedClone(VirtualMachineMO vmTemplate, DatacenterMO dcMo, DatastoreMO dsMo, String vmdkName, ManagedObjectReference morDatastore, - ManagedObjectReference morPool) throws Exception { + ManagedObjectReference morPool) throws Exception { ManagedObjectReference morBaseSnapshot = vmTemplate.getSnapshotMor("cloud.template.base"); if (morBaseSnapshot == null) { @@ -257,7 +257,7 @@ public class VmwareStorageProcessor implements StorageProcessor { } private boolean createVMFullClone(VirtualMachineMO vmTemplate, DatacenterMO dcMo, DatastoreMO dsMo, String vmdkName, ManagedObjectReference morDatastore, - ManagedObjectReference morPool) throws Exception { + ManagedObjectReference morPool) throws Exception { s_logger.info("creating full clone from template"); if (!vmTemplate.createFullClone(vmdkName, dcMo.getVmFolder(), morPool, morDatastore)) { @@ -293,7 +293,7 @@ public class VmwareStorageProcessor implements StorageProcessor { String vmdkFileBaseName = null; if (srcStore == null) { // create a root volume for blank VM (created from ISO) - String dummyVmName = this.hostService.getWorkerName(context, cmd, 0); + String dummyVmName = hostService.getWorkerName(context, cmd, 0); try { vmMo = HypervisorHostHelper.createWorkerVM(hyperHost, dsMo, dummyVmName); @@ -312,10 +312,12 @@ public class VmwareStorageProcessor implements StorageProcessor { vmMo.detachDisk(volumeDatastorePath, false); } } finally { - vmMo.detachAllDisks(); - s_logger.info("Destroy dummy VM after volume creation"); - vmMo.destroy(); + if (vmMo != null) { + s_logger.warn("Unable to destroy a null VM ManagedObjectReference"); + vmMo.detachAllDisks(); + vmMo.destroy(); + } } } else { String templatePath = template.getPath(); @@ -459,7 +461,7 @@ public class VmwareStorageProcessor implements StorageProcessor { } private Pair copyVolumeToSecStorage(VmwareHostService hostService, VmwareHypervisorHost hyperHost, CopyCommand cmd, String vmName, String poolId, - String volumePath, String destVolumePath, String secStorageUrl, String workerVmName) throws Exception { + String volumePath, String destVolumePath, String secStorageUrl, String workerVmName) throws Exception { VirtualMachineMO workerVm = null; VirtualMachineMO vmMo = null; String exportName = UUID.randomUUID().toString().replace("-", ""); @@ -521,8 +523,8 @@ public class VmwareStorageProcessor implements StorageProcessor { Pair result; result = - copyVolumeToSecStorage(hostService, hyperHost, cmd, vmName, primaryStorage.getUuid(), srcVolume.getPath(), destVolume.getPath(), destStore.getUrl(), - hostService.getWorkerName(context, cmd, 0)); + copyVolumeToSecStorage(hostService, hyperHost, cmd, vmName, primaryStorage.getUuid(), srcVolume.getPath(), destVolume.getPath(), destStore.getUrl(), + hostService.getWorkerName(context, cmd, 0)); VolumeObjectTO newVolume = new VolumeObjectTO(); newVolume.setPath(result.first() + File.separator + result.second()); return new CopyCmdAnswer(newVolume); @@ -577,7 +579,7 @@ public class VmwareStorageProcessor implements StorageProcessor { } private Ternary createTemplateFromVolume(VirtualMachineMO vmMo, String installPath, long templateId, String templateUniqueName, - String secStorageUrl, String volumePath, String workerVmName) throws Exception { + String secStorageUrl, String volumePath, String workerVmName) throws Exception { String secondaryMountPoint = mountService.getMountPoint(secStorageUrl); String installFullPath = secondaryMountPoint + "/" + installPath; @@ -611,7 +613,7 @@ public class VmwareStorageProcessor implements StorageProcessor { // 4 MB is the minimum requirement for VM memory in VMware Pair cloneResult = - vmMo.cloneFromCurrentSnapshot(workerVmName, 0, 4, volumeDeviceInfo.second(), VmwareHelper.getDiskDeviceDatastore(volumeDeviceInfo.first())); + vmMo.cloneFromCurrentSnapshot(workerVmName, 0, 4, volumeDeviceInfo.second(), VmwareHelper.getDiskDeviceDatastore(volumeDeviceInfo.first())); clonedVm = cloneResult.first(); clonedVm.exportVm(secondaryMountPoint + "/" + installPath, templateUniqueName, false, false); @@ -674,7 +676,7 @@ public class VmwareStorageProcessor implements StorageProcessor { if (vmMo == null) { if (s_logger.isDebugEnabled()) { s_logger.debug("Unable to find the owner VM for CreatePrivateTemplateFromVolumeCommand on host " + hyperHost.getHyperHostName() + - ", try within datacenter"); + ", try within datacenter"); } vmMo = hyperHost.findVmOnPeerHyperHost(volume.getVmName()); @@ -694,8 +696,8 @@ public class VmwareStorageProcessor implements StorageProcessor { } Ternary result = - createTemplateFromVolume(vmMo, template.getPath(), template.getId(), template.getName(), secondaryStoragePoolURL, volumePath, - hostService.getWorkerName(context, cmd, 0)); + createTemplateFromVolume(vmMo, template.getPath(), template.getId(), template.getName(), secondaryStoragePoolURL, volumePath, + hostService.getWorkerName(context, cmd, 0)); TemplateObjectTO newTemplate = new TemplateObjectTO(); newTemplate.setPath(result.first()); @@ -742,7 +744,7 @@ public class VmwareStorageProcessor implements StorageProcessor { } private Ternary createTemplateFromSnapshot(String installPath, String templateUniqueName, String secStorageUrl, String snapshotPath, - Long templateId) throws Exception { + Long templateId) throws Exception { //Snapshot path is decoded in this form: /snapshots/account/volumeId/uuid/uuid String backupSSUuid; String snapshotFolder; @@ -751,7 +753,7 @@ public class VmwareStorageProcessor implements StorageProcessor { backupSSUuid = snapshotPath.substring(index + 1).replace(".ova", ""); snapshotFolder = snapshotPath.substring(0, index); } else { - String[] tokens = snapshotPath.split(File.separator); + String[] tokens = snapshotPath.split(File.separatorChar == '\\' ? "\\\\" : File.separator); backupSSUuid = tokens[tokens.length - 1]; snapshotFolder = StringUtils.join(tokens, File.separator, 0, tokens.length - 1); } @@ -909,7 +911,7 @@ public class VmwareStorageProcessor implements StorageProcessor { // return Pair private Pair exportVolumeToSecondaryStroage(VirtualMachineMO vmMo, String volumePath, String secStorageUrl, String secStorageDir, - String exportName, String workerVmName) throws Exception { + String exportName, String workerVmName) throws Exception { String secondaryMountPoint = mountService.getMountPoint(secStorageUrl); String exportPath = secondaryMountPoint + "/" + secStorageDir + "/" + exportName; @@ -937,7 +939,7 @@ public class VmwareStorageProcessor implements StorageProcessor { // 4 MB is the minimum requirement for VM memory in VMware Pair cloneResult = - vmMo.cloneFromCurrentSnapshot(workerVmName, 0, 4, volumeDeviceInfo.second(), VmwareHelper.getDiskDeviceDatastore(volumeDeviceInfo.first())); + vmMo.cloneFromCurrentSnapshot(workerVmName, 0, 4, volumeDeviceInfo.second(), VmwareHelper.getDiskDeviceDatastore(volumeDeviceInfo.first())); clonedVm = cloneResult.first(); String disks[] = cloneResult.second(); @@ -953,7 +955,7 @@ public class VmwareStorageProcessor implements StorageProcessor { // Ternary private Ternary backupSnapshotToSecondaryStorage(VirtualMachineMO vmMo, String installPath, String volumePath, String snapshotUuid, - String secStorageUrl, String prevSnapshotUuid, String prevBackupUuid, String workerVmName) throws Exception { + String secStorageUrl, String prevSnapshotUuid, String prevBackupUuid, String workerVmName) throws Exception { String backupUuid = UUID.randomUUID().toString(); Pair snapshotInfo = exportVolumeToSecondaryStroage(vmMo, volumePath, secStorageUrl, installPath, backupUuid, workerVmName); @@ -1030,8 +1032,8 @@ public class VmwareStorageProcessor implements StorageProcessor { } backupResult = - backupSnapshotToSecondaryStorage(vmMo, destSnapshot.getPath(), srcSnapshot.getVolume().getPath(), snapshotUuid, secondaryStorageUrl, - prevSnapshotUuid, prevBackupUuid, hostService.getWorkerName(context, cmd, 1)); + backupSnapshotToSecondaryStorage(vmMo, destSnapshot.getPath(), srcSnapshot.getVolume().getPath(), snapshotUuid, secondaryStorageUrl, + prevSnapshotUuid, prevBackupUuid, hostService.getWorkerName(context, cmd, 1)); snapshotBackupUuid = backupResult.first(); success = (snapshotBackupUuid != null); @@ -1173,9 +1175,9 @@ public class VmwareStorageProcessor implements StorageProcessor { Map details = disk.getDetails(); morDs = hostService.prepareManagedStorage(hyperHost, iScsiName, storageHost, storagePort, - details.get(DiskTO.CHAP_INITIATOR_USERNAME), details.get(DiskTO.CHAP_INITIATOR_SECRET), - details.get(DiskTO.CHAP_TARGET_USERNAME), details.get(DiskTO.CHAP_TARGET_SECRET), - volumeTO.getSize(), cmd); + details.get(DiskTO.CHAP_INITIATOR_USERNAME), details.get(DiskTO.CHAP_INITIATOR_SECRET), + details.get(DiskTO.CHAP_TARGET_USERNAME), details.get(DiskTO.CHAP_TARGET_SECRET), + volumeTO.getSize(), cmd); } else { morDs = HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost, isManaged ? VmwareResource.getDatastoreName(iScsiName) : primaryStore.getUuid()); @@ -1187,7 +1189,7 @@ public class VmwareStorageProcessor implements StorageProcessor { throw new Exception(msg); } - DatastoreMO dsMo = new DatastoreMO(this.hostService.getServiceContext(null), morDs); + DatastoreMO dsMo = new DatastoreMO(hostService.getServiceContext(null), morDs); String datastoreVolumePath; if (isAttach) { @@ -1219,7 +1221,7 @@ public class VmwareStorageProcessor implements StorageProcessor { vmMo.detachDisk(datastoreVolumePath, false); if (isManaged) { - this.hostService.handleDatastoreAndVmdkDetach(iScsiName, storageHost, storagePort); + hostService.handleDatastoreAndVmdkDetach(iScsiName, storageHost, storagePort); } else { VmwareStorageLayoutHelper.syncVolumeToRootFolder(dsMo.getOwnerDatacenter().first(), dsMo, volumeTO.getPath()); } @@ -1369,7 +1371,7 @@ public class VmwareStorageProcessor implements StorageProcessor { String volumeUuid = UUID.randomUUID().toString().replace("-", ""); String volumeDatastorePath = dsMo.getDatastorePath(volumeUuid + ".vmdk"); - String dummyVmName = this.hostService.getWorkerName(context, cmd, 0); + String dummyVmName = hostService.getWorkerName(context, cmd, 0); try { s_logger.info("Create worker VM " + dummyVmName); vmMo = HypervisorHostHelper.createWorkerVM(hyperHost, dsMo, dummyVmName); @@ -1485,7 +1487,7 @@ public class VmwareStorageProcessor implements StorageProcessor { // this.hostService.handleDatastoreAndVmdkDetach(iScsiName, storageHost, storagePort); if (managedIqns != null && !managedIqns.isEmpty()) { - this.hostService.removeManagedTargetsFromCluster(managedIqns); + hostService.removeManagedTargetsFromCluster(managedIqns); } for (NetworkDetails netDetails : networks) { @@ -1573,7 +1575,7 @@ public class VmwareStorageProcessor implements StorageProcessor { } private Long restoreVolumeFromSecStorage(VmwareHypervisorHost hyperHost, DatastoreMO primaryDsMo, String newVolumeName, String secStorageUrl, String secStorageDir, - String backupName) throws Exception { + String backupName) throws Exception { String secondaryMountPoint = mountService.getMountPoint(secStorageUrl); String srcOVAFileName = null; diff --git a/plugins/hypervisors/vmware/src/org/apache/cloudstack/api/command/admin/zone/AddVmwareDcCmd.java b/plugins/hypervisors/vmware/src/org/apache/cloudstack/api/command/admin/zone/AddVmwareDcCmd.java index 8a8f98ad79f..7241b96db78 100644 --- a/plugins/hypervisors/vmware/src/org/apache/cloudstack/api/command/admin/zone/AddVmwareDcCmd.java +++ b/plugins/hypervisors/vmware/src/org/apache/cloudstack/api/command/admin/zone/AddVmwareDcCmd.java @@ -37,7 +37,8 @@ import com.cloud.hypervisor.vmware.VmwareDatacenterVO; import com.cloud.user.Account; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "addVmwareDc", description = "Adds a VMware datacenter to specified zone", responseObject = VmwareDatacenterResponse.class) +@APICommand(name = "addVmwareDc", description = "Adds a VMware datacenter to specified zone", responseObject = VmwareDatacenterResponse.class, + requestHasSensitiveInfo = true, responseHasSensitiveInfo = false) public class AddVmwareDcCmd extends BaseCmd { @Inject diff --git a/plugins/hypervisors/vmware/src/org/apache/cloudstack/api/command/admin/zone/ListVmwareDcsCmd.java b/plugins/hypervisors/vmware/src/org/apache/cloudstack/api/command/admin/zone/ListVmwareDcsCmd.java index 9fbf09a2000..271bc90448b 100644 --- a/plugins/hypervisors/vmware/src/org/apache/cloudstack/api/command/admin/zone/ListVmwareDcsCmd.java +++ b/plugins/hypervisors/vmware/src/org/apache/cloudstack/api/command/admin/zone/ListVmwareDcsCmd.java @@ -43,7 +43,8 @@ import com.cloud.hypervisor.vmware.VmwareDatacenter; import com.cloud.hypervisor.vmware.VmwareDatacenterService; import com.cloud.user.Account; -@APICommand(name = "listVmwareDcs", responseObject = VmwareDatacenterResponse.class, description = "Retrieves VMware DC(s) associated with a zone.") +@APICommand(name = "listVmwareDcs", responseObject = VmwareDatacenterResponse.class, description = "Retrieves VMware DC(s) associated with a zone.", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListVmwareDcsCmd extends BaseListCmd { @Inject diff --git a/plugins/hypervisors/vmware/src/org/apache/cloudstack/api/command/admin/zone/RemoveVmwareDcCmd.java b/plugins/hypervisors/vmware/src/org/apache/cloudstack/api/command/admin/zone/RemoveVmwareDcCmd.java index 631413913c6..acc0adc9c20 100644 --- a/plugins/hypervisors/vmware/src/org/apache/cloudstack/api/command/admin/zone/RemoveVmwareDcCmd.java +++ b/plugins/hypervisors/vmware/src/org/apache/cloudstack/api/command/admin/zone/RemoveVmwareDcCmd.java @@ -35,7 +35,8 @@ import com.cloud.hypervisor.vmware.VmwareDatacenterService; import com.cloud.user.Account; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "removeVmwareDc", responseObject = SuccessResponse.class, description = "Remove a VMware datacenter from a zone.") +@APICommand(name = "removeVmwareDc", responseObject = SuccessResponse.class, description = "Remove a VMware datacenter from a zone.", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class RemoveVmwareDcCmd extends BaseCmd { @Inject diff --git a/plugins/hypervisors/vmware/src/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategy.java b/plugins/hypervisors/vmware/src/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategy.java index e1527f96b15..09f10688a68 100644 --- a/plugins/hypervisors/vmware/src/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategy.java +++ b/plugins/hypervisors/vmware/src/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategy.java @@ -20,6 +20,7 @@ package org.apache.cloudstack.storage.motion; import java.util.HashMap; +import java.util.List; import java.util.Map; import javax.inject.Inject; @@ -36,6 +37,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory; import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; import org.apache.cloudstack.framework.async.AsyncCompletionCallback; import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; +import org.apache.cloudstack.storage.to.VolumeObjectTO; import com.cloud.agent.AgentManager; import com.cloud.agent.api.Answer; @@ -145,7 +147,7 @@ public class VmwareStorageMotionStrategy implements DataMotionStrategy { throw new CloudRuntimeException("Error while migrating the vm " + vm + " to host " + destHost + ". " + migrateWithStorageAnswer.getDetails()); } else { // Update the volume details after migration. - updateVolumesAfterMigration(volumeToPool); + updateVolumesAfterMigration(volumeToPool, migrateWithStorageAnswer.getVolumeTos()); } s_logger.debug("Storage migration of VM " + vm.getInstanceName() + " completed successfully. Migrated to host " + destHost.getName()); @@ -179,7 +181,7 @@ public class VmwareStorageMotionStrategy implements DataMotionStrategy { throw new CloudRuntimeException("Error while migrating the vm " + vm + " to host " + destHost + ". " + answer.getDetails()); } else { // Update the volume details after migration. - updateVolumesAfterMigration(volumeToPool); + updateVolumesAfterMigration(volumeToPool, answer.getVolumeTos()); } return answer; @@ -189,20 +191,28 @@ public class VmwareStorageMotionStrategy implements DataMotionStrategy { } } - private void updateVolumesAfterMigration(Map volumeToPool) { + private void updateVolumesAfterMigration(Map volumeToPool, List volumeTos) { for (Map.Entry entry : volumeToPool.entrySet()) { + boolean updated = false; VolumeInfo volume = entry.getKey(); StoragePool pool = (StoragePool)entry.getValue(); - - VolumeVO volumeVO = volDao.findById(volume.getId()); - Long oldPoolId = volumeVO.getPoolId(); - volumeVO.setLastPoolId(oldPoolId); - volumeVO.setFolder(pool.getPath()); - volumeVO.setPodId(pool.getPodId()); - volumeVO.setPoolId(pool.getId()); - - volDao.update(volume.getId(), volumeVO); - s_logger.debug("Volume path was successfully updated for volume " + volume.getName() + " after it was migrated."); + for (VolumeObjectTO volumeTo : volumeTos) { + if (volume.getId() == volumeTo.getId()) { + VolumeVO volumeVO = volDao.findById(volume.getId()); + Long oldPoolId = volumeVO.getPoolId(); + volumeVO.setPath(volumeTo.getPath()); + volumeVO.setLastPoolId(oldPoolId); + volumeVO.setFolder(pool.getPath()); + volumeVO.setPodId(pool.getPodId()); + volumeVO.setPoolId(pool.getId()); + volDao.update(volume.getId(), volumeVO); + updated = true; + break; + } + } + if (!updated) { + s_logger.error("Volume path wasn't updated for volume " + volume + " after it was migrated."); + } } } } diff --git a/plugins/hypervisors/xen/src/com/cloud/ha/XenServerFencer.java b/plugins/hypervisors/xen/src/com/cloud/ha/XenServerFencer.java index 5604db89ede..28cba2b98c4 100755 --- a/plugins/hypervisors/xen/src/com/cloud/ha/XenServerFencer.java +++ b/plugins/hypervisors/xen/src/com/cloud/ha/XenServerFencer.java @@ -43,7 +43,6 @@ import com.cloud.vm.VirtualMachine; @Local(value = FenceBuilder.class) public class XenServerFencer extends AdapterBase implements FenceBuilder { private static final Logger s_logger = Logger.getLogger(XenServerFencer.class); - String _name; @Inject HostDao _hostDao; diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java index 58fe0159815..fbfd222d137 100755 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java @@ -34,6 +34,13 @@ import javax.persistence.EntityExistsException; import org.apache.log4j.Logger; import org.apache.xmlrpc.XmlRpcException; +import com.xensource.xenapi.Connection; +import com.xensource.xenapi.Host; +import com.xensource.xenapi.Pool; +import com.xensource.xenapi.Session; +import com.xensource.xenapi.Types.SessionAuthenticationFailed; +import com.xensource.xenapi.Types.XenAPIException; + import com.cloud.agent.AgentManager; import com.cloud.agent.Listener; import com.cloud.agent.api.AgentControlAnswer; @@ -92,12 +99,6 @@ import com.cloud.utils.db.QueryBuilder; import com.cloud.utils.db.SearchCriteria.Op; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.exception.HypervisorVersionChangedException; -import com.xensource.xenapi.Connection; -import com.xensource.xenapi.Host; -import com.xensource.xenapi.Pool; -import com.xensource.xenapi.Session; -import com.xensource.xenapi.Types.SessionAuthenticationFailed; -import com.xensource.xenapi.Types.XenAPIException; @Local(value = Discoverer.class) public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, Listener, ResourceStateAdapter { @@ -157,7 +158,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L @Override public Map> - find(long dcId, Long podId, Long clusterId, URI url, String username, String password, List hostTags) throws DiscoveryException { + find(long dcId, Long podId, Long clusterId, URI url, String username, String password, List hostTags) throws DiscoveryException { Map> resources = new HashMap>(); Connection conn = null; if (!url.getScheme().equals("http")) { @@ -486,8 +487,8 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L } String msg = - "Only support XCP 1.0.0, 1.1.0, 1.4.x, 1.5 beta, 1.6.x; XenServer 5.6, XenServer 5.6 FP1, XenServer 5.6 SP2, Xenserver 6.0, 6.0.2, 6.1.0, 6.2.0 but this one is " + - prodBrand + " " + prodVersion; + "Only support XCP 1.0.0, 1.1.0, 1.4.x, 1.5 beta, 1.6.x; XenServer 5.6, XenServer 5.6 FP1, XenServer 5.6 SP2, Xenserver 6.0, 6.0.2, 6.1.0, 6.2.0 but this one is " + + prodBrand + " " + prodVersion; _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, dcId, podId, msg, msg); s_logger.debug(msg); throw new RuntimeException(msg); @@ -574,8 +575,8 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L if (tmplt == null) { id = _tmpltDao.getNextInSequence(Long.class, "id"); VMTemplateVO template = - VMTemplateVO.createPreHostIso(id, isoName, isoName, ImageFormat.ISO, true, true, TemplateType.PERHOST, null, null, true, 64, Account.ACCOUNT_ID_SYSTEM, - null, "xen-pv-drv-iso", false, 1, false, HypervisorType.XenServer); + VMTemplateVO.createPreHostIso(id, isoName, isoName, ImageFormat.ISO, true, true, TemplateType.PERHOST, null, null, true, 64, Account.ACCOUNT_ID_SYSTEM, + null, "xen-pv-drv-iso", false, 1, false, HypervisorType.XenServer); _tmpltDao.persist(template); } else { id = tmplt.getId(); @@ -646,8 +647,8 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L if (resource == null) { String msg = - "Only support XCP 1.0.0, 1.1.0, 1.4.x, 1.5 beta, 1.6.x; XenServer 5.6, 5.6 FP1, 5.6 SP2 and Xenserver 6.0 , 6.0.2, 6.1.0, 6.2.0 but this one is " + - prodBrand + " " + prodVersion; + "Only support XCP 1.0.0, 1.1.0, 1.4.x, 1.5 beta, 1.6.x; XenServer 5.6, 5.6 FP1, 5.6 SP2 and Xenserver 6.0 , 6.0.2, 6.1.0, 6.2.0 but this one is " + + prodBrand + " " + prodVersion; s_logger.debug(msg); throw new RuntimeException(msg); } @@ -674,12 +675,12 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L } try { - SetupAnswer answer = (SetupAnswer)_agentMgr.send(agentId, setup); - if (answer != null && answer.getResult()) { + Answer answer = _agentMgr.send(agentId, setup); + if (answer != null && answer.getResult() && answer instanceof SetupAnswer) { host.setSetup(true); host.setLastPinged((System.currentTimeMillis() >> 10) - 5 * 60); _hostDao.update(host.getId(), host); - if (answer.needReconnect()) { + if (((SetupAnswer)answer).needReconnect()) { throw new ConnectionException(false, "Reinitialize agent after setup."); } return; @@ -763,7 +764,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L } if (!success) { String msg = - "Unable to eject host " + host.getGuid() + " due to there is no host up in this cluster, please execute xe pool-eject host-uuid=" + host.getGuid() + + "Unable to eject host " + host.getGuid() + " due to there is no host up in this cluster, please execute xe pool-eject host-uuid=" + host.getGuid() + "in this host " + host.getPrivateIpAddress(); s_logger.warn(msg); _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(), "Unable to eject host " + host.getGuid(), msg); diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixHelper.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixHelper.java index 2524bc31635..6c1e9a863a1 100644 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixHelper.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixHelper.java @@ -27,6 +27,7 @@ import org.apache.log4j.Logger; */ public class CitrixHelper { private static final Logger s_logger = Logger.getLogger(CitrixHelper.class); + private static final HashMap Xcp100GuestOsMap = new HashMap(70); private static final HashMap Xcp160GuestOsMap = new HashMap(70); private static final HashMap XenServerGuestOsMap = new HashMap(70); @@ -36,7 +37,9 @@ public class CitrixHelper { private static final HashMap XenServer602GuestOsMap = new HashMap(70); private static final HashMap XenServer610GuestOsMap = new HashMap(70); private static final HashMap XenServer620GuestOsMap = new HashMap(70); + private static final HashMap XenServer625GuestOsMap = new HashMap(70); private static final HashMap XenServer620GuestOsMemoryMap = new HashMap(70); + private static final HashMap XenServer625GuestOsMemoryMap = new HashMap(70); private static final HashMap XenServer610GuestOsMemoryMap = new HashMap(70); private static final HashMap XenServer602GuestOsMemoryMap = new HashMap(70); private static final HashMap XenServer600GuestOsMemoryMap = new HashMap(70); @@ -1528,6 +1531,168 @@ public class CitrixHelper { XenServer620GuestOsMap.put("Other PV (64-bit)", "CentOS 5 (64-bit)"); } + static { + XenServer625GuestOsMap.put("CentOS 4.5 (32-bit)", "CentOS 4.5 (32-bit)"); + XenServer625GuestOsMap.put("CentOS 4.6 (32-bit)", "CentOS 4.6 (32-bit)"); + XenServer625GuestOsMap.put("CentOS 4.7 (32-bit)", "CentOS 4.7 (32-bit)"); + XenServer625GuestOsMap.put("CentOS 4.8 (32-bit)", "CentOS 4.8 (32-bit)"); + XenServer625GuestOsMap.put("CentOS 5.0 (32-bit)", "CentOS 5 (32-bit)"); + XenServer625GuestOsMap.put("CentOS 5.0 (64-bit)", "CentOS 5 (64-bit)"); + XenServer625GuestOsMap.put("CentOS 5.1 (32-bit)", "CentOS 5 (32-bit)"); + XenServer625GuestOsMap.put("CentOS 5.1 (64-bit)", "CentOS 5 (64-bit)"); + XenServer625GuestOsMap.put("CentOS 5.2 (32-bit)", "CentOS 5 (32-bit)"); + XenServer625GuestOsMap.put("CentOS 5.2 (64-bit)", "CentOS 5 (64-bit)"); + XenServer625GuestOsMap.put("CentOS 5.3 (32-bit)", "CentOS 5 (32-bit)"); + XenServer625GuestOsMap.put("CentOS 5.3 (64-bit)", "CentOS 5 (64-bit)"); + XenServer625GuestOsMap.put("CentOS 5.4 (32-bit)", "CentOS 5 (32-bit)"); + XenServer625GuestOsMap.put("CentOS 5.4 (64-bit)", "CentOS 5 (64-bit)"); + XenServer625GuestOsMap.put("CentOS 5.5 (32-bit)", "CentOS 5 (32-bit)"); + XenServer625GuestOsMap.put("CentOS 5.5 (64-bit)", "CentOS 5 (64-bit)"); + XenServer625GuestOsMap.put("CentOS 5.6 (32-bit)", "CentOS 5 (32-bit)"); + XenServer625GuestOsMap.put("CentOS 5.6 (64-bit)", "CentOS 5 (64-bit)"); + XenServer625GuestOsMap.put("CentOS 5.7 (32-bit)", "CentOS 5 (32-bit)"); + XenServer625GuestOsMap.put("CentOS 5.7 (64-bit)", "CentOS 5 (64-bit)"); + XenServer625GuestOsMap.put("CentOS 5.8 (32-bit)", "CentOS 5 (32-bit)"); + XenServer625GuestOsMap.put("CentOS 5.8 (64-bit)", "CentOS 5 (64-bit)"); + XenServer625GuestOsMap.put("CentOS 5.9 (32-bit)", "CentOS 5 (32-bit)"); + XenServer625GuestOsMap.put("CentOS 5.9 (64-bit)", "CentOS 5 (64-bit)"); + XenServer625GuestOsMap.put("CentOS 6.0 (32-bit)", "CentOS 6 (32-bit)"); + XenServer625GuestOsMap.put("CentOS 6.0 (64-bit)", "CentOS 6 (64-bit)"); + XenServer625GuestOsMap.put("CentOS 6.1 (32-bit)", "CentOS 6 (32-bit)"); + XenServer625GuestOsMap.put("CentOS 6.1 (64-bit)", "CentOS 6 (64-bit)"); + XenServer625GuestOsMap.put("CentOS 6.2 (32-bit)", "CentOS 6 (32-bit)"); + XenServer625GuestOsMap.put("CentOS 6.2 (64-bit)", "CentOS 6 (64-bit)"); + XenServer625GuestOsMap.put("CentOS 6.3 (32-bit)", "CentOS 6 (32-bit)"); + XenServer625GuestOsMap.put("CentOS 6.3 (64-bit)", "CentOS 6 (64-bit)"); + XenServer625GuestOsMap.put("CentOS 6.4 (32-bit)", "CentOS 6 (32-bit)"); + XenServer625GuestOsMap.put("CentOS 6.4 (64-bit)", "CentOS 6 (64-bit)"); + XenServer625GuestOsMap.put("Debian GNU/Linux 6(32-bit)", "Debian Squeeze 6.0 (32-bit)"); + XenServer625GuestOsMap.put("Debian GNU/Linux 6(64-bit)", "Debian Squeeze 6.0 (64-bit)"); + XenServer625GuestOsMap.put("Debian GNU/Linux 7(32-bit)", "Debian Wheezy 7.0 (32-bit)"); + XenServer625GuestOsMap.put("Debian GNU/Linux 7(64-bit)", "Debian Wheezy 7.0 (64-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 5.0 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 5.0 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 5.1 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 5.1 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 5.2 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 5.2 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 5.3 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 5.3 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 5.4 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 5.4 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 5.5 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 5.5 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 5.6 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 5.6 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 5.7 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 5.7 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 5.8 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 5.8 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 5.9 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 5.9 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 6.0 (32-bit)", "Oracle Enterprise Linux 6 (32-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 6.0 (64-bit)", "Oracle Enterprise Linux 6 (64-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 6.1 (32-bit)", "Oracle Enterprise Linux 6 (32-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 6.1 (64-bit)", "Oracle Enterprise Linux 6 (64-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 6.2 (32-bit)", "Oracle Enterprise Linux 6 (32-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 6.2 (64-bit)", "Oracle Enterprise Linux 6 (64-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 6.3 (32-bit)", "Oracle Enterprise Linux 6 (32-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 6.3 (64-bit)", "Oracle Enterprise Linux 6 (64-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 6.4 (32-bit)", "Oracle Enterprise Linux 6 (32-bit)"); + XenServer625GuestOsMap.put("Oracle Enterprise Linux 6.4 (64-bit)", "Oracle Enterprise Linux 6 (64-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 4.5 (32-bit)", "Red Hat Enterprise Linux 4.5 (32-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 4.6 (32-bit)", "Red Hat Enterprise Linux 4.6 (32-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 4.7 (32-bit)", "Red Hat Enterprise Linux 4.7 (32-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 4.8 (32-bit)", "Red Hat Enterprise Linux 4.8 (32-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 5.0 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 5.0 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 5.1 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 5.1 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 5.2 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 5.2 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 5.3 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 5.3 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 5.4 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 5.4 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 5.5 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 5.5 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 5.6 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 5.6 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 5.7 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 5.7 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 5.8 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 5.8 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 5.9 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 5.9 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 6.0 (32-bit)", "Red Hat Enterprise Linux 6 (32-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 6.0 (64-bit)", "Red Hat Enterprise Linux 6 (64-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 6.1 (32-bit)", "Red Hat Enterprise Linux 6 (32-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 6.1 (64-bit)", "Red Hat Enterprise Linux 6 (64-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 6.2 (32-bit)", "Red Hat Enterprise Linux 6 (32-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 6.2 (64-bit)", "Red Hat Enterprise Linux 6 (64-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 6.3 (32-bit)", "Red Hat Enterprise Linux 6 (32-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 6.3 (64-bit)", "Red Hat Enterprise Linux 6 (64-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 6.4 (32-bit)", "Red Hat Enterprise Linux 6 (32-bit)"); + XenServer625GuestOsMap.put("Red Hat Enterprise Linux 6.4 (64-bit)", "Red Hat Enterprise Linux 6 (64-bit)"); + XenServer625GuestOsMap.put("SUSE Linux Enterprise Server 10 SP1 (32-bit)", "SUSE Linux Enterprise Server 10 SP1 (32-bit)"); + XenServer625GuestOsMap.put("SUSE Linux Enterprise Server 10 SP1 (64-bit)", "SUSE Linux Enterprise Server 10 SP1 (64-bit)"); + XenServer625GuestOsMap.put("SUSE Linux Enterprise Server 10 SP2 (32-bit)", "SUSE Linux Enterprise Server 10 SP2 (32-bit)"); + XenServer625GuestOsMap.put("SUSE Linux Enterprise Server 10 SP2 (64-bit)", "SUSE Linux Enterprise Server 10 SP2 (64-bit)"); + XenServer625GuestOsMap.put("SUSE Linux Enterprise Server 10 SP3 (32-bit)", "SUSE Linux Enterprise Server 10 SP3 (32-bit)"); + XenServer625GuestOsMap.put("SUSE Linux Enterprise Server 10 SP3 (64-bit)", "SUSE Linux Enterprise Server 10 SP3 (64-bit)"); + XenServer625GuestOsMap.put("SUSE Linux Enterprise Server 10 SP4 (32-bit)", "SUSE Linux Enterprise Server 10 SP4 (32-bit)"); + XenServer625GuestOsMap.put("SUSE Linux Enterprise Server 10 SP4 (64-bit)", "SUSE Linux Enterprise Server 10 SP4 (64-bit)"); + XenServer625GuestOsMap.put("SUSE Linux Enterprise Server 11 (32-bit)", "SUSE Linux Enterprise Server 11 (32-bit)"); + XenServer625GuestOsMap.put("SUSE Linux Enterprise Server 11 (64-bit)", "SUSE Linux Enterprise Server 11 (64-bit)"); + XenServer625GuestOsMap.put("SUSE Linux Enterprise Server 11 SP1 (32-bit)", "SUSE Linux Enterprise Server 11 SP1 (32-bit)"); + XenServer625GuestOsMap.put("SUSE Linux Enterprise Server 11 SP1 (64-bit)", "SUSE Linux Enterprise Server 11 SP1 (64-bit)"); + XenServer625GuestOsMap.put("SUSE Linux Enterprise Server 11 SP2 (32-bit)", "SUSE Linux Enterprise Server 11 SP2 (32-bit)"); + XenServer625GuestOsMap.put("SUSE Linux Enterprise Server 11 SP2 (64-bit)", "SUSE Linux Enterprise Server 11 SP2 (64-bit)"); + XenServer625GuestOsMap.put("Windows 7 (32-bit)", "Windows 7 (32-bit)"); + XenServer625GuestOsMap.put("Windows 7 (64-bit)", "Windows 7 (64-bit)"); + XenServer625GuestOsMap.put("Windows 7 SP1 (32-bit)", "Windows 7 (32-bit)"); + XenServer625GuestOsMap.put("Windows 7 SP1 (64-bit)", "Windows 7 (64-bit)"); + XenServer625GuestOsMap.put("Windows 8 (32-bit)", "Windows 8 (32-bit)"); + XenServer625GuestOsMap.put("Windows 8 (64-bit)", "Windows 8 (64-bit)"); + XenServer625GuestOsMap.put("Windows Server 2003 SP2 (32-bit)", "Windows Server 2003 (32-bit)"); + XenServer625GuestOsMap.put("Windows Server 2003 SP2 (64-bit)", "Windows Server 2003 (64-bit)"); + XenServer625GuestOsMap.put("Windows Server 2003 PAE (32-bit)", "Windows Server 2003 (32-bit)"); + XenServer625GuestOsMap.put("Windows Server 2003 Enterprise Edition(32-bit)", "Windows Server 2003 (32-bit)"); + XenServer625GuestOsMap.put("Windows Server 2003 Enterprise Edition(64-bit)", "Windows Server 2003 (64-bit)"); + XenServer625GuestOsMap.put("Windows Server 2003 DataCenter Edition(32-bit)", "Windows Server 2003 (32-bit)"); + XenServer625GuestOsMap.put("Windows Server 2003 DataCenter Edition(64-bit)", "Windows Server 2003 (64-bit)"); + XenServer625GuestOsMap.put("Windows Server 2003 Standard Edition(32-bit)", "Windows Server 2003 (32-bit)"); + XenServer625GuestOsMap.put("Windows Server 2003 Standard Edition(64-bit)", "Windows Server 2003 (64-bit)"); + XenServer625GuestOsMap.put("Windows Server 2008 SP2 (32-bit)", "Windows Server 2008 (34-bit)"); + XenServer625GuestOsMap.put("Windows Server 2008 SP2 (64-bit)", "Windows Server 2008 (64-bit)"); + XenServer625GuestOsMap.put("Windows Server 2008 R2 (64-bit)", "Windows Server 2008 R2 (64-bit)"); + XenServer625GuestOsMap.put("Windows Server 2008 R2 SP1 (64-bit)", "Windows Server 2008 R2 (64-bit)"); + XenServer625GuestOsMap.put("Windows Server 2012 (64-bit)", "Windows Server 2012 (64-bit)"); + XenServer625GuestOsMap.put("Windows Server 2012 R2 (64-bit)", "Windows Server 2012 (64-bit)"); + XenServer625GuestOsMap.put("Windows Vista SP2 (32-bit)", "Windows Vista (32-bit)"); + XenServer625GuestOsMap.put("Windows XP SP3 (32-bit)", "Windows XP SP3 (32-bit)"); + XenServer625GuestOsMap.put("Ubuntu 10.04 (32-bit)", "Ubuntu Lucid Lynx 10.04 (32-bit)"); + XenServer625GuestOsMap.put("Ubuntu 10.04 (64-bit)", "Ubuntu Lucid Lynx 10.04 (64-bit)"); + XenServer625GuestOsMap.put("Ubuntu 10.10 (32-bit)", "Ubuntu Maverick Meerkat 10.10 (32-bit) (experimental)"); + XenServer625GuestOsMap.put("Ubuntu 10.10 (64-bit)", "Ubuntu Maverick Meerkat 10.10 (64-bit) (experimental)"); + XenServer625GuestOsMap.put("Ubuntu 12.04 (32-bit)", "Ubuntu Precise Pangolin 12.04 (32-bit)"); + XenServer625GuestOsMap.put("Ubuntu 12.04 (64-bit)", "Ubuntu Precise Pangolin 12.04 (64-bit)"); + XenServer625GuestOsMap.put("Ubuntu 11.04 (32-bit)", "Other install media"); + XenServer625GuestOsMap.put("Ubuntu 11.04 (64-bit)", "Other install media"); + XenServer625GuestOsMap.put("Other Linux (32-bit)", "Other install media"); + XenServer625GuestOsMap.put("Other Linux (64-bit)", "Other install media"); + XenServer625GuestOsMap.put("Other (32-bit)", "Other install media"); + XenServer625GuestOsMap.put("Other (64-bit)", "Other install media"); + XenServer625GuestOsMap.put("Other CentOS (32-bit)", "Other install media"); + XenServer625GuestOsMap.put("Other CentOS (64-bit)", "Other install media"); + XenServer625GuestOsMap.put("Other Ubuntu (32-bit)", "Other install media"); + XenServer625GuestOsMap.put("Other Ubuntu (64-bit)", "Other install media"); + XenServer625GuestOsMap.put("Other SUSE Linux(32-bit)", "Other install media"); + XenServer625GuestOsMap.put("Other SUSE Linux(64-bit)", "Other install media"); + XenServer625GuestOsMap.put("Other PV (32-bit)", "CentOS 5 (32-bit)"); + XenServer625GuestOsMap.put("Other PV (64-bit)", "CentOS 5 (64-bit)"); + } + public static class MemoryValues { long max; long min; @@ -1819,6 +1984,150 @@ public class CitrixHelper { XenServer620GuestOsMemoryMap.put("Ubuntu 12.04 (64-bit)", new MemoryValues(128l, 128 * 1024l)); } + + static { + XenServer625GuestOsMemoryMap.put("CentOS 4.5 (32-bit)", new MemoryValues(256l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 4.6 (32-bit)", new MemoryValues(256l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 4.7 (32-bit)", new MemoryValues(256l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 4.8 (32-bit)", new MemoryValues(256l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 5.0 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 5.0 (64-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 5.1 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 5.1 (64-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 5.2 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 5.2 (64-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 5.3 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 5.3 (64-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 5.4 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 5.4 (64-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 5.5 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 5.5 (64-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 5.6 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 5.6 (64-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 5.7 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 5.7 (64-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 5.8 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 5.8 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 5.9 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 5.9 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 6.0 (32-bit)", new MemoryValues(512l, 8 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 6.0 (64-bit)", new MemoryValues(512l, 32 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 6.1 (32-bit)", new MemoryValues(512l, 8 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 6.1 (64-bit)", new MemoryValues(512l, 32 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 6.2 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 6.2 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 6.3 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 6.3 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 6.4 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("CentOS 6.4 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Debian GNU/Linux 6(32-bit)", new MemoryValues(128l, 32 * 1024l)); + XenServer625GuestOsMemoryMap.put("Debian GNU/Linux 6(64-bit)", new MemoryValues(128l, 32 * 1024l)); + XenServer625GuestOsMemoryMap.put("Debian GNU/Linux 7(32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Debian GNU/Linux 7(64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 5.0 (32-bit)", new MemoryValues(512l, 64 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 5.0 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 5.1 (32-bit)", new MemoryValues(512l, 64 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 5.1 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 5.2 (32-bit)", new MemoryValues(512l, 64 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 5.2 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 5.3 (32-bit)", new MemoryValues(512l, 64 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 5.3 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 5.4 (32-bit)", new MemoryValues(512l, 64 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 5.4 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 5.5 (32-bit)", new MemoryValues(512l, 64 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 5.5 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 5.6 (32-bit)", new MemoryValues(512l, 64 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 5.6 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 5.7 (32-bit)", new MemoryValues(512l, 64 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 5.7 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 5.8 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 5.8 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 5.9 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 5.9 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 6.0 (32-bit)", new MemoryValues(512l, 8 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 6.0 (64-bit)", new MemoryValues(512l, 32 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 6.1 (32-bit)", new MemoryValues(512l, 8 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 6.1 (64-bit)", new MemoryValues(512l, 32 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 6.2 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 6.2 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 6.3 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 6.3 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 6.4 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Oracle Enterprise Linux 6.4 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 4.5 (32-bit)", new MemoryValues(256l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 4.6 (32-bit)", new MemoryValues(256l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 4.7 (32-bit)", new MemoryValues(256l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 4.8 (32-bit)", new MemoryValues(256l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 5.0 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 5.0 (64-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 5.1 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 5.1 (64-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 5.2 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 5.2 (64-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 5.3 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 5.3 (64-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 5.4 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 5.4 (64-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 5.5 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 5.5 (64-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 5.6 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 5.6 (64-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 5.7 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 5.7 (64-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 5.8 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 5.8 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 5.9 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 5.9 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 6.0 (32-bit)", new MemoryValues(512l, 8 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 6.0 (64-bit)", new MemoryValues(512l, 32 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 6.1 (32-bit)", new MemoryValues(512l, 8 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 6.1 (64-bit)", new MemoryValues(512l, 32 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 6.2 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 6.2 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 6.3 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 6.3 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 6.4 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("Red Hat Enterprise Linux 6.4 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("SUSE Linux Enterprise Server 10 SP1 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("SUSE Linux Enterprise Server 10 SP1 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("SUSE Linux Enterprise Server 10 SP2 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("SUSE Linux Enterprise Server 10 SP2 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("SUSE Linux Enterprise Server 10 SP3 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("SUSE Linux Enterprise Server 10 SP3 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("SUSE Linux Enterprise Server 10 SP4 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("SUSE Linux Enterprise Server 10 SP4 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("SUSE Linux Enterprise Server 11 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("SUSE Linux Enterprise Server 11 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("SUSE Linux Enterprise Server 11 SP1 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("SUSE Linux Enterprise Server 11 SP1 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("SUSE Linux Enterprise Server 11 SP2 (32-bit)", new MemoryValues(512l, 16 * 1024l)); + XenServer625GuestOsMemoryMap.put("SUSE Linux Enterprise Server 11 SP2 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + + XenServer625GuestOsMemoryMap.put("Windows 7 (32-bit)", new MemoryValues(1024l, 4 * 1024l)); + XenServer625GuestOsMemoryMap.put("Windows 7 (64-bit)", new MemoryValues(2 * 1024l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Windows 7 SP1 (32-bit)", new MemoryValues(1024l, 4 * 1024l)); + XenServer625GuestOsMemoryMap.put("Windows 7 SP1 (64-bit)", new MemoryValues(2 * 1024l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Windows 8 (32-bit)", new MemoryValues(1024l, 4 * 1024l)); + XenServer625GuestOsMemoryMap.put("Windows 8 (64-bit)", new MemoryValues(2 * 1024l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Windows Server 2003 SP2 (32-bit)", new MemoryValues(256l, 64 * 1024l)); + XenServer625GuestOsMemoryMap.put("Windows Server 2003 SP2 (64-bit)", new MemoryValues(256l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Windows Server 2008 SP2 (32-bit)", new MemoryValues(512l, 64 * 1024l)); + XenServer625GuestOsMemoryMap.put("Windows Server 2008 SP2 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Windows Server 2008 R2 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Windows Server 2008 R2 SP1 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Windows Server 2012 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Windows Server 2012 R2 (64-bit)", new MemoryValues(512l, 128 * 1024l)); + XenServer625GuestOsMemoryMap.put("Windows Vista SP2 (32-bit)", new MemoryValues(1024l, 4 * 1024l)); + XenServer625GuestOsMemoryMap.put("Windows XP SP3 (32-bit)", new MemoryValues(256l, 4 * 1024l)); + XenServer625GuestOsMemoryMap.put("Ubuntu 10.04 (32-bit)", new MemoryValues(128l, 512l)); + XenServer625GuestOsMemoryMap.put("Ubuntu 10.04 (64-bit)", new MemoryValues(128l, 32 * 1024l)); + //_xenServer620GuestOsMemoryMap.put("Ubuntu 10.10 (32-bit)", new MemoryValues(512l, 16*1024l));//? + //_xenServer620GuestOsMemoryMap.put("Ubuntu 10.10 (64-bit)", new MemoryValues(512l, 16*1024l)); //? + XenServer625GuestOsMemoryMap.put("Ubuntu 12.04 (32-bit)", new MemoryValues(128l, 32 * 1024l)); + XenServer625GuestOsMemoryMap.put("Ubuntu 12.04 (64-bit)", new MemoryValues(128l, 128 * 1024l)); + } + + public static String getXcpGuestOsType(String stdType) { String guestOS = Xcp100GuestOsMap.get(stdType); if (guestOS == null) { @@ -2017,6 +2326,20 @@ public class CitrixHelper { return guestOS; } + public static String getXenServer625GuestOsType(String stdType, boolean bootFromCD) { + String guestOS = XenServer625GuestOsMap.get(stdType); + if (guestOS == null) { + if (!bootFromCD) { + s_logger.debug("Can't find the guest os: " + stdType + " mapping into XenServer 6.2.5 guestOS type, start it as HVM guest"); + guestOS = "Other install media"; + } else { + String msg = "XenServer 6.2.5 DOES NOT support Guest OS type " + stdType; + s_logger.warn(msg); + } + } + return guestOS; + } + public static long getXenServer620StaticMax(String stdType, boolean bootFromCD) { MemoryValues recommendedMaxMinMemory = XenServer620GuestOsMemoryMap.get(stdType); if (recommendedMaxMinMemory == null) { @@ -2032,4 +2355,20 @@ public class CitrixHelper { } return recommendedMaxMinMemory.getMin(); } + + public static long getXenServer625StaticMax(String stdType, boolean bootFromCD) { + MemoryValues recommendedMaxMinMemory = XenServer625GuestOsMemoryMap.get(stdType); + if (recommendedMaxMinMemory == null) { + return 0l; + } + return recommendedMaxMinMemory.getMax(); + } + + public static long getXenServer625StaticMin(String stdType, boolean bootFromCD) { + MemoryValues recommendedMaxMinMemory = XenServer625GuestOsMemoryMap.get(stdType); + if (recommendedMaxMinMemory == null) { + return 0l; + } + return recommendedMaxMinMemory.getMin(); + } } \ No newline at end of file diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java index cf5c6d6c762..c0d691ad5ba 100644 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java @@ -239,7 +239,6 @@ import com.cloud.vm.VirtualMachine.PowerState; import com.cloud.vm.VirtualMachine.State; import com.cloud.vm.snapshot.VMSnapshot; - /** * CitrixResourceBase encapsulates the calls to the XenServer Xapi process * to perform the required functionalities for CloudStack. @@ -325,9 +324,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe static { s_powerStatesTable = new HashMap(); s_powerStatesTable.put(Types.VmPowerState.HALTED, PowerState.PowerOff); - s_powerStatesTable.put(Types.VmPowerState.PAUSED, PowerState.PowerOn); + s_powerStatesTable.put(Types.VmPowerState.PAUSED, PowerState.PowerOff); s_powerStatesTable.put(Types.VmPowerState.RUNNING, PowerState.PowerOn); - s_powerStatesTable.put(Types.VmPowerState.SUSPENDED, PowerState.PowerOn); + s_powerStatesTable.put(Types.VmPowerState.SUSPENDED, PowerState.PowerOff); s_powerStatesTable.put(Types.VmPowerState.UNRECOGNIZED, PowerState.PowerUnknown); } @@ -348,6 +347,15 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe return _host; } + private static boolean isAlienVm(VM vm, Connection conn) throws XenAPIException, XmlRpcException { + // TODO : we need a better way to tell whether or not the VM belongs to CloudStack + String vmName = vm.getNameLabel(conn); + if (vmName.matches("^[ivs]-\\d+-.+")) + return false; + + return true; + } + protected boolean cleanupHaltedVms(Connection conn) throws XenAPIException, XmlRpcException { Host host = Host.getByUuid(conn, _host.uuid); Map vms = VM.getAllRecords(conn); @@ -359,7 +367,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe continue; } - if (VmPowerState.HALTED.equals(vmRec.powerState) && vmRec.affinity.equals(host)) { + if (VmPowerState.HALTED.equals(vmRec.powerState) && vmRec.affinity.equals(host) && !isAlienVm(vm, conn)) { try { vm.destroy(conn); } catch (Exception e) { @@ -412,7 +420,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe if (clazz == CreateCommand.class) { return execute((CreateCommand)cmd); } else if (cmd instanceof NetworkElementCommand) { - return _vrResource.executeRequest(cmd); + return _vrResource.executeRequest((NetworkElementCommand)cmd); } else if (clazz == CheckConsoleProxyLoadCommand.class) { return execute((CheckConsoleProxyLoadCommand)cmd); } else if (clazz == WatchConsoleProxyLoadCommand.class) { @@ -569,7 +577,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe @Override public ExecutionResult cleanupCommand(NetworkElementCommand cmd) { if (cmd instanceof IpAssocCommand && !(cmd instanceof IpAssocVpcCommand)) { - cleanupNetworkElementCommand((IpAssocCommand)cmd); + return cleanupNetworkElementCommand((IpAssocCommand)cmd); } return new ExecutionResult(true, null); } @@ -876,7 +884,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe Set dom0Vifs = dom0.getVIFs(conn); for (VIF vif : dom0Vifs) { vif.getRecord(conn); - if (vif.getNetwork(conn).getUuid(conn) == nw.getUuid(conn)) { + if (vif.getNetwork(conn).getUuid(conn).equals(nw.getUuid(conn))) { dom0vif = vif; s_logger.debug("A VIF for dom0 has already been found - No need to create one"); } @@ -1956,7 +1964,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe protected ExecutionResult prepareNetworkElementCommand(IpAssocCommand cmd) { Connection conn = getConnection(); - int i = 0; String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME); String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); @@ -2029,12 +2036,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe protected ExecutionResult cleanupNetworkElementCommand(IpAssocCommand cmd) { Connection conn = getConnection(); - String[] results = new String[cmd.getIpAddresses().length]; - int i = 0; String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME); String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); try { IpAddressTO[] ips = cmd.getIpAddresses(); + int ipsCount = ips.length; for (IpAddressTO ip : ips) { VM router = getVM(conn, routerName); @@ -2063,6 +2069,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe // to remove a VIF boolean removeVif = false; + //there is only one ip in this public vlan and removing it, so remove the nic + if (ipsCount == 1 && !ip.isAdd()) { + removeVif = true; + } + if (correctVif == null) { throw new InternalErrorException("Failed to find DomR VIF to associate/disassociate IP with."); } @@ -2493,6 +2504,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } protected HashMap getHostVmStateReport(Connection conn) { + + // TODO : new VM sync model does not require a cluster-scope report, we need to optimize + // the report accordingly final HashMap vmStates = new HashMap(); Map vm_map = null; for (int i = 0; i < 2; i++) { @@ -2510,7 +2524,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } if (vm_map == null) { - return null; + return vmStates; } for (VM.Record record : vm_map.values()) { if (record.isControlDomain || record.isASnapshot || record.isATemplate) { @@ -2531,7 +2545,13 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } catch (XmlRpcException e) { s_logger.error("Failed to get host uuid for host " + host.toWireString(), e); } - vmStates.put(record.nameLabel, new HostVmStateReportEntry(convertPowerState(ps), host_uuid, xstoolsversion)); + + if (host_uuid.equalsIgnoreCase(_host.uuid)) { + vmStates.put( + record.nameLabel, + new HostVmStateReportEntry(convertPowerState(ps), host_uuid, xstoolsversion) + ); + } } } @@ -4907,7 +4927,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } if (srr.shared) { Host host = Host.getByUuid(conn, _host.uuid); - boolean found = false; for (PBD pbd : pbds) { PBD.Record pbdr = pbd.getRecord(conn); @@ -7297,14 +7316,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe VM router = getVM(conn, routerName); VIF correctVif = getVifByMac(conn, router, ip.getVifMacAddress()); - if (correctVif == null) { - if (ip.isAdd()) { - throw new InternalErrorException("Failed to find DomR VIF to associate IP with."); - } else { - s_logger.debug("VIF to deassociate IP with does not exist, return success"); - } - } - ip.setNicDevId(Integer.valueOf(correctVif.getDevice(conn))); + setNicDevIdIfCorrectVifIsNotNull(conn, ip, correctVif); } } catch (Exception e) { s_logger.error("Ip Assoc failure on applying one ip due to exception: ", e); @@ -7314,6 +7326,19 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe return new ExecutionResult(true, null); } + protected void setNicDevIdIfCorrectVifIsNotNull(Connection conn, IpAddressTO ip, VIF correctVif) throws InternalErrorException, BadServerResponse, XenAPIException, + XmlRpcException { + if (correctVif == null) { + if (ip.isAdd()) { + throw new InternalErrorException("Failed to find DomR VIF to associate IP with."); + } else { + s_logger.debug("VIF to deassociate IP with does not exist, return success"); + } + } else { + ip.setNicDevId(Integer.valueOf(correctVif.getDevice(conn))); + } + } + protected ExecutionResult prepareNetworkElementCommand(SetSourceNatCommand cmd) { Connection conn = getConnection(); String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME); diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/Xenserver625Resource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/Xenserver625Resource.java index 7d2a2a13ecb..e9c3f296805 100644 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/Xenserver625Resource.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/Xenserver625Resource.java @@ -25,20 +25,22 @@ import java.util.Map; import javax.ejb.Local; -import org.apache.cloudstack.hypervisor.xenserver.XenServerResourceNewBase; import org.apache.log4j.Logger; +import com.xensource.xenapi.Connection; + +import org.apache.cloudstack.hypervisor.xenserver.XenServerResourceNewBase; + import com.cloud.agent.api.StartupRoutingCommand; import com.cloud.resource.ServerResource; import com.cloud.storage.resource.StorageSubsystemCommandHandler; import com.cloud.storage.resource.StorageSubsystemCommandHandlerBase; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.script.Script; -import com.xensource.xenapi.Connection; @Local(value=ServerResource.class) public class Xenserver625Resource extends XenServerResourceNewBase { - private static final Logger s_logger = Logger.getLogger(XenServer620Resource.class); + private static final Logger s_logger = Logger.getLogger(Xenserver625Resource.class); public Xenserver625Resource() { super(); @@ -53,7 +55,7 @@ public class Xenserver625Resource extends XenServerResourceNewBase { @Override protected String getGuestOsType(String stdType, boolean bootFromCD) { - return CitrixHelper.getXenServer620GuestOsType(stdType, bootFromCD); + return CitrixHelper.getXenServer625GuestOsType(stdType, bootFromCD); } @Override @@ -71,7 +73,7 @@ public class Xenserver625Resource extends XenServerResourceNewBase { @Override public long getStaticMax(String os, boolean b, long dynamicMinRam, long dynamicMaxRam){ - long recommendedValue = CitrixHelper.getXenServer620StaticMax(os, b); + long recommendedValue = CitrixHelper.getXenServer625StaticMax(os, b); if(recommendedValue == 0){ s_logger.warn("No recommended value found for dynamic max, setting static max and dynamic max equal"); return dynamicMaxRam; @@ -86,7 +88,7 @@ public class Xenserver625Resource extends XenServerResourceNewBase { @Override public long getStaticMin(String os, boolean b, long dynamicMinRam, long dynamicMaxRam){ - long recommendedValue = CitrixHelper.getXenServer620StaticMin(os, b); + long recommendedValue = CitrixHelper.getXenServer625StaticMin(os, b); if(recommendedValue == 0){ s_logger.warn("No recommended value found for dynamic min"); return dynamicMinRam; @@ -109,4 +111,5 @@ public class Xenserver625Resource extends XenServerResourceNewBase { } + } \ No newline at end of file diff --git a/plugins/hypervisors/xen/src/org/apache/cloudstack/hypervisor/xenserver/XenServerResourceNewBase.java b/plugins/hypervisors/xen/src/org/apache/cloudstack/hypervisor/xenserver/XenServerResourceNewBase.java index 1c9748679bd..438a392cac4 100644 --- a/plugins/hypervisors/xen/src/org/apache/cloudstack/hypervisor/xenserver/XenServerResourceNewBase.java +++ b/plugins/hypervisors/xen/src/org/apache/cloudstack/hypervisor/xenserver/XenServerResourceNewBase.java @@ -45,6 +45,26 @@ import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachineName; +/** + * + * XenServerResourceNewBase is an abstract base class that encapsulates how + * CloudStack should interact with XenServer after a special XenServer + * 6.2 hotfix. From here on, every Resource for future versions of + * XenServer should use this as the base class. This base class lessens + * the amount of load CloudStack places on Xapi because it doesn't use + * polling as a means to collect data and figure out task completion. + * + * This base class differs from CitrixResourceBase in the following ways: + * - VM states are detected using Event.from instead of polling. This + * increases the number of threads CloudStack uses but the threads + * are mostly idle just waiting for events from XenServer. + * - stats are collected through the http interface rather than Xapi plugin. + * This change may be promoted to CitrixResourceBase as it's also possible + * in previous versions of XenServer. + * - Asynchronous task completion is done throught Event.from rather than + * polling. + * + */ public class XenServerResourceNewBase extends XenServer610Resource { private static final Logger s_logger = Logger.getLogger(XenServerResourceNewBase.class); protected VmEventListener _listener = null; @@ -62,7 +82,12 @@ public class XenServerResourceNewBase extends XenServer610Resource { Host.Record masterRecord = poolr.master.getRecord(conn); if (_host.uuid.equals(masterRecord.uuid)) { _listener = new VmEventListener(true); - _listener.start(); + + // + // TODO disable event listener for now. Wait until everything else is ready + // + + // _listener.start(); } else { _listener = new VmEventListener(false); } diff --git a/plugins/hypervisors/xen/test/com/cloud/ha/XenServerFencerTest.java b/plugins/hypervisors/xen/test/com/cloud/ha/XenServerFencerTest.java new file mode 100644 index 00000000000..bd1d8f80b23 --- /dev/null +++ b/plugins/hypervisors/xen/test/com/cloud/ha/XenServerFencerTest.java @@ -0,0 +1,39 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package com.cloud.ha; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + + +public class XenServerFencerTest { + + @Test + public void testSetAndGetName() throws Exception { + XenServerFencer xenServerFencer = new XenServerFencer(); + String name = "name"; + + xenServerFencer.setName(name); + String actual = xenServerFencer.getName(); + + assertEquals(name, actual); + + } + +} diff --git a/plugins/hypervisors/xen/test/com/cloud/hypervisor/xen/resource/CitrixResourceBaseTest.java b/plugins/hypervisors/xen/test/com/cloud/hypervisor/xen/resource/CitrixResourceBaseTest.java index c56cc6d9e25..0920c7f1173 100644 --- a/plugins/hypervisors/xen/test/com/cloud/hypervisor/xen/resource/CitrixResourceBaseTest.java +++ b/plugins/hypervisors/xen/test/com/cloud/hypervisor/xen/resource/CitrixResourceBaseTest.java @@ -19,6 +19,7 @@ package com.cloud.hypervisor.xen.resource; +import static org.junit.Assert.fail; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; @@ -41,11 +42,13 @@ import org.mockito.Spy; import com.xensource.xenapi.Connection; import com.xensource.xenapi.Host; import com.xensource.xenapi.Types; +import com.xensource.xenapi.VIF; import com.xensource.xenapi.VM; import com.xensource.xenapi.XenAPIObject; import com.cloud.agent.api.ScaleVmAnswer; import com.cloud.agent.api.ScaleVmCommand; +import com.cloud.agent.api.to.IpAddressTO; import com.cloud.agent.api.to.VirtualMachineTO; import com.cloud.hypervisor.xen.resource.CitrixResourceBase.XsHost; @@ -171,4 +174,17 @@ public class CitrixResourceBaseTest { verify(_resource, times(1)).callHostPlugin(conn, "vmops", "add_to_VCPUs_params_live", "key", "weight", "value", "253", "vmname", "i-2-3-VM"); verify(_resource, times(1)).callHostPlugin(conn, "vmops", "add_to_VCPUs_params_live", "key", "cap", "value", "99", "vmname", "i-2-3-VM"); } + + + @Test + public void testSetNicDevIdIfCorrectVifIsNotNull() throws Exception { + IpAddressTO ip = mock(IpAddressTO.class); + when(ip.isAdd()).thenReturn(false); + VIF correctVif = null; + try { + _resource.setNicDevIdIfCorrectVifIsNotNull(conn, ip, correctVif); + } catch (NullPointerException e) { + fail("this test is meant to show that null pointer is not thrown"); + } + } } \ No newline at end of file diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/AddBigSwitchVnsDeviceCmd.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/AddBigSwitchVnsDeviceCmd.java index a30059d8e28..5c6f555c8a4 100644 --- a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/AddBigSwitchVnsDeviceCmd.java +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/AddBigSwitchVnsDeviceCmd.java @@ -37,7 +37,8 @@ import com.cloud.network.BigSwitchVnsDeviceVO; import com.cloud.network.element.BigSwitchVnsElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "addBigSwitchVnsDevice", responseObject = BigSwitchVnsDeviceResponse.class, description = "Adds a BigSwitch VNS device", since = "4.1.0") +@APICommand(name = "addBigSwitchVnsDevice", responseObject = BigSwitchVnsDeviceResponse.class, description = "Adds a BigSwitch VNS device", since = "4.1.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AddBigSwitchVnsDeviceCmd extends BaseAsyncCmd { private static final String s_name = "addbigswitchvnsdeviceresponse"; @Inject diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/DeleteBigSwitchVnsDeviceCmd.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/DeleteBigSwitchVnsDeviceCmd.java index 4af45b22d62..1e2155dcd89 100644 --- a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/DeleteBigSwitchVnsDeviceCmd.java +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/DeleteBigSwitchVnsDeviceCmd.java @@ -35,7 +35,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.element.BigSwitchVnsElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "deleteBigSwitchVnsDevice", responseObject = SuccessResponse.class, description = " delete a bigswitch vns device", since = "4.1.0") +@APICommand(name = "deleteBigSwitchVnsDevice", responseObject = SuccessResponse.class, description = " delete a bigswitch vns device", since = "4.1.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteBigSwitchVnsDeviceCmd extends BaseAsyncCmd { private static final String s_name = "deletebigswitchvnsdeviceresponse"; @Inject diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/ListBigSwitchVnsDevicesCmd.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/ListBigSwitchVnsDevicesCmd.java index 6e4ee751212..4cde78e5039 100644 --- a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/ListBigSwitchVnsDevicesCmd.java +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/ListBigSwitchVnsDevicesCmd.java @@ -42,7 +42,8 @@ import com.cloud.network.BigSwitchVnsDeviceVO; import com.cloud.network.element.BigSwitchVnsElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "listBigSwitchVnsDevices", responseObject = BigSwitchVnsDeviceResponse.class, description = "Lists BigSwitch Vns devices", since = "4.1.0") +@APICommand(name = "listBigSwitchVnsDevices", responseObject = BigSwitchVnsDeviceResponse.class, description = "Lists BigSwitch Vns devices", since = "4.1.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListBigSwitchVnsDevicesCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListBigSwitchVnsDevicesCmd.class.getName()); private static final String s_name = "listbigswitchvnsdeviceresponse"; diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/AddCiscoAsa1000vResourceCmd.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/AddCiscoAsa1000vResourceCmd.java index c7e7d30c740..5c912a278f2 100755 --- a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/AddCiscoAsa1000vResourceCmd.java +++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/AddCiscoAsa1000vResourceCmd.java @@ -40,7 +40,8 @@ import com.cloud.network.cisco.CiscoAsa1000vDevice; import com.cloud.network.element.CiscoAsa1000vService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "addCiscoAsa1000vResource", responseObject = CiscoAsa1000vResourceResponse.class, description = "Adds a Cisco Asa 1000v appliance") +@APICommand(name = "addCiscoAsa1000vResource", responseObject = CiscoAsa1000vResourceResponse.class, description = "Adds a Cisco Asa 1000v appliance", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AddCiscoAsa1000vResourceCmd extends BaseCmd { private static final Logger s_logger = Logger.getLogger(AddCiscoAsa1000vResourceCmd.class.getName()); private static final String s_name = "addCiscoAsa1000vResource"; diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/AddCiscoVnmcResourceCmd.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/AddCiscoVnmcResourceCmd.java index b33d1a867d7..15d69b68c30 100644 --- a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/AddCiscoVnmcResourceCmd.java +++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/AddCiscoVnmcResourceCmd.java @@ -39,7 +39,8 @@ import com.cloud.network.cisco.CiscoVnmcController; import com.cloud.network.element.CiscoVnmcElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "addCiscoVnmcResource", responseObject = CiscoVnmcResourceResponse.class, description = "Adds a Cisco Vnmc Controller") +@APICommand(name = "addCiscoVnmcResource", responseObject = CiscoVnmcResourceResponse.class, description = "Adds a Cisco Vnmc Controller", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AddCiscoVnmcResourceCmd extends BaseCmd { private static final Logger s_logger = Logger.getLogger(AddCiscoVnmcResourceCmd.class.getName()); private static final String s_name = "addCiscoVnmcResource"; diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/DeleteCiscoAsa1000vResourceCmd.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/DeleteCiscoAsa1000vResourceCmd.java index 5af72994004..cdd4fbaca0e 100755 --- a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/DeleteCiscoAsa1000vResourceCmd.java +++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/DeleteCiscoAsa1000vResourceCmd.java @@ -38,7 +38,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.element.CiscoAsa1000vService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "deleteCiscoAsa1000vResource", responseObject = SuccessResponse.class, description = "Deletes a Cisco ASA 1000v appliance") +@APICommand(name = "deleteCiscoAsa1000vResource", responseObject = SuccessResponse.class, description = "Deletes a Cisco ASA 1000v appliance", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteCiscoAsa1000vResourceCmd extends BaseCmd { private static final Logger s_logger = Logger.getLogger(DeleteCiscoAsa1000vResourceCmd.class.getName()); private static final String s_name = "deleteCiscoAsa1000vResource"; diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/DeleteCiscoVnmcResourceCmd.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/DeleteCiscoVnmcResourceCmd.java index ee13ae6082e..2f1aecab98b 100644 --- a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/DeleteCiscoVnmcResourceCmd.java +++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/DeleteCiscoVnmcResourceCmd.java @@ -38,7 +38,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.element.CiscoVnmcElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "deleteCiscoVnmcResource", responseObject = SuccessResponse.class, description = "Deletes a Cisco Vnmc controller") +@APICommand(name = "deleteCiscoVnmcResource", responseObject = SuccessResponse.class, description = "Deletes a Cisco Vnmc controller", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteCiscoVnmcResourceCmd extends BaseCmd { private static final Logger s_logger = Logger.getLogger(DeleteCiscoVnmcResourceCmd.class.getName()); private static final String s_name = "deleteCiscoVnmcResource"; diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoAsa1000vResourcesCmd.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoAsa1000vResourcesCmd.java index 72898ae16d4..abf0bea11fa 100755 --- a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoAsa1000vResourcesCmd.java +++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoAsa1000vResourcesCmd.java @@ -43,7 +43,8 @@ import com.cloud.network.cisco.CiscoAsa1000vDeviceVO; import com.cloud.network.element.CiscoAsa1000vService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "listCiscoAsa1000vResources", responseObject = CiscoAsa1000vResourceResponse.class, description = "Lists Cisco ASA 1000v appliances") +@APICommand(name = "listCiscoAsa1000vResources", responseObject = CiscoAsa1000vResourceResponse.class, description = "Lists Cisco ASA 1000v appliances", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListCiscoAsa1000vResourcesCmd extends BaseListCmd { private static final Logger s_logger = Logger.getLogger(ListCiscoAsa1000vResourcesCmd.class.getName()); private static final String s_name = "listCiscoAsa1000vResources"; diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoVnmcResourcesCmd.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoVnmcResourcesCmd.java index 4b0a6b53ab5..c5e05e8013c 100644 --- a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoVnmcResourcesCmd.java +++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoVnmcResourcesCmd.java @@ -43,7 +43,8 @@ import com.cloud.network.cisco.CiscoVnmcControllerVO; import com.cloud.network.element.CiscoVnmcElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "listCiscoVnmcResources", responseObject = CiscoVnmcResourceResponse.class, description = "Lists Cisco VNMC controllers") +@APICommand(name = "listCiscoVnmcResources", responseObject = CiscoVnmcResourceResponse.class, description = "Lists Cisco VNMC controllers", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListCiscoVnmcResourcesCmd extends BaseListCmd { private static final Logger s_logger = Logger.getLogger(ListCiscoVnmcResourcesCmd.class.getName()); private static final String s_name = "listCiscoVnmcResources"; diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java index 03fac266700..d4d3c8dd0a6 100644 --- a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java +++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java @@ -29,11 +29,10 @@ import javax.inject.Inject; import javax.naming.ConfigurationException; import javax.persistence.EntityExistsException; -import org.apache.log4j.Logger; - import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice; +import org.apache.log4j.Logger; import com.cloud.agent.AgentManager; import com.cloud.agent.api.Answer; @@ -356,7 +355,7 @@ public class CiscoVnmcElement extends AdapterBase implements SourceNatServicePro try { Account caller = CallContext.current().getCallingAccount(); long callerUserId = CallContext.current().getCallingUserId(); - outsideIp = _ipAddrMgr.allocateIp(owner, false, caller, callerUserId, zone); + outsideIp = _ipAddrMgr.allocateIp(owner, false, caller, callerUserId, zone, true); } catch (ResourceAllocationException e) { s_logger.error("Unable to allocate additional public Ip address. Exception details " + e); throw new CloudRuntimeException("Unable to allocate additional public Ip address. Exception details " + e); diff --git a/plugins/network-elements/cisco-vnmc/test/com/cloud/network/cisco/CiscoVnmcConnectionTest.java b/plugins/network-elements/cisco-vnmc/test/com/cloud/network/cisco/CiscoVnmcConnectionTest.java index f5fca0aff8c..46e18a0e83f 100644 --- a/plugins/network-elements/cisco-vnmc/test/com/cloud/network/cisco/CiscoVnmcConnectionTest.java +++ b/plugins/network-elements/cisco-vnmc/test/com/cloud/network/cisco/CiscoVnmcConnectionTest.java @@ -35,207 +35,114 @@ public class CiscoVnmcConnectionTest { @BeforeClass public static void setUpClass() throws Exception { connection = new CiscoVnmcConnectionImpl("10.223.56.5", "admin", "C1sco123"); - try { - boolean response = connection.login(); - assertTrue(response); - } catch (ExecutionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + boolean response = connection.login(); + assertTrue(response); } @Test - public void testLogin() { - //fail("Not yet implemented"); - try { - boolean response = connection.login(); - assertTrue(response); - } catch (ExecutionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public void testLogin() throws ExecutionException { + boolean response = connection.login(); + assertTrue(response); } @Test - public void testCreateTenant() { - //fail("Not yet implemented"); - try { - boolean response = connection.createTenant(tenantName); - assertTrue(response); - } catch (ExecutionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public void testCreateTenant() throws ExecutionException { + boolean response = connection.createTenant(tenantName); + assertTrue(response); } @Test - public void testCreateTenantVDC() { - //fail("Not yet implemented"); - try { - boolean response = connection.createTenantVDC(tenantName); - assertTrue(response); - } catch (ExecutionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public void testCreateTenantVDC() throws ExecutionException { + boolean response = connection.createTenantVDC(tenantName); + assertTrue(response); } @Test - public void testCreateTenantVDCEdgeDeviceProfile() { - //fail("Not yet implemented"); - try { - boolean response = connection.createTenantVDCEdgeDeviceProfile(tenantName); - assertTrue(response); - } catch (ExecutionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public void testCreateTenantVDCEdgeDeviceProfile() throws ExecutionException { + boolean response = connection.createTenantVDCEdgeDeviceProfile(tenantName); + assertTrue(response); } @Test - public void testCreateTenantVDCEdgeDeviceRoutePolicy() { - try { - boolean response = connection.createTenantVDCEdgeStaticRoutePolicy(tenantName); - assertTrue(response); - } catch (ExecutionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public void testCreateTenantVDCEdgeDeviceRoutePolicy() throws ExecutionException { + boolean response = connection.createTenantVDCEdgeStaticRoutePolicy(tenantName); + assertTrue(response); } @Test - public void testCreateTenantVDCEdgeDeviceRoute() { - try { - boolean response = connection.createTenantVDCEdgeStaticRoute(tenantName, "10.223.136.1", "0.0.0.0", "0.0.0.0"); - assertTrue(response); - } catch (ExecutionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public void testCreateTenantVDCEdgeDeviceRoute() throws ExecutionException { + boolean response = connection.createTenantVDCEdgeStaticRoute(tenantName, "10.223.136.1", "0.0.0.0", "0.0.0.0"); + assertTrue(response); } @Test - public void testAssociateRoutePolicyWithEdgeProfile() { - try { - boolean response = connection.associateTenantVDCEdgeStaticRoutePolicy(tenantName); - assertTrue(response); - } catch (ExecutionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public void testAssociateRoutePolicyWithEdgeProfile() throws ExecutionException { + boolean response = connection.associateTenantVDCEdgeStaticRoutePolicy(tenantName); + assertTrue(response); } @Test - public void testAssociateTenantVDCEdgeDhcpPolicy() { - try { - boolean response = connection.associateTenantVDCEdgeDhcpPolicy(tenantName, "Edge_Inside"); - assertTrue(response); - } catch (ExecutionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public void testAssociateTenantVDCEdgeDhcpPolicy() throws ExecutionException { + boolean response = connection.associateTenantVDCEdgeDhcpPolicy(tenantName, "Edge_Inside"); + assertTrue(response); } @Test - public void testCreateTenantVDCEdgeDhcpPolicy() { - try { - boolean response = connection.createTenantVDCEdgeDhcpPolicy(tenantName, "10.1.1.2", "10.1.1.254", "255.255.255.0", "4.4.4.4", tenantName + ".net"); - assertTrue(response); - } catch (ExecutionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public void testCreateTenantVDCEdgeDhcpPolicy() throws ExecutionException { + boolean response = connection.createTenantVDCEdgeDhcpPolicy(tenantName, "10.1.1.2", "10.1.1.254", "255.255.255.0", "4.4.4.4", tenantName + ".net"); + assertTrue(response); } @Test - public void testCreateTenantVDCEdgeSecurityProfile() { - try { - boolean response = connection.createTenantVDCEdgeSecurityProfile(tenantName); - assertTrue(response); - } catch (ExecutionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public void testCreateTenantVDCEdgeSecurityProfile() throws ExecutionException { + boolean response = connection.createTenantVDCEdgeSecurityProfile(tenantName); + assertTrue(response); } @Test - public void testCreateTenantVDCSourceNatIpPool() { - try { - boolean response = connection.createTenantVDCSourceNatIpPool(tenantName, "1", "10.223.136.10"); - assertTrue(response); - } catch (ExecutionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public void testCreateTenantVDCSourceNatIpPool() throws ExecutionException { + boolean response = connection.createTenantVDCSourceNatIpPool(tenantName, "1", "10.223.136.10"); + assertTrue(response); } @Test - public void testCreateTenantVDCSourceNatPolicy() { - try { - boolean response = connection.createTenantVDCSourceNatPolicy(tenantName, "1"); - assertTrue(response); - response = connection.createTenantVDCSourceNatPolicyRef(tenantName, "1"); - assertTrue(response); - response = connection.createTenantVDCSourceNatRule(tenantName, "1", "10.1.1.2", "10.1.1.254"); - assertTrue(response); - } catch (ExecutionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public void testCreateTenantVDCSourceNatPolicy() throws ExecutionException { + boolean response = connection.createTenantVDCSourceNatPolicy(tenantName, "1"); + assertTrue(response); + response = connection.createTenantVDCSourceNatPolicyRef(tenantName, "1"); + assertTrue(response); + response = connection.createTenantVDCSourceNatRule(tenantName, "1", "10.1.1.2", "10.1.1.254"); + assertTrue(response); } @Test - public void testCreateTenantVDCNatPolicySet() { - try { - boolean response = connection.createTenantVDCNatPolicySet(tenantName); - assertTrue(response); - } catch (ExecutionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public void testCreateTenantVDCNatPolicySet() throws ExecutionException { + boolean response = connection.createTenantVDCNatPolicySet(tenantName); + assertTrue(response); } @Test - public void testAssociateNatPolicySet() { - try { - boolean response = connection.associateNatPolicySet(tenantName); - assertTrue(response); - } catch (ExecutionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public void testAssociateNatPolicySet() throws ExecutionException { + boolean response = connection.associateNatPolicySet(tenantName); + assertTrue(response); } @Test - public void testCreateEdgeFirewall() { - try { - boolean response = connection.createEdgeFirewall(tenantName, "44.44.44.44", "192.168.1.1", "255.255.255.0", "255.255.255.192"); - assertTrue(response); - } catch (ExecutionException e) { - e.printStackTrace(); - } + public void testCreateEdgeFirewall() throws ExecutionException { + boolean response = connection.createEdgeFirewall(tenantName, "44.44.44.44", "192.168.1.1", "255.255.255.0", "255.255.255.192"); + assertTrue(response); } @Test - public void testListUnassocAsa1000v() { - try { - Map response = connection.listUnAssocAsa1000v(); - assertTrue(response.size() >= 0); - fwDns = response; - } catch (ExecutionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public void testListUnassocAsa1000v() throws ExecutionException { + Map response = connection.listUnAssocAsa1000v(); + assertTrue(response.size() >= 0); + fwDns = response; } @Test - public void assocAsa1000v() { - try { - boolean result = connection.assignAsa1000v(tenantName, fwDns.get(0)); - assertTrue(result); - } catch (ExecutionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public void assocAsa1000v() throws ExecutionException { + boolean result = connection.assignAsa1000v(tenantName, fwDns.entrySet().iterator().next().getValue()); + assertTrue(result); } } diff --git a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java index 6dd0f8a3f93..2a7bcac7f0c 100644 --- a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java +++ b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java @@ -18,12 +18,9 @@ package com.cloud.network.lb; import java.util.ArrayList; import java.util.Collections; -import java.util.HashMap; import java.util.HashSet; -import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.Random; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; @@ -36,8 +33,6 @@ import javax.naming.ConfigurationException; import org.apache.cloudstack.api.command.user.loadbalancer.CreateLoadBalancerRuleCmd; import org.apache.cloudstack.config.ApiServiceConfiguration; -import org.apache.cloudstack.context.CallContext; -import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; import org.apache.cloudstack.framework.config.dao.ConfigurationDao; import org.apache.cloudstack.managed.context.ManagedContextRunnable; import org.apache.log4j.Logger; @@ -56,54 +51,31 @@ import com.cloud.configuration.Config; import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter.NetworkType; import com.cloud.dc.DataCenterVO; -import com.cloud.dc.Pod; -import com.cloud.dc.PodVlanMapVO; -import com.cloud.dc.Vlan.VlanType; import com.cloud.dc.dao.ClusterDao; import com.cloud.dc.dao.DataCenterDao; import com.cloud.dc.dao.HostPodDao; -import com.cloud.dc.dao.PodVlanMapDao; -import com.cloud.dc.dao.VlanDao; -import com.cloud.deploy.DataCenterDeployment; import com.cloud.deploy.DeployDestination; import com.cloud.exception.AgentUnavailableException; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientAddressCapacityException; -import com.cloud.exception.InsufficientCapacityException; -import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.OperationTimedoutException; import com.cloud.exception.ResourceUnavailableException; -import com.cloud.exception.StorageUnavailableException; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.network.ElasticLbVmMapVO; -import com.cloud.network.IpAddressManager; import com.cloud.network.Network; -import com.cloud.network.Network.Provider; -import com.cloud.network.Network.Service; import com.cloud.network.NetworkModel; import com.cloud.network.Networks.TrafficType; -import com.cloud.network.PhysicalNetworkServiceProvider; -import com.cloud.network.VirtualRouterProvider; -import com.cloud.network.VirtualRouterProvider.Type; -import com.cloud.network.addr.PublicIp; -import com.cloud.network.dao.IPAddressDao; -import com.cloud.network.dao.IPAddressVO; import com.cloud.network.dao.LoadBalancerDao; import com.cloud.network.dao.LoadBalancerVO; import com.cloud.network.dao.NetworkDao; import com.cloud.network.dao.NetworkVO; -import com.cloud.network.dao.PhysicalNetworkServiceProviderDao; -import com.cloud.network.dao.VirtualRouterProviderDao; import com.cloud.network.lb.LoadBalancingRule.LbDestination; import com.cloud.network.lb.LoadBalancingRule.LbHealthCheckPolicy; import com.cloud.network.lb.LoadBalancingRule.LbSslCert; import com.cloud.network.lb.LoadBalancingRule.LbStickinessPolicy; import com.cloud.network.lb.dao.ElasticLbVmMapDao; import com.cloud.network.router.VirtualRouter; -import com.cloud.network.router.VirtualRouter.RedundantState; -import com.cloud.network.router.VirtualRouter.Role; -import com.cloud.network.router.VpcVirtualNetworkApplianceManager; import com.cloud.network.rules.FirewallRule; import com.cloud.network.rules.LoadBalancer; import com.cloud.offering.NetworkOffering; @@ -111,21 +83,11 @@ import com.cloud.offering.ServiceOffering; import com.cloud.offerings.dao.NetworkOfferingDao; import com.cloud.service.ServiceOfferingVO; import com.cloud.service.dao.ServiceOfferingDao; -import com.cloud.storage.VMTemplateVO; -import com.cloud.storage.dao.VMTemplateDao; import com.cloud.user.Account; import com.cloud.user.AccountService; -import com.cloud.user.User; -import com.cloud.user.dao.AccountDao; import com.cloud.utils.NumbersUtil; import com.cloud.utils.component.ManagerBase; import com.cloud.utils.concurrency.NamedThreadFactory; -import com.cloud.utils.db.DB; -import com.cloud.utils.db.SearchBuilder; -import com.cloud.utils.db.SearchCriteria; -import com.cloud.utils.db.Transaction; -import com.cloud.utils.db.TransactionCallbackWithException; -import com.cloud.utils.db.TransactionStatus; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.net.Ip; import com.cloud.vm.DomainRouterVO; @@ -135,9 +97,7 @@ import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachine.State; import com.cloud.vm.VirtualMachineGuru; import com.cloud.vm.VirtualMachineManager; -import com.cloud.vm.VirtualMachineName; import com.cloud.vm.VirtualMachineProfile; -import com.cloud.vm.VirtualMachineProfile.Param; import com.cloud.vm.dao.DomainRouterDao; import com.cloud.vm.dao.NicDao; @@ -147,64 +107,40 @@ public class ElasticLoadBalancerManagerImpl extends ManagerBase implements Elast private static final Logger s_logger = Logger.getLogger(ElasticLoadBalancerManagerImpl.class); @Inject - IPAddressDao _ipAddressDao; + private AgentManager _agentMgr; @Inject - AgentManager _agentMgr; + private NetworkModel _networkModel; @Inject - NetworkModel _networkModel; + private LoadBalancingRulesManager _lbMgr; @Inject - NetworkOrchestrationService _networkMgr; - @Inject - LoadBalancerDao _loadBalancerDao = null; - @Inject - LoadBalancingRulesManager _lbMgr; - @Inject - VpcVirtualNetworkApplianceManager _routerMgr; - @Inject - DomainRouterDao _routerDao = null; + private final DomainRouterDao _routerDao = null; @Inject protected HostPodDao _podDao = null; @Inject protected ClusterDao _clusterDao; @Inject - DataCenterDao _dcDao = null; - @Inject - IpAddressManager _ipAddrMgr; + private final DataCenterDao _dcDao = null; @Inject protected NetworkDao _networkDao; @Inject protected NetworkOfferingDao _networkOfferingDao; @Inject - VMTemplateDao _templateDao = null; + private VirtualMachineManager _itMgr; @Inject - VirtualMachineManager _itMgr; + private ConfigurationDao _configDao; @Inject - ConfigurationDao _configDao; + private final ServiceOfferingDao _serviceOfferingDao = null; @Inject - ServiceOfferingDao _serviceOfferingDao = null; + private AccountService _accountService; @Inject - AccountService _accountService; + private LoadBalancerDao _lbDao; @Inject - LoadBalancerDao _lbDao; + private ElasticLbVmMapDao _elbVmMapDao; @Inject - VlanDao _vlanDao; - @Inject - PodVlanMapDao _podVlanMapDao; - @Inject - ElasticLbVmMapDao _elbVmMapDao; - @Inject - NetworkDao _networksDao; - @Inject - AccountDao _accountDao; - @Inject - PhysicalNetworkServiceProviderDao _physicalProviderDao; - @Inject - VirtualRouterProviderDao _vrProviderDao; - @Inject - NicDao _nicDao; + private NicDao _nicDao; String _instance; - static final private String ElbVmNamePrefix = "l"; + static final private String SystemVmType = "elbvm"; boolean _enabled; @@ -221,41 +157,7 @@ public class ElasticLoadBalancerManagerImpl extends ManagerBase implements Elast int _elasticLbvmCpuMHz; int _elasticLbvmNumCpu; - private Long getPodIdForDirectIp(IPAddressVO ipAddr) { - PodVlanMapVO podVlanMaps = _podVlanMapDao.listPodVlanMapsByVlan(ipAddr.getVlanId()); - if (podVlanMaps == null) { - return null; - } else { - return podVlanMaps.getPodId(); - } - } - - public DomainRouterVO deployLoadBalancerVM(Long networkId, IPAddressVO ipAddr, Long accountId) { - NetworkVO network = _networkDao.findById(networkId); - DataCenter dc = _dcDao.findById(network.getDataCenterId()); - Long podId = getPodIdForDirectIp(ipAddr); - Pod pod = podId == null ? null : _podDao.findById(podId); - Map params = new HashMap(1); - params.put(VirtualMachineProfile.Param.ReProgramGuestNetworks, true); - Account owner = _accountService.getActiveAccountByName("system", new Long(1)); - DeployDestination dest = new DeployDestination(dc, pod, null, null); - s_logger.debug("About to deploy ELB vm "); - - try { - DomainRouterVO elbVm = deployELBVm(network, dest, owner, params); - if (elbVm == null) { - throw new InvalidParameterValueException("Could not deploy or find existing ELB VM"); - } - s_logger.debug("Deployed ELB vm = " + elbVm); - - return elbVm; - - } catch (Throwable t) { - s_logger.warn("Error while deploying ELB VM: ", t); - return null; - } - - } + private LoadBalanceRuleHandler loadBalanceRuleHandler; private boolean sendCommandsToRouter(final DomainRouterVO elbVm, Commands cmds) throws AgentUnavailableException { Answer[] answers = null; @@ -307,9 +209,8 @@ public class ElasticLoadBalancerManagerImpl extends ManagerBase implements Elast } else { maxconn = offering.getConcurrentConnections().toString(); } - LoadBalancerConfigCommand cmd = - new LoadBalancerConfigCommand(lbs, elbVm.getPublicIpAddress(), _nicDao.getIpAddress(guestNetworkId, elbVm.getId()), elbVm.getPrivateIpAddress(), null, null, - maxconn, offering.isKeepAliveEnabled()); + LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(lbs, elbVm.getPublicIpAddress(), _nicDao.getIpAddress(guestNetworkId, elbVm.getId()), + elbVm.getPrivateIpAddress(), null, null, maxconn, offering.isKeepAliveEnabled()); cmd.setAccessDetail(NetworkElementCommand.ROUTER_IP, elbVm.getPrivateIpAddress()); cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, elbVm.getInstanceName()); //FIXME: why are we setting attributes directly? Ick!! There should be accessors and @@ -393,9 +294,8 @@ public class ElasticLoadBalancerManagerImpl extends ManagerBase implements Elast _elasticLbVmRamSize = NumbersUtil.parseInt(configs.get(Config.ElasticLoadBalancerVmMemory.key()), DEFAULT_ELB_VM_RAMSIZE); _elasticLbvmCpuMHz = NumbersUtil.parseInt(configs.get(Config.ElasticLoadBalancerVmCpuMhz.key()), DEFAULT_ELB_VM_CPU_MHZ); _elasticLbvmNumCpu = NumbersUtil.parseInt(configs.get(Config.ElasticLoadBalancerVmNumVcpu.key()), 1); - _elasticLbVmOffering = - new ServiceOfferingVO("System Offering For Elastic LB VM", _elasticLbvmNumCpu, _elasticLbVmRamSize, _elasticLbvmCpuMHz, 0, 0, true, null, useLocalStorage, - true, null, true, VirtualMachine.Type.ElasticLoadBalancerVm, true); + _elasticLbVmOffering = new ServiceOfferingVO("System Offering For Elastic LB VM", _elasticLbvmNumCpu, _elasticLbVmRamSize, _elasticLbvmCpuMHz, 0, 0, true, null, + useLocalStorage, true, null, true, VirtualMachine.Type.ElasticLoadBalancerVm, true); _elasticLbVmOffering.setUniqueName(ServiceOffering.elbVmDefaultOffUniqueName); _elasticLbVmOffering = _serviceOfferingDao.persistSystemServiceOffering(_elasticLbVmOffering); @@ -420,110 +320,12 @@ public class ElasticLoadBalancerManagerImpl extends ManagerBase implements Elast _itMgr.registerGuru(VirtualMachine.Type.ElasticLoadBalancerVm, this); } + loadBalanceRuleHandler = new LoadBalanceRuleHandler(_elasticLbVmOffering, _instance, _systemAcct); + return true; } - private DomainRouterVO findELBVmWithCapacity(Network guestNetwork, IPAddressVO ipAddr) { - List unusedElbVms = _elbVmMapDao.listUnusedElbVms(); - if (unusedElbVms.size() > 0) { - List candidateVms = new ArrayList(); - for (DomainRouterVO candidateVm : unusedElbVms) { - if (candidateVm.getPodIdToDeployIn() == getPodIdForDirectIp(ipAddr)) - candidateVms.add(candidateVm); - } - return candidateVms.size() == 0 ? null : candidateVms.get(new Random().nextInt(candidateVms.size())); - } - return null; - } - - public DomainRouterVO deployELBVm(Network guestNetwork, DeployDestination dest, Account owner, Map params) throws ConcurrentOperationException, - ResourceUnavailableException, InsufficientCapacityException { - long dcId = dest.getDataCenter().getId(); - - // lock guest network - Long guestNetworkId = guestNetwork.getId(); - guestNetwork = _networkDao.acquireInLockTable(guestNetworkId); - - if (guestNetwork == null) { - throw new ConcurrentOperationException("Unable to acquire network lock: " + guestNetworkId); - } - - try { - - if (_networkModel.isNetworkSystem(guestNetwork) || guestNetwork.getGuestType() == Network.GuestType.Shared) { - owner = _accountService.getSystemAccount(); - } - - if (s_logger.isDebugEnabled()) { - s_logger.debug("Starting a ELB vm for network configurations: " + guestNetwork + " in " + dest); - } - assert guestNetwork.getState() == Network.State.Implemented || guestNetwork.getState() == Network.State.Setup || - guestNetwork.getState() == Network.State.Implementing : "Network is not yet fully implemented: " + guestNetwork; - - DataCenterDeployment plan = null; - DomainRouterVO elbVm = null; - - plan = new DataCenterDeployment(dcId, dest.getPod().getId(), null, null, null, null); - - if (elbVm == null) { - long id = _routerDao.getNextInSequence(Long.class, "id"); - if (s_logger.isDebugEnabled()) { - s_logger.debug("Creating the ELB vm " + id); - } - - List offerings = _networkModel.getSystemAccountNetworkOfferings(NetworkOffering.SystemControlNetwork); - NetworkOffering controlOffering = offerings.get(0); - Network controlConfig = _networkMgr.setupNetwork(_systemAcct, controlOffering, plan, null, null, false).get(0); - - LinkedHashMap networks = new LinkedHashMap(2); - NicProfile guestNic = new NicProfile(); - guestNic.setDefaultNic(true); - networks.put(controlConfig, null); - networks.put(guestNetwork, guestNic); - - VMTemplateVO template = _templateDao.findSystemVMTemplate(dcId); - - String typeString = "ElasticLoadBalancerVm"; - Long physicalNetworkId = _networkModel.getPhysicalNetworkId(guestNetwork); - PhysicalNetworkServiceProvider provider = _physicalProviderDao.findByServiceProvider(physicalNetworkId, typeString); - if (provider == null) { - throw new CloudRuntimeException("Cannot find service provider " + typeString + " in physical network " + physicalNetworkId); - } - VirtualRouterProvider vrProvider = _vrProviderDao.findByNspIdAndType(provider.getId(), Type.ElasticLoadBalancerVm); - if (vrProvider == null) { - throw new CloudRuntimeException("Cannot find virtual router provider " + typeString + " as service provider " + provider.getId()); - } - - elbVm = - new DomainRouterVO(id, _elasticLbVmOffering.getId(), vrProvider.getId(), VirtualMachineName.getSystemVmName(id, _instance, ElbVmNamePrefix), - template.getId(), template.getHypervisorType(), template.getGuestOSId(), owner.getDomainId(), owner.getId(), false, 0, false, - RedundantState.UNKNOWN, _elasticLbVmOffering.getOfferHA(), false, VirtualMachine.Type.ElasticLoadBalancerVm, null); - elbVm.setRole(Role.LB); - elbVm = _routerDao.persist(elbVm); - _itMgr.allocate(elbVm.getInstanceName(), template, _elasticLbVmOffering, networks, plan, null); - elbVm = _routerDao.findById(elbVm.getId()); - //TODO: create usage stats - } - - State state = elbVm.getState(); - if (state != State.Running) { - elbVm = this.start(elbVm, _accountService.getSystemUser(), _accountService.getSystemAccount(), params); - } - - return elbVm; - } finally { - _networkDao.releaseFromLockTable(guestNetworkId); - } - } - - private DomainRouterVO start(DomainRouterVO elbVm, User user, Account caller, Map params) throws StorageUnavailableException, - InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException { - s_logger.debug("Starting ELB VM " + elbVm); - _itMgr.start(elbVm.getUuid(), params); - return _routerDao.findById(elbVm.getId()); - } - - private DomainRouterVO stop(DomainRouterVO elbVm, boolean forced, User user, Account caller) throws ConcurrentOperationException, ResourceUnavailableException { + private DomainRouterVO stop(DomainRouterVO elbVm, boolean forced) throws ConcurrentOperationException, ResourceUnavailableException { s_logger.debug("Stopping ELB vm " + elbVm); try { _itMgr.advanceStop(elbVm.getUuid(), forced); @@ -533,208 +335,55 @@ public class ElasticLoadBalancerManagerImpl extends ManagerBase implements Elast } } - protected List findExistingLoadBalancers(String lbName, Long ipId, Long accountId, Long domainId, Integer publicPort) { - SearchBuilder sb = _lbDao.createSearchBuilder(); - sb.and("name", sb.entity().getName(), SearchCriteria.Op.EQ); - sb.and("accountId", sb.entity().getAccountId(), SearchCriteria.Op.EQ); - sb.and("publicPort", sb.entity().getSourcePortStart(), SearchCriteria.Op.EQ); - if (ipId != null) { - sb.and("sourceIpAddress", sb.entity().getSourceIpAddressId(), SearchCriteria.Op.EQ); - } - if (domainId != null) { - sb.and("domainId", sb.entity().getDomainId(), SearchCriteria.Op.EQ); - } - if (publicPort != null) { - sb.and("publicPort", sb.entity().getSourcePortStart(), SearchCriteria.Op.EQ); - } - SearchCriteria sc = sb.create(); - sc.setParameters("name", lbName); - sc.setParameters("accountId", accountId); - if (ipId != null) { - sc.setParameters("sourceIpAddress", ipId); - } - if (domainId != null) { - sc.setParameters("domainId", domainId); - } - if (publicPort != null) { - sc.setParameters("publicPort", publicPort); - } - List lbs = _lbDao.search(sc, null); - - return lbs == null || lbs.size() == 0 ? null : lbs; - } - - @DB - public PublicIp allocDirectIp(final Account account, final long guestNetworkId) throws InsufficientAddressCapacityException { - return Transaction.execute(new TransactionCallbackWithException() { - @Override - public PublicIp doInTransaction(TransactionStatus status) throws InsufficientAddressCapacityException { - Network frontEndNetwork = _networkModel.getNetwork(guestNetworkId); - - PublicIp ip = - _ipAddrMgr.assignPublicIpAddress(frontEndNetwork.getDataCenterId(), null, account, VlanType.DirectAttached, frontEndNetwork.getId(), null, true); - IPAddressVO ipvo = _ipAddressDao.findById(ip.getId()); - ipvo.setAssociatedWithNetworkId(frontEndNetwork.getId()); - _ipAddressDao.update(ipvo.getId(), ipvo); - s_logger.info("Acquired frontend IP for ELB " + ip); - - return ip; - } - }); - } - - public void releaseIp(long ipId, long userId, Account caller) { - s_logger.info("ELB: Release public IP for loadbalancing " + ipId); - IPAddressVO ipvo = _ipAddressDao.findById(ipId); - ipvo.setAssociatedWithNetworkId(null); - _ipAddressDao.update(ipvo.getId(), ipvo); - _ipAddrMgr.disassociatePublicIpAddress(ipId, userId, caller); - _ipAddressDao.unassignIpAddress(ipId); - } - @Override - @DB public LoadBalancer handleCreateLoadBalancerRule(CreateLoadBalancerRuleCmd lb, Account account, long networkId) throws InsufficientAddressCapacityException, - NetworkRuleConflictException { - //this part of code is executed when the LB provider is Elastic Load Balancer vm - if (!_networkModel.isProviderSupportServiceInNetwork(lb.getNetworkId(), Service.Lb, Provider.ElasticLoadBalancerVm)) { - return null; - } - - Long ipId = lb.getSourceIpAddressId(); - if (ipId != null) { - return null; - } - boolean newIp = false; - account = _accountDao.acquireInLockTable(account.getId()); - if (account == null) { - s_logger.warn("ELB: CreateLoadBalancer: Failed to acquire lock on account"); - throw new CloudRuntimeException("Failed to acquire lock on account"); - } - try { - List existingLbs = - findExistingLoadBalancers(lb.getName(), lb.getSourceIpAddressId(), lb.getAccountId(), lb.getDomainId(), lb.getSourcePortStart()); - if (existingLbs == null) { - existingLbs = findExistingLoadBalancers(lb.getName(), lb.getSourceIpAddressId(), lb.getAccountId(), lb.getDomainId(), null); - if (existingLbs == null) { - if (lb.getSourceIpAddressId() != null) { - existingLbs = findExistingLoadBalancers(lb.getName(), null, lb.getAccountId(), lb.getDomainId(), null); - if (existingLbs != null) { - throw new InvalidParameterValueException("Supplied LB name " + lb.getName() + " is not associated with IP " + lb.getSourceIpAddressId()); - } - } else { - s_logger.debug("Could not find any existing frontend ips for this account for this LB rule, acquiring a new frontent IP for ELB"); - PublicIp ip = allocDirectIp(account, networkId); - ipId = ip.getId(); - newIp = true; - } - } else { - ipId = existingLbs.get(0).getSourceIpAddressId(); - s_logger.debug("ELB: Found existing frontend ip for this account for this LB rule " + ipId); - } - } else { - s_logger.warn("ELB: Found existing load balancers matching requested new LB"); - throw new NetworkRuleConflictException("ELB: Found existing load balancers matching requested new LB"); - } - - Network network = _networkModel.getNetwork(networkId); - IPAddressVO ipAddr = _ipAddressDao.findById(ipId); - - LoadBalancer result = null; - try { - lb.setSourceIpAddressId(ipId); - - result = - _lbMgr.createPublicLoadBalancer(lb.getXid(), lb.getName(), lb.getDescription(), lb.getSourcePortStart(), lb.getDefaultPortStart(), ipId.longValue(), - lb.getProtocol(), lb.getAlgorithm(), false, CallContext.current(), lb.getLbProtocol()); - } catch (NetworkRuleConflictException e) { - s_logger.warn("Failed to create LB rule, not continuing with ELB deployment"); - if (newIp) { - releaseIp(ipId, CallContext.current().getCallingUserId(), account); - } - throw e; - } - - DomainRouterVO elbVm = null; - - if (existingLbs == null) { - elbVm = findELBVmWithCapacity(network, ipAddr); - if (elbVm == null) { - elbVm = deployLoadBalancerVM(networkId, ipAddr, account.getId()); - if (elbVm == null) { - s_logger.warn("Failed to deploy a new ELB vm for ip " + ipAddr + " in network " + network + "lb name=" + lb.getName()); - if (newIp) - releaseIp(ipId, CallContext.current().getCallingUserId(), account); - } - } - - } else { - ElasticLbVmMapVO elbVmMap = _elbVmMapDao.findOneByIp(ipId); - if (elbVmMap != null) { - elbVm = _routerDao.findById(elbVmMap.getElbVmId()); - } - } - - if (elbVm == null) { - s_logger.warn("No ELB VM can be found or deployed"); - s_logger.warn("Deleting LB since we failed to deploy ELB VM"); - _lbDao.remove(result.getId()); - return null; - } - - ElasticLbVmMapVO mapping = new ElasticLbVmMapVO(ipId, elbVm.getId(), result.getId()); - _elbVmMapDao.persist(mapping); - return result; - - } finally { - if (account != null) { - _accountDao.releaseFromLockTable(account.getId()); - } - } - + NetworkRuleConflictException { + return loadBalanceRuleHandler.handleCreateLoadBalancerRule(lb, account, networkId); } void garbageCollectUnusedElbVms() { List unusedElbVms = _elbVmMapDao.listUnusedElbVms(); - if (unusedElbVms != null && unusedElbVms.size() > 0) - s_logger.info("Found " + unusedElbVms.size() + " unused ELB vms"); - Set currentGcCandidates = new HashSet(); - for (DomainRouterVO elbVm : unusedElbVms) { - currentGcCandidates.add(elbVm.getId()); - } - _gcCandidateElbVmIds.retainAll(currentGcCandidates); - currentGcCandidates.removeAll(_gcCandidateElbVmIds); - User user = _accountService.getSystemUser(); - for (Long elbVmId : _gcCandidateElbVmIds) { - DomainRouterVO elbVm = _routerDao.findById(elbVmId); - boolean gceed = false; - - try { - s_logger.info("Attempting to stop ELB VM: " + elbVm); - stop(elbVm, true, user, _systemAcct); - gceed = true; - } catch (ConcurrentOperationException e) { - s_logger.warn("Unable to stop unused ELB vm " + elbVm + " due to ", e); - } catch (ResourceUnavailableException e) { - s_logger.warn("Unable to stop unused ELB vm " + elbVm + " due to ", e); - continue; + if (unusedElbVms != null) { + if (unusedElbVms.size() > 0) { + s_logger.info("Found " + unusedElbVms.size() + " unused ELB vms"); } - if (gceed) { - try { - s_logger.info("Attempting to destroy ELB VM: " + elbVm); - _itMgr.expunge(elbVm.getUuid()); - _routerDao.remove(elbVm.getId()); - } catch (ResourceUnavailableException e) { - s_logger.warn("Unable to destroy unused ELB vm " + elbVm + " due to ", e); - gceed = false; - } - } - if (!gceed) { + Set currentGcCandidates = new HashSet(); + for (DomainRouterVO elbVm : unusedElbVms) { currentGcCandidates.add(elbVm.getId()); } + _gcCandidateElbVmIds.retainAll(currentGcCandidates); + currentGcCandidates.removeAll(_gcCandidateElbVmIds); + for (Long elbVmId : _gcCandidateElbVmIds) { + DomainRouterVO elbVm = _routerDao.findById(elbVmId); + boolean gceed = false; + try { + s_logger.info("Attempting to stop ELB VM: " + elbVm); + stop(elbVm, true); + gceed = true; + } catch (ConcurrentOperationException e) { + s_logger.warn("Unable to stop unused ELB vm " + elbVm + " due to ", e); + } catch (ResourceUnavailableException e) { + s_logger.warn("Unable to stop unused ELB vm " + elbVm + " due to ", e); + continue; + } + if (gceed) { + try { + s_logger.info("Attempting to destroy ELB VM: " + elbVm); + _itMgr.expunge(elbVm.getUuid()); + _routerDao.remove(elbVm.getId()); + } catch (ResourceUnavailableException e) { + s_logger.warn("Unable to destroy unused ELB vm " + elbVm + " due to ", e); + gceed = false; + } + } + if (!gceed) { + currentGcCandidates.add(elbVm.getId()); + } + + } + _gcCandidateElbVmIds = currentGcCandidates; } - _gcCandidateElbVmIds = currentGcCandidates; } public class CleanupThread extends ManagedContextRunnable { @@ -754,11 +403,7 @@ public class ElasticLoadBalancerManagerImpl extends ManagerBase implements Elast if (!_enabled) { return; } - List remainingLbs = _loadBalancerDao.listByIpAddress(lb.getSourceIpAddressId()); - if (remainingLbs.size() == 0) { - s_logger.debug("ELB mgr: releasing ip " + lb.getSourceIpAddressId() + " since no LB rules remain for this ip address"); - releaseIp(lb.getSourceIpAddressId(), userId, caller); - } + loadBalanceRuleHandler.handleDeleteLoadBalancerRule(lb, userId, caller); } @Override @@ -799,9 +444,9 @@ public class ElasticLoadBalancerManagerImpl extends ManagerBase implements Elast // control command is sent over management network in VMware if (dest.getHost().getHypervisorType() == HypervisorType.VMware) { if (s_logger.isInfoEnabled()) { - s_logger.info("Check if we need to add management server explicit route to ELB vm. pod cidr: " + dest.getPod().getCidrAddress() + "/" + - dest.getPod().getCidrSize() + ", pod gateway: " + dest.getPod().getGateway() + ", management host: " + - ApiServiceConfiguration.ManagementHostIPAdr.value()); + s_logger.info("Check if we need to add management server explicit route to ELB vm. pod cidr: " + dest.getPod().getCidrAddress() + "/" + + dest.getPod().getCidrSize() + ", pod gateway: " + dest.getPod().getGateway() + ", management host: " + + ApiServiceConfiguration.ManagementHostIPAdr.value()); } if (s_logger.isDebugEnabled()) { @@ -843,8 +488,7 @@ public class ElasticLoadBalancerManagerImpl extends ManagerBase implements Elast } @Override - public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) - throws ResourceUnavailableException { + public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException { DomainRouterVO elbVm = _routerDao.findById(profile.getVirtualMachine().getId()); List nics = profile.getNics(); @@ -868,7 +512,7 @@ public class ElasticLoadBalancerManagerImpl extends ManagerBase implements Elast public boolean finalizeStart(VirtualMachineProfile profile, long hostId, Commands cmds, ReservationContext context) { CheckSshAnswer answer = (CheckSshAnswer)cmds.getAnswer("checkSsh"); if (answer == null || !answer.getResult()) { - s_logger.warn("Unable to ssh to the ELB VM: " + answer.getDetails()); + s_logger.warn("Unable to ssh to the ELB VM: " + (answer != null ? answer.getDetails() : "No answer (answer for \"checkSsh\" was null)")); return false; } @@ -937,6 +581,7 @@ public class ElasticLoadBalancerManagerImpl extends ManagerBase implements Elast } } + @SuppressWarnings("unused") public void processStopOrRebootAnswer(final DomainRouterVO elbVm, Answer answer) { //TODO: process network usage stats } @@ -944,7 +589,6 @@ public class ElasticLoadBalancerManagerImpl extends ManagerBase implements Elast @Override public void finalizeExpunge(VirtualMachine vm) { // no-op - } @Override diff --git a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/LoadBalanceRuleHandler.java b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/LoadBalanceRuleHandler.java new file mode 100644 index 00000000000..32292cddd47 --- /dev/null +++ b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/LoadBalanceRuleHandler.java @@ -0,0 +1,467 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package com.cloud.network.lb; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; + +import javax.inject.Inject; + +import org.apache.cloudstack.api.command.user.loadbalancer.CreateLoadBalancerRuleCmd; +import org.apache.cloudstack.context.CallContext; +import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; +import org.apache.log4j.Logger; + +import com.cloud.dc.DataCenter; +import com.cloud.dc.Pod; +import com.cloud.dc.PodVlanMapVO; +import com.cloud.dc.Vlan.VlanType; +import com.cloud.dc.dao.ClusterDao; +import com.cloud.dc.dao.DataCenterDao; +import com.cloud.dc.dao.HostPodDao; +import com.cloud.dc.dao.PodVlanMapDao; +import com.cloud.deploy.DataCenterDeployment; +import com.cloud.deploy.DeployDestination; +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.InsufficientAddressCapacityException; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.exception.NetworkRuleConflictException; +import com.cloud.network.ElasticLbVmMapVO; +import com.cloud.network.IpAddressManager; +import com.cloud.network.Network; +import com.cloud.network.Network.Provider; +import com.cloud.network.Network.Service; +import com.cloud.network.NetworkModel; +import com.cloud.network.PhysicalNetworkServiceProvider; +import com.cloud.network.VirtualRouterProvider; +import com.cloud.network.VirtualRouterProvider.Type; +import com.cloud.network.addr.PublicIp; +import com.cloud.network.dao.IPAddressDao; +import com.cloud.network.dao.IPAddressVO; +import com.cloud.network.dao.LoadBalancerDao; +import com.cloud.network.dao.LoadBalancerVO; +import com.cloud.network.dao.NetworkDao; +import com.cloud.network.dao.NetworkVO; +import com.cloud.network.dao.PhysicalNetworkServiceProviderDao; +import com.cloud.network.dao.VirtualRouterProviderDao; +import com.cloud.network.lb.dao.ElasticLbVmMapDao; +import com.cloud.network.router.VirtualRouter.RedundantState; +import com.cloud.network.router.VirtualRouter.Role; +import com.cloud.network.rules.LoadBalancer; +import com.cloud.offering.NetworkOffering; +import com.cloud.offerings.dao.NetworkOfferingDao; +import com.cloud.service.ServiceOfferingVO; +import com.cloud.storage.VMTemplateVO; +import com.cloud.storage.dao.VMTemplateDao; +import com.cloud.user.Account; +import com.cloud.user.AccountService; +import com.cloud.user.dao.AccountDao; +import com.cloud.utils.db.DB; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.Transaction; +import com.cloud.utils.db.TransactionCallbackWithException; +import com.cloud.utils.db.TransactionStatus; +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.vm.DomainRouterVO; +import com.cloud.vm.NicProfile; +import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachine.State; +import com.cloud.vm.VirtualMachineManager; +import com.cloud.vm.VirtualMachineName; +import com.cloud.vm.VirtualMachineProfile; +import com.cloud.vm.VirtualMachineProfile.Param; +import com.cloud.vm.dao.DomainRouterDao; + +public class LoadBalanceRuleHandler { + + private static final Logger s_logger = Logger.getLogger(LoadBalanceRuleHandler.class); + + @Inject + private IPAddressDao _ipAddressDao; + @Inject + private NetworkModel _networkModel; + @Inject + private NetworkOrchestrationService _networkMgr; + @Inject + private final LoadBalancerDao _loadBalancerDao = null; + @Inject + private LoadBalancingRulesManager _lbMgr; + @Inject + private final DomainRouterDao _routerDao = null; + @Inject + protected HostPodDao _podDao = null; + @Inject + protected ClusterDao _clusterDao; + @Inject + private final DataCenterDao _dcDao = null; + @Inject + private IpAddressManager _ipAddrMgr; + @Inject + protected NetworkDao _networkDao; + @Inject + protected NetworkOfferingDao _networkOfferingDao; + @Inject + private final VMTemplateDao _templateDao = null; + @Inject + private VirtualMachineManager _itMgr; + @Inject + private AccountService _accountService; + @Inject + private LoadBalancerDao _lbDao; + @Inject + private PodVlanMapDao _podVlanMapDao; + @Inject + private ElasticLbVmMapDao _elbVmMapDao; + @Inject + private AccountDao _accountDao; + @Inject + private PhysicalNetworkServiceProviderDao _physicalProviderDao; + @Inject + private VirtualRouterProviderDao _vrProviderDao; + + static final private String ELB_VM_NAME_PREFIX = "l"; + + private final ServiceOfferingVO _elasticLbVmOffering; + private final String _instance; + private final Account _systemAcct; + + public LoadBalanceRuleHandler(ServiceOfferingVO elasticLbVmOffering, String instance, Account systemAcct) { + this._elasticLbVmOffering = elasticLbVmOffering; + this._instance = instance; + this._systemAcct = systemAcct; + } + + public void handleDeleteLoadBalancerRule(LoadBalancer lb, long userId, Account caller) { + List remainingLbs = _loadBalancerDao.listByIpAddress(lb.getSourceIpAddressId()); + if (remainingLbs.size() == 0) { + s_logger.debug("ELB mgr: releasing ip " + lb.getSourceIpAddressId() + " since no LB rules remain for this ip address"); + releaseIp(lb.getSourceIpAddressId(), userId, caller); + } + } + + public LoadBalancer handleCreateLoadBalancerRule(CreateLoadBalancerRuleCmd lb, Account account, long networkId) throws InsufficientAddressCapacityException, + NetworkRuleConflictException { + //this part of code is executed when the LB provider is Elastic Load Balancer vm + if (!_networkModel.isProviderSupportServiceInNetwork(lb.getNetworkId(), Service.Lb, Provider.ElasticLoadBalancerVm)) { + return null; + } + + Long ipId = lb.getSourceIpAddressId(); + if (ipId != null) { + return null; + } + + account = _accountDao.acquireInLockTable(account.getId()); + if (account == null) { + s_logger.warn("ELB: CreateLoadBalancer: Failed to acquire lock on account"); + throw new CloudRuntimeException("Failed to acquire lock on account"); + } + try { + return handleCreateLoadBalancerRuleWithLock(lb, account, networkId); + } finally { + if (account != null) { + _accountDao.releaseFromLockTable(account.getId()); + } + } + } + + private DomainRouterVO deployLoadBalancerVM(Long networkId, IPAddressVO ipAddr) { + NetworkVO network = _networkDao.findById(networkId); + DataCenter dc = _dcDao.findById(network.getDataCenterId()); + Long podId = getPodIdForDirectIp(ipAddr); + Pod pod = podId == null ? null : _podDao.findById(podId); + Map params = new HashMap(1); + params.put(VirtualMachineProfile.Param.ReProgramGuestNetworks, true); + Account owner = _accountService.getActiveAccountByName("system", new Long(1)); + DeployDestination dest = new DeployDestination(dc, pod, null, null); + s_logger.debug("About to deploy ELB vm "); + + try { + DomainRouterVO elbVm = deployELBVm(network, dest, owner, params); + if (elbVm == null) { + throw new InvalidParameterValueException("Could not deploy or find existing ELB VM"); + } + s_logger.debug("Deployed ELB vm = " + elbVm); + + return elbVm; + + } catch (Throwable t) { + s_logger.warn("Error while deploying ELB VM: ", t); + return null; + } + + } + + private DomainRouterVO deployELBVm(Network guestNetwork, DeployDestination dest, Account owner, Map params) throws ConcurrentOperationException, + InsufficientCapacityException { + long dcId = dest.getDataCenter().getId(); + + // lock guest network + Long guestNetworkId = guestNetwork.getId(); + guestNetwork = _networkDao.acquireInLockTable(guestNetworkId); + + if (guestNetwork == null) { + throw new ConcurrentOperationException("Unable to acquire network lock: " + guestNetworkId); + } + + try { + + if (_networkModel.isNetworkSystem(guestNetwork) || guestNetwork.getGuestType() == Network.GuestType.Shared) { + owner = _accountService.getSystemAccount(); + } + + if (s_logger.isDebugEnabled()) { + s_logger.debug("Starting a ELB vm for network configurations: " + guestNetwork + " in " + dest); + } + assert guestNetwork.getState() == Network.State.Implemented || guestNetwork.getState() == Network.State.Setup || guestNetwork.getState() == Network.State.Implementing : "Network is not yet fully implemented: " + + guestNetwork; + + DataCenterDeployment plan = null; + DomainRouterVO elbVm = null; + + plan = new DataCenterDeployment(dcId, dest.getPod().getId(), null, null, null, null); + + if (elbVm == null) { + long id = _routerDao.getNextInSequence(Long.class, "id"); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Creating the ELB vm " + id); + } + + List offerings = _networkModel.getSystemAccountNetworkOfferings(NetworkOffering.SystemControlNetwork); + NetworkOffering controlOffering = offerings.get(0); + Network controlConfig = _networkMgr.setupNetwork(_systemAcct, controlOffering, plan, null, null, false).get(0); + + LinkedHashMap> networks = new LinkedHashMap>(2); + NicProfile guestNic = new NicProfile(); + guestNic.setDefaultNic(true); + networks.put(controlConfig, new ArrayList()); + networks.put(guestNetwork, new ArrayList(Arrays.asList(guestNic))); + + VMTemplateVO template = _templateDao.findSystemVMTemplate(dcId); + + String typeString = "ElasticLoadBalancerVm"; + Long physicalNetworkId = _networkModel.getPhysicalNetworkId(guestNetwork); + PhysicalNetworkServiceProvider provider = _physicalProviderDao.findByServiceProvider(physicalNetworkId, typeString); + if (provider == null) { + throw new CloudRuntimeException("Cannot find service provider " + typeString + " in physical network " + physicalNetworkId); + } + VirtualRouterProvider vrProvider = _vrProviderDao.findByNspIdAndType(provider.getId(), Type.ElasticLoadBalancerVm); + if (vrProvider == null) { + throw new CloudRuntimeException("Cannot find virtual router provider " + typeString + " as service provider " + provider.getId()); + } + + elbVm = new DomainRouterVO(id, _elasticLbVmOffering.getId(), vrProvider.getId(), VirtualMachineName.getSystemVmName(id, _instance, ELB_VM_NAME_PREFIX), + template.getId(), template.getHypervisorType(), template.getGuestOSId(), owner.getDomainId(), owner.getId(), false, 0, false, RedundantState.UNKNOWN, + _elasticLbVmOffering.getOfferHA(), false, VirtualMachine.Type.ElasticLoadBalancerVm, null); + elbVm.setRole(Role.LB); + elbVm = _routerDao.persist(elbVm); + _itMgr.allocate(elbVm.getInstanceName(), template, _elasticLbVmOffering, networks, plan, null); + elbVm = _routerDao.findById(elbVm.getId()); + //TODO: create usage stats + } + + State state = elbVm.getState(); + if (state != State.Running) { + elbVm = this.start(elbVm, params); + } + + return elbVm; + } finally { + _networkDao.releaseFromLockTable(guestNetworkId); + } + } + + private void releaseIp(long ipId, long userId, Account caller) { + s_logger.info("ELB: Release public IP for loadbalancing " + ipId); + IPAddressVO ipvo = _ipAddressDao.findById(ipId); + ipvo.setAssociatedWithNetworkId(null); + _ipAddressDao.update(ipvo.getId(), ipvo); + _ipAddrMgr.disassociatePublicIpAddress(ipId, userId, caller); + _ipAddressDao.unassignIpAddress(ipId); + } + + protected Long getPodIdForDirectIp(IPAddressVO ipAddr) { + PodVlanMapVO podVlanMaps = _podVlanMapDao.listPodVlanMapsByVlan(ipAddr.getVlanId()); + if (podVlanMaps == null) { + return null; + } else { + return podVlanMaps.getPodId(); + } + } + + private LoadBalancer handleCreateLoadBalancerRuleWithLock(CreateLoadBalancerRuleCmd lb, Account account, long networkId) throws InsufficientAddressCapacityException, + NetworkRuleConflictException { + Long ipId = null; + boolean newIp = false; + List existingLbs = findExistingLoadBalancers(lb.getName(), lb.getSourceIpAddressId(), lb.getAccountId(), lb.getDomainId(), lb.getSourcePortStart()); + if (existingLbs == null) { + existingLbs = findExistingLoadBalancers(lb.getName(), lb.getSourceIpAddressId(), lb.getAccountId(), lb.getDomainId(), null); + if (existingLbs == null) { + if (lb.getSourceIpAddressId() != null) { + throwExceptionIfSuppliedlLbNameIsNotAssociatedWithIpAddress(lb); + } else { + s_logger.debug("Could not find any existing frontend ips for this account for this LB rule, acquiring a new frontent IP for ELB"); + PublicIp ip = allocDirectIp(account, networkId); + ipId = ip.getId(); + newIp = true; + } + } else { + ipId = existingLbs.get(0).getSourceIpAddressId(); + s_logger.debug("ELB: Found existing frontend ip for this account for this LB rule " + ipId); + } + } else { + s_logger.warn("ELB: Found existing load balancers matching requested new LB"); + throw new NetworkRuleConflictException("ELB: Found existing load balancers matching requested new LB"); + } + + IPAddressVO ipAddr = _ipAddressDao.findById(ipId); + + LoadBalancer result = null; + try { + lb.setSourceIpAddressId(ipId); + + result = _lbMgr.createPublicLoadBalancer(lb.getXid(), lb.getName(), lb.getDescription(), lb.getSourcePortStart(), lb.getDefaultPortStart(), ipId.longValue(), + lb.getProtocol(), lb.getAlgorithm(), false, CallContext.current(), lb.getLbProtocol(), true); + } catch (NetworkRuleConflictException e) { + s_logger.warn("Failed to create LB rule, not continuing with ELB deployment"); + if (newIp) { + releaseIp(ipId, CallContext.current().getCallingUserId(), account); + } + throw e; + } + + DomainRouterVO elbVm = null; + + if (existingLbs == null) { + elbVm = findElbVmWithCapacity(ipAddr); + if (elbVm == null) { + elbVm = deployLoadBalancerVM(networkId, ipAddr); + if (elbVm == null) { + Network network = _networkModel.getNetwork(networkId); + s_logger.warn("Failed to deploy a new ELB vm for ip " + ipAddr + " in network " + network + "lb name=" + lb.getName()); + if (newIp) + releaseIp(ipId, CallContext.current().getCallingUserId(), account); + } + } + + } else { + ElasticLbVmMapVO elbVmMap = _elbVmMapDao.findOneByIp(ipId); + if (elbVmMap != null) { + elbVm = _routerDao.findById(elbVmMap.getElbVmId()); + } + } + + if (elbVm == null) { + s_logger.warn("No ELB VM can be found or deployed"); + s_logger.warn("Deleting LB since we failed to deploy ELB VM"); + _lbDao.remove(result.getId()); + return null; + } + + ElasticLbVmMapVO mapping = new ElasticLbVmMapVO(ipId, elbVm.getId(), result.getId()); + _elbVmMapDao.persist(mapping); + return result; + } + + private void throwExceptionIfSuppliedlLbNameIsNotAssociatedWithIpAddress(CreateLoadBalancerRuleCmd lb) { + List existingLbs = findExistingLoadBalancers(lb.getName(), null, lb.getAccountId(), lb.getDomainId(), null); + if (existingLbs != null) { + throw new InvalidParameterValueException("Supplied LB name " + lb.getName() + " is not associated with IP " + lb.getSourceIpAddressId()); + } + } + + protected List findExistingLoadBalancers(String lbName, Long ipId, Long accountId, Long domainId, Integer publicPort) { + SearchBuilder sb = _lbDao.createSearchBuilder(); + sb.and("name", sb.entity().getName(), SearchCriteria.Op.EQ); + sb.and("accountId", sb.entity().getAccountId(), SearchCriteria.Op.EQ); + sb.and("publicPort", sb.entity().getSourcePortStart(), SearchCriteria.Op.EQ); + if (ipId != null) { + sb.and("sourceIpAddress", sb.entity().getSourceIpAddressId(), SearchCriteria.Op.EQ); + } + if (domainId != null) { + sb.and("domainId", sb.entity().getDomainId(), SearchCriteria.Op.EQ); + } + if (publicPort != null) { + sb.and("publicPort", sb.entity().getSourcePortStart(), SearchCriteria.Op.EQ); + } + SearchCriteria sc = sb.create(); + sc.setParameters("name", lbName); + sc.setParameters("accountId", accountId); + if (ipId != null) { + sc.setParameters("sourceIpAddress", ipId); + } + if (domainId != null) { + sc.setParameters("domainId", domainId); + } + if (publicPort != null) { + sc.setParameters("publicPort", publicPort); + } + List lbs = _lbDao.search(sc, null); + + return lbs == null || lbs.size() == 0 ? null : lbs; + } + + @DB + private PublicIp allocDirectIp(final Account account, final long guestNetworkId) throws InsufficientAddressCapacityException { + return Transaction.execute(new TransactionCallbackWithException() { + @Override + public PublicIp doInTransaction(TransactionStatus status) throws InsufficientAddressCapacityException { + Network frontEndNetwork = _networkModel.getNetwork(guestNetworkId); + + PublicIp ip = _ipAddrMgr.assignPublicIpAddress(frontEndNetwork.getDataCenterId(), null, account, VlanType.DirectAttached, frontEndNetwork.getId(), null, true); + IPAddressVO ipvo = _ipAddressDao.findById(ip.getId()); + ipvo.setAssociatedWithNetworkId(frontEndNetwork.getId()); + _ipAddressDao.update(ipvo.getId(), ipvo); + s_logger.info("Acquired frontend IP for ELB " + ip); + + return ip; + } + }); + } + + protected DomainRouterVO findElbVmWithCapacity(IPAddressVO ipAddr) { + List unusedElbVms = _elbVmMapDao.listUnusedElbVms(); + if (unusedElbVms.size() > 0) { + List candidateVms = new ArrayList(); + for (DomainRouterVO candidateVm : unusedElbVms) { + addCandidateVmIsPodIpMatches(candidateVm, getPodIdForDirectIp(ipAddr), candidateVms); + } + return candidateVms.size() == 0 ? null : candidateVms.get(new Random().nextInt(candidateVms.size())); + } + return null; + } + + protected static void addCandidateVmIsPodIpMatches(DomainRouterVO candidateVm, Long podIdForDirectIp, List candidateVms) { + if (candidateVm.getPodIdToDeployIn().equals(podIdForDirectIp)) { + candidateVms.add(candidateVm); + } + } + + protected DomainRouterVO start(DomainRouterVO elbVm, Map params) throws ConcurrentOperationException { + s_logger.debug("Starting ELB VM " + elbVm); + _itMgr.start(elbVm.getUuid(), params); + return _routerDao.findById(elbVm.getId()); + } +} diff --git a/plugins/network-elements/elastic-loadbalancer/test/com/cloud/network/lb/ElasticLoadBalancerManagerImplTest.java b/plugins/network-elements/elastic-loadbalancer/test/com/cloud/network/lb/ElasticLoadBalancerManagerImplTest.java new file mode 100644 index 00000000000..8928fd99979 --- /dev/null +++ b/plugins/network-elements/elastic-loadbalancer/test/com/cloud/network/lb/ElasticLoadBalancerManagerImplTest.java @@ -0,0 +1,101 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package com.cloud.network.lb; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.internal.util.reflection.Whitebox; +import org.mockito.runners.MockitoJUnitRunner; + +import com.cloud.agent.api.check.CheckSshAnswer; +import com.cloud.agent.manager.Commands; +import com.cloud.network.lb.dao.ElasticLbVmMapDao; +import com.cloud.vm.ReservationContext; +import com.cloud.vm.VirtualMachineProfile; + +@RunWith(MockitoJUnitRunner.class) +public class ElasticLoadBalancerManagerImplTest { + + @InjectMocks + private ElasticLoadBalancerManagerImpl elasticLoadBalancerManagerImpl; + + @Test + public void testFinalizeStartWhenCmdsAnswerIsNull() throws Exception { + VirtualMachineProfile profileMock = mock(VirtualMachineProfile.class); + long hostId = 1L; + Commands cmds = mock(Commands.class); + when(cmds.getAnswer("checkSsh")).thenReturn(null); + ReservationContext context = mock(ReservationContext.class); + + boolean expected = false; + boolean actual = elasticLoadBalancerManagerImpl.finalizeStart(profileMock, hostId, cmds, context); + + assertEquals(expected, actual); + } + + @Test + public void testFinalizeStartWhenCmdsAnswerIsNotNullButAnswerResultIsFalse() throws Exception { + CheckSshAnswer answerMock = mock(CheckSshAnswer.class); + when(answerMock.getResult()).thenReturn(false); + VirtualMachineProfile profileMock = mock(VirtualMachineProfile.class); + long hostId = 1L; + Commands cmds = mock(Commands.class); + when(cmds.getAnswer("checkSsh")).thenReturn(answerMock); + ReservationContext context = mock(ReservationContext.class); + + boolean expected = false; + boolean actual = elasticLoadBalancerManagerImpl.finalizeStart(profileMock, hostId, cmds, context); + + assertEquals(expected, actual); + } + + @Test + public void testFinalizeStartWhenCmdsAnswerIsNotNullAndAnswerResultIsTrue() throws Exception { + CheckSshAnswer answerMock = mock(CheckSshAnswer.class); + when(answerMock.getResult()).thenReturn(true); + VirtualMachineProfile profileMock = mock(VirtualMachineProfile.class); + long hostId = 1L; + Commands cmds = mock(Commands.class); + when(cmds.getAnswer("checkSsh")).thenReturn(answerMock); + ReservationContext context = mock(ReservationContext.class); + + boolean expected = true; + boolean actual = elasticLoadBalancerManagerImpl.finalizeStart(profileMock, hostId, cmds, context); + + assertEquals(expected, actual); + } + + @Test + public void testGarbageCollectUnusedElbVmsWhenVariableUnusedElbVmsIsNull() throws Exception { + ElasticLbVmMapDao elasticLbVmMapDaoMock = mock(ElasticLbVmMapDao.class); + when(elasticLbVmMapDaoMock.listUnusedElbVms()).thenReturn(null); + Whitebox.setInternalState(elasticLoadBalancerManagerImpl, "_elbVmMapDao", elasticLbVmMapDaoMock); + + try { + elasticLoadBalancerManagerImpl.garbageCollectUnusedElbVms(); + } catch (NullPointerException e) { + fail(); + } + } +} diff --git a/plugins/network-elements/elastic-loadbalancer/test/com/cloud/network/lb/LoadBalanceRuleHandlerTest.java b/plugins/network-elements/elastic-loadbalancer/test/com/cloud/network/lb/LoadBalanceRuleHandlerTest.java new file mode 100644 index 00000000000..17bae635687 --- /dev/null +++ b/plugins/network-elements/elastic-loadbalancer/test/com/cloud/network/lb/LoadBalanceRuleHandlerTest.java @@ -0,0 +1,215 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package com.cloud.network.lb; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.internal.util.reflection.Whitebox; +import org.mockito.runners.MockitoJUnitRunner; + +import com.cloud.dc.PodVlanMapVO; +import com.cloud.dc.dao.PodVlanMapDao; +import com.cloud.network.dao.IPAddressVO; +import com.cloud.network.lb.dao.ElasticLbVmMapDao; +import com.cloud.vm.DomainRouterVO; +import com.cloud.vm.VirtualMachineManager; +import com.cloud.vm.VirtualMachineProfile.Param; +import com.cloud.vm.dao.DomainRouterDao; + +@RunWith(MockitoJUnitRunner.class) +public class LoadBalanceRuleHandlerTest { + + @InjectMocks + private LoadBalanceRuleHandler loadBalanceRuleHandler; + + @Mock + private VirtualMachineManager virtualMachineManagerMock; + + @Mock + private DomainRouterDao domainRouterDaoMock; + + @Mock + private ElasticLbVmMapDao elasticLbVmMapDao; + + @Mock + private PodVlanMapDao podVlanMapDao; + + @Before + public void setup() { + Whitebox.setInternalState(loadBalanceRuleHandler, "_itMgr", virtualMachineManagerMock); + Whitebox.setInternalState(loadBalanceRuleHandler, "_routerDao", domainRouterDaoMock); + Whitebox.setInternalState(loadBalanceRuleHandler, "_elbVmMapDao", elasticLbVmMapDao); + Whitebox.setInternalState(loadBalanceRuleHandler, "_podVlanMapDao", podVlanMapDao); + } + + @Test + public void testAddCandidateVmIsPodIpMatchesWhenIdsHaveSameValue() throws Exception { + DomainRouterVO candidateVmMock = mock(DomainRouterVO.class); + when(candidateVmMock.getPodIdToDeployIn()).thenReturn(new Long(1)); + Long podIdForDirectIp = new Long(1); + List candidateVms = new ArrayList(); + + LoadBalanceRuleHandler.addCandidateVmIsPodIpMatches(candidateVmMock, podIdForDirectIp, candidateVms); + + assertEquals(1, candidateVms.size()); + } + + @Test + public void testAddCandidateVmIsPodIpMatchesWhenPodIdForDirectIpIsNull() throws Exception { + DomainRouterVO candidateVmMock = mock(DomainRouterVO.class); + when(candidateVmMock.getPodIdToDeployIn()).thenReturn(new Long(1)); + Long podIdForDirectIp = null; + List candidateVms = new ArrayList(); + + LoadBalanceRuleHandler.addCandidateVmIsPodIpMatches(candidateVmMock, podIdForDirectIp, candidateVms); + + assertEquals(0, candidateVms.size()); + } + + // PodIdToDeployIn should not be null according to column specification in DomainRouterVO + @Test(expected = NullPointerException.class) + public void testAddCandidateVmIsPodIpMatchesWhenPodIdToDeployInIsNull() throws Exception { + DomainRouterVO candidateVmMock = mock(DomainRouterVO.class); + when(candidateVmMock.getPodIdToDeployIn()).thenReturn(null); + Long podIdForDirectIp = new Long(1); + List candidateVms = new ArrayList(); + + LoadBalanceRuleHandler.addCandidateVmIsPodIpMatches(candidateVmMock, podIdForDirectIp, candidateVms); + } + + @Test(expected = NullPointerException.class) + public void testAddCandidateVmIsPodIpMatchesWhenCandidateVmsIsNull() throws Exception { + DomainRouterVO candidateVmMock = mock(DomainRouterVO.class); + when(candidateVmMock.getPodIdToDeployIn()).thenReturn(new Long(1)); + Long podIdForDirectIp = new Long(1); + List candidateVms = null; + + LoadBalanceRuleHandler.addCandidateVmIsPodIpMatches(candidateVmMock, podIdForDirectIp, candidateVms); + } + + @Test(expected = NullPointerException.class) + public void testStartWhenElbVmIsNull() throws Exception { + DomainRouterVO elbVm = null; + Map params = new HashMap(); + + loadBalanceRuleHandler.start(elbVm, params); + } + + @Test + public void testStartWhenParamsIsNull() throws Exception { + DomainRouterVO elbVmMock = mock(DomainRouterVO.class); + String uuid = "uuid"; + when(elbVmMock.getUuid()).thenReturn(uuid); + long id = 1L; + when(elbVmMock.getId()).thenReturn(id); + Map params = null; + + loadBalanceRuleHandler.start(elbVmMock, params); + + verify(virtualMachineManagerMock, times(1)).start(uuid, params); + verify(domainRouterDaoMock, times(1)).findById(id); + } + + @Test + public void testStartWhenParamsIsEmpty() throws Exception { + DomainRouterVO elbVmMock = mock(DomainRouterVO.class); + String uuid = "uuid"; + when(elbVmMock.getUuid()).thenReturn(uuid); + long id = 1L; + when(elbVmMock.getId()).thenReturn(id); + Map params = new HashMap(); + + loadBalanceRuleHandler.start(elbVmMock, params); + + verify(virtualMachineManagerMock, times(1)).start(uuid, params); + verify(domainRouterDaoMock, times(1)).findById(id); + } + + @Test + public void testStart() throws Exception { + DomainRouterVO elbVmMock = mock(DomainRouterVO.class); + String uuid = "uuid"; + when(elbVmMock.getUuid()).thenReturn(uuid); + long id = 1L; + when(elbVmMock.getId()).thenReturn(id); + Map params = new HashMap(); + params.put(mock(Param.class), new Object()); + + loadBalanceRuleHandler.start(elbVmMock, params); + + verify(virtualMachineManagerMock, times(1)).start(uuid, params); + verify(domainRouterDaoMock, times(1)).findById(id); + } + + @Test + public void testFindElbVmWithCapacityWhenIpAddrIsNull() throws Exception { + IPAddressVO ipAddr = null; + + DomainRouterVO actual = loadBalanceRuleHandler.findElbVmWithCapacity(ipAddr); + + assertNull(actual); + } + + @Test + public void testFindElbVmWithCapacityWhenThereAreNoUnusedElbVms() throws Exception { + IPAddressVO ipAddr = mock(IPAddressVO.class); + when(this.elasticLbVmMapDao.listUnusedElbVms()).thenReturn(new ArrayList(1)); + + DomainRouterVO actual = loadBalanceRuleHandler.findElbVmWithCapacity(ipAddr); + + assertNull(actual); + } + + @Test + public void testFindElbVmWithCapacityWhenThereAreUnusedElbVmsAndOneMatchesThePodId() throws Exception { + Long podId = 1L; + IPAddressVO ipAddrMock = mock(IPAddressVO.class); + when(ipAddrMock.getVlanId()).thenReturn(podId); + PodVlanMapVO podVlanMapVoMock = mock(PodVlanMapVO.class); + when(podVlanMapVoMock.getPodId()).thenReturn(podId); + when(podVlanMapDao.listPodVlanMapsByVlan(podId)).thenReturn(podVlanMapVoMock); + DomainRouterVO unusedElbVmThatMatchesPodId = mock(DomainRouterVO.class); + when(unusedElbVmThatMatchesPodId.getPodIdToDeployIn()).thenReturn(podId); + List unusedElbVms = Arrays.asList(new DomainRouterVO[] {unusedElbVmThatMatchesPodId, mock(DomainRouterVO.class)}); + when(this.elasticLbVmMapDao.listUnusedElbVms()).thenReturn(unusedElbVms); + + DomainRouterVO expected = unusedElbVmThatMatchesPodId; + DomainRouterVO actual = loadBalanceRuleHandler.findElbVmWithCapacity(ipAddrMock); + + assertNotNull(actual); + assertEquals(expected, actual); + } + +} diff --git a/plugins/network-elements/f5/src/com/cloud/api/commands/AddExternalLoadBalancerCmd.java b/plugins/network-elements/f5/src/com/cloud/api/commands/AddExternalLoadBalancerCmd.java index ff653e721d3..6deea1063d5 100644 --- a/plugins/network-elements/f5/src/com/cloud/api/commands/AddExternalLoadBalancerCmd.java +++ b/plugins/network-elements/f5/src/com/cloud/api/commands/AddExternalLoadBalancerCmd.java @@ -36,7 +36,8 @@ import com.cloud.network.element.F5ExternalLoadBalancerElementService; import com.cloud.user.Account; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "addExternalLoadBalancer", description = "Adds F5 external load balancer appliance.", responseObject = ExternalLoadBalancerResponse.class) +@APICommand(name = "addExternalLoadBalancer", description = "Adds F5 external load balancer appliance.", responseObject = ExternalLoadBalancerResponse.class, + requestHasSensitiveInfo = true, responseHasSensitiveInfo = false) @Deprecated // API supported only for backward compatibility. public class AddExternalLoadBalancerCmd extends BaseCmd { diff --git a/plugins/network-elements/f5/src/com/cloud/api/commands/AddF5LoadBalancerCmd.java b/plugins/network-elements/f5/src/com/cloud/api/commands/AddF5LoadBalancerCmd.java index ba98882a1b8..951439ddb65 100644 --- a/plugins/network-elements/f5/src/com/cloud/api/commands/AddF5LoadBalancerCmd.java +++ b/plugins/network-elements/f5/src/com/cloud/api/commands/AddF5LoadBalancerCmd.java @@ -41,7 +41,8 @@ import com.cloud.network.dao.ExternalLoadBalancerDeviceVO; import com.cloud.network.element.F5ExternalLoadBalancerElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "addF5LoadBalancer", responseObject = F5LoadBalancerResponse.class, description = "Adds a F5 BigIP load balancer device") +@APICommand(name = "addF5LoadBalancer", responseObject = F5LoadBalancerResponse.class, description = "Adds a F5 BigIP load balancer device", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AddF5LoadBalancerCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(AddF5LoadBalancerCmd.class.getName()); diff --git a/plugins/network-elements/f5/src/com/cloud/api/commands/ConfigureF5LoadBalancerCmd.java b/plugins/network-elements/f5/src/com/cloud/api/commands/ConfigureF5LoadBalancerCmd.java index dc33984b736..dc520ff7100 100644 --- a/plugins/network-elements/f5/src/com/cloud/api/commands/ConfigureF5LoadBalancerCmd.java +++ b/plugins/network-elements/f5/src/com/cloud/api/commands/ConfigureF5LoadBalancerCmd.java @@ -40,7 +40,8 @@ import com.cloud.network.dao.ExternalLoadBalancerDeviceVO; import com.cloud.network.element.F5ExternalLoadBalancerElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "configureF5LoadBalancer", responseObject = F5LoadBalancerResponse.class, description = "configures a F5 load balancer device") +@APICommand(name = "configureF5LoadBalancer", responseObject = F5LoadBalancerResponse.class, description = "configures a F5 load balancer device", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ConfigureF5LoadBalancerCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ConfigureF5LoadBalancerCmd.class.getName()); diff --git a/plugins/network-elements/f5/src/com/cloud/api/commands/DeleteExternalLoadBalancerCmd.java b/plugins/network-elements/f5/src/com/cloud/api/commands/DeleteExternalLoadBalancerCmd.java index 63a9041942b..b695ce4256d 100644 --- a/plugins/network-elements/f5/src/com/cloud/api/commands/DeleteExternalLoadBalancerCmd.java +++ b/plugins/network-elements/f5/src/com/cloud/api/commands/DeleteExternalLoadBalancerCmd.java @@ -34,7 +34,8 @@ import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.element.F5ExternalLoadBalancerElementService; import com.cloud.user.Account; -@APICommand(name = "deleteExternalLoadBalancer", description = "Deletes a F5 external load balancer appliance added in a zone.", responseObject = SuccessResponse.class) +@APICommand(name = "deleteExternalLoadBalancer", description = "Deletes a F5 external load balancer appliance added in a zone.", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) @Deprecated // API supported for backward compatibility. public class DeleteExternalLoadBalancerCmd extends BaseCmd { diff --git a/plugins/network-elements/f5/src/com/cloud/api/commands/DeleteF5LoadBalancerCmd.java b/plugins/network-elements/f5/src/com/cloud/api/commands/DeleteF5LoadBalancerCmd.java index 2bb6c1c36e9..cd60c61e3b8 100644 --- a/plugins/network-elements/f5/src/com/cloud/api/commands/DeleteF5LoadBalancerCmd.java +++ b/plugins/network-elements/f5/src/com/cloud/api/commands/DeleteF5LoadBalancerCmd.java @@ -40,7 +40,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.element.F5ExternalLoadBalancerElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "deleteF5LoadBalancer", responseObject = SuccessResponse.class, description = " delete a F5 load balancer device") +@APICommand(name = "deleteF5LoadBalancer", responseObject = SuccessResponse.class, description = " delete a F5 load balancer device", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteF5LoadBalancerCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteF5LoadBalancerCmd.class.getName()); private static final String s_name = "deletef5loadbalancerresponse"; diff --git a/plugins/network-elements/f5/src/com/cloud/api/commands/ListExternalLoadBalancersCmd.java b/plugins/network-elements/f5/src/com/cloud/api/commands/ListExternalLoadBalancersCmd.java index 119718cf8fd..4ffe85f5537 100644 --- a/plugins/network-elements/f5/src/com/cloud/api/commands/ListExternalLoadBalancersCmd.java +++ b/plugins/network-elements/f5/src/com/cloud/api/commands/ListExternalLoadBalancersCmd.java @@ -36,7 +36,8 @@ import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.host.Host; import com.cloud.network.element.F5ExternalLoadBalancerElementService; -@APICommand(name = "listExternalLoadBalancers", description = "Lists F5 external load balancer appliances added in a zone.", responseObject = HostResponse.class) +@APICommand(name = "listExternalLoadBalancers", description = "Lists F5 external load balancer appliances added in a zone.", responseObject = HostResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) @Deprecated // API supported for backward compatibility. public class ListExternalLoadBalancersCmd extends BaseListCmd { diff --git a/plugins/network-elements/f5/src/com/cloud/api/commands/ListF5LoadBalancerNetworksCmd.java b/plugins/network-elements/f5/src/com/cloud/api/commands/ListF5LoadBalancerNetworksCmd.java index b3f37254acd..1b7e1ec84a4 100644 --- a/plugins/network-elements/f5/src/com/cloud/api/commands/ListF5LoadBalancerNetworksCmd.java +++ b/plugins/network-elements/f5/src/com/cloud/api/commands/ListF5LoadBalancerNetworksCmd.java @@ -44,7 +44,8 @@ import com.cloud.network.Network; import com.cloud.network.element.F5ExternalLoadBalancerElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "listF5LoadBalancerNetworks", responseObject = NetworkResponse.class, description = "lists network that are using a F5 load balancer device") +@APICommand(name = "listF5LoadBalancerNetworks", responseObject = NetworkResponse.class, description = "lists network that are using a F5 load balancer device", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListF5LoadBalancerNetworksCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListF5LoadBalancerNetworksCmd.class.getName()); diff --git a/plugins/network-elements/f5/src/com/cloud/api/commands/ListF5LoadBalancersCmd.java b/plugins/network-elements/f5/src/com/cloud/api/commands/ListF5LoadBalancersCmd.java index ce8eb202005..283a1502da6 100644 --- a/plugins/network-elements/f5/src/com/cloud/api/commands/ListF5LoadBalancersCmd.java +++ b/plugins/network-elements/f5/src/com/cloud/api/commands/ListF5LoadBalancersCmd.java @@ -43,7 +43,8 @@ import com.cloud.network.dao.ExternalLoadBalancerDeviceVO; import com.cloud.network.element.F5ExternalLoadBalancerElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "listF5LoadBalancers", responseObject = F5LoadBalancerResponse.class, description = "lists F5 load balancer devices") +@APICommand(name = "listF5LoadBalancers", responseObject = F5LoadBalancerResponse.class, description = "lists F5 load balancer devices", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListF5LoadBalancersCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListF5LoadBalancersCmd.class.getName()); private static final String s_name = "listf5loadbalancerresponse"; diff --git a/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java b/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java index b2030a93f60..8b823063e5f 100644 --- a/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java +++ b/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java @@ -17,6 +17,7 @@ package org.apache.cloudstack.network.lb; import java.util.ArrayList; +import java.util.Arrays; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; @@ -26,12 +27,11 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; -import org.apache.log4j.Logger; - import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; import org.apache.cloudstack.framework.config.dao.ConfigurationDao; import org.apache.cloudstack.lb.ApplicationLoadBalancerRuleVO; import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao; +import org.apache.log4j.Logger; import com.cloud.agent.AgentManager; import com.cloud.agent.api.Answer; @@ -613,7 +613,7 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements In return internalLbVms; } - LinkedHashMap networks = createInternalLbVmNetworks(guestNetwork, plan, requestedGuestIp); + LinkedHashMap> networks = createInternalLbVmNetworks(guestNetwork, plan, requestedGuestIp); //Pass startVm=false as we are holding the network lock that needs to be released at the end of vm allocation DomainRouterVO internalLbVm = deployInternalLbVm(owner, dest, plan, params, internalLbProviderId, _internalLbVmOfferingId, guestNetwork.getVpcId(), networks, false); @@ -649,11 +649,11 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements In return internalLbProvider.getId(); } - protected LinkedHashMap createInternalLbVmNetworks(Network guestNetwork, DeploymentPlan plan, Ip guestIp) throws ConcurrentOperationException, - InsufficientAddressCapacityException { + protected LinkedHashMap> createInternalLbVmNetworks(Network guestNetwork, DeploymentPlan plan, Ip guestIp) throws ConcurrentOperationException, + InsufficientAddressCapacityException { //Form networks - LinkedHashMap networks = new LinkedHashMap(3); + LinkedHashMap> networks = new LinkedHashMap>(3); //1) Guest network - default if (guestNetwork != null) { @@ -672,7 +672,7 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements In String gatewayCidr = guestNetwork.getCidr(); guestNic.setNetmask(NetUtils.getCidrNetmask(gatewayCidr)); guestNic.setDefaultNic(true); - networks.put(guestNetwork, guestNic); + networks.put(guestNetwork, new ArrayList(Arrays.asList(guestNic))); } //2) Control network @@ -680,7 +680,7 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements In List offerings = _ntwkModel.getSystemAccountNetworkOfferings(NetworkOffering.SystemControlNetwork); NetworkOffering controlOffering = offerings.get(0); Network controlConfig = _ntwkMgr.setupNetwork(_accountMgr.getSystemAccount(), controlOffering, plan, null, null, false).get(0); - networks.put(controlConfig, null); + networks.put(controlConfig, new ArrayList()); return networks; } @@ -711,7 +711,7 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements In } protected DomainRouterVO deployInternalLbVm(Account owner, DeployDestination dest, DeploymentPlan plan, Map params, long internalLbProviderId, - long svcOffId, Long vpcId, LinkedHashMap networks, boolean startVm) throws ConcurrentOperationException, + long svcOffId, Long vpcId, LinkedHashMap> networks, boolean startVm) throws ConcurrentOperationException, InsufficientAddressCapacityException, InsufficientServerCapacityException, InsufficientCapacityException, StorageUnavailableException, ResourceUnavailableException { diff --git a/plugins/network-elements/juniper-contrail/resources/META-INF/cloudstack/system/spring-contrail-system-context-inheritable.xml b/plugins/network-elements/juniper-contrail/resources/META-INF/cloudstack/system/spring-contrail-system-context-inheritable.xml new file mode 100644 index 00000000000..085b99b8ab9 --- /dev/null +++ b/plugins/network-elements/juniper-contrail/resources/META-INF/cloudstack/system/spring-contrail-system-context-inheritable.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + diff --git a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/api/command/CreateServiceInstanceCmd.java b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/api/command/CreateServiceInstanceCmd.java index 50457d8f7c7..86e29497d64 100644 --- a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/api/command/CreateServiceInstanceCmd.java +++ b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/api/command/CreateServiceInstanceCmd.java @@ -51,7 +51,9 @@ import com.cloud.user.Account; @APICommand(name = "createServiceInstance", description = "Creates a system virtual-machine that implements network services", - responseObject = ServiceInstanceResponse.class) + responseObject = ServiceInstanceResponse.class, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false) public class CreateServiceInstanceCmd extends BaseAsyncCreateCmd { private static final String s_name = "createserviceinstanceresponse"; diff --git a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ContrailManagerImpl.java b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ContrailManagerImpl.java index b25de488f37..01be7dbd66a 100644 --- a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ContrailManagerImpl.java +++ b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ContrailManagerImpl.java @@ -31,9 +31,9 @@ import java.util.Set; import java.util.Timer; import java.util.TimerTask; +import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; -import javax.ejb.Local; import net.juniper.contrail.api.ApiConnector; import net.juniper.contrail.api.ApiConnectorFactory; @@ -44,19 +44,16 @@ import net.juniper.contrail.api.types.FloatingIpPool; import net.juniper.contrail.api.types.NetworkPolicy; import net.juniper.contrail.api.types.VirtualNetwork; -import org.apache.commons.lang.StringUtils; -import org.apache.log4j.Logger; - -import com.google.common.collect.ImmutableList; - import org.apache.cloudstack.network.contrail.model.FloatingIpModel; import org.apache.cloudstack.network.contrail.model.FloatingIpPoolModel; import org.apache.cloudstack.network.contrail.model.ModelController; import org.apache.cloudstack.network.contrail.model.VirtualNetworkModel; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; import com.cloud.configuration.ConfigurationManager; import com.cloud.configuration.ConfigurationService; -import com.cloud.server.ConfigurationServer; import com.cloud.dc.DataCenter; import com.cloud.dc.dao.DataCenterDao; import com.cloud.dc.dao.VlanDao; @@ -75,20 +72,21 @@ import com.cloud.network.dao.NetworkVO; import com.cloud.network.dao.PhysicalNetworkDao; import com.cloud.network.dao.PhysicalNetworkServiceProviderDao; import com.cloud.network.dao.PhysicalNetworkVO; -import com.cloud.offering.NetworkOffering.Availability; -import com.cloud.offering.NetworkOffering; -import com.cloud.offerings.NetworkOfferingVO; -import com.cloud.offerings.dao.NetworkOfferingDao; -import com.cloud.projects.ProjectVO; -import com.cloud.network.vpc.dao.NetworkACLDao; -import com.cloud.network.vpc.dao.VpcDao; -import com.cloud.network.vpc.dao.VpcOfferingDao; +import com.cloud.network.vpc.NetworkACLVO; import com.cloud.network.vpc.VpcOffering; import com.cloud.network.vpc.VpcOfferingVO; import com.cloud.network.vpc.VpcProvisioningService; import com.cloud.network.vpc.VpcVO; -import com.cloud.network.vpc.NetworkACLVO; +import com.cloud.network.vpc.dao.NetworkACLDao; +import com.cloud.network.vpc.dao.VpcDao; +import com.cloud.network.vpc.dao.VpcOfferingDao; +import com.cloud.offering.NetworkOffering; +import com.cloud.offering.NetworkOffering.Availability; +import com.cloud.offerings.NetworkOfferingVO; +import com.cloud.offerings.dao.NetworkOfferingDao; +import com.cloud.projects.ProjectVO; import com.cloud.projects.dao.ProjectDao; +import com.cloud.server.ConfigurationServer; import com.cloud.user.Account; import com.cloud.user.dao.AccountDao; import com.cloud.utils.PropertiesUtil; @@ -100,6 +98,7 @@ import com.cloud.vm.VMInstanceVO; import com.cloud.vm.dao.NicDao; import com.cloud.vm.dao.UserVmDao; import com.cloud.vm.dao.VMInstanceDao; +import com.google.common.collect.ImmutableList; @Local(value = { ContrailManager.class}) public class ContrailManagerImpl extends ManagerBase implements ContrailManager { @@ -159,7 +158,7 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager private Timer _dbSyncTimer; private int _dbSyncInterval = DB_SYNC_INTERVAL_DEFAULT; private final String configuration = "contrail.properties"; - private ModelDatabase _database; + private final ModelDatabase _database; private ModelController _controller; ContrailManagerImpl() { @@ -194,7 +193,7 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager } private NetworkOffering locatePublicNetworkOffering(String offeringName, - String offeringDisplayText, Provider provider) { + String offeringDisplayText, Provider provider) { List offerList = _configService.listNetworkOfferings(TrafficType.Public, false); for (NetworkOffering offer: offerList) { if (offer.getName().equals(offeringName)) { @@ -229,7 +228,7 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager } private NetworkOffering locateNetworkOffering(String offeringName, - String offeringDisplayText, Provider provider) { + String offeringDisplayText, Provider provider) { List offerList = _configService.listNetworkOfferings(TrafficType.Guest, false); for (NetworkOffering offer : offerList) { if (offer.getName().equals(offeringName)) { @@ -248,8 +247,8 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager } ConfigurationManager configMgr = (ConfigurationManager)_configService; NetworkOfferingVO voffer = - configMgr.createNetworkOffering(offeringName, offeringDisplayText, TrafficType.Guest, null, false, Availability.Optional, null, serviceProviderMap, true, - Network.GuestType.Isolated, false, null, false, null, false, true, null, true, null, false); + configMgr.createNetworkOffering(offeringName, offeringDisplayText, TrafficType.Guest, null, false, Availability.Optional, null, serviceProviderMap, true, + Network.GuestType.Isolated, false, null, false, null, false, true, null, true, null, false); voffer.setState(NetworkOffering.State.Enabled); long id = voffer.getId(); @@ -300,6 +299,7 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager public boolean configure(String name, Map params) throws ConfigurationException { File configFile = PropertiesUtil.findConfigFile(configuration); + FileInputStream fileStream = null; try { String hostname = null; int port = 0; @@ -307,10 +307,12 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager return false; } else { final Properties configProps = new Properties(); - configProps.load(new FileInputStream(configFile)); + fileStream = new FileInputStream(configFile); + configProps.load(fileStream); + String value = configProps.getProperty("management.db_sync_interval"); if (value != null) { - _dbSyncInterval = Integer.valueOf(value); + _dbSyncInterval = Integer.parseInt(value); } hostname = configProps.getProperty("api.hostname"); String portStr = configProps.getProperty("api.port"); @@ -326,16 +328,18 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager s_logger.debug("Exception in configure: " + ex); ex.printStackTrace(); throw new ConfigurationException(); + } finally { + IOUtils.closeQuietly(fileStream); } _controller = new ModelController(this, _api, _vmDao, _networksDao, _nicDao, _vlanDao, _ipAddressDao); _routerOffering = locateNetworkOffering(routerOfferingName, routerOfferingDisplayText, - Provider.JuniperContrailRouter); + Provider.JuniperContrailRouter); _routerPublicOffering = locatePublicNetworkOffering(routerPublicOfferingName, routerPublicOfferingDisplayText, - Provider.JuniperContrailRouter); + Provider.JuniperContrailRouter); _vpcRouterOffering = locateNetworkOffering(vpcRouterOfferingName, vpcRouterOfferingDisplayText, - Provider.JuniperContrailVpcRouter); + Provider.JuniperContrailVpcRouter); _vpcOffering = locateVpcOffering(); _eventHandler.subscribe(); @@ -448,7 +452,7 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager DomainVO domain = _domainDao.findById(domainId); if (domain.getId() != Domain.ROOT_DOMAIN) { net.juniper.contrail.api.types.Domain vncDomain = - (net.juniper.contrail.api.types.Domain)_api.findById(net.juniper.contrail.api.types.Domain.class, domain.getUuid()); + (net.juniper.contrail.api.types.Domain)_api.findById(net.juniper.contrail.api.types.Domain.class, domain.getUuid()); return _api.findByName(net.juniper.contrail.api.types.Project.class, vncDomain, VNC_DEFAULT_PROJECT); } return null; @@ -481,8 +485,8 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager @Override public void findInfrastructureNetworks(PhysicalNetworkVO phys, List dbList) { final TrafficType[] ttypes = {TrafficType.Control, // maps to __link_local__ - TrafficType.Management, // maps to ip-fabric - TrafficType.Public, TrafficType.Storage // maps to ip-fabric + TrafficType.Management, // maps to ip-fabric + TrafficType.Public, TrafficType.Storage // maps to ip-fabric }; for (int i = 0; i < ttypes.length; i++) { @@ -528,7 +532,7 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager List net_list = _physicalNetworkDao.listByZone(network.getDataCenterId()); for (PhysicalNetworkVO phys : net_list) { if(_physProviderDao.findByServiceProvider(phys.getId(), Provider.JuniperContrailRouter.getName()) != null || - _physProviderDao.findByServiceProvider(phys.getId(), Provider.JuniperContrailVpcRouter.getName()) != null) { + _physProviderDao.findByServiceProvider(phys.getId(), Provider.JuniperContrailVpcRouter.getName()) != null) { return true; } } @@ -653,7 +657,7 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager for (Iterator iter = phys_list.iterator(); iter.hasNext();) { PhysicalNetworkVO phys = iter.next(); if (_physProviderDao.findByServiceProvider(phys.getId(), provider) != null || - _physProviderDao.findByServiceProvider(phys.getId(), vpcProvider) != null) { + _physProviderDao.findByServiceProvider(phys.getId(), vpcProvider) != null) { List infraNets = new ArrayList(); findInfrastructureNetworks(phys, infraNets); for (NetworkVO net : infraNets) { @@ -886,7 +890,7 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager VirtualNetworkModel vnModel = getDatabase().lookupVirtualNetwork(net.getUuid(), getCanonicalName(net), TrafficType.Public); if (vnModel == null) { vnModel = new VirtualNetworkModel(net, net.getUuid(), - getCanonicalName(net), net.getTrafficType()); + getCanonicalName(net), net.getTrafficType()); vnModel.setProperties(getModelController(), net); } try { diff --git a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/EventUtils.java b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/EventUtils.java index 29b58fb7d78..faeff1f5bd6 100644 --- a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/EventUtils.java +++ b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/EventUtils.java @@ -20,6 +20,8 @@ package org.apache.cloudstack.network.contrail.management; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; +import java.util.ArrayList; +import java.util.List; import org.apache.log4j.Logger; import org.springframework.beans.factory.NoSuchBeanDefinitionException; @@ -28,8 +30,11 @@ import org.springframework.stereotype.Component; import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.framework.messagebus.MessageBus; import org.apache.cloudstack.framework.messagebus.MessageBusBase; +import org.aopalliance.intercept.MethodInterceptor; +import org.aopalliance.intercept.MethodInvocation; import com.cloud.event.ActionEvent; +import com.cloud.event.ActionEvents; import com.cloud.event.Event; import com.cloud.event.EventCategory; import com.cloud.event.EventTypes; @@ -74,7 +79,7 @@ public class EventUtils { } - public static class EventInterceptor implements ComponentMethodInterceptor { + public static class EventInterceptor implements ComponentMethodInterceptor, MethodInterceptor { private static final Logger s_logger = Logger.getLogger(EventInterceptor.class); @@ -82,6 +87,55 @@ public class EventUtils { } + @Override + public Object invoke(MethodInvocation invocation) throws Throwable { + Method m = invocation.getMethod(); + Object target = invocation.getThis(); + + if ( getActionEvents(m).size() == 0 ) { + /* Look for annotation on impl class */ + m = target.getClass().getMethod(m.getName(), m.getParameterTypes()); + } + + Object interceptorData = null; + + boolean success = true; + try { + interceptorData = interceptStart(m, target); + + Object result = invocation.proceed(); + success = true; + + return result; + } finally { + if ( success ) { + interceptComplete(m, target, interceptorData); + } else { + interceptException(m, target, interceptorData); + } + } + } + + protected List getActionEvents(Method m) { + List result = new ArrayList(); + + ActionEvents events = m.getAnnotation(ActionEvents.class); + + if ( events != null ) { + for ( ActionEvent e : events.value() ) { + result.add(e); + } + } + + ActionEvent e = m.getAnnotation(ActionEvent.class); + + if ( e != null ) { + result.add(e); + } + + return result; + } + @Override public Object interceptStart(Method method, Object target) { return null; diff --git a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ServiceManagerImpl.java b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ServiceManagerImpl.java index 9860faf7f09..f34eaccbb06 100644 --- a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ServiceManagerImpl.java +++ b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ServiceManagerImpl.java @@ -18,8 +18,10 @@ package org.apache.cloudstack.network.contrail.management; import java.io.IOException; +import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; import javax.ejb.Local; @@ -33,7 +35,6 @@ import org.apache.cloudstack.network.contrail.api.response.ServiceInstanceRespon import org.apache.cloudstack.network.contrail.model.ServiceInstanceModel; import org.apache.cloudstack.network.contrail.model.VirtualMachineModel; import org.apache.cloudstack.network.contrail.model.VirtualNetworkModel; - import org.apache.log4j.Logger; import com.cloud.api.ApiDBUtils; @@ -101,13 +102,12 @@ public class ServiceManagerImpl implements ServiceManager { long id = _vmDao.getNextInSequence(Long.class, "id"); DataCenterDeployment plan = new DataCenterDeployment(zone.getId()); - - LinkedHashMap networks = new LinkedHashMap(); - NetworkVO linklocal = (NetworkVO)_networkModel.getSystemNetworkByZoneAndTrafficType(zone.getId(), TrafficType.Management); - networks.put(linklocal, null); - networks.put((NetworkVO)left, null); - networks.put((NetworkVO)right, null); - + LinkedHashMap> networks = new LinkedHashMap>(); + NetworkVO linklocal = (NetworkVO) _networkModel.getSystemNetworkByZoneAndTrafficType(zone.getId(), + TrafficType.Management); + networks.put(linklocal, new ArrayList()); + networks.put((NetworkVO)left, new ArrayList()); + networks.put((NetworkVO)right, new ArrayList()); String instanceName = VirtualMachineName.getVmName(id, owner.getId(), "SRV"); ServiceVirtualMachine svm = new ServiceVirtualMachine(id, instanceName, name, template.getId(), serviceOffering.getId(), template.getHypervisorType(), template.getGuestOSId(), diff --git a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/ModelObject.java b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/ModelObject.java index 1b048ed440b..c751d75b63c 100644 --- a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/ModelObject.java +++ b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/ModelObject.java @@ -39,8 +39,16 @@ import com.cloud.exception.InternalErrorException; * The update method pushes updates to the contrail API server. */ public interface ModelObject { + public static class ModelReference implements Comparable, Serializable { - WeakReference reference; + + private static final long serialVersionUID = -2019113974956703526L; + + /* + * WeakReference class is not serializable by definition. So, we cannot enforce its serialization unless we write the implementation of + * methods writeObject() and readObject(). Since the code was already not serializing it, it's been marked as transient. + */ + transient WeakReference reference; ModelReference(ModelObject obj) { reference = new WeakReference(obj); diff --git a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/ServiceInstanceModel.java b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/ServiceInstanceModel.java index 0ce22adc421..e79053ca4f3 100644 --- a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/ServiceInstanceModel.java +++ b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/ServiceInstanceModel.java @@ -30,11 +30,10 @@ import net.juniper.contrail.api.types.ServiceInstanceType; import net.juniper.contrail.api.types.ServiceTemplate; import net.juniper.contrail.api.types.ServiceTemplateType; +import org.apache.cloudstack.network.contrail.management.ContrailManager; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; -import org.apache.cloudstack.network.contrail.management.ContrailManager; - import com.cloud.offering.ServiceOffering; import com.cloud.template.VirtualMachineTemplate; import com.cloud.utils.exception.CloudRuntimeException; @@ -72,8 +71,14 @@ public class ServiceInstanceModel extends ModelObjectBase { String parent_name; if (project != null) { parent_name = StringUtils.join(project.getQualifiedName(), ':'); + + _projectId = project.getUuid(); } else { parent_name = ContrailManager.VNC_ROOT_DOMAIN + ":" + ContrailManager.VNC_DEFAULT_PROJECT; + + //In the original code, if the projectId is null, it will simply throw NPE on the last line (nr. 90) of the method where the projectId.getUuid() is called. + //This was added as a way to avoid NPE. Should we perhaps throw a CloudRuntimeException if the project object is null? + _projectId = UUID.randomUUID().toString(); } _fqName = parent_name + ":" + name; @@ -86,8 +91,6 @@ public class ServiceInstanceModel extends ModelObjectBase { _templateName = template.getName(); _templateId = template.getUuid(); _templateUrl = template.getUrl(); - - _projectId = project.getUuid(); } /** @@ -170,16 +173,16 @@ public class ServiceInstanceModel extends ModelObjectBase { } private void clearServicePolicy(ModelController controller) { - _left.addToNetworkPolicy(null); - _right.addToNetworkPolicy(null); - try { + _left.addToNetworkPolicy(null); + _right.addToNetworkPolicy(null); + try { controller.getManager().getDatabase().getNetworkPolicys().remove(_policy); _policy.delete(controller.getManager().getModelController()); _policy = null; } catch (Exception e) { s_logger.error(e); } - try { + try { _left.update(controller.getManager().getModelController()); _right.update(controller.getManager().getModelController()); } catch (Exception ex) { @@ -194,7 +197,7 @@ public class ServiceInstanceModel extends ModelObjectBase { _right.addToNetworkPolicy(policyModel); List siList = new ArrayList(); siList.add(StringUtils.join(_serviceInstance.getQualifiedName(), ':')); - try { + try { policyModel.build(controller.getManager().getModelController(), _leftName, _rightName, "in-network", siList, "pass"); } catch (Exception e) { s_logger.error(e); diff --git a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/VirtualMachineModel.java b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/VirtualMachineModel.java index 4d0218c8b4a..4b64c808e88 100644 --- a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/VirtualMachineModel.java +++ b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/VirtualMachineModel.java @@ -18,6 +18,7 @@ package org.apache.cloudstack.network.contrail.model; import java.io.IOException; +import java.text.MessageFormat; import java.util.List; import java.util.Map; import java.util.TreeSet; @@ -28,13 +29,14 @@ import net.juniper.contrail.api.types.ServiceInstance; import net.juniper.contrail.api.types.VirtualMachine; import org.apache.cloudstack.network.contrail.management.ContrailManager; -import org.apache.log4j.Logger; import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; import com.cloud.exception.InternalErrorException; import com.cloud.network.dao.NetworkDao; import com.cloud.network.dao.NetworkVO; import com.cloud.uservm.UserVm; +import com.cloud.utils.UuidUtils; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.vm.NicVO; import com.cloud.vm.VMInstanceVO; @@ -83,10 +85,26 @@ public class VirtualMachineModel extends ModelObjectBase { final Gson json = new Gson(); Map kvmap = json.fromJson(userVm.getUserData(), new TypeToken>() { }.getType()); - String data = kvmap.get("service-instance"); - if (data != null) { - /* link the object with the service instance */ - buildServiceInstance(controller, data); + //Renamed "data" to "serviceUuid" because it's clearer. + String serviceUuid = kvmap.get("service-instance"); + if (serviceUuid != null) { + /* + * UUID.fromString() does not validate an UUID properly. I tried, for example, informing less digits in the UUID, where 12 were expected, + * and the UUID.fromstring() did not thrown the exception as expected. However, if you try UUID.fromString("aaa") it breaks, but if you try + * UUID.fromString("3dd4fa6e-2899-4429-b818-d34fe8df5") it doesn't (the last portion should have 12, instead of 9 digits). + * + * In other fix I added the validate UUID method to the UuidUtil classes. + */ + if (UuidUtils.validateUUID(serviceUuid)) { + /* link the object with the service instance */ + buildServiceInstance(controller, serviceUuid); + } else { + // Throw a CloudRuntimeException in case the UUID is not valid. + String message = "Invalid UUID ({0}) given for the service-instance for VM {1}."; + message = MessageFormat.format(message, instance.getId(), serviceUuid); + s_logger.warn(message); + throw new CloudRuntimeException(message); + } } } } @@ -109,22 +127,20 @@ public class VirtualMachineModel extends ModelObjectBase { s_logger.warn("service-instance read", ex); throw new CloudRuntimeException("Unable to read service-instance object", ex); } + ServiceInstanceModel siModel; - if (siObj == null) { + String fqn = StringUtils.join(siObj.getQualifiedName(), ':'); + siModel = manager.getDatabase().lookupServiceInstance(fqn); + if (siModel == null) { siModel = new ServiceInstanceModel(serviceUuid); siModel.build(controller, siObj); manager.getDatabase().getServiceInstances().add(siModel); - } else { - String fqn = StringUtils.join(siObj.getQualifiedName(), ':'); - siModel = manager.getDatabase().lookupServiceInstance(fqn); - if (siModel == null) { - if (siObj == null) { - siModel = new ServiceInstanceModel(serviceUuid); - siModel.build(controller, siObj); - manager.getDatabase().getServiceInstances().add(siModel); - } - } } + /* + * The code that was under the ELSE was never executed and due to that has been removed. + * Also, in the case siObj was null, it was going pass it as parameter to the build() method in the + * siModel object. + */ _serviceModel = siModel; } @@ -344,26 +360,26 @@ public class VirtualMachineModel extends ModelObjectBase { @Override public boolean verify(ModelController controller) { assert _initialized : "initialized is false"; - assert _uuid != null : "uuid is not set"; + assert _uuid != null : "uuid is not set"; - ApiConnector api = controller.getApiAccessor(); + ApiConnector api = controller.getApiAccessor(); - try { - _vm = (VirtualMachine) api.findById(VirtualMachine.class, _uuid); - } catch (IOException e) { - s_logger.error("virtual-machine verify", e); - } + try { + _vm = (VirtualMachine) api.findById(VirtualMachine.class, _uuid); + } catch (IOException e) { + s_logger.error("virtual-machine verify", e); + } - if (_vm == null) { + if (_vm == null) { + return false; + } + + for (ModelObject successor: successors()) { + if (!successor.verify(controller)) { return false; } - - for (ModelObject successor: successors()) { - if (!successor.verify(controller)) { - return false; - } - } - return true; + } + return true; } @Override diff --git a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/VirtualNetworkModel.java b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/VirtualNetworkModel.java index b0505b17db7..7563714528b 100644 --- a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/VirtualNetworkModel.java +++ b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/model/VirtualNetworkModel.java @@ -32,9 +32,8 @@ import net.juniper.contrail.api.types.VirtualNetwork; import net.juniper.contrail.api.types.VirtualNetworkPolicyType; import net.juniper.contrail.api.types.VnSubnetsType; -import org.apache.log4j.Logger; - import org.apache.cloudstack.network.contrail.management.ContrailManager; +import org.apache.log4j.Logger; import com.cloud.dc.VlanVO; import com.cloud.dc.dao.VlanDao; @@ -49,7 +48,7 @@ public class VirtualNetworkModel extends ModelObjectBase { private String _uuid; private long _id; - private TrafficType _trafficType; + private final TrafficType _trafficType; /* * current state for object properties @@ -362,92 +361,92 @@ public class VirtualNetworkModel extends ModelObjectBase { @Override public boolean verify(ModelController controller) { assert _initialized : "initialized is false"; - assert _uuid != null : "uuid is not set"; + assert _uuid != null : "uuid is not set"; - ApiConnector api = controller.getApiAccessor(); - VlanDao vlanDao = controller.getVlanDao(); + ApiConnector api = controller.getApiAccessor(); + VlanDao vlanDao = controller.getVlanDao(); - try { - _vn = (VirtualNetwork)api.findById(VirtualNetwork.class, _uuid); - } catch (IOException e) { - e.printStackTrace(); + try { + _vn = (VirtualNetwork)api.findById(VirtualNetwork.class, _uuid); + } catch (IOException e) { + e.printStackTrace(); + } + + if (_vn == null) { + return false; + } + + if (!isDynamicNetwork()) { + return true; + } + + List dbSubnets = new ArrayList(); + if (_trafficType == TrafficType.Public) { + List vlan_list = vlanDao.listVlansByNetworkId(_id); + for (VlanVO vlan : vlan_list) { + String cidr = NetUtils.ipAndNetMaskToCidr(vlan.getVlanGateway(), vlan.getVlanNetmask()); + dbSubnets.add(vlan.getVlanGateway() + cidr); } + } else { + dbSubnets.add(_gateway + _prefix); + } - if (_vn == null) { - return false; - } + List> ipamRefs = _vn.getNetworkIpam(); + List vncSubnets = new ArrayList(); - if (!isDynamicNetwork()) { - return true; - } + if (ipamRefs == null && !dbSubnets.isEmpty()) { + return false; + } - List dbSubnets = new ArrayList(); - if (_trafficType == TrafficType.Public) { - List vlan_list = vlanDao.listVlansByNetworkId(_id); - for (VlanVO vlan : vlan_list) { - String cidr = NetUtils.ipAndNetMaskToCidr(vlan.getVlanGateway(), vlan.getVlanNetmask()); - dbSubnets.add(vlan.getVlanGateway() + cidr); - } - } else { - dbSubnets.add(this._gateway + this._prefix); - } - - List> ipamRefs = _vn.getNetworkIpam(); - List vncSubnets = new ArrayList(); - - if (ipamRefs == null && !dbSubnets.isEmpty()) { - return false; - } - - if (ipamRefs != null) { - for (ObjectReference ref : ipamRefs) { - VnSubnetsType vnSubnetType = ref.getAttr(); - if (vnSubnetType != null) { - List subnets = vnSubnetType.getIpamSubnets(); - if (subnets != null && !subnets.isEmpty()) { - VnSubnetsType.IpamSubnetType ipamSubnet = subnets.get(0); - vncSubnets.add(ipamSubnet.getDefaultGateway() + ipamSubnet.getSubnet().getIpPrefix() + "/" + ipamSubnet.getSubnet().getIpPrefixLen()); - } + if (ipamRefs != null) { + for (ObjectReference ref : ipamRefs) { + VnSubnetsType vnSubnetType = ref.getAttr(); + if (vnSubnetType != null) { + List subnets = vnSubnetType.getIpamSubnets(); + if (subnets != null && !subnets.isEmpty()) { + VnSubnetsType.IpamSubnetType ipamSubnet = subnets.get(0); + vncSubnets.add(ipamSubnet.getDefaultGateway() + ipamSubnet.getSubnet().getIpPrefix() + "/" + ipamSubnet.getSubnet().getIpPrefixLen()); } } } - // unordered, no duplicates hence perform negation operation as set - Set diff = new HashSet(dbSubnets); - diff.removeAll(vncSubnets); + } + // unordered, no duplicates hence perform negation operation as set + Set diff = new HashSet(dbSubnets); + diff.removeAll(vncSubnets); - if (!diff.isEmpty()) { - s_logger.debug("Subnets changed, network: " + this._name + "; db: " + dbSubnets + ", vnc: " + vncSubnets + ", diff: " + diff); + if (!diff.isEmpty()) { + s_logger.debug("Subnets changed, network: " + _name + "; db: " + dbSubnets + ", vnc: " + vncSubnets + ", diff: " + diff); + return false; + } + + List> policyRefs = _vn.getNetworkPolicy(); + if ((policyRefs == null || policyRefs.isEmpty()) && _policyModel != null) { + return false; + } + + if ((policyRefs != null && !policyRefs.isEmpty()) && _policyModel == null) { + return false; + } + + if (policyRefs != null && !policyRefs.isEmpty() && _policyModel != null) { + ObjectReference ref = policyRefs.get(0); + if (!ref.getUuid().equals(_policyModel.getUuid())) { return false; } + } - List> policyRefs = _vn.getNetworkPolicy(); - if ((policyRefs == null || policyRefs.isEmpty()) && _policyModel != null) { + for (ModelObject successor : successors()) { + if (!successor.verify(controller)) { return false; } - - if ((policyRefs != null && !policyRefs.isEmpty()) && _policyModel == null) { - return false; - } - - if (policyRefs != null && !policyRefs.isEmpty() && _policyModel != null) { - ObjectReference ref = policyRefs.get(0); - if (!ref.getUuid().equals(_policyModel.getUuid())) { - return false; - } - } - - for (ModelObject successor : successors()) { - if (!successor.verify(controller)) { - return false; - } - } - return true; + } + return true; } @Override public boolean compare(ModelController controller, ModelObject o) { VirtualNetworkModel latest; - assert this._vn != null : "vnc virtual network current is not initialized"; + assert _vn != null : "vnc virtual network current is not initialized"; try { latest = (VirtualNetworkModel)o; @@ -464,7 +463,7 @@ public class VirtualNetworkModel extends ModelObjectBase { } assert latest._vn != null : "vnc virtual network new is not initialized"; - List> currentIpamRefs = this._vn.getNetworkIpam(); + List> currentIpamRefs = _vn.getNetworkIpam(); List> newIpamRefs = latest._vn.getNetworkIpam(); List currentSubnets = new ArrayList(); List newSubnets = new ArrayList(); @@ -503,42 +502,60 @@ public class VirtualNetworkModel extends ModelObjectBase { diff.removeAll(newSubnets); if (!diff.isEmpty()) { - s_logger.debug("Subnets differ, network: " + this._name + "; db: " + currentSubnets + ", vnc: " + newSubnets + ", diff: " + diff); + s_logger.debug("Subnets differ, network: " + _name + "; db: " + currentSubnets + ", vnc: " + newSubnets + ", diff: " + diff); return false; } - List> currentPolicyRefs = this._vn.getNetworkPolicy(); + List> currentPolicyRefs = _vn.getNetworkPolicy(); List> latestPolicyRefs = latest._vn.getNetworkPolicy(); if (currentPolicyRefs == null && latestPolicyRefs == null) { return true; } - if ((currentPolicyRefs == null && latestPolicyRefs != null) || - (currentPolicyRefs != null && latestPolicyRefs == null) || - (currentPolicyRefs.size() != latestPolicyRefs.size())) { + if ((currentPolicyRefs == null && latestPolicyRefs != null) || (currentPolicyRefs != null + && latestPolicyRefs == null)) { return false; } - if (currentPolicyRefs.isEmpty() && latestPolicyRefs.isEmpty()) { + if ((currentPolicyRefs != null && latestPolicyRefs != null) && (currentPolicyRefs.size() != latestPolicyRefs.size())) { + return false; + } + + if ((currentPolicyRefs != null && latestPolicyRefs != null) && currentPolicyRefs.isEmpty() + && latestPolicyRefs.isEmpty()) { return true; } //both must be non empty lists - ObjectReference ref1 = currentPolicyRefs.get(0); - ObjectReference ref2 = latestPolicyRefs.get(0); + ObjectReference ref1 = null; + + if (currentPolicyRefs != null) { + ref1 = currentPolicyRefs.get(0); + } + + ObjectReference ref2 = null; + + if (latestPolicyRefs != null) { + ref2 = latestPolicyRefs.get(0); + } + + if (ref1 == null && ref2 == null) { + return true; + } if ((ref1 != null && ref2 == null) || (ref1 == null && ref2 != null)) { return false; } - if ((ref1.getUuid() != null && ref2.getUuid() == null) || (ref1.getUuid() == null && ref2.getUuid() != null)) { + if ((ref1 != null && ref2 != null) && ((ref1.getUuid() != null && ref2.getUuid() == null) + || (ref1.getUuid() == null && ref2.getUuid() != null))) { return false; } - if (ref1.getUuid() == null && ref2.getUuid() == null) { + if ((ref1 != null && ref2 != null) && (ref1.getUuid() == null && ref2.getUuid() == null)) { return true; } - if (!ref1.getUuid().equals(ref2.getUuid())) { + if ((ref1 != null && ref2 != null) && !ref1.getUuid().equals(ref2.getUuid())) { return false; } return true; diff --git a/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/model/VirtualMachineModelTest.java b/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/model/VirtualMachineModelTest.java index f85beb62fe6..1e3944a4f26 100644 --- a/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/model/VirtualMachineModelTest.java +++ b/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/model/VirtualMachineModelTest.java @@ -28,11 +28,10 @@ import junit.framework.TestCase; import net.juniper.contrail.api.ApiConnector; import net.juniper.contrail.api.ApiConnectorMock; -import org.apache.log4j.Logger; -import org.junit.Test; - import org.apache.cloudstack.network.contrail.management.ContrailManagerImpl; import org.apache.cloudstack.network.contrail.management.ModelDatabase; +import org.apache.log4j.Logger; +import org.junit.Test; import com.cloud.network.Network; import com.cloud.network.dao.NetworkVO; @@ -118,7 +117,5 @@ public class VirtualMachineModelTest extends TestCase { //verify assertTrue(vmModel.verify(controller)); - } - -} +} \ No newline at end of file diff --git a/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/model/VirtualNetworkModelTest.java b/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/model/VirtualNetworkModelTest.java index b1b5ae1ebff..3a1e147d8c5 100644 --- a/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/model/VirtualNetworkModelTest.java +++ b/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/model/VirtualNetworkModelTest.java @@ -21,26 +21,138 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import java.util.UUID; import junit.framework.TestCase; import net.juniper.contrail.api.ApiConnector; import net.juniper.contrail.api.ApiConnectorMock; - -import org.apache.log4j.Logger; -import org.junit.Test; +import net.juniper.contrail.api.ObjectReference; +import net.juniper.contrail.api.types.VirtualNetwork; +import net.juniper.contrail.api.types.VirtualNetworkPolicyType; import org.apache.cloudstack.network.contrail.management.ContrailManager; import org.apache.cloudstack.network.contrail.management.ContrailManagerImpl; import org.apache.cloudstack.network.contrail.management.ModelDatabase; +import org.apache.log4j.Logger; +import org.junit.Before; +import org.junit.Test; +import com.cloud.dc.dao.VlanDao; import com.cloud.network.Network.State; import com.cloud.network.Networks.TrafficType; import com.cloud.network.dao.NetworkVO; public class VirtualNetworkModelTest extends TestCase { + private static final Logger s_logger = Logger.getLogger(VirtualNetworkModelTest.class); + private ModelController controller; + + private VirtualNetworkModel vnModel; + private VirtualNetworkModel vnModel1; + private VirtualNetworkModel vnModel2; + private VirtualNetworkModel vnModel3; + + @Override + @Before + public void setUp() throws IOException { + //Network UUIDs + String uuid = UUID.randomUUID().toString(); + String uuid1 = UUID.randomUUID().toString(); + String uuid2 = UUID.randomUUID().toString(); + String uuid3 = UUID.randomUUID().toString(); + + //ContrailManager + ContrailManagerImpl contrailMgr = mock(ContrailManagerImpl.class); + + controller = mock(ModelController.class); + VlanDao vlanDao = mock(VlanDao.class); + + ApiConnector api = mock(ApiConnectorMock.class); + + //Mock classes/methods + when(controller.getManager()).thenReturn(contrailMgr); + when(controller.getApiAccessor()).thenReturn(api); + when(controller.getVlanDao()).thenReturn(vlanDao); + + //Policy References used by vnModel1 + List> policyRefs1 = new ArrayList>(); + ObjectReference objectReference1 = new ObjectReference(); + policyRefs1.add(objectReference1); + + //Policy References used by vnModel2 + List> policyRefs2 = new ArrayList>(); + ObjectReference objectReference2 = new ObjectReference(); + policyRefs2.add(objectReference2); + + //Policy References used by vnModel3 + List> policyRefs3 = new ArrayList>(); + ObjectReference objectReference3 = new ObjectReference(); + objectReference3.setReference(Arrays.asList(""), null, null, UUID.randomUUID().toString()); + + policyRefs3.add(objectReference3); + + //Network to be compared with + VirtualNetwork vn = mock(VirtualNetwork.class); + when(api.findById(VirtualNetwork.class, uuid)).thenReturn(vn); + + //Network to be compared with + VirtualNetwork vn1 = mock(VirtualNetwork.class); + when(api.findById(VirtualNetwork.class, uuid1)).thenReturn(vn1); + when(vn1.getNetworkPolicy()).thenReturn(policyRefs1); + + //Network to be compared to + VirtualNetwork vn2 = mock(VirtualNetwork.class); + when(api.findById(VirtualNetwork.class, uuid2)).thenReturn(vn2); + when(vn2.getNetworkPolicy()).thenReturn(policyRefs2); + + //Network to be compared to + VirtualNetwork vn3 = mock(VirtualNetwork.class); + when(api.findById(VirtualNetwork.class, uuid3)).thenReturn(vn3); + when(vn3.getNetworkPolicy()).thenReturn(policyRefs3); + + //Virtual-Network 1 + NetworkVO network1 = mock(NetworkVO.class); + when(network1.getName()).thenReturn("testnetwork"); + when(network1.getState()).thenReturn(State.Allocated); + when(network1.getGateway()).thenReturn("10.1.1.1"); + when(network1.getCidr()).thenReturn("10.1.1.0/24"); + when(network1.getPhysicalNetworkId()).thenReturn(42L); + when(network1.getDomainId()).thenReturn(10L); + when(network1.getAccountId()).thenReturn(42L); + + //Virtual-Network 2 + NetworkVO network2 = mock(NetworkVO.class); + when(network2.getName()).thenReturn("Testnetwork"); + when(network2.getState()).thenReturn(State.Allocated); + when(network2.getGateway()).thenReturn("10.1.1.1"); + when(network2.getCidr()).thenReturn("10.1.1.0/24"); + when(network2.getPhysicalNetworkId()).thenReturn(42L); + when(network2.getDomainId()).thenReturn(10L); + when(network2.getAccountId()).thenReturn(42L); + + //Virtual-Network 3 + NetworkVO network3 = mock(NetworkVO.class); + when(network3.getName()).thenReturn("Testnetwork"); + when(network3.getState()).thenReturn(State.Allocated); + when(network3.getGateway()).thenReturn("10.1.1.1"); + when(network3.getCidr()).thenReturn("10.1.1.0/24"); + when(network3.getPhysicalNetworkId()).thenReturn(42L); + when(network3.getDomainId()).thenReturn(10L); + when(network3.getAccountId()).thenReturn(42L); + + when(contrailMgr.getCanonicalName(network1)).thenReturn("testnetwork"); + when(contrailMgr.getProjectId(network1.getDomainId(), network1.getAccountId())).thenReturn("testProjectId"); + + vnModel = new VirtualNetworkModel(network1, uuid, "testnetwork", TrafficType.Guest); + vnModel1 = new VirtualNetworkModel(network1, uuid1, "testnetwork", TrafficType.Guest); + vnModel2 = new VirtualNetworkModel(network2, uuid2, "testnetwork", TrafficType.Guest); + vnModel3 = new VirtualNetworkModel(network3, uuid3, "testnetwork", TrafficType.Guest); + } + @Test public void testDBLookup() { ModelDatabase db = new ModelDatabase(); @@ -99,4 +211,27 @@ public class VirtualNetworkModelTest extends TestCase { assertTrue(vnModel.verify(controller)); } -} + @Test + public void testCompareDifferentVirtualNetwork() throws IOException { + //This one returns false because one network has Policy References + vnModel.read(controller); + + assertFalse(vnModel.compare(controller, vnModel1)); + } + + @Test + public void testCompareSameVirtualNetwork() throws IOException { + //This one returns true because both networks have the same Policy References + vnModel1.read(controller); + + assertTrue(vnModel1.compare(controller, vnModel2)); + } + + @Test + public void testCompareDifferentDeeperVirtualNetwork() throws IOException { + //This one returns false because one network has Policy References + vnModel2.read(controller); + + assertFalse(vnModel2.compare(controller, vnModel3)); + } +} \ No newline at end of file diff --git a/plugins/network-elements/juniper-contrail/test/resources/log4j.properties b/plugins/network-elements/juniper-contrail/test/resources/log4j.properties index 138a9610873..2e724f4e902 100644 --- a/plugins/network-elements/juniper-contrail/test/resources/log4j.properties +++ b/plugins/network-elements/juniper-contrail/test/resources/log4j.properties @@ -25,7 +25,7 @@ log4j.appender.rolling=org.apache.log4j.DailyRollingFileAppender log4j.appender.rolling.layout=org.apache.log4j.PatternLayout log4j.appender.rolling.layout.ConversionPattern=%d %-5p [%c{3}] (%t:%x) %m%n log4j.appender.rolling.file.threshold=DEBUG -log4j.appender.rolling.File=./logs/testclient.log +log4j.appender.rolling.File=./target/logs/testclient.log log4j.appender.rolling.DatePattern='.'yyy-MM-dd log4j.appender.rolling.file.append=false log4j.category.org.apache=INFO, rolling, stdout diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/AddExternalFirewallCmd.java b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/AddExternalFirewallCmd.java index 96e9bc00d7b..89fc17d8b3c 100644 --- a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/AddExternalFirewallCmd.java +++ b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/AddExternalFirewallCmd.java @@ -35,7 +35,8 @@ import com.cloud.network.element.JuniperSRXFirewallElementService; import com.cloud.user.Account; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "addExternalFirewall", description = "Adds an external firewall appliance", responseObject = ExternalFirewallResponse.class) +@APICommand(name = "addExternalFirewall", description = "Adds an external firewall appliance", responseObject = ExternalFirewallResponse.class, + requestHasSensitiveInfo = true, responseHasSensitiveInfo = false) public class AddExternalFirewallCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(AddExternalFirewallCmd.class.getName()); private static final String s_name = "addexternalfirewallresponse"; diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/AddSrxFirewallCmd.java b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/AddSrxFirewallCmd.java index 53e7bfc037f..59bf17cc7f1 100644 --- a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/AddSrxFirewallCmd.java +++ b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/AddSrxFirewallCmd.java @@ -40,7 +40,8 @@ import com.cloud.network.dao.ExternalFirewallDeviceVO; import com.cloud.network.element.JuniperSRXFirewallElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "addSrxFirewall", responseObject = SrxFirewallResponse.class, description = "Adds a SRX firewall device") +@APICommand(name = "addSrxFirewall", responseObject = SrxFirewallResponse.class, description = "Adds a SRX firewall device", + requestHasSensitiveInfo = true, responseHasSensitiveInfo = false) public class AddSrxFirewallCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(AddSrxFirewallCmd.class.getName()); private static final String s_name = "addsrxfirewallresponse"; diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ConfigureSrxFirewallCmd.java b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ConfigureSrxFirewallCmd.java index 303e98785af..482968677a0 100644 --- a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ConfigureSrxFirewallCmd.java +++ b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ConfigureSrxFirewallCmd.java @@ -39,7 +39,8 @@ import com.cloud.network.dao.ExternalFirewallDeviceVO; import com.cloud.network.element.JuniperSRXFirewallElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "configureSrxFirewall", responseObject = SrxFirewallResponse.class, description = "Configures a SRX firewall device") +@APICommand(name = "configureSrxFirewall", responseObject = SrxFirewallResponse.class, description = "Configures a SRX firewall device", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ConfigureSrxFirewallCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ConfigureSrxFirewallCmd.class.getName()); diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/DeleteExternalFirewallCmd.java b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/DeleteExternalFirewallCmd.java index b24aa05dfa1..358d2e47d52 100644 --- a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/DeleteExternalFirewallCmd.java +++ b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/DeleteExternalFirewallCmd.java @@ -33,7 +33,8 @@ import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.element.JuniperSRXFirewallElementService; import com.cloud.user.Account; -@APICommand(name = "deleteExternalFirewall", description = "Deletes an external firewall appliance.", responseObject = SuccessResponse.class) +@APICommand(name = "deleteExternalFirewall", description = "Deletes an external firewall appliance.", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteExternalFirewallCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeleteExternalFirewallCmd.class.getName()); private static final String s_name = "deleteexternalfirewallresponse"; diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/DeleteSrxFirewallCmd.java b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/DeleteSrxFirewallCmd.java index 75aadc24955..3fa0278b01d 100644 --- a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/DeleteSrxFirewallCmd.java +++ b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/DeleteSrxFirewallCmd.java @@ -39,7 +39,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.element.JuniperSRXFirewallElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "deleteSrxFirewall", responseObject = SuccessResponse.class, description = " delete a SRX firewall device") +@APICommand(name = "deleteSrxFirewall", responseObject = SuccessResponse.class, description = " delete a SRX firewall device", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteSrxFirewallCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteSrxFirewallCmd.class.getName()); private static final String s_name = "deletesrxfirewallresponse"; diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListExternalFirewallsCmd.java b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListExternalFirewallsCmd.java index f87574e47a8..9fd7b4cbf9f 100644 --- a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListExternalFirewallsCmd.java +++ b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListExternalFirewallsCmd.java @@ -35,7 +35,8 @@ import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.host.Host; import com.cloud.network.element.JuniperSRXFirewallElementService; -@APICommand(name = "listExternalFirewalls", description = "List external firewall appliances.", responseObject = ExternalFirewallResponse.class) +@APICommand(name = "listExternalFirewalls", description = "List external firewall appliances.", responseObject = ExternalFirewallResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListExternalFirewallsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListServiceOfferingsCmd.class.getName()); private static final String s_name = "listexternalfirewallsresponse"; diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListSrxFirewallNetworksCmd.java b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListSrxFirewallNetworksCmd.java index 017ca6c5b3d..574985bafb2 100644 --- a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListSrxFirewallNetworksCmd.java +++ b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListSrxFirewallNetworksCmd.java @@ -43,7 +43,8 @@ import com.cloud.network.Network; import com.cloud.network.element.JuniperSRXFirewallElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "listSrxFirewallNetworks", responseObject = NetworkResponse.class, description = "lists network that are using SRX firewall device") +@APICommand(name = "listSrxFirewallNetworks", responseObject = NetworkResponse.class, description = "lists network that are using SRX firewall device", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListSrxFirewallNetworksCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListSrxFirewallNetworksCmd.class.getName()); diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListSrxFirewallsCmd.java b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListSrxFirewallsCmd.java index e8cdcd5f2ca..244da1bb632 100644 --- a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListSrxFirewallsCmd.java +++ b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListSrxFirewallsCmd.java @@ -42,7 +42,8 @@ import com.cloud.network.dao.ExternalFirewallDeviceVO; import com.cloud.network.element.JuniperSRXFirewallElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "listSrxFirewalls", responseObject = SrxFirewallResponse.class, description = "lists SRX firewall devices in a physical network") +@APICommand(name = "listSrxFirewalls", responseObject = SrxFirewallResponse.class, description = "lists SRX firewall devices in a physical network", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListSrxFirewallsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListSrxFirewallsCmd.class.getName()); diff --git a/plugins/network-elements/netscaler/src/com/cloud/api/commands/AddNetscalerLoadBalancerCmd.java b/plugins/network-elements/netscaler/src/com/cloud/api/commands/AddNetscalerLoadBalancerCmd.java index b744fffdcb1..2a74806fe4b 100644 --- a/plugins/network-elements/netscaler/src/com/cloud/api/commands/AddNetscalerLoadBalancerCmd.java +++ b/plugins/network-elements/netscaler/src/com/cloud/api/commands/AddNetscalerLoadBalancerCmd.java @@ -39,7 +39,8 @@ import com.cloud.network.dao.ExternalLoadBalancerDeviceVO; import com.cloud.network.element.NetscalerLoadBalancerElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "addNetscalerLoadBalancer", responseObject = NetscalerLoadBalancerResponse.class, description = "Adds a netscaler load balancer device") +@APICommand(name = "addNetscalerLoadBalancer", responseObject = NetscalerLoadBalancerResponse.class, description = "Adds a netscaler load balancer device", + requestHasSensitiveInfo = true, responseHasSensitiveInfo = false) public class AddNetscalerLoadBalancerCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(AddNetscalerLoadBalancerCmd.class.getName()); diff --git a/plugins/network-elements/netscaler/src/com/cloud/api/commands/ConfigureNetscalerLoadBalancerCmd.java b/plugins/network-elements/netscaler/src/com/cloud/api/commands/ConfigureNetscalerLoadBalancerCmd.java index f8bfd744f4e..9a25f3bf6a8 100644 --- a/plugins/network-elements/netscaler/src/com/cloud/api/commands/ConfigureNetscalerLoadBalancerCmd.java +++ b/plugins/network-elements/netscaler/src/com/cloud/api/commands/ConfigureNetscalerLoadBalancerCmd.java @@ -40,7 +40,8 @@ import com.cloud.network.dao.ExternalLoadBalancerDeviceVO; import com.cloud.network.element.NetscalerLoadBalancerElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "configureNetscalerLoadBalancer", responseObject = NetscalerLoadBalancerResponse.class, description = "configures a netscaler load balancer device") +@APICommand(name = "configureNetscalerLoadBalancer", responseObject = NetscalerLoadBalancerResponse.class, description = "configures a netscaler load balancer device", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ConfigureNetscalerLoadBalancerCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ConfigureNetscalerLoadBalancerCmd.class.getName()); diff --git a/plugins/network-elements/netscaler/src/com/cloud/api/commands/DeleteNetscalerLoadBalancerCmd.java b/plugins/network-elements/netscaler/src/com/cloud/api/commands/DeleteNetscalerLoadBalancerCmd.java index f0f6747c4ac..1baa7b05d54 100644 --- a/plugins/network-elements/netscaler/src/com/cloud/api/commands/DeleteNetscalerLoadBalancerCmd.java +++ b/plugins/network-elements/netscaler/src/com/cloud/api/commands/DeleteNetscalerLoadBalancerCmd.java @@ -38,7 +38,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.element.NetscalerLoadBalancerElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "deleteNetscalerLoadBalancer", responseObject = SuccessResponse.class, description = " delete a netscaler load balancer device") +@APICommand(name = "deleteNetscalerLoadBalancer", responseObject = SuccessResponse.class, description = " delete a netscaler load balancer device", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteNetscalerLoadBalancerCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteNetscalerLoadBalancerCmd.class.getName()); diff --git a/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancerNetworksCmd.java b/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancerNetworksCmd.java index 44bdb748d6e..a818abc8ea6 100644 --- a/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancerNetworksCmd.java +++ b/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancerNetworksCmd.java @@ -43,7 +43,8 @@ import com.cloud.utils.exception.CloudRuntimeException; @APICommand(name = "listNetscalerLoadBalancerNetworks", responseObject = NetworkResponse.class, - description = "lists network that are using a netscaler load balancer device") + description = "lists network that are using a netscaler load balancer device", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListNetscalerLoadBalancerNetworksCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListNetscalerLoadBalancerNetworksCmd.class.getName()); diff --git a/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancersCmd.java b/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancersCmd.java index 75d03d7e9e0..2d9ca24fb18 100644 --- a/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancersCmd.java +++ b/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancersCmd.java @@ -40,7 +40,8 @@ import com.cloud.network.dao.ExternalLoadBalancerDeviceVO; import com.cloud.network.element.NetscalerLoadBalancerElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "listNetscalerLoadBalancers", responseObject = NetscalerLoadBalancerResponse.class, description = "lists netscaler load balancer devices") +@APICommand(name = "listNetscalerLoadBalancers", responseObject = NetscalerLoadBalancerResponse.class, description = "lists netscaler load balancer devices", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListNetscalerLoadBalancersCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListNetscalerLoadBalancersCmd.class.getName()); diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/AddNiciraNvpDeviceCmd.java b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/AddNiciraNvpDeviceCmd.java index 37491fd876b..1a9be2854c3 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/AddNiciraNvpDeviceCmd.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/AddNiciraNvpDeviceCmd.java @@ -41,7 +41,8 @@ import com.cloud.network.NiciraNvpDeviceVO; import com.cloud.network.element.NiciraNvpElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "addNiciraNvpDevice", responseObject = NiciraNvpDeviceResponse.class, description = "Adds a Nicira NVP device") +@APICommand(name = "addNiciraNvpDevice", responseObject = NiciraNvpDeviceResponse.class, description = "Adds a Nicira NVP device", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AddNiciraNvpDeviceCmd extends BaseAsyncCmd { private static final String s_name = "addniciranvpdeviceresponse"; @Inject diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/DeleteNiciraNvpDeviceCmd.java b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/DeleteNiciraNvpDeviceCmd.java index 685debb6737..d3fadeaac74 100755 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/DeleteNiciraNvpDeviceCmd.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/DeleteNiciraNvpDeviceCmd.java @@ -40,7 +40,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.element.NiciraNvpElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "deleteNiciraNvpDevice", responseObject = SuccessResponse.class, description = " delete a nicira nvp device") +@APICommand(name = "deleteNiciraNvpDevice", responseObject = SuccessResponse.class, description = " delete a nicira nvp device", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteNiciraNvpDeviceCmd extends BaseAsyncCmd { private static final String s_name = "deleteniciranvpdeviceresponse"; @Inject diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDeviceNetworksCmd.java b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDeviceNetworksCmd.java index ac28dc13716..a3217cc7284 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDeviceNetworksCmd.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDeviceNetworksCmd.java @@ -46,7 +46,8 @@ import com.cloud.network.Network; import com.cloud.network.element.NiciraNvpElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "listNiciraNvpDeviceNetworks", responseObject = NetworkResponse.class, description = "lists network that are using a nicira nvp device") +@APICommand(name = "listNiciraNvpDeviceNetworks", responseObject = NetworkResponse.class, description = "lists network that are using a nicira nvp device", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListNiciraNvpDeviceNetworksCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListNiciraNvpDeviceNetworksCmd.class.getName()); diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDevicesCmd.java b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDevicesCmd.java index 260d60f2833..6cc8f5d4b7b 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDevicesCmd.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDevicesCmd.java @@ -42,7 +42,8 @@ import com.cloud.network.NiciraNvpDeviceVO; import com.cloud.network.element.NiciraNvpElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "listNiciraNvpDevices", responseObject = NiciraNvpDeviceResponse.class, description = "Lists Nicira NVP devices") +@APICommand(name = "listNiciraNvpDevices", responseObject = NiciraNvpDeviceResponse.class, description = "Lists Nicira NVP devices", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListNiciraNvpDevicesCmd extends BaseListCmd { private static final String s_name = "listniciranvpdeviceresponse"; diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/AccessConfiguration.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/AccessConfiguration.java index 487f14b3b8d..b5291dc3627 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/AccessConfiguration.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/AccessConfiguration.java @@ -19,32 +19,12 @@ package com.cloud.network.nicira; -import java.io.Serializable; import java.util.List; -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; -import org.apache.commons.lang.builder.ReflectionToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; +public abstract class AccessConfiguration extends BaseNiciraNamedEntity { -@SuppressWarnings("serial") -public abstract class AccessConfiguration implements Serializable { - - protected String displayName; protected List logicalPortEgressRules; protected List logicalPortIngressRules; - protected List tags; - protected String uuid; - protected String href; - protected String schema; - - public String getDisplayName() { - return displayName; - } - - public void setDisplayName(final String displayName) { - this.displayName = displayName; - } public List getLogicalPortEgressRules() { return logicalPortEgressRules; @@ -61,72 +41,4 @@ public abstract class AccessConfiguration implements Seria public void setLogicalPortIngressRules(final List logicalPortIngressRules) { this.logicalPortIngressRules = logicalPortIngressRules; } - - public String getUuid() { - return uuid; - } - - public void setUuid(final String uuid) { - this.uuid = uuid; - } - - public String getHref() { - return href; - } - - public void setHref(final String href) { - this.href = href; - } - - public String getSchema() { - return schema; - } - - public void setSchema(final String schema) { - this.schema = schema; - } - - public List getTags() { - return tags; - } - - public void setTags(final List tags) { - this.tags = tags; - } - - @Override - public String toString() { - return ReflectionToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE, false); - } - - @Override - public int hashCode() { - return new HashCodeBuilder(17, 31) - .append(displayName).append(logicalPortEgressRules) - .append(logicalPortIngressRules).append(tags) - .append(uuid).append(href).append(schema) - .toHashCode(); - } - - @Override - @SuppressWarnings("unchecked") - public boolean equals(final Object obj) { - if (obj == null) { - return false; - } - if (obj == this) { - return true; - } - if (!(this.getClass().isInstance(obj))) { - return false; - } - final AccessConfiguration another = - (AccessConfiguration) obj; - return new EqualsBuilder() - .append(displayName, another.displayName) - .append(uuid, another.uuid) - .append(href, another.href) - .append(schema, another.schema) - .isEquals(); - } } diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Acl.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Acl.java index 976177fdff8..870124ed603 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Acl.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Acl.java @@ -19,6 +19,5 @@ package com.cloud.network.nicira; -@SuppressWarnings("serial") public class Acl extends AccessConfiguration { } diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/BaseNiciraEntity.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/BaseNiciraEntity.java new file mode 100644 index 00000000000..afcd2333959 --- /dev/null +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/BaseNiciraEntity.java @@ -0,0 +1,85 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// + +package com.cloud.network.nicira; + +import java.io.Serializable; + +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.commons.lang.builder.ReflectionToStringBuilder; +import org.apache.commons.lang.builder.ToStringStyle; + +public abstract class BaseNiciraEntity implements Serializable { + protected String href; + protected String schema; + protected String uuid; + + public String getUuid() { + return uuid; + } + + public void setUuid(final String uuid) { + this.uuid = uuid; + } + + public String getHref() { + return href; + } + + public void setHref(final String href) { + this.href = href; + } + + public String getSchema() { + return schema; + } + + public void setSchema(final String schema) { + this.schema = schema; + } + + @Override + public String toString() { + return ReflectionToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE, false); + } + + @Override + public int hashCode() { + return new HashCodeBuilder(17, 31) + .append(this.getClass()) + .append(uuid) + .toHashCode(); + } + + @Override + public boolean equals(final Object obj) { + if (obj == null) { + return false; + } + if (obj == this) { + return true; + } + if (!(this.getClass().isInstance(obj))) { + return false; + } + final BaseNiciraEntity another = (BaseNiciraEntity) obj; + return new EqualsBuilder().append(uuid, another.uuid).isEquals(); + } +} diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterConfig.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/BaseNiciraNamedEntity.java similarity index 62% rename from plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterConfig.java rename to plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/BaseNiciraNamedEntity.java index b6eaa8f277a..0e21ddb74c4 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterConfig.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/BaseNiciraNamedEntity.java @@ -21,45 +21,24 @@ package com.cloud.network.nicira; import java.util.List; -/** - * - */ -public class LogicalRouterConfig { - private String displayName; - private RoutingConfig routingConfig; - private final String type = "LogicalRouterConfig"; - private String uuid; - private List tags; +public abstract class BaseNiciraNamedEntity extends BaseNiciraEntity { - public RoutingConfig getRoutingConfig() { - return routingConfig; - } - - public void setRoutingConfig(RoutingConfig routingConfig) { - this.routingConfig = routingConfig; - } + protected String displayName; + protected List tags; public String getDisplayName() { return displayName; } - public void setDisplayName(String displayName) { + public void setDisplayName(final String displayName) { this.displayName = displayName; } - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - public List getTags() { return tags; } - public void setTags(List tags) { + public void setTags(final List tags) { this.tags = tags; } } diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouter.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouter.java new file mode 100644 index 00000000000..edc93512229 --- /dev/null +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouter.java @@ -0,0 +1,71 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// + +package com.cloud.network.nicira; + + +/** + * + */ +public class LogicalRouter extends BaseNiciraNamedEntity { + public static final String REPLICATION_MODE_SERVICE = "service"; + public static final String REPLICATION_MODE_SOURCE = "source"; + + private final String type = "LogicalRouterConfig"; + private RoutingConfig routingConfig; + private boolean distributed; + private boolean natSynchronizationEnabled; + private String replicationMode; + + public String getType() { + return type; + } + + public RoutingConfig getRoutingConfig() { + return routingConfig; + } + + public void setRoutingConfig(final RoutingConfig routingConfig) { + this.routingConfig = routingConfig; + } + + public boolean isDistributed() { + return distributed; + } + + public void setDistributed(final boolean distributed) { + this.distributed = distributed; + } + + public boolean isNatSynchronizationEnabled() { + return natSynchronizationEnabled; + } + + public void setNatSynchronizationEnabled(final boolean natSynchronizationEnabled) { + this.natSynchronizationEnabled = natSynchronizationEnabled; + } + + public String getReplicationMode() { + return replicationMode; + } + + public void setReplicationMode(final String replicationMode) { + this.replicationMode = replicationMode; + } +} diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterPort.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterPort.java index 8ffe0546875..d9ee09ad6f8 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterPort.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterPort.java @@ -21,24 +21,18 @@ package com.cloud.network.nicira; import java.util.List; -/** - * - */ -public class LogicalRouterPort { - private String displayName; - private List tags; +public class LogicalRouterPort extends BaseNiciraNamedEntity { private Integer portno; private boolean adminStatusEnabled; private List ipAddresses; private String macAddress; private final String type = "LogicalRouterPortConfig"; - private String uuid; public int getPortno() { return portno; } - public void setPortno(int portno) { + public void setPortno(final int portno) { this.portno = portno; } @@ -46,7 +40,7 @@ public class LogicalRouterPort { return adminStatusEnabled; } - public void setAdminStatusEnabled(boolean adminStatusEnabled) { + public void setAdminStatusEnabled(final boolean adminStatusEnabled) { this.adminStatusEnabled = adminStatusEnabled; } @@ -54,7 +48,7 @@ public class LogicalRouterPort { return ipAddresses; } - public void setIpAddresses(List ipAddresses) { + public void setIpAddresses(final List ipAddresses) { this.ipAddresses = ipAddresses; } @@ -62,32 +56,7 @@ public class LogicalRouterPort { return macAddress; } - public void setMacAddress(String macAddress) { + public void setMacAddress(final String macAddress) { this.macAddress = macAddress; } - - public String getDisplayName() { - return displayName; - } - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - public List getTags() { - return tags; - } - - public void setTags(List tags) { - this.tags = tags; - } - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - } \ No newline at end of file diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitch.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitch.java index 23793549912..b527d94107d 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitch.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitch.java @@ -21,29 +21,20 @@ package com.cloud.network.nicira; import java.util.List; -public class LogicalSwitch { - private String displayName; +public class LogicalSwitch extends BaseNiciraNamedEntity { + public static final String REPLICATION_MODE_SERVICE = "service"; + public static final String REPLICATION_MODE_SOURCE = "source"; + + private final String type = "LogicalSwitchConfig"; private boolean portIsolationEnabled; - private List tags; private List transportZones; - private String type; - private String uuid; - private String href; - private String schema; - - public String getDisplayName() { - return displayName; - } - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } + private String replicationMode; public boolean isPortIsolationEnabled() { return portIsolationEnabled; } - public void setPortIsolationEnabled(boolean portIsolationEnabled) { + public void setPortIsolationEnabled(final boolean portIsolationEnabled) { this.portIsolationEnabled = portIsolationEnabled; } @@ -51,48 +42,19 @@ public class LogicalSwitch { return type; } - public void setType(String type) { - this.type = type; - } - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public String getHref() { - return href; - } - - public void setHref(String href) { - this.href = href; - } - - public String getSchema() { - return schema; - } - - public void setSchema(String schema) { - this.schema = schema; - } - - public List getTags() { - return tags; - } - - public void setTags(List tags) { - this.tags = tags; - } - public List getTransportZones() { return transportZones; } - public void setTransportZones(List transportZones) { + public void setTransportZones(final List transportZones) { this.transportZones = transportZones; } + public String getReplicationMode() { + return replicationMode; + } + + public void setReplicationMode(final String replicationMode) { + this.replicationMode = replicationMode; + } } diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitchPort.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitchPort.java index 3565fbe8dbe..5e074235a74 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitchPort.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitchPort.java @@ -21,16 +21,13 @@ package com.cloud.network.nicira; import java.util.List; -public class LogicalSwitchPort { - private String displayName; - private List tags; +public class LogicalSwitchPort extends BaseNiciraNamedEntity { private Integer portno; private boolean adminStatusEnabled; private String queueUuid; private List securityProfiles; private List mirrorTargets; - private String type; - private String uuid; + private final String type = "LogicalSwitchPortConfig"; public LogicalSwitchPort() { super(); @@ -43,27 +40,11 @@ public class LogicalSwitchPort { this.adminStatusEnabled = adminStatusEnabled; } - public String getDisplayName() { - return displayName; - } - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - public List getTags() { - return tags; - } - - public void setTags(List tags) { - this.tags = tags; - } - public Integer getPortno() { return portno; } - public void setPortno(Integer portno) { + public void setPortno(final Integer portno) { this.portno = portno; } @@ -71,7 +52,7 @@ public class LogicalSwitchPort { return adminStatusEnabled; } - public void setAdminStatusEnabled(boolean adminStatusEnabled) { + public void setAdminStatusEnabled(final boolean adminStatusEnabled) { this.adminStatusEnabled = adminStatusEnabled; } @@ -79,7 +60,7 @@ public class LogicalSwitchPort { return queueUuid; } - public void setQueueUuid(String queueUuid) { + public void setQueueUuid(final String queueUuid) { this.queueUuid = queueUuid; } @@ -87,7 +68,7 @@ public class LogicalSwitchPort { return securityProfiles; } - public void setSecurityProfiles(List securityProfiles) { + public void setSecurityProfiles(final List securityProfiles) { this.securityProfiles = securityProfiles; } @@ -95,24 +76,7 @@ public class LogicalSwitchPort { return mirrorTargets; } - public void setMirrorTargets(List mirrorTargets) { + public void setMirrorTargets(final List mirrorTargets) { this.mirrorTargets = mirrorTargets; } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - } diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java index 83d00752665..810453cfbf7 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java @@ -18,55 +18,14 @@ // package com.cloud.network.nicira; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; import java.lang.reflect.Type; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.MalformedURLException; -import java.net.Socket; -import java.net.URL; -import java.net.UnknownHostException; -import java.security.KeyManagementException; -import java.security.NoSuchAlgorithmException; -import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.UUID; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSocketFactory; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; - -import org.apache.commons.httpclient.ConnectTimeoutException; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpException; -import org.apache.commons.httpclient.HttpMethod; -import org.apache.commons.httpclient.HttpMethodBase; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; -import org.apache.commons.httpclient.NameValuePair; -import org.apache.commons.httpclient.cookie.CookiePolicy; -import org.apache.commons.httpclient.methods.DeleteMethod; -import org.apache.commons.httpclient.methods.GetMethod; -import org.apache.commons.httpclient.methods.PostMethod; -import org.apache.commons.httpclient.methods.PutMethod; -import org.apache.commons.httpclient.methods.StringRequestEntity; -import org.apache.commons.httpclient.params.HttpConnectionParams; -import org.apache.commons.httpclient.protocol.Protocol; -import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; -import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory; -import org.apache.log4j.Logger; - -import com.google.gson.FieldNamingPolicy; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; @@ -74,33 +33,24 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParseException; import com.google.gson.reflect.TypeToken; +import com.cloud.utils.rest.CloudstackRESTException; +import com.cloud.utils.rest.RESTServiceConnector; +import com.cloud.utils.rest.RESTValidationStrategy; + @SuppressWarnings("rawtypes") public class NiciraNvpApi { protected static final String GET_METHOD_TYPE = "get"; protected static final String DELETE_METHOD_TYPE = "delete"; protected static final String PUT_METHOD_TYPE = "put"; protected static final String POST_METHOD_TYPE = "post"; - private static final String TEXT_HTML_CONTENT_TYPE = "text/html"; - private static final String JSON_CONTENT_TYPE = "application/json"; - private static final String CONTENT_TYPE = "Content-Type"; - private static final int BODY_RESP_MAX_LEN = 1024; + protected static final String SEC_PROFILE_URI_PREFIX = "/ws.v1/security-profile"; protected static final String ACL_URI_PREFIX = "/ws.v1/acl"; private static final String SWITCH_URI_PREFIX = "/ws.v1/lswitch"; private static final String ROUTER_URI_PREFIX = "/ws.v1/lrouter"; - private static final int HTTPS_PORT = 443; - private static final Logger s_logger = Logger.getLogger(NiciraNvpApi.class); - private final static String protocol = "https"; - private final static MultiThreadedHttpConnectionManager s_httpClientManager = new MultiThreadedHttpConnectionManager(); + private static final String LOGIN_URL = "/ws.v1/login"; - private String host; - private String adminuser; - private String adminpass; - - private final HttpClient client; - private String nvpVersion; - - private final Gson gson; + protected RESTServiceConnector restConnector; protected final static Map prefixMap; @@ -112,115 +62,174 @@ public class NiciraNvpApi { prefixMap = new HashMap(); prefixMap.put(SecurityProfile.class, SEC_PROFILE_URI_PREFIX); prefixMap.put(Acl.class, ACL_URI_PREFIX); + prefixMap.put(LogicalSwitch.class, SWITCH_URI_PREFIX); + prefixMap.put(LogicalRouter.class, ROUTER_URI_PREFIX); listTypeMap = new HashMap(); listTypeMap.put(SecurityProfile.class, new TypeToken>() { }.getType()); listTypeMap.put(Acl.class, new TypeToken>() { }.getType()); + listTypeMap.put(LogicalSwitch.class, new TypeToken>() { + }.getType()); + listTypeMap.put(LogicalRouter.class, new TypeToken>() { + }.getType()); defaultListParams = new HashMap(); defaultListParams.put("fields", "*"); } - /* This factory method is protected so we can extend this - * in the unittests. - */ - protected HttpClient createHttpClient() { - return new HttpClient(s_httpClientManager); - } - - protected HttpMethod createMethod(final String type, final String uri) throws NiciraNvpApiException { - String url; - try { - url = new URL(protocol, host, uri).toString(); - } catch (final MalformedURLException e) { - s_logger.error("Unable to build Nicira API URL", e); - throw new NiciraNvpApiException("Unable to build Nicira API URL", e); - } - - if (POST_METHOD_TYPE.equalsIgnoreCase(type)) { - return new PostMethod(url); - } else if (GET_METHOD_TYPE.equalsIgnoreCase(type)) { - return new GetMethod(url); - } else if (DELETE_METHOD_TYPE.equalsIgnoreCase(type)) { - return new DeleteMethod(url); - } else if (PUT_METHOD_TYPE.equalsIgnoreCase(type)) { - return new PutMethod(url); - } else { - throw new NiciraNvpApiException("Requesting unknown method type"); - } - } - public NiciraNvpApi() { - client = createHttpClient(); - client.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY); + final List> classList = new ArrayList>(); + classList.add(NatRule.class); + classList.add(RoutingConfig.class); + final List> deserializerList = new ArrayList>(); + deserializerList.add(new NatRuleAdapter()); + deserializerList.add(new RoutingConfigAdapter()); - try { - // Cast to ProtocolSocketFactory to avoid the deprecated constructor with the SecureProtocolSocketFactory parameter - Protocol.registerProtocol("https", new Protocol("https", (ProtocolSocketFactory)new TrustingProtocolSocketFactory(), HTTPS_PORT)); - } catch (final IOException e) { - s_logger.warn("Failed to register the TrustingProtocolSocketFactory, falling back to default SSLSocketFactory", e); - } + restConnector = new RESTServiceConnector(new RESTValidationStrategy(LOGIN_URL), classList, deserializerList); + } - gson = new GsonBuilder().registerTypeAdapter(NatRule.class, new NatRuleAdapter()).setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create(); + public NiciraNvpApi(final String address, final String username, final String password) { + this(); + restConnector.setControllerAddress(address); + restConnector.setAdminCredentials(username, password); } public void setControllerAddress(final String address) { - host = address; + restConnector.setControllerAddress(address); } public void setAdminCredentials(final String username, final String password) { - adminuser = username; - adminpass = password; + restConnector.setAdminCredentials(username, password); } /** - * Logs into the Nicira API. The cookie is stored in the _authcookie variable. - *

- * The method returns false if the login failed or the connection could not be made. + * POST * + * @param entity + * @return + * @throws NiciraNvpApiException */ - protected void login() throws NiciraNvpApiException { - String url; - - if (host == null || host.isEmpty() || adminuser == null || adminuser.isEmpty() || adminpass == null || adminpass.isEmpty()) { - throw new NiciraNvpApiException("Hostname/credentials are null or empty"); - } + protected T create(final T entity) throws NiciraNvpApiException { + final String uri = prefixMap.get(entity.getClass()); + return createWithUri(entity, uri); + } + /** + * POST + * + * @param entity + * @return + * @throws NiciraNvpApiException + */ + protected T createWithUri(final T entity, final String uri) throws NiciraNvpApiException { + T createdEntity; try { - url = new URL(protocol, host, "/ws.v1/login").toString(); - } catch (final MalformedURLException e) { - s_logger.error("Unable to build Nicira API URL", e); - throw new NiciraNvpApiException("Unable to build Nicira API URL", e); + createdEntity = restConnector.executeCreateObject(entity, new TypeToken() { + }.getType(), uri, Collections. emptyMap()); + } catch (final CloudstackRESTException e) { + throw new NiciraNvpApiException(e); } - final PostMethod pm = new PostMethod(url); - pm.addParameter("username", adminuser); - pm.addParameter("password", adminpass); + return createdEntity; + } + /** + * GET list of items + * + * @return + * @throws NiciraNvpApiException + */ + protected NiciraNvpList find(final Class clazz) throws NiciraNvpApiException { + return find(null, clazz); + } + + /** + * GET list of items + * + * @param uuid + * @return + * @throws NiciraNvpApiException + */ + public NiciraNvpList find(final String uuid, final Class clazz) throws NiciraNvpApiException { + final String uri = prefixMap.get(clazz); + Map params = defaultListParams; + if (uuid != null) { + params = new HashMap(defaultListParams); + params.put("uuid", uuid); + } + + NiciraNvpList entities; try { - client.executeMethod(pm); - } catch (final HttpException e) { - throw new NiciraNvpApiException("Nicira NVP API login failed ", e); - } catch (final IOException e) { - throw new NiciraNvpApiException("Nicira NVP API login failed ", e); - } finally { - pm.releaseConnection(); + entities = restConnector.executeRetrieveObject(listTypeMap.get(clazz), uri, params); + } catch (final CloudstackRESTException e) { + throw new NiciraNvpApiException(e); } - if (pm.getStatusCode() != HttpStatus.SC_OK) { - s_logger.error("Nicira NVP API login failed : " + pm.getStatusText()); - throw new NiciraNvpApiException("Nicira NVP API login failed " + pm.getStatusText()); + if (entities == null) { + throw new NiciraNvpApiException("Unexpected response from API"); } - // Extract the version for later use - if (pm.getResponseHeader("Server") != null) { - nvpVersion = pm.getResponseHeader("Server").getValue(); - s_logger.debug("NVP Controller reports version " + nvpVersion); - } + return entities; + } - // Success; the cookie required for login is kept in _client + /** + * PUT item given a UUID as key and an item object + * with the new data + * + * @param item + * @param uuid + * @throws NiciraNvpApiException + */ + public void update(final T item, final String uuid) + throws NiciraNvpApiException { + final String uri = prefixMap.get(item.getClass()) + "/" + uuid; + updateWithUri(item, uri); + } + + /** + * PUT item given a UUID as key and an item object + * with the new data + * + * @param item + * @param uuid + * @throws NiciraNvpApiException + */ + public void updateWithUri(final T item, final String uri) + throws NiciraNvpApiException { + try { + restConnector.executeUpdateObject(item, uri, Collections. emptyMap()); + } catch (final CloudstackRESTException e) { + throw new NiciraNvpApiException(e); + } + } + + /** + * DELETE Security Profile given a UUID as key + * + * @param securityProfileUuid + * @throws NiciraNvpApiException + */ + public void delete(final String uuid, final Class clazz) + throws NiciraNvpApiException { + final String uri = prefixMap.get(clazz) + "/" + uuid; + deleteWithUri(uri); + } + + /** + * DELETE Security Profile given a UUID as key + * + * @param securityProfileUuid + * @throws NiciraNvpApiException + */ + public void deleteWithUri(final String uri) + throws NiciraNvpApiException { + try { + restConnector.executeDeleteObject(uri); + } catch (final CloudstackRESTException e) { + throw new NiciraNvpApiException(e); + } } /** @@ -341,111 +350,68 @@ public class NiciraNvpApi { delete(aclUuid, Acl.class); } - /** - * POST - * - * @param entity - * @return - * @throws NiciraNvpApiException - */ - protected T create(final T entity) throws NiciraNvpApiException { - final String uri = prefixMap.get(entity.getClass()); - final T createdEntity = executeCreateObject(entity, new TypeToken() { - }.getType(), uri, Collections. emptyMap()); - - return createdEntity; + public LogicalSwitch createLogicalSwitch(final LogicalSwitch logicalSwitch) throws NiciraNvpApiException { + return create(logicalSwitch); } /** - * GET list of items + * GET list of {@link LogicalSwitch} * * @return * @throws NiciraNvpApiException */ - protected NiciraNvpList find(final Class clazz) throws NiciraNvpApiException { - return find(null, clazz); + public NiciraNvpList findLogicalSwitch() throws NiciraNvpApiException { + return findLogicalSwitch(null); } /** - * GET list of items + * GET list of {@link LogicalSwitch} filtered by UUID * * @param uuid * @return * @throws NiciraNvpApiException */ - public NiciraNvpList find(final String uuid, final Class clazz) throws NiciraNvpApiException { - final String uri = prefixMap.get(clazz); - Map params = defaultListParams; - if (uuid != null) { - params = new HashMap(defaultListParams); - params.put("uuid", uuid); - } - - final NiciraNvpList entities = executeRetrieveObject(listTypeMap.get(clazz), uri, params); - - if (entities == null) { - throw new NiciraNvpApiException("Unexpected response from API"); - } - - return entities; + public NiciraNvpList findLogicalSwitch(final String uuid) throws NiciraNvpApiException { + return find(uuid, LogicalSwitch.class); } /** - * PUT item given a UUID as key and an item object + * PUT {@link LogicalSwitch} given a UUID as key and a {@link LogicalSwitch} * with the new data * - * @param item - * @param uuid + * @param logicalSwitch + * @param logicalSwitchUuid * @throws NiciraNvpApiException */ - public void update(final T item, - final String uuid) + public void updateLogicalSwitch(final LogicalSwitch logicalSwitch, + final String logicalSwitchUuid) throws NiciraNvpApiException { - final String uri = prefixMap.get(item.getClass()) + "/" + uuid; - executeUpdateObject(item, uri, Collections. emptyMap()); - } - - /** - * DELETE Security Profile given a UUID as key - * - * @param securityProfileUuid - * @throws NiciraNvpApiException - */ - public void delete(final String uuid, final Class clazz) - throws NiciraNvpApiException { - final String uri = prefixMap.get(clazz) + "/" + uuid; - executeDeleteObject(uri); - } - - public LogicalSwitch createLogicalSwitch(final LogicalSwitch logicalSwitch) throws NiciraNvpApiException { - final String uri = SWITCH_URI_PREFIX; - final LogicalSwitch createdLogicalSwitch = executeCreateObject(logicalSwitch, new TypeToken() { - }.getType(), uri, Collections. emptyMap()); - - return createdLogicalSwitch; + update(logicalSwitch, logicalSwitchUuid); } public void deleteLogicalSwitch(final String uuid) throws NiciraNvpApiException { - final String uri = SWITCH_URI_PREFIX + "/" + uuid; - executeDeleteObject(uri); + delete(uuid, LogicalSwitch.class); } public LogicalSwitchPort createLogicalSwitchPort(final String logicalSwitchUuid, final LogicalSwitchPort logicalSwitchPort) throws NiciraNvpApiException { final String uri = SWITCH_URI_PREFIX + "/" + logicalSwitchUuid + "/lport"; - final LogicalSwitchPort createdLogicalSwitchPort = executeCreateObject(logicalSwitchPort, new TypeToken() { - }.getType(), uri, Collections. emptyMap()); - - return createdLogicalSwitchPort; + return createWithUri(logicalSwitchPort, uri); } - public void modifyLogicalSwitchPortAttachment(final String logicalSwitchUuid, final String logicalSwitchPortUuid, final Attachment attachment) throws NiciraNvpApiException { + public void updateLogicalSwitchPort(final String logicalSwitchUuid, final LogicalSwitchPort logicalSwitchPort) throws NiciraNvpApiException { + final String uri = SWITCH_URI_PREFIX + "/" + logicalSwitchUuid + "/lport/" + logicalSwitchPort.getUuid(); + updateWithUri(logicalSwitchPort, uri); + } + + public void updateLogicalSwitchPortAttachment(final String logicalSwitchUuid, final String logicalSwitchPortUuid, + final Attachment attachment) throws NiciraNvpApiException { final String uri = SWITCH_URI_PREFIX + "/" + logicalSwitchUuid + "/lport/" + logicalSwitchPortUuid + "/attachment"; - executeUpdateObject(attachment, uri, Collections. emptyMap()); + updateWithUri(attachment, uri); } public void deleteLogicalSwitchPort(final String logicalSwitchUuid, final String logicalSwitchPortUuid) throws NiciraNvpApiException { final String uri = SWITCH_URI_PREFIX + "/" + logicalSwitchUuid + "/lport/" + logicalSwitchPortUuid; - executeDeleteObject(uri); + deleteWithUri(uri); } public String findLogicalSwitchPortUuidByVifAttachmentUuid(final String logicalSwitchUuid, final String vifAttachmentUuid) throws NiciraNvpApiException { @@ -454,8 +420,13 @@ public class NiciraNvpApi { params.put("attachment_vif_uuid", vifAttachmentUuid); params.put("fields", "uuid"); - final NiciraNvpList lspl = executeRetrieveObject(new TypeToken>() { - }.getType(), uri, params); + NiciraNvpList lspl; + try { + lspl = restConnector.executeRetrieveObject(new TypeToken>() { + }.getType(), uri, params); + } catch (final CloudstackRESTException e) { + throw new NiciraNvpApiException(e); + } if (lspl == null || lspl.getResultCount() != 1) { throw new NiciraNvpApiException("Unexpected response from API"); @@ -467,8 +438,13 @@ public class NiciraNvpApi { public ControlClusterStatus getControlClusterStatus() throws NiciraNvpApiException { final String uri = "/ws.v1/control-cluster/status"; - final ControlClusterStatus ccs = executeRetrieveObject(new TypeToken() { - }.getType(), uri, null); + ControlClusterStatus ccs; + try { + ccs = restConnector.executeRetrieveObject(new TypeToken() { + }.getType(), uri, null); + } catch (final CloudstackRESTException e) { + throw new NiciraNvpApiException(e); + } return ccs; } @@ -479,8 +455,13 @@ public class NiciraNvpApi { params.put("uuid", logicalSwitchPortUuid); params.put("fields", "uuid"); - final NiciraNvpList lspl = executeRetrieveObject(new TypeToken>() { - }.getType(), uri, params); + NiciraNvpList lspl; + try { + lspl = restConnector.executeRetrieveObject(new TypeToken>() { + }.getType(), uri, params); + } catch (final CloudstackRESTException e) { + throw new NiciraNvpApiException(e); + } if (lspl == null) { throw new NiciraNvpApiException("Unexpected response from API"); @@ -489,64 +470,101 @@ public class NiciraNvpApi { return lspl; } - public LogicalRouterConfig createLogicalRouter(final LogicalRouterConfig logicalRouterConfig) throws NiciraNvpApiException { - final String uri = ROUTER_URI_PREFIX; + public NiciraNvpList findLogicalRouterPortsByUuid(final String logicalRouterUuid, final String logicalRouterPortUuid) throws NiciraNvpApiException { + final String uri = ROUTER_URI_PREFIX + "/" + logicalRouterUuid + "/lport"; + final Map params = new HashMap(); + params.put("uuid", logicalRouterPortUuid); + params.put("fields", "uuid"); - final LogicalRouterConfig lrc = executeCreateObject(logicalRouterConfig, new TypeToken() { - }.getType(), uri, Collections. emptyMap()); + NiciraNvpList lrpl; + try { + lrpl = restConnector.executeRetrieveObject(new TypeToken>() { + }.getType(), uri, params); + } catch (final CloudstackRESTException e) { + throw new NiciraNvpApiException(e); + } - return lrc; + if (lrpl == null) { + throw new NiciraNvpApiException("Unexpected response from API"); + } + + return lrpl; + } + + public LogicalRouter createLogicalRouter(final LogicalRouter logicalRouter) throws NiciraNvpApiException { + return create(logicalRouter); + } + + /** + * GET list of {@link LogicalRouter} + * + * @return + * @throws NiciraNvpApiException + */ + public NiciraNvpList findLogicalRouter() throws NiciraNvpApiException { + return findLogicalRouter(null); + } + + /** + * GET list of {@link LogicalRouter} filtered by UUID + * + * @param uuid + * @return + * @throws NiciraNvpApiException + */ + public NiciraNvpList findLogicalRouter(final String uuid) throws NiciraNvpApiException { + return find(uuid, LogicalRouter.class); + } + + public LogicalRouter findOneLogicalRouterByUuid(final String logicalRouterUuid) throws NiciraNvpApiException { + return findLogicalRouter(logicalRouterUuid).getResults().get(0); + } + + public void updateLogicalRouter(final LogicalRouter logicalRouter, + final String logicalRouterUuid) + throws NiciraNvpApiException { + update(logicalRouter, logicalRouterUuid); } public void deleteLogicalRouter(final String logicalRouterUuid) throws NiciraNvpApiException { final String uri = ROUTER_URI_PREFIX + "/" + logicalRouterUuid; - - executeDeleteObject(uri); + deleteWithUri(uri); } public LogicalRouterPort createLogicalRouterPort(final String logicalRouterUuid, final LogicalRouterPort logicalRouterPort) throws NiciraNvpApiException { final String uri = ROUTER_URI_PREFIX + "/" + logicalRouterUuid + "/lport"; - - final LogicalRouterPort lrp = executeCreateObject(logicalRouterPort, new TypeToken() { - }.getType(), uri, Collections. emptyMap()); - return lrp; + return createWithUri(logicalRouterPort, uri); } public void deleteLogicalRouterPort(final String logicalRouterUuid, final String logicalRouterPortUuid) throws NiciraNvpApiException { final String uri = ROUTER_URI_PREFIX + "/" + logicalRouterUuid + "/lport/" + logicalRouterPortUuid; - - executeDeleteObject(uri); + deleteWithUri(uri); } - public void modifyLogicalRouterPort(final String logicalRouterUuid, final LogicalRouterPort logicalRouterPort) throws NiciraNvpApiException { + public void updateLogicalRouterPort(final String logicalRouterUuid, final LogicalRouterPort logicalRouterPort) throws NiciraNvpApiException { final String uri = ROUTER_URI_PREFIX + "/" + logicalRouterUuid + "/lport/" + logicalRouterPort.getUuid(); - - executeUpdateObject(logicalRouterPort, uri, Collections. emptyMap()); + updateWithUri(logicalRouterPort, uri); } - public void modifyLogicalRouterPortAttachment(final String logicalRouterUuid, final String logicalRouterPortUuid, final Attachment attachment) + public void updateLogicalRouterPortAttachment(final String logicalRouterUuid, final String logicalRouterPortUuid, final Attachment attachment) throws NiciraNvpApiException { final String uri = ROUTER_URI_PREFIX + "/" + logicalRouterUuid + "/lport/" + logicalRouterPortUuid + "/attachment"; - executeUpdateObject(attachment, uri, Collections. emptyMap()); + updateWithUri(attachment, uri); } public NatRule createLogicalRouterNatRule(final String logicalRouterUuid, final NatRule natRule) throws NiciraNvpApiException { final String uri = ROUTER_URI_PREFIX + "/" + logicalRouterUuid + "/nat"; - - return executeCreateObject(natRule, new TypeToken() { - }.getType(), uri, Collections. emptyMap()); + return createWithUri(natRule, uri); } - public void modifyLogicalRouterNatRule(final String logicalRouterUuid, final NatRule natRule) throws NiciraNvpApiException { + public void updateLogicalRouterNatRule(final String logicalRouterUuid, final NatRule natRule) throws NiciraNvpApiException { final String uri = ROUTER_URI_PREFIX + "/" + logicalRouterUuid + "/nat/" + natRule.getUuid(); - - executeUpdateObject(natRule, uri, Collections. emptyMap()); + updateWithUri(natRule, uri); } public void deleteLogicalRouterNatRule(final String logicalRouterUuid, final UUID natRuleUuid) throws NiciraNvpApiException { final String uri = ROUTER_URI_PREFIX + "/" + logicalRouterUuid + "/nat/" + natRuleUuid.toString(); - - executeDeleteObject(uri); + deleteWithUri(uri); } public NiciraNvpList findLogicalRouterPortByGatewayServiceAndVlanId(final String logicalRouterUuid, final String gatewayServiceUuid, @@ -557,21 +575,12 @@ public class NiciraNvpApi { params.put("attachment_vlan", "0"); params.put("fields", "*"); - return executeRetrieveObject(new TypeToken>() { - }.getType(), uri, params); - } - - public LogicalRouterConfig findOneLogicalRouterByUuid(final String logicalRouterUuid) throws NiciraNvpApiException { - final String uri = ROUTER_URI_PREFIX + "/" + logicalRouterUuid; - - return executeRetrieveObject(new TypeToken() { - }.getType(), uri, Collections. emptyMap()); - } - - public void updateLogicalRouterPortConfig(final String logicalRouterUuid, final LogicalRouterPort logicalRouterPort) throws NiciraNvpApiException { - final String uri = ROUTER_URI_PREFIX + "/" + logicalRouterUuid + "/lport" + logicalRouterPort.getUuid(); - - executeUpdateObject(logicalRouterPort, uri, Collections. emptyMap()); + try { + return restConnector.executeRetrieveObject(new TypeToken>() { + }.getType(), uri, params); + } catch (final CloudstackRESTException e) { + throw new NiciraNvpApiException(e); + } } public NiciraNvpList findNatRulesByLogicalRouterUuid(final String logicalRouterUuid) throws NiciraNvpApiException { @@ -579,8 +588,12 @@ public class NiciraNvpApi { final Map params = new HashMap(); params.put("fields", "*"); - return executeRetrieveObject(new TypeToken>() { - }.getType(), uri, params); + try { + return restConnector.executeRetrieveObject(new TypeToken>() { + }.getType(), uri, params); + } catch (final CloudstackRESTException e) { + throw new NiciraNvpApiException(e); + } } public NiciraNvpList findLogicalRouterPortByGatewayServiceUuid(final String logicalRouterUuid, final String l3GatewayServiceUuid) @@ -590,231 +603,11 @@ public class NiciraNvpApi { params.put("fields", "*"); params.put("attachment_gwsvc_uuid", l3GatewayServiceUuid); - return executeRetrieveObject(new TypeToken>() { - }.getType(), uri, params); - } - - protected void executeUpdateObject(final T newObject, final String uri, final Map parameters) throws NiciraNvpApiException { - if (host == null || host.isEmpty() || adminuser == null || adminuser.isEmpty() || adminpass == null || adminpass.isEmpty()) { - throw new NiciraNvpApiException("Hostname/credentials are null or empty"); - } - - final PutMethod pm = (PutMethod)createMethod(PUT_METHOD_TYPE, uri); - pm.setRequestHeader(CONTENT_TYPE, JSON_CONTENT_TYPE); try { - pm.setRequestEntity(new StringRequestEntity(gson.toJson(newObject), JSON_CONTENT_TYPE, null)); - } catch (final UnsupportedEncodingException e) { - throw new NiciraNvpApiException("Failed to encode json request body", e); - } - - executeMethod(pm); - - if (pm.getStatusCode() != HttpStatus.SC_OK) { - final String errorMessage = responseToErrorMessage(pm); - pm.releaseConnection(); - s_logger.error("Failed to update object : " + errorMessage); - throw new NiciraNvpApiException("Failed to update object : " + errorMessage); - } - pm.releaseConnection(); - } - - @SuppressWarnings("unchecked") - protected T executeCreateObject(final T newObject, final Type returnObjectType, final String uri, final Map parameters) - throws NiciraNvpApiException { - if (host == null || host.isEmpty() || adminuser == null || adminuser.isEmpty() || adminpass == null || adminpass.isEmpty()) { - throw new NiciraNvpApiException("Hostname/credentials are null or empty"); - } - - final PostMethod pm = (PostMethod)createMethod(POST_METHOD_TYPE, uri); - pm.setRequestHeader(CONTENT_TYPE, JSON_CONTENT_TYPE); - try { - pm.setRequestEntity(new StringRequestEntity(gson.toJson(newObject), JSON_CONTENT_TYPE, null)); - } catch (final UnsupportedEncodingException e) { - throw new NiciraNvpApiException("Failed to encode json request body", e); - } - - executeMethod(pm); - - if (pm.getStatusCode() != HttpStatus.SC_CREATED) { - final String errorMessage = responseToErrorMessage(pm); - pm.releaseConnection(); - s_logger.error("Failed to create object : " + errorMessage); - throw new NiciraNvpApiException("Failed to create object : " + errorMessage); - } - - T result; - try { - result = (T)gson.fromJson(pm.getResponseBodyAsString(), TypeToken.get(newObject.getClass()).getType()); - } catch (final IOException e) { - throw new NiciraNvpApiException("Failed to decode json response body", e); - } finally { - pm.releaseConnection(); - } - - return result; - } - - protected void executeDeleteObject(final String uri) throws NiciraNvpApiException { - if (host == null || host.isEmpty() || adminuser == null || adminuser.isEmpty() || adminpass == null || adminpass.isEmpty()) { - throw new NiciraNvpApiException("Hostname/credentials are null or empty"); - } - - final DeleteMethod dm = (DeleteMethod)createMethod(DELETE_METHOD_TYPE, uri); - dm.setRequestHeader(CONTENT_TYPE, JSON_CONTENT_TYPE); - - executeMethod(dm); - - if (dm.getStatusCode() != HttpStatus.SC_NO_CONTENT) { - final String errorMessage = responseToErrorMessage(dm); - dm.releaseConnection(); - s_logger.error("Failed to delete object : " + errorMessage); - throw new NiciraNvpApiException("Failed to delete object : " + errorMessage); - } - dm.releaseConnection(); - } - - @SuppressWarnings("unchecked") - protected T executeRetrieveObject(final Type returnObjectType, final String uri, final Map parameters) throws NiciraNvpApiException { - if (host == null || host.isEmpty() || adminuser == null || adminuser.isEmpty() || adminpass == null || adminpass.isEmpty()) { - throw new NiciraNvpApiException("Hostname/credentials are null or empty"); - } - - final GetMethod gm = (GetMethod)createMethod(GET_METHOD_TYPE, uri); - gm.setRequestHeader(CONTENT_TYPE, JSON_CONTENT_TYPE); - if (parameters != null && !parameters.isEmpty()) { - final List nameValuePairs = new ArrayList(parameters.size()); - for (final Entry e : parameters.entrySet()) { - nameValuePairs.add(new NameValuePair(e.getKey(), e.getValue())); - } - gm.setQueryString(nameValuePairs.toArray(new NameValuePair[0])); - } - - executeMethod(gm); - - if (gm.getStatusCode() != HttpStatus.SC_OK) { - final String errorMessage = responseToErrorMessage(gm); - gm.releaseConnection(); - s_logger.error("Failed to retrieve object : " + errorMessage); - throw new NiciraNvpApiException("Failed to retrieve object : " + errorMessage); - } - - T returnValue; - try { - returnValue = (T)gson.fromJson(gm.getResponseBodyAsString(), returnObjectType); - } catch (final IOException e) { - s_logger.error("IOException while retrieving response body", e); + return restConnector.executeRetrieveObject(new TypeToken>() { + }.getType(), uri, params); + } catch (final CloudstackRESTException e) { throw new NiciraNvpApiException(e); - } finally { - gm.releaseConnection(); - } - return returnValue; - } - - protected void executeMethod(final HttpMethodBase method) throws NiciraNvpApiException { - try { - client.executeMethod(method); - if (method.getStatusCode() == HttpStatus.SC_UNAUTHORIZED) { - method.releaseConnection(); - // login and try again - login(); - client.executeMethod(method); - } - } catch (final HttpException e) { - s_logger.error("HttpException caught while trying to connect to the Nicira NVP Controller", e); - method.releaseConnection(); - throw new NiciraNvpApiException("API call to Nicira NVP Controller Failed", e); - } catch (final IOException e) { - s_logger.error("IOException caught while trying to connect to the Nicira NVP Controller", e); - method.releaseConnection(); - throw new NiciraNvpApiException("API call to Nicira NVP Controller Failed", e); - } - } - - private String responseToErrorMessage(final HttpMethodBase method) { - assert method.isRequestSent() : "no use getting an error message unless the request is sent"; - - if (TEXT_HTML_CONTENT_TYPE.equals(method.getResponseHeader(CONTENT_TYPE).getValue())) { - // The error message is the response content - // Safety margin of 1024 characters, anything longer is probably useless - // and will clutter the logs - try { - return method.getResponseBodyAsString(BODY_RESP_MAX_LEN); - } catch (final IOException e) { - s_logger.debug("Error while loading response body", e); - } - } - - // The default - return method.getStatusText(); - } - - /* The Nicira controller uses a self-signed certificate. The - * TrustingProtocolSocketFactory will accept any provided - * certificate when making an SSL connection to the SDN - * Manager - */ - private class TrustingProtocolSocketFactory implements SecureProtocolSocketFactory { - - private SSLSocketFactory ssf; - - public TrustingProtocolSocketFactory() throws IOException { - // Create a trust manager that does not validate certificate chains - final TrustManager[] trustAllCerts = new TrustManager[] {new X509TrustManager() { - @Override - public X509Certificate[] getAcceptedIssuers() { - return null; - } - - @Override - public void checkClientTrusted(final X509Certificate[] certs, final String authType) { - // Trust always - } - - @Override - public void checkServerTrusted(final X509Certificate[] certs, final String authType) { - // Trust always - } - }}; - - try { - // Install the all-trusting trust manager - final SSLContext sc = SSLContext.getInstance("SSL"); - sc.init(null, trustAllCerts, new java.security.SecureRandom()); - ssf = sc.getSocketFactory(); - } catch (final KeyManagementException e) { - throw new IOException(e); - } catch (final NoSuchAlgorithmException e) { - throw new IOException(e); - } - } - - @Override - public Socket createSocket(final String host, final int port) throws IOException { - return ssf.createSocket(host, port); - } - - @Override - public Socket createSocket(final String address, final int port, final InetAddress localAddress, final int localPort) throws IOException, UnknownHostException { - return ssf.createSocket(address, port, localAddress, localPort); - } - - @Override - public Socket createSocket(final Socket socket, final String host, final int port, final boolean autoClose) throws IOException, UnknownHostException { - return ssf.createSocket(socket, host, port, autoClose); - } - - @Override - public Socket createSocket(final String host, final int port, final InetAddress localAddress, final int localPort, final HttpConnectionParams params) - throws IOException, UnknownHostException, ConnectTimeoutException { - final int timeout = params.getConnectionTimeout(); - if (timeout == 0) { - return createSocket(host, port, localAddress, localPort); - } else { - final Socket s = ssf.createSocket(); - s.bind(new InetSocketAddress(localAddress, localPort)); - s.connect(new InetSocketAddress(host, port), timeout); - return s; - } } } @@ -837,6 +630,29 @@ public class NiciraNvpApi { throw new JsonParseException("Failed to deserialize type \"" + natRuleType + "\""); } + } + public static class RoutingConfigAdapter implements JsonDeserializer { + + private static final String ROUTING_TABLE_ROUTING_CONFIG = "RoutingTableRoutingConfig"; + private static final String SINGLE_DEFAULT_ROUTE_IMPLICIT_ROUTING_CONFIG = "SingleDefaultRouteImplicitRoutingConfig"; + + @Override + public RoutingConfig deserialize(final JsonElement jsonElement, final Type type, final JsonDeserializationContext context) throws JsonParseException { + final JsonObject jsonObject = jsonElement.getAsJsonObject(); + + if (!jsonObject.has("type")) { + throw new JsonParseException("Deserializing as a RoutingConfig, but no type present in the json object"); + } + + final String routingConfigType = jsonObject.get("type").getAsString(); + if (SINGLE_DEFAULT_ROUTE_IMPLICIT_ROUTING_CONFIG.equals(routingConfigType)) { + return context.deserialize(jsonElement, SingleDefaultRouteImplicitRoutingConfig.class); + } else if (ROUTING_TABLE_ROUTING_CONFIG.equals(routingConfigType)) { + return context.deserialize(jsonElement, RoutingTableRoutingConfig.class); + } + + throw new JsonParseException("Failed to deserialize type \"" + routingConfigType + "\""); + } } } diff --git a/core/src/com/cloud/agent/api/SetupGuestNetworkAnswer.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/RoutingTableRoutingConfig.java similarity index 75% rename from core/src/com/cloud/agent/api/SetupGuestNetworkAnswer.java rename to plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/RoutingTableRoutingConfig.java index 16eb771466c..f0a80b85e5b 100644 --- a/core/src/com/cloud/agent/api/SetupGuestNetworkAnswer.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/RoutingTableRoutingConfig.java @@ -1,3 +1,4 @@ +// // Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information @@ -14,13 +15,16 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.agent.api; +// -public class SetupGuestNetworkAnswer extends Answer { - public SetupGuestNetworkAnswer() { - } +package com.cloud.network.nicira; - public SetupGuestNetworkAnswer(SetupGuestNetworkCommand cmd, boolean success, String result) { - super(cmd, success, result); +/** + * + */ +public class RoutingTableRoutingConfig extends RoutingConfig { + public final String type = "RoutingTableRoutingConfig"; + + public RoutingTableRoutingConfig() { } } diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SingleDefaultRouteImplictRoutingConfig.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SingleDefaultRouteImplicitRoutingConfig.java similarity index 82% rename from plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SingleDefaultRouteImplictRoutingConfig.java rename to plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SingleDefaultRouteImplicitRoutingConfig.java index 05335791b95..ea5df2cd1fd 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SingleDefaultRouteImplictRoutingConfig.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SingleDefaultRouteImplicitRoutingConfig.java @@ -22,11 +22,11 @@ package com.cloud.network.nicira; /** * */ -public class SingleDefaultRouteImplictRoutingConfig extends RoutingConfig { +public class SingleDefaultRouteImplicitRoutingConfig extends RoutingConfig { public RouterNextHop defaultRouteNextHop; public final String type = "SingleDefaultRouteImplicitRoutingConfig"; - public SingleDefaultRouteImplictRoutingConfig(RouterNextHop routerNextHop) { + public SingleDefaultRouteImplicitRoutingConfig(final RouterNextHop routerNextHop) { defaultRouteNextHop = routerNextHop; } @@ -34,7 +34,7 @@ public class SingleDefaultRouteImplictRoutingConfig extends RoutingConfig { return defaultRouteNextHop; } - public void setDefaultRouteNextHop(RouterNextHop defaultRouteNextHop) { + public void setDefaultRouteNextHop(final RouterNextHop defaultRouteNextHop) { this.defaultRouteNextHop = defaultRouteNextHop; } } diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/VifAttachment.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/VifAttachment.java index 87765be12a2..fe7d93adead 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/VifAttachment.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/VifAttachment.java @@ -19,6 +19,11 @@ package com.cloud.network.nicira; +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.commons.lang.builder.ReflectionToStringBuilder; +import org.apache.commons.lang.builder.ToStringStyle; + public class VifAttachment extends Attachment { private final String type = "VifAttachment"; private String vifUuid; @@ -34,7 +39,7 @@ public class VifAttachment extends Attachment { return vifUuid; } - public void setVifUuid(String vifUuid) { + public void setVifUuid(final String vifUuid) { this.vifUuid = vifUuid; } @@ -42,4 +47,32 @@ public class VifAttachment extends Attachment { return type; } + + @Override + public String toString() { + return ReflectionToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE, false); + } + + @Override + public int hashCode() { + return new HashCodeBuilder(17, 31) + .append(this.getClass()) + .append(vifUuid) + .toHashCode(); + } + + @Override + public boolean equals(final Object obj) { + if (obj == null) { + return false; + } + if (obj == this) { + return true; + } + if (!(this.getClass().isInstance(obj))) { + return false; + } + final VifAttachment another = (VifAttachment) obj; + return new EqualsBuilder().append(vifUuid, another.vifUuid).isEquals(); + } } diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/resource/NiciraNvpResource.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/resource/NiciraNvpResource.java index c228b08d5ee..ec95ea5a1b1 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/resource/NiciraNvpResource.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/resource/NiciraNvpResource.java @@ -66,7 +66,7 @@ import com.cloud.host.Host.Type; import com.cloud.network.nicira.ControlClusterStatus; import com.cloud.network.nicira.DestinationNatRule; import com.cloud.network.nicira.L3GatewayAttachment; -import com.cloud.network.nicira.LogicalRouterConfig; +import com.cloud.network.nicira.LogicalRouter; import com.cloud.network.nicira.LogicalRouterPort; import com.cloud.network.nicira.LogicalSwitch; import com.cloud.network.nicira.LogicalSwitchPort; @@ -78,7 +78,7 @@ import com.cloud.network.nicira.NiciraNvpList; import com.cloud.network.nicira.NiciraNvpTag; import com.cloud.network.nicira.PatchAttachment; import com.cloud.network.nicira.RouterNextHop; -import com.cloud.network.nicira.SingleDefaultRouteImplictRoutingConfig; +import com.cloud.network.nicira.SingleDefaultRouteImplicitRoutingConfig; import com.cloud.network.nicira.SourceNatRule; import com.cloud.network.nicira.TransportZoneBinding; import com.cloud.network.nicira.VifAttachment; @@ -294,7 +294,7 @@ public class NiciraNvpResource implements ServerResource { LogicalSwitchPort logicalSwitchPort = new LogicalSwitchPort(attachmentUuid, tags, true); LogicalSwitchPort newPort = niciraNvpApi.createLogicalSwitchPort(logicalSwitchUuid, logicalSwitchPort); try { - niciraNvpApi.modifyLogicalSwitchPortAttachment(cmd.getLogicalSwitchUuid(), newPort.getUuid(), new VifAttachment(attachmentUuid)); + niciraNvpApi.updateLogicalSwitchPortAttachment(cmd.getLogicalSwitchUuid(), newPort.getUuid(), new VifAttachment(attachmentUuid)); } catch (NiciraNvpApiException ex) { s_logger.warn("modifyLogicalSwitchPort failed after switchport was created, removing switchport"); niciraNvpApi.deleteLogicalSwitchPort(cmd.getLogicalSwitchUuid(), newPort.getUuid()); @@ -334,7 +334,7 @@ public class NiciraNvpResource implements ServerResource { List tags = new ArrayList(); tags.add(new NiciraNvpTag("cs_account", cmd.getOwnerName())); - niciraNvpApi.modifyLogicalSwitchPortAttachment(logicalSwitchUuid, logicalSwitchPortUuid, new VifAttachment(attachmentUuid)); + niciraNvpApi.updateLogicalSwitchPortAttachment(logicalSwitchUuid, logicalSwitchPortUuid, new VifAttachment(attachmentUuid)); return new UpdateLogicalSwitchPortAnswer(cmd, true, "Attachment for " + logicalSwitchPortUuid + " updated", logicalSwitchPortUuid); } catch (NiciraNvpApiException e) { if (numRetries > 0) { @@ -383,10 +383,10 @@ public class NiciraNvpResource implements ServerResource { try { // Create the Router - LogicalRouterConfig lrc = new LogicalRouterConfig(); + LogicalRouter lrc = new LogicalRouter(); lrc.setDisplayName(truncate(routerName, NAME_MAX_LEN)); lrc.setTags(tags); - lrc.setRoutingConfig(new SingleDefaultRouteImplictRoutingConfig(new RouterNextHop(publicNetworkNextHopIp))); + lrc.setRoutingConfig(new SingleDefaultRouteImplicitRoutingConfig(new RouterNextHop(publicNetworkNextHopIp))); lrc = niciraNvpApi.createLogicalRouter(lrc); // store the switchport for rollback @@ -408,7 +408,7 @@ public class NiciraNvpResource implements ServerResource { if (cmd.getVlanId() != 0) { attachment.setVlanId(cmd.getVlanId()); } - niciraNvpApi.modifyLogicalRouterPortAttachment(lrc.getUuid(), lrpo.getUuid(), attachment); + niciraNvpApi.updateLogicalRouterPortAttachment(lrc.getUuid(), lrpo.getUuid(), attachment); // Create the inside port for the router LogicalRouterPort lrpi = new LogicalRouterPort(); @@ -425,10 +425,10 @@ public class NiciraNvpResource implements ServerResource { lsp = niciraNvpApi.createLogicalSwitchPort(logicalSwitchUuid, lsp); // Attach the inside router port to the lswitch port with a PatchAttachment - niciraNvpApi.modifyLogicalRouterPortAttachment(lrc.getUuid(), lrpi.getUuid(), new PatchAttachment(lsp.getUuid())); + niciraNvpApi.updateLogicalRouterPortAttachment(lrc.getUuid(), lrpi.getUuid(), new PatchAttachment(lsp.getUuid())); // Attach the inside lswitch port to the router with a PatchAttachment - niciraNvpApi.modifyLogicalSwitchPortAttachment(logicalSwitchUuid, lsp.getUuid(), new PatchAttachment(lrpi.getUuid())); + niciraNvpApi.updateLogicalSwitchPortAttachment(logicalSwitchUuid, lsp.getUuid(), new PatchAttachment(lrpi.getUuid())); // Setup the source nat rule SourceNatRule snr = new SourceNatRule(); @@ -484,7 +484,7 @@ public class NiciraNvpResource implements ServerResource { } LogicalRouterPort lrp = ports.getResults().get(0); lrp.setIpAddresses(cmd.getPublicCidrs()); - niciraNvpApi.modifyLogicalRouterPort(cmd.getLogicalRouterUuid(), lrp); + niciraNvpApi.updateLogicalRouterPort(cmd.getLogicalRouterUuid(), lrp); return new ConfigurePublicIpsOnLogicalRouterAnswer(cmd, true, "Configured " + cmd.getPublicCidrs().size() + " ip addresses on logical router uuid " + cmd.getLogicalRouterUuid()); diff --git a/plugins/network-elements/nicira-nvp/test/com/cloud/network/element/NiciraNvpElementTest.java b/plugins/network-elements/nicira-nvp/test/com/cloud/network/element/NiciraNvpElementTest.java index 822c8c7ee93..bf8ce18491d 100644 --- a/plugins/network-elements/nicira-nvp/test/com/cloud/network/element/NiciraNvpElementTest.java +++ b/plugins/network-elements/nicira-nvp/test/com/cloud/network/element/NiciraNvpElementTest.java @@ -104,7 +104,7 @@ public class NiciraNvpElementTest { @Test public void canHandleTest() { - Network net = mock(Network.class); + final Network net = mock(Network.class); when(net.getBroadcastDomainType()).thenReturn(BroadcastDomainType.Lswitch); when(net.getId()).thenReturn(NETWORK_ID); @@ -134,43 +134,43 @@ public class NiciraNvpElementTest { @Test public void implementTest() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { - Network network = mock(Network.class); + final Network network = mock(Network.class); when(network.getBroadcastDomainType()).thenReturn(BroadcastDomainType.Lswitch); when(network.getId()).thenReturn(NETWORK_ID); - NetworkOffering offering = mock(NetworkOffering.class); + final NetworkOffering offering = mock(NetworkOffering.class); when(offering.getId()).thenReturn(NETWORK_ID); when(offering.getTrafficType()).thenReturn(TrafficType.Guest); when(offering.getGuestType()).thenReturn(GuestType.Isolated); mock(DeployDestination.class); - Domain dom = mock(Domain.class); + final Domain dom = mock(Domain.class); when(dom.getName()).thenReturn("domain"); - Account acc = mock(Account.class); + final Account acc = mock(Account.class); when(acc.getAccountName()).thenReturn("accountname"); - ReservationContext context = mock(ReservationContext.class); + final ReservationContext context = mock(ReservationContext.class); when(context.getDomain()).thenReturn(dom); when(context.getAccount()).thenReturn(acc); } @Test public void applyIpTest() throws ResourceUnavailableException { - Network network = mock(Network.class); + final Network network = mock(Network.class); when(network.getBroadcastDomainType()).thenReturn(BroadcastDomainType.Lswitch); when(network.getId()).thenReturn(NETWORK_ID); when(network.getPhysicalNetworkId()).thenReturn(NETWORK_ID); - NetworkOffering offering = mock(NetworkOffering.class); + final NetworkOffering offering = mock(NetworkOffering.class); when(offering.getId()).thenReturn(NETWORK_ID); when(offering.getTrafficType()).thenReturn(TrafficType.Guest); when(offering.getGuestType()).thenReturn(GuestType.Isolated); - List ipAddresses = new ArrayList(); - PublicIpAddress pipReleased = mock(PublicIpAddress.class); - PublicIpAddress pipAllocated = mock(PublicIpAddress.class); - Ip ipReleased = new Ip("42.10.10.10"); - Ip ipAllocated = new Ip("10.10.10.10"); + final List ipAddresses = new ArrayList(); + final PublicIpAddress pipReleased = mock(PublicIpAddress.class); + final PublicIpAddress pipAllocated = mock(PublicIpAddress.class); + final Ip ipReleased = new Ip("42.10.10.10"); + final Ip ipAllocated = new Ip("10.10.10.10"); when(pipAllocated.getState()).thenReturn(IpAddress.State.Allocated); when(pipAllocated.getAddress()).thenReturn(ipAllocated); when(pipAllocated.getNetmask()).thenReturn("255.255.255.0"); @@ -180,25 +180,25 @@ public class NiciraNvpElementTest { ipAddresses.add(pipAllocated); ipAddresses.add(pipReleased); - Set services = new HashSet(); + final Set services = new HashSet(); services.add(Service.SourceNat); services.add(Service.StaticNat); services.add(Service.PortForwarding); - List deviceList = new ArrayList(); - NiciraNvpDeviceVO nndVO = mock(NiciraNvpDeviceVO.class); - NiciraNvpRouterMappingVO nnrmVO = mock(NiciraNvpRouterMappingVO.class); + final List deviceList = new ArrayList(); + final NiciraNvpDeviceVO nndVO = mock(NiciraNvpDeviceVO.class); + final NiciraNvpRouterMappingVO nnrmVO = mock(NiciraNvpRouterMappingVO.class); when(niciraNvpRouterMappingDao.findByNetworkId(NETWORK_ID)).thenReturn(nnrmVO); when(nnrmVO.getLogicalRouterUuid()).thenReturn("abcde"); when(nndVO.getHostId()).thenReturn(NETWORK_ID); - HostVO hvo = mock(HostVO.class); + final HostVO hvo = mock(HostVO.class); when(hvo.getId()).thenReturn(NETWORK_ID); when(hvo.getDetail("l3gatewayserviceuuid")).thenReturn("abcde"); when(hostDao.findById(NETWORK_ID)).thenReturn(hvo); deviceList.add(nndVO); when(niciraNvpDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(deviceList); - ConfigurePublicIpsOnLogicalRouterAnswer answer = mock(ConfigurePublicIpsOnLogicalRouterAnswer.class); + final ConfigurePublicIpsOnLogicalRouterAnswer answer = mock(ConfigurePublicIpsOnLogicalRouterAnswer.class); when(answer.getResult()).thenReturn(true); when(agentManager.easySend(eq(NETWORK_ID), any(ConfigurePublicIpsOnLogicalRouterCommand.class))).thenReturn(answer); @@ -206,8 +206,8 @@ public class NiciraNvpElementTest { verify(agentManager, atLeast(1)).easySend(eq(NETWORK_ID), argThat(new ArgumentMatcher() { @Override - public boolean matches(Object argument) { - ConfigurePublicIpsOnLogicalRouterCommand command = (ConfigurePublicIpsOnLogicalRouterCommand)argument; + public boolean matches(final Object argument) { + final ConfigurePublicIpsOnLogicalRouterCommand command = (ConfigurePublicIpsOnLogicalRouterCommand)argument; if (command.getPublicCidrs().size() == 1) return true; return false; diff --git a/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java b/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java index db8637ccfb6..fb103e8aaac 100644 --- a/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java +++ b/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java @@ -99,7 +99,7 @@ public class NiciraNvpGuestNetworkGuruTest { guru.agentMgr = agentmgr; guru.networkDao = netdao; - DataCenterVO dc = mock(DataCenterVO.class); + final DataCenterVO dc = mock(DataCenterVO.class); when(dc.getNetworkType()).thenReturn(NetworkType.Advanced); when(dc.getGuestNetworkCidr()).thenReturn("10.1.1.1/24"); @@ -108,12 +108,12 @@ public class NiciraNvpGuestNetworkGuruTest { @Test public void testCanHandle() { - NetworkOffering offering = mock(NetworkOffering.class); + final NetworkOffering offering = mock(NetworkOffering.class); when(offering.getId()).thenReturn(NETWORK_ID); when(offering.getTrafficType()).thenReturn(TrafficType.Guest); when(offering.getGuestType()).thenReturn(GuestType.Isolated); - PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class); + final PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class); when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] {"STT"})); when(physnet.getId()).thenReturn(NETWORK_ID); @@ -142,34 +142,34 @@ public class NiciraNvpGuestNetworkGuruTest { @Test public void testDesign() { - PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class); + final PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class); when(physnetdao.findById((Long)any())).thenReturn(physnet); when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] {"STT"})); when(physnet.getId()).thenReturn(NETWORK_ID); - NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class); + final NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class); when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] {device})); when(device.getId()).thenReturn(1L); - NetworkOffering offering = mock(NetworkOffering.class); + final NetworkOffering offering = mock(NetworkOffering.class); when(offering.getId()).thenReturn(NETWORK_ID); when(offering.getTrafficType()).thenReturn(TrafficType.Guest); when(offering.getGuestType()).thenReturn(GuestType.Isolated); when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(true); - DeploymentPlan plan = mock(DeploymentPlan.class); - Network network = mock(Network.class); - Account account = mock(Account.class); + final DeploymentPlan plan = mock(DeploymentPlan.class); + final Network network = mock(Network.class); + final Account account = mock(Account.class); - Network designednetwork = guru.design(offering, plan, network, account); + final Network designednetwork = guru.design(offering, plan, network, account); assertTrue(designednetwork != null); assertTrue(designednetwork.getBroadcastDomainType() == BroadcastDomainType.Lswitch); } @Test public void testDesignNoElementOnPhysicalNetwork() { - PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class); + final PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class); when(physnetdao.findById((Long)any())).thenReturn(physnet); when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] {"STT"})); when(physnet.getId()).thenReturn(NETWORK_ID); @@ -177,22 +177,22 @@ public class NiciraNvpGuestNetworkGuruTest { mock(NiciraNvpDeviceVO.class); when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Collections. emptyList()); - NetworkOffering offering = mock(NetworkOffering.class); + final NetworkOffering offering = mock(NetworkOffering.class); when(offering.getId()).thenReturn(NETWORK_ID); when(offering.getTrafficType()).thenReturn(TrafficType.Guest); when(offering.getGuestType()).thenReturn(GuestType.Isolated); - DeploymentPlan plan = mock(DeploymentPlan.class); - Network network = mock(Network.class); - Account account = mock(Account.class); + final DeploymentPlan plan = mock(DeploymentPlan.class); + final Network network = mock(Network.class); + final Account account = mock(Account.class); - Network designednetwork = guru.design(offering, plan, network, account); + final Network designednetwork = guru.design(offering, plan, network, account); assertTrue(designednetwork == null); } @Test public void testDesignNoIsolationMethodSTT() { - PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class); + final PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class); when(physnetdao.findById((Long)any())).thenReturn(physnet); when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] {"VLAN"})); when(physnet.getId()).thenReturn(NETWORK_ID); @@ -200,57 +200,57 @@ public class NiciraNvpGuestNetworkGuruTest { mock(NiciraNvpDeviceVO.class); when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Collections. emptyList()); - NetworkOffering offering = mock(NetworkOffering.class); + final NetworkOffering offering = mock(NetworkOffering.class); when(offering.getId()).thenReturn(NETWORK_ID); when(offering.getTrafficType()).thenReturn(TrafficType.Guest); when(offering.getGuestType()).thenReturn(GuestType.Isolated); - DeploymentPlan plan = mock(DeploymentPlan.class); - Network network = mock(Network.class); - Account account = mock(Account.class); + final DeploymentPlan plan = mock(DeploymentPlan.class); + final Network network = mock(Network.class); + final Account account = mock(Account.class); - Network designednetwork = guru.design(offering, plan, network, account); + final Network designednetwork = guru.design(offering, plan, network, account); assertTrue(designednetwork == null); } @Test public void testDesignNoConnectivityInOffering() { - PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class); + final PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class); when(physnetdao.findById((Long)any())).thenReturn(physnet); when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] {"STT"})); when(physnet.getId()).thenReturn(NETWORK_ID); - NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class); + final NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class); when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] {device})); when(device.getId()).thenReturn(1L); - NetworkOffering offering = mock(NetworkOffering.class); + final NetworkOffering offering = mock(NetworkOffering.class); when(offering.getId()).thenReturn(NETWORK_ID); when(offering.getTrafficType()).thenReturn(TrafficType.Guest); when(offering.getGuestType()).thenReturn(GuestType.Isolated); when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(false); - DeploymentPlan plan = mock(DeploymentPlan.class); - Network network = mock(Network.class); - Account account = mock(Account.class); + final DeploymentPlan plan = mock(DeploymentPlan.class); + final Network network = mock(Network.class); + final Account account = mock(Account.class); - Network designednetwork = guru.design(offering, plan, network, account); + final Network designednetwork = guru.design(offering, plan, network, account); assertTrue(designednetwork == null); } @Test public void testImplement() throws InsufficientVirtualNetworkCapcityException { - PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class); + final PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class); when(physnetdao.findById((Long)any())).thenReturn(physnet); when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] {"STT"})); when(physnet.getId()).thenReturn(NETWORK_ID); - NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class); + final NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class); when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] {device})); when(device.getId()).thenReturn(1L); - NetworkOffering offering = mock(NetworkOffering.class); + final NetworkOffering offering = mock(NetworkOffering.class); when(offering.getId()).thenReturn(NETWORK_ID); when(offering.getTrafficType()).thenReturn(TrafficType.Guest); when(offering.getGuestType()).thenReturn(GuestType.Isolated); @@ -259,53 +259,53 @@ public class NiciraNvpGuestNetworkGuruTest { mock(DeploymentPlan.class); - NetworkVO network = mock(NetworkVO.class); + final NetworkVO network = mock(NetworkVO.class); when(network.getName()).thenReturn("testnetwork"); when(network.getState()).thenReturn(State.Implementing); when(network.getPhysicalNetworkId()).thenReturn(NETWORK_ID); - DeployDestination dest = mock(DeployDestination.class); + final DeployDestination dest = mock(DeployDestination.class); - DataCenter dc = mock(DataCenter.class); + final DataCenter dc = mock(DataCenter.class); when(dest.getDataCenter()).thenReturn(dc); - HostVO niciraHost = mock(HostVO.class); + final HostVO niciraHost = mock(HostVO.class); when(hostdao.findById(anyLong())).thenReturn(niciraHost); when(niciraHost.getDetail("transportzoneuuid")).thenReturn("aaaa"); when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt"); when(niciraHost.getId()).thenReturn(NETWORK_ID); when(netmodel.findPhysicalNetworkId(anyLong(), (String)any(), (TrafficType)any())).thenReturn(NETWORK_ID); - Domain dom = mock(Domain.class); + final Domain dom = mock(Domain.class); when(dom.getName()).thenReturn("domain"); - Account acc = mock(Account.class); + final Account acc = mock(Account.class); when(acc.getAccountName()).thenReturn("accountname"); - ReservationContext res = mock(ReservationContext.class); + final ReservationContext res = mock(ReservationContext.class); when(res.getDomain()).thenReturn(dom); when(res.getAccount()).thenReturn(acc); - CreateLogicalSwitchAnswer answer = mock(CreateLogicalSwitchAnswer.class); + final CreateLogicalSwitchAnswer answer = mock(CreateLogicalSwitchAnswer.class); when(answer.getResult()).thenReturn(true); when(answer.getLogicalSwitchUuid()).thenReturn("aaaaa"); when(agentmgr.easySend(eq(NETWORK_ID), (Command)any())).thenReturn(answer); - Network implementednetwork = guru.implement(network, offering, dest, res); + final Network implementednetwork = guru.implement(network, offering, dest, res); assertTrue(implementednetwork != null); verify(agentmgr, times(1)).easySend(eq(NETWORK_ID), (Command)any()); } @Test public void testImplementWithCidr() throws InsufficientVirtualNetworkCapcityException { - PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class); + final PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class); when(physnetdao.findById((Long)any())).thenReturn(physnet); when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] {"STT"})); when(physnet.getId()).thenReturn(NETWORK_ID); - NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class); + final NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class); when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] {device})); when(device.getId()).thenReturn(1L); - NetworkOffering offering = mock(NetworkOffering.class); + final NetworkOffering offering = mock(NetworkOffering.class); when(offering.getId()).thenReturn(NETWORK_ID); when(offering.getTrafficType()).thenReturn(TrafficType.Guest); when(offering.getGuestType()).thenReturn(GuestType.Isolated); @@ -314,39 +314,39 @@ public class NiciraNvpGuestNetworkGuruTest { mock(DeploymentPlan.class); - NetworkVO network = mock(NetworkVO.class); + final NetworkVO network = mock(NetworkVO.class); when(network.getName()).thenReturn("testnetwork"); when(network.getState()).thenReturn(State.Implementing); when(network.getGateway()).thenReturn("10.1.1.1"); when(network.getCidr()).thenReturn("10.1.1.0/24"); when(network.getPhysicalNetworkId()).thenReturn(NETWORK_ID); - DeployDestination dest = mock(DeployDestination.class); + final DeployDestination dest = mock(DeployDestination.class); - DataCenter dc = mock(DataCenter.class); + final DataCenter dc = mock(DataCenter.class); when(dest.getDataCenter()).thenReturn(dc); - HostVO niciraHost = mock(HostVO.class); + final HostVO niciraHost = mock(HostVO.class); when(hostdao.findById(anyLong())).thenReturn(niciraHost); when(niciraHost.getDetail("transportzoneuuid")).thenReturn("aaaa"); when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt"); when(niciraHost.getId()).thenReturn(NETWORK_ID); when(netmodel.findPhysicalNetworkId(anyLong(), (String)any(), (TrafficType)any())).thenReturn(NETWORK_ID); - Domain dom = mock(Domain.class); + final Domain dom = mock(Domain.class); when(dom.getName()).thenReturn("domain"); - Account acc = mock(Account.class); + final Account acc = mock(Account.class); when(acc.getAccountName()).thenReturn("accountname"); - ReservationContext res = mock(ReservationContext.class); + final ReservationContext res = mock(ReservationContext.class); when(res.getDomain()).thenReturn(dom); when(res.getAccount()).thenReturn(acc); - CreateLogicalSwitchAnswer answer = mock(CreateLogicalSwitchAnswer.class); + final CreateLogicalSwitchAnswer answer = mock(CreateLogicalSwitchAnswer.class); when(answer.getResult()).thenReturn(true); when(answer.getLogicalSwitchUuid()).thenReturn("aaaaa"); when(agentmgr.easySend(eq(NETWORK_ID), (Command)any())).thenReturn(answer); - Network implementednetwork = guru.implement(network, offering, dest, res); + final Network implementednetwork = guru.implement(network, offering, dest, res); assertTrue(implementednetwork != null); assertTrue(implementednetwork.getCidr().equals("10.1.1.0/24")); assertTrue(implementednetwork.getGateway().equals("10.1.1.1")); @@ -355,16 +355,16 @@ public class NiciraNvpGuestNetworkGuruTest { @Test public void testImplementURIException() throws InsufficientVirtualNetworkCapcityException { - PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class); + final PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class); when(physnetdao.findById((Long)any())).thenReturn(physnet); when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] {"STT"})); when(physnet.getId()).thenReturn(NETWORK_ID); - NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class); + final NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class); when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] {device})); when(device.getId()).thenReturn(1L); - NetworkOffering offering = mock(NetworkOffering.class); + final NetworkOffering offering = mock(NetworkOffering.class); when(offering.getId()).thenReturn(NETWORK_ID); when(offering.getTrafficType()).thenReturn(TrafficType.Guest); when(offering.getGuestType()).thenReturn(GuestType.Isolated); @@ -373,53 +373,53 @@ public class NiciraNvpGuestNetworkGuruTest { mock(DeploymentPlan.class); - NetworkVO network = mock(NetworkVO.class); + final NetworkVO network = mock(NetworkVO.class); when(network.getName()).thenReturn("testnetwork"); when(network.getState()).thenReturn(State.Implementing); when(network.getPhysicalNetworkId()).thenReturn(NETWORK_ID); - DeployDestination dest = mock(DeployDestination.class); + final DeployDestination dest = mock(DeployDestination.class); - DataCenter dc = mock(DataCenter.class); + final DataCenter dc = mock(DataCenter.class); when(dest.getDataCenter()).thenReturn(dc); - HostVO niciraHost = mock(HostVO.class); + final HostVO niciraHost = mock(HostVO.class); when(hostdao.findById(anyLong())).thenReturn(niciraHost); when(niciraHost.getDetail("transportzoneuuid")).thenReturn("aaaa"); when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt"); when(niciraHost.getId()).thenReturn(NETWORK_ID); when(netmodel.findPhysicalNetworkId(anyLong(), (String)any(), (TrafficType)any())).thenReturn(NETWORK_ID); - Domain dom = mock(Domain.class); + final Domain dom = mock(Domain.class); when(dom.getName()).thenReturn("domain"); - Account acc = mock(Account.class); + final Account acc = mock(Account.class); when(acc.getAccountName()).thenReturn("accountname"); - ReservationContext res = mock(ReservationContext.class); + final ReservationContext res = mock(ReservationContext.class); when(res.getDomain()).thenReturn(dom); when(res.getAccount()).thenReturn(acc); - CreateLogicalSwitchAnswer answer = mock(CreateLogicalSwitchAnswer.class); + final CreateLogicalSwitchAnswer answer = mock(CreateLogicalSwitchAnswer.class); when(answer.getResult()).thenReturn(true); //when(answer.getLogicalSwitchUuid()).thenReturn("aaaaa"); when(agentmgr.easySend(eq(NETWORK_ID), (Command)any())).thenReturn(answer); - Network implementednetwork = guru.implement(network, offering, dest, res); + final Network implementednetwork = guru.implement(network, offering, dest, res); assertTrue(implementednetwork == null); verify(agentmgr, times(1)).easySend(eq(NETWORK_ID), (Command)any()); } @Test public void testShutdown() throws InsufficientVirtualNetworkCapcityException, URISyntaxException { - PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class); + final PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class); when(physnetdao.findById((Long)any())).thenReturn(physnet); when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] {"STT"})); when(physnet.getId()).thenReturn(NETWORK_ID); - NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class); + final NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class); when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] {device})); when(device.getId()).thenReturn(1L); - NetworkOffering offering = mock(NetworkOffering.class); + final NetworkOffering offering = mock(NetworkOffering.class); when(offering.getId()).thenReturn(NETWORK_ID); when(offering.getTrafficType()).thenReturn(TrafficType.Guest); when(offering.getGuestType()).thenReturn(GuestType.Isolated); @@ -428,7 +428,7 @@ public class NiciraNvpGuestNetworkGuruTest { mock(DeploymentPlan.class); - NetworkVO network = mock(NetworkVO.class); + final NetworkVO network = mock(NetworkVO.class); when(network.getName()).thenReturn("testnetwork"); when(network.getState()).thenReturn(State.Implementing); when(network.getBroadcastDomainType()).thenReturn(BroadcastDomainType.Lswitch); @@ -436,31 +436,31 @@ public class NiciraNvpGuestNetworkGuruTest { when(network.getPhysicalNetworkId()).thenReturn(NETWORK_ID); when(netdao.findById(NETWORK_ID)).thenReturn(network); - DeployDestination dest = mock(DeployDestination.class); + final DeployDestination dest = mock(DeployDestination.class); - DataCenter dc = mock(DataCenter.class); + final DataCenter dc = mock(DataCenter.class); when(dest.getDataCenter()).thenReturn(dc); - HostVO niciraHost = mock(HostVO.class); + final HostVO niciraHost = mock(HostVO.class); when(hostdao.findById(anyLong())).thenReturn(niciraHost); when(niciraHost.getDetail("transportzoneuuid")).thenReturn("aaaa"); when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt"); when(niciraHost.getId()).thenReturn(NETWORK_ID); when(netmodel.findPhysicalNetworkId(anyLong(), (String)any(), (TrafficType)any())).thenReturn(NETWORK_ID); - Domain dom = mock(Domain.class); + final Domain dom = mock(Domain.class); when(dom.getName()).thenReturn("domain"); - Account acc = mock(Account.class); + final Account acc = mock(Account.class); when(acc.getAccountName()).thenReturn("accountname"); - ReservationContext res = mock(ReservationContext.class); + final ReservationContext res = mock(ReservationContext.class); when(res.getDomain()).thenReturn(dom); when(res.getAccount()).thenReturn(acc); - DeleteLogicalSwitchAnswer answer = mock(DeleteLogicalSwitchAnswer.class); + final DeleteLogicalSwitchAnswer answer = mock(DeleteLogicalSwitchAnswer.class); when(answer.getResult()).thenReturn(true); when(agentmgr.easySend(eq(NETWORK_ID), (Command)any())).thenReturn(answer); - NetworkProfile implementednetwork = mock(NetworkProfile.class); + final NetworkProfile implementednetwork = mock(NetworkProfile.class); when(implementednetwork.getId()).thenReturn(NETWORK_ID); when(implementednetwork.getBroadcastUri()).thenReturn(new URI("lswitch:aaaa")); when(offering.getSpecifyVlan()).thenReturn(false); diff --git a/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NatRuleTest.java b/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NatRuleTest.java index 84b28fb8da8..d4c65969ec0 100644 --- a/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NatRuleTest.java +++ b/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NatRuleTest.java @@ -31,22 +31,22 @@ public class NatRuleTest { @Test public void testNatRuleEncoding() { - Gson gson = - new GsonBuilder().registerTypeAdapter(NatRule.class, new com.cloud.network.nicira.NiciraNvpApi.NatRuleAdapter()) + final Gson gson = + new GsonBuilder().registerTypeAdapter(NatRule.class, new NiciraNvpApi.NatRuleAdapter()) .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES) .create(); - DestinationNatRule rn1 = new DestinationNatRule(); + final DestinationNatRule rn1 = new DestinationNatRule(); rn1.setToDestinationIpAddress("10.10.10.10"); rn1.setToDestinationPort(80); - Match mr1 = new Match(); + final Match mr1 = new Match(); mr1.setSourceIpAddresses("11.11.11.11/24"); mr1.setEthertype("IPv4"); mr1.setProtocol(6); rn1.setMatch(mr1); - String jsonString = gson.toJson(rn1); - NatRule dnr = gson.fromJson(jsonString, NatRule.class); + final String jsonString = gson.toJson(rn1); + final NatRule dnr = gson.fromJson(jsonString, NatRule.class); assertTrue(dnr instanceof DestinationNatRule); assertTrue(rn1.equals(dnr)); diff --git a/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraNvpApiIT.java b/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraNvpApiIT.java index 7f8f471595a..ec4ce092700 100644 --- a/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraNvpApiIT.java +++ b/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraNvpApiIT.java @@ -19,14 +19,15 @@ package com.cloud.network.nicira; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Properties; +import java.util.UUID; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -84,22 +85,22 @@ public class NiciraNvpApiIT { scInList = iProfile; } } - Assert.assertEquals("Read a Security Profile different from the one just created and updated", + assertEquals("Read a Security Profile different from the one just created and updated", sProfile, scInList); // Read them filtered by uuid (get one) profiles = api.findSecurityProfile(sProfile.getUuid()); - Assert.assertEquals("Read a Security Profile different from the one just created and updated", + assertEquals("Read a Security Profile different from the one just created and updated", sProfile, profiles.getResults().get(0)); - Assert.assertEquals("Read a Security Profile filtered by unique id (UUID) with more than one item", + assertEquals("Read a Security Profile filtered by unique id (UUID) with more than one item", 1, profiles.getResults().size()); // We can now delete the new entity api.deleteSecurityProfile(sProfile.getUuid()); } catch (final NiciraNvpApiException e) { e.printStackTrace(); - assertTrue("Errors creating Security Profile", false); + assertTrue("Errors in Security Profile CRUD", false); } } @@ -145,22 +146,203 @@ public class NiciraNvpApiIT { scInList = iAcl; } } - Assert.assertEquals("Read a ACL different from the one just created and updated", + assertEquals("Read a ACL different from the one just created and updated", acl, scInList); // Read them filtered by uuid (get one) acls = api.findAcl(acl.getUuid()); - Assert.assertEquals("Read a ACL different from the one just created and updated", + assertEquals("Read a ACL different from the one just created and updated", acl, acls.getResults().get(0)); - Assert.assertEquals("Read a ACL filtered by unique id (UUID) with more than one item", + assertEquals("Read a ACL filtered by unique id (UUID) with more than one item", 1, acls.getResults().size()); // We can now delete the new entity api.deleteAcl(acl.getUuid()); } catch (final NiciraNvpApiException e) { e.printStackTrace(); - assertTrue("Errors creating ACL", false); + assertTrue("Errors in ACL CRUD", false); } } + + @Test + public void testCRUDLogicalSwitch() throws NiciraNvpApiException { + LogicalSwitch logicalSwitch = new LogicalSwitch(); + logicalSwitch.setDisplayName("LogicalSwitch"+timestamp); + logicalSwitch.setPortIsolationEnabled(true); + logicalSwitch.setReplicationMode("service"); + logicalSwitch.setTags(new ArrayList()); + logicalSwitch.getTags().add(new NiciraNvpTag("anto", "hugo")); + + // In the creation we don't get to specify UUID, href or schema: they don't exist yet + + try { + logicalSwitch = api.createLogicalSwitch(logicalSwitch); + + // We can now update the new entity + logicalSwitch.setDisplayName("UpdatedLogicalSwitch"+timestamp); + api.updateLogicalSwitch(logicalSwitch, logicalSwitch.getUuid()); + + // Read them all + NiciraNvpList logicalSwitches = api.findLogicalSwitch(); + for(final LogicalSwitch iLogicalSwitch : logicalSwitches.getResults()) { + if (iLogicalSwitch.getUuid().equalsIgnoreCase(logicalSwitch.getUuid())) { + assertEquals("Read a LogicalSwitch different from the one just created and updated", + logicalSwitch, iLogicalSwitch); + } + } + + // Read them filtered by uuid (get one) + logicalSwitches = api.findLogicalSwitch(logicalSwitch.getUuid()); + assertEquals("Read a LogicalSwitch different from the one just created and updated", + logicalSwitch, + logicalSwitches.getResults().get(0)); + assertEquals("Read a LogicalSwitch filtered by unique id (UUID) with more than one item", + 1, logicalSwitches.getResults().size()); + + // Before deleting the test LogicalSwitch, test its ports + final List tags = new ArrayList(); + tags.add(new NiciraNvpTag("cs_account", "OwnerName")); + + LogicalSwitchPort logicalSwitchPort = new LogicalSwitchPort("LSwitchPort"+timestamp, tags, true); + logicalSwitchPort = api.createLogicalSwitchPort(logicalSwitch.getUuid(), logicalSwitchPort); + + logicalSwitchPort.setDisplayName("UpdatedLSwitchPort"+timestamp); + api.updateLogicalSwitchPort(logicalSwitch.getUuid(), logicalSwitchPort); + + final NiciraNvpList logicalSwitchePorts = + api.findLogicalSwitchPortsByUuid(logicalSwitch.getUuid(), logicalSwitchPort.getUuid()); + for(final LogicalSwitchPort iLSwitchPort : logicalSwitchePorts.getResults()) { + if (iLSwitchPort.getUuid().equalsIgnoreCase(logicalSwitchPort.getUuid())) { + assertEquals("Read a LogicalSwitchPort different from the one just created and updated", + logicalSwitchPort, iLSwitchPort); + } + } + + // And finally test attachments + final String attachmentUuid = UUID.randomUUID().toString(); + final VifAttachment vifAttachment = new VifAttachment(attachmentUuid); + api.updateLogicalSwitchPortAttachment(logicalSwitch.getUuid(), logicalSwitchPort.getUuid(), + vifAttachment); + + assertEquals("Read a LogicalSwitchPort by vifAttachment different than expected", + api.findLogicalSwitchPortUuidByVifAttachmentUuid(logicalSwitch.getUuid(), vifAttachment.getVifUuid()), + logicalSwitchPort.getUuid()); + + api.deleteLogicalSwitchPort(logicalSwitch.getUuid(), logicalSwitchPort.getUuid()); + + // We can now delete the new entity + api.deleteLogicalSwitch(logicalSwitch.getUuid()); + } catch (final NiciraNvpApiException e) { + e.printStackTrace(); + assertTrue("Errors in LogicalSwitch CRUD", false); + } + } + + @Test + public void testCRUDLogicalRouter() throws NiciraNvpApiException { + LogicalRouter logicalRouter = new LogicalRouter(); + logicalRouter.setDisplayName("LogicalRouter"+timestamp); + logicalRouter.setDistributed(true); + logicalRouter.setNatSynchronizationEnabled(true); + logicalRouter.setReplicationMode(LogicalRouter.REPLICATION_MODE_SERVICE); + final RoutingConfig routingConfig = new SingleDefaultRouteImplicitRoutingConfig( + new RouterNextHop("192.168.10.20")); + logicalRouter.setRoutingConfig(routingConfig); + + // In the creation we don't get to specify UUID, href or schema: they don't exist yet + + try { + logicalRouter = api.createLogicalRouter(logicalRouter); + + // We can now update the new entity + logicalRouter.setDisplayName("UpdatedLogicalSwitch"+timestamp); + api.updateLogicalRouter(logicalRouter, logicalRouter.getUuid()); + + // Read them all + NiciraNvpList logicalRouters = api.findLogicalRouter(); + LogicalRouter lsInList = null; + for(final LogicalRouter iLogicalRouter : logicalRouters.getResults()) { + if (iLogicalRouter.getUuid().equalsIgnoreCase(logicalRouter.getUuid())) { + lsInList = iLogicalRouter; + } + } + assertEquals("Read a LogicalRouter different from the one just created and updated", + logicalRouter, lsInList); + + // Read them filtered by uuid (get one) + logicalRouters = api.findLogicalRouter(logicalRouter.getUuid()); + assertEquals("Read a LogicalRouter different from the one just created and updated", + logicalRouter, + logicalRouters.getResults().get(0)); + assertEquals("Read a LogicalRouter filtered by unique id (UUID) with more than one item", + 1, logicalRouters.getResults().size()); + + assertEquals("", logicalRouters.getResults().get(0), + api.findOneLogicalRouterByUuid(logicalRouter.getUuid())); + + // Before deleting the test LogicalRouter, test its ports + final List tags = new ArrayList(); + tags.add(new NiciraNvpTag("cs_account", "OwnerName")); + + LogicalRouterPort logicalRouterPort = new LogicalRouterPort(); + logicalRouterPort.setDisplayName("LRouterPort"+timestamp); + logicalRouterPort.setTags(tags); + logicalRouterPort.setAdminStatusEnabled(true); + logicalRouterPort.setPortno(1024); + logicalRouterPort.setMacAddress("00:00:00:00:00:00"); + + final List ipAddresses = new ArrayList(); + // Add some ips to this list + logicalRouterPort.setIpAddresses(ipAddresses); + logicalRouterPort = api.createLogicalRouterPort(logicalRouter.getUuid(), logicalRouterPort); + + logicalRouterPort.setDisplayName("UpdatedLRouterPort"+timestamp); + api.updateLogicalRouterPort(logicalRouter.getUuid(), logicalRouterPort); + + final NiciraNvpList logicalRouterePorts = + api.findLogicalRouterPortsByUuid(logicalRouter.getUuid(), logicalRouterPort.getUuid()); + for(final LogicalRouterPort iLRouterPort : logicalRouterePorts.getResults()) { + if (iLRouterPort.getUuid().equalsIgnoreCase(logicalRouterPort.getUuid())) { + assertEquals("Read a LogicalRouterPort different from the one just created and updated", + logicalRouterPort, iLRouterPort); + } + } + + UUID.randomUUID().toString(); + + // Test CRUD for Nat Rules + SourceNatRule snr = new SourceNatRule(); + snr.setToSourceIpAddressMin("192.168.10.10"); + snr.setToSourceIpAddressMax("192.168.10.20"); + snr.setOrder(200); + final Match match = new Match(); + match.setSourceIpAddresses("192.168.150.150"); + snr.setMatch(match); + snr = (SourceNatRule) api.createLogicalRouterNatRule(logicalRouter.getUuid(), snr); + snr.setToSourceIpAddressMax("192.168.10.30"); + api.updateLogicalRouterNatRule(logicalRouter.getUuid(), snr); + + api.findNatRulesByLogicalRouterUuid(logicalRouter.getUuid()); + api.deleteLogicalRouterNatRule(logicalRouter.getUuid(), snr.getUuid()); + + api.deleteLogicalRouterPort(logicalRouter.getUuid(), logicalRouterPort.getUuid()); + + // We can now delete the new entity + api.deleteLogicalRouter(logicalRouter.getUuid()); + } catch (final NiciraNvpApiException e) { + e.printStackTrace(); + assertTrue("Errors in LogicalRouter CRUD", false); + } + } + + @Test + public void testGetControlClusterStatus() throws NiciraNvpApiException { + final ControlClusterStatus controlClusterStatus = api.getControlClusterStatus(); + final String clusterStatus = controlClusterStatus.getClusterStatus(); + final boolean correctStatus = (clusterStatus.equalsIgnoreCase("stable") || + clusterStatus.equalsIgnoreCase("joining") || clusterStatus.equalsIgnoreCase("unstable")); + assertTrue("Not recognizable cluster status", correctStatus); + } + } diff --git a/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraNvpApiTest.java b/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraNvpApiTest.java index 13d970c1cbc..51964bf0919 100644 --- a/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraNvpApiTest.java +++ b/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraNvpApiTest.java @@ -19,31 +19,32 @@ package com.cloud.network.nicira; -import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.io.IOException; -import java.util.Collections; -import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpException; import org.apache.commons.httpclient.HttpMethod; +import org.apache.commons.httpclient.HttpStatus; +import org.apache.commons.httpclient.NameValuePair; import org.apache.commons.httpclient.methods.DeleteMethod; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.httpclient.methods.PutMethod; import org.apache.commons.httpclient.params.HttpClientParams; -import org.apache.commons.httpclient.NameValuePair; -import org.apache.http.HttpStatus; import org.junit.Before; import org.junit.Test; +import com.google.gson.Gson; +import com.google.gson.JsonParseException; + +import com.cloud.utils.rest.RESTServiceConnector; +import com.cloud.utils.rest.RESTValidationStrategy; + public class NiciraNvpApiTest { protected static final String UUID = "aaaa"; protected static final String UUID2 = "bbbb"; @@ -52,8 +53,6 @@ public class NiciraNvpApiTest { protected static final String SCHEMA2 = "myTestSchema2"; protected static final String HREF = "myTestHref"; protected static final String HREF2 = "myTestHref2"; - protected static final String DISPLAY_NAME = "myTestName"; - protected static final String UUID_JSON_RESPONSE = "{\"uuid\" : \"aaaa\"}"; protected static final String SEC_PROFILE_JSON_RESPONSE = "{\"uuid\" : \"aaaa\"," + "\"display_name\" : \"myTestName\"," @@ -80,267 +79,26 @@ public class NiciraNvpApiTest { public void setUp() { final HttpClientParams hmp = mock(HttpClientParams.class); when(client.getParams()).thenReturn(hmp); - api = new NiciraNvpApi() { + api = new NiciraNvpApi(); + + api.restConnector = new RESTServiceConnector(new RESTValidationStrategy()) { @Override - protected HttpClient createHttpClient() { + public HttpClient createHttpClient() { return client; } @Override - protected HttpMethod createMethod(final String newType, final String newUri) { + public HttpMethod createMethod(final String newType, final String newUri) { type = newType; uri = newUri; return method; } }; + api.setAdminCredentials("admin", "adminpass"); api.setControllerAddress("localhost"); } - @Test(expected = NiciraNvpApiException.class) - public void testExecuteLoginWithoutHostname() throws NiciraNvpApiException { - api.setControllerAddress(null); - api.login(); - } - - @Test(expected = NiciraNvpApiException.class) - public void testExecuteLoginWithoutCredentials() throws NiciraNvpApiException { - api.setAdminCredentials(null, null); - api.login(); - } - - @Test(expected = NiciraNvpApiException.class) - public void testExecuteUpdateObjectWithoutHostname() throws NiciraNvpApiException { - api.setControllerAddress(null); - api.executeUpdateObject(new String(), "/", Collections. emptyMap()); - } - - @Test(expected = NiciraNvpApiException.class) - public void testExecuteUpdateObjectWithoutCredentials() throws NiciraNvpApiException { - api.setAdminCredentials(null, null); - api.executeUpdateObject(new String(), "/", Collections. emptyMap()); - } - - @Test(expected = NiciraNvpApiException.class) - public void testExecuteCreateObjectWithoutHostname() throws NiciraNvpApiException { - api.setControllerAddress(null); - api.executeCreateObject(new String(), String.class, "/", Collections. emptyMap()); - } - - @Test(expected = NiciraNvpApiException.class) - public void testExecuteCreateObjectWithoutCredentials() throws NiciraNvpApiException { - api.setAdminCredentials(null, null); - api.executeCreateObject(new String(), String.class, "/", Collections. emptyMap()); - } - - @Test(expected = NiciraNvpApiException.class) - public void testExecuteDeleteObjectWithoutHostname() throws NiciraNvpApiException { - api.setControllerAddress(null); - api.executeDeleteObject("/"); - } - - @Test(expected = NiciraNvpApiException.class) - public void testExecuteDeleteObjectWithoutCredentials() throws NiciraNvpApiException { - api.setAdminCredentials(null, null); - api.executeDeleteObject("/"); - } - - @Test(expected = NiciraNvpApiException.class) - public void testExecuteRetrieveObjectWithoutHostname() throws NiciraNvpApiException { - api.setControllerAddress(null); - api.executeRetrieveObject(String.class, "/", Collections. emptyMap()); - } - - @Test(expected = NiciraNvpApiException.class) - public void testExecuteRetrieveObjectWithoutCredentials() throws NiciraNvpApiException { - api.setAdminCredentials(null, null); - api.executeDeleteObject("/"); - } - - @Test - public void executeMethodTest() throws NiciraNvpApiException { - final GetMethod gm = mock(GetMethod.class); - - when(gm.getStatusCode()).thenReturn(HttpStatus.SC_OK); - api.executeMethod(gm); - verify(gm, times(1)).getStatusCode(); - } - - /* Bit of a roundabout way to ensure that login is called after an un authorized result - * It not possible to properly mock login() - */ - @Test(expected = NiciraNvpApiException.class) - public void executeMethodTestWithLogin() throws NiciraNvpApiException, HttpException, IOException { - final GetMethod gm = mock(GetMethod.class); - when(client.executeMethod((HttpMethod)any())).thenThrow(new HttpException()); - when(gm.getStatusCode()).thenReturn(HttpStatus.SC_UNAUTHORIZED).thenReturn(HttpStatus.SC_UNAUTHORIZED); - api.executeMethod(gm); - verify(gm, times(1)).getStatusCode(); - } - - @Test - public void testExecuteCreateObject() throws NiciraNvpApiException, IOException { - LogicalSwitch ls = new LogicalSwitch(); - method = mock(PostMethod.class); - when(method.getStatusCode()).thenReturn(HttpStatus.SC_CREATED); - when(method.getResponseBodyAsString()).thenReturn(UUID_JSON_RESPONSE); - ls = api.executeCreateObject(ls, LogicalSwitch.class, "/", Collections. emptyMap()); - assertTrue(UUID.equals(ls.getUuid())); - verify(method, times(1)).releaseConnection(); - - } - - @Test(expected = NiciraNvpApiException.class) - public void testExecuteCreateObjectFailure() throws NiciraNvpApiException, IOException { - LogicalSwitch ls = new LogicalSwitch(); - method = mock(PostMethod.class); - when(method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR); - final Header header = mock(Header.class); - when(header.getValue()).thenReturn("text/html"); - when(method.getResponseHeader("Content-Type")).thenReturn(header); - when(method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later."); - when(method.isRequestSent()).thenReturn(true); - try { - ls = api.executeCreateObject(ls, LogicalSwitch.class, "/", Collections. emptyMap()); - } finally { - verify(method, times(1)).releaseConnection(); - } - } - - @Test(expected = NiciraNvpApiException.class) - public void testExecuteCreateObjectException() throws NiciraNvpApiException, IOException { - LogicalSwitch ls = new LogicalSwitch(); - when(client.executeMethod((HttpMethod)any())).thenThrow(new HttpException()); - method = mock(PostMethod.class); - when(method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR); - final Header header = mock(Header.class); - when(header.getValue()).thenReturn("text/html"); - when(method.getResponseHeader("Content-Type")).thenReturn(header); - when(method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later."); - try { - ls = api.executeCreateObject(ls, LogicalSwitch.class, "/", Collections. emptyMap()); - } finally { - verify(method, times(1)).releaseConnection(); - } - } - - @Test - public void testExecuteUpdateObject() throws NiciraNvpApiException, IOException { - final LogicalSwitch ls = new LogicalSwitch(); - method = mock(PutMethod.class); - when(method.getStatusCode()).thenReturn(HttpStatus.SC_OK); - api.executeUpdateObject(ls, "/", Collections. emptyMap()); - verify(method, times(1)).releaseConnection(); - verify(client, times(1)).executeMethod(method); - } - - @Test(expected = NiciraNvpApiException.class) - public void testExecuteUpdateObjectFailure() throws NiciraNvpApiException, IOException { - final LogicalSwitch ls = new LogicalSwitch(); - method = mock(PutMethod.class); - when(method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR); - final Header header = mock(Header.class); - when(header.getValue()).thenReturn("text/html"); - when(method.getResponseHeader("Content-Type")).thenReturn(header); - when(method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later."); - when(method.isRequestSent()).thenReturn(true); - try { - api.executeUpdateObject(ls, "/", Collections. emptyMap()); - } finally { - verify(method, times(1)).releaseConnection(); - } - } - - @Test(expected = NiciraNvpApiException.class) - public void testExecuteUpdateObjectException() throws NiciraNvpApiException, IOException { - final LogicalSwitch ls = new LogicalSwitch(); - method = mock(PutMethod.class); - when(method.getStatusCode()).thenReturn(HttpStatus.SC_OK); - when(client.executeMethod((HttpMethod)any())).thenThrow(new IOException()); - try { - api.executeUpdateObject(ls, "/", Collections. emptyMap()); - } finally { - verify(method, times(1)).releaseConnection(); - } - } - - @Test - public void testExecuteDeleteObject() throws NiciraNvpApiException, IOException { - method = mock(DeleteMethod.class); - when(method.getStatusCode()).thenReturn(HttpStatus.SC_NO_CONTENT); - api.executeDeleteObject("/"); - verify(method, times(1)).releaseConnection(); - verify(client, times(1)).executeMethod(method); - } - - @Test(expected = NiciraNvpApiException.class) - public void testExecuteDeleteObjectFailure() throws NiciraNvpApiException, IOException { - method = mock(DeleteMethod.class); - when(method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR); - final Header header = mock(Header.class); - when(header.getValue()).thenReturn("text/html"); - when(method.getResponseHeader("Content-Type")).thenReturn(header); - when(method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later."); - when(method.isRequestSent()).thenReturn(true); - try { - api.executeDeleteObject("/"); - } finally { - verify(method, times(1)).releaseConnection(); - } - } - - @Test(expected = NiciraNvpApiException.class) - public void testExecuteDeleteObjectException() throws NiciraNvpApiException, IOException { - method = mock(DeleteMethod.class); - when(method.getStatusCode()).thenReturn(HttpStatus.SC_NO_CONTENT); - when(client.executeMethod((HttpMethod)any())).thenThrow(new HttpException()); - try { - api.executeDeleteObject("/"); - } finally { - verify(method, times(1)).releaseConnection(); - } - } - - @Test - public void testExecuteRetrieveObject() throws NiciraNvpApiException, IOException { - method = mock(GetMethod.class); - when(method.getStatusCode()).thenReturn(HttpStatus.SC_OK); - when(method.getResponseBodyAsString()).thenReturn(UUID_JSON_RESPONSE); - api.executeRetrieveObject(LogicalSwitch.class, "/", Collections. emptyMap()); - verify(method, times(1)).releaseConnection(); - verify(client, times(1)).executeMethod(method); - } - - @Test(expected = NiciraNvpApiException.class) - public void testExecuteRetrieveObjectFailure() throws NiciraNvpApiException, IOException { - method = mock(GetMethod.class); - when(method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR); - when(method.getResponseBodyAsString()).thenReturn(UUID_JSON_RESPONSE); - final Header header = mock(Header.class); - when(header.getValue()).thenReturn("text/html"); - when(method.getResponseHeader("Content-Type")).thenReturn(header); - when(method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later."); - when(method.isRequestSent()).thenReturn(true); - try { - api.executeRetrieveObject(LogicalSwitch.class, "/", Collections. emptyMap()); - } finally { - verify(method, times(1)).releaseConnection(); - } - } - - @Test(expected = NiciraNvpApiException.class) - public void testExecuteRetrieveObjectException() throws NiciraNvpApiException, IOException { - method = mock(GetMethod.class); - when(method.getStatusCode()).thenReturn(HttpStatus.SC_OK); - when(method.getResponseBodyAsString()).thenReturn(UUID_JSON_RESPONSE); - when(client.executeMethod((HttpMethod)any())).thenThrow(new HttpException()); - try { - api.executeRetrieveObject(LogicalSwitch.class, "/", Collections. emptyMap()); - } finally { - verify(method, times(1)).releaseConnection(); - } - } - @Test public void testFindSecurityProfile() throws NiciraNvpApiException, IOException { // Prepare @@ -467,9 +225,98 @@ public class NiciraNvpApiTest { // Assert verify(method, times(1)).releaseConnection(); - assertEquals("Wrong URI for SecurityProfile deletion REST service", - UUID_SEC_PROFILE_URI, uri); - assertEquals("Wrong HTTP method for SecurityProfile deletion REST service", - NiciraNvpApi.DELETE_METHOD_TYPE, type); + assertEquals("Wrong URI for SecurityProfile deletion REST service", UUID_SEC_PROFILE_URI, uri); + assertEquals("Wrong HTTP method for SecurityProfile deletion REST service", NiciraNvpApi.DELETE_METHOD_TYPE, type); } + + @Test(expected = JsonParseException.class) + public void testRoutingConfigAdapterNoType() throws NiciraNvpApiException, IOException { + // Prepare + final NiciraNvpApi api = new NiciraNvpApi(); + final Gson gson = api.restConnector.getGson(); + + // Execute + gson.fromJson("{}", RoutingConfig.class); + + // Assert: JsonParseException should be thrown + } + + @Test(expected = JsonParseException.class) + public void testRoutingConfigAdapterWrongType() throws NiciraNvpApiException, IOException { + // Prepare + final NiciraNvpApi api = new NiciraNvpApi(); + final Gson gson = api.restConnector.getGson(); + + // Execute + gson.fromJson("{type : \"WrongType\"}", RoutingConfig.class); + + // Assert: JsonParseException should be thrown + } + + @Test() + public void testRoutingConfigAdapter() throws NiciraNvpApiException, IOException { + // Prepare + final NiciraNvpApi api = new NiciraNvpApi(); + final Gson gson = api.restConnector.getGson(); + + // Execute + final SingleDefaultRouteImplicitRoutingConfig singleDefaultRouteImplicitRoutingConfig = + (SingleDefaultRouteImplicitRoutingConfig) gson.fromJson("{type : \"SingleDefaultRouteImplicitRoutingConfig\"}", RoutingConfig.class); + + // Assert: JsonParseException should be thrown + assertEquals("", SingleDefaultRouteImplicitRoutingConfig.class, singleDefaultRouteImplicitRoutingConfig.getClass()); + } + + @Test(expected = JsonParseException.class) + public void testNatRuleAdapterNoType() throws NiciraNvpApiException, IOException { + // Prepare + final NiciraNvpApi api = new NiciraNvpApi(); + final Gson gson = api.restConnector.getGson(); + + // Execute + gson.fromJson("{}", NatRule.class); + + // Assert: JsonParseException should be thrown + } + + @Test(expected = JsonParseException.class) + public void testNatRuleAdapterWrongType() throws NiciraNvpApiException, IOException { + // Prepare + final NiciraNvpApi api = new NiciraNvpApi(); + final Gson gson = api.restConnector.getGson(); + + // Execute + gson.fromJson("{type : \"WrongType\"}", NatRule.class); + + // Assert: JsonParseException should be thrown + } + + @Test() + public void testRoutingConfigAdapterWithSourceNatRule() throws NiciraNvpApiException, IOException { + // Prepare + final NiciraNvpApi api = new NiciraNvpApi(); + final Gson gson = api.restConnector.getGson(); + + // Execute + final SourceNatRule sourceNatRule = + (SourceNatRule) gson.fromJson("{type : \"SourceNatRule\"}", NatRule.class); + + // Assert: JsonParseException should be thrown + assertEquals("", SourceNatRule.class, sourceNatRule.getClass()); + } + + @Test() + public void testRoutingConfigAdapterWithDestinationNatRule() throws NiciraNvpApiException, IOException { + // Prepare + final NiciraNvpApi api = new NiciraNvpApi(); + final Gson gson = api.restConnector.getGson(); + + // Execute + final DestinationNatRule destinationNatRule = + (DestinationNatRule) gson.fromJson("{type : \"DestinationNatRule\"}", NatRule.class); + + // Assert: JsonParseException should be thrown + assertEquals("", DestinationNatRule.class, destinationNatRule.getClass()); + } + } diff --git a/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraTagTest.java b/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraTagTest.java index 58dcedc6a89..7a31264f360 100644 --- a/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraTagTest.java +++ b/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraTagTest.java @@ -26,21 +26,21 @@ import org.junit.Test; public class NiciraTagTest { @Test public void testCreateTag() { - NiciraNvpTag tag = new NiciraNvpTag("scope", "tag"); + final NiciraNvpTag tag = new NiciraNvpTag("scope", "tag"); assertEquals("scope part set", "scope", tag.getScope()); assertEquals("tag part set", "tag", tag.getTag()); } @Test public void testCreateLongTag() { - NiciraNvpTag tag = new NiciraNvpTag("scope", "verylongtagthatshouldattheminimumexceedthefortycharacterlenght"); + final NiciraNvpTag tag = new NiciraNvpTag("scope", "verylongtagthatshouldattheminimumexceedthefortycharacterlenght"); assertEquals("scope part set", "scope", tag.getScope()); assertEquals("tag part set", "verylongtagthatshouldattheminimumexceedt", tag.getTag()); } @Test public void testSetTag() { - NiciraNvpTag tag = new NiciraNvpTag(); + final NiciraNvpTag tag = new NiciraNvpTag(); tag.setScope("scope"); tag.setTag("tag"); assertEquals("scope part set", "scope", tag.getScope()); @@ -49,7 +49,7 @@ public class NiciraTagTest { @Test public void testSetLongTag() { - NiciraNvpTag tag = new NiciraNvpTag(); + final NiciraNvpTag tag = new NiciraNvpTag(); tag.setScope("scope"); tag.setTag("verylongtagthatshouldattheminimumexceedthefortycharacterlenght"); assertEquals("scope part set", "scope", tag.getScope()); diff --git a/plugins/network-elements/nicira-nvp/test/com/cloud/network/resource/NiciraNvpResourceTest.java b/plugins/network-elements/nicira-nvp/test/com/cloud/network/resource/NiciraNvpResourceTest.java index 2717c3125d8..23fe82a392e 100644 --- a/plugins/network-elements/nicira-nvp/test/com/cloud/network/resource/NiciraNvpResourceTest.java +++ b/plugins/network-elements/nicira-nvp/test/com/cloud/network/resource/NiciraNvpResourceTest.java @@ -76,7 +76,7 @@ import com.cloud.host.Host; import com.cloud.network.nicira.Attachment; import com.cloud.network.nicira.ControlClusterStatus; import com.cloud.network.nicira.DestinationNatRule; -import com.cloud.network.nicira.LogicalRouterConfig; +import com.cloud.network.nicira.LogicalRouter; import com.cloud.network.nicira.LogicalRouterPort; import com.cloud.network.nicira.LogicalSwitch; import com.cloud.network.nicira.LogicalSwitchPort; @@ -132,7 +132,7 @@ public class NiciraNvpResourceTest { public void testInitialization() throws ConfigurationException { resource.configure("NiciraNvpResource", parameters); - StartupCommand[] sc = resource.initialize(); + final StartupCommand[] sc = resource.initialize(); assertTrue(sc.length == 1); assertTrue("Incorrect startup command GUID", "aaaaa-bbbbb-ccccc".equals(sc[0].getGuid())); assertTrue("Incorrect NVP device name", "nvptestdevice".equals(sc[0].getName())); @@ -143,11 +143,11 @@ public class NiciraNvpResourceTest { public void testPingCommandStatusOk() throws ConfigurationException, NiciraNvpApiException { resource.configure("NiciraNvpResource", parameters); - ControlClusterStatus ccs = mock(ControlClusterStatus.class); + final ControlClusterStatus ccs = mock(ControlClusterStatus.class); when(ccs.getClusterStatus()).thenReturn("stable"); when(nvpApi.getControlClusterStatus()).thenReturn(ccs); - PingCommand ping = resource.getCurrentStatus(42); + final PingCommand ping = resource.getCurrentStatus(42); assertTrue(ping != null); assertTrue(ping.getHostId() == 42); assertTrue(ping.getHostType() == Host.Type.L2Networking); @@ -157,11 +157,11 @@ public class NiciraNvpResourceTest { public void testPingCommandStatusFail() throws ConfigurationException, NiciraNvpApiException { resource.configure("NiciraNvpResource", parameters); - ControlClusterStatus ccs = mock(ControlClusterStatus.class); + final ControlClusterStatus ccs = mock(ControlClusterStatus.class); when(ccs.getClusterStatus()).thenReturn("unstable"); when(nvpApi.getControlClusterStatus()).thenReturn(ccs); - PingCommand ping = resource.getCurrentStatus(42); + final PingCommand ping = resource.getCurrentStatus(42); assertTrue(ping == null); } @@ -169,11 +169,11 @@ public class NiciraNvpResourceTest { public void testPingCommandStatusApiException() throws ConfigurationException, NiciraNvpApiException { resource.configure("NiciraNvpResource", parameters); - ControlClusterStatus ccs = mock(ControlClusterStatus.class); + final ControlClusterStatus ccs = mock(ControlClusterStatus.class); when(ccs.getClusterStatus()).thenReturn("unstable"); when(nvpApi.getControlClusterStatus()).thenThrow(new NiciraNvpApiException()); - PingCommand ping = resource.getCurrentStatus(42); + final PingCommand ping = resource.getCurrentStatus(42); assertTrue(ping == null); } @@ -181,12 +181,12 @@ public class NiciraNvpResourceTest { public void testRetries() throws ConfigurationException, NiciraNvpApiException { resource.configure("NiciraNvpResource", parameters); - LogicalSwitch ls = mock(LogicalSwitch.class); + final LogicalSwitch ls = mock(LogicalSwitch.class); when(ls.getUuid()).thenReturn("cccc").thenReturn("cccc"); when(nvpApi.createLogicalSwitch((LogicalSwitch)any())).thenThrow(new NiciraNvpApiException()).thenThrow(new NiciraNvpApiException()).thenReturn(ls); - CreateLogicalSwitchCommand clsc = new CreateLogicalSwitchCommand((String)parameters.get("guid"), "stt", "loigicalswitch", "owner"); - CreateLogicalSwitchAnswer clsa = (CreateLogicalSwitchAnswer)resource.executeRequest(clsc); + final CreateLogicalSwitchCommand clsc = new CreateLogicalSwitchCommand((String)parameters.get("guid"), "stt", "loigicalswitch", "owner"); + final CreateLogicalSwitchAnswer clsa = (CreateLogicalSwitchAnswer)resource.executeRequest(clsc); assertTrue(clsa.getResult()); } @@ -194,12 +194,12 @@ public class NiciraNvpResourceTest { public void testCreateLogicalSwitch() throws ConfigurationException, NiciraNvpApiException { resource.configure("NiciraNvpResource", parameters); - LogicalSwitch ls = mock(LogicalSwitch.class); + final LogicalSwitch ls = mock(LogicalSwitch.class); when(ls.getUuid()).thenReturn("cccc").thenReturn("cccc"); when(nvpApi.createLogicalSwitch((LogicalSwitch)any())).thenReturn(ls); - CreateLogicalSwitchCommand clsc = new CreateLogicalSwitchCommand((String)parameters.get("guid"), "stt", "loigicalswitch", "owner"); - CreateLogicalSwitchAnswer clsa = (CreateLogicalSwitchAnswer)resource.executeRequest(clsc); + final CreateLogicalSwitchCommand clsc = new CreateLogicalSwitchCommand((String)parameters.get("guid"), "stt", "loigicalswitch", "owner"); + final CreateLogicalSwitchAnswer clsa = (CreateLogicalSwitchAnswer)resource.executeRequest(clsc); assertTrue(clsa.getResult()); assertTrue("cccc".equals(clsa.getLogicalSwitchUuid())); } @@ -208,12 +208,12 @@ public class NiciraNvpResourceTest { public void testCreateLogicalSwitchApiException() throws ConfigurationException, NiciraNvpApiException { resource.configure("NiciraNvpResource", parameters); - LogicalSwitch ls = mock(LogicalSwitch.class); + final LogicalSwitch ls = mock(LogicalSwitch.class); when(ls.getUuid()).thenReturn("cccc").thenReturn("cccc"); when(nvpApi.createLogicalSwitch((LogicalSwitch)any())).thenThrow(new NiciraNvpApiException()); - CreateLogicalSwitchCommand clsc = new CreateLogicalSwitchCommand((String)parameters.get("guid"), "stt", "loigicalswitch", "owner"); - CreateLogicalSwitchAnswer clsa = (CreateLogicalSwitchAnswer)resource.executeRequest(clsc); + final CreateLogicalSwitchCommand clsc = new CreateLogicalSwitchCommand((String)parameters.get("guid"), "stt", "loigicalswitch", "owner"); + final CreateLogicalSwitchAnswer clsa = (CreateLogicalSwitchAnswer)resource.executeRequest(clsc); assertFalse(clsa.getResult()); } @@ -221,8 +221,8 @@ public class NiciraNvpResourceTest { public void testDeleteLogicalSwitch() throws ConfigurationException, NiciraNvpApiException { resource.configure("NiciraNvpResource", parameters); - DeleteLogicalSwitchCommand dlsc = new DeleteLogicalSwitchCommand("cccc"); - DeleteLogicalSwitchAnswer dlsa = (DeleteLogicalSwitchAnswer)resource.executeRequest(dlsc); + final DeleteLogicalSwitchCommand dlsc = new DeleteLogicalSwitchCommand("cccc"); + final DeleteLogicalSwitchAnswer dlsa = (DeleteLogicalSwitchAnswer)resource.executeRequest(dlsc); assertTrue(dlsa.getResult()); } @@ -232,8 +232,8 @@ public class NiciraNvpResourceTest { doThrow(new NiciraNvpApiException()).when(nvpApi).deleteLogicalSwitch((String)any()); - DeleteLogicalSwitchCommand dlsc = new DeleteLogicalSwitchCommand("cccc"); - DeleteLogicalSwitchAnswer dlsa = (DeleteLogicalSwitchAnswer)resource.executeRequest(dlsc); + final DeleteLogicalSwitchCommand dlsc = new DeleteLogicalSwitchCommand("cccc"); + final DeleteLogicalSwitchAnswer dlsa = (DeleteLogicalSwitchAnswer)resource.executeRequest(dlsc); assertFalse(dlsa.getResult()); } @@ -241,12 +241,12 @@ public class NiciraNvpResourceTest { public void testCreateLogicalSwitchPort() throws ConfigurationException, NiciraNvpApiException { resource.configure("NiciraNvpResource", parameters); - LogicalSwitchPort lsp = mock(LogicalSwitchPort.class); + final LogicalSwitchPort lsp = mock(LogicalSwitchPort.class); when(lsp.getUuid()).thenReturn("eeee"); when(nvpApi.createLogicalSwitchPort(eq("cccc"), (LogicalSwitchPort)any())).thenReturn(lsp); - CreateLogicalSwitchPortCommand clspc = new CreateLogicalSwitchPortCommand("cccc", "dddd", "owner", "nicname"); - CreateLogicalSwitchPortAnswer clspa = (CreateLogicalSwitchPortAnswer)resource.executeRequest(clspc); + final CreateLogicalSwitchPortCommand clspc = new CreateLogicalSwitchPortCommand("cccc", "dddd", "owner", "nicname"); + final CreateLogicalSwitchPortAnswer clspa = (CreateLogicalSwitchPortAnswer)resource.executeRequest(clspc); assertTrue(clspa.getResult()); assertTrue("eeee".equals(clspa.getLogicalSwitchPortUuid())); @@ -256,12 +256,12 @@ public class NiciraNvpResourceTest { public void testCreateLogicalSwitchPortApiExceptionInCreate() throws ConfigurationException, NiciraNvpApiException { resource.configure("NiciraNvpResource", parameters); - LogicalSwitchPort lsp = mock(LogicalSwitchPort.class); + final LogicalSwitchPort lsp = mock(LogicalSwitchPort.class); when(lsp.getUuid()).thenReturn("eeee"); when(nvpApi.createLogicalSwitchPort(eq("cccc"), (LogicalSwitchPort)any())).thenThrow(new NiciraNvpApiException()); - CreateLogicalSwitchPortCommand clspc = new CreateLogicalSwitchPortCommand("cccc", "dddd", "owner", "nicname"); - CreateLogicalSwitchPortAnswer clspa = (CreateLogicalSwitchPortAnswer)resource.executeRequest(clspc); + final CreateLogicalSwitchPortCommand clspc = new CreateLogicalSwitchPortCommand("cccc", "dddd", "owner", "nicname"); + final CreateLogicalSwitchPortAnswer clspa = (CreateLogicalSwitchPortAnswer)resource.executeRequest(clspc); assertFalse(clspa.getResult()); } @@ -269,13 +269,13 @@ public class NiciraNvpResourceTest { public void testCreateLogicalSwitchPortApiExceptionInModify() throws ConfigurationException, NiciraNvpApiException { resource.configure("NiciraNvpResource", parameters); - LogicalSwitchPort lsp = mock(LogicalSwitchPort.class); + final LogicalSwitchPort lsp = mock(LogicalSwitchPort.class); when(lsp.getUuid()).thenReturn("eeee"); when(nvpApi.createLogicalSwitchPort(eq("cccc"), (LogicalSwitchPort)any())).thenReturn(lsp); - doThrow(new NiciraNvpApiException()).when(nvpApi).modifyLogicalSwitchPortAttachment((String)any(), (String)any(), (Attachment)any()); + doThrow(new NiciraNvpApiException()).when(nvpApi).updateLogicalSwitchPortAttachment((String)any(), (String)any(), (Attachment)any()); - CreateLogicalSwitchPortCommand clspc = new CreateLogicalSwitchPortCommand("cccc", "dddd", "owner", "nicname"); - CreateLogicalSwitchPortAnswer clspa = (CreateLogicalSwitchPortAnswer)resource.executeRequest(clspc); + final CreateLogicalSwitchPortCommand clspc = new CreateLogicalSwitchPortCommand("cccc", "dddd", "owner", "nicname"); + final CreateLogicalSwitchPortAnswer clspa = (CreateLogicalSwitchPortAnswer)resource.executeRequest(clspc); assertFalse(clspa.getResult()); verify(nvpApi, atLeastOnce()).deleteLogicalSwitchPort((String)any(), (String)any()); } @@ -285,7 +285,7 @@ public class NiciraNvpResourceTest { resource.configure("NiciraNvpResource", parameters); doThrow(new NiciraNvpApiException()).when(nvpApi).deleteLogicalSwitchPort((String)any(), (String)any()); - DeleteLogicalSwitchPortAnswer dlspa = (DeleteLogicalSwitchPortAnswer)resource.executeRequest(new DeleteLogicalSwitchPortCommand("aaaa", "bbbb")); + final DeleteLogicalSwitchPortAnswer dlspa = (DeleteLogicalSwitchPortAnswer)resource.executeRequest(new DeleteLogicalSwitchPortCommand("aaaa", "bbbb")); assertFalse(dlspa.getResult()); } @@ -293,8 +293,8 @@ public class NiciraNvpResourceTest { public void testUpdateLogicalSwitchPortException() throws ConfigurationException, NiciraNvpApiException { resource.configure("NiciraNvpResource", parameters); - doThrow(new NiciraNvpApiException()).when(nvpApi).modifyLogicalSwitchPortAttachment((String)any(), (String)any(), (Attachment)any()); - UpdateLogicalSwitchPortAnswer dlspa = + doThrow(new NiciraNvpApiException()).when(nvpApi).updateLogicalSwitchPortAttachment((String)any(), (String)any(), (Attachment)any()); + final UpdateLogicalSwitchPortAnswer dlspa = (UpdateLogicalSwitchPortAnswer)resource.executeRequest(new UpdateLogicalSwitchPortCommand("aaaa", "bbbb", "cccc", "owner", "nicname")); assertFalse(dlspa.getResult()); } @@ -304,11 +304,12 @@ public class NiciraNvpResourceTest { resource.configure("NiciraNvpResource", parameters); @SuppressWarnings("unchecked") + final NiciraNvpList lspl = mock(NiciraNvpList.class); when(lspl.getResultCount()).thenReturn(1); when(nvpApi.findLogicalSwitchPortsByUuid("aaaa", "bbbb")).thenReturn(lspl); - FindLogicalSwitchPortAnswer flspa = (FindLogicalSwitchPortAnswer)resource.executeRequest(new FindLogicalSwitchPortCommand("aaaa", "bbbb")); + final FindLogicalSwitchPortAnswer flspa = (FindLogicalSwitchPortAnswer)resource.executeRequest(new FindLogicalSwitchPortCommand("aaaa", "bbbb")); assertTrue(flspa.getResult()); } @@ -317,11 +318,12 @@ public class NiciraNvpResourceTest { resource.configure("NiciraNvpResource", parameters); @SuppressWarnings("unchecked") + final NiciraNvpList lspl = mock(NiciraNvpList.class); when(lspl.getResultCount()).thenReturn(0); when(nvpApi.findLogicalSwitchPortsByUuid("aaaa", "bbbb")).thenReturn(lspl); - FindLogicalSwitchPortAnswer flspa = (FindLogicalSwitchPortAnswer)resource.executeRequest(new FindLogicalSwitchPortCommand("aaaa", "bbbb")); + final FindLogicalSwitchPortAnswer flspa = (FindLogicalSwitchPortAnswer)resource.executeRequest(new FindLogicalSwitchPortCommand("aaaa", "bbbb")); assertFalse(flspa.getResult()); } @@ -331,7 +333,7 @@ public class NiciraNvpResourceTest { when(nvpApi.findLogicalSwitchPortsByUuid("aaaa", "bbbb")).thenThrow(new NiciraNvpApiException()); - FindLogicalSwitchPortAnswer flspa = (FindLogicalSwitchPortAnswer)resource.executeRequest(new FindLogicalSwitchPortCommand("aaaa", "bbbb")); + final FindLogicalSwitchPortAnswer flspa = (FindLogicalSwitchPortAnswer)resource.executeRequest(new FindLogicalSwitchPortCommand("aaaa", "bbbb")); assertFalse(flspa.getResult()); } @@ -339,17 +341,17 @@ public class NiciraNvpResourceTest { public void testCreateLogicalRouter() throws ConfigurationException, NiciraNvpApiException { resource.configure("NiciraNvpResource", parameters); - LogicalRouterConfig lrc = mock(LogicalRouterConfig.class); - LogicalRouterPort lrp = mock(LogicalRouterPort.class); - LogicalSwitchPort lsp = mock(LogicalSwitchPort.class); + final LogicalRouter lrc = mock(LogicalRouter.class); + final LogicalRouterPort lrp = mock(LogicalRouterPort.class); + final LogicalSwitchPort lsp = mock(LogicalSwitchPort.class); when(lrc.getUuid()).thenReturn("ccccc"); when(lrp.getUuid()).thenReturn("ddddd").thenReturn("eeeee"); when(lsp.getUuid()).thenReturn("fffff"); - when(nvpApi.createLogicalRouter((LogicalRouterConfig)any())).thenReturn(lrc); + when(nvpApi.createLogicalRouter((LogicalRouter)any())).thenReturn(lrc); when(nvpApi.createLogicalRouterPort(eq("ccccc"), (LogicalRouterPort)any())).thenReturn(lrp); when(nvpApi.createLogicalSwitchPort(eq("bbbbb"), (LogicalSwitchPort)any())).thenReturn(lsp); - CreateLogicalRouterCommand clrc = new CreateLogicalRouterCommand("aaaaa", 50, "bbbbb", "lrouter", "publiccidr", "nexthop", "internalcidr", "owner"); - CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer)resource.executeRequest(clrc); + final CreateLogicalRouterCommand clrc = new CreateLogicalRouterCommand("aaaaa", 50, "bbbbb", "lrouter", "publiccidr", "nexthop", "internalcidr", "owner"); + final CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer)resource.executeRequest(clrc); assertTrue(clra.getResult()); assertTrue("ccccc".equals(clra.getLogicalRouterUuid())); @@ -360,9 +362,9 @@ public class NiciraNvpResourceTest { public void testCreateLogicalRouterApiException() throws ConfigurationException, NiciraNvpApiException { resource.configure("NiciraNvpResource", parameters); - when(nvpApi.createLogicalRouter((LogicalRouterConfig)any())).thenThrow(new NiciraNvpApiException()); - CreateLogicalRouterCommand clrc = new CreateLogicalRouterCommand("aaaaa", 50, "bbbbb", "lrouter", "publiccidr", "nexthop", "internalcidr", "owner"); - CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer)resource.executeRequest(clrc); + when(nvpApi.createLogicalRouter((LogicalRouter)any())).thenThrow(new NiciraNvpApiException()); + final CreateLogicalRouterCommand clrc = new CreateLogicalRouterCommand("aaaaa", 50, "bbbbb", "lrouter", "publiccidr", "nexthop", "internalcidr", "owner"); + final CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer)resource.executeRequest(clrc); assertFalse(clra.getResult()); } @@ -371,12 +373,12 @@ public class NiciraNvpResourceTest { public void testCreateLogicalRouterApiExceptionRollbackRouter() throws ConfigurationException, NiciraNvpApiException { resource.configure("NiciraNvpResource", parameters); - LogicalRouterConfig lrc = mock(LogicalRouterConfig.class); + final LogicalRouter lrc = mock(LogicalRouter.class); when(lrc.getUuid()).thenReturn("ccccc"); - when(nvpApi.createLogicalRouter((LogicalRouterConfig)any())).thenReturn(lrc); + when(nvpApi.createLogicalRouter((LogicalRouter)any())).thenReturn(lrc); when(nvpApi.createLogicalRouterPort(eq("ccccc"), (LogicalRouterPort)any())).thenThrow(new NiciraNvpApiException()); - CreateLogicalRouterCommand clrc = new CreateLogicalRouterCommand("aaaaa", 50, "bbbbb", "lrouter", "publiccidr", "nexthop", "internalcidr", "owner"); - CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer)resource.executeRequest(clrc); + final CreateLogicalRouterCommand clrc = new CreateLogicalRouterCommand("aaaaa", 50, "bbbbb", "lrouter", "publiccidr", "nexthop", "internalcidr", "owner"); + final CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer)resource.executeRequest(clrc); assertFalse(clra.getResult()); verify(nvpApi, atLeast(1)).deleteLogicalRouter(eq("ccccc")); @@ -386,18 +388,18 @@ public class NiciraNvpResourceTest { public void testCreateLogicalRouterApiExceptionRollbackRouterAndSwitchPort() throws ConfigurationException, NiciraNvpApiException { resource.configure("NiciraNvpResource", parameters); - LogicalRouterConfig lrc = mock(LogicalRouterConfig.class); - LogicalRouterPort lrp = mock(LogicalRouterPort.class); - LogicalSwitchPort lsp = mock(LogicalSwitchPort.class); + final LogicalRouter lrc = mock(LogicalRouter.class); + final LogicalRouterPort lrp = mock(LogicalRouterPort.class); + final LogicalSwitchPort lsp = mock(LogicalSwitchPort.class); when(lrc.getUuid()).thenReturn("ccccc"); when(lrp.getUuid()).thenReturn("ddddd").thenReturn("eeeee"); when(lsp.getUuid()).thenReturn("fffff"); - when(nvpApi.createLogicalRouter((LogicalRouterConfig)any())).thenReturn(lrc); + when(nvpApi.createLogicalRouter((LogicalRouter)any())).thenReturn(lrc); when(nvpApi.createLogicalRouterPort(eq("ccccc"), (LogicalRouterPort)any())).thenReturn(lrp); when(nvpApi.createLogicalSwitchPort(eq("bbbbb"), (LogicalSwitchPort)any())).thenReturn(lsp); when(nvpApi.createLogicalRouterNatRule((String)any(), (NatRule)any())).thenThrow(new NiciraNvpApiException()); - CreateLogicalRouterCommand clrc = new CreateLogicalRouterCommand("aaaaa", 50, "bbbbb", "lrouter", "publiccidr", "nexthop", "internalcidr", "owner"); - CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer)resource.executeRequest(clrc); + final CreateLogicalRouterCommand clrc = new CreateLogicalRouterCommand("aaaaa", 50, "bbbbb", "lrouter", "publiccidr", "nexthop", "internalcidr", "owner"); + final CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer)resource.executeRequest(clrc); assertFalse(clra.getResult()); verify(nvpApi, atLeast(1)).deleteLogicalRouter(eq("ccccc")); @@ -409,7 +411,7 @@ public class NiciraNvpResourceTest { resource.configure("NiciraNvpResource", parameters); doThrow(new NiciraNvpApiException()).when(nvpApi).deleteLogicalRouter(eq("aaaaa")); - DeleteLogicalRouterAnswer dlspa = (DeleteLogicalRouterAnswer)resource.executeRequest(new DeleteLogicalRouterCommand("aaaaa")); + final DeleteLogicalRouterAnswer dlspa = (DeleteLogicalRouterAnswer)resource.executeRequest(new DeleteLogicalRouterCommand("aaaaa")); assertFalse(dlspa.getResult()); } @@ -417,16 +419,17 @@ public class NiciraNvpResourceTest { public void testConfigurePublicIpsOnLogicalRouterApiException() throws ConfigurationException, NiciraNvpApiException { resource.configure("NiciraNvpResource", parameters); - ConfigurePublicIpsOnLogicalRouterCommand cmd = mock(ConfigurePublicIpsOnLogicalRouterCommand.class); + final ConfigurePublicIpsOnLogicalRouterCommand cmd = mock(ConfigurePublicIpsOnLogicalRouterCommand.class); @SuppressWarnings("unchecked") + final NiciraNvpList list = mock(NiciraNvpList.class); when(cmd.getLogicalRouterUuid()).thenReturn("aaaaa"); when(cmd.getL3GatewayServiceUuid()).thenReturn("bbbbb"); - doThrow(new NiciraNvpApiException()).when(nvpApi).modifyLogicalRouterPort((String)any(), (LogicalRouterPort)any()); + doThrow(new NiciraNvpApiException()).when(nvpApi).updateLogicalRouterPort((String)any(), (LogicalRouterPort)any()); when(nvpApi.findLogicalRouterPortByGatewayServiceUuid("aaaaa", "bbbbb")).thenReturn(list); - ConfigurePublicIpsOnLogicalRouterAnswer answer = (ConfigurePublicIpsOnLogicalRouterAnswer)resource.executeRequest(cmd); + final ConfigurePublicIpsOnLogicalRouterAnswer answer = (ConfigurePublicIpsOnLogicalRouterAnswer)resource.executeRequest(cmd); assertFalse(answer.getResult()); } @@ -440,31 +443,32 @@ public class NiciraNvpResourceTest { */ // Mock the command - ConfigureStaticNatRulesOnLogicalRouterCommand cmd = mock(ConfigureStaticNatRulesOnLogicalRouterCommand.class); - StaticNatRuleTO rule = new StaticNatRuleTO(1, "11.11.11.11", null, null, "10.10.10.10", null, null, null, false, false); - List rules = new ArrayList(); + final ConfigureStaticNatRulesOnLogicalRouterCommand cmd = mock(ConfigureStaticNatRulesOnLogicalRouterCommand.class); + final StaticNatRuleTO rule = new StaticNatRuleTO(1, "11.11.11.11", null, null, "10.10.10.10", null, null, null, false, false); + final List rules = new ArrayList(); rules.add(rule); when(cmd.getRules()).thenReturn(rules); when(cmd.getLogicalRouterUuid()).thenReturn("aaaaa"); // Mock the api find call @SuppressWarnings("unchecked") + final NiciraNvpList storedRules = mock(NiciraNvpList.class); when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules); // Mock the api create calls - NatRule[] rulepair = resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11"); + final NatRule[] rulepair = resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11"); rulepair[0].setUuid(UUID.randomUUID()); rulepair[1].setUuid(UUID.randomUUID()); when(nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]); - ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer)resource.executeRequest(cmd); + final ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer)resource.executeRequest(cmd); assertTrue(a.getResult()); verify(nvpApi, atLeast(2)).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher() { @Override - public boolean matches(Object argument) { - NatRule rule = (NatRule)argument; + public boolean matches(final Object argument) { + final NatRule rule = (NatRule)argument; if (rule.getType().equals("DestinationNatRule") && ((DestinationNatRule)rule).getToDestinationIpAddress().equals("10.10.10.10")) { return true; } @@ -485,33 +489,34 @@ public class NiciraNvpResourceTest { */ // Mock the command - ConfigureStaticNatRulesOnLogicalRouterCommand cmd = mock(ConfigureStaticNatRulesOnLogicalRouterCommand.class); - StaticNatRuleTO rule = new StaticNatRuleTO(1, "11.11.11.11", null, null, "10.10.10.10", null, null, null, false, false); - List rules = new ArrayList(); + final ConfigureStaticNatRulesOnLogicalRouterCommand cmd = mock(ConfigureStaticNatRulesOnLogicalRouterCommand.class); + final StaticNatRuleTO rule = new StaticNatRuleTO(1, "11.11.11.11", null, null, "10.10.10.10", null, null, null, false, false); + final List rules = new ArrayList(); rules.add(rule); when(cmd.getRules()).thenReturn(rules); when(cmd.getLogicalRouterUuid()).thenReturn("aaaaa"); // Mock the api create calls - NatRule[] rulepair = resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11"); + final NatRule[] rulepair = resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11"); rulepair[0].setUuid(UUID.randomUUID()); rulepair[1].setUuid(UUID.randomUUID()); when(nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]); // Mock the api find call @SuppressWarnings("unchecked") + final NiciraNvpList storedRules = mock(NiciraNvpList.class); when(storedRules.getResultCount()).thenReturn(2); when(storedRules.getResults()).thenReturn(Arrays.asList(rulepair)); when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules); - ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer)resource.executeRequest(cmd); + final ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer)resource.executeRequest(cmd); assertTrue(a.getResult()); verify(nvpApi, never()).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher() { @Override - public boolean matches(Object argument) { - NatRule rule = (NatRule)argument; + public boolean matches(final Object argument) { + final NatRule rule = (NatRule)argument; if (rule.getType().equals("DestinationNatRule") && ((DestinationNatRule)rule).getToDestinationIpAddress().equals("10.10.10.10")) { return true; } @@ -532,15 +537,15 @@ public class NiciraNvpResourceTest { */ // Mock the command - ConfigureStaticNatRulesOnLogicalRouterCommand cmd = mock(ConfigureStaticNatRulesOnLogicalRouterCommand.class); - StaticNatRuleTO rule = new StaticNatRuleTO(1, "11.11.11.11", null, null, "10.10.10.10", null, null, null, true, false); - List rules = new ArrayList(); + final ConfigureStaticNatRulesOnLogicalRouterCommand cmd = mock(ConfigureStaticNatRulesOnLogicalRouterCommand.class); + final StaticNatRuleTO rule = new StaticNatRuleTO(1, "11.11.11.11", null, null, "10.10.10.10", null, null, null, true, false); + final List rules = new ArrayList(); rules.add(rule); when(cmd.getRules()).thenReturn(rules); when(cmd.getLogicalRouterUuid()).thenReturn("aaaaa"); // Mock the api create calls - NatRule[] rulepair = resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11"); + final NatRule[] rulepair = resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11"); final UUID rule0Uuid = UUID.randomUUID(); final UUID rule1Uuid = UUID.randomUUID(); rulepair[0].setUuid(rule0Uuid); @@ -549,18 +554,19 @@ public class NiciraNvpResourceTest { // Mock the api find call @SuppressWarnings("unchecked") + final NiciraNvpList storedRules = mock(NiciraNvpList.class); when(storedRules.getResultCount()).thenReturn(2); when(storedRules.getResults()).thenReturn(Arrays.asList(rulepair)); when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules); - ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer)resource.executeRequest(cmd); + final ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer)resource.executeRequest(cmd); assertTrue(a.getResult()); verify(nvpApi, atLeast(2)).deleteLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher() { @Override - public boolean matches(Object argument) { - UUID uuid = (UUID)argument; + public boolean matches(final Object argument) { + final UUID uuid = (UUID)argument; if (rule0Uuid.equals(uuid) || rule1Uuid.equals(uuid)) { return true; } @@ -578,26 +584,27 @@ public class NiciraNvpResourceTest { */ // Mock the command - ConfigureStaticNatRulesOnLogicalRouterCommand cmd = mock(ConfigureStaticNatRulesOnLogicalRouterCommand.class); - StaticNatRuleTO rule = new StaticNatRuleTO(1, "11.11.11.11", null, null, "10.10.10.10", null, null, null, false, false); - List rules = new ArrayList(); + final ConfigureStaticNatRulesOnLogicalRouterCommand cmd = mock(ConfigureStaticNatRulesOnLogicalRouterCommand.class); + final StaticNatRuleTO rule = new StaticNatRuleTO(1, "11.11.11.11", null, null, "10.10.10.10", null, null, null, false, false); + final List rules = new ArrayList(); rules.add(rule); when(cmd.getRules()).thenReturn(rules); when(cmd.getLogicalRouterUuid()).thenReturn("aaaaa"); // Mock the api create calls - NatRule[] rulepair = resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11"); + final NatRule[] rulepair = resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11"); rulepair[0].setUuid(UUID.randomUUID()); rulepair[1].setUuid(UUID.randomUUID()); when(nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenThrow(new NiciraNvpApiException()); // Mock the api find call @SuppressWarnings("unchecked") + final NiciraNvpList storedRules = mock(NiciraNvpList.class); when(storedRules.getResultCount()).thenReturn(0); when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules); - ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer)resource.executeRequest(cmd); + final ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer)resource.executeRequest(cmd); assertFalse(a.getResult()); verify(nvpApi, atLeastOnce()).deleteLogicalRouterNatRule(eq("aaaaa"), eq(rulepair[0].getUuid())); @@ -612,31 +619,32 @@ public class NiciraNvpResourceTest { */ // Mock the command - ConfigurePortForwardingRulesOnLogicalRouterCommand cmd = mock(ConfigurePortForwardingRulesOnLogicalRouterCommand.class); - PortForwardingRuleTO rule = new PortForwardingRuleTO(1, "11.11.11.11", 80, 80, "10.10.10.10", 8080, 8080, "tcp", false, false); - List rules = new ArrayList(); + final ConfigurePortForwardingRulesOnLogicalRouterCommand cmd = mock(ConfigurePortForwardingRulesOnLogicalRouterCommand.class); + final PortForwardingRuleTO rule = new PortForwardingRuleTO(1, "11.11.11.11", 80, 80, "10.10.10.10", 8080, 8080, "tcp", false, false); + final List rules = new ArrayList(); rules.add(rule); when(cmd.getRules()).thenReturn(rules); when(cmd.getLogicalRouterUuid()).thenReturn("aaaaa"); // Mock the api find call @SuppressWarnings("unchecked") + final NiciraNvpList storedRules = mock(NiciraNvpList.class); when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules); // Mock the api create calls - NatRule[] rulepair = resource.generatePortForwardingRulePair("10.10.10.10", new int[] {8080, 8080}, "11.11.11.11", new int[] {80, 80}, "tcp"); + final NatRule[] rulepair = resource.generatePortForwardingRulePair("10.10.10.10", new int[] {8080, 8080}, "11.11.11.11", new int[] {80, 80}, "tcp"); rulepair[0].setUuid(UUID.randomUUID()); rulepair[1].setUuid(UUID.randomUUID()); when(nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]); - ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer)resource.executeRequest(cmd); + final ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer)resource.executeRequest(cmd); assertTrue(a.getResult()); verify(nvpApi, atLeast(2)).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher() { @Override - public boolean matches(Object argument) { - NatRule rule = (NatRule)argument; + public boolean matches(final Object argument) { + final NatRule rule = (NatRule)argument; if (rule.getType().equals("DestinationNatRule") && ((DestinationNatRule)rule).getToDestinationIpAddress().equals("10.10.10.10")) { return true; } @@ -657,33 +665,34 @@ public class NiciraNvpResourceTest { */ // Mock the command - ConfigurePortForwardingRulesOnLogicalRouterCommand cmd = mock(ConfigurePortForwardingRulesOnLogicalRouterCommand.class); - PortForwardingRuleTO rule = new PortForwardingRuleTO(1, "11.11.11.11", 80, 80, "10.10.10.10", 8080, 8080, "tcp", false, true); - List rules = new ArrayList(); + final ConfigurePortForwardingRulesOnLogicalRouterCommand cmd = mock(ConfigurePortForwardingRulesOnLogicalRouterCommand.class); + final PortForwardingRuleTO rule = new PortForwardingRuleTO(1, "11.11.11.11", 80, 80, "10.10.10.10", 8080, 8080, "tcp", false, true); + final List rules = new ArrayList(); rules.add(rule); when(cmd.getRules()).thenReturn(rules); when(cmd.getLogicalRouterUuid()).thenReturn("aaaaa"); // Mock the api create calls - NatRule[] rulepair = resource.generatePortForwardingRulePair("10.10.10.10", new int[] {8080, 8080}, "11.11.11.11", new int[] {80, 80}, "tcp"); + final NatRule[] rulepair = resource.generatePortForwardingRulePair("10.10.10.10", new int[] {8080, 8080}, "11.11.11.11", new int[] {80, 80}, "tcp"); rulepair[0].setUuid(UUID.randomUUID()); rulepair[1].setUuid(UUID.randomUUID()); when(nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]); // Mock the api find call @SuppressWarnings("unchecked") + final NiciraNvpList storedRules = mock(NiciraNvpList.class); when(storedRules.getResultCount()).thenReturn(2); when(storedRules.getResults()).thenReturn(Arrays.asList(rulepair)); when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules); - ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer)resource.executeRequest(cmd); + final ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer)resource.executeRequest(cmd); assertTrue(a.getResult()); verify(nvpApi, never()).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher() { @Override - public boolean matches(Object argument) { - NatRule rule = (NatRule)argument; + public boolean matches(final Object argument) { + final NatRule rule = (NatRule)argument; if (rule.getType().equals("DestinationNatRule") && ((DestinationNatRule)rule).getToDestinationIpAddress().equals("10.10.10.10")) { return true; } @@ -704,15 +713,15 @@ public class NiciraNvpResourceTest { */ // Mock the command - ConfigurePortForwardingRulesOnLogicalRouterCommand cmd = mock(ConfigurePortForwardingRulesOnLogicalRouterCommand.class); - PortForwardingRuleTO rule = new PortForwardingRuleTO(1, "11.11.11.11", 80, 80, "10.10.10.10", 8080, 8080, "tcp", true, true); - List rules = new ArrayList(); + final ConfigurePortForwardingRulesOnLogicalRouterCommand cmd = mock(ConfigurePortForwardingRulesOnLogicalRouterCommand.class); + final PortForwardingRuleTO rule = new PortForwardingRuleTO(1, "11.11.11.11", 80, 80, "10.10.10.10", 8080, 8080, "tcp", true, true); + final List rules = new ArrayList(); rules.add(rule); when(cmd.getRules()).thenReturn(rules); when(cmd.getLogicalRouterUuid()).thenReturn("aaaaa"); // Mock the api create calls - NatRule[] rulepair = resource.generatePortForwardingRulePair("10.10.10.10", new int[] {8080, 8080}, "11.11.11.11", new int[] {80, 80}, "tcp"); + final NatRule[] rulepair = resource.generatePortForwardingRulePair("10.10.10.10", new int[] {8080, 8080}, "11.11.11.11", new int[] {80, 80}, "tcp"); final UUID rule0Uuid = UUID.randomUUID(); final UUID rule1Uuid = UUID.randomUUID(); rulepair[0].setUuid(rule0Uuid); @@ -721,18 +730,19 @@ public class NiciraNvpResourceTest { // Mock the api find call @SuppressWarnings("unchecked") + final NiciraNvpList storedRules = mock(NiciraNvpList.class); when(storedRules.getResultCount()).thenReturn(2); when(storedRules.getResults()).thenReturn(Arrays.asList(rulepair)); when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules); - ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer)resource.executeRequest(cmd); + final ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer)resource.executeRequest(cmd); assertTrue(a.getResult()); verify(nvpApi, atLeast(2)).deleteLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher() { @Override - public boolean matches(Object argument) { - UUID uuid = (UUID)argument; + public boolean matches(final Object argument) { + final UUID uuid = (UUID)argument; if (rule0Uuid.equals(uuid) || rule1Uuid.equals(uuid)) { return true; } @@ -750,26 +760,27 @@ public class NiciraNvpResourceTest { */ // Mock the command - ConfigurePortForwardingRulesOnLogicalRouterCommand cmd = mock(ConfigurePortForwardingRulesOnLogicalRouterCommand.class); - PortForwardingRuleTO rule = new PortForwardingRuleTO(1, "11.11.11.11", 80, 80, "10.10.10.10", 8080, 8080, "tcp", false, false); - List rules = new ArrayList(); + final ConfigurePortForwardingRulesOnLogicalRouterCommand cmd = mock(ConfigurePortForwardingRulesOnLogicalRouterCommand.class); + final PortForwardingRuleTO rule = new PortForwardingRuleTO(1, "11.11.11.11", 80, 80, "10.10.10.10", 8080, 8080, "tcp", false, false); + final List rules = new ArrayList(); rules.add(rule); when(cmd.getRules()).thenReturn(rules); when(cmd.getLogicalRouterUuid()).thenReturn("aaaaa"); // Mock the api create calls - NatRule[] rulepair = resource.generatePortForwardingRulePair("10.10.10.10", new int[] {8080, 8080}, "11.11.11.11", new int[] {80, 80}, "tcp"); + final NatRule[] rulepair = resource.generatePortForwardingRulePair("10.10.10.10", new int[] {8080, 8080}, "11.11.11.11", new int[] {80, 80}, "tcp"); rulepair[0].setUuid(UUID.randomUUID()); rulepair[1].setUuid(UUID.randomUUID()); when(nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenThrow(new NiciraNvpApiException()); // Mock the api find call @SuppressWarnings("unchecked") + final NiciraNvpList storedRules = mock(NiciraNvpList.class); when(storedRules.getResultCount()).thenReturn(0); when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules); - ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer)resource.executeRequest(cmd); + final ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer)resource.executeRequest(cmd); assertFalse(a.getResult()); verify(nvpApi, atLeastOnce()).deleteLogicalRouterNatRule(eq("aaaaa"), eq(rulepair[0].getUuid())); @@ -784,25 +795,26 @@ public class NiciraNvpResourceTest { */ // Mock the command - ConfigurePortForwardingRulesOnLogicalRouterCommand cmd = mock(ConfigurePortForwardingRulesOnLogicalRouterCommand.class); - PortForwardingRuleTO rule = new PortForwardingRuleTO(1, "11.11.11.11", 80, 85, "10.10.10.10", 80, 85, "tcp", false, false); - List rules = new ArrayList(); + final ConfigurePortForwardingRulesOnLogicalRouterCommand cmd = mock(ConfigurePortForwardingRulesOnLogicalRouterCommand.class); + final PortForwardingRuleTO rule = new PortForwardingRuleTO(1, "11.11.11.11", 80, 85, "10.10.10.10", 80, 85, "tcp", false, false); + final List rules = new ArrayList(); rules.add(rule); when(cmd.getRules()).thenReturn(rules); when(cmd.getLogicalRouterUuid()).thenReturn("aaaaa"); // Mock the api find call @SuppressWarnings("unchecked") + final NiciraNvpList storedRules = mock(NiciraNvpList.class); when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules); // Mock the api create calls - NatRule[] rulepair = resource.generatePortForwardingRulePair("10.10.10.10", new int[] {80, 85}, "11.11.11.11", new int[] {80, 85}, "tcp"); + final NatRule[] rulepair = resource.generatePortForwardingRulePair("10.10.10.10", new int[] {80, 85}, "11.11.11.11", new int[] {80, 85}, "tcp"); rulepair[0].setUuid(UUID.randomUUID()); rulepair[1].setUuid(UUID.randomUUID()); when(nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]); - ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer)resource.executeRequest(cmd); + final ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer)resource.executeRequest(cmd); // The expected result is false, Nicira does not support port ranges in DNAT assertFalse(a.getResult()); @@ -811,16 +823,16 @@ public class NiciraNvpResourceTest { @Test public void testGenerateStaticNatRulePair() { - NatRule[] rules = resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11"); + final NatRule[] rules = resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11"); assertTrue("DestinationNatRule".equals(rules[0].getType())); assertTrue("SourceNatRule".equals(rules[1].getType())); - DestinationNatRule dnr = (DestinationNatRule)rules[0]; + final DestinationNatRule dnr = (DestinationNatRule)rules[0]; assertTrue(dnr.getToDestinationIpAddress().equals("10.10.10.10")); assertTrue(dnr.getToDestinationPort() == null); assertTrue(dnr.getMatch().getDestinationIpAddresses().equals("11.11.11.11")); - SourceNatRule snr = (SourceNatRule)rules[1]; + final SourceNatRule snr = (SourceNatRule)rules[1]; assertTrue(snr.getToSourceIpAddressMin().equals("11.11.11.11") && snr.getToSourceIpAddressMax().equals("11.11.11.11")); assertTrue(snr.getToSourcePort() == null); assertTrue(snr.getMatch().getSourceIpAddresses().equals("10.10.10.10")); @@ -828,18 +840,18 @@ public class NiciraNvpResourceTest { @Test public void testGeneratePortForwardingRulePair() { - NatRule[] rules = resource.generatePortForwardingRulePair("10.10.10.10", new int[] {8080, 8080}, "11.11.11.11", new int[] {80, 80}, "tcp"); + final NatRule[] rules = resource.generatePortForwardingRulePair("10.10.10.10", new int[] {8080, 8080}, "11.11.11.11", new int[] {80, 80}, "tcp"); assertTrue("DestinationNatRule".equals(rules[0].getType())); assertTrue("SourceNatRule".equals(rules[1].getType())); - DestinationNatRule dnr = (DestinationNatRule)rules[0]; + final DestinationNatRule dnr = (DestinationNatRule)rules[0]; assertTrue(dnr.getToDestinationIpAddress().equals("10.10.10.10")); assertTrue(dnr.getToDestinationPort() == 8080); assertTrue(dnr.getMatch().getDestinationIpAddresses().equals("11.11.11.11")); assertTrue(dnr.getMatch().getDestinationPort() == 80); assertTrue(dnr.getMatch().getEthertype().equals("IPv4") && dnr.getMatch().getProtocol() == 6); - SourceNatRule snr = (SourceNatRule)rules[1]; + final SourceNatRule snr = (SourceNatRule)rules[1]; assertTrue(snr.getToSourceIpAddressMin().equals("11.11.11.11") && snr.getToSourceIpAddressMax().equals("11.11.11.11")); assertTrue(snr.getToSourcePort() == 80); assertTrue(snr.getMatch().getSourceIpAddresses().equals("10.10.10.10")); diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/commands/AddOpenDaylightControllerCmd.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/commands/AddOpenDaylightControllerCmd.java index 80130c0e4b8..ad92a22411a 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/commands/AddOpenDaylightControllerCmd.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/commands/AddOpenDaylightControllerCmd.java @@ -38,7 +38,8 @@ import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -@APICommand(name = "addOpenDaylightController", responseObject = OpenDaylightControllerResponse.class, description = "Adds an OpenDyalight controler") +@APICommand(name = "addOpenDaylightController", responseObject = OpenDaylightControllerResponse.class, description = "Adds an OpenDyalight controler", + requestHasSensitiveInfo = true, responseHasSensitiveInfo = false) public class AddOpenDaylightControllerCmd extends BaseAsyncCmd { @Inject diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/commands/DeleteOpenDaylightControllerCmd.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/commands/DeleteOpenDaylightControllerCmd.java index b5565041444..ce02e64fdd1 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/commands/DeleteOpenDaylightControllerCmd.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/commands/DeleteOpenDaylightControllerCmd.java @@ -40,7 +40,8 @@ import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -@APICommand(name = "deleteOpenDaylightController", responseObject = OpenDaylightControllerResponse.class, description = "Removes an OpenDyalight controler") +@APICommand(name = "deleteOpenDaylightController", responseObject = OpenDaylightControllerResponse.class, description = "Removes an OpenDyalight controler", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteOpenDaylightControllerCmd extends BaseAsyncCmd { @Inject private OpenDaylightControllerResourceManager resourceManager; diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/commands/ListOpenDaylightControllersCmd.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/commands/ListOpenDaylightControllersCmd.java index f3e2e39f4cc..9737114d2f6 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/commands/ListOpenDaylightControllersCmd.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/commands/ListOpenDaylightControllersCmd.java @@ -42,7 +42,8 @@ import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -@APICommand(name = "listOpenDaylightControllers", responseObject = OpenDaylightControllerResponse.class, description = "Lists OpenDyalight controllers") +@APICommand(name = "listOpenDaylightControllers", responseObject = OpenDaylightControllerResponse.class, description = "Lists OpenDyalight controllers", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListOpenDaylightControllersCmd extends BaseCmd { @Inject private OpenDaylightControllerResourceManager resourceManager; diff --git a/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java b/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java index ea46f93b1e2..03eeedd7e05 100644 --- a/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java +++ b/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java @@ -75,12 +75,12 @@ import com.cloud.vm.VirtualMachineProfile; import com.cloud.vm.dao.DomainRouterDao; @Local(value = {NetworkElement.class, ConnectivityProvider.class, - SourceNatServiceProvider.class, StaticNatServiceProvider.class, - PortForwardingServiceProvider.class, IpDeployer.class}) + SourceNatServiceProvider.class, StaticNatServiceProvider.class, + PortForwardingServiceProvider.class, IpDeployer.class}) public class OvsElement extends AdapterBase implements NetworkElement, - OvsElementService, ConnectivityProvider, ResourceStateAdapter, - PortForwardingServiceProvider, LoadBalancingServiceProvider, - StaticNatServiceProvider, IpDeployer { +OvsElementService, ConnectivityProvider, ResourceStateAdapter, +PortForwardingServiceProvider, LoadBalancingServiceProvider, +StaticNatServiceProvider, IpDeployer { @Inject OvsTunnelManager _ovsTunnelMgr; @Inject @@ -109,21 +109,21 @@ public class OvsElement extends AdapterBase implements NetworkElement, protected boolean canHandle(Network network, Service service) { s_logger.debug("Checking if OvsElement can handle service " - + service.getName() + " on network " + network.getDisplayText()); + + service.getName() + " on network " + network.getDisplayText()); if (network.getBroadcastDomainType() != BroadcastDomainType.Vswitch) { return false; } if (!_networkModel.isProviderForNetwork(getProvider(), network.getId())) { s_logger.debug("OvsElement is not a provider for network " - + network.getDisplayText()); + + network.getDisplayText()); return false; } if (!_ntwkSrvcDao.canProviderSupportServiceInNetwork(network.getId(), - service, Network.Provider.Ovs)) { + service, Network.Provider.Ovs)) { s_logger.debug("OvsElement can't provide the " + service.getName() - + " service on network " + network.getDisplayText()); + + " service on network " + network.getDisplayText()); return false; } @@ -132,7 +132,7 @@ public class OvsElement extends AdapterBase implements NetworkElement, @Override public boolean configure(String name, Map params) - throws ConfigurationException { + throws ConfigurationException { super.configure(name, params); _resourceMgr.registerResourceStateAdapter(name, this); return true; @@ -140,12 +140,12 @@ public class OvsElement extends AdapterBase implements NetworkElement, @Override public boolean implement(Network network, NetworkOffering offering, - DeployDestination dest, ReservationContext context) - throws ConcurrentOperationException, ResourceUnavailableException, - InsufficientCapacityException { + DeployDestination dest, ReservationContext context) + throws ConcurrentOperationException, ResourceUnavailableException, + InsufficientCapacityException { s_logger.debug("entering OvsElement implement function for network " - + network.getDisplayText() + " (state " + network.getState() - + ")"); + + network.getDisplayText() + " (state " + network.getState() + + ")"); if (!canHandle(network, Service.Connectivity)) { return false; @@ -155,10 +155,10 @@ public class OvsElement extends AdapterBase implements NetworkElement, @Override public boolean prepare(Network network, NicProfile nic, - VirtualMachineProfile vm, - DeployDestination dest, ReservationContext context) - throws ConcurrentOperationException, ResourceUnavailableException, - InsufficientCapacityException { + VirtualMachineProfile vm, + DeployDestination dest, ReservationContext context) + throws ConcurrentOperationException, ResourceUnavailableException, + InsufficientCapacityException { if (!canHandle(network, Service.Connectivity)) { return false; } @@ -171,16 +171,16 @@ public class OvsElement extends AdapterBase implements NetworkElement, return false; } - _ovsTunnelMgr.VmCheckAndCreateTunnel(vm, network, dest); + _ovsTunnelMgr.vmCheckAndCreateTunnel(vm, network, dest); return true; } @Override public boolean release(Network network, NicProfile nic, - VirtualMachineProfile vm, - ReservationContext context) throws ConcurrentOperationException, - ResourceUnavailableException { + VirtualMachineProfile vm, + ReservationContext context) throws ConcurrentOperationException, + ResourceUnavailableException { if (!canHandle(network, Service.Connectivity)) { return false; } @@ -192,14 +192,14 @@ public class OvsElement extends AdapterBase implements NetworkElement, return false; } - _ovsTunnelMgr.CheckAndDestroyTunnel(vm.getVirtualMachine(), network); + _ovsTunnelMgr.checkAndDestroyTunnel(vm.getVirtualMachine(), network); return true; } @Override public boolean shutdown(Network network, ReservationContext context, - boolean cleanup) throws ConcurrentOperationException, - ResourceUnavailableException { + boolean cleanup) throws ConcurrentOperationException, + ResourceUnavailableException { if (!canHandle(network, Service.Connectivity)) { return false; } @@ -208,7 +208,7 @@ public class OvsElement extends AdapterBase implements NetworkElement, @Override public boolean destroy(Network network, ReservationContext context) - throws ConcurrentOperationException, ResourceUnavailableException { + throws ConcurrentOperationException, ResourceUnavailableException { if (!canHandle(network, Service.Connectivity)) { return false; } @@ -222,8 +222,8 @@ public class OvsElement extends AdapterBase implements NetworkElement, @Override public boolean shutdownProviderInstances( - PhysicalNetworkServiceProvider provider, ReservationContext context) - throws ConcurrentOperationException, ResourceUnavailableException { + PhysicalNetworkServiceProvider provider, ReservationContext context) + throws ConcurrentOperationException, ResourceUnavailableException { return true; } @@ -275,90 +275,90 @@ public class OvsElement extends AdapterBase implements NetworkElement, method = new LbStickinessMethod(StickinessMethodType.LBCookieBased, "This is loadbalancer cookie based stickiness method."); method.addParam("cookie-name", false, "Cookie name passed in http header by the LB to the client.", false); method.addParam("mode", false, - "Valid values: insert, rewrite, prefix. Default value: insert. In the insert mode cookie will be created" + - " by the LB. In other modes, cookie will be created by the server and LB modifies it.", false); + "Valid values: insert, rewrite, prefix. Default value: insert. In the insert mode cookie will be created" + + " by the LB. In other modes, cookie will be created by the server and LB modifies it.", false); method.addParam( - "nocache", - false, - "This option is recommended in conjunction with the insert mode when there is a cache between the client" + - " and HAProxy, as it ensures that a cacheable response will be tagged non-cacheable if a cookie needs " + - "to be inserted. This is important because if all persistence cookies are added on a cacheable home page" + - " for instance, then all customers will then fetch the page from an outer cache and will all share the " + - "same persistence cookie, leading to one server receiving much more traffic than others. See also the " + - "insert and postonly options. ", - true); + "nocache", + false, + "This option is recommended in conjunction with the insert mode when there is a cache between the client" + + " and HAProxy, as it ensures that a cacheable response will be tagged non-cacheable if a cookie needs " + + "to be inserted. This is important because if all persistence cookies are added on a cacheable home page" + + " for instance, then all customers will then fetch the page from an outer cache and will all share the " + + "same persistence cookie, leading to one server receiving much more traffic than others. See also the " + + "insert and postonly options. ", + true); method.addParam( - "indirect", - false, - "When this option is specified in insert mode, cookies will only be added when the server was not reached" + - " after a direct access, which means that only when a server is elected after applying a load-balancing algorithm," + - " or after a redispatch, then the cookie will be inserted. If the client has all the required information" + - " to connect to the same server next time, no further cookie will be inserted. In all cases, when the " + - "indirect option is used in insert mode, the cookie is always removed from the requests transmitted to " + - "the server. The persistence mechanism then becomes totally transparent from the application point of view.", - true); + "indirect", + false, + "When this option is specified in insert mode, cookies will only be added when the server was not reached" + + " after a direct access, which means that only when a server is elected after applying a load-balancing algorithm," + + " or after a redispatch, then the cookie will be inserted. If the client has all the required information" + + " to connect to the same server next time, no further cookie will be inserted. In all cases, when the " + + "indirect option is used in insert mode, the cookie is always removed from the requests transmitted to " + + "the server. The persistence mechanism then becomes totally transparent from the application point of view.", + true); method.addParam( - "postonly", - false, - "This option ensures that cookie insertion will only be performed on responses to POST requests. It is an" + - " alternative to the nocache option, because POST responses are not cacheable, so this ensures that the " + - "persistence cookie will never get cached.Since most sites do not need any sort of persistence before the" + - " first POST which generally is a login request, this is a very efficient method to optimize caching " + - "without risking to find a persistence cookie in the cache. See also the insert and nocache options.", - true); + "postonly", + false, + "This option ensures that cookie insertion will only be performed on responses to POST requests. It is an" + + " alternative to the nocache option, because POST responses are not cacheable, so this ensures that the " + + "persistence cookie will never get cached.Since most sites do not need any sort of persistence before the" + + " first POST which generally is a login request, this is a very efficient method to optimize caching " + + "without risking to find a persistence cookie in the cache. See also the insert and nocache options.", + true); method.addParam( - "domain", - false, - "This option allows to specify the domain at which a cookie is inserted. It requires exactly one parameter:" + - " a valid domain name. If the domain begins with a dot, the browser is allowed to use it for any host " + - "ending with that name. It is also possible to specify several domain names by invoking this option multiple" + - " times. Some browsers might have small limits on the number of domains, so be careful when doing that. " + - "For the record, sending 10 domains to MSIE 6 or Firefox 2 works as expected.", - false); + "domain", + false, + "This option allows to specify the domain at which a cookie is inserted. It requires exactly one parameter:" + + " a valid domain name. If the domain begins with a dot, the browser is allowed to use it for any host " + + "ending with that name. It is also possible to specify several domain names by invoking this option multiple" + + " times. Some browsers might have small limits on the number of domains, so be careful when doing that. " + + "For the record, sending 10 domains to MSIE 6 or Firefox 2 works as expected.", + false); methodList.add(method); method = new LbStickinessMethod(StickinessMethodType.AppCookieBased, - "This is App session based sticky method. Define session stickiness on an existing application cookie. " + + "This is App session based sticky method. Define session stickiness on an existing application cookie. " + "It can be used only for a specific http traffic"); method.addParam("cookie-name", false, "This is the name of the cookie used by the application and which LB will " + - "have to learn for each new session. Default value: Auto geneared based on ip", false); + "have to learn for each new session. Default value: Auto geneared based on ip", false); method.addParam("length", false, "This is the max number of characters that will be memorized and checked in " + - "each cookie value. Default value:52", false); + "each cookie value. Default value:52", false); method.addParam( - "holdtime", - false, - "This is the time after which the cookie will be removed from memory if unused. The value should be in " + - "the format Example : 20s or 30m or 4h or 5d . only seconds(s), minutes(m) hours(h) and days(d) are valid," + - " cannot use th combinations like 20h30m. Default value:3h ", - false); + "holdtime", + false, + "This is the time after which the cookie will be removed from memory if unused. The value should be in " + + "the format Example : 20s or 30m or 4h or 5d . only seconds(s), minutes(m) hours(h) and days(d) are valid," + + " cannot use th combinations like 20h30m. Default value:3h ", + false); method.addParam( - "request-learn", - false, - "If this option is specified, then haproxy will be able to learn the cookie found in the request in case the server does not specify any in response. This is typically what happens with PHPSESSID cookies, or when haproxy's session expires before the application's session and the correct server is selected. It is recommended to specify this option to improve reliability", - true); + "request-learn", + false, + "If this option is specified, then haproxy will be able to learn the cookie found in the request in case the server does not specify any in response. This is typically what happens with PHPSESSID cookies, or when haproxy's session expires before the application's session and the correct server is selected. It is recommended to specify this option to improve reliability", + true); method.addParam( - "prefix", - false, - "When this option is specified, haproxy will match on the cookie prefix (or URL parameter prefix). " - + - "The appsession value is the data following this prefix. Example : appsession ASPSESSIONID len 64 timeout 3h prefix This will match the cookie ASPSESSIONIDXXXX=XXXXX, the appsession value will be XXXX=XXXXX.", - true); + "prefix", + false, + "When this option is specified, haproxy will match on the cookie prefix (or URL parameter prefix). " + + + "The appsession value is the data following this prefix. Example : appsession ASPSESSIONID len 64 timeout 3h prefix This will match the cookie ASPSESSIONIDXXXX=XXXXX, the appsession value will be XXXX=XXXXX.", + true); method.addParam( - "mode", - false, - "This option allows to change the URL parser mode. 2 modes are currently supported : - path-parameters " + - ": The parser looks for the appsession in the path parameters part (each parameter is separated by a semi-colon), " + - "which is convenient for JSESSIONID for example.This is the default mode if the option is not set. - query-string :" + - " In this mode, the parser will look for the appsession in the query string.", - false); + "mode", + false, + "This option allows to change the URL parser mode. 2 modes are currently supported : - path-parameters " + + ": The parser looks for the appsession in the path parameters part (each parameter is separated by a semi-colon), " + + "which is convenient for JSESSIONID for example.This is the default mode if the option is not set. - query-string :" + + " In this mode, the parser will look for the appsession in the query string.", + false); methodList.add(method); method = new LbStickinessMethod(StickinessMethodType.SourceBased, "This is source based Stickiness method, " + - "it can be used for any type of protocol."); + "it can be used for any type of protocol."); method.addParam("tablesize", false, "Size of table to store source ip addresses. example: tablesize=200k or 300m" + - " or 400g. Default value:200k", false); + " or 400g. Default value:200k", false); method.addParam("expire", false, "Entry in source ip table will expire after expire duration. units can be s,m,h,d ." + - " example: expire=30m 20s 50h 4d. Default value:3h", false); + " example: expire=30m 20s 50h 4d. Default value:3h", false); methodList.add(method); Gson gson = new Gson(); @@ -374,14 +374,14 @@ public class OvsElement extends AdapterBase implements NetworkElement, @Override public HostVO createHostVOForConnectedAgent(HostVO host, - StartupCommand[] cmd) { + StartupCommand[] cmd) { return null; } @Override public HostVO createHostVOForDirectConnectAgent(HostVO host, - StartupCommand[] startup, ServerResource resource, - Map details, List hostTags) { + StartupCommand[] startup, ServerResource resource, + Map details, List hostTags) { if (!(startup[0] instanceof StartupOvsCommand)) { return null; } @@ -391,7 +391,7 @@ public class OvsElement extends AdapterBase implements NetworkElement, @Override public DeleteHostAnswer deleteHost(HostVO host, boolean isForced, - boolean isForceDeleteStorage) throws UnableDeleteHostException { + boolean isForceDeleteStorage) throws UnableDeleteHostException { if (!(host.getType() == Host.Type.L2Networking)) { return null; } @@ -405,8 +405,8 @@ public class OvsElement extends AdapterBase implements NetworkElement, @Override public boolean applyIps(Network network, - List ipAddress, Set services) - throws ResourceUnavailableException { + List ipAddress, Set services) + throws ResourceUnavailableException { boolean canHandle = true; for (Service service : services) { // check if Ovs can handle services except SourceNat & Firewall @@ -417,11 +417,11 @@ public class OvsElement extends AdapterBase implements NetworkElement, } if (canHandle) { List routers = _routerDao.listByNetworkAndRole( - network.getId(), Role.VIRTUAL_ROUTER); + network.getId(), Role.VIRTUAL_ROUTER); if (routers == null || routers.isEmpty()) { s_logger.debug("Virtual router element doesn't need to associate ip addresses on the backend; virtual " - + "router doesn't exist in the network " - + network.getId()); + + "router doesn't exist in the network " + + network.getId()); return true; } @@ -433,15 +433,15 @@ public class OvsElement extends AdapterBase implements NetworkElement, @Override public boolean applyStaticNats(Network network, List rules) - throws ResourceUnavailableException { + throws ResourceUnavailableException { if (!canHandle(network, Service.StaticNat)) { return false; } List routers = _routerDao.listByNetworkAndRole( - network.getId(), Role.VIRTUAL_ROUTER); + network.getId(), Role.VIRTUAL_ROUTER); if (routers == null || routers.isEmpty()) { s_logger.debug("Ovs element doesn't need to apply static nat on the backend; virtual " - + "router doesn't exist in the network " + network.getId()); + + "router doesn't exist in the network " + network.getId()); return true; } @@ -450,15 +450,15 @@ public class OvsElement extends AdapterBase implements NetworkElement, @Override public boolean applyPFRules(Network network, List rules) - throws ResourceUnavailableException { + throws ResourceUnavailableException { if (!canHandle(network, Service.PortForwarding)) { return false; } List routers = _routerDao.listByNetworkAndRole( - network.getId(), Role.VIRTUAL_ROUTER); + network.getId(), Role.VIRTUAL_ROUTER); if (routers == null || routers.isEmpty()) { s_logger.debug("Ovs element doesn't need to apply firewall rules on the backend; virtual " - + "router doesn't exist in the network " + network.getId()); + + "router doesn't exist in the network " + network.getId()); return true; } @@ -467,25 +467,25 @@ public class OvsElement extends AdapterBase implements NetworkElement, @Override public boolean applyLBRules(Network network, List rules) - throws ResourceUnavailableException { + throws ResourceUnavailableException { if (canHandle(network, Service.Lb)) { if (!canHandleLbRules(rules)) { return false; } List routers = _routerDao.listByNetworkAndRole( - network.getId(), Role.VIRTUAL_ROUTER); + network.getId(), Role.VIRTUAL_ROUTER); if (routers == null || routers.isEmpty()) { s_logger.debug("Virtual router elemnt doesn't need to apply firewall rules on the backend; virtual " - + "router doesn't exist in the network " - + network.getId()); + + "router doesn't exist in the network " + + network.getId()); return true; } if (!_routerMgr.applyLoadBalancingRules(network, rules, routers)) { throw new CloudRuntimeException( - "Failed to apply load balancing rules in network " - + network.getId()); + "Failed to apply load balancing rules in network " + + network.getId()); } else { return true; } @@ -500,7 +500,7 @@ public class OvsElement extends AdapterBase implements NetworkElement, rules.add(rule); if (canHandle(network, Service.Lb) && canHandleLbRules(rules)) { List routers = _routerDao.listByNetworkAndRole( - network.getId(), Role.VIRTUAL_ROUTER); + network.getId(), Role.VIRTUAL_ROUTER); if (routers == null || routers.isEmpty()) { return true; } @@ -511,21 +511,21 @@ public class OvsElement extends AdapterBase implements NetworkElement, @Override public List updateHealthChecks(Network network, - List lbrules) { + List lbrules) { // TODO Auto-generated method stub return null; } private boolean canHandleLbRules(List rules) { - Map lbCaps = this.getCapabilities().get(Service.Lb); + Map lbCaps = getCapabilities().get(Service.Lb); if (!lbCaps.isEmpty()) { String schemeCaps = lbCaps.get(Capability.LbSchemes); if (schemeCaps != null) { for (LoadBalancingRule rule : rules) { if (!schemeCaps.contains(rule.getScheme().toString())) { s_logger.debug("Scheme " + rules.get(0).getScheme() - + " is not supported by the provider " - + this.getName()); + + " is not supported by the provider " + + getName()); return false; } } @@ -539,13 +539,13 @@ public class OvsElement extends AdapterBase implements NetworkElement, for (LbStickinessPolicy stickinessPolicy : rule.getStickinessPolicies()) { List> paramsList = stickinessPolicy - .getParams(); + .getParams(); if (StickinessMethodType.LBCookieBased.getName().equalsIgnoreCase( - stickinessPolicy.getMethodName())) { + stickinessPolicy.getMethodName())) { } else if (StickinessMethodType.SourceBased.getName() - .equalsIgnoreCase(stickinessPolicy.getMethodName())) { + .equalsIgnoreCase(stickinessPolicy.getMethodName())) { String tablesize = "200k"; // optional String expire = "30m"; // optional @@ -559,38 +559,29 @@ public class OvsElement extends AdapterBase implements NetworkElement, expire = value; } if ((expire != null) - && !containsOnlyNumbers(expire, timeEndChar)) { + && !containsOnlyNumbers(expire, timeEndChar)) { throw new InvalidParameterValueException( - "Failed LB in validation rule id: " + rule.getId() + "Failed LB in validation rule id: " + rule.getId() + " Cause: expire is not in timeformat: " + expire); } if ((tablesize != null) - && !containsOnlyNumbers(tablesize, "kmg")) { + && !containsOnlyNumbers(tablesize, "kmg")) { throw new InvalidParameterValueException( - "Failed LB in validation rule id: " - + rule.getId() - + " Cause: tablesize is not in size format: " - + tablesize); + "Failed LB in validation rule id: " + + rule.getId() + + " Cause: tablesize is not in size format: " + + tablesize); } } else if (StickinessMethodType.AppCookieBased.getName() - .equalsIgnoreCase(stickinessPolicy.getMethodName())) { - /* - * FORMAT : appsession len timeout - * [request-learn] [prefix] [mode - * ] - */ - /* example: appsession JSESSIONID len 52 timeout 3h */ - String cookieName = null; // optional + .equalsIgnoreCase(stickinessPolicy.getMethodName())) { String length = null; // optional String holdTime = null; // optional for (Pair paramKV : paramsList) { String key = paramKV.first(); String value = paramKV.second(); - if ("cookie-name".equalsIgnoreCase(key)) - cookieName = value; if ("length".equalsIgnoreCase(key)) length = value; if ("holdtime".equalsIgnoreCase(key)) @@ -599,15 +590,15 @@ public class OvsElement extends AdapterBase implements NetworkElement, if ((length != null) && (!containsOnlyNumbers(length, null))) { throw new InvalidParameterValueException( - "Failed LB in validation rule id: " + rule.getId() + "Failed LB in validation rule id: " + rule.getId() + " Cause: length is not a number: " + length); } if ((holdTime != null) - && (!containsOnlyNumbers(holdTime, timeEndChar) && !containsOnlyNumbers( - holdTime, null))) { + && (!containsOnlyNumbers(holdTime, timeEndChar) && !containsOnlyNumbers( + holdTime, null))) { throw new InvalidParameterValueException( - "Failed LB in validation rule id: " + rule.getId() + "Failed LB in validation rule id: " + rule.getId() + " Cause: holdtime is not in timeformat: " + holdTime); } @@ -630,7 +621,7 @@ public class OvsElement extends AdapterBase implements NetworkElement, boolean matchedEndChar = false; if (str.length() < 2) return false; // atleast one numeric and one char. example: - // 3h + // 3h char strEnd = str.toCharArray()[str.length() - 1]; for (char c : endChar.toCharArray()) { if (strEnd == c) { @@ -643,7 +634,7 @@ public class OvsElement extends AdapterBase implements NetworkElement, return false; } try { - int i = Integer.parseInt(number); + Integer.parseInt(number); } catch (NumberFormatException e) { return false; } diff --git a/plugins/network-elements/ovs/src/com/cloud/network/guru/OvsGuestNetworkGuru.java b/plugins/network-elements/ovs/src/com/cloud/network/guru/OvsGuestNetworkGuru.java index 6aacbb21c62..8fa636da593 100644 --- a/plugins/network-elements/ovs/src/com/cloud/network/guru/OvsGuestNetworkGuru.java +++ b/plugins/network-elements/ovs/src/com/cloud/network/guru/OvsGuestNetworkGuru.java @@ -144,10 +144,6 @@ public class OvsGuestNetworkGuru extends GuestNetworkGuru { if (network.getCidr() != null) { implemented.setCidr(network.getCidr()); } - String name = network.getName(); - if (name == null || name.isEmpty()) { - name = ((NetworkVO)network).getUuid(); - } // do we need to create switch right now? diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManager.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManager.java index eaf2d66c46e..118beeb58cb 100644 --- a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManager.java +++ b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManager.java @@ -26,8 +26,8 @@ public interface OvsTunnelManager extends Manager { boolean isOvsTunnelEnabled(); - public void VmCheckAndCreateTunnel(VirtualMachineProfile vm, Network nw, DeployDestination dest); + public void vmCheckAndCreateTunnel(VirtualMachineProfile vm, Network nw, DeployDestination dest); - public void CheckAndDestroyTunnel(VirtualMachine vm, Network nw); + public void checkAndDestroyTunnel(VirtualMachine vm, Network nw); } diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java index aa0f42e617e..320568ba084 100644 --- a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java +++ b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java @@ -104,7 +104,7 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage @Override public boolean configure(String name, Map params) - throws ConfigurationException { + throws ConfigurationException { _executorPool = Executors.newScheduledThreadPool(10, new NamedThreadFactory("OVS")); _cleanupExecutor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("OVS-Cleanup")); @@ -113,13 +113,13 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage @DB protected OvsTunnelInterfaceVO createInterfaceRecord(String ip, - String netmask, String mac, long hostId, String label) { + String netmask, String mac, long hostId, String label) { OvsTunnelInterfaceVO ti = null; try { ti = new OvsTunnelInterfaceVO(ip, netmask, mac, hostId, label); // TODO: Is locking really necessary here? OvsTunnelInterfaceVO lock = _tunnelInterfaceDao - .acquireInLockTable(Long.valueOf(1)); + .acquireInLockTable(Long.valueOf(1)); if (lock == null) { s_logger.warn("Cannot lock table ovs_tunnel_account"); return null; @@ -128,7 +128,7 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage _tunnelInterfaceDao.releaseFromLockTable(lock.getId()); } catch (EntityExistsException e) { s_logger.debug("A record for the interface for network " + label - + " on host id " + hostId + " already exists"); + + " on host id " + hostId + " already exists"); } return ti; } @@ -138,13 +138,13 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage if (ans.getResult()) { if (ans.getIp() != null && !("".equals(ans.getIp()))) { OvsTunnelInterfaceVO ti = createInterfaceRecord(ans.getIp(), - ans.getNetmask(), ans.getMac(), hostId, ans.getLabel()); + ans.getNetmask(), ans.getMac(), hostId, ans.getLabel()); return ti.getIp(); } } // Fetch interface failed! s_logger.warn("Unable to fetch the IP address for the GRE tunnel endpoint" - + ans.getDetails()); + + ans.getDetails()); return null; } @@ -169,22 +169,22 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage private void handleCreateTunnelAnswer(Answer[] answers) { OvsCreateTunnelAnswer r = (OvsCreateTunnelAnswer)answers[0]; String s = - String.format("(hostIP:%1$s, remoteIP:%2$s, bridge:%3$s," + "greKey:%4$s, portName:%5$s)", r.getFromIp(), r.getToIp(), r.getBridge(), r.getKey(), - r.getInPortName()); + String.format("(hostIP:%1$s, remoteIP:%2$s, bridge:%3$s," + "greKey:%4$s, portName:%5$s)", r.getFromIp(), r.getToIp(), r.getBridge(), r.getKey(), + r.getInPortName()); Long from = r.getFrom(); Long to = r.getTo(); long networkId = r.getNetworkId(); OvsTunnelNetworkVO tunnel = _tunnelNetworkDao.getByFromToNetwork(from, to, networkId); if (tunnel == null) { throw new CloudRuntimeException( - String.format("Unable find tunnelNetwork record" + - "(from=%1$s,to=%2$s, account=%3$s", - from, to, networkId)); + String.format("Unable find tunnelNetwork record" + + "(from=%1$s,to=%2$s, account=%3$s", + from, to, networkId)); } if (!r.getResult()) { tunnel.setState("FAILED"); s_logger.warn("Create GRE tunnel failed due to " + r.getDetails() - + s); + + s); } else { tunnel.setState("SUCCESS"); tunnel.setPortName(r.getInPortName()); @@ -194,31 +194,31 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage } private String getGreEndpointIP(Host host, Network nw) - throws AgentUnavailableException, OperationTimedoutException { + throws AgentUnavailableException, OperationTimedoutException { String endpointIp = null; // Fetch fefault name for network label from configuration String physNetLabel = _configDao.getValue(Config.OvsTunnelNetworkDefaultLabel.key()); Long physNetId = nw.getPhysicalNetworkId(); PhysicalNetworkTrafficType physNetTT = - _physNetTTDao.findBy(physNetId, TrafficType.Guest); + _physNetTTDao.findBy(physNetId, TrafficType.Guest); HypervisorType hvType = host.getHypervisorType(); String label = null; switch (hvType) { - case XenServer: - label = physNetTT.getXenNetworkLabel(); - if ((label != null) && (!label.equals(""))) { - physNetLabel = label; - } - break; - case KVM: - label = physNetTT.getKvmNetworkLabel(); - if ((label != null) && (!label.equals(""))) { - physNetLabel = label; - } - break; - default: - throw new CloudRuntimeException("Hypervisor " + + case XenServer: + label = physNetTT.getXenNetworkLabel(); + if ((label != null) && (!label.equals(""))) { + physNetLabel = label; + } + break; + case KVM: + label = physNetTT.getKvmNetworkLabel(); + if ((label != null) && (!label.equals(""))) { + physNetLabel = label; + } + break; + default: + throw new CloudRuntimeException("Hypervisor " + hvType.toString() + " unsupported by OVS Tunnel Manager"); } @@ -226,16 +226,16 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage // Try to fetch GRE endpoint IP address for cloud db // If not found, then find it on the hypervisor OvsTunnelInterfaceVO tunnelIface = - _tunnelInterfaceDao.getByHostAndLabel(host.getId(), - physNetLabel); + _tunnelInterfaceDao.getByHostAndLabel(host.getId(), + physNetLabel); if (tunnelIface == null) { //Now find and fetch configuration for physical interface //for network with label on target host Commands fetchIfaceCmds = - new Commands(new OvsFetchInterfaceCommand(physNetLabel)); + new Commands(new OvsFetchInterfaceCommand(physNetLabel)); s_logger.debug("Ask host " + host.getId() + - " to retrieve interface for phy net with label:" + - physNetLabel); + " to retrieve interface for phy net with label:" + + physNetLabel); Answer[] fetchIfaceAnswers = _agentMgr.send(host.getId(), fetchIfaceCmds); //And finally save it for future use endpointIp = handleFetchInterfaceAnswer(fetchIfaceAnswers, host.getId()); @@ -255,26 +255,26 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage // !! not in the case of lswitch/pvlan/(possibly)vswitch // So we now feel quite safe in converting it into a string // by calling the appropriate BroadcastDomainType method - key = Integer.valueOf(keyStr); + key = Integer.parseInt(keyStr); return key; } catch (NumberFormatException e) { s_logger.debug("Well well, how did '" + key - + "' end up in the broadcast URI for the network?"); + + "' end up in the broadcast URI for the network?"); throw new CloudRuntimeException(String.format( - "Invalid GRE key parsed from" - + "network broadcast URI (%s)", network - .getBroadcastUri().toString())); + "Invalid GRE key parsed from" + + "network broadcast URI (%s)", network + .getBroadcastUri().toString())); } } @DB - protected void CheckAndCreateTunnel(VirtualMachine instance, Network nw, DeployDestination dest) { + protected void checkAndCreateTunnel(VirtualMachine instance, Network nw, DeployDestination dest) { s_logger.debug("Creating tunnels with OVS tunnel manager"); if (instance.getType() != VirtualMachine.Type.User - && instance.getType() != VirtualMachine.Type.DomainRouter) { + && instance.getType() != VirtualMachine.Type.DomainRouter) { s_logger.debug("Will not work if you're not" - + "an instance or a virtual router"); + + "an instance or a virtual router"); return; } @@ -282,8 +282,8 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage int key = getGreKey(nw); // Find active VMs with a NIC on the target network List vms = _userVmDao.listByNetworkIdAndStates(nw.getId(), - State.Running, State.Starting, State.Stopping, State.Unknown, - State.Migrating); + State.Running, State.Starting, State.Stopping, State.Unknown, + State.Migrating); // Find routers for the network List routers = _routerDao.findByNetwork(nw.getId()); List ins = new ArrayList(); @@ -313,14 +313,14 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage } ta = _tunnelNetworkDao.getByFromToNetwork(rh.longValue(), - hostId, nw.getId()); + hostId, nw.getId()); // Try and create the tunnel even if a previous attempt failed if (ta == null || ta.getState().equals("FAILED")) { s_logger.debug("Attempting to create tunnel from:" + - rh.longValue() + " to:" + hostId); + rh.longValue() + " to:" + hostId); if (ta == null) { createTunnelRecord(rh.longValue(), hostId, - nw.getId(), key); + nw.getId(), key); } if (!fromHostIds.contains(rh)) { fromHostIds.add(rh); @@ -338,14 +338,14 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage String otherIp = getGreEndpointIP(rHost, nw); if (otherIp == null) throw new GreTunnelException( - "Unable to retrieve the remote " - + "endpoint for the GRE tunnel." - + "Failure is on host:" + rHost.getId()); + "Unable to retrieve the remote " + + "endpoint for the GRE tunnel." + + "Failure is on host:" + rHost.getId()); Commands cmds = new Commands( - new OvsCreateTunnelCommand(otherIp, key, - Long.valueOf(hostId), i, nw.getId(), myIp)); + new OvsCreateTunnelCommand(otherIp, key, + Long.valueOf(hostId), i, nw.getId(), myIp)); s_logger.debug("Ask host " + hostId - + " to create gre tunnel to " + i); + + " to create gre tunnel to " + i); Answer[] answers = _agentMgr.send(hostId, cmds); handleCreateTunnelAnswer(answers); noHost = false; @@ -355,9 +355,9 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage HostVO rHost = _hostDao.findById(i); String otherIp = getGreEndpointIP(rHost, nw); Commands cmds = new Commands(new OvsCreateTunnelCommand(myIp, - key, i, Long.valueOf(hostId), nw.getId(), otherIp)); + key, i, Long.valueOf(hostId), nw.getId(), otherIp)); s_logger.debug("Ask host " + i + " to create gre tunnel to " - + hostId); + + hostId); Answer[] answers = _agentMgr.send(i, cmds); handleCreateTunnelAnswer(answers); noHost = false; @@ -367,13 +367,13 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage // This will ensure VIF rules will be triggered if (noHost) { Commands cmds = new Commands(new OvsSetupBridgeCommand(key, - hostId, nw.getId())); + hostId, nw.getId())); s_logger.debug("Ask host " + hostId - + " to configure bridge for network:" + nw.getId()); + + " to configure bridge for network:" + nw.getId()); Answer[] answers = _agentMgr.send(hostId, cmds); handleSetupBridgeAnswer(answers); } - } catch (Exception e) { + } catch (GreTunnelException | OperationTimedoutException | AgentUnavailableException e) { // I really thing we should do a better handling of these exceptions s_logger.warn("Ovs Tunnel network created tunnel failed", e); } @@ -385,9 +385,9 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage } @Override - public void VmCheckAndCreateTunnel(VirtualMachineProfile vm, - Network nw, DeployDestination dest) { - CheckAndCreateTunnel(vm.getVirtualMachine(), nw, dest); + public void vmCheckAndCreateTunnel(VirtualMachineProfile vm, + Network nw, DeployDestination dest) { + checkAndCreateTunnel(vm.getVirtualMachine(), nw, dest); } @DB @@ -396,9 +396,9 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage OvsTunnelNetworkVO lock = _tunnelNetworkDao.acquireInLockTable(Long.valueOf(1)); if (lock == null) { s_logger.warn(String.format("failed to lock" + - "ovs_tunnel_account, remove record of " + - "tunnel(from=%1$s, to=%2$s account=%3$s) failed", - from, to, networkId)); + "ovs_tunnel_account, remove record of " + + "tunnel(from=%1$s, to=%2$s account=%3$s) failed", + from, to, networkId)); return; } @@ -406,8 +406,8 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage _tunnelNetworkDao.releaseFromLockTable(lock.getId()); s_logger.debug(String.format("Destroy tunnel(account:%1$s," + - "from:%2$s, to:%3$s) successful", - networkId, from, to)); + "from:%2$s, to:%3$s) successful", + networkId, from, to)); } else { s_logger.debug(String.format("Destroy tunnel(account:%1$s," + "from:%2$s, to:%3$s) failed", networkId, from, to)); } @@ -427,10 +427,10 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage _tunnelNetworkDao.releaseFromLockTable(lock.getId()); s_logger.debug(String.format("Destroy bridge for" + - "network %1$s successful", networkId)); + "network %1$s successful", networkId)); } else { s_logger.debug(String.format("Destroy bridge for" + - "network %1$s failed", networkId)); + "network %1$s failed", networkId)); } } @@ -440,7 +440,7 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage } @Override - public void CheckAndDestroyTunnel(VirtualMachine vm, Network nw) { + public void checkAndDestroyTunnel(VirtualMachine vm, Network nw) { // if (!_isEnabled) { // return; // } @@ -453,7 +453,7 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage List routers = _routerDao.findByNetwork(nw.getId()); for (DomainRouterVO router : routers) { - if (router.getHostId() == vm.getHostId()) { + if (router.getHostId().equals(vm.getHostId())) { return; } } @@ -471,18 +471,18 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage /* Then ask hosts have peer tunnel with me to destroy them */ List peers = - _tunnelNetworkDao.listByToNetwork(vm.getHostId(), - nw.getId()); + _tunnelNetworkDao.listByToNetwork(vm.getHostId(), + nw.getId()); for (OvsTunnelNetworkVO p : peers) { // If the tunnel was not successfully created don't bother to remove it if (p.getState().equals("SUCCESS")) { cmd = new OvsDestroyTunnelCommand(p.getNetworkId(), key, - p.getPortName()); + p.getPortName()); s_logger.debug("Destroying tunnel to " + vm.getHostId() + - " from " + p.getFrom()); + " from " + p.getFrom()); ans = _agentMgr.send(p.getFrom(), cmd); handleDestroyTunnelAnswer(ans, p.getFrom(), - p.getTo(), p.getNetworkId()); + p.getTo(), p.getNetworkId()); } } } catch (Exception e) { diff --git a/plugins/network-elements/palo-alto/src/com/cloud/api/commands/AddPaloAltoFirewallCmd.java b/plugins/network-elements/palo-alto/src/com/cloud/api/commands/AddPaloAltoFirewallCmd.java index 7aba9c2a9d2..a2b2cbb9e6f 100644 --- a/plugins/network-elements/palo-alto/src/com/cloud/api/commands/AddPaloAltoFirewallCmd.java +++ b/plugins/network-elements/palo-alto/src/com/cloud/api/commands/AddPaloAltoFirewallCmd.java @@ -40,7 +40,8 @@ import com.cloud.network.dao.ExternalFirewallDeviceVO; import com.cloud.network.element.PaloAltoFirewallElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "addPaloAltoFirewall", responseObject = PaloAltoFirewallResponse.class, description = "Adds a Palo Alto firewall device") +@APICommand(name = "addPaloAltoFirewall", responseObject = PaloAltoFirewallResponse.class, description = "Adds a Palo Alto firewall device", + requestHasSensitiveInfo = true, responseHasSensitiveInfo = false) public class AddPaloAltoFirewallCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(AddPaloAltoFirewallCmd.class.getName()); private static final String s_name = "addpaloaltofirewallresponse"; diff --git a/plugins/network-elements/palo-alto/src/com/cloud/api/commands/ConfigurePaloAltoFirewallCmd.java b/plugins/network-elements/palo-alto/src/com/cloud/api/commands/ConfigurePaloAltoFirewallCmd.java index 80f02ad07d9..0c6b3f7c9e9 100644 --- a/plugins/network-elements/palo-alto/src/com/cloud/api/commands/ConfigurePaloAltoFirewallCmd.java +++ b/plugins/network-elements/palo-alto/src/com/cloud/api/commands/ConfigurePaloAltoFirewallCmd.java @@ -39,7 +39,8 @@ import com.cloud.network.dao.ExternalFirewallDeviceVO; import com.cloud.network.element.PaloAltoFirewallElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "configurePaloAltoFirewall", responseObject = PaloAltoFirewallResponse.class, description = "Configures a Palo Alto firewall device") +@APICommand(name = "configurePaloAltoFirewall", responseObject = PaloAltoFirewallResponse.class, description = "Configures a Palo Alto firewall device", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ConfigurePaloAltoFirewallCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ConfigurePaloAltoFirewallCmd.class.getName()); diff --git a/plugins/network-elements/palo-alto/src/com/cloud/api/commands/DeletePaloAltoFirewallCmd.java b/plugins/network-elements/palo-alto/src/com/cloud/api/commands/DeletePaloAltoFirewallCmd.java index 4f147eb6fd1..f59cb386b37 100644 --- a/plugins/network-elements/palo-alto/src/com/cloud/api/commands/DeletePaloAltoFirewallCmd.java +++ b/plugins/network-elements/palo-alto/src/com/cloud/api/commands/DeletePaloAltoFirewallCmd.java @@ -39,7 +39,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.element.PaloAltoFirewallElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "deletePaloAltoFirewall", responseObject = SuccessResponse.class, description = " delete a Palo Alto firewall device") +@APICommand(name = "deletePaloAltoFirewall", responseObject = SuccessResponse.class, description = " delete a Palo Alto firewall device", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeletePaloAltoFirewallCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeletePaloAltoFirewallCmd.class.getName()); private static final String s_name = "deletepaloaltofirewallresponse"; diff --git a/plugins/network-elements/palo-alto/src/com/cloud/api/commands/ListPaloAltoFirewallNetworksCmd.java b/plugins/network-elements/palo-alto/src/com/cloud/api/commands/ListPaloAltoFirewallNetworksCmd.java index a7e71d3fd70..291663e5824 100644 --- a/plugins/network-elements/palo-alto/src/com/cloud/api/commands/ListPaloAltoFirewallNetworksCmd.java +++ b/plugins/network-elements/palo-alto/src/com/cloud/api/commands/ListPaloAltoFirewallNetworksCmd.java @@ -43,7 +43,8 @@ import com.cloud.network.Network; import com.cloud.network.element.PaloAltoFirewallElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "listPaloAltoFirewallNetworks", responseObject = NetworkResponse.class, description = "lists network that are using Palo Alto firewall device") +@APICommand(name = "listPaloAltoFirewallNetworks", responseObject = NetworkResponse.class, description = "lists network that are using Palo Alto firewall device", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListPaloAltoFirewallNetworksCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListPaloAltoFirewallNetworksCmd.class.getName()); diff --git a/plugins/network-elements/palo-alto/src/com/cloud/api/commands/ListPaloAltoFirewallsCmd.java b/plugins/network-elements/palo-alto/src/com/cloud/api/commands/ListPaloAltoFirewallsCmd.java index ad4be72cce8..cce3ac2b36b 100644 --- a/plugins/network-elements/palo-alto/src/com/cloud/api/commands/ListPaloAltoFirewallsCmd.java +++ b/plugins/network-elements/palo-alto/src/com/cloud/api/commands/ListPaloAltoFirewallsCmd.java @@ -42,7 +42,8 @@ import com.cloud.network.dao.ExternalFirewallDeviceVO; import com.cloud.network.element.PaloAltoFirewallElementService; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "listPaloAltoFirewalls", responseObject = PaloAltoFirewallResponse.class, description = "lists Palo Alto firewall devices in a physical network") +@APICommand(name = "listPaloAltoFirewalls", responseObject = PaloAltoFirewallResponse.class, description = "lists Palo Alto firewall devices in a physical network", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListPaloAltoFirewallsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListPaloAltoFirewallsCmd.class.getName()); diff --git a/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/api/commands/AddSspCmd.java b/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/api/commands/AddSspCmd.java index 085f873eceb..8558c8c0522 100644 --- a/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/api/commands/AddSspCmd.java +++ b/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/api/commands/AddSspCmd.java @@ -37,7 +37,8 @@ import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.host.Host; -@APICommand(name = "addStratosphereSsp", responseObject = SspResponse.class, description = "Adds stratosphere ssp server") +@APICommand(name = "addStratosphereSsp", responseObject = SspResponse.class, description = "Adds stratosphere ssp server", + requestHasSensitiveInfo = true, responseHasSensitiveInfo = false) public class AddSspCmd extends BaseCmd { private static final Logger s_logger = Logger.getLogger(AddSspCmd.class.getName()); @Inject diff --git a/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/api/commands/DeleteSspCmd.java b/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/api/commands/DeleteSspCmd.java index e23f64232d5..9eafa0e087c 100644 --- a/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/api/commands/DeleteSspCmd.java +++ b/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/api/commands/DeleteSspCmd.java @@ -35,7 +35,8 @@ import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -@APICommand(name = "deleteStratosphereSsp", responseObject = SuccessResponse.class, description = "Removes stratosphere ssp server") +@APICommand(name = "deleteStratosphereSsp", responseObject = SuccessResponse.class, description = "Removes stratosphere ssp server", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteSspCmd extends BaseCmd { private static final Logger s_logger = Logger.getLogger(AddSspCmd.class.getName()); @Inject diff --git a/plugins/pom.xml b/plugins/pom.xml index b1bafee1524..097f2246013 100755 --- a/plugins/pom.xml +++ b/plugins/pom.xml @@ -22,6 +22,19 @@ install + + + org.apache.maven.plugins + maven-checkstyle-plugin + + + cloudstack-checkstyle + none + false + + + + api/rate-limit @@ -160,6 +173,17 @@ network-elements/cisco-vnmc + + mysqlha + + + noredist + + + + database/mysql-ha + + simulator diff --git a/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java b/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java index 37861b48562..3c1b76a62d3 100644 --- a/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java +++ b/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java @@ -27,8 +27,6 @@ import java.util.UUID; import javax.inject.Inject; -import org.apache.log4j.Logger; - import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope; import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; @@ -40,6 +38,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope; import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; import org.apache.cloudstack.storage.volume.datastore.PrimaryDataStoreHelper; +import org.apache.log4j.Logger; import com.cloud.agent.AgentManager; import com.cloud.agent.api.Answer; @@ -167,6 +166,12 @@ public class CloudStackPrimaryDataStoreLifeCycleImpl implements PrimaryDataStore if (uriPath == null) { throw new InvalidParameterValueException("host or path is null, should be rbd://hostname/pool"); } + } else if (uri.getScheme().equalsIgnoreCase("gluster")) { + String uriHost = uri.getHost(); + String uriPath = uri.getPath(); + if (uriHost == null || uriPath == null || uriHost.trim().isEmpty() || uriPath.trim().isEmpty()) { + throw new InvalidParameterValueException("host or path is null, should be gluster://hostname/volume"); + } } } catch (URISyntaxException e) { throw new InvalidParameterValueException(url + " is not a valid uri"); @@ -250,7 +255,7 @@ public class CloudStackPrimaryDataStoreLifeCycleImpl implements PrimaryDataStore if (clusterId == null) { throw new IllegalArgumentException("IscsiLUN need to have clusters specified"); } - hostPath.replaceFirst("/", ""); + hostPath = hostPath.replaceFirst("/", ""); parameters.setType(StoragePoolType.IscsiLUN); parameters.setHost(storageHost); parameters.setPort(port); @@ -289,6 +294,14 @@ public class CloudStackPrimaryDataStoreLifeCycleImpl implements PrimaryDataStore parameters.setHost("clustered"); parameters.setPort(port); parameters.setPath(hostPath); + } else if (scheme.equalsIgnoreCase("gluster")) { + if (port == -1) { + port = 24007; + } + parameters.setType(StoragePoolType.Gluster); + parameters.setHost(storageHost); + parameters.setPort(port); + parameters.setPath(hostPath); } else { StoragePoolType type = Enum.valueOf(StoragePoolType.class, scheme); @@ -321,7 +334,7 @@ public class CloudStackPrimaryDataStoreLifeCycleImpl implements PrimaryDataStore } else if (scheme.equalsIgnoreCase("PreSetup")) { uuid = hostPath.replace("/", ""); } else { - uuid = UUID.nameUUIDFromBytes(new String(storageHost + hostPath).getBytes()).toString(); + uuid = UUID.nameUUIDFromBytes((storageHost + hostPath).getBytes()).toString(); } List spHandles = primaryDataStoreDao.findIfDuplicatePoolsExistByUUID(uuid); @@ -348,9 +361,10 @@ public class CloudStackPrimaryDataStoreLifeCycleImpl implements PrimaryDataStore s_logger.debug("creating pool " + pool.getName() + " on host " + hostId); if (pool.getPoolType() != StoragePoolType.NetworkFilesystem && pool.getPoolType() != StoragePoolType.Filesystem && - pool.getPoolType() != StoragePoolType.IscsiLUN && pool.getPoolType() != StoragePoolType.Iscsi && pool.getPoolType() != StoragePoolType.VMFS && - pool.getPoolType() != StoragePoolType.SharedMountPoint && pool.getPoolType() != StoragePoolType.PreSetup && pool.getPoolType() != StoragePoolType.OCFS2 && - pool.getPoolType() != StoragePoolType.RBD && pool.getPoolType() != StoragePoolType.CLVM && pool.getPoolType() != StoragePoolType.SMB) { + pool.getPoolType() != StoragePoolType.IscsiLUN && pool.getPoolType() != StoragePoolType.Iscsi && pool.getPoolType() != StoragePoolType.VMFS && + pool.getPoolType() != StoragePoolType.SharedMountPoint && pool.getPoolType() != StoragePoolType.PreSetup && pool.getPoolType() != StoragePoolType.OCFS2 && + pool.getPoolType() != StoragePoolType.RBD && pool.getPoolType() != StoragePoolType.CLVM && pool.getPoolType() != StoragePoolType.SMB && + pool.getPoolType() != StoragePoolType.Gluster) { s_logger.warn(" Doesn't support storage pool type " + pool.getPoolType()); return false; } @@ -377,7 +391,7 @@ public class CloudStackPrimaryDataStoreLifeCycleImpl implements PrimaryDataStore PrimaryDataStoreInfo primarystore = (PrimaryDataStoreInfo)store; // Check if there is host up in this cluster List allHosts = - _resourceMgr.listAllUpAndEnabledHosts(Host.Type.Routing, primarystore.getClusterId(), primarystore.getPodId(), primarystore.getDataCenterId()); + _resourceMgr.listAllUpAndEnabledHosts(Host.Type.Routing, primarystore.getClusterId(), primarystore.getPodId(), primarystore.getDataCenterId()); if (allHosts.isEmpty()) { primaryDataStoreDao.expunge(primarystore.getId()); throw new CloudRuntimeException("No host up to associate a storage pool with in cluster " + primarystore.getClusterId()); diff --git a/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/provider/CloudStackPrimaryDataStoreProviderImpl.java b/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/provider/CloudStackPrimaryDataStoreProviderImpl.java index 410416c4499..a02e3660830 100644 --- a/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/provider/CloudStackPrimaryDataStoreProviderImpl.java +++ b/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/provider/CloudStackPrimaryDataStoreProviderImpl.java @@ -34,7 +34,6 @@ import com.cloud.utils.component.ComponentContext; public class CloudStackPrimaryDataStoreProviderImpl implements PrimaryDataStoreProvider { - private final String providerName = DataStoreProvider.DEFAULT_PRIMARY; protected PrimaryDataStoreDriver driver; protected HypervisorHostListener listener; protected DataStoreLifeCycle lifecycle; @@ -45,12 +44,12 @@ public class CloudStackPrimaryDataStoreProviderImpl implements PrimaryDataStoreP @Override public String getName() { - return providerName; + return DataStoreProvider.DEFAULT_PRIMARY; } @Override public DataStoreLifeCycle getDataStoreLifeCycle() { - return this.lifecycle; + return lifecycle; } @Override @@ -63,12 +62,12 @@ public class CloudStackPrimaryDataStoreProviderImpl implements PrimaryDataStoreP @Override public PrimaryDataStoreDriver getDataStoreDriver() { - return this.driver; + return driver; } @Override public HypervisorHostListener getHostListener() { - return this.listener; + return listener; } @Override diff --git a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LDAPConfigCmd.java b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LDAPConfigCmd.java index 5e424dee9b4..619280dda6e 100644 --- a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LDAPConfigCmd.java +++ b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LDAPConfigCmd.java @@ -50,7 +50,9 @@ import com.cloud.utils.Pair; * @deprecated as of 4.3 use the new api {@link LdapAddConfigurationCmd} */ @Deprecated -@APICommand(name = "ldapConfig", description = "Configure the LDAP context for this site.", responseObject = LDAPConfigResponse.class, since = "3.0.0") +@APICommand(name = "ldapConfig", description = "Configure the LDAP context for this site.", responseObject = LDAPConfigResponse.class, since = "3.0.0", + requestHasSensitiveInfo = true, responseHasSensitiveInfo = false) + public class LDAPConfigCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(LDAPConfigCmd.class.getName()); diff --git a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LDAPRemoveCmd.java b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LDAPRemoveCmd.java index 535a545ade7..eb3729d9d9e 100644 --- a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LDAPRemoveCmd.java +++ b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LDAPRemoveCmd.java @@ -35,7 +35,8 @@ import com.cloud.utils.Pair; * @deprecated as of 4.3 use the new api {@link LdapDeleteConfigurationCmd} */ @Deprecated -@APICommand(name = "ldapRemove", description = "Remove the LDAP context for this site.", responseObject = LDAPConfigResponse.class, since = "3.0.1") +@APICommand(name = "ldapRemove", description = "Remove the LDAP context for this site.", responseObject = LDAPConfigResponse.class, since = "3.0.1", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class LDAPRemoveCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(LDAPRemoveCmd.class.getName()); diff --git a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapAddConfigurationCmd.java b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapAddConfigurationCmd.java index 56863747823..555d1a987fd 100644 --- a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapAddConfigurationCmd.java +++ b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapAddConfigurationCmd.java @@ -31,7 +31,8 @@ import org.apache.cloudstack.ldap.LdapManager; import com.cloud.exception.InvalidParameterValueException; import com.cloud.user.Account; -@APICommand(name = "addLdapConfiguration", description = "Add a new Ldap Configuration", responseObject = LdapConfigurationResponse.class, since = "4.2.0") +@APICommand(name = "addLdapConfiguration", description = "Add a new Ldap Configuration", responseObject = LdapConfigurationResponse.class, since = "4.2.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class LdapAddConfigurationCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(LdapAddConfigurationCmd.class.getName()); private static final String s_name = "ldapconfigurationresponse"; diff --git a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapCreateAccountCmd.java b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapCreateAccountCmd.java index abe61d1716e..626bb8fee62 100644 --- a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapCreateAccountCmd.java +++ b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapCreateAccountCmd.java @@ -43,7 +43,8 @@ import com.cloud.user.Account; import com.cloud.user.AccountService; import com.cloud.user.UserAccount; -@APICommand(name = "ldapCreateAccount", description = "Creates an account from an LDAP user", responseObject = AccountResponse.class, since = "4.2.0") +@APICommand(name = "ldapCreateAccount", description = "Creates an account from an LDAP user", responseObject = AccountResponse.class, since = "4.2.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class LdapCreateAccountCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(LdapCreateAccountCmd.class.getName()); private static final String s_name = "createaccountresponse"; diff --git a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapDeleteConfigurationCmd.java b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapDeleteConfigurationCmd.java index b45bce59e1e..30b37d8b88d 100644 --- a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapDeleteConfigurationCmd.java +++ b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapDeleteConfigurationCmd.java @@ -31,7 +31,8 @@ import org.apache.cloudstack.ldap.LdapManager; import com.cloud.exception.InvalidParameterValueException; import com.cloud.user.Account; -@APICommand(name = "deleteLdapConfiguration", description = "Remove an Ldap Configuration", responseObject = LdapConfigurationResponse.class, since = "4.2.0") +@APICommand(name = "deleteLdapConfiguration", description = "Remove an Ldap Configuration", responseObject = LdapConfigurationResponse.class, since = "4.2.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class LdapDeleteConfigurationCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(LdapDeleteConfigurationCmd.class.getName()); private static final String s_name = "ldapconfigurationresponse"; diff --git a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapImportUsersCmd.java b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapImportUsersCmd.java index 89cec6555b1..887ad009fd3 100644 --- a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapImportUsersCmd.java +++ b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapImportUsersCmd.java @@ -51,7 +51,8 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.AccountService; import com.cloud.user.DomainService; -@APICommand(name = "importLdapUsers", description = "Import LDAP users", responseObject = LdapUserResponse.class, since = "4.3.0") +@APICommand(name = "importLdapUsers", description = "Import LDAP users", responseObject = LdapUserResponse.class, since = "4.3.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class LdapImportUsersCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(LdapImportUsersCmd.class.getName()); diff --git a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapListConfigurationCmd.java b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapListConfigurationCmd.java index b50970f05f1..050fb36cb19 100644 --- a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapListConfigurationCmd.java +++ b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapListConfigurationCmd.java @@ -34,7 +34,8 @@ import org.apache.cloudstack.ldap.LdapManager; import com.cloud.user.Account; import com.cloud.utils.Pair; -@APICommand(name = "listLdapConfigurations", responseObject = LdapConfigurationResponse.class, description = "Lists all LDAP configurations", since = "4.2.0") +@APICommand(name = "listLdapConfigurations", responseObject = LdapConfigurationResponse.class, description = "Lists all LDAP configurations", since = "4.2.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class LdapListConfigurationCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(LdapListConfigurationCmd.class.getName()); diff --git a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapListUsersCmd.java b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapListUsersCmd.java index 5c65ac4a2b6..e655f5f4ac0 100644 --- a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapListUsersCmd.java +++ b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapListUsersCmd.java @@ -38,7 +38,8 @@ import org.apache.cloudstack.query.QueryService; import com.cloud.user.Account; -@APICommand(name = "listLdapUsers", responseObject = LdapUserResponse.class, description = "Lists all LDAP Users", since = "4.2.0") +@APICommand(name = "listLdapUsers", responseObject = LdapUserResponse.class, description = "Lists all LDAP Users", since = "4.2.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class LdapListUsersCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(LdapListUsersCmd.class.getName()); diff --git a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapUserSearchCmd.java b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapUserSearchCmd.java index e2b050d3d2a..b488bb78d33 100644 --- a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapUserSearchCmd.java +++ b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapUserSearchCmd.java @@ -34,7 +34,8 @@ import org.apache.cloudstack.ldap.NoLdapUserMatchingQueryException; import com.cloud.user.Account; -@APICommand(name = "searchLdap", responseObject = LdapUserResponse.class, description = "Searches LDAP based on the username attribute", since = "4.2.0") +@APICommand(name = "searchLdap", responseObject = LdapUserResponse.class, description = "Searches LDAP based on the username attribute", since = "4.2.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class LdapUserSearchCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(LdapUserSearchCmd.class.getName()); diff --git a/pom.xml b/pom.xml index 9dbd72b1a62..02b18087273 100644 --- a/pom.xml +++ b/pom.xml @@ -36,6 +36,7 @@ 1.7 UTF-8 + UTF-8 1.2.16 1.1 @@ -48,7 +49,9 @@ 1.1.1 0.5 3.0 - 4.10 + + 4.11 + 1.3 1.46 0.1.42 2.0.0 @@ -57,7 +60,7 @@ 2.6.6 1.7.1 14.0-rc1 - 5.6.100-1-SNAPSHOT + 6.2.0-1-SNAPSHOT 3.1 4.2.1 5.1.21 @@ -75,6 +78,7 @@ 5.1 3.2.4.RELEASE 1.9.5 + 1.5.3 1.3.22 2.6 1.4 @@ -411,12 +415,29 @@ ${cs.junit.version} test + + org.hamcrest + hamcrest-library + ${cs.hamcrest.version} + test + org.mockito mockito-all 1.9.5 test + + org.powermock + powermock-module-junit4 + ${cs.powermock.version} + + + org.powermock + powermock-api-mockito + ${cs.powermock.version} + test + org.springframework spring-test @@ -487,6 +508,11 @@ + + org.apache.maven.plugins + maven-site-plugin + 3.3 + org.apache.maven.plugins maven-checkstyle-plugin @@ -592,15 +618,6 @@ - - org.apache.maven.plugins - maven-site-plugin - 3.3 - - 9000 - ${basedir}/target/site/tempdir - - diff --git a/python/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in b/python/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in index 6d929c0a27e..b6720f5b639 100755 --- a/python/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in +++ b/python/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in @@ -23,12 +23,10 @@ . /etc/rc.d/init.d/functions -whatami=cloud-external-ipallocator - # set environment variables -SHORTNAME="$whatami" -PIDFILE=@PIDDIR@/"$whatami".pid +SHORTNAME="$0" +PIDFILE=@PIDDIR@/"$SHORTNAME".pid LOCKFILE=@LOCKDIR@/"$SHORTNAME" LOGFILE=@IPALOCATORLOG@ PROGNAME="External IPAllocator" @@ -90,7 +88,7 @@ case "$1" in fi ;; *) - echo $"Usage: $whatami {start|stop|restart|condrestart|status|help}" + echo $"Usage: $SHORTNAME {start|stop|restart|condrestart|status|help}" RETVAL=3 esac diff --git a/python/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in b/python/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in index a21070dadf8..aa7e8cf8820 100755 --- a/python/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in +++ b/python/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in @@ -23,12 +23,10 @@ . /etc/rc.d/init.d/functions -whatami=cloud-external-ipallocator - # set environment variables -SHORTNAME="$whatami" -PIDFILE=@PIDDIR@/"$whatami".pid +SHORTNAME="$0" +PIDFILE=@PIDDIR@/"$SHORTNAME".pid LOCKFILE=@LOCKDIR@/"$SHORTNAME" LOGFILE=@AGENTLOG@ PROGNAME="Cloud Agent" @@ -90,7 +88,7 @@ case "$1" in fi ;; *) - echo $"Usage: $whatami {start|stop|restart|condrestart|status|help}" + echo $"Usage: $SHORTNAME {start|stop|restart|condrestart|status|help}" RETVAL=3 esac diff --git a/python/distro/opensuse/SYSCONFDIR/init.d/cloud-ipallocator.in b/python/distro/opensuse/SYSCONFDIR/init.d/cloud-ipallocator.in index b12e16b050d..7aa456df51c 100755 --- a/python/distro/opensuse/SYSCONFDIR/init.d/cloud-ipallocator.in +++ b/python/distro/opensuse/SYSCONFDIR/init.d/cloud-ipallocator.in @@ -30,12 +30,10 @@ . /lib/lsb/init-functions . /etc/rc.status -whatami=cloud-external-ipallocator - # set environment variables -SHORTNAME="$whatami" -PIDFILE=@PIDDIR@/"$whatami".pid +SHORTNAME="$0" +PIDFILE=@PIDDIR@/"$SHORTNAME".pid LOCKFILE=@LOCKDIR@/"$SHORTNAME" LOGFILE=@AGENTLOG@ PROGNAME="Cloud Agent" @@ -110,7 +108,7 @@ case "$1" in start ;; *) - echo $"Usage: $whatami {start|stop|restart|status|help}" + echo $"Usage: $SHORTNAME {start|stop|restart|status|help}" RETVAL=3 esac diff --git a/python/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in b/python/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in index a21070dadf8..aa7e8cf8820 100644 --- a/python/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in +++ b/python/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in @@ -23,12 +23,10 @@ . /etc/rc.d/init.d/functions -whatami=cloud-external-ipallocator - # set environment variables -SHORTNAME="$whatami" -PIDFILE=@PIDDIR@/"$whatami".pid +SHORTNAME="$0" +PIDFILE=@PIDDIR@/"$SHORTNAME".pid LOCKFILE=@LOCKDIR@/"$SHORTNAME" LOGFILE=@AGENTLOG@ PROGNAME="Cloud Agent" @@ -90,7 +88,7 @@ case "$1" in fi ;; *) - echo $"Usage: $whatami {start|stop|restart|condrestart|status|help}" + echo $"Usage: $SHORTNAME {start|stop|restart|condrestart|status|help}" RETVAL=3 esac diff --git a/python/distro/sles/SYSCONFDIR/init.d/cloud-ipallocator.in b/python/distro/sles/SYSCONFDIR/init.d/cloud-ipallocator.in index b12e16b050d..7aa456df51c 100755 --- a/python/distro/sles/SYSCONFDIR/init.d/cloud-ipallocator.in +++ b/python/distro/sles/SYSCONFDIR/init.d/cloud-ipallocator.in @@ -30,12 +30,10 @@ . /lib/lsb/init-functions . /etc/rc.status -whatami=cloud-external-ipallocator - # set environment variables -SHORTNAME="$whatami" -PIDFILE=@PIDDIR@/"$whatami".pid +SHORTNAME="$0" +PIDFILE=@PIDDIR@/"$SHORTNAME".pid LOCKFILE=@LOCKDIR@/"$SHORTNAME" LOGFILE=@AGENTLOG@ PROGNAME="Cloud Agent" @@ -110,7 +108,7 @@ case "$1" in start ;; *) - echo $"Usage: $whatami {start|stop|restart|status|help}" + echo $"Usage: $SHORTNAME {start|stop|restart|status|help}" RETVAL=3 esac diff --git a/python/distro/ubuntu/SYSCONFDIR/init.d/cloud-ipallocator.in b/python/distro/ubuntu/SYSCONFDIR/init.d/cloud-ipallocator.in index 3dcc471cf68..ec84962b669 100755 --- a/python/distro/ubuntu/SYSCONFDIR/init.d/cloud-ipallocator.in +++ b/python/distro/ubuntu/SYSCONFDIR/init.d/cloud-ipallocator.in @@ -24,12 +24,10 @@ . /lib/lsb/init-functions . /etc/default/rcS -whatami=cloud-external-ipallocator - # set environment variables -SHORTNAME="$whatami" -PIDFILE=@PIDDIR@/"$whatami".pid +SHORTNAME="$0" +PIDFILE=@PIDDIR@/"$SHORTNAME".pid LOCKFILE=@LOCKDIR@/"$SHORTNAME" LOGFILE=@AGENTLOG@ PROGNAME="Cloud Agent" @@ -104,7 +102,7 @@ case "$1" in start ;; *) - echo $"Usage: $whatami {start|stop|restart|status|help}" + echo $"Usage: $SHORTNAME {start|stop|restart|status|help}" RETVAL=3 esac diff --git a/scripts/vm/systemvm/injectkeys.sh b/scripts/vm/systemvm/injectkeys.sh index c17a3c61935..cd5d9f9a06c 100755 --- a/scripts/vm/systemvm/injectkeys.sh +++ b/scripts/vm/systemvm/injectkeys.sh @@ -71,7 +71,7 @@ copy_priv_key() { if [[ "$EUID" -ne 0 ]] then - SUDO="sudo " + SUDO="sudo -n " fi $SUDO mkdir -p $MOUNTPATH diff --git a/server/src/com/cloud/api/ApiAsyncJobDispatcher.java b/server/src/com/cloud/api/ApiAsyncJobDispatcher.java index 71ac616cbfc..f037f2e81a7 100644 --- a/server/src/com/cloud/api/ApiAsyncJobDispatcher.java +++ b/server/src/com/cloud/api/ApiAsyncJobDispatcher.java @@ -36,7 +36,6 @@ import org.apache.cloudstack.framework.jobs.AsyncJob; import org.apache.cloudstack.framework.jobs.AsyncJobDispatcher; import org.apache.cloudstack.framework.jobs.AsyncJobManager; import org.apache.cloudstack.jobs.JobInfo; -import org.apache.cloudstack.managed.context.ManagedContext; import com.cloud.user.Account; import com.cloud.user.User; @@ -54,23 +53,12 @@ public class ApiAsyncJobDispatcher extends AdapterBase implements AsyncJobDispat private AsyncJobManager _asyncJobMgr; @Inject private EntityManager _entityMgr; - @Inject - ManagedContext _managedContext; public ApiAsyncJobDispatcher() { } @Override public void runJob(final AsyncJob job) { - _managedContext.runWithContext(new Runnable() { - @Override - public void run() { - runJobInContext(job); - } - }); - } - - protected void runJobInContext(AsyncJob job) { BaseAsyncCmd cmdObj = null; try { Class cmdClass = Class.forName(job.getCmd()); @@ -106,7 +94,7 @@ public class ApiAsyncJobDispatcher extends AdapterBase implements AsyncJobDispat accountObject = _entityMgr.findById(Account.class, Long.parseLong(acctIdStr)); } - CallContext.register(user, accountObject, job.getRelated()); + CallContext.register(user, accountObject); try { // dispatch could ultimately queue the job _dispatcher.dispatch(cmdObj, params, true); diff --git a/server/src/com/cloud/api/ApiDispatcher.java b/server/src/com/cloud/api/ApiDispatcher.java index 7c375413f62..4bc6578465d 100755 --- a/server/src/com/cloud/api/ApiDispatcher.java +++ b/server/src/com/cloud/api/ApiDispatcher.java @@ -102,7 +102,7 @@ public class ApiDispatcher { public void dispatchCreateCmd(BaseAsyncCreateCmd cmd, Map params) throws Exception { processParameters(cmd, params); - + CallContext.current().setEventDisplayEnabled(cmd.isDisplayResourceEnabled()); cmd.create(); } @@ -127,6 +127,7 @@ public class ApiDispatcher { public void dispatch(BaseCmd cmd, Map params, boolean execute) throws Exception { processParameters(cmd, params); CallContext ctx = CallContext.current(); + ctx.setEventDisplayEnabled(cmd.isDisplayResourceEnabled()); if (cmd instanceof BaseAsyncCmd) { diff --git a/server/src/com/cloud/api/ApiGsonHelper.java b/server/src/com/cloud/api/ApiGsonHelper.java index 58f29ceeee7..faa70c21fff 100644 --- a/server/src/com/cloud/api/ApiGsonHelper.java +++ b/server/src/com/cloud/api/ApiGsonHelper.java @@ -18,10 +18,10 @@ package com.cloud.api; import java.util.Map; -import com.google.gson.GsonBuilder; - import org.apache.cloudstack.api.ResponseObject; +import com.google.gson.GsonBuilder; + public class ApiGsonHelper { private static final GsonBuilder s_gBuilder; static { diff --git a/server/src/com/cloud/api/ApiResponseGsonHelper.java b/server/src/com/cloud/api/ApiResponseGsonHelper.java index 3352cc8a91d..c2cc9d92dbb 100644 --- a/server/src/com/cloud/api/ApiResponseGsonHelper.java +++ b/server/src/com/cloud/api/ApiResponseGsonHelper.java @@ -16,9 +16,15 @@ // under the License. package com.cloud.api; -import com.google.gson.GsonBuilder; - +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.ResponseObject; +import org.apache.cloudstack.context.CallContext; + +import com.cloud.serializer.Param; +import com.cloud.user.Account; +import com.google.gson.ExclusionStrategy; +import com.google.gson.FieldAttributes; +import com.google.gson.GsonBuilder; /** * The ApiResonseGsonHelper is different from ApiGsonHelper - it registeres one more adapter for String type required for api response encoding @@ -31,9 +37,38 @@ public class ApiResponseGsonHelper { s_gBuilder.setVersion(1.3); s_gBuilder.registerTypeAdapter(ResponseObject.class, new ResponseObjectTypeAdapter()); s_gBuilder.registerTypeAdapter(String.class, new EncodedStringTypeAdapter()); + s_gBuilder.setExclusionStrategies(new ExclStrat()); } public static GsonBuilder getBuilder() { return s_gBuilder; } + + private static class ExclStrat implements ExclusionStrategy { + + public boolean shouldSkipClass(Class arg0) { + return false; + } + public boolean shouldSkipField(FieldAttributes f) { + + Param param = f.getAnnotation(Param.class); + if (param != null) { + RoleType[] allowedRoles = param.authorized(); + if (allowedRoles.length > 0) { + boolean permittedParameter = false; + Account caller = CallContext.current().getCallingAccount(); + for (RoleType allowedRole : allowedRoles) { + if (allowedRole.getValue() == caller.getType()) { + permittedParameter = true; + break; + } + } + if (!permittedParameter) { + return true; + } + } + } + return false; + } + } } diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java index 77381aa1d1f..4b5550cd39c 100755 --- a/server/src/com/cloud/api/ApiResponseHelper.java +++ b/server/src/com/cloud/api/ApiResponseHelper.java @@ -714,6 +714,8 @@ public class ApiResponseHelper implements ResponseGenerator { } } + ipResponse.setForDisplay(ipAddr.isDisplay()); + ipResponse.setPortable(ipAddr.isPortable()); //set tag information @@ -745,6 +747,7 @@ public class ApiResponseHelper implements ResponseGenerator { lbResponse.setPrivatePort(Integer.toString(loadBalancer.getDefaultPortStart())); lbResponse.setAlgorithm(loadBalancer.getAlgorithm()); lbResponse.setLbProtocol(loadBalancer.getLbProtocol()); + lbResponse.setForDisplay(loadBalancer.isDisplay()); FirewallRule.State state = loadBalancer.getState(); String stateToSet = state.toString(); if (state.equals(FirewallRule.State.Revoke)) { @@ -1015,6 +1018,7 @@ public class ApiResponseHelper implements ResponseGenerator { Network guestNtwk = ApiDBUtils.findNetworkById(fwRule.getNetworkId()); response.setNetworkId(guestNtwk.getUuid()); + IpAddress ip = ApiDBUtils.findIpAddressById(fwRule.getSourceIpAddressId()); response.setPublicIpAddressId(ip.getUuid()); response.setPublicIpAddress(ip.getAddress().addr()); @@ -1049,6 +1053,7 @@ public class ApiResponseHelper implements ResponseGenerator { response.setTags(tagResponses); response.setState(stateToSet); + response.setForDisplay(fwRule.isDisplay()); response.setObjectName("portforwardingrule"); return response; } @@ -1125,7 +1130,7 @@ public class ApiResponseHelper implements ResponseGenerator { @Override public SystemVmResponse createSystemVmResponse(VirtualMachine vm) { SystemVmResponse vmResponse = new SystemVmResponse(); - if (vm.getType() == Type.SecondaryStorageVm || vm.getType() == Type.ConsoleProxy) { + if (vm.getType() == Type.SecondaryStorageVm || vm.getType() == Type.ConsoleProxy || vm.getType() == Type.DomainRouter) { // SystemVm vm = (SystemVm) systemVM; vmResponse.setId(vm.getUuid()); // vmResponse.setObjectId(vm.getId()); @@ -1270,11 +1275,10 @@ public class ApiResponseHelper implements ResponseGenerator { } vpnResponse.setIpRange(vpn.getIpRange()); vpnResponse.setPresharedKey(vpn.getIpsecPresharedKey()); - populateOwner(vpnResponse, vpn); - vpnResponse.setState(vpn.getState().toString()); vpnResponse.setId(vpn.getUuid()); + vpnResponse.setForDisplay(vpn.isDisplay()); vpnResponse.setObjectName("remoteaccessvpn"); return vpnResponse; @@ -2250,6 +2254,7 @@ public class ApiResponseHelper implements ResponseGenerator { response.setIcmpCode(fwRule.getIcmpCode()); response.setIcmpType(fwRule.getIcmpType()); + response.setForDisplay(fwRule.isDisplay()); // set tag information List tags = ApiDBUtils.listByResourceTypeAndId(ResourceObjectType.FirewallRule, fwRule.getId()); @@ -2295,6 +2300,7 @@ public class ApiResponseHelper implements ResponseGenerator { response.setState(stateToSet); response.setNumber(aclItem.getNumber()); response.setAction(aclItem.getAction().toString()); + response.setForDisplay(aclItem.isDisplay()); NetworkACL acl = ApiDBUtils.findByNetworkACLId(aclItem.getAclId()); if (acl != null) { @@ -2794,6 +2800,7 @@ public class ApiResponseHelper implements ResponseGenerator { response.setCidr(vpc.getCidr()); response.setRestartRequired(vpc.isRestartRequired()); response.setNetworkDomain(vpc.getNetworkDomain()); + response.setForDisplay(vpc.isDisplay()); Map> serviceProviderMap = ApiDBUtils.listVpcOffServices(vpc.getVpcOfferingId()); List serviceResponses = new ArrayList(); @@ -2974,6 +2981,7 @@ public class ApiResponseHelper implements ResponseGenerator { response.setMaxMembers(vmGroup.getMaxMembers()); response.setState(vmGroup.getState()); response.setInterval(vmGroup.getInterval()); + response.setForDisplay(vmGroup.isDisplay()); AutoScaleVmProfileVO profile = ApiDBUtils.findAutoScaleVmProfileById(vmGroup.getProfileId()); if (profile != null) { response.setProfileId(profile.getUuid()); @@ -3047,6 +3055,7 @@ public class ApiResponseHelper implements ResponseGenerator { response.setVpcId(vpc.getUuid()); } response.setRemoved(result.getRemoved()); + response.setForDisplay(result.isDisplay()); response.setObjectName("vpngateway"); populateAccount(response, result.getAccountId()); @@ -3116,6 +3125,7 @@ public class ApiResponseHelper implements ResponseGenerator { response.setState(result.getState().toString()); response.setCreated(result.getCreated()); response.setRemoved(result.getRemoved()); + response.setForDisplay(result.isDisplay()); response.setObjectName("vpnconnection"); return response; } @@ -3487,6 +3497,7 @@ public class ApiResponseHelper implements ResponseGenerator { lbResponse.setName(lb.getName()); lbResponse.setDescription(lb.getDescription()); lbResponse.setAlgorithm(lb.getAlgorithm()); + lbResponse.setForDisplay(lb.isDisplay()); Network nw = ApiDBUtils.findNetworkById(lb.getNetworkId()); lbResponse.setNetworkId(nw.getUuid()); populateOwner(lbResponse, lb); @@ -3673,6 +3684,7 @@ public class ApiResponseHelper implements ResponseGenerator { response.setId(networkACL.getUuid()); response.setName(networkACL.getName()); response.setDescription(networkACL.getDescription()); + response.setForDisplay(networkACL.isDisplay()); Vpc vpc = ApiDBUtils.findVpcById(networkACL.getVpcId()); if (vpc != null) { response.setVpcId(vpc.getUuid()); diff --git a/server/src/com/cloud/api/ApiServer.java b/server/src/com/cloud/api/ApiServer.java index 158a8976cb4..5ab65f4e0a4 100755 --- a/server/src/com/cloud/api/ApiServer.java +++ b/server/src/com/cloud/api/ApiServer.java @@ -369,7 +369,14 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer } Class cmdClass = getCmdClass(command[0]); + if (cmdClass != null) { + APICommand annotation = cmdClass.getAnnotation(APICommand.class); + if (annotation == null) { + s_logger.error("No APICommand annotation found for class " + cmdClass.getCanonicalName()); + throw new CloudRuntimeException("No APICommand annotation found for class " + cmdClass.getCanonicalName()); + } + BaseCmd cmdObj = (BaseCmd)cmdClass.newInstance(); cmdObj = ComponentContext.inject(cmdObj); cmdObj.configure(); @@ -379,6 +386,12 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer // This is where the command is either serialized, or directly dispatched response = queueCommand(cmdObj, paramMap); + if (annotation.responseHasSensitiveInfo()) + { + buildAuditTrail(auditTrailSb, command[0], + StringUtils.cleanString(response)); + } + else buildAuditTrail(auditTrailSb, command[0], response); } else { if (!command[0].equalsIgnoreCase("login") && !command[0].equalsIgnoreCase("logout")) { @@ -470,6 +483,7 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer CallContext ctx = CallContext.current(); Long callerUserId = ctx.getCallingUserId(); Account caller = ctx.getCallingAccount(); + ctx.setEventDisplayEnabled(cmdObj.isDisplayResourceEnabled()); // Queue command based on Cmd super class: // BaseCmd: cmd is dispatched to ApiDispatcher, executed, serialized and returned. @@ -503,7 +517,7 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer // save the scheduled event Long eventId = ActionEventUtils.onScheduledActionEvent((callerUserId == null) ? User.UID_SYSTEM : callerUserId, asyncCmd.getEntityOwnerId(), asyncCmd.getEventType(), - asyncCmd.getEventDescription(), startEventId); + asyncCmd.getEventDescription(), asyncCmd.isDisplayResourceEnabled(), startEventId); if (startEventId == 0) { // There was no create event before, set current event id as start eventId startEventId = eventId; @@ -513,9 +527,9 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer params.put("cmdEventType", asyncCmd.getEventType().toString()); Long instanceId = (objectId == null) ? asyncCmd.getInstanceId() : objectId; - AsyncJobVO job = - new AsyncJobVO(ctx.getContextId(), callerUserId, caller.getId(), cmdObj.getClass().getName(), ApiGsonHelper.getBuilder().create().toJson(params), - instanceId, asyncCmd.getInstanceType() != null ? asyncCmd.getInstanceType().toString() : null); + AsyncJobVO job = new AsyncJobVO("", callerUserId, caller.getId(), cmdObj.getClass().getName(), + ApiGsonHelper.getBuilder().create().toJson(params), instanceId, + asyncCmd.getInstanceType() != null ? asyncCmd.getInstanceType().toString() : null); job.setDispatcher(_asyncDispatcher.getName()); long jobId = _asyncMgr.submitAsyncJob(job); diff --git a/server/src/com/cloud/api/ResponseObjectTypeAdapter.java b/server/src/com/cloud/api/ResponseObjectTypeAdapter.java index a4bc6caa1cd..44baedc933b 100644 --- a/server/src/com/cloud/api/ResponseObjectTypeAdapter.java +++ b/server/src/com/cloud/api/ResponseObjectTypeAdapter.java @@ -19,6 +19,9 @@ package com.cloud.api; import java.lang.reflect.Method; import java.lang.reflect.Type; +import org.apache.cloudstack.api.ResponseObject; +import org.apache.cloudstack.api.response.ExceptionResponse; +import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.log4j.Logger; import com.google.gson.JsonElement; @@ -26,10 +29,6 @@ import com.google.gson.JsonObject; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; -import org.apache.cloudstack.api.ResponseObject; -import org.apache.cloudstack.api.response.ExceptionResponse; -import org.apache.cloudstack.api.response.SuccessResponse; - public class ResponseObjectTypeAdapter implements JsonSerializer { public static final Logger s_logger = Logger.getLogger(ResponseObjectTypeAdapter.class.getName()); diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java index e46e0f4c3c5..564bf4ed25e 100644 --- a/server/src/com/cloud/api/query/QueryManagerImpl.java +++ b/server/src/com/cloud/api/query/QueryManagerImpl.java @@ -511,6 +511,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService { sb.and("state", sb.entity().getState(), SearchCriteria.Op.NEQ); sb.and("startId", sb.entity().getStartId(), SearchCriteria.Op.EQ); sb.and("createDate", sb.entity().getCreateDate(), SearchCriteria.Op.BETWEEN); + sb.and("displayEvent", sb.entity().getDisplayEvent(), SearchCriteria.Op.EQ); sb.and("archived", sb.entity().getArchived(), SearchCriteria.Op.EQ); SearchCriteria sc = sb.create(); @@ -518,6 +519,11 @@ public class QueryManagerImpl extends ManagerBase implements QueryService { // building ACL search criteria _accountMgr.buildACLViewSearchCriteria(sc, aclSc, isRecursive, permittedDomains, permittedAccounts, permittedResources, listProjectResourcesCriteria); + // For end users display only enabled events + if(!_accountMgr.isRootAdmin(caller.getType())){ + sc.setParameters("displayEvent", true); + } + if (id != null) { sc.setParameters("id", id); } @@ -736,6 +742,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService { boolean listAll = cmd.listAll(); Long id = cmd.getId(); Map tags = cmd.getTags(); + Boolean display = cmd.getDisplay(); Ternary domainIdRecursiveListProject = new Ternary( cmd.getDomainId(), cmd.isRecursive(), null); _accountMgr.buildACLSearchParameters(caller, id, cmd.getAccountName(), cmd.getProjectId(), permittedDomains, permittedAccounts, permittedResources, @@ -775,6 +782,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService { Object isoId = cmd.getIsoId(); Object vpcId = cmd.getVpcId(); Object affinityGroupId = cmd.getAffinityGroupId(); + Object serviceOffId = cmd.getServiceOfferingId(); Object pod = null; Object hostId = null; Object storageId = null; @@ -799,6 +807,12 @@ public class QueryManagerImpl extends ManagerBase implements QueryService { sb.and("isoId", sb.entity().getIsoId(), SearchCriteria.Op.EQ); sb.and("instanceGroupId", sb.entity().getInstanceGroupId(), SearchCriteria.Op.EQ); + if (serviceOffId != null) { + sb.and("serviceOfferingId", sb.entity().getServiceOfferingId(), SearchCriteria.Op.EQ); + } + if (display != null) { + sb.and("display", sb.entity().isDisplayVm(), SearchCriteria.Op.EQ); + } if (groupId != null && (Long)groupId != -1) { sb.and("instanceGroupId", sb.entity().getInstanceGroupId(), SearchCriteria.Op.EQ); } @@ -855,6 +869,14 @@ public class QueryManagerImpl extends ManagerBase implements QueryService { sc.addAnd("displayName", SearchCriteria.Op.SC, ssc); } + if (serviceOffId != null) { + sc.setParameters("serviceOfferingId", serviceOffId); + } + + if (display != null) { + sc.setParameters("display", display); + } + if (id != null) { sc.setParameters("id", id); } @@ -1625,6 +1647,8 @@ public class QueryManagerImpl extends ManagerBase implements QueryService { String type = cmd.getType(); Map tags = cmd.getTags(); Long storageId = cmd.getStorageId(); + Long diskOffId = cmd.getDiskOfferingId(); + Boolean display = cmd.getDisplay(); Long zoneId = cmd.getZoneId(); Long podId = cmd.getPodId(); @@ -1655,6 +1679,8 @@ public class QueryManagerImpl extends ManagerBase implements QueryService { sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ); sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ); sb.and("storageId", sb.entity().getPoolId(), SearchCriteria.Op.EQ); + sb.and("diskOfferingId", sb.entity().getDiskOfferingId(), SearchCriteria.Op.EQ); + sb.and("display", sb.entity().isDisplayVolume(), SearchCriteria.Op.EQ); // Only return volumes that are not destroyed sb.and("state", sb.entity().getState(), SearchCriteria.Op.NEQ); sb.and("systemUse", sb.entity().isSystemUse(), SearchCriteria.Op.NEQ); @@ -1685,6 +1711,10 @@ public class QueryManagerImpl extends ManagerBase implements QueryService { sc.setParameters("name", name); } + if (display != null) { + sc.setParameters("display", display); + } + sc.setParameters("systemUse", 1); if (tags != null && !tags.isEmpty()) { @@ -1698,6 +1728,10 @@ public class QueryManagerImpl extends ManagerBase implements QueryService { sc.addAnd("tagKey", SearchCriteria.Op.SC, tagSc); } + if (diskOffId != null) { + sc.setParameters("diskOfferingId", diskOffId); + } + if (id != null) { sc.setParameters("id", id); } @@ -3276,7 +3310,10 @@ public class QueryManagerImpl extends ManagerBase implements QueryService { Boolean forDisplay = cmd.forDisplay(); ResourceTag.ResourceObjectType resourceType = cmd.getResourceType(); String resourceIdStr = cmd.getResourceId(); - long resourceId = _taggedResourceMgr.getResourceId(resourceIdStr, resourceType); + Long resourceId = null; + if (resourceIdStr != null) { + resourceId = _taggedResourceMgr.getResourceId(resourceIdStr, resourceType); + } List detailList = new ArrayList(); ResourceDetail requestedDetail = null; diff --git a/server/src/com/cloud/api/query/dao/ImageStoreJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/ImageStoreJoinDaoImpl.java index bcf8d4cd440..f1f873c43b4 100644 --- a/server/src/com/cloud/api/query/dao/ImageStoreJoinDaoImpl.java +++ b/server/src/com/cloud/api/query/dao/ImageStoreJoinDaoImpl.java @@ -81,7 +81,7 @@ public class ImageStoreJoinDaoImpl extends GenericDaoBase 0 ){ + if ( detailName != null && detailName.length() > 0 && !detailName.equals(ApiConstants.PASSWORD)) { String detailValue = ids.getDetailValue(); if (detailName.equals(ApiConstants.KEY) || detailName.equals(ApiConstants.S3_SECRET_KEY)) { detailValue = DBEncryptionUtil.decrypt(detailValue); @@ -96,7 +96,7 @@ public class ImageStoreJoinDaoImpl extends GenericDaoBase 0 ){ + if ( detailName != null && detailName.length() > 0 && !detailName.equals(ApiConstants.PASSWORD)) { String detailValue = ids.getDetailValue(); if (detailName.equals(ApiConstants.KEY) || detailName.equals(ApiConstants.S3_SECRET_KEY)) { detailValue = DBEncryptionUtil.decrypt(detailValue); diff --git a/server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java index 9512a60c5a4..8a0431baaa6 100644 --- a/server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java +++ b/server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java @@ -212,7 +212,8 @@ public class VolumeJoinDaoImpl extends GenericDaoBase implem } volResponse.setExtractable(isExtractable); - volResponse.setDisplayVm(volume.isDisplayVolume()); + volResponse.setDisplayVolume(volume.isDisplayVolume()); + volResponse.setChainInfo(volume.getChainInfo()); // set async job if (volume.getJobId() != null) { diff --git a/server/src/com/cloud/api/query/vo/AffinityGroupJoinVO.java b/server/src/com/cloud/api/query/vo/AffinityGroupJoinVO.java index 8a213e2b1f8..f659ed95bb0 100644 --- a/server/src/com/cloud/api/query/vo/AffinityGroupJoinVO.java +++ b/server/src/com/cloud/api/query/vo/AffinityGroupJoinVO.java @@ -23,8 +23,8 @@ import javax.persistence.Enumerated; import javax.persistence.Id; import javax.persistence.Table; -import org.apache.cloudstack.acl.IAMEntityType; import org.apache.cloudstack.acl.ControlledEntity; +import org.apache.cloudstack.acl.IAMEntityType; import com.cloud.vm.VirtualMachine; diff --git a/server/src/com/cloud/api/query/vo/EventJoinVO.java b/server/src/com/cloud/api/query/vo/EventJoinVO.java index 757f0a7571d..91e2e6a2f60 100644 --- a/server/src/com/cloud/api/query/vo/EventJoinVO.java +++ b/server/src/com/cloud/api/query/vo/EventJoinVO.java @@ -108,6 +108,9 @@ public class EventJoinVO extends BaseViewVO implements ControlledViewEntity { @Column(name = "archived") private boolean archived; + @Column(name = "display_event") + protected boolean displayEvent = true; + public EventJoinVO() { } @@ -219,6 +222,10 @@ public class EventJoinVO extends BaseViewVO implements ControlledViewEntity { return archived; } + public boolean getDisplayEvent() { + return displayEvent; + } + @Override public IAMEntityType getEntityType() { return IAMEntityType.Event; diff --git a/server/src/com/cloud/api/query/vo/VolumeJoinVO.java b/server/src/com/cloud/api/query/vo/VolumeJoinVO.java index 9685d02003b..289b0b85afc 100644 --- a/server/src/com/cloud/api/query/vo/VolumeJoinVO.java +++ b/server/src/com/cloud/api/query/vo/VolumeJoinVO.java @@ -266,6 +266,9 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity { @Column(name = "path") protected String path; + @Column(name = "chain_info", length = 65535) + String chainInfo; + public VolumeJoinVO() { } @@ -569,6 +572,11 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity { return path; } + + public String getChainInfo() { + return chainInfo; + } + @Override public IAMEntityType getEntityType() { return IAMEntityType.Volume; diff --git a/server/src/com/cloud/api/response/ApiResponseSerializer.java b/server/src/com/cloud/api/response/ApiResponseSerializer.java index c254520fd2e..482834aa2ac 100644 --- a/server/src/com/cloud/api/response/ApiResponseSerializer.java +++ b/server/src/com/cloud/api/response/ApiResponseSerializer.java @@ -31,6 +31,7 @@ import org.apache.log4j.Logger; import com.google.gson.Gson; import com.google.gson.annotations.SerializedName; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.ResponseObject; @@ -39,10 +40,13 @@ import org.apache.cloudstack.api.response.CreateCmdResponse; import org.apache.cloudstack.api.response.ExceptionResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.context.CallContext; import com.cloud.api.ApiDBUtils; import com.cloud.api.ApiResponseGsonHelper; import com.cloud.api.ApiServer; +import com.cloud.serializer.Param; +import com.cloud.user.Account; import com.cloud.utils.encoding.URLEncoder; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.exception.ExceptionProxyObject; @@ -191,11 +195,31 @@ public class ApiResponseSerializer { continue; // skip transient fields } + SerializedName serializedName = field.getAnnotation(SerializedName.class); if (serializedName == null) { continue; // skip fields w/o serialized name } + Param param = field.getAnnotation(Param.class); + if (param != null) { + RoleType[] allowedRoles = param.authorized(); + if (allowedRoles.length > 0) { + boolean permittedParameter = false; + Account caller = CallContext.current().getCallingAccount(); + for (RoleType allowedRole : allowedRoles) { + if (allowedRole.getValue() == caller.getType()) { + permittedParameter = true; + break; + } + } + if (!permittedParameter) { + s_logger.trace("Ignoring paremeter " + param.name() + " as the caller is not authorized to see it"); + continue; + } + } + } + field.setAccessible(true); Object fieldValue = null; try { diff --git a/server/src/com/cloud/api/response/SecurityGroupResultObject.java b/server/src/com/cloud/api/response/SecurityGroupResultObject.java index 98ed4150cfc..66ba4876416 100644 --- a/server/src/com/cloud/api/response/SecurityGroupResultObject.java +++ b/server/src/com/cloud/api/response/SecurityGroupResultObject.java @@ -21,8 +21,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.cloudstack.acl.IAMEntityType; import org.apache.cloudstack.acl.ControlledEntity; +import org.apache.cloudstack.acl.IAMEntityType; import org.apache.cloudstack.api.InternalIdentity; import com.cloud.api.ApiDBUtils; diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java index 975eecdc117..98e5d3424a2 100755 --- a/server/src/com/cloud/configuration/Config.java +++ b/server/src/com/cloud/configuration/Config.java @@ -407,6 +407,12 @@ public enum Config { "vm.network.nic.max.secondary.ipaddresses", "256", "Specify the number of secondary ip addresses per nic per vm", null), + EnableServiceMonitoring( + "Network", ManagementServer.class, Boolean.class, + "network.router.enableserviceMonitoring", "false", + "service monitoring in router enable/disable option, default false", null), + + // Console Proxy ConsoleProxyCapacityStandby( "Console Proxy", diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index bf45d8ff423..b739d30cdc7 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -36,8 +36,6 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; -import org.apache.log4j.Logger; - import org.apache.cloudstack.acl.SecurityChecker; import org.apache.cloudstack.affinity.AffinityGroup; import org.apache.cloudstack.affinity.AffinityGroupService; @@ -85,6 +83,7 @@ import org.apache.cloudstack.region.dao.RegionDao; import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao; import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; +import org.apache.log4j.Logger; import com.cloud.alert.AlertManager; import com.cloud.api.ApiDBUtils; @@ -443,7 +442,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati if (zone == null) { throw new InvalidParameterValueException("unable to find zone by id " + resourceId); } - _dcDetailsDao.addDetail(resourceId, name, value); + _dcDetailsDao.addDetail(resourceId, name, value, true); break; case Cluster: ClusterVO cluster = _clusterDao.findById(resourceId); @@ -465,7 +464,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati if (pool == null) { throw new InvalidParameterValueException("unable to find storage pool by id " + resourceId); } - _storagePoolDetailsDao.addDetail(resourceId, name, value); + _storagePoolDetailsDao.addDetail(resourceId, name, value, true); break; @@ -2040,7 +2039,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati if (details != null) { List detailsVO = new ArrayList(); for (Entry detailEntry : details.entrySet()) { - detailsVO.add(new ServiceOfferingDetailsVO(offering.getId(), detailEntry.getKey(), detailEntry.getValue())); + detailsVO.add(new ServiceOfferingDetailsVO(offering.getId(), detailEntry.getKey(), detailEntry.getValue(), true)); } _serviceOfferingDetailsDao.saveDetails(detailsVO); @@ -2558,7 +2557,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati List vlans = _vlanDao.listVlansByNetworkId(network.getId()); if (vlans != null && vlans.size() > 0) { VlanVO vlan = vlans.get(0); - if (vlanId == null) { + if (vlanId == null || vlanId.contains(Vlan.UNTAGGED)) { vlanId = vlan.getVlanTag(); } else if (!NetUtils.isSameIsolationId(vlan.getVlanTag(), vlanId)) { throw new InvalidParameterValueException("there is already one vlan " + vlan.getVlanTag() + " on network :" + +network.getId() diff --git a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java index 813888707a3..3e4c57e6852 100755 --- a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java +++ b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java @@ -17,6 +17,7 @@ package com.cloud.consoleproxy; import java.nio.charset.Charset; +import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.HashMap; @@ -703,16 +704,16 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy List offerings = _networkModel.getSystemAccountNetworkOfferings(NetworkOffering.SystemControlNetwork, NetworkOffering.SystemManagementNetwork); - LinkedHashMap networks = new LinkedHashMap(offerings.size() + 1); + LinkedHashMap> networks = new LinkedHashMap>(offerings.size() + 1); NicProfile defaultNic = new NicProfile(); defaultNic.setDefaultNic(true); defaultNic.setDeviceId(2); networks.put(_networkMgr.setupNetwork(systemAcct, _networkOfferingDao.findById(defaultNetwork.getNetworkOfferingId()), plan, null, null, false).get(0), - defaultNic); + new ArrayList(Arrays.asList(defaultNic))); for (NetworkOffering offering : offerings) { - networks.put(_networkMgr.setupNetwork(systemAcct, offering, plan, null, null, false).get(0), null); + networks.put(_networkMgr.setupNetwork(systemAcct, offering, plan, null, null, false).get(0), new ArrayList()); } ConsoleProxyVO proxy = diff --git a/server/src/com/cloud/event/ActionEventInterceptor.java b/server/src/com/cloud/event/ActionEventInterceptor.java index 275c2d07dac..df8010c0d30 100644 --- a/server/src/com/cloud/event/ActionEventInterceptor.java +++ b/server/src/com/cloud/event/ActionEventInterceptor.java @@ -71,8 +71,9 @@ public class ActionEventInterceptor implements ComponentMethodInterceptor, Metho String eventDescription = getEventDescription(actionEvent, ctx); String eventType = getEventType(actionEvent, ctx); + boolean isEventDisplayEnabled = ctx.isEventDisplayEnabled(); - ActionEventUtils.onStartedActionEventFromContext(eventType, eventDescription); + ActionEventUtils.onStartedActionEventFromContext(eventType, eventDescription, isEventDisplayEnabled); } } return event; @@ -87,17 +88,19 @@ public class ActionEventInterceptor implements ComponentMethodInterceptor, Metho long startEventId = ctx.getStartEventId(); String eventDescription = getEventDescription(actionEvent, ctx); String eventType = getEventType(actionEvent, ctx); + boolean isEventDisplayEnabled = ctx.isEventDisplayEnabled(); if (eventType.equals("")) return; if (actionEvent.create()) { //This start event has to be used for subsequent events of this action - startEventId = - ActionEventUtils.onCreatedActionEvent(userId, accountId, EventVO.LEVEL_INFO, eventType, "Successfully created entity for " + eventDescription); + startEventId = ActionEventUtils.onCreatedActionEvent(userId, accountId, EventVO.LEVEL_INFO, eventType, + isEventDisplayEnabled, "Successfully created entity for " + eventDescription); ctx.setStartEventId(startEventId); } else { - ActionEventUtils.onCompletedActionEvent(userId, accountId, EventVO.LEVEL_INFO, eventType, "Successfully completed " + eventDescription, startEventId); + ActionEventUtils.onCompletedActionEvent(userId, accountId, EventVO.LEVEL_INFO, eventType, + isEventDisplayEnabled, "Successfully completed " + eventDescription, startEventId); } } } @@ -111,16 +114,18 @@ public class ActionEventInterceptor implements ComponentMethodInterceptor, Metho long startEventId = ctx.getStartEventId(); String eventDescription = getEventDescription(actionEvent, ctx); String eventType = getEventType(actionEvent, ctx); + boolean isEventDisplayEnabled = ctx.isEventDisplayEnabled(); if (eventType.equals("")) return; if (actionEvent.create()) { - long eventId = - ActionEventUtils.onCreatedActionEvent(userId, accountId, EventVO.LEVEL_ERROR, eventType, "Error while creating entity for " + eventDescription); + long eventId = ActionEventUtils.onCreatedActionEvent(userId, accountId, EventVO.LEVEL_ERROR, eventType, + isEventDisplayEnabled, "Error while creating entity for " + eventDescription); ctx.setStartEventId(eventId); } else { - ActionEventUtils.onCompletedActionEvent(userId, accountId, EventVO.LEVEL_ERROR, eventType, "Error while " + eventDescription, startEventId); + ActionEventUtils.onCompletedActionEvent(userId, accountId, EventVO.LEVEL_ERROR, eventType, isEventDisplayEnabled, + "Error while " + eventDescription, startEventId); } } } diff --git a/server/src/com/cloud/event/ActionEventUtils.java b/server/src/com/cloud/event/ActionEventUtils.java index c332a8e32e4..a9999dc520e 100755 --- a/server/src/com/cloud/event/ActionEventUtils.java +++ b/server/src/com/cloud/event/ActionEventUtils.java @@ -84,7 +84,7 @@ public class ActionEventUtils { publishOnEventBus(userId, accountId, EventCategory.ACTION_EVENT.getName(), type, com.cloud.event.Event.State.Completed, description); - Event event = persistActionEvent(userId, accountId, domainId, null, type, Event.State.Completed, description, null); + Event event = persistActionEvent(userId, accountId, domainId, null, type, Event.State.Completed, true, description, null); return event.getId(); } @@ -92,67 +92,75 @@ public class ActionEventUtils { /* * Save event after scheduling an async job */ - public static Long onScheduledActionEvent(Long userId, Long accountId, String type, String description, long startEventId) { + public static Long onScheduledActionEvent(Long userId, Long accountId, String type, String description, boolean eventDisplayEnabled, long startEventId) { publishOnEventBus(userId, accountId, EventCategory.ACTION_EVENT.getName(), type, com.cloud.event.Event.State.Scheduled, description); - Event event = persistActionEvent(userId, accountId, null, null, type, Event.State.Scheduled, description, startEventId); + Event event = persistActionEvent(userId, accountId, null, null, type, Event.State.Scheduled, eventDisplayEnabled, description, startEventId); return event.getId(); } public static void startNestedActionEvent(String eventType, String eventDescription) { CallContext.setActionEventInfo(eventType, eventDescription); - onStartedActionEventFromContext(eventType, eventDescription); + onStartedActionEventFromContext(eventType, eventDescription, true); } - public static void onStartedActionEventFromContext(String eventType, String eventDescription) { + public static void onStartedActionEventFromContext(String eventType, String eventDescription, boolean eventDisplayEnabled) { CallContext ctx = CallContext.current(); long userId = ctx.getCallingUserId(); long accountId = ctx.getCallingAccountId(); long startEventId = ctx.getStartEventId(); if (!eventType.equals("")) - ActionEventUtils.onStartedActionEvent(userId, accountId, eventType, eventDescription, startEventId); + ActionEventUtils.onStartedActionEvent(userId, accountId, eventType, eventDescription, eventDisplayEnabled, startEventId); } /* * Save event after starting execution of an async job */ - public static Long onStartedActionEvent(Long userId, Long accountId, String type, String description, long startEventId) { + public static Long onStartedActionEvent(Long userId, Long accountId, String type, String description, boolean eventDisplayEnabled, long startEventId) { publishOnEventBus(userId, accountId, EventCategory.ACTION_EVENT.getName(), type, com.cloud.event.Event.State.Started, description); - Event event = persistActionEvent(userId, accountId, null, null, type, Event.State.Started, description, startEventId); + Event event = persistActionEvent(userId, accountId, null, null, type, Event.State.Started, eventDisplayEnabled, description, startEventId); + return event.getId(); } public static Long onCompletedActionEvent(Long userId, Long accountId, String level, String type, String description, long startEventId) { - publishOnEventBus(userId, accountId, EventCategory.ACTION_EVENT.getName(), type, com.cloud.event.Event.State.Completed, description); - - Event event = persistActionEvent(userId, accountId, null, level, type, Event.State.Completed, description, startEventId); - - return event.getId(); + return onCompletedActionEvent(userId, accountId, level, type, true, description, startEventId); } - public static Long onCreatedActionEvent(Long userId, Long accountId, String level, String type, String description) { + public static Long onCompletedActionEvent(Long userId, Long accountId, String level, String type, boolean eventDisplayEnabled, String description, long startEventId) { + publishOnEventBus(userId, accountId, EventCategory.ACTION_EVENT.getName(), type, com.cloud.event.Event.State.Completed, description); + + Event event = persistActionEvent(userId, accountId, null, level, type, Event.State.Completed, eventDisplayEnabled, description, startEventId); + + return event.getId(); + + } + + public static Long onCreatedActionEvent(Long userId, Long accountId, String level, String type, boolean eventDisplayEnabled, String description) { publishOnEventBus(userId, accountId, EventCategory.ACTION_EVENT.getName(), type, com.cloud.event.Event.State.Created, description); - Event event = persistActionEvent(userId, accountId, null, level, type, Event.State.Created, description, null); + Event event = persistActionEvent(userId, accountId, null, level, type, Event.State.Created, eventDisplayEnabled, description, null); return event.getId(); } - private static Event persistActionEvent(Long userId, Long accountId, Long domainId, String level, String type, Event.State state, String description, - Long startEventId) { + private static Event persistActionEvent(Long userId, Long accountId, Long domainId, String level, String type, + Event.State state, boolean eventDisplayEnabled, String description, Long startEventId) { EventVO event = new EventVO(); event.setUserId(userId); event.setAccountId(accountId); event.setType(type); event.setState(state); event.setDescription(description); + event.setDisplayEventEnabled(eventDisplayEnabled); + if (domainId != null) { event.setDomainId(domainId); } else { diff --git a/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java b/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java index 3963f29ec81..b7d5be8b237 100755 --- a/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java +++ b/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java @@ -32,7 +32,6 @@ import javax.naming.ConfigurationException; import org.apache.log4j.Logger; import org.apache.log4j.NDC; -import com.cloud.deploy.HAPlanner; import org.apache.cloudstack.engine.orchestration.service.VolumeOrchestrationService; import org.apache.cloudstack.framework.config.dao.ConfigurationDao; import org.apache.cloudstack.managed.context.ManagedContext; @@ -48,6 +47,8 @@ import com.cloud.dc.DataCenterVO; import com.cloud.dc.HostPodVO; import com.cloud.dc.dao.DataCenterDao; import com.cloud.dc.dao.HostPodDao; +import com.cloud.deploy.DeploymentPlanner; +import com.cloud.deploy.HAPlanner; import com.cloud.exception.AgentUnavailableException; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; @@ -62,6 +63,7 @@ import com.cloud.host.dao.HostDao; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.resource.ResourceManager; import com.cloud.server.ManagementServer; +import com.cloud.service.dao.ServiceOfferingDao; import com.cloud.storage.StorageManager; import com.cloud.storage.dao.GuestOSCategoryDao; import com.cloud.storage.dao.GuestOSDao; @@ -70,6 +72,7 @@ import com.cloud.utils.NumbersUtil; import com.cloud.utils.component.ManagerBase; import com.cloud.utils.concurrency.NamedThreadFactory; import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.utils.fsm.StateListener; import com.cloud.vm.VMInstanceVO; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachine.State; @@ -99,8 +102,10 @@ import com.cloud.vm.dao.VMInstanceDao; * ha.retry.wait | time to wait before retrying the work item | seconds | 120 || || stop.retry.wait | time to wait * before retrying the stop | seconds | 120 || * } **/ -@Local(value = {HighAvailabilityManager.class}) -public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvailabilityManager, ClusterManagerListener { +@Local(value = { HighAvailabilityManager.class }) +public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvailabilityManager, ClusterManagerListener, + StateListener { + protected static final Logger s_logger = Logger.getLogger(HighAvailabilityManagerImpl.class); WorkerThread[] _workers; boolean _stopped; @@ -117,6 +122,10 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai HostPodDao _podDao; @Inject ClusterDetailsDao _clusterDetailsDao; + + @Inject + ServiceOfferingDao _serviceOfferingDao; + long _serverId; @Inject @@ -148,7 +157,7 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai } public void setHaPlanners(List haPlanners) { - this._haPlanners = haPlanners; + _haPlanners = haPlanners; } @@ -316,7 +325,6 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai assert false : "How do we hit this when force is true?"; throw new CloudRuntimeException("Caught exception even though it should be handled.", e); } - return; } if (vm.getHypervisorType() == HypervisorType.VMware || vm.getHypervisorType() == HypervisorType.Hyperv) { @@ -611,13 +619,7 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai VMInstanceVO vm = _instanceDao.findById(vmId); // First try starting the vm with its original planner, if it doesn't succeed send HAPlanner as its an emergency. - boolean result = false; - try { - _itMgr.migrateAway(vm.getUuid(), srcHostId, null); - }catch (InsufficientServerCapacityException e) { - s_logger.warn("Failed to deploy vm " + vmId + " with original planner, sending HAPlanner"); - _itMgr.migrateAway(vm.getUuid(), srcHostId, _haPlanners.get(0)); - } + _itMgr.migrateAway(vm.getUuid(), srcHostId); return null; } catch (InsufficientServerCapacityException e) { s_logger.warn("Insufficient capacity for migrating a VM."); @@ -791,6 +793,7 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai _stopped = true; _executor = Executors.newScheduledThreadPool(count, new NamedThreadFactory("HA")); + VirtualMachine.State.getStateMachine().registerListener(this); return true; } @@ -935,4 +938,25 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai return _haTag; } + @Override + public DeploymentPlanner getHAPlanner() { + return _haPlanners.get(0); + } + + @Override + public boolean preStateTransitionEvent(State oldState, VirtualMachine.Event event, State newState, VirtualMachine vo, boolean status, Object opaque) { + return true; + } + + @Override + public boolean postStateTransitionEvent(State oldState, VirtualMachine.Event event, State newState, VirtualMachine vo, boolean status, Object opaque) { + if (oldState == State.Running && event == VirtualMachine.Event.FollowAgentPowerOffReport && newState == State.Stopped) { + VMInstanceVO vm = _instanceDao.findById(vo.getId()); + if (vm.isHaEnabled()) { + s_logger.info("Detected out-of-band stop of a HA enabled VM " + vm.getInstanceName() + ", will schedule restart"); + scheduleRestart(vm, true); + } + } + return true; + } } diff --git a/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java b/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java index 17b489510aa..d91da921ebc 100644 --- a/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java +++ b/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java @@ -159,7 +159,7 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource @Override @DB @ActionEvent(eventType = EventTypes.EVENT_RESOURCE_DETAILS_CREATE, eventDescription = "creating resource meta data") - public boolean addResourceMetaData(final String resourceId, final ResourceObjectType resourceType, final Map details) { + public boolean addResourceMetaData(final String resourceId, final ResourceObjectType resourceType, final Map details, final boolean forDisplay) { return Transaction.execute(new TransactionCallback() { @Override public Boolean doInTransaction(TransactionStatus status) { @@ -171,7 +171,7 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource } DetailDaoHelper newDetailDaoHelper = new DetailDaoHelper(resourceType); - newDetailDaoHelper.addDetail(_taggedResourceMgr.getResourceId(resourceId, resourceType), key, value); + newDetailDaoHelper.addDetail(_taggedResourceMgr.getResourceId(resourceId, resourceType), key, value, forDisplay); } return true; @@ -215,8 +215,8 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource return dao.findDetail(resourceId, key); } - private void addDetail(long resourceId, String key, String value) { - dao.addDetail(resourceId, key, value); + private void addDetail(long resourceId, String key, String value, boolean forDisplay) { + dao.addDetail(resourceId, key, value, forDisplay); } private Map getDetailsMap(long resourceId, Boolean forDisplay) { diff --git a/server/src/com/cloud/network/IpAddressManagerImpl.java b/server/src/com/cloud/network/IpAddressManagerImpl.java index dbec06f9c44..5905fd3de43 100644 --- a/server/src/com/cloud/network/IpAddressManagerImpl.java +++ b/server/src/com/cloud/network/IpAddressManagerImpl.java @@ -17,6 +17,7 @@ package com.cloud.network; import java.util.ArrayList; +import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.HashSet; @@ -114,7 +115,9 @@ import com.cloud.network.rules.StaticNat; import com.cloud.network.rules.dao.PortForwardingRulesDao; import com.cloud.network.vpc.NetworkACLManager; import com.cloud.network.vpc.VpcManager; +import com.cloud.network.vpc.VpcVO; import com.cloud.network.vpc.dao.PrivateIpDao; +import com.cloud.network.vpc.dao.VpcDao; import com.cloud.network.vpn.RemoteAccessVpnService; import com.cloud.offering.NetworkOffering; import com.cloud.offering.NetworkOffering.Availability; @@ -270,6 +273,8 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage Ipv6AddressManager _ipv6Mgr; @Inject PortableIpDao _portableIpDao; + @Inject + VpcDao _vpcDao; SearchBuilder AssignIpAddressSearch; SearchBuilder AssignIpAddressFromPodVlanSearch; @@ -408,7 +413,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage DataCenter zone = _entityMgr.findById(DataCenter.class, zoneId); - return allocateIp(ipOwner, isSystem, caller, callerUserId, zone); + return allocateIp(ipOwner, isSystem, caller, callerUserId, zone, null); } // An IP association is required in below cases @@ -639,18 +644,19 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage @Override public PublicIp assignPublicIpAddress(long dcId, Long podId, Account owner, VlanType type, Long networkId, String requestedIp, boolean isSystem) throws InsufficientAddressCapacityException { - return fetchNewPublicIp(dcId, podId, null, owner, type, networkId, false, true, requestedIp, isSystem, null); + return fetchNewPublicIp(dcId, podId, null, owner, type, networkId, false, true, requestedIp, isSystem, null, null); } @Override public PublicIp assignPublicIpAddressFromVlans(long dcId, Long podId, Account owner, VlanType type, List vlanDbIds, Long networkId, String requestedIp, boolean isSystem) throws InsufficientAddressCapacityException { - return fetchNewPublicIp(dcId, podId, vlanDbIds, owner, type, networkId, false, true, requestedIp, isSystem, null); + return fetchNewPublicIp(dcId, podId, vlanDbIds, owner, type, networkId, false, true, requestedIp, isSystem, null, null); } @DB public PublicIp fetchNewPublicIp(final long dcId, final Long podId, final List vlanDbIds, final Account owner, final VlanType vlanUse, final Long guestNetworkId, - final boolean sourceNat, final boolean assign, final String requestedIp, final boolean isSystem, final Long vpcId) throws InsufficientAddressCapacityException { + final boolean sourceNat, final boolean assign, final String requestedIp, final boolean isSystem, final Long vpcId, final Boolean displayIp) + throws InsufficientAddressCapacityException { IPAddressVO addr = Transaction.execute(new TransactionCallbackWithException() { @Override public IPAddressVO doInTransaction(TransactionStatus status) throws InsufficientAddressCapacityException { @@ -684,7 +690,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage if (dedicatedVlanDbIds != null && !dedicatedVlanDbIds.isEmpty()) { fetchFromDedicatedRange = true; sc.setParameters("vlanId", dedicatedVlanDbIds.toArray()); - errorMessage.append(", vlanId id=" + dedicatedVlanDbIds.toArray()); + errorMessage.append(", vlanId id=" + Arrays.toString(dedicatedVlanDbIds.toArray())); } else if (nonDedicatedVlanDbIds != null && !nonDedicatedVlanDbIds.isEmpty()) { sc.setParameters("vlanId", nonDedicatedVlanDbIds.toArray()); errorMessage.append(", vlanId id=" + nonDedicatedVlanDbIds.toArray()); @@ -763,6 +769,9 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage addr.setAllocatedInDomainId(owner.getDomainId()); addr.setAllocatedToAccountId(owner.getId()); addr.setSystem(isSystem); + if (displayIp != null) { + addr.setDisplay(displayIp); + } if (assign) { markPublicIpAsAllocated(addr); @@ -870,8 +879,16 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage if (s_logger.isDebugEnabled()) { s_logger.debug("lock account " + ownerId + " is acquired"); } + boolean displayIp = true; + if (guestNtwkId != null) { + Network ntwk = _networksDao.findById(guestNtwkId); + displayIp = ntwk.getDisplayNetwork(); + } else if (vpcId != null) { + VpcVO vpc = _vpcDao.findById(vpcId); + displayIp = vpc.isDisplay(); + } - PublicIp ip = fetchNewPublicIp(dcId, null, null, owner, VlanType.VirtualNetwork, guestNtwkId, isSourceNat, false, null, false, vpcId); + PublicIp ip = fetchNewPublicIp(dcId, null, null, owner, VlanType.VirtualNetwork, guestNtwkId, isSourceNat, false, null, false, vpcId, displayIp); IPAddressVO publicIp = ip.ip(); markPublicIpAsAllocated(publicIp); @@ -973,7 +990,8 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage @DB @Override - public IpAddress allocateIp(final Account ipOwner, final boolean isSystem, Account caller, long callerUserId, final DataCenter zone) throws ConcurrentOperationException, + public IpAddress allocateIp(final Account ipOwner, final boolean isSystem, Account caller, long callerUserId, final DataCenter zone, final Boolean displayIp) + throws ConcurrentOperationException, ResourceAllocationException, InsufficientAddressCapacityException { final VlanType vlanType = VlanType.VirtualNetwork; @@ -1006,7 +1024,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage ip = Transaction.execute(new TransactionCallbackWithException() { @Override public PublicIp doInTransaction(TransactionStatus status) throws InsufficientAddressCapacityException { - PublicIp ip = fetchNewPublicIp(zone.getId(), null, null, ipOwner, vlanType, null, false, assign, null, isSystem, null); + PublicIp ip = fetchNewPublicIp(zone.getId(), null, null, ipOwner, vlanType, null, false, assign, null, isSystem, null, displayIp); if (ip == null) { InsufficientAddressCapacityException ex = new InsufficientAddressCapacityException("Unable to find available public IP addresses", DataCenter.class, zone @@ -1037,7 +1055,8 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage @Override @DB - public IpAddress allocatePortableIp(final Account ipOwner, Account caller, final long dcId, final Long networkId, final Long vpcID) throws ConcurrentOperationException, + public IpAddress allocatePortableIp(final Account ipOwner, Account caller, final long dcId, final Long networkId, final Long vpcID) + throws ConcurrentOperationException, ResourceAllocationException, InsufficientAddressCapacityException { GlobalLock portableIpLock = GlobalLock.getInternLock("PortablePublicIpRange"); diff --git a/server/src/com/cloud/network/NetworkModelImpl.java b/server/src/com/cloud/network/NetworkModelImpl.java index 52a08e1480e..9212a89b838 100755 --- a/server/src/com/cloud/network/NetworkModelImpl.java +++ b/server/src/com/cloud/network/NetworkModelImpl.java @@ -1019,7 +1019,7 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel { for (NetworkOfferingServiceMapVO instance : map) { String service = instance.getService(); Set providers; - providers = serviceProviderMap.get(service); + providers = serviceProviderMap.get(Service.getService(service)); if (providers == null) { providers = new HashSet(); } diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java index 41cc2ed63f6..828e6bb4567 100755 --- a/server/src/com/cloud/network/NetworkServiceImpl.java +++ b/server/src/com/cloud/network/NetworkServiceImpl.java @@ -515,7 +515,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService { @Override @ActionEvent(eventType = EventTypes.EVENT_NET_IP_ASSIGN, eventDescription = "allocating Ip", create = true) - public IpAddress allocateIP(Account ipOwner, long zoneId, Long networkId) throws ResourceAllocationException, InsufficientAddressCapacityException, + public IpAddress allocateIP(Account ipOwner, long zoneId, Long networkId, Boolean displayIp) throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException { Account caller = CallContext.current().getCallingAccount(); @@ -539,7 +539,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService { if (s_logger.isDebugEnabled()) { s_logger.debug("Associate IP address called by the user " + callerUserId + " account " + ipOwner.getId()); } - return _ipAddrMgr.allocateIp(ipOwner, false, caller, callerUserId, zone); + return _ipAddrMgr.allocateIp(ipOwner, false, caller, callerUserId, zone, displayIp); } else { throw new InvalidParameterValueException("Associate IP address can only be called on the shared networks in the advanced zone" + " with Firewall/Source Nat/Static Nat/Port Forwarding/Load balancing services enabled"); @@ -550,7 +550,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService { _accountMgr.checkAccess(caller, null, false, ipOwner); } - return _ipAddrMgr.allocateIp(ipOwner, false, caller, callerUserId, zone); + return _ipAddrMgr.allocateIp(ipOwner, false, caller, callerUserId, zone, displayIp); } @Override @@ -1027,11 +1027,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService { zoneId = pNtwk.getDataCenterId(); } - if(displayNetwork != null){ - if(!_accountMgr.isRootAdmin(caller.getId())){ - throw new PermissionDeniedException("Only admin allowed to update displaynetwork parameter"); - } - } else { + if (displayNetwork == null) { displayNetwork = true; } @@ -1392,6 +1388,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService { Boolean canUseForDeploy = cmd.canUseForDeploy(); Map tags = cmd.getTags(); Boolean forVpc = cmd.getForVpc(); + Boolean display = cmd.getDisplay(); // 1) default is system to false if not specified // 2) reset parameter to false if it's specified by the regular user @@ -1524,33 +1521,33 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService { //get account level networks networksToReturn.addAll(listAccountSpecificNetworks( buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, physicalNetworkId, aclType, skipProjectNetworks, restartRequired, - specifyIpRanges, vpcId, tags), searchFilter, permittedAccounts)); + specifyIpRanges, vpcId, tags, display), searchFilter, permittedAccounts)); //get domain level networks if (domainId != null) { networksToReturn.addAll(listDomainLevelNetworks( buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, physicalNetworkId, aclType, true, restartRequired, - specifyIpRanges, vpcId, tags), searchFilter, domainId, false)); + specifyIpRanges, vpcId, tags, display), searchFilter, domainId, false)); } } else { //add account specific networks networksToReturn.addAll(listAccountSpecificNetworksByDomainPath( buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, physicalNetworkId, aclType, skipProjectNetworks, restartRequired, - specifyIpRanges, vpcId, tags), searchFilter, path, isRecursive)); + specifyIpRanges, vpcId, tags, display), searchFilter, path, isRecursive)); //add domain specific networks of domain + parent domains networksToReturn.addAll(listDomainSpecificNetworksByDomainPath( buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, physicalNetworkId, aclType, skipProjectNetworks, restartRequired, - specifyIpRanges, vpcId, tags), searchFilter, path, isRecursive)); + specifyIpRanges, vpcId, tags, display), searchFilter, path, isRecursive)); //add networks of subdomains if (domainId == null) { networksToReturn.addAll(listDomainLevelNetworks( buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, physicalNetworkId, aclType, true, restartRequired, - specifyIpRanges, vpcId, tags), searchFilter, caller.getDomainId(), true)); + specifyIpRanges, vpcId, tags, display), searchFilter, caller.getDomainId(), true)); } } } else { networksToReturn = _networksDao.search( buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, physicalNetworkId, null, skipProjectNetworks, restartRequired, - specifyIpRanges, vpcId, tags), searchFilter); + specifyIpRanges, vpcId, tags, display), searchFilter); } if (supportedServicesStr != null && !supportedServicesStr.isEmpty() && !networksToReturn.isEmpty()) { @@ -1617,7 +1614,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService { private SearchCriteria buildNetworkSearchCriteria(SearchBuilder sb, String keyword, Long id, Boolean isSystem, Long zoneId, String guestIpType, String trafficType, Long physicalNetworkId, String aclType, boolean skipProjectNetworks, Boolean restartRequired, Boolean specifyIpRanges, Long vpcId, - Map tags) { + Map tags, Boolean display) { SearchCriteria sc = sb.create(); @@ -1631,6 +1628,10 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService { sc.addAnd("name", SearchCriteria.Op.SC, ssc); } + if (display != null) { + sc.addAnd("displayNetwork", SearchCriteria.Op.EQ, display); + } + if (id != null) { sc.addAnd("id", SearchCriteria.Op.EQ, id); } @@ -1995,10 +1996,6 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService { // display flag is not null and has changed if (displayNetwork != null && displayNetwork != network.getDisplayNetwork()) { - if (!_accountMgr.isRootAdmin(callerAccount.getId())) { - throw new PermissionDeniedException("Only admin allowed to update displaynetwork parameter"); - } - // Update resource count if it needs to be updated NetworkOffering networkOffering = _networkOfferingDao.findById(network.getNetworkOfferingId()); if (_networkMgr.resourceCountNeedsUpdate(networkOffering, network.getAclType())) { @@ -3601,6 +3598,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService { // For public traffic, get isolation method of physical network and update the public network accordingly // each broadcast type will individually need to be qualified for support of public traffic + if (TrafficType.Public.equals(trafficType)){ List isolationMethods = network.getIsolationMethods(); if ((isolationMethods.size() == 1 && isolationMethods.get(0).toLowerCase().equals("vxlan")) || (isolationMethod != null && isolationMethods.contains(isolationMethod) && isolationMethod.toLowerCase().equals("vxlan"))) { @@ -3612,6 +3610,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService { _networksDao.persist(publicNetwork); } } + } return pNetworktrafficType; } catch (Exception ex) { @@ -4018,14 +4017,14 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService { Long nicId = cmd.getNicId(); long vmId = cmd.getVmId(); Long networkId = cmd.getNetworkId(); - UserVmVO userVm = _userVmDao.findById(vmId); - if (userVm == null) { + if (userVm == null || (!userVm.isDisplayVm() && caller.getType() == Account.ACCOUNT_TYPE_NORMAL)) { InvalidParameterValueException ex = new InvalidParameterValueException("Virtual mahine id does not exist"); ex.addProxyObject(Long.valueOf(vmId).toString(), "vmId"); throw ex; } + _accountMgr.checkAccess(caller, null, true, userVm); return _networkMgr.listVmNics(vmId, nicId, networkId); } @@ -4041,7 +4040,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService { @Override @ActionEvent(eventType = EventTypes.EVENT_NET_IP_UPDATE, eventDescription = "updating public ip address", async = true) - public IpAddress updateIP(Long id, String customId) { + public IpAddress updateIP(Long id, String customId, Boolean displayIp) { Account caller = CallContext.current().getCallingAccount(); IPAddressVO ipVO = _ipAddressDao.findById(id); if (ipVO == null) { @@ -4058,6 +4057,11 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService { if (customId != null) { ipVO.setUuid(customId); } + + if (displayIp != null) { + ipVO.setDisplay(displayIp); + } + _ipAddressDao.update(id, ipVO); return _ipAddressDao.findById(id); } diff --git a/server/src/com/cloud/network/as/AutoScaleManagerImpl.java b/server/src/com/cloud/network/as/AutoScaleManagerImpl.java index c8cc5b3cc0f..e07e5023551 100644 --- a/server/src/com/cloud/network/as/AutoScaleManagerImpl.java +++ b/server/src/com/cloud/network/as/AutoScaleManagerImpl.java @@ -372,6 +372,11 @@ public class AutoScaleManagerImpl extends ManagerBase implements AutoScale AutoScaleVmProfileVO profileVO = new AutoScaleVmProfileVO(cmd.getZoneId(), cmd.getDomainId(), cmd.getAccountId(), cmd.getServiceOfferingId(), cmd.getTemplateId(), cmd.getOtherDeployParams(), cmd.getCounterParamList(), cmd.getDestroyVmGraceperiod(), autoscaleUserId); + + if (cmd.getDisplay() != null) { + profileVO.setDisplay(cmd.getDisplay()); + } + profileVO = checkValidityAndPersist(profileVO); s_logger.info("Successfully create AutoScale Vm Profile with Id: " + profileVO.getId()); @@ -412,6 +417,10 @@ public class AutoScaleManagerImpl extends ManagerBase implements AutoScale vmProfile.setUuid(cmd.getCustomId()); } + if (cmd.getDisplay() != null) { + vmProfile.setDisplay(cmd.getDisplay()); + } + List vmGroupList = _autoScaleVmGroupDao.listByAll(null, profileId); for (AutoScaleVmGroupVO vmGroupVO : vmGroupList) { if (physicalParameterUpdate && !vmGroupVO.getState().equals(AutoScaleVmGroup.State_Disabled)) { @@ -447,6 +456,7 @@ public class AutoScaleManagerImpl extends ManagerBase implements AutoScale String otherDeployParams = cmd.getOtherDeployParams(); Long serviceOffId = cmd.getServiceOfferingId(); Long zoneId = cmd.getZoneId(); + Boolean display = cmd.getDisplay(); SearchWrapper searchWrapper = new SearchWrapper(_autoScaleVmProfileDao, AutoScaleVmProfileVO.class, cmd, cmd.getId(), "listAutoScaleVmProfiles"); @@ -457,6 +467,7 @@ public class AutoScaleManagerImpl extends ManagerBase implements AutoScale sb.and("serviceOfferingId", sb.entity().getServiceOfferingId(), SearchCriteria.Op.EQ); sb.and("otherDeployParams", sb.entity().getOtherDeployParams(), SearchCriteria.Op.LIKE); sb.and("zoneId", sb.entity().getZoneId(), SearchCriteria.Op.EQ); + sb.and("display", sb.entity().isDisplay(), SearchCriteria.Op.EQ); SearchCriteria sc = searchWrapper.buildSearchCriteria(); if (id != null) { @@ -477,6 +488,10 @@ public class AutoScaleManagerImpl extends ManagerBase implements AutoScale sc.setParameters("zoneId", zoneId); } + if (display != null) { + sc.setParameters("display", display); + } + return searchWrapper.search(); } @@ -748,6 +763,7 @@ public class AutoScaleManagerImpl extends ManagerBase implements AutoScale int minMembers = cmd.getMinMembers(); int maxMembers = cmd.getMaxMembers(); Integer interval = cmd.getInterval(); + Boolean forDisplay = cmd.getDisplay(); if (interval == null) { interval = NetUtils.DEFAULT_AUTOSCALE_POLICY_INTERVAL_TIME; @@ -769,6 +785,10 @@ public class AutoScaleManagerImpl extends ManagerBase implements AutoScale AutoScaleVmGroupVO vmGroupVO = new AutoScaleVmGroupVO(cmd.getLbRuleId(), zoneId, loadBalancer.getDomainId(), loadBalancer.getAccountId(), minMembers, maxMembers, loadBalancer.getDefaultPortStart(), interval, null, cmd.getProfileId(), AutoScaleVmGroup.State_New); + if (forDisplay != null) { + vmGroupVO.setDisplay(forDisplay); + } + vmGroupVO = checkValidityAndPersist(vmGroupVO, cmd.getScaleUpPolicyIds(), cmd.getScaleDownPolicyIds()); s_logger.info("Successfully created Autoscale Vm Group with Id: " + vmGroupVO.getId()); @@ -859,6 +879,7 @@ public class AutoScaleManagerImpl extends ManagerBase implements AutoScale Long loadBalancerId = cmd.getLoadBalancerId(); Long profileId = cmd.getProfileId(); Long zoneId = cmd.getZoneId(); + Boolean forDisplay = cmd.getDisplay(); SearchWrapper searchWrapper = new SearchWrapper(_autoScaleVmGroupDao, AutoScaleVmGroupVO.class, cmd, cmd.getId(), "listAutoScaleVmGroups"); @@ -868,6 +889,7 @@ public class AutoScaleManagerImpl extends ManagerBase implements AutoScale sb.and("loadBalancerId", sb.entity().getLoadBalancerId(), SearchCriteria.Op.EQ); sb.and("profileId", sb.entity().getProfileId(), SearchCriteria.Op.EQ); sb.and("zoneId", sb.entity().getZoneId(), SearchCriteria.Op.EQ); + sb.and("display", sb.entity().isDisplay(), SearchCriteria.Op.EQ); if (policyId != null) { SearchBuilder asVmGroupPolicySearch = _autoScaleVmGroupPolicyMapDao.createSearchBuilder(); @@ -891,6 +913,9 @@ public class AutoScaleManagerImpl extends ManagerBase implements AutoScale if (policyId != null) { sc.setJoinParameters("asVmGroupPolicySearch", "policyId", policyId); } + if (forDisplay != null) { + sc.setParameters("display", forDisplay); + } return searchWrapper.search(); } @@ -980,6 +1005,7 @@ public class AutoScaleManagerImpl extends ManagerBase implements AutoScale Integer minMembers = cmd.getMinMembers(); Integer maxMembers = cmd.getMaxMembers(); Integer interval = cmd.getInterval(); + Boolean forDisplay = cmd.getDisplay(); List scaleUpPolicyIds = cmd.getScaleUpPolicyIds(); List scaleDownPolicyIds = cmd.getScaleDownPolicyIds(); @@ -1008,6 +1034,10 @@ public class AutoScaleManagerImpl extends ManagerBase implements AutoScale vmGroupVO.setUuid(cmd.getCustomId()); } + if (forDisplay != null) { + vmGroupVO.setDisplay(forDisplay); + } + vmGroupVO = checkValidityAndPersist(vmGroupVO, scaleUpPolicyIds, scaleDownPolicyIds); if (vmGroupVO != null) { s_logger.debug("Updated Auto Scale VmGroup id:" + vmGroupId); diff --git a/server/src/com/cloud/network/firewall/FirewallManagerImpl.java b/server/src/com/cloud/network/firewall/FirewallManagerImpl.java index b5374e7d93e..c312d3d1ba8 100644 --- a/server/src/com/cloud/network/firewall/FirewallManagerImpl.java +++ b/server/src/com/cloud/network/firewall/FirewallManagerImpl.java @@ -170,7 +170,7 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService, } return createFirewallRule(null, caller, rule.getXid(), rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getProtocol(), rule.getSourceCidrList(), - rule.getIcmpCode(), rule.getIcmpType(), null, rule.getType(), rule.getNetworkId(), rule.getTrafficType()); + rule.getIcmpCode(), rule.getIcmpType(), null, rule.getType(), rule.getNetworkId(), rule.getTrafficType(), rule.isDisplay()); } @Override @@ -180,13 +180,14 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService, Long sourceIpAddressId = rule.getSourceIpAddressId(); return createFirewallRule(sourceIpAddressId, caller, rule.getXid(), rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getProtocol(), - rule.getSourceCidrList(), rule.getIcmpCode(), rule.getIcmpType(), null, rule.getType(), rule.getNetworkId(), rule.getTrafficType()); + rule.getSourceCidrList(), rule.getIcmpCode(), rule.getIcmpType(), null, rule.getType(), rule.getNetworkId(), rule.getTrafficType(), rule.isDisplay()); } @DB protected FirewallRule createFirewallRule(final Long ipAddrId, Account caller, final String xId, final Integer portStart, final Integer portEnd, final String protocol, final List sourceCidrList, final Integer icmpCode, final Integer icmpType, final Long relatedRuleId, - final FirewallRule.FirewallRuleType type, final Long networkId, final FirewallRule.TrafficType trafficType) throws NetworkRuleConflictException { + final FirewallRule.FirewallRuleType type, + final Long networkId, final FirewallRule.TrafficType trafficType, final Boolean forDisplay) throws NetworkRuleConflictException { IPAddressVO ipAddress = null; if (ipAddrId != null) { @@ -233,6 +234,9 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService, new FirewallRuleVO(xId, ipAddrId, portStart, portEnd, protocol.toLowerCase(), networkId, accountIdFinal, domainIdFinal, Purpose.Firewall, sourceCidrList, icmpCode, icmpType, relatedRuleId, trafficType); newRule.setType(type); + if (forDisplay != null) { + newRule.setDisplay(forDisplay); + } newRule = _firewallDao.persist(newRule); if (type == FirewallRuleType.User) @@ -255,6 +259,7 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService, Long networkId = cmd.getNetworkId(); Map tags = cmd.getTags(); FirewallRule.TrafficType trafficType = cmd.getTrafficType(); + Boolean display = cmd.getDisplay(); Account caller = CallContext.current().getCallingAccount(); List permittedDomains = new ArrayList(); @@ -283,6 +288,7 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService, sb.and("networkId", sb.entity().getNetworkId(), Op.EQ); sb.and("ip", sb.entity().getSourceIpAddressId(), Op.EQ); sb.and("purpose", sb.entity().getPurpose(), Op.EQ); + sb.and("display", sb.entity().isDisplay(), Op.EQ); if (tags != null && !tags.isEmpty()) { SearchBuilder tagSearch = _resourceTagDao.createSearchBuilder(); @@ -313,6 +319,10 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService, } } + if (display != null) { + sc.setParameters("display", display); + } + if (ipId != null) { sc.setParameters("ip", ipId); } @@ -717,12 +727,12 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService, @Override @ActionEvent(eventType = EventTypes.EVENT_FIREWALL_UPDATE, eventDescription = "updating firewall rule", async = true) - public FirewallRule updateFirewallRule(long ruleId, String customId) { + public FirewallRule updateFirewallRule(long ruleId, String customId, Boolean forDisplay) { Account caller = CallContext.current().getCallingAccount(); - return updateFirewallRule(ruleId, customId, caller); + return updateFirewallRule(ruleId, customId, caller, forDisplay); } - protected FirewallRule updateFirewallRule(long ruleId, String customId, Account caller) { + protected FirewallRule updateFirewallRule(long ruleId, String customId, Account caller, Boolean forDisplay) { FirewallRuleVO rule = _firewallDao.findById(ruleId); if (rule == null || rule.getPurpose() != Purpose.Firewall) { throw new InvalidParameterValueException("Unable to find " + ruleId + " having purpose " + Purpose.Firewall); @@ -736,8 +746,14 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService, if (customId != null) { rule.setUuid(customId); - _firewallDao.update(ruleId, rule); } + + if (forDisplay != null) { + rule.setDisplay(forDisplay); + } + + _firewallDao.update(ruleId, rule); + return _firewallDao.findById(ruleId); } @@ -822,7 +838,7 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService, List oneCidr = new ArrayList(); oneCidr.add(NetUtils.ALL_CIDRS); return createFirewallRule(ipAddrId, caller, null, startPort, endPort, protocol, oneCidr, icmpCode, icmpType, relatedRuleId, FirewallRule.FirewallRuleType.User, - networkId, FirewallRule.TrafficType.Ingress); + networkId, FirewallRule.TrafficType.Ingress, true); } @Override @@ -936,7 +952,7 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService, _firewallDao.loadSourceCidrs(rule); } createFirewallRule(ip.getId(), acct, rule.getXid(), rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getProtocol(), rule.getSourceCidrList(), - rule.getIcmpCode(), rule.getIcmpType(), rule.getRelated(), FirewallRuleType.System, rule.getNetworkId(), rule.getTrafficType()); + rule.getIcmpCode(), rule.getIcmpType(), rule.getRelated(), FirewallRuleType.System, rule.getNetworkId(), rule.getTrafficType(), true); } catch (Exception e) { s_logger.debug("Failed to add system wide firewall rule, due to:" + e.toString()); } diff --git a/server/src/com/cloud/network/guru/ControlNetworkGuru.java b/server/src/com/cloud/network/guru/ControlNetworkGuru.java index a6e21801586..13ff385da90 100755 --- a/server/src/com/cloud/network/guru/ControlNetworkGuru.java +++ b/server/src/com/cloud/network/guru/ControlNetworkGuru.java @@ -224,12 +224,12 @@ public class ControlNetworkGuru extends PodBasedNetworkGuru implements NetworkGu Map dbParams = _configDao.getConfiguration(params); - _cidr = dbParams.get(Config.ControlCidr); + _cidr = dbParams.get(Config.ControlCidr.toString()); if (_cidr == null) { _cidr = "169.254.0.0/16"; } - _gateway = dbParams.get(Config.ControlGateway); + _gateway = dbParams.get(Config.ControlGateway.toString()); if (_gateway == null) { _gateway = NetUtils.getLinkLocalGateway(); } diff --git a/server/src/com/cloud/network/guru/GuestNetworkGuru.java b/server/src/com/cloud/network/guru/GuestNetworkGuru.java index a759951b85e..b7b26275a34 100755 --- a/server/src/com/cloud/network/guru/GuestNetworkGuru.java +++ b/server/src/com/cloud/network/guru/GuestNetworkGuru.java @@ -417,13 +417,13 @@ public abstract class GuestNetworkGuru extends AdapterBase implements NetworkGur @Override public void shutdown(NetworkProfile profile, NetworkOffering offering) { - if (profile.getBroadcastDomainType() == BroadcastDomainType.Vlan && profile.getBroadcastUri() != null && !offering.getSpecifyVlan()) { + if ((profile.getBroadcastDomainType() == BroadcastDomainType.Vlan || profile.getBroadcastDomainType() == BroadcastDomainType.Vxlan) && !offering.getSpecifyVlan()) { s_logger.debug("Releasing vnet for the network id=" + profile.getId()); _dcDao.releaseVnet(BroadcastDomainType.getValue(profile.getBroadcastUri()), profile.getDataCenterId(), profile.getPhysicalNetworkId(), profile.getAccountId(), profile.getReservationId()); ActionEventUtils.onCompletedActionEvent(CallContext.current().getCallingUserId(), profile.getAccountId(), EventVO.LEVEL_INFO, EventTypes.EVENT_ZONE_VLAN_RELEASE, - "Released Zone Vlan: " + BroadcastDomainType.getValue(profile.getBroadcastUri()) + " for Network: " + profile.getId(), 0); + "Released Zone Vnet: " + BroadcastDomainType.getValue(profile.getBroadcastUri()) + " for Network: " + profile.getId(), 0); } profile.setBroadcastUri(null); } diff --git a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java index e08b76c1c3d..9f280ef7a80 100755 --- a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java +++ b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java @@ -1411,7 +1411,7 @@ public class LoadBalancingRulesManagerImpl extends ManagerBase implements @Override @ActionEvent(eventType = EventTypes.EVENT_LOAD_BALANCER_CREATE, eventDescription = "creating load balancer") public LoadBalancer createPublicLoadBalancerRule(String xId, String name, String description, int srcPortStart, int srcPortEnd, int defPortStart, int defPortEnd, - Long ipAddrId, String protocol, String algorithm, long networkId, long lbOwnerId, boolean openFirewall, String lbProtocol) throws NetworkRuleConflictException, + Long ipAddrId, String protocol, String algorithm, long networkId, long lbOwnerId, boolean openFirewall, String lbProtocol, Boolean forDisplay) throws NetworkRuleConflictException, InsufficientAddressCapacityException { Account lbOwner = _accountMgr.getAccount(lbOwnerId); @@ -1467,9 +1467,8 @@ public class LoadBalancingRulesManagerImpl extends ManagerBase implements throw new InvalidParameterValueException("Ip address " + ipVO + " is not assigned to the network " + network); } - result = - createPublicLoadBalancer(xId, name, description, srcPortStart, defPortStart, ipVO.getId(), protocol, algorithm, openFirewall, CallContext.current(), - lbProtocol); + result = createPublicLoadBalancer(xId, name, description, srcPortStart, defPortStart, ipVO.getId(), protocol, algorithm, openFirewall, CallContext.current(), + lbProtocol, forDisplay); } catch (Exception ex) { s_logger.warn("Failed to create load balancer due to ", ex); if (ex instanceof NetworkRuleConflictException) { @@ -1498,7 +1497,8 @@ public class LoadBalancingRulesManagerImpl extends ManagerBase implements @DB @Override public LoadBalancer createPublicLoadBalancer(final String xId, final String name, final String description, final int srcPort, final int destPort, - final long sourceIpId, final String protocol, final String algorithm, final boolean openFirewall, final CallContext caller, final String lbProtocol) + final long sourceIpId, + final String protocol, final String algorithm, final boolean openFirewall, final CallContext caller, final String lbProtocol, final Boolean forDisplay) throws NetworkRuleConflictException { if (!NetUtils.isValidPort(destPort)) { @@ -1560,6 +1560,10 @@ public class LoadBalancingRulesManagerImpl extends ManagerBase implements new LoadBalancerVO(xId, name, description, sourceIpId, srcPort, destPort, algorithm, networkId, ipAddr.getAllocatedToAccountId(), ipAddr.getAllocatedInDomainId(), lbProtocol); + if (forDisplay != null) { + newRule.setDisplay(forDisplay); + } + // verify rule is supported by Lb provider of the network Ip sourceIp = getSourceIp(newRule); LoadBalancingRule loadBalancing = @@ -1889,6 +1893,7 @@ public class LoadBalancingRulesManagerImpl extends ManagerBase implements LoadBalancerVO lb = _lbDao.findById(lbRuleId); LoadBalancerVO lbBackup = _lbDao.findById(lbRuleId); String customId = cmd.getCustomId(); + Boolean forDisplay = cmd.getDisplay(); if (lb == null) { throw new InvalidParameterValueException("Unable to find lb rule by id=" + lbRuleId); @@ -1913,6 +1918,10 @@ public class LoadBalancingRulesManagerImpl extends ManagerBase implements lb.setUuid(customId); } + if (forDisplay != null) { + lb.setDisplay(forDisplay); + } + boolean success = _lbDao.update(lbRuleId, lb); // If algorithm is changed, have to reapply the lb config diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java index e838530f844..9097b873caf 100644 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java @@ -50,6 +50,7 @@ public interface VirtualNetworkApplianceManager extends Manager, VirtualNetworkA static final String RouterTemplateVmwareCK = "router.template.vmware"; static final String RouterTemplateHyperVCK = "router.template.hyperv"; static final String RouterTemplateLxcCK = "router.template.lxc"; + static final String SetServiceMonitorCK = "network.router.EnableServiceMonitoring"; static final ConfigKey RouterTemplateXen = new ConfigKey(String.class, RouterTemplateXenCK, "Advanced", "SystemVM Template (XenServer)", "Name of the default router template on Xenserver.", true, ConfigKey.Scope.Zone, null); @@ -62,6 +63,9 @@ public interface VirtualNetworkApplianceManager extends Manager, VirtualNetworkA static final ConfigKey RouterTemplateLxc = new ConfigKey(String.class, RouterTemplateLxcCK, "Advanced", "SystemVM Template (LXC)", "Name of the default router template on LXC.", true, ConfigKey.Scope.Zone, null); + static final ConfigKey SetServiceMonitor = new ConfigKey(String.class, SetServiceMonitorCK, "Advanced", "true", + "service monitoring in router enable/disable option, default true", true, ConfigKey.Scope.Zone, null); + public static final int DEFAULT_ROUTER_VM_RAMSIZE = 128; // 128M public static final int DEFAULT_ROUTER_CPU_MHZ = 500; // 500 MHz public static final boolean USE_POD_VLAN = false; diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index 734fc5b3d78..37171f540a1 100755 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -18,6 +18,7 @@ package com.cloud.network.router; import java.util.ArrayList; +import java.util.Arrays; import java.util.Calendar; import java.util.Collections; import java.util.Comparator; @@ -30,7 +31,6 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.TimeZone; -import java.util.UUID; import java.util.concurrent.BlockingQueue; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -42,8 +42,6 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.command.admin.router.RebootRouterCmd; import org.apache.cloudstack.api.command.admin.router.UpgradeRouterCmd; import org.apache.cloudstack.api.command.admin.router.UpgradeRouterTemplateCmd; @@ -58,6 +56,7 @@ import org.apache.cloudstack.framework.jobs.AsyncJobManager; import org.apache.cloudstack.framework.jobs.impl.AsyncJobVO; import org.apache.cloudstack.managed.context.ManagedContextRunnable; import org.apache.cloudstack.utils.identity.ManagementServerNode; +import org.apache.log4j.Logger; import com.cloud.agent.AgentManager; import com.cloud.agent.Listener; @@ -106,6 +105,7 @@ import com.cloud.agent.api.to.StaticNatRuleTO; import com.cloud.agent.manager.Commands; import com.cloud.alert.AlertManager; import com.cloud.api.ApiAsyncJobDispatcher; +import com.cloud.api.ApiDispatcher; import com.cloud.api.ApiGsonHelper; import com.cloud.cluster.ManagementServerHostVO; import com.cloud.cluster.dao.ManagementServerHostDao; @@ -251,6 +251,7 @@ import com.cloud.utils.db.Transaction; import com.cloud.utils.db.TransactionCallbackNoReturn; import com.cloud.utils.db.TransactionStatus; import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.utils.fsm.StateListener; import com.cloud.utils.net.Ip; import com.cloud.utils.net.MacAddress; import com.cloud.utils.net.NetUtils; @@ -281,9 +282,9 @@ import com.cloud.vm.dao.VMInstanceDao; /** * VirtualNetworkApplianceManagerImpl manages the different types of virtual network appliances available in the Cloud Stack. */ -@Local(value = {VirtualNetworkApplianceManager.class, VirtualNetworkApplianceService.class}) -public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements VirtualNetworkApplianceManager, VirtualNetworkApplianceService, VirtualMachineGuru, -Listener, Configurable { +@Local(value = { VirtualNetworkApplianceManager.class, VirtualNetworkApplianceService.class }) +public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements VirtualNetworkApplianceManager, VirtualNetworkApplianceService, + VirtualMachineGuru, Listener, Configurable, StateListener { private static final Logger s_logger = Logger.getLogger(VirtualNetworkApplianceManagerImpl.class); @Inject @@ -675,6 +676,8 @@ Listener, Configurable { _checkExecutor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("RouterStatusMonitor")); _networkStatsUpdateExecutor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("NetworkStatsUpdater")); + VirtualMachine.State.getStateMachine().registerListener(this); + final Map configs = _configDao.getConfiguration("AgentManager", params); _routerRamSize = NumbersUtil.parseInt(configs.get("router.ram.size"), DEFAULT_ROUTER_VM_RAMSIZE); @@ -1566,10 +1569,10 @@ Listener, Configurable { final int count = routerCount - routers.size(); final DeploymentPlan plan = planAndRouters.first(); for (int i = 0; i < count; i++) { - final LinkedHashMap networks = - createRouterNetworks(owner, isRedundant, plan, guestNetwork, new Pair(publicNetwork, sourceNatIp)); + LinkedHashMap> networks = createRouterNetworks(owner, isRedundant, plan, guestNetwork, new Pair( + publicNetwork, sourceNatIp)); //don't start the router as we are holding the network lock that needs to be released at the end of router allocation - final DomainRouterVO router = deployRouter(owner, destination, plan, params, isRedundant, vrProvider, offeringId, null, networks, false, null); + DomainRouterVO router = deployRouter(owner, destination, plan, params, isRedundant, vrProvider, offeringId, null, networks, false, null); if (router != null) { _routerDao.addRouterToGuestNetwork(router, guestNetwork); @@ -1607,7 +1610,7 @@ Listener, Configurable { } protected DomainRouterVO deployRouter(final Account owner, final DeployDestination dest, final DeploymentPlan plan, final Map params, final boolean isRedundant, - final VirtualRouterProvider vrProvider, final long svcOffId, final Long vpcId, final LinkedHashMap networks, final boolean startRouter, + final VirtualRouterProvider vrProvider, final long svcOffId, final Long vpcId, final LinkedHashMap> networks, final boolean startRouter, final List supportedHypervisors) throws ConcurrentOperationException, InsufficientAddressCapacityException, InsufficientServerCapacityException, InsufficientCapacityException, StorageUnavailableException, ResourceUnavailableException { @@ -1747,7 +1750,7 @@ Listener, Configurable { return hypervisors; } - protected LinkedHashMap createRouterNetworks(final Account owner, final boolean isRedundant, final DeploymentPlan plan, final Network guestNetwork, + protected LinkedHashMap> createRouterNetworks(final Account owner, final boolean isRedundant, final DeploymentPlan plan, final Network guestNetwork, final Pair publicNetwork) throws ConcurrentOperationException, InsufficientAddressCapacityException { boolean setupPublicNetwork = false; @@ -1756,8 +1759,7 @@ Listener, Configurable { } //Form networks - final LinkedHashMap networks = new LinkedHashMap(3); - + LinkedHashMap> networks = new LinkedHashMap>(3); //1) Guest network boolean hasGuestNetwork = false; if (guestNetwork != null) { @@ -1813,17 +1815,16 @@ Listener, Configurable { gatewayNic.setDefaultNic(true); } - networks.put(guestNetwork, gatewayNic); + networks.put(guestNetwork, new ArrayList(Arrays.asList(gatewayNic))); hasGuestNetwork = true; } //2) Control network s_logger.debug("Adding nic for Virtual Router in Control network "); - final List offerings = _networkModel.getSystemAccountNetworkOfferings(NetworkOffering.SystemControlNetwork); - final NetworkOffering controlOffering = offerings.get(0); - final Network controlConfig = _networkMgr.setupNetwork(_systemAcct, controlOffering, plan, null, null, false).get(0); - networks.put(controlConfig, null); - + List offerings = _networkModel.getSystemAccountNetworkOfferings(NetworkOffering.SystemControlNetwork); + NetworkOffering controlOffering = offerings.get(0); + Network controlConfig = _networkMgr.setupNetwork(_systemAcct, controlOffering, plan, null, null, false).get(0); + networks.put(controlConfig, new ArrayList()); //3) Public network if (setupPublicNetwork) { final PublicIp sourceNatIp = publicNetwork.second(); @@ -1858,7 +1859,7 @@ Listener, Configurable { s_logger.info("Use same MAC as previous RvR, the MAC is " + peerNic.getMacAddress()); defaultNic.setMacAddress(peerNic.getMacAddress()); } - networks.put(publicNetworks.get(0), defaultNic); + networks.put(publicNetworks.get(0), new ArrayList(Arrays.asList(defaultNic))); } return networks; @@ -2327,12 +2328,23 @@ Listener, Configurable { finalizeUserDataAndDhcpOnStart(cmds, router, provider, guestNetworkId); } - finalizeMonitorServiceOnStrat(cmds, profile, router, provider, routerGuestNtwkIds.get(0)); + + + String serviceMonitringSet = SetServiceMonitor.valueIn(router.getDataCenterId()); + //String serviceMonitringSet = _configDao.getValue(Config.EnableServiceMonitoring.key()); + + if (serviceMonitringSet != null && serviceMonitringSet.equalsIgnoreCase("true")) { + finalizeMonitorServiceOnStrat(cmds, profile, router, provider, routerGuestNtwkIds.get(0), true); + } else { + finalizeMonitorServiceOnStrat(cmds, profile, router, provider, routerGuestNtwkIds.get(0), false); + } + + return true; } - private void finalizeMonitorServiceOnStrat(final Commands cmds, final VirtualMachineProfile profile, final DomainRouterVO router, final Provider provider, final long networkId) { + private void finalizeMonitorServiceOnStrat(Commands cmds, VirtualMachineProfile profile, DomainRouterVO router, Provider provider, long networkId, Boolean add) { final NetworkVO network = _networkDao.findById(networkId); @@ -2373,6 +2385,9 @@ Listener, Configurable { command.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, getRouterIpInNetwork(networkId, router.getId())); command.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName()); + if (!add) { + command.setAccessDetail(NetworkElementCommand.ROUTER_MONITORING_ENABLE, add.toString()); + } cmds.addCommand("monitor", command); } @@ -3421,7 +3436,6 @@ Listener, Configurable { "vmdata", generateVmDataCommand(router, nic.getIp4Address(), vm.getUserData(), serviceOffering, zoneName, nic.getIp4Address(), vm.getHostName(), vm.getInstanceName(), vm.getId(), vm.getUuid(), publicKey, nic.getNetworkId())); - } private void createVmDataCommandForVMs(final DomainRouterVO router, final Commands cmds, final long guestNetworkId) { @@ -4178,26 +4192,26 @@ Listener, Configurable { return (Version.compare(trimmedVersion, MinVRVersion) >= 0); } - private List rebootRouters(final List routers) { - final List jobIds = new ArrayList(); - for (final DomainRouterVO router : routers) { - if (!checkRouterVersion(router)) { - s_logger.debug("Upgrading template for router: " + router.getId()); - final Map params = new HashMap(); - params.put("ctxUserId", "1"); - params.put("ctxAccountId", "" + router.getAccountId()); + private List rebootRouters(List routers){ + List jobIds = new ArrayList(); + for(DomainRouterVO router: routers){ + if(!checkRouterVersion(router)){ + s_logger.debug("Upgrading template for router: "+router.getId()); + ApiDispatcher.getInstance(); + Map params = new HashMap(); + params.put("ctxUserId", "1"); + params.put("ctxAccountId", "" + router.getAccountId()); - final RebootRouterCmd cmd = new RebootRouterCmd(); - ComponentContext.inject(cmd); - params.put("id", "" + router.getId()); - params.put("ctxStartEventId", "1"); - final AsyncJobVO job = - new AsyncJobVO(UUID.randomUUID().toString(), User.UID_SYSTEM, router.getAccountId(), RebootRouterCmd.class.getName(), ApiGsonHelper.getBuilder() - .create() - .toJson(params), router.getId(), cmd.getInstanceType() != null ? cmd.getInstanceType().toString() : null); - job.setDispatcher(_asyncDispatcher.getName()); - final long jobId = _asyncMgr.submitAsyncJob(job); - jobIds.add(jobId); + RebootRouterCmd cmd = new RebootRouterCmd(); + ComponentContext.inject(cmd); + params.put("id", ""+router.getId()); + params.put("ctxStartEventId", "1"); + AsyncJobVO job = new AsyncJobVO("", User.UID_SYSTEM, router.getAccountId(), RebootRouterCmd.class.getName(), + ApiGsonHelper.getBuilder().create().toJson(params), router.getId(), + cmd.getInstanceType() != null ? cmd.getInstanceType().toString() : null); + job.setDispatcher(_asyncDispatcher.getName()); + long jobId = _asyncMgr.submitAsyncJob(job); + jobIds.add(jobId); } else { s_logger.debug("Router: " + router.getId() + " is already at the latest version. No upgrade required"); } @@ -4212,6 +4226,41 @@ Listener, Configurable { @Override public ConfigKey[] getConfigKeys() { - return new ConfigKey[] {UseExternalDnsServers, routerVersionCheckEnabled}; + return new ConfigKey[] {UseExternalDnsServers, routerVersionCheckEnabled, SetServiceMonitor}; + } + + @Override + public boolean preStateTransitionEvent(State oldState, VirtualMachine.Event event, State newState, VirtualMachine vo, boolean status, Object opaque) { + return true; + } + + @Override + public boolean postStateTransitionEvent(State oldState, VirtualMachine.Event event, State newState, VirtualMachine vo, boolean status, Object opaque) { + if (oldState == State.Stopped && event == VirtualMachine.Event.FollowAgentPowerOnReport && newState == State.Running) { + if (vo.getType() == VirtualMachine.Type.DomainRouter) { + s_logger.info("Schedule a router reboot task as router " + vo.getId() + " is powered-on out-of-band. we need to reboot to refresh network rules"); + _executor.schedule(new RebootTask(vo.getId()), 1000, TimeUnit.MICROSECONDS); + } + } + return true; + } + + protected class RebootTask extends ManagedContextRunnable { + + long _routerId; + + public RebootTask(long routerId) { + _routerId = routerId; + } + + @Override + protected void runInContext() { + try { + s_logger.info("Reboot router " + _routerId + " to refresh network rules"); + rebootRouter(_routerId, true); + } catch (Exception e) { + s_logger.warn("Error while rebooting the router", e); + } + } } } diff --git a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java index 6e4b771073f..f6bd9e1ed42 100644 --- a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java @@ -16,8 +16,10 @@ // under the License. package com.cloud.network.router; + import java.net.URI; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; @@ -36,7 +38,6 @@ import com.cloud.agent.api.Answer; import com.cloud.agent.api.Command; import com.cloud.agent.api.NetworkUsageCommand; import com.cloud.agent.api.PlugNicCommand; -import com.cloud.agent.api.SetupGuestNetworkAnswer; import com.cloud.agent.api.SetupGuestNetworkCommand; import com.cloud.agent.api.routing.IpAssocVpcCommand; import com.cloud.agent.api.routing.NetworkElementCommand; @@ -321,7 +322,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian VirtualRouterProvider vrProvider, long svcOffId, Long vpcId, PublicIp sourceNatIp) throws ConcurrentOperationException, InsufficientAddressCapacityException, InsufficientServerCapacityException, InsufficientCapacityException, StorageUnavailableException, ResourceUnavailableException { - LinkedHashMap networks = createVpcRouterNetworks(owner, isRedundant, plan, new Pair(true, sourceNatIp), vpcId); + LinkedHashMap> networks = createVpcRouterNetworks(owner, isRedundant, plan, new Pair(true, sourceNatIp),vpcId); DomainRouterVO router = super.deployRouter(owner, dest, plan, params, isRedundant, vrProvider, svcOffId, vpcId, networks, true, _vpcMgr.getSupportedVpcHypervisors()); @@ -339,7 +340,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian cmds.addCommand("setupguestnetwork", setupCmd); sendCommandsToRouter(router, cmds); - SetupGuestNetworkAnswer setupAnswer = cmds.getAnswer(SetupGuestNetworkAnswer.class); + Answer setupAnswer = cmds.getAnswer("setupguestnetwork"); String setup = add ? "set" : "destroy"; if (!(setupAnswer != null && setupAnswer.getResult())) { s_logger.warn("Unable to " + setup + " guest network on router " + router); @@ -1153,10 +1154,10 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian } } - protected LinkedHashMap createVpcRouterNetworks(Account owner, boolean isRedundant, DeploymentPlan plan, Pair sourceNatIp, + protected LinkedHashMap> createVpcRouterNetworks(Account owner, boolean isRedundant, DeploymentPlan plan, Pair sourceNatIp, long vpcId) throws ConcurrentOperationException, InsufficientAddressCapacityException { - LinkedHashMap networks = new LinkedHashMap(4); + LinkedHashMap> networks = new LinkedHashMap>(4); TreeSet publicVlans = new TreeSet(); publicVlans.add(sourceNatIp.second().getVlanTag()); @@ -1170,7 +1171,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian for (PrivateGateway privateGateway : privateGateways) { NicProfile privateNic = createPrivateNicProfileForGateway(privateGateway); Network privateNetwork = _networkModel.getNetwork(privateGateway.getNetworkId()); - networks.put(privateNetwork, privateNic); + networks.put(privateNetwork, new ArrayList(Arrays.asList(privateNic))); } } @@ -1179,12 +1180,14 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian for (Network guestNetwork : guestNetworks) { if (guestNetwork.getState() == Network.State.Implemented) { NicProfile guestNic = createGuestNicProfileForVpcRouter(guestNetwork); - networks.put(guestNetwork, guestNic); + networks.put(guestNetwork, new ArrayList(Arrays.asList(guestNic))); } } //4) allocate nic for additional public network(s) List ips = _ipAddressDao.listByAssociatedVpc(vpcId, false); + List publicNics = new ArrayList(); + Network publicNetwork = null; for (IPAddressVO ip : ips) { PublicIp publicIp = PublicIp.createFromAddrAndVlan(ip, _vlanDao.findById(ip.getVlanId())); if ((ip.getState() == IpAddress.State.Allocated || ip.getState() == IpAddress.State.Allocating) && _vpcMgr.isIpAllocatedToVpc(ip) && @@ -1200,11 +1203,23 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian publicNic.setBroadcastUri(BroadcastDomainType.Vlan.toUri(publicIp.getVlanTag())); publicNic.setIsolationUri(IsolationType.Vlan.toUri(publicIp.getVlanTag())); NetworkOffering publicOffering = _networkModel.getSystemAccountNetworkOfferings(NetworkOffering.SystemPublicNetwork).get(0); - List publicNetworks = _networkMgr.setupNetwork(_systemAcct, publicOffering, plan, null, null, false); - networks.put(publicNetworks.get(0), publicNic); + if (publicNetwork == null) { + List publicNetworks = _networkMgr.setupNetwork(_systemAcct, publicOffering, plan, null, null, false); + publicNetwork = publicNetworks.get(0); + } + publicNics.add(publicNic); publicVlans.add(publicIp.getVlanTag()); } } + if (publicNetwork != null) { + if (networks.get(publicNetwork) != null) { + List publicNicProfiles = (List)networks.get(publicNetwork); + publicNicProfiles.addAll(publicNics); + networks.put(publicNetwork, publicNicProfiles); + } else { + networks.put(publicNetwork, publicNics); + } + } return networks; } diff --git a/server/src/com/cloud/network/rules/RulesManagerImpl.java b/server/src/com/cloud/network/rules/RulesManagerImpl.java index 4a75d40f321..9a76219f00a 100755 --- a/server/src/com/cloud/network/rules/RulesManagerImpl.java +++ b/server/src/com/cloud/network/rules/RulesManagerImpl.java @@ -201,7 +201,7 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules @Override @DB @ActionEvent(eventType = EventTypes.EVENT_NET_RULE_ADD, eventDescription = "creating forwarding rule", create = true) - public PortForwardingRule createPortForwardingRule(final PortForwardingRule rule, final Long vmId, Ip vmIp, final boolean openFirewall) + public PortForwardingRule createPortForwardingRule(final PortForwardingRule rule, final Long vmId, Ip vmIp, final boolean openFirewall, final Boolean forDisplay) throws NetworkRuleConflictException { CallContext ctx = CallContext.current(); final Account caller = ctx.getCallingAccount(); @@ -316,6 +316,10 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules PortForwardingRuleVO newRule = new PortForwardingRuleVO(rule.getXid(), rule.getSourceIpAddressId(), rule.getSourcePortStart(), rule.getSourcePortEnd(), dstIpFinal, rule.getDestinationPortStart(), rule.getDestinationPortEnd(), rule.getProtocol().toLowerCase(), networkId, accountId, domainId, vmId); + + if (forDisplay != null) { + newRule.setDisplay(forDisplay); + } newRule = _portForwardingDao.persist(newRule); // create firewallRule for 0.0.0.0/0 cidr @@ -775,6 +779,7 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules Long id = cmd.getId(); Map tags = cmd.getTags(); Long networkId = cmd.getNetworkId(); + Boolean display = cmd.getDisplay(); Account caller = CallContext.current().getCallingAccount(); List permittedDomains = new ArrayList(); @@ -803,6 +808,7 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules sb.and("ip", sb.entity().getSourceIpAddressId(), Op.EQ); sb.and("purpose", sb.entity().getPurpose(), Op.EQ); sb.and("networkId", sb.entity().getNetworkId(), Op.EQ); + sb.and("display", sb.entity().isDisplay(), Op.EQ); if (tags != null && !tags.isEmpty()) { SearchBuilder tagSearch = _resourceTagDao.createSearchBuilder(); @@ -823,6 +829,10 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules sc.setParameters("id", id); } + if (display != null) { + sc.setParameters("display", display); + } + if (tags != null && !tags.isEmpty()) { int count = 0; sc.setJoinParameters("tagSearch", "resourceType", ResourceObjectType.PortForwardingRule.toString()); @@ -1489,7 +1499,7 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules @Override @ActionEvent(eventType = EventTypes.EVENT_NET_RULE_MODIFY, eventDescription = "updating forwarding rule", async = true) - public PortForwardingRule updatePortForwardingRule(long id, String customId) { + public PortForwardingRule updatePortForwardingRule(long id, String customId, Boolean forDisplay) { Account caller = CallContext.current().getCallingAccount(); PortForwardingRuleVO rule = _portForwardingDao.findById(id); if (rule == null) { @@ -1500,6 +1510,11 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules if (customId != null) { rule.setUuid(customId); } + + if (forDisplay != null) { + rule.setDisplay(forDisplay); + } + _portForwardingDao.update(id, rule); return _portForwardingDao.findById(id); } diff --git a/server/src/com/cloud/network/vpc/NetworkACLManagerImpl.java b/server/src/com/cloud/network/vpc/NetworkACLManagerImpl.java index 82360f5789e..82f1216d7fb 100644 --- a/server/src/com/cloud/network/vpc/NetworkACLManagerImpl.java +++ b/server/src/com/cloud/network/vpc/NetworkACLManagerImpl.java @@ -84,8 +84,11 @@ public class NetworkACLManagerImpl extends ManagerBase implements NetworkACLMana VpcService _vpcSvc; @Override - public NetworkACL createNetworkACL(String name, String description, long vpcId) { + public NetworkACL createNetworkACL(String name, String description, long vpcId, Boolean forDisplay) { NetworkACLVO acl = new NetworkACLVO(name, description, vpcId); + if (forDisplay != null) { + acl.setDisplay(forDisplay); + } return _networkACLDao.persist(acl); } @@ -215,8 +218,8 @@ public class NetworkACLManagerImpl extends ManagerBase implements NetworkACLMana @Override @DB @ActionEvent(eventType = EventTypes.EVENT_NETWORK_ACL_ITEM_CREATE, eventDescription = "creating network ACL Item", create = true) - public NetworkACLItem createNetworkACLItem(final Integer portStart, final Integer portEnd, final String protocol, final List sourceCidrList, - final Integer icmpCode, final Integer icmpType, final NetworkACLItem.TrafficType trafficType, final Long aclId, final String action, Integer number) { + public NetworkACLItem createNetworkACLItem(final Integer portStart, final Integer portEnd, final String protocol, final List sourceCidrList, final Integer icmpCode, + final Integer icmpType, final NetworkACLItem.TrafficType trafficType, final Long aclId, final String action, Integer number, final Boolean forDisplay) { // If number is null, set it to currentMax + 1 (for backward compatibility) if (number == null) { number = _networkACLItemDao.getMaxNumberByACL(aclId) + 1; @@ -233,6 +236,11 @@ public class NetworkACLManagerImpl extends ManagerBase implements NetworkACLMana NetworkACLItemVO newRule = new NetworkACLItemVO(portStart, portEnd, protocol.toLowerCase(), aclId, sourceCidrList, icmpCode, icmpType, trafficType, ruleAction, numberFinal); + + if (forDisplay != null) { + newRule.setDisplay(forDisplay); + } + newRule = _networkACLItemDao.persist(newRule); if (!_networkACLItemDao.setStateToAdd(newRule)) { @@ -398,7 +406,7 @@ public class NetworkACLManagerImpl extends ManagerBase implements NetworkACLMana @Override public NetworkACLItem updateNetworkACLItem(Long id, String protocol, List sourceCidrList, NetworkACLItem.TrafficType trafficType, String action, - Integer number, Integer sourcePortStart, Integer sourcePortEnd, Integer icmpCode, Integer icmpType, String customId) throws ResourceUnavailableException { + Integer number, Integer sourcePortStart, Integer sourcePortEnd, Integer icmpCode, Integer icmpType, String customId, Boolean forDisplay) throws ResourceUnavailableException { NetworkACLItemVO aclItem = _networkACLItemDao.findById(id); aclItem.setState(State.Add); @@ -446,6 +454,10 @@ public class NetworkACLManagerImpl extends ManagerBase implements NetworkACLMana aclItem.setUuid(customId); } + if (forDisplay != null) { + aclItem.setDisplay(forDisplay); + } + if (_networkACLItemDao.update(id, aclItem)) { if (applyNetworkACL(aclItem.getAclId())) { return aclItem; diff --git a/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java b/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java index ef3bba9ef31..e024fbe3d38 100644 --- a/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java +++ b/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java @@ -97,14 +97,14 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ VpcService _vpcSvc; @Override - public NetworkACL createNetworkACL(String name, String description, long vpcId) { + public NetworkACL createNetworkACL(String name, String description, long vpcId, Boolean forDisplay) { Account caller = CallContext.current().getCallingAccount(); Vpc vpc = _entityMgr.findById(Vpc.class, vpcId); if (vpc == null) { throw new InvalidParameterValueException("Unable to find VPC"); } _accountMgr.checkAccess(caller, null, true, vpc); - return _networkAclMgr.createNetworkACL(name, description, vpcId); + return _networkAclMgr.createNetworkACL(name, description, vpcId, forDisplay); } @Override @@ -119,10 +119,13 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ Long networkId = cmd.getNetworkId(); Long vpcId = cmd.getVpcId(); String keyword = cmd.getKeyword(); + Boolean display = cmd.getDisplay(); + SearchBuilder sb = _networkACLDao.createSearchBuilder(); sb.and("id", sb.entity().getId(), Op.EQ); sb.and("name", sb.entity().getName(), Op.EQ); sb.and("vpcId", sb.entity().getVpcId(), Op.IN); + sb.and("display", sb.entity().isDisplay(), Op.EQ); Account caller = CallContext.current().getCallingAccount(); @@ -141,6 +144,10 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ sc.addAnd("name", SearchCriteria.Op.SC, ssc); } + if (display != null) { + sc.setParameters("display", display); + } + if(id != null){ sc.setParameters("id", id); } @@ -333,7 +340,7 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ //Create new ACL String aclName = "VPC_" + vpc.getName() + "_Tier_" + network.getName() + "_ACL_" + network.getUuid(); String description = "ACL for " + aclName; - NetworkACL acl = _networkAclMgr.createNetworkACL(aclName, description, network.getVpcId()); + NetworkACL acl = _networkAclMgr.createNetworkACL(aclName, description, network.getVpcId(), aclItemCmd.getDisplay()); if (acl == null) { throw new CloudRuntimeException("Error while create ACL before adding ACL Item for network " + network.getId()); } @@ -378,7 +385,7 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ return _networkAclMgr.createNetworkACLItem(aclItemCmd.getSourcePortStart(), aclItemCmd.getSourcePortEnd(), aclItemCmd.getProtocol(), aclItemCmd.getSourceCidrList(), aclItemCmd.getIcmpCode(), aclItemCmd.getIcmpType(), aclItemCmd.getTrafficType(), aclId, aclItemCmd.getAction(), - aclItemCmd.getNumber()); + aclItemCmd.getNumber(), aclItemCmd.getDisplay()); } private void validateNetworkACLItem(Integer portStart, Integer portEnd, List sourceCidrList, String protocol, Integer icmpCode, Integer icmpType, @@ -481,6 +488,7 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ String action = cmd.getAction(); Map tags = cmd.getTags(); Account caller = CallContext.current().getCallingAccount(); + Boolean display = cmd.getDisplay(); Filter filter = new Filter(NetworkACLItemVO.class, "id", false, cmd.getStartIndex(), cmd.getPageSizeVal()); SearchBuilder sb = _networkACLItemDao.createSearchBuilder(); @@ -490,6 +498,7 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ sb.and("trafficType", sb.entity().getTrafficType(), Op.EQ); sb.and("protocol", sb.entity().getProtocol(), Op.EQ); sb.and("action", sb.entity().getAction(), Op.EQ); + sb.and("display", sb.entity().isDisplay(), Op.EQ); if (tags != null && !tags.isEmpty()) { SearchBuilder tagSearch = _resourceTagDao.createSearchBuilder(); @@ -512,6 +521,10 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ SearchCriteria sc = sb.create(); + if (display != null) { + sc.setParameters("display", display); + } + if (id != null) { sc.setParameters("id", id); } @@ -613,7 +626,7 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ @Override public NetworkACLItem updateNetworkACLItem(Long id, String protocol, List sourceCidrList, NetworkACLItem.TrafficType trafficType, String action, - Integer number, Integer sourcePortStart, Integer sourcePortEnd, Integer icmpCode, Integer icmpType, String newUUID) throws ResourceUnavailableException { + Integer number, Integer sourcePortStart, Integer sourcePortEnd, Integer icmpCode, Integer icmpType, String newUUID, Boolean forDisplay) throws ResourceUnavailableException { NetworkACLItemVO aclItem = _networkACLItemDao.findById(id); if (aclItem == null) { throw new InvalidParameterValueException("Unable to find ACL Item cannot be found"); @@ -642,12 +655,12 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ validateNetworkACLItem((sourcePortStart == null) ? aclItem.getSourcePortStart() : sourcePortStart, (sourcePortEnd == null) ? aclItem.getSourcePortEnd() : sourcePortEnd, sourceCidrList, protocol, icmpCode, (icmpType == null) ? aclItem.getIcmpType() : icmpType, action, number); - return _networkAclMgr.updateNetworkACLItem(id, protocol, sourceCidrList, trafficType, action, number, sourcePortStart, sourcePortEnd, icmpCode, icmpType, newUUID); + return _networkAclMgr.updateNetworkACLItem(id, protocol, sourceCidrList, trafficType, action, number, sourcePortStart, sourcePortEnd, icmpCode, icmpType, newUUID, forDisplay); } @Override @ActionEvent(eventType = EventTypes.EVENT_NETWORK_ACL_UPDATE, eventDescription = "updating network acl", async = true) - public NetworkACL updateNetworkACL(Long id, String customId) { + public NetworkACL updateNetworkACL(Long id, String customId, Boolean forDisplay) { NetworkACLVO acl = _networkACLDao.findById(id); Vpc vpc = _entityMgr.findById(Vpc.class, acl.getVpcId()); Account caller = CallContext.current().getCallingAccount(); @@ -657,6 +670,10 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ acl.setUuid(customId); } + if (forDisplay != null) { + acl.setDisplay(forDisplay); + } + _networkACLDao.update(id, acl); return _networkACLDao.findById(id); } diff --git a/server/src/com/cloud/network/vpc/VpcManagerImpl.java b/server/src/com/cloud/network/vpc/VpcManagerImpl.java index 39fb19ed64e..08381e273e3 100644 --- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java +++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java @@ -584,7 +584,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis @Override @ActionEvent(eventType = EventTypes.EVENT_VPC_CREATE, eventDescription = "creating vpc", create = true) - public Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName, String displayText, String cidr, String networkDomain) + public Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName, String displayText, String cidr, String networkDomain, Boolean displayVpc) throws ResourceAllocationException { Account caller = CallContext.current().getCallingAccount(); Account owner = _accountMgr.getAccount(vpcOwnerId); @@ -630,12 +630,12 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis } } - return createVpc(zoneId, vpcOffId, owner, vpcName, displayText, cidr, networkDomain); + return createVpc(zoneId, vpcOffId, owner, vpcName, displayText, cidr, networkDomain, displayVpc); } @DB protected Vpc createVpc(final long zoneId, final long vpcOffId, final Account vpcOwner, final String vpcName, final String displayText, final String cidr, - final String networkDomain) { + final String networkDomain, final Boolean displayVpc) { //Validate CIDR if (!NetUtils.isValidCIDR(cidr)) { @@ -658,6 +658,9 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis @Override public VpcVO doInTransaction(TransactionStatus status) { VpcVO vpc = new VpcVO(zoneId, vpcName, displayText, vpcOwner.getId(), vpcOwner.getDomainId(), vpcOffId, cidr, networkDomain); + if (displayVpc != null) { + vpc.setDisplay(displayVpc); + } vpc = _vpcDao.persist(vpc, finalizeServicesAndProvidersForVpc(zoneId, vpcOffId)); _resourceLimitMgr.incrementResourceCount(vpcOwner.getId(), ResourceType.vpc); @@ -769,7 +772,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis @Override @ActionEvent(eventType = EventTypes.EVENT_VPC_UPDATE, eventDescription = "updating vpc") - public Vpc updateVpc(long vpcId, String vpcName, String displayText, String customId) { + public Vpc updateVpc(long vpcId, String vpcName, String displayText, String customId, Boolean displayVpc) { CallContext.current().setEventDetails(" Id: " + vpcId); Account caller = CallContext.current().getCallingAccount(); @@ -795,6 +798,10 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis vpc.setUuid(customId); } + if (displayVpc != null) { + vpc.setDisplay(displayVpc); + } + if (_vpcDao.update(vpcId, vpc)) { s_logger.debug("Updated VPC id=" + vpcId); return _vpcDao.findById(vpcId); @@ -806,7 +813,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis @Override public List listVpcs(Long id, String vpcName, String displayText, List supportedServicesStr, String cidr, Long vpcOffId, String state, String accountName, Long domainId, String keyword, Long startIndex, Long pageSizeVal, Long zoneId, Boolean isRecursive, Boolean listAll, Boolean restartRequired, - Map tags, Long projectId) { + Map tags, Long projectId, Boolean display) { Account caller = CallContext.current().getCallingAccount(); List permittedDomains = new ArrayList(); List permittedAccounts = new ArrayList(); @@ -831,6 +838,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis sb.and("state", sb.entity().getState(), SearchCriteria.Op.EQ); sb.and("restartRequired", sb.entity().isRestartRequired(), SearchCriteria.Op.EQ); sb.and("cidr", sb.entity().getCidr(), SearchCriteria.Op.EQ); + sb.and("display", sb.entity().isDisplay(), SearchCriteria.Op.EQ); if (tags != null && !tags.isEmpty()) { SearchBuilder tagSearch = _resourceTagDao.createSearchBuilder(); @@ -873,6 +881,10 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis } } + if (display != null) { + sc.setParameters("display", display); + } + if (id != null) { sc.addAnd("id", SearchCriteria.Op.EQ, id); } @@ -1412,7 +1424,8 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis Long nextMac = mac + 1; dc.setMacAddress(nextMac); - privateIp = new PrivateIpVO(ipAddress, privateNtwk.getId(), nextMac, vpcId, true); + s_logger.info("creating private ip adress for vpc (" + ipAddress + ", " + privateNtwk.getId() + ", " + nextMac + ", " + vpcId + ", " + isSourceNat + ")"); + privateIp = new PrivateIpVO(ipAddress, privateNtwk.getId(), nextMac, vpcId, isSourceNat); _privateIpDao.persist(privateIp); _dcDao.update(dc.getId(), dc); @@ -2026,6 +2039,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis //update ip address with networkId ip.setVpcId(vpcId); ip.setSourceNat(isSourceNatFinal); + _ipAddressDao.update(ipId, ip); //mark ip as allocated diff --git a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java index a8505a743b6..531adad3520 100755 --- a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java +++ b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java @@ -138,7 +138,7 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements RemoteAcc @Override @DB - public RemoteAccessVpn createRemoteAccessVpn(final long publicIpId, String ipRange, boolean openFirewall) throws NetworkRuleConflictException { + public RemoteAccessVpn createRemoteAccessVpn(final long publicIpId, String ipRange, boolean openFirewall, final Boolean forDisplay) throws NetworkRuleConflictException { CallContext ctx = CallContext.current(); final Account caller = ctx.getCallingAccount(); @@ -248,6 +248,10 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements RemoteAcc RemoteAccessVpnVO vpnVO = new RemoteAccessVpnVO(ipAddr.getAccountId(), ipAddr.getDomainId(), ipAddr.getAssociatedWithNetworkId(), publicIpId, vpcId, range[0], newIpRange, sharedSecret); + + if (forDisplay != null) { + vpnVO.setDisplay(forDisplay); + } return _remoteAccessVpnDao.persist(vpnVO); } }); @@ -650,6 +654,7 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements RemoteAcc sb.and("id", sb.entity().getId(), Op.EQ); sb.and("networkId", sb.entity().getNetworkId(), Op.EQ); sb.and("state", sb.entity().getState(), Op.EQ); + sb.and("display", sb.entity().isDisplay(), Op.EQ); SearchCriteria sc = sb.create(); _accountMgr.buildACLSearchCriteria(sc, isRecursive, permittedDomains, permittedAccounts, permittedResources, listProjectResourcesCriteria); @@ -736,7 +741,7 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements RemoteAcc @Override @ActionEvent(eventType = EventTypes.EVENT_REMOTE_ACCESS_VPN_UPDATE, eventDescription = "updating remote access vpn", async = true) - public RemoteAccessVpn updateRemoteAccessVpn(long id, String customId) { + public RemoteAccessVpn updateRemoteAccessVpn(long id, String customId, Boolean forDisplay) { final RemoteAccessVpnVO vpn = _remoteAccessVpnDao.findById(id); if (vpn == null) { throw new InvalidParameterValueException("Can't find remote access vpn by id " + id); @@ -746,6 +751,9 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements RemoteAcc if (customId != null) { vpn.setUuid(customId); } + if (forDisplay != null) { + vpn.setDisplay(forDisplay); + } _remoteAccessVpnDao.update(vpn.getId(), vpn); return _remoteAccessVpnDao.findById(id); diff --git a/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java b/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java index 03a13c3373d..fdb5bbf1247 100644 --- a/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java +++ b/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java @@ -142,6 +142,11 @@ public class Site2SiteVpnManagerImpl extends ManagerBase implements Site2SiteVpn } Site2SiteVpnGatewayVO gw = new Site2SiteVpnGatewayVO(owner.getAccountId(), owner.getDomainId(), ips.get(0).getId(), vpcId); + + if (cmd.getDisplay() != null) { + gw.setDisplay(cmd.getDisplay()); + } + _vpnGatewayDao.persist(gw); return gw; } @@ -299,6 +304,10 @@ public class Site2SiteVpnManagerImpl extends ManagerBase implements Site2SiteVpn Site2SiteVpnConnectionVO conn = new Site2SiteVpnConnectionVO(owner.getAccountId(), owner.getDomainId(), vpnGatewayId, customerGatewayId, cmd.isPassive()); conn.setState(State.Pending); + if (cmd.getDisplay() != null) { + conn.setDisplay(cmd.getDisplay()); + } + _vpnConnectionDao.persist(conn); return conn; } @@ -605,6 +614,7 @@ public class Site2SiteVpnManagerImpl extends ManagerBase implements Site2SiteVpn public Pair, Integer> searchForVpnGateways(ListVpnGatewaysCmd cmd) { Long id = cmd.getId(); Long vpcId = cmd.getVpcId(); + Boolean display = cmd.getDisplay(); Long domainId = cmd.getDomainId(); boolean isRecursive = cmd.isRecursive(); @@ -632,6 +642,7 @@ public class Site2SiteVpnManagerImpl extends ManagerBase implements Site2SiteVpn sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ); sb.and("vpcId", sb.entity().getVpcId(), SearchCriteria.Op.EQ); + sb.and("display", sb.entity().isDisplay(), SearchCriteria.Op.EQ); SearchCriteria sc = sb.create(); _accountMgr.buildACLSearchCriteria(sc, isRecursive, permittedDomains, permittedAccounts, permittedResources, listProjectResourcesCriteria); @@ -640,6 +651,10 @@ public class Site2SiteVpnManagerImpl extends ManagerBase implements Site2SiteVpn sc.addAnd("id", SearchCriteria.Op.EQ, id); } + if (display != null) { + sc.setParameters("display", display); + } + if (vpcId != null) { sc.addAnd("vpcId", SearchCriteria.Op.EQ, vpcId); } @@ -652,6 +667,7 @@ public class Site2SiteVpnManagerImpl extends ManagerBase implements Site2SiteVpn public Pair, Integer> searchForVpnConnections(ListVpnConnectionsCmd cmd) { Long id = cmd.getId(); Long vpcId = cmd.getVpcId(); + Boolean display = cmd.getDisplay(); Long domainId = cmd.getDomainId(); boolean isRecursive = cmd.isRecursive(); @@ -678,6 +694,7 @@ public class Site2SiteVpnManagerImpl extends ManagerBase implements Site2SiteVpn _accountMgr.buildACLSearchBuilder(sb, isRecursive, permittedDomains, permittedAccounts, permittedResources, listProjectResourcesCriteria); sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ); + sb.and("display", sb.entity().isDisplay(), SearchCriteria.Op.EQ); if (vpcId != null) { SearchBuilder gwSearch = _vpnGatewayDao.createSearchBuilder(); @@ -688,6 +705,9 @@ public class Site2SiteVpnManagerImpl extends ManagerBase implements Site2SiteVpn SearchCriteria sc = sb.create(); _accountMgr.buildACLSearchCriteria(sc, isRecursive, permittedDomains, permittedAccounts, permittedResources, listProjectResourcesCriteria); + if (display != null) { + sc.setParameters("display", display); + } if (id != null) { sc.addAnd("id", SearchCriteria.Op.EQ, id); } @@ -794,7 +814,7 @@ public class Site2SiteVpnManagerImpl extends ManagerBase implements Site2SiteVpn @Override @ActionEvent(eventType = EventTypes.EVENT_S2S_VPN_CONNECTION_UPDATE, eventDescription = "creating s2s vpn gateway", async = true) - public Site2SiteVpnConnection updateVpnConnection(long id, String customId) { + public Site2SiteVpnConnection updateVpnConnection(long id, String customId, Boolean forDisplay) { Account caller = CallContext.current().getCallingAccount(); Site2SiteVpnConnectionVO conn = _vpnConnectionDao.findById(id); if (conn == null) { @@ -806,13 +826,17 @@ public class Site2SiteVpnManagerImpl extends ManagerBase implements Site2SiteVpn conn.setUuid(customId); } + if (forDisplay != null) { + conn.setDisplay(forDisplay); + } + _vpnConnectionDao.update(id, conn); return _vpnConnectionDao.findById(id); } @Override @ActionEvent(eventType = EventTypes.EVENT_S2S_VPN_GATEWAY_UPDATE, eventDescription = "updating s2s vpn gateway", async = true) - public Site2SiteVpnGateway updateVpnGateway(Long id, String customId) { + public Site2SiteVpnGateway updateVpnGateway(Long id, String customId, Boolean forDisplay) { Account caller = CallContext.current().getCallingAccount(); Site2SiteVpnGatewayVO vpnGateway = _vpnGatewayDao.findById(id); @@ -824,6 +848,11 @@ public class Site2SiteVpnManagerImpl extends ManagerBase implements Site2SiteVpn if (customId != null) { vpnGateway.setUuid(customId); } + + if (forDisplay != null) { + vpnGateway.setDisplay(forDisplay); + } + _vpnGatewayDao.update(id, vpnGateway); return _vpnGatewayDao.findById(id); diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java index 1f91bc93a61..689a0d75849 100755 --- a/server/src/com/cloud/resource/ResourceManagerImpl.java +++ b/server/src/com/cloud/resource/ResourceManagerImpl.java @@ -50,6 +50,7 @@ import org.apache.cloudstack.framework.config.dao.ConfigurationDao; import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; import org.apache.cloudstack.utils.identity.ManagementServerNode; +import org.apache.commons.lang.ObjectUtils; import com.cloud.agent.AgentManager; import com.cloud.agent.api.Answer; @@ -1892,7 +1893,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager, // If the server's private IP is the same as is public IP, this host has // a host-only private network. Don't check for conflicts with the // private IP address table. - if (serverPrivateIP != serverPublicIP) { + if (!ObjectUtils.equals(serverPrivateIP, serverPublicIP)) { if (!_privateIPAddressDao.mark(dc.getId(), pod.getId(), serverPrivateIP)) { // If the server's private IP address is already in the // database, return false diff --git a/server/src/com/cloud/server/Criteria.java b/server/src/com/cloud/server/Criteria.java index 6ff8a2811ff..02bafa7b56f 100755 --- a/server/src/com/cloud/server/Criteria.java +++ b/server/src/com/cloud/server/Criteria.java @@ -84,6 +84,8 @@ public class Criteria { public static final String ISO_ID = "isoid"; public static final String VPC_ID = "vpcId"; public static final String AFFINITY_GROUP_ID = "affinitygroupid"; + public static final String SERVICE_OFFERING_ID = "serviceofferingid"; + public static final String DISPLAY = "display"; public Criteria(String orderBy, Boolean ascending, Long offset, Long limit) { this.offset = offset; diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index 350dfc7fa12..c6d4e02f33c 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -1902,6 +1902,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe Boolean sourceNat = cmd.getIsSourceNat(); Boolean staticNat = cmd.getIsStaticNat(); Long vpcId = cmd.getVpcId(); + Boolean forDisplay = cmd.getDisplay(); Map tags = cmd.getTags(); Boolean isAllocated = cmd.isAllocatedOnly(); @@ -1940,6 +1941,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe sb.and("isSourceNat", sb.entity().isSourceNat(), SearchCriteria.Op.EQ); sb.and("isStaticNat", sb.entity().isOneToOneNat(), SearchCriteria.Op.EQ); sb.and("vpcId", sb.entity().getVpcId(), SearchCriteria.Op.EQ); + sb.and("display", sb.entity().isDisplay(), SearchCriteria.Op.EQ); if (forLoadBalancing != null && forLoadBalancing) { SearchBuilder lbSearch = _loadbalancerDao.createSearchBuilder(); @@ -2037,6 +2039,10 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe sc.setParameters("associatedNetworkIdEq", associatedNetworkId); } + if (forDisplay != null) { + sc.setParameters("display", forDisplay); + } + Pair, Integer> result = _publicIpAddressDao.searchAndCount(sc, searchFilter); return new Pair, Integer>(result.first(), result.second()); } @@ -3297,13 +3303,13 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe } @Override - public Long saveStartedEvent(Long userId, Long accountId, String type, String description, long startEventId) { - return ActionEventUtils.onStartedActionEvent(userId, accountId, type, description, startEventId); + public Long saveStartedEvent(Long userId, Long accountId, String type, String description, boolean displayResourceEnabled, Long startEventId) { + return ActionEventUtils.onStartedActionEvent(userId, accountId, type, description, displayResourceEnabled, startEventId); } @Override - public Long saveCompletedEvent(Long userId, Long accountId, String level, String type, String description, long startEventId) { - return ActionEventUtils.onCompletedActionEvent(userId, accountId, level, type, description, startEventId); + public Long saveCompletedEvent(Long userId, Long accountId, String level, String type, String description, boolean displayResourceEnabled, long startEventId) { + return ActionEventUtils.onCompletedActionEvent(userId, accountId, level, type, displayResourceEnabled, description, startEventId); } @Override diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/com/cloud/storage/VolumeApiServiceImpl.java index ad8a4ba3c76..3ef8e135d84 100644 --- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java +++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java @@ -222,7 +222,8 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic VmWorkJobHandlerProxy _jobHandlerProxy = new VmWorkJobHandlerProxy(this); // TODO - static final ConfigKey VmJobEnabled = new ConfigKey("Advanced", Boolean.class, "vm.job.enabled", "false", + static final ConfigKey VmJobEnabled = new ConfigKey("Advanced", + Boolean.class, "vm.job.enabled", "true", "True to enable new VM sync model. false to use the old way", false); static final ConfigKey VmJobCheckInterval = new ConfigKey("Advanced", Long.class, "vm.job.check.interval", "3000", "Interval in milliseconds to check if the job is complete", false); @@ -373,13 +374,13 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic Account caller = CallContext.current().getCallingAccount(); long ownerId = cmd.getEntityOwnerId(); - Boolean displayVolumeEnabled = cmd.getDisplayVolume(); + Boolean displayVolume = cmd.getDisplayVolume(); // permission check _accountMgr.checkAccess(caller, null, true, _accountMgr.getActiveAccountById(ownerId)); - if (displayVolumeEnabled == null) { - displayVolumeEnabled = true; + if (displayVolume == null) { + displayVolume = true; } else { if (!_accountMgr.isRootAdmin(caller.getType())) { throw new PermissionDeniedException("Cannot update parameter displayvolume, only admin permitted "); @@ -387,7 +388,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic } // Check that the resource limit for volumes won't be exceeded - _resourceLimitMgr.checkResourceLimit(_accountMgr.getAccount(ownerId), ResourceType.volume, displayVolumeEnabled); + _resourceLimitMgr.checkResourceLimit(_accountMgr.getAccount(ownerId), ResourceType.volume, displayVolume); Long zoneId = cmd.getZoneId(); Long diskOfferingId = null; @@ -528,7 +529,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic } // Check that the resource limit for primary storage won't be exceeded - _resourceLimitMgr.checkResourceLimit(_accountMgr.getAccount(ownerId), ResourceType.primary_storage, displayVolumeEnabled, new Long(size)); + _resourceLimitMgr.checkResourceLimit(_accountMgr.getAccount(ownerId), ResourceType.primary_storage, displayVolume, new Long(size)); // Verify that zone exists DataCenterVO zone = _dcDao.findById(zoneId); @@ -552,13 +553,13 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic userSpecifiedName = getRandomVolumeName(); } - VolumeVO volume = commitVolume(cmd, caller, ownerId, displayVolumeEnabled, zoneId, diskOfferingId, size, minIops, maxIops, parentVolume, userSpecifiedName, + VolumeVO volume = commitVolume(cmd, caller, ownerId, displayVolume, zoneId, diskOfferingId, size, minIops, maxIops, parentVolume, userSpecifiedName, _uuidMgr.generateUuid(Volume.class, cmd.getCustomId())); return volume; } - private VolumeVO commitVolume(final CreateVolumeCmd cmd, final Account caller, final long ownerId, final Boolean displayVolumeEnabled, final Long zoneId, + private VolumeVO commitVolume(final CreateVolumeCmd cmd, final Account caller, final long ownerId, final Boolean displayVolume, final Long zoneId, final Long diskOfferingId, final Long size, final Long minIops, final Long maxIops, final VolumeVO parentVolume, final String userSpecifiedName, final String uuid) { return Transaction.execute(new TransactionCallback() { @Override @@ -577,7 +578,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic volume.setInstanceId(null); volume.setUpdated(new Date()); volume.setDomainId((caller == null) ? Domain.ROOT_DOMAIN : caller.getDomainId()); - volume.setDisplayVolume(displayVolumeEnabled); + volume.setDisplayVolume(displayVolume); if (parentVolume != null) { volume.setTemplateId(parentVolume.getTemplateId()); volume.setFormat(parentVolume.getFormat()); @@ -596,8 +597,8 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic // Increment resource count during allocation; if actual creation fails, // decrement it - _resourceLimitMgr.incrementResourceCount(volume.getAccountId(), ResourceType.volume, displayVolumeEnabled); - _resourceLimitMgr.incrementResourceCount(volume.getAccountId(), ResourceType.primary_storage, displayVolumeEnabled, new Long(volume.getSize())); + _resourceLimitMgr.incrementResourceCount(volume.getAccountId(), ResourceType.volume, displayVolume); + _resourceLimitMgr.incrementResourceCount(volume.getAccountId(), ResourceType.primary_storage, displayVolume, new Long(volume.getSize())); return volume; } }); @@ -824,7 +825,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic Volume vol = null; try { - vol = outcome.get(); + outcome.get(); } catch (InterruptedException e) { throw new RuntimeException("Operation is interrupted", e); } catch (java.util.concurrent.ExecutionException e) { @@ -837,6 +838,9 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic throw (ConcurrentOperationException)jobResult; else if (jobResult instanceof Throwable) throw new RuntimeException("Unexpected exception", (Throwable)jobResult); + else if (jobResult instanceof Long) { + vol = _volumeDao.findById((Long)jobResult); + } } return volume; } @@ -1024,7 +1028,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic Volume vol = null; try { - vol = outcome.get(); + outcome.get(); } catch (InterruptedException e) { throw new RuntimeException("Operation is interrupted", e); } catch (java.util.concurrent.ExecutionException e) { @@ -1037,6 +1041,9 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic throw (ConcurrentOperationException)jobResult; else if (jobResult instanceof Throwable) throw new RuntimeException("Unexpected exception", (Throwable)jobResult); + else if (jobResult instanceof Long) { + vol = _volumeDao.findById((Long)jobResult); + } } return vol; } @@ -1205,7 +1212,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic @Override @ActionEvent(eventType = EventTypes.EVENT_VOLUME_UPDATE, eventDescription = "updating volume", async = true) - public Volume updateVolume(long volumeId, String path, String state, Long storageId, Boolean displayVolume, String customId, long entityOwnerId) { + public Volume updateVolume(long volumeId, String path, String state, Long storageId, Boolean displayVolume, String customId, long entityOwnerId, String chainInfo) { VolumeVO volume = _volumeDao.findById(volumeId); @@ -1217,6 +1224,10 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic volume.setDisplayVolume(displayVolume); } + if(chainInfo != null){ + volume.setChainInfo(chainInfo); + } + if (state != null) { try { Volume.State volumeState = Volume.State.valueOf(state); @@ -1335,7 +1346,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic Volume vol = null; try { - vol = outcome.get(); + outcome.get(); } catch (InterruptedException e) { throw new RuntimeException("Operation is interrupted", e); } catch (java.util.concurrent.ExecutionException e) { @@ -1348,6 +1359,9 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic throw (ConcurrentOperationException)jobResult; else if (jobResult instanceof Throwable) throw new RuntimeException("Unexpected exception", (Throwable)jobResult); + else if (jobResult instanceof Long) { + vol = _volumeDao.findById((Long)jobResult); + } } return vol; } @@ -2124,7 +2138,8 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic public Object[] doInTransaction(TransactionStatus status) { VmWorkJobVO workJob = null; - _vmInstanceDao.lockRow(vm.getId(), true); + _vmInstanceDao.lockInLockTable(String.valueOf(vm.getId()), Integer.MAX_VALUE); + try { workJob = new VmWorkJobVO(context.getContextId()); workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); @@ -2135,11 +2150,11 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic workJob.setStep(VmWorkJobVO.Step.Starting); workJob.setVmType(VirtualMachine.Type.Instance); workJob.setVmInstanceId(vm.getId()); - workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); + workJob.setRelated(AsyncJobExecutionContext.getOriginJobId()); // save work context info (there are some duplications) - VmWorkAttachVolume workInfo = new VmWorkAttachVolume(callingUser.getId(), callingAccount.getId(), vm.getId(), VolumeApiServiceImpl.VM_WORK_JOB_HANDLER, volumeId, - deviceId); + VmWorkAttachVolume workInfo = new VmWorkAttachVolume(callingUser.getId(), callingAccount.getId(), vm.getId(), + VolumeApiServiceImpl.VM_WORK_JOB_HANDLER, volumeId, deviceId); workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); @@ -2148,6 +2163,9 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic s_logger.debug("New job " + workJob.getId() + ", result field: " + jobVo.getResult()); return new Object[] {workJob, new Long(workJob.getId())}; + } finally { + _vmInstanceDao.unlockFromLockTable(String.valueOf(vm.getId())); + } } }); @@ -2171,7 +2189,8 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic public Object[] doInTransaction(TransactionStatus status) { VmWorkJobVO workJob = null; - _vmInstanceDao.lockRow(vm.getId(), true); + _vmInstanceDao.lockInLockTable(String.valueOf(vm.getId()), Integer.MAX_VALUE); + try { workJob = new VmWorkJobVO(context.getContextId()); workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); @@ -2182,15 +2201,19 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic workJob.setStep(VmWorkJobVO.Step.Starting); workJob.setVmType(VirtualMachine.Type.Instance); workJob.setVmInstanceId(vm.getId()); - workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); + workJob.setRelated(AsyncJobExecutionContext.getOriginJobId()); // save work context info (there are some duplications) - VmWorkDetachVolume workInfo = new VmWorkDetachVolume(callingUser.getId(), callingAccount.getId(), vm.getId(), VolumeApiServiceImpl.VM_WORK_JOB_HANDLER, volumeId); + VmWorkDetachVolume workInfo = new VmWorkDetachVolume(callingUser.getId(), callingAccount.getId(), vm.getId(), + VolumeApiServiceImpl.VM_WORK_JOB_HANDLER, volumeId); workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); return new Object[] {workJob, new Long(workJob.getId())}; + } finally { + _vmInstanceDao.unlockFromLockTable(String.valueOf(vm.getId())); + } } }); @@ -2215,7 +2238,9 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic public Object[] doInTransaction(TransactionStatus status) { VmWorkJobVO workJob = null; - _vmInstanceDao.lockRow(vm.getId(), true); + _vmInstanceDao.lockInLockTable(String.valueOf(vm.getId()), Integer.MAX_VALUE); + + try { workJob = new VmWorkJobVO(context.getContextId()); workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); @@ -2226,7 +2251,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic workJob.setStep(VmWorkJobVO.Step.Starting); workJob.setVmType(VirtualMachine.Type.Instance); workJob.setVmInstanceId(vm.getId()); - workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); + workJob.setRelated(AsyncJobExecutionContext.getOriginJobId()); // save work context info (there are some duplications) VmWorkResizeVolume workInfo = new VmWorkResizeVolume(callingUser.getId(), callingAccount.getId(), vm.getId(), @@ -2236,6 +2261,9 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); return new Object[] {workJob, new Long(workJob.getId())}; + } finally { + _vmInstanceDao.unlockFromLockTable(String.valueOf(vm.getId())); + } } }); @@ -2260,7 +2288,8 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic public Object[] doInTransaction(TransactionStatus status) { VmWorkJobVO workJob = null; - _vmInstanceDao.lockRow(vm.getId(), true); + _vmInstanceDao.lockInLockTable(String.valueOf(vm.getId()), Integer.MAX_VALUE); + try { workJob = new VmWorkJobVO(context.getContextId()); workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); @@ -2271,7 +2300,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic workJob.setStep(VmWorkJobVO.Step.Starting); workJob.setVmType(VirtualMachine.Type.Instance); workJob.setVmInstanceId(vm.getId()); - workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); + workJob.setRelated(AsyncJobExecutionContext.getOriginJobId()); // save work context info (there are some duplications) VmWorkMigrateVolume workInfo = new VmWorkMigrateVolume(callingUser.getId(), callingAccount.getId(), vm.getId(), @@ -2281,6 +2310,9 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); return new Object[] {workJob, new Long(workJob.getId())}; + } finally { + _vmInstanceDao.unlockFromLockTable(String.valueOf(vm.getId())); + } } }); @@ -2305,7 +2337,8 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic public Object[] doInTransaction(TransactionStatus status) { VmWorkJobVO workJob = null; - _vmInstanceDao.lockRow(vm.getId(), true); + _vmInstanceDao.lockInLockTable(String.valueOf(vm.getId()), Integer.MAX_VALUE); + try { workJob = new VmWorkJobVO(context.getContextId()); workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); @@ -2316,7 +2349,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic workJob.setStep(VmWorkJobVO.Step.Starting); workJob.setVmType(VirtualMachine.Type.Instance); workJob.setVmInstanceId(vm.getId()); - workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); + workJob.setRelated(AsyncJobExecutionContext.getOriginJobId()); // save work context info (there are some duplications) VmWorkTakeVolumeSnapshot workInfo = new VmWorkTakeVolumeSnapshot( @@ -2327,6 +2360,9 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); return new Object[] {workJob, new Long(workJob.getId())}; + } finally { + _vmInstanceDao.unlockFromLockTable(String.valueOf(vm.getId())); + } } }); @@ -2338,19 +2374,23 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic } private Pair orchestrateAttachVolumeToVM(VmWorkAttachVolume work) throws Exception { - orchestrateAttachVolumeToVM(work.getVmId(), work.getVolumeId(), work.getDeviceId()); - return new Pair(JobInfo.Status.SUCCEEDED, null); + Volume vol = orchestrateAttachVolumeToVM(work.getVmId(), work.getVolumeId(), work.getDeviceId()); + + return new Pair(JobInfo.Status.SUCCEEDED, + _jobMgr.marshallResultObject(new Long(vol.getId()))); } private Pair orchestrateDetachVolumeFromVM(VmWorkDetachVolume work) throws Exception { - orchestrateDetachVolumeFromVM(work.getVmId(), work.getVolumeId()); - return new Pair(JobInfo.Status.SUCCEEDED, null); + Volume vol = orchestrateDetachVolumeFromVM(work.getVmId(), work.getVolumeId()); + return new Pair(JobInfo.Status.SUCCEEDED, + _jobMgr.marshallResultObject(new Long(vol.getId()))); } private Pair orchestrateResizeVolume(VmWorkResizeVolume work) throws Exception { - orchestrateResizeVolume(work.getVolumeId(), work.getCurrentSize(), work.getNewSize(), + Volume vol = orchestrateResizeVolume(work.getVolumeId(), work.getCurrentSize(), work.getNewSize(), work.getNewServiceOfferingId(), work.isShrinkOk()); - return new Pair(JobInfo.Status.SUCCEEDED, null); + return new Pair(JobInfo.Status.SUCCEEDED, + _jobMgr.marshallResultObject(new Long(vol.getId()))); } private Pair orchestrateMigrateVolume(VmWorkMigrateVolume work) throws Exception { diff --git a/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java index 315905953a6..a85c0526e1f 100644 --- a/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java +++ b/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java @@ -22,7 +22,6 @@ import java.util.List; import java.util.Map; import java.util.Timer; import java.util.TimerTask; -import java.util.UUID; import javax.ejb.Local; import javax.inject.Inject; @@ -246,7 +245,7 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu tmpSnapshotScheduleVO = _snapshotScheduleDao.acquireInLockTable(snapshotScheId); Long eventId = ActionEventUtils.onScheduledActionEvent(User.UID_SYSTEM, volume.getAccountId(), EventTypes.EVENT_SNAPSHOT_CREATE, "creating snapshot for volume Id:" + - volumeId, 0); + volumeId, true, 0); Map params = new HashMap(); params.put(ApiConstants.VOLUME_ID, "" + volumeId); @@ -261,10 +260,9 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu params.put("id", "" + cmd.getEntityId()); params.put("ctxStartEventId", "1"); - AsyncJobVO job = - new AsyncJobVO(UUID.randomUUID().toString(), User.UID_SYSTEM, volume.getAccountId(), CreateSnapshotCmd.class.getName(), ApiGsonHelper.getBuilder() - .create() - .toJson(params), cmd.getEntityId(), cmd.getInstanceType() != null ? cmd.getInstanceType().toString() : null); + AsyncJobVO job = new AsyncJobVO("", User.UID_SYSTEM, volume.getAccountId(), CreateSnapshotCmd.class.getName(), + ApiGsonHelper.getBuilder().create().toJson(params), cmd.getEntityId(), + cmd.getInstanceType() != null ? cmd.getInstanceType().toString() : null); job.setDispatcher(_asyncDispatcher.getName()); long jobId = _asyncMgr.submitAsyncJob(job); diff --git a/server/src/com/cloud/template/HypervisorTemplateAdapter.java b/server/src/com/cloud/template/HypervisorTemplateAdapter.java index d6a1ab5e320..2b6f1ebf3a3 100755 --- a/server/src/com/cloud/template/HypervisorTemplateAdapter.java +++ b/server/src/com/cloud/template/HypervisorTemplateAdapter.java @@ -19,7 +19,9 @@ package com.cloud.template; import java.net.MalformedURLException; import java.net.URL; import java.util.Collections; +import java.util.HashSet; import java.util.List; +import java.util.Set; import java.util.concurrent.ExecutionException; import javax.ejb.Local; @@ -226,7 +228,8 @@ public class HypervisorTemplateAdapter extends TemplateAdapterBase { throw new CloudRuntimeException("Unable to find image store to download template " + profile.getTemplate()); } - Collections.shuffle(imageStores);// For private templates choose a random store. TODO - Have a better algorithm based on size, no. of objects, load etc. + Set zoneSet = new HashSet(); + Collections.shuffle(imageStores); // For private templates choose a random store. TODO - Have a better algorithm based on size, no. of objects, load etc. for (DataStore imageStore : imageStores) { // skip data stores for a disabled zone Long zoneId = imageStore.getScope().getScopeId(); @@ -242,6 +245,14 @@ public class HypervisorTemplateAdapter extends TemplateAdapterBase { s_logger.info("Zone " + zoneId + " is disabled, so skip downloading template to its image store " + imageStore.getId()); continue; } + + // We want to download private template to one of the image store in a zone + if(isPrivateTemplate(template) && zoneSet.contains(zoneId)){ + continue; + }else { + zoneSet.add(zoneId); + } + } TemplateInfo tmpl = imageFactory.getTemplate(template.getId(), imageStore); @@ -250,15 +261,21 @@ public class HypervisorTemplateAdapter extends TemplateAdapterBase { caller.setCallback(caller.getTarget().createTemplateAsyncCallBack(null, null)); caller.setContext(context); imageService.createTemplateAsync(tmpl, imageStore, caller); - if (!(profile.getIsPublic() || profile.getFeatured())) { // If private template then break - break; - } } _resourceLimitMgr.incrementResourceCount(profile.getAccountId(), ResourceType.template); return template; } + private boolean isPrivateTemplate(VMTemplateVO template){ + + // if public OR featured OR system template + if(template.isPublicTemplate() || template.isFeatured() || template.getTemplateType() == TemplateType.SYSTEM) + return false; + else + return true; + } + private class CreateTemplateContext extends AsyncRpcContext { final TemplateInfo template; diff --git a/server/src/com/cloud/template/TemplateManagerImpl.java b/server/src/com/cloud/template/TemplateManagerImpl.java index f27fb745931..34123cdb986 100755 --- a/server/src/com/cloud/template/TemplateManagerImpl.java +++ b/server/src/com/cloud/template/TemplateManagerImpl.java @@ -85,6 +85,7 @@ import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao; import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO; import org.apache.cloudstack.storage.image.datastore.ImageStoreEntity; +import org.apache.cloudstack.storage.to.TemplateObjectTO; import com.cloud.agent.AgentManager; import com.cloud.agent.api.Answer; @@ -150,6 +151,7 @@ import com.cloud.storage.dao.VMTemplatePoolDao; import com.cloud.storage.dao.VMTemplateZoneDao; import com.cloud.storage.dao.VolumeDao; import com.cloud.template.TemplateAdapter.TemplateAdapterType; +import com.cloud.template.VirtualMachineTemplate.BootloaderType; import com.cloud.user.Account; import com.cloud.user.AccountManager; import com.cloud.user.AccountService; @@ -172,6 +174,7 @@ import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.vm.UserVmVO; import com.cloud.vm.VMInstanceVO; import com.cloud.vm.VirtualMachine.State; +import com.cloud.vm.VirtualMachineProfile; import com.cloud.vm.dao.UserVmDao; import com.cloud.vm.dao.VMInstanceDao; @@ -443,6 +446,37 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager, return tmpltStore.createEntityExtractUrl(templateObject.getInstallPath(), template.getFormat(), templateObject); } + @Override + public void prepareIsoForVmProfile(VirtualMachineProfile profile) { + UserVmVO vm = _userVmDao.findById(profile.getId()); + if (vm.getIsoId() != null) { + TemplateInfo template = prepareIso(vm.getIsoId(), vm.getDataCenterId()); + if (template == null){ + s_logger.error("Failed to prepare ISO on secondary or cache storage"); + throw new CloudRuntimeException("Failed to prepare ISO on secondary or cache storage"); + } + if (template.isBootable()) { + profile.setBootLoaderType(BootloaderType.CD); + } + + GuestOSVO guestOS = _guestOSDao.findById(template.getGuestOSId()); + String displayName = null; + if (guestOS != null) { + displayName = guestOS.getDisplayName(); + } + + TemplateObjectTO iso = (TemplateObjectTO)template.getTO(); + iso.setGuestOsType(displayName); + DiskTO disk = new DiskTO(iso, 3L, null, Volume.Type.ISO); + profile.addDisk(disk); + } else { + TemplateObjectTO iso = new TemplateObjectTO(); + iso.setFormat(ImageFormat.ISO); + DiskTO disk = new DiskTO(iso, 3L, null, Volume.Type.ISO); + profile.addDisk(disk); + } + } + public void prepareTemplateInAllStoragePools(final VMTemplateVO template, long zoneId) { List pools = _poolDao.listByStatus(StoragePoolStatus.Up); for (final StoragePoolVO pool : pools) { @@ -1744,12 +1778,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager, throw ex; } - // Don't allow to modify system template - if (id == Long.valueOf(1)) { - InvalidParameterValueException ex = new InvalidParameterValueException("Unable to update template/iso of specified id"); - ex.addProxyObject(String.valueOf(id), "templateId"); - throw ex; - } + verifyTemplateId(id); // do a permission check _accountMgr.checkAccess(account, AccessType.OperateEntry, true, template); @@ -1826,6 +1855,15 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager, return _tmpltDao.findById(id); } + void verifyTemplateId(Long id) { + // Don't allow to modify system template + if (id.equals(Long.valueOf(1))) { + InvalidParameterValueException ex = new InvalidParameterValueException("Unable to update template/iso of specified id"); + ex.addProxyObject(String.valueOf(id), "templateId"); + throw ex; + } + } + @Override public String getConfigComponentName() { return TemplateManager.class.getSimpleName(); diff --git a/server/src/com/cloud/user/DomainManager.java b/server/src/com/cloud/user/DomainManager.java index 592ab81a2a4..f72b18a94ba 100644 --- a/server/src/com/cloud/user/DomainManager.java +++ b/server/src/com/cloud/user/DomainManager.java @@ -50,5 +50,4 @@ public interface DomainManager extends DomainService { public static final String MESSAGE_ADD_DOMAIN_EVENT = "Message.AddDomain.Event"; public static final String MESSAGE_REMOVE_DOMAIN_EVENT = "Message.RemoveDomain.Event"; - } diff --git a/server/src/com/cloud/vm/UserVmManager.java b/server/src/com/cloud/vm/UserVmManager.java index fa90c1844a1..0e4841478c3 100755 --- a/server/src/com/cloud/vm/UserVmManager.java +++ b/server/src/com/cloud/vm/UserVmManager.java @@ -100,7 +100,7 @@ public interface UserVmManager extends UserVmService { void collectVmDiskStatistics(UserVmVO userVm); UserVm updateVirtualMachine(long id, String displayName, String group, Boolean ha, Boolean isDisplayVmEnabled, Long osTypeId, String userData, - Boolean isDynamicallyScalable, HTTPMethod httpMethod, String customId) throws ResourceUnavailableException, InsufficientCapacityException; + Boolean isDynamicallyScalable, HTTPMethod httpMethod, String customId, String hostName) throws ResourceUnavailableException, InsufficientCapacityException; //the validateCustomParameters, save and remove CustomOfferingDetils functions can be removed from the interface once we can //find a common place for all the scaling and upgrading code of both user and systemvms. diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index 2957bac768a..ca734c237d5 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -17,6 +17,7 @@ package com.cloud.vm; import java.util.ArrayList; +import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.HashSet; @@ -34,6 +35,9 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; +import org.apache.commons.codec.binary.Base64; +import org.apache.log4j.Logger; + import org.apache.cloudstack.acl.ControlledEntity.ACLType; import org.apache.cloudstack.acl.SecurityChecker.AccessType; import org.apache.cloudstack.affinity.AffinityGroupService; @@ -66,7 +70,6 @@ import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationSe import org.apache.cloudstack.engine.orchestration.service.VolumeOrchestrationService; import org.apache.cloudstack.engine.service.api.OrchestrationService; import org.apache.cloudstack.engine.subsystem.api.storage.TemplateDataFactory; -import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory; import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService; @@ -79,9 +82,6 @@ import org.apache.cloudstack.framework.jobs.AsyncJobManager; import org.apache.cloudstack.managed.context.ManagedContextRunnable; import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; -import org.apache.cloudstack.storage.to.TemplateObjectTO; -import org.apache.commons.codec.binary.Base64; -import org.apache.log4j.Logger; import com.cloud.agent.AgentManager; import com.cloud.agent.api.Answer; @@ -93,7 +93,6 @@ import com.cloud.agent.api.PvlanSetupCommand; import com.cloud.agent.api.StartAnswer; import com.cloud.agent.api.VmDiskStatsEntry; import com.cloud.agent.api.VmStatsEntry; -import com.cloud.agent.api.to.DiskTO; import com.cloud.agent.api.to.NicTO; import com.cloud.agent.api.to.VirtualMachineTO; import com.cloud.agent.manager.Commands; @@ -215,7 +214,6 @@ import com.cloud.storage.snapshot.SnapshotManager; import com.cloud.tags.dao.ResourceTagDao; import com.cloud.template.TemplateManager; import com.cloud.template.VirtualMachineTemplate; -import com.cloud.template.VirtualMachineTemplate.BootloaderType; import com.cloud.user.Account; import com.cloud.user.AccountManager; import com.cloud.user.AccountService; @@ -406,7 +404,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir @Inject VpcManager _vpcMgr; @Inject - TemplateManager templateMgr; + TemplateManager _templateMgr; @Inject protected GuestOSCategoryDao _guestOSCategoryDao; @Inject @@ -1425,7 +1423,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir details.put(UsageEventVO.DynamicParameters.memory.name(), serviceOffering.getRamSize().toString()); List detailList = new ArrayList(); for (String key : details.keySet()) { - UserVmDetailVO detailVO = new UserVmDetailVO(vmId, key, details.get(key)); + UserVmDetailVO detailVO = new UserVmDetailVO(vmId, key, details.get(key), true); detailList.add(detailVO); } _uservmDetailsDao.saveDetails(detailList); @@ -1439,7 +1437,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir details.remove(UsageEventVO.DynamicParameters.memory.name()); List detailList = new ArrayList(); for (String key : details.keySet()) { - UserVmDetailVO detailVO = new UserVmDetailVO(vmId, key, details.get(key)); + UserVmDetailVO detailVO = new UserVmDetailVO(vmId, key, details.get(key), true); detailList.add(detailVO); } _uservmDetailsDao.saveDetails(detailList); @@ -1824,12 +1822,12 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir String displayName = cmd.getDisplayName(); String group = cmd.getGroup(); Boolean ha = cmd.getHaEnable(); - Boolean isDisplayVmEnabled = cmd.getDisplayVm(); + Boolean isDisplayVm = cmd.getDisplayVm(); Long id = cmd.getId(); Long osTypeId = cmd.getOsTypeId(); String userData = cmd.getUserData(); Boolean isDynamicallyScalable = cmd.isDynamicallyScalable(); - Account caller = CallContext.current().getCallingAccount(); + String hostName = cmd.getHostName(); // Input validation and permission checks UserVmVO vmInstance = _vmDao.findById(id.longValue()); @@ -1840,22 +1838,19 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir _accountMgr.checkAccess(CallContext.current().getCallingAccount(), null, true, vmInstance); //If the flag is specified and is changed - if (isDisplayVmEnabled != null && isDisplayVmEnabled != vmInstance.isDisplayVm()) { - if (!_accountMgr.isRootAdmin(caller.getType())) { - throw new PermissionDeniedException("Cannot update parameter displayvm, only admin permitted "); - } + if (isDisplayVm != null && isDisplayVm != vmInstance.isDisplayVm()) { ServiceOffering offering = _serviceOfferingDao.findByIdIncludingRemoved(vmInstance.getServiceOfferingId()); - _resourceLimitMgr.changeResourceCount(vmInstance.getAccountId(), ResourceType.user_vm, isDisplayVmEnabled); - _resourceLimitMgr.changeResourceCount(vmInstance.getAccountId(), ResourceType.cpu, isDisplayVmEnabled, new Long(offering.getCpu())); - _resourceLimitMgr.changeResourceCount(vmInstance.getAccountId(), ResourceType.memory, isDisplayVmEnabled, new Long(offering.getRamSize())); + _resourceLimitMgr.changeResourceCount(vmInstance.getAccountId(), ResourceType.user_vm, isDisplayVm); + _resourceLimitMgr.changeResourceCount(vmInstance.getAccountId(), ResourceType.cpu, isDisplayVm, new Long(offering.getCpu())); + _resourceLimitMgr.changeResourceCount(vmInstance.getAccountId(), ResourceType.memory, isDisplayVm, new Long(offering.getRamSize())); } - return updateVirtualMachine(id, displayName, group, ha, isDisplayVmEnabled, osTypeId, userData, isDynamicallyScalable, cmd.getHttpMethod(), cmd.getCustomId()); + return updateVirtualMachine(id, displayName, group, ha, isDisplayVm, osTypeId, userData, isDynamicallyScalable, cmd.getHttpMethod(), cmd.getCustomId(), hostName); } @Override public UserVm updateVirtualMachine(long id, String displayName, String group, Boolean ha, Boolean isDisplayVmEnabled, Long osTypeId, String userData, - Boolean isDynamicallyScalable, HTTPMethod httpMethod, String customId) throws ResourceUnavailableException, InsufficientCapacityException { + Boolean isDynamicallyScalable, HTTPMethod httpMethod, String customId, String hostName) throws ResourceUnavailableException, InsufficientCapacityException { UserVmVO vm = _vmDao.findById(id); if (vm == null) { throw new CloudRuntimeException("Unable to find virual machine with id " + id); @@ -1910,7 +1905,25 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir isDynamicallyScalable = vm.isDynamicallyScalable(); } - _vmDao.updateVM(id, displayName, ha, osTypeId, userData, isDisplayVmEnabled, isDynamicallyScalable, customId); + if (hostName != null) { + // Check is hostName is RFC compliant + checkNameForRFCCompliance(hostName); + + if (vm.getHostName().equalsIgnoreCase(hostName)) { + s_logger.debug("Vm " + vm + " is already set with the hostName specified: " + hostName); + hostName = null; + } + + // Verify that vm's hostName is unique + List vmNtwks = new ArrayList(); + List nics = _nicDao.listByVmId(vm.getId()); + for (Nic nic : nics) { + vmNtwks.add(_networkDao.findById(nic.getNetworkId())); + } + checkIfHostNameUniqueInNtwkDomain(hostName, vmNtwks); + } + + _vmDao.updateVM(id, displayName, ha, osTypeId, userData, isDisplayVmEnabled, isDynamicallyScalable, customId, hostName); if (updateUserdata) { boolean result = updateUserDataInternal(_vmDao.findById(id)); @@ -2458,7 +2471,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir @DB protected UserVm createVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate tmplt, String hostName, String displayName, Account owner, Long diskOfferingId, Long diskSize, List networkList, List securityGroupIdList, String group, HTTPMethod httpmethod, String userData, - String sshKeyPair, HypervisorType hypervisor, Account caller, Map requestedIps, IpAddresses defaultIps, Boolean isDisplayVmEnabled, String keyboard, + String sshKeyPair, HypervisorType hypervisor, Account caller, Map requestedIps, IpAddresses defaultIps, Boolean isDisplayVm, String keyboard, List affinityGroupIdList, Map customParameters, String customId) throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException, StorageUnavailableException, ResourceAllocationException { @@ -2525,7 +2538,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir } size += _diskOfferingDao.findById(diskOfferingId).getDiskSize(); } - resourceLimitCheck(owner, isDisplayVmEnabled, new Long(offering.getCpu()), new Long(offering.getRamSize())); + resourceLimitCheck(owner, isDisplayVm, new Long(offering.getCpu()), new Long(offering.getRamSize())); _resourceLimitMgr.checkResourceLimit(owner, ResourceType.volume, (isIso || diskOfferingId == null ? 1 : 2)); _resourceLimitMgr.checkResourceLimit(owner, ResourceType.primary_storage, size); @@ -2732,32 +2745,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir throw new InvalidParameterValueException("There already exists a VM by the display name supplied"); } - // Check that hostName is unique in the network domain - Map> ntwkDomains = new HashMap>(); - for (NetworkVO network : networkList) { - String ntwkDomain = network.getNetworkDomain(); - if (!ntwkDomains.containsKey(ntwkDomain)) { - List ntwkIds = new ArrayList(); - ntwkIds.add(network.getId()); - ntwkDomains.put(ntwkDomain, ntwkIds); - } else { - List ntwkIds = ntwkDomains.get(ntwkDomain); - ntwkIds.add(network.getId()); - ntwkDomains.put(ntwkDomain, ntwkIds); - } - } - - for (Entry> ntwkDomain : ntwkDomains.entrySet()) { - for (Long ntwkId : ntwkDomain.getValue()) { - // * get all vms hostNames in the network - List hostNames = _vmInstanceDao.listDistinctHostNames(ntwkId); - // * verify that there are no duplicates - if (hostNames.contains(hostName)) { - throw new InvalidParameterValueException("The vm with hostName " + hostName + " already exists in the network domain: " + ntwkDomain.getKey() + "; network=" - + _networkModel.getNetwork(ntwkId)); - } - } - } + checkIfHostNameUniqueInNtwkDomain(hostName, networkList); HypervisorType hypervisorType = null; if (template.getHypervisorType() == null || template.getHypervisorType() == HypervisorType.None) { @@ -2766,7 +2754,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir hypervisorType = template.getHypervisorType(); } - UserVmVO vm = commitUserVm(zone, template, hostName, displayName, owner, diskOfferingId, diskSize, userData, hypervisor, caller, isDisplayVmEnabled, keyboard, accountId, + UserVmVO vm = commitUserVm(zone, template, hostName, displayName, owner, diskOfferingId, diskSize, userData, hypervisor, caller, isDisplayVm, keyboard, accountId, offering, isIso, sshPublicKey, networkNicMap, id, instanceName, uuidName, hypervisorType, customParameters); // Assign instance to the group @@ -2790,12 +2778,41 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir return vm; } + private void checkIfHostNameUniqueInNtwkDomain(String hostName, List networkList) { + // Check that hostName is unique in the network domain + Map> ntwkDomains = new HashMap>(); + for (Network network : networkList) { + String ntwkDomain = network.getNetworkDomain(); + if (!ntwkDomains.containsKey(ntwkDomain)) { + List ntwkIds = new ArrayList(); + ntwkIds.add(network.getId()); + ntwkDomains.put(ntwkDomain, ntwkIds); + } else { + List ntwkIds = ntwkDomains.get(ntwkDomain); + ntwkIds.add(network.getId()); + ntwkDomains.put(ntwkDomain, ntwkIds); + } + } + + for (Entry> ntwkDomain : ntwkDomains.entrySet()) { + for (Long ntwkId : ntwkDomain.getValue()) { + // * get all vms hostNames in the network + List hostNames = _vmInstanceDao.listDistinctHostNames(ntwkId); + // * verify that there are no duplicates + if (hostNames.contains(hostName)) { + throw new InvalidParameterValueException("The vm with hostName " + hostName + " already exists in the network domain: " + ntwkDomain.getKey() + "; network=" + + _networkModel.getNetwork(ntwkId)); + } + } + } + } + private String generateHostName(String uuidName) { return _instance + "-" + uuidName; } private UserVmVO commitUserVm(final DataCenter zone, final VirtualMachineTemplate template, final String hostName, final String displayName, final Account owner, - final Long diskOfferingId, final Long diskSize, final String userData, final HypervisorType hypervisor, final Account caller, final Boolean isDisplayVmEnabled, + final Long diskOfferingId, final Long diskSize, final String userData, final HypervisorType hypervisor, final Account caller, final Boolean isDisplayVm, final String keyboard, final long accountId, final ServiceOfferingVO offering, final boolean isIso, final String sshPublicKey, final LinkedHashMap networkNicMap, final long id, final String instanceName, final String uuidName, final HypervisorType hypervisorType, final Map customParameters) throws InsufficientCapacityException { @@ -2804,18 +2821,18 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir public UserVmVO doInTransaction(TransactionStatus status) throws InsufficientCapacityException { UserVmVO vm = new UserVmVO(id, instanceName, displayName, template.getId(), hypervisorType, template.getGuestOSId(), offering.getOfferHA(), offering .getLimitCpuUse(), owner.getDomainId(), owner.getId(), offering.getId(), userData, hostName, diskOfferingId); - vm.setUuid(uuidName); - vm.setDynamicallyScalable(template.isDynamicallyScalable()); - if (sshPublicKey != null) { - vm.setDetail("SSH.PublicKey", sshPublicKey); - } + vm.setUuid(uuidName); + vm.setDynamicallyScalable(template.isDynamicallyScalable()); + if (sshPublicKey != null) { + vm.setDetail("SSH.PublicKey", sshPublicKey); + } - if (keyboard != null && !keyboard.isEmpty()) - vm.setDetail(VmDetailConstants.KEYBOARD, keyboard); + if (keyboard != null && !keyboard.isEmpty()) + vm.setDetail(VmDetailConstants.KEYBOARD, keyboard); - if (isIso) { - vm.setIsoId(template.getId()); - } + if (isIso) { + vm.setIsoId(template.getId()); + } Long rootDiskSize = null; if (customParameters.containsKey("rootdisksize")) { if (NumbersUtil.parseLong(customParameters.get("rootdisksize"), -1) <= 0) { @@ -2825,64 +2842,61 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir customParameters.remove("rootdisksize"); } - if(isDisplayVmEnabled != null){ - if(!_accountMgr.isRootAdmin(caller.getId())){ - throw new PermissionDeniedException( "Cannot update parameter displayvm, only admin permitted "); - } - vm.setDisplayVm(isDisplayVmEnabled); + if (isDisplayVm != null) { + vm.setDisplayVm(isDisplayVm); } else { - vm.setDisplayVm(true); - } + vm.setDisplayVm(true); + } - // If hypervisor is vSphere, check for clone type setting. - if (hypervisorType.equals(HypervisorType.VMware)) { - // retrieve clone flag. - UserVmCloneType cloneType = UserVmCloneType.linked; - String value = _configDao.getValue(Config.VmwareCreateFullClone.key()); - if (value != null) { - if (Boolean.parseBoolean(value) == true) - cloneType = UserVmCloneType.full; - } - UserVmCloneSettingVO vmCloneSettingVO = new UserVmCloneSettingVO(id, cloneType.toString()); - _vmCloneSettingDao.persist(vmCloneSettingVO); - } + // If hypervisor is vSphere, check for clone type setting. + if (hypervisorType.equals(HypervisorType.VMware)) { + // retrieve clone flag. + UserVmCloneType cloneType = UserVmCloneType.linked; + String value = _configDao.getValue(Config.VmwareCreateFullClone.key()); + if (value != null) { + if (Boolean.parseBoolean(value) == true) + cloneType = UserVmCloneType.full; + } + UserVmCloneSettingVO vmCloneSettingVO = new UserVmCloneSettingVO(id, cloneType.toString()); + _vmCloneSettingDao.persist(vmCloneSettingVO); + } - long guestOSId = template.getGuestOSId(); - GuestOSVO guestOS = _guestOSDao.findById(guestOSId); - long guestOSCategoryId = guestOS.getCategoryId(); - GuestOSCategoryVO guestOSCategory = _guestOSCategoryDao.findById(guestOSCategoryId); + long guestOSId = template.getGuestOSId(); + GuestOSVO guestOS = _guestOSDao.findById(guestOSId); + long guestOSCategoryId = guestOS.getCategoryId(); + GuestOSCategoryVO guestOSCategory = _guestOSCategoryDao.findById(guestOSCategoryId); - // If hypervisor is vSphere and OS is OS X, set special settings. - if (hypervisorType.equals(HypervisorType.VMware)) { + // If hypervisor is vSphere and OS is OS X, set special settings. + if (hypervisorType.equals(HypervisorType.VMware)) { if (guestOS.getDisplayName().toLowerCase().contains("apple mac os")) { - vm.setDetail("smc.present", "TRUE"); - vm.setDetail(VmDetailConstants.ROOK_DISK_CONTROLLER, "scsi"); - vm.setDetail("firmware", "efi"); - s_logger.info("guestOS is OSX : overwrite root disk controller to scsi, use smc and efi"); - } - } + vm.setDetail("smc.present", "TRUE"); + vm.setDetail(VmDetailConstants.ROOK_DISK_CONTROLLER, "scsi"); + vm.setDetail("firmware", "efi"); + s_logger.info("guestOS is OSX : overwrite root disk controller to scsi, use smc and efi"); + } + } Map details = template.getDetails(); if (details != null && !details.isEmpty()) { vm.details.putAll(details); } - _vmDao.persist(vm); + _vmDao.persist(vm); if (customParameters != null && customParameters.size() > 0) { for (String key : customParameters.keySet()) { vm.setDetail(key, customParameters.get(key)); } } - _vmDao.saveDetails(vm); + _vmDao.saveDetails(vm); - s_logger.debug("Allocating in the DB for vm"); - DataCenterDeployment plan = new DataCenterDeployment(zone.getId()); + s_logger.debug("Allocating in the DB for vm"); + DataCenterDeployment plan = new DataCenterDeployment(zone.getId()); - List computeTags = new ArrayList(); - computeTags.add(offering.getHostTag()); + List computeTags = new ArrayList(); + computeTags.add(offering.getHostTag()); List rootDiskTags = new ArrayList(); - rootDiskTags.add(offering.getTags()); + rootDiskTags.add(offering.getTags()); if (isIso) { _orchSrvc.createVirtualMachineFromScratch(vm.getUuid(), Long.toString(owner.getAccountId()), vm.getIsoId().toString(), hostName, displayName, @@ -2891,12 +2905,12 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir } else { _orchSrvc.createVirtualMachine(vm.getUuid(), Long.toString(owner.getAccountId()), Long.toString(template.getId()), hostName, displayName, hypervisor.name(), offering.getCpu(), offering.getSpeed(), offering.getRamSize(), diskSize, computeTags, rootDiskTags, networkNicMap, plan, rootDiskSize); - } + } - if (s_logger.isDebugEnabled()) { - s_logger.debug("Successfully allocated DB entry for " + vm); - } - CallContext.current().setEventDetails("Vm Id: " + vm.getId()); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Successfully allocated DB entry for " + vm); + } + CallContext.current().setEventDetails("Vm Id: " + vm.getId()); if (!offering.isDynamic()) { UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VM_CREATE, accountId, zone.getId(), vm.getId(), vm.getHostName(), offering.getId(), template.getId(), @@ -2906,10 +2920,10 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir hypervisorType.toString(), VirtualMachine.class.getName(), vm.getUuid(), customParameters); } - //Update Resource Count for the given account - resourceCountIncrement(accountId, isDisplayVmEnabled, new Long(offering.getCpu()), new Long(offering.getRamSize())); - return vm; - } + //Update Resource Count for the given account + resourceCountIncrement(accountId, isDisplayVm, new Long(offering.getCpu()), new Long(offering.getRamSize())); + return vm; + } }); } @@ -2992,34 +3006,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir UserVmVO vm = _vmDao.findById(profile.getId()); Map details = _vmDetailsDao.listDetailsKeyPairs(vm.getId()); vm.setDetails(details); - - if (vm.getIsoId() != null) { - TemplateInfo template = templateMgr.prepareIso(vm.getIsoId(), vm.getDataCenterId()); - if (template == null) { - s_logger.error("Failed to prepare ISO on secondary or cache storage"); - throw new CloudRuntimeException("Failed to prepare ISO on secondary or cache storage"); - } - if (template.isBootable()) { - profile.setBootLoaderType(BootloaderType.CD); - } - - GuestOSVO guestOS = _guestOSDao.findById(template.getGuestOSId()); - String displayName = null; - if (guestOS != null) { - displayName = guestOS.getDisplayName(); - } - - TemplateObjectTO iso = (TemplateObjectTO)template.getTO(); - iso.setGuestOsType(displayName); - DiskTO disk = new DiskTO(iso, 3L, null, Volume.Type.ISO); - profile.addDisk(disk); - } else { - TemplateObjectTO iso = new TemplateObjectTO(); - iso.setFormat(ImageFormat.ISO); - DiskTO disk = new DiskTO(iso, 3L, null, Volume.Type.ISO); - profile.addDisk(disk); - } - + _templateMgr.prepareIsoForVmProfile(profile); return true; } @@ -4301,10 +4288,10 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir } } - LinkedHashMap networks = new LinkedHashMap(); + LinkedHashMap> networks = new LinkedHashMap>(); NicProfile profile = new NicProfile(); profile.setDefaultNic(true); - networks.put(networkList.get(0), profile); + networks.put(networkList.get(0), new ArrayList(Arrays.asList(profile))); VirtualMachine vmi = _itMgr.findById(vm.getId()); VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(vmi); @@ -4408,7 +4395,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir } // add the new nics - LinkedHashMap networks = new LinkedHashMap(); + LinkedHashMap> networks = new LinkedHashMap>(); int toggle = 0; for (NetworkVO appNet : applicableNetworks) { NicProfile defaultNic = new NicProfile(); @@ -4416,7 +4403,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir defaultNic.setDefaultNic(true); toggle++; } - networks.put(appNet, defaultNic); + networks.put(appNet, new ArrayList(Arrays.asList(defaultNic))); } VirtualMachine vmi = _itMgr.findById(vm.getId()); VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(vmi); diff --git a/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java b/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java index e9d10b89d40..37cdf86fd43 100644 --- a/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java +++ b/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java @@ -135,7 +135,7 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana // TODO static final ConfigKey VmJobEnabled = new ConfigKey("Advanced", - Boolean.class, "vm.job.enabled", "false", + Boolean.class, "vm.job.enabled", "true", "True to enable new VM sync model. false to use the old way", false); static final ConfigKey VmJobCheckInterval = new ConfigKey("Advanced", Long.class, "vm.job.check.interval", "3000", @@ -865,7 +865,8 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana public Object[] doInTransaction(TransactionStatus status) { VmWorkJobVO workJob = null; - _vmInstanceDao.lockRow(vm.getId(), true); + _vmInstanceDao.lockInLockTable(String.valueOf(vm.getId()), Integer.MAX_VALUE); + try { workJob = new VmWorkJobVO(context.getContextId()); workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); @@ -876,7 +877,7 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana workJob.setStep(VmWorkJobVO.Step.Starting); workJob.setVmType(VirtualMachine.Type.Instance); workJob.setVmInstanceId(vm.getId()); - workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); + workJob.setRelated(AsyncJobExecutionContext.getOriginJobId()); // save work context info (there are some duplications) VmWorkCreateVMSnapshot workInfo = new VmWorkCreateVMSnapshot(callingUser.getId(), callingAccount.getId(), vm.getId(), @@ -886,6 +887,9 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); return new Object[] {workJob, new Long(workJob.getId())}; + } finally { + _vmInstanceDao.unlockFromLockTable(String.valueOf(vm.getId())); + } } }); @@ -909,7 +913,8 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana public Object[] doInTransaction(TransactionStatus status) { VmWorkJobVO workJob = null; - _vmInstanceDao.lockRow(vm.getId(), true); + _vmInstanceDao.lockInLockTable(String.valueOf(vm.getId()), Integer.MAX_VALUE); + try { workJob = new VmWorkJobVO(context.getContextId()); workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); @@ -920,7 +925,7 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana workJob.setStep(VmWorkJobVO.Step.Starting); workJob.setVmType(VirtualMachine.Type.Instance); workJob.setVmInstanceId(vm.getId()); - workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); + workJob.setRelated(AsyncJobExecutionContext.getOriginJobId()); // save work context info (there are some duplications) VmWorkDeleteVMSnapshot workInfo = new VmWorkDeleteVMSnapshot(callingUser.getId(), callingAccount.getId(), vm.getId(), @@ -930,6 +935,9 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); return new Object[] {workJob, new Long(workJob.getId())}; + } finally { + _vmInstanceDao.unlockFromLockTable(String.valueOf(vm.getId())); + } } }); @@ -953,7 +961,8 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana public Object[] doInTransaction(TransactionStatus status) { VmWorkJobVO workJob = null; - _vmInstanceDao.lockRow(vm.getId(), true); + _vmInstanceDao.lockInLockTable(String.valueOf(vm.getId()), Integer.MAX_VALUE); + try { workJob = new VmWorkJobVO(context.getContextId()); workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); @@ -964,7 +973,7 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana workJob.setStep(VmWorkJobVO.Step.Starting); workJob.setVmType(VirtualMachine.Type.Instance); workJob.setVmInstanceId(vm.getId()); - workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); + workJob.setRelated(AsyncJobExecutionContext.getOriginJobId()); // save work context info (there are some duplications) VmWorkRevertToVMSnapshot workInfo = new VmWorkRevertToVMSnapshot(callingUser.getId(), callingAccount.getId(), vm.getId(), @@ -974,6 +983,9 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); return new Object[] {workJob, new Long(workJob.getId())}; + } finally { + _vmInstanceDao.unlockFromLockTable(String.valueOf(vm.getId())); + } } }); @@ -997,7 +1009,8 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana public Object[] doInTransaction(TransactionStatus status) { VmWorkJobVO workJob = null; - _vmInstanceDao.lockRow(vm.getId(), true); + _vmInstanceDao.lockInLockTable(String.valueOf(vm.getId()), Integer.MAX_VALUE); + try { workJob = new VmWorkJobVO(context.getContextId()); workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER); @@ -1008,7 +1021,7 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana workJob.setStep(VmWorkJobVO.Step.Starting); workJob.setVmType(VirtualMachine.Type.Instance); workJob.setVmInstanceId(vm.getId()); - workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); + workJob.setRelated(AsyncJobExecutionContext.getOriginJobId()); // save work context info (there are some duplications) VmWorkDeleteAllVMSnapshots workInfo = new VmWorkDeleteAllVMSnapshots(callingUser.getId(), callingAccount.getId(), vm.getId(), @@ -1018,6 +1031,9 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); return new Object[] {workJob, new Long(workJob.getId())}; + } finally { + _vmInstanceDao.unlockFromLockTable(String.valueOf(vm.getId())); + } } }); diff --git a/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java b/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java index e304e0efaba..1f3e0d28d26 100644 --- a/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java +++ b/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java @@ -104,7 +104,7 @@ public class ApplicationLoadBalancerManagerImpl extends ManagerBase implements A @Override @ActionEvent(eventType = EventTypes.EVENT_LOAD_BALANCER_CREATE, eventDescription = "creating load balancer") public ApplicationLoadBalancerRule createApplicationLoadBalancer(String name, String description, Scheme scheme, long sourceIpNetworkId, String sourceIp, - int sourcePort, int instancePort, String algorithm, long networkId, long lbOwnerId) throws InsufficientAddressCapacityException, NetworkRuleConflictException, + int sourcePort, int instancePort, String algorithm, long networkId, long lbOwnerId, Boolean forDisplay) throws InsufficientAddressCapacityException, NetworkRuleConflictException, InsufficientVirtualNetworkCapcityException { //Validate LB rule guest network @@ -126,11 +126,11 @@ public class ApplicationLoadBalancerManagerImpl extends ManagerBase implements A throw new InvalidParameterValueException("Can't find the lb owner account"); } - return createApplicationLoadBalancer(name, description, scheme, sourceIpNtwk, sourceIp, sourcePort, instancePort, algorithm, lbOwner, guestNtwk); + return createApplicationLoadBalancer(name, description, scheme, sourceIpNtwk, sourceIp, sourcePort, instancePort, algorithm, lbOwner, guestNtwk, forDisplay); } protected ApplicationLoadBalancerRule createApplicationLoadBalancer(String name, String description, Scheme scheme, Network sourceIpNtwk, String sourceIp, - int sourcePort, int instancePort, String algorithm, Account lbOwner, Network guestNtwk) throws NetworkRuleConflictException, + int sourcePort, int instancePort, String algorithm, Account lbOwner, Network guestNtwk, Boolean forDisplay) throws NetworkRuleConflictException, InsufficientVirtualNetworkCapcityException { //Only Internal scheme is supported in this release @@ -151,6 +151,10 @@ public class ApplicationLoadBalancerManagerImpl extends ManagerBase implements A new ApplicationLoadBalancerRuleVO(name, description, sourcePort, instancePort, algorithm, guestNtwk.getId(), lbOwner.getId(), lbOwner.getDomainId(), sourceIpAddr, sourceIpNtwk.getId(), scheme); + if (forDisplay != null) { + newRule.setDisplay(forDisplay); + } + //4) Validate Load Balancing rule on the providers LoadBalancingRule loadBalancing = new LoadBalancingRule(newRule, new ArrayList(), new ArrayList(), new ArrayList(), sourceIpAddr, null, @@ -379,6 +383,7 @@ public class ApplicationLoadBalancerManagerImpl extends ManagerBase implements A String keyword = cmd.getKeyword(); Scheme scheme = cmd.getScheme(); Long networkId = cmd.getNetworkId(); + Boolean display = cmd.getDisplay(); Map tags = cmd.getTags(); @@ -404,6 +409,7 @@ public class ApplicationLoadBalancerManagerImpl extends ManagerBase implements A sb.and("sourceIpAddressNetworkId", sb.entity().getSourceIpNetworkId(), SearchCriteria.Op.EQ); sb.and("scheme", sb.entity().getScheme(), SearchCriteria.Op.EQ); sb.and("networkId", sb.entity().getNetworkId(), SearchCriteria.Op.EQ); + sb.and("display", sb.entity().isDisplay(), SearchCriteria.Op.EQ); //list only load balancers having not null sourceIp/sourceIpNtwkId sb.and("sourceIpAddress", sb.entity().getSourceIp(), SearchCriteria.Op.NNULL); @@ -465,6 +471,10 @@ public class ApplicationLoadBalancerManagerImpl extends ManagerBase implements A } } + if (display != null) { + sc.setParameters("display", display); + } + Pair, Integer> result = _lbDao.searchAndCount(sc, searchFilter); return new Pair, Integer>(result.first(), result.second()); } @@ -529,7 +539,7 @@ public class ApplicationLoadBalancerManagerImpl extends ManagerBase implements A @Override @ActionEvent(eventType = EventTypes.EVENT_LOAD_BALANCER_UPDATE, eventDescription = "updating load balancer", async = true) - public ApplicationLoadBalancerRule deleteApplicationLoadBalancer(Long id, String customId) { + public ApplicationLoadBalancerRule updateApplicationLoadBalancer(Long id, String customId, Boolean forDisplay) { Account caller = CallContext.current().getCallingAccount(); ApplicationLoadBalancerRuleVO rule = _lbDao.findById(id); @@ -537,9 +547,15 @@ public class ApplicationLoadBalancerManagerImpl extends ManagerBase implements A throw new InvalidParameterValueException("Unable to find load balancer " + id); } _accountMgr.checkAccess(caller, null, true, rule); + if (customId != null) { rule.setUuid(customId); } + + if (forDisplay != null) { + rule.setDisplay(forDisplay); + } + _lbDao.update(id, rule); return _lbDao.findById(id); diff --git a/server/test/com/cloud/metadata/ResourceMetaDataManagerTest.java b/server/test/com/cloud/metadata/ResourceMetaDataManagerTest.java index fe236d90685..d6d8953d3fb 100644 --- a/server/test/com/cloud/metadata/ResourceMetaDataManagerTest.java +++ b/server/test/com/cloud/metadata/ResourceMetaDataManagerTest.java @@ -89,7 +89,7 @@ public class ResourceMetaDataManagerTest { doNothing().when(_nicDetailDao).removeDetail(anyLong(), anyString()); Map map = new HashedMap(); map.put("key", "value"); - _resourceMetaDataMgr.addResourceMetaData("1", ResourceTag.ResourceObjectType.Volume, map); + _resourceMetaDataMgr.addResourceMetaData("1", ResourceTag.ResourceObjectType.Volume, map, true); } diff --git a/server/test/com/cloud/network/MockFirewallManagerImpl.java b/server/test/com/cloud/network/MockFirewallManagerImpl.java index b3069763537..3c026135dab 100644 --- a/server/test/com/cloud/network/MockFirewallManagerImpl.java +++ b/server/test/com/cloud/network/MockFirewallManagerImpl.java @@ -185,7 +185,7 @@ public class MockFirewallManagerImpl extends ManagerBase implements FirewallMana } @Override - public FirewallRule updateFirewallRule(long ruleId, String customId) { + public FirewallRule updateFirewallRule(long ruleId, String customId, Boolean forDisplay) { // TODO Auto-generated method stub return null; } diff --git a/server/test/com/cloud/template/TemplateManagerImplTest.java b/server/test/com/cloud/template/TemplateManagerImplTest.java new file mode 100644 index 00000000000..bcbc3234746 --- /dev/null +++ b/server/test/com/cloud/template/TemplateManagerImplTest.java @@ -0,0 +1,37 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// + +package com.cloud.template; + +import org.junit.Test; + +import com.cloud.exception.InvalidParameterValueException; + +public class TemplateManagerImplTest { + + TemplateManagerImpl tmgr = new TemplateManagerImpl(); + + @Test(expected = InvalidParameterValueException.class) + public void testVerifyTemplateIdOfSystemTemplate() { + tmgr.verifyTemplateId(1L); + } + + public void testVerifyTemplateIdOfNonSystemTemplate() { + tmgr.verifyTemplateId(1L); + } +} diff --git a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java index 68390f87c71..ac303dddfcb 100644 --- a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java +++ b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java @@ -154,7 +154,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkOrches * @see com.cloud.network.NetworkService#allocateIP(com.cloud.user.Account, long, java.lang.Long) */ @Override - public IpAddress allocateIP(Account ipOwner, long zoneId, Long networkId) throws ResourceAllocationException, InsufficientAddressCapacityException, + public IpAddress allocateIP(Account ipOwner, long zoneId, Long networkId, Boolean displayIp) throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException { // TODO Auto-generated method stub return null; @@ -521,10 +521,9 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkOrches * @see com.cloud.network.NetworkManager#allocate(com.cloud.vm.VirtualMachineProfile, java.util.List) */ @Override - public void allocate(VirtualMachineProfile vm, LinkedHashMap networks) throws InsufficientCapacityException, - ConcurrentOperationException { + public void allocate(VirtualMachineProfile vm, LinkedHashMap> networks) + throws InsufficientCapacityException, ConcurrentOperationException { // TODO Auto-generated method stub - } /* (non-Javadoc) @@ -858,7 +857,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkOrches } @Override - public IpAddress updateIP(Long id, String customId) { + public IpAddress updateIP(Long id, String customId, Boolean displayIp) { // TODO Auto-generated method stub return null; } diff --git a/server/test/com/cloud/vpc/MockSite2SiteVpnManagerImpl.java b/server/test/com/cloud/vpc/MockSite2SiteVpnManagerImpl.java index 3815ed15201..b59c11a49de 100644 --- a/server/test/com/cloud/vpc/MockSite2SiteVpnManagerImpl.java +++ b/server/test/com/cloud/vpc/MockSite2SiteVpnManagerImpl.java @@ -259,13 +259,13 @@ public class MockSite2SiteVpnManagerImpl extends ManagerBase implements Site2Sit } @Override - public Site2SiteVpnConnection updateVpnConnection(long id, String customId) { + public Site2SiteVpnConnection updateVpnConnection(long id, String customId, Boolean forDisplay) { // TODO Auto-generated method stub return null; } @Override - public Site2SiteVpnGateway updateVpnGateway(Long id, String customId) { + public Site2SiteVpnGateway updateVpnGateway(Long id, String customId, Boolean forDisplay) { // TODO Auto-generated method stub return null; } diff --git a/server/test/com/cloud/vpc/NetworkACLManagerTest.java b/server/test/com/cloud/vpc/NetworkACLManagerTest.java index edf183e6271..f812a551a52 100644 --- a/server/test/com/cloud/vpc/NetworkACLManagerTest.java +++ b/server/test/com/cloud/vpc/NetworkACLManagerTest.java @@ -125,7 +125,7 @@ public class NetworkACLManagerTest extends TestCase { @Test public void testCreateACL() throws Exception { Mockito.when(_networkACLDao.persist(Matchers.any(NetworkACLVO.class))).thenReturn(acl); - assertNotNull(_aclMgr.createNetworkACL("acl_new", "acl desc", 1L)); + assertNotNull(_aclMgr.createNetworkACL("acl_new", "acl desc", 1L, true)); } @Test @@ -227,7 +227,7 @@ public class NetworkACLManagerTest extends TestCase { public void testUpdateACLItem() throws Exception { Mockito.when(_networkACLItemDao.findById(Matchers.anyLong())).thenReturn(aclItem); Mockito.when(_networkACLItemDao.update(Matchers.anyLong(), Matchers.any(NetworkACLItemVO.class))).thenReturn(true); - assertNotNull(_aclMgr.updateNetworkACLItem(1L, "UDP", null, NetworkACLItem.TrafficType.Ingress, "Deny", 10, 22, 32, null, null, null)); + assertNotNull(_aclMgr.updateNetworkACLItem(1L, "UDP", null, NetworkACLItem.TrafficType.Ingress, "Deny", 10, 22, 32, null, null, null, true)); } @Test(expected = CloudRuntimeException.class) diff --git a/server/test/com/cloud/vpc/NetworkACLServiceTest.java b/server/test/com/cloud/vpc/NetworkACLServiceTest.java index 786789fec77..5361639819a 100644 --- a/server/test/com/cloud/vpc/NetworkACLServiceTest.java +++ b/server/test/com/cloud/vpc/NetworkACLServiceTest.java @@ -22,6 +22,10 @@ import javax.inject.Inject; import junit.framework.TestCase; +import org.apache.cloudstack.api.command.user.network.CreateNetworkACLCmd; +import org.apache.cloudstack.context.CallContext; +import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; +import org.apache.cloudstack.test.utils.SpringUtils; import org.apache.log4j.Logger; import org.junit.After; import org.junit.Before; @@ -40,11 +44,6 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.support.AnnotationConfigContextLoader; -import org.apache.cloudstack.api.command.user.network.CreateNetworkACLCmd; -import org.apache.cloudstack.context.CallContext; -import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; -import org.apache.cloudstack.test.utils.SpringUtils; - import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.NetworkModel; import com.cloud.network.dao.NetworkDao; @@ -155,8 +154,8 @@ public class NetworkACLServiceTest extends TestCase { @Test public void testCreateACL() throws Exception { Mockito.when(_entityMgr.findById(Matchers.eq(Vpc.class), Matchers.anyLong())).thenReturn(new VpcVO()); - Mockito.when(_networkAclMgr.createNetworkACL("acl_new", "acl desc", 1L)).thenReturn(acl); - assertNotNull(_aclService.createNetworkACL("acl_new", "acl desc", 1L)); + Mockito.when(_networkAclMgr.createNetworkACL("acl_new", "acl desc", 1L, true)).thenReturn(acl); + assertNotNull(_aclService.createNetworkACL("acl_new", "acl desc", 1L, true)); } @Test(expected = InvalidParameterValueException.class) @@ -172,7 +171,8 @@ public class NetworkACLServiceTest extends TestCase { Mockito.when(_networkAclMgr.getNetworkACL(Matchers.anyLong())).thenReturn(acl); Mockito.when( _networkAclMgr.createNetworkACLItem(Matchers.anyInt(), Matchers.anyInt(), Matchers.anyString(), Matchers.anyList(), Matchers.anyInt(), Matchers.anyInt(), - Matchers.any(NetworkACLItem.TrafficType.class), Matchers.anyLong(), Matchers.anyString(), Matchers.anyInt())).thenReturn(new NetworkACLItemVO()); + Matchers.any(NetworkACLItem.TrafficType.class), Matchers.anyLong(), Matchers.anyString(), Matchers.anyInt(), Matchers.anyBoolean())).thenReturn( + new NetworkACLItemVO()); Mockito.when(_networkACLItemDao.findByAclAndNumber(Matchers.anyLong(), Matchers.anyInt())).thenReturn(null); assertNotNull(_aclService.createNetworkACLItem(createACLItemCmd)); } diff --git a/server/test/org/apache/cloudstack/network/lb/ApplicationLoadBalancerTest.java b/server/test/org/apache/cloudstack/network/lb/ApplicationLoadBalancerTest.java index e2bd9b225d0..32ac86cc0aa 100644 --- a/server/test/org/apache/cloudstack/network/lb/ApplicationLoadBalancerTest.java +++ b/server/test/org/apache/cloudstack/network/lb/ApplicationLoadBalancerTest.java @@ -244,7 +244,7 @@ public class ApplicationLoadBalancerTest extends TestCase { public void createValidLoadBalancer() throws InsufficientAddressCapacityException, InsufficientVirtualNetworkCapcityException, NetworkRuleConflictException { _appLbSvc.createApplicationLoadBalancer("alena", "alena", Scheme.Internal, validGuestNetworkId, validRequestedIp, 22, 22, "roundrobin", validGuestNetworkId, - validAccountId); + validAccountId, true); } @Test(expected = UnsupportedServiceException.class) @@ -252,7 +252,7 @@ public class ApplicationLoadBalancerTest extends TestCase { public void createPublicLoadBalancer() throws InsufficientAddressCapacityException, InsufficientVirtualNetworkCapcityException, NetworkRuleConflictException { _appLbSvc.createApplicationLoadBalancer("alena", "alena", Scheme.Public, validGuestNetworkId, validRequestedIp, 22, 22, "roundrobin", validGuestNetworkId, - validAccountId); + validAccountId, true); } @Test(expected = InvalidParameterValueException.class) @@ -260,7 +260,7 @@ public class ApplicationLoadBalancerTest extends TestCase { public void createWithInvalidSourcePort() throws InsufficientAddressCapacityException, InsufficientVirtualNetworkCapcityException, NetworkRuleConflictException { _appLbSvc.createApplicationLoadBalancer("alena", "alena", Scheme.Internal, validGuestNetworkId, validRequestedIp, 65536, 22, "roundrobin", validGuestNetworkId, - validAccountId); + validAccountId, true); } @Test(expected = InvalidParameterValueException.class) @@ -268,7 +268,7 @@ public class ApplicationLoadBalancerTest extends TestCase { public void createWithInvalidInstandePort() throws InsufficientAddressCapacityException, InsufficientVirtualNetworkCapcityException, NetworkRuleConflictException { _appLbSvc.createApplicationLoadBalancer("alena", "alena", Scheme.Internal, validGuestNetworkId, validRequestedIp, 22, 65536, "roundrobin", validGuestNetworkId, - validAccountId); + validAccountId, true); } @@ -278,7 +278,7 @@ public class ApplicationLoadBalancerTest extends TestCase { void createWithInvalidAlgorithm() throws InsufficientAddressCapacityException, InsufficientVirtualNetworkCapcityException, NetworkRuleConflictException { String expectedExcText = null; _appLbSvc.createApplicationLoadBalancer("alena", "alena", Scheme.Internal, validGuestNetworkId, validRequestedIp, 22, 22, "invalidalgorithm", - validGuestNetworkId, validAccountId); + validGuestNetworkId, validAccountId, true); } @@ -287,7 +287,7 @@ public class ApplicationLoadBalancerTest extends TestCase { public void createWithInvalidSourceIpNtwk() throws InsufficientAddressCapacityException, InsufficientVirtualNetworkCapcityException, NetworkRuleConflictException { _appLbSvc.createApplicationLoadBalancer("alena", "alena", Scheme.Internal, validPublicNetworkId, validRequestedIp, 22, 22, "roundrobin", validGuestNetworkId, - validAccountId); + validAccountId, true); } @@ -297,7 +297,7 @@ public class ApplicationLoadBalancerTest extends TestCase { void createWithInvalidRequestedIp() throws InsufficientAddressCapacityException, InsufficientVirtualNetworkCapcityException, NetworkRuleConflictException { _appLbSvc.createApplicationLoadBalancer("alena", "alena", Scheme.Internal, validGuestNetworkId, "10.2.1.1", 22, 22, "roundrobin", validGuestNetworkId, - validAccountId); + validAccountId, true); } private static NetworkVO setId(NetworkVO vo, long id) { diff --git a/services/console-proxy-rdp/rdpconsole/pom.xml b/services/console-proxy-rdp/rdpconsole/pom.xml index 05585a1027a..efcf7807574 100755 --- a/services/console-proxy-rdp/rdpconsole/pom.xml +++ b/services/console-proxy-rdp/rdpconsole/pom.xml @@ -58,7 +58,7 @@ junit junit - 3.8.1 + ${cs.junit.version} test @@ -516,10 +526,10 @@ - - - - + + + + diff --git a/ui/lib/jquery.validate.js b/ui/lib/jquery.validate.js index 72296a61f20..2ee39615091 100644 --- a/ui/lib/jquery.validate.js +++ b/ui/lib/jquery.validate.js @@ -260,23 +260,23 @@ $.extend($.validator, { }, messages: { - required: "This field is required.", - remote: "Please fix this field.", - email: "Please enter a valid email address.", - url: "Please enter a valid URL.", - date: "Please enter a valid date.", - dateISO: "Please enter a valid date (ISO).", - number: "Please enter a valid number.", - digits: "Please enter only digits.", - creditcard: "Please enter a valid credit card number.", - equalTo: "Please enter the same value again.", - accept: "Please enter a value with a valid extension.", - maxlength: $.validator.format("Please enter no more than {0} characters."), - minlength: $.validator.format("Please enter at least {0} characters."), - rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."), - range: $.validator.format("Please enter a value between {0} and {1}."), - max: $.validator.format("Please enter a value less than or equal to {0}."), - min: $.validator.format("Please enter a value greater than or equal to {0}.") + required: 'message.validate.fieldrequired', + remote: 'message.validate.fixfield', + email: 'message.validate.email.address', + url: 'message.validate.URL', + date: 'message.validate.date', + dateISO: 'message.validate.date.ISO', + number: 'message.validate.number', + digits: 'message.validate.digits', + creditcard: 'message.validate.creditcard', + equalTo: 'message.validate.equalto', + accept: 'message.validate.accept', + maxlength: $.validator.format('message.validate.maxlength'), + minlength: $.validator.format('message.validate.minlength'), + rangelength: $.validator.format('message.validate.range.length'), + range: $.validator.format('message.validate.range'), + max: $.validator.format('message.validate.max'), + min: $.validator.format('messgae.validate.min') }, autoCreateRanges: false, diff --git a/ui/scripts/accounts.js b/ui/scripts/accounts.js index a15cc87a7a6..aff780ef480 100644 --- a/ui/scripts/accounts.js +++ b/ui/scripts/accounts.js @@ -728,7 +728,7 @@ } }, vpcLimit: { - label: 'VPC limits', + label: 'label.VPC.limits', isEditable: function(context) { if (context.accounts[0].accounttype == roleTypeUser || context.accounts[0].accounttype == roleTypeDomainAdmin) //updateResourceLimits is only allowed on account whose type is user or domain-admin return true; diff --git a/ui/scripts/autoscaler.js b/ui/scripts/autoscaler.js index ab1b459e98c..c8963fd0659 100644 --- a/ui/scripts/autoscaler.js +++ b/ui/scripts/autoscaler.js @@ -25,7 +25,7 @@ // UI actions to appear in dialog autoscaleActions: { enable: { - label: 'Enable Autoscale', + label: 'label.enable.autoscale', action: function(args) { $.ajax({ url: createURL('enableAutoScaleVmGroup'), @@ -53,7 +53,7 @@ } }, disable: { - label: 'Disable Autoscale', + label: 'label.disable.autoscale', action: function(args) { $.ajax({ url: createURL('disableAutoScaleVmGroup'), @@ -328,7 +328,7 @@ }, minInstance: { - label: 'Min Instances', + label: 'label.min.instances', defaultValue: '3', validation: { required: true, @@ -337,7 +337,7 @@ }, maxInstance: { - label: 'Max Instances', + label: 'label.max.instances', defaultValue: '10', validation: { required: true, @@ -349,10 +349,10 @@ bottomFields: { isAdvanced: { isBoolean: true, - label: 'Show advanced settings' + label: 'label.show.advanced.settings' }, interval: { - label: 'Polling Interval (in sec)', + label: 'label.polling.interval.sec', defaultValue: '30', validation: { required: true, @@ -361,7 +361,7 @@ }, quietTime: { - label: 'Quiet Time (in sec)', + label: 'label.quiet.time.sec', defaultValue: '300', validation: { required: true, @@ -370,7 +370,7 @@ }, destroyVMgracePeriod: { - label: 'Destroy VM Grace Period', + label: 'label.destroy.vm.graceperiod', defaultValue: '30', isHidden: true, dependsOn: 'isAdvanced', @@ -442,7 +442,7 @@ snmpCommunity: { isHidden: true, dependsOn: 'isAdvanced', - label: 'SNMP Community', + label: 'label.SNMP.community', defaultValue: 'public', validation: { required: true @@ -452,7 +452,7 @@ snmpPort: { isHidden: true, dependsOn: 'isAdvanced', - label: 'SNMP Port', + label: 'label.SNMP.port', defaultValue: '161', validation: { required: true, @@ -463,7 +463,7 @@ username: { isHidden: true, dependsOn: 'isAdvanced', - label: 'User', + label: 'label.user', select: function(args) { var items = []; if (args.context.originalAutoscaleData == null) { //new LB rule @@ -1270,7 +1270,7 @@ if ('vpc' in args.context) { //from VPC section if (args.data.tier == null) { cloudStack.dialog.notice({ - message: 'Tier is required' + message: 'message.tier.required' }); return; } @@ -1429,7 +1429,7 @@ if (template && template[0].hypervisor === 'VMware') { cloudStack.dialog.confirm({ - message: 'For VMware-based VMs, please read the dynamic scaling section in the admin guide before scaling. Would you like to continue?,', + message: 'message.admin.guide.read', action: function() { //*** API calls start!!! ******** scaleUp(args); diff --git a/ui/scripts/cloudStack.js b/ui/scripts/cloudStack.js index 5195a7b817f..be7692de093 100644 --- a/ui/scripts/cloudStack.js +++ b/ui/scripts/cloudStack.js @@ -101,10 +101,16 @@ var clickAction = function() { $('#user-options a').eq(0).trigger('click'); }; + + if ($('.notification-box:visible').size()) { + $('.notification-box, div.overlay:first').remove(); + } + cloudStack.dialog.notice({ message: _l('label.session.expired'), clickAction: clickAction - }); + }).closest('.ui-dialog').overlay(); + return false; } } diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js index 6adbade76b0..869b876865c 100644 --- a/ui/scripts/configuration.js +++ b/ui/scripts/configuration.js @@ -522,7 +522,10 @@ memory: { label: 'label.memory.mb', converter: function(args) { - return cloudStack.converters.convertBytes(args * 1024 * 1024); + if (args == undefined) + return ''; + else + return cloudStack.converters.convertBytes(args * 1024 * 1024); } }, networkrate: { @@ -1038,7 +1041,10 @@ memory: { label: 'label.memory.mb', converter: function(args) { - return cloudStack.converters.convertBytes(args * 1024 * 1024); + if (args == undefined) + return ''; + else + return cloudStack.converters.convertBytes(args * 1024 * 1024); } }, networkrate: { diff --git a/ui/scripts/domains.js b/ui/scripts/domains.js index 5d8fd689bfb..488382e62a0 100644 --- a/ui/scripts/domains.js +++ b/ui/scripts/domains.js @@ -417,7 +417,7 @@ } }, vpcLimit: { - label: 'VPC limits', + label: 'label.VPC.limits', isEditable: function(args) { if (args.domains[0].id == g_domainid) //disallow to update the field on the domain you log in as return false; diff --git a/ui/scripts/installWizard.js b/ui/scripts/installWizard.js index dbea34e6bf6..25de4aaa0ad 100644 --- a/ui/scripts/installWizard.js +++ b/ui/scripts/installWizard.js @@ -287,7 +287,7 @@ response: { success: function(args) { var enableZone = function() { - message('Enabling zone...'); + message(dictionary['message.enabling.zone.dots']); cloudStack.zoneWizard.enableZoneAction({ data: args.data, formData: args.data, @@ -302,7 +302,7 @@ var pollSystemVMs = function() { // Poll System VMs, then enable zone - message('Creating system VMs (this may take a while)'); + message(dictionary['message.creating.systemVM']); var poll = setInterval(function() { $.ajax({ url: createURL('listSystemVms'), diff --git a/ui/scripts/instanceWizard.js b/ui/scripts/instanceWizard.js index 646ffbf5b19..3ee9af1b9e4 100644 --- a/ui/scripts/instanceWizard.js +++ b/ui/scripts/instanceWizard.js @@ -239,7 +239,11 @@ templates: templatesObj, hypervisors: hypervisorObjs }, - customHidden: function(args) { + customHidden: function(args) { + //// + return true; // Disabled -- not supported in backend right now + //// + if (selectedTemplateOrIso == 'select-template') { return false; //show Root Disk Size field } else { //selectedTemplateOrIso == 'select-iso' @@ -377,7 +381,7 @@ step6ContainerType = 'nothing-to-select'; $networkStep.find("#from_instance_page_1").hide(); $networkStep.find("#from_instance_page_2").hide(); - $networkStep.find("#from_vpc_tier").text("tier " + args.context.networks[0].name); + $networkStep.find("#from_vpc_tier").prepend("tier " + _s(args.context.networks[0].name)); $networkStep.find("#from_vpc_tier").show(); } else { //from Instance page if (selectedZoneObj.securitygroupsenabled != true) { // Advanced SG-disabled zone @@ -661,6 +665,7 @@ //step 6: select network if (step6ContainerType == 'select-network' || step6ContainerType == 'select-advanced-sg') { var array2 = []; + var array3 = []; var defaultNetworkId = args.data.defaultNetwork; //args.data.defaultNetwork might be equal to string "new-network" or a network ID var checkedNetworkIdArray; @@ -706,23 +711,62 @@ } //create new network ends here - //add default network first - if (defaultNetworkId != null && defaultNetworkId.length > 0) { - array2.push(defaultNetworkId); - } - //then, add other checked networks + if (defaultNetworkId == null) { + cloudStack.dialog.notice({ + message: "Please select a default network in Network step." + }); + return; + } + if (checkedNetworkIdArray.length > 0) { for (var i = 0; i < checkedNetworkIdArray.length; i++) { - if (checkedNetworkIdArray[i] != defaultNetworkId) //exclude defaultNetworkId that has been added to array2 + if (checkedNetworkIdArray[i] == defaultNetworkId) { + array2.unshift(defaultNetworkId); + + var ipToNetwork = { + networkid: defaultNetworkId + }; + if (args.data["new-network"] == "create-new-network") { + if (args.data['new-network-ip'] != null && args.data['new-network-ip'].length > 0) { + $.extend(ipToNetwork, { + ip: args.data['new-network-ip'] + }); + } + } else { + if (args.data["my-network-ips"][i] != null && args.data["my-network-ips"][i].length > 0) { + $.extend(ipToNetwork, { + ip: args.data["my-network-ips"][i] + }); + } + } + array3.unshift(ipToNetwork); + + } else { array2.push(checkedNetworkIdArray[i]); + + var ipToNetwork = { + networkid: checkedNetworkIdArray[i] + }; + if (args.data["my-network-ips"][i] != null && args.data["my-network-ips"][i].length > 0) { + $.extend(ipToNetwork, { + ip: args.data["my-network-ips"][i] + }); + } + array3.push(ipToNetwork); + } } } - $.extend(deployVmData, { - networkids : array2.join(",") - }); - + //deployVmData.push("&networkIds=" + array2.join(",")); //ipToNetworkMap can't be specified along with networkIds or ipAddress + + for (var k = 0; k < array3.length; k++) { + deployVmData["iptonetworklist[" + k + "].networkid"] = array3[k].networkid; + if (array3[k].ip != undefined && array3[k].ip.length > 0) { + deployVmData["iptonetworklist[" + k + "].ip"] = array3[k].ip; + } + } + } else if (step6ContainerType == 'select-security-group') { var checkedSecurityGroupIdArray; if (typeof(args.data["security-groups"]) == "object" && args.data["security-groups"].length != null) { //args.data["security-groups"] is an array of string, e.g. ["2375f8cc-8a73-4b8d-9b26-50885a25ffe0", "27c60d2a-de7f-4bb7-96e5-a602cec681df","c6301d77-99b5-4e8a-85e2-3ea2ab31c342"], @@ -773,10 +817,12 @@ }); } } else if (step6ContainerType == 'nothing-to-select') { - if (args.context.networks != null) { //from VPC tier - $.extend(deployVmData, { - networkids : args.context.networks[0].id - }); + if ("vpc" in args.context) { //from VPC tier + deployVmData["iptonetworklist[0].networkid"] = args.context.networks[0].id; + if (args.data["vpc-specify-ip"] != undefined && args.data["vpc-specify-ip"].length > 0) { + deployVmData["iptonetworklist[0].ip"] = args.data["vpc-specify-ip"]; + } + $.extend(deployVmData, { domainid : args.context.vpc[0].domainid }); diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js index cd18f83be55..53c9e98af98 100644 --- a/ui/scripts/instances.js +++ b/ui/scripts/instances.js @@ -148,19 +148,16 @@ }, fields: { name: { - label: 'label.name', - truncate: true + label: 'label.name' }, instancename: { label: 'label.internal.name' }, displayname: { - label: 'label.display.name', - truncate: true + label: 'label.display.name' }, zonename: { - label: 'label.zone.name', - truncate: true + label: 'label.zone.name' }, state: { label: 'label.state', @@ -574,7 +571,7 @@ compactLabel: 'label.destroy', createForm: { title: 'label.action.destroy.instance', - desc: 'Please confirm that you want to destroy this instance', + desc: 'label.action.destroy.instance', preFilter: function(args) { if (isAdmin() || isDomainAdmin()) { args.$form.find('.form-item[rel=expunge]').css('display', 'inline-block'); @@ -584,7 +581,7 @@ }, fields: { expunge: { - label: 'Expunge', + label: 'label.expunge', isBoolean: true, isChecked: false } @@ -698,18 +695,18 @@ } }, reset: { - label: 'Reset VM', - textLabel: 'Reset VM', + label: 'label.resetVM', + textLabel: 'label.resetVM', messages: { confirm: function(args) { - return 'Do you want to restore the VM ?'; + return 'message.restoreVM'; }, notification: function(args) { - return 'Reset VM'; + return 'label.resetVM'; }, complete: function(args) { if (args.password != null && args.password.length > 0) - return 'Password has been reset to ' + args.password; + return 'label.password.reset.confirm' + args.password; else return null; } @@ -745,7 +742,7 @@ }, changeAffinity: { - label: 'Change affinity', + label: 'label.change.affinity', action: { custom: cloudStack.uiCustom.affinity({ @@ -874,7 +871,7 @@ }, messages: { notification: function(args) { - return 'Change affinity'; + return 'label.change.affinity'; } }, notification: { @@ -1291,7 +1288,7 @@ }); } else { cloudStack.dialog.notice({ - message: _l('No Hosts are avaialble for Migration') + message: _l(dictionary['message.no.host.available']) }); //Only a single host in the set up } } @@ -1574,10 +1571,10 @@ }, messages: { confirm: function(args) { - return 'Do you really want to scale Up your instance ?'; + return 'message.instance.scaled.up.confirm'; }, notification: function(args) { - return 'Instance Scaled Up'; + return 'label.instance.scaled.up'; } }, notification: { @@ -1586,9 +1583,9 @@ }, assignVmToAnotherAccount: { - label: 'Assign Instance to Another Account', + label: 'label.assign.instance.another', createForm: { - title: 'Assign Instance to Another Account', + title: 'label.assign.instance.another', fields: { domainid: { label: 'label.domain', @@ -1646,7 +1643,7 @@ }, messages: { notification: function(args) { - return 'Assign Instance to Another Account'; + return 'label.assign.instance.another'; } }, notification: { @@ -1735,7 +1732,7 @@ }, isdynamicallyscalable: { - label: 'Dynamically Scalable', + label: 'label.dynamically.scalable', isBoolean: true, isEditable: true, converter: cloudStack.converters.toBooleanText @@ -1771,7 +1768,7 @@ }, xenserverToolsVersion61plus: { - label: 'XenServer Tools Version 6.1+', + label: 'label.Xenserver.Tools.Version61plus', isBoolean: true, isEditable: function () { if (isAdmin()) @@ -1895,18 +1892,18 @@ multiple: true, actions: { add: { - label: 'Add network to VM', + label: 'label.network.addVM', messages: { confirm: function(args) { - return 'Please confirm that you would like to add a new VM NIC for this network.'; + return 'message.network.addVMNIC'; }, notification: function(args) { - return 'Add network to VM'; + return 'label.network.addVM'; } }, createForm: { - title: 'Add network to VM', - desc: 'Please specify the network that you would like to add this VM to. A new NIC will be added for this network.', + title: 'label.network.addVM', + desc: 'message.network.addVM.desc', fields: { networkid: { label: 'label.network', @@ -1955,13 +1952,13 @@ }, makeDefault: { - label: 'Set default NIC', + label: 'label.set.default.NIC', messages: { confirm: function() { - return 'Please confirm that you would like to make this NIC the default for this VM.'; + return 'message.set.default.NIC'; }, notification: function(args) { - return 'Set default NIC' + return 'label.set.default.NIC' } }, action: function(args) { @@ -1978,7 +1975,7 @@ } }); cloudStack.dialog.notice({ - message: _l('Please manually update the default NIC on the VM now.') + message: _l(dictionary['message.set.default.NIC.manual']) }); } }); @@ -2022,14 +2019,14 @@ }, fields: [{ id: { - label: 'ID' + label: 'label.id' }, name: { label: 'label.name', header: true }, networkname: { - label: 'Network Name' + label: 'label.network.name' }, type: { label: 'label.type' @@ -2045,13 +2042,13 @@ }, ip6address: { - label: 'IPv6 IP Address' + label: 'label.ipv6.address' }, ip6gateway: { - label: 'IPv6 Gateway' + label: 'label.ipv6.gateway' }, ip6cidr: { - label: 'IPv6 CIDR' + label: 'label.ipv6.CIDR' }, isdefault: { diff --git a/ui/scripts/network.js b/ui/scripts/network.js index 0aa5473117c..6ce66e8da22 100755 --- a/ui/scripts/network.js +++ b/ui/scripts/network.js @@ -35,7 +35,8 @@ return elemData; }; - var instanceSecondaryIPSubselect = function(args) { + //value of Primary IP in subselect dropdown is -1, for single VM selection (API parameter virtualmachineid + vmguestip), e.g. enableStaticNat API, createPortForwardingRule API. + var singleVmSecondaryIPSubselect = function(args) { var instance = args.context.instances[0]; var network = args.context.networks[0]; @@ -116,6 +117,88 @@ }) }; + //value of Primary IP in subselect dropdown is itself (not -1), for multiple VM selection (API parameter vmidipmap), e.g. assignToLoadBalancerRule API. + var multipleVmSecondaryIPSubselect = function(args) { + var instance = args.context.instances[0]; + var network = args.context.networks[0]; + + if (args.context.ipAddresses[0].isportable) { + $.ajax({ + url: createURL('listNics'), + data: { + virtualmachineid: instance.id + }, + success: function(json) { + var nics = json.listnicsresponse.nic; + var ipSelection = []; + + $(nics).map(function(index, nic) { + var ips = nic.secondaryip ? nic.secondaryip : []; + var prefix = '[NIC ' + (index + 1) + '] '; + + // Add primary IP as default + ipSelection.push({ + id: nic.networkid + ',' + nic.ipaddress, + description: prefix + nic.ipaddress + ' (Primary)' + }); + + // Add secondary IPs + $(ips).map(function(index, ip) { + ipSelection.push({ + id: nic.networkid + ',' + ip.ipaddress, + description: prefix + ip.ipaddress + }); + }); + }); + + + args.response.success({ + data: ipSelection + }); + } + }); + + return; + } + + var nic = $.grep(instance.nic, function(nic) { + return nic.networkid == network.id; + })[0]; + + // Get NIC IPs + $.ajax({ + url: createURL('listNics'), + data: { + virtualmachineid: instance.id, + nicId: nic.id + }, + success: function(json) { + var nic = json.listnicsresponse.nic[0]; + var ips = nic.secondaryip ? nic.secondaryip : []; + var ipSelection = []; + + // Add primary IP as default + ipSelection.push({ + id: nic.ipaddress, + description: nic.ipaddress + ' (Primary)' + }); + + // Add secondary IPs + $(ips).map(function(index, ip) { + ipSelection.push({ + id: ip.ipaddress, + description: ip.ipaddress + }); + }); + + + args.response.success({ + data: ipSelection + }); + } + }) + }; + var ipChangeNotice = function() { cloudStack.dialog.confirm({ message: 'message.ip.address.changed', @@ -2386,7 +2469,7 @@ filters: false, subselect: { label: 'label.use.vm.ip', - dataProvider: instanceSecondaryIPSubselect + dataProvider: singleVmSecondaryIPSubselect }, dataProvider: function(args) { var data = { @@ -3232,6 +3315,15 @@ } }, filters: false, + + //when server-side change of adding new parameter "vmidipmap" to assignToLoadBalancerRule API is in, uncomment the following commented 4 lines. + /* + subselect: { + label: 'label.use.vm.ip', + dataProvider: multipleVmSecondaryIPSubselect + }, + */ + dataProvider: function(args) { var itemData = $.isArray(args.context.multiRule) && args.context.multiRule[0]['_itemData'] ? args.context.multiRule[0]['_itemData'] : []; @@ -3485,7 +3577,7 @@ }; var stickyData = $.extend(true, {}, args.data.sticky); - + $.ajax({ url: createURL('createLoadBalancerRule'), data: data, @@ -3495,17 +3587,44 @@ var itemData = args.itemData; var jobID = data.createloadbalancerruleresponse.jobid; var lbID = data.createloadbalancerruleresponse.id; - + + + var inputData = { + id: data.createloadbalancerruleresponse.id, + virtualmachineids: $.map(itemData, function(elem) { + return elem.id; + }).join(',') + }; + //when server-side change of adding new parameter "vmidipmap" to assignToLoadBalancerRule API is in, remove the above 6 lines and uncomment the commented section below. + + + /* + var inputData = { + id: data.createloadbalancerruleresponse.id + }; + if (args.context.ipAddresses[0].isportable) { + if (args.itemData != null) { + for (var k = 0; k < args.itemData.length; k++) { + inputData['vmidipmap[' + k + '].vmid'] = args.itemData[k].id; + inputData['vmidipmap[' + k + '].ip'] = args.itemData[k]._subselect.split(',')[1]; + } + } + + } else { + if (args.itemData != null) { + for (var k = 0; k < args.itemData.length; k++) { + inputData['vmidipmap[' + k + '].vmid'] = args.itemData[k].id; + inputData['vmidipmap[' + k + '].ip'] = args.itemData[k]._subselect; + } + } + } + */ + //http://localhost:8080/client/api?command=assignToLoadBalancerRule&response=json&sessionkey=M6I8h6gBXuEMeBMb4pjSDTjYprc=&id=da97bae5-9389-4bbb-aef3-ccca8408a852&vmidipmap[0].vmid=667d1450-3cd9-4670-b22e-aebb77f521a3&vmidipmap[0].ip=10.1.1.23&vmidipmap[1].vmid=5128d30b-7747-4a05-bdbc-6262191d7642&vmidipmap[1].ip=10.1.1.82&vmidipmap[2].vmid=48c61d00-28d2-4048-aed5-774289470804&vmidipmap[2].ip=10.1.1.5&_=1393451067671 + + $.ajax({ url: createURL('assignToLoadBalancerRule'), - data: { - id: data.createloadbalancerruleresponse.id, - virtualmachineids: $.map(itemData, function(elem) { - return elem.id; - }).join(',') - }, - dataType: 'json', - async: true, + data: inputData, success: function(data) { var jobID = data.assigntoloadbalancerruleresponse.jobid; var lbStickyCreated = false; @@ -3878,7 +3997,7 @@ filters: false, subselect: { label: 'label.use.vm.ip', - dataProvider: instanceSecondaryIPSubselect + dataProvider: singleVmSecondaryIPSubselect }, dataProvider: function(args) { var networkid; diff --git a/ui/scripts/regions.js b/ui/scripts/regions.js index ac573b74025..66dae8c1a17 100644 --- a/ui/scripts/regions.js +++ b/ui/scripts/regions.js @@ -277,27 +277,27 @@ label: 'label.name' }, gslbdomainname: { - label: 'GSLB Domain Name' + label: 'label.gslb.domain.name' }, gslblbmethod: { - label: 'Algorithm' + label: 'label.algorithm' } }, actions: { add: { - label: 'Add GSLB', + label: 'label.add.gslb', messages: { confirm: function(args) { - return 'Add GSLB'; + return 'label.add.gslb'; }, notification: function(args) { - return 'Add GSLB'; + return 'label.add.gslb'; } }, createForm: { - title: 'Add GSLB', + title: 'label.add.gslb', fields: { name: { label: 'label.name', @@ -309,13 +309,13 @@ label: 'label.description' }, gslbdomainname: { - label: 'GSLB Domain Name', + label: 'label.gslb.domain.name', validation: { required: true } }, gslblbmethod: { - label: 'Algorithm', + label: 'label.algorithm', select: function(args) { var array1 = [{ id: 'roundrobin', @@ -333,7 +333,7 @@ } }, gslbservicetype: { - label: 'Service Type', + label: 'label.gslb.servicetype', select: function(args) { var array1 = [{ id: 'tcp', @@ -351,7 +351,7 @@ } }, domainid: { - label: 'Domain', + label: 'label.domain', select: function(args) { if (isAdmin() || isDomainAdmin()) { $.ajax({ @@ -393,7 +393,7 @@ } }, account: { - label: 'Account', + label: 'label.account', isHidden: function(args) { if (isAdmin() || isDomainAdmin()) return false; @@ -470,7 +470,7 @@ }, detailView: { - name: 'GSLB details', + name: 'label.gslb.details', viewAll: { path: 'regions.lbUnderGSLB', label: 'assigned load balancing' @@ -502,13 +502,13 @@ } }, remove: { - label: 'delete GSLB', + label: 'label.gslb.delete', messages: { confirm: function(args) { - return 'Please confirm you want to delete this GSLB'; + return 'message.gslb.delete.confirm'; }, notification: function(args) { - return 'delete GSLB'; + return 'label.gslb.delete'; } }, action: function(args) { @@ -546,10 +546,10 @@ isEditable: true }, gslbdomainname: { - label: 'GSLB Domain Name' + label: 'label.gslb.domain.name' }, gslblbmethod: { - label: 'Algorithm', + label: 'label.algorithm', isEditable: true, select: function(args) { var array1 = [{ @@ -568,10 +568,10 @@ } }, gslbservicetype: { - label: 'Service Type' + label: 'label.gslb.servicetype' }, id: { - label: 'ID' + label: 'label.id' } }], dataProvider: function(args) { @@ -598,10 +598,10 @@ portableIpRanges: { id: 'portableIpRanges', type: 'select', - title: 'Portable IP Ranges', + title: 'label.portable.ip.ranges', listView: { id: 'portableIpRanges', - label: 'Portable IP Ranges', + label: 'label.portable.ip.ranges', fields: { startip: { label: 'label.start.IP' @@ -638,14 +638,14 @@ }, actions: { add: { - label: 'Add Portable IP Range', + label: 'label.add.portable.ip.range', messages: { notification: function(args) { - return 'Add Portable IP Range'; + return 'label.add.portable.ip.range'; } }, createForm: { - title: 'Add Portable IP Range', + title: 'label.add.portable.ip.range', fields: { startip: { label: 'label.start.IP', @@ -718,16 +718,16 @@ }, detailView: { - name: 'Portable IP Range details', + name: 'label.portable.ip.range.details', actions: { remove: { - label: 'Delete Portable IP Range', + label: 'label.delete.portable.ip.range', messages: { confirm: function(args) { - return 'Please confirm you want to delete Portable IP Range'; + return 'message.portable.ip.delete.confirm'; }, notification: function(args) { - return 'Delete Portable IP Range'; + return 'label.delete.portable.ip.range'; } }, action: function(args) { @@ -780,7 +780,7 @@ label: 'label.vlan' }, portableipaddress: { - label: 'Portable IPs', + label: 'label.portable.ips', converter: function(args) { var text1 = ''; if (args != null) { @@ -821,11 +821,11 @@ lbUnderGSLB: { id: 'lbUnderGSLB', type: 'select', - title: 'assigned load balancing', + title: 'label.gslb.assigned.lb', listView: { section: 'lbUnderGSLB', id: 'lbUnderGSLB', - label: 'assigned load balancing', + label: 'label.gslb.assigned.lb', fields: { name: { label: 'label.name' @@ -857,17 +857,17 @@ }, actions: { add: { - label: 'assign more load balancing', + label: 'label.gslb.assigned.lb.more', messages: { notification: function(args) { - return 'assign more load balancing'; + return 'label.gslb.assigned.lb.more'; } }, createForm: { - title: 'assign more load balancing', + title: 'label.gslb.assigned.lb.more', fields: { loadbalancerrule: { - label: 'load balancing rule', + label: 'label.gslb.lb.rule', select: function(args) { var data = { globalloadbalancerruleid: args.context.GSLB[0].id, @@ -934,16 +934,16 @@ }, detailView: { - name: 'load balancing details', + name: 'label.gslb.lb.details', actions: { remove: { - label: 'remove load balancing from this GSLB', + label: 'label.gslb.lb.remove', messages: { notification: function() { - return 'remove load balancing from GSLB'; + return 'label.gslb.lb.remove'; }, confirm: function() { - return 'Please confirm you want to remove load balancing from GSLB'; + return 'message.gslb.lb.remove.confirm'; } }, action: function(args) { diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js index b9dc2f37767..f0afea508cc 100644 --- a/ui/scripts/sharedFunctions.js +++ b/ui/scripts/sharedFunctions.js @@ -900,6 +900,9 @@ var roleTypeDomainAdmin = "2"; cloudStack.converters = { convertBytes: function(bytes) { + if (bytes == undefined) + return ''; + if (bytes < 1024 * 1024) { return (bytes / 1024).toFixed(2) + " KB"; } else if (bytes < 1024 * 1024 * 1024) { @@ -1253,7 +1256,7 @@ var processPropertiesInImagestoreObject = function(jsonObj) { url += 'cifs://'; } - url += (server + path + '?user=' + smbUsername + '&password=' + smbPassword + '&domain=' + smbDomain); + url += (server + path); return url; } @@ -1337,6 +1340,15 @@ var processPropertiesInImagestoreObject = function(jsonObj) { return url; } + function glusterURL(server, path) { + var url; + if (server.indexOf("://") == -1) + url = "gluster://" + server + path; + else + url = server + path; + return url; + } + //VM Instance diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 7832bef173b..c21e277cf8c 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -199,6 +199,16 @@ return allowedActions; }; + function ovsProviderActionFilter(args) { + var allowedActions = []; + var jsonObj = args.context.item; //args.context.item == nspMap["virtualRouter"] + if (jsonObj.state == "Enabled") + allowedActions.push("disable"); + else if (jsonObj.state == "Disabled") + allowedActions.push("enable"); + return allowedActions; + }; + cloudStack.sections.system = { title: 'label.menu.infrastructure', id: 'system', @@ -584,15 +594,15 @@ isEditable: true }, ovmnetworklabel: { - label: 'OVM traffic label', + label: 'label.ovm.traffic.label', isEditable: true }, lxcnetworklabel: { - label: 'LXC Traffic Label', + label: 'label.lxc.traffic.label', isEditable: true }, hypervnetworklabel: { - label: 'HyperV Traffic Label', + label: 'label.hyperv.traffic.label', isEditable: true } }], @@ -3908,6 +3918,120 @@ } }, + Ovs: { + id: "Ovs", + label: "Ovs", + isMaximized: true, + type: 'detailView', + fields: { + name: { + label: 'label.name' + }, + state: { + label: 'label.status', + indicator: { + 'Enabled': 'on' + } + } + }, + tabs: { + network: { + title: 'label.network', + fields: [{ + name: { + label: 'label.name' + } + }, { + state: { + label: 'label.state' + }, + supportedServices: { + label: 'label.supported.services' + }, + id: { + label: 'label.id' + }, + physicalnetworkid: { + label: 'label.physical.network.ID' + } + }], + dataProvider: function(args) { + refreshNspData("Ovs"); + args.response.success({ + actionFilter: ovsProviderActionFilter, + data: $.extend(nspMap["Ovs"], { + supportedServices: nspMap["Ovs"] == undefined? "": nspMap["Ovs"].servicelist.join(', ') + }) + }); + } + }, + }, + actions: { + enable: { + label: 'label.enable.provider', + action: function(args) { + $.ajax({ + url: createURL("updateNetworkServiceProvider&id=" + nspMap["Ovs"].id + "&state=Enabled"), + dataType: "json", + success: function(json) { + var jid = json.updatenetworkserviceproviderresponse.jobid; + args.response.success({ + _custom: { + jobId: jid, + getUpdatedItem: function(json) { + $(window).trigger('cloudStack.fullRefresh'); + } + } + }); + } + }); + }, + messages: { + confirm: function(args) { + return 'message.confirm.enable.provider'; + }, + notification: function() { + return 'label.enable.provider'; + } + }, + notification: { + poll: pollAsyncJobResult + } + }, + disable: { + label: 'label.disable.provider', + action: function(args) { + $.ajax({ + url: createURL("updateNetworkServiceProvider&id=" + nspMap["Ovs"].id + "&state=Disabled"), + dataType: "json", + success: function(json) { + var jid = json.updatenetworkserviceproviderresponse.jobid; + args.response.success({ + _custom: { + jobId: jid, + getUpdatedItem: function(json) { + $(window).trigger('cloudStack.fullRefresh'); + } + } + }); + } + }); + }, + messages: { + confirm: function(args) { + return 'message.confirm.disable.provider'; + }, + notification: function() { + return 'label.disable.provider'; + } + }, + notification: { + poll: pollAsyncJobResult + } + } + } + }, + // NetScaler provider detail view netscaler: { type: 'detailView', @@ -15171,6 +15295,10 @@ id: "clvm", description: "CLVM" }); + items.push({ + id: "gluster", + description: "Gluster" + }); args.response.success({ data: items }); @@ -15277,6 +15405,8 @@ $form.find('.form-item[rel=rbdpool]').hide(); $form.find('.form-item[rel=rbdid]').hide(); $form.find('.form-item[rel=rbdsecret]').hide(); + + $form.find('.form-item[rel=glustervolume]').hide(); } else if (protocol == "SMB") { //"SMB" show almost the same fields as "nfs" does, except 3 more SMB-specific fields. $form.find('.form-item[rel=server]').css('display', 'inline-block'); @@ -15302,6 +15432,8 @@ $form.find('.form-item[rel=rbdpool]').hide(); $form.find('.form-item[rel=rbdid]').hide(); $form.find('.form-item[rel=rbdsecret]').hide(); + + $form.find('.form-item[rel=glustervolume]').hide(); } else if (protocol == "ocfs2") { //ocfs2 is the same as nfs, except no server field. $form.find('.form-item[rel=server]').hide(); @@ -15327,6 +15459,8 @@ $form.find('.form-item[rel=rbdpool]').hide(); $form.find('.form-item[rel=rbdid]').hide(); $form.find('.form-item[rel=rbdsecret]').hide(); + + $form.find('.form-item[rel=glustervolume]').hide(); } else if (protocol == "PreSetup") { $form.find('.form-item[rel=server]').hide(); $form.find('.form-item[rel=server]').find(".value").find("input").val("localhost"); @@ -15351,6 +15485,8 @@ $form.find('.form-item[rel=rbdpool]').hide(); $form.find('.form-item[rel=rbdid]').hide(); $form.find('.form-item[rel=rbdsecret]').hide(); + + $form.find('.form-item[rel=glustervolume]').hide(); } else if (protocol == "iscsi") { $form.find('.form-item[rel=server]').css('display', 'inline-block'); $form.find('.form-item[rel=server]').find(".value").find("input").val(""); @@ -15373,6 +15509,8 @@ $form.find('.form-item[rel=rbdpool]').hide(); $form.find('.form-item[rel=rbdid]').hide(); $form.find('.form-item[rel=rbdsecret]').hide(); + + $form.find('.form-item[rel=glustervolume]').hide(); } else if ($(this).val() == "clvm") { $form.find('.form-item[rel=server]').hide(); $form.find('.form-item[rel=server]').find(".value").find("input").val("localhost"); @@ -15395,6 +15533,8 @@ $form.find('.form-item[rel=rbdpool]').hide(); $form.find('.form-item[rel=rbdid]').hide(); $form.find('.form-item[rel=rbdsecret]').hide(); + + $form.find('.form-item[rel=glustervolume]').hide(); } else if (protocol == "vmfs") { $form.find('.form-item[rel=server]').css('display', 'inline-block'); $form.find('.form-item[rel=server]').find(".value").find("input").val(""); @@ -15417,6 +15557,8 @@ $form.find('.form-item[rel=rbdpool]').hide(); $form.find('.form-item[rel=rbdid]').hide(); $form.find('.form-item[rel=rbdsecret]').hide(); + + $form.find('.form-item[rel=glustervolume]').hide(); } else if (protocol == "SharedMountPoint") { //"SharedMountPoint" show the same fields as "nfs" does. $form.find('.form-item[rel=server]').hide(); @@ -15442,6 +15584,8 @@ $form.find('.form-item[rel=rbdpool]').hide(); $form.find('.form-item[rel=rbdid]').hide(); $form.find('.form-item[rel=rbdsecret]').hide(); + + $form.find('.form-item[rel=glustervolume]').hide(); } else if (protocol == "rbd") { $form.find('.form-item[rel=rbdmonitor]').css('display', 'inline-block'); $form.find('.form-item[rel=rbdmonitor]').find(".name").find("label").text("RADOS Monitor:"); @@ -15466,6 +15610,33 @@ $form.find('.form-item[rel=smbUsername]').hide(); $form.find('.form-item[rel=smbPassword]').hide(); $form.find('.form-item[rel=smbDomain]').hide(); + + $form.find('.form-item[rel=glustervolume]').hide(); + } else if (protocol == "gluster") { + $form.find('.form-item[rel=server]').css('display', 'inline-block'); + $form.find('.form-item[rel=server]').find(".value").find("input"); + + $form.find('.form-item[rel=glustervolume]').css('display', 'inline-block'); + $form.find('.form-item[rel=glustervolume]').find(".name").find("label").text("Volume:"); + + $form.find('.form-item[rel=path]').hide(); + + $form.find('.form-item[rel=smbUsername]').hide(); + $form.find('.form-item[rel=smbPassword]').hide(); + $form.find('.form-item[rel=smbDomain]').hide(); + + $form.find('.form-item[rel=iqn]').hide(); + $form.find('.form-item[rel=lun]').hide(); + + $form.find('.form-item[rel=volumegroup]').hide(); + + $form.find('.form-item[rel=vCenterDataCenter]').hide(); + $form.find('.form-item[rel=vCenterDataStore]').hide(); + + $form.find('.form-item[rel=rbdmonitor]').hide(); + $form.find('.form-item[rel=rbdpool]').hide(); + $form.find('.form-item[rel=rbdid]').hide(); + $form.find('.form-item[rel=rbdsecret]').hide(); } else { $form.find('.form-item[rel=server]').css('display', 'inline-block'); $form.find('.form-item[rel=server]').find(".value").find("input").val(""); @@ -15486,6 +15657,8 @@ $form.find('.form-item[rel=smbUsername]').hide(); $form.find('.form-item[rel=smbPassword]').hide(); $form.find('.form-item[rel=smbDomain]').hide(); + + $form.find('.form-item[rel=glustervolume]').hide(); } }); @@ -15613,7 +15786,16 @@ }, isHidden: true }, - + + //gluster + glustervolume: { + label: 'label.gluster.volume', + validation: { + required: true + }, + isHidden: true + }, + //always appear (begin) storageTags: { label: 'label.storage.tags', @@ -15661,9 +15843,12 @@ } else if (args.data.protocol == "SMB") { var path = args.data.path; if (path.substring(0, 1) != "/") - path = "/" + path; - url = smbURL(server, path, args.data.smbUsername, args.data.smbPassword, args.data.smbDomain); - } else if (args.data.protocol == "PreSetup") { + path = "/" + path; + url = smbURL(server, path); + array1.push("&details[0].user=" + args.data.smbUsername); + array1.push("&details[1].password=" + todb(args.data.smbPassword)); + array1.push("&details[2].domain=" + args.data.smbDomain); + } else if (args.data.protocol == "PreSetup") { var path = args.data.path; if (path.substring(0, 1) != "/") path = "/" + path; @@ -15695,6 +15880,12 @@ path = "/" + path; path += "/" + args.data.vCenterDataStore; url = vmfsURL("dummy", path); + } else if (args.data.protocol == "gluster") { + var glustervolume = args.data.glustervolume; + + if (glustervolume.substring(0, 1) != "/") + glustervolume = "/" + glustervolume; + url = glusterURL(server, glustervolume); } else { var iqn = args.data.iqn; if (iqn.substring(0, 1) != "/") @@ -16058,16 +16249,16 @@ }, actions: { add: { - label: 'Add UCS Manager', + label: 'label.add.ucs.manager', messages: { notification: function (args) { - return 'Add UCS Manager'; + return 'label.add.ucs.manager'; } }, createForm: { - title: 'Add UCS Manager', + title: 'label.add.ucs.manager', fields: { name: { label: 'label.name', @@ -16900,8 +17091,7 @@ } }, //SMB (end) - - + //S3 (begin) accesskey: { label: 'label.s3.access_key', @@ -17065,12 +17255,17 @@ var zoneid = args.data.zoneid; var nfs_server = args.data.nfsServer; var path = args.data.path; - var url = smbURL(nfs_server, path, args.data.smbUsername, args.data.smbPassword, args.data.smbDomain); - + var url = smbURL(nfs_server, path); $.extend(data, { provider: args.data.provider, zoneid: zoneid, - url: url + url: url, + 'details[0].key': 'user', + 'details[0].value': args.data.smbUsername, + 'details[1].key': 'password', + 'details[1].value': args.data.smbPassword, + 'details[2].key': 'domain', + 'details[2].value': args.data.smbDomain }); $.ajax({ @@ -18931,6 +19126,9 @@ case "VpcVirtualRouter": nspMap[ "vpcVirtualRouter"] = items[i]; break; + case "Ovs": + nspMap["Ovs"] = items[i]; + break; case "Netscaler": nspMap[ "netscaler"] = items[i]; break; @@ -19060,6 +19258,12 @@ state: nspMap.pa ? nspMap.pa.state: 'Disabled' }); } + + nspHardcodingArray.push({ + id: "Ovs", + name: "Ovs", + state: nspMap.Ovs ? nspMap.Ovs.state : 'Disabled' + }); }; cloudStack.actionFilter.physicalNetwork = function (args) { diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js index 8c63ce2b678..35516130482 100644 --- a/ui/scripts/templates.js +++ b/ui/scripts/templates.js @@ -63,10 +63,10 @@ advSearchFields: { name: { - label: 'Name' + label: 'label.name' }, zoneid: { - label: 'Zone', + label: 'label.zone', select: function(args) { $.ajax({ url: createURL('listZones'), @@ -706,14 +706,14 @@ //do nothing } else if (result.jobstatus == 2) { cloudStack.dialog.notice({ - message: "Failed to update XenServer Tools Version 6.1+ field. Error: " + _s(result.jobresult.errortext) + message: "message.XSTools61plus.update.failed" + " " + _s(result.jobresult.errortext) }); } } }, error: function(XMLHttpResponse) { cloudStack.dialog.notice({ - message: "Failed to update XenServer Tools Version 6.1+ field. Error: " + parseXMLHttpResponse(XMLHttpResponse) + message: "message.XSTools61plus.update.failed" + " " + parseXMLHttpResponse(XMLHttpResponse) }); } }); @@ -749,10 +749,10 @@ label: 'label.action.copy.template', messages: { confirm: function(args) { - return 'Are you sure you want to copy template?'; + return 'message.copy.template.confirm'; }, success: function(args) { - return 'Template is being copied.'; + return 'message.template.copying'; }, notification: function(args) { return 'label.action.copy.template'; @@ -837,7 +837,7 @@ return 'message.action.download.template'; }, notification: function(args) { - return 'Downloading template'; + return 'message.action.downloading.template'; }, complete: function(args) { var url = args.url; @@ -938,23 +938,15 @@ required: true } } - }, { - id: { - label: 'ID' + }, { + isready: { + label: 'state.ready', + converter: cloudStack.converters.toBooleanText }, - zonename: { - label: 'label.zone.name' - }, - zoneid: { - label: 'label.zone.id' - }, - displaytext: { - label: 'label.description', - isEditable: true, - validation: { - required: true - } + status: { + label: 'label.status' }, + hypervisor: { label: 'label.hypervisor' }, @@ -968,17 +960,8 @@ return false; }, converter: cloudStack.converters.toBooleanText - }, - templatetype: { - label: 'label.type' - }, - isready: { - label: 'state.ready', - converter: cloudStack.converters.toBooleanText - }, - status: { - label: 'label.status' - }, + }, + size: { label: 'label.size', converter: function(args) { @@ -1036,12 +1019,8 @@ return false; }, converter: cloudStack.converters.toBooleanText - }, - crossZones: { - label: 'label.cross.zones', - converter: cloudStack.converters.toBooleanText - }, - + }, + ostypeid: { label: 'label.os.type', isEditable: true, @@ -1067,6 +1046,21 @@ } }, + zonename: { + label: 'label.zone.name' + }, + crossZones: { + label: 'label.cross.zones', + converter: cloudStack.converters.toBooleanText + }, + displaytext: { + label: 'label.description', + isEditable: true, + validation: { + required: true + } + }, + domain: { label: 'label.domain' }, @@ -1076,6 +1070,17 @@ created: { label: 'label.created', converter: cloudStack.converters.toLocalDate + }, + + templatetype: { + label: 'label.type' + }, + + id: { + label: 'label.id' + }, + zoneid: { + label: 'label.zone.id' } }], @@ -1350,10 +1355,10 @@ advSearchFields: { name: { - label: 'Name' + label: 'label.name' }, zoneid: { - label: 'Zone', + label: 'label.zone', select: function(args) { $.ajax({ url: createURL('listZones'), @@ -1376,10 +1381,10 @@ } }, tagKey: { - label: 'Tag Key' + label: 'label.tag.key' }, tagValue: { - label: 'Tag Value' + label: 'label.tag.value' } }, diff --git a/ui/scripts/ui-custom/accountsWizard.js b/ui/scripts/ui-custom/accountsWizard.js index f2017f8c04c..5ef0fa96b3a 100644 --- a/ui/scripts/ui-custom/accountsWizard.js +++ b/ui/scripts/ui-custom/accountsWizard.js @@ -132,17 +132,32 @@ success: function(json) { if (json.ldapuserresponse.count > 0) { $(json.ldapuserresponse.LdapUser).each(function() { - var result = $(""); - result.append(""); - result.append(""); - result.append(""); - result.append(""); - $table.append(result); + var $result = $(''); + + $result.append( + $('"); - result.append(""); - $table.append(result); + var $result = $(''); + + $result.append( + $('
SelectRealnameUsernameEmail
" + this.firstname + " " + this.lastname + "" + this.username + "" + this.email + "
').addClass('select').append( + $('').attr({ + type: 'checkbox', name: 'username', value: this.username + }) + ), + $('').addClass('name').html(this.firstname + ' ' + this.lastname) + .attr('title', this.firstname + ' ' + this.lastname), + $('').addClass('username').html(this.username) + .attr('title', this.username), + $('').addClass('email').html(this.email) + .attr('title', this.email) + ) + + $table.append($result); }); } else { - var result = $("
No data to show
').attr('colspan', 4).html(_l('label.no.data')) + ); + + $table.append($result); } } }); diff --git a/ui/scripts/ui-custom/instanceWizard.js b/ui/scripts/ui-custom/instanceWizard.js index d5203c84d9c..8884ebe6ec8 100644 --- a/ui/scripts/ui-custom/instanceWizard.js +++ b/ui/scripts/ui-custom/instanceWizard.js @@ -45,6 +45,20 @@ var data = cloudStack.serializeForm($form); var $wizardLoading = $('
').addClass('loading-overlay').appendTo($wizard).css('z-index', '10000'); + // Pass network IPs + data['my-network-ips'] = []; + $form.find('.my-networks .select .specify-ip input[type=text]').each(function() { + var $input = $(this); + + if (!$input.closest('.select').find('input[type=checkbox]').is(':checked')) return true; + + data['my-network-ips'].push( + $input.closest('.select').hasClass('advanced') ? + $input.val() : null + ); + }); + data['new-network-ip'] = $form.find('.new-network .select.advanced .specify-ip input[type=text]').val(); + args.action({ // Populate data context: context, @@ -770,6 +784,26 @@ }) ); + // Add IP/advanced option fields + $step.find('.my-networks .select-container .select, .select.new-network .select').each(function () { + var $select = $(this); + var $advancedLink = $('
').addClass('advanced-options hide-if-unselected'); + var $specifyIpField = $('
').addClass('specify-ip hide-if-unselected').append( + $('