Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions api/src/main/java/com/cloud/server/ManagementService.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@
import org.apache.cloudstack.api.command.admin.guest.UpdateGuestOsMappingCmd;
import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
import org.apache.cloudstack.api.command.admin.host.UpdateHostPasswordCmd;
import org.apache.cloudstack.api.command.admin.outofbandmanagement.LicenseCheckCmd;
import org.apache.cloudstack.api.command.admin.outofbandmanagement.ListHostDevicesCmd;
// import org.apache.cloudstack.api.command.admin.outofbandmanagement.ListHostLunDevicesCmd;
// import org.apache.cloudstack.api.command.admin.outofbandmanagement.ListHostUsbDevicesCmd;
import org.apache.cloudstack.api.command.admin.outofbandmanagement.UpdateHostDevicesCmd;
// import org.apache.cloudstack.api.command.admin.outofbandmanagement.UpdateHostLunDevicesCmd;
// import org.apache.cloudstack.api.command.admin.outofbandmanagement.UpdateHostUsbDevicesCmd;
import org.apache.cloudstack.api.command.admin.pod.ListPodsByCmd;
import org.apache.cloudstack.api.command.admin.resource.ArchiveAlertsCmd;
import org.apache.cloudstack.api.command.admin.resource.DeleteAlertsCmd;
Expand Down Expand Up @@ -66,10 +72,14 @@
import org.apache.cloudstack.api.command.user.userdata.RegisterUserDataCmd;
import org.apache.cloudstack.api.command.user.vm.GetVMPasswordCmd;
import org.apache.cloudstack.api.command.user.vmgroup.UpdateVMGroupCmd;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.LicenseCheckerResponse;
import org.apache.cloudstack.api.command.admin.outofbandmanagement.LicenseCheckCmd;
import org.apache.cloudstack.api.response.ListHostDevicesResponse;
// import org.apache.cloudstack.api.response.ListHostLunDevicesResponse;
// import org.apache.cloudstack.api.response.ListHostUsbDevicesResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.UpdateHostDevicesResponse;
// import org.apache.cloudstack.api.response.UpdateHostLunDevicesResponse;
// import org.apache.cloudstack.api.response.UpdateHostUsbDevicesResponse;
import org.apache.cloudstack.config.Configuration;
import org.apache.cloudstack.config.ConfigurationGroup;

Expand Down Expand Up @@ -97,6 +107,7 @@
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachine.Type;


