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
Original file line number Diff line number Diff line change
@@ -1,79 +1,79 @@
// //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 com.cloud.host.Host;
// import com.cloud.serializer.Param;
// import com.google.gson.annotations.SerializedName;
// import java.util.List;
// import java.util.Map;
// import org.apache.cloudstack.api.ApiConstants;
// import org.apache.cloudstack.api.BaseResponse;
// import org.apache.cloudstack.api.EntityReference;


// @EntityReference(value = Host.class)
// public class ListHostUsbDevicesResponse extends BaseResponse {

// @SerializedName(ApiConstants.HOSTDEVICES_NAME)
// @Param(description = "Allocated IP address")
// private List<String> hostDevicesName;

// @SerializedName(ApiConstants.HOSTDEVICES_TEXT)
// @Param(description = "the ID of the pod the IP address belongs to")
// private List<String> hostDevicesText;

// @SerializedName("vmallocations")
// @Param(description = "Map of device to VM allocations")
// private Map<String, String> vmAllocations;

// public ListHostUsbDevicesResponse(List<String> hostDevicesName, List<String> hostDevicesText) {
// this.hostDevicesName = hostDevicesName;
// this.hostDevicesText = hostDevicesText;
// }

// public ListHostUsbDevicesResponse() {
// super();
// this.setObjectName("listhostusbdevices");
// }

// public List<String> getHostDevicesNames() {
// return hostDevicesName;
// }

// public List<String> getHostDevicesTexts() {
// return hostDevicesText;
// }

// public void setHostDevicesNames(List<String> hostDevicesName) {
// this.hostDevicesName = hostDevicesName;
// }

// public void setHostDevicesTexts(List<String> hostDevicesText) {
// this.hostDevicesText = hostDevicesText;
// }

// public void setVmAllocations(Map<String, String> vmAllocations) {
// this.vmAllocations = vmAllocations;
// }

// public Map<String, String> getVmAllocations() {
// return this.vmAllocations;
// }

// }
//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 com.cloud.host.Host;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
import java.util.List;
import java.util.Map;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse;
import org.apache.cloudstack.api.EntityReference;


@EntityReference(value = Host.class)
public class ListHostUsbDevicesResponse extends BaseResponse {

@SerializedName(ApiConstants.HOSTDEVICES_NAME)
@Param(description = "Allocated IP address")
private List<String> hostDevicesName;

@SerializedName(ApiConstants.HOSTDEVICES_TEXT)
@Param(description = "the ID of the pod the IP address belongs to")
private List<String> hostDevicesText;

@SerializedName("vmallocations")
@Param(description = "Map of device to VM allocations")
private Map<String, String> vmAllocations;

public ListHostUsbDevicesResponse(List<String> hostDevicesName, List<String> hostDevicesText) {
this.hostDevicesName = hostDevicesName;
this.hostDevicesText = hostDevicesText;
}

public ListHostUsbDevicesResponse() {
super();
this.setObjectName("listhostusbdevices");
}

public List<String> getHostDevicesNames() {
return hostDevicesName;
}

public List<String> getHostDevicesTexts() {
return hostDevicesText;
}

public void setHostDevicesNames(List<String> hostDevicesName) {
this.hostDevicesName = hostDevicesName;
}

public void setHostDevicesTexts(List<String> hostDevicesText) {
this.hostDevicesText = hostDevicesText;
}

public void setVmAllocations(Map<String, String> vmAllocations) {
this.vmAllocations = vmAllocations;
}

public Map<String, String> getVmAllocations() {
return this.vmAllocations;
}

}
46 changes: 0 additions & 46 deletions core/src/main/java/com/cloud/resource/ServerResourceBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.Logger;
// import org.json.JSONArray;
// import org.json.JSONObject;
import org.apache.logging.log4j.LogManager;

import com.cloud.agent.IAgentControl;
Expand All @@ -57,9 +55,6 @@
import com.cloud.utils.script.OutputInterpreter;
import com.cloud.utils.script.Script;
import com.cloud.agent.api.ListHostDeviceAnswer;
// import com.cloud.agent.api.ListHostLunDeviceAnswer;
// import com.cloud.agent.api.ListHostUsbDeviceAnswer;
// import com.cloud.agent.api.ListHostLunDeviceCommand;

public abstract class ServerResourceBase implements ServerResource {
protected Logger logger = LogManager.getLogger(getClass());
Expand Down Expand Up @@ -518,45 +513,4 @@ public boolean start() {
public boolean stop() {
return true;
}

// protected Answer updateHostUsbDevices(Command command, String vmName, String xmlConfig, boolean isAttach) {
// try {
// // 임시 XML 파일 생성
// String tempXmlPath = "/tmp/usb_device_" + System.currentTimeMillis() + ".xml";
// try (PrintWriter writer = new PrintWriter(tempXmlPath)) {
// writer.write(xmlConfig);
// }
// logger.info("Generated temporary XML file: {}", tempXmlPath);
// // virsh 명령어 실행
// Script virshCmd = new Script("virsh");
// if (isAttach) {
// virshCmd.add("attach-device", vmName, tempXmlPath);
// } else {
// virshCmd.add("detach-device", vmName, tempXmlPath);
// }

// String result = virshCmd.execute();

// // 임시 파일 삭제
// File tempFile = new File(tempXmlPath);
// if (tempFile.exists() && !tempFile.delete()) {
// logger.warn("Failed to delete temporary file: {}", tempXmlPath);
// }

// if (result != null) {
// String action = isAttach ? "attach" : "detach";
// logger.error("Failed to {} USB device: {}", action, result);
// return new Answer(command, false, "Failed to " + action + " USB device: " + result);
// }

// String action = isAttach ? "attached to" : "detached from";
// logger.info("Successfully {} USB device {} VM {}", action, tempXmlPath, vmName);
// return new Answer(command, true, null);

// } catch (Exception e) {
// String action = isAttach ? "attaching" : "detaching";
// logger.error("Error {} USB device: {}", action, e.getMessage(), e);
// return new Answer(command, false, "Error " + action + " USB device: " + e.getMessage());
// }
// }
}
Loading
Loading