Compare commits
777 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c01f980803 | |||
| 32345bc57c | |||
| fe342f041d | |||
| 35beb15503 | |||
| 1967441266 | |||
| b02452e2fb | |||
| 4097b7f845 | |||
| 21da21dec2 | |||
| 628067db4d | |||
| f5577e7921 | |||
| be301fac1e | |||
| 30623ebd13 | |||
| 476f9f7b94 | |||
| b8602d756f | |||
| 607e2bd385 | |||
| 2e32683a52 | |||
| 5ef5b62877 | |||
| f9430e7364 | |||
| d9e87410d4 | |||
| 288ffa7b68 | |||
| da02c2bce7 | |||
| 217887b177 | |||
| cdacb9a85f | |||
| 641be270e9 | |||
| d9b5d07882 | |||
| ee20161772 | |||
| e6b4ca9913 | |||
| c33901f267 | |||
| 56228c180b | |||
| c5549a6533 | |||
| 9d0b4b1be7 | |||
| c21a1d35a2 | |||
| 69bf4249be | |||
| cb62009306 | |||
| e14dc92c12 | |||
| c264c8b3a8 | |||
| c65b55b79d | |||
| 3f59552d0c | |||
| 72c058edc9 | |||
| b9f206c746 | |||
| 037ed0bcfd | |||
| 029e6d18ca | |||
| 900963b1db | |||
| 089315126c | |||
| 28d2110a5e | |||
| 2b74e1de3c | |||
| c5e82bb0fd | |||
| ba51617afd | |||
| 458d82a3b2 | |||
| 1c0ff10789 | |||
| 3a4cefe53b | |||
| 449ee0f808 | |||
| a139146cba | |||
| 2d4e7c9fdd | |||
| 0d6d911fa5 | |||
| f2f03bc718 | |||
| 72739e890d | |||
| 11cd20ada5 | |||
| 738f891d61 | |||
| 65814f3b59 | |||
| 87fadccb22 | |||
| 6f4c3875d2 | |||
| e9d56917fc | |||
| ab8beaf15d | |||
| e638a90375 | |||
| ac83f5c65f | |||
| 4607e8138f | |||
| e40229e41d | |||
| 6f38163688 | |||
| 31d1cf9961 | |||
| 5f72bfa56f | |||
| df970f4cb0 | |||
| 3a3256b518 | |||
| 834ae798ca | |||
| b4d9167344 | |||
| e2c31bad27 | |||
| 2d1961c4f9 | |||
| b777d3dfa5 | |||
| 7ee1498601 | |||
| 01f4cc8917 | |||
| 502cc6aaad | |||
| 7bcc0909a9 | |||
| 9e86ac498c | |||
| 84712be32c | |||
| 3eaaa3b6f3 | |||
| a09f2d6faa | |||
| 21d12983c9 | |||
| ba343557ec | |||
| 7f58d3fd6c | |||
| 9f91e914d9 | |||
| 68fbecb21a | |||
| ce7ed0cb72 | |||
| 084e71387b | |||
| 85af82dc02 | |||
| 83bf291a3d | |||
| 9f830ffc17 | |||
| 23a132c497 | |||
| 51f9f121bc | |||
| 06bbdbc33f | |||
| 8622f3f9bd | |||
| 1fb1b283bb | |||
| df45650bfb | |||
| c31b275d54 | |||
| 2ace529fee | |||
| 852fc3c164 | |||
| b15e8e9db8 | |||
| 47c91ef186 | |||
| c8426f9f43 | |||
| 943b31d0ff | |||
| 5c9bd40b1f | |||
| dd63773ee8 | |||
| b6c35465dc | |||
| 9ba2726f83 | |||
| ec1ef81ea8 | |||
| 5078f8293b | |||
| 6b040b23f7 | |||
| 9539644ca1 | |||
| aa0f63c2b7 | |||
| cc971870f9 | |||
| 255811ee1f | |||
| b9577cb9ef | |||
| 5ad09597bd | |||
| 5b5ad7d6d7 | |||
| 2f6be40923 | |||
| 2a494808f7 | |||
| 053225fb26 | |||
| 3b05fc84b0 | |||
| 2511cebef8 | |||
| c85c5acdee | |||
| 0c51f6e92a | |||
| 31c9e1f812 | |||
| af98c573fb | |||
| 1eb7f10e2e | |||
| 47d8713482 | |||
| 7d84551ce5 | |||
| b855150aee | |||
| d041294800 | |||
| 8557d86359 | |||
| a6b4056b2e | |||
| e0bbf7b1db | |||
| 6ec8d4c4e3 | |||
| 252da58c78 | |||
| 9d628fb636 | |||
| a4ac5c5187 | |||
| ba9dc1cd5e | |||
| 2cf01b06b3 | |||
| f2901b06d0 | |||
| fe890637c9 | |||
| 83ed138db2 | |||
| 7f8b48ba40 | |||
| d0585fe056 | |||
| ae1dde7d9a | |||
| 80772ee81c | |||
| 66a38f0075 | |||
| a7621d345f | |||
| 6c46d5b75d | |||
| 1a5de449ef | |||
| aff90b34ac | |||
| 61b8040369 | |||
| 9a237c699b | |||
| 42b0f43780 | |||
| c66fe0d131 | |||
| 088ee8e9cd | |||
| 541dcf53d3 | |||
| 532c7d618c | |||
| aab450c4de | |||
| 7bbc3e8add | |||
| 9dd06c1047 | |||
| 40b5891c4a | |||
| 0c77d04e7c | |||
| c79eca69df | |||
| 0f4a674527 | |||
| 447b31ee60 | |||
| ae5320d82b | |||
| d8faafb4b4 | |||
| 573fc1790f | |||
| 8a6b60a769 | |||
| 201fb1871b | |||
| ab8e64217f | |||
| 027d4ff52a | |||
| 18a3c26864 | |||
| 1e2329be1d | |||
| 9fae510b2e | |||
| fda569d340 | |||
| f4ef1202fe | |||
| eb5655a9e4 | |||
| e140fcd040 | |||
| 3eabe15ff3 | |||
| eaf7325a1c | |||
| d87440ec41 | |||
| baa3edb3ca | |||
| fea8c45131 | |||
| 01da31702e | |||
| 358959724d | |||
| 5d55cc5dbe | |||
| 95e9cc18fb | |||
| afe37ebeab | |||
| b19461a479 | |||
| 3281a3d1c3 | |||
| 5373b22b61 | |||
| f6761bb0b7 | |||
| 3eec0c921d | |||
| 280ad16dbe | |||
| a74177cb86 | |||
| 02269d22b5 | |||
| f0987c908f | |||
| a049714a3e | |||
| 878d9443dd | |||
| d047c4cdf5 | |||
| cad641241d | |||
| b865f08e2e | |||
| cec473c646 | |||
| 392fc1b3cb | |||
| 614594fa52 | |||
| 340c5fc553 | |||
| b59f72bd8e | |||
| 0215a5bed2 | |||
| f0b9cac61c | |||
| 43c9fecd1a | |||
| b8bd2acad8 | |||
| e83055a0a1 | |||
| 0705721307 | |||
| c20b47d205 | |||
| 2490baf473 | |||
| 3ebf2f7851 | |||
| 00e96b2b57 | |||
| 24cc328940 | |||
| 8f6bd7a584 | |||
| 522a815c3d | |||
| da874a91f2 | |||
| 2170c7196f | |||
| f101f97df4 | |||
| 0b35d9edd7 | |||
| dff4cad29f | |||
| 1c379b1590 | |||
| f6d48a858b | |||
| cd4c886ba1 | |||
| b94dcb02e4 | |||
| 4781a420d2 | |||
| c40c63ad77 | |||
| 424886c5d0 | |||
| e81496cac9 | |||
| cf5ae47428 | |||
| 50f2f825ac | |||
| 475e64aa69 | |||
| dcaa4416af | |||
| ab0cba2748 | |||
| fead0c878e | |||
| f8db0659f0 | |||
| dab45f5df2 | |||
| 15bc5437f4 | |||
| c57e57fc3f | |||
| 49e7a6d393 | |||
| 13c93831bf | |||
| 3ec9780b6e | |||
| f5cf1968df | |||
| a44d508044 | |||
| 8431d6cad9 | |||
| f00771ff92 | |||
| 6244920305 | |||
| a3028511fa | |||
| 215e4620b6 | |||
| b4cd2e016b | |||
| f1a75b17d3 | |||
| 851094e6a1 | |||
| f383d4d0fc | |||
| 37672312ba | |||
| 8133553481 | |||
| ad2b7370cc | |||
| 0db64ebb8e | |||
| 85075225ca | |||
| f35a5b6071 | |||
| 91c67cea57 | |||
| ad0118ddf9 | |||
| be7dea96d5 | |||
| ae11f1f4fe | |||
| 50a441209b | |||
| 73d08b58fa | |||
| 7e8c02bf07 | |||
| f904ce2cc1 | |||
| 0096a8dde0 | |||
| de215daef3 | |||
| 75f15ce9b7 | |||
| b5f708ed39 | |||
| ccfa70d8c8 | |||
| c270d5e563 | |||
| a049575c4f | |||
| d718ba8396 | |||
| 402c91cfcc | |||
| 79d784a384 | |||
| 5b59d6eddf | |||
| 2c070624ff | |||
| 9552485df6 | |||
| 1d781ea39f | |||
| 49bf7c1200 | |||
| d5320ca977 | |||
| 3573ced9eb | |||
| 0654fa65e6 | |||
| 8ea1539aa2 | |||
| 3ce3e80a4c | |||
| 2959c875ed | |||
| fd13ae7232 | |||
| f474dbd1b9 | |||
| 9b402bb656 | |||
| e570ed6e49 | |||
| 57c53ba533 | |||
| 99e6319765 | |||
| c631a0107d | |||
| 24f771dbe6 | |||
| cde6b88011 | |||
| 088cb897b2 | |||
| fdfa1fe290 | |||
| 037a8db481 | |||
| 8ff7a04ee3 | |||
| 85019012cb | |||
| dd636f8108 | |||
| 33213acfae | |||
| 50d51f4e40 | |||
| ae31875596 | |||
| 64c3c7c273 | |||
| 062bc44605 | |||
| 425dbf90ed | |||
| 9af411c290 | |||
| 5cb4f7a8d9 | |||
| 1c0f2b5bef | |||
| e438c2f766 | |||
| ee82fa97b4 | |||
| 97df5ec9a6 | |||
| b76e15c487 | |||
| 32d389cbee | |||
| cc67df3caa | |||
| f5296e4107 | |||
| e9dd282fdf | |||
| 590b18a34c | |||
| aea40b0226 | |||
| c3f0760164 | |||
| 1d241dedf0 | |||
| 3133cbeb3f | |||
| 03c9a17566 | |||
| 88003827c9 | |||
| 1aa1f30cdc | |||
| 87840527c2 | |||
| 4e008d7895 | |||
| e2e8463d64 | |||
| d0198f8592 | |||
| 769f05bd91 | |||
| 365b378f4b | |||
| 7ab784ea38 | |||
| 5054e01a26 | |||
| 6aabbe5ae2 | |||
| af16b12041 | |||
| 0541a3361a | |||
| 641d9bd78a | |||
| b06aa3afb0 | |||
| 7ae2e3d8f3 | |||
| b0eff0cf94 | |||
| d29aea3c01 | |||
| 08e0ce42f0 | |||
| ee1a1574c3 | |||
| d8eeeb306b | |||
| ac34247aba | |||
| ec61ef27da | |||
| 4100dd77e4 | |||
| fc8b2cc4eb | |||
| 0fa2dbd486 | |||
| 7edce8ec57 | |||
| 5576b8b1f4 | |||
| 92d313bb20 | |||
| f39c0f46a1 | |||
| 547cbd4217 | |||
| 25ffc91f0f | |||
| a5dceadccf | |||
| 1407d0044e | |||
| ba706470d0 | |||
| 61517af5ce | |||
| ec400ad4b4 | |||
| 425f741435 | |||
| d12e49efe3 | |||
| 04f26ded54 | |||
| e8d48b81e0 | |||
| a2332700d5 | |||
| 68758810b0 | |||
| 8ced43ef98 | |||
| b383556d34 | |||
| fc55bc9fd7 | |||
| 99365ff4a8 | |||
| e1c67b0724 | |||
| ec38cf3e61 | |||
| 2c12505a11 | |||
| 2a6fe02049 | |||
| 6a44ddea08 | |||
| d7081292fc | |||
| ef94ee5642 | |||
| 3beec6c8b1 | |||
| 13b71591e0 | |||
| 5cccca9d1c | |||
| 15cc210445 | |||
| 90ed515fb3 | |||
| 9a05a5ea1f | |||
| 151409cff9 | |||
| 975b90e619 | |||
| 9b5f4e2d05 | |||
| f9e77f3ddf | |||
| 18a8cdf36a | |||
| 246f7d1e2b | |||
| 40f96179a6 | |||
| 4e9ee2bbdc | |||
| a6ca187a16 | |||
| 7fffc07e54 | |||
| 4753c86b38 | |||
| 812fc4b3bc | |||
| 77625c7fe9 | |||
| 6bfb39fb7d | |||
| d92fc99a3a | |||
| 70668c86a8 | |||
| 7ae7479c3a | |||
| c703748797 | |||
| 79ad455b31 | |||
| 33fd485628 | |||
| ac121cabbe | |||
| c455d1dbe9 | |||
| ea56c3ebee | |||
| 7e90a37681 | |||
| 4903509b05 | |||
| 09ac1b8a27 | |||
| 83baec8526 | |||
| 81e86de979 | |||
| 7be4cc008c | |||
| c635c4da8a | |||
| 2e9cc3742f | |||
| 6003b146ae | |||
| 3b194a3815 | |||
| 2c196c5b63 | |||
| 1f37d0d359 | |||
| 513c8d0e1b | |||
| ce985114c6 | |||
| 2366886fc9 | |||
| fd1a6dba31 | |||
| 4b7acd5bb1 | |||
| 281b0ade7e | |||
| d0ee775708 | |||
| da17bda0a5 | |||
| 19e7c2071d | |||
| e48e3b1c1a | |||
| 3e1316d9a6 | |||
| ef0fbad422 | |||
| 46f1d9465e | |||
| b5fca17987 | |||
| 48641cf945 | |||
| ea79842882 | |||
| 49814b311c | |||
| 545fe7fb50 | |||
| d3f25a84db | |||
| b06ac7a8c9 | |||
| f3c2e1f22d | |||
| 3c97d11beb | |||
| 5d547f0985 | |||
| a10fe3f1d6 | |||
| f9b61a3bf1 | |||
| d13d0835c4 | |||
| 113e7372fc | |||
| d2a6ee27d5 | |||
| 1db0f7419e | |||
| 0d90767a46 | |||
| 8e06c3fb23 | |||
| a03ecf8daa | |||
| 7203b4db08 | |||
| 27abfa4c23 | |||
| cea7f53e91 | |||
| 84eca8b73b | |||
| 17317c3ef3 | |||
| 2f666702c2 | |||
| 1a35256053 | |||
| d2cda7eb9e | |||
| 7b52961f4b | |||
| 1bafec231a | |||
| fc6536eb30 | |||
| 109e086253 | |||
| 5ffb067e5e | |||
| 8ce66a26f0 | |||
| 498afad13c | |||
| 0d78da8895 | |||
| d17b873107 | |||
| d94108f7bb | |||
| 8b362709b4 | |||
| b07006d576 | |||
| 7680ac2dec | |||
| dad35bb816 | |||
| 8945dd34c3 | |||
| ba99e7cef1 | |||
| 22d0dd5eb7 | |||
| 946664e1a1 | |||
| e92f283f53 | |||
| 07d51d6e5e | |||
| 3187579cab | |||
| 7b4aea756f | |||
| dd1478c5e1 | |||
| 399159c045 | |||
| a68140b3b9 | |||
| 0fba751c63 | |||
| 4de9ae70fa | |||
| 9b7842df35 | |||
| a3cc1f8c3d | |||
| 984cc68c7a | |||
| 39ff855a02 | |||
| b987c7c15f | |||
| 26ac0c0eec | |||
| a2d182ca9a | |||
| 69017348db | |||
| 2957dc90cb | |||
| 47a98444ab | |||
| 3757a0aeec | |||
| 394f19aa65 | |||
| 1ea6e1c04a | |||
| 437021b8e0 | |||
| 01a3803d0a | |||
| 6891beab89 | |||
| 17cbf2ac8b | |||
| b5ff0604a2 | |||
| b6afbee55f | |||
| 60d993bcac | |||
| 0d5a3becee | |||
| 8c296f2257 | |||
| 16b585a088 | |||
| c4223de958 | |||
| 8cab4c75d8 | |||
| f50d12f695 | |||
| bfc49280f3 | |||
| 12df11297b | |||
| 7b4ac7b45b | |||
| 31fde8c3f4 | |||
| 364849f5bd | |||
| 827d039ebf | |||
| 01d0036bc6 | |||
| 899428db2c | |||
| 96d9612893 | |||
| 8352acdab2 | |||
| b2365aad67 | |||
| f0dc19b045 | |||
| 2bcc60220a | |||
| 5e50058a81 | |||
| d9f82f9805 | |||
| 85ff5011bf | |||
| 27710159d2 | |||
| c220404af1 | |||
| da5ed2be0d | |||
| 5467f1ed24 | |||
| a5e9a4a2c4 | |||
| 9f4ceb8354 | |||
| 6ec4a80f52 | |||
| eb34ca52c0 | |||
| 7c8aec0bd3 | |||
| d04edd2119 | |||
| 3a91016c26 | |||
| d4c7b7051b | |||
| 6933635111 | |||
| 357b0b8ba0 | |||
| a36d004f83 | |||
| fafd2a3284 | |||
| 0082f79f34 | |||
| 0308e295ee | |||
| 157aa15fd3 | |||
| cab2354b99 | |||
| a16ea6d6e8 | |||
| 3cbefa06df | |||
| 44b9e57af6 | |||
| 2af67b457f | |||
| 272c793745 | |||
| 770d1ae776 | |||
| 457003a0c6 | |||
| 51262156b1 | |||
| 408189df1f | |||
| ea29179f16 | |||
| 54c7dc77ec | |||
| 9be66d4e28 | |||
| 0293406d2b | |||
| 7c79c52e89 | |||
| 9045bc8c9b | |||
| 686cbd7d44 | |||
| fdcdfd31d1 | |||
| 6774ddc36b | |||
| 49c8235318 | |||
| 6af8964e0c | |||
| d185b3791c | |||
| 02c9efee97 | |||
| a0f5f21b2c | |||
| 07f5fd7887 | |||
| 7c2f1653a9 | |||
| b9a2dc6b25 | |||
| cad677f29a | |||
| c47c9ac1ca | |||
| 01f459cd1d | |||
| 9f83e565c0 | |||
| 983fab8b05 | |||
| ddbc02cbf5 | |||
| 6d1bb5d3a9 | |||
| 314937c12c | |||
| ae85fe3e7f | |||
| d49424b6c8 | |||
| c778b849e9 | |||
| 43b1ddd1db | |||
| 8cf5aacd8f | |||
| 18b11a7b1b | |||
| 30a9a37a19 | |||
| 560dd57b15 | |||
| d7eb089a6e | |||
| 2b3115299f | |||
| 59a277bc40 | |||
| 829a613617 | |||
| 7a1f2f0ec0 | |||
| d1b5103807 | |||
| d4e6fdfe5a | |||
| 905b709cd2 | |||
| 3bf749e8fe | |||
| 8aaec27237 | |||
| d6a55aa3dd | |||
| a51870ea58 | |||
| 469b6ae3c6 | |||
| 4987ea5e95 | |||
| 7c98f84c36 | |||
| 31404156e6 | |||
| 1baf28a360 | |||
| 10b2198bf3 | |||
| c2b85fe9af | |||
| a96a4aceb5 | |||
| f5851bc826 | |||
| f7b9a9a40b | |||
| 51add4de64 | |||
| aac1c20125 | |||
| 5fe158f353 | |||
| e252efee1e | |||
| 97538d1494 | |||
| 5e935ac943 | |||
| c40e8e109a | |||
| c75e3d0544 | |||
| 1ae17b155a | |||
| fd5a4b4561 | |||
| 539feaca28 | |||
| 042fd93b09 | |||
| fbce828647 | |||
| 5d479620a4 | |||
| 87afa435a3 | |||
| c4ffdc484d | |||
| 2384376d2e | |||
| 0875fc1d24 | |||
| 52c35aad8a | |||
| 74fea7a308 | |||
| 5302abb4a9 | |||
| b51add79a9 | |||
| 4f3bf457a6 | |||
| d5e6982054 | |||
| ef3f29352f | |||
| 3f3b6eaaa1 | |||
| 48a0eedb88 | |||
| c501349c2f | |||
| cd96e91c11 | |||
| c4b71ab3d9 | |||
| 1925650c96 | |||
| b78515b8bc | |||
| ce8f3c0599 | |||
| 93e42585d9 | |||
| 6afbba9bf4 | |||
| 97d08bf849 | |||
| 3d3f69cdbe | |||
| d4f35031c9 | |||
| cfbd30bf98 | |||
| 5b0a30a986 | |||
| 72497eb0b6 | |||
| 6040b0a853 | |||
| 69763c4327 | |||
| f43352521e | |||
| 27d8ca563b | |||
| 6e9d88a842 | |||
| 53374908bf | |||
| 2b92556a12 | |||
| 6dabd85bfe | |||
| 19c8698264 | |||
| 4176bab034 | |||
| 41e73881de | |||
| 78cd8978e2 | |||
| 6374c80de3 | |||
| 8b094a6df9 | |||
| 44e3271119 | |||
| d26a616680 | |||
| 6f9c87f6b2 | |||
| d5134f8c91 | |||
| 4d35d617ed | |||
| ba33248764 | |||
| 813fba8c6b | |||
| 25b2fee331 | |||
| 172927ef77 | |||
| 9e11cce4dd | |||
| 1179350392 | |||
| 2aabbf40e6 | |||
| 8a6c4b642f | |||
| a07ce9e7f0 | |||
| 0cf4be5a5f | |||
| 926221ee07 | |||
| a98946efdd | |||
| 77ba6d499a | |||
| bf55ee9416 | |||
| eff65a7f3f | |||
| 5399ef9258 | |||
| a582549916 | |||
| becd9d1202 | |||
| 8da129f633 | |||
| 61ce49e627 | |||
| 516ab61cc3 | |||
| 29457d1177 | |||
| e41e21b9b5 | |||
| eb6d32c244 | |||
| 3f691766a6 | |||
| 49a534cf53 | |||
| c7b7c0abd0 | |||
| 03a880dbf2 | |||
| 5eaae003d8 | |||
| bcda93b1f1 | |||
| cd78dd4ed0 | |||
| a966ac3d73 | |||
| 5de62313a9 | |||
| a40eb3d054 | |||
| a7484ee4ec | |||
| 802366a48e | |||
| b86a62a148 | |||
| 725fb69a51 | |||
| 427e91463e | |||
| 1206a25baf | |||
| 10a1b7502d | |||
| 8fee9e9ae8 | |||
| 687b9b1dd5 | |||
| 6041b8cc78 | |||
| 8af6186305 | |||
| 2e40553fb7 | |||
| 471d947171 | |||
| f4b1cce7cc | |||
| 071d78f5f5 | |||
| 4bfe14d67f | |||
| 4940f8ab80 | |||
| 86ce2a4ccb | |||
| 956f45d7b3 | |||
| 23bd81f4a6 | |||
| aea0692520 | |||
| ff172d1ef1 | |||
| 3df16cd4e3 | |||
| 0c668d1cf0 | |||
| 269ef4d950 | |||
| 231dbd84f5 | |||
| e4befe9959 | |||
| 51b81d2116 | |||
| 0e21fa3931 | |||
| d8431f4fd3 | |||
| 1700471ada | |||
| 8071c719c6 | |||
| 273e6f226b | |||
| 988ffd5ba9 | |||
| 8927265eba | |||
| 67daf3f0b0 | |||
| 7a3e2e2461 | |||
| 80ddcd845b | |||
| 7293046915 | |||
| eebfcc912b | |||
| d915fcf4b7 | |||
| bf306b5fc1 | |||
| cee55105de | |||
| 40d4c75b29 | |||
| 49dd61bcac | |||
| e590737654 | |||
| cde9aed074 | |||
| bbd6972315 | |||
| 8af243775a | |||
| 1f48dcea9c | |||
| 3ad0eb8f16 | |||
| ec0a921395 | |||
| 3e1ff658fa | |||
| 595bc352fd | |||
| 5a770129e3 | |||
| 1bed59f010 |
+76
-27
@@ -53,7 +53,7 @@ for i in $*; do
|
||||
done
|
||||
|
||||
# Supported distributions
|
||||
dists="maverick natty oneiric precise saucy"
|
||||
dists="saucy trusty utopic"
|
||||
|
||||
c_flag= # xcat-core (trunk-delvel) path
|
||||
d_flag= # xcat-dep (trunk) path
|
||||
@@ -86,7 +86,7 @@ if [ "$c_flag" -a "$d_flag" ];then
|
||||
exit 2
|
||||
fi
|
||||
|
||||
uploader="bp-sawyers"
|
||||
uploader="ligc"
|
||||
# Find where this script is located to set some build variables
|
||||
old_pwd=`pwd`
|
||||
cd `dirname $0`
|
||||
@@ -194,27 +194,40 @@ then
|
||||
if [ ! -d ../../$package_dir_name ];then
|
||||
mkdir -p "../../$package_dir_name"
|
||||
fi
|
||||
packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-OpenStack xCAT-OpenStack-baremetal"
|
||||
|
||||
#packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-OpenStack xCAT-OpenStack-baremetal xCAT-buildkit"
|
||||
packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT xCATsn xCAT-test xCAT-buildkit"
|
||||
target_archs=(amd64 ppc64el)
|
||||
for file in `echo $packages`
|
||||
do
|
||||
file_low=`echo $file | tr '[A-Z]' '[a-z]'`
|
||||
if grep -q $file $update_log || [ "$BUILDALL" == 1 -o "$file" = "perl-xCAT" ]; then
|
||||
rm -f ../../$package_dir_name/${file_low}_*.deb
|
||||
#only for genesis package
|
||||
rm -f ../../$package_dir_name/${file_low}-amd64_*.deb
|
||||
cd $file
|
||||
dch -v $pkg_version -b -c debian/changelog $build_string
|
||||
dpkg-buildpackage -uc -us
|
||||
rc=$?
|
||||
if [ $rc -gt 0 ]; then
|
||||
echo "Error: $file build package failed exit code $rc"
|
||||
fi
|
||||
cd -
|
||||
find $file -maxdepth 3 -type d -name "${file_low}*" | grep debian | xargs rm -rf
|
||||
find $file -maxdepth 3 -type f -name "files" | grep debian | xargs rm -rf
|
||||
mv ${file_low}* ../../$package_dir_name/
|
||||
if [ "$file" = "xCAT" -o "$file" = "xCAT-genesis-scripts" ]; then
|
||||
target_archs="amd64 ppc64el"
|
||||
else
|
||||
target_archs="all"
|
||||
fi
|
||||
for target_arch in `echo $target_archs`
|
||||
do
|
||||
if grep -q $file $update_log || [ "$BUILDALL" == 1 -o "$file" = "perl-xCAT" ]; then
|
||||
rm -f ../../$package_dir_name/${file_low}_*.$target_arch.deb
|
||||
#genesis scripts package, don't remove genesis amd64 files
|
||||
#rm -f ../../$package_dir_name/${file_low}-amd64_*.deb
|
||||
cd $file
|
||||
dch -v $pkg_version -b -c debian/changelog $build_string
|
||||
if [ "$target_arch" = "all" ]; then
|
||||
dpkg-buildpackage -uc -us
|
||||
else
|
||||
dpkg-buildpackage -uc -us -a$target_arch
|
||||
fi
|
||||
rc=$?
|
||||
if [ $rc -gt 0 ]; then
|
||||
echo "Error: $file build package failed exit code $rc"
|
||||
fi
|
||||
cd -
|
||||
find $file -maxdepth 3 -type d -name "${file_low}*" | grep debian | xargs rm -rf
|
||||
find $file -maxdepth 3 -type f -name "files" | grep debian | xargs rm -rf
|
||||
mv ${file_low}* ../../$package_dir_name/
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
find ../../$package_dir_name/* ! -name *.deb | xargs rm -f
|
||||
@@ -250,11 +263,16 @@ then
|
||||
mkdir conf
|
||||
|
||||
for dist in $dists; do
|
||||
if [ "$dist" = "trusty" ] || [ "$dist" = "utopic" ]; then
|
||||
tmp_out_arch="amd64 ppc64el"
|
||||
else
|
||||
tmp_out_arch="amd64"
|
||||
fi
|
||||
cat << __EOF__ >> conf/distributions
|
||||
Origin: xCAT internal repository
|
||||
Label: xcat-core bazaar repository
|
||||
Codename: $dist
|
||||
Architectures: amd64
|
||||
Architectures: $tmp_out_arch
|
||||
Components: main
|
||||
Description: Repository automatically genereted conf
|
||||
SignWith: yes
|
||||
@@ -269,17 +287,29 @@ basedir .
|
||||
__EOF__
|
||||
|
||||
#import the deb packages into the repo
|
||||
amd_files=`ls ../$package_dir_name/*.deb | grep -v "ppc64el"`
|
||||
all_files=`ls ../$package_dir_name/*.deb`
|
||||
for dist in $dists; do
|
||||
for file in `ls ../$package_dir_name/*.deb`; do
|
||||
if [ "$dist" = "trusty" ] || [ "$dist" = "utopic" ]; then
|
||||
deb_files=$all_files
|
||||
else
|
||||
deb_files=$amd_files
|
||||
fi
|
||||
for file in $deb_files; do
|
||||
reprepro -b ./ includedeb $dist $file;
|
||||
done
|
||||
done
|
||||
|
||||
#create the mklocalrepo script
|
||||
cat << '__EOF__' > mklocalrepo.sh
|
||||
. /etc/lsb-release
|
||||
cd `dirname $0`
|
||||
echo deb file://"`pwd`" $DISTRIB_CODENAME main > /etc/apt/sources.list.d/xcat-core.list
|
||||
host_arch=`uname -m`
|
||||
if [ "$host_arch" != "ppc64le" ];then
|
||||
host_arch="amd64"
|
||||
else
|
||||
host_arch="ppc64el"
|
||||
fi
|
||||
echo deb [arch=$host_arch] file://"`pwd`" $DISTRIB_CODENAME main > /etc/apt/sources.list.d/xcat-core.list
|
||||
__EOF__
|
||||
|
||||
chmod 775 mklocalrepo.sh
|
||||
@@ -353,11 +383,16 @@ then
|
||||
|
||||
#create the conf/distributions file
|
||||
for dist in $dists; do
|
||||
if [ "$dist" = "trusty" ] || [ "$dist" = "utopic" ]; then
|
||||
tmp_out_arch="amd64 ppc64el"
|
||||
else
|
||||
tmp_out_arch="amd64"
|
||||
fi
|
||||
cat << __EOF__ >> conf/distributions
|
||||
Origin: xCAT internal repository
|
||||
Label: xcat-dep bazaar repository
|
||||
Codename: $dist
|
||||
Architectures: amd64
|
||||
Architectures: $tmp_out_arch
|
||||
Components: main
|
||||
Description: Repository automatically genereted conf
|
||||
SignWith: yes
|
||||
@@ -371,8 +406,16 @@ ask-passphrase
|
||||
basedir .
|
||||
__EOF__
|
||||
|
||||
#import the deb packages into the repo
|
||||
amd_files=`ls ../debs/*.deb | grep -v "ppc64el"`
|
||||
all_files=`ls ../debs/*.deb`
|
||||
for dist in $dists; do
|
||||
for file in `ls ../debs/*.deb`; do
|
||||
if [ "$dist" = "trusty" ] || [ "$dist" = "utopic" ]; then
|
||||
deb_files=$all_files
|
||||
else
|
||||
deb_files=$amd_files
|
||||
fi
|
||||
for file in $deb_files; do
|
||||
reprepro -b ./ includedeb $dist $file;
|
||||
done
|
||||
done
|
||||
@@ -380,7 +423,13 @@ __EOF__
|
||||
cat << '__EOF__' > mklocalrepo.sh
|
||||
. /etc/lsb-release
|
||||
cd `dirname $0`
|
||||
echo deb file://"`pwd`" $DISTRIB_CODENAME main > /etc/apt/sources.list.d/xcat-dep.list
|
||||
host_arch=`uname -m`
|
||||
if [ "$host_arch" != "ppc64le" ];then
|
||||
host_arch="amd64"
|
||||
else
|
||||
host_arch="ppc64el"
|
||||
fi
|
||||
echo deb [arch=$host_arch] file://"`pwd`" $DISTRIB_CODENAME main > /etc/apt/sources.list.d/xcat-dep.list
|
||||
__EOF__
|
||||
|
||||
chmod 775 mklocalrepo.sh
|
||||
@@ -396,7 +445,7 @@ __EOF__
|
||||
chmod -R g+w xcat-dep
|
||||
|
||||
#create the tar ball
|
||||
dep_tar_name=xcat-dep-ubuntu.tar.bz
|
||||
dep_tar_name=xcat-dep-ubuntu-snap`date +%Y%m%d`.tar.bz
|
||||
tar -hjcf $dep_tar_name xcat-dep
|
||||
chgrp root $dep_tar_name
|
||||
chmod g+w $dep_tar_name
|
||||
|
||||
+9
-5
@@ -41,13 +41,15 @@ UPLOADUSER=bp-sawyers
|
||||
FRS=/home/frs/project/x/xc/xcat
|
||||
|
||||
# These are the rpms that should be built for each kind of xcat build
|
||||
ALLBUILD="perl-xCAT xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xCAT-buildkit xCAT xCATsn xCAT-genesis-scripts xCAT-OpenStack xCAT-SoftLayer xCAT-OpenStack-baremetal"
|
||||
#ALLBUILD="perl-xCAT xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xCAT-buildkit xCAT xCATsn xCAT-genesis-scripts xCAT-OpenStack xCAT-SoftLayer xCAT-OpenStack-baremetal"
|
||||
ALLBUILD="perl-xCAT xCAT-client xCAT-server xCAT-test xCAT-buildkit xCAT xCATsn xCAT-genesis-scripts xCAT-SoftLayer"
|
||||
ZVMBUILD="perl-xCAT xCAT-server xCAT-UI"
|
||||
ZVMLINK="xCAT-client xCAT xCATsn"
|
||||
# xCAT has PCM specific configuration - conserver-xcat, syslinux-xcat
|
||||
# xCAT and xCATsn have PCM specific configuration - conserver-xcat, syslinux-xcat
|
||||
# xCAT-server has PCM specific configuration - RESTAPI(perl-JSON)
|
||||
PCMBUILD="xCAT xCAT-server"
|
||||
PCMLINK="perl-xCAT xCAT-client xCAT-buildkit xCAT-genesis-scripts-x86_64"
|
||||
# xCAT-client has PCM specific configuration - getxcatdocs(perl-JSON)
|
||||
PCMBUILD="xCAT xCAT-server xCAT-client xCATsn"
|
||||
PCMLINK="perl-xCAT xCAT-buildkit xCAT-genesis-scripts-x86_64"
|
||||
# Note: for FSM, the FlexCAT rpm is built separately from gsa/git
|
||||
FSMBUILD="perl-xCAT xCAT-client xCAT-server"
|
||||
FSMLINK=""
|
||||
@@ -264,6 +266,8 @@ if [ "$OSNAME" != "AIX" ]; then
|
||||
ORIGFAILEDRPMS="$FAILEDRPMS"
|
||||
./makerpm xCAT-genesis-scripts x86_64 "$EMBED"
|
||||
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS xCAT-genesis-scripts-x86_64"; fi
|
||||
./makerpm xCAT-genesis-scripts ppc64 "$EMBED"
|
||||
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS xCAT-genesis-scripts-ppc64"; fi
|
||||
if [ "$FAILEDRPMS" = "$ORIGFAILEDRPMS" ]; then # all succeeded
|
||||
rm -f $DESTDIR/xCAT-genesis-scripts*rpm
|
||||
rm -f $SRCDIR/xCAT-genesis-scripts*rpm
|
||||
@@ -286,7 +290,7 @@ for rpmname in xCAT xCATsn xCAT-OpenStack xCAT-OpenStack-baremetal; do
|
||||
./makerpm $rpmname "$EMBED"
|
||||
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS $rpmname"; fi
|
||||
else
|
||||
for arch in x86_64 ppc64 s390x; do
|
||||
for arch in x86_64 ppc64 ppc64le s390x; do
|
||||
if [ "$rpmname" = "xCAT-OpenStack" -a "$arch" != "x86_64" ] || [ "$rpmname" = "xCAT-OpenStack-baremetal" -a "$arch" != "x86_64" ] ; then continue; fi # only bld openstack for x86_64 for now
|
||||
./makerpm $rpmname $arch "$EMBED"
|
||||
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS $rpmname-$arch"; fi
|
||||
|
||||
@@ -111,6 +111,8 @@ echo "This is an $OSNAME system"
|
||||
ARCH=$(uname -p)
|
||||
if [ "$ARCH" = "x64_64" ]; then
|
||||
$CURDIR/makerpm xCAT-genesis-scripts x86_64
|
||||
else
|
||||
$CURDIR/makerpm xCAT-genesis-scripts ppc64
|
||||
fi
|
||||
|
||||
|
||||
@@ -150,6 +152,7 @@ gpgcheck=0
|
||||
EOF
|
||||
|
||||
cp $CURDIR/build/xCAT-core.repo /etc/yum.repos.d/
|
||||
createrepo $CURDIR/build
|
||||
else
|
||||
rm -f /etc/zypp/repos.d/xCAT-core.repo
|
||||
zypper ar file://$CURDIR/build xCAT-core
|
||||
|
||||
@@ -85,6 +85,7 @@ function makexcat {
|
||||
cd `dirname $0`/$RPMNAME
|
||||
tar --exclude .svn -czf $RPMROOT/SOURCES/license.tar.gz LICENSE.html
|
||||
cp xcat.conf $RPMROOT/SOURCES
|
||||
cp xcat.conf.apach24 $RPMROOT/SOURCES
|
||||
cp xCATSN $RPMROOT/SOURCES
|
||||
cd - >/dev/null
|
||||
elif [ "$RPMNAME" = "xCAT-buildkit" ]; then
|
||||
@@ -105,7 +106,23 @@ function makexcat {
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# make ironic rpm for ironic baremetal driver
|
||||
function makeironic {
|
||||
RPMNAME="$1"
|
||||
ARCH="$2"
|
||||
cd `dirname $0`/$RPMNAME
|
||||
cp -rf ironic_baremetal /tmp/
|
||||
cd /tmp/ironic_baremetal
|
||||
git init
|
||||
git add *
|
||||
git commit -a -m "generate rpm"
|
||||
python setup.py bdist_rpm
|
||||
rm -rf $RPMROOT/RPMS/$ARCH/
|
||||
mkdir -p $RPMROOT/RPMS/$ARCH/
|
||||
cp -rf dist/*.rpm $RPMROOT/RPMS/$ARCH/
|
||||
rm -rf /tmp/ironic_baremetal
|
||||
}
|
||||
|
||||
|
||||
# Make the xCAT-nbroot-core rpm
|
||||
function makenbroot {
|
||||
@@ -205,7 +222,6 @@ else # linux
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ "$1" = "xCAT" -o "$1" = "xCATsn" -o "$1" = "xCAT-buildkit" -o "$1" = "xCAT-OpenStack" ]; then
|
||||
exportEmbed $3
|
||||
makexcat $1 $2
|
||||
@@ -218,6 +234,8 @@ elif [ "$1" = "xCAT-genesis-builder" ]; then
|
||||
elif [ "$1" = "xCAT-genesis-scripts" ]; then
|
||||
exportEmbed $3
|
||||
makegenesisscripts $1 $2
|
||||
elif [ "$1" = "xCAT-OpenStack-ironic" ]; then
|
||||
makeironic $1 $2
|
||||
else # must be one of the noarch rpms
|
||||
exportEmbed $2
|
||||
makenoarch $1
|
||||
|
||||
+1
-1
@@ -266,7 +266,7 @@ See http://www.perl.com/doc/manual/html/pod/perlre.html for information on perl
|
||||
|
||||
As of xCAT 2.8.1, you can use a modified version of the regular expression support described in the previous section. You do not need to enter the node information (1st part of the expression), it will be derived from the input nodename. You only need to supply the 2nd part of the expression to determine the value to give the attribute. For examples, see
|
||||
|
||||
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Listing_and_Modifying_the_Database#Easy_Regular_expressions
|
||||
https://sourceforge.net/p/xcat/wiki/Listing_and_Modifying_the_Database/#easy-regular-expressions
|
||||
|
||||
=head1 OBJECT DEFINITIONS
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ binary-arch: build install
|
||||
chmod 644 `pwd`/debian/perl-xcat/opt/xcat/share/doc/man5/*
|
||||
chmod 644 `pwd`/debian/perl-xcat/opt/xcat/share/man/man7/*
|
||||
chmod 644 `pwd`/debian/perl-xcat/opt/xcat/share/doc/man7/*
|
||||
./modifyUtils `cat ../Version` `svn info | grep Revision | cut -d" " -f 2`
|
||||
./modifyUtils `cat ../Version` `git log -n 1 | head -n 1 | cut -f 2 -d ' '`
|
||||
# dh_installmenu
|
||||
# dh_installdebconf
|
||||
# dh_installlogrotate
|
||||
|
||||
+125
-2
@@ -500,6 +500,7 @@ sub setCFMPkglistFile {
|
||||
Arguments:
|
||||
$imagename - the specified linuximage name
|
||||
@curospkgs - the currently selected OS packages list
|
||||
$mode - using Fuzzy Matching or Exact Matching to check packages
|
||||
Returns:
|
||||
0 - update successfully
|
||||
1 - update failed
|
||||
@@ -509,13 +510,22 @@ sub setCFMPkglistFile {
|
||||
none
|
||||
Example:
|
||||
my $ret = CAT::CFMUtils->updateCFMPkglistFile($imagename, @cur_selected_pkgs);
|
||||
my $ret = CAT::CFMUtils->updateCFMPkglistFile($imagename, @cur_selected_pkgs, 1);
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub updateCFMPkglistFile {
|
||||
my ($class, $img, $ospkgs) = @_;
|
||||
|
||||
my ($class, $img, $ospkgs, $mode) = @_;
|
||||
|
||||
if(defined($mode)){
|
||||
# Exact Matching
|
||||
$mode = 1;
|
||||
}else {
|
||||
# Fuzzy Matching
|
||||
$mode = 0;
|
||||
}
|
||||
|
||||
my @cur_selected = @$ospkgs;
|
||||
my $cfmpkglist = "/install/osimages/$img/pkglist.cfm";
|
||||
|
||||
@@ -549,6 +559,14 @@ sub updateCFMPkglistFile {
|
||||
my @selected = @$selected_ref;
|
||||
@basepkgs = xCAT::CFMUtils->arrayops("U", \@basepkgs, \@selected);
|
||||
}
|
||||
|
||||
# Fuzzy Matching
|
||||
if (not $mode){
|
||||
my ($ref1, $ref2, $ref3) = xCAT::CFMUtils->updateSelectedPkgs(\@pre_selected, \@pre_removed, \@cur_selected);
|
||||
@pre_selected = @$ref1;
|
||||
@pre_removed = @$ref2;
|
||||
@cur_selected = @$ref3;
|
||||
}
|
||||
|
||||
# get diff between previous and current selected OS packages lists
|
||||
my @diff = xCAT::CFMUtils->getPkgsDiff(\@pre_selected, \@cur_selected);
|
||||
@@ -661,6 +679,48 @@ sub getPreOSpkgsList {
|
||||
return (\@selected, \@removed);
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 getPreBaseOSpkgsList
|
||||
Get previously selected and removed base OS packages lists from pkglist file. Packages named with "example.xxx" should be the base name "example"
|
||||
|
||||
Arguments:
|
||||
$ospkglist - the path for ospkglist file
|
||||
Returns:
|
||||
refs for selected and removed OS packages arrays
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my $pre_selected_ref = xCAT::CFMUtils->getPreOSpkgsList($ospkglist);
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub getPreBaseOSpkgsList {
|
||||
my ($class, $pkglist) = @_;
|
||||
|
||||
my ($pre_selected_ref, $pre_removed_ref) = xCAT::CFMUtils->getPreOSpkgsList($pkglist);
|
||||
|
||||
my %pre_selected_hash = ();
|
||||
foreach (@$pre_selected_ref) {
|
||||
my @names = split(/\./, $_);
|
||||
my $basename = $names[0];
|
||||
|
||||
if ($_ =~ /^$basename\.([^\.]+)$/) {
|
||||
$pre_selected_hash{$basename} = 1;
|
||||
}else {
|
||||
$pre_selected_hash{$_} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
my @pre_selected = keys %pre_selected_hash;
|
||||
|
||||
return \@pre_selected;
|
||||
}
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 getPkgsDiff
|
||||
@@ -819,3 +879,66 @@ sub arrayops {
|
||||
|
||||
#return (\@union, \@intersection, \@difference);
|
||||
}
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 updateSelectedPkgs
|
||||
Update previous selected, previous removed and current selected packages based on fuzzy matching rules. Packages named with "example.i686" should be same with package "example"
|
||||
|
||||
Arguments:
|
||||
\@pre_selected - reference to previous selected packages
|
||||
\@pre_removed - reference to previous removed packages
|
||||
\@cur_selected - reference to current selected packages
|
||||
Returns:
|
||||
new previous selected, previous removed, current selected packages
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my ($ref1, $ref2, $ref3) = xCAT::CFMUtils->arrayops(\@pre_selected, \@pre_removed, \@cur_selected);
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub updateSelectedPkgs() {
|
||||
my ($class, $pre_selected_ref, $pre_removed_ref, $cur_selected_ref) = @_;
|
||||
|
||||
my %pre_selected_hash = map{$_ => 1} @$pre_selected_ref;
|
||||
my %pre_removed_hash = map{$_ => 1} @$pre_removed_ref;
|
||||
my %cur_selected_hash = map{$_ => 1} @$cur_selected_ref;
|
||||
|
||||
my %new_pre_selected_hash = %pre_selected_hash;
|
||||
my %new_pre_removed_hash = %pre_removed_hash;
|
||||
my %new_cur_selected_hash = %cur_selected_hash;
|
||||
|
||||
foreach (keys %cur_selected_hash) {
|
||||
my $father = $_;
|
||||
my $flag = 0;
|
||||
foreach (keys %pre_selected_hash) {
|
||||
my $child = $_;
|
||||
if ($child =~ /^$father\.([^\.]+)$/) {
|
||||
$new_cur_selected_hash{$child} = 1;
|
||||
$flag = 1;
|
||||
}
|
||||
}
|
||||
if ($flag and not exists $pre_selected_hash{$father}){
|
||||
delete $new_cur_selected_hash{$father} if exists $new_cur_selected_hash{$father};
|
||||
}
|
||||
|
||||
foreach (keys %pre_removed_hash) {
|
||||
my $child = $_;
|
||||
if ($child =~ /^$father\.([^\.]+)$/) {
|
||||
delete $new_pre_removed_hash{$child} if exists $new_pre_removed_hash{$child};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my @new_cur_selected = keys %new_cur_selected_hash;
|
||||
my @new_pre_selected = keys %new_pre_selected_hash;
|
||||
my @new_pre_removed = keys %new_pre_removed_hash;
|
||||
|
||||
|
||||
return (\@new_pre_selected, \@new_pre_removed, \@new_cur_selected);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ if ($inet6support) {
|
||||
|
||||
if ($^O =~ /^linux/i) {
|
||||
# Is IPv6 enabled on the MN or xcat client node at all?
|
||||
my $ipv6enabled = `ip addr | grep inet6`;
|
||||
my $ipv6enabled = `ip addr 2> /dev/null | grep inet6`;
|
||||
if (!$ipv6enabled) {
|
||||
$inet6support = 0;
|
||||
}
|
||||
|
||||
@@ -1020,6 +1020,7 @@ sub fork_fanout_dsh
|
||||
}
|
||||
}
|
||||
# save the original exports, we are going to add the unique node name below
|
||||
my $firstpass=0;
|
||||
while (@$targets_waiting
|
||||
&& (keys(%$targets_active) < $$options{'fanout'}))
|
||||
{
|
||||
@@ -1046,6 +1047,7 @@ sub fork_fanout_dsh
|
||||
}
|
||||
if ($$options{'environment'})
|
||||
{
|
||||
if ($firstpass ==0) { # do the servicenode stuff only once
|
||||
# if we are on a servicenode need to get the environment file
|
||||
# from the SNsyncfiledir, not local
|
||||
if (xCAT::Utils->isServiceNode()) {
|
||||
@@ -1068,8 +1070,10 @@ sub fork_fanout_dsh
|
||||
$rsp->{error}->[0] = "File $$options{'environment'} does not exist";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
|
||||
}
|
||||
# build the xdsh command
|
||||
push @dsh_command,
|
||||
$firstpass=1;
|
||||
}
|
||||
# build the xdsh command
|
||||
push @dsh_command,
|
||||
"$exportnode$$options{'pre-command'} . $$options{'environment'} ; $$options{'command'}$$options{'post-command'}";
|
||||
}
|
||||
|
||||
@@ -4032,7 +4036,7 @@ sub parse_and_run_dsh
|
||||
{ # from sinv, discard this name
|
||||
undef @$nodes;
|
||||
}
|
||||
if (@$nodes)
|
||||
if (@$nodes[0])
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
@@ -4403,6 +4407,14 @@ sub parse_and_run_dcp
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1);
|
||||
return;
|
||||
}
|
||||
if (@$nodes[0])
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"Input noderange:@$nodes and any other xdsh flags or environment variables are not valid with -i flag.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ((!(defined($nodes))) && (!(defined($options{'rootimg'}))))
|
||||
{ # no nodes and not -i option, error
|
||||
@@ -4501,7 +4513,7 @@ sub parse_and_run_dcp
|
||||
#
|
||||
# build list of nodes
|
||||
my @nodelist;
|
||||
if (@$nodes)
|
||||
if (@$nodes[0])
|
||||
{ # there are nodes
|
||||
@nodelist = @$nodes;
|
||||
$options{'nodes'} = join(',', @nodelist);
|
||||
|
||||
@@ -517,12 +517,14 @@ sub getmacs {
|
||||
$data.= "\n$_\n";
|
||||
push @$value, "\n$_\n";
|
||||
} elsif ( /^ent\s+/ || /^hfi-ent\s+/ ) {
|
||||
my @fields = split /\s+/, $_;
|
||||
my $mac = $fields[2];
|
||||
$mac = format_mac( $mac );
|
||||
$fields[2] = $mac;
|
||||
$data .= join(" ",@fields)."\n";
|
||||
push @$value, join(" ",@fields)."\n";
|
||||
#my @fields = split /\s+/, $_;
|
||||
#my $mac = $fields[2];
|
||||
#$mac = format_mac( $mac );
|
||||
#$fields[2] = $mac;
|
||||
#$data .= join(" ",@fields)."\n";
|
||||
#push @$value, join(" ",@fields)."\n";
|
||||
$data .= "$_\n";
|
||||
push @$value, "$_\n";
|
||||
}
|
||||
}
|
||||
push @$res,[$node,$data,0];
|
||||
|
||||
@@ -264,7 +264,7 @@ sub temp {
|
||||
# No frame commands for IVM
|
||||
#################################
|
||||
if ( $hwtype eq "ivm" ) {
|
||||
push @result, [$name,"$prefix Not available (No BPA)",1];
|
||||
push @result, [$name,"$prefix Not available (No BPA)",0];
|
||||
next;
|
||||
}
|
||||
#################################
|
||||
@@ -272,14 +272,14 @@ sub temp {
|
||||
#################################
|
||||
if ( @$d[4] !~ /^(fsp|lpar|cec)$/ ) {
|
||||
my $text = "$prefix Only available for CEC/LPAR";
|
||||
push @result, [$name,$text,1];
|
||||
push @result, [$name,$text,0];
|
||||
next;
|
||||
}
|
||||
#################################
|
||||
# Error - No frame
|
||||
#################################
|
||||
if ( $mtms eq "0" ) {
|
||||
push @result, [$name,"$prefix Not available (No BPA)",1];
|
||||
push @result, [$name,"$prefix Not available (No BPA)",0];
|
||||
next;
|
||||
}
|
||||
#################################
|
||||
@@ -352,7 +352,7 @@ sub rackenv {
|
||||
#################################
|
||||
if ( @$d[4] !~ /^(bpa|frame)$/ ) {
|
||||
my $text = "$prefix Only available for BPA/Frame";
|
||||
push @result, [$name,$text,1];
|
||||
push @result, [$name,$text,0];
|
||||
next;
|
||||
}
|
||||
|
||||
|
||||
+132
-45
@@ -52,9 +52,10 @@ my @query_array = ();
|
||||
my %param_list_map = (
|
||||
'vmcpus' => 'part_get_lpar_processing',
|
||||
'vmmemory' => 'part_get_lpar_memory',
|
||||
'vmphyslots' => 'part_get_all_io_bus_info',
|
||||
'vmnics' => 'part_get_all_vio_info',
|
||||
'vmstorage' => 'part_get_all_vio_info',
|
||||
'add_physlots' => 'part_get_all_io_bus_info',
|
||||
'del_physlots' => 'part_get_all_io_bus_info',
|
||||
'add_vmnics' => 'part_get_all_vio_info',
|
||||
'add_vmstorage' => 'part_get_all_vio_info',
|
||||
'del_vadapter' => 'part_get_all_vio_info'
|
||||
);
|
||||
|
||||
@@ -62,7 +63,7 @@ sub chvm_parse_extra_options {
|
||||
my $args = shift;
|
||||
my $opt = shift;
|
||||
# Partition used attributes #
|
||||
my @support_ops = qw(vmcpus vmmemory vmphyslots vmothersetting vmstorage vmnics del_vadapter);
|
||||
my @support_ops = qw(vmcpus vmmemory add_physlots vmothersetting add_vmstorage add_vmnics del_vadapter del_physlots);
|
||||
if (ref($args) ne 'ARRAY') {
|
||||
return "$args";
|
||||
}
|
||||
@@ -94,7 +95,13 @@ sub chvm_parse_extra_options {
|
||||
if ($value !~ /^\d+$/) {
|
||||
return "Invalid param '$value', only one slot id can be specified";
|
||||
}
|
||||
|
||||
} elsif ($cmd eq "del_physlots") {
|
||||
my @tmp_array = split ",",$value;
|
||||
foreach (@tmp_array) {
|
||||
unless (/(0x\w{8})/) {
|
||||
return "'$_' is invalid";
|
||||
}
|
||||
}
|
||||
} elsif ($cmd eq "vmothersetting") {
|
||||
if ($value =~ /hugepage:\s*(\d+)/i) {
|
||||
$opt->{huge_page} = $1;
|
||||
@@ -105,7 +112,7 @@ sub chvm_parse_extra_options {
|
||||
$tmp_hash{'get_cec_bsr'} = 1;
|
||||
}
|
||||
next;
|
||||
} elsif ($cmd eq "vmstorage") {
|
||||
} elsif ($cmd eq "add_vmstorage") {
|
||||
if (exists($opt->{vios})) {
|
||||
if ($value !~ /\d+/) {
|
||||
return "'$value' is invalid, must be numbers";
|
||||
@@ -149,7 +156,7 @@ sub chvm_parse_extra_options {
|
||||
} else {
|
||||
return "'$value' is invalid";
|
||||
}
|
||||
} elsif ($cmd eq "vmphyslots") {
|
||||
} elsif ($cmd eq "add_physlots") {
|
||||
my @tmp_array = split ",",$value;
|
||||
foreach (@tmp_array) {
|
||||
unless (/(0x\w{8})/) {
|
||||
@@ -163,7 +170,7 @@ sub chvm_parse_extra_options {
|
||||
return "'$_' is invalid";
|
||||
}
|
||||
}
|
||||
} elsif ($cmd eq "vmnics") {
|
||||
} elsif ($cmd eq "add_vmnics") {
|
||||
my @tmp_array = split ",", $value;
|
||||
foreach (@tmp_array) {
|
||||
unless (/^vlan\d+$/i) {
|
||||
@@ -199,8 +206,9 @@ sub chvm_parse_args {
|
||||
# Process command-line arguments
|
||||
#############################################
|
||||
if ( !defined( $args )) {
|
||||
$request->{method} = $cmd;
|
||||
return( \%opt );
|
||||
#$request->{method} = $cmd;
|
||||
#return( \%opt );
|
||||
return ( usage() );
|
||||
}
|
||||
#############################################
|
||||
# Checks case in GetOptions, allows opts
|
||||
@@ -415,7 +423,7 @@ sub chvm_parse_args {
|
||||
my $check_chvm_arg = chvm_parse_extra_options(\@ARGV, \%opt);
|
||||
if (defined($check_chvm_arg)) {
|
||||
return (usage("Invalid argument: $check_chvm_arg"));
|
||||
} elsif (($opt{lparname} ne '*') && (scalar(@{$request->{node}}) > '1')){
|
||||
} elsif (($opt{lparname}) && ($opt{lparname} ne '*') && (scalar(@{$request->{node}}) > '1')){
|
||||
return(usage( "Invalid argument: must specify '*' for more than one node" ));
|
||||
}
|
||||
if ((exists($opt{lparname}) ||exists($opt{huge_page})) &&
|
||||
@@ -608,7 +616,6 @@ sub mkvm_parse_args {
|
||||
if ( (!exists( $opt{i} ) || !exists( $opt{r} )) ) {
|
||||
return(usage());
|
||||
}
|
||||
}
|
||||
$opt{target} = \@{$request->{node}};
|
||||
my $ppctab = xCAT::Table->new( 'ppc');
|
||||
unless($ppctab) {
|
||||
@@ -633,9 +640,11 @@ sub mkvm_parse_args {
|
||||
return(usage("For Power 775, please make sure the noderange are in one CEC "));
|
||||
}
|
||||
}
|
||||
if (exists($opt{p775})) {
|
||||
#if (exists($opt{p775})) {
|
||||
$request->{node} = [$other_p];
|
||||
$request->{noderange} = $other_p;
|
||||
#}
|
||||
|
||||
}
|
||||
####################################
|
||||
# No operands - add command name
|
||||
@@ -794,14 +803,27 @@ sub do_op_extra_cmds {
|
||||
if ($op eq "lparname") {
|
||||
$action = "set_lpar_name";
|
||||
} elsif ($op eq "huge_page") {
|
||||
my @td = @$d;
|
||||
@td[0] = 0;
|
||||
my $tmphash = &query_cec_info_actions($request, $name, \@td, 1, ["get_huge_page"]);
|
||||
if ($tmphash->{huge_page_avail}) {
|
||||
if ($param > $tmphash->{huge_page_avail}) {
|
||||
push @values, [$name, "No enough huge pages, only $tmphash->{huge_page_avail} pages available", 0];
|
||||
$param = $tmphash->{huge_page_avail};
|
||||
}
|
||||
$param = "1/$param/$param";
|
||||
} else {
|
||||
push @values, [$name, "No huge page available to configure", 0];
|
||||
next;
|
||||
}
|
||||
$action = "set_huge_page";
|
||||
} elsif ($op eq "vmcpus") {
|
||||
$action = "part_set_lpar_pending_proc";
|
||||
} elsif ($op eq "vmphyslots") {
|
||||
} elsif ($op eq "add_physlots" or $op eq "del_physlots") {
|
||||
$action = "set_io_slot_owner_uber";
|
||||
} elsif ($op eq "del_vadapter") {
|
||||
$action = "part_clear_vslot_config";
|
||||
} elsif ($op eq "vmnics") {
|
||||
} elsif ($op eq "add_vmnics") {
|
||||
my @vlans = split /,/,$param;
|
||||
foreach (@vlans) {
|
||||
if (/vlan(\d+)/i) {
|
||||
@@ -820,7 +842,7 @@ sub do_op_extra_cmds {
|
||||
}
|
||||
}
|
||||
next;
|
||||
} elsif ($op eq "vmstorage") {
|
||||
} elsif ($op eq "add_vmstorage") {
|
||||
foreach my $v_info (@$param) {
|
||||
if ($v_info =~ /(\d+),([\w_-]*):(\d+)/) {
|
||||
my $vios = &find_lpar_id($request, @$d[3], $2);
|
||||
@@ -842,6 +864,10 @@ sub do_op_extra_cmds {
|
||||
my @td = @$d;
|
||||
@td[0] = 0;
|
||||
$memhash = &query_cec_info_actions($request, $name, \@td, 1, ["part_get_hyp_process_and_mem"]);
|
||||
unless (scalar keys(%$memhash)) {
|
||||
push @values, [$mtms, "Can not get hypervisor information", 1];
|
||||
next;
|
||||
}
|
||||
if (!exists($memhash->{run})) {
|
||||
if ($param =~ /(\d+)([G|M]?)\/(\d+)([G|M]?)\/(\d+)([G|M]?)/i) {
|
||||
my $memsize = $memhash->{mem_region_size};
|
||||
@@ -871,7 +897,11 @@ sub do_op_extra_cmds {
|
||||
$memhash->{lpar_used_regions} = 0;
|
||||
my $ret = &deal_with_avail_mem($request, $name, $d, $memhash);
|
||||
if (ref($ret) eq "ARRAY") {
|
||||
return ([[@$ret]]);
|
||||
if (@$ret[2]) {
|
||||
return ([[@$ret]]);
|
||||
} else {
|
||||
push @values, $ret;
|
||||
}
|
||||
}
|
||||
$param = $memhash->{memory};
|
||||
$action = "part_set_lpar_pending_mem";
|
||||
@@ -885,17 +915,27 @@ sub do_op_extra_cmds {
|
||||
}
|
||||
my $tmp_value = ($param eq '*') ? $name : $param;
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} $action for node:$name, parm:$tmp_value.");
|
||||
my $value = xCAT::FSPUtils::fsp_api_action($request, $name, $d, $action, 0, $tmp_value);
|
||||
my @tmpd = @$d;
|
||||
if ($op eq "del_physlots") {
|
||||
@tmpd[0] = "-1";
|
||||
}
|
||||
my $value = xCAT::FSPUtils::fsp_api_action($request, $name, \@tmpd, $action, 0, $tmp_value);
|
||||
if (@$value[1] && ((@$value[1] =~ /Error/i) && (@$value[2] ne '0'))) {
|
||||
return ([[$name, @$value[1], '1']]) ;
|
||||
} else {
|
||||
push @values, [$name, "Success", '0'];
|
||||
}
|
||||
}
|
||||
my $rethash = query_cec_info_actions($request, $name, $d, 1, \@query_array);
|
||||
# need to add update db here
|
||||
$lpar_hash{$name} = $rethash;
|
||||
$lpar_hash{$name}->{parent} = @$d[3];
|
||||
if (@query_array) {
|
||||
my $rethash = query_cec_info_actions($request, $name, $d, 1, \@query_array);
|
||||
unless (scalar keys(%$memhash)) {
|
||||
push @values, [$mtms, "Can not get hypervisor information", 1];
|
||||
next;
|
||||
}
|
||||
# need to add update db here
|
||||
$lpar_hash{$name} = $rethash;
|
||||
$lpar_hash{$name}->{parent} = @$d[3];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (%lpar_hash) {
|
||||
@@ -1667,7 +1707,7 @@ sub xCATdB {
|
||||
$profile,
|
||||
$parent );
|
||||
|
||||
return( xCAT::PPCdb::add_ppc( $hwtype, [$values] ));
|
||||
return( xCAT::PPCdb::add_ppc( $hwtype, [$values],'','',"FSP" ));
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
@@ -1942,12 +1982,24 @@ sub query_cec_info {
|
||||
}
|
||||
my $rethash = query_cec_info_actions($request, $name, $d, $usage, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_io_bus_info","part_get_all_vio_info","get_huge_page","get_cec_bsr"], \%tmp_hash);
|
||||
#push @result, [$name, $rethash, 0];
|
||||
push @result, @$rethash;
|
||||
#push @result, @$rethash;
|
||||
if (scalar (@$rethash)) {
|
||||
push @result, @$rethash;
|
||||
} else {
|
||||
push @result, [$name, "No information got", -1];
|
||||
last;
|
||||
}
|
||||
$lpar_hash{$name} = \%tmp_hash;
|
||||
$lpar_hash{$name}->{parent} = @$d[3];
|
||||
}
|
||||
if (@td[0] == 0) {
|
||||
my $rethash = query_cec_info_actions($request, @td[3],\@td, $usage);
|
||||
if (scalar (@$rethash)) {
|
||||
push @result, @$rethash;
|
||||
} else {
|
||||
push @result, [@td[3], "No information got", -1];
|
||||
last;
|
||||
}
|
||||
#push @result, [@td[3], $rethash, 0];
|
||||
push @result, @$rethash;
|
||||
}
|
||||
@@ -2049,9 +2101,12 @@ sub deal_with_avail_mem {
|
||||
my $cur_mem_in_G = $lparhash->{hyp_avail_mem} * $lparhash->{mem_region_size} * 1.0 / 1024;
|
||||
return([$name, "Parse reserverd regions failed, no enough memory, available:$cur_mem_in_G GB.", 1]);
|
||||
}
|
||||
if ($cur > $cur_avail) {
|
||||
my $new_cur = $cur_avail;
|
||||
$lparhash->{memory} = "$min/$new_cur/$max";
|
||||
if (($cur_avail > 0) and ($cur > $cur_avail)) {
|
||||
my $cur_avail_in_G = $cur_avail * $lparhash->{mem_region_size} * 1.0 / 1024;
|
||||
$lparhash->{memory} = "$min/$cur_avail/$max";
|
||||
unless ($lparhash->{full_par}) {
|
||||
return([$name, "Available memory is less than required, allocate $cur_avail_in_G GB.", 0]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return ([$name, "Failed to get hypervisor reserved memory regions.", 1]);
|
||||
@@ -2089,6 +2144,7 @@ sub create_lpar {
|
||||
my $name = shift;
|
||||
my $d = shift;
|
||||
my $lparhash = shift;
|
||||
my @ret = ();
|
||||
my $values;
|
||||
if (exists($request->{opt}->{vios})) {
|
||||
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_def_state", 0, 0x03);
|
||||
@@ -2101,7 +2157,7 @@ sub create_lpar {
|
||||
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_lpar_name", 0, $name);
|
||||
if (@$values[2] ne 0) {
|
||||
&set_lpar_undefined($request, $name, $d);
|
||||
return ([$name, @$values[1], @$values[0]]);
|
||||
return ([[$name, @$values[1], @$values[0]]]);
|
||||
}
|
||||
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_shared_pool_util_auth");
|
||||
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_group_id");
|
||||
@@ -2112,7 +2168,7 @@ sub create_lpar {
|
||||
#$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_io_slot_owner", 0, join(",",@phy_io_array));
|
||||
if (@$values[2] ne 0) {
|
||||
&set_lpar_undefined($request, $name, $d);
|
||||
return ([$name, @$values[1], @$values[2]]);
|
||||
return ([[$name, @$values[1], @$values[2]]]);
|
||||
}
|
||||
}
|
||||
if (exists($lparhash->{nics})) {
|
||||
@@ -2128,7 +2184,7 @@ sub create_lpar {
|
||||
$values = xCAT::FSPUtils::fsp_api_action($request,$name, $d, "part_set_veth_slot_config",0,"0,$vlanid,$mac");
|
||||
if (@$values[2] ne 0) {
|
||||
&set_lpar_undefined($request, $name, $d);
|
||||
return ([$name, @$values[1], @$values[2]]);
|
||||
return ([[$name, @$values[1], @$values[2]]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2138,7 +2194,7 @@ sub create_lpar {
|
||||
$values = xCAT::FSPUtils::fsp_api_action($request,$name, $d, "part_set_vscsi_slot_config",0,$v_info);
|
||||
if (@$values[2] ne 0) {
|
||||
&set_lpar_undefined($request, $name, $d);
|
||||
return ([$name, @$values[1], @$values[2]]);
|
||||
return ([[$name, @$values[1], @$values[2]]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2169,19 +2225,23 @@ sub create_lpar {
|
||||
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_pending_proc", 0, $lparhash->{cpus});
|
||||
if (@$values[2] ne 0) {
|
||||
&set_lpar_undefined($request, $name, $d);
|
||||
return ([$name, @$values[1], @$values[2]]);
|
||||
return ([[$name, @$values[1], @$values[2]]]);
|
||||
}
|
||||
$values = &deal_with_avail_mem($request, $name, $d,$lparhash);
|
||||
if (ref($values) eq "ARRAY") {
|
||||
&set_lpar_undefined($request, $name, $d);
|
||||
return ([@$values]);
|
||||
if (@$values[2]) {
|
||||
&set_lpar_undefined($request, $name, $d);
|
||||
return ([[@$values]]);
|
||||
} else {
|
||||
push @ret, $values;
|
||||
}
|
||||
}
|
||||
|
||||
#print "======>memory:$lparhash->{memory}.\n";
|
||||
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_pending_mem", 0, $lparhash->{memory});
|
||||
if (@$values[2] ne 0) {
|
||||
&set_lpar_undefined($request, $name, $d);
|
||||
return ([$name, @$values[1], @$values[2]]);
|
||||
return ([[$name, @$values[1], @$values[2]]]);
|
||||
}
|
||||
|
||||
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_comp_modes");
|
||||
@@ -2196,9 +2256,11 @@ sub create_lpar {
|
||||
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_def_state", 0, 0x02);
|
||||
}
|
||||
if (@$values[2] ne 0) {
|
||||
return ([$name, @$values[1], @$values[2]]);
|
||||
return ([[$name, @$values[1], @$values[2]]]);
|
||||
}
|
||||
return ([$name, "Done", 0]);
|
||||
push @ret, [$name, "Done", 0];
|
||||
#return ([$name, "Done", 0]);
|
||||
return \@ret;
|
||||
}
|
||||
|
||||
sub mkspeclpar {
|
||||
@@ -2213,7 +2275,7 @@ sub mkspeclpar {
|
||||
return([["Error","Cannot open vm table", 1]]);
|
||||
}
|
||||
while (my ($mtms, $h) = each (%$hash)) {
|
||||
my $memhash;
|
||||
my $memhash = undef;
|
||||
my @nodes = keys(%$h);
|
||||
my $ent = $vmtab->getNodesAttribs(\@nodes, ['cpus', 'memory','physlots', 'othersettings', 'storage', 'nics']);
|
||||
while (my ($name, $d) = each (%$h)) {
|
||||
@@ -2221,12 +2283,18 @@ sub mkspeclpar {
|
||||
push @result, [$name, "Node must be LPAR", 1];
|
||||
last;
|
||||
}
|
||||
if (!exists($memhash->{run})) {
|
||||
#if (!exists($memhash->{run}))
|
||||
#{
|
||||
my @td = @$d;
|
||||
@td[0] = 0;
|
||||
$memhash = &query_cec_info_actions($request, $name, \@td, 1, ["part_get_hyp_process_and_mem","lpar_lhea_mac","part_get_all_io_bus_info"]);
|
||||
$memhash->{run} = 1;
|
||||
}
|
||||
unless (scalar keys(%$memhash)) {
|
||||
push @result, [$mtms, "Can not get hypervisor information", 1];
|
||||
last;
|
||||
}
|
||||
#$memhash->{run} = 1;
|
||||
#}
|
||||
|
||||
my $tmp_ent = $ent->{$name}->[0];
|
||||
if (exists($opt->{vmcpus})) {
|
||||
$tmp_ent->{cpus} = $opt->{vmcpus};
|
||||
@@ -2261,11 +2329,23 @@ sub mkspeclpar {
|
||||
if ($tmp_ent->{cpus} =~ /^(\d+)\/(\d+)\/(\d+)$/) {
|
||||
unless ($1 <= $2 and $2 <= $3) {
|
||||
return([[$name, "Parameter for 'vmcpus' is invalid", 1]]);
|
||||
} elsif ($memhash->{process_units_avail} eq '0') {
|
||||
push @result, [$name, "No process available", 1];
|
||||
next;
|
||||
} elsif ($2 > $memhash->{process_units_avail}) {
|
||||
my $cur = $memhash->{process_units_avail};
|
||||
my $min = $1 > $cur ? $cur : $1;
|
||||
$tmp_ent->{cpus} = "$min/$cur/$3";
|
||||
push @result, [$name, "Available processor is less than required, allocate $cur processors.", 0];
|
||||
}
|
||||
} else {
|
||||
return([[$name, "Parameter for 'vmcpus' is invalid", 1]]);
|
||||
}
|
||||
if ($tmp_ent->{memory} =~ /^([\d|.]+)([G|M]?)\/([\d|.]+)([G|M]?)\/([\d|.]+)([G|M]?)$/i) {
|
||||
if ($memhash->{hyp_avail_mem} eq '0') {
|
||||
push @result, [$name, "No memory available", 1];
|
||||
next;
|
||||
}
|
||||
my ($mmin, $mcur, $mmax);
|
||||
if ($2 == "G" or $2 == '') {
|
||||
$mmin = $1 * 1024;
|
||||
@@ -2372,9 +2452,13 @@ sub mkspeclpar {
|
||||
$tmp_ent->{phy_hea} = $memhash->{phy_drc_group_port};
|
||||
$tmp_ent->{logic_drc_phydrc} = $memhash->{logic_drc_phydrc};
|
||||
$values = &create_lpar($request, $name, $d, $tmp_ent);
|
||||
push @result, $values;
|
||||
push @result, @$values;
|
||||
#need to add update db here
|
||||
my $rethash = query_cec_info_actions($request, $name, $d, 1, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_vio_info","part_get_all_io_bus_info","get_huge_page","get_cec_bsr"]);
|
||||
unless (scalar keys(%$rethash)) {
|
||||
push @result, [$mtms, "Can not get hypervisor information", 1];
|
||||
next;
|
||||
}
|
||||
$lpar_hash{$name} = $rethash;
|
||||
$lpar_hash{$name}->{parent} = @$d[3];
|
||||
|
||||
@@ -2404,8 +2488,9 @@ sub mkfulllpar {
|
||||
my @td = @$d;
|
||||
@td[0] = 0;
|
||||
$rethash = query_cec_info_actions($request, $name, \@td, 1);
|
||||
if (ref($rethash) ne 'HASH') {
|
||||
return ([[$mtms, "Cann't get hypervisor info hash", 1]]);
|
||||
unless (scalar keys(%$rethash)) {
|
||||
push @result, [$mtms, "Can not get hypervisor information", 1];
|
||||
next;
|
||||
}
|
||||
$rethash->{run} = 1;
|
||||
#print Dumper($rethash);
|
||||
@@ -2415,15 +2500,17 @@ sub mkfulllpar {
|
||||
$lpar_param{memory} = "1/".$rethash->{hyp_avail_mem}."/".$rethash->{hyp_config_mem};
|
||||
$lpar_param{hyp_config_mem} = $rethash->{hyp_config_mem};
|
||||
$lpar_param{hyp_avail_mem} = $rethash->{hyp_avail_mem};
|
||||
$lpar_param{mem_region_size} = $rethash->{mem_region_size};
|
||||
my @phy_io_array = keys(%{$rethash->{bus}});
|
||||
$lpar_param{physlots} = join(",", @phy_io_array);
|
||||
$lpar_param{huge_page} = "1/".$rethash->{huge_page_avail}."/".$rethash->{huge_page_avail};
|
||||
$lpar_param{bsr_num} = $rethash->{cec_bsr_avail};
|
||||
$lpar_param{phy_hea} = $rethash->{phy_drc_group_port};
|
||||
$lpar_param{logic_drc_phydrc} = $rethash->{logic_drc_phydrc};
|
||||
$lpar_param{full_par} = 1;
|
||||
$values = &create_lpar($request, $name, $d, \%lpar_param);
|
||||
$rethash->{logic_drc_phydrc} = $lpar_param{logic_drc_phydrc};
|
||||
push @result, $values;
|
||||
push @result, @$values;
|
||||
$name = undef;
|
||||
$d = undef;
|
||||
}
|
||||
|
||||
Regular → Executable
+17
-9
@@ -217,14 +217,23 @@ sub is_me
|
||||
#my ($b1, $b2, $b3, $b4) = split /\./, $nameIP;
|
||||
|
||||
# get all the possible IPs for the node I'm running on
|
||||
my $ifcmd = "ifconfig -a | grep 'inet'";
|
||||
my $result = xCAT::Utils->runcmd($ifcmd, -1, 1);
|
||||
# this is a common subroutine for both AIX and Linux,
|
||||
# AIX does not have ip command
|
||||
my $ipcmd;
|
||||
if ( -f "/sbin/ip" )
|
||||
{
|
||||
$ipcmd = "ip addr | grep 'inet'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$ipcmd = "ifconfig -a | grep 'inet'";
|
||||
}
|
||||
my $result = xCAT::Utils->runcmd($ipcmd, -1, 1);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp;
|
||||
# push @{$rsp->{data}}, "Could not run $ifcmd.\n";
|
||||
# xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
$::VERBOSE = $verb;
|
||||
my $str="Error running ipcmd";
|
||||
xCAT::MsgUtils->message("S", $str);
|
||||
$::VERBOSE = $verb;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -232,7 +241,6 @@ sub is_me
|
||||
{
|
||||
my ($inet, $myIP, $str) = split(" ", $int);
|
||||
chomp $myIP;
|
||||
$myIP =~ s/addr://;
|
||||
$myIP =~ s/\/.*//; # ipv6 address 4000::99/64
|
||||
$myIP =~ s/\%.*//; # ipv6 address ::1%1/128
|
||||
|
||||
@@ -1135,8 +1143,8 @@ sub dolitesetup
|
||||
|
||||
if (!$file) {
|
||||
next;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# ex. .../inst_root/foo/bar/ or .../inst_root/etc/lppcfg
|
||||
my $instrootfile = $instrootloc . $file;
|
||||
|
||||
|
||||
Regular → Executable
+72
-10
@@ -629,7 +629,8 @@ sub get_adap_prop {
|
||||
$cmd[0] = "\" supported-network-types\" " . $phandle . " get-package-property\r";
|
||||
$msg[0] = "Status: rc and all supported network types now on stack\n";
|
||||
#$pattern[0] = "(.*)3 >(.*)";
|
||||
$pattern[0] = "3 >";
|
||||
#$pattern[0] = "3 >";
|
||||
$pattern[0] = "ok";
|
||||
$newstate[0] = 1;
|
||||
|
||||
# state 1, return code and string on stack
|
||||
@@ -637,7 +638,8 @@ sub get_adap_prop {
|
||||
$cmd[1] = ".\r";
|
||||
$msg[1] = "Status: All supported network types now on stack\n";
|
||||
#$pattern[1] = "(.*)2 >(.*)";
|
||||
$pattern[1] = "2 >";
|
||||
#$pattern[1] = "2 >";
|
||||
$pattern[1] = "ok";
|
||||
$newstate[1] = 2;
|
||||
|
||||
# state 2, data ready to decode
|
||||
@@ -691,6 +693,16 @@ sub get_adap_prop {
|
||||
$timeout,
|
||||
[ qr/$pattern[$state]/i,
|
||||
sub {
|
||||
if ($state eq 1) {
|
||||
if ($rconsole->before() =~ /-\d+/) {
|
||||
nc_msg($verbose, "Status: Error getting adapter property for phandle=$phandle.\n");
|
||||
$state = 7;
|
||||
$rconsole->clear_accum();
|
||||
$rc = 1;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
nc_msg($verbose, $msg[$state]);
|
||||
$state = $newstate[$state];
|
||||
$rconsole->clear_accum();
|
||||
@@ -878,6 +890,15 @@ sub get_mac_addr {
|
||||
$timeout,
|
||||
[qr/$pattern[$state]/=>
|
||||
sub {
|
||||
if ($state eq 1) {
|
||||
if ($rconsole->before() =~ /-\d+/) {
|
||||
nc_msg($verbose, "Status: Error getting MAC address for phandle=$phandle.\n");
|
||||
$rconsole->clear_accum();
|
||||
$state = 4;
|
||||
$rc = 1;
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
nc_msg($verbose, $msg[$state]);
|
||||
$state = $newstate[$state];
|
||||
$rconsole->clear_accum();
|
||||
@@ -1019,7 +1040,8 @@ sub get_mac_addr {
|
||||
$cmd[0] = "\" ibm,loc-code\" $phandle get-package-property\r";
|
||||
$msg[0] = "Status: return code and loc-code now on stack\n";
|
||||
#$pattern[0] = "(.*)3 >(.*)";
|
||||
$pattern[0] = "3 >";
|
||||
#$pattern[0] = "3 >";
|
||||
$pattern[0] = "ok";
|
||||
$newstate[0] = 1;
|
||||
|
||||
# cmd(1) is a dot (.). This is a stack manipulation command that removes one
|
||||
@@ -1052,6 +1074,16 @@ sub get_mac_addr {
|
||||
$timeout,
|
||||
[qr/$pattern[$state]/=>
|
||||
sub {
|
||||
if ($state eq 1) {
|
||||
if ($rconsole->before() =~ /-\d+/) {
|
||||
nc_msg($verbose, "Status: Error getting adapter location for phandle=$phandle.");
|
||||
$rconsole->clear_accum();
|
||||
$state = 3;
|
||||
$rc = 1;
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
|
||||
nc_msg($verbose, $msg[$state]);
|
||||
$rconsole->clear_accum();
|
||||
$state = $newstate[$state];
|
||||
@@ -1125,10 +1157,19 @@ sub get_mac_addr {
|
||||
return undef if ($rc eq 1);
|
||||
}
|
||||
# Did we find one or more adapters?
|
||||
|
||||
if ($result[3] =~ /(\w*):(.*):(\w*\.\w*\.\w*):/) {
|
||||
$loc_code = $3;
|
||||
}else {
|
||||
my @loc_array = split /\n/,$result[3];
|
||||
my $found = 0;
|
||||
$loc_code = '';
|
||||
foreach my $line ( @loc_array ) {
|
||||
if ($line =~ /(\w*):(.*):([\w|\.|-]*):/) {
|
||||
$loc_code .= $3;
|
||||
$found = 1;
|
||||
}
|
||||
}
|
||||
if ($found) {
|
||||
$loc_code =~ s/\.$//;
|
||||
return $loc_code;
|
||||
} else {
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
@@ -1240,6 +1281,12 @@ sub ping_server{
|
||||
$msg[3] = "Status: ping return code now on stack\n";
|
||||
$newstate[3] = 4;
|
||||
|
||||
# get the timeout for ping test
|
||||
my $to4pt;
|
||||
if ( $ENV{TIMEOUT4PINGTEST} =~ /^\d+$/ ) {
|
||||
$to4pt = ",$ENV{TIMEOUT4PINGTEST}";
|
||||
}
|
||||
|
||||
#IPv6
|
||||
if ( $server_ip =~ /:/ ) {
|
||||
#::1, calculate link local address
|
||||
@@ -1249,9 +1296,9 @@ sub ping_server{
|
||||
} else {
|
||||
$linklocal_ip = $client_ip;
|
||||
}
|
||||
$cmd[3] = "ping $full_path_name:ipv6,$server_ip,$linklocal_ip,$gateway_ip\r";
|
||||
$cmd[3] = "ping $full_path_name:ipv6,$server_ip,$linklocal_ip,$gateway_ip$to4pt\r";
|
||||
} else {
|
||||
$cmd[3] = "ping $full_path_name:$server_ip,$client_ip,$gateway_ip\r";
|
||||
$cmd[3] = "ping $full_path_name:$server_ip,$client_ip,$gateway_ip$to4pt\r";
|
||||
}
|
||||
$pattern[3] = ".*ping(.*)ok(.*)0 >(.*)";
|
||||
|
||||
@@ -2628,7 +2675,7 @@ sub lparnetbootexp
|
||||
sub {
|
||||
$rc = 2;
|
||||
$rconsole->clear_accum();
|
||||
nc_msg($verbose, "Please make sure rcons $node works.\n");
|
||||
nc_msg(1, "Please make sure rcons $node works.\n");
|
||||
}
|
||||
],
|
||||
);
|
||||
@@ -3000,6 +3047,21 @@ sub lparnetbootexp
|
||||
$device_type = "physical";
|
||||
}
|
||||
|
||||
if (defined($mac_address)) {
|
||||
my @newmacs = ();
|
||||
my @allmacs = split /\|/,$mac_address;
|
||||
if ( !xCAT::Utils->isAIX() ) {
|
||||
foreach my $mac_a ( @allmacs ) {
|
||||
$mac_a = lc($mac_a);
|
||||
$mac_a =~ s/(\w{2})/$1:/g;
|
||||
$mac_a =~ s/:$//;
|
||||
push @newmacs, $mac_a;
|
||||
}
|
||||
$mac_address = join("|",@newmacs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($colon) {
|
||||
nc_msg($verbose, "$adap_type[$i]\:$loc_code\:$mac_address\:$full_path_name_array[$i]\:$ping_result\:$device_type\:\:\:\:\n");
|
||||
$outputarrayindex++;
|
||||
|
||||
+37
-23
@@ -138,8 +138,9 @@ This program module file, supports the xcat messaging and logging
|
||||
N - Node informational goes to STDOUT
|
||||
S - Message will be logged to syslog ( severe error)
|
||||
Note S can be combined with other flags for example
|
||||
SE logs message to syslog and is sent to STDERR.
|
||||
SA logs message to syslog and to the auditlog DB table
|
||||
SE logs message to syslog and is sent to STDERR.
|
||||
SA logs message to syslog and to the auditlog DB table. (only xcatd)
|
||||
A logs message auditlog DB table only. (only for xcatd)
|
||||
V - verbose. This flag is not valid, the calling routine
|
||||
should check for verbose mode before calling the message
|
||||
|
||||
@@ -175,7 +176,7 @@ This program module file, supports the xcat messaging and logging
|
||||
# Message to Syslog
|
||||
xCAT::MsgUtils->message('S', "Host $host not responding\n");
|
||||
|
||||
# Message to Syslog and auditlog table
|
||||
# Message to Syslog and auditlog table (only used by xcatd)
|
||||
# see tabdump -d auditlog
|
||||
my $rsp = {};
|
||||
$rsp->{syslogdata}->[0] = "$host not responding\n"; # for syslog
|
||||
@@ -189,6 +190,18 @@ This program module file, supports the xcat messaging and logging
|
||||
$rsp->{status} -> [0] = $status;
|
||||
xCAT::MsgUtils->message('SA', $rsp);
|
||||
|
||||
# Message to only auditlog table (only used by xcatd)
|
||||
# see tabdump -d auditlog
|
||||
my $rsp = {};
|
||||
$rsp->{userid} ->[0] = $user;
|
||||
$rsp->{clientname} -> [0] = $client;
|
||||
$rsp->{clienttype} -> [0] = $clienttype;
|
||||
$rsp->{command} -> [0] = $command;
|
||||
$rsp->{noderange} -> [0] = $noderange;
|
||||
$rsp->{args} -> [0] = $arguments;
|
||||
$rsp->{status} -> [0] = $status;
|
||||
xCAT::MsgUtils->message('A', $rsp);
|
||||
|
||||
# Message to Log and Syslog
|
||||
xCAT::MsgUtils->message('LS', "Host $host not responding\n");
|
||||
|
||||
@@ -197,44 +210,44 @@ This program module file, supports the xcat messaging and logging
|
||||
|
||||
Use with callback
|
||||
# Message to callback
|
||||
my $rsp = {};
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "Job did not run. \n";
|
||||
xCAT::MsgUtils->message("D", $rsp, $::CALLBACK);
|
||||
|
||||
my $rsp = {};
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] = "No hosts in node list\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
|
||||
|
||||
my $rsp = {};
|
||||
$rsp->{node}->[0]->{name}->[0] ="mynode";
|
||||
$rsp->{node}->[0]->{data}->[0] ="mydata";
|
||||
xCAT::MsgUtils->message("N", $rsp, $callback);
|
||||
my $rsp = {};
|
||||
$rsp->{node}->[0]->{name}->[0] ="mynode";
|
||||
$rsp->{node}->[0]->{data}->[0] ="mydata";
|
||||
xCAT::MsgUtils->message("N", $rsp, $callback);
|
||||
|
||||
my $rsp = {};
|
||||
my $rsp = {};
|
||||
$rsp->{info}->[0] = "No hosts in node list\n";
|
||||
xCAT::MsgUtils->message("I", $rsp, $::CALLBACK);
|
||||
|
||||
my $rsp = {};
|
||||
my $rsp = {};
|
||||
$rsp->{sinfo}->[0] = "No hosts in node list\n";
|
||||
xCAT::MsgUtils->message("IS", $rsp, $::CALLBACK);
|
||||
|
||||
|
||||
my $rsp = {};
|
||||
my $rsp = {};
|
||||
$rsp->{warning}->[0] = "No hosts in node list\n";
|
||||
xCAT::MsgUtils->message("W", $rsp, $::CALLBACK);
|
||||
|
||||
my $rsp = {};
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] = "Host not responding\n";
|
||||
xCAT::MsgUtils->message("S", $rsp, $::CALLBACK);
|
||||
|
||||
|
||||
# Message to Syslog and callback
|
||||
my $rsp = {};
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] = "Host not responding\n";
|
||||
xCAT::MsgUtils->message("SE", $rsp, $::CALLBACK);
|
||||
|
||||
# Message to Syslog and callback
|
||||
my $rsp = {};
|
||||
my $rsp = {};
|
||||
$rsp->{info}->[0] = "Host not responding\n";
|
||||
xCAT::MsgUtils->message("SI", $rsp, $::CALLBACK);
|
||||
|
||||
@@ -274,17 +287,19 @@ sub message
|
||||
my $call_back = shift; # optional
|
||||
my $exitcode = shift; # optional
|
||||
|
||||
# should be I,IS, D, E, S, SA ,LS, W , L,N
|
||||
# should be I,IS, D, E, S, SA,A ,LS, W , L,N
|
||||
# or S(I, D, E, S, W, L,N)
|
||||
#
|
||||
# if new SA option need to split syslog messages from auditlog entry
|
||||
# if SA option need to split syslog messages from auditlog entry
|
||||
#
|
||||
my $newrsp;
|
||||
if ($sev eq 'SA')
|
||||
{ # if SA then need to pull first entry from $rsp
|
||||
# for syslog, to preserve old interface
|
||||
if (($sev eq 'SA') || ($sev eq 'A'))
|
||||
{ # if SA ( syslog and auditlog) or A ( only auditlog)then need to pull first entry from $rsp
|
||||
# for syslog, to preserve old interface
|
||||
$newrsp = $rsp;
|
||||
if ($sev eq 'SA'){ # syslog and auditlog
|
||||
$rsp = $newrsp->{syslogdata}->[0];
|
||||
}
|
||||
}
|
||||
my $stdouterrf = \*STDOUT;
|
||||
my $stdouterrd = '';
|
||||
@@ -449,11 +464,10 @@ sub message
|
||||
}
|
||||
}
|
||||
|
||||
# is syslog requested
|
||||
# is syslog option requested
|
||||
|
||||
if ($sev =~ /S/)
|
||||
{
|
||||
|
||||
# If they want this msg to also go to syslog, do that now
|
||||
eval {
|
||||
openlog("xCAT", "nofatal,pid", "local4");
|
||||
@@ -474,7 +488,7 @@ sub message
|
||||
|
||||
# if write to auditlog table requested, if not on service node
|
||||
if (xCAT::Utils->isMN()){
|
||||
if ($sev eq 'SA')
|
||||
if (($sev eq 'SA') || ($sev eq 'A'))
|
||||
{
|
||||
require xCAT::Table;
|
||||
my $auditlogentry;
|
||||
|
||||
+219
-242
@@ -19,7 +19,7 @@ use File::Path;
|
||||
use Math::BigInt;
|
||||
use Socket;
|
||||
use xCAT::GlobalDef;
|
||||
use Data::Dumper;
|
||||
#use Data::Dumper;
|
||||
use strict;
|
||||
use warnings "all";
|
||||
my $socket6support = eval { require Socket6 };
|
||||
@@ -69,14 +69,14 @@ This program module file, is a set of network utilities used by xCAT commands.
|
||||
#-------------------------------------------------------------------------------
|
||||
sub getNodeDomains()
|
||||
{
|
||||
my $class = shift;
|
||||
my $class = shift;
|
||||
my $nodes = shift;
|
||||
|
||||
my @nodelist = @$nodes;
|
||||
my %nodedomains;
|
||||
|
||||
# Get the network info for each node
|
||||
my %nethash = xCAT::DBobjUtils->getNetwkInfo(\@nodelist);
|
||||
my %nethash = xCAT::DBobjUtils->getNetwkInfo(\@nodelist);
|
||||
|
||||
# get the site domain value
|
||||
my @domains = xCAT::TableUtils->get_site_attribute("domain");
|
||||
@@ -85,12 +85,13 @@ sub getNodeDomains()
|
||||
# for each node - set hash value to network domain or default
|
||||
# to site domain
|
||||
foreach my $node (@nodelist) {
|
||||
if ($nethash{$node}{domain}) {
|
||||
$nodedomains{$node} = $nethash{$node}{domain};
|
||||
} else {
|
||||
$nodedomains{$node} = $sitedomain;
|
||||
}
|
||||
}
|
||||
unless (defined($node)) {next;}
|
||||
if (defined($nethash{$node}) && $nethash{$node}{domain}) {
|
||||
$nodedomains{$node} = $nethash{$node}{domain};
|
||||
} else {
|
||||
$nodedomains{$node} = $sitedomain;
|
||||
}
|
||||
}
|
||||
|
||||
return \%nodedomains;
|
||||
}
|
||||
@@ -643,16 +644,11 @@ sub get_nic_ip
|
||||
{
|
||||
my $nic;
|
||||
my %iphash;
|
||||
my $cmd = "ifconfig -a";
|
||||
my $result = `$cmd`;
|
||||
my $mode = "MULTICAST";
|
||||
my $payingattention=0;
|
||||
my $interface;
|
||||
my $keepcurrentiface;
|
||||
|
||||
#############################################
|
||||
# Error running command
|
||||
#############################################
|
||||
if ( !$result ) {
|
||||
return undef;
|
||||
}
|
||||
|
||||
if (xCAT::Utils->isAIX()) {
|
||||
##############################################################
|
||||
@@ -664,6 +660,14 @@ sub get_nic_ip
|
||||
# en1: ...
|
||||
#
|
||||
##############################################################
|
||||
my $cmd = "ifconfig -a";
|
||||
my $result = `$cmd`;
|
||||
#############################################
|
||||
# Error running command
|
||||
#############################################
|
||||
if ( !$result ) {
|
||||
return undef;
|
||||
}
|
||||
my @adapter = split /(\w+\d+):\s+flags=/, $result;
|
||||
foreach ( @adapter ) {
|
||||
if ($_ =~ /^(en\d)/) {
|
||||
@@ -683,44 +687,39 @@ sub get_nic_ip
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
##############################################################
|
||||
# Should look like this for Linux:
|
||||
# eth0 Link encap:Ethernet HWaddr 00:02:55:7B:06:30
|
||||
# inet addr:9.114.154.193 Bcast:9.114.154.223
|
||||
# inet6 addr: fe80::202:55ff:fe7b:630/64 Scope:Link
|
||||
# UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
|
||||
# RX packets:1280982 errors:0 dropped:0 overruns:0 frame:0
|
||||
# TX packets:3535776 errors:0 dropped:0 overruns:0 carrier:0
|
||||
# collisions:0 txqueuelen:1000
|
||||
# RX bytes:343489371 (327.5 MiB) TX bytes:870969610 (830.6 MiB)
|
||||
# Base address:0x2600 Memory:fbfe0000-fc0000080
|
||||
#
|
||||
# eth1 ...
|
||||
# Redhat7
|
||||
#eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
|
||||
# inet 10.1.0.178 netmask 255.255.0.0 broadcast 10.1.255.255
|
||||
#
|
||||
##############################################################
|
||||
my @adapter= split /\n{2,}/, $result;
|
||||
foreach ( @adapter ) {
|
||||
if ( !($_ =~ /LOOPBACK/ ) and
|
||||
$_ =~ /UP( |,|>)/ and
|
||||
$_ =~ /$mode/ ) {
|
||||
my @ip = split /\n/;
|
||||
for my $ent ( @ip ) {
|
||||
if ($ent =~ /^(eth\d|ib\d|hf\d)\s+/) {
|
||||
$nic = $1;
|
||||
}
|
||||
if ($ent =~ /^(eth\d:|ib\d:|hf\d:)\s+/) {
|
||||
$nic = $1;
|
||||
}
|
||||
$ent=~ s/addr://; # works for Redhat7 also
|
||||
if ( $ent =~ /^\s*inet \s*(\d+\.\d+\.\d+\.\d+)/ ) {
|
||||
$iphash{$nic} = $1;
|
||||
next;
|
||||
}
|
||||
else { # linux
|
||||
my @ipoutput = `ip addr`;
|
||||
#############################################
|
||||
# Error running command
|
||||
#############################################
|
||||
if ( !@ipoutput ) {
|
||||
return undef;
|
||||
}
|
||||
foreach my $line (@ipoutput) {
|
||||
if ($line =~ /^\d/) { # new interface, new context..
|
||||
if ($interface and not $keepcurrentiface) {
|
||||
#don't bother reporting unusable nics
|
||||
delete $iphash{$interface};
|
||||
}
|
||||
$keepcurrentiface=0;
|
||||
if ( !($line =~ /LOOPBACK/ ) and
|
||||
$line =~ /UP( |,|>)/ and
|
||||
$line =~ /$mode/ ) {
|
||||
|
||||
$payingattention=1;
|
||||
$line =~ /^([^:]*): ([^:]*):/;
|
||||
$interface=$2;
|
||||
} else {
|
||||
$payingattention=0;
|
||||
next;
|
||||
}
|
||||
}
|
||||
unless ($payingattention) { next; }
|
||||
if ($line =~ /inet/) {
|
||||
$keepcurrentiface=1;
|
||||
}
|
||||
if ( $line =~ /^\s*inet \s*(\d+\.\d+\.\d+\.\d+)/ ) {
|
||||
$iphash{$interface} = $1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1603,58 +1602,124 @@ sub thishostisnot
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#sub gethost_ips1
|
||||
#{
|
||||
# my ($class) = @_;
|
||||
# my $cmd;
|
||||
# my @ipaddress;
|
||||
# $cmd = "ifconfig" . " -a";
|
||||
# $cmd = $cmd . "| grep \"inet\"";
|
||||
# my @result = xCAT::Utils->runcmd($cmd, 0);
|
||||
# if ($::RUNCMD_RC != 0)
|
||||
# {
|
||||
# xCAT::MsgUtils->message("S", "Error from $cmd\n");
|
||||
# exit $::RUNCMD_RC;
|
||||
# }
|
||||
# foreach my $addr (@result)
|
||||
# {
|
||||
# my @ip;
|
||||
# if (xCAT::Utils->isLinux())
|
||||
# {
|
||||
# if ($addr =~ /inet6/)
|
||||
# {
|
||||
# #TODO, Linux ipv6
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# my ($inet, $addr1, $Bcast, $Mask) = split(" ", $addr);
|
||||
# #@ip = split(":", $addr1);
|
||||
# #push @ipaddress, $ip[1];
|
||||
# $addr1 =~ s/.*://;
|
||||
# push @ipaddress, $addr1;
|
||||
# }
|
||||
# }
|
||||
# else
|
||||
# { #AIX
|
||||
# if ($addr =~ /inet6/)
|
||||
# {
|
||||
# $addr =~ /\s*inet6\s+([\da-fA-F:]+).*\/(\d+)/;
|
||||
# my $v6ip = $1;
|
||||
# my $v6mask = $2;
|
||||
# if ($v6ip)
|
||||
# {
|
||||
# push @ipaddress, $v6ip;
|
||||
# }
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# my ($inet, $addr1, $netmask, $mask1, $Bcast, $bcastaddr) =
|
||||
# split(" ", $addr);
|
||||
# push @ipaddress, $addr1;
|
||||
# }
|
||||
#
|
||||
# }
|
||||
# }
|
||||
# my @names = @ipaddress;
|
||||
# foreach my $ipaddr (@names)
|
||||
# {
|
||||
# my $hostname = xCAT::NetworkUtils->gethostname($ipaddr);
|
||||
# if ($hostname)
|
||||
# {
|
||||
# my @shorthost = split(/\./, $hostname);
|
||||
# push @ipaddress, $shorthost[0];
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# return @ipaddress;
|
||||
#}
|
||||
|
||||
|
||||
sub gethost_ips
|
||||
{
|
||||
my ($class) = @_;
|
||||
my $cmd;
|
||||
my @ipaddress;
|
||||
$cmd = "ifconfig" . " -a";
|
||||
$cmd = $cmd . "| grep \"inet\"";
|
||||
my @result = xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
if (xCAT::Utils->isLinux())
|
||||
{
|
||||
xCAT::MsgUtils->message("S", "Error from $cmd\n");
|
||||
exit $::RUNCMD_RC;
|
||||
$cmd="ip -4 --oneline addr show |awk -F ' ' '{print \$4}'|awk -F '/' '{print \$1}'";
|
||||
my @result =xCAT::Utils->runcmd($cmd);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
xCAT::MsgUtils->message("S", "Error from $cmd\n");
|
||||
exit $::RUNCMD_RC;
|
||||
}
|
||||
|
||||
push @ipaddress, @result;
|
||||
}
|
||||
foreach my $addr (@result)
|
||||
{
|
||||
my @ip;
|
||||
if (xCAT::Utils->isLinux())
|
||||
{
|
||||
if ($addr =~ /inet6/)
|
||||
{
|
||||
#TODO, Linux ipv6
|
||||
}
|
||||
else
|
||||
{
|
||||
my ($inet, $addr1, $Bcast, $Mask) = split(" ", $addr);
|
||||
#@ip = split(":", $addr1);
|
||||
#push @ipaddress, $ip[1];
|
||||
$addr1 =~ s/.*://;
|
||||
push @ipaddress, $addr1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ #AIX
|
||||
if ($addr =~ /inet6/)
|
||||
{
|
||||
$addr =~ /\s*inet6\s+([\da-fA-F:]+).*\/(\d+)/;
|
||||
my $v6ip = $1;
|
||||
my $v6mask = $2;
|
||||
if ($v6ip)
|
||||
{
|
||||
push @ipaddress, $v6ip;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
my ($inet, $addr1, $netmask, $mask1, $Bcast, $bcastaddr) =
|
||||
split(" ", $addr);
|
||||
push @ipaddress, $addr1;
|
||||
}
|
||||
else
|
||||
{ #AIX
|
||||
|
||||
$cmd = "ifconfig" . " -a";
|
||||
$cmd = $cmd . "| grep \"inet\"";
|
||||
my @result = xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
xCAT::MsgUtils->message("S", "Error from $cmd\n");
|
||||
exit $::RUNCMD_RC;
|
||||
}
|
||||
|
||||
foreach my $addr (@result)
|
||||
{
|
||||
if ($addr =~ /inet6/)
|
||||
{
|
||||
$addr =~ /\s*inet6\s+([\da-fA-F:]+).*\/(\d+)/;
|
||||
my $v6ip = $1;
|
||||
my $v6mask = $2;
|
||||
if ($v6ip)
|
||||
{
|
||||
push @ipaddress, $v6ip;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
my ($inet, $addr1, $netmask, $mask1, $Bcast, $bcastaddr) =
|
||||
split(" ", $addr);
|
||||
push @ipaddress, $addr1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my @names = @ipaddress;
|
||||
foreach my $ipaddr (@names)
|
||||
{
|
||||
@@ -1665,9 +1730,9 @@ sub gethost_ips
|
||||
push @ipaddress, $shorthost[0];
|
||||
}
|
||||
}
|
||||
|
||||
return @ipaddress;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 get_subnet_aix
|
||||
@@ -1843,102 +1908,6 @@ sub validate_ip
|
||||
}
|
||||
return([0]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 getFacingIP
|
||||
Gets the ip address of the adapter of the localhost that is facing the
|
||||
the given node.
|
||||
Assume it is the same as my_ip_facing...
|
||||
Arguments:
|
||||
The name of the node that is facing the localhost.
|
||||
Returns:
|
||||
The ip address of the adapter that faces the node.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub getFacingIP
|
||||
{
|
||||
my ($class, $node) = @_;
|
||||
my $ip;
|
||||
my $cmd;
|
||||
my @ipaddress;
|
||||
|
||||
my $nodeip = inet_ntoa(inet_aton($node));
|
||||
unless ($nodeip =~ /\d+\.\d+\.\d+\.\d+/)
|
||||
{
|
||||
return 0; #Not supporting IPv6 here IPV6TODO
|
||||
}
|
||||
|
||||
$cmd = "ifconfig" . " -a";
|
||||
$cmd = $cmd . "| grep \"inet \"";
|
||||
my @result = xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
xCAT::MsgUtils->message("S", "Error from $cmd\n");
|
||||
exit $::RUNCMD_RC;
|
||||
}
|
||||
|
||||
# split node address
|
||||
my ($n1, $n2, $n3, $n4) = split('\.', $nodeip);
|
||||
|
||||
foreach my $addr (@result)
|
||||
{
|
||||
my $ip;
|
||||
my $mask;
|
||||
if (xCAT::Utils->isLinux())
|
||||
{
|
||||
my ($inet, $addr1, $Bcast, $Mask) = split(" ", $addr);
|
||||
if ((!$addr1) || (!$Mask)) { next; }
|
||||
my @ips = split(":", $addr1);
|
||||
my @masks = split(":", $Mask);
|
||||
$ip = $ips[1];
|
||||
$mask = $masks[1];
|
||||
}
|
||||
else
|
||||
{ #AIX
|
||||
my ($inet, $addr1, $netmask, $mask1, $Bcast, $bcastaddr) =
|
||||
split(" ", $addr);
|
||||
if ((!$addr1) && (!$mask1)) { next; }
|
||||
$ip = $addr1;
|
||||
$mask1 =~ s/0x//;
|
||||
$mask =
|
||||
`printf "%d.%d.%d.%d" \$(echo "$mask1" | sed 's/../0x& /g')`;
|
||||
}
|
||||
|
||||
if ($ip && $mask)
|
||||
{
|
||||
|
||||
# split interface IP
|
||||
my ($h1, $h2, $h3, $h4) = split('\.', $ip);
|
||||
|
||||
# split mask
|
||||
my ($m1, $m2, $m3, $m4) = split('\.', $mask);
|
||||
|
||||
# AND this interface IP with the netmask of the network
|
||||
my $a1 = ((int $h1) & (int $m1));
|
||||
my $a2 = ((int $h2) & (int $m2));
|
||||
my $a3 = ((int $h3) & (int $m3));
|
||||
my $a4 = ((int $h4) & (int $m4));
|
||||
|
||||
# AND node IP with the netmask of the network
|
||||
my $b1 = ((int $n1) & (int $m1));
|
||||
my $b2 = ((int $n2) & (int $m2));
|
||||
my $b3 = ((int $n3) & (int $m3));
|
||||
my $b4 = ((int $n4) & (int $m4));
|
||||
|
||||
if (($b1 == $a1) && ($b2 == $a2) && ($b3 == $a3) && ($b4 == $a4))
|
||||
{
|
||||
return $ip;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xCAT::MsgUtils->message("S", "Cannot find master for the node $node\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 isIpaddr
|
||||
@@ -1992,50 +1961,6 @@ sub isIpaddr
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
=head3 getSubnetGateway
|
||||
Description:
|
||||
Get gateway from the networks table of the specified net.
|
||||
|
||||
Arguments:
|
||||
net: the net, ie. the "net" field of the networks table
|
||||
Returns:
|
||||
Return a string, of the gateway
|
||||
undef - Failed to get the gateway
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my $gateway = xCAT::NetworkUtils::getSubnetGateway('192.168.1.0');
|
||||
Comments:
|
||||
none
|
||||
|
||||
=cut
|
||||
#-------------------------------------------------------------------------------
|
||||
sub getSubnetGateway
|
||||
{
|
||||
my $netname=shift;
|
||||
if( $netname =~ /xCAT::NetworkUtils/)
|
||||
{
|
||||
$netname=shift;
|
||||
}
|
||||
|
||||
my $gateway=undef;
|
||||
my $nettab = xCAT::Table->new("networks");
|
||||
unless($nettab) { die "No entry defined in networks"; }
|
||||
my @nets = $nettab->getAllAttribs('net','gateway');
|
||||
foreach(@nets)
|
||||
{
|
||||
if("$_->{net}" eq "$netname")
|
||||
{
|
||||
$gateway = $_->{gateway};
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
return $gateway;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
@@ -2093,6 +2018,50 @@ sub getNodeNameservers{
|
||||
return \%nodenameservers;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
=head3 getNodeGateway
|
||||
Description:
|
||||
Get gateway from the networks table of the node.
|
||||
|
||||
Arguments:
|
||||
ip: the ip address of the node
|
||||
Returns:
|
||||
Return a string, of the gateway
|
||||
undef - Failed to get the gateway
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my $gateway = xCAT::NetworkUtils::getNodeGateway('192.168.1.0');
|
||||
Comments:
|
||||
none
|
||||
|
||||
=cut
|
||||
#-------------------------------------------------------------------------------
|
||||
sub getNodeGateway
|
||||
{
|
||||
my $ip=shift;
|
||||
if( $ip =~ /xCAT::NetworkUtils/)
|
||||
{
|
||||
$ip=shift;
|
||||
}
|
||||
my $gateway=undef;
|
||||
|
||||
my $nettab = xCAT::Table->new("networks");
|
||||
if ($nettab) {
|
||||
my @nets = $nettab->getAllAttribs('net','mask','gateway');
|
||||
foreach my $net (@nets) {
|
||||
if (xCAT::NetworkUtils::isInSameSubnet( $net->{'net'}, $ip, $net->{'mask'}, 0)) {
|
||||
$gateway=$net->{'gateway'};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $gateway;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 getNodeNetworkCfg
|
||||
@@ -2122,8 +2091,8 @@ sub getNodeNetworkCfg
|
||||
if( $node =~ /xCAT::NetworkUtils/)
|
||||
{
|
||||
$node =shift;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
my $nets = xCAT::NetworkUtils::my_nets();
|
||||
my $ip = xCAT::NetworkUtils->getipaddr($node);
|
||||
my $mask = undef;
|
||||
@@ -2132,12 +2101,14 @@ sub getNodeNetworkCfg
|
||||
{
|
||||
my $netname;
|
||||
($netname,$mask) = split /\//, $net;
|
||||
$gateway=xCAT::NetworkUtils::getSubnetGateway($netname);
|
||||
last if ( xCAT::NetworkUtils::isInSameSubnet( $netname, $ip, $mask, 1));
|
||||
}
|
||||
$gateway=xCAT::NetworkUtils::getNodeGateway($ip);
|
||||
return ($ip, $node, $gateway, xCAT::NetworkUtils::formatNetmask($mask,1,0));
|
||||
}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 get_hdwr_ip
|
||||
@@ -2211,7 +2182,13 @@ sub pingNodeStatus {
|
||||
foreach (@mon_nodes) {
|
||||
$deadnodes{$_}=1;
|
||||
}
|
||||
open (NMAP, "nmap -PE --system-dns --send-ip -sP ". $nodes . " 2> /dev/null|") or die("Cannot open nmap pipe: $!");
|
||||
|
||||
# get additional options from site table
|
||||
my @nmap_options = xCAT::TableUtils->get_site_attribute("nmapoptions");
|
||||
my $more_options = $nmap_options[0];
|
||||
|
||||
#call namp
|
||||
open (NMAP, "nmap -PE --system-dns --send-ip -sP $more_options ". $nodes . " 2> /dev/null|") or die("Cannot open nmap pipe: $!");
|
||||
my $node;
|
||||
while (<NMAP>) {
|
||||
if (/Host (.*) \(.*\) appears to be up/) {
|
||||
|
||||
@@ -311,9 +311,6 @@ sub notify {
|
||||
my ($modname, $path, $suffix) = fileparse($_, ".pm");
|
||||
# print "modname=$modname, path=$path, suffix=$suffix\n";
|
||||
if ($suffix =~ /.pm/) { #it is a perl module
|
||||
my $pid;
|
||||
if ($pid=xCAT::Utils->xfork()) { }
|
||||
elsif (defined($pid)) {
|
||||
my $fname;
|
||||
if (($path eq "") || ($path eq ".\/")) {
|
||||
#default path is /opt/xcat/lib/perl/xCAT_monitoring/ if there is no path specified
|
||||
@@ -328,8 +325,7 @@ sub notify {
|
||||
else {
|
||||
${"xCAT_monitoring::".$modname."::"}{processTableChanges}->($action, $tablename, $old_data, $new_data);
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else { #it is a command
|
||||
my $pid;
|
||||
|
||||
@@ -21,7 +21,6 @@ sub parse_args {
|
||||
my %opt = ();
|
||||
my $cmd = $request->{command};
|
||||
my $args = $request->{arg};
|
||||
my @VERSION = qw( 2.1 );
|
||||
|
||||
#############################################
|
||||
# Responds with usage statement
|
||||
@@ -60,7 +59,8 @@ sub parse_args {
|
||||
# Option -v for version
|
||||
####################################
|
||||
if ( exists( $opt{v} )) {
|
||||
return( \@VERSION );
|
||||
my $version = xCAT::Utils->Version();
|
||||
return ([$version]);
|
||||
}
|
||||
|
||||
if ( exists( $opt{s} ) ){
|
||||
@@ -350,6 +350,27 @@ sub do_rnetboot {
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
# Set the boot mode to norm from 'of' (open firmware)
|
||||
# NOW, only necessary for IVM
|
||||
my $hwtype = @$exp[2];
|
||||
if ($hwtype eq "ivm") {
|
||||
my $server = @$exp[3];
|
||||
|
||||
# creat connection first
|
||||
my @newexp = xCAT::PPCcli::connect( $request, $hwtype, $server );
|
||||
if (ref($newexp[0]) eq "Expect" ) {
|
||||
my $cfg = "lpar_id=@$d[0],boot_mode=norm";
|
||||
# change the boot mode to 'norm'
|
||||
xCAT::PPCcli::chsyscfg(\@newexp, "prof", $d, $cfg);
|
||||
xCAT::PPCcli::disconnect(\@newexp);
|
||||
} else {
|
||||
my $rsp;
|
||||
$rsp->{data} = ["Failed to set the boot mode to normal. For rnetboot command, you have to rpower off and then on the node after finishing the OS deployment."];
|
||||
xCAT::MsgUtils->message("E", $rsp, $request->{callback});
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@@ -436,9 +436,9 @@ sub sshcfg {
|
||||
#####################################
|
||||
# userid@host not found in key file
|
||||
#####################################
|
||||
if ( $sshkey !~ /\s+(\S+\@\S+$)/ ) {
|
||||
return( [[$server,"Cannot find userid\@host in '$fname'",RC_ERROR]] );
|
||||
}
|
||||
#if ( $sshkey !~ /\s+(\S+\@\S+$)/ ) {
|
||||
# return( [[$server,"Cannot find userid\@host in '$fname'",RC_ERROR]] );
|
||||
#}
|
||||
my $logon = $1;
|
||||
|
||||
#####################################
|
||||
|
||||
@@ -75,6 +75,7 @@ sub add_ppc {
|
||||
my $values = shift;
|
||||
my $not_overwrite = shift;
|
||||
my $otherinterfaces = shift;
|
||||
my $callfile = shift;
|
||||
my @tabs = qw(ppc vpd nodehm nodelist nodetype hosts mac);
|
||||
my %db = ();
|
||||
###################################
|
||||
@@ -119,7 +120,12 @@ sub add_ppc {
|
||||
|
||||
# Specify CEC and Frame's mgt as fsp and bpa
|
||||
if ( $type =~ /^cec$/) {
|
||||
$mgt = "fsp";
|
||||
if ( $callfile eq "PPC" ) {
|
||||
$mgt = "hmc";
|
||||
}
|
||||
if ( $callfile eq "FSP" ) {
|
||||
$mgt = "fsp";
|
||||
}
|
||||
}
|
||||
if ( $type =~ /^frame$/) {
|
||||
$mgt = "bpa";
|
||||
@@ -320,7 +326,7 @@ sub update_lpar {
|
||||
}
|
||||
}
|
||||
if (defined($write)) {
|
||||
&add_ppc($hwtype, \@write_list);
|
||||
&add_ppc($hwtype, \@write_list,'','',"FSP");
|
||||
return ([@update_list,@write_list]);
|
||||
} else {
|
||||
foreach ( @tabs ) {
|
||||
|
||||
+21
-22
@@ -14,7 +14,7 @@ use xCAT::Usage;
|
||||
use xCAT::NodeRange;
|
||||
use xCAT::DBobjUtils;
|
||||
use xCAT::FSPUtils;
|
||||
use xCAT::TableUtils qw(get_site_Master);
|
||||
use xCAT::TableUtils;
|
||||
%::QUERY_ATTRS = (
|
||||
'savingstatus' => 1,
|
||||
'dsavingstatus' => 1,
|
||||
@@ -223,7 +223,6 @@ sub renergy {
|
||||
my ($node, $attrs) = %$nodehash;
|
||||
my $cec_name = @$attrs[2];
|
||||
my $hw_type = @$attrs[4];
|
||||
|
||||
|
||||
if (!$cec_name) {
|
||||
return ([[$node, "ERROR: Cannot find the cec name, check the attributes: vpd.serial, vpd.mtm.", 1]]);
|
||||
@@ -295,43 +294,43 @@ sub renergy {
|
||||
foreach (@hcps_ip) {
|
||||
$deadnodes{$_}=1;
|
||||
}
|
||||
open (NMAP, "nmap -PE --system-dns --send-ip -sP ". join(' ',@hcps_ip) . " 2> /dev/null|") or die("Cannot open nmap pipe: $!");
|
||||
my $node1;
|
||||
my $msg1;
|
||||
|
||||
# get additional options from site table
|
||||
my @nmap_options = xCAT::TableUtils->get_site_attribute("nmapoptions");
|
||||
my $more_options = $nmap_options[0];
|
||||
|
||||
open (NMAP, "nmap -PE --system-dns --send-ip -sP $more_options ". join(' ',@hcps_ip) . " 2> /dev/null|") or die("Cannot open nmap pipe: $!");
|
||||
my $node;
|
||||
while (<NMAP>) {
|
||||
#print "$_\n";
|
||||
if (/Host (.*) \((.*)\) appears to be up/) {
|
||||
$node1=$2;
|
||||
unless ($deadnodes{$node1}) {
|
||||
$node=$2;
|
||||
unless ($deadnodes{$node}) {
|
||||
foreach (keys %deadnodes) {
|
||||
if ($node1 =~ /^$_\./) {
|
||||
$node1 = $_;
|
||||
if ($node =~ /^$_\./) {
|
||||
$node = $_;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
delete $deadnodes{$node1};
|
||||
delete $deadnodes{$node};
|
||||
if ($verbose) {
|
||||
push @return_msg, [$node, $_, 0];
|
||||
}
|
||||
push(@pingable_hcp, $node1);
|
||||
} elsif (/Nmap scan report for ([^ ]*) \((.*)\)/) {
|
||||
$node1=$2;
|
||||
$msg1=$_;
|
||||
push(@pingable_hcp, $node);
|
||||
} elsif (/Nmap scan report for ([^ ]*)/) {
|
||||
$node=$1;
|
||||
} elsif (/Host is up./) {
|
||||
unless ($deadnodes{$node1}) {
|
||||
unless ($deadnodes{$node}) {
|
||||
foreach (keys %deadnodes) {
|
||||
if ($node1 =~ /^$_\./) {
|
||||
$node1 = $_;
|
||||
if ($node =~ /^$_\./) {
|
||||
$node = $_;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
delete $deadnodes{$node1};
|
||||
if ($verbose) {
|
||||
push @return_msg, [$node, "$msg1$_", 0];
|
||||
}
|
||||
push(@pingable_hcp, $node1);
|
||||
delete $deadnodes{$node};
|
||||
push(@pingable_hcp, $node);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -144,12 +144,16 @@ sub connect {
|
||||
##################################
|
||||
# Set options
|
||||
##################################
|
||||
my $hosttab = xCAT::Table->new( 'hosts' );
|
||||
if ( $hosttab) {
|
||||
my $hostshash = $hosttab->getNodeAttribs( $server, [qw(ip otherinterfaces)]);
|
||||
if ( $hostshash ) {
|
||||
$server = $hostshash->{ip};
|
||||
}
|
||||
#my $hosttab = xCAT::Table->new( 'hosts' );
|
||||
#if ( $hosttab) {
|
||||
# my $hostshash = $hosttab->getNodeAttribs( $server, [qw(ip otherinterfaces)]);
|
||||
# if ( $hostshash ) {
|
||||
# $server = $hostshash->{ip};
|
||||
# }
|
||||
#}
|
||||
$server = xCAT::NetworkUtils::getNodeIPaddress( $server );
|
||||
unless ($server) {
|
||||
return( "Unable to get IP address for $server" );
|
||||
}
|
||||
# my $serverip = inet_ntoa(inet_aton($server));
|
||||
my $url = "https://$server/cgi-bin/cgi?form=2";
|
||||
|
||||
@@ -347,7 +347,7 @@ sub bus {
|
||||
#################################
|
||||
# Output header
|
||||
#################################
|
||||
push @result, [$name,"I/O Bus Information"];
|
||||
push @result, [$name,"I/O Bus Information", 0];
|
||||
|
||||
#################################
|
||||
# Output error
|
||||
@@ -532,7 +532,7 @@ sub config {
|
||||
#################################
|
||||
# Output header
|
||||
#################################
|
||||
push @result, [$name,"Machine Configuration Info"];
|
||||
push @result, [$name,"Machine Configuration Info", 0];
|
||||
my $i;
|
||||
|
||||
foreach ( @prefix ) {
|
||||
|
||||
+37
-10
@@ -555,6 +555,9 @@ sub getmacs {
|
||||
} else {
|
||||
$type = "virtualio";
|
||||
}
|
||||
if ($mac_addr) {
|
||||
$mac_addr = format_mac($mac_addr);
|
||||
}
|
||||
|
||||
my %att = ();
|
||||
$att{'MAC_Address'} = ($mac_addr) ? $mac_addr : "N/A";
|
||||
@@ -627,9 +630,9 @@ sub getmacs {
|
||||
}
|
||||
foreach ( @$value ) {
|
||||
if ( /^#\s?Type/ ) {
|
||||
$data.= "\n$_\n";
|
||||
$data.= "\n$_\n";
|
||||
} else {
|
||||
$data.= format_mac( $_ );
|
||||
$data.= "$_\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -756,7 +759,7 @@ sub getmacs {
|
||||
if ( /^#\s?Type/ ) {
|
||||
$data.= "\n$_\n";
|
||||
} elsif ( /^ent\s+/ or /^hfi-ent\s+/ ) {
|
||||
$data.= format_mac( $_ );
|
||||
$data.= "$_\n";
|
||||
}
|
||||
}
|
||||
#####################################
|
||||
@@ -801,10 +804,8 @@ sub cal_mac {
|
||||
##########################################################################
|
||||
sub format_mac {
|
||||
|
||||
my $data = shift;
|
||||
my $mac = shift;
|
||||
|
||||
$data =~ /^(\S+\s+\S+\s+)(\S+)(\s+.*)$/;
|
||||
my $mac = $2;
|
||||
#####################################
|
||||
# Get adapter mac
|
||||
#####################################
|
||||
@@ -813,6 +814,10 @@ sub format_mac {
|
||||
|
||||
if ( !xCAT::Utils->isAIX() ) {
|
||||
foreach my $mac_a ( @macs ) {
|
||||
if (&checkmac($mac_a)) {
|
||||
push @newmacs, $mac_a;
|
||||
next;
|
||||
}
|
||||
#################################
|
||||
# Delineate MAC with colons
|
||||
#################################
|
||||
@@ -821,14 +826,30 @@ sub format_mac {
|
||||
$mac_a =~ s/:$//;
|
||||
push @newmacs, $mac_a;
|
||||
}
|
||||
my $newmac = join("|",@newmacs);
|
||||
$data =~ s/$mac/$newmac/;
|
||||
$mac = join("|",@newmacs);
|
||||
}
|
||||
|
||||
return( "$data\n" );
|
||||
return( "$mac\n" );
|
||||
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
# checkmac format
|
||||
##########################################################################
|
||||
|
||||
sub checkmac {
|
||||
my $mac = shift;
|
||||
if ( !xCAT::Utils->isAIX()) {
|
||||
if ($mac =~ /\w{2}:\w{2}:\w{2}:\w{2}:\w{2}:\w{2}/) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
##########################################################################
|
||||
# Write first valid adapter MAC to database
|
||||
@@ -847,6 +868,9 @@ sub writemac {
|
||||
# Find first valid adapter
|
||||
#####################################
|
||||
foreach ( @$data ) {
|
||||
unless (&checkmac($_)) {
|
||||
next;
|
||||
}
|
||||
if ( /^ent\s+/ or /^hfi-ent\s+/ ) {
|
||||
$value = $_;
|
||||
#####################################
|
||||
@@ -869,6 +893,9 @@ sub writemac {
|
||||
#####################################
|
||||
if ( $pingret ne "successful" ) {
|
||||
foreach ( @$data ) {
|
||||
unless (&checkmac($_)) {
|
||||
next;
|
||||
}
|
||||
if ( /^ent\s+/ or /^hfi-ent\s+/ ) {
|
||||
$value = $_;
|
||||
$ping_test = 0;
|
||||
@@ -890,7 +917,7 @@ sub writemac {
|
||||
#####################################
|
||||
# Get adapter mac
|
||||
#####################################
|
||||
$value = format_mac( $value );
|
||||
#$value = format_mac( $value );
|
||||
@fields = split /\s+/, $value;
|
||||
$mac = $fields[2];
|
||||
|
||||
|
||||
@@ -411,7 +411,7 @@ sub format_output {
|
||||
# Strip errors for results
|
||||
#######################################
|
||||
my @val = grep( !/^#.*: ERROR /, @$values );
|
||||
xCAT::PPCdb::add_ppc( $hwtype, \@val );
|
||||
xCAT::PPCdb::add_ppc( $hwtype, \@val ,'','',"PPC");
|
||||
}
|
||||
|
||||
###########################################
|
||||
|
||||
@@ -203,7 +203,7 @@ sub voltage {
|
||||
# Voltages available in frame
|
||||
#################################
|
||||
if ( @$d[4] ne "bpa" ) {
|
||||
push @result, [$name,"$text Only available for BPA",1];
|
||||
push @result, [$name,"$text Only available for BPA",0];
|
||||
next;
|
||||
}
|
||||
my $volt = enumerate_volt( $exp, $d );
|
||||
@@ -256,7 +256,7 @@ sub temp {
|
||||
# No frame commands for IVM
|
||||
#################################
|
||||
if ( $hwtype eq "ivm" ) {
|
||||
push @result, [$name,"$prefix Not available (No BPA)",1];
|
||||
push @result, [$name,"$prefix Not available (No BPA)",0];
|
||||
next;
|
||||
}
|
||||
#################################
|
||||
@@ -264,14 +264,14 @@ sub temp {
|
||||
#################################
|
||||
if ( @$d[4] !~ /^(fsp|cec|lpar)$/ ) {
|
||||
my $text = "$prefix Only available for CEC/LPAR";
|
||||
push @result, [$name,$text,1];
|
||||
push @result, [$name,$text,0];
|
||||
next;
|
||||
}
|
||||
#################################
|
||||
# Error - No frame
|
||||
#################################
|
||||
if ( $mtms eq "0" ) {
|
||||
push @result, [$name,"$prefix Not available (No BPA)",1];
|
||||
push @result, [$name,"$prefix Not available (No BPA)",0];
|
||||
next;
|
||||
}
|
||||
#################################
|
||||
|
||||
@@ -1913,7 +1913,7 @@ sub xCATdB {
|
||||
$profile,
|
||||
$parent );
|
||||
|
||||
return( xCAT::PPCdb::add_ppc( $hwtype, [$values] ));
|
||||
return( xCAT::PPCdb::add_ppc( $hwtype, [$values],'','',"PPC" ));
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
@@ -653,6 +653,39 @@ sub get_all_cecs
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 get_all_lparids
|
||||
Description : Get all LPAR ids in system.
|
||||
Arguments : ref of all cecs
|
||||
Returns : ref for LPAR ids hash.
|
||||
Example :
|
||||
my $arrayref = xCAT::ProfiledNodeUtils->get_all_lparids(\%allcecs);
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub get_all_lparids
|
||||
{
|
||||
my $class= shift;
|
||||
my $cecsref = shift;
|
||||
my %allcecs = %$cecsref;
|
||||
my %lparids;
|
||||
|
||||
my $ppctab = xCAT::Table->new('ppc');
|
||||
foreach my $cec (keys %allcecs) {
|
||||
my @ids = $ppctab->getAllAttribsWhere("hcp = '$cec'", 'id');
|
||||
foreach (@ids) {
|
||||
if ( $_->{'id'} ){
|
||||
$lparids{$cec}{$_->{'id'}} = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
$ppctab->close();
|
||||
|
||||
return \%lparids;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 is_discover_started
|
||||
@@ -690,6 +723,7 @@ sub get_nodes_profiles
|
||||
{
|
||||
my $class = shift;
|
||||
my $nodelistref = shift;
|
||||
my $groupnamemode = shift;
|
||||
my %profile_dict;
|
||||
|
||||
my $nodelisttab = xCAT::Table->new('nodelist');
|
||||
@@ -709,8 +743,12 @@ sub get_nodes_profiles
|
||||
if ( $idx == 2 ){
|
||||
# The group string will like @NetworkProfile_<profile name>
|
||||
# So, index should +3, 2 for '__', 1 for _.
|
||||
my $append_index = length($profile) + 3;
|
||||
$profile_dict{$_}{$profile} = substr $group, $append_index;
|
||||
if ($groupnamemode) {
|
||||
$profile_dict{$_}{$profile} = $group;
|
||||
} else{
|
||||
my $append_index = length($profile) + 3;
|
||||
$profile_dict{$_}{$profile} = substr $group, $append_index;
|
||||
}
|
||||
last;
|
||||
}
|
||||
}
|
||||
@@ -719,28 +757,6 @@ sub get_nodes_profiles
|
||||
return \%profile_dict;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 get_imageprofile_prov_osvers
|
||||
Description : Get A node's provisioning os version and profile from its imageprofile attribute.
|
||||
Arguments : $imgprofilename - imageprofile name
|
||||
Returns : node's osversion and profile
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub get_imageprofile_prov_osvers
|
||||
{
|
||||
|
||||
my $class = shift;
|
||||
my $imgprofilename = shift;
|
||||
my $osimgtab = xCAT::Table->new('osimage');
|
||||
my $osimgentry = ($osimgtab->getAllAttribsWhere("imagename = '$imgprofilename'", 'ALL' ))[0];
|
||||
my $osversion = $osimgentry->{'osvers'};
|
||||
my $profile = $osimgentry->{'profile'};
|
||||
return ($osversion, $profile);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 get_imageprofile_prov_method
|
||||
@@ -761,7 +777,7 @@ sub get_imageprofile_prov_method
|
||||
|
||||
my $nodetypestab = xCAT::Table->new('nodetype');
|
||||
my $entry = ($nodetypestab->getAllAttribsWhere("node = '$imgprofilename'", 'ALL' ))[0];
|
||||
my $osimgname = $entry->{'provmethod'};
|
||||
return $entry->{'provmethod'};
|
||||
|
||||
#my $osimgtab = xCAT::Table->new('osimage');
|
||||
#my $osimgentry = ($osimgtab->getAllAttribsWhere("imagename = '$osimgname'", 'ALL' ))[0];
|
||||
@@ -770,6 +786,27 @@ sub get_imageprofile_prov_method
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 get_imageprofile_prov_osvers
|
||||
Description : Get A node's provisioning os version and profile from its imageprofile attribute.
|
||||
Arguments : $imgprofilename - imageprofile name
|
||||
Returns : node's osversion and profile
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub get_imageprofile_prov_osvers
|
||||
{
|
||||
|
||||
my $class = shift;
|
||||
my $imgprofilename = shift;
|
||||
my $osimgtab = xCAT::Table->new('osimage');
|
||||
my $osimgentry = ($osimgtab->getAllAttribsWhere("imagename = '$imgprofilename'", 'ALL' ))[0];
|
||||
my $osversion = $osimgentry->{'osvers'};
|
||||
my $profile = $osimgentry->{'profile'};
|
||||
return ($osversion, $profile);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 check_profile_consistent
|
||||
Description : Check if three profile consistent
|
||||
Arguments : $imageprofile - image profile name
|
||||
@@ -801,13 +838,10 @@ sub check_profile_consistent{
|
||||
}
|
||||
}
|
||||
|
||||
# Profile consistent keys, arch=>netboot, mgt=>nictype
|
||||
my %profile_dict = ('x86' => 'xnba','x86_64' => 'xnba', 'ppc64' => 'yaboot',
|
||||
'fsp' => 'FSP', 'ipmi' => 'BMC');
|
||||
|
||||
# Get Imageprofile arch
|
||||
my $nodetypetab = xCAT::Table->new('nodetype');
|
||||
my $nodetypeentry = $nodetypetab->getNodeAttribs($imageprofile, ['arch']);
|
||||
my $nodetypeentry = $nodetypetab->getNodeAttribs($imageprofile, ['os','arch']);
|
||||
my $os = $nodetypeentry->{'os'};
|
||||
my $arch = $nodetypeentry->{'arch'};
|
||||
$nodetypetab->close();
|
||||
|
||||
@@ -848,6 +882,14 @@ sub check_profile_consistent{
|
||||
return 0, "Provisioning network not defined for network profile."
|
||||
}
|
||||
|
||||
# Profile consistent keys, arch=>netboot, mgt=>nictype
|
||||
my $ppc_netboot = 'yaboot';
|
||||
if( $os =~ /rhels7/ ){
|
||||
$ppc_netboot = 'grub2';
|
||||
}
|
||||
my %profile_dict = ('x86' => 'xnba','x86_64' => 'xnba', 'ppc64' => $ppc_netboot,
|
||||
'ppc64el' => $ppc_netboot,
|
||||
'fsp' => 'FSP', 'ipmi' => 'BMC');
|
||||
# Check if imageprofile is consistent with networkprofile
|
||||
if ($profile_dict{$arch} ne $netboot) {
|
||||
return 0, "Imageprofile's arch is not consistent with networkprofile's netboot."
|
||||
@@ -861,6 +903,11 @@ sub check_profile_consistent{
|
||||
return 0, "$nictype networkprofile must use with hardwareprofile.";
|
||||
}
|
||||
}
|
||||
|
||||
if ($mgt eq 'vm')
|
||||
{
|
||||
return 1, "";
|
||||
}
|
||||
|
||||
# For nodetype is lpar node, not need to check the nictype as it is not required for lpar node
|
||||
if (not $nictype and $mgt and $nodetype ne 'lpar' ) {
|
||||
@@ -1140,3 +1187,70 @@ sub check_nicips{
|
||||
return (0, \%nics_hash, "");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
=head3 gen_chain_for_profiles
|
||||
Description: Generate a chain string based on Network/Hardware/Image profiles.
|
||||
Arguments: $profiles_hash: The reference for profiles hash.
|
||||
For example:
|
||||
$profiles_hash = { 'HardwareProfile' => 'IBM_NeXtScale_M4',
|
||||
'ImageProfile' => 'rhels6.5-x86_64-stateful-compute',
|
||||
'NetworkProfile' => 'default_network_profile',
|
||||
}
|
||||
$hw_reconfig: the flag shows whether we need re-configure all hardware
|
||||
relative settings or not: like runcmds, runimg...etc
|
||||
Returns: ($retcode, $chain)
|
||||
$retcode = 1. Generate chain failed, $chain stands for error message.
|
||||
$retcode = 0. Generate chain OK. $chain stands for the chain string.
|
||||
|
||||
=cut
|
||||
#-------------------------------------------------------------------------------
|
||||
sub gen_chain_for_profiles{
|
||||
my $class = shift;
|
||||
my $profiles_hashref = shift;
|
||||
my $hw_reconfig = shift;
|
||||
my $final_chain = "";
|
||||
if (! $profiles_hashref){
|
||||
return (1, "Missing parameter for gen_chain_for_profiles.");
|
||||
}
|
||||
# A node must have at least imageprofile and network profile.
|
||||
unless (defined $profiles_hashref->{'ImageProfile'}){
|
||||
return (1, "No imageprofile specified in profiles hash.");
|
||||
}
|
||||
unless (defined $profiles_hashref->{'NetworkProfile'}){
|
||||
return (1, "No networkprofile specified in profiles hash.");
|
||||
}
|
||||
my $hwprofile = $profiles_hashref->{'HardwareProfile'};
|
||||
my $imgprofile = $profiles_hashref->{'ImageProfile'};
|
||||
my $netprofile = $profiles_hashref->{'NetworkProfile'};
|
||||
|
||||
# Get node's provisioning method
|
||||
my $provmethod = xCAT::ProfiledNodeUtils->get_imageprofile_prov_method($imgprofile);
|
||||
unless ($provmethod ){
|
||||
return (1, "Can not get provisioning method for image profile $imgprofile");
|
||||
}
|
||||
my $netprofileattr = xCAT::ProfiledNodeUtils->get_nodes_nic_attrs([$netprofile])->{$netprofile};
|
||||
unless ($netprofileattr){
|
||||
return (1, "Can not get attributes for network profile $netprofile");
|
||||
}
|
||||
|
||||
$final_chain = 'osimage='.$provmethod.":--noupdateinitrd";
|
||||
# get the chain attribute from hardwareprofile and insert it to node.
|
||||
if (defined $hwprofile and $hwprofile and $hw_reconfig){
|
||||
my $chaintab = xCAT::Table->new('chain');
|
||||
my $chain = $chaintab->getNodeAttribs($hwprofile, ['chain']);
|
||||
if (exists $chain->{'chain'}) {
|
||||
my $hw_chain = $chain->{'chain'};
|
||||
$final_chain = $hw_chain.',osimage='.$provmethod.":--noupdateinitrd";
|
||||
}
|
||||
}
|
||||
#run bmcsetups.
|
||||
if ((exists $netprofileattr->{"bmc"}) and $hw_reconfig){
|
||||
if (index($final_chain, "runcmd=bmcsetup") == -1){
|
||||
$final_chain = 'runcmd=bmcsetup,'.$final_chain.':reboot4deploy';
|
||||
}
|
||||
else{
|
||||
$final_chain = $final_chain.':reboot4deploy';
|
||||
}
|
||||
}
|
||||
return (0, $final_chain);
|
||||
}
|
||||
|
||||
@@ -810,6 +810,10 @@ sub senddeviceskeys
|
||||
# add to the command
|
||||
$setupcmd .=$key;
|
||||
$setupcmd .="\"";
|
||||
# Special case for vios
|
||||
if ($ENV{DEVICETYPE} eq 'vios') {
|
||||
$setupcmd = "\"echo $key | tee -a ~/.ssh/authorized_keys2\"";
|
||||
}
|
||||
# For each input device
|
||||
my @nodelist=split(/,/,$nodes);
|
||||
foreach my $node (@nodelist) {
|
||||
|
||||
@@ -116,6 +116,9 @@ sub dodiscover {
|
||||
send_message($args{reqcallback}, 0, "The rarge is too large and may be time consuming. Broadcast is recommended.");
|
||||
}
|
||||
}
|
||||
|
||||
#no need to check site.nmapoptions because it specifilly
|
||||
# uses T5 for certain performance requirement.
|
||||
`/usr/bin/nmap $range -sn -PE -n --send-ip -T5 `;
|
||||
my $nmapres = `/usr/bin/nmap $range -PE -p 427 -n --send-ip -T5 `;
|
||||
foreach my $line (split(/\n\n/,$nmapres)) {
|
||||
@@ -287,7 +290,7 @@ sub dodiscover {
|
||||
if ($rethash{$peername}) {
|
||||
next; #got a dupe, discard
|
||||
}
|
||||
my $result = process_slp_packet(packet=>$slpkg,sockaddr=>$pkg,'socket'=>$args{'socket'});
|
||||
my $result = process_slp_packet(packet=>$slpkg,sockaddr=>$pkg,'socket'=>$args{'socket'}, peername=>$peername, callback=>$args{reqcallback});
|
||||
if ($result) {
|
||||
if ($peername =~ /\./) { #ipv4
|
||||
$peername =~ s/::ffff://;
|
||||
@@ -371,9 +374,10 @@ sub process_slp_packet {
|
||||
if ($parsedpacket->{FunctionId} == 2) {#Service Reply
|
||||
parse_service_reply($parsedpacket->{payload},$parsedpacket);
|
||||
unless (ref $parsedpacket->{service_urls} and scalar @{$parsedpacket->{service_urls}}) { return undef; }
|
||||
if ($parsedpacket->{attributes}) { #service reply had ext
|
||||
|
||||
return $parsedpacket; #don't bother sending attrrequest, already got it in first packet
|
||||
if ($parsedpacket->{attributes} && get_mac_for_addr($args{peername})) {
|
||||
#service reply had ext. Stop here if has gotten attributes and got mac.
|
||||
#continue the unicast request for service attributes if cannot find mac for peernode
|
||||
return $parsedpacket; #don't bother sending attrrequest, already got it in first packet
|
||||
}
|
||||
my $srvtype = $xid_to_srvtype_map{$parsedpacket->{Xid}};
|
||||
my $packet = generate_attribute_request(%args,SrvType=>$srvtype);
|
||||
|
||||
+68
-10
@@ -650,7 +650,8 @@ sub decode_spd {
|
||||
8 => "DDR2 SDRAM",
|
||||
9 => "DDR2 SDRAM FB-DIMM",
|
||||
10 => "DDR2 SDRAM FB-DIMM PROBE",
|
||||
11 => "DDR3 SDRAM"
|
||||
11 => "DDR3 SDRAM",
|
||||
12 => "DDR4 SDRAM",
|
||||
);
|
||||
|
||||
my %modtypes = (
|
||||
@@ -668,33 +669,35 @@ sub decode_spd {
|
||||
1333 => 10600,
|
||||
1600 => 12800,
|
||||
1867 => 14900,
|
||||
2132 => 17000,
|
||||
2133 => 17000,
|
||||
2134 => 17000,
|
||||
);
|
||||
|
||||
my %ddr3modcap = (
|
||||
my %ddrmodcap = (
|
||||
0 => 256,
|
||||
1 => 512,
|
||||
2 => 1024,
|
||||
3 => 2048,
|
||||
4 => 4096,
|
||||
5 => 8192,
|
||||
6 => 16384
|
||||
6 => 16384,
|
||||
7 => 32768,
|
||||
);
|
||||
|
||||
my %ddr3devwidth = (
|
||||
my %ddrdevwidth = (
|
||||
0 => 4,
|
||||
1 => 8,
|
||||
2 => 16,
|
||||
3 => 32
|
||||
);
|
||||
my %ddr3ranks = (
|
||||
my %ddrranks = (
|
||||
0 => 1,
|
||||
1 => 2,
|
||||
2 => 3,
|
||||
3 => 4
|
||||
);
|
||||
my %ddr3buswidth = (
|
||||
my %ddrbuswidth = (
|
||||
0 => 8,
|
||||
1 => 16,
|
||||
2 => 32,
|
||||
@@ -728,10 +731,10 @@ sub decode_spd {
|
||||
$rethash->{product}->{name} .= " ECC";
|
||||
}
|
||||
$rethash->{product}->{name}.=" ".$modtypes{$spd[3]&0x0f};
|
||||
my $sdramcap=$ddr3modcap{$spd[4]&0xf};
|
||||
my $buswidth=$ddr3buswidth{$spd[8]&0b111};
|
||||
my $sdramwidth=$ddr3devwidth{$spd[7]&0b111};
|
||||
my $ranks = $ddr3ranks{($spd[7]&0b111000)>>3};
|
||||
my $sdramcap=$ddrmodcap{$spd[4]&0xf};
|
||||
my $buswidth=$ddrbuswidth{$spd[8]&0b111};
|
||||
my $sdramwidth=$ddrdevwidth{$spd[7]&0b111};
|
||||
my $ranks = $ddrranks{($spd[7]&0b111000)>>3};
|
||||
|
||||
|
||||
my $capacity = $sdramcap/8*$buswidth/$sdramwidth*$ranks;
|
||||
@@ -769,6 +772,61 @@ sub decode_spd {
|
||||
# $rawspd .= sprintf("%02X ",$_);
|
||||
#}
|
||||
#push @{$rethash->{product}->{extra}},$rawspd;
|
||||
} elsif ($spd[2] == 12) { #DDR4 spec applies
|
||||
# spd[125] spd[18] spd[18is sdram min cycle time .. spd125 is fine offset for min time
|
||||
# mtb and ftb are fixed in ddr4 spd spec.. mtb is always 0.125 ns and ftb is always 0.001 ns
|
||||
my $speed;
|
||||
my $clock;
|
||||
if ($spd[17] == 0) {
|
||||
my $fineoffset = $spd[125];
|
||||
if ($fineoffset & 0b10000000) {
|
||||
#negative value, twos complement
|
||||
$fineoffset = 0-(($fineoffset ^ 0xff) + 1);
|
||||
}
|
||||
$clock = int(2/((0.125*$spd[18] + $fineoffset*0.001)*0.001));
|
||||
$speed = $speedfromclock{$clock};
|
||||
unless ($speed) { $speed = "UNKNOWN"; }
|
||||
} else { # this would mean a different MTB and FTB than spec indicated..
|
||||
$clock = "UNKNOWN";
|
||||
$speed = "UNKNOWN";
|
||||
}
|
||||
$rethash->{product}->{name}="PC4-".$speed." ($clock MT/s)";
|
||||
if ($spd[13]&0b11000 == 0b1000) {
|
||||
$rethash->{product}->{name} .= " ECC";
|
||||
}
|
||||
$rethash->{product}->{name}.=" ".$modtypes{$spd[3]&0x0f};
|
||||
my $sdramcap=$ddrmodcap{$spd[4]&0xf};
|
||||
my $buswidth=$ddrbuswidth{$spd[13]&0b111};
|
||||
my $sdramwidth=$ddrdevwidth{$spd[12]&0b111};
|
||||
my $ranks = $ddrranks{($spd[12]&0b111000)>>3};
|
||||
|
||||
|
||||
my $capacity = $sdramcap/8*$buswidth/$sdramwidth*$ranks;
|
||||
if ($capacity < 1024) {
|
||||
$capacity = $capacity."MB";
|
||||
} else {
|
||||
$capacity = ($capacity/1024)."GB";
|
||||
}
|
||||
$rethash->{product}->{name} = $capacity." ".$rethash->{product}->{name};
|
||||
|
||||
$rethash->{product}->{manufacturer} = decode_manufacturer($spd[320],$spd[321]);
|
||||
$rethash->{product}->{buildlocation} = sprintf("%02x",$spd[322]);
|
||||
if ($spd[120] != 0 or $spd[121] != 0) {
|
||||
$rethash->{product}->{builddate} = sprintf("Week %x of 20%02x",$spd[323],$spd[324]);
|
||||
}
|
||||
foreach (@spd[329..348]) {
|
||||
if ($_ > 126 or $_ < 32) {
|
||||
$rethash->{product}->{model}="Malformed SPD";
|
||||
}
|
||||
}
|
||||
unless ($rethash->{product}->{model}) {
|
||||
$rethash->{product}->{model}=pack("C*",@spd[329..348]);
|
||||
}
|
||||
#my $rawspd="SPD Dump: ";
|
||||
#foreach (@spd) {
|
||||
# $rawspd .= sprintf("%02X ",$_);
|
||||
#}
|
||||
#push @{$rethash->{product}->{extra}},$rawspd;
|
||||
} else {
|
||||
$rethash->{product}->{model}="Unrecognized SPD";
|
||||
}
|
||||
|
||||
+84
-12
@@ -393,7 +393,46 @@ ipmi => {
|
||||
descriptions => {
|
||||
node => 'The node name or group name.',
|
||||
bmc => 'The hostname of the BMC adapater.',
|
||||
bmcport => 'In systems with selectable shared/dedicated ethernet ports, this parameter can be used to specify the preferred port. 0 means use the shared port, 1 means dedicated, blank is to not assign',
|
||||
bmcport => ' In systems with selectable shared/dedicated ethernet ports,
|
||||
this parameter can be used to specify the preferred port. 0
|
||||
means use the shared port, 1 means dedicated, blank is to not
|
||||
assign.
|
||||
|
||||
The following special cases exist for IBM System x servers:
|
||||
|
||||
For x3755 M3 systems, 0 means use the dedicated port, 1 means
|
||||
shared, blank is to not assign.
|
||||
|
||||
For certain systems which have a mezzaine or ML2 adapter, there is a second
|
||||
value to include:
|
||||
|
||||
|
||||
For x3750 M4 (Model 8722):
|
||||
|
||||
|
||||
0 2 1st 1Gbps interface for LOM
|
||||
|
||||
0 0 1st 10Gbps interface for LOM
|
||||
|
||||
0 3 2nd 1Gbps interface for LOM
|
||||
|
||||
0 1 2nd 10Gbps interface for LOM
|
||||
|
||||
|
||||
For x3750 M4 (Model 8752), x3850/3950 X6, dx360 M4, x3550 M4, and x3650 M4:
|
||||
|
||||
|
||||
0 Shared (1st onboard interface)
|
||||
|
||||
1 Dedicated
|
||||
|
||||
2 0 First interface on ML2 or mezzanine adapter
|
||||
|
||||
2 1 Second interface on ML2 or mezzanine adapter
|
||||
|
||||
2 2 Third interface on ML2 or mezzanine adapter
|
||||
|
||||
2 3 Fourth interface on ML2 or mezzanine adapter',
|
||||
taggedvlan => 'Have bmcsetup place the BMC on the specified vlan tag on a shared netwirk interface. Some network devices may be incompatible with this option',
|
||||
bmcid => 'Unique identified data used by discovery processes to distinguish known BMCs from unrecognized BMCs',
|
||||
username => 'The BMC userid. If not specified, the key=ipmi row in the passwd table is used as the default.',
|
||||
@@ -689,7 +728,7 @@ osimage => {
|
||||
description => 'OS Image Description',
|
||||
provmethod => 'The provisioning method for node deployment. The valid values are install, netboot,statelite,boottarget,dualboot,sysclone. If boottarget is set, you must set linuximage.boottarget to the name of the boottarget definition. It is not used by AIX.',
|
||||
rootfstype => 'The filesystem type for the rootfs is used when the provmethod is statelite. The valid values are nfs or ramdisk. The default value is nfs',
|
||||
osdistroname => 'The name of the OS distro definition. This attribute can be used to specify which OS distro to use, instead of using the osname,osvers,and osarch attributes.',
|
||||
osdistroname => 'The name of the OS distro definition. This attribute can be used to specify which OS distro to use, instead of using the osname,osvers,and osarch attributes. For *kit commands, the attribute will be used to read the osdistro table for the osname, osvers, and osarch attributes. If defined, the osname, osvers, and osarch attributes defined in the osimage table will be ignored.',
|
||||
osupdatename => 'A comma-separated list of OS distro updates to apply to this osimage.',
|
||||
cfmdir => 'CFM directory name for PCM. Set to /install/osimages/<osimage name>/cfmdir by PCM. ',
|
||||
profile => 'The node usage category. For example compute, service.',
|
||||
@@ -713,7 +752,7 @@ linuximage => {
|
||||
table_desc => 'Information about a Linux operating system image that can be used to deploy cluster nodes.',
|
||||
descriptions => {
|
||||
imagename => 'The name of this xCAT OS image definition.',
|
||||
template => 'The fully qualified name of the template file that is used to create the kick start file for diskful installation.',
|
||||
template => 'The fully qualified name of the template file that will be used to create the OS installer configuration file for stateful installations (e.g. kickstart for RedHat, autoyast for SLES).',
|
||||
boottarget => 'The name of the boottarget definition. When this attribute is set, xCAT will use the kernel, initrd and kernel params defined in the boottarget definition instead of the default.',
|
||||
addkcmdline=> 'User specified arguments to be passed to the kernel. The user arguments are appended to xCAT.s default kernel arguments. This attribute is ignored if linuximage.boottarget is set.',
|
||||
pkglist => 'The fully qualified name of the file that stores the distro packages list that will be included in the image. Make sure that if the pkgs in the pkglist have dependency pkgs, the dependency pkgs should be found in one of the pkgdir',
|
||||
@@ -722,7 +761,7 @@ linuximage => {
|
||||
otherpkgdir => 'The base directory where the non-distro packages are stored.',
|
||||
exlist => 'The fully qualified name of the file that stores the file names and directory names that will be excluded from the image during packimage command. It is used for diskless image only.',
|
||||
postinstall => 'The fully qualified name of the script file that will be run at the end of the genimage command. It is used for diskless image only.',
|
||||
rootimgdir => 'The directory name where the image is stored. It is used for diskless image only.',
|
||||
rootimgdir => 'The directory name where the image is stored. It is generally used for diskless image. it also can be used in sysclone environment to specify where the image captured from golden client is stored. in sysclone environment, rootimgdir is generally assigned to some default value by xcat, but you can specify your own store directory. just one thing need to be noticed, wherever you save the image, the name of last level directory must be the name of image. for example, if your image name is testimage and you want to save this image under home directoy, rootimgdir should be assigned to value /home/testimage/',
|
||||
kerneldir => 'The directory name where the 3rd-party kernel is stored. It is used for diskless image only.',
|
||||
nodebootif => 'The network interface the stateless/statelite node will boot over (e.g. eth0)',
|
||||
otherifce => 'Other network interfaces (e.g. eth1) in the image that should be configured via DHCP',
|
||||
@@ -732,7 +771,7 @@ linuximage => {
|
||||
permission => 'The mount permission of /.statelite directory is used, its default value is 755',
|
||||
dump => qq{The NFS directory to hold the Linux kernel dump file (vmcore) when the node with this image crashes, its format is "nfs://<nfs_server_ip>/<kdump_path>". If you want to use the node's "xcatmaster" (its SN or MN), <nfs_server_ip> can be left blank. For example, "nfs:///<kdump_path>" means the NFS directory to hold the kernel dump file is on the node's SN, or MN if there's no SN.},
|
||||
crashkernelsize => 'the size that assigned to the kdump kernel. If the kernel size is not set, 256M will be the default value.',
|
||||
partitionfile => 'The path of the configuration file which is used to part the disk for the node. For stateful: two types of value can be set for this attribute. One is "<partition file absolute path>", the content of the partition file must use the corresponding format with the OS type. The other one is "s:<partition file absolute path>", the content of the partition file should be a shell script which must write the partition definition into /tmp/partitionfile on the node. For statelite: the valid value is <partition file absolute path>, refer to the statelite doc for the xCAT defined format of the configuration file.',
|
||||
partitionfile => 'The path of the configuration file which will be used to partition the disk for the node. For stateful osimages,two types of files are supported: "<partition file absolute path>" which contains a partitioning definition that will be inserted directly into the generated autoinst configuration file and must be formatted for the corresponding OS installer (e.g. kickstart for RedHat, autoyast for SLES). "s:<partitioning script absolute path>" which specifies a shell script that will be run from the OS installer configuration file %pre section; the script must write the correct partitioning definition into the file /tmp/partitionfile on the node which will be included into the configuration file during the install process. For statelite osimages, partitionfile should specify "<partition file absolute path>"; see the xCAT Statelite documentation for the xCAT defined format of this configuration file.',
|
||||
driverupdatesrc => 'The source of the drivers which need to be loaded during the boot. Two types of driver update source are supported: Driver update disk and Driver rpm package. The value for this attribute should be comma separated sources. Each source should be the format tab:full_path_of_srouce_file. The tab keyword can be: dud (for Driver update disk) and rpm (for driver rpm). If missing the tab, the rpm format is the default. e.g. dud:/install/dud/dd.img,rpm:/install/rpm/d.rpm',
|
||||
comments => 'Any user-written notes.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
@@ -747,7 +786,7 @@ winimage => {
|
||||
imagename => 'The name of this xCAT OS image definition.',
|
||||
template => 'The fully qualified name of the template file that is used to create the windows unattend.xml file for diskful installation.',
|
||||
installto => 'The disk and partition that the Windows will be deployed to. The valid format is <disk>:<partition>. If not set, default value is 0:1 for bios boot mode(legacy) and 0:3 for uefi boot mode; If setting to 1, it means 1:1 for bios boot and 1:3 for uefi boot',
|
||||
partitionfile => 'The path of partition configuration file. Since the partition configuration for bios boot mode and uefi boot mode are different, this configuration file should include two parts if customer wants to support both bios and uefi mode. If customer just wants to support one of the modes, specify one of them anyway. Example of partition configuration file: [BIOS]xxxxxxx[UEFI]yyyyyyy. To simplify the setting, you also can set installto in partitionfile with section likes [INSTALLTO]0:1',
|
||||
partitionfile => 'The path of partition configuration file. Since the partition configuration for bios boot mode and uefi boot mode are different, this configuration file can include both configurations if you need to support both bios and uefi mode. Either way, you must specify the boot mode in the configuration. Example of partition configuration file: [BIOS]xxxxxxx[UEFI]yyyyyyy. To simplify the setting, you also can set installto in partitionfile with section like [INSTALLTO]0:1',
|
||||
winpepath => 'The path of winpe which will be used to boot this image. If the real path is /tftpboot/winboot/winpe1/, the value for winpepath should be set to winboot/winpe1',
|
||||
comments => 'Any user-written notes.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
@@ -885,8 +924,11 @@ site => {
|
||||
" -----------------\n".
|
||||
"DATABASE ATTRIBUTES\n".
|
||||
" -----------------\n".
|
||||
" auditnosyslog: If set to 1, then commands will only be written to the auditlog table.\n".
|
||||
" This attribute set to 1 and auditskipcmds=ALL means no logging of commands.\n".
|
||||
" Default is to write to both the auditlog table and syslog.\n".
|
||||
" auditskipcmds: List of commands and/or client types that will not be\n".
|
||||
" written to the auditlog table.\n".
|
||||
" written to the auditlog table and syslog. See auditnosyslog.\n".
|
||||
" 'ALL' means all cmds will be skipped. If attribute is null, all\n".
|
||||
" commands will be written.\n".
|
||||
" clienttype:web would skip all commands from the web client\n".
|
||||
@@ -904,6 +946,7 @@ site => {
|
||||
" nodestatus: If set to 'n', the nodelist.status column will not be updated during\n".
|
||||
" the node deployment, node discovery and power operations. The default is to update.\n\n".
|
||||
" skiptables: Comma separated list of tables to be skipped by dumpxCATdb\n\n".
|
||||
" skipvalidatelog: If set to 1, then getcredentials and getpostscripts calls will not be logged in syslog.\n\n".
|
||||
" -------------\n".
|
||||
"DHCP ATTRIBUTES\n".
|
||||
" -------------\n".
|
||||
@@ -952,6 +995,16 @@ site => {
|
||||
" dnsupdaters: The value are \',\' separated string which will be added to the zone config\n".
|
||||
" section. This is an interface for user to add configuration entries to\n".
|
||||
" the zone sections in named.conf.\n\n".
|
||||
" dnsinterfaces: The network interfaces DNS server should listen on. If it is the same\n".
|
||||
" for all nodes, use a simple comma-separated list of NICs. To\n".
|
||||
" specify different NICs for different nodes:\n".
|
||||
" xcatmn|eth1,eth2;service|bond0.\n".
|
||||
" In this example xcatmn is the name of the xCAT MN, and DNS there\n".
|
||||
" should listen on eth1 and eth2. On all of the nodes in group\n".
|
||||
" 'service' DNS should listen on the bond0 nic.\n".
|
||||
" NOTE: if using this attribute to block certain interfaces, make sure\n".
|
||||
" the ip maps to your hostname of xCAT MN is not blocked since xCAT needs to\n".
|
||||
" use this ip to communicate with the local NDS server on MN.\n\n".
|
||||
" -------------------------\n".
|
||||
"HARDWARE CONTROL ATTRIBUTES\n".
|
||||
" -------------------------\n".
|
||||
@@ -1079,6 +1132,13 @@ site => {
|
||||
" httpport: The port number that the booting/installing nodes should contact the\n".
|
||||
" http server on the MN/SN on. It is your responsibility to configure\n".
|
||||
" the http server to listen on that port - xCAT will not do that.\n\n".
|
||||
" nmapoptions: Additional options for the nmap command. nmap is used in pping, \n".
|
||||
" nodestat, xdsh -v and updatenode commands. Sometimes additional \n".
|
||||
" performance tuning may be needed for nmap due to network traffic.\n".
|
||||
" For example, if the network response time is too slow, nmap may not\n".
|
||||
" give stable output. You can increase the timeout value by specifying \n".
|
||||
" '--min-rtt-timeout 1s'. xCAT will append the options defined here to \n".
|
||||
" the nmap command.\n\n".
|
||||
" ntpservers: A comma delimited list of NTP servers for the cluster - often the\n".
|
||||
" xCAT management node.\n\n".
|
||||
" svloglocal: if set to 1, syslog on the service node will not get forwarded to the\n".
|
||||
@@ -1121,9 +1181,9 @@ site => {
|
||||
" locking out admin interactive use. This value works with the\n".
|
||||
" xcatmaxconnections and xcatmaxbatch attributes. Is not supported on AIX.\n".
|
||||
" If the value is no, nodes sleep for a random time before contacting\n".
|
||||
" xcatd, and retry. On a new install of xcat, this value will be set to yes.\n".
|
||||
" xcatd, and retry. The default is no.\n".
|
||||
" See the following document for details:\n".
|
||||
" https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Hints_and_Tips_for_Large_Scale_Clusters\n\n".
|
||||
" Hints_and_Tips_for_Large_Scale_Clusters\n\n".
|
||||
" xcatmaxconnections: Number of concurrent xCAT protocol requests before requests\n".
|
||||
" begin queueing. This applies to both client command requests\n".
|
||||
" and node requests, e.g. to get postscripts. Default is 64.\n\n".
|
||||
@@ -1518,7 +1578,7 @@ discoverydata => {
|
||||
method => 'The method which handled the discovery request. The method could be one of: switch, blade, profile, sequential.',
|
||||
discoverytime => 'The last time that xCAT received the discovery message.',
|
||||
arch => 'The architecture of the discovered node. e.g. x86_64.',
|
||||
cpucount => 'The cpu number of the discovered node. e.g. 32.',
|
||||
cpucount => 'The number of cores multiply by threads core supported for the discovered node. e.g. 192.',
|
||||
cputype => 'The cpu type of the discovered node. e.g. Intel(R) Xeon(R) CPU E5-2690 0 @ 2.90GHz',
|
||||
memory => 'The memory size of the discovered node. e.g. 198460852',
|
||||
mtm => 'The machine type model of the discovered node. e.g. 786310X',
|
||||
@@ -3574,6 +3634,10 @@ push(@{$defspec{group}->{'attrs'}}, @nodeattrs);
|
||||
tabentry => 'kit.kitdeployparams',
|
||||
access_tabentry => 'kit.kitname=attr:kitname',
|
||||
},
|
||||
{attr_name => 'kitdir',
|
||||
tabentry => 'kit.kitdir',
|
||||
access_tabentry => 'kit.kitname=attr:kitname',
|
||||
},
|
||||
|
||||
);
|
||||
#############################
|
||||
@@ -3590,8 +3654,8 @@ push(@{$defspec{group}->{'attrs'}}, @nodeattrs);
|
||||
tabentry => 'kitrepo.kitname',
|
||||
access_tabentry => 'kitrepo.kitreponame=attr:kitreponame',
|
||||
},
|
||||
{attr_name => 'osname',
|
||||
tabentry => 'kitrepo.osname',
|
||||
{attr_name => 'osbasename',
|
||||
tabentry => 'kitrepo.osbasename',
|
||||
access_tabentry => 'kitrepo.kitreponame=attr:kitreponame',
|
||||
},
|
||||
{attr_name => 'osmajorversion',
|
||||
@@ -3659,6 +3723,10 @@ push(@{$defspec{group}->{'attrs'}}, @nodeattrs);
|
||||
tabentry => 'kitcomponent.kitpkgdeps',
|
||||
access_tabentry => 'kitcomponent.kitcompname=attr:kitcompname',
|
||||
},
|
||||
{attr_name => 'prerequisite',
|
||||
tabentry => 'kitcomponent.prerequisite',
|
||||
access_tabentry => 'kitcomponent.kitcompname=attr:kitcompname',
|
||||
},
|
||||
{attr_name => 'driverpacks',
|
||||
tabentry => 'kitcomponent.driverpacks',
|
||||
access_tabentry => 'kitcomponent.kitcompname=attr:kitcompname',
|
||||
@@ -3671,6 +3739,10 @@ push(@{$defspec{group}->{'attrs'}}, @nodeattrs);
|
||||
tabentry => 'kitcomponent.postbootscripts',
|
||||
access_tabentry => 'kitcomponent.kitcompname=attr:kitcompname',
|
||||
},
|
||||
{attr_name => 'genimage_postinstall',
|
||||
tabentry => 'kitcomponent.genimage_postinstall',
|
||||
access_tabentry => 'kitcomponent.kitcompname=attr:kitcompname',
|
||||
},
|
||||
{attr_name => 'exlist',
|
||||
tabentry => 'kitcomponent.exlist',
|
||||
access_tabentry => 'kitcomponent.kitcompname=attr:kitcompname',
|
||||
|
||||
@@ -10,12 +10,8 @@ BEGIN
|
||||
# if AIX - make sure we include perl 5.8.2 in INC path.
|
||||
# Needed to find perl dependencies shipped in deps tarball.
|
||||
if ($^O =~ /^aix/i) {
|
||||
use lib "/usr/opt/perl5/lib/5.8.2/aix-thread-multi";
|
||||
use lib "/usr/opt/perl5/lib/5.8.2";
|
||||
use lib "/usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi";
|
||||
use lib "/usr/opt/perl5/lib/site_perl/5.8.2";
|
||||
}
|
||||
|
||||
unshift(@INC, qw(/usr/opt/perl5/lib/5.8.2/aix-thread-multi /usr/opt/perl5/lib/5.8.2 /usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi /usr/opt/perl5/lib/site_perl/5.8.2));
|
||||
}
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
use strict;
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
@@ -179,6 +179,10 @@ sub init_dbworker {
|
||||
#setup signal in NotifHandler so that the cache can be updated
|
||||
xCAT::NotifHandler::setup($$, 0);
|
||||
|
||||
# NOTE: There's a bug that sometimes the %SIG is cleaned up by accident, but we cannot figure out when and why
|
||||
# this happens. The temporary fix is to backup the %SIG and recover it when necessary.
|
||||
my %SIGbakup = %SIG;
|
||||
|
||||
while (not $exitdbthread) {
|
||||
eval {
|
||||
my @ready_socks = $clientset->can_read;
|
||||
@@ -191,6 +195,7 @@ sub init_dbworker {
|
||||
} else {
|
||||
eval {
|
||||
handle_dbc_conn($currcon,$clientset);
|
||||
unless (%SIG && defined ($SIG{USR1})) { %SIG = %SIGbakup; }
|
||||
};
|
||||
if ($@) {
|
||||
my $err=$@;
|
||||
@@ -215,6 +220,9 @@ sub init_dbworker {
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
# sleep a while to make sure the client process has done
|
||||
sleep 1.5;
|
||||
close($dbworkersocket);
|
||||
unlink($dbsockpath);
|
||||
exit 0;
|
||||
@@ -3834,7 +3842,7 @@ sub writeAllEntries
|
||||
}
|
||||
my $filename = shift;
|
||||
my $fh;
|
||||
my $rc;
|
||||
my $rc = 0;
|
||||
# open the file for write
|
||||
unless (open($fh," > $filename")) {
|
||||
my $msg="Unable to open $filename for write \n.";
|
||||
|
||||
@@ -10,11 +10,8 @@ BEGIN
|
||||
# if AIX - make sure we include perl 5.8.2 in INC path.
|
||||
# Needed to find perl dependencies shipped in deps tarball.
|
||||
if ($^O =~ /^aix/i) {
|
||||
use lib "/usr/opt/perl5/lib/5.8.2/aix-thread-multi";
|
||||
use lib "/usr/opt/perl5/lib/5.8.2";
|
||||
use lib "/usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi";
|
||||
use lib "/usr/opt/perl5/lib/site_perl/5.8.2";
|
||||
}
|
||||
unshift(@INC, qw(/usr/opt/perl5/lib/5.8.2/aix-thread-multi /usr/opt/perl5/lib/5.8.2 /usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi /usr/opt/perl5/lib/site_perl/5.8.2));
|
||||
}
|
||||
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
use strict;
|
||||
|
||||
+13
-8
@@ -18,8 +18,9 @@ use xCAT::Utils;
|
||||
my %usage = (
|
||||
"rnetboot" =>
|
||||
"Usage: rnetboot <noderange> [-s net|hd] [-F] [-f] [-V|--verbose] [-m table.colum==expectedstatus] [-m table.colum==expectedstatus...] [-r <retrycount>] [-t <timeout>]
|
||||
rnetboot <noderange> [ipl= address]
|
||||
rnetboot [-h|--help|-v|--version]",
|
||||
rnetboot [-h|--help|-v|--version]
|
||||
zVM specific:
|
||||
rnetboot <noderange> [ipl= address]",
|
||||
"rpower" =>
|
||||
"Usage: rpower <noderange> [--nodeps] [on|onstandby|off|suspend|reset|stat|state|boot] [-V|--verbose] [-m table.colum==expectedstatus][-m table.colum==expectedstatus...] [-r <retrycount>] [-t <timeout>]
|
||||
rpower [-h|--help|-v|--version]
|
||||
@@ -27,10 +28,12 @@ my %usage = (
|
||||
rpower <noderange> [boot] [ -c <path to iso> ]
|
||||
PPC (with IVM or HMC) specific:
|
||||
rpower <noderange> [--nodeps] [of] [-V|--verbose]
|
||||
PPC (HMC) specific:
|
||||
rpower <noderange> [onstandby] [-V|--verbose]
|
||||
CEC (with HMC) specific:
|
||||
rpower <noderange> [on|off|reset|boot|onstandby]
|
||||
LPAR(with HMC) specific:
|
||||
rpower <noderange> [on|off|reset|stat|state|boot|of|sms|softoff]
|
||||
CEC(using Direct FSP Management) specific:
|
||||
rpower <noderange> [on|onstandby|off|stat|state|lowpower|resetsp]
|
||||
rpower <noderange> [on|onstandby|off|stat|state|resetsp]
|
||||
Frame(using Direct FSP Management) specific:
|
||||
rpower <noderange> [stat|state|rackstandby|exit_rackstandby|resetsp]
|
||||
LPAR(using Direct FSP Management) specific:
|
||||
@@ -131,7 +134,7 @@ my %usage = (
|
||||
textid=<*>|
|
||||
frame=<*>|
|
||||
ntp=<[ntp],[ip],[frequency],[v3]>
|
||||
FSP/BPA Common:
|
||||
FSP/CEC (using ASM Interface) Specific:
|
||||
rspconfig <noderange> [autopower|iocap|decfg|memdecfg|procdecfg|time|date|spdump|sysdump|network|hostname]
|
||||
rspconfig <noderange> autopower=<enable|disable>|
|
||||
iocap=<enable|disable>|
|
||||
@@ -241,8 +244,10 @@ my %usage = (
|
||||
chvm <noderange> --p775 -i <id> [-m <memory_interleaving>] -r <partition_rule>
|
||||
chvm <noderange> [lparname=<*|name>]
|
||||
chvm <noderange> [vmcpus=min/req/max] [vmmemory=min/req/max]
|
||||
[vmphyslots=drc_index1,drc_index2...] [vmothersetting=hugepage:N,bsr:N]
|
||||
[vmnics=vlan1,vlan2] [vmstorage=<N|viosnode:slotid>] [--vios]
|
||||
[vmothersetting=hugepage:N,bsr:N]
|
||||
[add_physlots=drc_index1,drc_index2...]
|
||||
[add_vmnics=vlan1,vlan2] [add_vmstorage=<N|viosnode:slotid>] [--vios]
|
||||
chvm <noderange> [del_physlots=drc_index1,drc_index2...]
|
||||
chvm <noderange> [del_vadapter=slotid]
|
||||
VMware specific:
|
||||
chvm <noderange> [-a size][-d disk][-p disk][--resize disk=size][--cpus count][--mem memory]
|
||||
|
||||
Regular → Executable
+864
-6
@@ -1370,11 +1370,30 @@ sub runxcmd_output
|
||||
}
|
||||
}
|
||||
}
|
||||
if (defined($node->{error}))
|
||||
{
|
||||
if (ref(\($node->{error}->[0])) eq 'SCALAR')
|
||||
{
|
||||
$desc = $desc . ": " . $node->{error}->[0];
|
||||
}
|
||||
}
|
||||
if (defined($node->{errorcode}))
|
||||
{
|
||||
if (ref(\($node->{errorcode}->[0])) eq 'SCALAR')
|
||||
{
|
||||
$::RUNCMD_RC |= $node->{errorcode}->[0];
|
||||
}
|
||||
}
|
||||
push @$::xcmd_outref, $desc;
|
||||
}
|
||||
if (defined($resp->{error}))
|
||||
{
|
||||
if (ref($resp->{error}) eq 'ARRAY')
|
||||
{
|
||||
push @$::xcmd_outref, @{$resp->{error}};
|
||||
} else {
|
||||
push @$::xcmd_outref, $resp->{error};
|
||||
}
|
||||
}
|
||||
if (defined($resp->{errorcode}))
|
||||
{
|
||||
@@ -1860,8 +1879,7 @@ sub get_image_name
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 StartService
|
||||
Supports AIX and Linux as long as the service is registered with
|
||||
lssrc or startsrc.
|
||||
Supports AIX only, use startservice for Linux
|
||||
Used by the service node plugin (AAsn.pm) to start requested services.
|
||||
Checks to see if the input service is already started. If it is started
|
||||
it stops and starts the service. Otherwise
|
||||
@@ -1881,7 +1899,9 @@ sub get_image_name
|
||||
Example:
|
||||
if (xCAT::Utils->startService("named") { ...}
|
||||
Comments:
|
||||
none
|
||||
this subroutine is deprecated for Linux,
|
||||
will be used as an internal function to process AIX service,
|
||||
for linux, use xCAT::Utils->startservice instead
|
||||
|
||||
=cut
|
||||
|
||||
@@ -2142,7 +2162,72 @@ sub osver
|
||||
my $line = '';
|
||||
my @lines;
|
||||
my $relfile;
|
||||
if (-f "/etc/redhat-release")
|
||||
|
||||
if (-f "/etc/os-release"){
|
||||
my $version;
|
||||
my $version_id;
|
||||
my $id;
|
||||
my $id_like;
|
||||
my $name;
|
||||
my $prettyname;
|
||||
my $verrel;
|
||||
if (open($relfile,"<","/etc/os-release")) {
|
||||
my @text = <$relfile>;
|
||||
close($relfile);
|
||||
chomp(@text);
|
||||
#print Dumper(\@text);
|
||||
foreach my $line (@text){
|
||||
if($line =~ /^\s*VERSION=\"?([0-9\.]+).*/){
|
||||
$version=$1;
|
||||
}
|
||||
if($line =~ /^\s*VERSION_ID=\"?([0-9\.]+).*/){
|
||||
$version_id=$1;
|
||||
}
|
||||
|
||||
|
||||
if($line =~ /^\s*ID=\"?([0-9a-z\_\-\.]+).*/){
|
||||
$id=$1;
|
||||
}
|
||||
if($line =~ /^\s*ID_LIKE=\"?([0-9a-z\_\-\.]+).*/){
|
||||
$id_like=$1;
|
||||
}
|
||||
|
||||
|
||||
if($line =~ /^\s*NAME=\"?(.*)/){
|
||||
$name=$1;
|
||||
}
|
||||
if($line =~ /^\s*PRETTY_NAME=\"?(.*)/){
|
||||
$prettyname=$1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$os=$id;
|
||||
if (!$os and $id_like) {
|
||||
$os=$id_like;
|
||||
}
|
||||
|
||||
$verrel=$version;
|
||||
if (!$verrel and $version_id) {
|
||||
$verrel=$version_id;
|
||||
}
|
||||
|
||||
|
||||
if(!$name and $prettyname){
|
||||
$name=$prettyname;
|
||||
}
|
||||
|
||||
if($os =~ /rhel/ and $name =~ /Server/i){
|
||||
$os="rhels";
|
||||
}
|
||||
|
||||
if($verrel =~ /([0-9]+)\.?(.*)/) {
|
||||
$ver=$1;
|
||||
$rel=$2;
|
||||
}
|
||||
# print "$ver -- $rel";
|
||||
}
|
||||
elsif (-f "/etc/redhat-release")
|
||||
{
|
||||
open($relfile,"<","/etc/redhat-release");
|
||||
$line = <$relfile>;
|
||||
@@ -2249,8 +2334,10 @@ sub osver
|
||||
close($relfile);
|
||||
}
|
||||
}
|
||||
#print "xxxx $type === $rel \n";
|
||||
if ( $type and $type =~ /all/ ) {
|
||||
if ( $rel ) {
|
||||
if ( $rel ne "") {
|
||||
# print "xxx $os-$ver-$rel \n";
|
||||
return( "$os" . "," . "$ver" . ".$rel" );
|
||||
} else {
|
||||
return( "$os" . "," . "$ver" );
|
||||
@@ -2532,6 +2619,12 @@ sub check_deployment_monitoring_settings()
|
||||
($attr, $val) = split /=~/,$m,2;
|
||||
$val =~ s/^\///;
|
||||
$val =~ s/\/$//;
|
||||
} elsif ($m =~ /^[^=]*!=/) {
|
||||
($attr, $val) = split /!=/,$m,2;
|
||||
} elsif ($m =~ /^[^=]*!~/) {
|
||||
($attr, $val) = split /!~/,$m,2;
|
||||
$val =~ s/^\///;
|
||||
$val =~ s/\/$//;
|
||||
} else {
|
||||
my $rsp={};
|
||||
$rsp->{data}->[0] = "Invalid string \"$m\" specified with -m flag";
|
||||
@@ -3519,7 +3612,7 @@ sub gettimezone
|
||||
} else { # all linux
|
||||
my $localtime = "/etc/localtime";
|
||||
my $zoneinfo = "/usr/share/zoneinfo";
|
||||
my $cmd = "find $zoneinfo -type f -exec cmp -s $localtime {} \\; -print | grep -v posix | grep -v SystemV";
|
||||
my $cmd = "find $zoneinfo -xtype f -exec cmp -s $localtime {} \\; -print | grep -v posix | grep -v SystemV | grep -v right | grep -v localtime ";
|
||||
my $zone_result = xCAT::Utils->runcmd("$cmd", 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
@@ -3543,4 +3636,769 @@ sub gettimezone
|
||||
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
=head3 specialservicemgr
|
||||
some special services cannot be processed in sysVinit, upstart and systemd framework, should be process here...
|
||||
Arguments:
|
||||
service name:
|
||||
action: start/stop/restart/status/enable/disable
|
||||
outputoption:
|
||||
1: return a hashref with the keys:"retcode","retmsg"
|
||||
otherwise: return retcode only
|
||||
Returns:
|
||||
|
||||
a hashref if $outputoption is 1,the hash structure is:
|
||||
{"retcode"=>(status code, 0 for running/active,1 for stopped/inactive,2 for failed)
|
||||
"retmsg" =>(status string, running/active/stopped/inactive/failed)
|
||||
}
|
||||
the status code otherwise
|
||||
|
||||
retcode: 127 if the service specified is not processed
|
||||
the exit code of the service operation if the service specified is processed
|
||||
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my $ret=xCAT::Utils->specialservicemgr("firewall","start");
|
||||
Comments:
|
||||
none
|
||||
=cut
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
sub specialservicemgr{
|
||||
my $svcname=shift;
|
||||
my $action=shift;
|
||||
my $outputoption=shift;
|
||||
my %ret;
|
||||
|
||||
$ret{retcode}=127;
|
||||
if($svcname eq "firewall")
|
||||
{
|
||||
|
||||
my $cmd="type -P SuSEfirewall2 >/dev/null 2>&1";
|
||||
xCAT::Utils->runcmd($cmd,-1);
|
||||
if($::RUNCMD_RC)
|
||||
{
|
||||
$ret{retcode}=127;
|
||||
if(defined $outputoption and $outputoption == 1){
|
||||
return \%ret;
|
||||
}else{
|
||||
return $ret{retcode};
|
||||
}
|
||||
}else{
|
||||
if(($action eq "start") || ($action eq "stop"))
|
||||
{
|
||||
$cmd="SuSEfirewall2 $action";
|
||||
}elsif($action eq "restart"){
|
||||
$cmd="SuSEfirewall2 stop;SuSEfirewall2 start";
|
||||
}elsif($action eq "disable"){
|
||||
$cmd="SuSEfirewall2 off";
|
||||
}elsif($action eq "enable"){
|
||||
$cmd="SuSEfirewall2 on";
|
||||
}elsif($action eq "status"){
|
||||
$cmd="service SuSEfirewall2_setup status";
|
||||
}else{
|
||||
|
||||
$ret{retcode}=127;
|
||||
if(defined $outputoption and $outputoption == 1){
|
||||
return \%ret;
|
||||
}else{
|
||||
return $ret{retcode};
|
||||
}
|
||||
}
|
||||
|
||||
$ret{retmsg}=xCAT::Utils->runcmd($cmd,-1);
|
||||
$ret{retcode}= $::RUNCMD_RC;
|
||||
if(defined $outputoption and $outputoption == 1){
|
||||
return \%ret;
|
||||
}else{
|
||||
return $ret{retcode};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(defined $outputoption and $outputoption == 1){
|
||||
return \%ret;
|
||||
}else{
|
||||
return $ret{retcode};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
=head3 servicemap
|
||||
returns the name of service unit(for systemd) or service daemon(for SYSVinit).
|
||||
Arguments:
|
||||
$svcname: the name of the service
|
||||
$svcmgrtype: the service manager type:
|
||||
0: SYSVinit
|
||||
1: systemd
|
||||
2: upstart
|
||||
Returns:
|
||||
the name of service unit or service daemon
|
||||
undef on fail
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
None
|
||||
Example:
|
||||
my $svc = xCAT::Utils->servicemap($svcname,1);
|
||||
Comments:
|
||||
none
|
||||
=cut
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
sub servicemap{
|
||||
my $svcname=shift;
|
||||
if( $svcname =~ /xCAT::Utils/)
|
||||
{
|
||||
$svcname=shift;
|
||||
}
|
||||
|
||||
my $svcmgrtype=shift;
|
||||
|
||||
|
||||
#hash structure:
|
||||
#"service name $svcname" =>{
|
||||
#"service manager name(SYSVinit/systemd) $svcmgrtype"
|
||||
#=> ["list of possible service file names for the specified $svcname under the specified $svcmgrtype "]
|
||||
# }
|
||||
#
|
||||
#
|
||||
# if there are more than 1 possible service names for a service among
|
||||
# different os distributions and os releases, the service should be
|
||||
# specified in %svchash with structure
|
||||
# (general service name) => {list of possible service names}
|
||||
#
|
||||
my %svchash=(
|
||||
"dhcp" => ["dhcp3-server","dhcpd","isc-dhcp-server"],
|
||||
"nfs" => ["nfsserver","nfs-server","nfs","nfs-kernel-server"],
|
||||
"named" => ["named","bind9"],
|
||||
"syslog" => ["syslog","syslogd","rsyslog"],
|
||||
"firewall" => ["iptables","firewalld","ufw"],
|
||||
"http" => ["apache2","httpd"],
|
||||
"ntpserver" =>["ntpd","ntp"],
|
||||
"mysql" => ["mysqld","mysql"],
|
||||
);
|
||||
|
||||
my $path=undef;
|
||||
my $postfix="";
|
||||
my $retdefault=$svcname;
|
||||
if($svcmgrtype == 0){
|
||||
$path="/etc/init.d/";
|
||||
}elsif ($svcmgrtype == 1){
|
||||
$path="/usr/lib/systemd/system/";
|
||||
$postfix=".service";
|
||||
# $retdefault=$svcname.".service";
|
||||
}elsif ($svcmgrtype == 2){
|
||||
$path="/etc/init/";
|
||||
$postfix=".conf";
|
||||
}
|
||||
|
||||
|
||||
my $ret=undef;
|
||||
if($svchash{$svcname}){
|
||||
foreach my $file (@{$svchash{$svcname}}){
|
||||
if(-e $path.$file.$postfix ){
|
||||
$ret=$file;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(-e $path.$retdefault.$postfix){
|
||||
$ret=$retdefault;
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
=head3 startservice
|
||||
start a service
|
||||
Arguments:
|
||||
service name
|
||||
Returns:
|
||||
0 on success
|
||||
nonzero otherwise
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
xCAT::Utils->startservice("nfs");
|
||||
Comments:
|
||||
none
|
||||
=cut
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
sub startservice{
|
||||
my $svcname=shift;
|
||||
if( $svcname =~ /xCAT::Utils/)
|
||||
{
|
||||
$svcname=shift;
|
||||
}
|
||||
|
||||
my $retval=0;
|
||||
$retval=specialservicemgr($svcname,"start");
|
||||
if($retval != 127)
|
||||
{
|
||||
return $retval;
|
||||
}
|
||||
|
||||
my $cmd="";
|
||||
#for Systemd
|
||||
my $svcunit=undef;
|
||||
#for sysVinit
|
||||
my $svcd=undef;
|
||||
#for upstart
|
||||
my $svcjob=undef;
|
||||
|
||||
$svcunit=servicemap($svcname,1);
|
||||
$svcjob=servicemap($svcname,2);
|
||||
$svcd=servicemap($svcname,0);
|
||||
if($svcunit)
|
||||
{
|
||||
$cmd="systemctl start $svcunit";
|
||||
}
|
||||
elsif( $svcjob )
|
||||
{
|
||||
$cmd="initctl start $svcjob";
|
||||
}
|
||||
elsif( $svcd )
|
||||
{
|
||||
$cmd="service $svcd start";
|
||||
}
|
||||
|
||||
#print "$cmd\n";
|
||||
if( $cmd eq "" )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#xCAT::Utils->runcmd($cmd, -1); # do not use runcmd (backtics), must use system to not fork
|
||||
system($cmd);
|
||||
$::RUNCMD_RC=$?;
|
||||
return $::RUNCMD_RC;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
=head3 stopservice
|
||||
stop a service
|
||||
Arguments:
|
||||
service name
|
||||
Returns:
|
||||
0 on success
|
||||
nonzero otherwise
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
xCAT::Utils->stopservice("nfs");
|
||||
Comments:
|
||||
none
|
||||
=cut
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
sub stopservice{
|
||||
my $svcname=shift;
|
||||
if( $svcname =~ /xCAT::Utils/)
|
||||
{
|
||||
$svcname=shift;
|
||||
}
|
||||
|
||||
|
||||
my $retval=0;
|
||||
$retval=specialservicemgr($svcname,"stop");
|
||||
if($retval != 127)
|
||||
{
|
||||
return $retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
my $cmd="";
|
||||
my $svcunit=undef;
|
||||
my $svcd=undef;
|
||||
my $svcjob=undef;
|
||||
|
||||
$svcunit=servicemap($svcname,1);
|
||||
$svcjob=servicemap($svcname,2);
|
||||
$svcd=servicemap($svcname,0);
|
||||
if($svcunit)
|
||||
{
|
||||
$cmd="systemctl stop $svcunit";
|
||||
}
|
||||
elsif( $svcjob )
|
||||
{
|
||||
$cmd="initctl status $svcjob |grep stop; if [ \"\$?\" != \"0\" ]; then initctl stop $svcjob ; fi";
|
||||
}
|
||||
elsif( $svcd )
|
||||
{
|
||||
$cmd="service $svcd stop";
|
||||
}
|
||||
|
||||
|
||||
#print "$cmd\n";
|
||||
if( $cmd eq "" )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
#xCAT::Utils->runcmd($cmd, -1); # do not use runcmd (backtics), must use system to not fork
|
||||
system($cmd);
|
||||
$::RUNCMD_RC=$?;
|
||||
return $::RUNCMD_RC;
|
||||
}
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
=head3 restartservice
|
||||
restart a service
|
||||
Arguments:
|
||||
service name
|
||||
Returns:
|
||||
0 on success
|
||||
nonzero otherwise
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
xCAT::Utils->restartservice("nfs");
|
||||
Comments:
|
||||
none
|
||||
=cut
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
sub restartservice{
|
||||
my $svcname=shift;
|
||||
if( $svcname =~ /xCAT::Utils/)
|
||||
{
|
||||
$svcname=shift;
|
||||
}
|
||||
|
||||
|
||||
my $retval=0;
|
||||
$retval=specialservicemgr($svcname,"restart");
|
||||
if($retval != 127)
|
||||
{
|
||||
return $retval;
|
||||
}
|
||||
|
||||
my $cmd="";
|
||||
my $svcunit=undef;
|
||||
my $svcd=undef;
|
||||
my $svcjob=undef;
|
||||
|
||||
$svcunit=servicemap($svcname,1);
|
||||
$svcjob=servicemap($svcname,2);
|
||||
$svcd=servicemap($svcname,0);
|
||||
if($svcunit)
|
||||
{
|
||||
$cmd="systemctl restart $svcunit";
|
||||
}
|
||||
elsif( $svcd )
|
||||
{
|
||||
$cmd="service $svcd restart";
|
||||
}
|
||||
elsif( $svcjob )
|
||||
{
|
||||
$cmd="initctl status $svcjob |grep stop; if [ \"\$?\" != \"0\" ]; then initctl restart $svcjob ; else initctl start $svcjob; fi";
|
||||
}
|
||||
|
||||
#print "$cmd\n";
|
||||
if( $cmd eq "" )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
return $::RUNCMD_RC;
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
=head3 checkservicestatus
|
||||
returns theservice status.
|
||||
Arguments:
|
||||
$svcname: the name of the service
|
||||
$outputoption[optional]:
|
||||
the output option
|
||||
1: return a hashref with the keys:"retcode","retmsg"
|
||||
otherwise: return retcode only
|
||||
Returns:
|
||||
undef on fail
|
||||
a hashref if $outputoption is 1,the hash structure is:
|
||||
{"retcode"=>(status code, 0 for running/active,1 for stopped/inactive,2 for failed)
|
||||
"retmsg" =>(status string, running/active/stopped/inactive/failed)
|
||||
}
|
||||
the status code otherwise
|
||||
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
None
|
||||
Example:
|
||||
my $ret = xCAT::Utils-checkservicestatus($svcname,1);
|
||||
my $retcode = xCAT::Utils-checkservicestatus($svcname);
|
||||
Comments:
|
||||
none
|
||||
=cut
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
sub checkservicestatus{
|
||||
my $svcname=shift;
|
||||
if( $svcname =~ /xCAT::Utils/)
|
||||
{
|
||||
$svcname=shift;
|
||||
}
|
||||
|
||||
my $outputoption=shift;
|
||||
|
||||
my $retval;
|
||||
$retval=specialservicemgr($svcname,"status",1);
|
||||
if($retval->{retcode} != 127)
|
||||
{
|
||||
if(defined $outputoption and $outputoption == 1 ){
|
||||
return $retval;
|
||||
}elsif(exists $retval->{retcode}){
|
||||
return $retval->{retcode};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
my $cmd="";
|
||||
my $svcunit=undef;
|
||||
my $svcd=undef;
|
||||
my $svcjob=undef;
|
||||
my %ret;
|
||||
|
||||
$svcunit=servicemap($svcname,1);
|
||||
$svcjob=servicemap($svcname,2);
|
||||
$svcd=servicemap($svcname,0);
|
||||
my $output=undef;
|
||||
|
||||
if($svcunit)
|
||||
{
|
||||
#for systemd, parse the output since it is formatted
|
||||
$cmd="systemctl show --property=ActiveState $svcunit|awk -F '=' '{print \$2}'";
|
||||
$output=xCAT::Utils->runcmd($cmd, -1);
|
||||
if($output =~ /^active$/i){
|
||||
$ret{retcode}=0;
|
||||
}elsif($output =~ /^failed$/i){
|
||||
$ret{retcode}=2;
|
||||
|
||||
}elsif($output =~ /^inactive$/i){
|
||||
$ret{retcode}=1;
|
||||
}
|
||||
}
|
||||
elsif ( $svcjob )
|
||||
{
|
||||
#for upstart, parse the output
|
||||
$cmd="initctl status $svcjob";
|
||||
$output=xCAT::Utils->runcmd($cmd, -1);
|
||||
if($output =~ /waiting/i){
|
||||
$ret{retcode}=2;
|
||||
}elsif($output =~ /running/i){
|
||||
$ret{retcode}=0;
|
||||
}
|
||||
|
||||
}
|
||||
elsif( $svcd )
|
||||
{
|
||||
#for SYSVinit, check the return value since the "service" command output is confused
|
||||
$cmd="service $svcd status";
|
||||
$output=xCAT::Utils->runcmd($cmd, -1);
|
||||
$ret{retcode}=$::RUNCMD_RC;
|
||||
# if($output =~ /stopped|not running/i){
|
||||
# $ret{retcode}=1;
|
||||
# }elsif($output =~ /running/i){
|
||||
# $ret{retcode}=0;
|
||||
# }
|
||||
}
|
||||
if($output)
|
||||
{
|
||||
$ret{retmsg}=$output;
|
||||
}
|
||||
|
||||
|
||||
if(defined $outputoption and $outputoption == 1 ){
|
||||
return \%ret;
|
||||
}elsif(exists $ret{retcode}){
|
||||
return $ret{retcode};
|
||||
}
|
||||
|
||||
return undef;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
=head3 enableservice
|
||||
enable a service to start it on the system bootup
|
||||
Arguments:
|
||||
service name
|
||||
Returns:
|
||||
0 on success
|
||||
nonzero otherwise
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
xCAT::Utils->enableservice("nfs");
|
||||
Comments:
|
||||
none
|
||||
=cut
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
sub enableservice{
|
||||
my $svcname=shift;
|
||||
if( $svcname =~ /xCAT::Utils/)
|
||||
{
|
||||
$svcname=shift;
|
||||
|
||||
}
|
||||
|
||||
my $retval=0;
|
||||
$retval=specialservicemgr($svcname,"enable");
|
||||
if($retval != 127)
|
||||
{
|
||||
return $retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
my $cmd="";
|
||||
my $svcunit=undef;
|
||||
my $svcd=undef;
|
||||
my $svcjob=undef;
|
||||
|
||||
$svcunit=servicemap($svcname,1);
|
||||
$svcjob=servicemap($svcname,2);
|
||||
$svcd=servicemap($svcname,0);
|
||||
if($svcunit)
|
||||
{
|
||||
$cmd="systemctl enable $svcunit";
|
||||
}
|
||||
elsif($svcjob)
|
||||
{
|
||||
$cmd="update-rc.d $svcjob defaults";
|
||||
|
||||
}
|
||||
elsif( $svcd )
|
||||
{
|
||||
my $CHKCONFIG = xCAT::Utils->fullpathbin("chkconfig");
|
||||
if($CHKCONFIG ne "chkconfig"){
|
||||
$cmd="$CHKCONFIG $svcd on";
|
||||
}else{
|
||||
$CHKCONFIG = xCAT::Utils->fullpathbin("update-rc.d");
|
||||
if($CHKCONFIG ne "update-rc.d"){
|
||||
$cmd="$CHKCONFIG $svcd defaults";
|
||||
}
|
||||
}
|
||||
}
|
||||
if( $cmd eq "" )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
return $::RUNCMD_RC;
|
||||
}
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
=head3 disableservice
|
||||
disable a service to prevent it from starting on system bootup
|
||||
Arguments:
|
||||
service name
|
||||
Returns:
|
||||
0 on success
|
||||
nonzero otherwise
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
xCAT::Utils->disableservice("nfs");
|
||||
Comments:
|
||||
none
|
||||
=cut
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
sub disableservice{
|
||||
my $svcname=shift;
|
||||
if( $svcname =~ /xCAT::Utils/)
|
||||
{
|
||||
$svcname=shift;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
my $retval=0;
|
||||
$retval=specialservicemgr($svcname,"disable");
|
||||
if($retval != 127)
|
||||
{
|
||||
return $retval;
|
||||
}
|
||||
|
||||
|
||||
my $cmd="";
|
||||
my $svcunit=undef;
|
||||
my $svcjob=undef;
|
||||
my $svcd=undef;
|
||||
|
||||
$svcunit=servicemap($svcname,1);
|
||||
$svcjob=servicemap($svcname,2);
|
||||
$svcd=servicemap($svcname,0);
|
||||
if($svcunit)
|
||||
{
|
||||
$cmd="systemctl disable $svcunit";
|
||||
}
|
||||
elsif($svcjob)
|
||||
{
|
||||
$cmd="update-rc.d -f $svcjob remove";
|
||||
|
||||
}
|
||||
elsif( $svcd )
|
||||
{
|
||||
my $CHKCONFIG = xCAT::Utils->fullpathbin("chkconfig");
|
||||
if($CHKCONFIG ne "chkconfig"){
|
||||
$cmd="$CHKCONFIG $svcd off";
|
||||
}else{
|
||||
$CHKCONFIG = xCAT::Utils->fullpathbin("update-rc.d");
|
||||
if($CHKCONFIG ne "update-rc.d"){
|
||||
$cmd="$CHKCONFIG -f $svcd remove";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# print "$cmd\n";
|
||||
if( $cmd eq "" )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
return $::RUNCMD_RC;
|
||||
}
|
||||
|
||||
sub cleanup_for_powerLE_hardware_discovery {
|
||||
my $host_node = shift;
|
||||
if( $host_node =~ /xCAT::Utils/)
|
||||
{
|
||||
$host_node=shift;
|
||||
}
|
||||
my $pbmc_node = shift;
|
||||
my $subreq = shift;
|
||||
my $ipmitab = xCAT::Table->new("ipmi");
|
||||
unless($ipmitab) {
|
||||
xCAT::MsgUtils->message("S", "Discovery Error: can not open ipmi table.");
|
||||
return;
|
||||
}
|
||||
my @nodes = ($host_node, $pbmc_node);
|
||||
my $ipmihash = $ipmitab->getNodesAttribs(\@nodes, ['node', 'bmc', 'username', 'password']);
|
||||
if ($ipmihash) {
|
||||
my $new_bmc_ip = $ipmihash->{$host_node}->[0]->{bmc};
|
||||
my $new_bmc_password = $ipmihash->{$host_node}->[0]->{password};
|
||||
|
||||
xCAT::MsgUtils->message("S", "Discovery info: configure password for pbmc_node:$pbmc_node.");
|
||||
`rspconfig $pbmc_node password=$new_bmc_password`;
|
||||
#if ($new_bmc_password) {
|
||||
# xCAT::Utils->runxcmd(
|
||||
# {
|
||||
# command => ["rspconfig"],
|
||||
# node => ["$pbmc_node"],
|
||||
# arg => [ "password=$new_bmc_password" ],
|
||||
# },
|
||||
# $subreq, 0,1);
|
||||
# if ($::RUNCMD_RC != 0) {
|
||||
# xCAT::MsgUtils->message("S", "Discovery Error: configure password failed for FSP.");
|
||||
# return;
|
||||
# }
|
||||
#}
|
||||
|
||||
xCAT::MsgUtils->message("S", "Discover info: configure ip:$new_bmc_ip for pbmc_node:$pbmc_node.");
|
||||
`rspconfig $pbmc_node ip=$new_bmc_ip`;
|
||||
#if($new_bmc_ip) {
|
||||
# xCAT::Utils->runxcmd(
|
||||
# {
|
||||
# command => ["rspconfig"],
|
||||
# node => ["$pbmc_node"],
|
||||
# arg => [ "ip=$new_bmc_ip" ],
|
||||
# },
|
||||
# $subreq, 0,1);
|
||||
# if ($::RUNCMD_RC != 0) {
|
||||
# xCAT::MsgUtils->message("S", "Discovery Error: configure IP address failed for FSP.");
|
||||
# return;
|
||||
# }
|
||||
#}
|
||||
xCAT::MsgUtils->message("S", "Discovery info: remove pbmc_node:$pbmc_node.");
|
||||
`rmdef $pbmc_node`;
|
||||
#xCAT::Utils->runxcmd(
|
||||
# {
|
||||
# command => ["rmdef"],
|
||||
# node => ["$pbmc_node"],
|
||||
# },
|
||||
# $subreq, 0,1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#The parseMacTabEntry parses the mac table entry and return the mac address of nic in management network
|
||||
#Arguments:
|
||||
#macString : the string of mac table entry
|
||||
#HostName : the hostname of the node
|
||||
#The mac address is taken as installnic when:
|
||||
#1. the mac addr does not have a suffix "!xxxx"
|
||||
#2. the mac addr has a fuffix "!<the node name in xcat nodelist table>"
|
||||
#The schema description of mac table is:
|
||||
# mac: The mac address or addresses for which xCAT will manage static bindings for this node.
|
||||
#This may be simply a mac address, which would be bound to the node name (such as "01:02:03:04:05:0E").
|
||||
#This may also be a "|" delimited string of "mac address!hostname" format (such as "01:02:03:04:05:0E!node5|01:02:03:05:0F!node6-eth1").
|
||||
sub parseMacTabEntry{
|
||||
|
||||
my $macString=shift;
|
||||
if( $macString =~ /xCAT::Utils/)
|
||||
{
|
||||
$macString=shift;
|
||||
|
||||
}
|
||||
my $HostName=shift;
|
||||
|
||||
my $mac_ret;
|
||||
my @macEntry=split(/\|/,$macString);
|
||||
|
||||
foreach my $mac_t (@macEntry){
|
||||
if($mac_t =~ /!/){
|
||||
if($mac_t =~ /(.+)!$HostName$/){
|
||||
$mac_ret=$1;
|
||||
}
|
||||
}else{
|
||||
$mac_ret=$mac_t;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $mac_ret;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
@@ -18,6 +18,7 @@ require Exporter;
|
||||
"1341569670.539525" => "centos6.3",#x86
|
||||
"1362445555.957609" => "centos6.4",#x86_64
|
||||
"1385726732.061157" => "centos6.5",#x86_64
|
||||
"1404489053.504589" => "centos7.0",
|
||||
"1176234647.982657" => "centos5",
|
||||
"1156364963.862322" => "centos4.4",
|
||||
"1178480581.024704" => "centos4.5",
|
||||
@@ -66,12 +67,16 @@ require Exporter;
|
||||
"1359576196.686790" => "rhels6.4", #ppc64
|
||||
"1384196515.415715" => "rhels6.5", #x86_64
|
||||
"1384198011.520581" => "rhels6.5", #ppc64
|
||||
"1411733344.627228" => "rhels6.6", #x86_64
|
||||
"1411733344.616389" => "rhels6.6", #ppc64
|
||||
"1285193176.593806" => "rhelhpc6", #x86_64
|
||||
"1305067719.718814" => "rhelhpc6.1",#x86_64
|
||||
"1321545261.599847" => "rhelhpc6.2",#x86_64
|
||||
"1339640148.070971" => "rhelhpc6.3",#x86_64
|
||||
"1359576195.413831" => "rhelhpc6.4",#x86_64, RHEL ComputeNode
|
||||
"1384196516.465862" => "rhelhpc6.5",#x86_64, RHEL ComputeNode
|
||||
"1411733344.599861" => "rhelhpc6.6",#x86_64, RHEL ComputeNode
|
||||
"1399449226.140088" => "rhelhpc7.0",#x86_64, RHEL ComputeNode
|
||||
"1194015916.783841" => "fedora8",
|
||||
"1194015385.299901" => "fedora8",
|
||||
"1210112435.291709" => "fedora9",
|
||||
@@ -90,9 +95,12 @@ require Exporter;
|
||||
"1194512327.501046" => "rhas4.6",
|
||||
"1241464993.830723" => "rhas4.8", #x86-64
|
||||
|
||||
"1273608367.051780" => "SL5.5", #x86_64 DVD ISO
|
||||
"1299104542.844706" => "SL6", #x86_64 DVD ISO
|
||||
"1394111947.452332" => "pkvm2.1", # ppc64
|
||||
"1273608367.051780" => "SL5.5", #x86_64 DVD ISO
|
||||
"1299104542.844706" => "SL6", #x86_64 DVD ISO
|
||||
"1390839789.062069" => "SL6.5", #x86_64 DVD ISO Install
|
||||
|
||||
"1394111947.452332" => "pkvm2.1", # ppc64, PowerKVM
|
||||
"1413749127.352649" => "pkvm2.1.1", # ppc64, PowerKVM
|
||||
);
|
||||
my %numdiscs = (
|
||||
"1156364963.862322" => 4,
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
# AIX Bundle file for compiler runtime packages
|
||||
|
||||
I:xlC.aix61
|
||||
I:xlC.rte
|
||||
I:xlfrte
|
||||
I:xlfrte.aix61
|
||||
I:xlfrte.msg.en_US
|
||||
I:xlsmp.aix61.rte
|
||||
I:xlsmp.msg.en_US.rte
|
||||
I:xlsmp.rte
|
||||
@@ -103,7 +103,7 @@ else # assume Linux
|
||||
fi
|
||||
if [ ! -e $gpfsprofile.sh ]; then
|
||||
echo 'export PATH=$PATH:/usr/lpp/mmfs/bin' > $gpfsprofile.sh
|
||||
echo 'setenv PATH $PATH:/usr/lpp/mmfs/bin' > $gpfsprofile.csh
|
||||
echo 'setenv PATH ${PATH}:/usr/lpp/mmfs/bin' > $gpfsprofile.csh
|
||||
# Turn off LANG support since we did not install other msg catalogs
|
||||
echo 'export LC_CTYPE=POSIX' >> $gpfsprofile.sh
|
||||
echo 'setenv LC_CTYPE POSIX' >> $gpfsprofile.csh
|
||||
|
||||
@@ -62,7 +62,8 @@ else
|
||||
file=$1
|
||||
fi
|
||||
|
||||
ifconfig -a | grep 'inet ' | awk ' { print $2 } ' | grep -v 127.0.0.1 |
|
||||
#ifconfig -a | grep 'inet ' | awk ' { print $2 } ' | grep -v 127.0.0.1 |
|
||||
ip -4 -oneline addr show 2>/dev/null |grep inet | sed -ne "s/.*inet //p"|awk -F ' ' '{print $1}'|awk -F '/' '{print $1}'|
|
||||
while read my_address ; do
|
||||
##print "checking $my_address"
|
||||
grep -q " ${my_address}$" $file
|
||||
|
||||
@@ -1,38 +1,88 @@
|
||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: xcat-openstack-baremetal
|
||||
Source: <url://example.com>
|
||||
Eclipse Public License - v 1.0
|
||||
|
||||
Files: *
|
||||
Copyright: <years> <put author's name and email here>
|
||||
<years> <likewise for another author>
|
||||
License: <special license>
|
||||
<Put the license of the package here indented by 1 space>
|
||||
<This follows the format of Description: lines in control file>
|
||||
.
|
||||
<Including paragraphs>
|
||||
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
|
||||
|
||||
# If you want to use GPL v2 or later for the /debian/* files use
|
||||
# the following clauses, or change it to suit. Delete these two lines
|
||||
Files: debian/*
|
||||
Copyright: 2014 root <root@unknown>
|
||||
License: GPL-2+
|
||||
This package is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
.
|
||||
This package is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
.
|
||||
On Debian systems, the complete text of the GNU General
|
||||
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
|
||||
1. DEFINITIONS
|
||||
|
||||
# Please also look if there are files or directories which have a
|
||||
# different copyright/license attached and list them here.
|
||||
# Please avoid to pick license terms that are more restrictive than the
|
||||
# packaged work, as it may make Debian's contributions unacceptable upstream.
|
||||
"Contribution" means:
|
||||
|
||||
a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
|
||||
b) in the case of each subsequent Contributor:
|
||||
|
||||
i) changes to the Program, and
|
||||
|
||||
ii) additions to the Program;
|
||||
|
||||
where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
|
||||
|
||||
"Contributor" means any person or entity that distributes the Program.
|
||||
|
||||
"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
|
||||
|
||||
"Program" means the Contributions distributed in accordance with this Agreement.
|
||||
|
||||
"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
|
||||
|
||||
2. GRANT OF RIGHTS
|
||||
|
||||
a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
|
||||
|
||||
b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
|
||||
|
||||
c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
|
||||
|
||||
d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
|
||||
|
||||
3. REQUIREMENTS
|
||||
|
||||
A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
|
||||
|
||||
a) it complies with the terms and conditions of this Agreement; and
|
||||
|
||||
b) its license agreement:
|
||||
|
||||
i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
|
||||
|
||||
ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
|
||||
|
||||
iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
|
||||
|
||||
iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
|
||||
|
||||
When the Program is made available in source code form:
|
||||
|
||||
a) it must be made available under this Agreement; and
|
||||
|
||||
b) a copy of this Agreement must be included with each copy of the Program.
|
||||
|
||||
Contributors may not remove or alter any copyright notices contained within the Program.
|
||||
|
||||
Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.
|
||||
|
||||
4. COMMERCIAL DISTRIBUTION
|
||||
|
||||
Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
|
||||
|
||||
For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
|
||||
|
||||
5. NO WARRANTY
|
||||
|
||||
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
|
||||
|
||||
6. DISCLAIMER OF LIABILITY
|
||||
|
||||
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
7. GENERAL
|
||||
|
||||
If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
|
||||
|
||||
If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
|
||||
|
||||
All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
|
||||
|
||||
Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
|
||||
|
||||
This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
|
||||
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
xcat-openstack-baremetal_2.8.4-1_all.deb admin extra
|
||||
xcat-openstack-baremetal_2.8.4-1_all.deb admin extra
|
||||
@@ -1,201 +0,0 @@
|
||||
dh_installdirs
|
||||
dh_installdirs
|
||||
dh_install
|
||||
dh_link
|
||||
dh_installman
|
||||
dh_compress
|
||||
dh_installdeb
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
dh_builddeb
|
||||
dh_installdirs
|
||||
dh_install
|
||||
dh_link
|
||||
dh_installman
|
||||
dh_compress
|
||||
dh_installdeb
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
dh_builddeb
|
||||
dh_installdirs
|
||||
dh_install
|
||||
dh_link
|
||||
dh_installman
|
||||
dh_compress
|
||||
dh_installdeb
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
dh_builddeb
|
||||
dh_installdirs
|
||||
dh_install
|
||||
dh_link
|
||||
dh_installman
|
||||
dh_compress
|
||||
dh_installdeb
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
dh_builddeb
|
||||
dh_installdirs
|
||||
dh_install
|
||||
dh_link
|
||||
dh_installman
|
||||
dh_compress
|
||||
dh_installdeb
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
dh_builddeb
|
||||
dh_installdirs
|
||||
dh_install
|
||||
dh_link
|
||||
dh_installman
|
||||
dh_compress
|
||||
dh_installdeb
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
dh_builddeb
|
||||
dh_installdirs
|
||||
dh_install
|
||||
dh_link
|
||||
dh_installman
|
||||
dh_compress
|
||||
dh_installdeb
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
dh_builddeb
|
||||
dh_installdirs
|
||||
dh_install
|
||||
dh_link
|
||||
dh_installman
|
||||
dh_compress
|
||||
dh_installdeb
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
dh_builddeb
|
||||
dh_installdirs
|
||||
dh_install
|
||||
dh_link
|
||||
dh_installman
|
||||
dh_compress
|
||||
dh_installdeb
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
dh_builddeb
|
||||
dh_installdirs
|
||||
dh_install
|
||||
dh_link
|
||||
dh_installman
|
||||
dh_compress
|
||||
dh_installdeb
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
dh_builddeb
|
||||
dh_installdirs
|
||||
dh_install
|
||||
dh_link
|
||||
dh_installman
|
||||
dh_compress
|
||||
dh_installdeb
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
dh_builddeb
|
||||
dh_installdirs
|
||||
dh_install
|
||||
dh_link
|
||||
dh_installman
|
||||
dh_compress
|
||||
dh_installdeb
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
dh_builddeb
|
||||
dh_installdirs
|
||||
dh_install
|
||||
dh_link
|
||||
dh_installman
|
||||
dh_compress
|
||||
dh_installdeb
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
dh_builddeb
|
||||
dh_installdirs
|
||||
dh_install
|
||||
dh_link
|
||||
dh_installman
|
||||
dh_compress
|
||||
dh_installdeb
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
dh_builddeb
|
||||
dh_installdirs
|
||||
dh_install
|
||||
dh_link
|
||||
dh_installman
|
||||
dh_compress
|
||||
dh_installdeb
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
dh_builddeb
|
||||
dh_installdirs
|
||||
dh_install
|
||||
dh_link
|
||||
dh_installman
|
||||
dh_compress
|
||||
dh_installdeb
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
dh_builddeb
|
||||
dh_installdirs
|
||||
dh_install
|
||||
dh_link
|
||||
dh_installman
|
||||
dh_compress
|
||||
dh_installdeb
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
dh_builddeb
|
||||
dh_installdirs
|
||||
dh_install
|
||||
dh_link
|
||||
dh_installman
|
||||
dh_compress
|
||||
dh_installdeb
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
dh_builddeb
|
||||
dh_installdirs
|
||||
dh_install
|
||||
dh_link
|
||||
dh_installman
|
||||
dh_compress
|
||||
dh_installdeb
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
dh_builddeb
|
||||
dh_installdirs
|
||||
dh_install
|
||||
dh_link
|
||||
dh_installman
|
||||
dh_compress
|
||||
dh_installdeb
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
dh_builddeb
|
||||
@@ -100,8 +100,8 @@ change_host_name()
|
||||
|
||||
if [ "$str_os_type" = "sles" ];then
|
||||
echo "Persistently changing the hostname not implemented yet."
|
||||
#debian ubuntu
|
||||
elif [ "$str_os_type" = "debian" ];then
|
||||
#debian ubuntu and rh7
|
||||
elif [ -f "/etc/hostname" ];then
|
||||
conf_file="/etc/hostname"
|
||||
echo "$str_hostname" > $conf_file
|
||||
else
|
||||
|
||||
@@ -36,8 +36,8 @@ change_host_name()
|
||||
|
||||
if [ "$str_os_type" = "sles" ];then
|
||||
echo "Persistently changing the hostname not implemented yet."
|
||||
#debian ubuntu
|
||||
elif [ "$str_os_type" = "debian" ];then
|
||||
#debian ubuntu and rh7
|
||||
elif [ -f "/etc/hostname" ];then
|
||||
conf_file="/etc/hostname"
|
||||
echo "$str_hostname" > $conf_file
|
||||
else
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
include AUTHORS
|
||||
include ChangeLog
|
||||
exclude .gitignore
|
||||
exclude .gitreview
|
||||
|
||||
global-exclude *.pyc
|
||||
@@ -0,0 +1,44 @@
|
||||
xCAT Driver for ironic x86/64 machine
|
||||
==================================
|
||||
|
||||
xCAT is a Extreme Cluster/Cloud Administration Toolkit. We can use xcat
|
||||
to do :
|
||||
1 hardward discoveery
|
||||
2 remote hardware control
|
||||
3 remote sonsole
|
||||
4 hardware inventory
|
||||
5 firmware flashing
|
||||
|
||||
Ironic is a project in Openstack, it will replace the nova-baremetal in juno release. Ironic's design is very flexable, we can add driver to extend function
|
||||
without change any code in Openstack. Ironic xCAT driver takes the advantage of xcat and openstack, we can use it to deploy the baremetal machine very easily.
|
||||
|
||||
Before using this driver, we must setup the openstack environment at least for two nodes( ironic conductor and neutron network node can't setup on the same node)
|
||||
Ironic conductor and the baremetal node( waiting for deploy) must in the same vlan
|
||||
|
||||
Add the follows in the ironic egg-info entry_points.txt file (ironic.drivers section)
|
||||
|
||||
pxe_xcat = ironic.drivers.xcat:XCATBaremetalDriver
|
||||
|
||||
When the openstack with ironic is ready, just execute command in the ironic_xcat directory as follows:
|
||||
|
||||
$ python setup.py install
|
||||
|
||||
Restart the ironic-conductor process
|
||||
|
||||
Initialize the xcat environment according to http://sourceforge.net/p/xcat/wiki/XCAT_iDataPlex_Cluster_Quick_Start/
|
||||
Using xCAT baremetal driver need config site table and run copycds to generate image. The node definition is not requirement.
|
||||
|
||||
Ironic use neutron as the network service.
|
||||
Check the openvswitch config on the network node ,make sure brbm bridge connect to the baremetal node.
|
||||
|
||||
==================================================================================
|
||||
Some Example to use the xCAT baremetal driver.
|
||||
|
||||
$touch /tmp/rhelhpc6.5-x86_64-install-compute.qcow2;glance image-create --name rhelhpc6.5-x86_64-install-compute --public --disk-format qcow2 --container-format bare --property xcat_image_name='rhels6.4-x86_64-install-compute' < /tmp/rhelhpc6.5-x86_64-install-compute.qcow2
|
||||
--name rhelhpc6.5-x86_64-install-compute is the image name in xcat. You can use lsdef -t osimage on the ironic-conductor node which xcat is installed.
|
||||
|
||||
$ ironic node-create --driver pxe_xcat -i ipmi_address=xxx.xxx.xxx.xxx -i ipmi_username=userid -i ipmi_password=password -i xcat_node=x3550m4n02 -i xcatmaster=10.1.0.241 -i netboot=xnba -i ipmi_terminal_port=0 -p memory_mb=2048 -p cpus=8
|
||||
|
||||
$ ironic port-create --address ff:ff:ff:ff:ff:ff --node_uuid <ironic node uuid>
|
||||
|
||||
$ nova boot --flavor baremetal --image <image-id> testing --nic net-id=<internal network id>
|
||||
@@ -0,0 +1,25 @@
|
||||
"""xCAT baremtal exceptions.
|
||||
"""
|
||||
|
||||
from oslo.config import cfg
|
||||
import six
|
||||
|
||||
from ironic.openstack.common.gettextutils import _
|
||||
from ironic.openstack.common import log as logging
|
||||
from ironic.common.exception import IronicException
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
class xCATCmdFailure(IronicException):
|
||||
message = _("xcat call failed: %(cmd)s %(node)s %(args)s.")
|
||||
|
||||
class xCATDeploymentFailure(IronicException):
|
||||
message = _("xCAT node deployment failed for node %(node)s:%(error)s")
|
||||
|
||||
class GetNetworkFixedIPFailure(IronicException):
|
||||
message = _("get fixed ip failed for mac %(mac_address)s")
|
||||
|
||||
class GetNetworkIdFailure(IronicException):
|
||||
message = _("get node network in failed for mac %(mac_address)s")
|
||||
|
||||
class FailedToGetInfoOnPort(IronicException):
|
||||
message = _("Show info on port: %(port_id)s failed.")
|
||||
@@ -0,0 +1,41 @@
|
||||
"""
|
||||
Get the network from neutron
|
||||
This is a xcat patch for the ironic/common/neutron.py
|
||||
"""
|
||||
|
||||
from neutronclient.common import exceptions as neutron_client_exc
|
||||
from ironic.common import exception
|
||||
from ironic.openstack.common import log as logging
|
||||
from ironic.common import neutron
|
||||
from ironic.drivers.modules import xcat_exception
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
def get_vif_port_info(task, port_id):
|
||||
""" Get detail port info from neutron with a given port id """
|
||||
api = neutron.NeutronAPI(task.context)
|
||||
try:
|
||||
port_info = api.client.show_port(port_id)
|
||||
except neutron_client_exc.NeutronClientException:
|
||||
LOG.exception(_("Failed to get port info %s."), port_id)
|
||||
raise exception.FailedToGetInfoOnPort(port_id=port_id)
|
||||
return port_info
|
||||
|
||||
|
||||
def get_ports_info_from_neutron(task):
|
||||
""" Get neutron port info from neutron about this task """
|
||||
vifs = neutron.get_node_vif_ids(task)
|
||||
if not vifs:
|
||||
LOG.warning(_("No VIFs found for node %(node)s when attempting to "
|
||||
"update Neutron DHCP BOOT options."),
|
||||
{'node': task.node.uuid})
|
||||
return
|
||||
failures = []
|
||||
vif_ports_info = {}
|
||||
for port_id, port_vif in vifs.iteritems():
|
||||
try:
|
||||
vif_ports_info[port_id] = get_vif_port_info(task,port_vif)
|
||||
except xcat_exception.FailedToGetInfoOnPort(port_id=port_vif):
|
||||
failures.append(port_vif)
|
||||
return vif_ports_info
|
||||
|
||||
@@ -0,0 +1,462 @@
|
||||
"""
|
||||
pxe procedure for the xcat baremetal driver
|
||||
use xcat to config dhcp and tftp
|
||||
"""
|
||||
|
||||
import os
|
||||
import time
|
||||
import paramiko
|
||||
import datetime
|
||||
from oslo.config import cfg
|
||||
from ironic.common import exception
|
||||
from ironic.common import image_service as service
|
||||
from ironic.common import keystone
|
||||
from ironic.common import states
|
||||
from ironic.common import utils
|
||||
from ironic.conductor import task_manager
|
||||
from ironic.conductor import utils as manager_utils
|
||||
from ironic.drivers import base
|
||||
from ironic.drivers import utils as driver_utils
|
||||
from ironic.openstack.common import log as logging
|
||||
from ironic.openstack.common import strutils
|
||||
from ironic.drivers.modules import xcat_neutron
|
||||
from ironic.drivers.modules import xcat_util
|
||||
from ironic.openstack.common import loopingcall
|
||||
from nova.openstack.common import timeutils
|
||||
from ironic.openstack.common import lockutils
|
||||
from ironic.drivers.modules import xcat_exception
|
||||
|
||||
|
||||
pxe_opts = [
|
||||
cfg.StrOpt('pxe_append_params',
|
||||
default='nofb nomodeset vga=normal',
|
||||
help='Additional append parameters for baremetal PXE boot.'),
|
||||
cfg.StrOpt('default_ephemeral_format',
|
||||
default='ext4',
|
||||
help='Default file system format for ephemeral partition, '
|
||||
'if one is created.'),
|
||||
]
|
||||
xcat_opts = [
|
||||
cfg.StrOpt('network_node_ip',
|
||||
default='127.0.0.1',
|
||||
help='IP address of neutron network node'),
|
||||
cfg.StrOpt('ssh_user',
|
||||
default='root',
|
||||
help='Username of neutron network node.'),
|
||||
cfg.StrOpt('ssh_password',
|
||||
default='cluster',
|
||||
help='Password of neutron network node'),
|
||||
cfg.IntOpt('ssh_port',
|
||||
default=22,
|
||||
help='ssh connection port for the neutron '),
|
||||
cfg.StrOpt('host_filepath',
|
||||
default='/etc/hosts',
|
||||
help='host file of server'),
|
||||
cfg.IntOpt('deploy_timeout',
|
||||
default=3600,
|
||||
help='max depolyment time(seconds) for the xcat driver'),
|
||||
cfg.IntOpt('deploy_checking_interval',
|
||||
default=30,
|
||||
help='interval time(seconds) to check the xcat deploy state'),
|
||||
]
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(pxe_opts, group='pxe')
|
||||
CONF.register_opts(xcat_opts, group='xcat')
|
||||
CONF.import_opt('use_ipv6', 'ironic.netconf')
|
||||
|
||||
REQUIRED_PROPERTIES = {
|
||||
'pxe_deploy_kernel': _("UUID (from Glance) of the deployment kernel. "
|
||||
"Required."),
|
||||
'pxe_deploy_ramdisk': _("UUID (from Glance) of the ramdisk that is "
|
||||
"mounted at boot time. Required."),
|
||||
}
|
||||
COMMON_PROPERTIES = REQUIRED_PROPERTIES
|
||||
EM_SEMAPHORE = 'xcat_pxe'
|
||||
|
||||
def _check_for_missing_params(info_dict, param_prefix=''):
|
||||
missing_info = []
|
||||
for label, value in info_dict.items():
|
||||
if not value:
|
||||
missing_info.append(param_prefix + label)
|
||||
|
||||
if missing_info:
|
||||
raise exception.InvalidParameterValue(_(
|
||||
"Can not validate PXE bootloader. The following parameters "
|
||||
"were not passed to ironic: %s") % missing_info)
|
||||
|
||||
def _parse_driver_info(node):
|
||||
"""Gets the driver specific Node deployment info.
|
||||
|
||||
This method validates whether the 'driver_info' property of the
|
||||
supplied node contains the required information for this driver to
|
||||
deploy images to the node.
|
||||
|
||||
:param node: a single Node.
|
||||
:returns: A dict with the driver_info values.
|
||||
"""
|
||||
info = node.driver_info
|
||||
d_info = {}
|
||||
d_info['xcat_node'] = info.get('xcat_node')
|
||||
return d_info
|
||||
|
||||
def _parse_instance_info(node):
|
||||
"""Gets the instance specific Node deployment info.
|
||||
|
||||
This method validates whether the 'instance_info' property of the
|
||||
supplied node contains the required information for this driver to
|
||||
deploy images to the node.
|
||||
|
||||
:param node: a single Node.
|
||||
:returns: A dict with the instance_info values.
|
||||
"""
|
||||
|
||||
info = node.instance_info
|
||||
i_info = {}
|
||||
i_info['image_source'] = info.get('image_source')
|
||||
i_info['root_gb'] = info.get('root_gb')
|
||||
i_info['image_file'] = i_info['image_source']
|
||||
|
||||
_check_for_missing_params(i_info)
|
||||
|
||||
# Internal use only
|
||||
i_info['deploy_key'] = info.get('deploy_key')
|
||||
|
||||
i_info['swap_mb'] = info.get('swap_mb', 0)
|
||||
i_info['ephemeral_gb'] = info.get('ephemeral_gb', 0)
|
||||
i_info['ephemeral_format'] = info.get('ephemeral_format')
|
||||
|
||||
err_msg_invalid = _("Can not validate PXE bootloader. Invalid parameter "
|
||||
"%(param)s. Reason: %(reason)s")
|
||||
for param in ('root_gb', 'swap_mb', 'ephemeral_gb'):
|
||||
try:
|
||||
int(i_info[param])
|
||||
except ValueError:
|
||||
reason = _("'%s' is not an integer value.") % i_info[param]
|
||||
raise exception.InvalidParameterValue(err_msg_invalid %
|
||||
{'param': param, 'reason': reason})
|
||||
|
||||
if i_info['ephemeral_gb'] and not i_info['ephemeral_format']:
|
||||
i_info['ephemeral_format'] = CONF.pxe.default_ephemeral_format
|
||||
|
||||
preserve_ephemeral = info.get('preserve_ephemeral', False)
|
||||
try:
|
||||
i_info['preserve_ephemeral'] = strutils.bool_from_string(
|
||||
preserve_ephemeral, strict=True)
|
||||
except ValueError as e:
|
||||
raise exception.InvalidParameterValue(err_msg_invalid %
|
||||
{'param': 'preserve_ephemeral', 'reason': e})
|
||||
return i_info
|
||||
|
||||
|
||||
def _parse_deploy_info(node):
|
||||
"""Gets the instance and driver specific Node deployment info.
|
||||
|
||||
This method validates whether the 'instance_info' and 'driver_info'
|
||||
property of the supplied node contains the required information for
|
||||
this driver to deploy images to the node.
|
||||
|
||||
:param node: a single Node.
|
||||
:returns: A dict with the instance_info and driver_info values.
|
||||
"""
|
||||
info = {}
|
||||
info.update(_parse_instance_info(node))
|
||||
info.update(_parse_driver_info(node))
|
||||
return info
|
||||
|
||||
def _validate_glance_image(ctx, deploy_info):
|
||||
"""Validate the image in Glance.
|
||||
|
||||
Check if the image exist in Glance and if it contains the
|
||||
'kernel_id' and 'ramdisk_id' properties.
|
||||
|
||||
:raises: InvalidParameterValue.
|
||||
"""
|
||||
image_id = deploy_info['image_source']
|
||||
if not image_id:
|
||||
raise exception.ImageNotFound
|
||||
|
||||
class PXEDeploy(base.DeployInterface):
|
||||
"""PXE Deploy Interface: just a stub until the real driver is ported."""
|
||||
def get_properties(self):
|
||||
return COMMON_PROPERTIES
|
||||
|
||||
def validate(self, task):
|
||||
"""Validate the deployment information for the task's node.
|
||||
|
||||
:param task: a TaskManager instance containing the node to act on.
|
||||
:raises: InvalidParameterValue.
|
||||
"""
|
||||
node = task.node
|
||||
if not driver_utils.get_node_mac_addresses(task):
|
||||
raise exception.InvalidParameterValue(_("Node %s does not have "
|
||||
"any port associated with it.") % node.uuid)
|
||||
|
||||
d_info = _parse_deploy_info(node)
|
||||
# Try to get the URL of the Ironic API
|
||||
try:
|
||||
# TODO(lucasagomes): Validate the format of the URL
|
||||
CONF.conductor.api_url or keystone.get_service_url()
|
||||
except (exception.CatalogFailure,
|
||||
exception.CatalogNotFound,
|
||||
exception.CatalogUnauthorized):
|
||||
raise exception.InvalidParameterValue(_(
|
||||
"Couldn't get the URL of the Ironic API service from the "
|
||||
"configuration file or keystone catalog."))
|
||||
|
||||
_validate_glance_image(task.context, d_info)
|
||||
|
||||
@task_manager.require_exclusive_lock
|
||||
def deploy(self, task):
|
||||
"""Start deployment of the task's node'.
|
||||
|
||||
Config host file and xcat dhcp, generate image info for xcat
|
||||
and issues a reboot request to the power driver.
|
||||
This causes the node to boot into the deployment ramdisk and triggers
|
||||
the next phase of PXE-based deployment via
|
||||
VendorPassthru._continue_deploy().
|
||||
|
||||
:param task: a TaskManager instance containing the node to act on.
|
||||
:returns: deploy state DEPLOYDONE.
|
||||
"""
|
||||
|
||||
d_info = _parse_deploy_info(task.node)
|
||||
if not task.node.instance_info.get('fixed_ip_address') or not task.node.instance_info.get('image_name'):
|
||||
raise exception.InvalidParameterValue
|
||||
self._config_host_file(d_info,task.node.instance_info.get('fixed_ip_address'))
|
||||
self._make_dhcp()
|
||||
self._nodeset_osimage(d_info,task.node.instance_info.get('image_name'))
|
||||
manager_utils.node_set_boot_device(task, 'pxe', persistent=True)
|
||||
manager_utils.node_power_action(task, states.REBOOT)
|
||||
try:
|
||||
self._wait_for_node_deploy(task)
|
||||
except xcat_exception.xCATDeploymentFailure:
|
||||
LOG.info(_("xcat deployment failed"))
|
||||
return states.ERROR
|
||||
|
||||
return states.DEPLOYDONE
|
||||
|
||||
@task_manager.require_exclusive_lock
|
||||
def tear_down(self, task):
|
||||
"""Tear down a previous deployment on the task's node.
|
||||
|
||||
Power off the node. All actual clean-up is done in the clean_up()
|
||||
method which should be called separately.
|
||||
|
||||
:param task: a TaskManager instance containing the node to act on.
|
||||
:returns: deploy state DELETED.
|
||||
"""
|
||||
manager_utils.node_power_action(task, states.POWER_OFF)
|
||||
return states.DELETED
|
||||
|
||||
def prepare(self, task):
|
||||
"""Prepare the deployment environment for this task's node.
|
||||
Get the image info from glance, config the mac for the xcat
|
||||
use ssh and iptables to disable dhcp on network node
|
||||
:param task: a TaskManager instance containing the node to act on.
|
||||
"""
|
||||
# TODO(deva): optimize this if rerun on existing files
|
||||
d_info = _parse_deploy_info(task.node)
|
||||
i_info = task.node.instance_info
|
||||
image_id = d_info['image_source']
|
||||
try:
|
||||
glance_service = service.Service(version=1, context=task.context)
|
||||
image_name = glance_service.show(image_id)['name']
|
||||
i_info['image_name'] = image_name
|
||||
except (exception.GlanceConnectionFailed,
|
||||
exception.ImageNotAuthorized,
|
||||
exception.Invalid):
|
||||
LOG.warning(_("Failed to connect to Glance to get the properties "
|
||||
"of the image %s") % image_id)
|
||||
|
||||
node_mac_addresses = driver_utils.get_node_mac_addresses(task)
|
||||
vif_ports_info = xcat_neutron.get_ports_info_from_neutron(task)
|
||||
try:
|
||||
network_info = self._get_deploy_network_info(vif_ports_info, node_mac_addresses)
|
||||
except (xcat_exception.GetNetworkFixedIPFailure,xcat_exception.GetNetworkIdFailure):
|
||||
LOG.error(_("Failed to get network info"))
|
||||
return
|
||||
if not network_info:
|
||||
LOG.error(_("Failed to get network info"))
|
||||
return
|
||||
|
||||
fixed_ip_address = network_info['fixed_ip_address']
|
||||
deploy_mac_address = network_info['mac_address']
|
||||
network_id = network_info['network_id']
|
||||
|
||||
i_info['fixed_ip_address'] = fixed_ip_address
|
||||
i_info['network_id'] = network_id
|
||||
i_info['deploy_mac_address'] = deploy_mac_address
|
||||
|
||||
# use iptables to drop the dhcp mac of baremetal machine
|
||||
self._ssh_append_dhcp_rule(CONF.xcat.network_node_ip,CONF.xcat.ssh_port,CONF.xcat.ssh_user,
|
||||
CONF.xcat.ssh_password,network_id,deploy_mac_address)
|
||||
self._chdef_node_mac_address(d_info,deploy_mac_address)
|
||||
|
||||
def clean_up(self, task):
|
||||
"""Clean up the deployment environment for the task's node.
|
||||
|
||||
Unlinks TFTP and instance images and triggers image cache cleanup.
|
||||
Removes the TFTP configuration files for this node. As a precaution,
|
||||
this method also ensures the keystone auth token file was removed.
|
||||
|
||||
:param task: a TaskManager instance containing the node to act on.
|
||||
"""
|
||||
pass
|
||||
|
||||
def take_over(self, task):
|
||||
pass
|
||||
|
||||
def _get_deploy_network_info(self, vif_ports_info, valid_node_mac_addrsses):
|
||||
"""Get network info from mac address of ironic node.
|
||||
:param vif_ports_info: info collection from neutron ports
|
||||
:param valid_node_mac_addrsses: mac address from ironic node
|
||||
:raises: GetNetworkFixedIpFailure if search the fixed ip from mac address failure
|
||||
:raises: GetNetworkIdFailure if search the network id from mac address failure
|
||||
"""
|
||||
network_info = {}
|
||||
for port_info in vif_ports_info.values():
|
||||
if(port_info['port']['mac_address'] in valid_node_mac_addrsses ):
|
||||
network_info['fixed_ip_address'] = port_info['port']['fixed_ips'][0]['ip_address']
|
||||
if not network_info['fixed_ip_address']:
|
||||
raise xcat_exception.GetNetworkFixedIPFailure(mac_address=port_info['port']['mac_address'])
|
||||
network_info['mac_address'] = port_info['port']['mac_address']
|
||||
network_info['network_id'] = port_info['port']['network_id']
|
||||
if not network_info['network_id']:
|
||||
raise xcat_exception.GetNetworkIdFailure(mac_address=port_info['port']['mac_address'])
|
||||
network_info['port_id'] = port_info['port']['id']
|
||||
return network_info
|
||||
return network_info
|
||||
|
||||
def _chdef_node_mac_address(self, driver_info, deploy_mac):
|
||||
""" run chdef command to set mac address"""
|
||||
cmd = 'chdef'
|
||||
args = 'mac='+ deploy_mac
|
||||
try:
|
||||
out_err = xcat_util.exec_xcatcmd(driver_info, cmd, args)
|
||||
LOG.info(_("xcat chdef cmd exetute output: %(out_err)s") % {'out_err':out_err})
|
||||
except xcat_exception.xCATCmdFailure as e:
|
||||
LOG.warning(_("xcat chdef failed for node %(xcat_node)s with "
|
||||
"error: %(error)s.")
|
||||
% {'xcat_node': driver_info['xcat_node'], 'error': e})
|
||||
raise exception.IPMIFailure(cmd=cmd)
|
||||
|
||||
@lockutils.synchronized(EM_SEMAPHORE, 'xcat-hosts-')
|
||||
def _config_host_file(self, driver_info, deploy_ip):
|
||||
""" append node and ip infomation to host file"""
|
||||
with open(CONF.xcat.host_filepath,"r+") as f:
|
||||
lines = []
|
||||
for line in f:
|
||||
temp = line.split('#')
|
||||
if temp[0].strip():
|
||||
host_name = xcat_util._tsplit(temp[0].strip(),(' ','\t'))[1]
|
||||
if driver_info['xcat_node'] not in host_name:
|
||||
lines.append(line)
|
||||
|
||||
# append a new line to host file
|
||||
line = "%s\t%s\n" %(deploy_ip,driver_info['xcat_node'])
|
||||
lines.append(line)
|
||||
f.seek(0)
|
||||
f.truncate()
|
||||
for line in lines:
|
||||
f.write(line)
|
||||
|
||||
def _nodeset_osimage(self, driver_info, image_name):
|
||||
"""run nodeset command to config the image for the xcat node
|
||||
:param driver_info: xcat node deploy info
|
||||
:param image_name: image for the xcat deployment
|
||||
"""
|
||||
cmd = 'nodeset'
|
||||
args = 'osimage='+ image_name
|
||||
try:
|
||||
xcat_util.exec_xcatcmd(driver_info, cmd, args)
|
||||
except xcat_exception.xCATCmdFailure as e:
|
||||
LOG.warning(_("xcat nodeset failed for node %(xcat_node)s with "
|
||||
"error: %(error)s.")
|
||||
% {'xcat_node': driver_info['xcat_node'], 'error': e})
|
||||
|
||||
def _make_dhcp(self):
|
||||
"""run makedhcp command to setup dhcp environment for the xcat node"""
|
||||
cmd = ['makedhcp',
|
||||
'-n'
|
||||
]
|
||||
try:
|
||||
out, err = utils.execute(*cmd)
|
||||
LOG.info(_(" excute cmd: %(cmd)s \n output: %(out)s \n. Error: %(err)s \n"),
|
||||
{'cmd':cmd,'out': out, 'err': err})
|
||||
except Exception as e:
|
||||
LOG.error(_("Unable to execute %(cmd)s. Exception: %(exception)s"),
|
||||
{'cmd': cmd, 'exception': e})
|
||||
# makedhcp -a
|
||||
cmd = ['makedhcp',
|
||||
'-a'
|
||||
]
|
||||
try:
|
||||
out, err = utils.execute(*cmd)
|
||||
LOG.info(_(" excute cmd: %(cmd)s \n output: %(out)s \n. Error: %(err)s \n"),
|
||||
{'cmd':cmd,'out': out, 'err': err})
|
||||
except Exception as e:
|
||||
LOG.error(_("Unable to execute %(cmd)s. Exception: %(exception)s"),
|
||||
{'cmd': cmd, 'exception': e})
|
||||
|
||||
def _ssh_append_dhcp_rule(self,ip,port,username,password,network_id,mac_address):
|
||||
""" drop the dhcp package in network node to avoid of confilct of dhcp """
|
||||
netns = 'qdhcp-%s' %network_id
|
||||
append_cmd = 'sudo ip netns exec %s iptables -A INPUT -m mac --mac-source %s -j DROP' % \
|
||||
(netns,mac_address)
|
||||
cmd = [append_cmd]
|
||||
xcat_util.xcat_ssh(ip,port,username,password,cmd)
|
||||
|
||||
def _ssh_delete_dhcp_rule(self,ip,port,username,password,network_id,mac_address):
|
||||
""" delete the iptable rule on network node to recover the environment"""
|
||||
netns = 'qdhcp-%s' %network_id
|
||||
cancel_cmd = 'sudo ip netns exec %s iptables -D INPUT -m mac --mac-source %s -j DROP' % \
|
||||
(netns,mac_address)
|
||||
cmd = [cancel_cmd]
|
||||
xcat_util.xcat_ssh(ip,port,username,password,cmd)
|
||||
|
||||
def _wait_for_node_deploy(self, task):
|
||||
"""Wait for xCAT node deployment to complete."""
|
||||
locals = {'errstr':''}
|
||||
driver_info = _parse_deploy_info(task.node)
|
||||
node_mac_addrsses = driver_utils.get_node_mac_addresses(task)
|
||||
i_info = task.node.instance_info
|
||||
|
||||
def _wait_for_deploy():
|
||||
out,err = xcat_util.exec_xcatcmd(driver_info,'nodels','nodelist.status')
|
||||
if err:
|
||||
locals['errstr'] = _("Error returned when quering node status"
|
||||
" for node %s:%s") % (driver_info['xcat_node'], err)
|
||||
LOG.warning(locals['errstr'])
|
||||
raise loopingcall.LoopingCallDone()
|
||||
|
||||
if out:
|
||||
node,status = out.split(": ")
|
||||
status = status.strip()
|
||||
if status == "booted":
|
||||
LOG.info(_("Deployment for node %s completed.")
|
||||
% driver_info['xcat_node'])
|
||||
raise loopingcall.LoopingCallDone()
|
||||
|
||||
if (CONF.xcat.deploy_timeout and
|
||||
timeutils.utcnow() > expiration):
|
||||
locals['errstr'] = _("Timeout while waiting for"
|
||||
" deployment of node %s.") % driver_info['xcat_node']
|
||||
LOG.warning(locals['errstr'])
|
||||
raise loopingcall.LoopingCallDone()
|
||||
|
||||
expiration = timeutils.utcnow() + datetime.timedelta(
|
||||
seconds=CONF.xcat.deploy_timeout)
|
||||
timer = loopingcall.FixedIntervalLoopingCall(_wait_for_deploy)
|
||||
# default check every 10 seconds
|
||||
timer.start(interval=CONF.xcat.deploy_checking_interval).wait()
|
||||
|
||||
if locals['errstr']:
|
||||
raise xcat_exception.xCATDeploymentFailure(locals['errstr'])
|
||||
# deploy end, delete the dhcp rule for xcat
|
||||
self._ssh_delete_dhcp_rule(CONF.xcat.network_node_ip,CONF.xcat.ssh_port,CONF.xcat.ssh_user,
|
||||
CONF.xcat.ssh_password,i_info['network_id'],node_mac_addrsses[0])
|
||||
|
||||
|
||||
@@ -0,0 +1,444 @@
|
||||
|
||||
"""
|
||||
IPMI power manager driver.
|
||||
"""
|
||||
|
||||
import contextlib
|
||||
import os
|
||||
import stat
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.common import states
|
||||
from ironic.common import utils
|
||||
from ironic.conductor import task_manager
|
||||
from ironic.drivers import base
|
||||
from ironic.drivers.modules import console_utils
|
||||
from ironic.openstack.common import excutils
|
||||
from ironic.openstack.common import log as logging
|
||||
from ironic.openstack.common import loopingcall
|
||||
from ironic.openstack.common import processutils
|
||||
from ironic.drivers.modules import xcat_exception
|
||||
from ironic.drivers.modules import xcat_util
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_opt('retry_timeout',
|
||||
'ironic.drivers.modules.ipminative',
|
||||
group='ipmi')
|
||||
CONF.import_opt('min_command_interval',
|
||||
'ironic.drivers.modules.ipminative',
|
||||
group='ipmi')
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
VALID_PRIV_LEVELS = ['ADMINISTRATOR', 'CALLBACK', 'OPERATOR', 'USER']
|
||||
REQUIRED_PROPERTIES = {
|
||||
'ipmi_address': _("IP address or hostname of the node. Required.")
|
||||
}
|
||||
OPTIONAL_PROPERTIES = {
|
||||
'ipmi_password': _("password. Optional."),
|
||||
'ipmi_priv_level': _("privilege level; default is ADMINISTRATOR. One of "
|
||||
"%s. Optional.") % ', '.join(VALID_PRIV_LEVELS),
|
||||
'ipmi_username': _("username; default is NULL user. Optional.")
|
||||
}
|
||||
COMMON_PROPERTIES = REQUIRED_PROPERTIES.copy()
|
||||
COMMON_PROPERTIES.update(OPTIONAL_PROPERTIES)
|
||||
CONSOLE_PROPERTIES = {
|
||||
'ipmi_terminal_port': _("node's UDP port to connect to. Only required for "
|
||||
"console access.")
|
||||
}
|
||||
TIMING_SUPPORT = None
|
||||
|
||||
|
||||
def _is_timing_supported(is_supported=None):
|
||||
# shim to allow module variable to be mocked in unit tests
|
||||
global TIMING_SUPPORT
|
||||
|
||||
if (TIMING_SUPPORT is None) and (is_supported is not None):
|
||||
TIMING_SUPPORT = is_supported
|
||||
return TIMING_SUPPORT
|
||||
|
||||
|
||||
def check_timing_support():
|
||||
"""Check the installed version of ipmitool for -N -R option support.
|
||||
|
||||
Support was added in 1.8.12 for the -N -R options, which enable
|
||||
more precise control over timing of ipmi packets. Prior to this,
|
||||
the default behavior was to retry each command up to 18 times at
|
||||
1 to 5 second intervals.
|
||||
http://ipmitool.cvs.sourceforge.net/viewvc/ipmitool/ipmitool/ChangeLog?revision=1.37 # noqa
|
||||
|
||||
This method updates the module-level TIMING_SUPPORT variable so that
|
||||
it is accessible by any driver interface class in this module. It is
|
||||
intended to be called from the __init__ method of such classes only.
|
||||
|
||||
:returns: boolean indicating whether support for -N -R is present
|
||||
:raises: OSError
|
||||
"""
|
||||
if _is_timing_supported() is None:
|
||||
# Directly check ipmitool for support of -N and -R options. Because
|
||||
# of the way ipmitool processes' command line options, if the local
|
||||
# ipmitool does not support setting the timing options, the command
|
||||
# below will fail.
|
||||
try:
|
||||
out, err = utils.execute(*['ipmitool', '-N', '0', '-R', '0', '-h'])
|
||||
except processutils.ProcessExecutionError:
|
||||
# the local ipmitool does not support the -N and -R options.
|
||||
_is_timing_supported(False)
|
||||
else:
|
||||
# looks like ipmitool supports timing options.
|
||||
_is_timing_supported(True)
|
||||
|
||||
|
||||
def _console_pwfile_path(uuid):
|
||||
"""Return the file path for storing the ipmi password for a console."""
|
||||
file_name = "%(uuid)s.pw" % {'uuid': uuid}
|
||||
return os.path.join(tempfile.gettempdir(), file_name)
|
||||
|
||||
def _parse_driver_info(node):
|
||||
"""Gets the parameters required for ipmitool to access the node.
|
||||
|
||||
:param node: the Node of interest.
|
||||
:returns: dictionary of parameters.
|
||||
:raises: InvalidParameterValue if any required parameters are missing.
|
||||
|
||||
"""
|
||||
info = node.driver_info or {}
|
||||
address = info.get('ipmi_address')
|
||||
username = info.get('ipmi_username')
|
||||
password = info.get('ipmi_password')
|
||||
port = info.get('ipmi_terminal_port')
|
||||
priv_level = info.get('ipmi_priv_level', 'ADMINISTRATOR')
|
||||
xcat_node = info.get('xcat_node')
|
||||
xcatmaster = info.get('xcatmaster')
|
||||
netboot = info.get('netboot')
|
||||
|
||||
if port:
|
||||
try:
|
||||
port = int(port)
|
||||
except ValueError:
|
||||
raise exception.InvalidParameterValue(_(
|
||||
"IPMI terminal port is not an integer."))
|
||||
|
||||
if not address:
|
||||
raise exception.InvalidParameterValue(_(
|
||||
"IPMI address not supplied to xcat driver."))
|
||||
|
||||
if priv_level not in VALID_PRIV_LEVELS:
|
||||
valid_priv_lvls = ', '.join(VALID_PRIV_LEVELS)
|
||||
raise exception.InvalidParameterValue(_(
|
||||
"Invalid privilege level value:%(priv_level)s, the valid value"
|
||||
" can be one of %(valid_levels)s") %
|
||||
{'priv_level': priv_level, 'valid_levels': valid_priv_lvls})
|
||||
|
||||
if not xcat_node:
|
||||
raise exception.InvalidParameterValue(_(
|
||||
"xcat node name not supplied to xcat driver"))
|
||||
|
||||
if not xcatmaster:
|
||||
raise exception.InvalidParameterValue(_(
|
||||
"xcatmaster not supplied to xcat driver"))
|
||||
|
||||
if not netboot:
|
||||
raise exception.InvalidParameterValue(_(
|
||||
"netboot not supplied to xcat driver"))
|
||||
|
||||
return {
|
||||
'address': address,
|
||||
'username': username,
|
||||
'password': password,
|
||||
'port': port,
|
||||
'uuid': node.uuid,
|
||||
'priv_level': priv_level,
|
||||
'xcat_node': xcat_node,
|
||||
'xcatmaster': xcatmaster,
|
||||
'netboot': netboot
|
||||
}
|
||||
def chdef_node(driver_info):
|
||||
"""Run the chdef command in xcat, config the node
|
||||
:param driver_info: driver_info for the xcat node
|
||||
"""
|
||||
cmd = 'chdef'
|
||||
args = 'mgt=ipmi' + \
|
||||
' bmc=' + driver_info['address'] + \
|
||||
' bmcusername=' + driver_info['username'] + \
|
||||
' bmcpassword=' + driver_info['password'] + \
|
||||
' xcatmaster=' + driver_info['xcatmaster']+ \
|
||||
' netboot=' + driver_info['netboot']+ \
|
||||
' primarynic=mac'+ \
|
||||
' installnic=mac'+ \
|
||||
' monserver=' + driver_info['xcatmaster'] + \
|
||||
' nfsserver=' + driver_info['xcatmaster'] + \
|
||||
' serialflow=hard'+ \
|
||||
' serialspeed=115200' + \
|
||||
' serialport=' + str(driver_info['port']);
|
||||
|
||||
try:
|
||||
xcat_util.exec_xcatcmd(driver_info, cmd, args)
|
||||
except xcat_exception.xCATCmdFailure as e:
|
||||
LOG.warning(_("xcat chdef failed for node %(node_id)s with "
|
||||
"error: %(error)s.")
|
||||
% {'node_id': driver_info['uuid'], 'error': e})
|
||||
|
||||
def _sleep_time(iter):
|
||||
"""Return the time-to-sleep for the n'th iteration of a retry loop.
|
||||
This implementation increases exponentially.
|
||||
|
||||
:param iter: iteration number
|
||||
:returns: number of seconds to sleep
|
||||
|
||||
"""
|
||||
if iter <= 1:
|
||||
return 1
|
||||
return iter ** 2
|
||||
|
||||
|
||||
def _set_and_wait(target_state, driver_info):
|
||||
"""Helper function for DynamicLoopingCall.
|
||||
|
||||
This method changes the power state and polls the BMCuntil the desired
|
||||
power state is reached, or CONF.ipmi.retry_timeout would be exceeded by the
|
||||
next iteration.
|
||||
|
||||
This method assumes the caller knows the current power state and does not
|
||||
check it prior to changing the power state. Most BMCs should be fine, but
|
||||
if a driver is concerned, the state should be checked prior to calling this
|
||||
method.
|
||||
|
||||
:param target_state: desired power state
|
||||
:param driver_info: the ipmitool parameters for accessing a node.
|
||||
:returns: one of ironic.common.states
|
||||
:raises: IPMIFailure on an error from ipmitool (from _power_status call).
|
||||
|
||||
"""
|
||||
if target_state == states.POWER_ON:
|
||||
state_name = "on"
|
||||
elif target_state == states.POWER_OFF:
|
||||
state_name = "off"
|
||||
|
||||
def _wait(mutable):
|
||||
try:
|
||||
# Only issue power change command once
|
||||
if mutable['iter'] < 0:
|
||||
xcat_util.exec_xcatcmd(driver_info,'rpower',state_name)
|
||||
else:
|
||||
mutable['power'] = _power_status(driver_info)
|
||||
except Exception:
|
||||
# Log failures but keep trying
|
||||
LOG.warning(_("xcat rpower %(state)s failed for node %(node)s."),
|
||||
{'state': state_name, 'node': driver_info['uuid']})
|
||||
finally:
|
||||
mutable['iter'] += 1
|
||||
|
||||
if mutable['power'] == target_state:
|
||||
raise loopingcall.LoopingCallDone()
|
||||
|
||||
sleep_time = _sleep_time(mutable['iter'])
|
||||
if (sleep_time + mutable['total_time']) > CONF.ipmi.retry_timeout:
|
||||
# Stop if the next loop would exceed maximum retry_timeout
|
||||
LOG.error(_('xcat rpower %(state)s timed out after '
|
||||
'%(tries)s retries on node %(node_id)s.'),
|
||||
{'state': state_name, 'tries': mutable['iter'],
|
||||
'node_id': driver_info['uuid']})
|
||||
mutable['power'] = states.ERROR
|
||||
raise loopingcall.LoopingCallDone()
|
||||
else:
|
||||
mutable['total_time'] += sleep_time
|
||||
return sleep_time
|
||||
|
||||
# Use mutable objects so the looped method can change them.
|
||||
# Start 'iter' from -1 so that the first two checks are one second apart.
|
||||
status = {'power': None, 'iter': -1, 'total_time': 0}
|
||||
|
||||
timer = loopingcall.DynamicLoopingCall(_wait, status)
|
||||
timer.start().wait()
|
||||
return status['power']
|
||||
|
||||
def _power_on(driver_info):
|
||||
"""Turn the power ON for this node.
|
||||
|
||||
:param driver_info: the xcat parameters for accessing a node.
|
||||
:returns: one of ironic.common.states POWER_ON or ERROR.
|
||||
:raises: IPMIFailure on an error from ipmitool (from _power_status call).
|
||||
|
||||
"""
|
||||
return _set_and_wait(states.POWER_ON, driver_info)
|
||||
|
||||
|
||||
def _power_off(driver_info):
|
||||
"""Turn the power OFF for this node.
|
||||
|
||||
:param driver_info: the xcat parameters for accessing a node.
|
||||
:returns: one of ironic.common.states POWER_OFF or ERROR.
|
||||
:raises: IPMIFailure on an error from ipmitool (from _power_status call).
|
||||
|
||||
"""
|
||||
return _set_and_wait(states.POWER_OFF, driver_info)
|
||||
|
||||
def _power_status(driver_info):
|
||||
"""Get the power status for a node.
|
||||
|
||||
:param driver_info: the xcat access parameters for a node.
|
||||
:returns: one of ironic.common.states POWER_OFF, POWER_ON or ERROR.
|
||||
:raises: IPMIFailure on an error from ipmitool.
|
||||
|
||||
"""
|
||||
cmd = "rpower"
|
||||
try:
|
||||
out_err = xcat_util.exec_xcatcmd(driver_info,cmd,'status')
|
||||
except Exception as e:
|
||||
LOG.warning(_("xcat rpower status failed for node %(node_id)s with "
|
||||
"error: %(error)s.")
|
||||
% {'node_id': driver_info['uuid'], 'error': e})
|
||||
|
||||
if out_err[0].split(' ')[1].strip() == "on":
|
||||
return states.POWER_ON
|
||||
elif out_err[0].split(' ')[1].strip() == "off":
|
||||
return states.POWER_OFF
|
||||
else:
|
||||
return states.ERROR
|
||||
|
||||
|
||||
class XcatPower(base.PowerInterface):
|
||||
|
||||
def __init__(self):
|
||||
try:
|
||||
check_timing_support()
|
||||
except OSError:
|
||||
raise exception.DriverLoadError(
|
||||
driver=self.__class__.__name__,
|
||||
reason="Unable to locate usable xcat command in "
|
||||
"the system path when checking xcat version")
|
||||
def get_properties(self):
|
||||
return COMMON_PROPERTIES
|
||||
|
||||
def validate(self, task):
|
||||
"""Validate driver_info for xcat driver.
|
||||
|
||||
Check that node['driver_info'] contains IPMI credentials.
|
||||
|
||||
:param task: a TaskManager instance containing the node to act on.
|
||||
:raises: InvalidParameterValue if required ipmi parameters are missing.
|
||||
|
||||
"""
|
||||
driver_info = _parse_driver_info(task.node)
|
||||
try:
|
||||
chdef_node(driver_info)
|
||||
except exception:
|
||||
LOG.error(_("chdef xcat info error!"))
|
||||
|
||||
def get_power_state(self, task):
|
||||
"""Get the current power state of the task's node.
|
||||
|
||||
:param task: a TaskManager instance containing the node to act on.
|
||||
:returns: one of ironic.common.states POWER_OFF, POWER_ON or ERROR.
|
||||
|
||||
"""
|
||||
driver_info = _parse_driver_info(task.node)
|
||||
return _power_status(driver_info)
|
||||
|
||||
@task_manager.require_exclusive_lock
|
||||
def set_power_state(self, task, pstate):
|
||||
"""Turn the power on or off.
|
||||
|
||||
:param task: a TaskManager instance containing the node to act on.
|
||||
:param pstate: The desired power state, one of ironic.common.states
|
||||
POWER_ON, POWER_OFF.
|
||||
:raises: InvalidParameterValue if required ipmi parameters are missing
|
||||
or if an invalid power state was specified.
|
||||
:raises: PowerStateFailure if the power couldn't be set to pstate.
|
||||
|
||||
"""
|
||||
driver_info = _parse_driver_info(task.node)
|
||||
|
||||
if pstate == states.POWER_ON:
|
||||
state = _power_on(driver_info)
|
||||
elif pstate == states.POWER_OFF:
|
||||
state = _power_off(driver_info)
|
||||
else:
|
||||
raise exception.InvalidParameterValue(_("set_power_state called "
|
||||
"with invalid power state %s.") % pstate)
|
||||
if state != pstate:
|
||||
raise exception.PowerStateFailure(pstate=pstate)
|
||||
|
||||
@task_manager.require_exclusive_lock
|
||||
def reboot(self, task):
|
||||
"""Cycles the power to the task's node.
|
||||
|
||||
:param task: a TaskManager instance containing the node to act on.
|
||||
:raises: InvalidParameterValue if required ipmi parameters are missing.
|
||||
:raises: PowerStateFailure if the final state of the node is not
|
||||
POWER_ON.
|
||||
|
||||
"""
|
||||
driver_info = _parse_driver_info(task.node)
|
||||
_power_off(driver_info)
|
||||
state = _power_on(driver_info)
|
||||
|
||||
if state != states.POWER_ON:
|
||||
raise exception.PowerStateFailure(pstate=states.POWER_ON)
|
||||
|
||||
class IPMIShellinaboxConsole(base.ConsoleInterface):
|
||||
"""A ConsoleInterface that uses ipmitool and shellinabox."""
|
||||
|
||||
def __init__(self):
|
||||
try:
|
||||
check_timing_support()
|
||||
except OSError:
|
||||
raise exception.DriverLoadError(
|
||||
driver=self.__class__.__name__,
|
||||
reason="Unable to locate usable xcat command in "
|
||||
"the system path when checking xcat version")
|
||||
def get_properties(self):
|
||||
return COMMON_PROPERTIES
|
||||
|
||||
def validate(self, task):
|
||||
"""Validate the Node console info.
|
||||
|
||||
:param task: a task from TaskManager.
|
||||
:raises: InvalidParameterValue
|
||||
"""
|
||||
driver_info = _parse_driver_info(task.node)
|
||||
if not driver_info['xcat_node']:
|
||||
raise exception.InvalidParameterValue(_(
|
||||
"xcat node name not supplied to xcat baremetal driver."))
|
||||
if not driver_info['port']:
|
||||
raise exception.InvalidParameterValue(_(
|
||||
"IPMI terminal port not supplied to IPMI driver."))
|
||||
|
||||
def start_console(self, task):
|
||||
"""Start a remote console for the node."""
|
||||
driver_info = _parse_driver_info(task.node)
|
||||
|
||||
path = _console_pwfile_path(driver_info['uuid'])
|
||||
pw_file = console_utils.make_persistent_password_file(
|
||||
path, driver_info['password'])
|
||||
|
||||
ipmi_cmd = "/:%(uid)s:%(gid)s:HOME:ipmitool -H %(address)s" \
|
||||
" -I lanplus -U %(user)s -f %(pwfile)s" \
|
||||
% {'uid': os.getuid(),
|
||||
'gid': os.getgid(),
|
||||
'address': driver_info['address'],
|
||||
'user': driver_info['username'],
|
||||
'pwfile': pw_file}
|
||||
if CONF.debug:
|
||||
ipmi_cmd += " -v"
|
||||
ipmi_cmd += " sol activate"
|
||||
console_utils.start_shellinabox_console(driver_info['uuid'],
|
||||
driver_info['port'],
|
||||
ipmi_cmd)
|
||||
|
||||
def stop_console(self, task):
|
||||
"""Stop the remote console session for the node."""
|
||||
driver_info = _parse_driver_info(task.node)
|
||||
console_utils.stop_shellinabox_console(driver_info['uuid'])
|
||||
utils.unlink_without_raise(_console_pwfile_path(driver_info['uuid']))
|
||||
|
||||
def get_console(self, task):
|
||||
"""Get the type and connection information about the console."""
|
||||
driver_info = _parse_driver_info(task.node)
|
||||
url = console_utils.get_shellinabox_console_url(driver_info['port'])
|
||||
return {'type': 'shellinabox', 'url': url}
|
||||
@@ -0,0 +1,110 @@
|
||||
"""
|
||||
util for xcat baremetal driver
|
||||
exec_xcatcmd
|
||||
xcat_ssh to excute remote cmd
|
||||
"""
|
||||
import paramiko
|
||||
import time
|
||||
import socket
|
||||
from ironic.openstack.common import log as logging
|
||||
from oslo.config import cfg
|
||||
from ironic.drivers.modules import xcat_exception
|
||||
from ironic.common import utils
|
||||
|
||||
xcat_opts = [
|
||||
cfg.IntOpt('ssh_session_timeout',
|
||||
default=10,
|
||||
help='ssh session time'),
|
||||
cfg.FloatOpt('ssh_shell_wait',
|
||||
default=0.5,
|
||||
help='wait time for the ssh cmd excute'),
|
||||
cfg.IntOpt('ssh_buf_size',
|
||||
default=65535,
|
||||
help='Maximum size (in charactor) of cache for ssh, '
|
||||
'including those in use'),
|
||||
cfg.StrOpt('ssh_key',
|
||||
default=None,
|
||||
help='ssh private key to login '),
|
||||
cfg.StrOpt('ssh_key_pass',
|
||||
default=None,
|
||||
help='Maximum size (in charactor) of cache for ssh, '
|
||||
'including those in use'),
|
||||
]
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(xcat_opts, group='xcat')
|
||||
|
||||
LAST_CMD_TIME = {}
|
||||
|
||||
def xcat_ssh(ip,port,username,password,cmd):
|
||||
""" exec remote command with ssh """
|
||||
key =None
|
||||
if CONF.xcat.ssh_key:
|
||||
try:
|
||||
key=paramiko.RSAKey.from_private_key_file(CONF.xcat.ssh_key)
|
||||
except paramiko.PasswordRequiredException:
|
||||
if not CONF.ssh_key_pass:
|
||||
raise Exception.message("no pubkey password")
|
||||
key = paramiko.RSAKey.from_private_key_file(
|
||||
CONF.xcat.ssh_key, CONF.xcat.ssh_key.ssh_key_pass)
|
||||
s = paramiko.SSHClient()
|
||||
s.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
try:
|
||||
s.connect(ip,port,username=username,password=password,pkey=key,
|
||||
timeout=CONF.xcat.ssh_session_timeout)
|
||||
except socket.timeout as e:
|
||||
LOG.error(_("Unable to connect to the ssh server Exception: %(exception)s"),
|
||||
{'exception': e})
|
||||
chan = s.invoke_shell()
|
||||
output = chan.recv(CONF.xcat.ssh_buf_size)
|
||||
while not output.rstrip().endswith('#') and not output.rstrip().endswith('$'):
|
||||
output = chan.recv(CONF.xcat.ssh_buf_size)
|
||||
for c in cmd :
|
||||
_xcat_ssh_exec(chan,c,password)
|
||||
|
||||
def _xcat_ssh_exec(chan,cmd,password):
|
||||
""" exec ssh command """
|
||||
chan.send(cmd + '\n')
|
||||
time.sleep(CONF.xcat.ssh_shell_wait)
|
||||
ret = chan.recv(CONF.xcat.ssh_buf_size)
|
||||
if 'password' in ret and ret.rstrip().endswith(':'):
|
||||
chan.send(password + '\n')
|
||||
output = chan.recv(CONF.xcat.ssh_buf_size)
|
||||
while not output.rstrip().endswith('#') and not output.rstrip().endswith('$'):
|
||||
output = chan.recv(CONF.xcat.ssh_buf_size)
|
||||
return output
|
||||
|
||||
def _tsplit(string, delimiters):
|
||||
""" Behaves str.split but supports multiple delimiters. """
|
||||
delimiters = tuple(delimiters)
|
||||
stack = [string,]
|
||||
for delimiter in delimiters:
|
||||
for i, substring in enumerate(stack):
|
||||
substack = substring.split(delimiter)
|
||||
stack.pop(i)
|
||||
for j, _substring in enumerate(substack):
|
||||
stack.insert(i+j, _substring)
|
||||
return stack
|
||||
|
||||
def exec_xcatcmd(driver_info, command, args):
|
||||
""" excute xcat cmd """
|
||||
cmd = [command,
|
||||
driver_info['xcat_node']
|
||||
]
|
||||
cmd.extend(args.split(" "))
|
||||
# NOTE: ensure that no communications are excuted more
|
||||
# often than once every min_command_interval seconds.
|
||||
time_till_next_poll = CONF.ipmi.min_command_interval - (
|
||||
time.time() - LAST_CMD_TIME.get(driver_info['xcat_node'], 0))
|
||||
if time_till_next_poll > 0:
|
||||
time.sleep(time_till_next_poll)
|
||||
try:
|
||||
out, err = utils.execute(*cmd)
|
||||
if err:
|
||||
raise xcat_exception.xCATCmdFailure(cmd=cmd,node=driver_info['xcat_node'],
|
||||
args=args)
|
||||
finally:
|
||||
LAST_CMD_TIME[driver_info['xcat_node']] = time.time()
|
||||
return out, err
|
||||
@@ -0,0 +1,27 @@
|
||||
"""
|
||||
XCATBaremetalDriver
|
||||
use xcat to deploy a baremetal machine
|
||||
"""
|
||||
|
||||
|
||||
from ironic.drivers import base
|
||||
from ironic.drivers.modules import ipmitool
|
||||
from ironic.drivers.modules import pxe
|
||||
from ironic.drivers.modules import xcat_pxe
|
||||
from ironic.drivers import utils
|
||||
from ironic.drivers.modules import xcat_rpower
|
||||
|
||||
|
||||
class XCATBaremetalDriver(base.BaseDriver):
|
||||
"""xCAT driver
|
||||
This driver implements the `core` functionality, combinding
|
||||
:class:`ironic.drivers.xcat_rpower.XcatPower` for power on/off and reboot with
|
||||
:class:`ironic.driver.xcat_pxe.PXEDeploy` for image deployment. Implementations are in
|
||||
those respective classes; this class is merely the glue between them.
|
||||
"""
|
||||
def __init__(self):
|
||||
self.power = xcat_rpower.XcatPower()
|
||||
self.console = ipmitool.IPMIShellinaboxConsole()
|
||||
self.deploy = xcat_pxe.PXEDeploy()
|
||||
self.management = ipmitool.IPMIManagement()
|
||||
self.vendor = pxe.VendorPassthru()
|
||||
@@ -0,0 +1,33 @@
|
||||
[DEFAULT]
|
||||
|
||||
# The list of modules to copy from oslo-incubator
|
||||
module=cliutils
|
||||
module=config.generator
|
||||
module=context
|
||||
module=db
|
||||
module=db.sqlalchemy
|
||||
module=db.sqlalchemy.migration_cli
|
||||
module=eventlet_backdoor
|
||||
module=excutils
|
||||
module=fileutils
|
||||
module=gettextutils
|
||||
module=importutils
|
||||
module=jsonutils
|
||||
module=local
|
||||
module=lockutils
|
||||
module=log
|
||||
module=loopingcall
|
||||
module=network_utils
|
||||
module=periodic_task
|
||||
module=policy
|
||||
module=processutils
|
||||
module=service
|
||||
module=strutils
|
||||
module=timeutils
|
||||
module=versionutils
|
||||
|
||||
# Tools
|
||||
|
||||
|
||||
# The base module to hold the copy of openstack.common
|
||||
base=ironic
|
||||
@@ -0,0 +1,51 @@
|
||||
[metadata]
|
||||
name = ironic
|
||||
version = 2014.2
|
||||
summary = OpenStack Bare Metal Provisioning
|
||||
description-file =
|
||||
README.rst
|
||||
author = chenglch
|
||||
author-email = chenglch@cn.ibm.com
|
||||
home-page = http://xcat.sf.net/
|
||||
classifier =
|
||||
Environment :: OpenStack
|
||||
Intended Audience :: Information Technology
|
||||
Intended Audience :: System Administrators
|
||||
License :: OSI Approved :: Apache Software License
|
||||
Operating System :: POSIX :: Linux
|
||||
Programming Language :: Python
|
||||
Programming Language :: Python :: 2
|
||||
Programming Language :: Python :: 2.7
|
||||
Programming Language :: Python :: 2.6
|
||||
|
||||
[files]
|
||||
packages =
|
||||
ironic
|
||||
|
||||
[entry_points]
|
||||
ironic.drivers =
|
||||
agent_ipmitool = ironic.drivers.agent:AgentAndIPMIToolDriver
|
||||
agent_pyghmi = ironic.drivers.agent:AgentAndIPMINativeDriver
|
||||
agent_ssh = ironic.drivers.agent:AgentAndSSHDriver
|
||||
fake = ironic.drivers.fake:FakeDriver
|
||||
fake_agent = ironic.drivers.fake:FakeAgentDriver
|
||||
fake_iboot = ironic.drivers.fake:FakeIBootDriver
|
||||
fake_ipminative = ironic.drivers.fake:FakeIPMINativeDriver
|
||||
fake_ipmitool = ironic.drivers.fake:FakeIPMIToolDriver
|
||||
fake_pxe = ironic.drivers.fake:FakePXEDriver
|
||||
fake_seamicro = ironic.drivers.fake:FakeSeaMicroDriver
|
||||
fake_ssh = ironic.drivers.fake:FakeSSHDriver
|
||||
ilo = ironic.drivers.ilo:IloDriver
|
||||
pxe_iboot = ironic.drivers.pxe:PXEAndIBootDriver
|
||||
pxe_ipminative = ironic.drivers.pxe:PXEAndIPMINativeDriver
|
||||
pxe_ipmitool = ironic.drivers.pxe:PXEAndIPMIToolDriver
|
||||
pxe_seamicro = ironic.drivers.pxe:PXEAndSeaMicroDriver
|
||||
pxe_ssh = ironic.drivers.pxe:PXEAndSSHDriver
|
||||
pxe_xcat = ironic.drivers.xcat:XCATBaremetalDriver
|
||||
|
||||
[pbr]
|
||||
autodoc_index_modules = True
|
||||
|
||||
[global]
|
||||
setup-hooks =
|
||||
pbr.hooks.setup_hook
|
||||
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed 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.
|
||||
|
||||
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
|
||||
import setuptools
|
||||
|
||||
# In python < 2.7.4, a lazy loading of package `pbr` will break
|
||||
# setuptools if some other modules registered functions in `atexit`.
|
||||
# solution from: http://bugs.python.org/issue15881#msg170215
|
||||
try:
|
||||
import multiprocessing # noqa
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['pbr'],
|
||||
pbr=True)
|
||||
@@ -0,0 +1,22 @@
|
||||
hacking>=0.8.0,<0.9
|
||||
coverage>=3.6
|
||||
discover
|
||||
fixtures>=0.3.14
|
||||
mock>=1.0
|
||||
Babel>=1.3
|
||||
MySQL-python
|
||||
psycopg2
|
||||
python-ironicclient
|
||||
python-subunit>=0.0.18
|
||||
testrepository>=0.0.18
|
||||
testtools>=0.9.34
|
||||
|
||||
# Doc requirements
|
||||
sphinx>=1.1.2,!=1.2.0,<1.3
|
||||
sphinxcontrib-pecanwsme>=0.8
|
||||
oslosphinx
|
||||
|
||||
# Required for Nova unit tests in ironic/nova/tests/ and can be removed
|
||||
# once the driver code lands in Nova.
|
||||
http://tarballs.openstack.org/nova/nova-master.tar.gz#egg=nova
|
||||
mox>=0.5.3
|
||||
@@ -89,7 +89,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%ifos linux
|
||||
if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image
|
||||
if [ -f $RPM_INSTALL_PREFIX0/sbin/xcatd ]; then
|
||||
/etc/init.d/xcatd reload
|
||||
/etc/init.d/xcatd restart
|
||||
fi
|
||||
fi
|
||||
%endif
|
||||
|
||||
@@ -40,7 +40,7 @@ my $hnmatch = $ARGV[0]; # if they specified a hostname match, only show svrs th
|
||||
readconf("$ENV{HOME}/.slconfig"); # get the userid and api key from the config file
|
||||
|
||||
my $slinstalled = eval { push @INC, $CONFIG{apidir}; require SoftLayer::API::SOAP; };
|
||||
if (!$slinstalled) { die "Error: the SoftLayer::API::SOAP perl module is not installed. Download it using 'git clone https://github.com/softlayer/softlayer-api-perl-client' and put the directory in ~/.slconfig ."; }
|
||||
if (!$slinstalled) { die "$@\nError: either the SoftLayer::API::SOAP perl module is not installed, or some dependencies are missing. Download it using 'git clone https://github.com/softlayer/softlayer-api-perl-client', put the directory in ~/.slconfig , and ensure its dependencies are installed."; }
|
||||
|
||||
my $client = SoftLayer::API::SOAP->new('SoftLayer_Account', undef, $CONFIG{userid}, $CONFIG{apikey});
|
||||
|
||||
|
||||
Executable
+88
@@ -0,0 +1,88 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# remove entries from the .ssh/known_hosts file for a node
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use Data::Dumper;
|
||||
#$Data::Dumper::Maxdepth=2;
|
||||
|
||||
# Globals - these are set once and then only read.
|
||||
my $HELP;
|
||||
my $VERBOSE;
|
||||
my $file = '~/.ssh/known_hosts';
|
||||
|
||||
my $usage = sub {
|
||||
my $exitcode = shift @_;
|
||||
print "Usage: khrem <node>\n";
|
||||
print " Removes the entries in the .ssh/known_hosts file associated with this node.\n";
|
||||
exit $exitcode;
|
||||
};
|
||||
|
||||
# Process the cmd line args
|
||||
Getopt::Long::Configure("bundling");
|
||||
#Getopt::Long::Configure("pass_through");
|
||||
Getopt::Long::Configure("no_pass_through");
|
||||
if (!GetOptions('h|?|help' => \$HELP, 'v|verbose' => \$VERBOSE)) { $usage->(1); }
|
||||
|
||||
if ($HELP) { $usage->(0); }
|
||||
if (scalar(@ARGV)!=1) { $usage->(1); }
|
||||
my $node = $ARGV[0]; # if they specified a hostname match, only show svrs that start with that
|
||||
|
||||
my @output = runcmd("host $node");
|
||||
my $hostname;
|
||||
my $line = shift @output;
|
||||
#print "line=$line\n";
|
||||
if ($line =~ m/is an alias for /) {
|
||||
($hostname) = $line =~ m/is an alias for ([^\.]+)/;
|
||||
#print "hostname=$hostname\n";
|
||||
$line = shift @output;
|
||||
}
|
||||
#print "line=$line\n";
|
||||
my ($ip) = $line =~ m/has address (.+)$/;
|
||||
if (defined($hostname)) {
|
||||
print "Removing entries from $file for: $node, $hostname, $ip\n";
|
||||
runcmd("sed -i '/^$node/d;/^$hostname/d;/^$ip/d' $file");
|
||||
}
|
||||
else {
|
||||
print "Removing entries from $file for: $node, $ip\n";
|
||||
runcmd("sed -i '/^$node/d;/^$ip/d' $file");
|
||||
}
|
||||
|
||||
exit(0);
|
||||
|
||||
|
||||
# Pring msg only if -v was specified
|
||||
sub verbose { if ($VERBOSE) { print shift, "\n"; } }
|
||||
|
||||
|
||||
|
||||
|
||||
# Run a command. If called in the context of return an array, it will capture the output
|
||||
# of the cmd and return it. Otherwise, it will display the output to stdout.
|
||||
# If the cmd has a non-zero rc, this function will die with a msg.
|
||||
sub runcmd
|
||||
{
|
||||
my ($cmd) = @_;
|
||||
my $rc;
|
||||
|
||||
$cmd .= ' 2>&1' ;
|
||||
verbose($cmd);
|
||||
|
||||
my @output;
|
||||
if (wantarray) {
|
||||
@output = `$cmd`;
|
||||
$rc = $?;
|
||||
}
|
||||
else {
|
||||
system($cmd);
|
||||
$rc = $?;
|
||||
}
|
||||
|
||||
if ($rc) {
|
||||
$rc = $rc >> 8;
|
||||
if ($rc > 0) { die "Error: rc $rc return from cmd: $cmd\n"; }
|
||||
else { die "Error: system error returned from cmd: $cmd\n"; }
|
||||
}
|
||||
elsif (wantarray) { return @output; }
|
||||
}
|
||||
@@ -12,13 +12,14 @@ use Socket;
|
||||
# Globals - these are set once and then only read.
|
||||
my $HELP;
|
||||
my $VERBOSE;
|
||||
my $DRYRUN;
|
||||
my $WAITTIME;
|
||||
my $PROVMETHOD;
|
||||
my $XCATNETBOOTTITLE = 'xCAT network boot kernel and initrd';
|
||||
|
||||
my $usage = sub {
|
||||
my $exitcode = shift @_;
|
||||
print "Usage: modifygrub [-?|-h|--help] [-v|--verbose] [-w <waittime>] [-p <provmethod] <kernel-path> <initrd-path> <kernel-parms> <mn-ip>\n\n";
|
||||
print "Usage: modifygrub [-?|-h|--help] [-v|--verbose] [--dryrun] [-w <waittime>] [-p <provmethod] <kernel-path> <initrd-path> <kernel-parms> <mn-ip>\n\n";
|
||||
if (!$exitcode) {
|
||||
print "Modify the grub config file on the node to boot the specified kernel and initrd.\n";
|
||||
}
|
||||
@@ -31,7 +32,7 @@ if (-f '/etc/os-release') { die "This script doesn't support ubuntu yet.\n"; }
|
||||
Getopt::Long::Configure("bundling");
|
||||
#Getopt::Long::Configure("pass_through");
|
||||
Getopt::Long::Configure("no_pass_through");
|
||||
if (!GetOptions('h|?|help' => \$HELP, 'v|verbose' => \$VERBOSE, 'w|waittime=s' => \$WAITTIME, 'p|provmethod=s' => \$PROVMETHOD)) { $usage->(1); }
|
||||
if (!GetOptions('h|?|help' => \$HELP, 'v|verbose' => \$VERBOSE, 'dryrun' => \$DRYRUN, 'w|waittime=s' => \$WAITTIME, 'p|provmethod=s' => \$PROVMETHOD)) { $usage->(1); }
|
||||
|
||||
if ($HELP) { $usage->(0); }
|
||||
if (scalar(@ARGV) != 4) { $usage->(1); }
|
||||
@@ -59,26 +60,53 @@ sub addKernelParms {
|
||||
# replace <nodename> with the nodename
|
||||
my $nodename = $ENV{NODE}; # this env var is set by xdsh
|
||||
$args->{kernelparms} =~ s/<nodename>/$nodename/g;
|
||||
|
||||
# get node ip and add it to the kernel parms
|
||||
my ($nic, $ip, $netmask, $network, $broadcast, $gateway, $mac) = getNodeIpInfo($args);
|
||||
if (!$ip) { die "Error: could not find the NIC that would connect to the xCAT mgmt node's IP (".$args->{mnip}.").\n"; }
|
||||
# if we are booting genesis, need to add the BOOTIF parm
|
||||
my $bootif;
|
||||
|
||||
#if (defined($PROVMETHOD) && $PROVMETHOD eq 'sysclone') {
|
||||
if ($args->{kernelpath} =~ m/genesis\.kernel\.x86_64/) {
|
||||
$bootif = $mac;
|
||||
# genesis case, add additional parms for sysclone or nodeset shell
|
||||
my $bootif = $mac;
|
||||
$bootif =~ s/:/-/g;
|
||||
$bootif = "BOOTIF=01-$bootif";
|
||||
}
|
||||
|
||||
if (defined($PROVMETHOD) && $PROVMETHOD eq 'sysclone') {
|
||||
# add additional parms for sysclone
|
||||
# DEVICE=eth0 IPADDR=10.0.0.99 NETMASK=255.255.255.0 NETWORK=10.0.0.0 BROADCAST=10.0.0.255 GATEWAY=10.0.0.1 GATEWAYDEV=eth0
|
||||
#todo: should we also add ETHER_SLEEP=$WAITTIME textmode=1 dns=$mnip ?
|
||||
$args->{kernelparms} .= " $bootif IPADDR=$ip NETMASK=$netmask NETWORK=$network BROADCAST=$broadcast GATEWAY=$gateway HOSTNAME=$nodename DEVICE=$nic GATEWAYDEV=$nic";
|
||||
}
|
||||
else { # scripted install or genesis shell
|
||||
$args->{kernelparms} .= " $bootif hostip=$ip netmask=$netmask gateway=$gateway dns=$mnip hostname=$nodename netdevice=$nic netwait=$WAITTIME textmode=1";
|
||||
else { # scripted install (kickstart or autoyast)
|
||||
if ($args->{kernelparms} =~ m/autoyast=/) { # sles
|
||||
# if site.managedaddressmode=static is set, it will put several of these kernel parms on there for us. Do not duplicate in that case.
|
||||
if ($args->{kernelparms} !~ m/ hostip=/) { $args->{kernelparms} .= " hostip=$ip"; }
|
||||
if ($args->{kernelparms} !~ m/ netmask=/) { $args->{kernelparms} .= " netmask=$netmask"; }
|
||||
if ($args->{kernelparms} !~ m/ gateway=/) { $args->{kernelparms} .= " gateway=$gateway"; }
|
||||
if ($args->{kernelparms} !~ m/ hostname=/) { $args->{kernelparms} .= " hostname=$nodename"; }
|
||||
if ($args->{kernelparms} !~ m/ dns=/) { $args->{kernelparms} .= " dns=$mnip"; }
|
||||
# If they set installnic=mac (recommended), the netdevice will already be set to the mac.
|
||||
# If they explicitly set installnic=<nic>, then ksdevice will be set to that and we will not disturb it here.
|
||||
# Otherwise add netdevice set to the nic we calculated it should be.
|
||||
if ($args->{kernelparms} !~ m/ netdevice=/) { $args->{kernelparms} .= " netdevice=$nic"; }
|
||||
$args->{kernelparms} .= " netwait=$WAITTIME textmode=1";
|
||||
# print Dumper($args->{kernelparms})
|
||||
}
|
||||
elsif ($args->{kernelparms} =~ m/ks=/) { # rhel/centos
|
||||
# See https://www.centos.org/docs/5/html/Installation_Guide-en-US/s1-kickstart2-startinginstall.html
|
||||
# and http://fedoraproject.org/wiki/Anaconda/NetworkIssues for description of kickstart kernel parms
|
||||
# if site.managedaddressmode=static is set, it will put several of these kernel parms on there for us. Do not duplicate in that case.
|
||||
if ($args->{kernelparms} !~ m/ ip=/) { $args->{kernelparms} .= " ip=$ip"; }
|
||||
if ($args->{kernelparms} !~ m/ netmask=/) { $args->{kernelparms} .= " netmask=$netmask"; }
|
||||
if ($args->{kernelparms} !~ m/ gateway=/) { $args->{kernelparms} .= " gateway=$gateway"; }
|
||||
if ($args->{kernelparms} !~ m/ hostname=/) { $args->{kernelparms} .= " hostname=$nodename"; }
|
||||
if ($args->{kernelparms} !~ m/ dns=/) { $args->{kernelparms} .= " dns=$mnip"; }
|
||||
# If they set installnic=mac (recommended), the ksdevice will already be set to the mac.
|
||||
# If they explicitly set installnic=<nic>, then ksdevice will be set to that and we will not disturb it here.
|
||||
# Otherwise ksdevice will be set to bootif, and we change it to the nic we calculated it should be.
|
||||
if ($args->{kernelparms} =~ m/ ksdevice=bootif/) { $args->{kernelparms} =~ s/ ksdevice=bootif/ ksdevice=$nic/; }
|
||||
elsif ($args->{kernelparms} !~ m/ ksdevice=/) { $args->{kernelparms} .= " ksdevice=$nic"; }
|
||||
$args->{kernelparms} .= " nicdelay=$WAITTIME linksleep=$WAITTIME textmode=1";
|
||||
# print Dumper($args->{kernelparms})
|
||||
}
|
||||
else { die "Error: for scripted installs, only support SLES or RHEL/CentOS as the target OS.\n"; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,11 +114,11 @@ sub addKernelParms {
|
||||
# get this nodes nic, ip, netmask, gateway, and mac. Returns them in a 5 element array.
|
||||
sub getNodeIpInfo {
|
||||
my $args = shift @_;
|
||||
my ($ipprefix) = $args->{mnip}=~m/^(\d+\.\d+)\./; #todo: this is a hack, just using the 1st 2 octets of the mn ip addr
|
||||
my ($ipprefix) = $args->{mnip}=~m/^(\d+)\./; #todo: this is a hack, just using the 1st octet of the mn ip addr
|
||||
verbose("using IP prefix $ipprefix");
|
||||
|
||||
# parse ip addr show output, looking for ipprefix, to determine nic and ip
|
||||
my @output = runcmd("ip addr show");
|
||||
# parse ip addr show output, looking for ipprefix, to determine nic, ip, mac
|
||||
my @output = runcmd("/sbin/ip addr show");
|
||||
my ($nic, $mac, $ipandmask);
|
||||
foreach my $line (@output) {
|
||||
my ($nictmp, $mactmp, $iptmp);
|
||||
@@ -98,25 +126,55 @@ sub getNodeIpInfo {
|
||||
if (($mactmp) = $line=~m|^\s+link/ether\s+(\S+) |) { $mac = $mactmp; } # got mac, remember it
|
||||
if (($iptmp) = $line=~m/^\s+inet\s+($ipprefix\S+) /) { $ipandmask = $iptmp; last; } # got ip, we are done
|
||||
}
|
||||
if (!defined($ipandmask)) { die "Error: can't find a NIC with a prefix $ipprefix that communicates with".$args->{mnip}.".\n"; }
|
||||
my ($ip, $netmask, $network, $broadcast) = convertIpAndMask($ipandmask);
|
||||
|
||||
# if the nic is a bonded nic (common on sl), then find the 1st real nic that is part of it
|
||||
my $realnic = $nic;
|
||||
# if the nic is a bonded nic (common on sl), then find the 1st real nic that is up that is part of it.
|
||||
# also find that real nics real mac
|
||||
my $realnic;
|
||||
if ($nic =~ /^bond/) {
|
||||
my @nics = grep(m/\s+master\s+$nic\s+/, @output);
|
||||
if (!scalar(@nics)) { die "Error: can't find the NICs that are part of $nic.\n"; }
|
||||
($realnic) = $nics[0]=~m/^\d+:\s+(\S+): /;
|
||||
# go back thru the ip add show output and find the mac of this nic
|
||||
foreach my $line (@output) {
|
||||
my ($nictmp, $mactmp, $foundnic);
|
||||
if (($nictmp) = $line=~m/^\d+:\s+(\S+): / && $nictmp eq $realnic) { $foundnic = 1; }
|
||||
if (($mactmp) = $line=~m|^\s+link/ether\s+(\S+) | && $foundnic) { $mac = $mactmp; last; } # got mac, we are done
|
||||
foreach my $line (@nics) {
|
||||
my ($nictmp, $state) = $line=~m/^\d+:\s+(\S+): .* state\s+(\S+)/;
|
||||
if (defined($nictmp) && defined($state) && $state eq 'UP') { $realnic = $nictmp; last; } # got ip, we are done
|
||||
}
|
||||
if (!defined($realnic)) { die "Error: can't find a physical NIC that is up and part of $nic.\n"; }
|
||||
|
||||
# now get the real mac of this real nic (when 2 nics are bonded, ip addr show displays one of the nics
|
||||
# macs for both nics and the bond). So we have to depend on /proc/net/bonding/$bond instead.
|
||||
my @bondout = runcmd("cat /proc/net/bonding/$nic");
|
||||
my $foundnic;
|
||||
foreach my $line (@bondout) {
|
||||
my $mactmp;
|
||||
if ($line=~m/^Slave Interface:\s+$realnic/) { $foundnic = 1; } # found the stanza for this nic, remember it
|
||||
if ($foundnic && (($mactmp) = $line=~m/^Permanent HW addr:\s+(\S+)/)) { $mac = $mactmp; last; }
|
||||
}
|
||||
}
|
||||
else { $realnic = $nic; }
|
||||
|
||||
# centos/redhat seems to name the nic in a different order than sles on some svrs.
|
||||
# sles seems to name them in the same order as 'ip addr show' displays them, centos does not.
|
||||
# so if we are on centos right now, we need to count down to determine the number that sles
|
||||
# will give the nic that we have selected, because it is the sles naming that we care about,
|
||||
# because that is the initrd that will be running in the scripted install case.
|
||||
# This works similarly (at least in some case) when rhel is the target OS.
|
||||
# The preferred way is for the user to set installnic=mac, then we do not need to run this code.
|
||||
# For the sysclone case, genesis doxcat uses the mac to find the nic.
|
||||
if (isRedhat() && $args->{kernelparms} !~ m/ ksdevice=\S*:/ && $args->{kernelparms} !~ m/ netdevice=\S*:/) {
|
||||
my @nics = grep(m/^\d+:\s+eth/, @output);
|
||||
my $i = 0;
|
||||
foreach my $line (@nics) {
|
||||
my ($nictmp) = $line=~m/^\d+:\s+(\S+):/;
|
||||
if (defined($nictmp) && $nictmp eq $realnic) { $realnic = "eth$i"; last; } # got ip, we are done
|
||||
$i++;
|
||||
}
|
||||
print "Determined that SLES/RHEL will call the install NIC $realnic (it has mac $mac)\n";
|
||||
}
|
||||
|
||||
# finally, find the gateway
|
||||
my $gateway;
|
||||
my @output = runcmd("ip route");
|
||||
my @output = runcmd("/sbin/ip route");
|
||||
# we are looking for a line like: 10.0.0.0/8 via 10.54.51.1 dev bond0
|
||||
my @networks = grep(m/ via .* $nic\s*$/, @output);
|
||||
if (scalar(@networks)) { ($gateway) = $networks[0]=~m/ via\s+(\S+)/; }
|
||||
@@ -197,6 +255,11 @@ sub updateGrub {
|
||||
"\tkernel " . $fileprefix . $args->{kernelpath} . ' ' . $args->{kernelparms} . "\n",
|
||||
"\tinitrd " . $fileprefix . $args->{initrdpath} . "\n",
|
||||
);
|
||||
if ($DRYRUN) {
|
||||
print "Dry run: would add this stanza to $grubfile:\n";
|
||||
foreach my $l (@entry) { print $l; }
|
||||
return;
|
||||
}
|
||||
|
||||
my $needtowritefile = 1;
|
||||
if (grep(/^title\s+$XCATNETBOOTTITLE/, @lines)) { $needtowritefile = updateGrubEntry(\@lines, \@entry); } # there is already an entry in there
|
||||
|
||||
+110
-23
@@ -4,7 +4,7 @@
|
||||
# even across vlans (w/o setting up pxe/dhcp broadcast relay). This assumes a working
|
||||
# OS is on the node. This script is primarily meant to be used in the softlayer environment.
|
||||
|
||||
#todo: site attr for using static ip?
|
||||
#todo: work with site.managedaddressmode=static for sles
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
@@ -13,17 +13,18 @@ use Data::Dumper;
|
||||
# Globals - these are set once and then only read.
|
||||
my $HELP;
|
||||
my $VERBOSE;
|
||||
my $DRYRUN;
|
||||
my $WAITTIME;
|
||||
my $NOAUTOINST;
|
||||
|
||||
my $usage = sub {
|
||||
my $exitcode = shift @_;
|
||||
print "Usage: pushinitrd [-?|-h|--help] [-v|--verbose] [-w <waittime>] <noderange>\n\n";
|
||||
print "Usage: pushinitrd [-?|-h|--help] [-v|--verbose] [--dryrun] [-w <waittime>] [--noautoinst] <noderange>\n\n";
|
||||
if (!$exitcode) {
|
||||
print "Copy the initrd, kernel, params, and static IP info to nodes, so they can net install\n";
|
||||
print "even across vlans (w/o setting up pxe/dhcp broadcast relay). This assumes a working\n";
|
||||
print "OS is on the node, that you've run nodeset for these nodes, and that all of the nodes\n";
|
||||
print "are using the same osimage.\n";
|
||||
print "in this noderange are using the same osimage.\n";
|
||||
}
|
||||
exit $exitcode;
|
||||
};
|
||||
@@ -32,7 +33,7 @@ my $usage = sub {
|
||||
Getopt::Long::Configure("bundling");
|
||||
#Getopt::Long::Configure("pass_through");
|
||||
Getopt::Long::Configure("no_pass_through");
|
||||
if (!GetOptions('h|?|help' => \$HELP, 'v|verbose' => \$VERBOSE, 'w|waittime=s' => \$WAITTIME, 'a|noautoinst' => \$NOAUTOINST)) { $usage->(1); }
|
||||
if (!GetOptions('h|?|help' => \$HELP, 'v|verbose' => \$VERBOSE, 'dryrun' => \$DRYRUN, 'w|waittime=s' => \$WAITTIME, 'a|noautoinst' => \$NOAUTOINST)) { $usage->(1); }
|
||||
|
||||
if ($HELP) { $usage->(0); }
|
||||
if (scalar(@ARGV) != 1) { $usage->(1); }
|
||||
@@ -45,12 +46,15 @@ copyFilesToNodes($noderange, \%bootparms);
|
||||
|
||||
updateGrubOnNodes($noderange, \%bootparms);
|
||||
|
||||
if ($bootparms{osimageprovmethod} eq 'install' && !$NOAUTOINST) { modifyAutoinstFiles($noderange, \%bootparms); }
|
||||
if ($DRYRUN) { exit(0); }
|
||||
|
||||
if ($bootparms{osimageprovmethod} eq 'install' && $bootparms{osimageosvers}=~ m/^sles/ && !$NOAUTOINST) { modifyAutoinstFiles($noderange, \%bootparms); }
|
||||
|
||||
if ($bootparms{osimageprovmethod} eq 'sysclone') { copySyscloneFiles(); }
|
||||
|
||||
exit(0);
|
||||
|
||||
sub isRedhat { return (-e '/etc/redhat-release' || -e '/etc/centos-release' || -e '/etc/fedora-release'); }
|
||||
|
||||
# Query the db for the kernel, initrd, and kcmdline attributes of the 1st node in the noderange
|
||||
sub getBootParms {
|
||||
@@ -66,15 +70,27 @@ sub getBootParms {
|
||||
# for now just pick the 1st one. They should all be the same, except for the node name in kcmdline
|
||||
chomp($gresults[0]);
|
||||
$gresults[0] =~ s/^\S+:\s+$attr:\s*//;
|
||||
#print "gresults='$gresults[0]'\n";
|
||||
if ($gresults[0] !~ m/\S/) { die "Error: attribute $attr not defined for the noderange. Did you run 'nodeset <noderange> osimage=<osimage>' ?\n"; }
|
||||
$bootparms{$a} = $gresults[0];
|
||||
}
|
||||
$bootparms{kcmdline} =~ s|/install/autoinst/\S+|/install/autoinst/<nodename>|;
|
||||
|
||||
# from the nodes provmethod, get the osimage provmethod, so we know the type of install
|
||||
@output = runcmd("lsdef -t osimage $bootparms{provmethod} -ci provmethod");
|
||||
chomp($output[0]);
|
||||
my ($junk, $provmethod) = split(/=/, $output[0]);
|
||||
$bootparms{osimageprovmethod} = $provmethod;
|
||||
@output = runcmd("lsdef -t osimage $bootparms{provmethod} -ci provmethod,osvers");
|
||||
foreach my $line (@output) {
|
||||
chomp($line);
|
||||
if ($line =~ m/^Could not find/) { die "Error: provmethod $bootparms{provmethod} is set for the node, but there is no osimage definition by that name."; }
|
||||
if ($line =~ m/ provmethod=/) {
|
||||
my ($junk, $provmethod) = split(/=/, $line);
|
||||
$bootparms{osimageprovmethod} = $provmethod;
|
||||
}
|
||||
if ($line =~ m/ osvers=/) {
|
||||
my ($junk, $osvers) = split(/=/, $line);
|
||||
$bootparms{osimageosvers} = $osvers;
|
||||
}
|
||||
}
|
||||
#print "provmethod=$bootparms{osimageprovmethod}, osvers=$bootparms{osimageosvers}\n"; exit;
|
||||
|
||||
# get the mgmt node cluster-facing ip addr
|
||||
@output = runcmd('lsdef -t site -ci master');
|
||||
@@ -97,8 +113,13 @@ sub copyFilesToNodes {
|
||||
my $localfile = "/tftpboot/$file";
|
||||
# for the
|
||||
my $remotefile = '/boot/' . remoteFilename($file);
|
||||
print "Copying $localfile to $nr:$remotefile\n";
|
||||
runcmd("xdcp $nr -p $localfile $remotefile");
|
||||
if ($DRYRUN) {
|
||||
print "Dry run: would copy $localfile to $nr:$remotefile\n";
|
||||
}
|
||||
else {
|
||||
print "Copying $localfile to $nr:$remotefile\n";
|
||||
runcmd("xdcp $nr -p $localfile $remotefile");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,10 +138,12 @@ sub updateGrubOnNodes {
|
||||
my $nr = shift @_;
|
||||
my $bootparms = shift @_;
|
||||
my $vtxt = ($VERBOSE ? '-v' : '');
|
||||
my $dtxt = ($DRYRUN ? '--dryrun' : '');
|
||||
my @output = runcmd('which modifygrub');
|
||||
my $modifygrub = $output[0];
|
||||
chomp($modifygrub);
|
||||
my $cmd = "xdsh $nr -e $modifygrub $vtxt -w $WAITTIME -p " . $bootparms->{osimageprovmethod} . ' ' . remoteFilename($bootparms->{kernel}) . ' ' . remoteFilename($bootparms->{initrd}) . ' ';
|
||||
my $euser ="root";
|
||||
my $cmd = "xdsh $nr -l $euser -e $modifygrub $vtxt $dtxt -w $WAITTIME -p " . $bootparms->{osimageprovmethod} . ' ' . remoteFilename($bootparms->{kernel}) . ' ' . remoteFilename($bootparms->{initrd}) . ' ';
|
||||
# we need to quote the kernel parms, both here when passing it to xdsh, and on the node
|
||||
# when xdsh is passing it to modifygrub. The way to get single quotes inside single quotes
|
||||
# is to quote each of the outer single quotes with double quotes.
|
||||
@@ -131,8 +154,7 @@ sub updateGrubOnNodes {
|
||||
}
|
||||
|
||||
|
||||
# Hack the autoinst files to wait in a key spot to make them work even tho it takes
|
||||
# the NICs almost a min before they can transmit after a state change.
|
||||
# Hack the autoinst files to overcome the nic coming up delay.
|
||||
#todo: this has only been tested with SLES nodes
|
||||
sub modifyAutoinstFiles {
|
||||
my $nr = shift @_;
|
||||
@@ -142,21 +164,28 @@ sub modifyAutoinstFiles {
|
||||
my @nodes = runcmd("nodels $nr");
|
||||
chomp(@nodes);
|
||||
|
||||
# Modify chroot.sles to insert a wait in the /etc/init.d/network of each node. This is
|
||||
# necessary because even tho compute.sles11.softlayer.tmpl configures bonding, when autoyast
|
||||
# reboots the node after installing the rpms, it does not bring up the network in the normal way
|
||||
# at first and seems to skip any bonding and the if-up.d scripts. So we are left doing this.
|
||||
# (After autoyast is done with all of its post-configuration, it brings up the network in the
|
||||
# normal way, so bonding gets done then, which is good at least.)
|
||||
|
||||
# Edit each file to have chroot.sles insert a wait at the end of /etc/init.d/network
|
||||
# this finds the end of boot.sh script (which is chroot.sles)
|
||||
my $search = '\n\]\]>\s*</source>\s*</script>\s*</chroot-scripts>';
|
||||
|
||||
# hack the /etc/init.d/network script to put a wait in it
|
||||
my $file = '/mnt/etc/init.d/network'; # at this point in the installation, the permanent file system is just mounted
|
||||
#my $waitstring = 'echo Sleeping for 55s;sleep 55';
|
||||
# this is the string to insert in the nodes /etc/init.d/network script. It is a while loop pinging the mn, but some of the chars need to be escaped for sed
|
||||
my $waitstring = 'echo -n Waiting to reach xCAT mgmt node ' . $bootparms->{mnip} . '.;xcatretries=60;while \[ \$\(\(xcati+=1\)\) -le \$xcatretries \] \&\& ! ping -c2 -w3 ' . $bootparms->{mnip} .' \>\/dev\/null 2\>\&1; do echo -n .; done; if \[ \$xcati -le \$xcatretries \]; then echo success; else echo failed; fi; sleep 3';
|
||||
my $waitstring = 'echo -n Waiting to reach xCAT mgmt node ' . $bootparms->{mnip} . '.;xcatretries=60;while \[ \$\(\(xcati+=1\)\) -le \$xcatretries \] \&\& ! ping -c2 -w3 ' . $bootparms->{mnip} .' \>\/dev\/null 2\>\&1; do echo -n .; done; if \[ \$xcati -le \$xcatretries \]; then echo success; else echo failed; fi';
|
||||
# this crazy sed string is from google. It gathers up the whole file into the hold buffer, and then the substitution is done on the whole file
|
||||
my $sedstring = q|sed -n '1h;1!H;${;g;s/\(\t\treload_firewall\n\)\n/\1\t\t| . $waitstring . q(\n\n/g;p;}') . " $file > $file.new";
|
||||
# finally create the perl replace string that will be used to modify the autoinst file
|
||||
my $replace = "$sedstring\nchmod 755 $file.new; mv -f $file.new $file";
|
||||
|
||||
# Now instead we add a script that gets invoked by the OS after the nic is brought up
|
||||
# Add a script that gets invoked by the OS after the nic is brought up
|
||||
# Note: this does not work, because midway thru the autoyast process, the if-up.d scripts do not seem to get invoked
|
||||
# so autoyast fails to get the media
|
||||
# these are specific to SLES
|
||||
#my $netdir = '/etc/sysconfig/network';
|
||||
#my $filename = '/etc/sysconfig/network/if-up.d/xcat-sl-wait';
|
||||
@@ -164,9 +193,6 @@ sub modifyAutoinstFiles {
|
||||
#todo: to support rhel, use these values instead
|
||||
#my $netdir='/etc/sysconfig/network-scripts';
|
||||
#my $filename='/sbin/ifup-local';
|
||||
|
||||
# this does not work, because midway thru the autoyast process, the if-up.d scripts do not seem to get invoked
|
||||
# so autoyast fails to get he media
|
||||
#my $replace = qq(
|
||||
#FILENAME=$filename
|
||||
#NETDIR=$netdir
|
||||
@@ -194,10 +220,14 @@ sub modifyAutoinstFiles {
|
||||
#chmod +x $FILENAME
|
||||
#);
|
||||
|
||||
# now actually update the file
|
||||
# The compute.sles11.softlayer.tmpl file contains 2 variables (node ip and netmask) that are
|
||||
# not replaced by Template.pm. Substitute those in the autoinst files now.
|
||||
# Also use our own multiline sed to put the network script hack in.
|
||||
print "Updating /install/autoinst files.\n";
|
||||
foreach my $n (@nodes) {
|
||||
my $f = "/install/autoinst/$n";
|
||||
my ($ip, $netmask, $gateway) = getNodeIpInfo($n);
|
||||
runcmd("sudo sed -i 's/#NODEIPADDR#/$ip/;s/#NODENETMASK#/$netmask/;s/#NODEGATEWAY#/$gateway/' $f");
|
||||
my $matches = sed($f, $search, $replace, mode=>'insertbefore');
|
||||
if (!$matches) { die "Error: could not find the right place in $f to insert the sed of the network wait.\n"; }
|
||||
}
|
||||
@@ -213,8 +243,65 @@ sub copySyscloneFiles {
|
||||
}
|
||||
|
||||
|
||||
# Get IP and network of a node
|
||||
sub getNodeIpInfo {
|
||||
my $node = shift;
|
||||
|
||||
# get ip for the node
|
||||
my @output = runcmd("nodels $node hosts.ip");
|
||||
chomp($output[0]);
|
||||
my ($junk, $ip) = split(/\s+/, $output[0]);
|
||||
#todo: also support getting the ip from name resolution
|
||||
if (!$ip) { die "Error: the ip attribute must be set for $node.\n"; }
|
||||
|
||||
# find relevant network in the networks table
|
||||
# first get the networks in a hash
|
||||
my %networks;
|
||||
@output = runcmd("lsdef -t network -ci net,mask,gateway");
|
||||
foreach my $line (@output) {
|
||||
chomp($line);
|
||||
my ($netname, $attr, $val) = $line =~ m/^(.+):\s+(.+?)=(.+)$/;
|
||||
$networks{$netname}->{$attr} = $val;
|
||||
}
|
||||
# now go thru the networks looking for the correct one
|
||||
my ($netmask, $gateway);
|
||||
foreach my $key (keys %networks) {
|
||||
if (isIPinNet($ip, $networks{$key}->{net}, $networks{$key}->{mask})) { # found it
|
||||
$netmask = $networks{$key}->{mask};
|
||||
$gateway = $networks{$key}->{gateway};
|
||||
last;
|
||||
}
|
||||
}
|
||||
if (!$netmask) { die "Error: could not find a network in the networks table that $node $ip is part of.\n"; }
|
||||
if (!$gateway) { die "Error: gateway not specified in the networks table for the network that $node $ip is part of.\n"; }
|
||||
|
||||
verbose("IP info for $node: ip=$ip, netmask=$netmask, gateway=$gateway");
|
||||
return ($ip, $netmask, $gateway);
|
||||
}
|
||||
|
||||
|
||||
# Is the IP in the network/netmask combo
|
||||
sub isIPinNet {
|
||||
my ($ip, $net, $mask) = @_;
|
||||
my $ipbin = convert2bin($ip);
|
||||
my $netbin = convert2bin($net);
|
||||
my $maskbin = convert2bin($mask);
|
||||
$ipbin &= $maskbin;
|
||||
if ($ipbin && $netbin && ($ipbin == $netbin)) { return 1; }
|
||||
else { return 0; }
|
||||
}
|
||||
|
||||
|
||||
# Convert dotted decimal format (1.2.3.4) to a binary number
|
||||
sub convert2bin {
|
||||
my @arr=split(/\./, shift);
|
||||
my ($bin) = unpack('N', pack('C4',@arr ) );
|
||||
return $bin;
|
||||
}
|
||||
|
||||
|
||||
# this is like multi-line sed replace function
|
||||
# Args: filename, search-string, replace-string
|
||||
# Args: filename, search-string, replace-string, options (mode=>{insertbefore,insertafter,replace})
|
||||
sub sed {
|
||||
my ($file, $search, $replace, %options) = @_;
|
||||
#my $opts = 's';
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# set the default route of the node to the ip address and nic passed in
|
||||
|
||||
set -x
|
||||
ip route replace to default via $1 dev $2
|
||||
@@ -67,7 +67,6 @@
|
||||
</user>
|
||||
</users>
|
||||
<networking>
|
||||
<keep_install_network config:type="boolean">true</keep_install_network>
|
||||
<dns>
|
||||
<domain>#TABLE:site:key=domain:value#</domain>
|
||||
<hostname>#TABLE:nodelist:$NODE:node#</hostname>
|
||||
@@ -78,10 +77,53 @@
|
||||
<search>#TABLE:site:key=domain:value#</search>
|
||||
</searchlist>
|
||||
</dns>
|
||||
<interfaces config:type="list">
|
||||
<interface>
|
||||
<bonding_master>yes</bonding_master>
|
||||
<bonding_module_opts>mode=4 miimon=100 downdelay=0 updelay=0 lacp_rate=fast xmit_hash_policy=1</bonding_module_opts>
|
||||
<bonding_slave0>eth0</bonding_slave0>
|
||||
<bonding_slave1>eth2</bonding_slave1>
|
||||
<device>bond0</device>
|
||||
<bootproto>static</bootproto>
|
||||
<startmode>auto</startmode>
|
||||
<ipaddr>#NODEIPADDR#</ipaddr>
|
||||
<netmask>#NODENETMASK#</netmask>
|
||||
<usercontrol>no</usercontrol>
|
||||
</interface>
|
||||
<interface>
|
||||
<bootproto>none</bootproto>
|
||||
<device>eth0</device>
|
||||
<name>Ethernet Card 0</name>
|
||||
<startmode>off</startmode>
|
||||
</interface>
|
||||
<interface>
|
||||
<bootproto>none</bootproto>
|
||||
<device>eth2</device>
|
||||
<name>Ethernet Card 2</name>
|
||||
<startmode>off</startmode>
|
||||
</interface>
|
||||
</interfaces>
|
||||
<routing>
|
||||
<ip_forward config:type="boolean">false</ip_forward>
|
||||
<routes config:type="list">
|
||||
<route>
|
||||
<destination>default</destination>
|
||||
<device>-</device>
|
||||
<gateway>#NODEGATEWAY#</gateway>
|
||||
<netmask>-</netmask>
|
||||
</route>
|
||||
</routes>
|
||||
</routing>
|
||||
</networking>
|
||||
<files config:type="list">
|
||||
<file>
|
||||
<file_contents><![CDATA[alias bond0 bonding
|
||||
]]></file_contents>
|
||||
<file_owner>root</file_owner>
|
||||
<file_path>/etc/modprobe.d/bond0.conf</file_path>
|
||||
<file_permissions>644</file_permissions>
|
||||
</file>
|
||||
</files>
|
||||
<scripts>
|
||||
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.sles#
|
||||
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/chroot.sles#
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Add a script that will run when the network is brought up to wait until the
|
||||
# xcat mn can be pinged.
|
||||
|
||||
. /tmp/post-install/variables.txt
|
||||
|
||||
if [ -d "/etc/sysconfig/network-scripts/" ];then
|
||||
#redhat
|
||||
NETDIR=/etc/sysconfig/network-scripts
|
||||
filename=/sbin/ifup-local
|
||||
elif [ -d "/etc/sysconfig/network/" ];then
|
||||
#suse
|
||||
NETDIR=/etc/sysconfig/network
|
||||
filename=/etc/sysconfig/network/if-up.d/xcat-sl-wait
|
||||
else
|
||||
#ubuntu
|
||||
echo "Does not support ubuntu."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create the wait script, overwriting a copy that may have come from the golden client
|
||||
# (in case the mn/image server is different).
|
||||
# this part of the file we want to expand the variables in the content
|
||||
cat >$filename << EOF1
|
||||
MNIP=$IMAGESERVER
|
||||
NETDIR=$NETDIR
|
||||
EOF1
|
||||
|
||||
# this part of the file we do NOT want to expand the variables in the content
|
||||
cat >>$filename << 'EOF2'
|
||||
NIC="$1"
|
||||
# look in this ifcfg script to get the nics ip to see if this is the one we should be waiting on
|
||||
NICIP=`awk -F= '/^IPADDR/ {print $2}' $NETDIR/ifcfg-$NIC | tr -d \' `
|
||||
if [ "${NICIP%.*.*}" != "${MNIP%.*.*}" ]; then exit; fi # hack: compare the 1st 2 octets
|
||||
echo -n Waiting to reach xCAT mgmt node $MNIP.
|
||||
xcatretries=60
|
||||
while [ $((xcati+=1)) -le $xcatretries ] && ! ping -c2 -w3 $MNIP >/dev/null 2>&1; do echo -n .; done
|
||||
if [ $xcati -le $xcatretries ]; then echo " success"; else echo " failed"; fi
|
||||
sleep 3
|
||||
EOF2
|
||||
|
||||
chmod +x $filename
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
#!/bin/bash
|
||||
|
||||
# SI post-install script to configure the efi boot mgr or grub after SI has installed the OS
|
||||
# SI post-install scripts run in a chroot environment of the final OS image
|
||||
|
||||
if [ -d /sys/firmware/efi ]; then
|
||||
echo "Setting Boot Manager for the next boot."
|
||||
echo "delete all sysclone boot list"
|
||||
str_bootnums=`efibootmgr | grep 'syscloneLinux' | awk '{print $1}' | sed 's/boot//i' | sed 's/*//'`
|
||||
for str_num in $str_bootnums
|
||||
do
|
||||
efibootmgr -b $str_num -B -q
|
||||
done
|
||||
|
||||
if [ -f "/boot/efi/EFI/redhat/grub.efi" ];then
|
||||
efibootmgr -c -l \\EFI\\redhat\\grub.efi -L syscloneLinux
|
||||
elif [ -f "/boot/efi/efi/SuSE/elilo.efi" ];then
|
||||
efibootmgr -c -l \\efi\\SuSE\\elilo.efi -L syscloneLinux
|
||||
else
|
||||
echo "Can not find the boot loader."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "run grub-install to configure the MBR."
|
||||
if [ -e /etc/mtab ];then
|
||||
mv /etc/mtab /etc/mtab.bak
|
||||
fi
|
||||
grep -v rootfs /proc/mounts > /etc/mtab
|
||||
boot_device=''
|
||||
if [ -f "/etc/systemconfig/systemconfig.conf" ];then
|
||||
boot_device=`cat /etc/systemconfig/systemconfig.conf | grep BOOTDEV | awk '{print $3}'`
|
||||
else
|
||||
boot_root=`mount | grep -E ' on\s+/ type ' | awk '{print $1}'`
|
||||
boot_device=`echo $boot_root | sed -e 's/[0-9]*$//'`
|
||||
|
||||
#str_temp=`mount | awk '{print $1","$3}'`
|
||||
#for line in $str_temp
|
||||
#do
|
||||
# mp=`echo $line | awk -F, '{print $2}'`
|
||||
# if [ "$mp" = "/" ];then
|
||||
# boot_device=`echo $line | awk -F, '{print $1}' | sed -e 's/[0-9]*$//'`
|
||||
# break
|
||||
# fi
|
||||
#done
|
||||
fi
|
||||
|
||||
if [ -n "$boot_device" ];then
|
||||
echo "The boot device is $boot_device"
|
||||
echo "The boot root device is $boot_root"
|
||||
else
|
||||
echo "Can not find the boot device, return error"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# set grub to use this boot device
|
||||
if grep -qe '^VERSION\s*=\s*11' /etc/SuSE-release; then
|
||||
#sles11, run grub-install.unsupported directly
|
||||
echo "grub-install.unsupported --no-floppy --recheck $boot_device"
|
||||
grub-install.unsupported --no-floppy --recheck $boot_device
|
||||
# note: the error about grub-set-default not existing is harmless, because we want the default to be 0 anyway
|
||||
else
|
||||
#for sles10, should run grub-install with parameters
|
||||
echo "grub-install --no-floppy --recheck $boot_device"
|
||||
grub-install --no-floppy --recheck $boot_device
|
||||
fi
|
||||
|
||||
# change the entries in the grub conf file to use the correct boot root device
|
||||
# (not the one leftover from the golden image)
|
||||
if [ -f "/boot/grub/grub.conf" ];then
|
||||
conffile="/boot/grub/grub.conf"
|
||||
else
|
||||
conffile="/boot/grub/menu.lst"
|
||||
fi
|
||||
sed -i 's| root=\S*| root='$boot_root'|' $conffile
|
||||
sed -i 's| resume=\S*| noresume|' $conffile
|
||||
|
||||
if [ -e /etc/mtab.bak ];then
|
||||
mv -f /etc/mtab.bak /etc/mtab
|
||||
else
|
||||
rm -f /etc/mtab
|
||||
fi
|
||||
fi
|
||||
@@ -1,9 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Configure network settings after SI has installed the OS
|
||||
# SI post-install script to configure network settings after SI has installed the OS
|
||||
# SI post-install scripts run in a chroot environment of the final OS image
|
||||
|
||||
. /tmp/post-install/variables.txt
|
||||
|
||||
bondingopts='mode=4 miimon=100 downdelay=0 updelay=0 lacp_rate=fast xmit_hash_policy=1'
|
||||
|
||||
# determine if we should be using a static ip or dhcp
|
||||
staticIP () {
|
||||
# Eventually we should use the SI variable IP_ASSIGNMENT_METHOD below to determine this.
|
||||
@@ -35,11 +38,23 @@ if [ -n "$rule_file" ];then
|
||||
fi
|
||||
|
||||
hostname $HOSTNAME
|
||||
bond=bond0
|
||||
# this is a softlayer assumption that the two devices on the private net will be eth0 and eth2
|
||||
if [[ $DEVICE == "eth0" ]]; then
|
||||
DEVICE2=eth2
|
||||
elif [[ $DEVICE == "eth2" ]]; then
|
||||
DEVICE2=eth0
|
||||
fi
|
||||
ip addr show|grep -q -E "^[0-9]+:\s+$DEVICE2:" # make sure it exists on the system
|
||||
if [[ $? == 0 ]]; then
|
||||
DEVICE2EXISTS="yes"
|
||||
fi
|
||||
|
||||
device_names=`ifconfig -a | grep -i hwaddr | grep -i 'Ethernet' | grep -v usb| awk '{print $1}'`
|
||||
str_cfg_file=''
|
||||
if [ -d "/etc/sysconfig/network-scripts/" ];then
|
||||
#redhat
|
||||
dir="/etc/sysconfig/network-scripts"
|
||||
grep -i HOSTNAME /etc/sysconfig/network
|
||||
if [ $? -eq 0 ];then
|
||||
sed -i "s/HOSTNAME=.*/HOSTNAME=$HOSTNAME/g" /etc/sysconfig/network
|
||||
@@ -47,21 +62,60 @@ if [ -d "/etc/sysconfig/network-scripts/" ];then
|
||||
echo "HOSTNAME=$HOSTNAME" >> /etc/sysconfig/network
|
||||
fi
|
||||
if staticIP; then
|
||||
# delete all nic cfg files left over from the golden node
|
||||
for i in $device_names;do
|
||||
rm -f "$dir/ifcfg-$i"
|
||||
done
|
||||
|
||||
# set static ip from variables in variables.txt
|
||||
i="$DEVICE"
|
||||
str_cfg_file="/etc/sysconfig/network-scripts/ifcfg-$i"
|
||||
# write ifcfg-bond0. For now we assume the installnic should be part of bond0,
|
||||
# because in SL i think that is always the case.
|
||||
i="$bond"
|
||||
str_cfg_file="$dir/ifcfg-$i"
|
||||
echo "DEVICE=$i" > $str_cfg_file
|
||||
echo "BOOTPROTO=static" >> $str_cfg_file
|
||||
echo "BOOTPROTO=none" >> $str_cfg_file
|
||||
echo "ONBOOT=yes" >> $str_cfg_file
|
||||
echo "USERCTL=no" >> $str_cfg_file
|
||||
echo 'BONDING_OPTS="'$bondingopts'"' >> $str_cfg_file
|
||||
echo "IPADDR=$IPADDR" >> $str_cfg_file
|
||||
echo "NETMASK=$NETMASK" >> $str_cfg_file
|
||||
echo "NETWORK=$NETWORK" >> $str_cfg_file
|
||||
echo "BROADCAST=$BROADCAST" >> $str_cfg_file
|
||||
#todo: add gateway config? Not sure, because the boot kernels gateway might not be the final OS gateway
|
||||
|
||||
# write ifcfg-eth0
|
||||
i="$DEVICE"
|
||||
str_cfg_file="$dir/ifcfg-$i"
|
||||
echo "DEVICE=$i" > $str_cfg_file
|
||||
echo "BOOTPROTO=none" >> $str_cfg_file
|
||||
echo "MASTER=$bond" >> $str_cfg_file
|
||||
echo "ONBOOT=yes" >> $str_cfg_file
|
||||
echo "SLAVE=yes" >> $str_cfg_file
|
||||
echo "USERCTL=no" >> $str_cfg_file
|
||||
|
||||
i="$DEVICE2"
|
||||
str_cfg_file="$dir/ifcfg-$i"
|
||||
if [[ $DEVICE2EXISTS == "yes" ]]; then
|
||||
# write ifcfg-eth2
|
||||
echo "DEVICE=$i" > $str_cfg_file
|
||||
echo "BOOTPROTO=none" >> $str_cfg_file
|
||||
echo "MASTER=$bond" >> $str_cfg_file
|
||||
echo "ONBOOT=yes" >> $str_cfg_file
|
||||
echo "SLAVE=yes" >> $str_cfg_file
|
||||
echo "USERCTL=no" >> $str_cfg_file
|
||||
else
|
||||
rm -f $str_cfg_file # in case it was left over in the image that was captured
|
||||
fi
|
||||
|
||||
# write modprobe alias config
|
||||
str_cfg_file="/etc/modprobe.d/$bond.conf"
|
||||
echo "alias $bond bonding" > $str_cfg_file
|
||||
|
||||
#todo: figure out how to set the default gateway in rhel
|
||||
else
|
||||
# use dhcp for all nics
|
||||
for i in $device_names;do
|
||||
str_cfg_file="/etc/sysconfig/network-scripts/ifcfg-$i"
|
||||
str_cfg_file="$dir/ifcfg-$i"
|
||||
echo "DEVICE=$i" > $str_cfg_file
|
||||
echo "BOOTPROTO=dhcp" >> $str_cfg_file
|
||||
echo "NM_CONTROLLED=yes" >> $str_cfg_file
|
||||
@@ -70,23 +124,77 @@ if [ -d "/etc/sysconfig/network-scripts/" ];then
|
||||
fi
|
||||
elif [ -d "/etc/sysconfig/network/" ];then
|
||||
#suse
|
||||
dir="/etc/sysconfig/network"
|
||||
echo "$HOSTNAME" > /etc/HOSTNAME
|
||||
if staticIP; then
|
||||
# delete all nic cfg files left over from the golden node
|
||||
for i in $device_names;do
|
||||
rm -f "$dir/ifcfg-$i"
|
||||
done
|
||||
|
||||
# set static ip from variables in variables.txt
|
||||
i="$DEVICE"
|
||||
str_cfg_file="/etc/sysconfig/network/ifcfg-$i"
|
||||
echo "DEVICE=$i" > $str_cfg_file
|
||||
echo "BOOTPROTO=static" >> $str_cfg_file
|
||||
# write ifcfg-bond0. For now we assume the installnic should be part of bond0,
|
||||
# because in SL i think that is always the case.
|
||||
i="$bond"
|
||||
str_cfg_file="$dir/ifcfg-$i"
|
||||
echo "BOOTPROTO=static" > $str_cfg_file
|
||||
echo "STARTMODE=onboot" >> $str_cfg_file
|
||||
echo "BONDING_MASTER=yes" >> $str_cfg_file
|
||||
echo "BONDING_MODULE_OPTS='$bondingopts'" >> $str_cfg_file
|
||||
echo "NAME='Bonded Interface'" >> $str_cfg_file
|
||||
echo "IPADDR=$IPADDR" >> $str_cfg_file
|
||||
echo "NETMASK=$NETMASK" >> $str_cfg_file
|
||||
echo "NETWORK=$NETWORK" >> $str_cfg_file
|
||||
echo "BROADCAST=$BROADCAST" >> $str_cfg_file
|
||||
echo "USERCONTROL=no" >> $str_cfg_file
|
||||
echo "BONDING_SLAVE_0=$DEVICE" >> $str_cfg_file
|
||||
if [[ $DEVICE2EXISTS == "yes" ]]; then
|
||||
echo "BONDING_SLAVE_1=$DEVICE2" >> $str_cfg_file
|
||||
fi
|
||||
|
||||
# write ifcfg-eth0
|
||||
i="$DEVICE"
|
||||
str_cfg_file="$dir/ifcfg-$i"
|
||||
echo "BOOTPROTO=none" > $str_cfg_file
|
||||
echo "STARTMODE=hotplug" >> $str_cfg_file
|
||||
|
||||
i="$DEVICE2"
|
||||
str_cfg_file="$dir/ifcfg-$i"
|
||||
if [[ $DEVICE2EXISTS == "yes" ]]; then
|
||||
# write ifcfg-eth2
|
||||
echo "BOOTPROTO=none" > $str_cfg_file
|
||||
echo "STARTMODE=hotplug" >> $str_cfg_file
|
||||
else
|
||||
rm -f $str_cfg_file # in case it was left over in the image that was captured
|
||||
fi
|
||||
|
||||
# write modprobe alias config
|
||||
str_cfg_file="/etc/modprobe.d/$bond.conf"
|
||||
echo "alias $bond bonding" > $str_cfg_file
|
||||
|
||||
# set the default gateway (at this point this is the private nic gateway, to handle provision across vlans)
|
||||
file=/etc/sysconfig/network/routes
|
||||
if grep -q -E '^default ' $file; then
|
||||
# replace the default route that is already in there
|
||||
sed -i 's/^default .*$/default '$GATEWAY' - -/' $file
|
||||
else
|
||||
# no default route yet, append to file
|
||||
echo "default $GATEWAY - -" >>$file
|
||||
fi
|
||||
|
||||
# this was the original config of the eth0 nic (without bonding)
|
||||
#echo "DEVICE=$i" > $str_cfg_file
|
||||
#echo "BOOTPROTO=static" >> $str_cfg_file
|
||||
#echo "STARTMODE=onboot" >> $str_cfg_file
|
||||
#echo "IPADDR=$IPADDR" >> $str_cfg_file
|
||||
#echo "NETMASK=$NETMASK" >> $str_cfg_file
|
||||
#echo "NETWORK=$NETWORK" >> $str_cfg_file
|
||||
#echo "BROADCAST=$BROADCAST" >> $str_cfg_file
|
||||
#todo: add gateway config? Not sure, because the boot kernels gateway might not be the final OS gateway
|
||||
else
|
||||
# use dhcp for all nics
|
||||
for i in $device_names;do
|
||||
str_cfg_file="/etc/sysconfig/network/ifcfg-$i"
|
||||
str_cfg_file="$dir/ifcfg-$i"
|
||||
echo "DEVICE=$i" > $str_cfg_file
|
||||
echo "BOOTPROTO=dhcp" >> $str_cfg_file
|
||||
echo "STARTMODE=onboot" >> $str_cfg_file
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
#Used only by sysclone
|
||||
|
||||
# This SI post-install script is needed because the initrd that autoyast/kickstart/ubuntu builds when installing
|
||||
# sles/rh/ubuntu on the golden node may not have the drivers when that initrd runs on the node that is
|
||||
# being deployed with this image (specifically, drivers to be able to mount the disk).
|
||||
# So rebuild the initrd on the to-node after putting the image on the disk, but before rebooting.
|
||||
|
||||
#todo: Make this script work on red hat by checking for dracut and using that if it exists.
|
||||
# And do whatever is necessary on ubuntu.
|
||||
|
||||
if [[ -f /sbin/dracut ]]; then
|
||||
# redhat/centos
|
||||
echo "Running dracut to regenerate the initrd with the drivers needed by this node:"
|
||||
dracut --force
|
||||
else
|
||||
# suse/sles
|
||||
echo "Running mkinitrd to regenerate the initrd with the drivers needed by this node:"
|
||||
mkinitrd
|
||||
fi
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
# SI post-install script, run after SI has installed the OS, to kill processes SI does not kill
|
||||
# (so /a can be umounted cleanly)
|
||||
# SI post-install scripts run in a chroot environment of the final OS image
|
||||
|
||||
if [ -f "/etc/SuSE-release" ];then
|
||||
str_out=`ps -ef | grep -v grep | grep syslog-ng`
|
||||
if [ $? -eq 0 ];then
|
||||
str_id=`echo $str_out | awk '{print $2}'`
|
||||
kill -9 $str_id
|
||||
fi
|
||||
fi
|
||||
|
||||
# SI starts klogd in the chroot, but does not kill it. Remove this line when SI fixes their bug.
|
||||
killall klogd
|
||||
|
||||
# flush all write buffers, just in case SI can not umount /a
|
||||
echo "Syncing file systems"
|
||||
sync
|
||||
|
||||
#todo: remove
|
||||
#echo "Processes still using /:"
|
||||
#fuser -v /
|
||||
#sleep 30
|
||||
@@ -17,6 +17,11 @@ BuildArch: noarch
|
||||
Requires: xCAT-server
|
||||
#Requires: xCAT-server >= %{epoch}:%(cat Version|cut -d. -f 1,2)
|
||||
|
||||
# perl-ExtUtils-MakeMaker, perl-CPAN, perl-Test-Harness are only available in rhel.
|
||||
# When this rpm supports being installed in sles, need to add these to xcat-dep.
|
||||
# perl-SOAP-Lite is already in xcat-dep
|
||||
Requires: perl-ExtUtils-MakeMaker perl-CPAN perl-Test-Harness perl-SOAP-Lite
|
||||
|
||||
Provides: xCAT-SoftLayer = %{epoch}:%{version}
|
||||
|
||||
%description
|
||||
@@ -43,7 +48,7 @@ xCAT-SoftLayer provides Utilities to make xCAT work in a SoftLayer environment.
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/bin
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/install
|
||||
mkdir -p $RPM_BUILD_ROOT/install/postscripts
|
||||
#mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-SoftLayer
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/man/man1
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/man1
|
||||
@@ -54,8 +59,8 @@ cp -p -R share/xcat/install/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/install/
|
||||
cp -d bin/* $RPM_BUILD_ROOT/%{prefix}/bin
|
||||
chmod 755 $RPM_BUILD_ROOT/%{prefix}/bin/*
|
||||
|
||||
cp -d postscripts/* $RPM_BUILD_ROOT/install/postscripts
|
||||
chmod 755 $RPM_BUILD_ROOT/install/postscripts/*
|
||||
#cp -d postscripts/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts
|
||||
#chmod 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts/*
|
||||
|
||||
cp -d si-post-install/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/post-install
|
||||
chmod 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/post-install/*
|
||||
@@ -75,4 +80,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%defattr(-,root,root)
|
||||
#%doc LICENSE.html
|
||||
%{prefix}
|
||||
/install/postscripts
|
||||
|
||||
%post
|
||||
# We are shipping the postscripts in a sysclone dir and then copying them to /install/postscripts here,
|
||||
# because we want to allow base xcat to eventually ship them and not conflict on the file name/path
|
||||
|
||||
@@ -101,15 +101,13 @@ ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/webportal
|
||||
# Inspect whether PHP related RPM packages are installed
|
||||
%ifos linux
|
||||
if [ -e "/etc/redhat-release" ]; then
|
||||
rpm -q php >/dev/null
|
||||
if [ $? != 0 ]; then
|
||||
if [ ! -e "/etc/httpd/conf.d/php.conf" ]; then
|
||||
echo ""
|
||||
echo "Error! php has not been installed. Please run 'yum install php' before installing xCAT-UI.";
|
||||
exit -1;
|
||||
fi
|
||||
else # SUSE
|
||||
rpm -q apache2-mod_php5 php5 >/dev/null
|
||||
if [ $? != 0 ]; then
|
||||
if [ ! -e "/etc/apache2/conf.d/php5.conf" ]; then
|
||||
echo ""
|
||||
echo "Error! apache2-mod_php5 and php5 have not been installed. Please run 'zypper install apache2-mod_php5 php5' before installing xCAT-UI."
|
||||
exit -1;
|
||||
|
||||
+265
-41
@@ -322,6 +322,7 @@ if (
|
||||
'k|kitversion=s' => \$::KITVERSION,
|
||||
'r|kitrelease=s' => \$::KITRELEASE,
|
||||
'l|kitloc=s' => \$::KITLOC,
|
||||
'for=s' => \$::FOROSVERSARCH,
|
||||
)
|
||||
)
|
||||
{
|
||||
@@ -337,18 +338,34 @@ if ($::HELP)
|
||||
}
|
||||
|
||||
my $debianflag = 0;
|
||||
my $dpkg_flag = '-uc -us';
|
||||
my $tempstring = xCAT::BuildKitUtils->osver();
|
||||
if ( $tempstring =~ /debian/ || $tempstring =~ /ubuntu/ ){
|
||||
$debianflag = 1;
|
||||
}
|
||||
|
||||
# This is an undocumented flag to support our local build team
|
||||
# to allow building Ubuntu kits on our RH build machines.
|
||||
# It requires RH rpms such as dep, fakeroot, perl-File-DesktopEntry,
|
||||
# perl-File-BaseDir, and html2text to be installed on the build server
|
||||
# for this to work. To use this flag:
|
||||
# buildkit --for ubuntu buildrepo <reponame>
|
||||
# buildkit --for ubuntu buildtar
|
||||
if ($::FOROSVERSARCH) {
|
||||
if ( $::FOROSVERSARCH =~ /debian/ || $::FOROSVERSARCH =~ /ubuntu/ ) {
|
||||
$debianflag=1;
|
||||
$dpkg_flag .= ' -A -d';
|
||||
}
|
||||
}
|
||||
|
||||
# display the version statement if -v or --version is specified
|
||||
if ($::VERSION)
|
||||
{
|
||||
my $versioncmd = "rpm -q --qf \"%{NAME}: %{VERSION}-%{RELEASE} \n\" xCAT-buildkit";
|
||||
my $message = "Error quering xCAT-buildkit rpm. Version info is not available. \n";
|
||||
if ( $debianflag ){
|
||||
$versioncmd = "dpkg-query --show -f='\${PackageSpec}: \${Version}\n' xcat-buildkit";
|
||||
|
||||
$versioncmd = "dpkg-query --show -f='\${binary:Package}: \${Version}\n' xcat-buildkit";
|
||||
$message = "Error quering xcat-buildkit package. Version info is not available. \n";
|
||||
}
|
||||
if ( system($versioncmd) ) {
|
||||
@@ -764,20 +781,21 @@ sub kit_buildrepo1
|
||||
}
|
||||
}
|
||||
|
||||
# Build kitcomponent metapackages
|
||||
# Build kitcomponent preppackages and metapackages
|
||||
if ( $debianflag ){
|
||||
foreach my $kc (@{$::bldkit_config->{kitcomponent}{entries}}) {
|
||||
if ($repoid ne $kc->{kitrepoid}) { next; }
|
||||
my $debname = "$repodir/".&comppkgname($kc);
|
||||
if (-r $debname) { next; }
|
||||
if ($::VERBOSE) { print "building kitcomponent metapackage for $kc->{basename} \n";}
|
||||
if ($::VERBOSE) { print "building kitcomponent package for $kc->{basename} \n";}
|
||||
if (&build_kitcomp_debian($kc)) {
|
||||
print "Error building kitcomponent metapackage for $kc->{basename} \n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if ( system("dpkg-scanpackages $repodir > $repodir/Packages") ) {
|
||||
print "Error building the repository meta-data with the dpkg-scanpackages command \n";
|
||||
|
||||
if ( system("cd $repodir;dpkg-scanpackages . > Packages") ) {
|
||||
print "Error building the repository meta-data with the dpkg-scanpackages command \n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -1005,7 +1023,7 @@ sub kit_buildtar
|
||||
}
|
||||
}
|
||||
|
||||
print "Creating tar file $tarfile.\n";
|
||||
print "Creating tar file $::current_dir/$kitfilename.\n";
|
||||
|
||||
if ( system("cd $::deploy_dir; cd ..; tar -cjhf $tarfile $kitname/*") ) {
|
||||
print "Error building tarfile $tarfile \n";
|
||||
@@ -1145,8 +1163,16 @@ sub edit_bldkitconf
|
||||
my ($osbasename,$osmore) = split(/\,/, $osinfo);
|
||||
my ($osmajorversion,$osminorversion) = split(/\./, $osmore);
|
||||
my $osarch=`uname -p`;
|
||||
chomp($osarch);
|
||||
my $kitcomponent_basename = $kitname."_compute";
|
||||
|
||||
if ($debianflag==1) {
|
||||
if($osarch eq "ppc64le"){
|
||||
$osarch="ppc64el";
|
||||
}
|
||||
$kitcomponent_basename = $kitname."-compute";
|
||||
}
|
||||
|
||||
for (@lines) {
|
||||
s/<<<INSERT_kitbasename_HERE>>>/$kitname/;
|
||||
s/<<<INSERT_kitrepoid_HERE>>>/$kitrepoid/;
|
||||
@@ -1865,6 +1891,12 @@ sub validate_os
|
||||
my ($osmajorversion,$osminorversion) = split(/\./, $osmore);
|
||||
my $osarch=`uname -p`;
|
||||
chomp($osarch);
|
||||
|
||||
if ($debianflag==1) {
|
||||
if($osarch eq "ppc64le"){
|
||||
$osarch="ppc64el";
|
||||
}
|
||||
}
|
||||
$osinfo =~ s/\,//;
|
||||
my $repo_osinfo = "$repo->{osbasename}$repo->{osmajorversion}";
|
||||
if (defined($repo->{osminorversion})){
|
||||
@@ -1969,7 +2001,7 @@ sub build_kitcomp
|
||||
$::VALID_PRER_COMPONENT = 0;
|
||||
|
||||
if ( !$::PREREQUISITE ) {
|
||||
if ( $comp->{ospkgdeps} || $comp->{preinstall} || $comp->{preupgrade} || $comp->{preuninstall} ) {
|
||||
if ( $comp->{ospkgdeps} || $comp->{preinstall} || $comp->{preupgrade} ) {
|
||||
if ( &gen_kitcomp_spec($comp,\%repo, 'PREREQUISITE') ) { return 1; }
|
||||
|
||||
# run the rpmbuild command
|
||||
@@ -2344,7 +2376,7 @@ sub gen_kitcomp_spec
|
||||
s/<<<INSERT_kitcomponent_postinstall_script_HERE>>>/$postscript/;
|
||||
s/<<<INSERT_kitcomponent_preupgrade_script_HERE>>>//;
|
||||
s/<<<INSERT_kitcomponent_postupgrade_script_HERE>>>/$postupscript/;
|
||||
s/<<<INSERT_kitcomponent_preuninstall_script_HERE>>>//;
|
||||
s/<<<INSERT_kitcomponent_preuninstall_script_HERE>>>/$preunscript/;
|
||||
s/<<<INSERT_kitcomponent_postuninstall_script_HERE>>>/$postunscript/;
|
||||
}
|
||||
}
|
||||
@@ -2407,14 +2439,45 @@ sub build_kitcomp_debian{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#run the dpkg-buildpackage command
|
||||
my $curdir = $::workdir;
|
||||
my $cmd = "rm -Rf $debbuilddir";
|
||||
system($cmd);
|
||||
mkpath($debbuilddir);
|
||||
|
||||
#Create debian directory for this kit component
|
||||
if ( &gen_kitcomp_debdir($comp,\%repo) ) { return 1; }
|
||||
$::VALID_PREP_COMPONENT = 0;
|
||||
|
||||
if ( !$::PREREQUISITE ) {
|
||||
if ( $comp->{ospkgdeps} || $comp->{preinstall} || $comp->{preupgrade} || $comp->{preuninstall} ) {
|
||||
|
||||
#Create debian directory for this kit component preppackage
|
||||
|
||||
if ( &gen_kitcomp_debdir_prep($comp,\%repo) ) { return 1; }
|
||||
$::VALID_PREP_COMPONENT = 1;
|
||||
# build prep deb
|
||||
my $prep_compversion = $comp->{version} . "-" . $comp->{release};
|
||||
my $prep_buildstring = "Prep Kit component build package.";
|
||||
my $prep_debbuilddir = $::workdir."/debbuild/"."prep-".$comp->{kitcompname};
|
||||
my $prep_debianbuildcmd = "cd $prep_debbuilddir;debchange -v $prep_compversion -b -c debian/changelog $prep_buildstring;dpkg-buildpackage $dpkg_flag";
|
||||
|
||||
if ( system($prep_debianbuildcmd) ) {
|
||||
print "Error running \"dpkg-buildpackage $dpkg_flag\" command for kit component prep-$comp->{kitcompname} meta package\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
#Create debian directory for this kit component metapackage
|
||||
|
||||
if ( &gen_kitcomp_debdir($comp,\%repo,'METADEB') ) { return 1; }
|
||||
|
||||
} else {
|
||||
#Create debian directory for this kit component
|
||||
|
||||
if ( &gen_kitcomp_debdir($comp,\%repo,'ALL') ) { return 1; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (defined($comp->{non_native_pkgs}) ) {
|
||||
my $sourcedir = $::workdir."/source_packages";
|
||||
@@ -2436,11 +2499,11 @@ sub build_kitcomp_debian{
|
||||
}
|
||||
}
|
||||
my $compversion = $comp->{version} . "-" . $comp->{release};
|
||||
my $buildstring = "Kit component build package.";
|
||||
my $debianbuildcmd = "cd $debbuilddir;dch -v $compversion -b -c debian/changelog $buildstring;dpkg-buildpackage -uc -us";
|
||||
my $buildstring = "\'Kit component build package.\'";
|
||||
my $debianbuildcmd = "cd $debbuilddir;debchange -v $compversion -b -c debian/changelog $buildstring;dpkg-buildpackage $dpkg_flag";
|
||||
if ( !$::NON_NATIVE_PKGS->{$comp->{kitcompname}} ) {
|
||||
if ( system($debianbuildcmd) ) {
|
||||
print "Error running \"dpkg-buildpackage -uc -us\" command for kit component $comp->{kitcompname} meta package\n";
|
||||
print "Error running \"dpkg-buildpackage $dpkg_flag\" command for kit component $comp->{kitcompname} meta package\n";
|
||||
return 1;
|
||||
}
|
||||
my $repodir = $::base_repodir."/".$repo{kitreponame};
|
||||
@@ -2456,6 +2519,99 @@ sub build_kitcomp_debian{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 gen_kitcomp_debdir_prep
|
||||
|
||||
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub gen_kitcomp_debdir_prep{
|
||||
my $comp = shift;
|
||||
my $repo = shift;
|
||||
my $scriptdir = $::workdir."/scripts/";
|
||||
my $combuilddir = $::workdir."/debbuild/"."prep-".$comp->{kitcompname};
|
||||
|
||||
#copy the debian dir template to the build path
|
||||
mkpath("$combuilddir/debian");
|
||||
my $cmd = "cp -Rf " . $::XCATSHARE . "/kits/debian_template/* $combuilddir/debian/";
|
||||
system($cmd);
|
||||
|
||||
my $kitname = $::bldkit_config->{kit}{entries}[0]->{basename};
|
||||
my $kitcompname = "prep-".$comp->{kitcompname};
|
||||
my $upgradeflag = "pre-".$comp->{basename} . ".tmp";
|
||||
|
||||
my ($prescript,$postscript,$preupscript,$postupscript,$preunscript,$postunscript,$nonnativepkgs) = '';
|
||||
if (defined($comp->{preinstall})) {
|
||||
$prescript = &load_script("$scriptdir$comp->{preinstall}");
|
||||
}
|
||||
if (defined($comp->{preupgrade})) {
|
||||
$preupscript = &load_script("$scriptdir$comp->{preupgrade}");
|
||||
}
|
||||
if (defined($comp->{preuninstall})) {
|
||||
$preunscript = &load_script("$scriptdir$comp->{preuninstall}");
|
||||
}
|
||||
|
||||
#replace all special sub string in all files under debian
|
||||
unless (opendir(DH, "${combuilddir}/debian/")){
|
||||
print "Can not open the xCAT Kit Component debian dir: ${combuilddir}/debian/";
|
||||
return 1;
|
||||
}
|
||||
|
||||
foreach (readdir(DH)){
|
||||
my $file = "${combuilddir}/debian/$_";
|
||||
if ( -d $file){
|
||||
next;
|
||||
}
|
||||
|
||||
unless ( open ( FH, "<", $file )){
|
||||
print "Error attempting to open the xCAT Kit Component ${kitcompname}'s debian template file $file.\n";
|
||||
close(DH);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ($::VERBOSE){
|
||||
print "Reading the xCAT Kit Component ${kitcompname}'s debian template file $file. \n";
|
||||
}
|
||||
my @lines = <FH>;
|
||||
close(FH);
|
||||
my $prep_comp_name="prep-".$comp->{basename};
|
||||
for(@lines) {
|
||||
chomp;
|
||||
s/<<<INSERT_kitcomponent_basename_HERE>>>/$prep_comp_name/;
|
||||
s/<<<INSERT_kitcomponent_ospkgdeps_HERE>>>/$comp->{ospkgdeps}/;
|
||||
s/<<<INSERT_kitcomponent_kitpkgdeps_HERE>>>//;
|
||||
s/<<<INSERT_kitcomponent_kitcompdeps_HERE>>>//;
|
||||
s/<<<INSERT_kitcomponent_desc_HERE>>>/$comp->{description}/;
|
||||
s/<<<INSERT_kitcomponent_upgrade_flag_HERE>>>/$upgradeflag/;
|
||||
s/<<<INSERT_kitcomponent_preinstall_script_HERE>>>/$prescript/;
|
||||
s/<<<INSERT_kitcomponent_postinstall_script_HERE>>>//;
|
||||
s/<<<INSERT_kitcomponent_preupgrade_script_HERE>>>/$preupscript/;
|
||||
s/<<<INSERT_kitcomponent_postupgrade_script_HERE>>>//;
|
||||
s/<<<INSERT_kitcomponent_preuninstall_script_HERE>>>/$preunscript/;
|
||||
s/<<<INSERT_kitcomponent_postuninstall_script_HERE>>>//;
|
||||
|
||||
}
|
||||
my $joined_lines = join("\n", @lines);
|
||||
@lines = split(/\\n/,$joined_lines);
|
||||
|
||||
open (FH, ">", $file);
|
||||
if ($::VERBOSE){
|
||||
print "Created kitcomponent ${kitcompname}'s build file under debian dir $file";
|
||||
}
|
||||
print FH @lines;
|
||||
close(FH);
|
||||
}
|
||||
closedir(DH);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 gen_kitcomp_debdir
|
||||
@@ -2468,6 +2624,7 @@ sub build_kitcomp_debian{
|
||||
sub gen_kitcomp_debdir{
|
||||
my $comp = shift;
|
||||
my $repo = shift;
|
||||
my $level = shift;
|
||||
my $scriptdir = $::workdir."/scripts/";
|
||||
my $combuilddir = $::workdir."/debbuild/".$comp->{kitcompname};
|
||||
|
||||
@@ -2481,29 +2638,38 @@ sub gen_kitcomp_debdir{
|
||||
my $upgradeflag = $comp->{basename} . ".tmp";
|
||||
|
||||
my ($prescript,$postscript,$preupscript,$postupscript,$preunscript,$postunscript,$nonnativepkgs) = '';
|
||||
if (defined($comp->{preinstall})) {
|
||||
$prescript = &load_script("$scriptdir$comp->{preinstall}");
|
||||
}
|
||||
if (defined($comp->{postinstall})) {
|
||||
$postscript = &load_script("$scriptdir$comp->{postinstall}");
|
||||
}
|
||||
if (defined($comp->{preupgrade})) {
|
||||
$preupscript = &load_script("$scriptdir$comp->{preupgrade}");
|
||||
}
|
||||
if (defined($comp->{postupgrade})) {
|
||||
$postupscript = &load_script("$scriptdir$comp->{postupgrade}");
|
||||
}
|
||||
if (defined($comp->{preuninstall})) {
|
||||
$preunscript = &load_script("$scriptdir$comp->{preuninstall}");
|
||||
}
|
||||
if (defined($comp->{postuninstall})) {
|
||||
$postunscript = &load_script("$scriptdir$comp->{postuninstall}");
|
||||
}
|
||||
if (defined($comp->{non_native_pkgs})) {
|
||||
$nonnativepkgs = "\n";
|
||||
$nonnativepkgs .= "mkdir -p \$RPM_BUILD_ROOT/opt/xcat/kits/$kitname/$kitcompname \n";
|
||||
$nonnativepkgs .= "cp -a * \$RPM_BUILD_ROOT/opt/xcat/kits/$kitname/$kitcompname \n";
|
||||
|
||||
if ($level eq 'METADEB' || $level eq 'ALL')
|
||||
{
|
||||
if (defined($comp->{postinstall})) {
|
||||
$postscript = &load_script("$scriptdir$comp->{postinstall}");
|
||||
}
|
||||
|
||||
if (defined($comp->{postupgrade})) {
|
||||
$postupscript = &load_script("$scriptdir$comp->{postupgrade}");
|
||||
}
|
||||
if (defined($comp->{postuninstall})) {
|
||||
$postunscript = &load_script("$scriptdir$comp->{postuninstall}");
|
||||
}
|
||||
if (defined($comp->{non_native_pkgs})) {
|
||||
$nonnativepkgs = "\n";
|
||||
$nonnativepkgs .= "mkdir -p \$RPM_BUILD_ROOT/opt/xcat/kits/$kitname/$kitcompname \n";
|
||||
$nonnativepkgs .= "cp -a * \$RPM_BUILD_ROOT/opt/xcat/kits/$kitname/$kitcompname \n";
|
||||
}
|
||||
}
|
||||
if ($level eq 'ALL')
|
||||
{
|
||||
if (defined($comp->{preinstall})) {
|
||||
$prescript = &load_script("$scriptdir$comp->{preinstall}");
|
||||
}
|
||||
if (defined($comp->{preupgrade})) {
|
||||
$preupscript = &load_script("$scriptdir$comp->{preupgrade}");
|
||||
}
|
||||
if (defined($comp->{preuninstall})) {
|
||||
$preunscript = &load_script("$scriptdir$comp->{preuninstall}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#replace all special sub string in all files under debian
|
||||
unless (opendir(DH, "${combuilddir}/debian/")){
|
||||
@@ -2528,12 +2694,20 @@ sub gen_kitcomp_debdir{
|
||||
}
|
||||
my @lines = <FH>;
|
||||
close(FH);
|
||||
my $prepcomp="prep-".$comp->{basename};
|
||||
for(@lines) {
|
||||
chomp;
|
||||
s/<<<INSERT_kitcomponent_basename_HERE>>>/$comp->{basename}/;
|
||||
s/<<<INSERT_kitcomponent_ospkgdeps_HERE>>>/$comp->{ospkgdeps}/;
|
||||
s/<<<INSERT_kitcomponent_kitpkgdeps_HERE>>>/$comp->{kitpkgdeps}/;
|
||||
s/<<<INSERT_kitcomponent_kitcompdeps_HERE>>>/$comp->{kitcompdeps}/;
|
||||
if ( $::VALID_PREP_COMPONENT ) {
|
||||
s/<<<INSERT_kitcomponent_kitcompdeps_HERE>>>/$comp->{kitcompdeps},$prepcomp/;
|
||||
}
|
||||
else
|
||||
{
|
||||
s/<<<INSERT_kitcomponent_kitcompdeps_HERE>>>/$comp->{kitcompdeps}/;
|
||||
}
|
||||
|
||||
s/<<<INSERT_kitcomponent_desc_HERE>>>/$comp->{description}/;
|
||||
s/<<<INSERT_kitcomponent_upgrade_flag_HERE>>>/$upgradeflag/;
|
||||
s/<<<INSERT_kitcomponent_preinstall_script_HERE>>>/$prescript/;
|
||||
@@ -2682,8 +2856,13 @@ sub create_kitconf
|
||||
$::kit_config->{$s}{entries}[$li]->{kitreponame} =
|
||||
$se->{kitreponame};
|
||||
if ( !$::PREREQUISITE and ($se->{ospkgdeps} || $se->{preinstall} || $se->{preupgrade} || $se->{preuninstall}) ) {
|
||||
$::kit_config->{$s}{entries}[$li]->{prerequisite} =
|
||||
if ( $debianflag ){
|
||||
$::kit_config->{$s}{entries}[$li]->{prerequisite} =
|
||||
"prep-" . $se->{basename};
|
||||
}else{
|
||||
$::kit_config->{$s}{entries}[$li]->{prerequisite} =
|
||||
"prep_" . $se->{basename};
|
||||
}
|
||||
}
|
||||
}
|
||||
$li++;
|
||||
@@ -3401,7 +3580,7 @@ sub kit_addpkgs
|
||||
#for debian/ubuntu
|
||||
my $repodir = $tmpdir . "/repos/".$non_native_kitreponame;
|
||||
if ( $debianflag ){
|
||||
my $debbuildcmd = "cd $source_dir;dpkg-buildpackage -uc -us";
|
||||
my $debbuildcmd = "cd $source_dir;dpkg-buildpackage $dpkg_flag";
|
||||
if ( system($debbuildcmd) ){
|
||||
print "error running debian build cmd for kit component $non_native_basename meta package.\n";
|
||||
return 1;
|
||||
@@ -3587,9 +3766,13 @@ sub NEW_kit_addpkgs
|
||||
if ($kp->{isexternalpkg} eq 'yes') {
|
||||
my $ext_filename = $kp->{filename};
|
||||
my $ext_reponames = $kp->{kitreponame};
|
||||
|
||||
my $files = xCAT::BuildKitUtils->find_latest_pkg(\@pkgdirlist, $ext_filename);
|
||||
|
||||
my $files;
|
||||
if($debianflag){
|
||||
$files = xCAT::BuildKitUtils->find_latest_pkg_deb(\@pkgdirlist, $ext_filename);
|
||||
}
|
||||
else {
|
||||
$files = xCAT::BuildKitUtils->find_latest_pkg(\@pkgdirlist, $ext_filename);
|
||||
}
|
||||
if (!defined($files) ) {
|
||||
print "Error: The product package file $ext_filename was not found in the package directory(s) @pkgdirlist.\n";
|
||||
# Cleanup
|
||||
@@ -3709,6 +3892,47 @@ sub NEW_kit_addpkgs
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#When using -k -r, there are useless repodir
|
||||
#delete useless repo dir
|
||||
my $kitrepodirby=$::base_repodir;
|
||||
my $cmdby = "/bin/ls $kitrepodirby 2>/dev/null";
|
||||
my $outputby = `$cmdby`;
|
||||
my @allrepolist = split(/\n/, $outputby);
|
||||
my @dellist;
|
||||
|
||||
foreach my $reponame (@allrepolist)
|
||||
{
|
||||
my $match=0;
|
||||
foreach my $kr (@{$::bldkit_config->{kitrepo}{entries}})
|
||||
{
|
||||
my $repodirname = "$kr->{kitreponame}";
|
||||
|
||||
if ( ${repodirname} eq ${reponame} )
|
||||
{
|
||||
${match}++;
|
||||
}
|
||||
}
|
||||
if ( ${match} == 0 )
|
||||
{
|
||||
push(@dellist,$reponame);
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $del (@dellist)
|
||||
{
|
||||
my $delrepodir=$::base_repodir."/".$del ;
|
||||
if ( -d $delrepodir )
|
||||
{
|
||||
my $delcmd="rm -Rf $delrepodir";
|
||||
if ( system($delcmd) )
|
||||
{
|
||||
print "Failed to delete useless repo directory \n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Build the full kit tar file
|
||||
my $buildtar_rc = &kit_buildtar;
|
||||
|
||||
|
||||
@@ -134,6 +134,87 @@ sub get_latest_version
|
||||
}
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
=head3 get_latest_version_deb
|
||||
|
||||
Find the latest version in a list of debs with the same basename
|
||||
|
||||
Arguments:
|
||||
- the repo location
|
||||
- a list of debs with the same basename
|
||||
Returns:
|
||||
- name of deb
|
||||
- undef
|
||||
Example:
|
||||
my $new_d = xCAT::BuildKitUtils->get_latest_version($repodir, \@rpmlist);
|
||||
Comments:
|
||||
|
||||
=cut
|
||||
#--------------------------------------------------------------------------
|
||||
sub get_latest_version_deb
|
||||
{
|
||||
my ($class, $repodir, $debs) = @_;
|
||||
|
||||
my @deblist = @$debs;
|
||||
|
||||
my %localversions_hash = ();
|
||||
my $file_name;
|
||||
my %founddeb;
|
||||
my $latest;
|
||||
my $i = 0;
|
||||
foreach my $deb (@deblist)
|
||||
{
|
||||
|
||||
# include path
|
||||
my $fulldebpath = "$repodir/$deb*";
|
||||
chomp $deb;
|
||||
# get the basename, version, and release for this deb
|
||||
print "dpkg -I $repodir/$deb |grep Package|awk '{print \$2}'";
|
||||
my $basenamedeb = `dpkg -I $repodir/$deb |grep Package|awk '{print \$2}'`;
|
||||
chomp $basenamedeb;
|
||||
|
||||
my $versiondeb = `dpkg -I $repodir/$deb |grep Version|awk '{print \$2}'`;
|
||||
chomp $versiondeb;
|
||||
|
||||
$founddeb{$basenamedeb}{$deb}{version}=$versiondeb;
|
||||
|
||||
$i++;
|
||||
}
|
||||
if ($i == 0)
|
||||
{
|
||||
print "error\n";
|
||||
return undef;
|
||||
}
|
||||
|
||||
|
||||
foreach my $r (keys %founddeb ) {
|
||||
# if more than one with same basename then find the latest
|
||||
my $latestmatch="";
|
||||
foreach my $fdeb (keys %{$founddeb{$r}} ) {
|
||||
# if we already found a match in some other dir
|
||||
if ($latestmatch) {
|
||||
# then we need to figure out which is the newest
|
||||
# if the $fdeb is newer than use iti
|
||||
if ( ! xCAT::BuildKitUtils->testVersion_deb($founddeb{$r}{$fdeb}{version}, 'gt', $founddeb{$r}{$latestmatch}{version}) ) {
|
||||
$latestmatch = $fdeb;
|
||||
}
|
||||
|
||||
} else {
|
||||
$latestmatch = $fdeb;
|
||||
}
|
||||
}
|
||||
$latest=$latestmatch;
|
||||
|
||||
}
|
||||
if ($i == 0)
|
||||
{
|
||||
print "Error: Could not determine the latest version for the following list of debs: @deblist\n";
|
||||
return undef;
|
||||
} else {
|
||||
return ($latest);
|
||||
}
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
=head3 find_latest_pkg
|
||||
|
||||
@@ -160,6 +241,7 @@ sub find_latest_pkg
|
||||
my @rpms;
|
||||
my %foundrpm;
|
||||
|
||||
|
||||
# need to check each pkgdir for the rpm(s)
|
||||
# - if more than one match need to pick latest
|
||||
# find all the matches in all the directories
|
||||
@@ -223,6 +305,128 @@ sub find_latest_pkg
|
||||
}
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
=head3 find_latest_pkg_deb
|
||||
|
||||
Find the latest deb package give the deb name and a list of
|
||||
possible package locations.
|
||||
|
||||
Arguments:
|
||||
- a list of package directories
|
||||
- the name of the deb
|
||||
Returns:
|
||||
- \@founddeblist
|
||||
|
||||
- undef
|
||||
Example:
|
||||
my $newrpm = xCAT::BuildKitUtils->find_latest_pkg_deb(\@pkgdirs, $debname);
|
||||
Comments:
|
||||
|
||||
=cut
|
||||
#--------------------------------------------------------------------------
|
||||
sub find_latest_pkg_deb
|
||||
{
|
||||
my ($class, $pkgdirs, $debname) = @_;
|
||||
my @pkgdirlist = @$pkgdirs;
|
||||
|
||||
my @debs;
|
||||
my %founddeb;
|
||||
|
||||
|
||||
# need to check each pkgdir for the deb(s)
|
||||
# - if more than one match need to pick latest
|
||||
# find all the matches in all the directories
|
||||
foreach my $debdir (@pkgdirlist) {
|
||||
my $ffile = $debdir."/".$debname;
|
||||
|
||||
if ( system("/bin/ls $ffile > /dev/null 2>&1") ){
|
||||
# if not then skip to next dir
|
||||
next;
|
||||
} else {
|
||||
# if so then get the details and add it to the %founddeb hash
|
||||
my $cmd = "/bin/ls $ffile 2>/dev/null";
|
||||
my $output = `$cmd`;
|
||||
my @deblist = split(/\n/, $output);
|
||||
|
||||
if ( scalar(@deblist) == 0) {
|
||||
next;
|
||||
}
|
||||
|
||||
foreach my $r (@deblist) {
|
||||
my $basename = `dpkg -I $r* |grep Package|awk '{print \$2}'|head -1`;
|
||||
chomp $basename;
|
||||
|
||||
my $version = `dpkg -I $r* |grep Version|awk '{print \$2}'|head -1`;
|
||||
chomp $version;
|
||||
|
||||
$founddeb{$basename}{$r}{version}=$version;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# for each unique deb basename
|
||||
foreach my $r (keys %founddeb ) {
|
||||
# if more than one with same basename then find the latest
|
||||
my $latestmatch="";
|
||||
foreach my $fdeb (keys %{$founddeb{$r}} ) {
|
||||
# if we already found a match in some other dir
|
||||
if ($latestmatch) {
|
||||
# then we need to figure out which is the newest
|
||||
# if the $fdeb is newer than use it
|
||||
if ( ! xCAT::BuildKitUtils->testVersion_deb($founddeb{$r}{$fdeb}{version}, 'gt', $founddeb{$r}{$latestmatch}{version}) ) {
|
||||
$latestmatch = $fdeb;
|
||||
}
|
||||
|
||||
} else {
|
||||
$latestmatch = $fdeb;
|
||||
}
|
||||
}
|
||||
push(@debs, $latestmatch);
|
||||
}
|
||||
|
||||
if (scalar(@debs)) {
|
||||
return \@debs;
|
||||
} else {
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
|
||||
=head3 testVersion_deb
|
||||
|
||||
Compare version1 and version2 according to the operator and
|
||||
return 1 0 or 0.
|
||||
|
||||
Arguments:
|
||||
$version1
|
||||
$operator
|
||||
$version2
|
||||
Returns:
|
||||
1 or 0
|
||||
Example:
|
||||
|
||||
Comments:
|
||||
The return value is generated with the Require query
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub testVersion_deb
|
||||
{
|
||||
my ($class, $version1, $operator, $version2) = @_;
|
||||
if ($::VERBOSE) {
|
||||
print "dpkg --compare-versions $version1 $operator $version2 \n";
|
||||
}
|
||||
my $result =`dpkg --compare-versions $version1 $operator $version2`;
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ set -e
|
||||
case "$1" in
|
||||
configure)
|
||||
<<<INSERT_kitcomponent_postinstall_script_HERE>>>
|
||||
if [ -f /tmp/<<<INSERT_kitcomponent_upgrade_flag_HERE>>> ]
|
||||
if [ -f /tmp/<<<INSERT_kitcomponent_upgrade_flag_HERE>>> ]; then
|
||||
<<<INSERT_kitcomponent_postupgrade_script_HERE>>>
|
||||
rm /tmp/<<<INSERT_kitcomponent_upgrade_flag_HERE>>>
|
||||
fi
|
||||
|
||||
@@ -17,10 +17,12 @@ set -e
|
||||
case "$1" in
|
||||
install)
|
||||
<<<INSERT_kitcomponent_preinstall_script_HERE>>>
|
||||
echo "preinstall processing"
|
||||
;;
|
||||
|
||||
upgrade)
|
||||
if [ -f /tmp/<<<INSERT_kitcomponent_upgrade_flag_HERE>>> ]
|
||||
if [ -f /tmp/<<<INSERT_kitcomponent_upgrade_flag_HERE>>> ]; then
|
||||
echo "preupgrade processing"
|
||||
<<<INSERT_kitcomponent_preupgrade_script_HERE>>>
|
||||
fi
|
||||
;;
|
||||
|
||||
@@ -96,7 +96,8 @@ kit:
|
||||
#
|
||||
# osminorversion (optional) OS minor version. (ex. "4")
|
||||
#
|
||||
# osarch (mandatory) OS architecture. (ex. "x86_64")
|
||||
# osarch (mandatory) OS architecture. (ex.redhat x86_64 should be "x86_64", Ubuntu Power LE should be "ppc64el",
|
||||
# For Ubuntu Power LE, system arch is ppc64le, for ubuntu software package, should use "ppc64el",
|
||||
#
|
||||
# compat_osbasenames (optional) Comma-separated list of compatible
|
||||
# OS distribution base names. (ex. "centos")
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "running sample-comp1 genimage_post script"
|
||||
rpmdir="/opt/xcat/kits/<<<buildkit_WILL_INSERT_kit_basename_HERE>>>/<<<buildkit_WILL_INSERT_kitcomponent_name_HERE>>>"
|
||||
|
||||
if [[ ! -z "$installroot" ]]; then
|
||||
if [ -n "`ls $installroot$rpmdir/*.deb 2> /dev/null`" ] ; then
|
||||
dpkg -i --force-all --instdir=$installroot $installroot$rpmdir/*.deb
|
||||
|
||||
elif [ -n "`ls $installroot$rpmdir/*.rpm 2> /dev/null`" ] ; then
|
||||
rpm --force --root $installroot -Uvh $installroot$rpmdir/*.rpm
|
||||
fi
|
||||
else
|
||||
if [ -n "`ls $rpmdir/*.deb 2> /dev/null`" ] ; then
|
||||
dpkg -i --force-all $rpmdir/*.deb
|
||||
|
||||
elif [ -n "`ls $rpmdir/*.rpm 2> /dev/null`" ] ; then
|
||||
rpm --force -Uvh $rpmdir/*.rpm
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
BIN
Binary file not shown.
@@ -26,9 +26,6 @@ BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
<<<INSERT_kitcomponent_files_HERE>>>
|
||||
|
||||
%changelog
|
||||
|
||||
@@ -48,6 +45,11 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%preun
|
||||
<<<INSERT_kitcomponent_preuninstall_script_HERE>>>
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
<<<INSERT_kitcomponent_files_HERE>>>
|
||||
|
||||
|
||||
%postun
|
||||
<<<INSERT_kitcomponent_postuninstall_script_HERE>>>
|
||||
|
||||
|
||||
+39
-19
@@ -590,13 +590,16 @@ sub startxcatd
|
||||
} else {
|
||||
$xcmd = "$::XCATROOT/sbin/restartxcatd";
|
||||
}
|
||||
system($xcmd);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$xcmd = "service xcatd restart";
|
||||
#$xcmd = "service xcatd restart";
|
||||
my $ret=xCAT::Utils->restartservice("xcatd");
|
||||
return $ret;
|
||||
}
|
||||
system($xcmd);
|
||||
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -618,13 +621,16 @@ sub shutdownxcatd
|
||||
if ($::osname eq 'AIX')
|
||||
{
|
||||
$xcmd = "stopsrc -s xcatd";
|
||||
system($xcmd);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$xcmd = "service xcatd stop";
|
||||
#$xcmd = "service xcatd stop";
|
||||
my $ret=xCAT::Utils->stopservice("xcatd");
|
||||
return $ret;
|
||||
}
|
||||
system($xcmd);
|
||||
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -1872,7 +1878,7 @@ sub restorexcatdb
|
||||
# restore the database
|
||||
xCAT::MsgUtils->message(
|
||||
"I",
|
||||
"Restoring the xCat Database with $::backupdir to DB2 database.\nThis could take several minutes."
|
||||
"Restoring the xCAT Database with $::backupdir to DB2 database.\nThis could take several minutes."
|
||||
);
|
||||
if (!(-d $::backupdir))
|
||||
{ # does not exist, error
|
||||
@@ -2073,11 +2079,12 @@ sub adddb2paths
|
||||
#-----------------------------------------------------------------------------
|
||||
sub remove
|
||||
{
|
||||
my $cmd;
|
||||
my @output;
|
||||
my $error = 0;
|
||||
#see if DB2 is installed
|
||||
if (!(-e ($::installdb2dir)))
|
||||
my $cmd;
|
||||
my @output;
|
||||
my $error = 0;
|
||||
my $retcode=0;
|
||||
#see if DB2 is installed
|
||||
if (!(-e ($::installdb2dir)))
|
||||
{
|
||||
my $message =
|
||||
"\nDB2 is not installed.";
|
||||
@@ -2120,18 +2127,23 @@ sub remove
|
||||
|
||||
my $cmd = "ps -elf|grep xcatd";
|
||||
my @output = xCAT::Utils->runcmd($cmd, 0);
|
||||
|
||||
if ($::RUNCMD_RC == 0)
|
||||
{
|
||||
if ($::osname eq 'AIX')
|
||||
{
|
||||
my $cmd = "startsrc -s xcatd";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
$retcode=$::RUNCMD_RC;
|
||||
}
|
||||
else
|
||||
{
|
||||
my $cmd = "service xcatd start";
|
||||
#my $cmd = "service xcatd start";
|
||||
$retcode=xCAT::Utils->startservice("xcatd");
|
||||
}
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC !=0)
|
||||
#xCAT::Utils->runcmd($cmd, -1);
|
||||
#if ($::RUNCMD_RC !=0)
|
||||
if($retcode!=0)
|
||||
{
|
||||
my $message = "can't start xcatd";
|
||||
$error += 1;
|
||||
@@ -2155,13 +2167,17 @@ sub remove
|
||||
if ($::osname eq 'AIX')
|
||||
{
|
||||
my $cmd = "stopsrc -s xcatd";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
$retcode=$::RUNCMD_RC;
|
||||
}
|
||||
else
|
||||
{
|
||||
my $cmd = "service xcatd stop";
|
||||
#my $cmd = "service xcatd stop";
|
||||
$retcode=xCAT::Utils->stopservice("xcatd");
|
||||
}
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC !=0)
|
||||
#xCAT::Utils->runcmd($cmd, -1);
|
||||
#if ($::RUNCMD_RC !=0)
|
||||
if($retcode!=0)
|
||||
{
|
||||
my $message = "can't stop xcatd";
|
||||
xCAT::MsgUtils->message("E", "$message");
|
||||
@@ -2198,13 +2214,17 @@ sub remove
|
||||
if ($::osname eq 'AIX')
|
||||
{
|
||||
my $cmd = "startsrc -s xcatd";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
$retcode=$::RUNCMD_RC;
|
||||
}
|
||||
else
|
||||
{
|
||||
my $cmd = "service xcatd start";
|
||||
#my $cmd = "service xcatd start";
|
||||
$retcode=xCAT::Utils->startservice("xcatd");
|
||||
}
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC !=0)
|
||||
#xCAT::Utils->runcmd($cmd, -1);
|
||||
#if ($::RUNCMD_RC !=0)
|
||||
if($retcode!=0)
|
||||
{
|
||||
my $message = "can't start xcatd";
|
||||
xCAT::MsgUtils->message("E", "$message");
|
||||
|
||||
@@ -43,6 +43,7 @@ my $interactive;
|
||||
my $onlyinitrd;
|
||||
my $dryrun;
|
||||
my $ignorekernelchk;
|
||||
my $noupdate;
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 print_usage - usage message
|
||||
@@ -55,8 +56,8 @@ sub print_usage
|
||||
print "Usage:\n";
|
||||
print " genimage\n\n";
|
||||
print " genimage --dryrun\n\n";
|
||||
print ' genimage -o <osver> [-a <arch>] -p <profile> -i <nodebootif> -n <nodenetdrivers> [--onlyinitrd] [-r <otherifaces>] [-k <kernelver>] [-g <krpmver>] [-m statelite] [-l rootlimitsize] [-t tmplimitsize] [--permission <permission>] [--interactive] [--dryrun]'."\n\n";
|
||||
print ' genimage [-o <osver>] [-a <arch>] [-p <profile>] [-i <nodebootif>] [-n <nodenetdrivers>] [--onlyinitrd] [-r <otherifaces>] [-k <kernelver>] [-g <krpmver>] [-m statelite] [-l rootlimitsize] [-t tmplimitsize] [--permission <permission>] [--interactive] [--dryrun] <imagename>'."\n\n";
|
||||
print ' genimage -o <osver> [-a <arch>] -p <profile> -i <nodebootif> -n <nodenetdrivers> [--onlyinitrd] [-r <otherifaces>] [-k <kernelver>] [-g <krpmver>] [-m statelite] [-l rootlimitsize] [-t tmplimitsize] [--permission <permission>] [--interactive] [--dryrun] [--noupdate]'."\n\n";
|
||||
print ' genimage [-o <osver>] [-a <arch>] [-p <profile>] [-i <nodebootif>] [-n <nodenetdrivers>] [--onlyinitrd] [-r <otherifaces>] [-k <kernelver>] [-g <krpmver>] [-m statelite] [-l rootlimitsize] [-t tmplimitsize] [--permission <permission>] [--interactive] [--dryrun] [--noupdate] <imagename>'."\n\n";
|
||||
print " --permission is used for statelite only\n";
|
||||
print " -g is used for SLES only\n\n";
|
||||
print " -m is used for urbuntu, debian and fedora12 only\n\n";
|
||||
@@ -90,6 +91,7 @@ if (!GetOptions(
|
||||
'onlyinitrd' => \$onlyinitrd,
|
||||
'dryrun' => \$dryrun,
|
||||
'ignorekernelchk' => \$ignorekernelchk,
|
||||
'noupdate' => \$noupdate,
|
||||
'h|help' => \$help,
|
||||
'v|version' => \$version,
|
||||
)) {
|
||||
@@ -176,7 +178,8 @@ if ((!$imagename) && (!$os)){
|
||||
my @dircontents = `ls $installdir`;
|
||||
chomp(@dircontents);
|
||||
foreach (@dircontents) {
|
||||
if($_ =~ /(rhel|fedora|sl|centos|suse)/){
|
||||
# SL matches Scientific Linux, sl matches sles amd sled
|
||||
if($_ =~ /(rhel|fedora|SL|centos|sl|suse)/){
|
||||
push @oses,$_;
|
||||
}
|
||||
}
|
||||
@@ -408,6 +411,10 @@ if ($ignorekernelchk) {
|
||||
push @arg, "--ignorekernelchk";
|
||||
}
|
||||
|
||||
if ($noupdate) {
|
||||
push @arg, "--noupdate";
|
||||
}
|
||||
|
||||
my $cmdref;
|
||||
push (@{$cmdref->{arg}}, @arg);
|
||||
$cmdref->{command}->[0] = "genimage";
|
||||
|
||||
+366
-160
@@ -1,191 +1,397 @@
|
||||
#!/usr/bin/perl
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
# Downloads/converts the xCAT docs on the sourceforge wiki to local HTML and PDF.
|
||||
|
||||
# Downloads/converts the xCAT docs on the sourceforge Allura wiki to local HTML and PDF.
|
||||
# This script is not dependent on other xCAT code, so you can copy it to a machine
|
||||
# that has internet access to run it. Before running this command, you must have
|
||||
# wget, python, and pisa installed. See: http://sourceforge.net/apps/mediawiki/xcat/index.php?title=Editing_xCAT_Documentation_Pages#Converting_Wiki_Pages_to_HTML_and_PDFs .
|
||||
# curl, pandoc, and latex installed. See: http://sourceforge.net/p/xcat/wiki/Editing_and_Downloading_xCAT_Documentation/#converting-wiki-pages-to-html-and-pdfs
|
||||
|
||||
|
||||
# Note: do not use the --upload option, unless your machine has authority to write to http://xcat.sourceforge.net/doc/ .
|
||||
# You also need to set $UPLOADUSER to your sourceforge user.
|
||||
# You also need to set $UPLOADUSER to your sourceforge user:
|
||||
my $UPLOADUSER = 'bp-sawyers';
|
||||
|
||||
#BEGIN
|
||||
#{
|
||||
# $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr';
|
||||
#}
|
||||
use strict;
|
||||
#use lib "$::XCATROOT/lib/perl";
|
||||
#use xCAT::Utils;
|
||||
use Getopt::Long;
|
||||
#use File::Path;
|
||||
use Cwd;
|
||||
#use Data::Dumper;
|
||||
use JSON;
|
||||
use List::Util qw[max];
|
||||
|
||||
|
||||
# URL for the xCAT Allura wiki API markdown on SourceForge
|
||||
my $SF_URL='http://sourceforge.net/rest';
|
||||
my $WIKI_URL=$SF_URL.'/p/xcat/wiki/';
|
||||
|
||||
# Update this list if you group any xcat docs on a separate page such that they
|
||||
# are no longer linked from the main doc page:
|
||||
my @INDEXDOCS = ('XCAT_Documentation',
|
||||
'Power_775_Cluster_Documentation',
|
||||
'Highly_Available_Management_Node',
|
||||
'Mixed_Cluster_Support',
|
||||
'IBM_HPC_Stack_in_an_xCAT_Cluster');
|
||||
|
||||
# Update this list if you group any xcat docs on a separate page such that they are no longer linked from the
|
||||
# main doc page.
|
||||
my @indexdocs = ('XCAT_Documentation', 'Power_775_Cluster_Documentation', 'Highly_Available_Management_Node', 'Mixed_Cluster_Support', 'IBM_HPC_Stack_in_an_xCAT_Cluster');
|
||||
|
||||
#my $VERSION;
|
||||
my $HELP;
|
||||
my $UPLOAD;
|
||||
my $UPLOADONLY;
|
||||
my $IGNOREERRORS;
|
||||
my $CONTINUE;
|
||||
my $SINGLE_DOC;
|
||||
my $VERBOSE;
|
||||
|
||||
my $usage = sub {
|
||||
my $exitcode = shift @_;
|
||||
print "Usage: getxcatdocs [-?|-h|--help] [-v|--verbose] [-u|--upload] [--uploadonly] [<destination-dir>]\n";
|
||||
exit $exitcode;
|
||||
};
|
||||
|
||||
# Process the cmd line args
|
||||
Getopt::Long::Configure("bundling");
|
||||
#Getopt::Long::Configure("pass_through");
|
||||
Getopt::Long::Configure("no_pass_through");
|
||||
if (!GetOptions('h|?|help' => \$HELP, 'v|verbose' => \$VERBOSE, 'u|upload' => \$UPLOAD, 'uploadonly' => \$UPLOADONLY )) { $usage->(1); }
|
||||
|
||||
if ($HELP) { $usage->(0); }
|
||||
|
||||
#if ($VERSION) {
|
||||
#print xCAT::Utils->Version(), "\n";
|
||||
# exit;
|
||||
#}
|
||||
|
||||
if ($^O =~ /^aix/i) { die "Error: this command is not yet supported on AIX.\n"; }
|
||||
|
||||
my $destdir = scalar(@ARGV) ? $ARGV[0] : '.';
|
||||
chdir($destdir) or die "Can not cd to $destdir: $!\n";
|
||||
#my $docdir = $ENV{'PWD'};
|
||||
|
||||
# Download the HTML docs and convert them all to pdfs
|
||||
my @dir;
|
||||
if (!$UPLOADONLY) {
|
||||
@dir = gethtmldocs('html');
|
||||
convert2pdf('pdf', \@dir);
|
||||
}
|
||||
|
||||
|
||||
# tar/compress
|
||||
my $date=`date +%Y%m%d%H%M`;
|
||||
chop $date;
|
||||
my $docname="xcat-docs-snap$date.tar.gz";
|
||||
#system('pwd');
|
||||
my $cmd = "tar -zcf $docname html pdf 2>&1";
|
||||
verbose($cmd);
|
||||
system($cmd) == 0 or die "Error running $cmd: $!, rc=$?";
|
||||
|
||||
# Optionally upload the tarball to sourceforge
|
||||
if ($UPLOAD || $UPLOADONLY) {
|
||||
my $UPLOADUSER = 'bp-sawyers';
|
||||
my $count = 1;
|
||||
#my $cmd = "rsync -v $docname $UPLOADUSER," . 'xcat@web.sourceforge.net:htdocs/doc/';
|
||||
my $cmd = "rsync -v $docname $UPLOADUSER," . 'xcat@web.sourceforge.net:/home/frs/project/x/xc/xcat/doc/';
|
||||
print "$cmd\n";
|
||||
while ($count<=5 && system("$cmd 2>&1")) { $count++; }
|
||||
}
|
||||
exit 0;
|
||||
|
||||
my $MDDIR;
|
||||
my $HTMLDIR;
|
||||
my $PDFDIR;
|
||||
my $IMAGEDIR;
|
||||
my %LOADEDDOCS;
|
||||
|
||||
sub verbose { if ($VERBOSE) { print shift, "\n"; } }
|
||||
|
||||
my $usage = sub {
|
||||
my $exitcode = shift @_;
|
||||
print "Usage: getxcatdocs [-?|-h|--help] \n";
|
||||
print "Usage: getxcatdocs [-v|--verbose] [-u|--upload] [--uploadonly] [-U|--uploaduser sourceforge_id] [-i|--ignoreerrors] [<destination-dir>]\n";
|
||||
print "Usage: getxcatdocs [-v|--verbose] [-c|--continue] [-d|--doc single_doc] [-i|--ignoreerrors] [<destination-dir>]\n";
|
||||
exit $exitcode;
|
||||
};
|
||||
|
||||
|
||||
# Main processing
|
||||
|
||||
# Process the cmd line args
|
||||
Getopt::Long::Configure("bundling");
|
||||
#Getopt::Long::Configure("pass_through");
|
||||
Getopt::Long::Configure("no_pass_through");
|
||||
if (!GetOptions(
|
||||
'h|?|help' => \$HELP,
|
||||
'v|verbose' => \$VERBOSE,
|
||||
'u|upload' => \$UPLOAD,
|
||||
'uploadonly' => \$UPLOADONLY,
|
||||
'uploaduser' => \$UPLOADUSER,
|
||||
'c|continue' => \$CONTINUE,
|
||||
'i|ignoreerrors' => \$IGNOREERRORS,
|
||||
'd|doc=s' => \$SINGLE_DOC ))
|
||||
{ $usage->(1); }
|
||||
|
||||
if ($HELP) { $usage->(0); }
|
||||
|
||||
if ($^O =~ /^aix/i) { die "Error: this command is not yet supported on AIX.\n"; }
|
||||
|
||||
my $DESTDIR = scalar(@ARGV) ? $ARGV[0] : '.';
|
||||
chdir($DESTDIR) or die "Can not cd to $DESTDIR: $!\n";
|
||||
|
||||
my $json = JSON->new();
|
||||
|
||||
if ($SINGLE_DOC) {
|
||||
$MDDIR = '.';
|
||||
$HTMLDIR = '.';
|
||||
$PDFDIR = '.';
|
||||
$IMAGEDIR = '.';
|
||||
download_doc($SINGLE_DOC);
|
||||
convert_doc($SINGLE_DOC);
|
||||
exit;
|
||||
}
|
||||
|
||||
# Download the HTML docs and convert them all to pdfs
|
||||
if (!$UPLOADONLY) { gethtmldocs(); }
|
||||
|
||||
# tar/compress
|
||||
my $date=`date +%Y%m%d%H%M`;
|
||||
chop $date;
|
||||
my $docname="xcat-docs-snap$date.tar.gz";
|
||||
|
||||
my $cmd = "tar -zcf $docname html pdf images 2>&1";
|
||||
verbose($cmd);
|
||||
system($cmd) == 0 or die "Error running $cmd: $!, rc=$?";
|
||||
|
||||
# Optionally upload the tarball to sourceforge
|
||||
if ($UPLOAD || $UPLOADONLY) {
|
||||
my $count = 1;
|
||||
#my $cmd = "rsync -v $docname $UPLOADUSER," . 'xcat@web.sourceforge.net:htdocs/doc/';
|
||||
my $cmd = "rsync -v $docname $UPLOADUSER," . 'xcat@web.sourceforge.net:/home/frs/project/x/xc/xcat/doc/';
|
||||
print "$cmd\n";
|
||||
while ($count<=5 && system("$cmd 2>&1")) { $count++; }
|
||||
}
|
||||
exit 0;
|
||||
|
||||
|
||||
|
||||
# Download all of the html docs from several "index" docs
|
||||
sub gethtmldocs {
|
||||
my $dir = shift;
|
||||
my $savedir = getcwd();
|
||||
#File::Path::make_path($dir);
|
||||
mkdir($dir);
|
||||
chdir($dir);
|
||||
#system('pwd');
|
||||
unlink <*>; # delete all the files in the dir, in case they previously ran this
|
||||
#system('ls');
|
||||
|
||||
my $indexes = '';
|
||||
foreach my $index (@indexdocs) {
|
||||
$indexes .= qq('http://sourceforge.net/apps/mediawiki/xcat/index.php?title=$index&printable=yes' );
|
||||
}
|
||||
print "Downloading the xCAT wiki documentation to $dir, from: $indexes ...\n";
|
||||
runwget($indexes);
|
||||
|
||||
# Remove the funny chars from the links to other docs and rename the docs
|
||||
#my $sedcmd = q(sed -i 's/<a href="\/apps\/mediawiki\/xcat\/index.php?title/<a href="index.php%3Ftitle/' *);
|
||||
# sed -i 's/href="index.php%3Ftitle=/href="/g' index.php\?title\=
|
||||
# sed -i 's/<a href="\([^"]*\)"/<a href="\1.html"/'
|
||||
# This searches for '<a href="index.php?title=' and then all text before a '"' or '#', and then removes the front part and add .html on the end
|
||||
# Note: this does not convert the 'MediaWiki:*' files because they are used in <link> tags, but converting them does not seem to do any good anyway.
|
||||
my $cmd = q(sed -i 's/<a href="index.php?title=\\([^"#]*\\)\\("\|#\\)/<a href="\1.html\2/g' *);
|
||||
verbose($cmd);
|
||||
system($cmd) == 0 or die "Error running $cmd: $!, rc=$?";
|
||||
# get the list of docs
|
||||
opendir(DIR, '.') or die "Error: could not read the just created html directory.\n";
|
||||
#my @docs = grep /^index.php\?title=/, readdir(DIR); # /
|
||||
my @docs;
|
||||
foreach my $f (readdir(DIR)) {
|
||||
if ($f !~ /^index.php\?title=/ || $f =~ /^index.php\?title=MediaWiki:/) { next; }
|
||||
my $newf = $f;
|
||||
$newf =~ s/^index.php\?title=//;
|
||||
if ($newf !~ /\./) { $newf .= '.html'; }
|
||||
verbose("Renaming $f to $newf");
|
||||
rename($f, $newf);
|
||||
push @docs, $newf;
|
||||
}
|
||||
close(DIR);
|
||||
chdir($savedir);
|
||||
return @docs;
|
||||
|
||||
$MDDIR = 'md';
|
||||
$HTMLDIR = 'html';
|
||||
$PDFDIR = 'pdf';
|
||||
$IMAGEDIR = 'images';
|
||||
|
||||
mkdir($MDDIR);
|
||||
mkdir($HTMLDIR);
|
||||
mkdir($PDFDIR);
|
||||
mkdir($IMAGEDIR);
|
||||
#delete all the files in the dirs in case they previously ran this
|
||||
if ($CONTINUE) {
|
||||
print "CONTINUING with files already in $MDDIR";
|
||||
my @mdfiles = glob "$MDDIR/*.md";
|
||||
foreach my $mdf (@mdfiles) {
|
||||
$mdf =~ s/^$MDDIR\///;
|
||||
$mdf =~ s/\.md//;
|
||||
$LOADEDDOCS{$mdf}=1;
|
||||
}
|
||||
} else {
|
||||
unlink <$MDDIR/*>;
|
||||
unlink <$HTMLDIR/*>;
|
||||
unlink <$PDFDIR/*>;
|
||||
unlink <$IMAGEDIR/*>;
|
||||
}
|
||||
|
||||
print "\nDownloading and converting the xCAT wiki document list from $WIKI_URL ...\n";
|
||||
foreach my $index (@INDEXDOCS) {
|
||||
my @related_docs = download_doc($index);
|
||||
foreach my $docref (@related_docs) {
|
||||
my $docref_name = $docref;
|
||||
$docref_name =~ s/\/.*\/(.+)\/$/$1/;
|
||||
download_doc($docref_name);
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $doc (keys %LOADEDDOCS) {
|
||||
convert_doc($doc);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
# Convert to pdf
|
||||
sub convert2pdf {
|
||||
my ($dir, $files) = @_;
|
||||
my $savedir = getcwd();
|
||||
#File::Path::make_path($dir);
|
||||
mkdir($dir);
|
||||
chdir($dir);
|
||||
if (system('which xhtml2pdf >/dev/null 2>&1')) { die "xhtml2pdf is not installed. See http://sourceforge.net/apps/mediawiki/xcat/index.php?title=Editing_xCAT_Documentation_Pages#Converting_Wiki_Pages_to_HTML_and_PDFs .\n"; }
|
||||
unlink <*>; # delete all the files in the dir, in case they previously ran this
|
||||
foreach my $file (@$files) {
|
||||
#if ($file =~ /^index.php\?title=MediaWiki:/ || $file eq 'index.php?title=XCAT_Documentation') { next; }
|
||||
if ($file eq 'XCAT_Documentation') { next; }
|
||||
#my ($docname) = $file =~ /^index.php\?title=(.+)$/;
|
||||
$file =~ s/\.html$//;
|
||||
print "Converting $file to PDF format...\n";
|
||||
my $url = 'http://sourceforge.net/apps/mediawiki/xcat/index.php?title=' . $file . '&printable=yes';
|
||||
my $destfile = "$file.pdf";
|
||||
my $cmd = "xhtml2pdf '$url' '$destfile' ";
|
||||
runh2p($cmd);
|
||||
}
|
||||
chdir($savedir);
|
||||
|
||||
sub download_doc {
|
||||
my $doc_name = shift;
|
||||
|
||||
if ( $LOADEDDOCS{$doc_name} ) { return; }
|
||||
verbose("processing $doc_name");
|
||||
$LOADEDDOCS{$doc_name}=1;
|
||||
|
||||
my $curlcmd = "curl --retry 5 -X GET $WIKI_URL/$doc_name";
|
||||
verbose($curlcmd);
|
||||
my $docjson = `$curlcmd`;
|
||||
if ($? && !$IGNOREERRORS) { die "error encountered in $curlcmd \n";}
|
||||
|
||||
my $jsout = $json->decode($docjson);
|
||||
|
||||
foreach my $att (@{$jsout->{attachments}}) {
|
||||
my $wgetcmd = "wget -P $IMAGEDIR/ $att->{url}";
|
||||
verbose($wgetcmd);
|
||||
system($wgetcmd);
|
||||
if ($? && !$IGNOREERRORS) { die "error encountered in $wgetcmd \n";}
|
||||
}
|
||||
|
||||
open(MDFILE, ">$MDDIR/${doc_name}.md") or die "Could not open >$MDDIR/${doc_name}.md";
|
||||
print MDFILE $jsout->{text};
|
||||
close MDFILE;
|
||||
|
||||
return @{$jsout->{related_artifacts}};
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub convert_doc {
|
||||
my $doc_name = shift;
|
||||
|
||||
open(MDFILE, "<$MDDIR/${doc_name}.md") or die "Could not open <$MDDIR/${doc_name}.md";
|
||||
my @doc_lines = <MDFILE>;
|
||||
close MDFILE;
|
||||
my $doc_text = join('',@doc_lines);
|
||||
|
||||
$doc_text = process_includes($doc_text,0);
|
||||
|
||||
if ($doc_text =~ /begin_xcat_table/) {
|
||||
open(MDFILE, ">$MDDIR/${doc_name}.md") or die "Could not open >$MDDIR/${doc_name}.md";
|
||||
print MDFILE $doc_text;
|
||||
close MDFILE;
|
||||
|
||||
convert_tables($doc_name);
|
||||
|
||||
open(MDFILE, "<$MDDIR/${doc_name}.md") or die "Could not open <$MDDIR/${doc_name}.md";
|
||||
@doc_lines = <MDFILE>;
|
||||
close MDFILE;
|
||||
$doc_text = join('',@doc_lines);
|
||||
}
|
||||
|
||||
## Make image refs local
|
||||
$doc_text =~ s/\!\[\]\(.+\/(.+)\.png\)/\!\[\]\(\.\.\/$IMAGEDIR\/$1\.png\)/g;
|
||||
$doc_text =~ s/\!\[\]\(.+\/(.+)\.PNG\)/\!\[\]\(\.\.\/$IMAGEDIR\/$1\.PNG\)/g;
|
||||
$doc_text =~ s/\!\[\]\(.+\/(.+)\.jpg\)/\!\[\]\(\.\.\/$IMAGEDIR\/$1\.jpg\)/g;
|
||||
$doc_text =~ s/\[img src=(.+)\.png\]/\!\[\]\(\.\.\/$IMAGEDIR\/$1\.png\)/g;
|
||||
$doc_text =~ s/\[img src=(.+)\.PNG\]/\!\[\]\(\.\.\/$IMAGEDIR\/$1\.PNG\)/g;
|
||||
$doc_text =~ s/\[img src=(.+)\.jpg\]/\!\[\]\(\.\.\/$IMAGEDIR\/$1\.jpg\)/g;
|
||||
|
||||
## Remove [TOC] entries
|
||||
$doc_text =~ s/\[TOC\]//g;
|
||||
|
||||
|
||||
open(MDFILE, ">$MDDIR/${doc_name}.md") or die "Could not open >$MDDIR/${doc_name}.md";
|
||||
print MDFILE $doc_text;
|
||||
close MDFILE;
|
||||
|
||||
my $pandoccmd = "pandoc -s --toc $MDDIR/${doc_name}.md -o $HTMLDIR/${doc_name}.html";
|
||||
verbose($pandoccmd);
|
||||
system($pandoccmd);
|
||||
if ($? && !$IGNOREERRORS) { die "error encountered in $pandoccmd \n";}
|
||||
# This rename is probably a hack, but I didn't want to take the time to
|
||||
# figure out what was going on:
|
||||
# pandoc does different processing if target filetype is html
|
||||
# but all internal refs only work in browser when there is no html filetype
|
||||
rename "$HTMLDIR/${doc_name}.html","$HTMLDIR/${doc_name}";
|
||||
|
||||
$doc_text =~ s/\!\[\]\(\.\.\/$IMAGEDIR\/(.+)\.png\)/\!\[\]\(\.\/$IMAGEDIR\/$1\.png\)/g;
|
||||
$doc_text =~ s/\!\[\]\(\.\.\/$IMAGEDIR\/(.+)\.PNG\)/\!\[\]\(\.\/$IMAGEDIR\/$1\.PNG\)/g;
|
||||
$doc_text =~ s/\!\[\]\(\.\.\/$IMAGEDIR\/(.+)\.jpg\)/\!\[\]\(\.\/$IMAGEDIR\/$1\.jpg\)/g;
|
||||
open(MDFILE, ">$MDDIR/${doc_name}.md") or die "Could not open >$MDDIR/${doc_name}.md";
|
||||
print MDFILE $doc_text;
|
||||
close MDFILE;
|
||||
my $pandoccmd2 = "pandoc --toc $MDDIR/${doc_name}.md -o $PDFDIR/${doc_name}.pdf";
|
||||
verbose($pandoccmd2);
|
||||
system($pandoccmd2);
|
||||
if ($? && !$IGNOREERRORS) { die "error encountered in $pandoccmd2 \n";}
|
||||
|
||||
}
|
||||
|
||||
|
||||
# Run the wget cmd and filter out some of the silly output
|
||||
sub runwget {
|
||||
my $index = shift;
|
||||
# options we might consider: --html-extension --restrict-file-names=windows --cut-dirs=3
|
||||
# options that do not work: --relative
|
||||
#my $rejectlist = q('*title=Special:*,*title=Talk:*,*title=-&*,*title=HowTos,*title=Main_Page,*title=MediaWiki:*,*title=Release_Notes,*title=Wish_List_for_xCAT_2,*&action=edit*,*&action=history*,*&printable=yes*,*&oldid=*,index.html,opensearch_desc.php,xcat,login.php,support');
|
||||
my $rejectlist = q('*title=Special:*,*title=Talk:*,*title=-&*,*title=HowTos,*title=Main_Page,*title=Release_Notes,*title=Wish_List_for_xCAT_2,*&action=edit*,*&action=history*,*&printable=yes*,*&oldid=*,index.html,opensearch_desc.php,xcat,login.php,support');
|
||||
my $cmd = qq(wget --recursive --convert-links --no-verbose --progress=bar --level=1 --page-requisites --no-parent --no-host-directories --no-directories --no-clobber --execute robots=off --post-data='printable=yes' --reject $rejectlist $index);
|
||||
verbose($cmd);
|
||||
open(OUT, "$cmd 2>&1 |") || die "can't fork $cmd: $!\n";
|
||||
while (<OUT>) {
|
||||
if (/URL:https*:\/\/sourceforge\.net.+\s+->\s+\"(\S+)\"\s+\[/) { print "Downloaded $1.\n"; }
|
||||
else { print; }
|
||||
}
|
||||
close OUT || print "Error running $cmd: $! $?\n";
|
||||
|
||||
sub process_includes {
|
||||
my $doc_text = shift;
|
||||
my $include_nest = shift;
|
||||
|
||||
if ($include_nest++ > 10) { die "nested include processing greater than 10. Infinite recursion???"; }
|
||||
|
||||
while (1) {
|
||||
if ($doc_text =~ /\[\[(\s*)include (\s*)ref=(\s*)(.+)(\s*)\]\]/) {
|
||||
my $next_include = $4;
|
||||
download_doc($next_include);
|
||||
|
||||
open(INCLDFILE, "<$MDDIR/${next_include}.md") or die "Could not open <$MDDIR/${next_include}.md";
|
||||
my @include_lines = <INCLDFILE>;
|
||||
close INCLDFILE;
|
||||
|
||||
# my $include_text = join('\n', @include_lines);
|
||||
my $include_text = join('', @include_lines);
|
||||
$include_text = process_includes($include_text,$include_nest);
|
||||
|
||||
$doc_text =~ s/\[\[(\s*)include (\s*)ref=(\s*)$next_include(\s*)\]\]/$include_text/g;
|
||||
|
||||
} else {
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
return $doc_text;
|
||||
}
|
||||
|
||||
# Run the xhtml2pdf cmd and filter out some of the silly output
|
||||
sub runh2p {
|
||||
my $cmd = shift;
|
||||
verbose($cmd);
|
||||
open(OUT, "$cmd 2>&1 |") || die "can't fork $cmd: $!\n";
|
||||
while (<OUT>) {
|
||||
next if /DeprecationWarning:\sthe sets module is deprecated/;
|
||||
next if /from sets import ImmutableSet/;
|
||||
next if /^\s*import sets\s*$/;
|
||||
next if /^Converting\ssourceforge.net/;
|
||||
print;
|
||||
}
|
||||
close OUT || print "Error running $cmd: $! $?\n";
|
||||
|
||||
sub convert_tables {
|
||||
my $doc_name=shift;
|
||||
my $infile="$MDDIR/${doc_name}.md";
|
||||
my $outfile=$infile;
|
||||
|
||||
open(MDFILE, "<$infile") or die "Could not open <$infile";
|
||||
my @inlines=<MDFILE>;
|
||||
close MDFILE;
|
||||
my @outlines;
|
||||
my @tablines;
|
||||
|
||||
my $in_comment=0;
|
||||
my $xcat_table=0;
|
||||
my $numcols=1;
|
||||
my @colwidths=(0);
|
||||
my $tabcount=0;
|
||||
|
||||
verbose("converting tables in $doc_name");
|
||||
foreach my $line (@inlines) {
|
||||
if ($line =~ /\<\!---/) { $in_comment=1; next; }
|
||||
if ($in_comment) {
|
||||
if ($line =~ /begin_xcat_table/) {$xcat_table=1; next;}
|
||||
if ($xcat_table) {
|
||||
if ($line =~ /numcols=(\d+)/) { $numcols=$1; next;}
|
||||
if ($line =~ /colwidths=([\d,]+)/) { @colwidths=split(',',$1); next;}
|
||||
}
|
||||
if ($line =~ /end_xcat_table/) {
|
||||
my $separator = '+';
|
||||
foreach my $c (@colwidths) {
|
||||
if ($c > 0) { $separator .= '-' x $c; }
|
||||
$separator .= '+';
|
||||
}
|
||||
$separator .= "\n";
|
||||
my $headsep = $separator;
|
||||
$headsep =~ s/-/=/g;
|
||||
my $rowline = $separator;
|
||||
$rowline =~ s/-/ /g;
|
||||
|
||||
my $nosep=0;
|
||||
foreach my $tabline(@tablines) {
|
||||
if ($tabline =~ /^\s*$/) { next;}
|
||||
if ($tabline =~ /^\-\-/) {
|
||||
push (@outlines,$headsep);
|
||||
$nosep = 1;
|
||||
next;
|
||||
}
|
||||
if ($nosep) { $nosep=0;} else {push (@outlines,$separator);}
|
||||
$tabline =~ s/^\s*\|//;
|
||||
my @vals = split (/\|/,$tabline);
|
||||
my $last_cell_line=0;
|
||||
my $colnum=0;
|
||||
my @tabrow;
|
||||
foreach my $c (@colwidths) {
|
||||
if ($c > 0) {
|
||||
my $colval=$vals[$colnum];
|
||||
$colval =~ s/(\s*)$//;
|
||||
my $vallen = length($colval);
|
||||
my $cell_line=0;
|
||||
while ($vallen > $c) {
|
||||
$tabrow[$cell_line++][$colnum] = substr($colval,0,$c);
|
||||
$vallen -= $c;
|
||||
$colval = substr($colval,$c,$vallen);
|
||||
}
|
||||
$tabrow[$cell_line][$colnum] = substr($colval,0,$vallen);
|
||||
if ($vallen < $c) {
|
||||
$tabrow[$cell_line][$colnum] .= " " x ($c-$vallen);
|
||||
}
|
||||
$last_cell_line = max($cell_line,$last_cell_line);
|
||||
}
|
||||
$colnum++;
|
||||
}
|
||||
|
||||
my @rowlines;
|
||||
for (my $i=0;$i<=$last_cell_line;$i++) {
|
||||
for (my $j=0;$j<=$numcols-1;$j++) {
|
||||
$rowlines[$i] .= "|";
|
||||
if ($tabrow[$i][$j]) { $rowlines[$i] .= $tabrow[$i][$j]; }
|
||||
else { $rowlines[$i] .= " " x $colwidths[$j]; }
|
||||
}
|
||||
$rowlines[$i] .= "|\n";
|
||||
}
|
||||
push (@outlines,@rowlines);
|
||||
}
|
||||
push (@outlines,$separator);
|
||||
|
||||
# reset to process next table
|
||||
@tablines = ();
|
||||
$xcat_table=0; $numcols=1;@colwidths=(0);next;
|
||||
}
|
||||
if ($line =~ /--\>/) {$in_comment=0;next;}
|
||||
next;
|
||||
}
|
||||
if ($xcat_table) { push (@tablines,$line); next; }
|
||||
|
||||
push (@outlines,$line);
|
||||
next;
|
||||
}
|
||||
|
||||
open(MD2FILE, ">$outfile") or die "Could not open >$outfile";
|
||||
print MD2FILE @outlines;
|
||||
close MD2FILE;
|
||||
|
||||
return;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
xcatclient
|
||||
+78
-23
@@ -147,29 +147,41 @@ if ( -e "/etc/debian_version" ){
|
||||
# determine whether redhat or sles
|
||||
$::linuxos = xCAT::Utils->osver();
|
||||
|
||||
# is this MariaDB or MySQL
|
||||
$::MariaDB=0;
|
||||
my $cmd;
|
||||
if ( $::debianflag ){
|
||||
$cmd = "dpkg -l | grep mariadb";
|
||||
} else {
|
||||
$cmd = "rpm -qa | grep -i mariadb"; # check this is MariaDB not MySQL
|
||||
}
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC == 0) {
|
||||
$::MariaDB=1;
|
||||
}
|
||||
|
||||
#
|
||||
# check to see if mysql is installed
|
||||
#
|
||||
my $cmd = "rpm -qa | grep -i perl-DBD-mysql";
|
||||
$cmd = "rpm -qa | grep -i perl-DBD-mysql";
|
||||
my $msg = "\nMySQL perl DBD ";
|
||||
if ( $::debianflag ){
|
||||
$cmd = "dpkg -l | grep mysql-server";
|
||||
if ( $::MariaDB ){
|
||||
$cmd = "dpkg -l | grep -i mariadb-server";
|
||||
$msg = "\nmariadb-server ";
|
||||
} else {
|
||||
$cmd = "dpkg -l | grep mysql-server";
|
||||
$msg = "\nmysql-server ";
|
||||
}
|
||||
}
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $message =
|
||||
"\nMySQL perl DBD is not installed. If on AIX, it should be first obtained from the xcat dependency tarballs and installed before running this command.\n If on Linux, install from the OS CDs.";
|
||||
"\n$msg is not installed. If on AIX, it should be first obtained from the xcat dependency tarballs and installed before running this command.\n If on Linux, install from the OS CDs.";
|
||||
xCAT::MsgUtils->message("E", " $cmd failed. $message");
|
||||
exit(1);
|
||||
}
|
||||
# is this MariaDB or MySQL
|
||||
$::MariaDB=0;
|
||||
$cmd = "rpm -qa | grep -i mariadb"; # check this is MariaDB not MySQL
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC == 0) {
|
||||
$::MariaDB=1;
|
||||
}
|
||||
|
||||
# check to see if MySQL is running
|
||||
$::mysqlrunning = 0;
|
||||
$::xcatrunningmysql = 0;
|
||||
@@ -187,6 +199,29 @@ if (grep(/$mysqlcheck/, @output))
|
||||
}
|
||||
$::mysqlrunning = 1;
|
||||
}
|
||||
|
||||
#for ubuntu 14, after install mysql/maria server, the mysql will running
|
||||
#need to stop mysql in order to setup init xcat mysql
|
||||
if ( $::debianflag ){
|
||||
$cmd = "pidof mysqld";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC == 0)
|
||||
{
|
||||
if ($::INIT)
|
||||
{
|
||||
my $ret=xCAT::Utils->stopservice("mysql");
|
||||
if ($ret != 0)
|
||||
{
|
||||
xCAT::MsgUtils->message("E", " failed to stop mysql/mariadb.");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$::mysqlrunning = 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (-e ("/etc/xcat/cfgloc")) # check to see if xcat is using mysql
|
||||
{ # cfgloc exists
|
||||
$cmd = "fgrep mysql /etc/xcat/cfgloc";
|
||||
@@ -608,13 +643,16 @@ sub shutdownxcatd
|
||||
if ($::osname eq 'AIX')
|
||||
{
|
||||
$xcmd = "stopsrc -s xcatd";
|
||||
system($xcmd);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$xcmd = "service xcatd stop";
|
||||
#$xcmd = "service xcatd stop";
|
||||
my $ret=xCAT::Utils->stopservice("xcatd");
|
||||
return $ret;
|
||||
}
|
||||
system($xcmd);
|
||||
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -861,6 +899,7 @@ sub initmysqldb
|
||||
sub mysqlstart
|
||||
{
|
||||
my $cmd;
|
||||
my $ret=0;
|
||||
if ($::osname eq 'AIX')
|
||||
{
|
||||
my $hostname = `hostname`;
|
||||
@@ -872,28 +911,34 @@ sub mysqlstart
|
||||
$cmd = $cmd2;
|
||||
$cmd .=
|
||||
"$::installdir/bin/mysqld --user=mysql --basedir=$::installdir --datadir=/var/lib/mysql --user=mysql --log-error=/var/lib/mysql/$hostname.err --pid-file=/var/lib/mysql/$hostname.pid --socket=/tmp/mysql.sock --port=3306 &";
|
||||
$ret=xCAT::Utils->runcmd($cmd, 0);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($::MariaDB==1) { # running MariaDB
|
||||
$cmd = "service mariadb start";
|
||||
if ($::linuxos =~ /rh.*/) {
|
||||
$ret=xCAT::Utils->startservice("mariadb");
|
||||
} else { # sles
|
||||
$ret=xCAT::Utils->startservice("mysql");
|
||||
}
|
||||
|
||||
} else { # it is mysql
|
||||
|
||||
if ($::linuxos =~ /rh.*/)
|
||||
{
|
||||
$cmd = "service mysqld start";
|
||||
$ret=xCAT::Utils->startservice("mysqld");
|
||||
}
|
||||
else
|
||||
{ # sles
|
||||
$cmd = "service mysql start";
|
||||
$ret=xCAT::Utils->startservice("mysql");
|
||||
}
|
||||
}
|
||||
}
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
if ($ret != 0)
|
||||
{
|
||||
xCAT::MsgUtils->message("E", " $cmd failed.");
|
||||
xCAT::MsgUtils->message("E", " failed to start mysql/mariadb.");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -986,7 +1031,15 @@ sub mysqlreboot
|
||||
{
|
||||
if ($::MariaDB==1 ) { # MariaDB not MySQL
|
||||
|
||||
if ($::linuxos =~ /rh.*/) {
|
||||
$cmd = "chkconfig mariadb on";
|
||||
} else { #sles
|
||||
$cmd = "chkconfig mysql on";
|
||||
if ( $::debianflag ){
|
||||
$cmd = "update-rc.d mysql defaults";
|
||||
}
|
||||
|
||||
}
|
||||
} else { # mysql
|
||||
if ($::linuxos =~ /rh.*/)
|
||||
{
|
||||
@@ -1780,7 +1833,7 @@ sub restorexcatdb
|
||||
# restore the database
|
||||
xCAT::MsgUtils->message(
|
||||
"I",
|
||||
"Restoring the xCat Database with $::backupdir to MySQL database.\nThis could take several minutes."
|
||||
"Restoring the xCAT Database with $::backupdir to MySQL database.\nThis could take several minutes."
|
||||
);
|
||||
if (!(-d $::backupdir))
|
||||
{ # does not exist, error
|
||||
@@ -1809,12 +1862,14 @@ sub restorexcatdb
|
||||
if ($::osname eq 'AIX')
|
||||
{
|
||||
$xcmd = "$::XCATROOT/sbin/restartxcatd";
|
||||
|
||||
system($xcmd);
|
||||
}
|
||||
else
|
||||
{
|
||||
$xcmd = "service xcatd restart";
|
||||
#$xcmd = "service xcatd restart";
|
||||
my $ret=xCAT::Utils->restartservice("xcatd");
|
||||
return $ret;
|
||||
}
|
||||
system($xcmd);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+64
-30
@@ -180,7 +180,8 @@ if ($::RUNCMD_RC != 0)
|
||||
exit(1);
|
||||
}
|
||||
# check if 9.X release not built by us is installed, setup different
|
||||
if (grep(/postgresql9/, @output)) { # postgresql 9.x
|
||||
# SLES used default dir
|
||||
if ( (grep(/postgresql9/, @output)) && ($::linuxos !~ /sles/) ){ # postgresql 9.x
|
||||
# figure out which 9.x release and build path
|
||||
my @parseout= split(/\-/, $output[0]);
|
||||
my @ptflevel= split ("postgresql9",$parseout[0]);
|
||||
@@ -336,14 +337,14 @@ if (($INIT) && ($xcatrunningpgsql == 0))
|
||||
#
|
||||
# Init Pg database and setup pg_hba.conf and postgresql.conf
|
||||
#
|
||||
&initpgdb;
|
||||
&initpgdb;
|
||||
|
||||
#
|
||||
# Start Postgresql server
|
||||
#
|
||||
if ($pgsqlrunning == 0) # if not already running
|
||||
{
|
||||
&pgstart;
|
||||
&pgstart(0);
|
||||
}
|
||||
|
||||
#
|
||||
@@ -444,13 +445,16 @@ sub shutdownxcatd
|
||||
if ($::osname eq 'AIX')
|
||||
{
|
||||
$xcmd = "stopsrc -s xcatd";
|
||||
system($xcmd);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$xcmd = "service xcatd stop";
|
||||
# $xcmd = "service xcatd stop";
|
||||
my $ret=xCAT::Utils->stopservice("xcatd");
|
||||
return $ret;
|
||||
}
|
||||
system($xcmd);
|
||||
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -702,6 +706,7 @@ sub runpgcmd_chkoutput
|
||||
sub initpgdb
|
||||
{
|
||||
my $cmd;
|
||||
my $dbrestart = 0;
|
||||
|
||||
# init the database, must su to postgres
|
||||
|
||||
@@ -756,6 +761,7 @@ sub initpgdb
|
||||
xCAT::MsgUtils->message("E", " $cmd failed.");
|
||||
exit(1);
|
||||
}
|
||||
$dbrestart = 1;
|
||||
}
|
||||
|
||||
# setup the postgresql.conf file
|
||||
@@ -797,6 +803,7 @@ sub initpgdb
|
||||
$cmd = qq~echo log_min_messages = notice >> $pgconf~;
|
||||
`$cmd`;
|
||||
}
|
||||
$dbrestart = 1;
|
||||
}
|
||||
# make sure everything in /var/lib/pgsql/data is owned by postgres
|
||||
if ($::installdatadir) { # for protection
|
||||
@@ -816,6 +823,11 @@ sub initpgdb
|
||||
}
|
||||
|
||||
}
|
||||
if ($dbrestart){
|
||||
&pgstart(1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -823,15 +835,20 @@ sub initpgdb
|
||||
=head3 pgstart
|
||||
|
||||
|
||||
Start the Postgresql server
|
||||
Start or restart the Postgresql server
|
||||
startflg = 0 start postgresql
|
||||
startflg = 1 restart postgresql
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
sub pgstart
|
||||
|
||||
{
|
||||
my $startflg = shift;
|
||||
my $cmd;
|
||||
my $ret=0;
|
||||
xCAT::MsgUtils->message("I", "Starting the PosgreSQL Server");
|
||||
if ($::osname eq 'AIX')
|
||||
{
|
||||
@@ -843,27 +860,37 @@ sub pgstart
|
||||
else # linux
|
||||
{
|
||||
if (defined($::postgres9)) { # set to the PTF level of postgresql 9.X
|
||||
$cmd = "service postgresql-9.$::postgres9 start";
|
||||
#$cmd = "service postgresql-9.$::postgres9 start";
|
||||
$cmd = "postgresql-9.$::postgres9";
|
||||
} else {
|
||||
$cmd = "service postgresql start";
|
||||
#$cmd = "service postgresql start";
|
||||
$cmd = "postgresql";
|
||||
}
|
||||
system($cmd);
|
||||
if ($? > 0) {
|
||||
xCAT::MsgUtils->message("E", " $cmd failed.");
|
||||
if ($startflg == 0) {
|
||||
$ret=xCAT::Utils->startservice($cmd);
|
||||
} else {
|
||||
$ret=xCAT::Utils->restartservice($cmd);
|
||||
}
|
||||
if ($ret != 0) {
|
||||
xCAT::MsgUtils->message("E", " failed to start $cmd.");
|
||||
exit(1);
|
||||
}
|
||||
# check to see if running before continuing
|
||||
my $retries =0;
|
||||
my $pgstarted =0;
|
||||
if (defined($::postgres9)) { # set to the PTF level of postgresql 9.X
|
||||
$cmd = "service postgresql-9.$::postgres9 status";
|
||||
} else {
|
||||
$cmd = "service postgresql status";
|
||||
}
|
||||
#if (defined($::postgres9)) { # set to the PTF level of postgresql 9.X
|
||||
# #$cmd = "service postgresql-9.$::postgres9 status";
|
||||
# $ret=xCAT::Utils->checkservicestatus("postgresql-9.$::postgres9");
|
||||
#} else {
|
||||
# #$cmd = "service postgresql status";
|
||||
# $ret=xCAT::Utils->checkservicestatus("postgresql");
|
||||
#}
|
||||
while ($retries < 30) {
|
||||
$retries++;
|
||||
my @status=xCAT::Utils->runcmd($cmd, -1);
|
||||
if (grep(/[r|R]unning/, @status)) {
|
||||
#my @status=xCAT::Utils->runcmd($cmd, -1);
|
||||
#if (grep(/[r|R]unning/, @status)) {
|
||||
$ret=xCAT::Utils->checkservicestatus($cmd);
|
||||
if($ret == 0){
|
||||
$pgstarted=1;
|
||||
last;
|
||||
}
|
||||
@@ -903,18 +930,22 @@ sub pgreboot
|
||||
else # linux
|
||||
{
|
||||
if (defined($::postgres9)) { # set to the postgresql ptf level
|
||||
$cmd = "chkconfig postgresql-9.$::postgres9 on";
|
||||
# $cmd = "chkconfig postgresql-9.$::postgres9 on";
|
||||
$cmd = "postgresql-9.$::postgres9";
|
||||
} else {
|
||||
$cmd = "chkconfig postgresql on";
|
||||
#$cmd = "chkconfig postgresql on";
|
||||
$cmd = "postgresql";
|
||||
}
|
||||
if ($debianflag){
|
||||
$cmd = "update-rc.d postgresql defaults";
|
||||
}
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
#if ($debianflag){
|
||||
#$cmd = "update-rc.d postgresql defaults";
|
||||
#}
|
||||
#xCAT::Utils->runcmd($cmd, 0);
|
||||
#if ($::RUNCMD_RC != 0)
|
||||
my $ret=xCAT::Utils->enableservice($cmd);
|
||||
if($cmd !=0 )
|
||||
{
|
||||
xCAT::MsgUtils->message("E",
|
||||
" $cmd failed. PostgreSQL will not restart on reboot.");
|
||||
"enable service $cmd failed. PostgreSQL will not restart on reboot.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -956,7 +987,7 @@ sub setupxcatdb
|
||||
$cmd = "/var/lib/pgsql/bin/psql -d $::dbname -U postgres";
|
||||
} else { # Linux
|
||||
$cmd = "$::pgcmddir/psql -d $::dbname -U postgres";
|
||||
if ($debianflag){
|
||||
if ( ($debianflag) || ($::linuxos =~ /sles/) ){
|
||||
$cmd = "su - postgres -c '$::pgcmddir/psql -d $::dbname -U postgres'";
|
||||
}
|
||||
}
|
||||
@@ -1315,7 +1346,7 @@ sub restorexcatdb
|
||||
# restore the database
|
||||
xCAT::MsgUtils->message(
|
||||
"I",
|
||||
"Restoring the xCat Database with $::backupdir to PostgreSQL database.\nThis could take several minutes."
|
||||
"Restoring the xCAT Database with $::backupdir to PostgreSQL database.\nThis could take several minutes."
|
||||
);
|
||||
if (!(-d $::backupdir))
|
||||
{ # does not exist, error
|
||||
@@ -1347,12 +1378,15 @@ sub restorexcatdb
|
||||
if ($::osname eq 'AIX')
|
||||
{
|
||||
$xcmd = "startsrc -s xcatd";
|
||||
system($xcmd);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$xcmd = "service xcatd start";
|
||||
#$xcmd = "service xcatd start";
|
||||
my $ret=xCAT::Utils->startservice("xcatd");
|
||||
return $ret;
|
||||
}
|
||||
system($xcmd);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -169,7 +169,11 @@ sub nmap_pping {
|
||||
foreach (@$nodes) {
|
||||
$deadnodes{$_}=1;
|
||||
}
|
||||
open (FPING, "nmap -PE --system-dns --send-ip -sP ".join(' ',@$nodes). " 2> /dev/null|") or die("Cannot open nmap pipe: $!");
|
||||
# get additional options from site table
|
||||
my @nmap_options = xCAT::TableUtils->get_site_attribute("nmapoptions");
|
||||
my $more_options = $nmap_options[0];
|
||||
|
||||
open (FPING, "nmap -PE --system-dns --send-ip -sP $more_options ".join(' ',@$nodes). " 2> /dev/null|") or die("Cannot open nmap pipe: $!");
|
||||
my $node;
|
||||
while (<FPING>) {
|
||||
if (/Host (.*) \(.*\) appears to be up/) {
|
||||
|
||||
@@ -69,7 +69,7 @@ my $client = IO::Socket::SSL->new(
|
||||
SSL_cert_file=>$homedir."/.xcat/client-cred.pem",
|
||||
SSL_ca_file => $homedir."/.xcat/ca.pem",
|
||||
SSL_use_cert => 1,
|
||||
#SSL_verify_mode => 1,
|
||||
SSL_verify_mode => 1,
|
||||
);
|
||||
die "Connection failure: $!\n" unless ($client);
|
||||
my %cmdref = (command => 'noderange', noderange => $noderange);
|
||||
|
||||
+44
-13
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
# Provide serial console access to nodes
|
||||
|
||||
@@ -13,7 +13,7 @@ if [ "$os" == "AIX" ]; then
|
||||
export HOME
|
||||
fi
|
||||
|
||||
if [ -z "$1" ] || [ "$1" = "-h" ]; then
|
||||
if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "-help" ] || [ "$1" = "--help" ]; then
|
||||
echo "rcons - remotely accesses the serial console of a node"
|
||||
echo "rcons <singlenode> [conserver] [-f]"
|
||||
echo "rcons <singlenode> [conserver] [-s]"
|
||||
@@ -21,7 +21,11 @@ if [ -z "$1" ] || [ "$1" = "-h" ]; then
|
||||
exit 0
|
||||
fi
|
||||
if [ "$1" = "-v" ]; then
|
||||
echo "Version 2.8"
|
||||
echo "Version 2.9"
|
||||
exit 0
|
||||
fi
|
||||
if [ "$1" = "--version" ]; then
|
||||
echo "Version 2.9"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -48,7 +52,27 @@ if [ -n "$2" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f "/usr/bin/console" ] || [ -f "/bin/console" ]; then
|
||||
if [ -x "/opt/confluent/bin/confetty" ] || [ -x "/usr/bin/confetty" ]; then
|
||||
#use confluent
|
||||
CONFETTY="confetty"
|
||||
if [ -x "/opt/confluent/bin/confetty" ]; then
|
||||
CONFETTY="/opt/confluent/bin/confetty"
|
||||
fi
|
||||
if [ ! -z "$CONSCONTROLPATH" ]; then
|
||||
CONSCONTROLPATH="-c $CONSCONTROLPATH"
|
||||
fi
|
||||
if [ -z "$CONSERVER" ]; then
|
||||
CONSERVER=`nodels $1 nodehm.conserver 2>/dev/null | awk -F: '{print $2}' | tr -d ' '`
|
||||
fi
|
||||
|
||||
if [ -z "$CONSERVER" ]; then
|
||||
CONSERVER=$XCATHOST
|
||||
fi
|
||||
if [ ! -z "$CONSERVER" ]; then
|
||||
CONSERVER="-s $CONSERVER"
|
||||
fi
|
||||
$CONFETTY $CONSCONTROLPATH $CONSERVER $1
|
||||
elif [ -f "/usr/bin/console" ] || [ -f "/bin/console" ]; then
|
||||
#use conserver
|
||||
if [ -z "$CONSERVER" ]; then
|
||||
CONSERVER=`nodels $1 nodehm.conserver 2>/dev/null | awk -F: '{print $2}' | tr -d ' '`
|
||||
@@ -66,14 +90,17 @@ if [ -f "/usr/bin/console" ] || [ -f "/bin/console" ]; then
|
||||
|
||||
#Detect console support of SSL, only fixup consolerc if encryption is detected
|
||||
if ! console -h 2>&1 | grep "encryption not compiled" > /dev/null; then
|
||||
if [ ! -f $HOME/.consolerc ]; then
|
||||
echo 'config * {' > $HOME/.consolerc
|
||||
echo " port 782;" >> $HOME/.consolerc
|
||||
echo " sslenabled yes;" >> $HOME/.consolerc
|
||||
echo " sslauthority $HOME/.xcat/ca.pem;" >> $HOME/.consolerc
|
||||
echo " sslcredentials $HOME/.xcat/client-cred.pem;" >> $HOME/.consolerc
|
||||
echo '}' >> $HOME/.consolerc
|
||||
fi
|
||||
# generate .consolerc if it does not exist or is empty
|
||||
if [ ! -s $HOME/.consolerc ]; then
|
||||
cat > $HOME/.consolerc << EOF
|
||||
config * {
|
||||
port 782;
|
||||
sslenabled yes;
|
||||
sslauthority $HOME/.xcat/ca.pem;
|
||||
sslcredentials $HOME/.xcat/client-cred.pem;
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
else
|
||||
# ssl is not enabled, comment out the ssl settings in .consolerc
|
||||
if [ -f $HOME/.consolerc ]; then
|
||||
@@ -115,7 +142,11 @@ else
|
||||
length=`expr $index2 - $index1`
|
||||
length=`expr $length - 1`
|
||||
cons_ip=`expr substr "$result" $pos $length`
|
||||
ifconfig |grep "$cons_ip"
|
||||
if [ "$os" == "AIX" ]; then
|
||||
ifconfig |grep "$cons_ip"
|
||||
else
|
||||
ip addr |grep "$cons_ip"
|
||||
fi
|
||||
if [ $? -eq 0 ]; then
|
||||
CONSERVER=""
|
||||
fi
|
||||
|
||||
+56
-168
@@ -1,12 +1,11 @@
|
||||
#!/usr/bin/env perl
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
# Used as a convience command combined of [nodech]-nodeset-rpower-[rcons/wcons]
|
||||
# Used as a convience command combined of [nodech]-nodeset-rsetboot-rpower-[rcons/wcons]
|
||||
# to make ease of node OS provision
|
||||
|
||||
# To use this, sym link your cmd name to this script.
|
||||
# This is the client front-end to rinstall/winstall commands
|
||||
|
||||
use strict;
|
||||
|
||||
BEGIN
|
||||
{
|
||||
@@ -20,180 +19,69 @@ use lib "$::XCATROOT/lib/perl";
|
||||
use File::Basename;
|
||||
use Getopt::Long;
|
||||
use xCAT::MsgUtils;
|
||||
use xCAT::Table;
|
||||
use xCAT::NodeRange;
|
||||
use xCAT::Utils;
|
||||
use xCAT::Client;
|
||||
use Cwd;
|
||||
use strict;
|
||||
|
||||
|
||||
sub usage {
|
||||
print basename($0)." usage:\n";
|
||||
print " ".basename($0)." [-o|--osver] [-p|--profile] [-a|--arch] [-O|--osimage] [-c|--console] <noderange>\n"
|
||||
}
|
||||
|
||||
|
||||
|
||||
my $OSVER;
|
||||
my $PROFILE;
|
||||
my $ARCH;
|
||||
my $CONSOLE;
|
||||
my $OSIMAGE;
|
||||
|
||||
Getopt::Long::Configure("bundling");
|
||||
unless (GetOptions(
|
||||
'o|osver=s' => \$OSVER,
|
||||
'p|profile=s' => \$PROFILE,
|
||||
'a|arch=s' => \$ARCH,
|
||||
'O|osimage=s' => \$OSIMAGE,
|
||||
'c|console' => \$CONSOLE
|
||||
)) {
|
||||
usage;
|
||||
exit 1;
|
||||
}
|
||||
my $arraysize=@ARGV;
|
||||
if ($arraysize > 1) {
|
||||
print "noderange invalid\n";
|
||||
usage;
|
||||
exit 1;
|
||||
}
|
||||
if ($arraysize == 0) {
|
||||
print "noderange not supplied\n";
|
||||
usage;
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $noderange=@ARGV[0];
|
||||
my $rc=0;
|
||||
my %pnhash;
|
||||
my @allnodes;
|
||||
#use Data::Dumper;
|
||||
|
||||
# check and complain about the invalid combination of the options,
|
||||
# called when -O is specified or nodetype.provmethod=<osimage>,
|
||||
# ignore -o,-p and -a options and prompt a warning message
|
||||
sub checkoption{
|
||||
my $optstring=shift;
|
||||
if($OSVER) {print 'warning: "'.$optstring.'" specified, "[-o|--osver] '.$OSVER."\" ignored\n"};
|
||||
if($PROFILE) {print 'warning: "'.$optstring.'" specified, "[-p|--profile] '.$PROFILE."\" ignored\n"};
|
||||
if($ARCH) {print 'warning: "'.$optstring.'" specified, "[-a|--arch] '.$OSVER."\" ignored\n"};
|
||||
}
|
||||
|
||||
|
||||
@allnodes=noderange($noderange);
|
||||
if($OSIMAGE){
|
||||
|
||||
# -O|--osimage is specified, ignore any -a,-p,-o options,
|
||||
# call "nodeset ... osimage= ..." to set the boot state of the noderange to the specified osimage,
|
||||
# "nodeset" will handle the updating of node attributes such as os,arch,profile,provmethod
|
||||
|
||||
&checkoption("[-O|--osimage] $OSIMAGE");
|
||||
$rc=system("nodeset $noderange osimage=$OSIMAGE");
|
||||
if ($rc) {
|
||||
xCAT::MsgUtils->message("E","nodeset failure");
|
||||
exit 1;
|
||||
};
|
||||
}else
|
||||
# build a request to go the rinstall plugin
|
||||
my $bname = basename($0);
|
||||
my $cmdref;
|
||||
$cmdref->{command}->[0] = $bname;
|
||||
$cmdref->{cwd}->[0] = cwd();
|
||||
# allows our plugins to get the stdin of the cmd that invoked the plugin
|
||||
my $data;
|
||||
if ( (($^O =~ /^linux/i) && ($ENV{'SHELL'} =~ /\/ksh$/)) || !defined($ENV{'TERM'}) )
|
||||
{
|
||||
|
||||
# no osimage specified, update the node attributes specified by -a,-p,-o options thru "nodech",
|
||||
# then set the boot state of each node based on the nodetype.provmethod:
|
||||
# 1) if nodetype.provmethod = <osimage>, ignore any -p,-o,-a option, then call "nodeset ... osimage"
|
||||
# 2) if nodetype.provmethod = [install/netboot/statelite], update the node attributes specified by -a,-p,-o options thru "nodech", call "nodeset ... [install/netboot/statelite]"
|
||||
# 3) if nodetype.provmethod is not set, use 'install' as the default value
|
||||
|
||||
# group the nodes according to the nodetype.provmethod
|
||||
|
||||
foreach(@allnodes){
|
||||
my $tab=xCAT::Table->new("nodetype");
|
||||
my $nthash=$tab->getNodeAttribs($_,['provmethod']);
|
||||
$tab->close();
|
||||
if(defined($nthash) and defined($nthash->{'provmethod'}))
|
||||
{
|
||||
push(@{$pnhash{$nthash->{'provmethod'}}},$_);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if nodetype.provmethod is not specified,
|
||||
push(@{$pnhash{'install'}},$_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach my $key (keys %pnhash)
|
||||
{
|
||||
my $rclocal=0;
|
||||
my $nodes=join(',',@{$pnhash{$key}});
|
||||
if($key =~ /^(install|netboot|statelite)$/)
|
||||
{
|
||||
|
||||
# nodetype.provmethod = [install|netboot|statelite]
|
||||
my $nodechline = "";
|
||||
if ($OSVER) {
|
||||
$nodechline = "nodetype.os=$OSVER";
|
||||
}
|
||||
if ($PROFILE) {
|
||||
$nodechline .= " nodetype.profile=$PROFILE";
|
||||
}
|
||||
if ($ARCH) {
|
||||
$nodechline .= " nodetype.arch=$ARCH";
|
||||
}
|
||||
if ($nodechline) {
|
||||
$rclocal=system("nodech $nodes $nodechline");
|
||||
if ($rclocal) {
|
||||
print "nodech failure\n";
|
||||
$rc=$rclocal;
|
||||
}
|
||||
}
|
||||
|
||||
unless($rc){
|
||||
$rclocal=system("nodeset $nodes $key");
|
||||
if ($rclocal) {
|
||||
print "nodeset $nodes failure\n";
|
||||
$rc=$rclocal;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
# nodetype.provmethod = <osimage>
|
||||
&checkoption("nodetype.provmethod=$key");
|
||||
$rclocal=system("nodeset $nodes osimage");
|
||||
if ($rclocal) {
|
||||
print "nodeset $nodes failure\n";
|
||||
$rc=$rclocal;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
my $rin="";
|
||||
my $rout;
|
||||
vec($rin,fileno(STDIN),1)=1;
|
||||
my $nfound=select($rout=$rin,"","",1);
|
||||
if ($nfound)
|
||||
{
|
||||
while ( <STDIN> ) { $data.=$_; }
|
||||
$cmdref->{stdin}->[0]=$data;
|
||||
}
|
||||
}
|
||||
|
||||
if($rc){
|
||||
xCAT::MsgUtils->message("E","nodeset failure");
|
||||
exit 1;
|
||||
else
|
||||
{
|
||||
if (-p STDIN) {
|
||||
while ( <STDIN> ) { $data.=$_; }
|
||||
$cmdref->{stdin}->[0]=$data;
|
||||
}
|
||||
}
|
||||
my $arg;
|
||||
my @tmpargv = @ARGV;
|
||||
# first
|
||||
$arg=shift(@ARGV);
|
||||
# first 1st non-hyphen arg is the noderange
|
||||
while ($arg =~ /^-/) {
|
||||
push (@{$cmdref->{arg}}, $arg);
|
||||
$arg=shift(@ARGV);
|
||||
}
|
||||
$cmdref->{noderange}->[0]=$arg;
|
||||
push (@{$cmdref->{arg}}, @ARGV);
|
||||
|
||||
# call "rsetboot" to set the boot order of the nodehm.mgt=ipmi nodes,for others, assume user has set the correct boot order before "rinstall"
|
||||
system("rsetboot $noderange net");
|
||||
my $noderange=$cmdref->{noderange}->[0]; # save the noderange
|
||||
|
||||
# call "rpower" to start the node provision process
|
||||
$rc=system("rpower $noderange boot");
|
||||
if ($rc) {
|
||||
xCAT::MsgUtils->message("E","rpower failure");
|
||||
exit 1;
|
||||
};
|
||||
# ok call Client to run the plugin rinstall.pm
|
||||
xCAT::Client::submit_request($cmdref,\&xCAT::Client::handle_response);
|
||||
|
||||
if ($xCAT::Client::EXITCODE == 0) # no errors
|
||||
{
|
||||
my $startconsole=$cmdref->{startconsole}->[0];
|
||||
# if startconsole requested ( -c flag) for rinstall always for winstall
|
||||
# This is set in the rinstall plugin
|
||||
if ($startconsole == 1) {
|
||||
if (basename($0) =~ /rinstall/) {
|
||||
|
||||
if (basename($0) =~ /rinstall/) {
|
||||
|
||||
# for rinstall, the -c|--console option can provide the remote console for only 1 node
|
||||
if ($CONSOLE) {
|
||||
if(scalar @allnodes ne 1){
|
||||
xCAT::MsgUtils->message("E","rinstall [-c|--console] will only work if there is only one node in the noderange. See winstall(8) for consoles on multiple systems");
|
||||
exit 1;
|
||||
}
|
||||
exec("rcons $noderange");
|
||||
}
|
||||
} elsif (basename($0) =~ /winstall/) {
|
||||
# winstall can commence a wcons command to the noderange for monitoring the provision cycle
|
||||
elsif (basename($0) =~ /winstall/) {
|
||||
# winstall can commence a wcons command to the noderange for monitoring the provision cycle
|
||||
|
||||
exec("wcons $noderange");
|
||||
exec("wcons $noderange");
|
||||
}
|
||||
}
|
||||
}
|
||||
exit $xCAT::Client::EXITCODE;
|
||||
|
||||
+21
-5
@@ -3,6 +3,8 @@
|
||||
use Getopt::Long qw(:config getopt_compat pass_through);
|
||||
use File::Basename;
|
||||
BEGIN { $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; }
|
||||
use IO::Socket::UNIX;
|
||||
use Time::HiRes qw/sleep/;
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
use xCAT::Client;
|
||||
#use Data::Dumper;
|
||||
@@ -54,7 +56,6 @@ foreach (@nodes) {
|
||||
$conservers{$_} =~ s/:.*//;
|
||||
next;
|
||||
}
|
||||
$conservers{$_} = 'localhost';
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +83,7 @@ if (defined($tilefact)) {
|
||||
$screenheight=$1;
|
||||
}
|
||||
}
|
||||
$rootinf = `xwininfo -name "Top Panel"`;
|
||||
$rootinf = `xwininfo -name "Top Panel" 2> /dev/null`;
|
||||
foreach (split /\n/,$rootinf) {
|
||||
if (/-geometry\s+([0-9]+)x([0-9]+)\+([0-9]+)\+([0-9]+)/) {
|
||||
if ($1 > 640 and $2 < 480 and $3 == 0 and $4 == 0) {
|
||||
@@ -91,7 +92,7 @@ if (defined($tilefact)) {
|
||||
}
|
||||
}
|
||||
if ($panel_pad == 0) {
|
||||
$rootinf = `xwininfo -name "Top Expanded Edge Panel"`;
|
||||
$rootinf = `xwininfo -name "Top Expanded Edge Panel" 2> /dev/null`;
|
||||
foreach (split /\n/,$rootinf) {
|
||||
if (/-geometry\s+([0-9]+)x([0-9]+)\+([0-9]+)\+([0-9]+)/) {
|
||||
if ($1 > 640 and $2 < 480 and $3 == 0 and $4 == 0) {
|
||||
@@ -102,9 +103,24 @@ if (defined($tilefact)) {
|
||||
}
|
||||
|
||||
|
||||
$ENV{CONSCONTROLPATH} = "/tmp/wconscontrol.$firstnode.$$";
|
||||
system("xterm $xrm -bg black -fg white -title $firstnode -n $firstnode -geometry +0+0 ".join(" ",@ARGV)." -e /bin/bash -c \"$mydir/xtcd.pl ".$ENV{DISPLAY}." $firstnode $firstnode & let SDATE=`date +%s`+5; $mydir/rcons $firstnode ".$conservers{$firstnode}."; if [ \\\$SDATE -gt \\`date +%s\\` ]; then echo Press enter to close; read SDATE; fi \" &");
|
||||
sleep(2); #Give time for window manager to figure out everything
|
||||
my $xinfo = `xwininfo -name $firstnode`;
|
||||
my $remainwait = 2;
|
||||
while (not -S "/tmp/wconscontrol.$firstnode.$$" and $remainwait > 0) {
|
||||
sleep(0.1);
|
||||
$remainwait -= 0.1;
|
||||
}
|
||||
my $xinfo;
|
||||
if (-S "/tmp/wconscontrol.$firstnode.$$") { # confluent mode
|
||||
my $controlchannel = IO::Socket::UNIX->new(Type=>SOCK_STREAM(), Peer => "/tmp/wconscontrol.$firstnode.$$");
|
||||
print $controlchannel "GETWINID\n";
|
||||
my $winid = <$controlchannel>;
|
||||
$winid = <$controlchannel>;
|
||||
$xinfo = `xwininfo -id $winid`;
|
||||
} else {
|
||||
$xinfo = `xwininfo -name $firstnode`;
|
||||
}
|
||||
|
||||
my @xinfl = split(/\n/,$xinfo);
|
||||
my $side_pad;
|
||||
my $wmxo;
|
||||
|
||||
+33
-14
@@ -443,22 +443,41 @@ sub parse_args_xdsh
|
||||
}
|
||||
|
||||
|
||||
# add config file with strict host checking no
|
||||
my $cmd = "echo \"StrictHostKeyChecking no\" >> $home/.ssh/config";
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{ # error
|
||||
$msg = "Error from $cmd\n";
|
||||
xCAT::MsgUtils->message("E", $msg);
|
||||
# add config file with strict host checking no, if not already there
|
||||
my $configinfo = "StrictHostKeyChecking no";
|
||||
my $configfile= "$home/.ssh/config";
|
||||
if (-e $configfile)
|
||||
{
|
||||
my $cmd = "grep StrictHostKeyChecking $configfile";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{ # not there
|
||||
$cmd = "echo $configinfo >> $configfile";
|
||||
my @output = xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{ # error
|
||||
xCAT::MsgUtils->message("E", "Error on $cmd, @output");
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else # file does not exist
|
||||
{
|
||||
my $cmd = "echo $configinfo >> $configfile";
|
||||
my @output = xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{ # error
|
||||
xCAT::MsgUtils->message("E", "Error on $cmd, @output");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
chmod 0600, $configfile;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
my $cmd = "chmod 0600 $home/.ssh/config";
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{ # error
|
||||
$msg = "Error from $cmd\n";
|
||||
xCAT::MsgUtils->message("E", $msg);
|
||||
}
|
||||
|
||||
# if current_userid is not "root", we need to generate the keys
|
||||
# here before becoming root while running under xcatd
|
||||
|
||||
@@ -88,4 +88,12 @@ opt/xcat/bin/xcatclient opt/xcat/bin/lshwconn
|
||||
opt/xcat/bin/xcatclientnnr opt/xcat/sbin/makeroutes
|
||||
opt/xcat/bin/xcatclientnnr opt/xcat/sbin/snmove
|
||||
opt/xcat/bin/xcatclientnnr opt/xcat/bin/lsxcatd
|
||||
opt/xcat/bin/xcatclientnnr opt/xcat/bin/lskit
|
||||
opt/xcat/bin/xcatclientnnr opt/xcat/bin/addkit
|
||||
opt/xcat/bin/xcatclientnnr opt/xcat/bin/rmkit
|
||||
opt/xcat/bin/xcatclientnnr opt/xcat/bin/lskitcomp
|
||||
opt/xcat/bin/xcatclientnnr opt/xcat/bin/addkitcomp
|
||||
opt/xcat/bin/xcatclientnnr opt/xcat/bin/rmkitcomp
|
||||
opt/xcat/bin/xcatclientnnr opt/xcat/bin/chkkitcomp
|
||||
opt/xcat/bin/xcatclientnnr opt/xcat/bin/lskitdeployparam
|
||||
opt/xcat/bin/xcatclient opt/xcat/bin/postage
|
||||
|
||||
@@ -23,8 +23,10 @@ B<chvm> I<noderange> I<--p775> B<-i id> [B<-m> I<memory_interleaving>] B<-r> I<p
|
||||
B<chvm> I<noderange> [B<lparname>={B<*>|B<name>}]
|
||||
|
||||
B<chvm> I<noderange> [B<vmcpus=min/req/max>] [B<vmmemory=min/req/max>]
|
||||
[B<vmphyslots=drc_index1,drc_index2...>] [B<vmothersetting=hugepage:N,bsr:N>]
|
||||
[B<vmnics=vlan1[,vlan2..]]> [B<vmstorage=<N|viosnode:slotid>>] [B<--vios>]
|
||||
[B<vmothersetting=hugepage:N,bsr:N>]
|
||||
[B<add_physlots=drc_index1,drc_index2...>]
|
||||
[B<add_vmnics=vlan1[,vlan2..]]> [B<add_vmstorage=<N|viosnode:slotid>>] [B<--vios>]
|
||||
[B<del_physlots=drc_index1,drc_index2...>]
|
||||
[B<del_vadapter=slotid>]
|
||||
|
||||
=head2 VMware/KVM specific:
|
||||
@@ -113,7 +115,7 @@ The administrator should use lsvm to get the profile content, and then edit the
|
||||
|
||||
For normal power machine:
|
||||
|
||||
chvm could be used to modify the resources assigned to partitions. The admin shall specify the attributes with options I<vmcpus>, I<vmmemory>, I<vmphyslots>, I<vmothersetting>, I<vmnics> and/or I<vmstorage>. If nothing specified, nothing will be returned.
|
||||
chvm could be used to modify the resources assigned to partitions. The admin shall specify the attributes with options I<vmcpus>, I<vmmemory>, I<add_physlots>, I<vmothersetting>, I<add_vmnics> and/or I<add_vmstorage>. If nothing specified, nothing will be returned.
|
||||
|
||||
=head2 VMware/KVM specific:
|
||||
|
||||
@@ -197,17 +199,21 @@ Name of I/O slots assignment profile. Shall work with option B<--p775>.
|
||||
|
||||
Set LPAR name for the specified lpars. If '*' specified, it means to get names from xCAT database and then set them for the specified lpars. If a string is specified, it only supports single node and the string will be set for the specified lpar. The user can use lsvm to check the lparnames for lpars.
|
||||
|
||||
=item B<vmcpus=value> B<vmmemory=value> B<vmphyslots=value> B<vmothersetting=value>
|
||||
=item B<vmcpus=value> B<vmmemory=value> B<add_physlots=value> B<vmothersetting=value>
|
||||
|
||||
To specify the parameters that will be modified.
|
||||
|
||||
=item B<vmnics=value> B<vmstorage=value> [B<--vios>]
|
||||
=item B<add_vmnics=value> B<add_vmstorage=value> [B<--vios>]
|
||||
|
||||
To create new virtual adapter for the specified node.
|
||||
|
||||
=item B<del_vadapter=value>
|
||||
=item B<del_physlots=drc_index1,drc_index2...>
|
||||
|
||||
To specify the slot id of the virtual adapter will be deleted.
|
||||
To delete physical slots which are specified by the I<drc_index1,drc_index2...>.
|
||||
|
||||
=item B<del_vadapter=slotid>
|
||||
|
||||
To delete a virtual adapter specified by the I<slotid>.
|
||||
|
||||
=back
|
||||
|
||||
@@ -504,7 +510,7 @@ The output is similar to:
|
||||
|
||||
To modify the resource assignment:
|
||||
|
||||
chvm lpar1 vmcpus=1/2/16 vmmemory=1G/8G/32G vmphyslots=0x21010202
|
||||
chvm lpar1 vmcpus=1/2/16 vmmemory=1G/8G/32G add_physlots=0x21010202
|
||||
|
||||
The output is similar to:
|
||||
|
||||
@@ -526,7 +532,7 @@ The resource information after modification is similar to:
|
||||
lpar1: 1/2/2
|
||||
lpar1: 128.
|
||||
|
||||
Note: The physical I/O resources specified with I<vmphyslots> will be appended to the specified partition. The physical I/O resources which are not specified but belonged to the partition will not be removed. For more information about I<vmphyslots>, please refer to L<lsvm(1)|lsvm.1>.
|
||||
Note: The physical I/O resources specified with I<add_physlots> will be appended to the specified partition. The physical I/O resources which are not specified but belonged to the partition will not be removed. For more information about I<add_physlots>, please refer to L<lsvm(1)|lsvm.1>.
|
||||
|
||||
=head2 VMware/KVM specific:
|
||||
|
||||
|
||||
@@ -6,13 +6,15 @@ B<configfpc> - discover the Fan Power Controllers (FPCs) and configure the FPC i
|
||||
|
||||
B<configfpc> B<-i> I<interface>
|
||||
|
||||
B<configfpc> B<-i> I<interface> B<--ip> I<default ip address>
|
||||
|
||||
B<configfpc> [B<-V>|B<--verbose>]
|
||||
|
||||
B<configfpc> [B<-h>|B<--help>|B<-?>]
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
B<configfpc> will discover and configure all FPCs that are set to the default IP address.
|
||||
B<configfpc> will discover and configure all FPCs that are set to the default IP address. If not supplied the default ip is 192.168.0.100.
|
||||
|
||||
The B<-i> B<interface> is required to direct B<configfpc> to the xCAT MN interface which is on the same VLAN as the FPCs.
|
||||
|
||||
@@ -24,8 +26,8 @@ The B<configfpc> command discovers the FPCs and collects the MAC address. The MA
|
||||
|
||||
This process is repeated until no more FPCs are discovered.
|
||||
|
||||
For more information on xCAT support of NeXtScale and configfpc see:
|
||||
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=XCAT_NeXtScale_Clusters
|
||||
For more information on xCAT support of NeXtScale and configfpc see the following doc:
|
||||
XCAT_NeXtScale_Clusters
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
@@ -35,6 +37,10 @@ https://sourceforge.net/apps/mediawiki/xcat/index.php?title=XCAT_NeXtScale_Clust
|
||||
|
||||
Use this flag to specify which xCAT MN interface (example: eth4) that is connected to the NeXtScale FPCs. This option is required.
|
||||
|
||||
=item B<--ip> I<default ip address>
|
||||
|
||||
Use this flag to override the default ip address of 192.168.0.100 with a new address.
|
||||
|
||||
=item B<-V>|B<--verbose>
|
||||
|
||||
Verbose mode
|
||||
@@ -51,5 +57,11 @@ To discover and configure all NeXtScale Fan Power Controllers (FPCs) connected o
|
||||
|
||||
B<configfpc> B<-i> I<eth0>
|
||||
|
||||
=item 2
|
||||
|
||||
To override the default ip address and run in Verbose mode.
|
||||
|
||||
B<configfpc> B<-i> I<eth0> B<--ip> I<196.68.0.100> B<-V>
|
||||
|
||||
=back
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ The xcatd daemon will be stopped during migration on the MN. No xCAT commands s
|
||||
|
||||
The db2sqlsetup script must be run on each Service Node, after the DB2 Client code has been installed, to setup the DB2 Client (-C). There are two postscripts that are provided ( db2install and odbcsetup) that will automatically setup you Service Node as a DB2 client.
|
||||
|
||||
For full information on the setup of DB2, see http://sourceforge.net/apps/mediawiki/xcat/index.php?title=Setting_Up_DB2_as_the_xCAT_DB.
|
||||
For full information on the setup of DB2, see Setting_Up_DB2_as_the_xCAT_DB.
|
||||
|
||||
When running of db2sqlsetup on the MN:
|
||||
One password must be supplied for the setup, a password for the xcatdb unix id which will be used as the DB2 instance id and database name. The password will be prompted for interactively or can be input with the XCATDB2PW environment variable.
|
||||
|
||||
@@ -6,9 +6,9 @@ B<genimage> - Generates a stateless image to be used for a diskless install.
|
||||
|
||||
B<genimage>
|
||||
|
||||
B<genimage> [B<-o> I<osver>] [B<-a> I<arch>] [B<-p> I<profile>] [B<-i> I<nodebootif>] [B<-n> I<nodenetdrivers>] [B<--onlyinitrd>] [B<-r> I<otherifaces>] [B<-k> I<kernelver>] [B<-g> I<krpmver>] [B<-m> I<statelite>] [B<-l> I<rootlimitsize>] [B<--permission> I<permission>] [B<--interactive>] [B<--dryrun>] [B<--ignorekernelchk>] I<imagename>
|
||||
B<genimage> [B<-o> I<osver>] [B<-a> I<arch>] [B<-p> I<profile>] [B<-i> I<nodebootif>] [B<-n> I<nodenetdrivers>] [B<--onlyinitrd>] [B<-r> I<otherifaces>] [B<-k> I<kernelver>] [B<-g> I<krpmver>] [B<-m> I<statelite>] [B<-l> I<rootlimitsize>] [B<--permission> I<permission>] [B<--interactive>] [B<--dryrun>] [B<--ignorekernelchk>] [B<--noupdate>] I<imagename>
|
||||
|
||||
B<genimage> B<-o> I<osver> [B<-a> I<arch>] B<-p> I<profile> B<-i> I<nodebootif> B<-n> I<nodenetdrivers> [B<--onlyinitrd>] [B<-r> I<otherifaces>] [B<-k> I<kernelver>] [B<-g> I<krpmver>] [B<-m> I<statelite>] [B<-l> I<rootlimitsize>] [B<--permission> I<permission>] [B<--interactive>] [B<--dryrun>]
|
||||
B<genimage> B<-o> I<osver> [B<-a> I<arch>] B<-p> I<profile> B<-i> I<nodebootif> B<-n> I<nodenetdrivers> [B<--onlyinitrd>] [B<-r> I<otherifaces>] [B<-k> I<kernelver>] [B<-g> I<krpmver>] [B<-m> I<statelite>] [B<-l> I<rootlimitsize>] [B<--permission> I<permission>] [B<--interactive>] [B<--dryrun>] [B<--noupdate>]
|
||||
|
||||
|
||||
B<genimage> [B<-h> | B<--help> | B<-v> | B<--version>]
|
||||
@@ -154,6 +154,10 @@ This flag shows the underlying call to the os specific genimage function. The us
|
||||
|
||||
Skip the kernel version checking when injecting drivers from osimage.driverupdatesrc. That means all drivers from osimage.driverupdatesrc will be injected to initrd for the specific target kernel.
|
||||
|
||||
=item B<--noupdate>
|
||||
|
||||
This flag allows the user to bypass automatic package updating when installing other packages.
|
||||
|
||||
=item B<-v|--version>
|
||||
|
||||
Display version.
|
||||
|
||||
@@ -38,7 +38,7 @@ B<osupdatename> - comma separated 'osdistroupdate' object. Each 'osdistroupdate'
|
||||
Linux distro update. When run geninitrd, 'kernel-*.rpm' will be searched from osdistroupdate.dirpath
|
||||
to get all the rpm packages and then search the drivers from the rpm packages.
|
||||
|
||||
Refer to the doc: https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Using_Linux_Driver_Update_Disk
|
||||
Refer to the doc: Using_Linux_Driver_Update_Disk
|
||||
|
||||
=back
|
||||
|
||||
|
||||
@@ -26,10 +26,14 @@ The getmacs command collects MAC address from a single or range of nodes.
|
||||
Note that on AIX systems, the returned MAC address is not colon-seperated (for example 8ee2245cf004), while on Linux systems the MAC address is colon-seperated (for example 8e:e2:24:5c:f0:04).
|
||||
If no ping test performed, getmacs writes the first adapter MAC to the xCAT database. If ping test performed, getmacs will write the first successfully pinged MAC to xCAT database.
|
||||
|
||||
For PPC (without HMC, using Direct FSP Management) specific:
|
||||
For PPC (using Direct FSP Management) specific:
|
||||
|
||||
Note: If network adapters are physically assigned to LPARs, getmacs cannot read the MAC addresses unless perform ping test, since there is no HMC command to read them and getmacs has to login to open formware. And if the LPARs has never been activated before, getmacs need to be performed with the option "B<-D>" to get theirs MAC addresses.
|
||||
|
||||
For PPC (using HMC) specific:
|
||||
|
||||
Note: The option "B<-D>" B<must> be used to get MAC addresses of LPARs.
|
||||
|
||||
For IBM Flex Compute Node (Compute Node for short) specific:
|
||||
|
||||
Note: If "B<-d>" is specified, all the MAC of the blades will be displayed. If no option specified, the first MAC address of the blade will be written to mac table.
|
||||
|
||||
@@ -4,19 +4,23 @@ B<getxcatdocs> - downloads the xCAT documentation and converts to HTML and PDF
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<getxcatdocs> [B<-?> | B<-h> | B<--help> | B<-v> | B<--version>] [I<destination-dir>]
|
||||
B<getxcatdocs> [B<-?> | B<-h> | B<--help>]
|
||||
B<getxcatdocs> [B<-v> | B<--verbose>] [I<destination-dir>]
|
||||
B<getxcatdocs> [B<-v> | B<--verbose>] [B<-c> | B<--continue>] [B<-d> | B<--doc> I<single_doc>] [I<destination-dir>]
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
The B<getxcatdocs> command downloads the xCAT documentation from the wiki and converts it to both HTML and PDF.
|
||||
This enables reading the documentation when you do not have internet access. Note that this command does not
|
||||
download/convert the entire xCAT wiki - only the "official" xCAT documentation linked from https://sourceforge.net/apps/mediawiki/xcat/index.php?title=XCAT_Documentation .
|
||||
download/convert the entire xCAT wiki - only the "official" xCAT documentation linked from http://sourceforge.net/p/xcat/wiki/XCAT_Documentation.
|
||||
|
||||
If I<destination-dir> is specified, B<getxcatdocs> will put the converted documentation in that directory, in 2 sub-directories: html, pdf.
|
||||
Otherwise, it will put it in the current directory (in the same two sub-directories).
|
||||
If I<destination-dir> is specified, B<getxcatdocs> will put the converted documentation in that directory, in 3 sub-directories: html, pdf, images.
|
||||
Otherwise, it will put it in the current directory (in the same three sub-directories).
|
||||
|
||||
B<getxcatdocs> uses wget to do the download the documents and xhtml2pdf to convert them to PDF. To install xhtml2pdf, see:
|
||||
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Editing_xCAT_Documentation_Pages#Converting_Wiki_Pages_to_HTML_and_PDFs .
|
||||
If B<--doc> I<single_doc> is specified, only that one wiki page will be downloaded and converted.
|
||||
|
||||
B<getxcatdocs> uses curl to run the Allura wiki API to download the document markdown text, and Pandoc with LaTex them to PDF. You must have all of these functions installed to run B<getxcatdocs>. See:
|
||||
http://sourceforge.net/p/xcat/wiki/Editing_and_Downloading_xCAT_Documentation/#converting-wiki-pages-to-html-and-pdfs
|
||||
|
||||
=head2 Limitations:
|
||||
|
||||
@@ -26,24 +30,28 @@ https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Editing_xCAT_Documen
|
||||
|
||||
This command does not run on AIX or Windows.
|
||||
|
||||
=item *
|
||||
|
||||
The conversion to HTML does not yet honor the xCAT wiki style sheet.
|
||||
|
||||
=back
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 10
|
||||
|
||||
=item B<-v|--version>
|
||||
|
||||
Command Version.
|
||||
|
||||
=item B<-?|-h|--help>
|
||||
|
||||
Display usage message.
|
||||
|
||||
=item B<-v|--verbose>
|
||||
|
||||
Run the command in verbose mode.
|
||||
|
||||
=item B<-c|--continue>
|
||||
|
||||
If a previous run of this command failed (which often happens if you lose your network connection), continue processing using files already downloaded to your markdown directory.
|
||||
|
||||
=item B<-d|--doc> I<single_doc>
|
||||
|
||||
Run this command for a single document only. If you get errors about Official-xcat-doc.png not found, either download this image directly from http://sourceforge.net/p/xcat/wiki/XCAT_Documentation/attachment/Official-xcat-doc.png or run B<getxcatdocs -d XCAT_Documentation> first.
|
||||
|
||||
=back
|
||||
|
||||
=head1 RETURN VALUE
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user