mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Separate Template/ISO related APIs to use two different views.
This commit is contained in:
parent
e66b58b65f
commit
8f21eca922
@ -216,10 +216,6 @@ public interface ResponseGenerator {
|
||||
|
||||
SnapshotPolicyResponse createSnapshotPolicyResponse(SnapshotPolicy policy);
|
||||
|
||||
//List<UserVmResponse> createUserVmResponse(String objectName, UserVm... userVms);
|
||||
|
||||
//List<UserVmResponse> createUserVmResponse(String objectName, EnumSet<VMDetails> details, UserVm... userVms);
|
||||
|
||||
List<UserVmResponse> createUserVmResponse(ResponseView view, String objectName, UserVm... userVms);
|
||||
|
||||
List<UserVmResponse> createUserVmResponse(ResponseView view, String objectName, EnumSet<VMDetails> details, UserVm... userVms);
|
||||
@ -285,17 +281,13 @@ public interface ResponseGenerator {
|
||||
|
||||
Host findHostById(Long hostId);
|
||||
|
||||
//List<TemplateResponse> createTemplateResponses(long templateId, long zoneId, boolean readyOnly);
|
||||
|
||||
VpnUsersResponse createVpnUserResponse(VpnUser user);
|
||||
|
||||
RemoteAccessVpnResponse createRemoteAccessVpnResponse(RemoteAccessVpn vpn);
|
||||
|
||||
List<TemplateResponse> createTemplateResponses(long templateId, Long zoneId, boolean readyOnly);
|
||||
List<TemplateResponse> createTemplateResponses(ResponseView view, long templateId, Long zoneId, boolean readyOnly);
|
||||
|
||||
List<TemplateResponse> createTemplateResponses(long templateId, Long snapshotId, Long volumeId, boolean readyOnly);
|
||||
|
||||
//ListResponse<SecurityGroupResponse> createSecurityGroupResponses(List<? extends SecurityGroupRules> networkGroups);
|
||||
List<TemplateResponse> createTemplateResponses(ResponseView view, long templateId, Long snapshotId, Long volumeId, boolean readyOnly);
|
||||
|
||||
SecurityGroupResponse createSecurityGroupResponseFromSecurityGroupRule(List<? extends SecurityRule> SecurityRules);
|
||||
|
||||
@ -309,11 +301,9 @@ public interface ResponseGenerator {
|
||||
|
||||
EventResponse createEventResponse(Event event);
|
||||
|
||||
//List<EventResponse> createEventResponse(EventJoinVO... events);
|
||||
TemplateResponse createTemplateUpdateResponse(ResponseView view, VirtualMachineTemplate result);
|
||||
|
||||
TemplateResponse createTemplateUpdateResponse(VirtualMachineTemplate result);
|
||||
|
||||
List<TemplateResponse> createTemplateResponses(VirtualMachineTemplate result, Long zoneId, boolean readyOnly);
|
||||
List<TemplateResponse> createTemplateResponses(ResponseView view, VirtualMachineTemplate result, Long zoneId, boolean readyOnly);
|
||||
|
||||
List<CapacityResponse> createCapacityResponse(List<? extends Capacity> result, DecimalFormat format);
|
||||
|
||||
@ -327,20 +317,15 @@ public interface ResponseGenerator {
|
||||
|
||||
UserResponse createUserResponse(User user);
|
||||
|
||||
//List<UserResponse> createUserResponse(UserAccountJoinVO... users);
|
||||
|
||||
AccountResponse createUserAccountResponse(UserAccount user);
|
||||
|
||||
Long getSecurityGroupId(String groupName, long accountId);
|
||||
|
||||
List<TemplateResponse> createIsoResponses(VirtualMachineTemplate iso, Long zoneId, boolean readyOnly);
|
||||
|
||||
// List<TemplateResponse> createIsoResponses(long isoId, Long zoneId, boolean readyOnly);
|
||||
//List<TemplateResponse> createIsoResponses(VirtualMachineTemplate iso, long zoneId, boolean readyOnly);
|
||||
List<TemplateResponse> createIsoResponses(ResponseView view, VirtualMachineTemplate iso, Long zoneId, boolean readyOnly);
|
||||
|
||||
ProjectResponse createProjectResponse(Project project);
|
||||
|
||||
List<TemplateResponse> createTemplateResponses(long templateId, Long vmId);
|
||||
List<TemplateResponse> createTemplateResponses(ResponseView view, long templateId, Long vmId);
|
||||
|
||||
FirewallResponse createFirewallResponse(FirewallRule fwRule);
|
||||
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
// 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.admin.iso;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.command.user.iso.ListIsosCmd;
|
||||
import org.apache.cloudstack.api.response.TemplateResponse;
|
||||
|
||||
@APICommand(name = "listIsos", description = "Lists all available ISO files.", responseObject = TemplateResponse.class, responseView = ResponseView.Full)
|
||||
public class ListIsosCmdByAdmin extends ListIsosCmd {
|
||||
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
// 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.admin.iso;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.command.user.iso.RegisterIsoCmd;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.TemplateResponse;
|
||||
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
|
||||
@APICommand(name = "registerIso", responseObject = TemplateResponse.class, description = "Registers an existing ISO into the CloudStack Cloud.", responseView = ResponseView.Full)
|
||||
public class RegisterIsoCmdByAdmin extends RegisterIsoCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(RegisterIsoCmdByAdmin.class.getName());
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() throws ResourceAllocationException{
|
||||
VirtualMachineTemplate template = _templateService.registerIso(this);
|
||||
if (template != null) {
|
||||
ListResponse<TemplateResponse> response = new ListResponse<TemplateResponse>();
|
||||
List<TemplateResponse> templateResponses = _responseGenerator.createIsoResponses(ResponseView.Full, template, zoneId, false);
|
||||
response.setResponses(templateResponses);
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to register iso");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
// 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.admin.iso;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.command.user.iso.UpdateIsoCmd;
|
||||
import org.apache.cloudstack.api.response.TemplateResponse;
|
||||
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
|
||||
@APICommand(name = "updateIso", description = "Updates an ISO file.", responseObject = TemplateResponse.class, responseView = ResponseView.Full)
|
||||
public class UpdateIsoCmdByAdmin extends UpdateIsoCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(UpdateIsoCmdByAdmin.class.getName());
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
VirtualMachineTemplate result = _templateService.updateTemplate(this);
|
||||
if (result != null) {
|
||||
TemplateResponse response = _responseGenerator.createTemplateUpdateResponse(ResponseView.Full, result);
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update iso");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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.admin.template;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.command.user.template.CopyTemplateCmd;
|
||||
import org.apache.cloudstack.api.response.TemplateResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.StorageUnavailableException;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
|
||||
@APICommand(name = "copyTemplate", description = "Copies a template from one zone to another.", responseObject = TemplateResponse.class, responseView = ResponseView.Full)
|
||||
public class CopyTemplateCmdByAdmin extends CopyTemplateCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CopyTemplateCmdByAdmin.class.getName());
|
||||
|
||||
@Override
|
||||
public void execute() throws ResourceAllocationException{
|
||||
try {
|
||||
CallContext.current().setEventDetails(getEventDescription());
|
||||
VirtualMachineTemplate template = _templateService.copyTemplate(this);
|
||||
|
||||
if (template != null){
|
||||
List<TemplateResponse> listResponse = _responseGenerator.createTemplateResponses(ResponseView.Full, template, getDestinationZoneId(), false);
|
||||
TemplateResponse response = new TemplateResponse();
|
||||
if (listResponse != null && !listResponse.isEmpty()) {
|
||||
response = listResponse.get(0);
|
||||
}
|
||||
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to copy template");
|
||||
}
|
||||
} catch (StorageUnavailableException ex) {
|
||||
s_logger.warn("Exception: ", ex);
|
||||
throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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.admin.template;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.command.user.template.CreateTemplateCmd;
|
||||
import org.apache.cloudstack.api.response.TemplateResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
|
||||
@APICommand(name = "createTemplate", responseObject = TemplateResponse.class, description = "Creates a template of a virtual machine. " + "The virtual machine must be in a STOPPED state. "
|
||||
+ "A template created from this command is automatically designated as a private template visible to the account that created it.", responseView = ResponseView.Full)
|
||||
public class CreateTemplateCmdByAdmin extends CreateTemplateCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CreateTemplateCmdByAdmin.class.getName());
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
CallContext.current().setEventDetails("Template Id: "+getEntityId()+((getSnapshotId() == null) ? " from volume Id: " + getVolumeId() : " from snapshot Id: " + getSnapshotId()));
|
||||
VirtualMachineTemplate template = null;
|
||||
template = _templateService.createPrivateTemplate(this);
|
||||
|
||||
if (template != null){
|
||||
List<TemplateResponse> templateResponses;
|
||||
if (isBareMetal()) {
|
||||
templateResponses = _responseGenerator.createTemplateResponses(ResponseView.Full, template.getId(), vmId);
|
||||
} else {
|
||||
templateResponses = _responseGenerator.createTemplateResponses(ResponseView.Full, template.getId(), snapshotId, volumeId, false);
|
||||
}
|
||||
TemplateResponse response = new TemplateResponse();
|
||||
if (templateResponses != null && !templateResponses.isEmpty()) {
|
||||
response = templateResponses.get(0);
|
||||
}
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create private template");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
// 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.admin.template;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.command.user.template.ListTemplatesCmd;
|
||||
import org.apache.cloudstack.api.response.TemplateResponse;
|
||||
|
||||
@APICommand(name = "listTemplates", description = "List all public, private, and privileged templates.", responseObject = TemplateResponse.class, responseView = ResponseView.Full)
|
||||
public class ListTemplatesCmdByAdmin extends ListTemplatesCmd {
|
||||
|
||||
}
|
||||
@ -18,14 +18,16 @@ package org.apache.cloudstack.api.command.admin.template;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.TemplateResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import com.cloud.user.Account;
|
||||
@ -80,10 +82,10 @@ public class PrepareTemplateCmd extends BaseCmd {
|
||||
ListResponse<TemplateResponse> response = new ListResponse<TemplateResponse>();
|
||||
|
||||
VirtualMachineTemplate vmTemplate = _templateService.prepareTemplate(templateId, zoneId);
|
||||
List<TemplateResponse> templateResponses = _responseGenerator.createTemplateResponses(vmTemplate, zoneId, true);
|
||||
List<TemplateResponse> templateResponses = _responseGenerator.createTemplateResponses(ResponseView.Full, vmTemplate, zoneId, true);
|
||||
response.setResponses(templateResponses);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
setResponseObject(response);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,57 @@
|
||||
// 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.admin.template;
|
||||
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.command.user.template.RegisterTemplateCmd;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.TemplateResponse;
|
||||
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
|
||||
@APICommand(name = "registerTemplate", description = "Registers an existing template into the CloudStack cloud. ", responseObject = TemplateResponse.class, responseView = ResponseView.Full)
|
||||
public class RegisterTemplateCmdByAdmin extends RegisterTemplateCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(RegisterTemplateCmdByAdmin.class.getName());
|
||||
|
||||
@Override
|
||||
public void execute() throws ResourceAllocationException{
|
||||
try {
|
||||
VirtualMachineTemplate template = _templateService.registerTemplate(this);
|
||||
if (template != null){
|
||||
ListResponse<TemplateResponse> response = new ListResponse<TemplateResponse>();
|
||||
List<TemplateResponse> templateResponses = _responseGenerator.createTemplateResponses(ResponseView.Full, template, zoneId, false);
|
||||
response.setResponses(templateResponses);
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to register template");
|
||||
}
|
||||
} catch (URISyntaxException ex1) {
|
||||
s_logger.info(ex1);
|
||||
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ex1.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
// 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.admin.template;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.command.user.template.UpdateTemplateCmd;
|
||||
import org.apache.cloudstack.api.response.TemplateResponse;
|
||||
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
|
||||
@APICommand(name = "updateTemplate", description = "Updates attributes of a template.", responseObject = TemplateResponse.class, responseView = ResponseView.Full)
|
||||
public class UpdateTemplateCmdByAdmin extends UpdateTemplateCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(UpdateTemplateCmdByAdmin.class.getName());
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
VirtualMachineTemplate result = _templateService.updateTemplate(this);
|
||||
if (result != null) {
|
||||
TemplateResponse response = _responseGenerator.createTemplateUpdateResponse(ResponseView.Full, result);
|
||||
response.setObjectName("template");
|
||||
response.setTemplateType(result.getTemplateType().toString());//Template can be either USER or ROUTING type
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update template");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -16,22 +16,23 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.user.iso;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandJobType;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.TemplateResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.template.VirtualMachineTemplate.TemplateFilter;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
@APICommand(name = "listIsos", description="Lists all available ISO files.", responseObject=TemplateResponse.class)
|
||||
@APICommand(name = "listIsos", description = "Lists all available ISO files.", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted)
|
||||
public class ListIsosCmd extends BaseListTaggedResourcesCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListIsosCmd.class.getName());
|
||||
|
||||
@ -139,6 +140,7 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiCommandJobType getInstanceType() {
|
||||
return ApiCommandJobType.Iso;
|
||||
}
|
||||
@ -147,6 +149,6 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd {
|
||||
public void execute(){
|
||||
ListResponse<TemplateResponse> response = _queryService.listIsos(this);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
setResponseObject(response);
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,11 +18,14 @@ package org.apache.cloudstack.api.command.user.iso;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.DomainResponse;
|
||||
import org.apache.cloudstack.api.response.GuestOSResponse;
|
||||
@ -32,12 +35,10 @@ import org.apache.cloudstack.api.response.TemplateResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
|
||||
@APICommand(name = "registerIso", responseObject=TemplateResponse.class, description="Registers an existing ISO into the CloudStack Cloud.")
|
||||
@APICommand(name = "registerIso", responseObject = TemplateResponse.class, description = "Registers an existing ISO into the CloudStack Cloud.", responseView = ResponseView.Restricted)
|
||||
public class RegisterIsoCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(RegisterIsoCmd.class.getName());
|
||||
|
||||
@ -74,7 +75,7 @@ public class RegisterIsoCmd extends BaseCmd {
|
||||
|
||||
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
|
||||
required=true, description="the ID of the zone you wish to register the ISO to.")
|
||||
private Long zoneId;
|
||||
protected Long zoneId;
|
||||
|
||||
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType = DomainResponse.class,
|
||||
description="an optional domainId. If the account parameter is used, domainId must also be used.")
|
||||
@ -150,7 +151,7 @@ public class RegisterIsoCmd extends BaseCmd {
|
||||
}
|
||||
|
||||
public String getImageStoreUuid() {
|
||||
return this.imageStoreUuid;
|
||||
return imageStoreUuid;
|
||||
}
|
||||
|
||||
public Boolean isDynamicallyScalable() {
|
||||
@ -181,10 +182,10 @@ public class RegisterIsoCmd extends BaseCmd {
|
||||
VirtualMachineTemplate template = _templateService.registerIso(this);
|
||||
if (template != null) {
|
||||
ListResponse<TemplateResponse> response = new ListResponse<TemplateResponse>();
|
||||
List<TemplateResponse> templateResponses = _responseGenerator.createIsoResponses(template, zoneId, false);
|
||||
List<TemplateResponse> templateResponses = _responseGenerator.createIsoResponses(ResponseView.Restricted, template, zoneId, false);
|
||||
response.setResponses(templateResponses);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to register iso");
|
||||
}
|
||||
|
||||
@ -16,17 +16,19 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.user.iso;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoCmd;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.TemplateResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
@APICommand(name = "updateIso", description="Updates an ISO file.", responseObject=TemplateResponse.class)
|
||||
@APICommand(name = "updateIso", description = "Updates an ISO file.", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted)
|
||||
public class UpdateIsoCmd extends BaseUpdateTemplateOrIsoCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(UpdateIsoCmd.class.getName());
|
||||
private static final String s_name = "updateisoresponse";
|
||||
@ -68,9 +70,9 @@ public class UpdateIsoCmd extends BaseUpdateTemplateOrIsoCmd {
|
||||
public void execute(){
|
||||
VirtualMachineTemplate result = _templateService.updateTemplate(this);
|
||||
if (result != null) {
|
||||
TemplateResponse response = _responseGenerator.createTemplateUpdateResponse(result);
|
||||
TemplateResponse response = _responseGenerator.createTemplateUpdateResponse(ResponseView.Restricted, result);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update iso");
|
||||
}
|
||||
|
||||
@ -18,27 +18,27 @@ package org.apache.cloudstack.api.command.user.template;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandJobType;
|
||||
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.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.TemplateResponse;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.StorageUnavailableException;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
@APICommand(name = "copyTemplate", description="Copies a template from one zone to another.", responseObject=TemplateResponse.class)
|
||||
@APICommand(name = "copyTemplate", description = "Copies a template from one zone to another.", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted)
|
||||
public class CopyTemplateCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CopyTemplateCmd.class.getName());
|
||||
private static final String s_name = "copytemplateresponse";
|
||||
@ -110,10 +110,12 @@ public class CopyTemplateCmd extends BaseAsyncCmd {
|
||||
return "copying template: " + getId() + " from zone: " + getSourceZoneId() + " to zone: " + getDestinationZoneId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiCommandJobType getInstanceType() {
|
||||
return ApiCommandJobType.Template;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
@ -125,14 +127,14 @@ public class CopyTemplateCmd extends BaseAsyncCmd {
|
||||
VirtualMachineTemplate template = _templateService.copyTemplate(this);
|
||||
|
||||
if (template != null){
|
||||
List<TemplateResponse> listResponse = _responseGenerator.createTemplateResponses(template, getDestinationZoneId(), false);
|
||||
List<TemplateResponse> listResponse = _responseGenerator.createTemplateResponses(ResponseView.Restricted, template, getDestinationZoneId(), false);
|
||||
TemplateResponse response = new TemplateResponse();
|
||||
if (listResponse != null && !listResponse.isEmpty()) {
|
||||
response = listResponse.get(0);
|
||||
}
|
||||
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to copy template");
|
||||
}
|
||||
|
||||
@ -16,6 +16,27 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.user.template;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandJobType;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.GuestOSResponse;
|
||||
import org.apache.cloudstack.api.response.SnapshotResponse;
|
||||
import org.apache.cloudstack.api.response.TemplateResponse;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import org.apache.cloudstack.api.response.VolumeResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
@ -26,28 +47,8 @@ import com.cloud.storage.Volume;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandJobType;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.GuestOSResponse;
|
||||
import org.apache.cloudstack.api.response.SnapshotResponse;
|
||||
import org.apache.cloudstack.api.response.TemplateResponse;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import org.apache.cloudstack.api.response.VolumeResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@APICommand(name = "createTemplate", responseObject = TemplateResponse.class, description = "Creates a template of a virtual machine. " + "The virtual machine must be in a STOPPED state. "
|
||||
+ "A template created from this command is automatically designated as a private template visible to the account that created it.")
|
||||
+ "A template created from this command is automatically designated as a private template visible to the account that created it.", responseView = ResponseView.Restricted)
|
||||
public class CreateTemplateCmd extends BaseAsyncCreateCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CreateTemplateCmd.class.getName());
|
||||
private static final String s_name = "createtemplateresponse";
|
||||
@ -83,15 +84,15 @@ import java.util.Map;
|
||||
|
||||
@Parameter(name = ApiConstants.SNAPSHOT_ID, type = CommandType.UUID, entityType = SnapshotResponse.class,
|
||||
description = "the ID of the snapshot the template is being created from. Either this parameter, or volumeId has to be passed in")
|
||||
private Long snapshotId;
|
||||
protected Long snapshotId;
|
||||
|
||||
@Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class,
|
||||
description = "the ID of the disk volume the template is being created from. Either this parameter, or snapshotId has to be passed in")
|
||||
private Long volumeId;
|
||||
protected Long volumeId;
|
||||
|
||||
@Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = UserVmResponse.class,
|
||||
description="Optional, VM ID. If this presents, it is going to create a baremetal template for VM this ID refers to. This is only for VM whose hypervisor type is BareMetal")
|
||||
private Long vmId;
|
||||
protected Long vmId;
|
||||
|
||||
@Parameter(name=ApiConstants.URL, type=CommandType.STRING, description="Optional, only for baremetal hypervisor. The directory name where template stored on CIFS server")
|
||||
private String url;
|
||||
@ -240,17 +241,17 @@ import java.util.Map;
|
||||
return ApiCommandJobType.Template;
|
||||
}
|
||||
|
||||
private boolean isBareMetal() {
|
||||
return (this.getVmId() != null && this.getUrl() != null);
|
||||
protected boolean isBareMetal() {
|
||||
return (getVmId() != null && getUrl() != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create() throws ResourceAllocationException {
|
||||
VirtualMachineTemplate template = null;
|
||||
template = this._templateService.createPrivateTemplateRecord(this, _accountService.getAccount(getEntityOwnerId()));
|
||||
template = _templateService.createPrivateTemplateRecord(this, _accountService.getAccount(getEntityOwnerId()));
|
||||
if (template != null) {
|
||||
this.setEntityId(template.getId());
|
||||
this.setEntityUuid(template.getUuid());
|
||||
setEntityId(template.getId());
|
||||
setEntityUuid(template.getUuid());
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,
|
||||
"Failed to create a template");
|
||||
@ -262,21 +263,21 @@ import java.util.Map;
|
||||
public void execute() {
|
||||
CallContext.current().setEventDetails("Template Id: "+getEntityId()+((getSnapshotId() == null) ? " from volume Id: " + getVolumeId() : " from snapshot Id: " + getSnapshotId()));
|
||||
VirtualMachineTemplate template = null;
|
||||
template = this._templateService.createPrivateTemplate(this);
|
||||
template = _templateService.createPrivateTemplate(this);
|
||||
|
||||
if (template != null){
|
||||
List<TemplateResponse> templateResponses;
|
||||
if (isBareMetal()) {
|
||||
templateResponses = _responseGenerator.createTemplateResponses(template.getId(), vmId);
|
||||
templateResponses = _responseGenerator.createTemplateResponses(ResponseView.Restricted, template.getId(), vmId);
|
||||
} else {
|
||||
templateResponses = _responseGenerator.createTemplateResponses(template.getId(), snapshotId, volumeId, false);
|
||||
templateResponses = _responseGenerator.createTemplateResponses(ResponseView.Restricted, template.getId(), snapshotId, volumeId, false);
|
||||
}
|
||||
TemplateResponse response = new TemplateResponse();
|
||||
if (templateResponses != null && !templateResponses.isEmpty()) {
|
||||
response = templateResponses.get(0);
|
||||
}
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create private template");
|
||||
}
|
||||
|
||||
@ -16,22 +16,23 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.user.template;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandJobType;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.TemplateResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.template.VirtualMachineTemplate.TemplateFilter;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
@APICommand(name = "listTemplates", description="List all public, private, and privileged templates.", responseObject=TemplateResponse.class)
|
||||
@APICommand(name = "listTemplates", description = "List all public, private, and privileged templates.", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted)
|
||||
public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListTemplatesCmd.class.getName());
|
||||
|
||||
@ -110,6 +111,7 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiCommandJobType getInstanceType() {
|
||||
return ApiCommandJobType.Template;
|
||||
}
|
||||
@ -118,6 +120,6 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
|
||||
public void execute(){
|
||||
ListResponse<TemplateResponse> response = _queryService.listTemplates(this);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
setResponseObject(response);
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,12 +21,15 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandJobType;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.DomainResponse;
|
||||
import org.apache.cloudstack.api.response.GuestOSResponse;
|
||||
@ -36,12 +39,10 @@ import org.apache.cloudstack.api.response.TemplateResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
|
||||
@APICommand(name = "registerTemplate", description="Registers an existing template into the CloudStack cloud. ", responseObject=TemplateResponse.class)
|
||||
@APICommand(name = "registerTemplate", description = "Registers an existing template into the CloudStack cloud. ", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted)
|
||||
public class RegisterTemplateCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(RegisterTemplateCmd.class.getName());
|
||||
|
||||
@ -93,7 +94,7 @@ public class RegisterTemplateCmd extends BaseCmd {
|
||||
|
||||
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
|
||||
required=true, description="the ID of the zone the template is to be hosted on")
|
||||
private Long zoneId;
|
||||
protected Long zoneId;
|
||||
|
||||
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType = DomainResponse.class,
|
||||
description="an optional domainId. If the account parameter is used, domainId must also be used.")
|
||||
@ -245,10 +246,10 @@ public class RegisterTemplateCmd extends BaseCmd {
|
||||
VirtualMachineTemplate template = _templateService.registerTemplate(this);
|
||||
if (template != null){
|
||||
ListResponse<TemplateResponse> response = new ListResponse<TemplateResponse>();
|
||||
List<TemplateResponse> templateResponses = _responseGenerator.createTemplateResponses(template, zoneId, false);
|
||||
List<TemplateResponse> templateResponses = _responseGenerator.createTemplateResponses(ResponseView.Restricted, template, zoneId, false);
|
||||
response.setResponses(templateResponses);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to register template");
|
||||
}
|
||||
|
||||
@ -16,17 +16,19 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.user.template;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoCmd;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.TemplateResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
@APICommand(name = "updateTemplate", description="Updates attributes of a template.", responseObject=TemplateResponse.class)
|
||||
@APICommand(name = "updateTemplate", description = "Updates attributes of a template.", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted)
|
||||
public class UpdateTemplateCmd extends BaseUpdateTemplateOrIsoCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(UpdateTemplateCmd.class.getName());
|
||||
private static final String s_name = "updatetemplateresponse";
|
||||
@ -68,11 +70,11 @@ public class UpdateTemplateCmd extends BaseUpdateTemplateOrIsoCmd {
|
||||
public void execute(){
|
||||
VirtualMachineTemplate result = _templateService.updateTemplate(this);
|
||||
if (result != null) {
|
||||
TemplateResponse response = _responseGenerator.createTemplateUpdateResponse(result);
|
||||
TemplateResponse response = _responseGenerator.createTemplateUpdateResponse(ResponseView.Restricted, result);
|
||||
response.setObjectName("template");
|
||||
response.setTemplateType(result.getTemplateType().toString());//Template can be either USER or ROUTING type
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update template");
|
||||
}
|
||||
|
||||
@ -1664,8 +1664,8 @@ public class ApiDBUtils {
|
||||
}
|
||||
|
||||
|
||||
public static TemplateResponse newTemplateResponse(TemplateJoinVO vr) {
|
||||
return _templateJoinDao.newTemplateResponse(vr);
|
||||
public static TemplateResponse newTemplateResponse(ResponseView view, TemplateJoinVO vr) {
|
||||
return _templateJoinDao.newTemplateResponse(view, vr);
|
||||
}
|
||||
|
||||
|
||||
@ -1673,8 +1673,8 @@ public class ApiDBUtils {
|
||||
return _templateJoinDao.newIsoResponse(vr);
|
||||
}
|
||||
|
||||
public static TemplateResponse fillTemplateDetails(TemplateResponse vrData, TemplateJoinVO vr){
|
||||
return _templateJoinDao.setTemplateResponse(vrData, vr);
|
||||
public static TemplateResponse fillTemplateDetails(ResponseView view, TemplateResponse vrData, TemplateJoinVO vr) {
|
||||
return _templateJoinDao.setTemplateResponse(view, vrData, vr);
|
||||
}
|
||||
|
||||
public static List<TemplateJoinVO> newTemplateView(VirtualMachineTemplate vr){
|
||||
|
||||
@ -1279,15 +1279,15 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TemplateResponse createTemplateUpdateResponse(VirtualMachineTemplate result) {
|
||||
public TemplateResponse createTemplateUpdateResponse(ResponseView view, VirtualMachineTemplate result) {
|
||||
List<TemplateJoinVO> tvo = ApiDBUtils.newTemplateView(result);
|
||||
List<TemplateResponse> listVrs = ViewResponseHelper.createTemplateUpdateResponse(tvo.toArray(new TemplateJoinVO[tvo.size()]));
|
||||
List<TemplateResponse> listVrs = ViewResponseHelper.createTemplateUpdateResponse(view, tvo.toArray(new TemplateJoinVO[tvo.size()]));
|
||||
assert listVrs != null && listVrs.size() == 1 : "There should be one template returned";
|
||||
return listVrs.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TemplateResponse> createTemplateResponses(VirtualMachineTemplate result, Long zoneId, boolean readyOnly) {
|
||||
public List<TemplateResponse> createTemplateResponses(ResponseView view, VirtualMachineTemplate result, Long zoneId, boolean readyOnly) {
|
||||
List<TemplateJoinVO> tvo = null;
|
||||
if (zoneId == null || zoneId == -1) {
|
||||
tvo = ApiDBUtils.newTemplateView(result);
|
||||
@ -1295,18 +1295,18 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
tvo = ApiDBUtils.newTemplateView(result, zoneId, readyOnly);
|
||||
|
||||
}
|
||||
return ViewResponseHelper.createTemplateResponse(tvo.toArray(new TemplateJoinVO[tvo.size()]));
|
||||
return ViewResponseHelper.createTemplateResponse(view, tvo.toArray(new TemplateJoinVO[tvo.size()]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TemplateResponse> createTemplateResponses(long templateId, Long zoneId, boolean readyOnly) {
|
||||
public List<TemplateResponse> createTemplateResponses(ResponseView view, long templateId, Long zoneId, boolean readyOnly) {
|
||||
VirtualMachineTemplate template = findTemplateById(templateId);
|
||||
return createTemplateResponses(template, zoneId, readyOnly);
|
||||
return createTemplateResponses(view, template, zoneId, readyOnly);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<TemplateResponse> createIsoResponses(VirtualMachineTemplate result, Long zoneId, boolean readyOnly) {
|
||||
public List<TemplateResponse> createIsoResponses(ResponseView view, VirtualMachineTemplate result, Long zoneId, boolean readyOnly) {
|
||||
List<TemplateJoinVO> tvo = null;
|
||||
if (zoneId == null || zoneId == -1) {
|
||||
tvo = ApiDBUtils.newTemplateView(result);
|
||||
@ -1314,7 +1314,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
tvo = ApiDBUtils.newTemplateView(result, zoneId, readyOnly);
|
||||
}
|
||||
|
||||
return ViewResponseHelper.createIsoResponse(tvo.toArray(new TemplateJoinVO[tvo.size()]));
|
||||
return ViewResponseHelper.createIsoResponse(view, tvo.toArray(new TemplateJoinVO[tvo.size()]));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1653,7 +1653,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TemplateResponse> createTemplateResponses(long templateId, Long snapshotId, Long volumeId, boolean readyOnly) {
|
||||
public List<TemplateResponse> createTemplateResponses(ResponseView view, long templateId, Long snapshotId, Long volumeId, boolean readyOnly) {
|
||||
VolumeVO volume = null;
|
||||
if (snapshotId != null) {
|
||||
Snapshot snapshot = ApiDBUtils.findSnapshotById(snapshotId);
|
||||
@ -1661,15 +1661,15 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
} else {
|
||||
volume = findVolumeById(volumeId);
|
||||
}
|
||||
return createTemplateResponses(templateId, volume.getDataCenterId(), readyOnly);
|
||||
return createTemplateResponses(view, templateId, volume.getDataCenterId(), readyOnly);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TemplateResponse> createTemplateResponses(long templateId, Long vmId) {
|
||||
public List<TemplateResponse> createTemplateResponses(ResponseView view, long templateId, Long vmId) {
|
||||
UserVm vm = findUserVmById(vmId);
|
||||
Long hostId = (vm.getHostId() == null ? vm.getLastHostId() : vm.getHostId());
|
||||
Host host = findHostById(hostId);
|
||||
return createTemplateResponses(templateId, host.getDataCenterId(), true);
|
||||
return createTemplateResponses(view, templateId, host.getDataCenterId(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -45,10 +45,12 @@ import org.apache.cloudstack.api.ResourceDetail;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.internallb.ListInternalLBVMsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.iso.ListIsosCmdByAdmin;
|
||||
import org.apache.cloudstack.api.command.admin.router.ListRoutersCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.ListImageStoresCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.ListSecondaryStagingStoresCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.template.ListTemplatesCmdByAdmin;
|
||||
import org.apache.cloudstack.api.command.admin.user.ListUsersCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vm.ListVMsCmdByAdmin;
|
||||
import org.apache.cloudstack.api.command.admin.volume.ListVolumesCmdByAdmin;
|
||||
@ -2748,7 +2750,12 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
||||
Pair<List<TemplateJoinVO>, Integer> result = searchForTemplatesInternal(cmd);
|
||||
ListResponse<TemplateResponse> response = new ListResponse<TemplateResponse>();
|
||||
|
||||
List<TemplateResponse> templateResponses = ViewResponseHelper.createTemplateResponse(result.first().toArray(
|
||||
ResponseView respView = ResponseView.Restricted;
|
||||
if (cmd instanceof ListTemplatesCmdByAdmin) {
|
||||
respView = ResponseView.Full;
|
||||
}
|
||||
|
||||
List<TemplateResponse> templateResponses = ViewResponseHelper.createTemplateResponse(respView, result.first().toArray(
|
||||
new TemplateJoinVO[result.first().size()]));
|
||||
response.setResponses(templateResponses, result.second());
|
||||
return response;
|
||||
@ -3045,7 +3052,12 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
||||
Pair<List<TemplateJoinVO>, Integer> result = searchForIsosInternal(cmd);
|
||||
ListResponse<TemplateResponse> response = new ListResponse<TemplateResponse>();
|
||||
|
||||
List<TemplateResponse> templateResponses = ViewResponseHelper.createIsoResponse(result.first().toArray(
|
||||
ResponseView respView = ResponseView.Restricted;
|
||||
if (cmd instanceof ListIsosCmdByAdmin) {
|
||||
respView = ResponseView.Full;
|
||||
}
|
||||
|
||||
List<TemplateResponse> templateResponses = ViewResponseHelper.createIsoResponse(respView, result.first().toArray(
|
||||
new TemplateJoinVO[result.first().size()]));
|
||||
response.setResponses(templateResponses, result.second());
|
||||
return response;
|
||||
|
||||
@ -378,24 +378,24 @@ public class ViewResponseHelper {
|
||||
return respList;
|
||||
}
|
||||
|
||||
public static List<TemplateResponse> createTemplateResponse(TemplateJoinVO... templates) {
|
||||
public static List<TemplateResponse> createTemplateResponse(ResponseView view, TemplateJoinVO... templates) {
|
||||
Hashtable<String, TemplateResponse> vrDataList = new Hashtable<String, TemplateResponse>();
|
||||
for (TemplateJoinVO vr : templates) {
|
||||
TemplateResponse vrData = vrDataList.get(vr.getTempZonePair());
|
||||
if ( vrData == null ){
|
||||
// first time encountering this volume
|
||||
vrData = ApiDBUtils.newTemplateResponse(vr);
|
||||
vrData = ApiDBUtils.newTemplateResponse(view, vr);
|
||||
}
|
||||
else{
|
||||
// update tags
|
||||
vrData = ApiDBUtils.fillTemplateDetails(vrData, vr);
|
||||
vrData = ApiDBUtils.fillTemplateDetails(view, vrData, vr);
|
||||
}
|
||||
vrDataList.put(vr.getTempZonePair(), vrData);
|
||||
}
|
||||
return new ArrayList<TemplateResponse>(vrDataList.values());
|
||||
}
|
||||
|
||||
public static List<TemplateResponse> createTemplateUpdateResponse(TemplateJoinVO... templates) {
|
||||
public static List<TemplateResponse> createTemplateUpdateResponse(ResponseView view, TemplateJoinVO... templates) {
|
||||
Hashtable<Long, TemplateResponse> vrDataList = new Hashtable<Long, TemplateResponse>();
|
||||
for (TemplateJoinVO vr : templates) {
|
||||
TemplateResponse vrData = vrDataList.get(vr.getId());
|
||||
@ -405,14 +405,14 @@ public class ViewResponseHelper {
|
||||
}
|
||||
else{
|
||||
// update tags
|
||||
vrData = ApiDBUtils.fillTemplateDetails(vrData, vr);
|
||||
vrData = ApiDBUtils.fillTemplateDetails(view, vrData, vr);
|
||||
}
|
||||
vrDataList.put(vr.getId(), vrData);
|
||||
}
|
||||
return new ArrayList<TemplateResponse>(vrDataList.values());
|
||||
}
|
||||
|
||||
public static List<TemplateResponse> createIsoResponse(TemplateJoinVO... templates) {
|
||||
public static List<TemplateResponse> createIsoResponse(ResponseView view, TemplateJoinVO... templates) {
|
||||
Hashtable<String, TemplateResponse> vrDataList = new Hashtable<String, TemplateResponse>();
|
||||
for (TemplateJoinVO vr : templates) {
|
||||
TemplateResponse vrData = vrDataList.get(vr.getTempZonePair());
|
||||
@ -422,7 +422,7 @@ public class ViewResponseHelper {
|
||||
}
|
||||
else{
|
||||
// update tags
|
||||
vrData = ApiDBUtils.fillTemplateDetails(vrData, vr);
|
||||
vrData = ApiDBUtils.fillTemplateDetails(view, vrData, vr);
|
||||
}
|
||||
vrDataList.put(vr.getTempZonePair(), vrData);
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ package com.cloud.api.query.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.response.TemplateResponse;
|
||||
|
||||
import com.cloud.api.query.vo.TemplateJoinVO;
|
||||
@ -26,13 +27,13 @@ import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public interface TemplateJoinDao extends GenericDao<TemplateJoinVO, Long> {
|
||||
|
||||
TemplateResponse newTemplateResponse(TemplateJoinVO tmpl);
|
||||
TemplateResponse newTemplateResponse(ResponseView view, TemplateJoinVO tmpl);
|
||||
|
||||
TemplateResponse newIsoResponse(TemplateJoinVO tmpl);
|
||||
|
||||
TemplateResponse newUpdateResponse(TemplateJoinVO tmpl);
|
||||
|
||||
TemplateResponse setTemplateResponse(TemplateResponse tmplData, TemplateJoinVO tmpl);
|
||||
TemplateResponse setTemplateResponse(ResponseView view, TemplateResponse tmplData, TemplateJoinVO tmpl);
|
||||
|
||||
List<TemplateJoinVO> newTemplateView(VirtualMachineTemplate tmpl);
|
||||
|
||||
|
||||
@ -24,16 +24,16 @@ import java.util.Map;
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.response.TemplateResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateState;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.api.ApiDBUtils;
|
||||
import com.cloud.api.ApiResponseHelper;
|
||||
import com.cloud.api.query.vo.ResourceTagJoinVO;
|
||||
@ -94,44 +94,34 @@ public class TemplateJoinDaoImpl extends GenericDaoBase<TemplateJoinVO, Long> im
|
||||
activeTmpltSearch.done();
|
||||
|
||||
// select distinct pair (template_id, zone_id)
|
||||
this._count = "select count(distinct temp_zone_pair) from template_view WHERE ";
|
||||
_count = "select count(distinct temp_zone_pair) from template_view WHERE ";
|
||||
}
|
||||
|
||||
|
||||
|
||||
private String getTemplateStatus(TemplateJoinVO template){
|
||||
boolean isAdmin = false;
|
||||
Account caller = CallContext.current().getCallingAccount();
|
||||
if ((caller == null) || _accountService.isAdmin(caller.getType())) {
|
||||
isAdmin = true;
|
||||
}
|
||||
|
||||
// If the user is an Admin, add the template download status
|
||||
private String getTemplateStatus(TemplateJoinVO template) {
|
||||
String templateStatus = null;
|
||||
if (isAdmin || caller.getId() == template.getAccountId()) {
|
||||
// add download status
|
||||
if (template.getDownloadState() != Status.DOWNLOADED) {
|
||||
templateStatus = "Processing";
|
||||
if (template.getDownloadState() == VMTemplateHostVO.Status.DOWNLOAD_IN_PROGRESS) {
|
||||
if (template.getDownloadPercent() == 100) {
|
||||
templateStatus = "Installing Template";
|
||||
} else {
|
||||
templateStatus = template.getDownloadPercent() + "% Downloaded";
|
||||
}
|
||||
if (template.getDownloadState() != Status.DOWNLOADED) {
|
||||
templateStatus = "Processing";
|
||||
if (template.getDownloadState() == VMTemplateHostVO.Status.DOWNLOAD_IN_PROGRESS) {
|
||||
if (template.getDownloadPercent() == 100) {
|
||||
templateStatus = "Installing Template";
|
||||
} else {
|
||||
templateStatus = template.getErrorString();
|
||||
templateStatus = template.getDownloadPercent() + "% Downloaded";
|
||||
}
|
||||
} else if (template.getDownloadState() == VMTemplateHostVO.Status.DOWNLOADED) {
|
||||
templateStatus = "Download Complete";
|
||||
} else {
|
||||
templateStatus = "Successfully Installed";
|
||||
templateStatus = template.getErrorString();
|
||||
}
|
||||
} else if (template.getDownloadState() == VMTemplateHostVO.Status.DOWNLOADED) {
|
||||
templateStatus = "Download Complete";
|
||||
} else {
|
||||
templateStatus = "Successfully Installed";
|
||||
}
|
||||
return templateStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TemplateResponse newTemplateResponse(TemplateJoinVO template) {
|
||||
public TemplateResponse newTemplateResponse(ResponseView view, TemplateJoinVO template) {
|
||||
TemplateResponse templateResponse = new TemplateResponse();
|
||||
templateResponse.setId(template.getUuid());
|
||||
templateResponse.setName(template.getName());
|
||||
@ -171,9 +161,11 @@ public class TemplateJoinDaoImpl extends GenericDaoBase<TemplateJoinVO, Long> im
|
||||
|
||||
|
||||
// If the user is an Admin, add the template download status
|
||||
String templateStatus = getTemplateStatus(template);
|
||||
if ( templateStatus != null ){
|
||||
templateResponse.setStatus(templateStatus);
|
||||
if (view == ResponseView.Full) {
|
||||
String templateStatus = getTemplateStatus(template);
|
||||
if (templateStatus != null) {
|
||||
templateResponse.setStatus(templateStatus);
|
||||
}
|
||||
}
|
||||
|
||||
if ( template.getDataCenterId() > 0 ){
|
||||
@ -261,7 +253,7 @@ public class TemplateJoinDaoImpl extends GenericDaoBase<TemplateJoinVO, Long> im
|
||||
|
||||
|
||||
@Override
|
||||
public TemplateResponse setTemplateResponse(TemplateResponse templateResponse, TemplateJoinVO template) {
|
||||
public TemplateResponse setTemplateResponse(ResponseView view, TemplateResponse templateResponse, TemplateJoinVO template) {
|
||||
|
||||
// update details map
|
||||
if (template.getDetailName() != null){
|
||||
|
||||
@ -127,7 +127,7 @@ public class UserVmJoinDaoImpl extends GenericDaoBase<UserVmJoinVO, Long> implem
|
||||
}
|
||||
userVmResponse.setZoneId(userVm.getDataCenterUuid());
|
||||
userVmResponse.setZoneName(userVm.getDataCenterName());
|
||||
if (view == ResponseView.Full || ((view == null) && ((caller == null) || (_accountMgr.isRootAdmin(caller.getId()))))) {
|
||||
if (view == ResponseView.Full) {
|
||||
userVmResponse.setInstanceName(userVm.getInstanceName());
|
||||
userVmResponse.setHostId(userVm.getHostUuid());
|
||||
userVmResponse.setHostName(userVm.getHostName());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user