/**
* Hopefully this is temporary.
*
Expand Down Expand Up @@ -496,6 +507,16 @@ VirtualMachine upgradeSystemVM(ScaleSystemVMCmd cmd) throws ResourceUnavailableE

ListResponse<ListHostDevicesResponse> listHostDevices(ListHostDevicesCmd cmd);

ListResponse<UpdateHostDevicesResponse> updateHostDevices(UpdateHostDevicesCmd cmd);

// ListResponse<ListHostUsbDevicesResponse> listHostUsbDevices(ListHostUsbDevicesCmd cmd);

// ListResponse<ListHostLunDevicesResponse> listHostLunDevices(ListHostLunDevicesCmd cmd);

// ListResponse<UpdateHostUsbDevicesResponse> updateHostUsbDevices(UpdateHostUsbDevicesCmd cmd);

// ListResponse<UpdateHostLunDevicesResponse> updateHostLunDevices(UpdateHostLunDevicesCmd cmd);

LicenseCheckerResponse checkLicense(LicenseCheckCmd cmd);

}
2 changes: 2 additions & 0 deletions api/src/main/java/org/apache/cloudstack/api/ApiConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,8 @@ public class ApiConstants {
public static final String LICENSE_CHECK = "licensecheck";
public static final String HAS_LICENSE = "haslicense";
public static final String ISSUED_DATE = "issueddate";
public static final String XML_CONFIG = "xmlconfig";
public static final String CURRENT_VM_ID = "currentvmid";
/**
* This enum specifies IO Drivers, each option controls specific policies on I/O.
* Qemu guests support "threads" and "native" options Since 0.8.8 ; "io_uring" is supported Since 6.3.0 (QEMU 5.0).
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// 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.outofbandmanagement;

import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListHostLunDevicesResponse;
import org.apache.cloudstack.context.CallContext;
// import org.apache.cloudstack.api.response.ListResponse;



@APICommand(name = "listHostLunDevices", description = "list Host LUN Devices'.", since = "4.20.0.0", responseObject = ListHostLunDevicesResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, authorized = { RoleType.Admin })
public class ListHostLunDevicesCmd extends BaseListCmd {

private static final String LISTHOSTLUNDEVICES = "listhostusbdevices";

/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////

@Parameter(name = ApiConstants.ID, type = BaseCmd.CommandType.UUID, entityType = ListHostLunDevicesResponse.class, description = "host ID", required = true, validations = {
ApiArgValidator.PositiveNumber })
private Long id;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////a
/////////////////////////////////////////////////////

public Long getId() {
return id;
}

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

public static String getResultObjectName() {
return "listhostusbdevices";
}

@Override
public long getEntityOwnerId() {
return CallContext.current().getCallingAccountId();
}

@Override
public void execute() {
// ListResponse<ListHostLunDevicesResponse> response = _mgr.listHostLunDevices(this);
// response.setResponseName(getCommandName());
// response.setObjectName(getCommandName());
// this.setResponseObject(response);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// 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.outofbandmanagement;

import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListHostUsbDevicesResponse;
import org.apache.cloudstack.context.CallContext;
// import org.apache.cloudstack.api.response.ListResponse;



@APICommand(name = "listHostUsbDevices", description = "list Host USB Devices'.", since = "4.20.0.0", responseObject = ListHostUsbDevicesResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, authorized = { RoleType.Admin })
public class ListHostUsbDevicesCmd extends BaseListCmd {

private static final String LISTHOSTUSBDEVICES = "listhostusbdevices";

/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////

@Parameter(name = ApiConstants.ID, type = BaseCmd.CommandType.UUID, entityType = ListHostUsbDevicesResponse.class, description = "host ID", required = true, validations = {
ApiArgValidator.PositiveNumber })
private Long id;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////

public Long getId() {
return id;
}

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

public static String getResultObjectName() {
return "listhostusbdevices";
}

@Override
public long getEntityOwnerId() {
return CallContext.current().getCallingAccountId();
}

@Override
public void execute() {
// ListResponse<ListHostUsbDevicesResponse> response = _mgr.listHostUsbDevices(this);
// response.setResponseName(getCommandName());
// response.setObjectName(getCommandName());
// this.setResponseObject(response);
}
}
Original file line number Diff line number Diff line change
@@ -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.admin.outofbandmanagement;

import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.UpdateHostDevicesResponse;
import org.apache.cloudstack.context.CallContext;
// import org.apache.cloudstack.api.response.HostResponse;

@APICommand(name = "updateHostDevices", description = "list Host Devices'.", since = "4.20.0.0", responseObject = UpdateHostDevicesResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, authorized = {
RoleType.Admin })
public class UpdateHostDevicesCmd extends BaseListCmd {

private static final String UPDATEHOSTDEVICES = "updatehostdevices";

/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////

@Parameter(name = ApiConstants.HOST_ID, type = BaseCmd.CommandType.UUID, entityType = UpdateHostDevicesResponse.class, description = "host ID", required = true, validations = {
ApiArgValidator.PositiveNumber })
private Long hostId;

@Parameter(name = ApiConstants.HOSTDEVICES_NAME, type = CommandType.STRING, required = true,
description = "Device name to allocate")
private String hostDeviceName;

@Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID,
entityType = UpdateHostDevicesResponse.class,
required = false, description = "VM ID to allocate the device to")
private Long vmId;

@Parameter(name = ApiConstants.XML_CONFIG, type = CommandType.STRING, required = false,
description = "XML configuration for device attachment")
private String xmlConfig;

@Parameter(name = ApiConstants.CURRENT_VM_ID, type = CommandType.STRING, required = false,
description = "Current VM ID")
private String currentVmId;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////

public Long getHostId() {
return hostId;
}

public String getHostDeviceName() {
return hostDeviceName;
}

public Long getVirtualMachineId() {
return vmId;
}

public String getXmlConfig() {
return xmlConfig;
}

public void setXmlConfig(String xmlConfig) {
this.xmlConfig = xmlConfig;
}

public String getCurrentVmId() {
return currentVmId;
}

public void setCurrentVmId(String currentVmId) {
this.currentVmId = currentVmId;
}


/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

public static String getResultObjectName() {
return "updatehostdevices";
}

@Override
public long getEntityOwnerId() {
return CallContext.current().getCallingAccountId();
}

@Override
public void execute() {
ListResponse<UpdateHostDevicesResponse> response = _mgr.updateHostDevices(this);
response.setResponseName(getCommandName());
response.setObjectName(getCommandName());
this.setResponseObject(response);
}
}
Loading
Loading