mirror of https://github.com/apache/cloudstack.git
=initial changes
This commit is contained in:
parent
08f6a24d19
commit
d1642a489c
|
|
@ -166,6 +166,9 @@ public class EventTypes {
|
|||
public static final String EVENT_VOLUME_UPLOAD = "VOLUME.UPLOAD";
|
||||
public static final String EVENT_VOLUME_MIGRATE = "VOLUME.MIGRATE";
|
||||
public static final String EVENT_VOLUME_RESIZE = "VOLUME.RESIZE";
|
||||
public static final String EVENT_VOLUME_DETAIL_UPDATE = "VOLUME.DETAIL.UPDATE";
|
||||
public static final String EVENT_VOLUME_DETAIL_ADD = "VOLUME.DETAIL.ADD";
|
||||
public static final String EVENT_VOLUME_DETAIL_REMOVE = "VOLUME.DETAIL.REMOVE";
|
||||
|
||||
// Domains
|
||||
public static final String EVENT_DOMAIN_CREATE = "DOMAIN.CREATE";
|
||||
|
|
|
|||
|
|
@ -319,6 +319,8 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
|
|||
|
||||
boolean getSpecifyIpRanges();
|
||||
|
||||
boolean getDisplayNetwork();
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ public class NetworkProfile implements Network {
|
|||
private boolean restartRequired;
|
||||
private boolean specifyIpRanges;
|
||||
private Long vpcId;
|
||||
private boolean displayNetwork;
|
||||
|
||||
public NetworkProfile(Network network) {
|
||||
this.id = network.getId();
|
||||
|
|
@ -81,6 +82,7 @@ public class NetworkProfile implements Network {
|
|||
this.restartRequired = network.isRestartRequired();
|
||||
this.specifyIpRanges = network.getSpecifyIpRanges();
|
||||
this.vpcId = network.getVpcId();
|
||||
this.displayNetwork = network.getDisplayNetwork();
|
||||
}
|
||||
|
||||
public String getDns1() {
|
||||
|
|
@ -231,6 +233,11 @@ public class NetworkProfile implements Network {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getDisplayNetwork() {
|
||||
return displayNetwork;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getVpcId() {
|
||||
return vpcId;
|
||||
|
|
|
|||
|
|
@ -18,12 +18,7 @@
|
|||
*/
|
||||
package com.cloud.storage;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.MigrateVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.UploadVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.*;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
|
|
@ -79,4 +74,10 @@ public interface VolumeApiService {
|
|||
Volume attachVolumeToVM(AttachVolumeCmd command);
|
||||
|
||||
Volume detachVolumeFromVM(DetachVolumeCmd cmmd);
|
||||
|
||||
void updateVolumeDetails(UpdateVolumeDetailCmd updateVolumeDetailCmd);
|
||||
|
||||
void removeVolumeDetail(RemoveVolumeDetailCmd removeVolumeDetailCmd);
|
||||
|
||||
void addVolumeDetail(AddVolumeDetailCmd addVolumeDetailCmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
package com.cloud.storage;
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: nitinmehta
|
||||
* Date: 24/04/13
|
||||
* Time: 5:55 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public interface VolumeDetail extends ControlledEntity, InternalIdentity, Identity {
|
||||
|
||||
}
|
||||
|
|
@ -177,7 +177,10 @@ public interface UserVmService {
|
|||
* TODO
|
||||
* @param defaultIp
|
||||
* TODO
|
||||
* @param displayVm
|
||||
* - Boolean flag whether to the display the vm to the end user or not
|
||||
* @param affinityGroupIdList
|
||||
*
|
||||
* @param accountName
|
||||
* - an optional account for the virtual machine. Must be used
|
||||
* with domainId
|
||||
|
|
@ -197,9 +200,9 @@ public interface UserVmService {
|
|||
* @throws InsufficientResourcesException
|
||||
*/
|
||||
UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> securityGroupIdList, Account owner, String hostName,
|
||||
String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
|
||||
String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
|
||||
HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps,
|
||||
IpAddresses defaultIp, String keyboard, List<Long> affinityGroupIdList)
|
||||
IpAddresses defaultIp, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList)
|
||||
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
|
||||
|
||||
/**
|
||||
|
|
@ -250,7 +253,10 @@ public interface UserVmService {
|
|||
* TODO
|
||||
* @param defaultIps
|
||||
* TODO
|
||||
* @param displayVm
|
||||
* - Boolean flag whether to the display the vm to the end user or not
|
||||
* @param affinityGroupIdList
|
||||
*
|
||||
* @param accountName
|
||||
* - an optional account for the virtual machine. Must be used
|
||||
* with domainId
|
||||
|
|
@ -270,8 +276,8 @@ public interface UserVmService {
|
|||
* @throws InsufficientResourcesException
|
||||
*/
|
||||
UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, List<Long> securityGroupIdList,
|
||||
Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData, String sshKeyPair,
|
||||
Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, String keyboard, List<Long> affinityGroupIdList)
|
||||
Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData, String sshKeyPair,
|
||||
Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList)
|
||||
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
|
||||
|
||||
/**
|
||||
|
|
@ -319,7 +325,10 @@ public interface UserVmService {
|
|||
* TODO
|
||||
* @param defaultIps
|
||||
* TODO
|
||||
* @param displayVm
|
||||
* - Boolean flag whether to the display the vm to the end user or not
|
||||
* @param affinityGroupIdList
|
||||
*
|
||||
* @param accountName
|
||||
* - an optional account for the virtual machine. Must be used
|
||||
* with domainId
|
||||
|
|
@ -340,8 +349,9 @@ public interface UserVmService {
|
|||
*/
|
||||
UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, Account owner, String hostName,
|
||||
String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
|
||||
HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps,
|
||||
IpAddresses defaultIps, String keyboard, List<Long> affinityGroupIdList)
|
||||
HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps,
|
||||
IpAddresses defaultIps, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList)
|
||||
|
||||
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -56,7 +56,11 @@ public class ApiConstants {
|
|||
public static final String DISK_OFFERING_ID = "diskofferingid";
|
||||
public static final String DISK_SIZE = "disksize";
|
||||
public static final String DISPLAY_NAME = "displayname";
|
||||
public static final String DISPLAY_NETWORK = "displaynetwork";
|
||||
public static final String DISPLAY_TEXT = "displaytext";
|
||||
public static final String DISPLAY_VM = "displayvm";
|
||||
public static final String DISPLAY_OFFERING = "displayoffering";
|
||||
public static final String DISPLAY_VOLUME = "displayvolume";
|
||||
public static final String DNS1 = "dns1";
|
||||
public static final String DNS2 = "dns2";
|
||||
public static final String IP6_DNS1 = "ip6dns1";
|
||||
|
|
|
|||
|
|
@ -62,7 +62,10 @@ public class CreateDiskOfferingCmd extends BaseCmd {
|
|||
@Parameter(name=ApiConstants.STORAGE_TYPE, type=CommandType.STRING, description="the storage type of the disk offering. Values are local and shared.")
|
||||
private String storageType = ServiceOffering.StorageType.shared.toString();
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
@Parameter(name=ApiConstants.DISPLAY_OFFERING, type=CommandType.BOOLEAN, description="an optional field, whether to display the offering to the end user or not.")
|
||||
private Boolean displayOffering;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
|
@ -94,6 +97,10 @@ public class CreateDiskOfferingCmd extends BaseCmd {
|
|||
return storageType;
|
||||
}
|
||||
|
||||
public Boolean getDisplayOffering() {
|
||||
return displayOffering;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -0,0 +1,116 @@
|
|||
// 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.api.command.user.network;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.NicResponse;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import org.apache.cloudstack.api.response.VolumeResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
||||
@APICommand(name = "addNicDetail", description="Adds detail for the volume.", since="4.2", responseObject=SuccessResponse.class)
|
||||
public class AddNicDetailCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(AddNicDetailCmd.class.getName());
|
||||
private static final String s_name = "addNicDetailresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=NicResponse.class,
|
||||
required=true, description="the ID of the nic")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING,
|
||||
required=true, description="the name of the field")
|
||||
private String name;
|
||||
|
||||
@Parameter(name=ApiConstants.VALUE, type=CommandType.STRING,
|
||||
required=true, description="the value of the field")
|
||||
private String value;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Volume;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Volume volume = _responseGenerator.findVolumeById(getId());
|
||||
if (volume == null) {
|
||||
return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
|
||||
}
|
||||
return volume.getAccountId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_VOLUME_ATTACH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "adding detail to the nic: " + getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
_networkService.addNicDetail(this);
|
||||
this.setResponseObject(new SuccessResponse(getCommandName()));
|
||||
}
|
||||
}
|
||||
|
|
@ -126,6 +126,9 @@ public class CreateNetworkCmd extends BaseCmd {
|
|||
@Parameter(name=ApiConstants.IP6_CIDR, type=CommandType.STRING, description="the CIDR of IPv6 network, must be at least /64")
|
||||
private String ip6Cidr;
|
||||
|
||||
@Parameter(name=ApiConstants.DISPLAY_NETWORK, type=CommandType.BOOLEAN, description="an optional field, whether to the display the network to the end user or not.")
|
||||
private Boolean displayNetwork;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -189,6 +192,10 @@ public class CreateNetworkCmd extends BaseCmd {
|
|||
return vpcId;
|
||||
}
|
||||
|
||||
public Boolean getDisplayNetwork() {
|
||||
return displayNetwork;
|
||||
}
|
||||
|
||||
public Long getZoneId() {
|
||||
Long physicalNetworkId = getPhysicalNetworkId();
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,117 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for removeitional 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.api.command.user.network;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.NicResponse;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import org.apache.cloudstack.api.response.VolumeResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
||||
@APICommand(name = "removeNicDetail", description="Removes detail for the volume.", since="4.2", responseObject=SuccessResponse.class)
|
||||
public class RemoveNicDetailCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(RemoveNicDetailCmd.class.getName());
|
||||
private static final String s_name = "removeNicDetailresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=NicResponse.class,
|
||||
required=true, description="the ID of the nic")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING,
|
||||
required=true, description="the name of the field")
|
||||
private String name;
|
||||
|
||||
@Parameter(name=ApiConstants.VALUE, type=CommandType.STRING,
|
||||
required=true, description="the value of the field")
|
||||
private String value;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Volume;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Volume volume = _responseGenerator.findVolumeById(getId());
|
||||
if (volume == null) {
|
||||
return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
|
||||
}
|
||||
return volume.getAccountId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_VOLUME_ATTACH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "removing detail to the nic: " + getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
UserContext.current().setEventDetails("Nic Id: "+getId());
|
||||
_networkService.removeNicDetail(this);
|
||||
this.setResponseObject(new SuccessResponse(getCommandName()));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for updateitional 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.api.command.user.network;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.NicResponse;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import org.apache.cloudstack.api.response.VolumeResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
||||
@APICommand(name = "updateNicDetail", description="Updates detail for the nic.", since="4.2", responseObject=SuccessResponse.class)
|
||||
public class UpdateNicDetailCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(UpdateNicDetailCmd.class.getName());
|
||||
private static final String s_name = "updateNicDetailresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=NicResponse.class,
|
||||
required=true, description="the ID of the nic")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING,
|
||||
required=true, description="the name of the field")
|
||||
private String name;
|
||||
|
||||
@Parameter(name=ApiConstants.VALUE, type=CommandType.STRING,
|
||||
required=true, description="the value of the field")
|
||||
private String value;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Volume;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Volume volume = _responseGenerator.findVolumeById(getId());
|
||||
if (volume == null) {
|
||||
return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
|
||||
}
|
||||
return volume.getAccountId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_VOLUME_ATTACH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "updating detail to the nic: " + getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
_networkService.updateNicDetail(this);
|
||||
this.setResponseObject(new SuccessResponse(getCommandName()));
|
||||
}
|
||||
}
|
||||
|
|
@ -183,6 +183,8 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
|
|||
+ "Mutually exclusive with affinitygroupids parameter")
|
||||
private List<String> 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.")
|
||||
private Boolean displayVm;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
|
|
@ -219,6 +221,10 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
|
|||
return HypervisorType.getType(hypervisor);
|
||||
}
|
||||
|
||||
public Boolean getDisplayVm() {
|
||||
return displayVm;
|
||||
}
|
||||
|
||||
public List<Long> getSecurityGroupIdList() {
|
||||
if (securityGroupNameList != null && securityGroupIdList != null) {
|
||||
throw new InvalidParameterValueException("securitygroupids parameter is mutually exclusive with securitygroupnames parameter");
|
||||
|
|
@ -481,18 +487,20 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
|
|||
throw new InvalidParameterValueException("Can't specify network Ids in Basic zone");
|
||||
} else {
|
||||
vm = _userVmService.createBasicSecurityGroupVirtualMachine(zone, serviceOffering, template, getSecurityGroupIdList(), owner, name,
|
||||
displayName, diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard, getAffinityGroupIdList());
|
||||
displayName, diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList());
|
||||
}
|
||||
} else {
|
||||
if (zone.isSecurityGroupEnabled()) {
|
||||
vm = _userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, template, getNetworkIds(), getSecurityGroupIdList(),
|
||||
owner, name, displayName, diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard, getAffinityGroupIdList());
|
||||
owner, name, displayName, diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList());
|
||||
|
||||
} else {
|
||||
if (getSecurityGroupIdList() != null && !getSecurityGroupIdList().isEmpty()) {
|
||||
throw new InvalidParameterValueException("Can't create vm with security groups; security group feature is not enabled per zone");
|
||||
}
|
||||
vm = _userVmService.createAdvancedVirtualMachine(zone, serviceOffering, template, getNetworkIds(), owner, name, displayName,
|
||||
diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard, getAffinityGroupIdList());
|
||||
diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,8 @@ public class UpdateVMCmd extends BaseCmd{
|
|||
@Parameter(name=ApiConstants.USER_DATA, type=CommandType.STRING, description="an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded before adding it to the request. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding. Using HTTP POST(via POST body), you can send up to 32K of data after base64 encoding.", 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.")
|
||||
private Boolean displayVm;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
|
|
@ -89,6 +91,10 @@ public class UpdateVMCmd extends BaseCmd{
|
|||
return userData;
|
||||
}
|
||||
|
||||
public Boolean getDisplayVm() {
|
||||
return displayVm;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -107,6 +113,7 @@ public class UpdateVMCmd extends BaseCmd{
|
|||
}
|
||||
|
||||
@Override
|
||||
|
||||
public long getEntityOwnerId() {
|
||||
UserVm userVm = _entityMgr.findById(UserVm.class, getId());
|
||||
if (userVm != null) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,115 @@
|
|||
// 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.api.command.user.volume;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import org.apache.cloudstack.api.response.VolumeResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
||||
@APICommand(name = "addVolumeDetail", description="Adds detail for the volume.", responseObject=SuccessResponse.class)
|
||||
public class AddVolumeDetailCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(AddVolumeDetailCmd.class.getName());
|
||||
private static final String s_name = "addVolumeDetailresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VolumeResponse.class,
|
||||
required=true, description="the ID of the disk volume")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING,
|
||||
required=true, description="the name of the field")
|
||||
private String name;
|
||||
|
||||
@Parameter(name=ApiConstants.VALUE, type=CommandType.STRING,
|
||||
required=true, description="the value of the field")
|
||||
private String value;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Volume;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Volume volume = _responseGenerator.findVolumeById(getId());
|
||||
if (volume == null) {
|
||||
return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
|
||||
}
|
||||
return volume.getAccountId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_VOLUME_DETAIL_ADD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "adding detail to the volume: " + getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
_volumeService.addVolumeDetail(this);
|
||||
this.setResponseObject(new SuccessResponse(getCommandName()));
|
||||
}
|
||||
}
|
||||
|
|
@ -76,8 +76,10 @@ public class CreateVolumeCmd extends BaseAsyncCreateCmd {
|
|||
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.")
|
||||
private Boolean displayVolume;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
|
@ -114,6 +116,10 @@ public class CreateVolumeCmd extends BaseAsyncCreateCmd {
|
|||
return projectId;
|
||||
}
|
||||
|
||||
public Boolean getDisplayVolume() {
|
||||
return displayVolume;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
package org.apache.cloudstack.api.command.user.volume;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: nitinmehta
|
||||
* Date: 24/04/13
|
||||
* Time: 5:18 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class ListVolumeDetailCmd {
|
||||
}
|
||||
|
|
@ -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 org.apache.cloudstack.api.command.user.volume;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.response.*;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.async.AsyncJob;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@APICommand(name = "listVolumeDetails", description="Lists all volume details.", responseObject=VolumeDetailResponse.class)
|
||||
public class ListVolumeDetailsCmd extends BaseListTaggedResourcesCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListVolumesCmd.class.getName());
|
||||
|
||||
private static final String s_name = "listvolumedetailsresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VolumeResponse.class,
|
||||
required=true, description="the ID of the volume")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the volume detail")
|
||||
private String name;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Volume;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
ListResponse<VolumeDetailResponse> responses = new ListResponse<VolumeDetailResponse>();
|
||||
List<VolumeDetailResponse> volumeDetailList = _queryService.searchForVolumeDetails(this);
|
||||
responses.setResponses(volumeDetailList);
|
||||
responses.setResponseName(getCommandName());
|
||||
this.setResponseObject(responses);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
// 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.api.command.user.volume;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import org.apache.cloudstack.api.response.VolumeResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
||||
@APICommand(name = "removeVolumeDetail", description="Remove a particular detail for the volume.", responseObject=VolumeResponse.class)
|
||||
public class RemoveVolumeDetailCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(AttachVolumeCmd.class.getName());
|
||||
private static final String s_name = "removeVolumeDetailresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VolumeResponse.class,
|
||||
required=true, description="the ID of the disk volume")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING,
|
||||
required=true, description="the name of the field")
|
||||
private String name;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Volume;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Volume volume = _responseGenerator.findVolumeById(getId());
|
||||
if (volume == null) {
|
||||
return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
|
||||
}
|
||||
return volume.getAccountId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_VOLUME_ATTACH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "adding detail to the volume: " + getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
_volumeService.removeVolumeDetail(this);
|
||||
this.setResponseObject(new SuccessResponse(getCommandName()));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
// 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.api.command.user.volume;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import org.apache.cloudstack.api.response.VolumeResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
||||
@APICommand(name = "updateVolumeDetail", description="Updates the volume.", responseObject=VolumeResponse.class)
|
||||
public class UpdateVolumeCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(AttachVolumeCmd.class.getName());
|
||||
private static final String s_name = "addVolumeDetailresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VolumeResponse.class,
|
||||
required=true, description="the ID of the disk volume")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING,
|
||||
required=true, description="the name of the field")
|
||||
private String name;
|
||||
|
||||
@Parameter(name=ApiConstants.VALUE, type=CommandType.STRING, entityType=UserVmResponse.class,
|
||||
required=true, description="the value of the field")
|
||||
private String value;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Volume;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Volume volume = _responseGenerator.findVolumeById(getId());
|
||||
if (volume == null) {
|
||||
return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
|
||||
}
|
||||
return volume.getAccountId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_VOLUME_ATTACH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "adding detail to the volume: " + getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
UserContext.current().setEventDetails("Volume Id: "+getId());
|
||||
/*Volume result = _volumeService.attachVolumeToVM(this);
|
||||
if (result != null) {
|
||||
VolumeResponse response = _responseGenerator.createVolumeResponse(result);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to attach volume");
|
||||
} */
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
// 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.api.command.user.volume;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import org.apache.cloudstack.api.response.VolumeResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
||||
@APICommand(name = "updateVolumeDetail", description="Updates the volume detail.", responseObject=VolumeResponse.class)
|
||||
public class UpdateVolumeDetailCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(AttachVolumeCmd.class.getName());
|
||||
private static final String s_name = "updateVolumeDetailresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VolumeResponse.class,
|
||||
required=true, description="the ID of the disk volume")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING,
|
||||
required=true, description="the name of the field")
|
||||
private String name;
|
||||
|
||||
@Parameter(name=ApiConstants.VALUE, type=CommandType.STRING, entityType=UserVmResponse.class,
|
||||
required=true, description="the value of the field")
|
||||
private String value;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.Volume;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Volume volume = _responseGenerator.findVolumeById(getId());
|
||||
if (volume == null) {
|
||||
return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
|
||||
}
|
||||
return volume.getAccountId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_VOLUME_ATTACH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "updating detail to the volume: " + getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
_volumeService.updateVolumeDetails(this);
|
||||
this.setResponseObject(new SuccessResponse(getCommandName()));
|
||||
}
|
||||
}
|
||||
|
|
@ -58,8 +58,20 @@ public class DiskOfferingResponse extends BaseResponse {
|
|||
@SerializedName("storagetype") @Param(description="the storage type for this disk offering")
|
||||
private String storageType;
|
||||
|
||||
@SerializedName("displayoffering") @Param(description="whether to display the offering to the end user or not.")
|
||||
private Boolean displayOffering;
|
||||
|
||||
public Boolean getDisplayOffering() {
|
||||
return displayOffering;
|
||||
}
|
||||
|
||||
public void setDisplayOffering(Boolean displayOffering) {
|
||||
this.displayOffering = displayOffering;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
|
|
|
|||
|
|
@ -162,7 +162,18 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
|
|||
|
||||
@SerializedName(ApiConstants.IP6_CIDR) @Param(description="the cidr of IPv6 network")
|
||||
private String ip6Cidr;
|
||||
|
||||
|
||||
@SerializedName(ApiConstants.DISPLAY_NETWORK) @Param(description="an optional field, whether to the display the network to the end user or not.")
|
||||
private Boolean displayNetwork;
|
||||
|
||||
public Boolean getDisplayNetwork() {
|
||||
return displayNetwork;
|
||||
}
|
||||
|
||||
public void setDisplayNetwork(Boolean displayNetwork) {
|
||||
this.displayNetwork = displayNetwork;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -177,6 +177,9 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
|
|||
@Param(description = "list of affinity groups associated with the virtual machine", responseObject = AffinityGroupResponse.class)
|
||||
private Set<AffinityGroupResponse> affinityGroupList;
|
||||
|
||||
@SerializedName(ApiConstants.DISPLAY_VM) @Param(description="an optional field whether to the display the vm to the end user or not.")
|
||||
private Boolean displayVm;
|
||||
|
||||
public UserVmResponse(){
|
||||
securityGroupList = new LinkedHashSet<SecurityGroupResponse>();
|
||||
nics = new LinkedHashSet<NicResponse>();
|
||||
|
|
@ -196,7 +199,13 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
|
|||
return this.id;
|
||||
}
|
||||
|
||||
public Boolean getDisplayVm() {
|
||||
return displayVm;
|
||||
}
|
||||
|
||||
public void setDisplayVm(Boolean displayVm) {
|
||||
this.displayVm = displayVm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getObjectId() {
|
||||
|
|
|
|||
|
|
@ -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 org.apache.cloudstack.api.response;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
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;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class VolumeDetailResponse extends BaseResponse{
|
||||
@SerializedName(ApiConstants.VOLUME_ID)
|
||||
@Param(description = "ID of the volume")
|
||||
private String id;
|
||||
|
||||
@SerializedName(ApiConstants.NAME)
|
||||
@Param(description = "name of the volume detail")
|
||||
private String name;
|
||||
|
||||
|
||||
@SerializedName(ApiConstants.VALUE)
|
||||
@Param(description = "value of the volume detail")
|
||||
private String value;
|
||||
|
||||
@SerializedName(ApiConstants.DISPLAY_VOLUME) @Param(description="an optional field whether to the display the volume to the end user or not.")
|
||||
private Boolean displayVm;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Boolean getDisplayVm() {
|
||||
return displayVm;
|
||||
}
|
||||
|
||||
public void setDisplayVm(Boolean displayVm) {
|
||||
this.displayVm = displayVm;
|
||||
}
|
||||
}
|
||||
|
|
@ -165,6 +165,9 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity
|
|||
@SerializedName(ApiConstants.TAGS) @Param(description="the list of resource tags associated with volume", responseObject = ResourceTagResponse.class)
|
||||
private Set<ResourceTagResponse> 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;
|
||||
|
||||
public VolumeResponse(){
|
||||
tags = new LinkedHashSet<ResourceTagResponse>();
|
||||
}
|
||||
|
|
@ -324,4 +327,13 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity
|
|||
public void addTag(ResourceTagResponse tag){
|
||||
this.tags.add(tag);
|
||||
}
|
||||
|
||||
public Boolean getDisplayVm() {
|
||||
return displayVm;
|
||||
}
|
||||
|
||||
public void setDisplayVm(Boolean displayVm) {
|
||||
this.displayVm = displayVm;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,30 +33,15 @@ import org.apache.cloudstack.api.command.user.securitygroup.ListSecurityGroupsCm
|
|||
import org.apache.cloudstack.api.command.user.tag.ListTagsCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.ListVMsCmd;
|
||||
import org.apache.cloudstack.api.command.user.vmgroup.ListVMGroupsCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.ListVolumeDetailsCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.ListVolumesCmd;
|
||||
import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd;
|
||||
import org.apache.cloudstack.api.response.AccountResponse;
|
||||
import org.apache.cloudstack.api.response.AsyncJobResponse;
|
||||
import org.apache.cloudstack.api.response.DiskOfferingResponse;
|
||||
import org.apache.cloudstack.api.response.DomainRouterResponse;
|
||||
import org.apache.cloudstack.api.response.EventResponse;
|
||||
import org.apache.cloudstack.api.response.HostResponse;
|
||||
import org.apache.cloudstack.api.response.InstanceGroupResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.ProjectAccountResponse;
|
||||
import org.apache.cloudstack.api.response.ProjectInvitationResponse;
|
||||
import org.apache.cloudstack.api.response.ProjectResponse;
|
||||
import org.apache.cloudstack.api.response.ResourceTagResponse;
|
||||
import org.apache.cloudstack.api.response.SecurityGroupResponse;
|
||||
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
|
||||
import org.apache.cloudstack.api.response.StoragePoolResponse;
|
||||
import org.apache.cloudstack.api.response.UserResponse;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import org.apache.cloudstack.api.response.VolumeResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.cloudstack.api.response.*;
|
||||
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Service used for list api query.
|
||||
*
|
||||
|
|
@ -101,4 +86,7 @@ public interface QueryService {
|
|||
|
||||
public ListResponse<AffinityGroupResponse> listAffinityGroups(Long affinityGroupId, String affinityGroupName,
|
||||
String affinityGroupType, Long vmId, Long startIndex, Long pageSize);
|
||||
}
|
||||
|
||||
public List<VolumeDetailResponse> searchForVolumeDetails(ListVolumeDetailsCmd cmd);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,62 @@
|
|||
// 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.api.command.test;
|
||||
|
||||
import com.cloud.network.NetworkService;
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.cloudstack.api.ResponseGenerator;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.network.AddNicDetailCmd;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.mockito.Mockito;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
public class AddNicDetailCmdTest extends TestCase{
|
||||
|
||||
private AddNicDetailCmd addNicDetailCmd;
|
||||
private ResponseGenerator responseGenerator;
|
||||
|
||||
@Rule
|
||||
public ExpectedException expectedException = ExpectedException.none();
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
|
||||
addNicDetailCmd = new AddNicDetailCmd();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testCreateSuccess() {
|
||||
|
||||
NetworkService networkService = Mockito.mock(NetworkService.class);
|
||||
doNothing().when(networkService).addNicDetail(addNicDetailCmd);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
// 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.api.command.test;
|
||||
|
||||
import com.cloud.storage.VolumeApiService;
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.cloudstack.api.ResponseGenerator;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.volume.AddVolumeDetailCmd;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.mockito.Mockito;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
public class AddVolumeDetailCmdTest extends TestCase{
|
||||
|
||||
private AddVolumeDetailCmd addVolumeDetailCmd;
|
||||
private ResponseGenerator responseGenerator;
|
||||
|
||||
@Rule
|
||||
public ExpectedException expectedException = ExpectedException.none();
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
|
||||
addVolumeDetailCmd = new AddVolumeDetailCmd();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testCreateSuccess() {
|
||||
|
||||
VolumeApiService volumeService = Mockito.mock(VolumeApiService.class);
|
||||
doNothing().when(volumeService).addVolumeDetail(addVolumeDetailCmd);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for removeitional 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.api.command.test;
|
||||
|
||||
import com.cloud.network.NetworkService;
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.cloudstack.api.ResponseGenerator;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.network.RemoveNicDetailCmd;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.mockito.Mockito;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
public class RemoveNicDetailCmdTest extends TestCase{
|
||||
|
||||
private RemoveNicDetailCmd removeNicDetailCmd;
|
||||
private ResponseGenerator responseGenerator;
|
||||
|
||||
@Rule
|
||||
public ExpectedException expectedException = ExpectedException.none();
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
|
||||
removeNicDetailCmd = new RemoveNicDetailCmd();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testCreateSuccess() {
|
||||
|
||||
NetworkService networkService = Mockito.mock(NetworkService.class);
|
||||
doNothing().when(networkService).removeNicDetail(removeNicDetailCmd);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
// 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.api.command.test;
|
||||
|
||||
import com.cloud.storage.VolumeApiService;
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.cloudstack.api.ResponseGenerator;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.volume.AddVolumeDetailCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.RemoveVolumeDetailCmd;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.mockito.Mockito;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
public class RemoveVolumeDetailCmdTest extends TestCase{
|
||||
|
||||
private RemoveVolumeDetailCmd removeVolumeDetailCmd;
|
||||
private ResponseGenerator responseGenerator;
|
||||
|
||||
@Rule
|
||||
public ExpectedException expectedException = ExpectedException.none();
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
|
||||
removeVolumeDetailCmd = new RemoveVolumeDetailCmd();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testCreateSuccess() {
|
||||
|
||||
VolumeApiService volumeService = Mockito.mock(VolumeApiService.class);
|
||||
doNothing().when(volumeService).removeVolumeDetail(removeVolumeDetailCmd);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
// 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.api.command.test;
|
||||
|
||||
import com.cloud.storage.VolumeApiService;
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.cloudstack.api.ResponseGenerator;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.volume.UpdateVolumeDetailCmd;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.mockito.Mockito;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
public class UpdateVolumeDetailCmdTest extends TestCase{
|
||||
|
||||
private UpdateVolumeDetailCmd updateVolumeDetailCmd;
|
||||
private ResponseGenerator responseGenerator;
|
||||
|
||||
@Rule
|
||||
public ExpectedException expectedException = ExpectedException.none();
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
|
||||
updateVolumeDetailCmd = new UpdateVolumeDetailCmd();
|
||||
|
||||
//Account account = new AccountVO("testaccount", 1L, "networkdomain", (short) 0, "uuid");
|
||||
//UserContext.registerContext(1, account, null, true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testCreateSuccess() {
|
||||
|
||||
VolumeApiService volumeService = Mockito.mock(VolumeApiService.class);
|
||||
doNothing().when(volumeService).updateVolumeDetails(updateVolumeDetailCmd);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for updateitional 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.api.command.test;
|
||||
|
||||
import com.cloud.network.NetworkService;
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.cloudstack.api.ResponseGenerator;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.network.UpdateNicDetailCmd;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.mockito.Mockito;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
public class updateNicDetailCmdTest extends TestCase{
|
||||
|
||||
private UpdateNicDetailCmd updateNicDetailCmd;
|
||||
private ResponseGenerator responseGenerator;
|
||||
|
||||
@Rule
|
||||
public ExpectedException expectedException = ExpectedException.none();
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
|
||||
updateNicDetailCmd = new UpdateNicDetailCmd();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testCreateSuccess() {
|
||||
|
||||
NetworkService networkService = Mockito.mock(NetworkService.class);
|
||||
doNothing().when(networkService).updateNicDetail(updateNicDetailCmd);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -269,6 +269,10 @@ listVolumes=15
|
|||
extractVolume=15
|
||||
migrateVolume=15
|
||||
resizeVolume=15
|
||||
addVolumeDetail=15
|
||||
updateVolumeDetail=15
|
||||
removeVolumeDetail=15
|
||||
listVolumeDetails=15
|
||||
|
||||
#### registration command: FIXME -- this really should be something in management server that
|
||||
#### generates a new key for the user and they just have to
|
||||
|
|
@ -339,6 +343,9 @@ updateNetwork=15
|
|||
addNicToVirtualMachine=15
|
||||
removeNicFromVirtualMachine=15
|
||||
updateDefaultNicForVirtualMachine=15
|
||||
addNicDetail=15
|
||||
updateNicDetail=15
|
||||
removeNicDetail=15
|
||||
|
||||
####
|
||||
addIpToNic=15
|
||||
|
|
|
|||
|
|
@ -100,6 +100,9 @@ public class DiskOfferingVO implements DiskOffering {
|
|||
@Column(name="sort_key")
|
||||
int sortKey;
|
||||
|
||||
@Column(name="display_offering")
|
||||
boolean displayOffering;
|
||||
|
||||
public DiskOfferingVO() {
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
}
|
||||
|
|
@ -315,4 +318,13 @@ public class DiskOfferingVO implements DiskOffering {
|
|||
public void setRecreatable(boolean recreatable) {
|
||||
this.recreatable = recreatable;
|
||||
}
|
||||
|
||||
|
||||
public boolean getDisplayOffering() {
|
||||
return displayOffering;
|
||||
}
|
||||
|
||||
public void setDisplayOffering(boolean displayOffering) {
|
||||
this.displayOffering = displayOffering;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.storage;
|
||||
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name="volume_details")
|
||||
public class VolumeDetailVO implements InternalIdentity {
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
@Column(name="id")
|
||||
private long id;
|
||||
|
||||
@Column(name="volume_id")
|
||||
private long volumeId;
|
||||
|
||||
@Column(name="name")
|
||||
private String name;
|
||||
|
||||
@Column(name="value", length=1024)
|
||||
private String value;
|
||||
|
||||
public VolumeDetailVO() {}
|
||||
|
||||
public VolumeDetailVO(long volumeId, String name, String value) {
|
||||
this.volumeId = volumeId;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public long getVolumeId() {
|
||||
return volumeId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setVolumeId(long volumeId) {
|
||||
this.volumeId = volumeId;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -130,7 +130,10 @@ public class VolumeVO implements Volume {
|
|||
|
||||
@Column(name = "uuid")
|
||||
String uuid;
|
||||
|
||||
|
||||
@Column(name="display_volume", updatable=true, nullable=false)
|
||||
protected boolean displayVolume;
|
||||
|
||||
@Transient
|
||||
// @Column(name="reservation")
|
||||
String reservationId;
|
||||
|
|
@ -451,4 +454,13 @@ public class VolumeVO implements Volume {
|
|||
public void setUuid(String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
|
||||
public boolean isDisplayVolume() {
|
||||
return displayVolume;
|
||||
}
|
||||
|
||||
public void setDisplayVolume(boolean displayVolume) {
|
||||
this.displayVolume = displayVolume;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,6 +111,9 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, Vi
|
|||
@Column(name="ha_enabled", updatable=true, nullable=true)
|
||||
protected boolean haEnabled;
|
||||
|
||||
@Column(name="display_vm", updatable=true, nullable=false)
|
||||
protected boolean displayVm = true;
|
||||
|
||||
@Column(name="limit_cpu_use", updatable=true, nullable=true)
|
||||
private boolean limitCpuUse;
|
||||
|
||||
|
|
@ -376,6 +379,14 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, Vi
|
|||
return haEnabled;
|
||||
}
|
||||
|
||||
public boolean isDisplayVm() {
|
||||
return displayVm;
|
||||
}
|
||||
|
||||
public void setDisplayVm(boolean displayVm) {
|
||||
this.displayVm = displayVm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean limitCpuUse() {
|
||||
return limitCpuUse;
|
||||
|
|
|
|||
|
|
@ -156,6 +156,7 @@ public class VolumeVO implements Identity, StateObject<Volume.State> {
|
|||
this(that.getSize(), that.getVolumeType(), that.getName(), that.getTemplateId());
|
||||
this.recreatable = that.isRecreatable();
|
||||
this.state = that.getState();
|
||||
|
||||
this.size = that.getSize();
|
||||
this.diskOfferingId = that.getDiskOfferingId();
|
||||
this.poolId = that.getPoolId();
|
||||
|
|
@ -413,4 +414,5 @@ public class VolumeVO implements Identity, StateObject<Volume.State> {
|
|||
public void setDiskType(DiskFormat type) {
|
||||
diskType = type;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2394,6 +2394,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
if (network.getAclType() != null) {
|
||||
response.setAclType(network.getAclType().toString());
|
||||
}
|
||||
response.setDisplayNetwork(network.getDisplayNetwork());
|
||||
response.setState(network.getState().toString());
|
||||
response.setRestartRequired(network.isRestartRequired());
|
||||
NetworkVO nw = ApiDBUtils.findNetworkById(network.getRelated());
|
||||
|
|
|
|||
|
|
@ -16,12 +16,7 @@
|
|||
// under the License.
|
||||
package com.cloud.api.query;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
|
@ -29,6 +24,8 @@ import javax.inject.Inject;
|
|||
import org.apache.cloudstack.affinity.AffinityGroupResponse;
|
||||
import org.apache.cloudstack.affinity.AffinityGroupVMMapVO;
|
||||
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
|
||||
import com.cloud.storage.VolumeDetailVO;
|
||||
import com.cloud.storage.dao.VolumeDetailsDao;
|
||||
import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.router.ListRoutersCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd;
|
||||
|
|
@ -45,28 +42,12 @@ import org.apache.cloudstack.api.command.user.securitygroup.ListSecurityGroupsCm
|
|||
import org.apache.cloudstack.api.command.user.tag.ListTagsCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.ListVMsCmd;
|
||||
import org.apache.cloudstack.api.command.user.vmgroup.ListVMGroupsCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.ListVolumeDetailsCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.ListVolumesCmd;
|
||||
import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd;
|
||||
import org.apache.cloudstack.api.response.AccountResponse;
|
||||
import org.apache.cloudstack.api.response.AsyncJobResponse;
|
||||
import org.apache.cloudstack.api.response.DiskOfferingResponse;
|
||||
import org.apache.cloudstack.api.response.DomainRouterResponse;
|
||||
import org.apache.cloudstack.api.response.EventResponse;
|
||||
import org.apache.cloudstack.api.response.HostResponse;
|
||||
import org.apache.cloudstack.api.response.InstanceGroupResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.ProjectAccountResponse;
|
||||
import org.apache.cloudstack.api.response.ProjectInvitationResponse;
|
||||
import org.apache.cloudstack.api.response.ProjectResponse;
|
||||
import org.apache.cloudstack.api.response.ResourceTagResponse;
|
||||
import org.apache.cloudstack.api.response.SecurityGroupResponse;
|
||||
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
|
||||
import org.apache.cloudstack.api.response.StoragePoolResponse;
|
||||
import org.apache.cloudstack.api.response.UserResponse;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import org.apache.cloudstack.api.response.VolumeResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.cloudstack.api.response.*;
|
||||
import org.apache.cloudstack.query.QueryService;
|
||||
import org.apache.commons.collections.map.HashedMap;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
|
@ -245,6 +226,9 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
|||
@Inject
|
||||
private DomainRouterDao _routerDao;
|
||||
|
||||
@Inject
|
||||
private VolumeDetailsDao _volumeDetailDao;
|
||||
|
||||
@Inject
|
||||
private HighAvailabilityManager _haMgr;
|
||||
|
||||
|
|
@ -1508,6 +1492,34 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
|||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VolumeDetailResponse> searchForVolumeDetails(ListVolumeDetailsCmd cmd){
|
||||
|
||||
Long id = cmd.getId();
|
||||
String name = cmd.getName();
|
||||
|
||||
List<VolumeDetailVO> volumeDetailList;
|
||||
if(name == null){
|
||||
volumeDetailList = _volumeDetailDao.findDetails(id);
|
||||
}else{
|
||||
VolumeDetailVO volumeDetail = _volumeDetailDao.findDetail(id, name);
|
||||
volumeDetailList = new LinkedList<VolumeDetailVO>();
|
||||
volumeDetailList.add(volumeDetail);
|
||||
}
|
||||
|
||||
List<VolumeDetailResponse> volumeDetailResponseList = new ArrayList<VolumeDetailResponse>();
|
||||
for (VolumeDetailVO volumeDetail : volumeDetailList ){
|
||||
VolumeDetailResponse volumeDetailResponse = new VolumeDetailResponse();
|
||||
volumeDetailResponse.setId(id.toString());
|
||||
volumeDetailResponse.setName(volumeDetail.getName());
|
||||
volumeDetailResponse.setValue(volumeDetail.getValue());
|
||||
volumeDetailResponse.setObjectName("volumedetail");
|
||||
volumeDetailResponseList.add(volumeDetailResponse);
|
||||
}
|
||||
|
||||
return volumeDetailResponseList;
|
||||
}
|
||||
|
||||
|
||||
private Pair<List<VolumeJoinVO>, Integer> searchForVolumesInternal(ListVolumesCmd cmd) {
|
||||
|
||||
|
|
|
|||
|
|
@ -68,8 +68,9 @@ public class DiskOfferingJoinDaoImpl extends GenericDaoBase<DiskOfferingJoinVO,
|
|||
diskOfferingResponse.setCreated(offering.getCreated());
|
||||
diskOfferingResponse.setDiskSize(offering.getDiskSize() / (1024 * 1024 * 1024));
|
||||
|
||||
diskOfferingResponse.setDomain(offering.getDomainName());
|
||||
diskOfferingResponse.setDomainId(offering.getDomainUuid());
|
||||
diskOfferingResponse.setDomain(offering.getDomainName());
|
||||
diskOfferingResponse.setDomainId(offering.getDomainUuid());
|
||||
diskOfferingResponse.setDisplayOffering(offering.isDisplayOffering());
|
||||
|
||||
diskOfferingResponse.setTags(offering.getTags());
|
||||
diskOfferingResponse.setCustomized(offering.isCustomized());
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ public class UserVmJoinDaoImpl extends GenericDaoBase<UserVmJoinVO, Long> implem
|
|||
userVmResponse.setDomainName(userVm.getDomainName());
|
||||
|
||||
userVmResponse.setCreated(userVm.getCreated());
|
||||
userVmResponse.setDisplayVm(userVm.isDisplayVm());
|
||||
|
||||
if (userVm.getState() != null) {
|
||||
userVmResponse.setState(userVm.getState().toString());
|
||||
|
|
|
|||
|
|
@ -195,6 +195,7 @@ public class VolumeJoinDaoImpl extends GenericDaoBase<VolumeJoinVO, Long> implem
|
|||
}
|
||||
|
||||
volResponse.setExtractable(isExtractable);
|
||||
volResponse.setDisplayVm(volume.isDisplayVolume());
|
||||
|
||||
// set async job
|
||||
volResponse.setJobId(volume.getJobUuid());
|
||||
|
|
|
|||
|
|
@ -85,6 +85,9 @@ public class DiskOfferingJoinVO extends BaseViewVO implements InternalIdentity,
|
|||
@Column(name="domain_path")
|
||||
private String domainPath = null;
|
||||
|
||||
@Column(name="display_offering")
|
||||
boolean displayOffering;
|
||||
|
||||
|
||||
public DiskOfferingJoinVO() {
|
||||
}
|
||||
|
|
@ -164,6 +167,14 @@ public class DiskOfferingJoinVO extends BaseViewVO implements InternalIdentity,
|
|||
this.customized = customized;
|
||||
}
|
||||
|
||||
public boolean isDisplayOffering() {
|
||||
return displayOffering;
|
||||
}
|
||||
|
||||
public void setDisplayOffering(boolean displayOffering) {
|
||||
this.displayOffering = displayOffering;
|
||||
}
|
||||
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,6 +128,9 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
|
|||
@Column(name="limit_cpu_use", updatable=true, nullable=true)
|
||||
private boolean limitCpuUse;
|
||||
|
||||
@Column(name="display_vm", updatable=true, nullable=false)
|
||||
protected boolean displayVm = true;
|
||||
|
||||
@Column(name="last_host_id", updatable=true, nullable=true)
|
||||
private Long lastHostId;
|
||||
|
||||
|
|
@ -780,6 +783,13 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
|
|||
limitCpuUse = value;
|
||||
}
|
||||
|
||||
public boolean isDisplayVm() {
|
||||
return displayVm;
|
||||
}
|
||||
|
||||
public void setDisplayVm(boolean displayVm) {
|
||||
this.displayVm = displayVm;
|
||||
}
|
||||
|
||||
public String getDataCenterUuid() {
|
||||
return dataCenterUuid;
|
||||
|
|
|
|||
|
|
@ -246,6 +246,9 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity {
|
|||
private String tagCustomer;
|
||||
|
||||
|
||||
@Column(name="display_volume", updatable=true, nullable=false)
|
||||
protected boolean displayVolume;
|
||||
|
||||
|
||||
public VolumeJoinVO() {
|
||||
}
|
||||
|
|
@ -387,6 +390,13 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity {
|
|||
}
|
||||
|
||||
|
||||
public boolean isDisplayVolume() {
|
||||
return displayVolume;
|
||||
}
|
||||
|
||||
public void setDisplayVolume(boolean displayVolume) {
|
||||
this.displayVolume = displayVolume;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAccountUuid() {
|
||||
|
|
|
|||
|
|
@ -93,9 +93,11 @@ public interface ConfigurationManager extends ConfigurationService, Manager {
|
|||
* @param numGibibytes
|
||||
* @param tags
|
||||
* @param isCustomized
|
||||
* @param localStorageRequired
|
||||
* @param isDisplayOfferingEnabled
|
||||
* @return newly created disk offering
|
||||
*/
|
||||
DiskOfferingVO createDiskOffering(Long domainId, String name, String description, Long numGibibytes, String tags, boolean isCustomized, boolean localStorageRequired);
|
||||
DiskOfferingVO createDiskOffering(Long domainId, String name, String description, Long numGibibytes, String tags, boolean isCustomized, boolean localStorageRequired, boolean isDisplayOfferingEnabled);
|
||||
|
||||
/**
|
||||
* Creates a new pod
|
||||
|
|
|
|||
|
|
@ -1727,7 +1727,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
userNetwork.setBroadcastDomainType(broadcastDomainType);
|
||||
userNetwork.setNetworkDomain(networkDomain);
|
||||
_networkMgr.setupNetwork(systemAccount, offering, userNetwork, plan, null, null, false,
|
||||
Domain.ROOT_DOMAIN, null, null, null);
|
||||
Domain.ROOT_DOMAIN, null, null, null, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1954,7 +1954,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
|
||||
@Override
|
||||
@ActionEvent(eventType = EventTypes.EVENT_DISK_OFFERING_CREATE, eventDescription = "creating disk offering")
|
||||
public DiskOfferingVO createDiskOffering(Long domainId, String name, String description, Long numGibibytes, String tags, boolean isCustomized, boolean localStorageRequired) {
|
||||
public DiskOfferingVO createDiskOffering(Long domainId, String name, String description, Long numGibibytes, String tags, boolean isCustomized, boolean localStorageRequired, boolean isDisplayOfferingEnabled) {
|
||||
long diskSize = 0;// special case for custom disk offerings
|
||||
if (numGibibytes != null && (numGibibytes <= 0)) {
|
||||
throw new InvalidParameterValueException("Please specify a disk size of at least 1 Gb.");
|
||||
|
|
@ -1973,6 +1973,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
tags = cleanupTags(tags);
|
||||
DiskOfferingVO newDiskOffering = new DiskOfferingVO(domainId, name, description, diskSize, tags, isCustomized);
|
||||
newDiskOffering.setUseLocalStorage(localStorageRequired);
|
||||
newDiskOffering.setDisplayOffering(isDisplayOfferingEnabled);
|
||||
UserContext.current().setEventDetails("Disk offering id=" + newDiskOffering.getId());
|
||||
DiskOfferingVO offering = _diskOfferingDao.persist(newDiskOffering);
|
||||
if (offering != null) {
|
||||
|
|
@ -1988,6 +1989,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
String name = cmd.getOfferingName();
|
||||
String description = cmd.getDisplayText();
|
||||
Long numGibibytes = cmd.getDiskSize();
|
||||
boolean isDisplayOfferingEnabled = cmd.getDisplayOffering() != null ? cmd.getDisplayOffering() : true;
|
||||
boolean isCustomized = cmd.isCustomized() != null ? cmd.isCustomized() : false; // false
|
||||
// by
|
||||
// default
|
||||
|
|
@ -2012,7 +2014,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
}
|
||||
}
|
||||
|
||||
return createDiskOffering(domainId, name, description, numGibibytes, tags, isCustomized, localStorageRequired);
|
||||
return createDiskOffering(domainId, name, description, numGibibytes, tags, isCustomized, localStorageRequired, isDisplayOfferingEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -2376,9 +2378,9 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
|
||||
@Override
|
||||
@DB
|
||||
public Vlan createVlanAndPublicIpRange(long zoneId, long networkId, long physicalNetworkId, boolean forVirtualNetwork, Long podId,
|
||||
String startIP, String endIP, String vlanGateway, String vlanNetmask,
|
||||
String vlanId, Account vlanOwner, String startIPv6, String endIPv6, String vlanIp6Gateway, String vlanIp6Cidr) {
|
||||
public Vlan createVlanAndPublicIpRange(long zoneId, long networkId, long physicalNetworkId, boolean forVirtualNetwork, Long podId,
|
||||
String startIP, String endIP, String vlanGateway, String vlanNetmask,
|
||||
String vlanId, Account vlanOwner, String startIPv6, String endIPv6, String vlanIp6Gateway, String vlanIp6Cidr) {
|
||||
Network network = _networkModel.getNetwork(networkId);
|
||||
|
||||
boolean ipv4 = false, ipv6 = false;
|
||||
|
|
|
|||
|
|
@ -163,6 +163,9 @@ public class NetworkVO implements Network {
|
|||
@Column(name="ip6_cidr")
|
||||
String ip6Cidr;
|
||||
|
||||
@Column(name="display_network", updatable=true, nullable=false)
|
||||
protected boolean displayNetwork = true;
|
||||
|
||||
public NetworkVO() {
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
}
|
||||
|
|
@ -540,4 +543,13 @@ public class NetworkVO implements Network {
|
|||
public void setIp6Gateway(String ip6Gateway) {
|
||||
this.ip6Gateway = ip6Gateway;
|
||||
}
|
||||
|
||||
@Override()
|
||||
public boolean getDisplayNetwork() {
|
||||
return displayNetwork;
|
||||
}
|
||||
|
||||
public void setDisplayNetwork(boolean displayNetwork) {
|
||||
this.displayNetwork = displayNetwork;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2480,7 +2480,13 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||
cmdList.add(ListAffinityGroupsCmd.class);
|
||||
cmdList.add(UpdateVMAffinityGroupCmd.class);
|
||||
cmdList.add(ListAffinityGroupTypesCmd.class);
|
||||
|
||||
cmdList.add(AddVolumeDetailCmd.class);
|
||||
cmdList.add(UpdateVolumeDetailCmd.class);
|
||||
cmdList.add(RemoveVolumeDetailCmd.class);
|
||||
cmdList.add(ListVolumeDetailsCmd.class);
|
||||
cmdList.add(AddNicDetailCmd.class);
|
||||
cmdList.add(UpdateNicDetailCmd.class);
|
||||
cmdList.add(RemoveNicDetailCmd.class);
|
||||
return cmdList;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,14 +36,10 @@ import java.util.concurrent.ExecutionException;
|
|||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.storage.dao.*;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.MigrateVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.UploadVolumeCmd;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.CommandResult;
|
||||
import org.apache.cloudstack.api.command.user.volume.*;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager;
|
||||
|
|
@ -122,18 +118,6 @@ import com.cloud.storage.Storage.ImageFormat;
|
|||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
import com.cloud.storage.Volume.Event;
|
||||
import com.cloud.storage.Volume.Type;
|
||||
import com.cloud.storage.dao.DiskOfferingDao;
|
||||
import com.cloud.storage.dao.SnapshotDao;
|
||||
import com.cloud.storage.dao.SnapshotPolicyDao;
|
||||
import com.cloud.storage.dao.StoragePoolHostDao;
|
||||
import com.cloud.storage.dao.StoragePoolWorkDao;
|
||||
import com.cloud.storage.dao.VMTemplateDao;
|
||||
import com.cloud.storage.dao.VMTemplateHostDao;
|
||||
import com.cloud.storage.dao.VMTemplatePoolDao;
|
||||
import com.cloud.storage.dao.VMTemplateS3Dao;
|
||||
import com.cloud.storage.dao.VMTemplateSwiftDao;
|
||||
import com.cloud.storage.dao.VolumeDao;
|
||||
import com.cloud.storage.dao.VolumeHostDao;
|
||||
import com.cloud.storage.download.DownloadMonitor;
|
||||
import com.cloud.storage.s3.S3Manager;
|
||||
import com.cloud.storage.secondary.SecondaryStorageVmManager;
|
||||
|
|
@ -302,6 +286,8 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
|
|||
@Inject
|
||||
ConfigurationDao _configDao;
|
||||
@Inject
|
||||
VolumeDetailsDao _volDetailDao;
|
||||
@Inject
|
||||
ManagementServer _msServer;
|
||||
@Inject
|
||||
DataStoreManager dataStoreMgr;
|
||||
|
|
@ -817,6 +803,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
|
|||
Account caller = UserContext.current().getCaller();
|
||||
|
||||
long ownerId = cmd.getEntityOwnerId();
|
||||
Boolean displayVolumeEnabled = cmd.getDisplayVolume();
|
||||
|
||||
// permission check
|
||||
_accountMgr.checkAccess(caller, null, true,
|
||||
|
|
@ -891,6 +878,10 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
|
|||
size = diskOffering.getDiskSize();
|
||||
}
|
||||
|
||||
if(displayVolumeEnabled == null){
|
||||
displayVolumeEnabled = true;
|
||||
}
|
||||
|
||||
if (!validateVolumeSizeRange(size)) {// convert size from mb to gb
|
||||
// for validation
|
||||
throw new InvalidParameterValueException(
|
||||
|
|
@ -971,6 +962,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
|
|||
volume.setUpdated(new Date());
|
||||
volume.setDomainId((caller == null) ? Domain.ROOT_DOMAIN : caller
|
||||
.getDomainId());
|
||||
volume.setDisplayVolume(displayVolumeEnabled);
|
||||
if (parentVolume != null) {
|
||||
volume.setTemplateId(parentVolume.getTemplateId());
|
||||
} else {
|
||||
|
|
@ -1781,6 +1773,66 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
|
|||
return newVol;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ActionEvent(eventType = EventTypes.EVENT_VOLUME_DETAIL_UPDATE, eventDescription = "updating volume detail", async = true)
|
||||
public void updateVolumeDetails(UpdateVolumeDetailCmd cmd){
|
||||
UserContext.current().setEventDetails("Volume Id: "+cmd.getId());
|
||||
Account caller = UserContext.current().getCaller();
|
||||
Long volumeId = cmd.getId();
|
||||
String name = cmd.getName();
|
||||
String value = cmd.getValue();
|
||||
|
||||
VolumeVO volume = _volsDao.findById(volumeId);
|
||||
_accountMgr.checkAccess(caller, null, true, volume);
|
||||
VolumeDetailVO volDetail = _volDetailDao.findDetail(volumeId, name);
|
||||
if(volDetail != null){
|
||||
volDetail.setValue(value);
|
||||
_volDetailDao.update(volDetail.getId(), volDetail);
|
||||
}else{
|
||||
throw new InvalidParameterValueException("This detail doesnt exist for the volume ");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@ActionEvent(eventType = EventTypes.EVENT_VOLUME_DETAIL_REMOVE, eventDescription = "removing volume detail", async = true)
|
||||
public void removeVolumeDetail(RemoveVolumeDetailCmd cmd){
|
||||
UserContext.current().setEventDetails("Volume Id: "+cmd.getId());
|
||||
Account caller = UserContext.current().getCaller();
|
||||
Long volumeId = cmd.getId();
|
||||
String name = cmd.getName();
|
||||
|
||||
VolumeVO volume = _volsDao.findById(volumeId);
|
||||
_accountMgr.checkAccess(caller, null, true, volume);
|
||||
VolumeDetailVO volDetail = _volDetailDao.findDetail(volumeId, name);
|
||||
if(volDetail != null){
|
||||
_volDetailDao.remove(volDetail.getId());
|
||||
}else{
|
||||
throw new InvalidParameterValueException("This detail doesnt exist for the volume ");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@ActionEvent(eventType = EventTypes.EVENT_VOLUME_DETAIL_ADD, eventDescription = "adding volume detail", async = true)
|
||||
public void addVolumeDetail(AddVolumeDetailCmd cmd){
|
||||
|
||||
Account caller = UserContext.current().getCaller();
|
||||
UserContext.current().setEventDetails("Volume Id: "+ cmd.getId());
|
||||
|
||||
Long volumeId = cmd.getId();
|
||||
String name = cmd.getName();
|
||||
String value = cmd.getValue();
|
||||
|
||||
VolumeVO volume = _volsDao.findById(volumeId);
|
||||
_accountMgr.checkAccess(caller, null, true, volume);
|
||||
VolumeDetailVO volDetail = new VolumeDetailVO(volumeId, name, value);
|
||||
_volDetailDao.persist(volDetail);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@ActionEvent(eventType = EventTypes.EVENT_VOLUME_DETACH, eventDescription = "detaching volume", async = true)
|
||||
public Volume detachVolumeFromVM(DetachVolumeCmd cmmd) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
// 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.storage.dao;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.storage.VolumeDetailVO;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public interface VolumeDetailsDao extends GenericDao<VolumeDetailVO, Long> {
|
||||
List<VolumeDetailVO> findDetails(long volumeId);
|
||||
|
||||
void persist(long vmId, Map<String, String> details);
|
||||
|
||||
VolumeDetailVO findDetail(long vmId, String name);
|
||||
|
||||
void deleteDetails(long vmId);
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
// 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.storage.dao;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import com.cloud.storage.VolumeDetailVO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
|
||||
@Component
|
||||
@Local(value=VolumeDetailsDao.class)
|
||||
public class VolumeDetailsDaoImpl extends GenericDaoBase<VolumeDetailVO, Long> implements VolumeDetailsDao {
|
||||
protected final SearchBuilder<VolumeDetailVO> VolumeSearch;
|
||||
protected final SearchBuilder<VolumeDetailVO> DetailSearch;
|
||||
|
||||
public VolumeDetailsDaoImpl() {
|
||||
VolumeSearch = createSearchBuilder();
|
||||
VolumeSearch.and("volumeId", VolumeSearch.entity().getVolumeId(), SearchCriteria.Op.EQ);
|
||||
VolumeSearch.done();
|
||||
|
||||
DetailSearch = createSearchBuilder();
|
||||
DetailSearch.and("volumeId", DetailSearch.entity().getVolumeId(), SearchCriteria.Op.EQ);
|
||||
DetailSearch.and("name", DetailSearch.entity().getName(), SearchCriteria.Op.EQ);
|
||||
DetailSearch.done();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDetails(long volumeId) {
|
||||
SearchCriteria<VolumeDetailVO> sc = VolumeSearch.create();
|
||||
sc.setParameters("volumeId", volumeId);
|
||||
|
||||
List<VolumeDetailVO> results = search(sc, null);
|
||||
for (VolumeDetailVO result : results) {
|
||||
remove(result.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public VolumeDetailVO findDetail(long volumeId, String name) {
|
||||
SearchCriteria<VolumeDetailVO> sc = DetailSearch.create();
|
||||
sc.setParameters("volumeId", volumeId);
|
||||
sc.setParameters("name", name);
|
||||
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VolumeDetailVO> findDetails(long volumeId) {
|
||||
SearchCriteria<VolumeDetailVO> sc = VolumeSearch.create();
|
||||
sc.setParameters("volumeId", volumeId);
|
||||
|
||||
List<VolumeDetailVO> results = search(sc, null);
|
||||
return results;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void persist(long volumeId, Map<String, String> details) {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
SearchCriteria<VolumeDetailVO> sc = VolumeSearch.create();
|
||||
sc.setParameters("volumeId", volumeId);
|
||||
expunge(sc);
|
||||
|
||||
for (Map.Entry<String, String> detail : details.entrySet()) {
|
||||
VolumeDetailVO vo = new VolumeDetailVO(volumeId, detail.getKey(), detail.getValue());
|
||||
persist(vo);
|
||||
}
|
||||
txn.commit();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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.vm;
|
||||
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name="nic_details")
|
||||
public class NicDetailVO implements InternalIdentity {
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
@Column(name="id")
|
||||
private long id;
|
||||
|
||||
@Column(name="nic_id")
|
||||
private long nicId;
|
||||
|
||||
@Column(name="name")
|
||||
private String name;
|
||||
|
||||
@Column(name="value", length=1024)
|
||||
private String value;
|
||||
|
||||
public NicDetailVO() {}
|
||||
|
||||
public NicDetailVO(long nicId, String name, String value) {
|
||||
this.nicId = nicId;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public long getNicId() {
|
||||
return nicId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setNicId(long nicId) {
|
||||
this.nicId = nicId;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.cloud.vm;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: nitinmehta
|
||||
* Date: 15/04/13
|
||||
* Time: 5:03 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class NicDetailsVO {
|
||||
}
|
||||
|
|
@ -1572,6 +1572,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
|
|||
String displayName = cmd.getDisplayName();
|
||||
String group = cmd.getGroup();
|
||||
Boolean ha = cmd.getHaEnable();
|
||||
Boolean isDisplayVmEnabled = cmd.getDisplayVm();
|
||||
Long id = cmd.getId();
|
||||
Long osTypeId = cmd.getOsTypeId();
|
||||
String userData = cmd.getUserData();
|
||||
|
|
@ -1605,6 +1606,10 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
|
|||
ha = vmInstance.isHaEnabled();
|
||||
}
|
||||
|
||||
if (isDisplayVmEnabled == null) {
|
||||
isDisplayVmEnabled = vmInstance.isDisplayVm();
|
||||
}
|
||||
|
||||
UserVmVO vm = _vmDao.findById(id);
|
||||
if (vm == null) {
|
||||
throw new CloudRuntimeException(
|
||||
|
|
@ -1653,7 +1658,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
|
|||
}
|
||||
}
|
||||
|
||||
_vmDao.updateVM(id, displayName, ha, osTypeId, userData);
|
||||
_vmDao.updateVM(id, displayName, ha, osTypeId, userData, isDisplayVmEnabled);
|
||||
|
||||
if (updateUserdata) {
|
||||
boolean result = updateUserDataInternal(_vmDao.findById(id));
|
||||
|
|
@ -1945,9 +1950,9 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
|
|||
public UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> securityGroupIdList, Account owner,
|
||||
String hostName, String displayName, Long diskOfferingId, Long diskSize, String group,
|
||||
HypervisorType hypervisor, HTTPMethod httpmethod, String userData, String sshKeyPair,
|
||||
Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, String keyboard,
|
||||
Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard,
|
||||
List<Long> affinityGroupIdList)
|
||||
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException {
|
||||
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException {
|
||||
|
||||
Account caller = UserContext.current().getCaller();
|
||||
List<NetworkVO> networkList = new ArrayList<NetworkVO>();
|
||||
|
|
@ -1997,16 +2002,17 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
|
|||
|
||||
return createVirtualMachine(zone, serviceOffering, template, hostName, displayName, owner, diskOfferingId,
|
||||
diskSize, networkList, securityGroupIdList, group, httpmethod, userData, sshKeyPair, hypervisor,
|
||||
caller, requestedIps, defaultIps, keyboard, affinityGroupIdList);
|
||||
caller, requestedIps, defaultIps, displayVm, keyboard, affinityGroupIdList);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList,
|
||||
List<Long> securityGroupIdList, Account owner, String hostName, String displayName, Long diskOfferingId,
|
||||
Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData,
|
||||
String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, String keyboard,
|
||||
List<Long> affinityGroupIdList) throws InsufficientCapacityException, ConcurrentOperationException,
|
||||
ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException {
|
||||
Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData,
|
||||
String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard,
|
||||
List<Long> affinityGroupIdList) throws InsufficientCapacityException, ConcurrentOperationException,
|
||||
ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException {
|
||||
|
||||
Account caller = UserContext.current().getCaller();
|
||||
List<NetworkVO> networkList = new ArrayList<NetworkVO>();
|
||||
|
|
@ -2113,15 +2119,15 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
|
|||
|
||||
return createVirtualMachine(zone, serviceOffering, template, hostName, displayName, owner, diskOfferingId,
|
||||
diskSize, networkList, securityGroupIdList, group, httpmethod, userData, sshKeyPair, hypervisor,
|
||||
caller, requestedIps, defaultIps, keyboard, affinityGroupIdList);
|
||||
caller, requestedIps, defaultIps, displayVm, keyboard, affinityGroupIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, Account owner, String hostName,
|
||||
String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
|
||||
String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
|
||||
HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps,
|
||||
IpAddresses defaultIps, String keyboard, List<Long> affinityGroupIdList)
|
||||
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException {
|
||||
IpAddresses defaultIps, Boolean displayvm, String keyboard, List<Long> affinityGroupIdList)
|
||||
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException {
|
||||
|
||||
Account caller = UserContext.current().getCaller();
|
||||
List<NetworkVO> networkList = new ArrayList<NetworkVO>();
|
||||
|
|
@ -2165,7 +2171,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
|
|||
s_logger.debug("Creating network for account " + owner + " from the network offering id=" +requiredOfferings.get(0).getId() + " as a part of deployVM process");
|
||||
Network newNetwork = _networkMgr.createGuestNetwork(requiredOfferings.get(0).getId(),
|
||||
owner.getAccountName() + "-network", owner.getAccountName() + "-network", null, null,
|
||||
null, null, owner, null, physicalNetwork, zone.getId(), ACLType.Account, null, null, null, null);
|
||||
null, null, owner, null, physicalNetwork, zone.getId(), ACLType.Account, null, null, null, null, true);
|
||||
defaultNetwork = _networkDao.findById(newNetwork.getId());
|
||||
} else if (virtualNetworks.size() > 1) {
|
||||
throw new InvalidParameterValueException(
|
||||
|
|
@ -2230,7 +2236,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
|
|||
|
||||
return createVirtualMachine(zone, serviceOffering, template, hostName, displayName, owner, diskOfferingId,
|
||||
diskSize, networkList, null, group, httpmethod, userData, sshKeyPair, hypervisor, caller, requestedIps,
|
||||
defaultIps, keyboard, affinityGroupIdList);
|
||||
defaultIps, displayvm, keyboard, affinityGroupIdList);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2243,9 +2249,9 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
|
|||
|
||||
@DB @ActionEvent(eventType = EventTypes.EVENT_VM_CREATE, eventDescription = "deploying Vm", create = true)
|
||||
protected UserVm createVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, String hostName, String displayName, Account owner, Long diskOfferingId,
|
||||
Long diskSize, List<NetworkVO> networkList, List<Long> securityGroupIdList, String group, HTTPMethod httpmethod,
|
||||
Long diskSize, List<NetworkVO> networkList, List<Long> securityGroupIdList, String group, HTTPMethod httpmethod,
|
||||
String userData, String sshKeyPair, HypervisorType hypervisor, Account caller, Map<Long, IpAddresses> requestedIps,
|
||||
IpAddresses defaultIps, String keyboard, List<Long> affinityGroupIdList)
|
||||
IpAddresses defaultIps, Boolean displayvm, String keyboard, List<Long> affinityGroupIdList)
|
||||
throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException, StorageUnavailableException, ResourceAllocationException {
|
||||
|
||||
_accountMgr.checkAccess(caller, null, true, owner);
|
||||
|
|
@ -2510,6 +2516,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
|
|||
} else {
|
||||
hypervisorType = template.getHypervisorType();
|
||||
}
|
||||
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
UserVmVO vm = new UserVmVO(id, instanceName, displayName,
|
||||
|
|
@ -2530,6 +2537,12 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
|
|||
vm.setIsoId(template.getId());
|
||||
}
|
||||
|
||||
if(displayvm != null){
|
||||
vm.setDisplayVm(displayvm);
|
||||
}else {
|
||||
vm.setDisplayVm(true);
|
||||
}
|
||||
|
||||
// If hypervisor is vSphere, check for clone type setting.
|
||||
if (hypervisorType.equals(HypervisorType.VMware)) {
|
||||
// retrieve clone flag.
|
||||
|
|
@ -4003,7 +4016,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
|
|||
requiredOfferings.get(0).getId() + " as a part of deployVM process");
|
||||
Network newNetwork = _networkMgr.createGuestNetwork(requiredOfferings.get(0).getId(),
|
||||
newAccount.getAccountName() + "-network", newAccount.getAccountName() + "-network", null, null,
|
||||
null, null, newAccount, null, physicalNetwork, zone.getId(), ACLType.Account, null, null, null, null);
|
||||
null, null, newAccount, null, physicalNetwork, zone.getId(), ACLType.Account, null, null, null, null, true);
|
||||
// if the network offering has persistent set to true, implement the network
|
||||
if (requiredOfferings.get(0).getIsPersistent()) {
|
||||
DeployDestination dest = new DeployDestination(zone, null, null, null);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
// 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.dao;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import com.cloud.vm.NicDetailVO;
|
||||
|
||||
public interface NicDetailDao extends GenericDao<NicDetailVO, Long> {
|
||||
Map<String, String> findDetails(long nicId);
|
||||
|
||||
void persist(long nicId, Map<String, String> details);
|
||||
|
||||
NicDetailVO findDetail(long nicId, String name);
|
||||
|
||||
void deleteDetails(long nicId);
|
||||
}
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
// 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.dao;
|
||||
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
import com.cloud.vm.NicDetailVO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
@Local(value = { NicDetailDao.class })
|
||||
public class NicDetailDaoImpl extends GenericDaoBase<NicDetailVO, Long> implements NicDetailDao {
|
||||
protected final SearchBuilder<NicDetailVO> NicSearch;
|
||||
protected final SearchBuilder<NicDetailVO> DetailSearch;
|
||||
|
||||
public NicDetailDaoImpl() {
|
||||
NicSearch = createSearchBuilder();
|
||||
NicSearch.and("nicId", NicSearch.entity().getNicId(), SearchCriteria.Op.EQ);
|
||||
NicSearch.done();
|
||||
|
||||
DetailSearch = createSearchBuilder();
|
||||
DetailSearch.and("nicId", DetailSearch.entity().getNicId(), SearchCriteria.Op.EQ);
|
||||
DetailSearch.and("name", DetailSearch.entity().getName(), SearchCriteria.Op.EQ);
|
||||
DetailSearch.done();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDetails(long nicId) {
|
||||
SearchCriteria<NicDetailVO> sc = NicSearch.create();
|
||||
sc.setParameters("nicId", nicId);
|
||||
|
||||
List<NicDetailVO> results = search(sc, null);
|
||||
for (NicDetailVO result : results) {
|
||||
remove(result.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NicDetailVO findDetail(long nicId, String name) {
|
||||
SearchCriteria<NicDetailVO> sc = DetailSearch.create();
|
||||
sc.setParameters("nicId", nicId);
|
||||
sc.setParameters("name", name);
|
||||
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> findDetails(long nicId) {
|
||||
SearchCriteria<NicDetailVO> sc = NicSearch.create();
|
||||
sc.setParameters("nicId", nicId);
|
||||
|
||||
List<NicDetailVO> results = search(sc, null);
|
||||
Map<String, String> details = new HashMap<String, String>(results.size());
|
||||
for (NicDetailVO result : results) {
|
||||
details.put(result.getName(), result.getValue());
|
||||
}
|
||||
|
||||
return details;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void persist(long nicId, Map<String, String> details) {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
SearchCriteria<NicDetailVO> sc = NicSearch.create();
|
||||
sc.setParameters("nicId", nicId);
|
||||
expunge(sc);
|
||||
|
||||
for (Map.Entry<String, String> detail : details.entrySet()) {
|
||||
NicDetailVO vo = new NicDetailVO(nicId, detail.getKey(), detail.getValue());
|
||||
persist(vo);
|
||||
}
|
||||
txn.commit();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -38,8 +38,9 @@ public interface UserVmDao extends GenericDao<UserVmVO, Long> {
|
|||
* @param id vm id.
|
||||
* @param displan name and enable for ha
|
||||
* @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.
|
||||
*/
|
||||
void updateVM(long id, String displayName, boolean enable, Long osTypeId, String userData);
|
||||
void updateVM(long id, String displayName, boolean enable, Long osTypeId, String userData, boolean displayVm);
|
||||
|
||||
List<UserVmVO> findDestroyedVms(Date date);
|
||||
|
||||
|
|
|
|||
|
|
@ -224,12 +224,13 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateVM(long id, String displayName, boolean enable, Long osTypeId, String userData) {
|
||||
public void updateVM(long id, String displayName, boolean enable, Long osTypeId, String userData, boolean displayVm) {
|
||||
UserVmVO vo = createForUpdate();
|
||||
vo.setDisplayName(displayName);
|
||||
vo.setHaEnabled(enable);
|
||||
vo.setGuestOSId(osTypeId);
|
||||
vo.setUserData(userData);
|
||||
vo.setDisplayVm(displayVm);
|
||||
update(id, vo);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,10 @@ import java.util.Map;
|
|||
import javax.ejb.Local;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
|
||||
import org.apache.cloudstack.api.BaseCmd.HTTPMethod;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor;
|
||||
import org.apache.cloudstack.api.command.admin.vm.AssignVMCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.AddNicToVMCmd;
|
||||
|
|
@ -339,11 +342,10 @@ public class MockUserVmManagerImpl extends ManagerBase implements UserVmManager,
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> securityGroupIdList, Account owner,
|
||||
String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
|
||||
HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps,
|
||||
IpAddresses defaultIp, String keyboard, List<Long> affinityGroupIdList)
|
||||
IpAddresses defaultIp, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList)
|
||||
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException,
|
||||
ResourceAllocationException {
|
||||
// TODO Auto-generated method stub
|
||||
|
|
@ -355,7 +357,7 @@ public class MockUserVmManagerImpl extends ManagerBase implements UserVmManager,
|
|||
List<Long> securityGroupIdList, Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize,
|
||||
String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData,
|
||||
String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps,
|
||||
String keyboard, List<Long> affinityGroupIdList) throws InsufficientCapacityException,
|
||||
Boolean displayVm, String keyboard, List<Long> affinityGroupIdList) throws InsufficientCapacityException,
|
||||
ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
|
|
@ -365,7 +367,7 @@ public class MockUserVmManagerImpl extends ManagerBase implements UserVmManager,
|
|||
public UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, Account owner, String hostName,
|
||||
String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
|
||||
HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps,
|
||||
IpAddresses defaultIps, String keyboard, List<Long> affinityGroupIdList) throws InsufficientCapacityException,
|
||||
IpAddresses defaultIps, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList) throws InsufficientCapacityException,
|
||||
ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -75,13 +75,11 @@ import com.cloud.offering.NetworkOffering;
|
|||
import com.cloud.offering.NetworkOffering.Availability;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
import com.cloud.offerings.NetworkOfferingVO;
|
||||
import com.cloud.offerings.dao.NetworkOfferingDao;
|
||||
import com.cloud.offerings.dao.NetworkOfferingDaoImpl;
|
||||
import com.cloud.org.Grouping.AllocationState;
|
||||
import com.cloud.service.ServiceOfferingVO;
|
||||
import com.cloud.storage.DiskOfferingVO;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.component.Manager;
|
||||
import com.cloud.utils.component.ManagerBase;
|
||||
import com.cloud.vm.VirtualMachine.Type;
|
||||
|
||||
|
|
@ -511,7 +509,7 @@ public class MockConfigurationManagerImpl extends ManagerBase implements Configu
|
|||
*/
|
||||
@Override
|
||||
public Vlan createVlanAndPublicIpRange(long zoneId, long networkId, long physicalNetworkId, boolean forVirtualNetwork, Long podId, String startIP, String endIP, String vlanGateway, String vlanNetmask, String vlanId,
|
||||
Account vlanOwner, String startIPv6, String endIPv6, String vlanGatewayv6, String vlanCidrv6) throws InsufficientCapacityException, ConcurrentOperationException, InvalidParameterValueException {
|
||||
Account vlanOwner, String startIPv6, String endIPv6, String vlanGatewayv6, String vlanCidrv6) throws InsufficientCapacityException, ConcurrentOperationException, InvalidParameterValueException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
|
@ -598,10 +596,10 @@ public class MockConfigurationManagerImpl extends ManagerBase implements Configu
|
|||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.cloud.configuration.ConfigurationManager#createDiskOffering(java.lang.Long, java.lang.String, java.lang.String, java.lang.Long, java.lang.String, boolean, boolean)
|
||||
* @see com.cloud.configuration.ConfigurationManager#createDiskOffering(java.lang.Long, java.lang.String, java.lang.String, java.lang.Long, java.lang.String, boolean, boolean, boolean)
|
||||
*/
|
||||
@Override
|
||||
public DiskOfferingVO createDiskOffering(Long domainId, String name, String description, Long numGibibytes, String tags, boolean isCustomized, boolean localStorageRequired) {
|
||||
public DiskOfferingVO createDiskOffering(Long domainId, String name, String description, Long numGibibytes, String tags, boolean isCustomized, boolean localStorageRequired, boolean isDisplayOfferingEnabled) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -243,6 +243,58 @@ ALTER TABLE `cloud`.`external_load_balancer_devices` ADD COLUMN `gslb_site_publi
|
|||
|
||||
ALTER TABLE `cloud`.`external_load_balancer_devices` ADD COLUMN `gslb_site_privateip` varchar(255) DEFAULT NULL COMMENT 'GSLB service Provider site private ip';
|
||||
|
||||
ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `display_vm` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Should vm instance be displayed to the end user';
|
||||
|
||||
ALTER TABLE `cloud`.`user_vm_details` ADD COLUMN `display_detail` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Should vm detail instance be displayed to the end user';
|
||||
|
||||
ALTER TABLE `cloud`.`volumes` ADD COLUMN `display_volume` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Should volume be displayed to the end user';
|
||||
|
||||
ALTER TABLE `cloud`.`networks` ADD COLUMN `display_network` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Should network be displayed to the end user';
|
||||
|
||||
ALTER TABLE `cloud`.`nics` ADD COLUMN `display_nic` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Should nic be displayed to the end user';
|
||||
|
||||
ALTER TABLE `cloud`.`disk_offering` ADD COLUMN `display_offering` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Should disk offering be displayed to the end user';
|
||||
|
||||
CREATE TABLE `cloud`.`volume_details` (
|
||||
`id` bigint unsigned NOT NULL auto_increment,
|
||||
`volume_id` bigint unsigned NOT NULL COMMENT 'volume id',
|
||||
`name` varchar(255) NOT NULL,
|
||||
`value` varchar(1024) NOT NULL,
|
||||
`display_detail` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Should detail be displayed to the end user',
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `fk_volume_details__volume_id` FOREIGN KEY `fk_volume_details__volume_id`(`volume_id`) REFERENCES `volumes`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `cloud`.`network_details` (
|
||||
`id` bigint unsigned NOT NULL auto_increment,
|
||||
`network_id` bigint unsigned NOT NULL COMMENT 'network id',
|
||||
`name` varchar(255) NOT NULL,
|
||||
`value` varchar(1024) NOT NULL,
|
||||
`display_detail` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Should detail be displayed to the end user',
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `fk_network_details__network_id` FOREIGN KEY `fk_network_details__network_id`(`network_id`) REFERENCES `networks`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `cloud`.`nic_details` (
|
||||
`id` bigint unsigned NOT NULL auto_increment,
|
||||
`nic_id` bigint unsigned NOT NULL COMMENT 'nic id',
|
||||
`name` varchar(255) NOT NULL,
|
||||
`value` varchar(1024) NOT NULL,
|
||||
`display_detail` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Should detail be displayed to the end user',
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `fk_nic_details__nic_id` FOREIGN KEY `fk_nic_details__nic_id`(`nic_id`) REFERENCES `nics`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `cloud`.`disk_offering_details` (
|
||||
`id` bigint unsigned NOT NULL auto_increment,
|
||||
`offering_id` bigint unsigned NOT NULL COMMENT 'offering id',
|
||||
`name` varchar(255) NOT NULL,
|
||||
`value` varchar(1024) NOT NULL,
|
||||
`display_detail` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Should detail be displayed to the end user',
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `fk_offering_details__offering_id` FOREIGN KEY `fk_offering_details__offering_id`(`offering_id`) REFERENCES `disk_offering`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `cloud`.`global_load_balancing_rules` (
|
||||
`id` bigint unsigned NOT NULL auto_increment COMMENT 'id',
|
||||
`uuid` varchar(40),
|
||||
|
|
@ -1110,3 +1162,301 @@ CREATE VIEW `cloud`.`account_view` AS
|
|||
and async_job.job_status = 0;
|
||||
|
||||
alter table `cloud_usage`.`usage_network_offering` add column nic_id bigint(20) unsigned NOT NULL;
|
||||
DROP VIEW IF EXISTS `cloud`.`disk_offering_view`;
|
||||
CREATE VIEW `cloud`.`disk_offering_view` AS
|
||||
select
|
||||
disk_offering.id,
|
||||
disk_offering.uuid,
|
||||
disk_offering.name,
|
||||
disk_offering.display_text,
|
||||
disk_offering.disk_size,
|
||||
disk_offering.created,
|
||||
disk_offering.tags,
|
||||
disk_offering.customized,
|
||||
disk_offering.removed,
|
||||
disk_offering.use_local_storage,
|
||||
disk_offering.system_use,
|
||||
disk_offering.sort_key,
|
||||
disk_offering.type,
|
||||
disk_offering.display_offering,
|
||||
domain.id domain_id,
|
||||
domain.uuid domain_uuid,
|
||||
domain.name domain_name,
|
||||
domain.path domain_path
|
||||
from
|
||||
`cloud`.`disk_offering`
|
||||
left join
|
||||
`cloud`.`domain` ON disk_offering.domain_id = domain.id;
|
||||
|
||||
DROP VIEW IF EXISTS `cloud`.`user_vm_view`;
|
||||
CREATE VIEW `cloud`.`user_vm_view` AS
|
||||
select
|
||||
vm_instance.id id,
|
||||
vm_instance.name name,
|
||||
user_vm.display_name display_name,
|
||||
user_vm.user_data user_data,
|
||||
account.id account_id,
|
||||
account.uuid account_uuid,
|
||||
account.account_name account_name,
|
||||
account.type account_type,
|
||||
domain.id domain_id,
|
||||
domain.uuid domain_uuid,
|
||||
domain.name domain_name,
|
||||
domain.path domain_path,
|
||||
projects.id project_id,
|
||||
projects.uuid project_uuid,
|
||||
projects.name project_name,
|
||||
instance_group.id instance_group_id,
|
||||
instance_group.uuid instance_group_uuid,
|
||||
instance_group.name instance_group_name,
|
||||
vm_instance.uuid uuid,
|
||||
vm_instance.last_host_id last_host_id,
|
||||
vm_instance.vm_type type,
|
||||
vm_instance.vnc_password vnc_password,
|
||||
vm_instance.limit_cpu_use limit_cpu_use,
|
||||
vm_instance.created created,
|
||||
vm_instance.state state,
|
||||
vm_instance.removed removed,
|
||||
vm_instance.ha_enabled ha_enabled,
|
||||
vm_instance.hypervisor_type hypervisor_type,
|
||||
vm_instance.instance_name instance_name,
|
||||
vm_instance.guest_os_id guest_os_id,
|
||||
vm_instance.display_vm display_vm,
|
||||
guest_os.uuid guest_os_uuid,
|
||||
vm_instance.pod_id pod_id,
|
||||
host_pod_ref.uuid pod_uuid,
|
||||
vm_instance.private_ip_address private_ip_address,
|
||||
vm_instance.private_mac_address private_mac_address,
|
||||
vm_instance.vm_type vm_type,
|
||||
data_center.id data_center_id,
|
||||
data_center.uuid data_center_uuid,
|
||||
data_center.name data_center_name,
|
||||
data_center.is_security_group_enabled security_group_enabled,
|
||||
host.id host_id,
|
||||
host.uuid host_uuid,
|
||||
host.name host_name,
|
||||
vm_template.id template_id,
|
||||
vm_template.uuid template_uuid,
|
||||
vm_template.name template_name,
|
||||
vm_template.display_text template_display_text,
|
||||
vm_template.enable_password password_enabled,
|
||||
iso.id iso_id,
|
||||
iso.uuid iso_uuid,
|
||||
iso.name iso_name,
|
||||
iso.display_text iso_display_text,
|
||||
service_offering.id service_offering_id,
|
||||
disk_offering.uuid service_offering_uuid,
|
||||
service_offering.cpu cpu,
|
||||
service_offering.speed speed,
|
||||
service_offering.ram_size ram_size,
|
||||
disk_offering.name service_offering_name,
|
||||
storage_pool.id pool_id,
|
||||
storage_pool.uuid pool_uuid,
|
||||
storage_pool.pool_type pool_type,
|
||||
volumes.id volume_id,
|
||||
volumes.uuid volume_uuid,
|
||||
volumes.device_id volume_device_id,
|
||||
volumes.volume_type volume_type,
|
||||
security_group.id security_group_id,
|
||||
security_group.uuid security_group_uuid,
|
||||
security_group.name security_group_name,
|
||||
security_group.description security_group_description,
|
||||
nics.id nic_id,
|
||||
nics.uuid nic_uuid,
|
||||
nics.network_id network_id,
|
||||
nics.ip4_address ip_address,
|
||||
nics.ip6_address ip6_address,
|
||||
nics.ip6_gateway ip6_gateway,
|
||||
nics.ip6_cidr ip6_cidr,
|
||||
nics.default_nic is_default_nic,
|
||||
nics.gateway gateway,
|
||||
nics.netmask netmask,
|
||||
nics.mac_address mac_address,
|
||||
nics.broadcast_uri broadcast_uri,
|
||||
nics.isolation_uri isolation_uri,
|
||||
vpc.id vpc_id,
|
||||
vpc.uuid vpc_uuid,
|
||||
networks.uuid network_uuid,
|
||||
networks.name network_name,
|
||||
networks.traffic_type traffic_type,
|
||||
networks.guest_type guest_type,
|
||||
user_ip_address.id public_ip_id,
|
||||
user_ip_address.uuid public_ip_uuid,
|
||||
user_ip_address.public_ip_address public_ip_address,
|
||||
ssh_keypairs.keypair_name keypair_name,
|
||||
resource_tags.id tag_id,
|
||||
resource_tags.uuid tag_uuid,
|
||||
resource_tags.key tag_key,
|
||||
resource_tags.value tag_value,
|
||||
resource_tags.domain_id tag_domain_id,
|
||||
resource_tags.account_id tag_account_id,
|
||||
resource_tags.resource_id tag_resource_id,
|
||||
resource_tags.resource_uuid tag_resource_uuid,
|
||||
resource_tags.resource_type tag_resource_type,
|
||||
resource_tags.customer tag_customer,
|
||||
async_job.id job_id,
|
||||
async_job.uuid job_uuid,
|
||||
async_job.job_status job_status,
|
||||
async_job.account_id job_account_id
|
||||
from
|
||||
`cloud`.`user_vm`
|
||||
inner join
|
||||
`cloud`.`vm_instance` ON vm_instance.id = user_vm.id
|
||||
and vm_instance.removed is NULL
|
||||
inner join
|
||||
`cloud`.`account` ON vm_instance.account_id = account.id
|
||||
inner join
|
||||
`cloud`.`domain` ON vm_instance.domain_id = domain.id
|
||||
left join
|
||||
`cloud`.`guest_os` ON vm_instance.guest_os_id = guest_os.id
|
||||
left join
|
||||
`cloud`.`host_pod_ref` ON vm_instance.pod_id = host_pod_ref.id
|
||||
left join
|
||||
`cloud`.`projects` ON projects.project_account_id = account.id
|
||||
left join
|
||||
`cloud`.`instance_group_vm_map` ON vm_instance.id = instance_group_vm_map.instance_id
|
||||
left join
|
||||
`cloud`.`instance_group` ON instance_group_vm_map.group_id = instance_group.id
|
||||
left join
|
||||
`cloud`.`data_center` ON vm_instance.data_center_id = data_center.id
|
||||
left join
|
||||
`cloud`.`host` ON vm_instance.host_id = host.id
|
||||
left join
|
||||
`cloud`.`vm_template` ON vm_instance.vm_template_id = vm_template.id
|
||||
left join
|
||||
`cloud`.`vm_template` iso ON iso.id = user_vm.iso_id
|
||||
left join
|
||||
`cloud`.`service_offering` ON vm_instance.service_offering_id = service_offering.id
|
||||
left join
|
||||
`cloud`.`disk_offering` ON vm_instance.service_offering_id = disk_offering.id
|
||||
left join
|
||||
`cloud`.`volumes` ON vm_instance.id = volumes.instance_id
|
||||
left join
|
||||
`cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id
|
||||
left join
|
||||
`cloud`.`security_group_vm_map` ON vm_instance.id = security_group_vm_map.instance_id
|
||||
left join
|
||||
`cloud`.`security_group` ON security_group_vm_map.security_group_id = security_group.id
|
||||
left join
|
||||
`cloud`.`nics` ON vm_instance.id = nics.instance_id
|
||||
left join
|
||||
`cloud`.`networks` ON nics.network_id = networks.id
|
||||
left join
|
||||
`cloud`.`vpc` ON networks.vpc_id = vpc.id
|
||||
left join
|
||||
`cloud`.`user_ip_address` ON user_ip_address.vm_id = vm_instance.id
|
||||
left join
|
||||
`cloud`.`user_vm_details` ON user_vm_details.vm_id = vm_instance.id
|
||||
and user_vm_details.name = 'SSH.PublicKey'
|
||||
left join
|
||||
`cloud`.`ssh_keypairs` ON ssh_keypairs.public_key = user_vm_details.value
|
||||
left join
|
||||
`cloud`.`resource_tags` ON resource_tags.resource_id = vm_instance.id
|
||||
and resource_tags.resource_type = 'UserVm'
|
||||
left join
|
||||
`cloud`.`async_job` ON async_job.instance_id = vm_instance.id
|
||||
and async_job.instance_type = 'VirtualMachine'
|
||||
and async_job.job_status = 0;
|
||||
|
||||
DROP VIEW IF EXISTS `cloud`.`volume_view`;
|
||||
CREATE VIEW `cloud`.`volume_view` AS
|
||||
select
|
||||
volumes.id,
|
||||
volumes.uuid,
|
||||
volumes.name,
|
||||
volumes.device_id,
|
||||
volumes.volume_type,
|
||||
volumes.size,
|
||||
volumes.created,
|
||||
volumes.state,
|
||||
volumes.attached,
|
||||
volumes.removed,
|
||||
volumes.pod_id,
|
||||
volumes.display_volume,
|
||||
account.id account_id,
|
||||
account.uuid account_uuid,
|
||||
account.account_name account_name,
|
||||
account.type account_type,
|
||||
domain.id domain_id,
|
||||
domain.uuid domain_uuid,
|
||||
domain.name domain_name,
|
||||
domain.path domain_path,
|
||||
projects.id project_id,
|
||||
projects.uuid project_uuid,
|
||||
projects.name project_name,
|
||||
data_center.id data_center_id,
|
||||
data_center.uuid data_center_uuid,
|
||||
data_center.name data_center_name,
|
||||
vm_instance.id vm_id,
|
||||
vm_instance.uuid vm_uuid,
|
||||
vm_instance.name vm_name,
|
||||
vm_instance.state vm_state,
|
||||
vm_instance.vm_type,
|
||||
user_vm.display_name vm_display_name,
|
||||
volume_host_ref.size volume_host_size,
|
||||
volume_host_ref.created volume_host_created,
|
||||
volume_host_ref.format,
|
||||
volume_host_ref.download_pct,
|
||||
volume_host_ref.download_state,
|
||||
volume_host_ref.error_str,
|
||||
disk_offering.id disk_offering_id,
|
||||
disk_offering.uuid disk_offering_uuid,
|
||||
disk_offering.name disk_offering_name,
|
||||
disk_offering.display_text disk_offering_display_text,
|
||||
disk_offering.use_local_storage,
|
||||
disk_offering.system_use,
|
||||
storage_pool.id pool_id,
|
||||
storage_pool.uuid pool_uuid,
|
||||
storage_pool.name pool_name,
|
||||
cluster.hypervisor_type,
|
||||
vm_template.id template_id,
|
||||
vm_template.uuid template_uuid,
|
||||
vm_template.extractable,
|
||||
vm_template.type template_type,
|
||||
resource_tags.id tag_id,
|
||||
resource_tags.uuid tag_uuid,
|
||||
resource_tags.key tag_key,
|
||||
resource_tags.value tag_value,
|
||||
resource_tags.domain_id tag_domain_id,
|
||||
resource_tags.account_id tag_account_id,
|
||||
resource_tags.resource_id tag_resource_id,
|
||||
resource_tags.resource_uuid tag_resource_uuid,
|
||||
resource_tags.resource_type tag_resource_type,
|
||||
resource_tags.customer tag_customer,
|
||||
async_job.id job_id,
|
||||
async_job.uuid job_uuid,
|
||||
async_job.job_status job_status,
|
||||
async_job.account_id job_account_id
|
||||
from
|
||||
`cloud`.`volumes`
|
||||
inner join
|
||||
`cloud`.`account` ON volumes.account_id = account.id
|
||||
inner join
|
||||
`cloud`.`domain` ON volumes.domain_id = domain.id
|
||||
left join
|
||||
`cloud`.`projects` ON projects.project_account_id = account.id
|
||||
left join
|
||||
`cloud`.`data_center` ON volumes.data_center_id = data_center.id
|
||||
left join
|
||||
`cloud`.`vm_instance` ON volumes.instance_id = vm_instance.id
|
||||
left join
|
||||
`cloud`.`user_vm` ON user_vm.id = vm_instance.id
|
||||
left join
|
||||
`cloud`.`volume_host_ref` ON volumes.id = volume_host_ref.volume_id
|
||||
and volumes.data_center_id = volume_host_ref.zone_id
|
||||
left join
|
||||
`cloud`.`disk_offering` ON volumes.disk_offering_id = disk_offering.id
|
||||
left join
|
||||
`cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id
|
||||
left join
|
||||
`cloud`.`cluster` ON storage_pool.cluster_id = cluster.id
|
||||
left join
|
||||
`cloud`.`vm_template` ON volumes.template_id = vm_template.id
|
||||
left join
|
||||
`cloud`.`resource_tags` ON resource_tags.resource_id = volumes.id
|
||||
and resource_tags.resource_type = 'Volume'
|
||||
left join
|
||||
`cloud`.`async_job` ON async_job.instance_id = volumes.id
|
||||
and async_job.instance_type = 'Volume'
|
||||
and async_job.job_status = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue