storcli_test.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673
  1. // Copyright 2019 Yunion
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package megactl
  15. import (
  16. "testing"
  17. "github.com/stretchr/testify/assert"
  18. )
  19. func Test_parseStorcliControllers(t *testing.T) {
  20. input := `
  21. {
  22. "Controllers":[
  23. {
  24. "Command Status" : {
  25. "CLI Version" : "007.1907.0000.0000 Sep 13, 2021",
  26. "Operating system" : "Linux 5.14.0-4-arm64",
  27. "Controller" : 0,
  28. "Status" : "Success",
  29. "Description" : "Show Drive Information Succeeded."
  30. },
  31. "Response Data" : {
  32. "Drive Information" : [
  33. {
  34. "EID:Slt" : "65:0",
  35. "DID" : 6,
  36. "State" : "Onln",
  37. "DG" : 0,
  38. "Size" : "1.089 TB",
  39. "Intf" : "SAS",
  40. "Med" : "HDD",
  41. "SED" : "N",
  42. "PI" : "N",
  43. "SeSz" : "512B",
  44. "Model" : "ST1200MM0009 ",
  45. "Sp" : "U",
  46. "Type" : "-"
  47. },
  48. {
  49. "EID:Slt" : "65:1",
  50. "DID" : 8,
  51. "State" : "Onln",
  52. "DG" : 0,
  53. "Size" : "1.089 TB",
  54. "Intf" : "SAS",
  55. "Med" : "HDD",
  56. "SED" : "N",
  57. "PI" : "N",
  58. "SeSz" : "512B",
  59. "Model" : "ST1200MM0009 ",
  60. "Sp" : "U",
  61. "Type" : "-"
  62. },
  63. {
  64. "EID:Slt" : "65:2",
  65. "DID" : 9,
  66. "State" : "Onln",
  67. "DG" : 0,
  68. "Size" : "1.089 TB",
  69. "Intf" : "SAS",
  70. "Med" : "HDD",
  71. "SED" : "N",
  72. "PI" : "N",
  73. "SeSz" : "512B",
  74. "Model" : "ST1200MM0009 ",
  75. "Sp" : "U",
  76. "Type" : "-"
  77. },
  78. {
  79. "EID:Slt" : "65:3",
  80. "DID" : 7,
  81. "State" : "Onln",
  82. "DG" : 0,
  83. "Size" : "1.089 TB",
  84. "Intf" : "SAS",
  85. "Med" : "HDD",
  86. "SED" : "N",
  87. "PI" : "N",
  88. "SeSz" : "512B",
  89. "Model" : "ST1200MM0009 ",
  90. "Sp" : "U",
  91. "Type" : "-"
  92. },
  93. {
  94. "EID:Slt" : "65:4",
  95. "DID" : 14,
  96. "State" : "Onln",
  97. "DG" : 0,
  98. "Size" : "1.089 TB",
  99. "Intf" : "SAS",
  100. "Med" : "HDD",
  101. "SED" : "N",
  102. "PI" : "N",
  103. "SeSz" : "512B",
  104. "Model" : "ST1200MM0009 ",
  105. "Sp" : "U",
  106. "Type" : "-"
  107. },
  108. {
  109. "EID:Slt" : "65:5",
  110. "DID" : 13,
  111. "State" : "Onln",
  112. "DG" : 0,
  113. "Size" : "1.089 TB",
  114. "Intf" : "SAS",
  115. "Med" : "HDD",
  116. "SED" : "N",
  117. "PI" : "N",
  118. "SeSz" : "512B",
  119. "Model" : "ST1200MM0009 ",
  120. "Sp" : "U",
  121. "Type" : "-"
  122. },
  123. {
  124. "EID:Slt" : "65:6",
  125. "DID" : 19,
  126. "State" : "UGood",
  127. "DG" : "F",
  128. "Size" : "1.745 TB",
  129. "Intf" : "SATA",
  130. "Med" : "SSD",
  131. "SED" : "N",
  132. "PI" : "N",
  133. "SeSz" : "512B",
  134. "Model" : "INTEL SSDSC2KB019T8",
  135. "Sp" : "U",
  136. "Type" : "-"
  137. },
  138. {
  139. "EID:Slt" : "65:7",
  140. "DID" : 20,
  141. "State" : "JBOD",
  142. "DG" : "-",
  143. "Size" : "1.746 TB",
  144. "Intf" : "SATA",
  145. "Med" : "SSD",
  146. "SED" : "N",
  147. "PI" : "N",
  148. "SeSz" : "512B",
  149. "Model" : "INTEL SSDSC2KB019T8",
  150. "Sp" : "U",
  151. "Type" : "-"
  152. },
  153. {
  154. "EID:Slt" : "65:9",
  155. "DID" : 15,
  156. "State" : "Onln",
  157. "DG" : 1,
  158. "Size" : "3.637 TB",
  159. "Intf" : "SATA",
  160. "Med" : "HDD",
  161. "SED" : "N",
  162. "PI" : "N",
  163. "SeSz" : "512B",
  164. "Model" : "MG04ACA400N",
  165. "Sp" : "U",
  166. "Type" : "-"
  167. },
  168. {
  169. "EID:Slt" : "65:10",
  170. "DID" : 17,
  171. "State" : "Onln",
  172. "DG" : 1,
  173. "Size" : "3.637 TB",
  174. "Intf" : "SATA",
  175. "Med" : "HDD",
  176. "SED" : "N",
  177. "PI" : "N",
  178. "SeSz" : "512B",
  179. "Model" : "MG04ACA400N",
  180. "Sp" : "U",
  181. "Type" : "-"
  182. },
  183. {
  184. "EID:Slt" : "65:11",
  185. "DID" : 16,
  186. "State" : "Onln",
  187. "DG" : 1,
  188. "Size" : "3.637 TB",
  189. "Intf" : "SATA",
  190. "Med" : "HDD",
  191. "SED" : "N",
  192. "PI" : "N",
  193. "SeSz" : "512B",
  194. "Model" : "MG04ACA400N",
  195. "Sp" : "U",
  196. "Type" : "-"
  197. }
  198. ]
  199. }
  200. }
  201. ]
  202. }
  203. `
  204. info, err := parseStorcliControllers(input)
  205. if err != nil {
  206. t.Fatalf("parseStorcliControllers error: %v", err)
  207. }
  208. assert := assert.New(t)
  209. assert.Equal(1, len(info.Controllers))
  210. assert.Equal("ST1200MM0009 ", info.Controllers[0].ResponseData.Info[0].Model)
  211. assert.Equal("1.089 TB", info.Controllers[0].ResponseData.Info[0].Size)
  212. pds := info.Controllers[0].ResponseData.Info
  213. for _, pd := range pds {
  214. d, err := pd.toMegaraidDev()
  215. if err != nil {
  216. t.Fatalf("toMegaraidDev error: %v", err)
  217. }
  218. t.Logf("convert megaraid device: %#v", d)
  219. }
  220. }
  221. func TestStorcliLogicalVolumes_GetLogicalVolumes(t *testing.T) {
  222. input := `
  223. {
  224. "Controllers":[
  225. {
  226. "Command Status" : {
  227. "CLI Version" : "007.1907.0000.0000 Sep 13, 2021",
  228. "Operating system" : "Linux 5.14.0-4-arm64",
  229. "Controller" : 0,
  230. "Status" : "Success",
  231. "Description" : "None"
  232. },
  233. "Response Data" : {
  234. "/c0/v0" : [
  235. {
  236. "DG/VD" : "0/0",
  237. "TYPE" : "RAID1",
  238. "State" : "Optl",
  239. "Access" : "RW",
  240. "Consist" : "No",
  241. "Cache" : "RWBD",
  242. "Cac" : "-",
  243. "sCC" : "ON",
  244. "Size" : "446.625 GB",
  245. "Name" : ""
  246. }
  247. ],
  248. "PDs for VD 0" : [
  249. {
  250. "EID:Slt" : "8:0",
  251. "DID" : 16,
  252. "State" : "Onln",
  253. "DG" : 0,
  254. "Size" : "446.625 GB",
  255. "Intf" : "SATA",
  256. "Med" : "SSD",
  257. "SED" : "N",
  258. "PI" : "N",
  259. "SeSz" : "512B",
  260. "Model" : "SAMSUNG MZ7LH480HAHQ-00005",
  261. "Sp" : "U",
  262. "Type" : "-"
  263. },
  264. {
  265. "EID:Slt" : "8:1",
  266. "DID" : 17,
  267. "State" : "Onln",
  268. "DG" : 0,
  269. "Size" : "446.625 GB",
  270. "Intf" : "SATA",
  271. "Med" : "SSD",
  272. "SED" : "N",
  273. "PI" : "N",
  274. "SeSz" : "512B",
  275. "Model" : "SAMSUNG MZ7LH480HAHQ-00005",
  276. "Sp" : "U",
  277. "Type" : "-"
  278. }
  279. ],
  280. "VD0 Properties" : {
  281. "Strip Size" : "256 KB",
  282. "Number of Blocks" : 936640512,
  283. "VD has Emulated PD" : "Yes",
  284. "Span Depth" : 1,
  285. "Number of Drives Per Span" : 2,
  286. "Write Cache(initial setting)" : "WriteBack",
  287. "Disk Cache Policy" : "Disk's Default",
  288. "Encryption" : "None",
  289. "Data Protection" : "Disabled",
  290. "Active Operations" : "None",
  291. "Exposed to OS" : "Yes",
  292. "OS Drive Name" : "/dev/sda",
  293. "Creation Date" : "08-06-2022",
  294. "Creation Time" : "02:46:23 PM",
  295. "Emulation type" : "default",
  296. "Cachebypass size" : "Cachebypass-64k",
  297. "Cachebypass Mode" : "Cachebypass Intelligent",
  298. "Is LD Ready for OS Requests" : "Yes",
  299. "SCSI NAA Id" : "600605b010e943702a3372bf4d29f6a7",
  300. "Unmap Enabled" : "N/A"
  301. },
  302. "/c0/v1" : [
  303. {
  304. "DG/VD" : "1/1",
  305. "TYPE" : "RAID1",
  306. "State" : "Optl",
  307. "Access" : "RW",
  308. "Consist" : "No",
  309. "Cache" : "RWBD",
  310. "Cac" : "-",
  311. "sCC" : "ON",
  312. "Size" : "558.406 GB",
  313. "Name" : ""
  314. }
  315. ],
  316. "PDs for VD 1" : [
  317. {
  318. "EID:Slt" : "8:2",
  319. "DID" : 15,
  320. "State" : "Onln",
  321. "DG" : 1,
  322. "Size" : "558.406 GB",
  323. "Intf" : "SAS",
  324. "Med" : "HDD",
  325. "SED" : "N",
  326. "PI" : "N",
  327. "SeSz" : "512B",
  328. "Model" : "ST600MP0006 ",
  329. "Sp" : "U",
  330. "Type" : "-"
  331. },
  332. {
  333. "EID:Slt" : "8:3",
  334. "DID" : 12,
  335. "State" : "Onln",
  336. "DG" : 1,
  337. "Size" : "558.406 GB",
  338. "Intf" : "SAS",
  339. "Med" : "HDD",
  340. "SED" : "N",
  341. "PI" : "N",
  342. "SeSz" : "512B",
  343. "Model" : "ST600MP0006 ",
  344. "Sp" : "U",
  345. "Type" : "-"
  346. }
  347. ],
  348. "VD1 Properties" : {
  349. "Strip Size" : "256 KB",
  350. "Number of Blocks" : 1171062784,
  351. "VD has Emulated PD" : "No",
  352. "Span Depth" : 1,
  353. "Number of Drives Per Span" : 2,
  354. "Write Cache(initial setting)" : "WriteBack",
  355. "Disk Cache Policy" : "Disk's Default",
  356. "Encryption" : "None",
  357. "Data Protection" : "Disabled",
  358. "Active Operations" : "None",
  359. "Exposed to OS" : "Yes",
  360. "OS Drive Name" : "/dev/sdb",
  361. "Creation Date" : "08-06-2022",
  362. "Creation Time" : "02:46:24 PM",
  363. "Emulation type" : "default",
  364. "Cachebypass size" : "Cachebypass-64k",
  365. "Cachebypass Mode" : "Cachebypass Intelligent",
  366. "Is LD Ready for OS Requests" : "Yes",
  367. "SCSI NAA Id" : "600605b010e943702a3372c04d2fb6b9",
  368. "Unmap Enabled" : "N/A"
  369. },
  370. "/c0/v2" : [
  371. {
  372. "DG/VD" : "2/2",
  373. "TYPE" : "RAID0",
  374. "State" : "Optl",
  375. "Access" : "RW",
  376. "Consist" : "Yes",
  377. "Cache" : "NRWTD",
  378. "Cac" : "-",
  379. "sCC" : "ON",
  380. "Size" : "1.090 TB",
  381. "Name" : ""
  382. }
  383. ],
  384. "PDs for VD 2" : [
  385. {
  386. "EID:Slt" : "8:4",
  387. "DID" : 14,
  388. "State" : "Onln",
  389. "DG" : 2,
  390. "Size" : "1.090 TB",
  391. "Intf" : "SAS",
  392. "Med" : "HDD",
  393. "SED" : "N",
  394. "PI" : "N",
  395. "SeSz" : "512B",
  396. "Model" : "ST1200MM0129 ",
  397. "Sp" : "U",
  398. "Type" : "-"
  399. }
  400. ],
  401. "VD2 Properties" : {
  402. "Strip Size" : "256 KB",
  403. "Number of Blocks" : 2343174144,
  404. "VD has Emulated PD" : "Yes",
  405. "Span Depth" : 1,
  406. "Number of Drives Per Span" : 1,
  407. "Write Cache(initial setting)" : "WriteThrough",
  408. "Disk Cache Policy" : "Disk's Default",
  409. "Encryption" : "None",
  410. "Data Protection" : "Disabled",
  411. "Active Operations" : "None",
  412. "Exposed to OS" : "Yes",
  413. "OS Drive Name" : "/dev/sdc",
  414. "Creation Date" : "08-06-2022",
  415. "Creation Time" : "02:46:24 PM",
  416. "Emulation type" : "default",
  417. "Cachebypass size" : "Cachebypass-64k",
  418. "Cachebypass Mode" : "Cachebypass Intelligent",
  419. "Is LD Ready for OS Requests" : "Yes",
  420. "SCSI NAA Id" : "600605b010e943702a3372c04d3ad143",
  421. "Unmap Enabled" : "N/A"
  422. },
  423. "/c0/v3" : [
  424. {
  425. "DG/VD" : "3/3",
  426. "TYPE" : "RAID0",
  427. "State" : "Optl",
  428. "Access" : "RW",
  429. "Consist" : "Yes",
  430. "Cache" : "NRWTD",
  431. "Cac" : "-",
  432. "sCC" : "ON",
  433. "Size" : "1.090 TB",
  434. "Name" : ""
  435. }
  436. ],
  437. "PDs for VD 3" : [
  438. {
  439. "EID:Slt" : "8:5",
  440. "DID" : 10,
  441. "State" : "Onln",
  442. "DG" : 3,
  443. "Size" : "1.090 TB",
  444. "Intf" : "SAS",
  445. "Med" : "HDD",
  446. "SED" : "N",
  447. "PI" : "N",
  448. "SeSz" : "512B",
  449. "Model" : "ST1200MM0129 ",
  450. "Sp" : "U",
  451. "Type" : "-"
  452. }
  453. ],
  454. "VD3 Properties" : {
  455. "Strip Size" : "256 KB",
  456. "Number of Blocks" : 2343174144,
  457. "VD has Emulated PD" : "Yes",
  458. "Span Depth" : 1,
  459. "Number of Drives Per Span" : 1,
  460. "Write Cache(initial setting)" : "WriteThrough",
  461. "Disk Cache Policy" : "Disk's Default",
  462. "Encryption" : "None",
  463. "Data Protection" : "Disabled",
  464. "Active Operations" : "None",
  465. "Exposed to OS" : "Yes",
  466. "OS Drive Name" : "/dev/sdd",
  467. "Creation Date" : "08-06-2022",
  468. "Creation Time" : "02:46:25 PM",
  469. "Emulation type" : "default",
  470. "Cachebypass size" : "Cachebypass-64k",
  471. "Cachebypass Mode" : "Cachebypass Intelligent",
  472. "Is LD Ready for OS Requests" : "Yes",
  473. "SCSI NAA Id" : "600605b010e943702a3372c14d48b67e",
  474. "Unmap Enabled" : "N/A"
  475. },
  476. "/c0/v4" : [
  477. {
  478. "DG/VD" : "4/4",
  479. "TYPE" : "RAID0",
  480. "State" : "Optl",
  481. "Access" : "RW",
  482. "Consist" : "Yes",
  483. "Cache" : "NRWTD",
  484. "Cac" : "-",
  485. "sCC" : "ON",
  486. "Size" : "1.090 TB",
  487. "Name" : ""
  488. }
  489. ],
  490. "PDs for VD 4" : [
  491. {
  492. "EID:Slt" : "8:6",
  493. "DID" : 9,
  494. "State" : "Onln",
  495. "DG" : 4,
  496. "Size" : "1.090 TB",
  497. "Intf" : "SAS",
  498. "Med" : "HDD",
  499. "SED" : "N",
  500. "PI" : "N",
  501. "SeSz" : "512B",
  502. "Model" : "ST1200MM0129 ",
  503. "Sp" : "U",
  504. "Type" : "-"
  505. }
  506. ],
  507. "VD4 Properties" : {
  508. "Strip Size" : "256 KB",
  509. "Number of Blocks" : 2343174144,
  510. "VD has Emulated PD" : "Yes",
  511. "Span Depth" : 1,
  512. "Number of Drives Per Span" : 1,
  513. "Write Cache(initial setting)" : "WriteThrough",
  514. "Disk Cache Policy" : "Disk's Default",
  515. "Encryption" : "None",
  516. "Data Protection" : "Disabled",
  517. "Active Operations" : "None",
  518. "Exposed to OS" : "Yes",
  519. "OS Drive Name" : "/dev/sde",
  520. "Creation Date" : "08-06-2022",
  521. "Creation Time" : "02:46:26 PM",
  522. "Emulation type" : "default",
  523. "Cachebypass size" : "Cachebypass-64k",
  524. "Cachebypass Mode" : "Cachebypass Intelligent",
  525. "Is LD Ready for OS Requests" : "Yes",
  526. "SCSI NAA Id" : "600605b010e943702a3372c24d57b796",
  527. "Unmap Enabled" : "N/A"
  528. },
  529. "/c0/v5" : [
  530. {
  531. "DG/VD" : "5/5",
  532. "TYPE" : "RAID0",
  533. "State" : "Optl",
  534. "Access" : "RW",
  535. "Consist" : "Yes",
  536. "Cache" : "NRWTD",
  537. "Cac" : "-",
  538. "sCC" : "ON",
  539. "Size" : "1.090 TB",
  540. "Name" : ""
  541. }
  542. ],
  543. "PDs for VD 5" : [
  544. {
  545. "EID:Slt" : "8:7",
  546. "DID" : 11,
  547. "State" : "Onln",
  548. "DG" : 5,
  549. "Size" : "1.090 TB",
  550. "Intf" : "SAS",
  551. "Med" : "HDD",
  552. "SED" : "N",
  553. "PI" : "N",
  554. "SeSz" : "512B",
  555. "Model" : "ST1200MM0129 ",
  556. "Sp" : "U",
  557. "Type" : "-"
  558. }
  559. ],
  560. "VD5 Properties" : {
  561. "Strip Size" : "256 KB",
  562. "Number of Blocks" : 2343174144,
  563. "VD has Emulated PD" : "Yes",
  564. "Span Depth" : 1,
  565. "Number of Drives Per Span" : 1,
  566. "Write Cache(initial setting)" : "WriteThrough",
  567. "Disk Cache Policy" : "Disk's Default",
  568. "Encryption" : "None",
  569. "Data Protection" : "Disabled",
  570. "Active Operations" : "None",
  571. "Exposed to OS" : "Yes",
  572. "OS Drive Name" : "/dev/sdf",
  573. "Creation Date" : "08-06-2022",
  574. "Creation Time" : "02:46:27 PM",
  575. "Emulation type" : "default",
  576. "Cachebypass size" : "Cachebypass-64k",
  577. "Cachebypass Mode" : "Cachebypass Intelligent",
  578. "Is LD Ready for OS Requests" : "Yes",
  579. "SCSI NAA Id" : "600605b010e943702a3372c34d665ecf",
  580. "Unmap Enabled" : "N/A"
  581. },
  582. "/c0/v6" : [
  583. {
  584. "DG/VD" : "6/6",
  585. "TYPE" : "RAID0",
  586. "State" : "Optl",
  587. "Access" : "RW",
  588. "Consist" : "Yes",
  589. "Cache" : "NRWTD",
  590. "Cac" : "-",
  591. "sCC" : "ON",
  592. "Size" : "1.090 TB",
  593. "Name" : ""
  594. }
  595. ],
  596. "PDs for VD 6" : [
  597. {
  598. "EID:Slt" : "8:8",
  599. "DID" : 13,
  600. "State" : "Onln",
  601. "DG" : 6,
  602. "Size" : "1.090 TB",
  603. "Intf" : "SAS",
  604. "Med" : "HDD",
  605. "SED" : "N",
  606. "PI" : "N",
  607. "SeSz" : "512B",
  608. "Model" : "ST1200MM0129 ",
  609. "Sp" : "U",
  610. "Type" : "-"
  611. }
  612. ],
  613. "VD6 Properties" : {
  614. "Strip Size" : "256 KB",
  615. "Number of Blocks" : 2343174144,
  616. "VD has Emulated PD" : "Yes",
  617. "Span Depth" : 1,
  618. "Number of Drives Per Span" : 1,
  619. "Write Cache(initial setting)" : "WriteThrough",
  620. "Disk Cache Policy" : "Disk's Default",
  621. "Encryption" : "None",
  622. "Data Protection" : "Disabled",
  623. "Active Operations" : "None",
  624. "Exposed to OS" : "Yes",
  625. "OS Drive Name" : "/dev/sdg",
  626. "Creation Date" : "08-06-2022",
  627. "Creation Time" : "02:46:28 PM",
  628. "Emulation type" : "default",
  629. "Cachebypass size" : "Cachebypass-64k",
  630. "Cachebypass Mode" : "Cachebypass Intelligent",
  631. "Is LD Ready for OS Requests" : "Yes",
  632. "SCSI NAA Id" : "600605b010e943702a3372c44d751bab",
  633. "Unmap Enabled" : "N/A"
  634. }
  635. }
  636. }
  637. ]
  638. }`
  639. parser, err := parseStorcliLVs(input)
  640. if err != nil {
  641. t.Fatalf("parseStorcliLVs: %v", err)
  642. }
  643. lvs, err := parser.GetLogicalVolumes(0)
  644. if err != nil {
  645. t.Fatalf("GetLogicalVolumes: %v", err)
  646. }
  647. assert := assert.New(t)
  648. assert.Equal(7, len(lvs), "Should 7 logical volumes")
  649. for i := range lvs {
  650. switch lvs[i].Index {
  651. case 0:
  652. first2SDDs := lvs[i].PDs
  653. assert.Equal("SSD", first2SDDs[0].Med)
  654. assert.Equal("446.625 GB", first2SDDs[0].Size)
  655. assert.Equal("SSD", first2SDDs[1].Med)
  656. assert.Equal("446.625 GB", first2SDDs[1].Size)
  657. assert.Equal(true, lvs[i].IsSSD())
  658. assert.Equal("/dev/sda", lvs[i].Properties.DeviceName)
  659. case 6:
  660. assert.Equal("/dev/sdg", lvs[i].Properties.DeviceName)
  661. }
  662. }
  663. }