Skip to content

Commit 1d41ec6

Browse files
jeongda-youngdhslove
authored andcommitted
코드 정리
1 parent 1b33ea0 commit 1d41ec6

2 files changed

Lines changed: 79 additions & 125 deletions

File tree

Lines changed: 79 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,79 @@
1-
// //Licensed to the Apache Software Foundation (ASF) under one
2-
// //or more contributor license agreements. See the NOTICE file
3-
// //distributed with this work for additional information
4-
// //regarding copyright ownership. The ASF licenses this file
5-
// //to you under the Apache License, Version 2.0 (the
6-
// //"License"); you may not use this file except in compliance
7-
// //with the License. You may obtain a copy of the License at
8-
// //
9-
// //http://www.apache.org/licenses/LICENSE-2.0
10-
// //
11-
// //Unless required by applicable law or agreed to in writing,
12-
// //software distributed under the License is distributed on an
13-
// //"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14-
// //KIND, either express or implied. See the License for the
15-
// //specific language governing permissions and limitations
16-
// //under the License.
17-
18-
// package org.apache.cloudstack.api.response;
19-
20-
// import com.cloud.host.Host;
21-
// import com.cloud.serializer.Param;
22-
// import com.google.gson.annotations.SerializedName;
23-
// import java.util.List;
24-
// import java.util.Map;
25-
// import org.apache.cloudstack.api.ApiConstants;
26-
// import org.apache.cloudstack.api.BaseResponse;
27-
// import org.apache.cloudstack.api.EntityReference;
28-
29-
30-
// @EntityReference(value = Host.class)
31-
// public class ListHostUsbDevicesResponse extends BaseResponse {
32-
33-
// @SerializedName(ApiConstants.HOSTDEVICES_NAME)
34-
// @Param(description = "Allocated IP address")
35-
// private List<String> hostDevicesName;
36-
37-
// @SerializedName(ApiConstants.HOSTDEVICES_TEXT)
38-
// @Param(description = "the ID of the pod the IP address belongs to")
39-
// private List<String> hostDevicesText;
40-
41-
// @SerializedName("vmallocations")
42-
// @Param(description = "Map of device to VM allocations")
43-
// private Map<String, String> vmAllocations;
44-
45-
// public ListHostUsbDevicesResponse(List<String> hostDevicesName, List<String> hostDevicesText) {
46-
// this.hostDevicesName = hostDevicesName;
47-
// this.hostDevicesText = hostDevicesText;
48-
// }
49-
50-
// public ListHostUsbDevicesResponse() {
51-
// super();
52-
// this.setObjectName("listhostusbdevices");
53-
// }
54-
55-
// public List<String> getHostDevicesNames() {
56-
// return hostDevicesName;
57-
// }
58-
59-
// public List<String> getHostDevicesTexts() {
60-
// return hostDevicesText;
61-
// }
62-
63-
// public void setHostDevicesNames(List<String> hostDevicesName) {
64-
// this.hostDevicesName = hostDevicesName;
65-
// }
66-
67-
// public void setHostDevicesTexts(List<String> hostDevicesText) {
68-
// this.hostDevicesText = hostDevicesText;
69-
// }
70-
71-
// public void setVmAllocations(Map<String, String> vmAllocations) {
72-
// this.vmAllocations = vmAllocations;
73-
// }
74-
75-
// public Map<String, String> getVmAllocations() {
76-
// return this.vmAllocations;
77-
// }
78-
79-
// }
1+
//Licensed to the Apache Software Foundation (ASF) under one
2+
//or more contributor license agreements. See the NOTICE file
3+
//distributed with this work for additional information
4+
//regarding copyright ownership. The ASF licenses this file
5+
//to you under the Apache License, Version 2.0 (the
6+
//"License"); you may not use this file except in compliance
7+
//with the License. You may obtain a copy of the License at
8+
//
9+
//http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
//Unless required by applicable law or agreed to in writing,
12+
//software distributed under the License is distributed on an
13+
//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
//KIND, either express or implied. See the License for the
15+
//specific language governing permissions and limitations
16+
//under the License.
17+
18+
package org.apache.cloudstack.api.response;
19+
20+
import com.cloud.host.Host;
21+
import com.cloud.serializer.Param;
22+
import com.google.gson.annotations.SerializedName;
23+
import java.util.List;
24+
import java.util.Map;
25+
import org.apache.cloudstack.api.ApiConstants;
26+
import org.apache.cloudstack.api.BaseResponse;
27+
import org.apache.cloudstack.api.EntityReference;
28+
29+
30+
@EntityReference(value = Host.class)
31+
public class ListHostUsbDevicesResponse extends BaseResponse {
32+
33+
@SerializedName(ApiConstants.HOSTDEVICES_NAME)
34+
@Param(description = "Allocated IP address")
35+
private List<String> hostDevicesName;
36+
37+
@SerializedName(ApiConstants.HOSTDEVICES_TEXT)
38+
@Param(description = "the ID of the pod the IP address belongs to")
39+
private List<String> hostDevicesText;
40+
41+
@SerializedName("vmallocations")
42+
@Param(description = "Map of device to VM allocations")
43+
private Map<String, String> vmAllocations;
44+
45+
public ListHostUsbDevicesResponse(List<String> hostDevicesName, List<String> hostDevicesText) {
46+
this.hostDevicesName = hostDevicesName;
47+
this.hostDevicesText = hostDevicesText;
48+
}
49+
50+
public ListHostUsbDevicesResponse() {
51+
super();
52+
this.setObjectName("listhostusbdevices");
53+
}
54+
55+
public List<String> getHostDevicesNames() {
56+
return hostDevicesName;
57+
}
58+
59+
public List<String> getHostDevicesTexts() {
60+
return hostDevicesText;
61+
}
62+
63+
public void setHostDevicesNames(List<String> hostDevicesName) {
64+
this.hostDevicesName = hostDevicesName;
65+
}
66+
67+
public void setHostDevicesTexts(List<String> hostDevicesText) {
68+
this.hostDevicesText = hostDevicesText;
69+
}
70+
71+
public void setVmAllocations(Map<String, String> vmAllocations) {
72+
this.vmAllocations = vmAllocations;
73+
}
74+
75+
public Map<String, String> getVmAllocations() {
76+
return this.vmAllocations;
77+
}
78+
79+
}

