Skip to content

Commit 92e88a2

Browse files
jeongda-youngDajeong-Park
authored andcommitted
vhba 수정2
1 parent da4632b commit 92e88a2

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

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

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ private boolean hasPartitionRecursive(JSONObject device) {
296296
protected Answer listHostHbaDevices(Command command) {
297297
List<String> hostDevicesText = new ArrayList<>();
298298
List<String> hostDevicesNames = new ArrayList<>();
299-
299+
300300
// 물리 HBA 장치 조회
301301
Script listCommand = new Script("/bin/bash");
302302
listCommand.add("-c");
@@ -313,15 +313,15 @@ protected Answer listHostHbaDevices(Command command) {
313313
}
314314
}
315315
}
316-
316+
317317
// vHBA 장치 조회 (KVM 환경)
318318
try {
319319
Script vhbaCommand = new Script("/bin/bash");
320320
vhbaCommand.add("-c");
321321
vhbaCommand.add("virsh nodedev-list | grep vhba");
322322
OutputInterpreter.AllLinesParser vhbaParser = new OutputInterpreter.AllLinesParser();
323323
String vhbaResult = vhbaCommand.execute(vhbaParser);
324-
324+
325325
if (vhbaResult == null && vhbaParser.getLines() != null) {
326326
String[] vhbaLines = vhbaParser.getLines().split("\\n");
327327
for (String vhbaLine : vhbaLines) {
@@ -333,7 +333,7 @@ protected Answer listHostHbaDevices(Command command) {
333333
vhbaInfoCommand.add("virsh nodedev-dumpxml " + vhbaName);
334334
OutputInterpreter.AllLinesParser vhbaInfoParser = new OutputInterpreter.AllLinesParser();
335335
String vhbaInfoResult = vhbaInfoCommand.execute(vhbaInfoParser);
336-
336+
337337
String vhbaDescription = "Virtual HBA Device";
338338
if (vhbaInfoResult == null && vhbaInfoParser.getLines() != null) {
339339
String[] infoLines = vhbaInfoParser.getLines().split("\\n");
@@ -345,7 +345,7 @@ protected Answer listHostHbaDevices(Command command) {
345345
}
346346
}
347347
}
348-
348+
349349
hostDevicesNames.add(vhbaName);
350350
hostDevicesText.add(vhbaDescription);
351351
}
@@ -354,7 +354,7 @@ protected Answer listHostHbaDevices(Command command) {
354354
} catch (Exception e) {
355355
logger.debug("vHBA 조회 중 오류 발생 (일반적인 상황): " + e.getMessage());
356356
}
357-
357+
358358
return new ListHostHbaDeviceAnswer(true, hostDevicesNames, hostDevicesText);
359359
}
360360

@@ -417,14 +417,14 @@ protected Answer listHostVHbaDevices(Command command) {
417417
ListVhbaDevicesCommand cmd = (ListVhbaDevicesCommand) command;
418418
String keyword = cmd.getKeyword();
419419
List<ListVhbaDevicesCommand.VhbaDeviceInfo> vhbaDevices = new ArrayList<>();
420-
420+
421421
// vHBA 장치 조회 (KVM 환경)
422422
Script vhbaCommand = new Script("/bin/bash");
423423
vhbaCommand.add("-c");
424424
vhbaCommand.add("virsh nodedev-list | grep vhba");
425425
OutputInterpreter.AllLinesParser vhbaParser = new OutputInterpreter.AllLinesParser();
426426
String vhbaResult = vhbaCommand.execute(vhbaParser);
427-
427+
428428
if (vhbaResult == null && vhbaParser.getLines() != null) {
429429
String[] vhbaLines = vhbaParser.getLines().split("\\n");
430430
for (String vhbaLine : vhbaLines) {
@@ -434,20 +434,20 @@ protected Answer listHostVHbaDevices(Command command) {
434434
if (keyword != null && !keyword.isEmpty() && !vhbaName.contains(keyword)) {
435435
continue;
436436
}
437-
437+
438438
// vHBA 상세 정보 조회
439439
Script vhbaInfoCommand = new Script("/bin/bash");
440440
vhbaInfoCommand.add("-c");
441441
vhbaInfoCommand.add("virsh nodedev-dumpxml " + vhbaName);
442442
OutputInterpreter.AllLinesParser vhbaInfoParser = new OutputInterpreter.AllLinesParser();
443443
String vhbaInfoResult = vhbaInfoCommand.execute(vhbaInfoParser);
444-
444+
445445
String parentHbaName = "";
446446
String wwnn = "";
447447
String wwpn = "";
448448
String description = "Virtual HBA Device";
449449
String status = "Active";
450-
450+
451451
if (vhbaInfoResult == null && vhbaInfoParser.getLines() != null) {
452452
String[] infoLines = vhbaInfoParser.getLines().split("\\n");
453453
for (String infoLine : infoLines) {
@@ -463,33 +463,33 @@ protected Answer listHostVHbaDevices(Command command) {
463463
}
464464
}
465465
}
466-
466+
467467
// vHBA 상태 확인
468468
Script statusCommand = new Script("/bin/bash");
469469
statusCommand.add("-c");
470470
statusCommand.add("virsh nodedev-info " + vhbaName + " | grep State");
471471
OutputInterpreter.AllLinesParser statusParser = new OutputInterpreter.AllLinesParser();
472472
String statusResult = statusCommand.execute(statusParser);
473-
473+
474474
if (statusResult == null && statusParser.getLines() != null) {
475475
String statusLine = statusParser.getLines().trim();
476476
if (statusLine.contains("State:")) {
477477
status = statusLine.replaceAll(".*State:\\s*([^\\s]+).*", "$1").trim();
478478
}
479479
}
480-
481-
com.cloud.agent.api.ListVhbaDevicesCommand.VhbaDeviceInfo vhbaInfo =
480+
481+
com.cloud.agent.api.ListVhbaDevicesCommand.VhbaDeviceInfo vhbaInfo =
482482
new com.cloud.agent.api.ListVhbaDevicesCommand.VhbaDeviceInfo(
483483
vhbaName, parentHbaName, wwnn, wwpn, description, status
484484
);
485485
vhbaDevices.add(vhbaInfo);
486486
}
487487
}
488488
}
489-
489+
490490
logger.info("vHBA 디바이스 조회 완료: " + vhbaDevices.size() + "개 발견");
491491
return new com.cloud.agent.api.ListVhbaDevicesAnswer(true, vhbaDevices);
492-
492+
493493
} catch (Exception e) {
494494
logger.error("vHBA 디바이스 조회 중 오류: " + e.getMessage(), e);
495495
return new com.cloud.agent.api.ListVhbaDevicesAnswer(false, new ArrayList<>());
@@ -499,15 +499,15 @@ protected Answer listHostVHbaDevices(Command command) {
499499
protected Answer listVhbaCapableHbas(Command command) {
500500
List<String> hostDevicesText = new ArrayList<>();
501501
List<String> hostDevicesNames = new ArrayList<>();
502-
502+
503503
try {
504504
// vHBA를 지원하는 HBA 조회
505505
Script vportsCommand = new Script("/bin/bash");
506506
vportsCommand.add("-c");
507507
vportsCommand.add("virsh nodedev-list --cap vports");
508508
OutputInterpreter.AllLinesParser parser = new OutputInterpreter.AllLinesParser();
509509
String result = vportsCommand.execute(parser);
510-
510+
511511
if (result == null && parser.getLines() != null) {
512512
String[] lines = parser.getLines().split("\\n");
513513
for (String line : lines) {
@@ -519,7 +519,7 @@ protected Answer listVhbaCapableHbas(Command command) {
519519
hbaInfoCommand.add("virsh nodedev-dumpxml " + hbaName);
520520
OutputInterpreter.AllLinesParser hbaInfoParser = new OutputInterpreter.AllLinesParser();
521521
String hbaInfoResult = hbaInfoCommand.execute(hbaInfoParser);
522-
522+
523523
String hbaDescription = "vHBA Capable HBA: " + hbaName;
524524
if (hbaInfoResult == null && hbaInfoParser.getLines() != null) {
525525
String[] infoLines = hbaInfoParser.getLines().split("\\n");
@@ -531,7 +531,7 @@ protected Answer listVhbaCapableHbas(Command command) {
531531
}
532532
}
533533
}
534-
534+
535535
hostDevicesNames.add(hbaName);
536536
hostDevicesText.add(hbaDescription);
537537
}
@@ -540,7 +540,7 @@ protected Answer listVhbaCapableHbas(Command command) {
540540
} catch (Exception e) {
541541
logger.debug("vHBA 지원 HBA 조회 중 오류 발생: " + e.getMessage());
542542
}
543-
543+
544544
return new ListHostHbaDeviceAnswer(true, hostDevicesNames, hostDevicesText);
545545
}
546546

0 commit comments

Comments
 (0)