core/src/main/java/com/cloud/resource/ServerResourceBase.java

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@
4545
import org.apache.commons.collections.CollectionUtils;
4646
import org.apache.commons.lang3.StringUtils;
4747
import org.apache.logging.log4j.Logger;
48-
// import org.json.JSONArray;
49-
// import org.json.JSONObject;
5048
import org.apache.logging.log4j.LogManager;
5149

5250
import com.cloud.agent.IAgentControl;
@@ -57,9 +55,6 @@
5755
import com.cloud.utils.script.OutputInterpreter;
5856
import com.cloud.utils.script.Script;
5957
import com.cloud.agent.api.ListHostDeviceAnswer;
60-
// import com.cloud.agent.api.ListHostLunDeviceAnswer;
61-
// import com.cloud.agent.api.ListHostUsbDeviceAnswer;
62-
// import com.cloud.agent.api.ListHostLunDeviceCommand;
6358

6459
public abstract class ServerResourceBase implements ServerResource {
6560
protected Logger logger = LogManager.getLogger(getClass());
@@ -518,45 +513,4 @@ public boolean start() {
518513
public boolean stop() {
519514
return true;
520515
}
521-
522-
// protected Answer updateHostUsbDevices(Command command, String vmName, String xmlConfig, boolean isAttach) {
523-
// try {
524-
// // 임시 XML 파일 생성
525-
// String tempXmlPath = "/tmp/usb_device_" + System.currentTimeMillis() + ".xml";
526-
// try (PrintWriter writer = new PrintWriter(tempXmlPath)) {
527-
// writer.write(xmlConfig);
528-
// }
529-
// logger.info("Generated temporary XML file: {}", tempXmlPath);
530-
// // virsh 명령어 실행
531-
// Script virshCmd = new Script("virsh");
532-
// if (isAttach) {
533-
// virshCmd.add("attach-device", vmName, tempXmlPath);
534-
// } else {
535-
// virshCmd.add("detach-device", vmName, tempXmlPath);
536-
// }
537-
538-
// String result = virshCmd.execute();
539-
540-
// // 임시 파일 삭제
541-
// File tempFile = new File(tempXmlPath);
542-
// if (tempFile.exists() && !tempFile.delete()) {
543-
// logger.warn("Failed to delete temporary file: {}", tempXmlPath);
544-
// }
545-
546-
// if (result != null) {
547-
// String action = isAttach ? "attach" : "detach";
548-
// logger.error("Failed to {} USB device: {}", action, result);
549-
// return new Answer(command, false, "Failed to " + action + " USB device: " + result);
550-
// }
551-
552-
// String action = isAttach ? "attached to" : "detached from";
553-
// logger.info("Successfully {} USB device {} VM {}", action, tempXmlPath, vmName);
554-
// return new Answer(command, true, null);
555-
556-
// } catch (Exception e) {
557-
// String action = isAttach ? "attaching" : "detaching";
558-
// logger.error("Error {} USB device: {}", action, e.getMessage(), e);
559-
// return new Answer(command, false, "Error " + action + " USB device: " + e.getMessage());
560-
// }
561-
// }
562516
}

0 commit comments

Comments
 (0)