Compare commits
812 Commits
2.8.1
..
2.8.3-soton
| Author | SHA1 | Date | |
|---|---|---|---|
| 9db88139d3 | |||
| a9068dbd0f | |||
| 06cad71050 | |||
| 3e52ee0c40 | |||
| 993e2f77a8 | |||
| da0431e69a | |||
| ccb66ff793 | |||
| cfb4a4cbaa | |||
| 92692d6939 | |||
| d9e220238d | |||
| 805adea8be | |||
| e6a4b0d8fb | |||
| 11e7b02653 | |||
| 55af05f8a3 | |||
| 93a98c256c | |||
| 3b18b981c5 | |||
| 1bf4253477 | |||
| 467d0873de | |||
| 77cea20b24 | |||
| e868887a29 | |||
| be04c5c896 | |||
| 369a9e9b1e | |||
| dd9b1b51ba | |||
| 28f0ef85cd | |||
| 367c5a1ec6 | |||
| 15061d46a9 | |||
| 102a6bbbf1 | |||
| eeaf1cdd72 | |||
| 10c87ba9b6 | |||
| 882d46d0b1 | |||
| d247f968fa | |||
| 29dbe8ed09 | |||
| c2275ad894 | |||
| 4e54d58318 | |||
| 4afaf438ea | |||
| d654045adc | |||
| b085606352 | |||
| d5893b8ee0 | |||
| 2f98fffc04 | |||
| 81c3bfd1ff | |||
| eacb1f7561 | |||
| 8d062e9649 | |||
| 61b359fb11 | |||
| 51f297a6fa | |||
| 5068f7999d | |||
| 5fce308c49 | |||
| 71cd1093ea | |||
| b4fa9ff479 | |||
| edc62bb346 | |||
| 0b6473f202 | |||
| 1f68b5b240 | |||
| f1ee97941e | |||
| 57ec0d82b6 | |||
| 770f50f9ba | |||
| 2af02291a6 | |||
| c9c4bca217 | |||
| 4ccaef4f22 | |||
| bc7ddd1f35 | |||
| 6b1b4f2253 | |||
| f6ea3147a7 | |||
| 107c598a46 | |||
| 7de10e0ff5 | |||
| 3514d539fa | |||
| 74739ca5b1 | |||
| b92312d0d2 | |||
| 923daaa8ba | |||
| 7e96eb2478 | |||
| 475bbf71ac | |||
| 80ac6ee67d | |||
| fcc0f6fa12 | |||
| f383337d78 | |||
| 019c780fcd | |||
| fdbf81c1cf | |||
| 9cb3991fec | |||
| f85ad98f06 | |||
| 039fac937d | |||
| c627c320bf | |||
| 1e7149a25a | |||
| 710b096765 | |||
| 72a4379087 | |||
| 1a48279d68 | |||
| bbe98da471 | |||
| bef22ea3d2 | |||
| d910e66cee | |||
| 735127be0b | |||
| 3ca11580ae | |||
| 24948a701d | |||
| 564abe331c | |||
| 250258dbb7 | |||
| e52d129d30 | |||
| e3c48f5dbd | |||
| a4ec5d2e92 | |||
| 1dfb366a1b | |||
| 4366fd508a | |||
| 2aee379b84 | |||
| 7e1b001ea4 | |||
| fc64737727 | |||
| bf79f4ea50 | |||
| 06cd041d4c | |||
| 862c94cbd1 | |||
| b1c7fda43c | |||
| 2cb204a14a | |||
| c1147d3e08 | |||
| 300113c21a | |||
| 0b18242922 | |||
| 8c4b0edc52 | |||
| 0a80486708 | |||
| 63573b4138 | |||
| b21ee18901 | |||
| ecf7b06d5a | |||
| 0059b61600 | |||
| 6dd853fc65 | |||
| 59ba6304fd | |||
| 6f1d4d616f | |||
| 736bcf95bb | |||
| 713c85179f | |||
| 95fff778c2 | |||
| bb5c8469c7 | |||
| 14331df196 | |||
| ffe7ccbf3b | |||
| 9b89fdcc07 | |||
| 0c5aa5d8bf | |||
| 2ff2cfe4e2 | |||
| 07ee30b7bb | |||
| 14d49836f8 | |||
| 25ab6e5f52 | |||
| 180ed68679 | |||
| 969244bbe9 | |||
| 66ea7851a6 | |||
| 3e71121c3f | |||
| 7057cd4439 | |||
| 78c6150219 | |||
| 68649e7ee1 | |||
| 93dd1e0e68 | |||
| 46cab0033d | |||
| a8cbfbff02 | |||
| 8519f75881 | |||
| 4d4b18ce31 | |||
| 99dba1777a | |||
| f87877d2fb | |||
| bfbb333379 | |||
| 3e51471614 | |||
| d659213d9b | |||
| 47a29edaf8 | |||
| daceb8d876 | |||
| 53ba1913c4 | |||
| ec3d146259 | |||
| 0b0c923519 | |||
| 84c818fbc6 | |||
| 3003110003 | |||
| 0b7a707179 | |||
| 47a5a4c536 | |||
| 0ea77b281a | |||
| 72de3aedfb | |||
| 92b9ca4b9e | |||
| 4fc4988238 | |||
| 3e8f68fe7f | |||
| b4dce6b70f | |||
| 59e57a1e84 | |||
| c6a0e6d4e5 | |||
| 46c9d5d788 | |||
| cad8c86a6b | |||
| f89163a501 | |||
| 4a48117c42 | |||
| 201427c9de | |||
| d155c8c68a | |||
| 0868963ef6 | |||
| 56636cf4e8 | |||
| e1ba890613 | |||
| 62f367a8ab | |||
| 856b80e2a1 | |||
| 9c14ddc07d | |||
| b089d456d7 | |||
| 12c91fbc60 | |||
| e39dbcd055 | |||
| d65ae4c854 | |||
| a5c16ad171 | |||
| bd27ca23be | |||
| 2486f856c3 | |||
| 3414416d01 | |||
| c8fbcc8541 | |||
| 6bb48f05a9 | |||
| f8f872641b | |||
| 6c9234df79 | |||
| 82157e991e | |||
| 020a114452 | |||
| c902672c60 | |||
| cf42c4e10b | |||
| bd094db1b4 | |||
| c85e2b60a4 | |||
| 9972e77adb | |||
| a1179f3018 | |||
| 0257de0ef2 | |||
| e60f695efb | |||
| dc2afed5c1 | |||
| c026a3d7fe | |||
| 316b58bd88 | |||
| 09c4277002 | |||
| 83eb5d2628 | |||
| b96e107a7c | |||
| 410217ac31 | |||
| 56f75cc342 | |||
| 47200ff1c8 | |||
| 3c5b618ff0 | |||
| 6a3bdba935 | |||
| cb77ac92d7 | |||
| 09dc9a129e | |||
| cd79e33f7c | |||
| ded2be133e | |||
| 066696686f | |||
| 90c24d0ff7 | |||
| 80deb78f25 | |||
| 7ec38c7be8 | |||
| 8d68a17dec | |||
| 8521b46ab2 | |||
| 3790ae7b65 | |||
| 37d616d5fb | |||
| b117fb3dbc | |||
| 57b6ff1af7 | |||
| fb71204859 | |||
| 5392fb7e34 | |||
| 83308c89e4 | |||
| 6dec17db73 | |||
| 1fa9bdb32f | |||
| 4dd43607b8 | |||
| daab6a0cde | |||
| efd7d6eadb | |||
| 9a9705a1bf | |||
| 9dcd216ac1 | |||
| 6e14118bcd | |||
| 3d31d5f112 | |||
| 8b6feb6b30 | |||
| f1976a7b99 | |||
| 089855bcd2 | |||
| 239add6be2 | |||
| 203d7025ad | |||
| 1141e9cd7d | |||
| f4296702e2 | |||
| 3583d5b59d | |||
| 4934dba5ea | |||
| e651a540d7 | |||
| 8bcf0a8717 | |||
| e342bd876c | |||
| 2b453aea6f | |||
| 2433281aa5 | |||
| 99f1ac8b79 | |||
| c9508a7966 | |||
| 75bb52802e | |||
| 80d3424855 | |||
| caed010c3d | |||
| 84b503a443 | |||
| 39c66d052f | |||
| 5f0da1b2de | |||
| 76edfcf670 | |||
| 5d02531baa | |||
| a0370be23f | |||
| f79ec9bdbd | |||
| 44f26b478d | |||
| 777c00e8d4 | |||
| 7754845c7c | |||
| 9a64ca9b84 | |||
| 1e3fa1a1e9 | |||
| 5e728c73a1 | |||
| 74d5d437d5 | |||
| af6b21edb0 | |||
| 4bbda3998f | |||
| de3184b24a | |||
| 219badd6f2 | |||
| 77ea7d4e41 | |||
| 431470e035 | |||
| 1ca9533e61 | |||
| 7db86eedff | |||
| d8e840bafd | |||
| e861a7c0a9 | |||
| 42af194434 | |||
| 643952493a | |||
| 5653f343a3 | |||
| 1b5cf5e044 | |||
| ffc621cf29 | |||
| 4082f1da22 | |||
| 7c29fd4757 | |||
| e1635a9b48 | |||
| f58a3f2f9a | |||
| 817f8ce411 | |||
| f1dc5da446 | |||
| 4f91b33757 | |||
| 031bc1e3bd | |||
| 8b8b932213 | |||
| 9704a7b176 | |||
| 716bb97084 | |||
| 815e2d6583 | |||
| dbcab937da | |||
| 3e0d22db7c | |||
| 01c3a1070d | |||
| 5205218f1a | |||
| 84e9d74314 | |||
| 464c4b0d3c | |||
| a96f96e2d4 | |||
| 0fe302f9e8 | |||
| 7ad12aba70 | |||
| d9e9515cf5 | |||
| 91d27eb358 | |||
| 890555235e | |||
| f0c6bcdbad | |||
| 115aef46f3 | |||
| 53209a79d1 | |||
| e1603a0242 | |||
| 552063ef57 | |||
| 6483bbc18e | |||
| 70c9b7c583 | |||
| 3c86356e3b | |||
| 5a09a9b34a | |||
| 28fba7f066 | |||
| ac79179400 | |||
| e91888a79b | |||
| 1a5b1e9086 | |||
| 0fa516df77 | |||
| 25b028a5fd | |||
| f4ddcdb9de | |||
| 2374e40b4e | |||
| cae2da8eba | |||
| e313b49839 | |||
| 80e8c21af7 | |||
| 9c0032b3c1 | |||
| 624fce5e4d | |||
| 814974aaa8 | |||
| 1810107998 | |||
| 045011b168 | |||
| 67a663131e | |||
| 6853cbc89f | |||
| cb9794ccdb | |||
| 9b3f5a15d0 | |||
| 2b0caf0346 | |||
| 62ee471f89 | |||
| 19a77111f6 | |||
| e6f7e461e4 | |||
| 56cab3f2c8 | |||
| adf53e32cd | |||
| 77bcb15656 | |||
| ef7fe69e19 | |||
| 67a7fab655 | |||
| b81e4cee2d | |||
| c93aeba53c | |||
| c057f231a0 | |||
| 5eaaf7369c | |||
| 0bdae5e4c4 | |||
| 37118daaf9 | |||
| a9acb42b1e | |||
| b3cf456fae | |||
| 7dd70c12d2 | |||
| f2b4b14a53 | |||
| 11b99248a9 | |||
| 8600f159b0 | |||
| c03f4d202f | |||
| 88914d3493 | |||
| a2a9dc9efd | |||
| 4cdeeb0b22 | |||
| 5ca816b0c4 | |||
| 529597d3c1 | |||
| 08f4ed81e5 | |||
| d6ce28f954 | |||
| 16be3f4902 | |||
| 1808cbf129 | |||
| 6969c52f82 | |||
| 09bf36a323 | |||
| 1b5ff23093 | |||
| 73ab8e8a7f | |||
| 0995a924dc | |||
| 311d3aafac | |||
| d948f8c69e | |||
| 368d0d1e83 | |||
| 18db706c89 | |||
| 020889ad3c | |||
| 76a47d856c | |||
| 4225daa29f | |||
| 3c874d9555 | |||
| 839c6d85a3 | |||
| fbd772e8cd | |||
| 92ec068fe4 | |||
| 68b4a0b5c7 | |||
| 650928ad15 | |||
| 4e79b8d8d7 | |||
| 67a48e2ee6 | |||
| 5459cf6a60 | |||
| 600ab740ae | |||
| 5f8d394346 | |||
| 6fb47b1d50 | |||
| 780fbaaad8 | |||
| 63edd565d1 | |||
| 2bca640ffa | |||
| cbb73b46a7 | |||
| e88a680e6b | |||
| 8921bc2734 | |||
| df1c520161 | |||
| 861794f576 | |||
| d0411a285f | |||
| cf502073f4 | |||
| 0f0046ca9d | |||
| b7701969ed | |||
| 918bd4270a | |||
| 3f56f0775e | |||
| 56b6f4c1b2 | |||
| ecd518e31e | |||
| a7e3e9ec2a | |||
| 008e72d316 | |||
| 1de09a51c9 | |||
| 106dc7874a | |||
| bf183224c7 | |||
| 4a2b39754f | |||
| df9fa2b101 | |||
| 3847fe71c0 | |||
| 4a91bb39cc | |||
| a81d66c124 | |||
| dab5a33b3f | |||
| 016a947428 | |||
| 79748cf356 | |||
| 85bf65876e | |||
| 8c2e36a02c | |||
| f2fcf48b5d | |||
| f52348bc1a | |||
| 64d03a8212 | |||
| 811a3eda65 | |||
| 9e71285c78 | |||
| d3bf022de7 | |||
| 4bd8a0e020 | |||
| 3ddce5fb90 | |||
| 52c1236f4e | |||
| d258f3a3c0 | |||
| 143f106f7d | |||
| 29b94ff6a2 | |||
| 0682ed07d3 | |||
| e518020aa4 | |||
| b67fcaed89 | |||
| 0a55da08fe | |||
| 7b7085742f | |||
| 487daef0d6 | |||
| f9533a6843 | |||
| bc96478730 | |||
| c0aeae7dd1 | |||
| 7d90895a38 | |||
| dd74f95007 | |||
| 465409982d | |||
| 04d832ce3d | |||
| 9f8a9efc4b | |||
| 6b26f84cf9 | |||
| a70323051f | |||
| 6996dc4f8a | |||
| 77e5889721 | |||
| e9d378a484 | |||
| d17e10419d | |||
| 392472e328 | |||
| 32e5e85a08 | |||
| 3065b2d394 | |||
| 594d5ce981 | |||
| f95c0026eb | |||
| f5d013dc48 | |||
| eb102a0d36 | |||
| 570cd821e3 | |||
| b4a5ddf4dc | |||
| c28fe1ef3b | |||
| a20d2ed496 | |||
| 965059d45c | |||
| 3f38f26761 | |||
| 223002d905 | |||
| 35457cb9ac | |||
| 39501e0b6c | |||
| cb8a813820 | |||
| 624a45bfa3 | |||
| 793cb090c4 | |||
| f099ffd1a5 | |||
| 49aad9e6bd | |||
| 465c5471a0 | |||
| 9524019f0b | |||
| b12951579b | |||
| 1d2391454e | |||
| f15ce9f06e | |||
| e5e7e4687d | |||
| 75bfe9b646 | |||
| 1144077591 | |||
| 8ea54a435f | |||
| 42b3c0c596 | |||
| 7ed707c67b | |||
| 1bb5051da7 | |||
| 95226fa3a8 | |||
| 23d64d7acc | |||
| 55fc5d4064 | |||
| b20ccd2905 | |||
| b802a02442 | |||
| 987d47a43d | |||
| 19241bce05 | |||
| e7f9eadd1e | |||
| acc28bb0ed | |||
| 1dd5758ff7 | |||
| 05778c7853 | |||
| ca700dca54 | |||
| fa4a8e6e28 | |||
| 90c22ee298 | |||
| 10986247e3 | |||
| 559c75e567 | |||
| dc432e7139 | |||
| 2e3dd4761e | |||
| 2b2d482aac | |||
| 1ef39d6ef8 | |||
| 3260c52a35 | |||
| ec54b30aa4 | |||
| 804fd22cf2 | |||
| b58ab630a6 | |||
| b27065d834 | |||
| e917ce1579 | |||
| 3ddb75d072 | |||
| 3724aed861 | |||
| 4d3ee33232 | |||
| 3910ec03e1 | |||
| b08b9a3c77 | |||
| f787c85ddc | |||
| 201f9895ed | |||
| 33693f8486 | |||
| 0f9d930de3 | |||
| e20198b86b | |||
| 2959fea562 | |||
| 7e90f3e8ea | |||
| 9af0a72bfc | |||
| f570a29c5c | |||
| 26e8951512 | |||
| 7ad5f1a53a | |||
| a5e8f44514 | |||
| cb290f429d | |||
| 9f9c6d2c79 | |||
| aa9d9140d0 | |||
| f4dca63e79 | |||
| 1c027a87d7 | |||
| 0916af5577 | |||
| d4816f7159 | |||
| 4e54ba0682 | |||
| 396d8b304f | |||
| c2afea1cb8 | |||
| d7d330966d | |||
| b9377d7251 | |||
| d3846f47f8 | |||
| 9c2a7d275b | |||
| ec5be914c9 | |||
| 16e0d2179a | |||
| 869ae04a45 | |||
| 80f923b96c | |||
| ef8b638460 | |||
| de974743c9 | |||
| 5f97813937 | |||
| 3a5af60c3f | |||
| c1bad5bcf6 | |||
| 611a5ff463 | |||
| dbd453d0a6 | |||
| 0ae570f73d | |||
| d80d963951 | |||
| af005c6a31 | |||
| 707e24b981 | |||
| 58249c8b14 | |||
| b5765f2fcf | |||
| 10caf24da8 | |||
| 5435fec0e5 | |||
| eaf843d6c4 | |||
| 0716b8596d | |||
| b0805684cc | |||
| b14a373512 | |||
| f0872d459e | |||
| ab3a23346b | |||
| cf06cc036d | |||
| 0b410a596b | |||
| 9799ef78e6 | |||
| 73fb28f6d0 | |||
| a758cdf573 | |||
| 9d65034701 | |||
| 11df32128f | |||
| 22468165b6 | |||
| 5c045ed61c | |||
| e2684acebe | |||
| c48f202bdd | |||
| 89ba8006f4 | |||
| e57868c1c6 | |||
| 38cea20397 | |||
| 2f669c1ac6 | |||
| d5e329e4c7 | |||
| 34bb809cc4 | |||
| c2cd84dbca | |||
| 0edc77694f | |||
| 8ac0f31915 | |||
| 4ce4e7c0fd | |||
| 69f6fa5693 | |||
| edbad6e498 | |||
| f5a31b7f4f | |||
| c68a422c44 | |||
| 3d06ddda0d | |||
| f890d03ef3 | |||
| 9ecfc50b91 | |||
| 78af39e06f | |||
| 645c602ce2 | |||
| a6aab0c6d0 | |||
| 592a0d508c | |||
| 7d5bcba0d5 | |||
| 594facc9a0 | |||
| e2d8a38928 | |||
| b6969b9817 | |||
| cd406905a8 | |||
| be3e25ce00 | |||
| e4d371d2e8 | |||
| 0244b031cf | |||
| 8fac597977 | |||
| 6738d6caba | |||
| 30c92ba536 | |||
| cff0e482eb | |||
| 47fc94d842 | |||
| 60ca873f6c | |||
| c5bba25f7e | |||
| a55349b5af | |||
| d1b41732b5 | |||
| db6e509b4a | |||
| 252e7dd3de | |||
| b2838fdca8 | |||
| 0ef6f64ab2 | |||
| 4e7720631b | |||
| c4a211ddd3 | |||
| 6e3206d31d | |||
| 1dfe0cb135 | |||
| f53574d1c6 | |||
| 5d4aace149 | |||
| 961c3951e6 | |||
| dcde28a213 | |||
| bc386fd56a | |||
| 636d866a40 | |||
| 36c4a83005 | |||
| 2649d44ed4 | |||
| e057ae26fd | |||
| 8754a7ee0c | |||
| 193bea48f6 | |||
| 685e039254 | |||
| 6a72e5feb6 | |||
| f6c559ca0a | |||
| 03584e81fb | |||
| d7bc639fc6 | |||
| 5b846b46a4 | |||
| 07023c0634 | |||
| 756c176f53 | |||
| dabe1aafca | |||
| 422c7cfef4 | |||
| 37a2bfde40 | |||
| 1ea7732f00 | |||
| 25bfbdee5e | |||
| 9585feebb8 | |||
| 5921d3cd95 | |||
| e8d1d7cf00 | |||
| 0479d3682c | |||
| b1c996ad2e | |||
| 5985c790d0 | |||
| f5bb7a2bc6 | |||
| 0cb3d901d8 | |||
| f930deea97 | |||
| 8d855e9e20 | |||
| 0df81a3dfa | |||
| b662046e19 | |||
| aedb671f1b | |||
| aba2b94d5c | |||
| 1cd456419a | |||
| 726c05134c | |||
| 8945c5ca33 | |||
| 24a2928e03 | |||
| d991d97332 | |||
| 2b35adf1f8 | |||
| d4d56cbc91 | |||
| 8210f4d82a | |||
| b8e32de9c8 | |||
| 607a2cc927 | |||
| 581739c5e5 | |||
| 608ecae96e | |||
| 52a0a5a4f4 | |||
| f170fe9c0f | |||
| 223d288cff | |||
| f9841836f9 | |||
| 4e9d9d0b7a | |||
| 268d20215e | |||
| 3a71acedeb | |||
| 09f4a16b24 | |||
| 61effb412e | |||
| 4b75dd3c03 | |||
| 456bd50c46 | |||
| f1cd22e0f8 | |||
| 4b57fe95f4 | |||
| 310287347a | |||
| 5b497df6e3 | |||
| 8e64beb962 | |||
| 4cdc6dab13 | |||
| 61569206a1 | |||
| 040ae224e5 | |||
| 9980daedc4 | |||
| 81ec3ad929 | |||
| 962772547d | |||
| 3341f2399b | |||
| a5ec8dcc36 | |||
| 66f9824509 | |||
| 348ccaf564 | |||
| 41aa89541c | |||
| 8a476a618b | |||
| 27ba4fcdbe | |||
| 4fd57c08e5 | |||
| 95b4be91eb | |||
| 8d2eeda1b3 | |||
| c48d82729c | |||
| a2fb35c9c5 | |||
| 3154df9b77 | |||
| 47fbbd2230 | |||
| aa01feda37 | |||
| a8323e599a | |||
| 62e8e445b9 | |||
| ea7577eb8f | |||
| 8c4dfd3470 | |||
| 019f6da484 | |||
| ce63e80e96 | |||
| 91fc845782 | |||
| dbd59da228 | |||
| 1f963dc243 | |||
| e0c25f0672 | |||
| cbdd1d4a9a | |||
| 273c3098fc | |||
| d3590828a7 | |||
| dd66c4427a | |||
| 2cb38161a8 | |||
| 2660c46a24 | |||
| 3ae9f03fe1 | |||
| 0ed2145239 | |||
| 546bf507ab | |||
| b13c713888 | |||
| 29aa9d83a7 | |||
| a7537857db | |||
| af3ac58d23 | |||
| fb453010c4 | |||
| 607866fb4a | |||
| aa5e95f28a | |||
| df158b4411 | |||
| 57bfbd67ad | |||
| 4d3bfb86c9 | |||
| 944a84bc0a | |||
| fd942bcf5a | |||
| 3456243248 | |||
| 7731929803 | |||
| ee3e6061f0 | |||
| b784427dbd | |||
| e439bfa3d9 | |||
| f4b3f09bb0 | |||
| cd354d6634 | |||
| 5562af5751 | |||
| 4896b906d4 | |||
| 2e53f21b7d | |||
| 97f11587b0 | |||
| 07da4182ab | |||
| 01ab6d41ea | |||
| f7208c1e81 | |||
| 56d12b7105 | |||
| 1e4a3631cc | |||
| c176287626 | |||
| e81e433f1e | |||
| e514305d5e | |||
| 0170a13ab4 | |||
| daa650686d | |||
| de0872c616 | |||
| a50b572e6e | |||
| f65080fb4b | |||
| b9bac72399 | |||
| 3dc5351cb4 | |||
| d10259eed1 | |||
| 42cb3d8799 | |||
| d256906e89 | |||
| e853c4c7e2 | |||
| 2ad903b713 | |||
| 32943f0a7a | |||
| 9a08f260ef | |||
| 4b65890eca | |||
| a6c2909603 | |||
| 06c90dd2e6 | |||
| a5ea4c5332 | |||
| f2fe9bd17e | |||
| 38f585626d | |||
| cac34c9f5a | |||
| 985de85cad | |||
| e6970bd97a | |||
| a392cfbe78 | |||
| b3a9a398dc | |||
| d302ccb027 | |||
| 79a7d3e4cc | |||
| aca25db4c9 | |||
| 428c90336d | |||
| 043303d1d7 | |||
| c600b54122 | |||
| 62d58ee68e | |||
| d8f8c7e49a | |||
| d1b10a4109 | |||
| d7c626da34 | |||
| 48b21d9656 | |||
| f212c3c7b3 | |||
| 75980fabbf | |||
| 5eb7f30342 | |||
| a95e58f482 | |||
| 082db86c77 | |||
| 05415e6588 | |||
| 15ecb156d4 | |||
| 9736ea127e | |||
| dfbfa103ec | |||
| 2e54ebc370 | |||
| 0724220b72 | |||
| e2055a8251 | |||
| 88e689b996 | |||
| e12bb46487 | |||
| 73f0454a44 | |||
| bcf9e0aff2 | |||
| a0f0bc1e07 |
@@ -1,14 +0,0 @@
|
||||
xCAT - eXtreme Cloud Administration Toolkit
|
||||
|
||||
xCAT is a toolkit for the deployment and administration of clusters.
|
||||
|
||||
xCAT documentation is available at: http://xcat.sourceforge.net/
|
||||
|
||||
xCAT is made available as open source software under the EPL license:
|
||||
http://www.opensource.org/licenses/eclipse-1.0.php
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -197,7 +197,7 @@ then
|
||||
Origin: xCAT internal repository
|
||||
Label: xcat-dep bazaar repository
|
||||
Codename: $dist
|
||||
Architectures: i386 amd64
|
||||
Architectures: amd64
|
||||
Components: main
|
||||
Description: Repository automatically genereted conf
|
||||
|
||||
|
||||
+128
-78
@@ -41,6 +41,17 @@ printusage()
|
||||
# For the purpose of getting the distribution name
|
||||
. /etc/lsb-release
|
||||
|
||||
# Process cmd line variable assignments, assigning each attr=val pair to a variable of same name
|
||||
for i in $*; do
|
||||
echo $i | grep '='
|
||||
if [ $? != 0 ];then
|
||||
continue
|
||||
fi
|
||||
# upper case the variable name
|
||||
varstring=`echo "$i"|cut -d '=' -f 1|tr '[a-z]' '[A-Z]'`=`echo "$i"|cut -d '=' -f 2`
|
||||
export $varstring
|
||||
done
|
||||
|
||||
# Supported distributions
|
||||
dists="maverick natty oneiric precise"
|
||||
|
||||
@@ -91,14 +102,6 @@ local_dep_repo_path="$curdir/../../../xcat-dep/xcat-dep"
|
||||
sf_repo_url="https://sourceforge.net/projects/xcat/files/ubuntu"
|
||||
sf_dir="/home/frs/project/x/xc/xcat"
|
||||
|
||||
if [ "$PROMOTE" = 1 ]; then
|
||||
upload_dir="xcat-core"
|
||||
tar_name="xcat-core-$ver.tar.bz2"
|
||||
else
|
||||
upload_dir="core-snap"
|
||||
tar_name="core-debs-snap.tar.bz2"
|
||||
fi
|
||||
|
||||
#use flock to only one person build at the same time
|
||||
# Get a lock, so can not do 2 builds at once
|
||||
exec 8>/var/lock/xcatbld.lock
|
||||
@@ -128,69 +131,111 @@ then
|
||||
REL=`basename $t`
|
||||
fi
|
||||
|
||||
#get the version
|
||||
echo "svn --quiet update Version"
|
||||
svn --quiet up Version
|
||||
ver=`cat Version`
|
||||
short_ver=`cat Version|cut -d. -f 1,2`
|
||||
short_short_ver=`cat Version|cut -d. -f 1`
|
||||
|
||||
#TODO: define the core path and tarball name
|
||||
tarball_name="core-debs-snap.tar.bz2"
|
||||
|
||||
#update the code from svn
|
||||
svn_up_log="../coresvnup"
|
||||
echo "svn update > $svn_up_log"
|
||||
svn update > $svn_up_log
|
||||
|
||||
#makesure the code change status
|
||||
code_change=0
|
||||
if ! grep -q 'At revision' $svn_up_log;then
|
||||
code_change=1
|
||||
fi
|
||||
|
||||
if [ $code_change == 0 -a "$UP" != 1 -a "$BUILDALL" != 1 ]; then
|
||||
echo "Nothing new detected"
|
||||
exit 0
|
||||
fi
|
||||
echo "###############################"
|
||||
echo "# Building xcat-core packages #"
|
||||
echo "###############################"
|
||||
|
||||
#the package type: local | snap | alpha
|
||||
#the build introduce stirng
|
||||
pkg_type="snap"
|
||||
build_string="Snap_Build"
|
||||
cur_date=`date +%Y%m%d`
|
||||
pkg_version="${short_ver}-${pkg_type}${cur_date}"
|
||||
|
||||
if [ ! -d ../../debs ];then
|
||||
mkdir -p "../../debs"
|
||||
fi
|
||||
packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test"
|
||||
|
||||
for file in `echo $packages`
|
||||
do
|
||||
file_low=`echo $file | tr '[A-Z]' '[a-z]'`
|
||||
if grep -q $file $svn_up_log || [ "$BUILDALL" == 1 ]; then
|
||||
rm -f ../../debs/${file_low}_*.deb
|
||||
#only for genesis package
|
||||
rm -f ../../debs/${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"
|
||||
if [ "$PROMOTE" != 1 ]; then
|
||||
code_change=0
|
||||
update_log=''
|
||||
#get the version
|
||||
if [ "$REL" = "xcat-core" ];then
|
||||
git_flag=1
|
||||
REL=`git rev-parse --abbrev-ref HEAD`
|
||||
if [ "$REL" = "master" ]; then
|
||||
REL="devel"
|
||||
fi
|
||||
if [ -z "$GITUP" ];then
|
||||
update_log=../coregitup
|
||||
echo "git pull > $update_log"
|
||||
git pull > $update_log
|
||||
else
|
||||
update_log=$GITUP
|
||||
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}* ../../debs/
|
||||
fi
|
||||
done
|
||||
|
||||
find ../../debs/* ! -name *.deb | xargs rm -f
|
||||
if ! grep -q 'Already up-to-date' $update_log; then
|
||||
code_change=1
|
||||
fi
|
||||
else
|
||||
git_flag=0
|
||||
if [ -z "$SVNUP" ]; then
|
||||
update_log=../coresvnup
|
||||
echo "svn up > $update_log"
|
||||
svn up > $update_log
|
||||
else
|
||||
update_log=$SVNUP
|
||||
fi
|
||||
|
||||
if ! grep -q 'At revision' $update_log;then
|
||||
code_change=1
|
||||
fi
|
||||
fi
|
||||
ver=`cat Version`
|
||||
short_ver=`cat Version|cut -d. -f 1,2`
|
||||
short_short_ver=`cat Version|cut -d. -f 1`
|
||||
|
||||
package_dir_name=debs$REL
|
||||
#TODO: define the core path and tarball name
|
||||
tarball_name="core-debs-snap.tar.bz2"
|
||||
|
||||
if [ $code_change == 0 -a "$UP" != 1 -a "$BUILDALL" != 1 ]; then
|
||||
echo "Nothing new detected"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "###############################"
|
||||
echo "# Building xcat-core packages #"
|
||||
echo "###############################"
|
||||
|
||||
#the package type: local | snap | alpha
|
||||
#the build introduce stirng
|
||||
pkg_type="snap"
|
||||
build_string="Snap_Build"
|
||||
cur_date=`date +%Y%m%d`
|
||||
pkg_version="${short_ver}-${pkg_type}${cur_date}"
|
||||
|
||||
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"
|
||||
|
||||
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/
|
||||
fi
|
||||
done
|
||||
|
||||
find ../../$package_dir_name/* ! -name *.deb | xargs rm -f
|
||||
else
|
||||
if [ "$REL" = "xcat-core" ];then
|
||||
git_flag=1
|
||||
REL=`git rev-parse --abbrev-ref HEAD`
|
||||
if [ "$REL" = "master" ]; then
|
||||
REL="devel"
|
||||
fi
|
||||
fi
|
||||
package_dir_name=debs$REL
|
||||
fi
|
||||
|
||||
if [ "$PROMOTE" = 1 ]; then
|
||||
upload_dir="xcat-core"
|
||||
tar_name="xcat-core-$ver.tar.bz2"
|
||||
else
|
||||
upload_dir="core-snap"
|
||||
tar_name="core-debs-snap.tar.bz2"
|
||||
fi
|
||||
|
||||
echo "#################################"
|
||||
echo "# Creating xcat-core repository #"
|
||||
@@ -209,7 +254,7 @@ then
|
||||
Origin: xCAT internal repository
|
||||
Label: xcat-core bazaar repository
|
||||
Codename: $dist
|
||||
Architectures: amd64 i386
|
||||
Architectures: amd64
|
||||
Components: main
|
||||
Description: Repository automatically genereted conf
|
||||
SignWith: yes
|
||||
@@ -225,7 +270,7 @@ __EOF__
|
||||
|
||||
#import the deb packages into the repo
|
||||
for dist in $dists; do
|
||||
for file in `ls ../debs/*.deb`; do
|
||||
for file in `ls ../$package_dir_name/*.deb`; do
|
||||
reprepro -b ./ includedeb $dist $file;
|
||||
done
|
||||
done
|
||||
@@ -247,12 +292,12 @@ __EOF__
|
||||
groupadd xcat
|
||||
fi
|
||||
|
||||
chgrp -R xcat xcat-core
|
||||
chgrp -R root xcat-core
|
||||
chmod -R g+w xcat-core
|
||||
|
||||
#build the tar ball
|
||||
tar -hjcf $tar_name xcat-core
|
||||
chgrp xcat $tar_name
|
||||
chgrp root $tar_name
|
||||
chmod g+w $tar_name
|
||||
|
||||
if [ ! -e core-snap ]; then
|
||||
@@ -260,7 +305,7 @@ __EOF__
|
||||
fi
|
||||
|
||||
# Decide whether to upload or not
|
||||
if [ "$UP" != 1 ]; then
|
||||
if [ -n "$UP" ] && [ "$UP" == 0 ]; then
|
||||
echo "No need to upload"
|
||||
cd $old_pwd
|
||||
exit 0
|
||||
@@ -275,8 +320,13 @@ __EOF__
|
||||
fi
|
||||
|
||||
#upload the tar ball
|
||||
#for the GA build, upload to https://sourceforge.net/projects/xcat/files/xcat/<version>.x_Ubuntu/
|
||||
#for other scenario, upload to https://sourceforge.net/projects/xcat/files/ubuntu/<version>
|
||||
if [ "$PROMOTE" = 1 -a "$REL" != "devel" -a "$PREGA" != 1 ]; then
|
||||
echo "";
|
||||
i=0
|
||||
echo "Uploading $tar_name to ${sf_dir}/xcat/${REL}.x_Ubuntu/ ..."
|
||||
while [ $((i+=1)) -le 5 ] && ! rsync -v $tar_name ${uploader},xcat@web.sourceforge.net:${sf_dir}/xcat/${REL}.x_Ubuntu/
|
||||
do : ; done
|
||||
else
|
||||
i=0
|
||||
echo "Uploading $tar_name to ${sf_dir}/ubuntu/${REL}/ ..."
|
||||
@@ -307,7 +357,7 @@ then
|
||||
Origin: xCAT internal repository
|
||||
Label: xcat-dep bazaar repository
|
||||
Codename: $dist
|
||||
Architectures: i386 amd64
|
||||
Architectures: amd64
|
||||
Components: main
|
||||
Description: Repository automatically genereted conf
|
||||
SignWith: yes
|
||||
@@ -342,16 +392,16 @@ __EOF__
|
||||
groupadd xcat
|
||||
fi
|
||||
|
||||
chgrp -R xcat xcat-dep
|
||||
chgrp -R root xcat-dep
|
||||
chmod -R g+w xcat-dep
|
||||
|
||||
#create the tar ball
|
||||
dep_tar_name=xcat-dep-ubuntu.tar.bz
|
||||
tar -hjcf $dep_tar_name xcat-dep
|
||||
chgrp xcat $dep_tar_name
|
||||
chgrp root $dep_tar_name
|
||||
chmod g+w $dep_tar_name
|
||||
|
||||
if [ "$UP" != 1 ];then
|
||||
if [ -n "$UP" ] && [ "$UP" == 0 ];then
|
||||
echo "No need to upload the dep packages"
|
||||
cd $old_pwd
|
||||
exit 0
|
||||
|
||||
+99
-59
@@ -19,6 +19,7 @@
|
||||
# directories that are needed.
|
||||
|
||||
# Usage: buildcore.sh [attr=value attr=value ...]
|
||||
# Before running buildcore.sh, you must change the local git repo to the branch you want built, using: git checkout <branch>
|
||||
# PROMOTE=1 - if the attribute "PROMOTE" is specified, means an official dot release. This does not
|
||||
# actually build xcat, just uploads the most recent snap build to https://sourceforge.net/projects/xcat/files/xcat/ .
|
||||
# If not specified, a snap build is assumed, which uploads to https://sourceforge.net/projects/xcat/files/yum/
|
||||
@@ -31,7 +32,7 @@
|
||||
# BUILDALL=1 - build all rpms, whether they changed or not. Should be used for snap builds that are in prep for a release.
|
||||
# UP=0 or UP=1 - override the default upload behavior
|
||||
# SVNUP=<filename> - control which rpms get built by specifying a coresvnup file
|
||||
# FRSYUM=0 - put the yum repo and snap builds in the old project web area instead of the FRS area.
|
||||
# GITUP=<filename> - control which rpms get built by specifying a coregitup file
|
||||
# EMBED=<embedded-environment> - the environment for which a minimal version of xcat should be built, e.g. zvm or flex
|
||||
# VERBOSE=1 - to see lots of verbose output
|
||||
|
||||
@@ -40,7 +41,7 @@ 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"
|
||||
ALLBUILD="perl-xCAT xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xCAT-buildkit xCAT xCATsn xCAT-genesis-scripts xCAT-OpenStack"
|
||||
ZVMBUILD="perl-xCAT xCAT-server xCAT-UI"
|
||||
ZVMLINK="xCAT-client xCAT xCATsn"
|
||||
PCMBUILD="xCAT"
|
||||
@@ -84,15 +85,24 @@ if [ "$OSNAME" != "AIX" ]; then
|
||||
export HOME=/root # This is so rpm and gpg will know home, even in sudo
|
||||
fi
|
||||
|
||||
# this is needed only when we are transitioning the yum over to frs
|
||||
if [ "$FRSYUM" != 0 ]; then
|
||||
YUMDIR=$FRS
|
||||
YUMREPOURL="https://sourceforge.net/projects/xcat/files/yum"
|
||||
else
|
||||
YUMDIR=htdocs
|
||||
YUMREPOURL="http://xcat.sourceforge.net/yum"
|
||||
# for the git case, query the current branch and set REL (changing master to devel if necessary)
|
||||
function setbranch {
|
||||
#git checkout $BRANCH
|
||||
#REL=`git rev-parse --abbrev-ref HEAD`
|
||||
REL=`git name-rev --name-only HEAD`
|
||||
if [ "$REL" = "master" ]; then
|
||||
REL="devel"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$REL" = "xcat-core" ]; then # using git
|
||||
GIT=1
|
||||
setbranch # this changes the REL variable
|
||||
fi
|
||||
|
||||
YUMDIR=$FRS
|
||||
YUMREPOURL="https://sourceforge.net/projects/xcat/files/yum"
|
||||
|
||||
# Set variables based on which type of build we are doing
|
||||
if [ -n "$EMBED" ]; then
|
||||
EMBEDDIR="/$EMBED"
|
||||
@@ -116,38 +126,38 @@ else
|
||||
fi
|
||||
|
||||
XCATCORE="xcat-core" # core-snap is a sym link to xcat-core
|
||||
echo "svn --quiet up Version"
|
||||
svn --quiet up Version
|
||||
VER=`cat Version`
|
||||
SHORTVER=`cat Version|cut -d. -f 1,2`
|
||||
SHORTSHORTVER=`cat Version|cut -d. -f 1`
|
||||
if [ "$PROMOTE" = 1 ]; then
|
||||
CORE="xcat-core"
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
TARNAME=core-aix-$VER.tar.gz
|
||||
else
|
||||
TARNAME=xcat-core-$VER.tar.bz2
|
||||
fi
|
||||
|
||||
if [ "$GIT" = "1" ]; then # using git - need to include REL in the path where we put the built rpms
|
||||
DESTDIR=../../$REL$EMBEDDIR/$XCATCORE
|
||||
else
|
||||
CORE="core-snap"
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
TARNAME=core-aix-snap.tar.gz
|
||||
else
|
||||
TARNAME=core-rpms-snap.tar.bz2
|
||||
fi
|
||||
DESTDIR=../..$EMBEDDIR/$XCATCORE
|
||||
fi
|
||||
DESTDIR=../..$EMBEDDIR/$XCATCORE
|
||||
SRCD=core-snap-srpms
|
||||
|
||||
# currently aix builds ppc rpms, but someday it should build noarch
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
NOARCH=ppc
|
||||
SYSGRP=system
|
||||
else
|
||||
NOARCH=noarch
|
||||
SYSGRP=root
|
||||
fi
|
||||
|
||||
function setversionvars {
|
||||
VER=`cat Version`
|
||||
SHORTVER=`cat Version|cut -d. -f 1,2`
|
||||
SHORTSHORTVER=`cat Version|cut -d. -f 1`
|
||||
}
|
||||
|
||||
|
||||
if [ "$PROMOTE" != 1 ]; then # very long if statement to not do builds if we are promoting
|
||||
# we are doing a snap build
|
||||
CORE="core-snap"
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
TARNAME=core-aix-snap.tar.gz
|
||||
else
|
||||
TARNAME=core-rpms-snap.tar.bz2
|
||||
fi
|
||||
mkdir -p $DESTDIR
|
||||
SRCDIR=$DESTDIR/../$SRCD
|
||||
mkdir -p $SRCDIR
|
||||
@@ -168,17 +178,38 @@ else
|
||||
#echo "source=$source"
|
||||
fi
|
||||
|
||||
# If they have not given us a premade update file, do an svn update and capture the results
|
||||
if [ -z "$SVNUP" ]; then
|
||||
SVNUP=../coresvnup
|
||||
echo "svn up > $SVNUP"
|
||||
svn up > $SVNUP
|
||||
fi
|
||||
# If they have not given us a premade update file, do an svn update or git pull and capture the results
|
||||
SOMETHINGCHANGED=0
|
||||
if ! $GREP 'At revision' $SVNUP; then
|
||||
SOMETHINGCHANGED=1
|
||||
if [ "$GIT" = "1" ]; then # using git
|
||||
if [ -z "$GITUP" ]; then
|
||||
GITUP=../coregitup
|
||||
echo "git pull > $GITUP"
|
||||
git pull > $GITUP
|
||||
if [[ $? != 0 ]]; then
|
||||
# do not continue so we do not build with old files
|
||||
echo "The 'git pull' command failed. Exiting the build."
|
||||
exit 3
|
||||
fi
|
||||
fi
|
||||
if ! $GREP 'Already up-to-date' $GITUP; then
|
||||
SOMETHINGCHANGED=1
|
||||
fi
|
||||
else # using svn
|
||||
GIT=0
|
||||
if [ -z "$SVNUP" ]; then
|
||||
SVNUP=../coresvnup
|
||||
echo "svn up > $SVNUP"
|
||||
svn up > $SVNUP
|
||||
fi
|
||||
if ! $GREP 'At revision' $SVNUP; then
|
||||
SOMETHINGCHANGED=1
|
||||
fi
|
||||
# copy the SVNUP variable to GITUP so the rest of the script doesnt have to worry whether we did svn or git
|
||||
GITUP=$SVNUP
|
||||
fi
|
||||
|
||||
setversionvars
|
||||
|
||||
# Function for making the noarch rpms
|
||||
function maker {
|
||||
rpmname="$1"
|
||||
@@ -194,7 +225,7 @@ function maker {
|
||||
}
|
||||
|
||||
# If anything has changed, we should always rebuild perl-xCAT
|
||||
if [ $SOMETHINGCHANGED == 1 -o "$BUILDALL" == 1 ]; then # Use to be: $GREP perl-xCAT $SVNUP; then
|
||||
if [ $SOMETHINGCHANGED == 1 -o "$BUILDALL" == 1 ]; then # Use to be: $GREP perl-xCAT $GITUP; then
|
||||
if [[ " $EMBEDBUILD " = *\ perl-xCAT\ * ]]; then
|
||||
UPLOAD=1
|
||||
maker perl-xCAT
|
||||
@@ -210,7 +241,7 @@ for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xC
|
||||
#if [ "$EMBED" = "zvm" -a "$rpmname" != "xCAT-server" -a "$rpmname" != "xCAT-UI" ]; then continue; fi # for zvm embedded env only need to build server and UI
|
||||
if [[ " $EMBEDBUILD " != *\ $rpmname\ * ]]; then continue; fi
|
||||
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-buildkit" ]; then continue; fi # do not build xCAT-buildkit on aix
|
||||
if $GREP $rpmname $SVNUP || [ "$BUILDALL" == 1 ]; then
|
||||
if $GREP $rpmname $GITUP || [ "$BUILDALL" == 1 ]; then
|
||||
UPLOAD=1
|
||||
maker $rpmname
|
||||
fi
|
||||
@@ -225,7 +256,7 @@ done
|
||||
# The mknb cmd combines them at install time.
|
||||
if [ "$OSNAME" != "AIX" ]; then
|
||||
if [[ " $EMBEDBUILD " = *\ xCAT-genesis-scripts\ * ]]; then
|
||||
if $GREP xCAT-genesis-scripts $SVNUP || [ "$BUILDALL" == 1 ]; then
|
||||
if $GREP xCAT-genesis-scripts $GITUP || [ "$BUILDALL" == 1 ]; then
|
||||
UPLOAD=1
|
||||
ORIGFAILEDRPMS="$FAILEDRPMS"
|
||||
./makerpm xCAT-genesis-scripts x86_64 "$EMBED"
|
||||
@@ -241,17 +272,19 @@ if [ "$OSNAME" != "AIX" ]; then
|
||||
fi
|
||||
|
||||
# Build the xCAT and xCATsn rpms for all platforms
|
||||
for rpmname in xCAT xCATsn; do
|
||||
for rpmname in xCAT xCATsn xCAT-OpenStack; do
|
||||
#if [ "$EMBED" = "zvm" ]; then break; fi
|
||||
if [[ " $EMBEDBUILD " != *\ $rpmname\ * ]]; then continue; fi
|
||||
if [ $SOMETHINGCHANGED == 1 -o "$BUILDALL" == 1 ]; then # used to be: if $GREP -E "^[UAD] +$rpmname/" $SVNUP; then
|
||||
if [ $SOMETHINGCHANGED == 1 -o "$BUILDALL" == 1 ]; then # used to be: if $GREP -E "^[UAD] +$rpmname/" $GITUP; then
|
||||
UPLOAD=1
|
||||
ORIGFAILEDRPMS="$FAILEDRPMS"
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
if [ "$rpmname" = "xCAT-OpenStack" ]; then continue; fi # do not bld openstack on aix
|
||||
./makerpm $rpmname "$EMBED"
|
||||
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS $rpmname"; fi
|
||||
else
|
||||
for arch in x86_64 i386 ppc64 s390x; do
|
||||
for arch in x86_64 ppc64 s390x; do
|
||||
if [ "$rpmname" = "xCAT-OpenStack" -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
|
||||
done
|
||||
@@ -322,10 +355,10 @@ if [ "$OSNAME" != "AIX" ]; then
|
||||
echo '%_gpg_name Jarrod Johnson' >> $MACROS
|
||||
fi
|
||||
echo "Signing RPMs..."
|
||||
build-utils/rpmsign.exp `find $DESTDIR -type f -name '*.rpm'` | grep -v -E '(was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
|
||||
build-utils/rpmsign.exp $SRCDIR/*rpm | grep -v -E '(was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
|
||||
createrepo $DESTDIR
|
||||
createrepo $SRCDIR
|
||||
build-utils/rpmsign.exp `find $DESTDIR -type f -name '*.rpm'` | grep -v -E '(already contains identical signature|was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
|
||||
build-utils/rpmsign.exp $SRCDIR/*rpm | grep -v -E '(already contains identical signature|was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
|
||||
createrepo --checksum sha $DESTDIR # specifying checksum so the repo will work on rhel5
|
||||
createrepo --checksum sha $SRCDIR
|
||||
rm -f $SRCDIR/repodata/repomd.xml.asc
|
||||
rm -f $DESTDIR/repodata/repomd.xml.asc
|
||||
gpg -a --detach-sign $DESTDIR/repodata/repomd.xml
|
||||
@@ -338,23 +371,26 @@ if [ "$OSNAME" != "AIX" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# make everything have a group of xcat, so anyone can manage them once they get on SF
|
||||
# set group and permissions correctly on the built rpms
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
if ! lsgroup xcat >/dev/null 2>&1; then
|
||||
mkgroup xcat
|
||||
fi
|
||||
chmod +x $DESTDIR/instxcat
|
||||
else # linux
|
||||
if ! $GREP xcat /etc/group; then
|
||||
groupadd xcat
|
||||
fi
|
||||
fi
|
||||
chgrp -R xcat $DESTDIR
|
||||
chgrp -R $SYSGRP $DESTDIR
|
||||
chmod -R g+w $DESTDIR
|
||||
chgrp -R xcat $SRCDIR
|
||||
chgrp -R $SYSGRP $SRCDIR
|
||||
chmod -R g+w $SRCDIR
|
||||
|
||||
fi # end of very long if-not-promote
|
||||
else # end of very long if-not-promote
|
||||
# we are only promoting (not building)
|
||||
setversionvars
|
||||
setbranch
|
||||
CORE="xcat-core"
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
TARNAME=core-aix-$VER.tar.gz
|
||||
else
|
||||
TARNAME=xcat-core-$VER.tar.bz2
|
||||
fi
|
||||
fi
|
||||
|
||||
cd $DESTDIR
|
||||
|
||||
@@ -394,14 +430,17 @@ else
|
||||
verboseflag=""
|
||||
fi
|
||||
echo "Creating $TARNAME ..."
|
||||
if [[ -e $TARNAME ]]; then
|
||||
mkdir -p previous
|
||||
mv -f $TARNAME previous
|
||||
fi
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
tar $verboseflag -hcf ${TARNAME%.gz} $XCATCORE
|
||||
rm -f $TARNAME
|
||||
gzip ${TARNAME%.gz}
|
||||
else
|
||||
tar $verboseflag -hjcf $TARNAME $XCATCORE
|
||||
fi
|
||||
chgrp xcat $TARNAME
|
||||
chgrp $SYSGRP $TARNAME
|
||||
chmod g+w $TARNAME
|
||||
|
||||
# Decide whether to upload or not
|
||||
@@ -456,6 +495,7 @@ if [ "$OSNAME" != "AIX" -a "$REL" = "devel" -a "$PROMOTE" != 1 -a -z "$EMBED" ];
|
||||
rpm2cpio ../$XCATCORE/perl-xCAT-*.$NOARCH.rpm | cpio -id '*.html'
|
||||
rpm2cpio ../$XCATCORE/xCAT-test-*.$NOARCH.rpm | cpio -id '*.html'
|
||||
rpm2cpio ../$XCATCORE/xCAT-buildkit-*.$NOARCH.rpm | cpio -id '*.html'
|
||||
rpm2cpio ../$XCATCORE/xCAT-OpenStack-*.x86_64.rpm | cpio -id '*.html'
|
||||
i=0
|
||||
while [ $((i+=1)) -le 5 ] && ! rsync $verboseflag -r opt/xcat/share/doc/man1 opt/xcat/share/doc/man3 opt/xcat/share/doc/man5 opt/xcat/share/doc/man7 opt/xcat/share/doc/man8 $UPLOADUSER,xcat@web.sourceforge.net:htdocs/
|
||||
do : ; done
|
||||
|
||||
+14
-12
@@ -97,15 +97,15 @@ if [ "$OSNAME" != "AIX" ]; then
|
||||
|
||||
# Sign the rpms that are not already signed. The "standard input reopened" warnings are normal.
|
||||
echo "Signing RPMs..."
|
||||
$XCATCOREDIR/build-utils/rpmsign.exp `find . -type f -name '*.rpm'` | grep -v -E '(was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
|
||||
$XCATCOREDIR/build-utils/rpmsign.exp `find . -type f -name '*.rpm'` | grep -v -E '(already contains identical signature|was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
|
||||
|
||||
# Create the repodata dirs
|
||||
echo "Creating repodata directories..."
|
||||
for i in `find -mindepth 2 -maxdepth 2 -type d `; do
|
||||
if [ -n "$VERBOSEMODE" ]; then
|
||||
createrepo $i
|
||||
createrepo --checksum sha $i # specifying checksum so the repo will work on rhel5
|
||||
else
|
||||
createrepo $i >/dev/null
|
||||
createrepo --checksum sha $i >/dev/null
|
||||
fi
|
||||
rm -f $i/repodata/repomd.xml.asc
|
||||
gpg -a --detach-sign $i/repodata/repomd.xml
|
||||
@@ -149,6 +149,13 @@ cd $OSVER
|
||||
# The only interdependency between the dep rpms so far is that net-snmp requires bash, and
|
||||
# pyodbc requires unixODBC. (The bash dependency is taken care of automatically because it
|
||||
# comes earlier in the alphabet.)
|
||||
|
||||
# first run /usr/sbin/updtvpkg to make sure any installp software is
|
||||
# registered with RPM.
|
||||
echo "Running updtvpkg. This could take a few minutes."
|
||||
/usr/sbin/updtvpkg
|
||||
echo "updtvpkg has completed."
|
||||
|
||||
rpm -Uvh unixODBC*
|
||||
for i in `ls *.rpm|grep -v -E '^tcl-|^tk-|^expect-|^unixODBC-|^xCAT-UI-deps|^perl-DBD-DB2Lite'`; do
|
||||
if [ "$i" == "perl-Net-DNS-0.66-1.aix5.3.ppc.rpm" ]; then
|
||||
@@ -183,18 +190,13 @@ EOF
|
||||
chmod +x instoss
|
||||
fi
|
||||
|
||||
# Get the permissions correct. Have to have all dirs/files with a group of xcat
|
||||
# and have them writeable by group, so any member of the xcat can build.
|
||||
# Get the permissions and group correct
|
||||
if [ "$OSNAME" == "AIX" ]; then
|
||||
if ! lsgroup xcat >/dev/null 2>&1; then
|
||||
mkgroup xcat
|
||||
fi
|
||||
SYSGRP=system
|
||||
else
|
||||
if ! $GREP xcat /etc/group; then
|
||||
groupadd xcat
|
||||
fi
|
||||
SYSGRP=root
|
||||
fi
|
||||
chgrp -R xcat *
|
||||
chgrp -R $SYSGRP *
|
||||
chmod -R g+w *
|
||||
|
||||
# Build the tarball
|
||||
|
||||
@@ -32,7 +32,7 @@ function makenoarch {
|
||||
|
||||
|
||||
|
||||
# Make one of the following rpms: xCAT, xCATsn, xCAT-buildkit
|
||||
# Make one of the following rpms: xCAT, xCATsn, xCAT-buildkit, xCAT-OpenStack
|
||||
function makexcat {
|
||||
if [ "$OSNAME" != "AIX" -a "$1" != "xCAT-buildkit" -a -z "$2" ]; then
|
||||
echo 'Usage: makerpm <RPMname> <arch> [<embedded-system>]'
|
||||
@@ -88,6 +88,8 @@ function makexcat {
|
||||
ARCH="noarch"
|
||||
TARGET=""
|
||||
tar --exclude .svn --exclude xCAT-buildkit.spec -czf $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz $RPMNAME
|
||||
elif [ "$RPMNAME" = "xCAT-OpenStack" ]; then
|
||||
tar --exclude .svn --exclude xCAT-OpenStack.spec -czf $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz $RPMNAME
|
||||
else # do not recognize rpm
|
||||
echo "Unrecognized rpm: $RPMNAME"
|
||||
exit 2
|
||||
@@ -201,7 +203,7 @@ else # linux
|
||||
fi
|
||||
|
||||
|
||||
if [ "$1" = "xCAT" -o "$1" = "xCATsn" -o "$1" = "xCAT-buildkit" ]; then
|
||||
if [ "$1" = "xCAT" -o "$1" = "xCATsn" -o "$1" = "xCAT-buildkit" -o "$1" = "xCAT-OpenStack" ]; then
|
||||
exportEmbed $3
|
||||
makexcat $1 $2
|
||||
elif [ "$1" = "xCAT-nbroot" -o "$1" = "xCAT-nbroot-core" ]; then
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Source: perl-xcat
|
||||
Section: libs
|
||||
Priority: extra
|
||||
Maintainer: Arif Ali <aali@ocf.co.uk>
|
||||
Maintainer: xCAT <xcat-user@lists.sourceforge.net>
|
||||
Build-Depends: debhelper (>= 5), libsoap-lite-perl, libdbi-perl
|
||||
Standards-Version: 3.7.2
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ export DH_COMPAT=5
|
||||
|
||||
build:
|
||||
dh_testdir
|
||||
./modifyUtils `cat ../Version` `svn info | grep Revision | cut -d" " -f 2`
|
||||
./db2man
|
||||
|
||||
clean:
|
||||
@@ -49,6 +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`
|
||||
# dh_installmenu
|
||||
# dh_installdebconf
|
||||
# dh_installlogrotate
|
||||
|
||||
+10
-18
@@ -1,34 +1,26 @@
|
||||
#!/bin/sh
|
||||
# Put the version, svn revision #, and build date into the Version function in Version.pm
|
||||
|
||||
if [ -z "$2" ]
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "modifyUtils: Error: must specify the xCAT version and svn revision number as arguments" >&2
|
||||
echo "modifyUtils: Error: must specify the xCAT version as an argument" >&2
|
||||
exit
|
||||
fi
|
||||
|
||||
VER=$1
|
||||
SVNREF="svn r$2, "
|
||||
|
||||
#SVNINFO=`svn info 2>/dev/null|grep Revision`
|
||||
#/bin/echo -e $SVNINFO
|
||||
#if [ $? -ne 0 -a -f .svninfo ]; then
|
||||
# SVNINFO=`cat .svninfo 2>/dev/null|grep Revision`
|
||||
#fi
|
||||
#if [ $? -eq 0 ]
|
||||
# then
|
||||
# SVNREF="svn r"`echo $SVNINFO|awk '{print $2}'`", "
|
||||
# else
|
||||
# SVNREF=""
|
||||
# fi
|
||||
|
||||
BUILDDATE=`date`
|
||||
#echo ". '(${SVNREF}built $BUILDDATE)'"
|
||||
#echo ". '(built $BUILDDATE)'"
|
||||
|
||||
if [ "$(uname)" = "AIX" ]
|
||||
then
|
||||
sed -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (${SVNREF}built $BUILDDATE)'"/ xCAT/Version.pm >xCAT/Version.pm.new
|
||||
sed -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (built $BUILDDATE)'"/ xCAT/Version.pm >xCAT/Version.pm.new
|
||||
mv xCAT/Version.pm.new xCAT/Version.pm
|
||||
else
|
||||
sed -i -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (${SVNREF}built $BUILDDATE)'"/ xCAT/Version.pm
|
||||
if [ -f "/etc/debian_version" ];then
|
||||
FILENAME="debian/perl-xcat/opt/xcat/lib/perl/xCAT/Version.pm"
|
||||
else
|
||||
FILENAME="xCAT/Version.pm"
|
||||
fi
|
||||
sed -i -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (built $BUILDDATE)'"/ $FILENAME
|
||||
fi
|
||||
|
||||
@@ -25,7 +25,6 @@ Includes xCAT::Table, xCAT::NodeRange, among others.
|
||||
|
||||
%define zvm %(if [ "$zvm" = "1" ];then echo 1; else echo 0; fi)
|
||||
%define fsm %(if [ "$fsm" = "1" ];then echo 1; else echo 0; fi)
|
||||
%define svninfo %(svn info | grep Revision | awk '{print $2}')
|
||||
|
||||
%prep
|
||||
%setup -q -n perl-xCAT
|
||||
@@ -37,7 +36,7 @@ Includes xCAT::Table, xCAT::NodeRange, among others.
|
||||
%if %fsm
|
||||
%else
|
||||
# Modify the Version() function in xCAT/Utils.pm to automatically have the correct version
|
||||
./modifyUtils %{version} %{svninfo}
|
||||
./modifyUtils %{version}
|
||||
|
||||
# Build the pod version of the man pages for each DB table. It puts them in the man5 and man7 subdirs.
|
||||
# Then convert the pods to man pages and html pages.
|
||||
|
||||
+13
-18
@@ -191,7 +191,12 @@ sub updateUserInfo {
|
||||
{
|
||||
for my $record (@diff)
|
||||
{
|
||||
print $fp "$record\n";
|
||||
# skip to add ROOT relative records into MERGE file
|
||||
if ($record =~ /^root/)
|
||||
{
|
||||
next;
|
||||
}
|
||||
print $fp "$record\n";
|
||||
}
|
||||
}
|
||||
close ($fp);
|
||||
@@ -230,24 +235,13 @@ sub setCFMSynclistFile {
|
||||
# get the cfmdir and synclists attributes
|
||||
my $osimage_t = xCAT::Table->new('osimage');
|
||||
my $records = $osimage_t->getAttribs({imagename=>$img}, 'cfmdir', 'synclists');
|
||||
if ($records)
|
||||
if (defined ($records->{'cfmdir'}))
|
||||
{
|
||||
if ($records->{'cfmdir'}) {$cfmdir = $records->{'cfmdir'}}
|
||||
if ($records->{'synclists'}) {$synclists = $records->{'synclists'}}
|
||||
$cfmdir = $records->{'cfmdir'};
|
||||
if (defined ($records->{'synclists'})) {$synclists = $records->{'synclists'}}
|
||||
} else {
|
||||
if ($::VERBOSE)
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "There are no records for cfmdir and synclists attribute in the osimage:$img. There is nothing to process.";
|
||||
xCAT::MsgUtils->message("I", $rsp, $::CALLBACK);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
# no cfmdir defined, return directly
|
||||
if (!$cfmdir)
|
||||
{
|
||||
return;
|
||||
# no cfmdir defined, return directly
|
||||
return 0;
|
||||
}
|
||||
|
||||
my $found = 0;
|
||||
@@ -369,7 +363,8 @@ sub updateCFMSynclistFile {
|
||||
|
||||
# recursively list the files under cfm directory
|
||||
my @files = ();
|
||||
find ( sub { push @files, $File::Find::name if (! -d) }, $cfmdir);
|
||||
|
||||
find ( { wanted => sub { push @files, $File::Find::name if -f }, follow => 1 }, $cfmdir);
|
||||
if (!@files) # not files under cfm directory, skip to next loop
|
||||
{
|
||||
next;
|
||||
|
||||
@@ -179,11 +179,28 @@ if (ref($request) eq 'HASH') { # the request is an array, not pure XML
|
||||
if ($ENV{XCATHOST}) {
|
||||
$xcathost=$ENV{XCATHOST};
|
||||
}
|
||||
my %connargs=();
|
||||
if ($xcathost =~ s/%([^\]|:]*)//) {
|
||||
$connargs{PeerScope} = $1;
|
||||
}
|
||||
$connargs{PeerAddr} = $xcathost;
|
||||
$connargs{Timeout} = 15;
|
||||
if ($connargs{PeerScope} and $connargs{PeerScope} =~ /[a-zA-Z]/) { #non-numeric, need to translate...
|
||||
my @ipdata = `ip link`;
|
||||
@ipdata = grep(/[^@]$connargs{PeerScope}(:|@)/,@ipdata);
|
||||
if (scalar(@ipdata) != 1) {
|
||||
print STDERR "Unable to identify scope ".$connargs{PeerScope}."\n";
|
||||
exit(1);
|
||||
}
|
||||
$connargs{PeerScope} = $ipdata[0];
|
||||
$connargs{PeerScope} =~ s/:.*//;
|
||||
}
|
||||
|
||||
|
||||
my $pclient;
|
||||
if ($inet6support) {
|
||||
$pclient = IO::Socket::INET6->new(
|
||||
PeerAddr => $xcathost,
|
||||
Timeout => 15,
|
||||
%connargs,
|
||||
);
|
||||
} else {
|
||||
$pclient = IO::Socket::INET->new(
|
||||
@@ -214,6 +231,16 @@ if (ref($request) eq 'HASH') { # the request is an array, not pure XML
|
||||
Timeout => 0,
|
||||
);
|
||||
}
|
||||
unless ($client) {
|
||||
print "Unable to open socket connection to xcatd daemon on $xcathost.\n";
|
||||
print "Verify that the xcatd daemon is running and that your SSL setup is correct.\n";
|
||||
if ($@ =~ /SSL Timeout/) {
|
||||
die "Connection failure: SSL Timeout or incorrect certificates in ~/.xcat";
|
||||
} else {
|
||||
die "Connection failure: $@"
|
||||
}
|
||||
}
|
||||
|
||||
my $msg;
|
||||
if (ref($request) eq 'HASH') { # the request is an array, not pure XML
|
||||
$msg=XMLout($request,RootName=>'xcatrequest',NoAttr=>1,KeyAttr=>[]);
|
||||
@@ -285,6 +312,7 @@ if (ref($request) eq 'HASH') { # the request is an array, not pure XML
|
||||
$massresponse="";
|
||||
unless ($cleanexit) {
|
||||
print STDERR "ERROR/WARNING: communication with the xCAT server seems to have been ended prematurely\n";
|
||||
$xCAT::Client::EXITCODE = 1;
|
||||
}
|
||||
|
||||
sub validateXML {
|
||||
@@ -597,7 +625,10 @@ sub plugin_command {
|
||||
no strict "refs";
|
||||
# eval { #REMOVEEVALFORDEBUG
|
||||
# if ($dispatch_requests) {
|
||||
dispatch_request($req,$callback,$modname);
|
||||
# backup the original req and recover it after the a run
|
||||
my $org_req = {%$req};
|
||||
dispatch_request($req,$callback,$modname);
|
||||
$req = {%$org_req};
|
||||
# } else {
|
||||
# $SIG{CHLD}='DEFAULT';
|
||||
# ${"xCAT_plugin::".$modname."::"}{process_request}->($req,$callback,\&do_request);
|
||||
|
||||
Regular → Executable
+12
-4
@@ -57,7 +57,7 @@ sub getObjectsOfType
|
||||
|
||||
# The database may be changed between getObjectsOfType calls
|
||||
# do not use cache %::saveObjList if --nocache is specified
|
||||
if ($::saveObjList{$type} && !$::opt_c)
|
||||
if ($::saveObjList{$type} && !$::opt_nc)
|
||||
{
|
||||
@objlist = @{$::saveObjList{$type}};
|
||||
}
|
||||
@@ -200,7 +200,8 @@ sub getobjattrs
|
||||
# list of object names
|
||||
foreach my $table (keys %tableattrs) {
|
||||
# open the table
|
||||
my $thistable = xCAT::Table->new($table, -create => 1, -autocommit => 0);
|
||||
# with autocommit => 0, it does not work on Ubuntu running mysql
|
||||
my $thistable = xCAT::Table->new($table, -create => 1, -autocommit => 1);
|
||||
if (!$thistable) {
|
||||
my $rsp;
|
||||
$rsp->{data}->[0] = "Could not open the \'$table\' table.";
|
||||
@@ -606,7 +607,7 @@ sub getDBtable
|
||||
|
||||
# save this table info - in case this subr gets called multiple times
|
||||
# --nocache flag specifies not to use cahe
|
||||
if (grep(/^$table$/, @::foundTableList) && !$::opt_c)
|
||||
if (grep(/^$table$/, @::foundTableList) && !$::opt_nc)
|
||||
{
|
||||
|
||||
# already have this
|
||||
@@ -2006,7 +2007,14 @@ sub getNetwkInfo
|
||||
my @nodes = ("$node");
|
||||
my $sn = xCAT::ServiceNodeUtils->get_ServiceNode(\@nodes,"xcat","Node");
|
||||
my $snkey = (keys %{$sn})[0];
|
||||
$nethash{$node}{'gateway'} = xCAT::NetworkUtils->getipaddr($snkey);
|
||||
my $gw = xCAT::NetworkUtils->getipaddr($snkey);
|
||||
# two possible cases when this code is run:
|
||||
# 1. flat cluster: ip forwarding is not enabled on MN
|
||||
# 2. hw ctrl in hierarchy cluster, in which HCP SN is not set
|
||||
# in either case, MN itself should not be the gateway
|
||||
if (xCAT::NetworkUtils->thishostisnot($gw)) {
|
||||
$nethash{$node}{'gateway'} = $gw;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+141
-81
@@ -1019,11 +1019,18 @@ sub fork_fanout_dsh
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# save the original exports, we are going to add the unique node name below
|
||||
while (@$targets_waiting
|
||||
&& (keys(%$targets_active) < $$options{'fanout'}))
|
||||
{
|
||||
my $user_target = shift @$targets_waiting;
|
||||
# now add export NODE=nodename to the pre-command, if not a device;
|
||||
my $exportnode;
|
||||
if (($$options{'devicetype'})) {
|
||||
$exportnode="";
|
||||
} else{
|
||||
$exportnode="export NODE=$user_target; ";
|
||||
}
|
||||
my $target_properties = $$resolved_targets{$user_target};
|
||||
my @commands;
|
||||
my $localShell =
|
||||
@@ -1037,7 +1044,6 @@ sub fork_fanout_dsh
|
||||
$$options{'post-command'} = "";
|
||||
$dsh_cmd_background = 1;
|
||||
}
|
||||
|
||||
if ($$options{'environment'})
|
||||
{
|
||||
# if we are on a servicenode need to get the environment file
|
||||
@@ -1062,14 +1068,15 @@ 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,
|
||||
"$$options{'pre-command'} . $$options{'environment'} ; $$options{'command'}$$options{'post-command'}";
|
||||
"$exportnode$$options{'pre-command'} . $$options{'environment'} ; $$options{'command'}$$options{'post-command'}";
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
push @dsh_command,
|
||||
"$$options{'pre-command'}$$options{'command'}$$options{'post-command'}";
|
||||
"$exportnode$$options{'pre-command'}$$options{'command'}$$options{'post-command'}";
|
||||
}
|
||||
|
||||
if ($$target_properties{'localhost'})
|
||||
@@ -1137,7 +1144,7 @@ sub fork_fanout_dsh
|
||||
#eval "require RemoteShell::$rsh_extension";
|
||||
eval "require xCAT::$rsh_extension";
|
||||
|
||||
$rsh_config{'command'} = "$$options{'pre-command'}";
|
||||
$rsh_config{'command'} = "$exportnode$$options{'pre-command'}";
|
||||
my $tmp_env_file;
|
||||
# for the -E flag here we build and copy the -E env variable
|
||||
# file to the nodes
|
||||
@@ -2338,10 +2345,14 @@ sub config_dsh
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
{
|
||||
# if not Mellanox, it does not need a config file
|
||||
if (!($$options{'devicetype'} =~ /Mellanox/i)) {
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] = "EMsgMISSING_DEV_CFG";
|
||||
xCAT::MsgUtils->message('E', $rsp, $::CALLBACK);
|
||||
$rsp->{error}->[0] = "The config file: $devicepath is missing";
|
||||
xCAT::MsgUtils->message('E', $rsp, $::CALLBACK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3226,7 +3237,17 @@ sub bld_resolve_nodes_hash
|
||||
|
||||
# find out if we have an MN in the list, local cp and sh will be used
|
||||
# not remote shell
|
||||
my $mname = xCAT::Utils->noderangecontainsMn(@target_list);
|
||||
# find out the names for the Management Node
|
||||
my @MNnodeinfo = xCAT::NetworkUtils->determinehostname;
|
||||
my $mname = pop @MNnodeinfo; # hostname
|
||||
my $cmd="hostname";
|
||||
my $localhostname = xCAT::Utils->runcmd($cmd,0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{info}->[0] = "Command: $cmd failed. Continuing...";
|
||||
xCAT::MsgUtils->message("I", $rsp, $::CALLBACK);
|
||||
}
|
||||
foreach my $target (@target_list)
|
||||
{
|
||||
|
||||
@@ -3235,11 +3256,9 @@ sub bld_resolve_nodes_hash
|
||||
my $localhost;
|
||||
my $user;
|
||||
my $context = "XCAT";
|
||||
# check to see if this node is the Management Node
|
||||
if ($mname) {
|
||||
if ($mname eq $target) {
|
||||
# check to see if this node is the Management Node we are on, can run local commands (sh,cp)
|
||||
if (($mname eq $target) || ($localhostname eq $target)){
|
||||
$localhost=$target;
|
||||
}
|
||||
}
|
||||
my %properties = (
|
||||
'hostname' => $hostname,
|
||||
@@ -4068,11 +4087,12 @@ sub parse_and_run_dsh
|
||||
# check if any node in the noderange is the Management Node and exit
|
||||
# with error, if the Management Node is in the Database and in the
|
||||
# noderange
|
||||
my $mname = xCAT::Utils->noderangecontainsMn(@nodelist);
|
||||
if ($mname) { # MN in the nodelist
|
||||
my @mname = xCAT::Utils->noderangecontainsMn(@nodelist);
|
||||
if (@mname) { # MN in the nodelist
|
||||
my $nodes=join(',', @mname);
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"You must not run -K option against the Management Node:$mname.";
|
||||
"You must not run -K option against the Management Node:$nodes.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1);
|
||||
return;
|
||||
}
|
||||
@@ -4174,7 +4194,7 @@ sub parse_and_run_dsh
|
||||
#
|
||||
# setup ssh keys on the nodes or ib switch
|
||||
#
|
||||
my $rc = xCAT::TableUtils->setupSSH($options{'nodes'});
|
||||
my $rc = xCAT::TableUtils->setupSSH($options{'nodes'},$options{'timeout'});
|
||||
my @results = "return code = $rc";
|
||||
return (@results);
|
||||
}
|
||||
@@ -4686,21 +4706,42 @@ sub parse_and_run_dcp
|
||||
my $ranpostscripts;
|
||||
my $ranappendscripts;
|
||||
my $ranmergescripts;
|
||||
|
||||
# if we were called with runxcmd, like by updatenode
|
||||
# need to save the runxcmd buffer
|
||||
# $::xcmd_outref
|
||||
my $save_xcmd_outref;
|
||||
if ($::xcmd_outref) { # this means we were called with runxcmd
|
||||
$save_xcmd_outref = $::xcmd_outref;
|
||||
}
|
||||
|
||||
if ((@::postscripts) && ($::SYNCSN == 0)) {
|
||||
@results2 = &run_rsync_postscripts(\@results,$synfiledir);
|
||||
@results2 = &run_rsync_postscripts(\@results,$synfiledir,\%options);
|
||||
$ranpostscripts=1;
|
||||
}
|
||||
if ((@::alwayspostscripts) && ($::SYNCSN == 0)) {
|
||||
@results3 = &run_always_rsync_postscripts(\@nodelist,$synfiledir);
|
||||
@results3 = &run_always_rsync_postscripts(\@nodelist,$synfiledir,\%options);
|
||||
}
|
||||
if (($::appendscript) && ($::SYNCSN == 0)) {
|
||||
@results4 = &bld_and_run_append(\@nodelist,\@results,$synfiledir,$nodesyncfiledir);
|
||||
@results4 = &bld_and_run_append(\@nodelist,\@results,$synfiledir,$nodesyncfiledir,\%options);
|
||||
$ranappendscripts=1;
|
||||
}
|
||||
if (($::mergescript) && ($::SYNCSN == 0)) {
|
||||
@results5 = &bld_and_run_merge(\@nodelist,\@results,$synfiledir,$nodesyncfiledir);
|
||||
@results5 = &bld_and_run_merge(\@nodelist,\@results,$synfiledir,$nodesyncfiledir,\%options);
|
||||
$ranmergescripts=1;
|
||||
}
|
||||
# restore the runxcmd buffer
|
||||
if ($save_xcmd_outref) { # this means we were called with runxcmd
|
||||
$::xcmd_outref = $save_xcmd_outref;
|
||||
}
|
||||
# TODO, will we ever need to merge
|
||||
# if we ran a postscript and we were run
|
||||
# using runxcmd, and there was previous output in the
|
||||
# runxcmd buffer and we have output from the postscript
|
||||
# then we have to merge the outputs
|
||||
#if (($ranaps == 1) && ($save_xcmd_outref) && ($::xcmd_outref) ) {
|
||||
# &mergeoutput($save_xcmd_outref);
|
||||
#}
|
||||
my @newresults;
|
||||
if (@results2) {
|
||||
@newresults = (@results2);
|
||||
@@ -4715,9 +4756,14 @@ sub parse_and_run_dcp
|
||||
@newresults = (@newresults,@results3,@results4,@results5);
|
||||
}
|
||||
if (@newresults) {
|
||||
if ($save_xcmd_outref) { # this means we were called with runxcmd
|
||||
foreach my $line (@newresults) {
|
||||
push @$::xcmd_outref,$line;
|
||||
}
|
||||
}
|
||||
return (@newresults);
|
||||
} else {
|
||||
# don't report results for postscripts,appendscripts,mergescripts because
|
||||
# don't report other results for postscripts,appendscripts,mergescripts because
|
||||
# you get all the rsync returned lines
|
||||
if (($ranpostscripts == 0 ) && ($ranappendscripts == 0)
|
||||
&& ($ranmergescripts == 0)) {
|
||||
@@ -4926,7 +4972,8 @@ sub parse_rsync_input_file_on_MN
|
||||
$::process_line = 0;
|
||||
my $destfileisdir;
|
||||
my $clause=0;
|
||||
|
||||
my $addmergescript =0;
|
||||
my $addappendscript =0;
|
||||
open(INPUTFILE, "< $input_file") || die "File $input_file does not exist\n";
|
||||
while (my $line = <INPUTFILE>)
|
||||
{
|
||||
@@ -4967,12 +5014,16 @@ sub parse_rsync_input_file_on_MN
|
||||
# this triggers the running of the appendscript
|
||||
$::appendscript ="/opt/xcat/share/xcat/scripts/xdcpappend.sh";
|
||||
}
|
||||
|
||||
# add the append script to the sync
|
||||
my $appscript ="/opt/xcat/share/xcat/scripts/xdcpappend.sh";
|
||||
my $appendscriptline = "$appscript -> $appscript";
|
||||
$syncappendscript=1; # syncing the xdcpappend.sh script
|
||||
&build_append_rsync($appendscriptline,$nodes, $options, $input_file,$rsyncSN, $syncdir,$nodesyncfiledir,$onServiceNode,$syncappendscript);
|
||||
}
|
||||
if ($addappendscript == 0) { # only add once
|
||||
my $appscript ="/opt/xcat/share/xcat/scripts/xdcpappend.sh";
|
||||
my $appendscriptline = "$appscript -> $appscript";
|
||||
$syncappendscript=1; # syncing the xdcpappend.sh script
|
||||
&build_append_rsync($appendscriptline,$nodes, $options, $input_file,$rsyncSN, $syncdir,$nodesyncfiledir,$onServiceNode,$syncappendscript);
|
||||
$addappendscript=1;
|
||||
}
|
||||
} # end APPEND clause
|
||||
if ($clause =~ /MERGE:/) {
|
||||
# location of the base merge script
|
||||
# for MERGE we have to sync the mergescript and the
|
||||
@@ -4984,12 +5035,16 @@ sub parse_rsync_input_file_on_MN
|
||||
# this triggers the running of the mergescript
|
||||
$::mergescript ="/opt/xcat/share/xcat/scripts/xdcpmerge.sh";
|
||||
}
|
||||
|
||||
# add the merge script to the sync
|
||||
my $mergescript ="/opt/xcat/share/xcat/scripts/xdcpmerge.sh";
|
||||
my $mergescriptline = "$mergescript -> $mergescript";
|
||||
$syncmergescript=1; # syncing the xdcpmerge.sh script
|
||||
&build_merge_rsync($mergescriptline,$nodes, $options, $input_file,$rsyncSN, $syncdir,$nodesyncfiledir,$onServiceNode,$syncmergescript);
|
||||
}
|
||||
if ($addmergescript == 0) { # only add once
|
||||
my $mergescript ="/opt/xcat/share/xcat/scripts/xdcpmerge.sh";
|
||||
my $mergescriptline = "$mergescript -> $mergescript";
|
||||
$syncmergescript=1; # syncing the xdcpmerge.sh script
|
||||
&build_merge_rsync($mergescriptline,$nodes, $options, $input_file,$rsyncSN, $syncdir,$nodesyncfiledir,$onServiceNode,$syncmergescript);
|
||||
$addmergescript=1;
|
||||
}
|
||||
} # end MERGE clause
|
||||
|
||||
}
|
||||
} else { # not processing EXECUTE, EXECUTEALWAYS or APPEND
|
||||
@@ -5153,6 +5208,7 @@ sub build_append_rsync
|
||||
push @::appendlines,$line;
|
||||
}
|
||||
my $src_file = $1; # append file left of arror
|
||||
my $orig_src_file = $1; # append file left of arror
|
||||
# it will be sync'd to $nodesyncfiledir/$append_file
|
||||
my $dest_file = $nodesyncfiledir;
|
||||
$dest_file .= $src_file;
|
||||
@@ -5181,7 +5237,7 @@ sub build_append_rsync
|
||||
# to pick up files from /var/xcat/syncfiles...
|
||||
if ($onServiceNode == 1) {
|
||||
my $newsrcfile = $syncdir; # add SN syndir on front
|
||||
$newsrcfile .= $src_file;
|
||||
$newsrcfile .= $orig_src_file;
|
||||
$src_file=$newsrcfile;
|
||||
}
|
||||
# destination file name
|
||||
@@ -5265,6 +5321,7 @@ sub build_merge_rsync
|
||||
push @::mergelines,$line;
|
||||
}
|
||||
my $src_file = $1; # merge file left of arror
|
||||
my $orig_src_file = $1;
|
||||
# it will be sync'd to $nodesyncfiledir/$merge_file
|
||||
my $dest_file = $nodesyncfiledir;
|
||||
$dest_file .= $src_file;
|
||||
@@ -5293,7 +5350,7 @@ sub build_merge_rsync
|
||||
# to pick up files from /var/xcat/syncfiles...
|
||||
if ($onServiceNode == 1) {
|
||||
my $newsrcfile = $syncdir; # add SN syndir on front
|
||||
$newsrcfile .= $src_file;
|
||||
$newsrcfile .= $orig_src_file;
|
||||
$src_file=$newsrcfile;
|
||||
}
|
||||
# destination file name
|
||||
@@ -5592,7 +5649,7 @@ sub parse_rsync_input_file_on_SN
|
||||
|
||||
sub run_rsync_postscripts
|
||||
{
|
||||
my ($rsyncoutput,$syncdir) = @_;
|
||||
my ($rsyncoutput,$syncdir,$options) = @_;
|
||||
my @rsync_output = @$rsyncoutput;
|
||||
my @newoutput= ();
|
||||
my $dshparms;
|
||||
@@ -5635,27 +5692,26 @@ sub run_rsync_postscripts
|
||||
# now if we have postscripts to run, run xdsh
|
||||
my $out;
|
||||
|
||||
# if we were called with runxcmd, like by updatenode
|
||||
# need to save the runxcmd buffer
|
||||
# $::xcmd_outref
|
||||
my $save_xcmd_outref;
|
||||
if ($::xcmd_outref) { # this means we were called with runxcmd
|
||||
$save_xcmd_outref = $::xcmd_outref;
|
||||
}
|
||||
# my $ranaps=0; # did we run a postscript
|
||||
|
||||
foreach my $ps ( keys %{$$dshparms{'postscripts'}}) {
|
||||
my @nodes;
|
||||
push (@nodes, @{$$dshparms{'postscripts'}{$ps}});
|
||||
my @args=();
|
||||
if ($$options{'nodestatus'}) {
|
||||
push @args,"--nodestatus" ;
|
||||
}
|
||||
push @args,"-e";
|
||||
# if on the service node need to add the $syncdir directory
|
||||
# to the path
|
||||
if (xCAT::Utils->isServiceNode()) {
|
||||
my $tmpp=$syncdir . $ps;
|
||||
$ps=$tmpp;
|
||||
}
|
||||
$out=xCAT::Utils->runxcmd( { command => ['xdsh'],
|
||||
push @args,$ps;
|
||||
$out=xCAT::Utils->runxcmd( { command => ['xdsh'],
|
||||
node => \@nodes,
|
||||
arg => [ "-e", $ps ]
|
||||
arg => \@args,
|
||||
}, $::SUBREQ, 0,1);
|
||||
foreach my $r (@$out){
|
||||
push(@newoutput, $r);
|
||||
@@ -5663,18 +5719,6 @@ sub run_rsync_postscripts
|
||||
}
|
||||
# $ranaps=1;
|
||||
}
|
||||
# restore the runxcmd buffer
|
||||
if ($save_xcmd_outref) { # this means we were called with runxcmd
|
||||
$::xcmd_outref = $save_xcmd_outref;
|
||||
}
|
||||
# TODO, will we ever need to merge
|
||||
# if we ran a postscript and we were run
|
||||
# using runxcmd, and there was previous output in the
|
||||
# runxcmd buffer and we have output from the postscript
|
||||
# then we have to merge the outputs
|
||||
#if (($ranaps == 1) && ($save_xcmd_outref) && ($::xcmd_outref) ) {
|
||||
# &mergeoutput($save_xcmd_outref);
|
||||
#}
|
||||
return @newoutput;
|
||||
}
|
||||
#-------------------------------------------------------------------------------
|
||||
@@ -5712,7 +5756,7 @@ sub run_rsync_postscripts
|
||||
|
||||
sub bld_and_run_append
|
||||
{
|
||||
my ($hostnames,$rsyncoutput,$syncdir,$nodesyncfiledir) = @_;
|
||||
my ($hostnames,$rsyncoutput,$syncdir,$nodesyncfiledir,$options) = @_;
|
||||
my @hosts = @$hostnames;
|
||||
my @rsync_output = @$rsyncoutput;
|
||||
my @newoutput= ();
|
||||
@@ -5762,8 +5806,10 @@ sub bld_and_run_append
|
||||
# that were rsyn'd to at least one node
|
||||
if ($tmpappendfile eq $ps) {
|
||||
my $parm="$appendfile:$filetoappend ";
|
||||
|
||||
$::xdcpappendparms .= $parm;
|
||||
# check to see if the parameter is already in the list
|
||||
if (!($::xdcpappendparms =~ /$parm/)) {
|
||||
$::xdcpappendparms .= $parm;
|
||||
}
|
||||
$processappend=1;
|
||||
|
||||
}
|
||||
@@ -5784,10 +5830,16 @@ sub bld_and_run_append
|
||||
foreach my $ps ( keys %{$$dshparms{'appendscripts'}}) {
|
||||
my @nodes;
|
||||
push (@nodes, @{$$dshparms{'appendscripts'}{$ps}});
|
||||
my @args=();
|
||||
if ($$options{'nodestatus'}) {
|
||||
push @args,"--nodestatus" ;
|
||||
}
|
||||
push @args,$ps;
|
||||
push @args,$::xdcpappendparms;
|
||||
|
||||
$out=xCAT::Utils->runxcmd( { command => ['xdsh'],
|
||||
node => \@nodes,
|
||||
arg => [ $ps , $::xdcpappendparms ]
|
||||
arg => \@args,
|
||||
}, $::SUBREQ, 0,1);
|
||||
foreach my $r (@$out){
|
||||
push(@newoutput, $r);
|
||||
@@ -5834,7 +5886,7 @@ sub bld_and_run_append
|
||||
|
||||
sub bld_and_run_merge
|
||||
{
|
||||
my ($hostnames,$rsyncoutput,$syncdir,$nodesyncfiledir) = @_;
|
||||
my ($hostnames,$rsyncoutput,$syncdir,$nodesyncfiledir,$options) = @_;
|
||||
my @hosts = @$hostnames;
|
||||
my @rsync_output = @$rsyncoutput;
|
||||
my @newoutput= ();
|
||||
@@ -5893,8 +5945,10 @@ sub bld_and_run_merge
|
||||
# that were rsyn'd to at least one node
|
||||
if ($tmpmergefile eq $ps) {
|
||||
my $parm="$mergefile:$filetomerge ";
|
||||
|
||||
$::xdcpmergeparms .= $parm;
|
||||
# check to see if the parameter is already in the list
|
||||
if (!($::xdcpmergeparms =~ /$parm/)) {
|
||||
$::xdcpmergeparms .= $parm;
|
||||
}
|
||||
$processmerge=1;
|
||||
|
||||
}
|
||||
@@ -5916,9 +5970,17 @@ sub bld_and_run_merge
|
||||
my @nodes;
|
||||
push (@nodes, @{$$dshparms{'mergescripts'}{$ps}});
|
||||
|
||||
# build the argument list
|
||||
my @args=();
|
||||
|
||||
if ($$options{'nodestatus'}) {
|
||||
push @args,"--nodestatus" ;
|
||||
}
|
||||
push @args, $ps;
|
||||
push @args, $::xdcpmergeparms;
|
||||
$out=xCAT::Utils->runxcmd( { command => ['xdsh'],
|
||||
node => \@nodes,
|
||||
arg => [ $ps , $::xdcpmergeparms ]
|
||||
arg => \@args,
|
||||
}, $::SUBREQ, 0,1);
|
||||
foreach my $r (@$out){
|
||||
push(@newoutput, $r);
|
||||
@@ -5944,7 +6006,7 @@ sub bld_and_run_merge
|
||||
|
||||
sub run_always_rsync_postscripts
|
||||
{
|
||||
my ($hostnames,$syncdir) = @_;
|
||||
my ($hostnames,$syncdir,$options) = @_;
|
||||
my @hosts = @$hostnames;
|
||||
my @newoutput= ();
|
||||
my $dshparms;
|
||||
@@ -5966,26 +6028,28 @@ sub run_always_rsync_postscripts
|
||||
# now if we have postscripts to run, run xdsh
|
||||
my $out;
|
||||
|
||||
# if we were called with runxcmd, like by updatenode
|
||||
# need to save the runxcmd buffer
|
||||
# $::xcmd_outref
|
||||
my $save_xcmd_outref;
|
||||
if ($::xcmd_outref) { # this means we were called with runxcmd
|
||||
$save_xcmd_outref = $::xcmd_outref;
|
||||
}
|
||||
|
||||
foreach my $ps ( keys %{$$dshparms{'postscripts'}}) {
|
||||
my @nodes;
|
||||
push (@nodes, @{$$dshparms{'postscripts'}{$ps}});
|
||||
# build the argument list
|
||||
my @args=();
|
||||
if ($$options{'nodestatus'}) {
|
||||
push @args,"--nodestatus" ;
|
||||
}
|
||||
push @args,"-e";
|
||||
# if on the service node need to add the $syncdir directory
|
||||
# to the path
|
||||
if (xCAT::Utils->isServiceNode()) {
|
||||
my $tmpp=$syncdir . $ps;
|
||||
$ps=$tmpp;
|
||||
my $tmps=$syncdir . $ps;
|
||||
push @args, $tmps;
|
||||
} else{
|
||||
push @args, $ps;
|
||||
}
|
||||
push (@nodes, @{$$dshparms{'postscripts'}{$ps}});
|
||||
|
||||
$out=xCAT::Utils->runxcmd( { command => ['xdsh'],
|
||||
$out=xCAT::Utils->runxcmd( { command => ['xdsh'],
|
||||
node => \@nodes,
|
||||
arg => [ "-e", $ps ]
|
||||
arg => \@args,
|
||||
}, $::SUBREQ, 0,1);
|
||||
foreach my $r (@$out){
|
||||
push(@newoutput, $r);
|
||||
@@ -5993,10 +6057,6 @@ sub run_always_rsync_postscripts
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
# restore the runxcmd buffer
|
||||
if ($save_xcmd_outref) { # this means we were called with runxcmd
|
||||
$::xcmd_outref = $save_xcmd_outref;
|
||||
}
|
||||
return @newoutput;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ sub update_discovery_data {
|
||||
$disdata{'discoverytime'} = $currtime;
|
||||
|
||||
foreach my $attr (keys %$request) {
|
||||
if ($attr =~ /^(command|discoverymethod|_xcat|cacheonly|noderange|environment)/) {
|
||||
if ($attr =~ /^(command|discoverymethod|_xcat|cacheonly|noderange|environment|method|discoverytime|updateswitch)/) {
|
||||
next;
|
||||
} elsif ($attr =~ /^(node|uuid|arch|cpucount|cputype|memory|mtm|serial)$/) {
|
||||
$disdata{$attr} = $request->{$attr}->[0];
|
||||
|
||||
@@ -368,11 +368,19 @@ sub fsp_api_action {
|
||||
} elsif( $parameter !=0 && $action =~ /^(on|reset)$/ ) {
|
||||
#powerinterval for lpars power on
|
||||
$cmd = "$fsp_api -a $action -i $parameter -T $tooltype -t $type:$fsp_ip:$id:$node_name:";
|
||||
} elsif ($action =~ /^part_set_lpar_def_state$/) {
|
||||
$cmd = "$fsp_api -a $action -T $tooltype -s $parameter -t $type:$fsp_ip:$id:$node_name:";
|
||||
} elsif (exists($request->{opt}->{vios})) {
|
||||
$cmd = "$fsp_api -a $action -T $tooltype -s 1 -t $type:$fsp_ip:$id:$node_name:$parameter";
|
||||
} else {
|
||||
$cmd = "$fsp_api -a $action -T $tooltype -t $type:$fsp_ip:$id:$node_name:$parameter";
|
||||
}
|
||||
} else {
|
||||
$cmd = "$fsp_api -a $action -T $tooltype -t $type:$fsp_ip:$id:$node_name:";
|
||||
if (exists($request->{opt}->{vios})) {
|
||||
$cmd = "$fsp_api -a $action -T $tooltype -s 1 -t $type:$fsp_ip:$id:$node_name:";
|
||||
} else {
|
||||
$cmd = "$fsp_api -a $action -T $tooltype -t $type:$fsp_ip:$id:$node_name:";
|
||||
}
|
||||
}
|
||||
}
|
||||
xCAT::MsgUtils->verbose_message($request, "fsp_api_action cmd:$cmd.");
|
||||
|
||||
@@ -13,6 +13,7 @@ use xCAT::GlobalDef;
|
||||
use xCAT::Usage;
|
||||
use xCAT::NetworkUtils;
|
||||
use xCAT::FSPUtils;
|
||||
require xCAT::data::ibmhwtypes;
|
||||
#use Data::Dumper;
|
||||
|
||||
##############################################
|
||||
@@ -259,7 +260,8 @@ sub format_output {
|
||||
# Strip errors for results
|
||||
#######################################
|
||||
my @val = grep( !/^#.*: ERROR /, @$values );
|
||||
xCAT::PPCdb::add_ppc( $hwtype, \@val );
|
||||
#xCAT::PPCdb::add_ppc( $hwtype, \@val );
|
||||
$values = xCAT::PPCdb::update_lpar( $hwtype, \@val, "write");
|
||||
}
|
||||
|
||||
###########################################
|
||||
@@ -270,7 +272,8 @@ sub format_output {
|
||||
# Strip errors for results
|
||||
#######################################
|
||||
my @val = grep( !/^#.*: ERROR /, @$values );
|
||||
$values = xCAT::PPCdb::update_ppc( $hwtype, \@val );
|
||||
#$values = xCAT::PPCdb::update_ppc( $hwtype, \@val );
|
||||
$values = xCAT::PPCdb::update_lpar( $hwtype, \@val );
|
||||
if ( exists( $opt->{x} ) or exists( $opt->{z} ))
|
||||
{
|
||||
unshift @$values, "hmc";
|
||||
@@ -391,6 +394,7 @@ sub format_stanza {
|
||||
#################################
|
||||
# Add each attribute
|
||||
#################################
|
||||
my $mtm = undef;
|
||||
foreach ( @attribs ) {
|
||||
my $d = $data[$i++];
|
||||
|
||||
@@ -401,7 +405,8 @@ sub format_stanza {
|
||||
} elsif ( /^hwtype$/ ) {
|
||||
$d = $globalhwtype{$type};
|
||||
} elsif ( /^groups$/ ) {
|
||||
$d = "$type,all";
|
||||
next;
|
||||
#$d = "$type,all";
|
||||
} elsif ( /^mgt$/ ) {
|
||||
$d = $hwtype;
|
||||
} elsif ( /^cons$/ ) {
|
||||
@@ -414,7 +419,9 @@ sub format_stanza {
|
||||
} elsif ( /^(mtm|serial)$/ ) {
|
||||
if ( $type eq "lpar" ) {
|
||||
$d = undef;
|
||||
}
|
||||
} elsif (/^mtm$/) {
|
||||
$mtm = $d;
|
||||
}
|
||||
} elsif (/^side$/) {
|
||||
unless ( $type =~ /^fsp|bpa$/ ) {
|
||||
next;
|
||||
@@ -422,6 +429,15 @@ sub format_stanza {
|
||||
}
|
||||
$result .= "\t$_=$d\n";
|
||||
}
|
||||
my $tmp_groups = "$type,all";
|
||||
if (defined($mtm)) {
|
||||
my $tmp_pre = xCAT::data::ibmhwtypes::parse_group($mtm);
|
||||
if (defined($tmp_pre)) {
|
||||
$tmp_groups .= ",$tmp_pre";
|
||||
}
|
||||
}
|
||||
$result .= "\tgroups=$tmp_groups\n";
|
||||
|
||||
}
|
||||
return( $result );
|
||||
}
|
||||
@@ -464,6 +480,7 @@ sub format_xml {
|
||||
#################################
|
||||
# Add each attribute
|
||||
#################################
|
||||
my $mtm = undef;
|
||||
foreach ( @attribs ) {
|
||||
my $d = $data[$i++];
|
||||
|
||||
@@ -472,7 +489,8 @@ sub format_xml {
|
||||
} elsif ( /^hwtype$/ ) {
|
||||
$d = $globalhwtype{$type};
|
||||
} elsif ( /^groups$/ ) {
|
||||
$d = "$type,all";
|
||||
next;
|
||||
#$d = "$type,all";
|
||||
} elsif ( /^mgt$/ ) {
|
||||
$d = $hwtype;
|
||||
} elsif ( /^cons$/ ) {
|
||||
@@ -484,6 +502,8 @@ sub format_xml {
|
||||
} elsif ( /^(mtm|serial)$/ ) {
|
||||
if ( $type eq "lpar" ) {
|
||||
$d = undef;
|
||||
} elsif (/^mtm$/) {
|
||||
$mtm = $d;
|
||||
}
|
||||
} elsif (/^side$/) {
|
||||
unless ( $type =~ /^fsp|bpa$/ ) {
|
||||
@@ -492,6 +512,15 @@ sub format_xml {
|
||||
}
|
||||
$href->{Node}->{$_} = $d;
|
||||
}
|
||||
my $tmp_groups = "$type,all";
|
||||
if (defined($mtm)) {
|
||||
my $tmp_pre = xCAT::data::ibmhwtypes::parse_group($mtm);
|
||||
if (defined($tmp_pre)) {
|
||||
$tmp_groups .= ",$tmp_pre";
|
||||
}
|
||||
}
|
||||
$href->{Node}->{groups}=$tmp_groups;
|
||||
|
||||
#print Dumper($href);
|
||||
#################################
|
||||
# XML encoding
|
||||
|
||||
+640
-53
@@ -51,6 +51,8 @@ sub parse_args {
|
||||
sub chvm_parse_extra_options {
|
||||
my $args = shift;
|
||||
my $opt = shift;
|
||||
# Partition used attributes #
|
||||
my @support_ops = qw(vmcpus vmmemory vmphyslots vmothersetting);
|
||||
if (ref($args) ne 'ARRAY') {
|
||||
return "$args";
|
||||
}
|
||||
@@ -71,7 +73,20 @@ sub chvm_parse_extra_options {
|
||||
# if ($value !~ /^\d+\/\d+\/\d+$/) {
|
||||
# return "'$value' invalid";
|
||||
# }
|
||||
} else {
|
||||
} elsif (grep(/^$cmd$/, @support_ops)) {
|
||||
if (exists($opt->{p775})) {
|
||||
return "'$cmd' doesn't work for Power 775 machines.";
|
||||
} elsif ($cmd eq "vmothersetting") {
|
||||
if ($value =~ /hugepage:\s*(\d+)/i) {
|
||||
$opt->{huge_page} = $1;
|
||||
}
|
||||
if ($value =~ /bsr:\s*(\d+)/i) {
|
||||
$opt->{bsr} = $1;
|
||||
}
|
||||
next;
|
||||
}
|
||||
|
||||
} else {
|
||||
return "'$cmd' not support";
|
||||
}
|
||||
$opt->{$cmd} = $value;
|
||||
@@ -109,7 +124,7 @@ sub chvm_parse_args {
|
||||
$Getopt::Long::ignorecase = 0;
|
||||
Getopt::Long::Configure( "bundling" );
|
||||
|
||||
if ( !GetOptions( \%opt, qw(V|verbose p=s i=s m=s r=s ) )) {
|
||||
if ( !GetOptions( \%opt, qw(V|verbose p=s i=s m=s r=s p775) )) {
|
||||
return( usage() );
|
||||
}
|
||||
####################################
|
||||
@@ -126,8 +141,11 @@ sub chvm_parse_args {
|
||||
# return(usage( "Configuration file or attributes not specified" ));
|
||||
# }
|
||||
#}
|
||||
|
||||
if (exists($opt{p775})) {
|
||||
my @cfgdata ;
|
||||
if ((exists ($opt{p}) || defined($request->{stdin})) && !exists($opt{p775}) ) {
|
||||
return(usage("Profile just work for Power 775"));
|
||||
}
|
||||
if ( exists( $opt{p})) {
|
||||
|
||||
if ( exists( $opt{i} ) || exists( $opt{r}) || exists( $opt{m} ) ) {
|
||||
@@ -302,6 +320,7 @@ sub chvm_parse_args {
|
||||
$request->{node} = [$other_p];
|
||||
$request->{noderange} = $other_p;
|
||||
}
|
||||
}
|
||||
####################################
|
||||
# Check for an extra argument
|
||||
####################################
|
||||
@@ -347,21 +366,23 @@ sub mkvm_parse_args {
|
||||
#############################################
|
||||
# Process command-line arguments
|
||||
#############################################
|
||||
if ( !defined( $args )) {
|
||||
return(usage( "No command specified" ));
|
||||
}
|
||||
#if ( !defined( $args )) {
|
||||
# return(usage( "No command specified" ));
|
||||
#}
|
||||
#############################################
|
||||
# Checks case in GetOptions, allows opts
|
||||
# to be grouped (e.g. -vx), and terminates
|
||||
# at the first unrecognized option.
|
||||
#############################################
|
||||
@ARGV = @$args;
|
||||
if (defined($args)) {
|
||||
@ARGV = @$args;
|
||||
}
|
||||
$Getopt::Long::ignorecase = 0;
|
||||
Getopt::Long::Configure( "bundling" );
|
||||
# if ( !GetOptions( \%opt, qw(V|verbose ibautocfg ibacap=s i=s l=s c=s p=s full) )) {
|
||||
# if ( !GetOptions( \%opt, qw(V|verbose ibautocfg ibacap=s i=s l=s c=s p=s m=s r=s full) )) {
|
||||
# return( usage() );
|
||||
# }
|
||||
if ( !GetOptions( \%opt, qw(V|verbose i=s m=s r=s ) )) {
|
||||
if ( !GetOptions( \%opt, qw(V|verbose full vios) )) {
|
||||
return( usage() );
|
||||
}
|
||||
####################################
|
||||
@@ -370,7 +391,37 @@ sub mkvm_parse_args {
|
||||
if ( grep(/^-$/, @ARGV )) {
|
||||
return(usage( "Missing option: -" ));
|
||||
}
|
||||
if (!exists($opt{p775})) {
|
||||
my @unsupport_ops = ();
|
||||
foreach my $tmpop (keys %opt) {
|
||||
if ($tmpop !~ /full|vios|V/) {
|
||||
push @unsupport_ops, $tmpop;
|
||||
}
|
||||
}
|
||||
my @support_ops = qw(vmcpus vmmemory vmphyslots vmothersetting);
|
||||
if (defined(@ARGV[0]) and defined($opt{full})) {
|
||||
return(usage("Option 'full' shall be used alone."));
|
||||
} elsif (defined(@ARGV[0])) {
|
||||
foreach my $arg (@ARGV) {
|
||||
my ($cmd,$val) = split (/=/,$arg);
|
||||
if (!grep(/^$cmd$/, @support_ops)) {
|
||||
push @unsupport_ops, $cmd;
|
||||
} elsif (!defined($val)) {
|
||||
return(usage("The option $cmd need specific parameters."));
|
||||
} else {
|
||||
$opt{$cmd} = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (@unsupport_ops) {
|
||||
my $tmpops = join(",",@unsupport_ops);
|
||||
return(usage( "The options $tmpops can only work(s) with Power 775 machines."));
|
||||
}
|
||||
} else {
|
||||
if (exists($opt{full}) or exists($opt{vios})) {
|
||||
return(usage( "Option 'p775' only works for Power 775 machines."));
|
||||
}
|
||||
####################################
|
||||
# Check for non-zero integer
|
||||
####################################
|
||||
@@ -408,13 +459,14 @@ sub mkvm_parse_args {
|
||||
} else {
|
||||
return(usage( "Invalid entry: $opt{m}.\n For Power 775, the pending memory interleaving mode only could be interleaved(or 1), or non-interleaved(or 2)." ));
|
||||
}
|
||||
} else {
|
||||
} elsif (exists($opt{p775})){
|
||||
$opt{m} = 2 ;# non-interleaved, which is the default
|
||||
}
|
||||
|
||||
my @ratio = (1, 2, 3, 4, 5);
|
||||
my %octant_cfg = ();
|
||||
if ( exists( $opt{r} ) ) {
|
||||
my @ratio = (1, 2, 3, 4, 5);
|
||||
my %octant_cfg = ();
|
||||
|
||||
my @elems = split(/\,/,$opt{r});
|
||||
my $range="";
|
||||
while (my $elem = shift @elems) {
|
||||
@@ -461,15 +513,15 @@ sub mkvm_parse_args {
|
||||
}
|
||||
} # end of "if .. else.."
|
||||
} # end of while
|
||||
$opt{octant_cfg}{octant_cfg_value} = (\%octant_cfg);
|
||||
$opt{octant_cfg}{memory_interleave} = $opt{m};
|
||||
} #end of if
|
||||
|
||||
$opt{octant_cfg}{octant_cfg_value} = (\%octant_cfg);
|
||||
$opt{octant_cfg}{memory_interleave} = $opt{m};
|
||||
|
||||
if ( !exists( $opt{i} ) || !exists( $opt{r} ) ) {
|
||||
|
||||
if ( (!exists( $opt{i} ) || !exists( $opt{r} )) ) {
|
||||
return(usage());
|
||||
}
|
||||
|
||||
}
|
||||
$opt{target} = \@{$request->{node}};
|
||||
my $ppctab = xCAT::Table->new( 'ppc');
|
||||
unless($ppctab) {
|
||||
@@ -483,6 +535,10 @@ sub mkvm_parse_args {
|
||||
if ( !$p) {
|
||||
return(usage("Not found the parent of $node"));
|
||||
}
|
||||
if (exists($opt{full}) and defined($other_p) and $other_p eq $p){
|
||||
return(usage("Only one full partition can be created in one CEC"));
|
||||
}
|
||||
|
||||
if(! defined( $other_p)) {
|
||||
$other_p = $p;
|
||||
}
|
||||
@@ -490,9 +546,10 @@ sub mkvm_parse_args {
|
||||
return(usage("For Power 775, please make sure the noderange are in one CEC "));
|
||||
}
|
||||
}
|
||||
$request->{node} = [$other_p];
|
||||
$request->{noderange} = $other_p;
|
||||
|
||||
if (exists($opt{p775})) {
|
||||
$request->{node} = [$other_p];
|
||||
$request->{noderange} = $other_p;
|
||||
}
|
||||
####################################
|
||||
# No operands - add command name
|
||||
####################################
|
||||
@@ -535,10 +592,14 @@ sub rmvm_parse_args {
|
||||
$Getopt::Long::ignorecase = 0;
|
||||
Getopt::Long::Configure( "bundling" );
|
||||
|
||||
if ( !GetOptions( \%opt, qw(V|verbose service r) )) {
|
||||
if ( !GetOptions( \%opt, qw(V|verbose service r p775) )) {
|
||||
return( usage() );
|
||||
}
|
||||
return(usage( "rmvm doesn't support for Power 775." ));
|
||||
|
||||
if (exists($opt{p775})) {
|
||||
return(usage( "rmvm doesn't support for Power 775." ));
|
||||
}
|
||||
|
||||
####################################
|
||||
# Check for "-" with no option
|
||||
####################################
|
||||
@@ -592,9 +653,12 @@ sub lsvm_parse_args {
|
||||
$Getopt::Long::ignorecase = 0;
|
||||
Getopt::Long::Configure( "bundling" );
|
||||
|
||||
if ( !GetOptions( \%opt, qw(V|verbose l|long) )) {
|
||||
if ( !GetOptions( \%opt, qw(V|verbose l|long p775) )) {
|
||||
return( usage() );
|
||||
}
|
||||
if (exists($opt{l}) && !exists($opt{p775})) {
|
||||
return(usage( "option 'l' only works for Power 775"));
|
||||
}
|
||||
####################################
|
||||
# Check for "-" with no option
|
||||
####################################
|
||||
@@ -622,8 +686,9 @@ sub modify {
|
||||
my $request = shift;
|
||||
my $hash = shift;
|
||||
my $usage_string = xCAT::Usage->getUsage($request->{command});
|
||||
return modify_by_prof( $request, $hash) if ( $request->{opt}->{p} || $request->{stdin});
|
||||
return create( $request, $hash) if ( $request->{opt}->{i});
|
||||
return modify_by_prof( $request, $hash) if ( exists($request->{opt}->{p775}) and ($request->{opt}->{p} || $request->{stdin}));
|
||||
return create( $request, $hash) if ( exists($request->{opt}->{p775}) and $request->{opt}->{i});
|
||||
return op_extra_cmds ($request, $hash) if (!exists($request->{opt}->{p775}));
|
||||
return op_extra_cmds ($request, $hash) if ($request->{opt}->{lparname} || $request->{opt}->{huge_page});
|
||||
return ([["Error", "Miss argument\n".$usage_string, 1]]);
|
||||
}
|
||||
@@ -631,26 +696,72 @@ sub do_op_extra_cmds {
|
||||
my $request = shift;
|
||||
my $hash = shift;
|
||||
my @values = ();
|
||||
my $action;
|
||||
my $param;
|
||||
if (exists($request->{opt}->{lparname})) {
|
||||
$action = "set_lpar_name";
|
||||
$param = $request->{opt}->{lparname};
|
||||
} elsif (exists($request->{opt}->{huge_page})) {
|
||||
$action = "set_huge_page";
|
||||
$param = $request->{opt}->{huge_page};
|
||||
}
|
||||
my $lparname_para = $request->{opt}->{lparname};
|
||||
|
||||
while (my ($mtms, $h) = each(%$hash)) {
|
||||
my $memhash;
|
||||
while (my($name, $d) = each(%$h)) {
|
||||
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);
|
||||
if (@$value[1] && ((@$value[1] =~ /Error/i) && (@$value[2] ne '0'))) {
|
||||
return ([[$name, @$value[1], '1']]) ;
|
||||
} else {
|
||||
push @values, [$name, "Success", '0'];
|
||||
}
|
||||
foreach my $op (keys %{$request->{opt}}) {
|
||||
my $action;
|
||||
my $param = $request->{opt}->{$op};
|
||||
if ($op eq "lparname") {
|
||||
$action = "set_lpar_name";
|
||||
} elsif ($op eq "huge_page") {
|
||||
$action = "set_huge_page";
|
||||
} elsif ($op eq "vmcpus") {
|
||||
$action = "part_set_lpar_pending_proc";
|
||||
} elsif ($op eq "vmphyslots") {
|
||||
$action = "set_io_slot_owner_uber";
|
||||
} elsif ($op eq "vmmemory") {
|
||||
my @td = @$d;
|
||||
@td[0] = 0;
|
||||
$memhash = &query_cec_info_actions($request, $name, \@td, 1, ["part_get_hyp_process_and_mem"]);
|
||||
if (!exists($memhash->{run})) {
|
||||
if ($param =~ /(\d+)([G|M]?)\/(\d+)([G|M]?)\/(\d+)([G|M]?)/i) {
|
||||
my $memsize = $memhash->{mem_region_size};
|
||||
my $min = $1;
|
||||
if ($2 == "G" or $2 == '') {
|
||||
$min = $min * 1024;
|
||||
}
|
||||
$min = $min/$memsize;
|
||||
my $cur = $3;
|
||||
if ($4 == "G" or $4 == '') {
|
||||
$cur = $cur * 1024;
|
||||
}
|
||||
$cur = $cur/$memsize;
|
||||
my $max = $5;
|
||||
if ($6 == "G" or $6 == '') {
|
||||
$max = $max * 1024;
|
||||
}
|
||||
$max = $max/$memsize;
|
||||
$request->{opt}->{$op} ="$min/$cur/$max";
|
||||
$param = $request->{opt}->{$op};
|
||||
} else {
|
||||
return([[$name, "The format of param:$param is incorrect.", 1]]);
|
||||
}
|
||||
$memhash->{run} = 1;
|
||||
}
|
||||
$memhash->{memory} = $param;
|
||||
$memhash->{lpar_used_regions} = 0;
|
||||
my $ret = &deal_with_avail_mem($request, $name, $d, $memhash);
|
||||
if (ref($ret) eq "ARRAY") {
|
||||
return ([[@$ret]]);
|
||||
}
|
||||
$param = $memhash->{memory};
|
||||
$action = "part_set_lpar_pending_mem";
|
||||
} elsif ($op eq "bsr") {
|
||||
$action = "set_lpar_bsr";
|
||||
} else {
|
||||
last;
|
||||
}
|
||||
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);
|
||||
if (@$value[1] && ((@$value[1] =~ /Error/i) && (@$value[2] ne '0'))) {
|
||||
return ([[$name, @$value[1], '1']]) ;
|
||||
} else {
|
||||
push @values, [$name, "Success", '0'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return \@values;
|
||||
@@ -1423,7 +1534,468 @@ sub xCATdB {
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
########################
|
||||
#***** partition related
|
||||
########################
|
||||
|
||||
#my @partition_query_actions = qw(part_get_partition_cap part_get_num_of_lpar_slots part_get_hyp_config_process_and_mem part_get_hyp_avail_process_and_mem part_get_service_authority_lpar_id part_get_shared_processing_resource part_get_all_vio_info lpar_lhea_mac part_get_all_io_bus_info part_get_lpar_processing part_get_lpar_memory get_huge_page get_cec_bsr);
|
||||
my @partition_query_actions = qw(part_get_partition_cap part_get_hyp_process_and_mem part_get_all_io_bus_info get_huge_page get_cec_bsr);
|
||||
|
||||
sub parse_part_get_info {
|
||||
my $hash = shift;
|
||||
my $data = shift;
|
||||
my @array = split /\n/, $data;
|
||||
foreach my $line (@array) {
|
||||
chomp($line);
|
||||
if ($line =~ /Num of lpar slots: (\d+)/i) {
|
||||
$hash->{num_of_lpars} = $1;
|
||||
} elsif ($line =~ /HYP Configurable Memory[^\(]*\((\d+)\s*regions\)/i) {
|
||||
$hash->{hyp_config_mem} = $1;
|
||||
} elsif ($line =~ /HYP Available Memory[^\(]*\((\d+)\s*regions\)/i) {
|
||||
$hash->{hyp_avail_mem} = $1;
|
||||
} elsif ($line =~ /HYP Memory Region Size[^\(]*\((\d+)\s*MB\)/i) {
|
||||
$hash->{mem_region_size} = $1;
|
||||
} elsif ($line =~ /HYP Configurable Processors: (\d+),\s*Avail Processors: (\d+)/i) {
|
||||
$hash->{process_units_config} = $1;
|
||||
$hash->{process_units_avail} = $2;
|
||||
} elsif ($line =~ /Authority Lpar id:(\w+)/i) {
|
||||
$hash->{service_lparid} = $1;
|
||||
} elsif ($line =~ /(\d+),(\d+),[^,]*,(\w+),\w*\(([\w| |-|_]*)\)/) {
|
||||
$hash->{bus}->{$3}->{cur_lparid} = $1;
|
||||
$hash->{bus}->{$3}->{bus_slot} = $2;
|
||||
$hash->{bus}->{$3}->{des} = $4;
|
||||
} elsif ($line =~ /Phy drc_index:(\w+), Port group: (\w+), Phy port id: (\w+)/) {
|
||||
$hash->{phy_drc_group_port}->{$1}->{$2}->{$3} = '1';
|
||||
} elsif ($line =~ /adapter_id=(\w+),lpar_id=([\d|-]+).*port_group=(\d+),phys_port_id=(\d+).*drc_index=(\w+),.*/) {
|
||||
if (($2 == -1) && ($4 == 255)) {
|
||||
$hash->{logic_drc_phydrc}->{$3}->{$5} = $1;
|
||||
#$hash->{logic_drc_phydrc}->{$5}->{$1} = [$2,$3,$4];
|
||||
}
|
||||
#} elsif ($line =~ /lpar 0:: Curr Memory::min: 1,cur: (\d+),max:/i) {
|
||||
} elsif ($line =~ /HYP Reserved Memory Regions:([-]?)(\d+), Min Required Regions:(\d+)/i) {
|
||||
if ($1 eq '-') {
|
||||
$hash->{lpar0_used_dec} = 1;
|
||||
}
|
||||
$hash->{lpar0_used_mem} = $2;
|
||||
$hash->{phy_min_mem_req} = $3;
|
||||
#print "===>lpar0_used_mem:$hash->{lpar0_used_mem}.\n";
|
||||
} elsif ($line =~ /Curr Memory Req:[^\(]*\((\d+)\s*regions\)/) {
|
||||
$hash->{lpar_used_regions} = $1;
|
||||
} elsif ($line =~ /Available huge page memory\(in pages\):\s*(\d+)/) {
|
||||
$hash->{huge_page_avail} = $1;
|
||||
} elsif ($line =~ /Available BSR array:\s*(\d+)/) {
|
||||
$hash->{cec_bsr_avail} = $1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub query_cec_info_actions {
|
||||
my $request = shift;
|
||||
my $name = shift;
|
||||
my $td = shift;
|
||||
my $usage = shift;
|
||||
my $action_array = shift;
|
||||
my $lparid = @$td[0];
|
||||
my $data;
|
||||
my @array = ();
|
||||
my %hash = ();
|
||||
if (!defined($action_array) or ref($action_array) ne "ARRAY") {
|
||||
$action_array = \@partition_query_actions;
|
||||
}
|
||||
|
||||
foreach my $action (@$action_array) {
|
||||
#$data .= "======> ret info for $action:\n";
|
||||
my $values = xCAT::FSPUtils::fsp_api_action($request, $name, $td, $action);
|
||||
chomp(@$values[1]);
|
||||
#if ($action eq "part_get_partition_cap" and (@$values[1] =~ /Error:/i or @$values[2] ne 0)) {
|
||||
if (@$values[1] =~ /Error:/i or @$values[2] ne 0) {
|
||||
return ([[@$values]]);
|
||||
}
|
||||
if (@$values[1] =~ /^$/) {
|
||||
next;
|
||||
}
|
||||
if ($usage eq 0) {
|
||||
if ($lparid) {
|
||||
if ($action eq "lpar_lhea_mac") {
|
||||
my @output = split /\n/,@$values[1];
|
||||
foreach my $line (@output) {
|
||||
if ($line =~ /adapter_id=\w+,lpar_id=$lparid,type=hea/) {
|
||||
#$data .= "$line\n";
|
||||
push @array, [$name, $line, 0];
|
||||
}
|
||||
}
|
||||
#$data .= "\n";
|
||||
next;
|
||||
}
|
||||
if ($action eq "part_get_all_io_bus_info") {
|
||||
my @output = split /\n/, @$values[1];
|
||||
foreach my $line (@output) {
|
||||
if ($line =~ /^$lparid,/) {
|
||||
#$data .= "$line\n";
|
||||
push @array, [$name, $line, 0];
|
||||
}
|
||||
}
|
||||
#$data .= "\n";
|
||||
next;
|
||||
}
|
||||
}
|
||||
#$data .= "@$values[1]\n\n";
|
||||
push @array, [$name, @$values[1], @$values[2]];
|
||||
} else {
|
||||
&parse_part_get_info(\%hash, @$values[1]);
|
||||
}
|
||||
}
|
||||
if ($usage eq 0) {
|
||||
#return $data;
|
||||
return \@array;
|
||||
} else {
|
||||
return \%hash;
|
||||
}
|
||||
}
|
||||
|
||||
#my @partition_query_actions = qw(part_get_partition_cap part_get_num_of_lpar_slots part_get_hyp_config_process_and_mem part_get_hyp_avail_process_and_mem part_get_service_authority_lpar_id part_get_shared_processing_resource part_get_all_vio_info lpar_lhea_mac part_get_all_io_bus_info part_get_lpar_processing part_get_lpar_memory get_huge_page get_cec_bsr);
|
||||
sub query_cec_info {
|
||||
my $request = shift;
|
||||
my $hash = shift;
|
||||
my $args = $request->{opt};
|
||||
my @td = ();
|
||||
my @result = ();
|
||||
while (my ($mtms,$h) = each(%$hash) ) {
|
||||
while (my ($name, $d) = each (%$h)) {
|
||||
@td = @$d;
|
||||
if (@$d[0] == 0 && @$d[4] ne "lpar") {
|
||||
last;
|
||||
}
|
||||
#my $rethash = query_cec_info_actions($request, $name, $d, 0, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_vio_info","lpar_lhea_mac","part_get_all_io_bus_info","get_huge_page","get_cec_bsr"]);
|
||||
my $rethash = query_cec_info_actions($request, $name, $d, 0, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_io_bus_info","get_huge_page","get_cec_bsr"]);
|
||||
#push @result, [$name, $rethash, 0];
|
||||
push @result, @$rethash;
|
||||
}
|
||||
if (@td[0] == 0) {
|
||||
my $rethash = query_cec_info_actions($request, @td[3],\@td, 0);
|
||||
#push @result, [@td[3], $rethash, 0];
|
||||
push @result, @$rethash;
|
||||
}
|
||||
}
|
||||
return \@result;
|
||||
}
|
||||
|
||||
########################
|
||||
#***** partition related
|
||||
########################
|
||||
|
||||
my @partition_config_actions = qw/part_set_lpar_def_state part_set_lpar_pending_proc part_set_lpar_pending_mem part_set_pending_max_vslots part_set_lpar_shared_pool_util_auth part_set_lpar_group_id part_set_lpar_avail_priority part_set_partition_placement part_set_lhea_assign_info part_set_phea_port_info part_set_lhea_port_info part_set_veth_slot_config part_set_vscsi_slot_config part_set_vfchan_slot_config part_clear_vslot_config set_huge_page set_lpar_name/;
|
||||
|
||||
sub set_lpar_undefined {
|
||||
my $request = shift;
|
||||
my $name = shift;
|
||||
my $attr = shift;
|
||||
my $values = xCAT::FSPUtils::fsp_api_action($request, $name, $attr, "part_set_lpar_def_state", 0, 0x0);
|
||||
if (!@$values[2]) {
|
||||
return ([$name,"Done",0]);
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
|
||||
sub clear_service_authority_lpar {
|
||||
my $request = shift;
|
||||
my $name = shift;
|
||||
my $attr = shift;
|
||||
my $values = xCAT::FSPUtils::fsp_api_action($request, $name, $attr, "part_get_service_authority_lpar_id");
|
||||
my @array = split /\n/, @$values[1];
|
||||
my $service_lparid = undef;
|
||||
foreach my $line (@array) {
|
||||
if ($line =~ /Authority Lpar id:([-|\d]+)./i) {
|
||||
$service_lparid = $1;
|
||||
}
|
||||
}
|
||||
if (defined($service_lparid) and $service_lparid == @$attr[0]) {
|
||||
xCAT::FSPUtils::fsp_api_action($request, $name, $attr, "part_set_service_authority_lpar_id");
|
||||
}
|
||||
}
|
||||
|
||||
sub remove {
|
||||
my $request = shift;
|
||||
my $hash = shift;
|
||||
my @result = ();
|
||||
while (my ($mtms, $h) = each (%$hash)) {
|
||||
while (my ($name, $d) = each (%$h)) {
|
||||
if (@$d[4] ne "lpar") {
|
||||
push @result, [$name, "Node must be LPAR", 1];
|
||||
last;
|
||||
}
|
||||
&clear_service_authority_lpar($request, $name, $d);
|
||||
my $values = &set_lpar_undefined($request, $name, $d);
|
||||
push @result, $values;
|
||||
}
|
||||
}
|
||||
return \@result;
|
||||
}
|
||||
|
||||
sub deal_with_avail_mem {
|
||||
my $request = shift;
|
||||
my $name = shift;
|
||||
my $d = shift;
|
||||
my $lparhash = shift;
|
||||
my $max_required_regions;
|
||||
if ($lparhash->{memory} =~ /(\d+)\/(\d+)\/(\d+)/) {
|
||||
my ($min,$cur,$max);
|
||||
my $used_regions = 0;
|
||||
my $cur_avail = 0;
|
||||
$min = $1;
|
||||
$cur = $2;
|
||||
$max = $3;
|
||||
my %tmphash;
|
||||
my $values;
|
||||
if (exists($lparhash->{lpar_used_regions})) {
|
||||
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_get_lpar_memory");
|
||||
&parse_part_get_info(\%tmphash, @$values[1]);
|
||||
if (exists($tmphash{lpar_used_regions})) {
|
||||
$used_regions = $tmphash{lpar_used_regions};
|
||||
}
|
||||
}
|
||||
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_get_hyp_res_mem_regions", 0, $3);
|
||||
&parse_part_get_info(\%tmphash, @$values[1]);
|
||||
if (exists($tmphash{lpar0_used_mem}) && exists($tmphash{phy_min_mem_req})) {
|
||||
if ($min < $tmphash{phy_min_mem_req}) {
|
||||
$min = $tmphash{phy_min_mem_req};
|
||||
}
|
||||
|
||||
if (exists($lparhash->{lpar0_used_dec})) {
|
||||
$cur_avail = $lparhash->{hyp_avail_mem} + $used_regions + $tmphash{lpar0_used_mem};
|
||||
} else {
|
||||
$cur_avail = $lparhash->{hyp_avail_mem} + $used_regions - $tmphash{lpar0_used_mem};
|
||||
}
|
||||
xCAT::MsgUtils->verbose_message($request, "====****====used:$used_regions,avail:$cur_avail,($min:$cur:$max).");
|
||||
if ($cur_avail < $min) {
|
||||
return([$name, "Parse reserverd regions failed, no enough memory, available:$lparhash->{hyp_avail_mem}.", 1]);
|
||||
}
|
||||
if ($cur > $cur_avail) {
|
||||
my $new_cur = $cur_avail;
|
||||
$lparhash->{memory} = "$min/$new_cur/$max";
|
||||
}
|
||||
} else {
|
||||
return ([$name, "Failed to get hypervisor reserved memory regions.", 1]);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub create_lpar {
|
||||
my $request = shift;
|
||||
my $name = shift;
|
||||
my $d = shift;
|
||||
my $lparhash = shift;
|
||||
my $values;
|
||||
if (exists($request->{opt}->{vios})) {
|
||||
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_def_state", 0, 0x03);
|
||||
} else {
|
||||
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_def_state", 0, 0x01);
|
||||
}
|
||||
if (@$values[2] ne 0) {
|
||||
return ([[$name, @$values[1], @$values[0]]]);
|
||||
}
|
||||
$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]]);
|
||||
}
|
||||
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");
|
||||
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_avail_priority");
|
||||
#print "======>physlots:$lparhash->{physlots}.\n";
|
||||
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_io_slot_owner_uber", 0, $lparhash->{physlots});
|
||||
#$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]]);
|
||||
}
|
||||
if (exists($lparhash->{phy_hea})) {
|
||||
my $phy_hash = $lparhash->{phy_hea};
|
||||
foreach my $phy_drc (keys %$phy_hash) {
|
||||
#print "======> set_lhea_assign_info: drc_index:$phy_drc.\n";
|
||||
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lhea_assign_info", 0, $phy_drc);
|
||||
my $group_hash = $phy_hash->{$phy_drc};
|
||||
foreach my $group_id (keys %$group_hash) {
|
||||
my @lhea_drc = (keys %{$lparhash->{logic_drc_phydrc}->{$group_id}});
|
||||
foreach my $phy_port_id (keys %{$group_hash->{$group_id}}) {
|
||||
my $tmp_param = "$phy_drc,$group_id,$phy_port_id";
|
||||
#print "======> set_phea_port_info: $tmp_param.\n";
|
||||
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_phea_port_info", 0, $tmp_param);
|
||||
my $tmp_lhea_param = $lhea_drc[$phy_port_id].",$phy_port_id";
|
||||
#print "======> set_lhea_port_info: $tmp_lhea_param.\n";
|
||||
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lhea_port_info", 0, $tmp_lhea_param);
|
||||
}
|
||||
delete ($lparhash->{logic_drc_phydrc}->{$group_id}->{$lhea_drc[0]});
|
||||
delete ($lparhash->{logic_drc_phydrc}->{$group_id}->{$lhea_drc[1]});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#print "======>cpus:$lparhash->{cpus}.\n";
|
||||
$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]]);
|
||||
}
|
||||
$values = &deal_with_avail_mem($request, $name, $d,$lparhash);
|
||||
if (ref($values) eq "ARRAY") {
|
||||
&set_lpar_undefined($request, $name, $d);
|
||||
return ([@$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]]);
|
||||
}
|
||||
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_comp_modes");
|
||||
#print "======>memory:$lparhash->{huge_page}.\n";
|
||||
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_huge_page", 0, $lparhash->{huge_page});
|
||||
#print "======>bsr:$lparhash->{bsr_num}.\n";
|
||||
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_lpar_bsr", 0, $lparhash->{bsr_num});
|
||||
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_partition_placement");
|
||||
if (exists($request->{opt}->{vios})) {
|
||||
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_def_state", 0, 0x04);
|
||||
} else {
|
||||
$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, "Done", 0]);
|
||||
}
|
||||
|
||||
sub mkspeclpar {
|
||||
my $request = shift;
|
||||
my $hash = shift;
|
||||
my $opt = $request->{opt};
|
||||
my $values;
|
||||
my @result = ();
|
||||
my $vmtab = xCAT::Table->new( 'vm');
|
||||
unless($vmtab) {
|
||||
return([["Error","Cannot open vm table", 1]]);
|
||||
}
|
||||
while (my ($mtms, $h) = each (%$hash)) {
|
||||
my $memhash;
|
||||
my @nodes = keys(%$h);
|
||||
my $ent = $vmtab->getNodesAttribs(\@nodes, ['cpus', 'memory','physlots', 'othersettings']);
|
||||
while (my ($name, $d) = each (%$h)) {
|
||||
if (@$d[4] ne 'lpar') {
|
||||
push @result, [$name, "Node must be LPAR", 1];
|
||||
last;
|
||||
}
|
||||
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"]);
|
||||
$memhash->{run} = 1;
|
||||
}
|
||||
my $tmp_ent = $ent->{$name}->[0];
|
||||
if (exists($opt->{vmcpus})) {
|
||||
$tmp_ent->{cpus} = $opt->{vmcpus};
|
||||
}
|
||||
if (exists($opt->{vmmemory})) {
|
||||
$tmp_ent->{memory} = $opt->{vmmemory};
|
||||
}
|
||||
if (exists($opt->{vmphyslots})) {
|
||||
$tmp_ent->{physlots} = $opt->{vmphyslots};
|
||||
}
|
||||
if (exists($opt->{vmothersetting})) {
|
||||
$tmp_ent->{othersettings} = $opt->{vmothersetting};
|
||||
}
|
||||
if (!defined($tmp_ent) ) {
|
||||
return ([[$name, "Not find params", 1]]);
|
||||
} elsif (!exists($tmp_ent->{cpus}) || !exists($tmp_ent->{memory}) || !exists($tmp_ent->{physlots})) {
|
||||
return ([[$name, "The attribute 'vmcpus', 'vmmemory' and 'vmphyslots' are all needed to be specified.", 1]]);
|
||||
}
|
||||
if ($tmp_ent->{memory} =~ /(\d+)([G|M]?)\/(\d+)([G|M]?)\/(\d+)([G|M]?)/i) {
|
||||
my $memsize = $memhash->{mem_region_size};
|
||||
my $min = $1;
|
||||
if ($2 == "G" or $2 == '') {
|
||||
$min = $min * 1024;
|
||||
}
|
||||
$min = $min/$memsize;
|
||||
my $cur = $3;
|
||||
if ($4 == "G" or $4 == '') {
|
||||
$cur = $cur * 1024;
|
||||
}
|
||||
$cur = $cur/$memsize;
|
||||
my $max = $5;
|
||||
if ($6 == "G" or $6 == '') {
|
||||
$max = $max * 1024;
|
||||
}
|
||||
$max = $max/$memsize;
|
||||
$tmp_ent->{memory} = "$min/$cur/$max";
|
||||
}
|
||||
$tmp_ent->{hyp_config_mem} = $memhash->{hyp_config_mem};
|
||||
$tmp_ent->{hyp_avail_mem} = $memhash->{hyp_avail_mem};
|
||||
$tmp_ent->{huge_page} = "0/0/0";
|
||||
$tmp_ent->{bsr_num} = "0";
|
||||
if (exists($tmp_ent->{othersettings})) {
|
||||
my $setting = $tmp_ent->{othersettings};
|
||||
if ($setting =~ /hugepage:(\d+)/) {
|
||||
my $tmp = $1;
|
||||
$tmp_ent->{huge_page} = "1/".$tmp."/".$tmp;
|
||||
}
|
||||
if ($setting =~ /bsr:(\d+)/) {
|
||||
$tmp_ent->{bsr_num} = $1;
|
||||
}
|
||||
}
|
||||
$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;
|
||||
$name = undef;
|
||||
$d = undef;
|
||||
}
|
||||
}
|
||||
return \@result;
|
||||
}
|
||||
|
||||
sub mkfulllpar {
|
||||
my $request = shift;
|
||||
my $hash = shift;
|
||||
my $values;
|
||||
my @result = ();
|
||||
while (my ($mtms, $h) = each (%$hash)) {
|
||||
my $rethash;
|
||||
while (my ($name, $d) = each (%$h)) {
|
||||
if (@$d[4] ne 'lpar') {
|
||||
push @result, [$name, "Node must be LPAR", 1];
|
||||
last;
|
||||
}
|
||||
if (!exists($rethash->{run})) {
|
||||
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]]);
|
||||
}
|
||||
$rethash->{run} = 1;
|
||||
#print Dumper($rethash);
|
||||
}
|
||||
my %lpar_param = ();
|
||||
$lpar_param{cpus} = "1/".$rethash->{process_units_avail}."/".$rethash->{process_units_config};
|
||||
$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};
|
||||
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};
|
||||
$values = &create_lpar($request, $name, $d, \%lpar_param);
|
||||
$rethash->{logic_drc_phydrc} = $lpar_param{logic_drc_phydrc};
|
||||
push @result, $values;
|
||||
$name = undef;
|
||||
$d = undef;
|
||||
}
|
||||
}
|
||||
return \@result;
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
# Creates logical partitions
|
||||
@@ -1435,13 +2007,14 @@ sub mkvm {
|
||||
# decide if issuing mkvm with the option '-f'.
|
||||
# if yes, mklpar will be invoked to
|
||||
# create a full system partition for each CECs managed by the HMC.
|
||||
if ( exists($opt->{full})) {
|
||||
return( mkfulllpar(@_) );
|
||||
}
|
||||
else {
|
||||
# if no, it will execute the original function.
|
||||
return( create(@_) );
|
||||
}
|
||||
if (exists($opt->{p775})) {
|
||||
return (create(@_));
|
||||
}
|
||||
if (exists($opt->{full})) {
|
||||
return (mkfulllpar(@_));
|
||||
} else {
|
||||
return (mkspeclpar(@_));
|
||||
}
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
@@ -1455,15 +2028,29 @@ sub chvm {
|
||||
##########################################################################
|
||||
# No rmvm for Power 775
|
||||
##########################################################################
|
||||
#sub rmvm {
|
||||
sub rmvm {
|
||||
my $request = $_[0];
|
||||
my $opt = $request->{opt};
|
||||
if (exists($opt->{p775})) {
|
||||
return ([["lpar","rmvm only support Power Partitioning.", 1]]);
|
||||
} else {
|
||||
return( remove(@_) );
|
||||
}
|
||||
# return( remove(@_) );
|
||||
#}
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
# Lists logical partition profile
|
||||
##########################################################################
|
||||
sub lsvm {
|
||||
return( list(@_) );
|
||||
my $request = shift;
|
||||
my $hash = shift;
|
||||
my $args = $request->{opt};
|
||||
if (exists($args->{p775})) {
|
||||
return( list($request, $hash) );
|
||||
} else {
|
||||
return (query_cec_info($request, $hash));
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
@@ -37,6 +37,7 @@ $::NODETYPE_MP="mp";
|
||||
$::STATUS_SYNCING="syncing";
|
||||
$::STATUS_OUT_OF_SYNC="out-of-sync";
|
||||
$::STATUS_SYNCED="synced";
|
||||
$::STATUS_FAILED="failed";
|
||||
|
||||
|
||||
# valid values for nodelist.status columns or other status
|
||||
|
||||
@@ -1132,7 +1132,11 @@ sub dolitesetup
|
||||
# $file could be full path file name or dir name
|
||||
# ex. /foo/bar/ or /etc/lppcfg
|
||||
my ($node, $option, $file) = split (/\|/, $line);
|
||||
|
||||
|
||||
if (!$file) {
|
||||
next;
|
||||
}
|
||||
|
||||
# ex. .../inst_root/foo/bar/ or .../inst_root/etc/lppcfg
|
||||
my $instrootfile = $instrootloc . $file;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ if ($^O =~ /^aix/i) {
|
||||
}
|
||||
|
||||
use strict;
|
||||
use Sys::Syslog qw (:DEFAULT setlogsock);
|
||||
use Sys::Syslog;
|
||||
use xCAT::Utils;
|
||||
#use locale;
|
||||
use Socket;
|
||||
@@ -456,8 +456,7 @@ sub message
|
||||
|
||||
# If they want this msg to also go to syslog, do that now
|
||||
eval {
|
||||
openlog("xCAT", '', 'local4');
|
||||
setlogsock(["tcp", "unix", "stream"]);
|
||||
openlog("xCAT", "nofatal,pid", "local4");
|
||||
if ($sev eq 'SE') {
|
||||
syslog("err", $rsp);
|
||||
} else {
|
||||
@@ -503,8 +502,7 @@ sub message
|
||||
{
|
||||
print $stdouterrf "Unable to open auditlog\n";
|
||||
eval {
|
||||
openlog("xCAT", '', 'local4');
|
||||
setlogsock(["tcp", "unix", "stream"]);
|
||||
openlog("xCAT", "nofatal,pid", "local4");
|
||||
syslog("err", "Unable to write to auditlog");
|
||||
closelog();
|
||||
};
|
||||
@@ -521,8 +519,7 @@ sub message
|
||||
{ # error
|
||||
print $stdouterrf "Unable to open auditlog\n";
|
||||
eval {
|
||||
openlog("xCAT", '', 'local4');
|
||||
setlogsock(["tcp", "unix", "stream"]);
|
||||
openlog("xCAT", "nofatal,pid", "local4");
|
||||
syslog("err", "Unable to open auditlog");
|
||||
closelog();
|
||||
};
|
||||
|
||||
@@ -1,271 +0,0 @@
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
package xCAT::NameRange;
|
||||
require xCAT::Table;
|
||||
require Exporter;
|
||||
use strict;
|
||||
|
||||
#Perl implementation of namerange
|
||||
# NOTE: This is identical to xCAT::NodeRange except that no
|
||||
# database access occurs, no nodes are verified, and
|
||||
# no nodegroups are expanded.
|
||||
# Made a new utility since NodeRange is used EVERYWHERE in
|
||||
# xCAT code and did not want to risk de-stabilizing existing code.
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(namerange);
|
||||
|
||||
my $recurselevel=0;
|
||||
|
||||
|
||||
sub subnodes (\@@) {
|
||||
#Subtract set of nodes from the first list
|
||||
my $nodes = shift;
|
||||
my $node;
|
||||
foreach $node (@_) {
|
||||
@$nodes = (grep(!/^$node$/,@$nodes));
|
||||
}
|
||||
}
|
||||
|
||||
sub expandatom {
|
||||
my $atom = shift;
|
||||
my @nodes= ();
|
||||
if ($atom =~ /^\(.*\)$/) { # handle parentheses by recursively calling namerange()
|
||||
$atom =~ s/^\((.*)\)$/$1/;
|
||||
$recurselevel++;
|
||||
return namerange($atom);
|
||||
}
|
||||
if ($atom =~ /@/) {
|
||||
$recurselevel++;
|
||||
return namerange($atom);
|
||||
}
|
||||
|
||||
if ($atom =~ m/^\//) { # A regular expression - not supported in namerange
|
||||
return ($atom);
|
||||
}
|
||||
|
||||
if ($atom =~ m/(.*)\[(.*)\](.*)/) { # square bracket range
|
||||
#for the time being, we are only going to consider one [] per atom
|
||||
#xcat 1.2 does no better
|
||||
my @subelems = split(/([\,\-\:])/,$2);
|
||||
my $subrange="";
|
||||
while (my $subelem = shift @subelems) {
|
||||
my $subop=shift @subelems;
|
||||
$subrange=$subrange."$1$subelem$3$subop";
|
||||
}
|
||||
foreach (split /,/,$subrange) {
|
||||
my @newnodes=expandatom($_);
|
||||
@nodes=(@nodes,@newnodes);
|
||||
}
|
||||
return @nodes;
|
||||
}
|
||||
|
||||
if ($atom =~ m/\+/) { # process the + operator
|
||||
$atom =~ m/^([^0-9]*)([0-9]+)([^\+]*)\+([0-9]+)/;
|
||||
my $pref=$1;
|
||||
my $startnum=$2;
|
||||
my $suf=$3;
|
||||
my $end=$4+$startnum;
|
||||
my $endnum = sprintf("%d",$end);
|
||||
if (length ($startnum) > length ($endnum)) {
|
||||
$endnum = sprintf("%0".length($startnum)."d",$end);
|
||||
}
|
||||
foreach ("$startnum".."$endnum") {
|
||||
my @addnodes=expandatom($pref.$_.$suf);
|
||||
@nodes=(@nodes,@addnodes);
|
||||
}
|
||||
return (@nodes);
|
||||
}
|
||||
|
||||
if ($atom =~ m/[-:]/) { # process the minus range operator
|
||||
my $left;
|
||||
my $right;
|
||||
if ($atom =~ m/:/) {
|
||||
($left,$right)=split /:/,$atom;
|
||||
} else {
|
||||
my $count= ($atom =~ tr/-//);
|
||||
if (($count % 2)==0) { #can't understand even numbers of - in range context
|
||||
# we might not really be in range context
|
||||
return ($atom);
|
||||
}
|
||||
my $expr="([^-]+?".("-[^-]*"x($count/2)).")-(.*)";
|
||||
$atom =~ m/$expr/;
|
||||
$left=$1;
|
||||
$right=$2;
|
||||
}
|
||||
if ($left eq $right) { #if they said node1-node1 for some strange reason
|
||||
return expandatom($left);
|
||||
}
|
||||
my @leftarr=split(/(\d+)/,$left);
|
||||
my @rightarr=split(/(\d+)/,$right);
|
||||
if (scalar(@leftarr) != scalar(@rightarr)) { #Mismatch formatting..
|
||||
# guess it's meant to be a nodename
|
||||
return ($atom);
|
||||
}
|
||||
my $prefix = "";
|
||||
my $suffix = "";
|
||||
foreach (0..$#leftarr) {
|
||||
my $idx = $_;
|
||||
if ($leftarr[$idx] =~ /^\d+$/ and $rightarr[$idx] =~ /^\d+$/) { #pure numeric component
|
||||
if ($leftarr[$idx] ne $rightarr[$idx]) { #We have found the iterator (only supporting one for now)
|
||||
my $prefix = join('',@leftarr[0..($idx-1)]); #Make a prefix of the pre-validated parts
|
||||
my $luffix; #However, the remainder must still be validated to be the same
|
||||
my $ruffix;
|
||||
if ($idx eq $#leftarr) {
|
||||
$luffix="";
|
||||
$ruffix="";
|
||||
} else {
|
||||
$ruffix = join('',@rightarr[($idx+1)..$#rightarr]);
|
||||
$luffix = join('',@leftarr[($idx+1)..$#leftarr]);
|
||||
}
|
||||
if ($luffix ne $ruffix) { #the suffixes mismatched..
|
||||
return ($atom);
|
||||
}
|
||||
foreach ($leftarr[$idx]..$rightarr[$idx]) {
|
||||
my @addnodes=expandatom($prefix.$_.$luffix);
|
||||
@nodes=(@nodes,@addnodes);
|
||||
}
|
||||
return (@nodes); #the return has been built, return, exiting loop and all
|
||||
}
|
||||
} elsif ($leftarr[$idx] ne $rightarr[$idx]) {
|
||||
return ($atom);
|
||||
}
|
||||
$prefix .= $leftarr[$idx]; #If here, it means that the pieces were the same, but more to come
|
||||
}
|
||||
#I cannot conceive how the code could possibly be here, but whatever it is, it must be questionable
|
||||
return ($atom);
|
||||
}
|
||||
|
||||
return ($atom);
|
||||
}
|
||||
|
||||
sub namerange {
|
||||
#We for now just do left to right operations
|
||||
my $range=shift;
|
||||
my %nodes = ();
|
||||
my %delnodes = ();
|
||||
my $op = ",";
|
||||
my @elems = split(/(,(?![^[]*?])(?![^\(]*?\)))/,$range); # commas outside of [] or ()
|
||||
if (scalar(@elems)==1) {
|
||||
@elems = split(/(@(?![^\(]*?\)))/,$range); # only split on @ when no , are present (inner recursion)
|
||||
}
|
||||
|
||||
while (my $atom = shift @elems) {
|
||||
if ($atom =~ /^-/) { # if this is an exclusion, strip off the minus, but remember it
|
||||
$atom = substr($atom,1);
|
||||
$op = $op."-";
|
||||
}
|
||||
|
||||
if ($atom =~ /^\^(.*)$/) { # get a list of nodes from a file
|
||||
open(NRF,$1);
|
||||
while (<NRF>) {
|
||||
my $line=$_;
|
||||
unless ($line =~ m/^[\^#]/) {
|
||||
$line =~ m/^([^: ]*)/;
|
||||
my $newrange = $1;
|
||||
chomp($newrange);
|
||||
$recurselevel++;
|
||||
my @filenodes = namerange($newrange);
|
||||
foreach (@filenodes) {
|
||||
$nodes{$_}=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
close(NRF);
|
||||
next;
|
||||
}
|
||||
|
||||
my %newset = map { $_ =>1 } expandatom($atom); # expand the atom and make each entry in the resulting array a key in newset
|
||||
|
||||
if ($op =~ /@/) { # compute the intersection of the current atom and the node list we have received before this
|
||||
foreach (keys %nodes) {
|
||||
unless ($newset{$_}) {
|
||||
delete $nodes{$_};
|
||||
}
|
||||
}
|
||||
} elsif ($op =~ /,-/) { # add the nodes from this atom to the exclude list
|
||||
foreach (keys %newset) {
|
||||
$delnodes{$_}=1; #delay removal to end
|
||||
}
|
||||
} else { # add the nodes from this atom to the total node list
|
||||
foreach (keys %newset) {
|
||||
$nodes{$_}=1;
|
||||
}
|
||||
}
|
||||
$op = shift @elems;
|
||||
|
||||
} # end of main while loop
|
||||
|
||||
# Now remove all the exclusion nodes
|
||||
foreach (keys %nodes) {
|
||||
if ($delnodes{$_}) {
|
||||
delete $nodes{$_};
|
||||
}
|
||||
}
|
||||
if ($recurselevel) {
|
||||
$recurselevel--;
|
||||
}
|
||||
return sort (keys %nodes);
|
||||
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
xCAT::NameRange - Perl module for xCAT namerange expansion
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use xCAT::NameRange;
|
||||
my @nodes=namerange("storage@rack1,node[1-200],^/tmp/nodelist,node300-node400,node401+10,500-550");
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
namerange interprets xCAT noderange formatted strings and returns a list of
|
||||
names. The following two operations are supported on elements, and interpreted
|
||||
left to right:
|
||||
|
||||
, union next element with everything to the left.
|
||||
|
||||
@ take intersection of element to the right with everything on the left
|
||||
(i.e. mask out anything to the left not belonging to what is described to
|
||||
the right)
|
||||
|
||||
Each element can be a number of things:
|
||||
|
||||
A node name, i.e.:
|
||||
|
||||
=item * node1
|
||||
|
||||
A hyphenated node range (only one group of numbers may differ between the left and right hand side, and those numbers will increment in a base 10 fashion):
|
||||
|
||||
node1-node200 node1-compute-node200-compute
|
||||
node1:node200 node1-compute:node200-compute
|
||||
|
||||
A namerange denoted by brackets:
|
||||
|
||||
node[1-200] node[001-200]
|
||||
|
||||
A regular expression describing the namerange:
|
||||
|
||||
/d(1.?.?|200)
|
||||
|
||||
A node plus offset (this increments the first number found in nodename):
|
||||
|
||||
node1+199
|
||||
|
||||
And most of the above substituting groupnames.
|
||||
3C
|
||||
3C
|
||||
|
||||
NameRange tries to be intelligent about detecting padding, so you can:
|
||||
node001-node200
|
||||
And it will increment according to the pattern.
|
||||
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2007 IBM Corp. All rights reserved.
|
||||
|
||||
|
||||
=cut
|
||||
@@ -422,11 +422,6 @@ sub ishostinsubnet {
|
||||
if ($ip =~ /:/) {#ipv6
|
||||
$numbits=128;
|
||||
}
|
||||
# IPv6 subnet with netmask postfix like /64
|
||||
if ($subnet && ($subnet =~ /\//))
|
||||
{
|
||||
$subnet =~ s/\/.*$//;
|
||||
}
|
||||
if ($mask) {
|
||||
if ($mask =~ /\//) {
|
||||
$mask =~ s/^\///;
|
||||
@@ -442,6 +437,10 @@ sub ishostinsubnet {
|
||||
die "ishostinsubnet must either be called with a netmask or CIDR /bits notation";
|
||||
}
|
||||
}
|
||||
if ($subnet && ($subnet =~ /\//)) #remove CIDR suffix from subnet
|
||||
{
|
||||
$subnet =~ s/\/.*$//;
|
||||
}
|
||||
$ip = getipaddr($ip,GetNumber=>1);
|
||||
$subnet = getipaddr($subnet,GetNumber=>1);
|
||||
$ip &= $mask;
|
||||
@@ -2255,6 +2254,26 @@ sub int_to_ip
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 getBroadcast
|
||||
Description : Get the broadcast ips
|
||||
Arguments : ipstr - the IPv4 string ip.
|
||||
netmask - the subnet mask of network
|
||||
Returns : bcipint - the IPv4 string of broadcast ip.
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub getBroadcast
|
||||
{
|
||||
my ($class, $ipstr, $netmask) = @_;
|
||||
my $ipint = xCAT::NetworkUtils->ip_to_int($ipstr);
|
||||
my $maskint = xCAT::NetworkUtils->ip_to_int($netmask);
|
||||
my $tmp = sprintf("%d", ~$maskint);
|
||||
my $bcnum = sprintf("%d", ($ipint | $tmp) & hex('0x00000000FFFFFFFF'));
|
||||
return xCAT::NetworkUtils->int_to_ip($bcnum);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 get_allips_in_range
|
||||
Description : Get all IPs in a IP range, return in a list.
|
||||
Arguments : $startip - start IP address
|
||||
|
||||
+98
-32
@@ -1,5 +1,6 @@
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
package xCAT::NodeRange;
|
||||
use Text::Balanced qw/extract_bracketed/;
|
||||
require xCAT::Table;
|
||||
require Exporter;
|
||||
use strict;
|
||||
@@ -180,7 +181,14 @@ sub nodesbycriteria {
|
||||
return \%critnodes;
|
||||
}
|
||||
|
||||
sub expandatom { #TODO: implement table selection as an atom (nodetype.os==rhels5.3)
|
||||
# Expand one part of the noderange from the noderange() function. Initially, one part means the
|
||||
# substring between commas in the noderange. But expandatom also calls itself recursively to
|
||||
# further expand some parts.
|
||||
# Input args:
|
||||
# - atom to expand
|
||||
# - verify: whether or not to require that the resulting nodenames exist in the nodelist table
|
||||
# - options: genericrange - a purely syntactical expansion of the range, not using the db at all, e.g not expanding group names
|
||||
sub expandatom {
|
||||
my $atom = shift;
|
||||
if ($recurselevel > 4096) { die "NodeRange seems to be hung on evaluating $atom, recursion limit hit"; }
|
||||
unless (scalar(@allnodeset) and (($allnodesetstamp+5) > time())) { #Build a cache of all nodes, some corner cases will perform worse, but by and large it will do better. We could do tests to see where the breaking points are, and predict how many atoms we have to evaluate to mitigate, for now, implement the strategy that keeps performance from going completely off the rails
|
||||
@@ -189,25 +197,28 @@ sub expandatom { #TODO: implement table selection as an atom (nodetype.os==rhels
|
||||
@allnodeset = $nodelist->getAllAttribs('node','groups');
|
||||
%allnodehash = map { $_->{node} => 1 } @allnodeset;
|
||||
}
|
||||
my $verify = (scalar(@_) == 1 ? shift : 1);
|
||||
my $verify = (scalar(@_) >= 1 ? shift : 1);
|
||||
my %options = @_; # additional options
|
||||
my @nodes= ();
|
||||
#TODO: these env vars need to get passed by the client to xcatd
|
||||
my $nprefix=(defined ($ENV{'XCAT_NODE_PREFIX'}) ? $ENV{'XCAT_NODE_PREFIX'} : 'node');
|
||||
my $nsuffix=(defined ($ENV{'XCAT_NODE_SUFFIX'}) ? $ENV{'XCAT_NODE_SUFFIX'} : '');
|
||||
if ($allnodehash{$atom}) { #The atom is a plain old nodename
|
||||
|
||||
if (not $options{genericrange} and $allnodehash{$atom}) { #The atom is a plain old nodename
|
||||
return ($atom);
|
||||
}
|
||||
if ($atom =~ /^\(.*\)$/) { # handle parentheses by recursively calling noderange()
|
||||
$atom =~ s/^\((.*)\)$/$1/;
|
||||
$recurselevel++;
|
||||
return noderange($atom);
|
||||
return noderange($atom,$verify,1,%options);
|
||||
}
|
||||
if ($atom =~ /@/) {
|
||||
$recurselevel++;
|
||||
return noderange($atom);
|
||||
return noderange($atom,$verify,1,%options);
|
||||
}
|
||||
|
||||
# Try to match groups?
|
||||
unless ($options{genericrange}) {
|
||||
unless ($grptab) {
|
||||
$grptab = xCAT::Table->new('nodegroup');
|
||||
}
|
||||
@@ -269,7 +280,9 @@ sub expandatom { #TODO: implement table selection as an atom (nodetype.os==rhels
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# node selection based on db attribute values (nodetype.os==rhels5.3)
|
||||
if ($atom =~ m/[=~]/) { #TODO: this is the clunky, slow code path to acheive the goal. It also is the easiest to write, strange coincidence. Aggregating multiples would be nice
|
||||
my @nodes;
|
||||
foreach (@allnodeset) {
|
||||
@@ -287,7 +300,7 @@ sub expandatom { #TODO: implement table selection as an atom (nodetype.os==rhels
|
||||
}
|
||||
if ($atom =~ m/^[0-9]+\z/) { # if only numbers, then add the prefix
|
||||
my $nodename=$nprefix.$atom.$nsuffix;
|
||||
return expandatom($nodename,$verify);
|
||||
return expandatom($nodename,$verify,%options);
|
||||
}
|
||||
my $nodelen=@nodes;
|
||||
if ($nodelen > 0) {
|
||||
@@ -295,7 +308,7 @@ sub expandatom { #TODO: implement table selection as an atom (nodetype.os==rhels
|
||||
}
|
||||
|
||||
if ($atom =~ m/^\//) { # A regular expression
|
||||
unless ($verify) { # If not in verify mode, regex makes zero possible sense
|
||||
if ($verify==0 or $options{genericrange}) { # If not in verify mode, regex makes zero possible sense
|
||||
return ($atom);
|
||||
}
|
||||
#TODO: check against all groups
|
||||
@@ -309,25 +322,29 @@ sub expandatom { #TODO: implement table selection as an atom (nodetype.os==rhels
|
||||
}
|
||||
|
||||
if ($atom =~ m/(.+?)\[(.+?)\](.*)/) { # square bracket range
|
||||
# if there are more than 1 [], we picked off just the 1st. if there is another, we will process it later
|
||||
my @subelems = split(/([\,\-\:])/,$2);
|
||||
# if there is more than 1 set of [], we picked off just the 1st. If there more sets of [], we will expand
|
||||
# the 1st set and create a new set of atom by concatenating each result in the 1st expandsion with the rest
|
||||
# of the brackets. Then call expandatom() recursively on each new atom.
|
||||
my @subelems = split(/([\,\-\:])/,$2); # $2 is the range inside the 1st set of brackets
|
||||
my $subrange="";
|
||||
my $subelem;
|
||||
my $start = $1;
|
||||
my $ending = $3;
|
||||
my $morebrackets = $ending =~ /\[.+?\]/; # if there are more brackets, we have to expand just the 1st part, then add the 2nd part later
|
||||
while (scalar @subelems) {
|
||||
my $subelem = shift @subelems;
|
||||
my $subelem;
|
||||
my $start = $1; # the text before the 1st set of brackets
|
||||
my $ending = $3; # the text after the 1st set of brackets (could contain more brackets)
|
||||
my $morebrackets = $ending =~ /\[.+?\]/; # if there are more brackets, we have to expand just the 1st part, then add the 2nd part later
|
||||
while (scalar @subelems) { # this while loop turns something like a[1-3] into a1-a3 because another section of expand atom knows how to expand that
|
||||
my $subelem = shift @subelems;
|
||||
my $subop=shift @subelems;
|
||||
$subrange=$subrange."$start$subelem" . ($morebrackets?'':$ending) . "$subop";
|
||||
}
|
||||
foreach (split /,/,$subrange) {
|
||||
my @newnodes=expandatom($_, ($morebrackets?0:$verify));
|
||||
foreach (split /,/,$subrange) { # this foreach is in case there were commas inside the brackets originally, e.g.: a[1,3,5]b[1-2]
|
||||
# this expandatom just expands the part of the noderange that contains the 1st set of brackets
|
||||
# e.g. if noderange is a[1-2]b[1-2] it will create newnodes of a1 and a2
|
||||
my @newnodes=expandatom($_, ($morebrackets?0:$verify), genericrange=>($morebrackets||$options{genericrange}));
|
||||
if (!$morebrackets) { push @nodes,@newnodes; }
|
||||
else {
|
||||
# for each of the new nodes, add the 2nd brackets and then expand
|
||||
# for each of the new nodes (prefixes), add the rest of the brackets and then expand recursively
|
||||
foreach my $n (@newnodes) {
|
||||
push @nodes, expandatom("$n$ending", $verify);
|
||||
push @nodes, expandatom("$n$ending", $verify, %options);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -349,7 +366,7 @@ sub expandatom { #TODO: implement table selection as an atom (nodetype.os==rhels
|
||||
$suf=$nsuffix;
|
||||
}
|
||||
foreach ("$startnum".."$endnum") {
|
||||
my @addnodes=expandatom($pref.$_.$suf,$verify);
|
||||
my @addnodes=expandatom($pref.$_.$suf,$verify,%options);
|
||||
@nodes=(@nodes,@addnodes);
|
||||
}
|
||||
return (@nodes);
|
||||
@@ -376,7 +393,7 @@ sub expandatom { #TODO: implement table selection as an atom (nodetype.os==rhels
|
||||
$right=$2;
|
||||
}
|
||||
if ($left eq $right) { #if they said node1-node1 for some strange reason
|
||||
return expandatom($left,$verify);
|
||||
return expandatom($left,$verify,%options);
|
||||
}
|
||||
my @leftarr=split(/(\d+)/,$left);
|
||||
my @rightarr=split(/(\d+)/,$right);
|
||||
@@ -413,7 +430,7 @@ sub expandatom { #TODO: implement table selection as an atom (nodetype.os==rhels
|
||||
}
|
||||
}
|
||||
foreach ($leftarr[$idx]..$rightarr[$idx]) {
|
||||
my @addnodes=expandatom($prefix.$_.$luffix,$verify);
|
||||
my @addnodes=expandatom($prefix.$_.$luffix,$verify,%options);
|
||||
push @nodes,@addnodes;
|
||||
}
|
||||
return (@nodes); #the return has been built, return, exiting loop and all
|
||||
@@ -461,7 +478,7 @@ sub retain_cache { #A semi private operation to be used *ONLY* in the interestin
|
||||
%allgrphash=();
|
||||
}
|
||||
}
|
||||
sub extnoderange { #An extended noderange function. Needed as the more straightforward function return format too simple for this.
|
||||
sub extnoderange { #An extended noderange function. Needed by the GUI as the more straightforward function return format too simple for this.
|
||||
my $range = shift;
|
||||
my $namedopts = shift;
|
||||
my $verify=1;
|
||||
@@ -487,7 +504,7 @@ sub extnoderange { #An extended noderange function. Needed as the more straight
|
||||
return $return;
|
||||
}
|
||||
sub abbreviate_noderange {
|
||||
#takes a list of nodes or a string and abbreviates
|
||||
#takes a list of nodes or a string and reduces it by replacing a list of nodes that make up a group with the group name itself
|
||||
my $nodes=shift;
|
||||
my %grouphash;
|
||||
my %sizedgroups;
|
||||
@@ -533,16 +550,40 @@ sub abbreviate_noderange {
|
||||
return (join ',',keys %targetelems,keys %nodesleft);
|
||||
}
|
||||
|
||||
sub set_arith {
|
||||
my $operand = shift;
|
||||
my $op = shift;
|
||||
my $newset = shift;
|
||||
if ($op =~ /@/) { # compute the intersection of the current atom and the node list we have received before this
|
||||
foreach (keys %$operand) {
|
||||
unless ($newset->{$_}) {
|
||||
delete $operand->{$_};
|
||||
}
|
||||
}
|
||||
} elsif ($op =~ /,-/) { # add the nodes from this atom to the exclude list
|
||||
foreach (keys %$newset) {
|
||||
delete $operand->{$_}
|
||||
}
|
||||
} else { # add the nodes from this atom to the total node list
|
||||
foreach (keys %$newset) {
|
||||
$operand->{$_}=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
# Expand the given noderange
|
||||
# Input args:
|
||||
# - noderange to expand
|
||||
# - verify: whether or not to require that the resulting nodenames exist in the nodelist table
|
||||
# - exsitenode: whether or not to honor site.excludenodes to automatically exclude those nodes from all noderanges
|
||||
# - options: genericrange - a purely syntactical expansion of the range, not using the db at all, e.g not expanding group names
|
||||
sub noderange {
|
||||
$missingnodes=[];
|
||||
#We for now just do left to right operations
|
||||
my $range=shift;
|
||||
$range =~ s/['"]//g;
|
||||
my $verify = (scalar(@_) >= 1 ? shift : 1);
|
||||
|
||||
#excludenodes attribute in site table,
|
||||
#these nodes should be excluded for any xCAT commands
|
||||
my $exsitenode = (scalar(@_) >= 1 ? shift : 1);
|
||||
my $exsitenode = (scalar(@_) >= 1 ? shift : 1); # if 1, honor site.excludenodes
|
||||
my %options = @_; # additional options
|
||||
|
||||
unless ($nodelist) {
|
||||
$nodelist =xCAT::Table->new('nodelist',-create =>1);
|
||||
@@ -553,20 +594,45 @@ sub noderange {
|
||||
}
|
||||
my %nodes = ();
|
||||
my %delnodes = ();
|
||||
if ($range =~ /\(/) {
|
||||
my ($middle, $end, $start) =
|
||||
extract_bracketed($range, '()', qr/[^()]*/);
|
||||
unless ($middle) { die "Unbalanced parentheses in noderange" }
|
||||
$middle = substr($middle,1,-1);
|
||||
my $op = ",";
|
||||
if ($start =~ m/-$/) { #subtract the parenthetical
|
||||
$op .= "-"
|
||||
} elsif ($start =~ m/\@$/) {
|
||||
$op = "@"
|
||||
}
|
||||
$start =~ s/,-$//;
|
||||
$start =~ s/,$//;
|
||||
$start =~ s/\@$//;
|
||||
%nodes = map { $_ => 1 } noderange($start,$verify,$exsitenode,%options);
|
||||
my %innernodes = map { $_ => 1 } noderange($middle,$verify,$exsitenode,%options);
|
||||
set_arith(\%nodes,$op,\%innernodes);
|
||||
$range = $end;
|
||||
}
|
||||
|
||||
my $op = ",";
|
||||
my @elems = split(/(,(?![^[]*?])(?![^\(]*?\)))/,$range); # commas outside of [] or ()
|
||||
if (scalar(@elems)==1) {
|
||||
@elems = split(/(@(?![^\(]*?\)))/,$range); # only split on @ when no , are present (inner recursion)
|
||||
}
|
||||
|
||||
while (my $atom = shift @elems) {
|
||||
while (defined(my $atom = shift @elems)) {
|
||||
if ($atom eq '') { next; }
|
||||
if ($atom eq ',') {
|
||||
next;
|
||||
}
|
||||
if ($atom =~ /^-/) { # if this is an exclusion, strip off the minus, but remember it
|
||||
$atom = substr($atom,1);
|
||||
$op = $op."-";
|
||||
} elsif ($atom =~ /^\@/) { # if this is an exclusion, strip off the minus, but remember it
|
||||
$atom = substr($atom,1);
|
||||
$op = "@";
|
||||
}
|
||||
if ($atom eq '') { next; }
|
||||
|
||||
if ($atom =~ /^\^(.*)$/) { # get a list of nodes from a file
|
||||
open(NRF,$1);
|
||||
@@ -577,7 +643,7 @@ sub noderange {
|
||||
my $newrange = $1;
|
||||
chomp($newrange);
|
||||
$recurselevel++;
|
||||
my @filenodes = noderange($newrange);
|
||||
my @filenodes = noderange($newrange,$verify,$exsitenode,%options);
|
||||
foreach (@filenodes) {
|
||||
$nodes{$_}=1;
|
||||
}
|
||||
@@ -587,7 +653,7 @@ sub noderange {
|
||||
next;
|
||||
}
|
||||
|
||||
my %newset = map { $_ =>1 } expandatom($atom,$verify); # expand the atom and make each entry in the resulting array a key in newset
|
||||
my %newset = map { $_ =>1 } expandatom($atom,$verify,%options); # expand the atom and make each entry in the resulting array a key in newset
|
||||
|
||||
if ($op =~ /@/) { # compute the intersection of the current atom and the node list we have received before this
|
||||
foreach (keys %nodes) {
|
||||
@@ -614,7 +680,7 @@ sub noderange {
|
||||
my $badnoderange = 0;
|
||||
my @badnodes = ();
|
||||
if ($::XCATSITEVALS{excludenodes}) {
|
||||
@badnodes = noderange($::XCATSITEVALS{excludenodes}, 1, 0);
|
||||
@badnodes = noderange($::XCATSITEVALS{excludenodes}, 1, 0, %options);
|
||||
foreach my $bnode (@badnodes) {
|
||||
if (!$delnodes{$bnode}) {
|
||||
$delnodes{$bnode} = 1;
|
||||
|
||||
@@ -139,7 +139,7 @@ sub connect {
|
||||
my $timeout = $req->{ppctimeout};
|
||||
my $verbose = $req->{verbose};
|
||||
my $ssh;
|
||||
my $expect_log;
|
||||
my $expect_log = "/dev/null";
|
||||
my $errmsg;
|
||||
|
||||
if ($req->{command} eq 'rflash') {
|
||||
@@ -170,7 +170,7 @@ sub connect {
|
||||
##################################################
|
||||
if ( $verbose ) {
|
||||
close STDERR;
|
||||
if ( !open( STDERR, '>', \$expect_log )) {
|
||||
if ( !open( STDERR, '>', $expect_log )) {
|
||||
return( "Unable to redirect STDERR: $!" );
|
||||
}
|
||||
}
|
||||
@@ -179,7 +179,7 @@ sub connect {
|
||||
##################################################
|
||||
if ( $verbose ) {
|
||||
close STDOUT;
|
||||
if ( !open( STDOUT, '>', \$expect_log )) {
|
||||
if ( !open( STDOUT, '>', $expect_log )) {
|
||||
return( "Unable to redirect STDOUT: $!" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -490,6 +490,9 @@ sub mkhwconn
|
||||
my $ntype = $$d[4];
|
||||
if ($ntype =~ /^(cec|frame|blade)$/)
|
||||
{
|
||||
if ($ntype eq "blade") {
|
||||
delete $opt->{port};
|
||||
}
|
||||
$cnode = xCAT::DBobjUtils::getchildren($node_name, $opt->{port});
|
||||
} else {
|
||||
$cnode = $node_name;
|
||||
|
||||
+112
-5
@@ -7,6 +7,7 @@ use xCAT::GlobalDef;
|
||||
use xCAT::Utils;
|
||||
use xCAT::TableUtils;
|
||||
use xCAT::NetworkUtils;
|
||||
require xCAT::data::ibmhwtypes;
|
||||
|
||||
###########################################
|
||||
# Factory defaults
|
||||
@@ -100,7 +101,6 @@ sub add_ppc {
|
||||
$parent,
|
||||
$ips,
|
||||
$mac ) = split /,/;
|
||||
|
||||
###############################
|
||||
# Update nodetype table
|
||||
###############################
|
||||
@@ -168,6 +168,10 @@ sub add_ppc {
|
||||
# Update nodelist table
|
||||
###########################
|
||||
updategroups( $name, $db{nodelist}, $type );
|
||||
my $tmp_group = xCAT::data::ibmhwtypes::parse_group($model);
|
||||
if (defined($tmp_group)) {
|
||||
updategroups($name, $db{nodelist}, $tmp_group);
|
||||
}
|
||||
if ( $type =~ /^(fsp|bpa)$/ ) {
|
||||
$db{nodelist}->setNodeAttribs( $name, {hidden => '1'});
|
||||
} else {
|
||||
@@ -236,6 +240,97 @@ sub add_ppc {
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
##########################################################################
|
||||
# Update lpar information in the xCAT databases
|
||||
##########################################################################
|
||||
sub update_lpar {
|
||||
my $hwtype = shift;
|
||||
my $values = shift;
|
||||
my $write = shift;
|
||||
my @tabs = qw(ppc vpd nodehm nodelist nodetype ppcdirect hosts mac);
|
||||
my %db = ();
|
||||
my @update_list = ();
|
||||
my @write_list = ();
|
||||
###################################
|
||||
# Open database needed
|
||||
###################################
|
||||
foreach ( @tabs ) {
|
||||
$db{$_} = xCAT::Table->new( $_, -create=>1, -autocommit=>0 );
|
||||
if ( !$db{$_} ) {
|
||||
return( "Error opening '$_'" );
|
||||
}
|
||||
}
|
||||
my @vpdlist = $db{vpd}->getAllNodeAttribs(['node','serial','mtm','side']);
|
||||
my @ppclist = $db{ppc}->getAllNodeAttribs(['node','hcp','id',
|
||||
'pprofile','parent','nodetype',
|
||||
'comments', 'disable']);
|
||||
# 'cec,cec1,,8246-L1D,100A9DA,,cec1,,cec1',
|
||||
# 'lpar,10-0A9DA,1,8246-L1D,100A9DA,,cec1,,cec1'
|
||||
my %ppchash = ();
|
||||
my %vpdhash = ();
|
||||
foreach my $ppcent (@ppclist) {
|
||||
if ($ppcent->{id} and $ppcent->{nodetype} and $ppcent->{nodetype} eq "lpar") {
|
||||
my $key = $ppcent->{node};
|
||||
$ppchash{$key}{id} = $ppcent->{id};
|
||||
$ppchash{$key}{parent} = $ppcent->{parent};
|
||||
}
|
||||
}
|
||||
foreach my $vpdent (@vpdlist)
|
||||
{
|
||||
my $key = $vpdent->{node};
|
||||
$vpdhash{$key}{mtm} = $vpdent->{mtm};
|
||||
$vpdhash{$key}{serial} = $vpdent->{serial};
|
||||
}
|
||||
my @ppc_lpars = keys %ppchash;
|
||||
foreach my $value ( @$values ) {
|
||||
my ($ttype,
|
||||
$tname,
|
||||
$tid,
|
||||
$tmtm,
|
||||
$tsn,
|
||||
$tside,
|
||||
$server,
|
||||
$pprofile,
|
||||
$parent) = split /,/, $value;
|
||||
if ($ttype ne "lpar") {
|
||||
push @update_list, $value;
|
||||
next;
|
||||
}
|
||||
my $find_node = undef;
|
||||
foreach my $tmp_node (@ppc_lpars) {
|
||||
if ($ppchash{$tmp_node}{id} eq $tid) {
|
||||
if (exists($ppchash{$tmp_node}{parent}) and $ppchash{$tmp_node}{parent} eq $parent) {
|
||||
$find_node = $tmp_node;
|
||||
last;
|
||||
} elsif ($vpdhash{$tmp_node}{mtm} eq $tmtm and $vpdhash{$tmp_node}{serial} eq $tsn) {
|
||||
$find_node = $tmp_node;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (defined($find_node)) {
|
||||
if ( update_node_attribs($hwtype, $ttype, $find_node, $tid, $tmtm, $tsn, $tside,
|
||||
$server, $pprofile, $parent, "", \%db, $tname, \@ppclist))
|
||||
{
|
||||
$value =~ s/^$ttype,$tname,/$ttype,$find_node,/;
|
||||
push @update_list, $value;
|
||||
}
|
||||
} elsif (defined($write)) {
|
||||
push @write_list, $value;
|
||||
}
|
||||
}
|
||||
if (defined($write)) {
|
||||
&add_ppc($hwtype, \@write_list);
|
||||
return ([@update_list,@write_list]);
|
||||
} else {
|
||||
foreach ( @tabs ) {
|
||||
if ( exists( $db{$_}{commit} )) {
|
||||
$db{$_}->commit;
|
||||
}
|
||||
}
|
||||
return \@update_list;
|
||||
}
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
# Update nodes in the xCAT databases
|
||||
@@ -278,7 +373,6 @@ sub update_ppc {
|
||||
$pprofile,
|
||||
$parent,
|
||||
$ips ) = split /,/, $value;
|
||||
|
||||
if ( $ttype eq 'cec' )
|
||||
{
|
||||
my $hostname = get_host($tname, "FSP", $tmtm, $tsn, "", "", $tid, "","");
|
||||
@@ -329,9 +423,7 @@ sub update_ppc {
|
||||
$pprofile,
|
||||
$parent,
|
||||
$ips ) = split /,/, $value;
|
||||
|
||||
next if ( $type ne 'cec' );
|
||||
|
||||
my $predefined_node = undef;
|
||||
foreach my $vpdent (@vpdlist)
|
||||
{
|
||||
@@ -525,6 +617,10 @@ sub update_node_attribs
|
||||
if ( $namediff)
|
||||
{
|
||||
updategroups( $name, $db->{nodelist}, $type );
|
||||
my $tmp_group = xCAT::data::ibmhwtypes::parse_group($model);
|
||||
if (defined($tmp_group)) {
|
||||
updategroups($name, $db->{nodelist}, $tmp_group);
|
||||
}
|
||||
$db->{nodelist}->setNodeAttribs( $name, {status=>$nodelisthash->{status},
|
||||
appstatus=>$nodelisthash->{appstatus},
|
||||
primarysn=>$nodelisthash->{primarysn},
|
||||
@@ -888,6 +984,18 @@ sub get_usr_passwd {
|
||||
} else {
|
||||
($ent) = $passwdtab->getNodeAttribs($key, qw(username password));
|
||||
}
|
||||
if (!$ent) {
|
||||
if ($key eq "cec") {
|
||||
$key = "fsp";
|
||||
} elsif ($key eq "frame") {
|
||||
$key = "bpa";
|
||||
}
|
||||
if ($user) {
|
||||
($ent) = $passwdtab->getAttribs({key => $key, username => $user}, qw(password cryptmethod));
|
||||
} else {
|
||||
($ent) = $passwdtab->getNodeAttribs($key, qw(username password));
|
||||
}
|
||||
}
|
||||
if (!$ent or !$ent->{password}) {
|
||||
my $hash = $default_passwd_accounts{$key};
|
||||
if (!$hash or ($user and !defined($hash->{$user}))) {
|
||||
@@ -958,7 +1066,6 @@ sub get_host {
|
||||
# get the information of existed nodes to do the migration
|
||||
|
||||
read_from_table() unless (%::OLD_DATA_CACHE);
|
||||
|
||||
foreach my $oldnode ( keys %::OLD_DATA_CACHE )
|
||||
{
|
||||
my $tmpmtm = @{$::OLD_DATA_CACHE{$oldnode}}[0];
|
||||
|
||||
@@ -5,6 +5,8 @@ use strict;
|
||||
use Getopt::Long;
|
||||
use xCAT::PPCcli qw(SUCCESS EXPECT_ERROR RC_ERROR NR_ERROR);
|
||||
use xCAT::Usage;
|
||||
use xCAT::TableUtils;
|
||||
require xCAT::data::ibmhwtypes;
|
||||
|
||||
|
||||
##########################################
|
||||
@@ -59,7 +61,7 @@ sub parse_args {
|
||||
$Getopt::Long::ignorecase = 0;
|
||||
Getopt::Long::Configure( "bundling" );
|
||||
|
||||
if ( !GetOptions( \%opt, qw(V|verbose) )) {
|
||||
if ( !GetOptions( \%opt, qw(V|verbose t) )) {
|
||||
return( usage() );
|
||||
}
|
||||
####################################
|
||||
@@ -75,6 +77,9 @@ sub parse_args {
|
||||
if ( !defined( $cmd )) {
|
||||
return(usage( "Invalid command: $ARGV[0]" ));
|
||||
}
|
||||
if (exists($opt{t}) and $cmd ne "model") {
|
||||
return(["Option 't' can only work with 'model'."]);
|
||||
}
|
||||
####################################
|
||||
# Check for an extra argument
|
||||
####################################
|
||||
@@ -411,6 +416,12 @@ sub vpd {
|
||||
#############################
|
||||
# Output value
|
||||
#############################
|
||||
if ($_ eq 'model' and exists($request->{opt}->{t})) {
|
||||
my $tmp_pre = xCAT::data::ibmhwtypes::parse_args($data->{$_});
|
||||
if (defined($tmp_pre)) {
|
||||
xCAT::TableUtils->updatenodegroups($name, $tmp_pre);
|
||||
}
|
||||
}
|
||||
my $value = "@{$prefix{$_}}[0]: $data->{$_}";
|
||||
push @result, [$name,$value,$Rc];
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ use xCAT::PPCdb;
|
||||
use xCAT::GlobalDef;
|
||||
use xCAT::Usage;
|
||||
use xCAT::NetworkUtils;
|
||||
|
||||
require xCAT::data::ibmhwtypes;
|
||||
|
||||
##############################################
|
||||
# Globals
|
||||
@@ -545,6 +545,7 @@ sub format_stanza {
|
||||
#################################
|
||||
# Add each attribute
|
||||
#################################
|
||||
my $mtm = undef;
|
||||
foreach ( @attribs ) {
|
||||
my $d = $data[$i++];
|
||||
|
||||
@@ -555,7 +556,8 @@ sub format_stanza {
|
||||
} elsif ( /^hwtype$/ ) {
|
||||
$d = $globalhwtype{$type};
|
||||
} elsif ( /^groups$/ ) {
|
||||
$d = "$type,all";
|
||||
next;
|
||||
#$d = "$type,all";
|
||||
} elsif ( /^mgt$/ ) {
|
||||
$d = $hwtype;
|
||||
} elsif ( /^cons$/ ) {
|
||||
@@ -568,7 +570,9 @@ sub format_stanza {
|
||||
} elsif ( /^(mtm|serial)$/ ) {
|
||||
if ( $type eq "lpar" ) {
|
||||
$d = undef;
|
||||
}
|
||||
} elsif (/^mtm$/) {
|
||||
$mtm = $d;
|
||||
}
|
||||
} elsif (/^side$/) {
|
||||
unless ( $type =~ /^fsp|bpa$/ ) {
|
||||
next;
|
||||
@@ -576,6 +580,14 @@ sub format_stanza {
|
||||
}
|
||||
$result .= "\t$_=$d\n";
|
||||
}
|
||||
my $tmp_groups = "$type,all";
|
||||
if (defined($mtm)) {
|
||||
my $tmp_pre = xCAT::data::ibmhwtypes::parse_group($mtm);
|
||||
if (defined($tmp_pre)) {
|
||||
$tmp_groups .= ",$tmp_pre";
|
||||
}
|
||||
}
|
||||
$result .= "\tgroups=$tmp_groups\n";
|
||||
}
|
||||
return( $result );
|
||||
}
|
||||
@@ -623,6 +635,7 @@ sub format_xml {
|
||||
#################################
|
||||
# Add each attribute
|
||||
#################################
|
||||
my $mtm = undef;
|
||||
foreach ( @attribs ) {
|
||||
my $d = $data[$i++];
|
||||
|
||||
@@ -631,7 +644,8 @@ sub format_xml {
|
||||
} elsif ( /^hwtype$/ ) {
|
||||
$d = $globalhwtype{$type};
|
||||
} elsif ( /^groups$/ ) {
|
||||
$d = "$type,all";
|
||||
next;
|
||||
#$d = "$type,all";
|
||||
} elsif ( /^mgt$/ ) {
|
||||
$d = $hwtype;
|
||||
} elsif ( /^cons$/ ) {
|
||||
@@ -643,6 +657,8 @@ sub format_xml {
|
||||
} elsif ( /^(mtm|serial)$/ ) {
|
||||
if ( $type eq "lpar" ) {
|
||||
$d = undef;
|
||||
} elsif (/^mtm$/){
|
||||
$mtm = $d;
|
||||
}
|
||||
} elsif (/^side$/) {
|
||||
unless ( $type =~ /^fsp|bpa$/ ) {
|
||||
@@ -651,6 +667,14 @@ sub format_xml {
|
||||
}
|
||||
$href->{Node}->{$_} = $d;
|
||||
}
|
||||
my $tmp_groups = "$type,all";
|
||||
if (defined($mtm)) {
|
||||
my $tmp_pre = xCAT::data::ibmhwtypes::parse_group($mtm);
|
||||
if (defined($tmp_pre)) {
|
||||
$tmp_groups .= ",$tmp_pre";
|
||||
}
|
||||
}
|
||||
$href->{Node}->{groups}=$tmp_groups;
|
||||
#################################
|
||||
# XML encoding
|
||||
#################################
|
||||
|
||||
@@ -52,14 +52,21 @@ sub get_allocable_staticips_innet
|
||||
my $netentry = ($networkstab->getAllAttribsWhere("netname = '$netname'", 'ALL'))[0];
|
||||
my ($startip, $endip) = split('-', $netentry->{'staticrange'});
|
||||
my $incremental = $netentry->{'staticrangeincrement'};
|
||||
my $netmask = $netentry->{'mask'};
|
||||
my $gateway = $netentry->{'gateway'};
|
||||
my $validipsref;
|
||||
if ($incremental and $startip and $endip){
|
||||
$validipsref = xCAT::NetworkUtils->get_allips_in_range($startip, $endip, $incremental);
|
||||
}
|
||||
|
||||
my $broadcastip = xCAT::NetworkUtils->getBroadcast($startip, $netmask);
|
||||
foreach (@$validipsref){
|
||||
if (! exists($iphash{$_})){
|
||||
push @allocableips, $_;
|
||||
#Remove ip which is broadcast ip, exclude ip, ips ended with 0, gateway ip
|
||||
if (exists($iphash{$_}) or $_ eq $broadcastip or $_ eq $gateway
|
||||
or $_ =~ /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(0)$/){
|
||||
next;
|
||||
}
|
||||
push @allocableips, $_;
|
||||
}
|
||||
return \@allocableips;
|
||||
}
|
||||
@@ -543,6 +550,96 @@ sub get_allnode_singleattrib_hash
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 get_db_swtiches
|
||||
Description : Get all records of switch config from a table, then return a string list.
|
||||
Arguments : $tabname - the table name.
|
||||
Returns : Reference of the records hash.
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub get_db_switches
|
||||
{
|
||||
my $class = shift;
|
||||
my $table = xCAT::Table->new("switches");
|
||||
my @attribs = ("switch");
|
||||
my @entries = $table->getAllAttribs(@attribs);
|
||||
$table->close();
|
||||
my %allrecords;
|
||||
foreach (@entries)
|
||||
{
|
||||
if ($_->{'switch'}){
|
||||
$allrecords{$_->{'switch'}} = 0;
|
||||
}
|
||||
}
|
||||
return \%allrecords;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 get_db_swtichports
|
||||
Description : Get all records of switch config from a table, then return a string list.
|
||||
Arguments : $tabname - the table name.
|
||||
Returns : Reference of the records hash.
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub get_db_switchports
|
||||
{
|
||||
my $class = shift;
|
||||
my $table = xCAT::Table->new("switch");
|
||||
my @attribs = ("switch", "port");
|
||||
my @entries = $table->getAllAttribs(@attribs);
|
||||
$table->close();
|
||||
my %allrecords;
|
||||
foreach (@entries)
|
||||
{
|
||||
$allrecords{$_->{'switch'} . "_" . $_->{'port'}} = 0;
|
||||
}
|
||||
return \%allrecords;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 get_all_cecs
|
||||
Description : Get all CEC objects name in system.
|
||||
Arguments : hashref: if not set, return a array ref.
|
||||
if set, return a hash ref.
|
||||
Returns : ref for CECs list.
|
||||
Example :
|
||||
my $arrayref = xCAT::ProfiledNodeUtils->get_all_cecs();
|
||||
my $hashref = xCAT::ProfiledNodeUtils->get_all_cecs(1);
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub get_all_cecs
|
||||
{
|
||||
my $hashref = shift;
|
||||
my %cecshash;
|
||||
my @cecslist;
|
||||
|
||||
my $ppctab = xCAT::Table->new('ppc');
|
||||
my @cecs = $ppctab->getAllAttribsWhere("nodetype = 'cec'", 'node');
|
||||
foreach (@cecs) {
|
||||
if($_->{'node'}) {
|
||||
if ($hashref) {
|
||||
$cecshash{$_->{'node'}} = 1;
|
||||
} else {
|
||||
push @cecslist, $_->{'node'};
|
||||
}
|
||||
}
|
||||
}
|
||||
$ppctab->close();
|
||||
|
||||
# Return the ref accordingly
|
||||
if ($hashref) {
|
||||
return \%cecshash;
|
||||
} else {
|
||||
return \@cecslist;
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 is_discover_started
|
||||
Description : Judge whether profiled nodes discovering is running or not.
|
||||
Arguments : NA
|
||||
@@ -701,7 +798,14 @@ sub check_profile_consistent{
|
||||
my $mgt = undef;
|
||||
$mgt = $mgtentry->{'mgt'} if ($mgtentry->{'mgt'});
|
||||
$nodehmtab->close();
|
||||
|
||||
|
||||
#Get hardwareprofile nodetype
|
||||
my $ppctab = xCAT::Table->new('ppc');
|
||||
my $ntentry = $ppctab->getNodeAttribs($hardwareprofile, ['nodetype']);
|
||||
my $nodetype = undef;
|
||||
$nodetype = $ntentry->{'nodetype'} if ($ntentry->{'nodetype'});
|
||||
$ppctab->close();
|
||||
|
||||
# Check if exists provision network
|
||||
if (not ($installnic and exists $netprofile_nicshash{$installnic}{"network"})){
|
||||
return 0, "Provisioning network not defined for network profile."
|
||||
@@ -720,17 +824,24 @@ sub check_profile_consistent{
|
||||
return 0, "$nictype networkprofile must use with hardwareprofile.";
|
||||
}
|
||||
}
|
||||
|
||||
if (not $nictype and $mgt) {
|
||||
# define hardwareprofile, not define fsp or bmc networkprofile
|
||||
|
||||
# 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' ) {
|
||||
# define hardwareprofile, not define fsp or bmc networkprofile, and the node type is not lpar
|
||||
return 0, "$profile_dict{$mgt} hardwareprofile must use with $profile_dict{$mgt} networkprofile.";
|
||||
}
|
||||
|
||||
if ($profile_dict{$mgt} ne $nictype) {
|
||||
# Networkprofile's nictype is not consistent with hadrwareprofile's mgt
|
||||
if ($profile_dict{$mgt} ne $nictype and $nodetype ne 'lpar') {
|
||||
# Networkprofile's nictype is not consistent with hadrwareprofile's mgt, and the node type is not lpar
|
||||
return 0, "Networkprofile's nictype is not consistent with hardwareprofile's mgt.";
|
||||
}
|
||||
|
||||
|
||||
if ($nodetype eq 'lpar' and $nictype eq 'FSP')
|
||||
{
|
||||
# can not associate FSP network if the node type is lpar
|
||||
return 0, "The node with hardware type $nodetype can not use with $nictype networkprofile.";
|
||||
}
|
||||
|
||||
return 1, "";
|
||||
}
|
||||
|
||||
|
||||
@@ -41,15 +41,16 @@ package xCAT::RemoteShellExp;
|
||||
[-t node list] test ssh connection to the node
|
||||
[-k] Generates the ssh keys needed , for the user on the MN.
|
||||
[-s node list] copies the ssh keys to the nodes
|
||||
|
||||
optional $timeout = timeout value for the expect. Usually from the xdsh -t flag
|
||||
default timeout is 10 seconds
|
||||
exit 0 - good
|
||||
exit 1 - abort
|
||||
exit 2 - usage error
|
||||
|
||||
Examples:
|
||||
$rc=xCAT::RemoteShellExp->remoteshellexp("k",$callback,$remoteshellcmd);
|
||||
$rc=xCAT::RemoteShellExp->remoteshellexp("s",$callback,$remoteshellcmd,$nodes);
|
||||
$rc=xCAT::RemoteShellExp->remoteshellexp("t",$callback,$remoteshellcmd,$nodes);
|
||||
$rc=xCAT::RemoteShellExp->remoteshellexp("k",$callback,$remoteshellcmd,$nodes,$timeout);
|
||||
$rc=xCAT::RemoteShellExp->remoteshellexp("s",$callback,$remoteshellcmd,$nodes,$timeout);
|
||||
$rc=xCAT::RemoteShellExp->remoteshellexp("t",$callback,$remoteshellcmd,$nodes,$timeout);
|
||||
|
||||
=cut
|
||||
|
||||
@@ -70,7 +71,7 @@ use strict;
|
||||
#-----------------------------------------------------------------------------
|
||||
sub remoteshellexp
|
||||
{
|
||||
my ($class, $flag, $callback, $remoteshell, $nodes) = @_;
|
||||
my ($class, $flag, $callback, $remoteshell, $nodes, $timeout) = @_;
|
||||
my $rc=0;
|
||||
$::CALLBACK = $callback;
|
||||
if (!($flag))
|
||||
@@ -90,6 +91,10 @@ sub remoteshellexp
|
||||
return 2;
|
||||
|
||||
}
|
||||
my $expecttimeout=10; # default
|
||||
if (defined($timeout)) { # value supplied
|
||||
$expecttimeout=$timeout;
|
||||
}
|
||||
|
||||
# for -s flag must have nodes and a $to_userid password
|
||||
my $to_user_password;
|
||||
@@ -180,7 +185,7 @@ sub remoteshellexp
|
||||
{
|
||||
# if the file size of the id_rsa key is 0, tell them to remove it
|
||||
# and run the command again
|
||||
$rc=xCAT::RemoteShellExp->gensshkeys;
|
||||
$rc=xCAT::RemoteShellExp->gensshkeys($expecttimeout);
|
||||
}
|
||||
# send ssh keys to the nodes/devices, to setup passwordless ssh
|
||||
if ($flag eq "s")
|
||||
@@ -193,15 +198,15 @@ sub remoteshellexp
|
||||
return 1;
|
||||
}
|
||||
if ($ssh_setup_cmd) { # setup ssh on devices
|
||||
$rc=xCAT::RemoteShellExp->senddeviceskeys($remoteshell,$remotecopy,$to_userid,$to_user_password,$home,$ssh_setup_cmd,$nodes);
|
||||
$rc=xCAT::RemoteShellExp->senddeviceskeys($remoteshell,$remotecopy,$to_userid,$to_user_password,$home,$ssh_setup_cmd,$nodes, $expecttimeout);
|
||||
} else { #setup ssh on nodes
|
||||
$rc=xCAT::RemoteShellExp->sendnodeskeys($remoteshell,$remotecopy,$to_userid,$to_user_password,$home,$nodes);
|
||||
$rc=xCAT::RemoteShellExp->sendnodeskeys($remoteshell,$remotecopy,$to_userid,$to_user_password,$home,$nodes, $expecttimeout);
|
||||
}
|
||||
}
|
||||
# test ssh setup on the node
|
||||
if ($flag eq "t")
|
||||
{
|
||||
$rc=xCAT::RemoteShellExp->testkeys($remoteshell,$to_userid,$nodes);
|
||||
$rc=xCAT::RemoteShellExp->testkeys($remoteshell,$to_userid,$nodes,$expecttimeout);
|
||||
}
|
||||
return $rc;
|
||||
}
|
||||
@@ -220,9 +225,9 @@ sub remoteshellexp
|
||||
sub gensshkeys
|
||||
|
||||
{
|
||||
my ($class) = @_;
|
||||
my ($class, $expecttimeout) = @_;
|
||||
my $keygen;
|
||||
my $timeout = 10; # sets Expect default timeout, 0 accepts immediately
|
||||
my $timeout = $expecttimeout; # sets Expect default timeout, 0 accepts immediately
|
||||
my $keygen_sent = 0;
|
||||
my $prompt1 = 'Generating public/private rsa';
|
||||
my $prompt2 = 'Enter file.*:';
|
||||
@@ -347,9 +352,9 @@ sub gensshkeys
|
||||
sub testkeys
|
||||
|
||||
{
|
||||
my ($class,$remoteshell,$to_userid,$nodes) = @_;
|
||||
my ($class,$remoteshell,$to_userid,$nodes, $expecttimeout) = @_;
|
||||
my $testkeys;
|
||||
my $timeout = 10; # sets Expect default timeout, 0 accepts immediately
|
||||
my $timeout = $expecttimeout; # sets Expect default timeout
|
||||
my $testkeys_sent = 0;
|
||||
my $prompt1 = 'Are you sure you want to continue connecting (yes/no)?';
|
||||
my $prompt2 = 'ssword:';
|
||||
@@ -469,9 +474,9 @@ sub testkeys
|
||||
sub sendnodeskeys
|
||||
|
||||
{
|
||||
my ($class,$remoteshell,$remotecopy,$to_userid,$to_userpassword,$home,$nodes) = @_;
|
||||
my ($class,$remoteshell,$remotecopy,$to_userid,$to_userpassword,$home,$nodes, $expecttimeout) = @_;
|
||||
my $sendkeys;
|
||||
my $timeout = 10; # sets Expect default timeout, 0 accepts immediately
|
||||
my $timeout = $expecttimeout; # sets Expect default timeout, 0 accepts immediately
|
||||
my $sendkeys_sent = 0;
|
||||
my $prompt1 = 'Are you sure you want to continue connecting (yes/no)?';
|
||||
my $prompt2 = 'ssword:';
|
||||
@@ -759,7 +764,7 @@ sub sendnodeskeys
|
||||
|
||||
=head3 senddeviceskeys
|
||||
|
||||
Setup the ssh keys on the nodes
|
||||
Setup the ssh keys on the switches
|
||||
|
||||
=cut
|
||||
|
||||
@@ -768,9 +773,9 @@ sub sendnodeskeys
|
||||
sub senddeviceskeys
|
||||
|
||||
{
|
||||
my ($class,$remoteshell,$remotecopy,$to_userid,$to_userpassword,$home,$ssh_setup_cmd,$nodes) = @_;
|
||||
my ($class,$remoteshell,$remotecopy,$to_userid,$to_userpassword,$home,$ssh_setup_cmd,$nodes, $expecttimeout) = @_;
|
||||
my $sendkeys;
|
||||
my $timeout = 10; # sets Expect default timeout, 0 accepts immediately
|
||||
my $timeout = $expecttimeout; # sets Expect default timeout, 0 accepts immediately
|
||||
my $sendkeys_sent = 0;
|
||||
my $prompt1 = 'Are you sure you want to continue connecting (yes/no)?';
|
||||
my $prompt2 = 'ssword:';
|
||||
|
||||
+32
-14
@@ -202,9 +202,11 @@ sub parse_and_run_sinv
|
||||
#
|
||||
my @nodelist = ();
|
||||
my @cmdparts = ();
|
||||
my $devicecommand =0;
|
||||
if ($options{'devicetype'}) {
|
||||
# must split different because devices have commands with spaces
|
||||
@cmdparts = split(' ', $cmd,3);
|
||||
$devicecommand =1;
|
||||
} else {
|
||||
@cmdparts = split(' ', $cmd);
|
||||
}
|
||||
@@ -503,7 +505,7 @@ sub parse_and_run_sinv
|
||||
);
|
||||
|
||||
# write the results to the tempfile after running through xdshcoll
|
||||
$rc = &storeresults($callback);
|
||||
$rc = &storeresults($callback,$devicecommand);
|
||||
|
||||
}
|
||||
$processflg = "node";
|
||||
@@ -534,7 +536,7 @@ sub parse_and_run_sinv
|
||||
|
||||
|
||||
# write the results to the tempfile after running through xdshcoll
|
||||
$rc = &storeresults($callback);
|
||||
$rc = &storeresults($callback,$devicecommand);
|
||||
|
||||
# Build report and write to output file
|
||||
# if file exist and has something in it
|
||||
@@ -1451,12 +1453,11 @@ sub rinvoutput
|
||||
sub storeresults
|
||||
{
|
||||
my $callback = shift;
|
||||
|
||||
my $devicecommand= shift;
|
||||
# open file to write results of xdsh or rinv command
|
||||
my $newtempfile = $tempfile;
|
||||
$newtempfile .= "temp";
|
||||
open(FILE, ">$newtempfile");
|
||||
if ($? > 0)
|
||||
unless (open(NEWTMPFILE, ">$newtempfile"))
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "Could not open $newtempfile\n";
|
||||
@@ -1465,9 +1466,9 @@ sub storeresults
|
||||
}
|
||||
foreach my $line (@cmdresult)
|
||||
{
|
||||
print FILE $line;
|
||||
print NEWTMPFILE $line;
|
||||
}
|
||||
close FILE;
|
||||
close NEWTMPFILE;
|
||||
my $outputfile;
|
||||
if ($processflg eq "seednode")
|
||||
{ # cmd to seednode
|
||||
@@ -1479,8 +1480,7 @@ sub storeresults
|
||||
}
|
||||
|
||||
# open file to put results of xdshcoll
|
||||
open(FILE, ">$outputfile");
|
||||
if ($? > 0)
|
||||
unless (open(NEWOUTFILE, ">$outputfile"))
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "Could not open $outputfile\n";
|
||||
@@ -1489,8 +1489,7 @@ sub storeresults
|
||||
}
|
||||
my $cmd = " $::XCATROOT/sbin/xdshcoll <$newtempfile |";
|
||||
|
||||
open(XCOLL, "$cmd");
|
||||
if ($? > 0)
|
||||
unless (open(XCOLL, "$cmd"))
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "Could not call xdshcoll \n";
|
||||
@@ -1503,18 +1502,37 @@ sub storeresults
|
||||
while (<XCOLL>)
|
||||
{
|
||||
$line = $_;
|
||||
print FILE $line
|
||||
print NEWOUTFILE $line
|
||||
|
||||
}
|
||||
|
||||
close(XCOLL);
|
||||
close FILE;
|
||||
close NEWOUTFILE;
|
||||
|
||||
system("/bin/rm $newtempfile");
|
||||
# is device command, we get false errors from the Switch, check for
|
||||
# blank error output lines and remove them. If there is nothing left
|
||||
# then there really were no errors
|
||||
my @newerrresult=();
|
||||
my $processerrors =1;
|
||||
if ($devicecommand==1) {
|
||||
foreach my $line (@errresult)
|
||||
{
|
||||
my @newline = (split(/:/, $line));
|
||||
if ($newline[1] !~ /^\s*$/) { # Not blank, then save it
|
||||
push @newerrresult,$line;
|
||||
}
|
||||
|
||||
}
|
||||
my $arraysize=@newerrresult;
|
||||
if ($arraysize < 1) {
|
||||
$processerrors =0;
|
||||
}
|
||||
}
|
||||
|
||||
# capture errors
|
||||
#
|
||||
if (@errresult)
|
||||
if ((@errresult) && ($processerrors ==1))
|
||||
{ # if errors
|
||||
my $rsp = {};
|
||||
my $i = 0;
|
||||
|
||||
+16
-2
@@ -667,6 +667,9 @@ sub decode_spd {
|
||||
1066 => 8500,
|
||||
1333 => 10600,
|
||||
1600 => 12800,
|
||||
1867 => 14900,
|
||||
2133 => 17000,
|
||||
2134 => 17000,
|
||||
);
|
||||
|
||||
my %ddr3modcap = (
|
||||
@@ -707,9 +710,20 @@ sub decode_spd {
|
||||
}
|
||||
$rethash->{product}->{name}=$memtypes{$spd[2]};
|
||||
if ($spd[2] == 11) { #DDR3 spec applies
|
||||
my $ftbdividend = $spd[9] >> 4;
|
||||
my $ftbdivisor = $spd[9] & 0xf;
|
||||
my $ftb = $ftbdividend/$ftbdivisor;
|
||||
my $fineoffset = $spd[34];
|
||||
if ($fineoffset & 0b10000000) {
|
||||
#negative value, twos complement
|
||||
$fineoffset = 0-(($fineoffset ^ 0xff) + 1);
|
||||
}
|
||||
$fineoffset = ($ftb * $fineoffset) * 10**-3;
|
||||
my $mtb = $spd[10]/$spd[11];
|
||||
my $speed = $speedfromclock{int(2/($mtb*$spd[12]*10**-3))};
|
||||
$rethash->{product}->{name}="PC3-".$speed;
|
||||
my $clock = int(2/(($mtb*$spd[12]+$fineoffset)*10**-3));
|
||||
my $speed = $speedfromclock{$clock};
|
||||
unless ($speed) { $speed = "UNKNOWN"; }
|
||||
$rethash->{product}->{name}="PC3-".$speed." ($clock MT/s)";
|
||||
if ($spd[8]&0b11000) {
|
||||
$rethash->{product}->{name} .= " ECC";
|
||||
}
|
||||
|
||||
+163
-13
@@ -191,7 +191,7 @@ vmmaster => {
|
||||
}
|
||||
},
|
||||
vm => {
|
||||
cols => [qw(node mgr host migrationdest storage storagemodel cfgstore memory cpus nics nicmodel bootorder clockoffset virtflags master vncport textconsole powerstate beacon datacenter cluster guestostype othersettings vidmodel vidproto vidpassword comments disable)],
|
||||
cols => [qw(node mgr host migrationdest storage storagemodel storagecache storageformat cfgstore memory cpus nics nicmodel bootorder clockoffset virtflags master vncport textconsole powerstate beacon datacenter cluster guestostype othersettings physlots vidmodel vidproto vidpassword comments disable)],
|
||||
keys => [qw(node)],
|
||||
tablespace =>'XCATTBS32K',
|
||||
table_desc => 'Virtualization parameters',
|
||||
@@ -222,14 +222,17 @@ vm => {
|
||||
'vncport' => 'Tracks the current VNC display port (currently not meant to be set',
|
||||
'textconsole' => 'Tracks the Psuedo-TTY that maps to the serial port or console of a VM',
|
||||
'powerstate' => "This flag is used by xCAT to track the last known power state of the VM.",
|
||||
'othersettings' => "This allows specifying a semicolon delimited list of key->value pairs to include in a vmx file of VMware.",
|
||||
'othersettings' => "This allows specifying a semicolon delimited list of key->value pairs to include in a vmx file of VMware. For partitioning on normal power machines, this option is used to specify the hugepage and/or bsr information, the value is like:'hugepage:1,bsr=2'.",
|
||||
'guestostype' => "This allows administrator to specify an identifier for OS to pass through to virtualization stack. Normally this should be ignored as xCAT will translate from nodetype.os rather than requiring this field be used\n",
|
||||
'beacon' => "This flag is used by xCAT to track the state of the identify LED with respect to the VM.",
|
||||
'datacenter' => "Optionally specify a datacenter for the VM to exist in (only applicable to VMWare)",
|
||||
'cluster' => 'Specify to the underlying virtualization infrastructure a cluster membership for the hypervisor.',
|
||||
'vidproto' => "Request a specific protocol for remote video access be set up. For example, spice in KVM.",
|
||||
'physlots' => "Specify the physical slots drc index that will assigned to the partition, the delimiter is ',', and the drc index must started with '0x'. For more details, please reference to manpage of 'lsvm'.",
|
||||
'vidmodel' => "Model of video adapter to provide to guest. For example, qxl in KVM",
|
||||
'vidpassword' => "Password to use instead of temporary random tokens for VNC and SPICE access",
|
||||
'storagecache' => "Select caching scheme to employ. E.g. KVM understands 'none', 'writethrough' and 'writeback'",
|
||||
'storageformat' => "Select disk format to use by default (e.g. raw versus qcow2)",
|
||||
}
|
||||
},
|
||||
hypervisor => {
|
||||
@@ -264,7 +267,7 @@ virtsd => {
|
||||
},
|
||||
|
||||
storage => {
|
||||
cols => [qw(node osvolume size state storagepool fcprange volumetag comments disable)],
|
||||
cols => [qw(node osvolume size state storagepool hypervisor fcprange volumetag comments disable)],
|
||||
keys => [qw(node)],
|
||||
table_descr => 'Node storage resources',
|
||||
descriptions => {
|
||||
@@ -276,6 +279,7 @@ storage => {
|
||||
size => 'Size of the volume. Examples include: 10G, 1024M.',
|
||||
state => 'State of the volume. The valid values are: free, used, and allocated',
|
||||
storagepool => 'Name of storage pool where the volume is assigned.',
|
||||
hypervisor => 'Name of the hypervisor where the volume is configured.',
|
||||
fcprange => 'A range of acceptable fibre channels that the volume can use. Examples include: 3B00-3C00;4B00-4C00.',
|
||||
volumetag => 'A specific tag used to identify the volume in the autoyast or kickstart template.',
|
||||
comments => 'Any user-written notes.',
|
||||
@@ -563,7 +567,7 @@ nodelist => {
|
||||
appstatustime =>'The date and time when appstatus was updated.',
|
||||
primarysn => 'Not used currently. The primary servicenode, used by this node.',
|
||||
hidden => "Used to hide fsp and bpa definitions, 1 means not show them when running lsdef and nodels",
|
||||
updatestatus => "The current node update status. Valid states are synced and out-of-sync.",
|
||||
updatestatus => "The current node update status. Valid states are synced out-of-sync,syncing,failed.",
|
||||
updatestatustime => "The date and time when the updatestatus was updated.",
|
||||
comments => 'Any user-written notes.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
@@ -676,7 +680,7 @@ osimage => {
|
||||
groups => 'A comma-delimited list of image groups of which this image is a member. Image groups can be used in the litefile and litetree table instead of a single image name. Group names are arbitrary.',
|
||||
imagetype => 'The type of operating system image this definition represents (linux,AIX).',
|
||||
description => 'OS Image Description',
|
||||
provmethod => 'The provisioning method for node deployment. The valid values are install, netboot,statelite,boottarget,dualboot. If boottarget is set, you must set linuximage.boottarget to the name of the boottarget definition. It is not used by AIX.',
|
||||
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.',
|
||||
osupdatename => 'A comma-separated list of OS distro updates to apply to this osimage.',
|
||||
@@ -748,10 +752,10 @@ policy => {
|
||||
descriptions => {
|
||||
priority => 'The priority value for this rule. This value is used to identify this policy data object (i.e. this rule).',
|
||||
name => 'The username that is allowed to perform the commands specified by this rule. Default is "*" (all users).',
|
||||
host => 'The host from which users may issue the commands specified by this rule. Default is "*" (all hosts).',
|
||||
host => 'The host from which users may issue the commands specified by this rule. Default is "*" (all hosts). Only all or one host supported. ',
|
||||
commands => 'The list of commands that this rule applies to. Default is "*" (all commands).',
|
||||
noderange => 'The Noderange that this rule applies to. Default is "*" (all nodes).',
|
||||
parameters => 'A regular expression that matches the command parameters (everything except the noderange) that this rule applies to. Default is "*" (all parameters).',
|
||||
noderange => 'The Noderange that this rule applies to. Default is "*" (all nodes). Not supported with the *def commands.',
|
||||
parameters => 'A regular expression that matches the command parameters (everything except the noderange) that this rule applies to. Default is "*" (all parameters). Not supported with the *def commands.',
|
||||
time => 'Time ranges that this command may be executed in. This is not supported.',
|
||||
rule => 'Specifies how this rule should be applied. Valid values are: allow, accept, trusted. Allow or accept will allow the user to run the commands. Any other value will deny the user access to the commands. Trusted means that once this client has been authenticated via the certificate, all other information that is sent (e.g. the username) is believed without question. This authorization should only be given to the xcatd on the management node at this time.',
|
||||
comments => 'Any user-written notes.',
|
||||
@@ -818,6 +822,7 @@ ppchcp => {
|
||||
servicenode => {
|
||||
cols => [qw(node nameserver dhcpserver tftpserver nfsserver conserver monserver ldapserver ntpserver ftpserver nimserver ipforward dhcpinterfaces comments disable)],
|
||||
keys => [qw(node)],
|
||||
tablespace =>'XCATTBS16K',
|
||||
table_desc => 'List of all Service Nodes and services that will be set up on the Service Node.',
|
||||
descriptions => {
|
||||
node => 'The hostname of the service node as known by the Management Node.',
|
||||
@@ -982,7 +987,7 @@ site => {
|
||||
" ppctimeout: The timeout, in milliseconds, to use when communicating with PPC hw\n".
|
||||
" through HMC. It only takes effect on the hardware control commands\n".
|
||||
" through HMC. Default is 0.\n\n".
|
||||
" precreatemypostscripts: (yes/1 or no/0, only for Linux).Default is no. If yes, it will \n".
|
||||
" precreatemypostscripts: (yes/1 or no/0). Default is no. If yes, it will \n".
|
||||
" instruct xCAT at nodeset and updatenode time to query the db once for\n".
|
||||
" all of the nodes passed into the cmd and create the mypostscript file\n".
|
||||
" for each node, and put them in a directory of tftpdir(such as: /tftpboot)\n".
|
||||
@@ -1027,6 +1032,16 @@ site => {
|
||||
" virtual network bridge up correctly. See\n".
|
||||
" https://sourceforge.net/apps/mediawiki/xcat/index.php?title=XCAT_Virtualization_with_KVM#Setting_up_a_network_bridge\n\n".
|
||||
" rsh/rcp will be setup and used on AIX. Default is yes.\n\n".
|
||||
" useflowcontrol: (yes/1 or no/0). If yes, the postscript processing on each node\n".
|
||||
" contacts xcatd on the MN/SN using a lightweight UDP packet to wait\n".
|
||||
" until xcatd is ready to handle the requests associated with\n".
|
||||
" postscripts. This prevents deploying nodes from flooding xcatd and\n".
|
||||
" 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".
|
||||
" 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".
|
||||
" useNFSv4onAIX: (yes/1 or no/0). If yes, NFSv4 will be used with NIM. If no,\n".
|
||||
" NFSv3 will be used with NIM. Default is no.\n\n".
|
||||
" vcenterautojoin: When set to no, the VMWare plugin will not attempt to auto remove\n".
|
||||
@@ -1044,6 +1059,8 @@ site => {
|
||||
" 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".
|
||||
" xcatmaxbatchconnections: Number of concurrent xCAT connections allowed from the nodes.\n".
|
||||
" Value must be less than xcatmaxconnections. Default is 50.\n\n".
|
||||
" xcatdport: The port used by the xcatd daemon for client/server communication.\n\n".
|
||||
" xcatiport: The port used by xcatd to receive install status updates from nodes.\n\n",
|
||||
" xcatsslversion: The ssl version by xcatd. Default is SSLv3.\n\n",
|
||||
@@ -1375,7 +1392,7 @@ kitrepo => {
|
||||
},
|
||||
},
|
||||
kitcomponent => {
|
||||
cols => [qw(kitcompname description kitname kitreponame basename version release serverroles kitpkgdeps driverpacks kitcompdeps postbootscripts genimage_postinstall exlist comments disable)],
|
||||
cols => [qw(kitcompname description kitname kitreponame basename version release serverroles kitpkgdeps prerequisite driverpacks kitcompdeps postbootscripts genimage_postinstall exlist comments disable)],
|
||||
keys => [qw(kitcompname)],
|
||||
tablespace =>'XCATTBS16K',
|
||||
table_desc => 'This table stores all kit components added to the xCAT cluster.',
|
||||
@@ -1389,6 +1406,7 @@ kitcomponent => {
|
||||
release => 'Kit Component release.',
|
||||
serverroles => 'The types of servers that this Kit Component can install on. Valid types are: mgtnode, servicenode, compute',
|
||||
kitpkgdeps => 'Comma-separated list of packages that this kit component depends on.',
|
||||
prerequisite => 'Prerequisite for this kit component, the prerequisite includes ospkgdeps,preinstall,preupgrade,preuninstall scripts',
|
||||
driverpacks => 'Comma-separated List of driver package names. These must be full names like: pkg1-1.0-1.x86_64.rpm.',
|
||||
kitcompdeps => 'Comma-separated list of kit components that this kit component depends on.',
|
||||
postbootscripts => 'Comma-separated list of postbootscripts that will run during the node boot.',
|
||||
@@ -1433,6 +1451,37 @@ discoverydata => {
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
},
|
||||
},
|
||||
cfgmgt => {
|
||||
cols => [qw(node cfgmgr cfgserver roles comments disable)],
|
||||
keys => [qw(node)],
|
||||
table_desc => 'Configuration management data for nodes used by non-xCAT osimage management services to install and configure software on a node. ',
|
||||
descriptions => {
|
||||
node => 'The node being managed by the cfgmgr service',
|
||||
cfgmgr => 'The name of the configuration manager service. Currently \'chef\' and \'puppet\' are supported services.',
|
||||
cfgserver => 'The xCAT node name of the chef server or puppet master',
|
||||
roles => 'The roles associated with this node as recognized by the cfgmgr for the software that is to be installed and configured. These role names map to chef recipes or puppet manifest classes that should be used for this node. For example, chef OpenStack cookbooks have roles such as mysql-master,keystone, glance, nova-controller, nova-conductor, cinder-all. ',
|
||||
comments => 'Any user-written notes.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
},
|
||||
},
|
||||
mic => {
|
||||
cols => [qw(node host id nodetype bridge onboot vlog powermgt comments disable)],
|
||||
keys => [qw(node)],
|
||||
table_desc => 'The host, slot id and configuraton of the mic (Many Integrated Core).',
|
||||
descriptions => {
|
||||
node => 'The node name or group name.',
|
||||
host => 'The host node which the mic card installed on.',
|
||||
id => 'The device id of the mic node.',
|
||||
nodetype => 'The hardware type of the mic node. Generally, it is mic.',
|
||||
bridge => 'The virtual bridge on the host node which the mic connected to.',
|
||||
onboot => 'Set mic to autoboot when mpss start. Valid values: yes|no. Default is yes.',
|
||||
vlog => 'Set the Verbose Log to console. Valid values: yes|no. Default is no.',
|
||||
powermgt => 'Set the Power Management for mic node. This attribute is used to set the power management state that mic may get into when it is idle. Four states can be set: cpufreq, corec6, pc3 and pc6. The valid value for powermgt attribute should be [cpufreq=<on|off>]![corec6=<on|off>]![pc3=<on|off>]![pc6=<on|off>]. e.g. cpufreq=on!corec6=off!pc3=on!pc6=off. Refer to the doc of mic to get more information for power management.',
|
||||
comments => 'Any user-provided notes.',
|
||||
disable => "Do not use. tabprune will not work if set to yes or 1",
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
); # end of tabspec definition
|
||||
|
||||
@@ -1510,6 +1559,8 @@ foreach my $tabname (keys(%xCAT::ExtTab::ext_tabspec)) {
|
||||
kitcomponent => { attrs => [], attrhash => {}, objkey => 'kitcompname' },
|
||||
rack => { attrs => [], attrhash => {}, objkey => 'rackname' },
|
||||
osdistro=> { attrs => [], attrhash => {}, objkey => 'osdistroname' },
|
||||
osdistroupdate=> { attrs => [], attrhash => {}, objkey => 'osupdatename' },
|
||||
|
||||
);
|
||||
|
||||
|
||||
@@ -2198,10 +2249,26 @@ my @nodeattrs = (
|
||||
tabentry => 'vm.storage',
|
||||
access_tabentry => 'vm.node=attr:node',
|
||||
},
|
||||
{attr_name => 'vmphyslots',
|
||||
tabentry => 'vm.physlots',
|
||||
access_tabentry => 'vm.node=attr:node',
|
||||
},
|
||||
{attr_name => 'vmothersetting',
|
||||
tabentry => 'vm.othersettings',
|
||||
access_tabentry => 'vm.node=attr:node',
|
||||
},
|
||||
{attr_name => 'vmstoragemodel',
|
||||
tabentry => 'vm.storagemodel',
|
||||
access_tabentry => 'vm.node=attr:node',
|
||||
},
|
||||
{attr_name => 'vmstoragecache',
|
||||
tabentry => 'vm.storagecache',
|
||||
access_tabentry => 'vm.node=attr:node',
|
||||
},
|
||||
{attr_name => 'vmstorageformat',
|
||||
tabentry => 'vm.storageformat',
|
||||
access_tabentry => 'vm.node=attr:node',
|
||||
},
|
||||
{attr_name => 'vmcfgstore',
|
||||
tabentry => 'vm.cfgstore',
|
||||
access_tabentry => 'vm.node=attr:node',
|
||||
@@ -2332,6 +2399,60 @@ my @nodeattrs = (
|
||||
tabentry => 'prescripts.end',
|
||||
access_tabentry => 'prescripts.node=attr:node',
|
||||
},
|
||||
#################
|
||||
# cfgmgt table #
|
||||
#################
|
||||
{attr_name => 'cfgmgr',
|
||||
tabentry => 'cfgmgt.cfgmgr',
|
||||
access_tabentry => 'cfgmgt.node=attr:node',
|
||||
},
|
||||
{attr_name => 'cfgserver',
|
||||
tabentry => 'cfgmgt.cfgserver',
|
||||
access_tabentry => 'cfgmgt.node=attr:node',
|
||||
},
|
||||
{attr_name => 'cfgmgtroles',
|
||||
tabentry => 'cfgmgt.roles',
|
||||
access_tabentry => 'cfgmgt.node=attr:node',
|
||||
},
|
||||
#####################
|
||||
## mic table #
|
||||
#####################
|
||||
{attr_name => 'michost',
|
||||
only_if => 'mgt=mic',
|
||||
tabentry => 'mic.host',
|
||||
access_tabentry => 'mic.node=attr:node',
|
||||
},
|
||||
{attr_name => 'micid',
|
||||
only_if => 'mgt=mic',
|
||||
tabentry => 'mic.id',
|
||||
access_tabentry => 'mic.node=attr:node',
|
||||
},
|
||||
{attr_name => 'hwtype',
|
||||
only_if => 'mgt=mic',
|
||||
tabentry => 'mic.nodetype',
|
||||
access_tabentry => 'mic.node=attr:node',
|
||||
},
|
||||
{attr_name => 'micbridge',
|
||||
only_if => 'mgt=mic',
|
||||
tabentry => 'mic.bridge',
|
||||
access_tabentry => 'mic.node=attr:node',
|
||||
},
|
||||
{attr_name => 'miconboot',
|
||||
only_if => 'mgt=mic',
|
||||
tabentry => 'mic.onboot',
|
||||
access_tabentry => 'mic.node=attr:node',
|
||||
},
|
||||
{attr_name => 'micvlog',
|
||||
only_if => 'mgt=mic',
|
||||
tabentry => 'mic.vlog',
|
||||
access_tabentry => 'mic.node=attr:node',
|
||||
},
|
||||
{attr_name => 'micpowermgt',
|
||||
only_if => 'mgt=mic',
|
||||
tabentry => 'mic.powermgt',
|
||||
access_tabentry => 'mic.node=attr:node',
|
||||
},
|
||||
|
||||
); # end of @nodeattrs that applies to both nodes and groups
|
||||
|
||||
|
||||
@@ -3138,7 +3259,7 @@ push(@{$defspec{group}->{'attrs'}}, @nodeattrs);
|
||||
access_tabentry => 'firmware.file=attr:cfgfile',
|
||||
},
|
||||
{attr_name => 'disable',
|
||||
tabentry => 'auditlog.disable',
|
||||
tabentry => 'firmware.disable',
|
||||
access_tabentry => 'firmware.file=attr:cfgfile',
|
||||
},
|
||||
);
|
||||
@@ -3177,6 +3298,35 @@ push(@{$defspec{group}->{'attrs'}}, @nodeattrs);
|
||||
},
|
||||
);
|
||||
|
||||
#############################
|
||||
# osdistroupdate object #
|
||||
#############################
|
||||
@{$defspec{osdistroupdate}->{'attrs'}} = (
|
||||
{attr_name => 'osupdatename',
|
||||
tabentry => 'osdistroupdate.osupdatename',
|
||||
access_tabentry => 'osdistroupdate.osupdatename=attr:osupdatename',
|
||||
},
|
||||
{attr_name => 'osdistroname',
|
||||
tabentry => 'osdistroupdate.osdistroname',
|
||||
access_tabentry => 'osdistroupdate.osupdatename=attr:osupdatename',
|
||||
},
|
||||
{attr_name => 'dirpath',
|
||||
tabentry => 'osdistroupdate.dirpath',
|
||||
access_tabentry => 'osdistroupdate.osupdatename=attr:osupdatename',
|
||||
},
|
||||
{attr_name => 'downloadtime',
|
||||
tabentry => 'osdistroupdate.downloadtime',
|
||||
access_tabentry => 'osdistroupdate.osupdatename=attr:osupdatename',
|
||||
},
|
||||
{attr_name => 'usercomment',
|
||||
tabentry => 'osdistroupdate.comments',
|
||||
access_tabentry => 'osdistroupdate.osupdatename=attr:osupdatename',
|
||||
},
|
||||
);
|
||||
|
||||
#############################
|
||||
# kit object #
|
||||
#############################
|
||||
#############################
|
||||
# kit object #
|
||||
#############################
|
||||
@@ -3187,8 +3337,8 @@ push(@{$defspec{group}->{'attrs'}}, @nodeattrs);
|
||||
tabentry => 'kit.kitname',
|
||||
access_tabentry => 'kit.kitname=attr:kitname',
|
||||
},
|
||||
{attr_name => 'name',
|
||||
tabentry => 'kit.name',
|
||||
{attr_name => 'basename',
|
||||
tabentry => 'kit.basename',
|
||||
access_tabentry => 'kit.kitname=attr:kitname',
|
||||
},
|
||||
{attr_name => 'description',
|
||||
|
||||
@@ -30,7 +30,6 @@ use strict;
|
||||
Example:
|
||||
my $retdata = xCAT::ServiceNodeUtils->readSNInfo;
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub readSNInfo
|
||||
{
|
||||
@@ -102,13 +101,17 @@ sub isServiceReq
|
||||
require xCAT::Table;
|
||||
my ($class, $servicenodename, $serviceip) = @_;
|
||||
|
||||
# list of all services from service node table
|
||||
# note this must be updated if more services added
|
||||
my @services = (
|
||||
"nameserver", "dhcpserver", "tftpserver", "nfsserver",
|
||||
"conserver", "monserver", "ldapserver", "ntpserver",
|
||||
"ftpserver", "ipforward"
|
||||
);
|
||||
# get list of all services from service node table ( actually all defined attributes)
|
||||
# read the schema
|
||||
my $schema = xCAT::Table->getTableSchema("servicenode");
|
||||
my @services; # list of only the actual service attributes from the servicenode table
|
||||
my @servicesattrs; # building second copy for call to getAllNodeAttribs, which modifies the array
|
||||
foreach my $c (@{$schema->{cols}}) {
|
||||
if (($c ne "node") && ($c ne "comments") && ($c ne "disable")) {
|
||||
push @servicesattrs,$c;
|
||||
push @services,$c;
|
||||
}
|
||||
}
|
||||
|
||||
my @ips = @$serviceip; # list of service node ip addresses and names
|
||||
my $rc = 0;
|
||||
@@ -139,10 +142,11 @@ sub isServiceReq
|
||||
}
|
||||
|
||||
my $servicehash;
|
||||
# read all the nodes from the table, for each service
|
||||
foreach my $service (@services)
|
||||
|
||||
# read all the nodes from the table, all the service attributes
|
||||
my @snodelist= $servicenodetab->getAllNodeAttribs(\@servicesattrs);
|
||||
foreach my $service (@services) # check list of services
|
||||
{
|
||||
my @snodelist = $servicenodetab->getAllNodeAttribs([$service]);
|
||||
|
||||
foreach $serviceip (@ips) # check the table for this servicenode
|
||||
{
|
||||
@@ -238,12 +242,13 @@ sub getAllSN
|
||||
# if did not input "ALL" and there is a MN, remove it
|
||||
my @newservicenodes;
|
||||
if ((!defined($options)) || ($options ne "ALL")) {
|
||||
my $mname = xCAT::Utils->noderangecontainsMn(@servicenodes);
|
||||
if ($mname) { # if there is a MN
|
||||
foreach my $nodes (@servicenodes) {
|
||||
if ($mname ne ($nodes)){
|
||||
push @newservicenodes, $nodes;
|
||||
}
|
||||
my @mname = xCAT::Utils->noderangecontainsMn(@servicenodes);
|
||||
if (@mname) { # if there is a MN
|
||||
foreach my $node (@servicenodes) {
|
||||
# check to see if node in MN list
|
||||
if (!(grep(/^$node$/, @mname))) { # if node not in the MN array
|
||||
push @newservicenodes, $node;
|
||||
}
|
||||
}
|
||||
$servicenodetab->close;
|
||||
return @newservicenodes; # return without the MN in the array
|
||||
@@ -351,7 +356,7 @@ sub getSNList
|
||||
$servicenodetab->close;
|
||||
foreach my $node (@nodes)
|
||||
{
|
||||
if ($service eq "") # want all the service nodes
|
||||
if (! defined ($service) || ($service eq "")) # want all the service nodes
|
||||
{
|
||||
push @servicenodes, $node->{node};
|
||||
}
|
||||
|
||||
+105
-72
@@ -70,7 +70,7 @@ require xCAT::NotifHandler;
|
||||
|
||||
my $dbworkerpid; #The process id of the database worker
|
||||
my $dbworkersocket;
|
||||
my $dbsockpath = "/tmp/xcat/dbworker.sock.".$$;
|
||||
my $dbsockpath = "/var/run/xcat/dbworker.sock.".$$;
|
||||
my $exitdbthread;
|
||||
my $dbobjsforhandle;
|
||||
my $intendedpid;
|
||||
@@ -159,7 +159,7 @@ sub init_dbworker {
|
||||
#This process is the database worker, it's job is to manage database queries to reduce required handles and to permit cross-process caching
|
||||
$0 = "xcatd: DB Access";
|
||||
use File::Path;
|
||||
mkpath('/tmp/xcat/');
|
||||
mkpath('/var/run/xcat/');
|
||||
use IO::Socket;
|
||||
$SIG{TERM} = $SIG{INT} = sub {
|
||||
$exitdbthread=1;
|
||||
@@ -323,6 +323,8 @@ sub handle_dbc_request {
|
||||
return $opentables{$tablename}->{$autocommit}->getAllNodeAttribs(@args);
|
||||
} elsif ($functionname eq 'getAllEntries') {
|
||||
return $opentables{$tablename}->{$autocommit}->getAllEntries(@args);
|
||||
} elsif ($functionname eq 'getMAXMINEntries') {
|
||||
return $opentables{$tablename}->{$autocommit}->getMAXMINEntries(@args);
|
||||
} elsif ($functionname eq 'writeAllEntries') {
|
||||
return $opentables{$tablename}->{$autocommit}->writeAllEntries(@args);
|
||||
} elsif ($functionname eq 'getAllAttribsWhere') {
|
||||
@@ -1603,7 +1605,7 @@ sub setAttribs
|
||||
# delimit the columns of the table
|
||||
my $delimitedcol = &delimitcol($col);
|
||||
$cols = $cols . $delimitedcol . " = ?,";
|
||||
push @bind, (($$elems{$col} =~ /NULL/) ? undef: $$elems{$col});
|
||||
push @bind, (($$elems{$col} eq "NULL") ? undef: $$elems{$col});
|
||||
}
|
||||
chop($cols);
|
||||
my $cmd ;
|
||||
@@ -1786,7 +1788,7 @@ sub setAttribsWhere
|
||||
# delimit the columns of the table
|
||||
my $delimitedcol = &delimitcol($col);
|
||||
$cols = $cols . $delimitedcol . " = ?,";
|
||||
push @bind, (($$elems{$col} =~ /NULL/) ? undef: $$elems{$col});
|
||||
push @bind, (($$elems{$col} eq "NULL") ? undef: $$elems{$col});
|
||||
}
|
||||
chop($cols);
|
||||
my $cmd = "UPDATE " . $self->{tabname} . " set $cols where " . $where_clause;
|
||||
@@ -2349,71 +2351,6 @@ sub getNodeAttribs
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
|
||||
=head3 getNodeSpecAttribs
|
||||
Description: Retrieves the requested attributes which matching the specified options for a node
|
||||
Arguments:
|
||||
Noderange
|
||||
The specified options
|
||||
List of attributes
|
||||
Return:
|
||||
Attribute hash
|
||||
Example:
|
||||
my $tab = xCAT::Table->new('ppcdirect');
|
||||
my $ent = $tab->getNodeSpecAttribs($node, {username=>'HMC'}, qw/password/);
|
||||
Comments:
|
||||
The keys of the specified options can be given in the list of attributes or not,
|
||||
this routine will deal with them.
|
||||
=cut
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
|
||||
#sub getNodeSpecAttribs {
|
||||
# my $self = shift;
|
||||
# my $node = shift;
|
||||
# my %options = ();
|
||||
# my @attribs = ();
|
||||
# my @keys = ();
|
||||
# if (ref $_[0] eq 'HASH') {
|
||||
# %options = %{shift()};
|
||||
# @attribs = @_;
|
||||
# foreach my $key (keys %options) {
|
||||
# if (!grep(/^$key$/, @attribs)) {
|
||||
# push @attribs, $key;
|
||||
# }
|
||||
# }
|
||||
# } else {
|
||||
# @attribs = @_;
|
||||
# }
|
||||
# if ((keys (%options)) == 0) {
|
||||
# my $ent = $self->getNodeAttribs($node, \@attribs);
|
||||
# return $ent;
|
||||
# } else {
|
||||
# my $nodekey = "node";
|
||||
# if (defined $xCAT::Schema::tabspec{$self->{tabname}}->{nodecol}) {
|
||||
# $nodekey = $xCAT::Schema::tabspec{$self->{tabname}}->{nodecol};
|
||||
# }
|
||||
# $options{$nodekey} = $node;
|
||||
# my $ent = $self->getAttribs(\%options, \@attribs);
|
||||
# if ($ent) {
|
||||
# return $ent;
|
||||
# }
|
||||
# my ($nodeghash) = $self->{nodelist}->getAttribs({node=>$node}, "groups");
|
||||
# unless(defined($nodeghash) && defined($nodeghash->{groups})) {
|
||||
# return undef;
|
||||
# }
|
||||
# my @nodegroups = split(/,/, $nodeghash->{groups});
|
||||
# foreach my $group (@nodegroups) {
|
||||
# $options{$nodekey} = $group;
|
||||
# my $g_ret = $self->getAttribs(\%options, \@attribs);
|
||||
# if ($g_ret) {
|
||||
# return $g_ret;
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# return undef;
|
||||
#}
|
||||
#--------------------------------------------------------------------------
|
||||
|
||||
=head3 getNodeAttribs_nosub
|
||||
|
||||
Description:
|
||||
@@ -2967,10 +2904,14 @@ sub getAllNodeAttribs
|
||||
$self->{nrcache}->{$data->{$nodekey}}->{tstamp} = time();
|
||||
}
|
||||
@nodes = @{$self->{nrcache}->{$data->{$nodekey}}->{value}}; #expand node entry, to make groups expand
|
||||
unless (@nodes) { #in the event of an entry not in nodelist, use entry value verbatim
|
||||
@nodes = ($data->{$nodekey});
|
||||
}
|
||||
|
||||
#If node not in nodelist do not add to the hash (SF 3580)
|
||||
#unless (@nodes) { #in the event of an entry not in nodelist, use entry value verbatim
|
||||
# @nodes = ($data->{$nodekey});
|
||||
#} end SF 3580
|
||||
|
||||
#my $localhash = $self->getNodesAttribs(\@nodes,$attribq); #NOTE: This is stupid, rebuilds the cache for every entry, FIXME
|
||||
|
||||
foreach (@nodes)
|
||||
{
|
||||
if ($donenodes{$_}) { next; }
|
||||
@@ -4049,5 +3990,97 @@ sub output_table {
|
||||
print $fh "\n";
|
||||
return 0;
|
||||
}
|
||||
#--------------------------------------------------------------------------
|
||||
|
||||
=head3 getMAXMINEntries
|
||||
|
||||
Description: Select the rows in the Table which has the MAX and the row with the
|
||||
Min value for the input attribute.
|
||||
Currently only the auditlog and evenlog are setup to have such an attribute (recid).
|
||||
|
||||
Arguments:
|
||||
Table handle
|
||||
attribute name ( e.g. recid)
|
||||
|
||||
Returns:
|
||||
HASH
|
||||
max=> max value
|
||||
min=> min value
|
||||
Globals:
|
||||
|
||||
Error:
|
||||
|
||||
Example:
|
||||
|
||||
my $tabh = xCAT::Table->new($table);
|
||||
my $recs=$tabh->getMAXMINEntries("recid");
|
||||
|
||||
Comments:
|
||||
none
|
||||
|
||||
=cut
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
sub getMAXMINEntries
|
||||
{
|
||||
my $self = shift;
|
||||
if ($dbworkerpid) {
|
||||
return dbc_call($self,'getMAXMINEntries',@_);
|
||||
}
|
||||
my $attr = shift;
|
||||
my $rets;
|
||||
my $query;
|
||||
my $xcatcfg=get_xcatcfg();
|
||||
# delimit the disable column based on the DB
|
||||
my $disable= &delimitcol("disable");
|
||||
my $qstring;
|
||||
if ($xcatcfg =~ /^DB2:/) { # for DB2
|
||||
$qstring = "SELECT MAX (\"$attr\") FROM " . $self->{tabname} . " WHERE " . $disable . " is NULL or " . $disable . " in ('0','no','NO','No','nO')";
|
||||
} else {
|
||||
$qstring = "SELECT MAX($attr) FROM " . $self->{tabname} . " WHERE " . $disable . " is NULL or " . $disable . " in ('0','no','NO','No','nO')";
|
||||
}
|
||||
$query = $self->{dbh}->prepare($qstring);
|
||||
|
||||
$query->execute();
|
||||
while (my $data = $query->fetchrow_hashref())
|
||||
{
|
||||
foreach (keys %$data)
|
||||
{
|
||||
if ($data->{$_} =~ /^$/)
|
||||
{
|
||||
$rets->{"max"} = undef;
|
||||
} else {
|
||||
$rets->{"max"} = $data->{$_};
|
||||
|
||||
}
|
||||
last; # better only be one value for max
|
||||
|
||||
}
|
||||
}
|
||||
$query->finish();
|
||||
if ($xcatcfg =~ /^DB2:/) { # for DB2
|
||||
$qstring = "SELECT MIN (\"$attr\") FROM " . $self->{tabname} . " WHERE " . $disable . " is NULL or " . $disable . " in ('0','no','NO','No','nO')";
|
||||
} else {
|
||||
$qstring = "SELECT MIN($attr) FROM " . $self->{tabname} . " WHERE " . $disable . " is NULL or " . $disable . " in ('0','no','NO','No','nO')";
|
||||
}
|
||||
$query = $self->{dbh}->prepare($qstring);
|
||||
|
||||
$query->execute();
|
||||
while (my $data = $query->fetchrow_hashref())
|
||||
{
|
||||
foreach (keys %$data)
|
||||
{
|
||||
if ($data->{$_} =~ /^$/)
|
||||
{
|
||||
$rets->{"min"} = undef;
|
||||
} else {
|
||||
$rets->{"min"} = $data->{$_};
|
||||
}
|
||||
last; # better be only one value for min
|
||||
}
|
||||
}
|
||||
return $rets;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
+139
-18
@@ -257,6 +257,7 @@ sub bldnonrootSSHFiles
|
||||
|
||||
Arguments:
|
||||
Array of nodes
|
||||
Timeout for expect call (optional)
|
||||
Returns:
|
||||
|
||||
Env Variables: $DSH_FROM_USERID, $DSH_TO_USERID, $DSH_REMOTE_PASSWORD
|
||||
@@ -281,7 +282,7 @@ sub bldnonrootSSHFiles
|
||||
#--------------------------------------------------------------------------------
|
||||
sub setupSSH
|
||||
{
|
||||
my ($class, $ref_nodes) = @_;
|
||||
my ($class, $ref_nodes,$expecttimeout) = @_;
|
||||
my @nodes = $ref_nodes;
|
||||
my @badnodes = ();
|
||||
my $n_str = $nodes[0];
|
||||
@@ -349,8 +350,9 @@ sub setupSSH
|
||||
}
|
||||
|
||||
# generates new keys for root, if they do not already exist
|
||||
# nodes not used on this option but in there to preserve the interface
|
||||
my $rc=
|
||||
xCAT::RemoteShellExp->remoteshellexp("k",$::CALLBACK,$::REMOTE_SHELL);
|
||||
xCAT::RemoteShellExp->remoteshellexp("k",$::CALLBACK,$::REMOTE_SHELL,$n_str,$expecttimeout);
|
||||
if ($rc != 0) {
|
||||
$rsp->{data}->[0] = "remoteshellexp failed generating keys.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
|
||||
@@ -442,7 +444,7 @@ rmdir \"/tmp/$to_userid\" \n";
|
||||
if ($enablenodes) { # node on list to setup nodetonodessh
|
||||
chop $enablenodes; # remove last comma
|
||||
$ENV{'DSH_ENABLE_SSH'} = "YES";
|
||||
my $rc=xCAT::RemoteShellExp->remoteshellexp("s",$::CALLBACK,"/usr/bin/ssh",$enablenodes);
|
||||
my $rc=xCAT::RemoteShellExp->remoteshellexp("s",$::CALLBACK,"/usr/bin/ssh",$enablenodes,$expecttimeout);
|
||||
if ($rc != 0)
|
||||
{
|
||||
$rsp->{data}->[0] = "remoteshellexp failed sending keys to enablenodes.";
|
||||
@@ -452,7 +454,7 @@ rmdir \"/tmp/$to_userid\" \n";
|
||||
}
|
||||
if ($disablenodes) { # node on list to setup nodetonodessh
|
||||
chop $disablenodes; # remove last comma
|
||||
my $rc=xCAT::RemoteShellExp->remoteshellexp("s",$::CALLBACK,"/usr/bin/ssh",$disablenodes);
|
||||
my $rc=xCAT::RemoteShellExp->remoteshellexp("s",$::CALLBACK,"/usr/bin/ssh",$disablenodes,$expecttimeout);
|
||||
if ($rc != 0)
|
||||
{
|
||||
$rsp->{data}->[0] = "remoteshellexp failed sending keys to disablenodes.";
|
||||
@@ -462,7 +464,7 @@ rmdir \"/tmp/$to_userid\" \n";
|
||||
}
|
||||
} else { # from user is not root or it is a device , always send private key
|
||||
$ENV{'DSH_ENABLE_SSH'} = "YES";
|
||||
my $rc=xCAT::RemoteShellExp->remoteshellexp("s",$::CALLBACK,"/usr/bin/ssh",$n_str);
|
||||
my $rc=xCAT::RemoteShellExp->remoteshellexp("s",$::CALLBACK,"/usr/bin/ssh",$n_str,$expecttimeout);
|
||||
if ($rc != 0)
|
||||
{
|
||||
$rsp->{data}->[0] = "remoteshellexp failed sending keys.";
|
||||
@@ -476,7 +478,7 @@ rmdir \"/tmp/$to_userid\" \n";
|
||||
foreach my $n (@testnodes)
|
||||
{
|
||||
my $rc=
|
||||
xCAT::RemoteShellExp->remoteshellexp("t",$::CALLBACK,"/usr/bin/ssh",$n);
|
||||
xCAT::RemoteShellExp->remoteshellexp("t",$::CALLBACK,"/usr/bin/ssh",$n,$expecttimeout);
|
||||
if ($rc != 0)
|
||||
{
|
||||
push @badnodes, $n;
|
||||
@@ -1498,19 +1500,10 @@ sub enablessh
|
||||
my ($class, $node) = @_;
|
||||
my $enablessh=1;
|
||||
|
||||
if( %::GLOBAL_SN_HASH ) {
|
||||
if ($::GLOBAL_SN_HASH{$node} == 1) {
|
||||
if( xCAT::Utils->isSN($node) ) {
|
||||
$enablessh=1; # service nodes always enabled
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
if (xCAT::Utils->isSN($node))
|
||||
{
|
||||
$enablessh=1; # service nodes always enabled
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
# if not a service node we need to check, before enabling
|
||||
my $values;
|
||||
my @vals = xCAT::TableUtils->get_site_attribute("sshbetweennodes");
|
||||
@@ -1554,12 +1547,93 @@ sub enablessh
|
||||
$enablessh=1;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return $enablessh;
|
||||
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 enableSSH
|
||||
Description:
|
||||
The function is same as enablessh() above. Before using this function,
|
||||
the $sn_hash for noderange, and $groups_hash for site.sshbetweennodes should be
|
||||
got. This is performance improvement.
|
||||
Arguments:
|
||||
$node -- node name
|
||||
$sn_hash -- if the node is one sn, key is the node name, and value is 1.
|
||||
if the node is not a sn, the key isn't in this hash
|
||||
$groups_hash -- there are two keys:
|
||||
1. Each group in the value of site.sshbetweennodes could be the key
|
||||
2. Each node in the groups from the value of site.sshbetweennodes , if the
|
||||
value isn't ALLGROUPS or NOGROUPS.
|
||||
|
||||
Returns:
|
||||
1 = enable ssh
|
||||
0 = do not enable ssh
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my $enable = xCAT::TableUtils->enableSSH($node);
|
||||
Comments:
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
sub enableSSH
|
||||
{
|
||||
|
||||
my ($class, $node, $sn_hash, $groups_hash) = @_;
|
||||
my $enablessh=1;
|
||||
|
||||
if( defined($sn_hash) && defined($sn_hash->{node}) && $sn_hash->{$node} == 1 ) {
|
||||
$enablessh=1; # service nodes always enabled
|
||||
|
||||
} else {
|
||||
# if not a service node we need to check, before enabling
|
||||
if (defined($groups_hash)) {
|
||||
if ($groups_hash->{ALLGROUPS} == 1)
|
||||
{
|
||||
$enablessh=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($groups_hash->{NOGROUPS} == 1)
|
||||
{
|
||||
$enablessh=0;
|
||||
}
|
||||
else
|
||||
{ # check to see if the node is a member of a group
|
||||
my $ismember = 0;
|
||||
$ismember = $groups_hash->{$node};
|
||||
|
||||
if ($ismember == 1)
|
||||
{
|
||||
$enablessh=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$enablessh=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ # does not exist, set default
|
||||
$enablessh=1;
|
||||
|
||||
}
|
||||
}
|
||||
return $enablessh;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
@@ -1663,4 +1737,51 @@ sub getimagenames()
|
||||
$nodetab->close;
|
||||
return @imagenames;
|
||||
}
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
=head3 updatenodegroups
|
||||
Update groups attribute for the specified node
|
||||
|
||||
Arguments:
|
||||
node
|
||||
tabhd: the handler of 'nodelist' table,
|
||||
groups: the groups attribute need to be merged.
|
||||
Can be an array or string.
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
Example:
|
||||
xCAT::TableUtils->updatenodegroups($node, $tab, $groups);
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
sub updatenodegroups {
|
||||
my ($class, $node, $tabhd, $groups) = @_;
|
||||
if (!$groups) {
|
||||
$groups = $tabhd;
|
||||
$tabhd = xCAT::Table->new('nodelist');
|
||||
unless ($tabhd) {
|
||||
xCAT::MsgUtils->message("E", " Could not read the nodelist table\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
my ($ent) = $tabhd->getNodeAttribs($node, ['groups']);
|
||||
my @list = qw(all);
|
||||
if (defined($ent) and $ent->{groups}) {
|
||||
push @list, split(/,/,$ent->{groups});
|
||||
}
|
||||
if (ref($groups) eq 'ARRAY') {
|
||||
push @list, @$groups;
|
||||
} else {
|
||||
push @list, split(/,/,$groups);
|
||||
}
|
||||
my %saw;
|
||||
@saw{@list} = ();
|
||||
@list = keys %saw;
|
||||
$tabhd->setNodeAttribs($node, {groups=>join(",",@list)});
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
+35
-14
@@ -41,6 +41,8 @@ my %usage = (
|
||||
rpower <noderange> [cycle|softoff] [-V|--verbose]
|
||||
zVM specific:
|
||||
rpower noderange [on|off|reset|stat|softoff]
|
||||
MIC specific:
|
||||
rpower noderange [stat|state|on|off|reset|boot]
|
||||
",
|
||||
"rbeacon" =>
|
||||
"Usage: rbeacon <noderange> [on|off|stat] [-V|--verbose]
|
||||
@@ -58,7 +60,9 @@ my %usage = (
|
||||
Blade specific:
|
||||
rvitals noderange {temp|wattage|fanspeed|leds|summary|all}
|
||||
BMC specific:
|
||||
rvitals noderange {temp|voltage|wattage|fanspeed|power|leds|lcds|summary|all}",
|
||||
rvitals noderange {temp|voltage|wattage|fanspeed|power|leds|lcds|summary|all}
|
||||
MIC specific:
|
||||
rvitals noderange {thermal|all}",
|
||||
"reventlog" =>
|
||||
"Usage: reventlog <noderange> [all [-s]|clear|<number of entries to retrieve> [-s]] [-V|--verbose]
|
||||
reventlog [-h|--help|-v|--version]",
|
||||
@@ -68,22 +72,24 @@ my %usage = (
|
||||
rinv <noderange> [all|model|serial] [-V|--verbose]
|
||||
rinv [-h|--help|-v|--version]
|
||||
BMC specific:
|
||||
rinv <noderange> [vpd|mprom|deviceid|uuid|guid]
|
||||
rinv <noderange> [mprom|deviceid|uuid|guid|vpd [-t]|all [-t]]
|
||||
MPA specific:
|
||||
rinv <noderange> [firm|bios|diag|mprom|sprom|mparom|mac|mtm]
|
||||
rinv <noderange> [firm|bios|diag|mprom|sprom|mparom|mac|mtm [-t]]
|
||||
PPC specific(with HMC):
|
||||
rinv <noderange> [bus|config|serial|model|firm|all]
|
||||
rinv <noderange> [all|bus|config|serial|model|firm [-t]]
|
||||
PPC specific(using Direct FSP Management):
|
||||
rinv <noderange> [firm]
|
||||
rinv <noderange> [deconfig [-x]]
|
||||
Blade specific:
|
||||
rinv <noderange> [mtm|serial|mac|bios|diag|mprom|mparom|firm|all]
|
||||
rinv <noderange> [all|serial|mac|bios|diag|mprom|mparom|firm|mtm [-t]]
|
||||
IBM Flex System Compute Node specific:
|
||||
rinv <noderange> [firm]
|
||||
VMware specific:
|
||||
rinv <noderange>
|
||||
zVM specific:
|
||||
rinv noderange [all|config]",
|
||||
rinv noderange [all|config]
|
||||
MIC specific:
|
||||
rinv noderange [system|ver|board|core|gddr|all]",
|
||||
"rsetboot" =>
|
||||
"Usage: rsetboot <noderange> [net|hd|cd|floppy|def|stat] [-V|--verbose]
|
||||
rsetboot [-h|--help|-v|--version]",
|
||||
@@ -193,10 +199,14 @@ my %usage = (
|
||||
"Usage:
|
||||
Common:
|
||||
mkvm [-h|--help|-v|--version]
|
||||
For PPC(with HMC):
|
||||
For PPC(with HMC) specific:
|
||||
mkvm noderange -i id -l singlenode [-V|--verbose]
|
||||
mkvm noderange -c destcec -p profile [-V|--verbose]
|
||||
mkvm noderange --full [-V|--verbose]
|
||||
PPC (using Direct FSP Management) specific:
|
||||
mkvm noderange [--full]
|
||||
mkvm noderange [vmcpus=min/req/max] [vmmemory=min/req/max]
|
||||
[vmphyslots=drc_index1,drc_index2...] [vmothersetting=hugepage:N,bsr:N]
|
||||
For KVM
|
||||
mkvm noderange -m|--master mastername -s|--size disksize -f|--force
|
||||
For zVM
|
||||
@@ -210,7 +220,8 @@ my %usage = (
|
||||
PPC (with HMC) specific:
|
||||
lsvm <noderange> [-a|--all]
|
||||
PPC (using Direct FSP Management) specific:
|
||||
lsvm <noderange> [-l|--long]
|
||||
lsvm <noderange> [-l|--long] --p775
|
||||
lsvm <noderange>
|
||||
zVM specific:
|
||||
lsvm noderange
|
||||
lsvm noderange --getnetworknames
|
||||
@@ -225,9 +236,11 @@ my %usage = (
|
||||
chvm <noderange> [-p profile][-V|--verbose]
|
||||
chvm <noderange> <attr>=<val> [<attr>=<val>...]
|
||||
PPC (using Direct FSP Management) specific:
|
||||
chvm <noderange> [-p <profile>]
|
||||
chvm <noderange> --p775 [-p <profile>]
|
||||
chvm <noderange> --p775 -i <id> [-m <memory_interleaving>] -r <partition_rule>
|
||||
chvm <noderange> [lparname=<*|name>]
|
||||
chvm <noderange> -i <id> [-m <memory_interleaving>] -r <partition_rule>
|
||||
chvm <noderange> [vmcpus=min/req/max] [vmmemory=min/req/max]
|
||||
[vmphyslots=drc_index1,drc_index2...] [vmothersetting=hugepage:N,bsr:N]
|
||||
VMware specific:
|
||||
chvm <noderange> [-a size][-d disk][-p disk][--resize disk=size][--cpus count][--mem memory]
|
||||
zVM specific:
|
||||
@@ -258,7 +271,9 @@ my %usage = (
|
||||
"rmvm" =>
|
||||
"Usage: rmvm <noderange> [--service][-V|--verbose]
|
||||
rmvm [-h|--help|-v|--version],
|
||||
rmvm [-p] [-f]",
|
||||
rmvm [-p] [-f]
|
||||
PPC (using Direct FSP Management) specific:
|
||||
rmvm <noderange>",
|
||||
"lsslp" =>
|
||||
"Usage: lsslp [-h|--help|-v|--version]
|
||||
lsslp [<noderange>][-V|--verbose][-i ip[,ip..]][-w][-r|-x|-z][-n][-I][-s FRAME|CEC|MM|IVM|RSA|HMC|CMM|IMM2|FSP]
|
||||
@@ -337,11 +352,11 @@ my %usage = (
|
||||
renergy noderange [-V] { cappingstatus={on | enable | off | disable} | {cappingwatt|cappingvalue}=watt }",
|
||||
"updatenode" =>
|
||||
"Usage:
|
||||
updatenode [-h|--help|-v|--version]
|
||||
updatenode [-h|--help|-v|--version | -g|--genmypost]
|
||||
or
|
||||
updatenode <noderange> [-V|--verbose] [-k|--security] [-s|--sn]
|
||||
updatenode <noderange> [-V|--verbose] [-k|--security] [-s|--sn] [-t <timeout>]
|
||||
or
|
||||
updatenode <noderange> [-V|--verbose] [-F|--sync | -f|--snsync] [-l|--user[username]] [--fanout=[fanout value]] [-S|--sw]
|
||||
updatenode <noderange> [-V|--verbose] [-F|--sync | -f|--snsync] [-l|--user[username]] [--fanout=[fanout value]] [-S|--sw] [-t <timeout>]
|
||||
[-P|--scripts [script1,script2,...]] [-s|--sn]
|
||||
[-A|--updateallsw] [-c|--cmdlineonly] [-d alt_source_dir]
|
||||
[attr=val [attr=val...]]
|
||||
@@ -362,6 +377,9 @@ Options:
|
||||
[-f|--snsync] Performs File Syncing to the service nodes that service
|
||||
the nodes in the noderange.
|
||||
|
||||
[-g|--genmypost] Will generate a new mypostscript file for the
|
||||
the nodes in the noderange, if site precreatemypostscripts is 1 or YES.
|
||||
|
||||
[-l|--user] User name to run the updatenode command. It overrides the
|
||||
current user which is the default.
|
||||
|
||||
@@ -375,6 +393,9 @@ Options:
|
||||
|
||||
[-s|--sn] Set the server information stored on the nodes.
|
||||
|
||||
[-t|--timeout] Time out in seconds to allow the command to run. Default is no timeout,
|
||||
except for updatenode -k which has a 10 second default timeout.
|
||||
|
||||
[-A|--updateallsw] Install or update all software contained in the source
|
||||
directory. (AIX only)
|
||||
|
||||
|
||||
+107
-14
@@ -21,10 +21,13 @@ use File::Path;
|
||||
use Socket;
|
||||
use strict;
|
||||
use Symbol;
|
||||
my $sha1support = eval {
|
||||
require Digest::SHA1;
|
||||
1;
|
||||
};
|
||||
my $sha1support;
|
||||
if ( -f "/etc/debian_version" ){
|
||||
$sha1support = eval {require Digest::SHA; 1;};
|
||||
}
|
||||
else {
|
||||
$sha1support = eval { require Digest::SHA1; 1;};
|
||||
}
|
||||
use IPC::Open3;
|
||||
use IO::Select;
|
||||
use xCAT::GlobalDef;
|
||||
@@ -176,7 +179,13 @@ sub genUUID
|
||||
return $uuid;
|
||||
} elsif ($args{url} and $sha1support) { #generate a UUIDv5 from URL
|
||||
#6ba7b810-9dad-11d1-80b4-00c04fd430c8 is the uuid for URL namespace
|
||||
my $sum = Digest::SHA1::sha1('6ba7b810-9dad-11d1-80b4-00c04fd430c8'.$args{url});
|
||||
my $sum = '';
|
||||
if ( -f "/etc/debian_version" ){
|
||||
$sum = Digest::SHA::sha1('6ba7b810-9dad-11d1-80b4-00c04fd430c8'.$args{url});
|
||||
}
|
||||
else{
|
||||
$sum = Digest::SHA1::sha1('6ba7b810-9dad-11d1-80b4-00c04fd430c8'.$args{url});
|
||||
}
|
||||
my @data = unpack("C*",$sum);
|
||||
splice @data,16;
|
||||
$data[6] = $data[6] & 0xf;
|
||||
@@ -1307,6 +1316,10 @@ sub runxcmd_output
|
||||
{
|
||||
push @$::xcmd_outref, @{$resp->{data}};
|
||||
}
|
||||
if (defined($resp->{status}))
|
||||
{
|
||||
push @$::xcmd_outref, @{$resp->{status}};
|
||||
}
|
||||
if (defined($resp->{node}))
|
||||
{
|
||||
my $node = $resp->{node}->[0];
|
||||
@@ -1378,6 +1391,10 @@ sub runxcmd_output2
|
||||
{
|
||||
push @{$::xcmd_outref_hash->{data}}, @{$resp->{data}};
|
||||
}
|
||||
if (defined($resp->{status}))
|
||||
{
|
||||
push @{$::xcmd_outref_hash->{status}}, @{$resp->{status}};
|
||||
}
|
||||
if (defined($resp->{node}))
|
||||
{
|
||||
push @{$::xcmd_outref_hash->{node}}, @{$resp->{node}};
|
||||
@@ -3134,26 +3151,30 @@ sub noderangecontainsMn
|
||||
{
|
||||
my ($class, @noderange)=@_;
|
||||
# check if any node in the noderange is the Management Node return the
|
||||
# name
|
||||
my $mname;
|
||||
# name
|
||||
my @mnames; # management node names in the database, members of __mgmtnode
|
||||
my $tab = xCAT::Table->new('nodelist');
|
||||
my @nodelist=$tab->getAllNodeAttribs(['node','groups']);
|
||||
foreach my $n (@nodelist) {
|
||||
if (defined($n->{'groups'})) {
|
||||
my @groups=split(",",$n->{'groups'});
|
||||
if ((grep (/__mgmtnode/,@groups))) { # this is the MN
|
||||
$mname=$n->{'node'};
|
||||
last;
|
||||
push @mnames,$n->{'node'};
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($mname) { # if Management Node defined in the database
|
||||
if (grep(/$mname/, @noderange)) { # if MN in the noderange
|
||||
return $mname;
|
||||
} else {
|
||||
return ;
|
||||
my @MNs; # management node names found the noderange
|
||||
if (@mnames) { # if any Management Node defined in the database
|
||||
foreach my $mn (@mnames) {
|
||||
if (grep(/^$mn$/, @noderange)) { # if MN in the noderange
|
||||
push @MNs, $mn;
|
||||
}
|
||||
}
|
||||
if (@MNs) { # management nodes in the noderange
|
||||
return @MNs;
|
||||
}
|
||||
}
|
||||
return; # if no MN in the noderange, return nothing
|
||||
}
|
||||
|
||||
=head3 filter_nodes
|
||||
@@ -3204,6 +3225,11 @@ sub filter_nodes{
|
||||
if ($ipmitab) {
|
||||
$ipmitabhash = $ipmitab->getNodesAttribs(\@nodes,['bmc']);
|
||||
}
|
||||
my $nodehmhash;
|
||||
my $nodehmtab = xCAT::Table->new("nodehm");
|
||||
if ($nodehmtab) {
|
||||
$nodehmhash = $nodehmtab->getNodesAttribs(\@nodes,['mgt']);
|
||||
}
|
||||
|
||||
my (@mp, @ngpfsp, @ngpbmc, @commonfsp, @commonbmc, @unknow);
|
||||
|
||||
@@ -3213,6 +3239,15 @@ sub filter_nodes{
|
||||
# if only in 'ipmi', a common x86 node
|
||||
foreach (@nodes) {
|
||||
if (defined ($mptabhash->{$_}->[0]) && defined ($mptabhash->{$_}->[0]->{'mpa'})) {
|
||||
if ($mptabhash->{$_}->[0]->{'mpa'} eq $_) {
|
||||
if (defined($nodehmhash->{$_}->[0]) && defined($nodehmhash->{$_}->[0]->{'mgt'}) &&
|
||||
$nodehmhash->{$_}->[0]->{'mgt'} eq "blade") {
|
||||
push @mp, $_;
|
||||
} else {
|
||||
push @unknow, $_;
|
||||
}
|
||||
next;
|
||||
}
|
||||
if (defined ($ppctabhash->{$_}->[0]) && defined ($ppctabhash->{$_}->[0]->{'hcp'})) {
|
||||
# flex power node
|
||||
push @ngpfsp, $_;
|
||||
@@ -3258,6 +3293,7 @@ sub filter_nodes{
|
||||
} else {
|
||||
push @{$mpnodes}, @ngpfsp;
|
||||
}
|
||||
push @{$mpnodes}, @ngpbmc;
|
||||
} elsif ($cmd eq "rvitals") {
|
||||
if (@args && (grep /^lcds$/,@args)) {
|
||||
push @{$fspnodes},@ngpfsp;
|
||||
@@ -3281,4 +3317,61 @@ sub filter_nodes{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
=head3 filter_nostatusupdate()
|
||||
|
||||
filter out the nodes which support provision status feedback from the status-nodes hash
|
||||
Returns:
|
||||
returns the filtered status-nodes hash
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Input:
|
||||
the ref of status-nodes hash to filter
|
||||
Example:
|
||||
my $mn=xCAT::Utils->filter_nostatusupdate(\%statusnodehash);
|
||||
Comments:
|
||||
=cut
|
||||
#-------------------------------------------------------------------------------
|
||||
sub filter_nostatusupdate{
|
||||
|
||||
my ($class,$inref)=@_;
|
||||
my $nttabdata;
|
||||
my @allnodes=();
|
||||
#read "nodetype" table to get the "os" attribs for all the nodes with status "installing" or "netbooting"
|
||||
if(exists $inref->{$::STATUS_INSTALLING}){
|
||||
push @allnodes, @{$inref->{$::STATUS_INSTALLING}};
|
||||
}
|
||||
if(exists $inref->{$::STATUS_NETBOOTING}){
|
||||
push @allnodes, @{$inref->{$::STATUS_NETBOOTING}};
|
||||
}
|
||||
|
||||
my $nodetypetab = xCAT::Table->new('nodetype');
|
||||
if ($nodetypetab) {
|
||||
$nttabdata = $nodetypetab->getNodesAttribs(\@allnodes, ['node', 'os']);
|
||||
$nodetypetab->close();
|
||||
}
|
||||
|
||||
#filter out the nodes which support the node provision status feedback
|
||||
my @nodesfiltered=();
|
||||
if(exists $inref->{$::STATUS_INSTALLING}){
|
||||
map{ if($nttabdata->{$_}->[0]->{os} !~ /(fedora|rh|centos|sles|ubuntu)/) {push @nodesfiltered,$_;} } @{$inref->{$::STATUS_INSTALLING}};
|
||||
delete $inref->{$::STATUS_INSTALLING};
|
||||
if(@nodesfiltered){
|
||||
@{$inref->{$::STATUS_INSTALLING}}=@nodesfiltered;
|
||||
}
|
||||
}
|
||||
|
||||
@nodesfiltered=();
|
||||
if(exists $inref->{$::STATUS_NETBOOTING}){
|
||||
map{ if($nttabdata->{$_}->[0]->{os} !~ /(fedora|rh|centos|sles|ubuntu)/) {push @nodesfiltered,$_;} } @{$inref->{$::STATUS_NETBOOTING}};
|
||||
delete $inref->{$::STATUS_NETBOOTING};
|
||||
if(@nodesfiltered){
|
||||
@{$inref->{$::STATUS_NETBOOTING}}=@nodesfiltered;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
@@ -26,7 +26,7 @@ sub grab_table_data{ #grab table data relevent to VM guest nodes
|
||||
if ($vpdtab) {
|
||||
$cfghash->{vpd} = $vpdtab->getNodesAttribs($noderange,['uuid']);
|
||||
}
|
||||
$cfghash->{vm} = $vmtab->getNodesAttribs($noderange,['node','host','migrationdest','cfgstore','storage','vidmodel','vidproto','vidpassword','storagemodel','memory','cpus','nics','nicmodel','bootorder','virtflags','datacenter','guestostype','othersettings','master']);
|
||||
$cfghash->{vm} = $vmtab->getNodesAttribs($noderange,['node','host','migrationdest','cfgstore','storage','storagecache','storageformat','vidmodel','vidproto','vidpassword','storagemodel','memory','cpus','nics','nicmodel','bootorder','virtflags','datacenter','guestostype','othersettings','master']);
|
||||
my $mactab = xCAT::Table->new("mac",-create=>1);
|
||||
my $nrtab= xCAT::Table->new("noderes",-create=>1);
|
||||
$cfghash->{mac} = $mactab->getAllNodeAttribs(['mac'],1);
|
||||
|
||||
Regular → Executable
+4
@@ -27,6 +27,7 @@ require Exporter;
|
||||
"1237641529.260981" => "centos5.3",
|
||||
"1272326751.405938" => "centos5.5",
|
||||
"1330913492.861127" => "centos5.8",#x86_64
|
||||
"1357930415.252042" => "centos5.9",#x86_64
|
||||
"1195488871.805863" => "centos4.6",
|
||||
"1195487524.127458" => "centos4.6",
|
||||
"1301444731.448392" => "centos5.6",
|
||||
@@ -63,6 +64,7 @@ require Exporter;
|
||||
"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
|
||||
"1194015916.783841" => "fedora8",
|
||||
"1194015385.299901" => "fedora8",
|
||||
"1210112435.291709" => "fedora9",
|
||||
@@ -74,6 +76,8 @@ require Exporter;
|
||||
"1273712675.937554" => "fedora13", #x86_64 DVD ISO
|
||||
"1287685820.403779" => "fedora14", #x86_64 DVD ISO
|
||||
"1305315870.828212" => "fedora15", #x86_64 DVD ISO
|
||||
"1372355769.065812" => "fedora19", #x86_64 DVD ISO
|
||||
"1372402928.663653" => "fedora19", #ppc64 DVD ISO
|
||||
|
||||
"1194512200.047708" => "rhas4.6",
|
||||
"1194512327.501046" => "rhas4.6",
|
||||
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env perl
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
package xCAT::data::ibmhwtypes;
|
||||
require Exporter;
|
||||
@EXPORT_OK=qw(parse_group mt2group);
|
||||
use Data::Dumper;
|
||||
my %groups2mtm = (
|
||||
"x3250" => ["2583","4251","4252"],
|
||||
"x3550" => ["7914","7944","7946"],
|
||||
"x3650" => ["7915","7945"],
|
||||
"dx360" => [],
|
||||
"x220" => ["7906"],
|
||||
"x240" => ["8737","7863"],
|
||||
"x440" => ["7917"],
|
||||
"p260" => ["7895"], #789522X, 789523X
|
||||
"p460" => [], #789542X
|
||||
"p470" => ["7954"],
|
||||
);
|
||||
|
||||
%mt2group = ();
|
||||
foreach my $group (keys %groups2mtm) {
|
||||
foreach my $mtm (@{$groups2mtm{$group}}) {
|
||||
$mt2group{$mtm} = $group;
|
||||
}
|
||||
}
|
||||
|
||||
sub parse_group {
|
||||
my $mtm = shift;
|
||||
if ($mtm =~ /xCAT::data/) {
|
||||
$mtm = shift;
|
||||
}
|
||||
if ($mtm =~ /^(\w{4})/) {
|
||||
$mt = $1;
|
||||
if ($mt eq "7895" and $mtm =~ /789542X/i) {
|
||||
return "p460";
|
||||
}
|
||||
return $mt2group{$mt};
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -208,7 +208,7 @@ sub getNic {
|
||||
Arguments : User (root or non-root)
|
||||
Node
|
||||
Returns : Network names
|
||||
Example : my $lans = xCAT::zvmCPUtils->getNetworkNames($node);
|
||||
Example : my $lans = xCAT::zvmCPUtils->getNetworkNames($user, $node);
|
||||
|
||||
=cut
|
||||
|
||||
@@ -260,7 +260,7 @@ sub getNetworkNames {
|
||||
Arguments : User (root or non-root)
|
||||
Node
|
||||
Returns : Array of networks names
|
||||
Example : my @networks = xCAT::zvmCPUtils->getNetworkNamesArray($node);
|
||||
Example : my @networks = xCAT::zvmCPUtils->getNetworkNamesArray($user, $node);
|
||||
|
||||
=cut
|
||||
|
||||
@@ -611,25 +611,39 @@ sub punch2Reader {
|
||||
|
||||
# Punch to reader
|
||||
# VMUR located in different directories on RHEL and SLES
|
||||
my $out;
|
||||
my $vmur;
|
||||
if ( $os =~ m/sles10/i ) {
|
||||
$out = `ssh -o ConnectTimeout=5 $user\@$hcp "$sudo /sbin/vmur punch $options -u $userId -r $srcFile -N $tgtFile"`;
|
||||
} elsif ( $os =~ m/sles11/i ) {
|
||||
$out = `ssh -o ConnectTimeout=5 $user\@$hcp "$sudo /usr/sbin/vmur punch $options -u $userId -r $srcFile -N $tgtFile"`;
|
||||
} elsif ( $os =~ m/rhel/i ) {
|
||||
$out = `ssh -o ConnectTimeout=5 $user\@$hcp "$sudo /usr/sbin/vmur punch $options -u $userId -r $srcFile -N $tgtFile"`;
|
||||
$vmur = "/sbin/vmur";
|
||||
} else {
|
||||
$out = `ssh -o ConnectTimeout=5 $user\@$hcp "$sudo /usr/sbin/vmur punch $options -u $userId -r $srcFile -N $tgtFile"`;
|
||||
$vmur = "/usr/sbin/vmur";
|
||||
}
|
||||
my $out;
|
||||
my $done = 0;
|
||||
|
||||
until ( $done ) {
|
||||
$out = `ssh -o ConnectTimeout=5 $user\@$hcp "$sudo $vmur punch $options -u $userId -r $srcFile -N $tgtFile" 2>&1`;
|
||||
my $rc = $? >> 8;
|
||||
if ( $rc == 255 ) {
|
||||
$out = "(Error) Unable to communicate with the zHCP system: $hcp";
|
||||
$done = 1;
|
||||
} elsif ( $out =~ m/A concurrent instance of vmur is already active/i ) {
|
||||
# Recoverable error: retry the command after a delay
|
||||
xCAT::zvmUtils->printSyslog( "punch2Reader() Punch in use on $hcp, retrying in 15 seconds" );
|
||||
sleep( 15 );
|
||||
} else {
|
||||
# Punch appears successful -- Look for the completion string
|
||||
my $searchStr = "created and transferred";
|
||||
if ( !( $out =~ m/$searchStr/i ) ) {
|
||||
chomp( $out );
|
||||
$out = "Failed, punch info: '$out'\n";
|
||||
xCAT::zvmUtils->printSyslog( "punch2Reader() Failed punching $srcFile to $userId from $hcp, info: '$out'" );
|
||||
} else {
|
||||
$out = "Done\n";
|
||||
}
|
||||
$done = 1;
|
||||
}
|
||||
}
|
||||
|
||||
# If punch is successful -- Look for this string
|
||||
my $searchStr = "created and transferred";
|
||||
if ( !( $out =~ m/$searchStr/i ) ) {
|
||||
$out = "Failed\n";
|
||||
} else {
|
||||
$out = "Done\n";
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
+860
-34
@@ -12,6 +12,8 @@ package xCAT::zvmUtils;
|
||||
use xCAT::MsgUtils;
|
||||
use xCAT::Utils;
|
||||
use xCAT::Table;
|
||||
use xCAT::NetworkUtils;
|
||||
use File::Basename;
|
||||
use strict;
|
||||
use warnings;
|
||||
1;
|
||||
@@ -287,8 +289,8 @@ sub printLn {
|
||||
# Print string
|
||||
my $rsp;
|
||||
my $type = "I";
|
||||
if ($str =~ m/error/i) { # Set to print error if the string contains error
|
||||
$type = "E";
|
||||
if ($str =~ m/(\(error\)|\sfailed)/i) { # Set to print error if the string contains error
|
||||
$type = "E";
|
||||
}
|
||||
|
||||
$rsp->{data}->[0] = "$str";
|
||||
@@ -870,6 +872,36 @@ sub checkOutput {
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 checkOutputExtractReason
|
||||
|
||||
Description : Check the return of given output. If bad, extract the reason.
|
||||
Arguments : Output string
|
||||
Reason (passed as a reference)
|
||||
Returns : 0 Good output
|
||||
-1 Bad output
|
||||
Example : my $rtn = xCAT::zvmUtils->checkOutput($callback, $out, \$reason);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub checkOutputExtractReason {
|
||||
my ( $class, $callback, $out, $reason ) = @_;
|
||||
|
||||
# Check output string
|
||||
my @outLn = split("\n", $out);
|
||||
foreach (@outLn) {
|
||||
# If output contains 'ERROR: ', return -1 and pass back the reason.
|
||||
if ($_ =~ /(.*?ERROR: )/) {
|
||||
$$reason = substr($_, index($_, "ERROR: ") + length("ERROR: "));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 getDeviceNode
|
||||
|
||||
Description : Get the device node for a given address
|
||||
@@ -892,14 +924,14 @@ sub getDeviceNode {
|
||||
|
||||
# Determine device node
|
||||
my $out = `ssh $user\@$node "$sudo cat /proc/dasd/devices" | grep ".$tgtAddr("`;
|
||||
my @words = split( ' ', $out );
|
||||
my @words = split(' ', $out);
|
||||
my $tgtDevNode;
|
||||
|
||||
# /proc/dasd/devices look similar to this:
|
||||
# 0.0.0100(ECKD) at ( 94: 0) is dasda : active at blocksize: 4096, 1802880 blocks, 7042 MB
|
||||
# Look for the string 'is'
|
||||
my $i = 0;
|
||||
while ( $tgtDevNode ne 'is' ) {
|
||||
while ($tgtDevNode ne 'is') {
|
||||
$tgtDevNode = $words[$i];
|
||||
$i++;
|
||||
}
|
||||
@@ -909,6 +941,39 @@ sub getDeviceNode {
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 getDeviceNodeAddr
|
||||
|
||||
Description : Get the virtual device address for a given device node
|
||||
Arguments : User (root or non-root)
|
||||
Node
|
||||
Device node
|
||||
Returns : Virtual device address
|
||||
Example : my $addr = xCAT::zvmUtils->getDeviceNodeAddr($user, $node, $deviceNode);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub getDeviceNodeAddr {
|
||||
my ( $class, $user, $node, $deviceNode ) = @_;
|
||||
|
||||
my $sudo = "sudo";
|
||||
if ($user eq "root") {
|
||||
$sudo = "";
|
||||
}
|
||||
|
||||
# Find device node and determine virtual address
|
||||
# /proc/dasd/devices look similar to this:
|
||||
# 0.0.0100(ECKD) at ( 94: 0) is dasda : active at blocksize: 4096, 1802880 blocks, 7042 MB
|
||||
my $addr = `ssh $user\@$node "$sudo cat /proc/dasd/devices" | grep -i "is $deviceNode"`;
|
||||
$addr =~ s/ +/ /g;
|
||||
$addr =~ s/^0.0.([0-9a-f]*).*/$1/;
|
||||
chomp($addr);
|
||||
|
||||
return $addr;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 isAddressUsed
|
||||
|
||||
Description : Check if a given address is used
|
||||
@@ -1181,7 +1246,7 @@ sub getArch {
|
||||
}
|
||||
|
||||
# Get host using VMCP
|
||||
my $arch = `ssh $user\@$node "$sudo uname -p"`;
|
||||
my $arch = `ssh $user\@$node "$sudo uname -m"`;
|
||||
|
||||
return ( xCAT::zvmUtils->trimStr($arch) );
|
||||
}
|
||||
@@ -1507,7 +1572,7 @@ sub getFreeAddress {
|
||||
} else {
|
||||
# When the node is down, use zHCP to get its user directory entry
|
||||
# Get HCP
|
||||
my @propNames = ( 'hcp', 'userid' );
|
||||
my @propNames = ('hcp', 'userid');
|
||||
my $propVals = xCAT::zvmUtils->getNodeProps( 'zvm', $node, @propNames );
|
||||
my $hcp = $propVals->{'hcp'};
|
||||
|
||||
@@ -1525,9 +1590,9 @@ sub getFreeAddress {
|
||||
}
|
||||
|
||||
# Get all defined device address
|
||||
$allUsedAddr = `cat $allUsedAddr | awk '$1 ~/^($deviceTypesUserDir)/ {print $2}' | sort`;
|
||||
$allUsedAddr = `cat $userDirEntry | awk '$1 ~/^($deviceTypesUserDir)/ {print $2}' | sort`;
|
||||
# Get all linked device address
|
||||
$allUsedAddr .= `cat $allUsedAddr | awk '$1 ~/^(LINK)/ {print $4}' | sort`;
|
||||
$allUsedAddr .= `cat $userDirEntry | awk '$1 ~/^(LINK)/ {print $4}' | sort`;
|
||||
}
|
||||
|
||||
# Loop to get the lowest free address
|
||||
@@ -1577,7 +1642,7 @@ sub getUsedCpuTime {
|
||||
$time =~ s/^\s+//;
|
||||
$time =~ s/\s+$//;
|
||||
if (!$time) {
|
||||
$time = 0;
|
||||
$time = 0;
|
||||
}
|
||||
|
||||
# Not found, return 0
|
||||
@@ -2071,7 +2136,7 @@ sub smapi4xcat {
|
||||
my $out = `ssh $user\@$hcp "$sudo $dir/smcli Query_API_Functional_Level -T $hcpUserId"`;
|
||||
$out = xCAT::zvmUtils->trimStr($out);
|
||||
if ( !($out =~ m/V6.2/i || $out =~ m/V6.1/i || $out =~ m/V5.4/i) ) {
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Check if SMAPI EXEC exists
|
||||
@@ -2172,20 +2237,20 @@ sub querySSI {
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub rExecute {
|
||||
my ( $class, $user, $node, $cmd ) = @_;
|
||||
|
||||
my $out;
|
||||
my $sudo = "sudo";
|
||||
my ( $class, $user, $node, $cmd ) = @_;
|
||||
|
||||
my $out;
|
||||
my $sudo = "sudo";
|
||||
if ($user eq "root") {
|
||||
# Just execute the command if root
|
||||
# Just execute the command if root
|
||||
$out = `ssh $user\@$node "$cmd"`;
|
||||
return $out;
|
||||
}
|
||||
|
||||
# Encapsulate command in single quotes
|
||||
$cmd = "'" . $cmd . "'";
|
||||
$out = `ssh $user\@$node "$sudo sh -c $cmd"`;
|
||||
return $out;
|
||||
# Encapsulate command in single quotes
|
||||
$cmd = "'" . $cmd . "'";
|
||||
$out = `ssh $user\@$node "$sudo sh -c $cmd"`;
|
||||
return $out;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
@@ -2202,8 +2267,8 @@ sub rExecute {
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub getUsedFcpDevices {
|
||||
my ( $class, $user, $hcp ) = @_;
|
||||
|
||||
my ( $class, $user, $hcp ) = @_;
|
||||
|
||||
# Directory where zFCP pools are
|
||||
my $pool = "/var/opt/zhcp/zfcp";
|
||||
|
||||
@@ -2211,15 +2276,15 @@ sub getUsedFcpDevices {
|
||||
if ($user eq "root") {
|
||||
$sudo = "";
|
||||
}
|
||||
|
||||
# Grep the pools for used or allocated zFCP devices
|
||||
my %usedDevices;
|
||||
my @args;
|
||||
my @devices = split("\n", `ssh $user\@$hcp "$sudo cat $pool/*.conf" | egrep -i "used|allocated"`);
|
||||
foreach (@devices) {
|
||||
@args = split(",", $_);
|
||||
|
||||
# Sample pool configuration file:
|
||||
|
||||
# Grep the pools for used or allocated zFCP devices
|
||||
my %usedDevices;
|
||||
my @args;
|
||||
my @devices = split("\n", `ssh $user\@$hcp "$sudo cat $pool/*.conf" | egrep -i "used|allocated"`);
|
||||
foreach (@devices) {
|
||||
@args = split(",", $_);
|
||||
|
||||
# Sample pool configuration file:
|
||||
# #status,wwpn,lun,size,range,owner,channel,tag
|
||||
# used,1000000000000000,2000000000000110,8g,3B00-3B3F,ihost1,1a23,$root_device$
|
||||
# free,1000000000000000,2000000000000111,,3B00-3B3F,,,
|
||||
@@ -2228,9 +2293,770 @@ sub getUsedFcpDevices {
|
||||
|
||||
# Push used or allocated devices into hash
|
||||
if ($args[6]) {
|
||||
$usedDevices{uc($args[6])} = 1;
|
||||
$usedDevices{uc($args[6])} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return %usedDevices;
|
||||
}
|
||||
|
||||
return %usedDevices;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 establishMount
|
||||
|
||||
Description : Establish an NFS mount point on a zHCP system.
|
||||
Arguments : Sudoer user name
|
||||
Sudo keyword
|
||||
zHCP hostname
|
||||
Install root directory
|
||||
Local directory to remotely mount
|
||||
Mount access ('ro' for read only, 'rw' for read write)
|
||||
Directory as known to zHCP (out)
|
||||
Returns : 0 - Mounted, or zHCP and MN are on the same system
|
||||
1 - Mount failed
|
||||
Example : establishMount( $callback, $::SUDOER, $::SUDO, $hcp, $installRoot, $provMethod, "ro", \$remoteDeployDir );
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub establishMount {
|
||||
# Get inputs
|
||||
my ($class, $callback, $sudoer, $sudo, $hcp, $installRoot, $localDir, $access, $mountedPt) = @_;
|
||||
my $out;
|
||||
|
||||
# If the target system is not on this system then establish the NFS mount point.
|
||||
my $hcpIP = xCAT::NetworkUtils->getipaddr( $hcp );
|
||||
if (! defined $hcpIP) {
|
||||
xCAT::zvmUtils->printLn( $callback, "(Error) Unable to obtain the IP address of the hcp node" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
my $masterIp = xCAT::TableUtils->get_site_Master();
|
||||
if (! defined $masterIp) {
|
||||
xCAT::zvmUtils->printLn( $callback, "$hcp: (Error) Unable to obtain the management node IP address from the site table" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ($masterIp eq $hcpIP) {
|
||||
# xCAT MN and zHCP are on the same box and will use the same directory without the need for an NFS mount.
|
||||
$$mountedPt = "$installRoot/$localDir";
|
||||
} else {
|
||||
# Determine the hostname for this management node
|
||||
my $masterHostname = Sys::Hostname::hostname();
|
||||
if (! defined $masterHostname) {
|
||||
# For some reason, the xCAT MN's hostname is not known. We pass along the IP address instead.
|
||||
$masterHostname = $masterIp;
|
||||
}
|
||||
|
||||
$$mountedPt = "/mnt/$masterHostname$installRoot/$localDir";
|
||||
|
||||
# If the mount point already exists then return because we are done.
|
||||
my $rc = `ssh $sudoer\@$hcp "$sudo mount | grep $$mountedPt > /dev/null; echo \\\$?"`;
|
||||
if ($rc == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
xCAT::zvmUtils->printSyslog( "establishMount() Preparing the NFS mount point on zHCP ($hcpIP) to xCAT MN $masterHostname($masterIp) for $localDir" );
|
||||
|
||||
# Prepare the staging mount point on zHCP, if they need to be established
|
||||
$rc = `ssh $sudoer\@$hcp "$sudo mkdir -p $$mountedPt && mount -t nfs -o $access $masterIp:/$localDir $$mountedPt; echo \\\$?"`;
|
||||
|
||||
# Return code = 0 (mount succeeded)
|
||||
if ($rc != '0') {
|
||||
xCAT::zvmUtils->printLn( $callback, "$hcp: (Error) Unable to establish zHCP mount point: $$mountedPt" );
|
||||
xCAT::zvmUtils->printSyslog( "establishMount() Unable to establish zHCP mount point: $$mountedPt, rc: $rc" );
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 getFreeRepoSpace
|
||||
|
||||
Description : Get the free space of image repository under /install.
|
||||
Arguments : Node
|
||||
Returns : The available space for /install (e.g. "2.1G ").
|
||||
The value is returned as a perl string (e.g. "0 ") to
|
||||
avoid perl returning null instead of "0" in the case
|
||||
of no space available.
|
||||
Example : my $free = getFreeRepoSpace($callback, $node);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub getFreeRepoSpace {
|
||||
# Get inputs
|
||||
my ($class, $user, $node) = @_;
|
||||
|
||||
my $sudo = "sudo";
|
||||
if ($user eq "root") {
|
||||
$sudo = "";
|
||||
}
|
||||
|
||||
# Check if node is the management node
|
||||
my @entries = xCAT::TableUtils->get_site_attribute("master");
|
||||
my $master = xCAT::zvmUtils->trimStr($entries[0]);
|
||||
my $ip = xCAT::NetworkUtils->getipaddr($node);
|
||||
$ip = xCAT::zvmUtils->trimStr($ip);
|
||||
my $mn = 0;
|
||||
if ($master eq $ip) {
|
||||
# If the master IP and node IP match, then it is the management node
|
||||
my $out = `$sudo /bin/df -h /install | sed 1d`;
|
||||
$out =~ s/\h+/ /g;
|
||||
my @results = split(' ', $out);
|
||||
if ( $results[3] eq "0" ) {
|
||||
$results[3] = "0M";
|
||||
}
|
||||
return $results[3];
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 findAndUpdatezFcpPool
|
||||
|
||||
Description : Find and update a SCSI/FCP device in a given storage pool.
|
||||
xCAT will find and update the SCSI/FCP device in all known pools based on the unique WWPN/LUN combo.
|
||||
Arguments : Message header
|
||||
User (root or non-root)
|
||||
zHCP
|
||||
Storage pool
|
||||
Criteria hash including:
|
||||
- Status (free, reserved, or used)
|
||||
- zFCP channel
|
||||
- WWPN
|
||||
- LUN
|
||||
- Size requested
|
||||
- Owner
|
||||
- Tag
|
||||
Returns : Results hash including:
|
||||
- Return code (0 = Success, -1 = Failure)
|
||||
- zFCP device (if one is requested)
|
||||
- WWPN
|
||||
- LUN
|
||||
Example : my $resultsRef = xCAT::zvmUtils->findAndUpdatezFcpPool($callback, $header, $user, $hcp, $pool, $criteriaRef);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub findAndUpdatezFcpPool {
|
||||
# Get inputs
|
||||
my ($class, $callback, $header, $user, $hcp, $pool, $criteriaRef) = @_;
|
||||
|
||||
# Determine if sudo is used
|
||||
my $sudo = "sudo";
|
||||
if ($user eq "root") {
|
||||
$sudo = "";
|
||||
}
|
||||
|
||||
# Directory where executables are on zHCP
|
||||
my $dir = "/opt/zhcp/bin";
|
||||
|
||||
# Directory where FCP disk pools are on zHCP
|
||||
my $zfcpDir = "/var/opt/zhcp/zfcp";
|
||||
|
||||
my %results = ('rc' => -1); # Default to error
|
||||
|
||||
# Extract criteria
|
||||
my %criteria = %$criteriaRef;
|
||||
my $status = defined($criteria{status}) ? $criteria{status} : "";
|
||||
my $fcpDevice = defined($criteria{fcp}) ? $criteria{fcp} : "";
|
||||
my $wwpn = defined($criteria{wwpn}) ? $criteria{wwpn} : "";
|
||||
my $lun = defined($criteria{lun}) ? $criteria{lun} : "";
|
||||
my $size = defined($criteria{size}) ? $criteria{size} : "";
|
||||
my $owner = defined($criteria{owner}) ? $criteria{owner} : "";
|
||||
my $tag = defined($criteria{tag}) ? $criteria{tag} : "";
|
||||
|
||||
# Check required arguments: pool, status
|
||||
# If you do not know what to update, why update!
|
||||
if (!$pool && !$status) {
|
||||
return \%results;
|
||||
}
|
||||
|
||||
# Check status
|
||||
if ($status !~ m/^(free|used|reserved)$/i) {
|
||||
xCAT::zvmUtils->printLn($callback, "$header: (Error) Status not recognized. Status can be free, used, or reserved.");
|
||||
return \%results;
|
||||
}
|
||||
|
||||
# Check FCP device syntax
|
||||
if ($fcpDevice && ($fcpDevice !~ /^auto/i) && ($fcpDevice =~ /[^0-9a-f]/i)) {
|
||||
xCAT::zvmUtils->printLn($callback, "$header: (Error) Invalid FCP channel address $fcpDevice.");
|
||||
return \%results;
|
||||
}
|
||||
|
||||
# Owner must be specified if status is used
|
||||
if ($status =~ m/used/i && !$owner) {
|
||||
xCAT::zvmUtils->printLn( $callback, "$header: (Error) Owner must be specified if status is used." );
|
||||
return \%results;
|
||||
} elsif ($status =~ m/free/i && $owner) {
|
||||
xCAT::zvmUtils->printLn( $callback, "$header: (Error) Owner must not be specified if status is free." );
|
||||
return \%results;
|
||||
}
|
||||
|
||||
# Size can be M(egabytes) or G(igabytes). Convert size into MB.
|
||||
my $originSize = $size;
|
||||
if ($size) {
|
||||
if ($size =~ m/G/i) {
|
||||
# Convert to MegaBytes
|
||||
$size =~ s/\D//g;
|
||||
$size = int($size) * 1024
|
||||
} elsif ($size =~ m/M/i || !$size) {
|
||||
# Do nothing
|
||||
} else {
|
||||
xCAT::zvmUtils->printLn( $callback, "$header: (Error) Size not recognized. Size can be M(egabytes) or G(igabytes)." );
|
||||
return \%results;
|
||||
}
|
||||
}
|
||||
|
||||
# Check if WWPN and LUN are given
|
||||
# WWPN can be given as a semi-colon separated list (multipathing)
|
||||
my $useWwpnLun = 0;
|
||||
if ($wwpn && $lun) {
|
||||
xCAT::zvmUtils->printLn($callback, "$header: Using given WWPN and LUN");
|
||||
$useWwpnLun = 1;
|
||||
|
||||
# Make sure WWPN and LUN do not have 0x prefix
|
||||
$wwpn = xCAT::zvmUtils->replaceStr($wwpn, "0x", "");
|
||||
$lun = xCAT::zvmUtils->replaceStr($lun, "0x", "");
|
||||
|
||||
# Check WWPN and LUN syntax
|
||||
if ( $wwpn && ($wwpn =~ /[^0-9a-f;"]/i) ) {
|
||||
xCAT::zvmUtils->printLn( $callback, "$header: (Error) Invalid world wide portname $wwpn." );
|
||||
return \%results;
|
||||
} if ( $lun && ($lun =~ /[^0-9a-f]/i) ) {
|
||||
xCAT::zvmUtils->printLn( $callback, "$header: (Error) Invalid logical unit number $lun." );
|
||||
return \%results;
|
||||
}
|
||||
}
|
||||
|
||||
# Find disk pool (create one if non-existent)
|
||||
my $out;
|
||||
if (!(`ssh $user\@$hcp "$sudo test -d $zfcpDir && echo Exists"`)) {
|
||||
# Create pool directory
|
||||
$out = `ssh $user\@$hcp "$sudo mkdir -p $zfcpDir"`;
|
||||
}
|
||||
|
||||
# Find if disk pool exists
|
||||
if (!(`ssh $user\@$hcp "$sudo test -e $zfcpDir/$pool.conf && echo Exists"`)) {
|
||||
# Return if xCAT is expected to find a FCP device, but no disk pool exists.
|
||||
xCAT::zvmUtils->printLn($callback, "$header: (Error) FCP storage pool does not exist");
|
||||
return \%results;
|
||||
}
|
||||
|
||||
# Find a free disk in the pool
|
||||
# FCP devices are contained in /var/opt/zhcp/zfcp/<pool-name>.conf
|
||||
my $range = "";
|
||||
my $sizeFound = "*";
|
||||
my @info;
|
||||
if (!$useWwpnLun) {
|
||||
# Find a suitable pair of WWPN and LUN in device pool based on requested size
|
||||
# Sample pool configuration file:
|
||||
# #status,wwpn,lun,size,range,owner,channel,tag
|
||||
# used,1000000000000000,2000000000000110,8g,3B00-3B3F,ihost1,1a23,$root_device$
|
||||
# free,1000000000000000,2000000000000111,,3B00-3B3F,,,
|
||||
# free,1230000000000000;4560000000000000,2000000000000112,,3B00-3B3F,,,
|
||||
my @devices = split("\n", `ssh $user\@$hcp "$sudo cat $zfcpDir/$pool.conf" | egrep -i ^free`);
|
||||
$sizeFound = 0;
|
||||
foreach (@devices) {
|
||||
@info = split(',', $_);
|
||||
|
||||
# Check if the size is sufficient. Convert size into MB.
|
||||
if ($info[3] =~ m/G/i) {
|
||||
# Convert to MegaBytes
|
||||
$info[3] =~ s/\D//g;
|
||||
$info[3] = int($info[3]) * 1024
|
||||
} elsif ($info[3] =~ m/M/i) {
|
||||
# Do nothing
|
||||
$info[3] =~ s/\D//g;
|
||||
} else {
|
||||
next;
|
||||
}
|
||||
|
||||
# Find optimal disk based on requested size
|
||||
if ($sizeFound && $info[3] >= $size && $info[3] < $sizeFound) {
|
||||
$sizeFound = $info[3];
|
||||
$wwpn = $info[1];
|
||||
$lun = $info[2];
|
||||
$range = $info[4];
|
||||
} elsif (!$sizeFound && $info[3] >= $size) {
|
||||
$sizeFound = $info[3];
|
||||
$wwpn = $info[1];
|
||||
$lun = $info[2];
|
||||
$range = $info[4];
|
||||
}
|
||||
}
|
||||
|
||||
# Do not continue if no devices can be found
|
||||
if (!$wwpn || !$lun) {
|
||||
xCAT::zvmUtils->printLn($callback, "$header: (Error) A suitable device of $size" . "M or larger could not be found");
|
||||
return \%results;
|
||||
}
|
||||
} else {
|
||||
# Find given WWPN and LUN. Do not continue if device is used
|
||||
my $select = `ssh $user\@$hcp "$sudo cat $zfcpDir/$pool.conf" | grep -i "$wwpn,$lun"`;
|
||||
chomp($select);
|
||||
if (!$select) {
|
||||
xCAT::zvmUtils->printLn($callback, "$header: (Error) zFCP device 0x$wwpn/0x$lun could not be found in zFCP pool $pool");
|
||||
return \%results;
|
||||
}
|
||||
|
||||
@info = split(',', $select);
|
||||
|
||||
if ($size) {
|
||||
if ($info[3] =~ m/G/i) {
|
||||
# Convert to MegaBytes
|
||||
$info[3] =~ s/\D//g;
|
||||
$info[3] = int($info[3]) * 1024
|
||||
} else {
|
||||
# Do nothing
|
||||
$info[3] =~ s/\D//g;
|
||||
}
|
||||
|
||||
# Do not continue if specified device does not have enough capacity
|
||||
if ($info[3] < $size) {
|
||||
xCAT::zvmUtils->printLn($callback, "$header: (Error) FCP device $wwpn/$lun is not large enough");
|
||||
return \%results;
|
||||
}
|
||||
}
|
||||
|
||||
# Find range of the specified disk
|
||||
$range = $info[4];
|
||||
}
|
||||
|
||||
# If there are multiple paths, take the 1st one
|
||||
# Handle multi-pathing in postscript because autoyast/kickstart does not support it.
|
||||
my $origWwpn = $wwpn;
|
||||
if ($wwpn =~ m/;/i) {
|
||||
@info = split(';', $wwpn);
|
||||
$wwpn = xCAT::zvmUtils->trimStr($info[0]);
|
||||
}
|
||||
|
||||
xCAT::zvmUtils->printLn($callback, "$header: Found FCP device 0x$wwpn/0x$lun");
|
||||
|
||||
if ( ($status =~ m/used/i) && ($fcpDevice =~ /^auto/i) ) {
|
||||
# select an eligible FCP device
|
||||
$fcpDevice = xCAT::zvmUtils->selectFcpDevice($callback, $header, $user, $hcp, $fcpDevice, $range, $owner);
|
||||
if (!$fcpDevice) {
|
||||
return \%results;
|
||||
}
|
||||
} elsif ($status =~ m/free/i) {
|
||||
# Owner and FCP channel make no sense when status is free
|
||||
$fcpDevice = "";
|
||||
$owner = "";
|
||||
}
|
||||
|
||||
# Mark WWPN and LUN as used, free, or reserved and set the owner/channel appropriately
|
||||
# This config file keeps track of the owner of each device, which is useful in nodeset
|
||||
$size = $size . "M";
|
||||
my $select = `ssh $user\@$hcp "$sudo cat $zfcpDir/$pool.conf" | grep -i "$lun"`;
|
||||
chomp($select);
|
||||
if ($select) {
|
||||
@info = split(',', $select);
|
||||
|
||||
if (!$info[3]) {
|
||||
$info[3] = $size;
|
||||
}
|
||||
|
||||
# Do not update if WWPN/LUN pair is specified but the pair does not exist
|
||||
if (!($info[1] =~ m/$wwpn/i)) {
|
||||
xCAT::zvmUtils->printLn($callback, "$header: (Error) FCP device $wwpn/$lun does not exists");
|
||||
return \%results;
|
||||
}
|
||||
|
||||
# Entry order: status,wwpn,lun,size,range,owner,channel,tag
|
||||
# The following are never updated: wwpn, lun, size, and range
|
||||
my $update = "$status,$info[1],$info[2],$info[3],$info[4],$owner,$fcpDevice,$tag";
|
||||
my $expression = "'s#" . $select . "#" .$update . "#i'";
|
||||
$out = `ssh $user\@$hcp "$sudo sed --in-place -e $expression $zfcpDir/$pool.conf"`;
|
||||
} else {
|
||||
# Insert device entry into file
|
||||
$out = `ssh $user\@$hcp "$sudo echo \"$status,$origWwpn,$lun,$size,,$owner,$fcpDevice,$tag\" >> $zfcpDir/$pool.conf"`;
|
||||
}
|
||||
|
||||
# Generate results hash
|
||||
%results = (
|
||||
'rc' => 0,
|
||||
'fcp' => $fcpDevice,
|
||||
'wwpn' => $wwpn,
|
||||
'lun' => $lun
|
||||
);
|
||||
return \%results;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 selectFcpDevice
|
||||
|
||||
Description : Select an eligible FCP device for attaching a zFCP device to a node
|
||||
Arguments : Message header
|
||||
User (root or non-root)
|
||||
zHCP
|
||||
candidate FCP devices or auto
|
||||
FCP device range
|
||||
zFCP device owner
|
||||
Returns : selected FCP device or empty if no one is selected
|
||||
Example : my $fcpDevice = xCAT::zvmUtils->selectFcpDevice($callback, $header, $user, $hcp, $fcpDevice, $range, $owner);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub selectFcpDevice {
|
||||
# Get inputs
|
||||
my ($class, $callback, $header, $user, $hcp, $fcpDevice, $range, $owner) = @_;
|
||||
|
||||
# Determine if sudo is used
|
||||
my $sudo = "sudo";
|
||||
if ($user eq "root") {
|
||||
$sudo = "";
|
||||
}
|
||||
|
||||
# Directory where executables are on zHCP
|
||||
my $dir = "/opt/zhcp/bin";
|
||||
|
||||
# Directory where FCP disk pools are on zHCP
|
||||
my $zfcpDir = "/var/opt/zhcp/zfcp";
|
||||
|
||||
my %results = ('rc' => -1); # Default to error
|
||||
|
||||
# Check FCP device syntax
|
||||
if ($fcpDevice && ($fcpDevice !~ /^auto/i) && ($fcpDevice =~ /[^0-9a-f]/i)) {
|
||||
xCAT::zvmUtils->printLn($callback, "$header: (Error) Invalid FCP channel address $fcpDevice.");
|
||||
return;
|
||||
}
|
||||
|
||||
# Find a free FCP device based on the given range
|
||||
if ($fcpDevice =~ m/^auto/i) {
|
||||
my @ranges;
|
||||
my $min;
|
||||
my $max;
|
||||
my $found = 0;
|
||||
|
||||
if ($range =~ m/;/i) {
|
||||
@ranges = split(';', $range);
|
||||
} else {
|
||||
push(@ranges, $range);
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
# If the node has an eligible FCP device, use it
|
||||
my @deviceList = xCAT::zvmUtils->getDedicates($callback, $user, $owner);
|
||||
foreach (@deviceList) {
|
||||
# Check if this devide is eligible (among the range specified for disk $lun)
|
||||
my @info = split(' ', $_);
|
||||
my $candidate = $info[2];
|
||||
foreach (@ranges) {
|
||||
($min, $max) = split('-', $_);
|
||||
if (hex($candidate) >= hex($min) && hex($candidate) <= hex($max)) {
|
||||
$found = 1;
|
||||
$fcpDevice = uc($candidate);
|
||||
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
if ($found) {
|
||||
xCAT::zvmUtils->printLn($callback, "$header: Found eligible FCP channel $fcpDevice");
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
# If the node has no eligible FCP device, find a free one for it.
|
||||
my %usedDevices = xCAT::zvmUtils->getUsedFcpDevices($user, $hcp);
|
||||
|
||||
my $hcpUserId = xCAT::zvmCPUtils->getUserId($user, $hcp);
|
||||
$hcpUserId =~ tr/a-z/A-Z/;
|
||||
|
||||
# Find a free FCP channel
|
||||
my $out = `ssh $user\@$hcp "$sudo $dir/smcli System_WWPN_Query -T $hcpUserId" | egrep -i "FCP device number|Status"`;
|
||||
my @devices = split( "\n", $out );
|
||||
for (my $i = 0; $i < @devices; $i++) {
|
||||
# Extract the device number and status
|
||||
$fcpDevice = $devices[$i];
|
||||
$fcpDevice =~ s/^FCP device number:(.*)/$1/;
|
||||
$fcpDevice =~ s/^\s+//;
|
||||
$fcpDevice =~ s/\s+$//;
|
||||
|
||||
$i++;
|
||||
my $fcpStatus = $devices[$i];
|
||||
$fcpStatus =~ s/^Status:(.*)/$1/;
|
||||
$fcpStatus =~ s/^\s+//;
|
||||
$fcpStatus =~ s/\s+$//;
|
||||
|
||||
# Only look at free FCP devices
|
||||
if ($fcpStatus =~ m/free/i) {
|
||||
# If the device number is within the specified range, exit out of loop
|
||||
# Range: 3B00-3C00;4B00-4C00;5E12-5E12
|
||||
foreach (@ranges) {
|
||||
($min, $max) = split('-', $_);
|
||||
if (hex($fcpDevice) >= hex($min) && hex($fcpDevice) <= hex($max)) {
|
||||
$fcpDevice = uc($fcpDevice);
|
||||
|
||||
# Use found FCP channel if not in use or allocated
|
||||
if (!$usedDevices{$fcpDevice}) {
|
||||
$found = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Break out of loop if FCP channel is found
|
||||
if ($found) {
|
||||
xCAT::zvmUtils->printLn($callback, "$header: Found FCP channel within acceptable range $fcpDevice");
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Do not continue if no FCP channel is found
|
||||
if (!$found) {
|
||||
xCAT::zvmUtils->printLn($callback, "$header: (Error) A suitable FCP channel could not be found");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
# If there are multiple devices (multipathing), take the 1st one
|
||||
if ($fcpDevice) {
|
||||
if ($fcpDevice =~ m/;/i) {
|
||||
my @info = split(';', $fcpDevice);
|
||||
$fcpDevice = xCAT::zvmUtils->trimStr($info[0]);
|
||||
}
|
||||
|
||||
# Make sure channel has a length of 4
|
||||
while (length($fcpDevice) < 4) {
|
||||
$fcpDevice = "0" . $fcpDevice;
|
||||
}
|
||||
}
|
||||
|
||||
return $fcpDevice;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 findzFcpDevicePool
|
||||
|
||||
Description : Find the zFCP storage pool that contains the given zFCP device
|
||||
Arguments : User (root or non-root)
|
||||
zHCP
|
||||
WWPN
|
||||
LUN
|
||||
Returns : Storage pool where zFCP device resides
|
||||
Example : my $pool = xCAT::zvmUtils->findzFcpDevicePool($user, $hcp, $wwpn, $lun);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub findzFcpDevicePool {
|
||||
|
||||
# Get inputs
|
||||
my ( $class, $user, $hcp, $wwpn, $lun ) = @_;
|
||||
|
||||
my $sudo = "sudo";
|
||||
if ($user eq "root") {
|
||||
$sudo = "";
|
||||
}
|
||||
|
||||
# Directory where FCP disk pools are on zHCP
|
||||
my $zfcpDir = "/var/opt/zhcp/zfcp";
|
||||
|
||||
# Find the pool that contains the SCSI/FCP device
|
||||
my @pools = split("\n", `ssh $user\@$hcp "$sudo grep -i -l \"$wwpn,$lun\" $zfcpDir/*.conf"`);
|
||||
my $pool = "";
|
||||
if (scalar(@pools)) {
|
||||
$pool = basename($pools[0]);
|
||||
$pool =~ s/\.[^.]+$//; # Do not use extension
|
||||
}
|
||||
|
||||
return $pool;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 findzFcpDeviceAttr
|
||||
|
||||
Description : Find the zFCP device attributes
|
||||
Arguments : User (root or non-root)
|
||||
zHCP
|
||||
Storage pool
|
||||
WWPN
|
||||
LUN
|
||||
Returns : Architecture of node
|
||||
Example : my $deviceRef = xCAT::zvmUtils->findzFcpDeviceAttr($user, $hcp, $pool, $wwpn, $lun);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub findzFcpDeviceAttr {
|
||||
|
||||
# Get inputs
|
||||
my ( $class, $user, $hcp, $pool, $wwpn, $lun ) = @_;
|
||||
|
||||
my $sudo = "sudo";
|
||||
if ($user eq "root") {
|
||||
$sudo = "";
|
||||
}
|
||||
|
||||
# Directory where FCP disk pools are on zHCP
|
||||
my $zfcpDir = "/var/opt/zhcp/zfcp";
|
||||
|
||||
# Find the SCSI/FCP device
|
||||
# Entry order: status,wwpn,lun,size,range,owner,channel,tag
|
||||
my @info = split("\n", `ssh $user\@$hcp "$sudo grep -i \"$wwpn,$lun\" $zfcpDir/$pool.conf"`);
|
||||
my $entry = $info[0];
|
||||
chomp($entry);
|
||||
|
||||
# Do not continue if no device is found
|
||||
my %attrs = ();
|
||||
if (!$entry) {
|
||||
return \%attrs;
|
||||
}
|
||||
|
||||
@info = split(',', $entry);
|
||||
%attrs = (
|
||||
'status' => $info[0],
|
||||
'wwpn' => $info[1],
|
||||
'lun' => $info[2],
|
||||
'size' => $info[3],
|
||||
'range' => $info[4],
|
||||
'owner' => $info[5],
|
||||
'fcp' => $info[6],
|
||||
'tag' => $info[7]
|
||||
);
|
||||
|
||||
return \%attrs;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 findUsablezHcpNetwork
|
||||
|
||||
Description : Find a useable NIC shared with the zHCP for a given user Id
|
||||
Arguments : User (root or non-root)
|
||||
zHCP
|
||||
User Id to find a useable NIC on
|
||||
DHCP is used or not (0 or 1)
|
||||
Returns : NIC, device channel, and layer (2 or 3)
|
||||
Example : my ($nic, $channel, $layer) = xCAT::zvmUtils->findUsablezHcpNetwork($user, $hcp, $userId, $dhcp);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub findUsablezHcpNetwork {
|
||||
# Get inputs
|
||||
my ( $class, $user, $hcp, $userId, $dhcp ) = @_;
|
||||
|
||||
my $sudo = "sudo";
|
||||
if ($user eq "root") {
|
||||
$sudo = "";
|
||||
}
|
||||
|
||||
my $nic = ''; # Usuable NIC on zHCP
|
||||
my $channel = ''; # Device channel where NIC is attached
|
||||
my $layer;
|
||||
my $i;
|
||||
my @words;
|
||||
|
||||
# Get the networks used by the zHCP
|
||||
my @hcpNetworks = xCAT::zvmCPUtils->getNetworkNamesArray($user, $hcp);
|
||||
|
||||
# Search directory entry for network name
|
||||
my $userEntry = `ssh $user\@$hcp "$sudo $::DIR/smcli Image_Query_DM -T $userId" | sed '\$d'`;
|
||||
xCAT::zvmUtils->printSyslog("findUsablezHcpNetwork() smcli Image_Query_DM -T $userId");
|
||||
xCAT::zvmUtils->printSyslog("findUsablezHcpNetwork() $userEntry");
|
||||
|
||||
my $out = `echo "$userEntry" | grep "NICDEF"`;
|
||||
my @lines = split('\n', $out);
|
||||
|
||||
# Go through each line
|
||||
for ($i = 0; $i < @lines; $i++) {
|
||||
# Go through each network device attached to zHCP
|
||||
foreach (@hcpNetworks) {
|
||||
|
||||
# If network device is found
|
||||
if ($lines[$i] =~ m/ $_/i) {
|
||||
# Get network layer
|
||||
$layer = xCAT::zvmCPUtils->getNetworkLayer($user, $hcp, $_);
|
||||
xCAT::zvmUtils->printSyslog("findUsablezHcpNetwork() NIC:$_ layer:$layer");
|
||||
|
||||
# If template using DHCP, layer must be 2
|
||||
if ((!$dhcp && $layer != 2) || (!$dhcp && $layer == 2) || ($dhcp && $layer == 2)) {
|
||||
# Save network name
|
||||
$nic = $_;
|
||||
|
||||
# Get network virtual address
|
||||
@words = split(' ', $lines[$i]);
|
||||
|
||||
# Get virtual address (channel)
|
||||
# Convert subchannel to decimal
|
||||
$channel = sprintf('%d', hex($words[1]));
|
||||
|
||||
xCAT::zvmUtils->printSyslog("findUsablezHcpNetwork() Candidate found NIC:$nic channel:$channel layer:$layer");
|
||||
return ($nic, $channel, $layer);
|
||||
} else {
|
||||
# Go to next network available
|
||||
$nic = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# If network device is not found
|
||||
if (!$nic) {
|
||||
# Check for user profile
|
||||
my $profileName = `echo "$userEntry" | grep "INCLUDE"`;
|
||||
if ($profileName) {
|
||||
@words = split(' ', xCAT::zvmUtils->trimStr($profileName));
|
||||
|
||||
# Get user profile
|
||||
my $userProfile = xCAT::zvmUtils->getUserProfile($user, $hcp, $words[1]);
|
||||
xCAT::zvmUtils->printSyslog("findUsablezHcpNetwork() $userProfile");
|
||||
|
||||
# Get the NICDEF statement containing the HCP network
|
||||
$out = `echo "$userProfile" | grep "NICDEF"`;
|
||||
@lines = split('\n', $out);
|
||||
|
||||
# Go through each line
|
||||
for ($i = 0; $i < @lines; $i++) {
|
||||
# Go through each network device attached to zHCP
|
||||
foreach (@hcpNetworks) {
|
||||
|
||||
# If network device is found
|
||||
if ($lines[$i] =~ m/ $_/i) {
|
||||
# Get network layer
|
||||
$layer = xCAT::zvmCPUtils->getNetworkLayer($user, $hcp, $_);
|
||||
xCAT::zvmUtils->printSyslog("findUsablezHcpNetwork() NIC:$_ layer:$layer");
|
||||
|
||||
# If template using DHCP, layer must be 2
|
||||
if ((!$dhcp && $layer != 2) || (!$dhcp && $layer == 2) || ($dhcp && $layer == 2)) {
|
||||
# Save network name
|
||||
$nic = $_;
|
||||
|
||||
# Get network virtual address
|
||||
@words = split(' ', $lines[$i]);
|
||||
|
||||
# Get virtual address (channel)
|
||||
# Convert subchannel to decimal
|
||||
$channel = sprintf('%d', hex($words[1]));
|
||||
|
||||
xCAT::zvmUtils->printSyslog("findUsablezHcpNetwork() Candidate found NIC:$nic channel:$channel layer:$layer");
|
||||
return ($nic, $channel, $layer);
|
||||
} else {
|
||||
# Go to next network available
|
||||
$nic = '';
|
||||
}
|
||||
}
|
||||
} # End of foreach
|
||||
} # End of for
|
||||
} # End of if
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,326 @@
|
||||
<html xmlns:o="urn:schemas-microsoft-com:office:office"
|
||||
xmlns:w="urn:schemas-microsoft-com:office:word"
|
||||
xmlns="http://www.w3.org/TR/REC-html40">
|
||||
|
||||
<head>
|
||||
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
|
||||
<meta name=ProgId content=Word.Document>
|
||||
<meta name=Generator content="Microsoft Word 9">
|
||||
<meta name=Originator content="Microsoft Word 9">
|
||||
<title>Eclipse Public License - Version 1.0</title>
|
||||
<!--[if gte mso 9]><xml>
|
||||
<o:DocumentProperties>
|
||||
<o:Revision>2</o:Revision>
|
||||
<o:TotalTime>3</o:TotalTime>
|
||||
<o:Created>2004-03-05T23:03:00Z</o:Created>
|
||||
<o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
|
||||
<o:Pages>4</o:Pages>
|
||||
<o:Words>1626</o:Words>
|
||||
<o:Characters>9270</o:Characters>
|
||||
<o:Lines>77</o:Lines>
|
||||
<o:Paragraphs>18</o:Paragraphs>
|
||||
<o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
|
||||
<o:Version>9.4402</o:Version>
|
||||
</o:DocumentProperties>
|
||||
</xml><![endif]--><!--[if gte mso 9]><xml>
|
||||
<w:WordDocument>
|
||||
<w:TrackRevisions/>
|
||||
</w:WordDocument>
|
||||
</xml><![endif]-->
|
||||
<style>
|
||||
<!--
|
||||
/* Font Definitions */
|
||||
@font-face
|
||||
{font-family:Tahoma;
|
||||
panose-1:2 11 6 4 3 5 4 4 2 4;
|
||||
mso-font-charset:0;
|
||||
mso-generic-font-family:swiss;
|
||||
mso-font-pitch:variable;
|
||||
mso-font-signature:553679495 -2147483648 8 0 66047 0;}
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{mso-style-parent:"";
|
||||
margin:0in;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
p
|
||||
{margin-right:0in;
|
||||
mso-margin-top-alt:auto;
|
||||
mso-margin-bottom-alt:auto;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
p.BalloonText, li.BalloonText, div.BalloonText
|
||||
{mso-style-name:"Balloon Text";
|
||||
margin:0in;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:8.0pt;
|
||||
font-family:Tahoma;
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
@page Section1
|
||||
{size:8.5in 11.0in;
|
||||
margin:1.0in 1.25in 1.0in 1.25in;
|
||||
mso-header-margin:.5in;
|
||||
mso-footer-margin:.5in;
|
||||
mso-paper-source:0;}
|
||||
div.Section1
|
||||
{page:Section1;}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body lang=EN-US style='tab-interval:.5in'>
|
||||
|
||||
<div class=Section1>
|
||||
|
||||
<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
|
||||
</p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>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.</span> </p>
|
||||
|
||||
<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
|
||||
in the case of the initial Contributor, the initial code and documentation
|
||||
distributed under this Agreement, and<br clear=left>
|
||||
b) in the case of each subsequent Contributor:</span></p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
|
||||
changes to the Program, and</span></p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
|
||||
additions to the Program;</span></p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>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. </span></p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>"Contributor" means any person or
|
||||
entity that distributes the Program.</span> </p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>"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. </span></p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>"Program" means the Contributions
|
||||
distributed in accordance with this Agreement.</span> </p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>"Recipient" means anyone who
|
||||
receives the Program under this Agreement, including all Contributors.</span> </p>
|
||||
|
||||
<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
|
||||
Subject to the terms of this Agreement, each Contributor hereby grants Recipient
|
||||
a non-exclusive, worldwide, royalty-free copyright license to<span
|
||||
style='color:red'> </span>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.</span></p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
|
||||
Subject to the terms of this Agreement, each Contributor hereby grants
|
||||
Recipient a non-exclusive, worldwide,<span style='color:green'> </span>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. </span></p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>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.</span></p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>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. </span></p>
|
||||
|
||||
<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
|
||||
Program in object code form under its own license agreement, provided that:</span>
|
||||
</p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
|
||||
it complies with the terms and conditions of this Agreement; and</span></p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
|
||||
its license agreement:</span></p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>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; </span></p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
|
||||
effectively excludes on behalf of all Contributors all liability for damages,
|
||||
including direct, indirect, special, incidental and consequential damages, such
|
||||
as lost profits; </span></p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
|
||||
states that any provisions which differ from this Agreement are offered by that
|
||||
Contributor alone and not by any other party; and</span></p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>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.<span style='color:blue'> </span></span></p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>When the Program is made available in source
|
||||
code form:</span> </p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
|
||||
it must be made available under this Agreement; and </span></p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
|
||||
copy of this Agreement must be included with each copy of the Program. </span></p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
|
||||
copyright notices contained within the Program. </span></p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>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. </span></p>
|
||||
|
||||
<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>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.</span> </p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>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.</span> </p>
|
||||
|
||||
<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>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. </span></p>
|
||||
|
||||
<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>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.</span> </p>
|
||||
|
||||
<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>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.</span> </p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>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. </span></p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>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. </span></p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>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.</span> </p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>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.</span> </p>
|
||||
|
||||
<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,15 @@
|
||||
AllCops:
|
||||
Excludes:
|
||||
- test/**
|
||||
- vendor/**
|
||||
|
||||
AlignParameters:
|
||||
Enabled: false
|
||||
Encoding:
|
||||
Enabled: false
|
||||
HashSyntax:
|
||||
Enabled: false
|
||||
LineLength:
|
||||
Enabled: false
|
||||
MethodLength:
|
||||
Max: 30
|
||||
@@ -0,0 +1,9 @@
|
||||
rvm:
|
||||
- 1.9.3
|
||||
- 2.0.0
|
||||
before_script:
|
||||
- bundle exec berks install
|
||||
script:
|
||||
- bundle exec foodcritic -f any . --tags ~FC007 --tags ~FC015 --tags ~FC023
|
||||
# - bundle exec rspec --color --format progress
|
||||
- bundle exec rubocop
|
||||
@@ -0,0 +1,7 @@
|
||||
site :opscode
|
||||
metadata
|
||||
|
||||
group :integration do
|
||||
cookbook 'apt', '~> 2.0'
|
||||
cookbook 'yum', '~> 2.0'
|
||||
end
|
||||
@@ -0,0 +1,198 @@
|
||||
apache2 Cookbook Changelog
|
||||
==========================
|
||||
This file is used to list changes made in each version of the apache2 cookbook.
|
||||
|
||||
v1.8.4
|
||||
------
|
||||
### Bug
|
||||
- **[COOK-3769](https://tickets.opscode.com/browse/COOK-3769)** - Fix a critical bug where the `apache_module` could not enable modules
|
||||
|
||||
|
||||
v1.8.2
|
||||
------
|
||||
### Bug
|
||||
- **[COOK-3766](https://tickets.opscode.com/browse/COOK-3766)** - Fix an issue where the `mod_ssl` recipe fails due to a missing attribute
|
||||
|
||||
|
||||
v1.8.0
|
||||
------
|
||||
### Bug
|
||||
- **[COOK-3680](https://tickets.opscode.com/browse/COOK-3680)** - Update template paths
|
||||
- **[COOK-3570](https://tickets.opscode.com/browse/COOK-3570)** - Apache cookbook breaks on RHEL / CentOS 6
|
||||
- **[COOK-2944](https://tickets.opscode.com/browse/COOK-2944)** - Fix foodcritic failures
|
||||
- **[COOK-2893](https://tickets.opscode.com/browse/COOK-2893)** - Improve mod_auth_openid recipe with guards and idempotency
|
||||
- **[COOK-2758](https://tickets.opscode.com/browse/COOK-2758)** - Fix use of non-existent attribute
|
||||
|
||||
### New Feature
|
||||
- **[COOK-3665](https://tickets.opscode.com/browse/COOK-3665)** - Add recipe for mod_userdir
|
||||
- **[COOK-3646](https://tickets.opscode.com/browse/COOK-3646)** - Add recipe for mod_cloudflare
|
||||
- **[COOK-3213](https://tickets.opscode.com/browse/COOK-3213)** - Add recipe for mod_info
|
||||
|
||||
### Improvement
|
||||
- **[COOK-3656](https://tickets.opscode.com/browse/COOK-3656)** - Parameterize apache2 binary
|
||||
- **[COOK-3562](https://tickets.opscode.com/browse/COOK-3562)** - Allow mod_proxy settings to be configured as attributes
|
||||
- **[COOK-3326](https://tickets.opscode.com/browse/COOK-3326)** - Fix default_test to use ServerTokens attribute
|
||||
- **[COOK-2635](https://tickets.opscode.com/browse/COOK-2635)** - Add support for SVG mime types
|
||||
- **[COOK-2598](https://tickets.opscode.com/browse/COOK-2598)** - FastCGI Module only works on Debian-based platforms
|
||||
- **[COOK-1984](https://tickets.opscode.com/browse/COOK-1984)** - Add option to configure the address apache listens to
|
||||
|
||||
|
||||
v1.7.0
|
||||
------
|
||||
### Improvement
|
||||
|
||||
- [COOK-3073]: make access.log location configurable per-platform
|
||||
- [COOK-3074]: don't hardcode the error.log location in the default site config
|
||||
- [COOK-3268]: don't hardcode DocumentRoot and cgi-bin locations in `default_site`
|
||||
|
||||
### New Feature
|
||||
|
||||
- [COOK-3184]: Add `mod_filter` recipe to Apache2-cookbook
|
||||
- [COOK-3236]: Add `mod_action` recipe to Apache2-cookbook
|
||||
|
||||
v1.6.6
|
||||
------
|
||||
1.6.4 had a missed step in the automated release, long live 1.6.6.
|
||||
|
||||
### Bug
|
||||
|
||||
- [COOK-3018]: apache2_module does duplicate delayed restart of apache2 service when conf = true
|
||||
- [COOK-3027]: Default site enable true, then false, does not disable default site
|
||||
- [COOK-3109]: fix apache lib_dir arch attribute regexp
|
||||
|
||||
v1.6.2
|
||||
------
|
||||
- [COOK-2535] - `mod_auth_openid` requires libtool to run autogen.sh
|
||||
- [COOK-2667] - Typo in usage documentation
|
||||
- [COOK-2461] - `apache2::mod_auth_openid` fails on some ubuntu systems
|
||||
- [COOK-2720] - Apache2 minitest helper function `ran_recipe` is not portable
|
||||
|
||||
v1.6.0
|
||||
------
|
||||
- [COOK-2372] - apache2 mpm_worker: add ServerLimit attribute (default to 16)
|
||||
|
||||
v1.5.0
|
||||
------
|
||||
The `mod_auth_openid` attributes are changed. The upstream maintainer deprecated the older release versions, and the source repository has releases available at specific SHA1SUM references. The new attribute, `node['apache']['mod_auth_openid']['ref']` is used to set this.
|
||||
|
||||
- [COOK-2198] - `apache::mod_auth_openid` compiles from source, but does not install make on debian/ubuntu
|
||||
- [COOK-2224] - version conflict between cucumber and other gems
|
||||
- [COOK-2248] - `apache2::mod_php5` uses `not_if` "which php" without ensuring package 'which' is installed
|
||||
- [COOK-2269] - Set allow list for mod_status incase external monitor scripts need
|
||||
- [COOK-2276] - cookbook apache2 documentation regarding listening ports doesn't match default attributes
|
||||
- [COOK-2296] - `mod_auth_openid` doesn't have tags/releases for the version I need for features and fixes
|
||||
- [COOK-2323] - Add Oracle linux support
|
||||
|
||||
v1.4.2
|
||||
------
|
||||
- [COOK-1721] - fix logrotate recipe
|
||||
|
||||
v1.4.0
|
||||
------
|
||||
- [COOK-1456] - iptables enhancements
|
||||
- [COOK-1473] - apache2 does not disable default site when setting "`default_site_enabled`" back to false
|
||||
- [COOK-1824] - the apache2 cookbook needs to specify which binary is used on rhel platform
|
||||
- [COOK-1916] - Download location wrong for apache2 `mod_auth_openid` >= 0.7
|
||||
- [COOK-1917] - Improve `mod_auth_openid` recipe to handle module upgrade more gracefully
|
||||
- [COOK-2029] - apache2 restarts on every run on RHEL and friends, generate-module-list on every run.
|
||||
- [COOK-2036] - apache2: Cookbook style
|
||||
|
||||
v1.3.2
|
||||
------
|
||||
- [COOK-1804] - fix `web_app` definition parameter so site can be disabled.
|
||||
|
||||
v1.3.0
|
||||
------
|
||||
- [COOK-1738] - Better configuration for `mod_include` and some overrides in `web_app` definition
|
||||
- [COOK-1470] - Change SSL Ciphers to Mitigate BEAST attack
|
||||
|
||||
v1.2.0
|
||||
------
|
||||
- [COOK-692] - delete package conf.d files in module recipes, for EL
|
||||
- [COOK-1693] - Foodcritic finding for unnecessary string interpolation
|
||||
- [COOK-1757] - platform_family and better style / usage practices
|
||||
|
||||
v1.1.16
|
||||
-------
|
||||
re-releasing as .16 due to error on tag 1.1.14
|
||||
|
||||
- [COOK-1466] - add `mod_auth_cas` recipe
|
||||
- [COOK-1609] - apache2 changes ports.conf twice per run when using apache2::mod_ssl
|
||||
|
||||
v1.1.12
|
||||
-------
|
||||
- [COOK-1436] - restore apache2 web_app definition
|
||||
- [COOK-1356] - allow ExtendedStatus via attribute
|
||||
- [COOK-1403] - add mod_fastcgi recipe
|
||||
|
||||
v1.1.10
|
||||
-------
|
||||
- [COOK-1315] - allow the default site to not be enabled
|
||||
- [COOK-1328] - cookbook tests (minitest, cucumber)
|
||||
|
||||
v1.1.8
|
||||
------
|
||||
- Some platforms with minimal installations that don't have perl won't have a `node['languages']['perl']` attribute, so remove the conditional and rely on the power of idempotence in the package resource.
|
||||
- [COOK-1214] - address foodcritic warnings
|
||||
- [COOK-1180] - add `mod_logio` and fix `mod_proxy`
|
||||
|
||||
v1.1.6
|
||||
------
|
||||
FreeBSD users: This release requires the `freebsd` cookbook. See README.md.
|
||||
|
||||
- [COOK-1025] - freebsd support in mod_php5 recipe
|
||||
|
||||
v1.1.4
|
||||
------
|
||||
- [COOK-1100] - support amazon linux
|
||||
|
||||
v1.1.2
|
||||
------
|
||||
- [COOK-996] - apache2::mod_php5 can cause PHP and module API mismatches
|
||||
- [COOK-1083] - return string for v_f_p and use correct value for default
|
||||
|
||||
v1.1.0
|
||||
------
|
||||
- [COOK-861] - Add `mod_perl` and apreq2
|
||||
- [COOK-941] - fix `mod_auth_openid` on FreeBSD
|
||||
- [COOK-1021] - add a commented-out LoadModule directive to keep apxs happy
|
||||
- [COOK-1022] - consistency for icondir attribute
|
||||
- [COOK-1023] - fix platform test for attributes
|
||||
- [COOK-1024] - fix a2enmod script so it runs cleanly on !bash
|
||||
- [COOK-1026] - fix `error_log` location on FreeBSD
|
||||
|
||||
v1.0.8
|
||||
------
|
||||
- COOK-548 - directory resource doesn't have backup parameter
|
||||
|
||||
v1.0.6
|
||||
------
|
||||
- COOK-915 - update to `mod_auth_openid` version 0.6, see __Recipes/mod_auth_openid__ below.
|
||||
- COOK-548 - Add support for FreeBSD.
|
||||
|
||||
v1.0.4
|
||||
------
|
||||
- COOK-859 - don't hardcode module paths
|
||||
|
||||
v1.0.2
|
||||
------
|
||||
- Tickets resolved in this release: COOK-788, COOK-782, COOK-780
|
||||
|
||||
v1.0.0
|
||||
------
|
||||
- Red Hat family support is greatly improved, all recipes except `god_monitor` converge.
|
||||
- Recipe `mod_auth_openid` now works on RHEL family distros
|
||||
- Recipe `mod_php5` will now remove config from package on RHEL family so it doesn't conflict with the cookbook's.
|
||||
- Added `php5.conf.erb` template for `mod_php5` recipe.
|
||||
- Create the run state directory for `mod_fcgid` to prevent a startup error on RHEL version 6.
|
||||
- New attribute `node['apache']['lib_dir']` to handle lib vs lib64 on RHEL family distributions.
|
||||
- New attribute `node['apache']['group']`.
|
||||
- Scientific Linux support added.
|
||||
- Use a file resource instead of the generate-module-list executed perl script on RHEL family.
|
||||
- "default" site can now be disabled.
|
||||
- web_app now has an "enable" parameter.
|
||||
- Support for dav_fs apache module.
|
||||
- Tickets resolved in this release: COOK-754, COOK-753, COOK-665, COOK-624, COOK-579, COOK-519, COOK-518
|
||||
- Fix node references in template for a2dissite
|
||||
- Use proper user and group attributes on files and templates.
|
||||
- Replace the anemic README.rdoc with this new and improved superpowered README.md :).
|
||||
@@ -0,0 +1,257 @@
|
||||
# Contributing to Opscode Cookbooks
|
||||
|
||||
We are glad you want to contribute to Opscode Cookbooks! The first
|
||||
step is the desire to improve the project.
|
||||
|
||||
You can find the answers to additional frequently asked questions
|
||||
[on the wiki](http://wiki.opscode.com/display/chef/How+to+Contribute).
|
||||
|
||||
You can find additional information about
|
||||
[contributing to cookbooks](http://wiki.opscode.com/display/chef/How+to+Contribute+to+Opscode+Cookbooks)
|
||||
on the wiki as well.
|
||||
|
||||
## Quick-contribute
|
||||
|
||||
* Create an account on our [bug tracker](http://tickets.opscode.com)
|
||||
* Sign our contributor agreement (CLA)
|
||||
[ online](https://secure.echosign.com/public/hostedForm?formid=PJIF5694K6L)
|
||||
(keep reading if you're contributing on behalf of your employer)
|
||||
* Create a ticket for your change on the
|
||||
[bug tracker](http://tickets.opscode.com)
|
||||
* Link to your patch as a rebased git branch or pull request from the
|
||||
ticket
|
||||
* Resolve the ticket as fixed
|
||||
|
||||
We regularly review contributions and will get back to you if we have
|
||||
any suggestions or concerns.
|
||||
|
||||
## The Apache License and the CLA/CCLA
|
||||
|
||||
Licensing is very important to open source projects, it helps ensure
|
||||
the software continues to be available under the terms that the author
|
||||
desired. Chef uses the Apache 2.0 license to strike a balance between
|
||||
open contribution and allowing you to use the software however you
|
||||
would like to.
|
||||
|
||||
The license tells you what rights you have that are provided by the
|
||||
copyright holder. It is important that the contributor fully
|
||||
understands what rights they are licensing and agrees to them.
|
||||
Sometimes the copyright holder isn't the contributor, most often when
|
||||
the contributor is doing work for a company.
|
||||
|
||||
To make a good faith effort to ensure these criteria are met, Opscode
|
||||
requires a Contributor License Agreement (CLA) or a Corporate
|
||||
Contributor License Agreement (CCLA) for all contributions. This is
|
||||
without exception due to some matters not being related to copyright
|
||||
and to avoid having to continually check with our lawyers about small
|
||||
patches.
|
||||
|
||||
It only takes a few minutes to complete a CLA, and you retain the
|
||||
copyright to your contribution.
|
||||
|
||||
You can complete our contributor agreement (CLA)
|
||||
[ online](https://secure.echosign.com/public/hostedForm?formid=PJIF5694K6L).
|
||||
If you're contributing on behalf of your employer, have your employer
|
||||
fill out our
|
||||
[Corporate CLA](https://secure.echosign.com/public/hostedForm?formid=PIE6C7AX856)
|
||||
instead.
|
||||
|
||||
## Ticket Tracker (JIRA)
|
||||
|
||||
The [ticket tracker](http://tickets.opscode.com) is the most important
|
||||
documentation for the code base. It provides significant historical
|
||||
information, such as:
|
||||
|
||||
* Which release a bug fix is included in
|
||||
* Discussion regarding the design and merits of features
|
||||
* Error output to aid in finding similar bugs
|
||||
|
||||
Each ticket should aim to fix one bug or add one feature.
|
||||
|
||||
## Using git
|
||||
|
||||
You can get a quick copy of the repository for this cookbook by
|
||||
running `git clone
|
||||
git://github.com/opscode-coobkooks/COOKBOOKNAME.git`.
|
||||
|
||||
For collaboration purposes, it is best if you create a Github account
|
||||
and fork the repository to your own account. Once you do this you will
|
||||
be able to push your changes to your Github repository for others to
|
||||
see and use.
|
||||
|
||||
If you have another repository in your GitHub account named the same
|
||||
as the cookbook, we suggest you suffix the repository with -cookbook.
|
||||
|
||||
### Branches and Commits
|
||||
|
||||
You should submit your patch as a git branch named after the ticket,
|
||||
such as COOK-1337. This is called a _topic branch_ and allows users to
|
||||
associate a branch of code with the ticket.
|
||||
|
||||
It is a best practice to have your commit message have a _summary
|
||||
line_ that includes the ticket number, followed by an empty line and
|
||||
then a brief description of the commit. This also helps other
|
||||
contributors understand the purpose of changes to the code.
|
||||
|
||||
[COOK-1757] - platform_family and style
|
||||
|
||||
* use platform_family for platform checking
|
||||
* update notifies syntax to "resource_type[resource_name]" instead of
|
||||
resources() lookup
|
||||
* COOK-692 - delete config files dropped off by packages in conf.d
|
||||
* dropped debian 4 support because all other platforms have the same
|
||||
values, and it is older than "old stable" debian release
|
||||
|
||||
Remember that not all users use Chef in the same way or on the same
|
||||
operating systems as you, so it is helpful to be clear about your use
|
||||
case and change so they can understand it even when it doesn't apply
|
||||
to them.
|
||||
|
||||
### Github and Pull Requests
|
||||
|
||||
All of Opscode's open source cookbook projects are available on
|
||||
[Github](http://www.github.com/opscode-cookbooks).
|
||||
|
||||
We don't require you to use Github, and we will even take patch diffs
|
||||
attached to tickets on the tracker. However Github has a lot of
|
||||
convenient features, such as being able to see a diff of changes
|
||||
between a pull request and the main repository quickly without
|
||||
downloading the branch.
|
||||
|
||||
If you do choose to use a pull request, please provide a link to the
|
||||
pull request from the ticket __and__ a link to the ticket from the
|
||||
pull request. Because pull requests only have two states, open and
|
||||
closed, we can't easily filter pull requests that are waiting for a
|
||||
reply from the author for various reasons.
|
||||
|
||||
### More information
|
||||
|
||||
Additional help with git is available on the
|
||||
[Working with Git](http://wiki.opscode.com/display/chef/Working+with+Git)
|
||||
wiki page.
|
||||
|
||||
## Functional and Unit Tests
|
||||
|
||||
This cookbook is set up to run tests under
|
||||
[Opscode's test-kitchen](https://github.com/opscode/test-kitchen). It
|
||||
uses minitest-chef to run integration tests after the node has been
|
||||
converged to verify that the state of the node.
|
||||
|
||||
Test kitchen should run completely without exception using the default
|
||||
[baseboxes provided by Opscode](https://github.com/opscode/bento).
|
||||
Because Test Kitchen creates VirtualBox machines and runs through
|
||||
every configuration in the Kitchenfile, it may take some time for
|
||||
these tests to complete.
|
||||
|
||||
If your changes are only for a specific recipe, run only its
|
||||
configuration with Test Kitchen. If you are adding a new recipe, or
|
||||
other functionality such as a LWRP or definition, please add
|
||||
appropriate tests and ensure they run with Test Kitchen.
|
||||
|
||||
If any don't pass, investigate them before submitting your patch.
|
||||
|
||||
Any new feature should have unit tests included with the patch with
|
||||
good code coverage to help protect it from future changes. Similarly,
|
||||
patches that fix a bug or regression should have a _regression test_.
|
||||
Simply put, this is a test that would fail without your patch but
|
||||
passes with it. The goal is to ensure this bug doesn't regress in the
|
||||
future. Consider a regular expression that doesn't match a certain
|
||||
pattern that it should, so you provide a patch and a test to ensure
|
||||
that the part of the code that uses this regular expression works as
|
||||
expected. Later another contributor may modify this regular expression
|
||||
in a way that breaks your use cases. The test you wrote will fail,
|
||||
signalling to them to research your ticket and use case and accounting
|
||||
for it.
|
||||
|
||||
If you need help writing tests, please ask on the Chef Developer's
|
||||
mailing list, or the #chef-hacking IRC channel.
|
||||
|
||||
## Code Review
|
||||
|
||||
Opscode regularly reviews code contributions and provides suggestions
|
||||
for improvement in the code itself or the implementation.
|
||||
|
||||
We find contributions by searching the ticket tracker for _resolved_
|
||||
tickets with a status of _fixed_. If we have feedback we will reopen
|
||||
the ticket and you should resolve it again when you've made the
|
||||
changes or have a response to our feedback. When we believe the patch
|
||||
is ready to be merged, we will tag the _Code Reviewed_ field with
|
||||
_Reviewed_.
|
||||
|
||||
Depending on the project, these tickets are then merged within a week
|
||||
or two, depending on the current release cycle.
|
||||
|
||||
## Release Cycle
|
||||
|
||||
The versioning for Opscode Cookbook projects is X.Y.Z.
|
||||
|
||||
* X is a major release, which may not be fully compatible with prior
|
||||
major releases
|
||||
* Y is a minor release, which adds both new features and bug fixes
|
||||
* Z is a patch release, which adds just bug fixes
|
||||
|
||||
A released version of a cookbook will end in an even number, e.g.
|
||||
"1.2.4" or "0.8.0". When development for the next version of the
|
||||
cookbook begins, the "Z" patch number is incremented to the next odd
|
||||
number, however the next release of the cookbook may be a major or
|
||||
minor incrementing version.
|
||||
|
||||
Releases of Opscode's cookbooks are usually announced on the Chef user
|
||||
mailing list. Releases of several cookbooks may be batched together
|
||||
and announced on the [Opscode Blog](http://www.opscode.com/blog).
|
||||
|
||||
## Working with the community
|
||||
|
||||
These resources will help you learn more about Chef and connect to
|
||||
other members of the Chef community:
|
||||
|
||||
* [chef](http://lists.opscode.com/sympa/info/chef) and
|
||||
[chef-dev](http://lists.opscode.com/sympa/info/chef-dev) mailing
|
||||
lists
|
||||
* #chef and #chef-hacking IRC channels on irc.freenode.net
|
||||
* [Community Cookbook site](http://community.opscode.com)
|
||||
* [Chef wiki](http://wiki.opscode.com/display/chef)
|
||||
* Opscode Chef [product page](http://www.opscode.com/chef)
|
||||
|
||||
|
||||
## Cookbook Contribution Do's and Don't's
|
||||
|
||||
Please do include tests for your contribution. If you need help, ask
|
||||
on the
|
||||
[chef-dev mailing list](http://lists.opscode.com/sympa/info/chef-dev)
|
||||
or the
|
||||
[#chef-hacking IRC channel](http://community.opscode.com/chat/chef-hacking).
|
||||
Not all platforms that a cookbook supports may be supported by Test
|
||||
Kitchen. Please provide evidence of testing your contribution if it
|
||||
isn't trivial so we don't have to duplicate effort in testing. Chef
|
||||
10.14+ "doc" formatted output is sufficient.
|
||||
|
||||
Please do indicate new platform (families) or platform versions in the
|
||||
commit message, and update the relevant ticket.
|
||||
|
||||
If a contribution adds new platforms or platform versions, indicate
|
||||
such in the body of the commit message(s), and update the relevant
|
||||
COOK ticket. When writing commit messages, it is helpful for others if
|
||||
you indicate the COOK ticket. For example:
|
||||
|
||||
git commit -m '[COOK-1041] - Updated pool resource to correctly
|
||||
delete.'
|
||||
|
||||
Please do use [foodcritic](http://acrmp.github.com/foodcritic) to
|
||||
lint-check the cookbook. Except FC007, it should pass all correctness
|
||||
rules. FC007 is okay as long as the dependent cookbooks are *required*
|
||||
for the default behavior of the cookbook, such as to support an
|
||||
uncommon platform, secondary recipe, etc.
|
||||
|
||||
Please do ensure that your changes do not break or modify behavior for
|
||||
other platforms supported by the cookbook. For example if your changes
|
||||
are for Debian, make sure that they do not break on CentOS.
|
||||
|
||||
Please do not modify the version number in the metadata.rb, Opscode
|
||||
will select the appropriate version based on the release cycle
|
||||
information above.
|
||||
|
||||
Please do not update the CHANGELOG.md for a new version. Not all
|
||||
changes to a cookbook may be merged and released in the same versions.
|
||||
Opscode will update the CHANGELOG.md when releasing a new version of
|
||||
the cookbook.
|
||||
@@ -0,0 +1,23 @@
|
||||
# source "https://rubygems.org"
|
||||
|
||||
# gem 'cucumber', '~> 1.2.0'
|
||||
# gem 'httparty', '~> 0.8.3'
|
||||
# gem 'minitest', '~> 3.0.0'
|
||||
# gem 'nokogiri', '~> 1.5.0'
|
||||
|
||||
# group :kitchen do
|
||||
# gem 'test-kitchen', '< 1.0'
|
||||
# end
|
||||
|
||||
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem 'berkshelf', '~> 2.0'
|
||||
gem 'chefspec', '~> 2.0'
|
||||
gem 'foodcritic', '~> 3.0'
|
||||
gem 'rubocop', '~> 0.12'
|
||||
|
||||
group :integration do
|
||||
gem 'test-kitchen', '~> 1.0.0.beta'
|
||||
gem 'kitchen-vagrant', '~> 0.11'
|
||||
end
|
||||
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) 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. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
||||
@@ -0,0 +1,586 @@
|
||||
apache2 Cookbook
|
||||
================
|
||||
[](http://travis-ci.org/opscode-cookbooks/apache2)
|
||||
|
||||
|
||||
This cookbook provides a complete Debian/Ubuntu style Apache HTTPD
|
||||
configuration. Non-Debian based distributions such as Red Hat/CentOS,
|
||||
ArchLinux and others supported by this cookbook will have a
|
||||
configuration that mimics Debian/Ubuntu style as it is easier to
|
||||
manage with Chef.
|
||||
|
||||
Debian-style Apache configuration uses scripts to manage modules and
|
||||
sites (vhosts). The scripts are:
|
||||
|
||||
* a2ensite
|
||||
* a2dissite
|
||||
* a2enmod
|
||||
* a2dismod
|
||||
|
||||
This cookbook ships with templates of these scripts for non
|
||||
Debian/Ubuntu platforms. The scripts are used in the __Definitions__
|
||||
below.
|
||||
|
||||
Requirements
|
||||
============
|
||||
|
||||
## Ohai and Chef:
|
||||
|
||||
* Ohai: 0.6.12+
|
||||
* Chef: 0.10.10+
|
||||
|
||||
As of v1.2.0, this cookbook makes use of `node['platform_family']` to
|
||||
simplify platform selection logic. This attribute was introduced in
|
||||
Ohai v0.6.12. The recipe methods were introduced in Chef v0.10.10. If
|
||||
you must run an older version of Chef or Ohai, use [version 1.1.16 of
|
||||
this cookbook](http://community.opscode.com/cookbooks/apache2/versions/1_1_16/downloads).
|
||||
|
||||
## Cookbooks:
|
||||
|
||||
This cookbook doesn't have direct dependencies on other cookbooks, as
|
||||
none are needed for the default recipe or the general use cases.
|
||||
|
||||
Depending on your OS configuration and security policy, you may need
|
||||
additional recipes or cookbooks for this cookbook's recipes to
|
||||
converge on the node. In particular, the following Operating System
|
||||
settings may affect the behavior of this cookbook:
|
||||
|
||||
* apt cache outdated
|
||||
* SELinux enabled
|
||||
* IPtables
|
||||
* Compile tools
|
||||
* 3rd party repositories
|
||||
|
||||
On Ubuntu/Debian, use Opscode's `apt` cookbook to ensure the package
|
||||
cache is updated so Chef can install packages, or consider putting
|
||||
apt-get in your bootstrap process or
|
||||
[knife bootstrap template](http://wiki.opscode.com/display/chef/Knife+Bootstrap).
|
||||
|
||||
On RHEL, SELinux is enabled by default. The `selinux` cookbook
|
||||
contains a `permissive` recipe that can be used to set SELinux to
|
||||
"Permissive" state. Otherwise, additional recipes need to be created
|
||||
by the user to address SELinux permissions.
|
||||
|
||||
The easiest but **certainly not ideal way** to deal with IPtables is
|
||||
to flush all rules. Opscode does provide an `iptables` cookbook but is
|
||||
migrating from the approach used there to a more robust solution
|
||||
utilizing a general "firewall" LWRP that would have an "iptables"
|
||||
provider. Alternately, you can use ufw, with Opscode's `ufw` and
|
||||
`firewall` cookbooks to set up rules. See those cookbooks' READMEs for
|
||||
documentation.
|
||||
|
||||
Build/compile tools may not be installed on the system by default.
|
||||
Some recipes (e.g., `apache2::mod_auth_openid`) build the module from
|
||||
source. Use Opscode's `build-essential` cookbook to get essential
|
||||
build packages installed.
|
||||
|
||||
On ArchLinux, if you are using the `apache2::mod_auth_openid` recipe,
|
||||
you also need the `pacman` cookbook for the `pacman_aur` LWRP. Put
|
||||
`recipe[pacman]` on the node's expanded run list (on the node or in a
|
||||
role). This is not an explicit dependency because it is only required
|
||||
for this single recipe and platform; the pacman default recipe
|
||||
performs `pacman -Sy` to keep pacman's package cache updated.
|
||||
|
||||
The `apache2::god_monitor` recipe uses a definition from the `god`
|
||||
cookbook. Include `recipe[god]` in the node's expanded run list to
|
||||
ensure that the cookbook is available to the node, and to set up `god`.
|
||||
|
||||
## Platforms:
|
||||
|
||||
The following platforms and versions are tested and supported using
|
||||
Opscode's [test-kitchen](http://github.com/opscode/test-kitchen).
|
||||
|
||||
* Ubuntu 10.04, 12.04
|
||||
* CentOS 5.8, 6.3
|
||||
|
||||
The following platform families are supported in the code, and are
|
||||
assumed to work based on the successful testing on Ubuntu and CentOS.
|
||||
|
||||
* Debian
|
||||
* Red Hat (rhel)
|
||||
* Fedora
|
||||
* Amazon Linux
|
||||
|
||||
The following platforms are also supported in the code, have been
|
||||
tested manually but are not tested under test-kitchen.
|
||||
|
||||
* SUSE/OpenSUSE
|
||||
* ArchLinux
|
||||
* FreeBSD
|
||||
|
||||
### Notes for RHEL Family:
|
||||
|
||||
On Red Hat Enterprise Linux and derivatives, the EPEL repository may
|
||||
be necessary to install packages used in certain recipes. The
|
||||
`apache2::default` recipe, however, does not require any additional
|
||||
repositories. Opscode's `yum` cookbook contains a recipe to add the
|
||||
EPEL repository. See __Examples__ for more information.
|
||||
|
||||
### Notes for FreeBSD:
|
||||
|
||||
The `apache2::mod_php5` recipe depends on the `freebsd` cookbook,
|
||||
which it uses to set the correct options for compiling the `php5` port
|
||||
from sources. You need to ensure the `freebsd` is in the expanded run
|
||||
list, or this recipe will fail. We don't set an explicit dependency
|
||||
because we feel the `freebsd` cookbook is something users would want
|
||||
on their nodes, and due to the generality of this cookbook we don't
|
||||
want additional specific dependencies.
|
||||
|
||||
Tests
|
||||
=====
|
||||
|
||||
This cookbook in the
|
||||
[source repository](https://github.com/opscode-cookbooks/apache2)
|
||||
contains minitest and cucumber tests. This is an initial proof of
|
||||
concept that will be fleshed out with more supporting infrastructure
|
||||
at a future time.
|
||||
|
||||
Please see the CONTRIBUTING file for information on how to add tests
|
||||
for your contributions.
|
||||
|
||||
Attributes
|
||||
==========
|
||||
|
||||
This cookbook uses many attributes, broken up into a few different
|
||||
kinds.
|
||||
|
||||
Platform specific
|
||||
-----------------
|
||||
|
||||
In order to support the broadest number of platforms, several
|
||||
attributes are determined based on the node's platform. See the
|
||||
attributes/default.rb file for default values in the case statement at
|
||||
the top of the file.
|
||||
|
||||
* `node['apache']['dir']` - Location for the Apache configuration
|
||||
* `node['apache']['log_dir']` - Location for Apache logs
|
||||
* `node['apache']['error_log']` - Location for the default error log
|
||||
* `node['apache']['access_log']` - Location for the default access log
|
||||
* `node['apache']['user']` - User Apache runs as
|
||||
* `node['apache']['group']` - Group Apache runs as
|
||||
* `node['apache']['binary']` - Apache httpd server daemon
|
||||
* `node['apache']['icondir']` - Location for icons
|
||||
* `node['apache']['cache_dir']` - Location for cached files used by Apache itself or recipes
|
||||
* `node['apache']['pid_file']` - Location of the PID file for Apache httpd
|
||||
* `node['apache']['lib_dir']` - Location for shared libraries
|
||||
* `node['apache']['default_site_enabled']` - Default site enabled. Default is false.
|
||||
* `node['apache']['ext_status']` - if true, enables ExtendedStatus for `mod_status`
|
||||
|
||||
General settings
|
||||
----------------
|
||||
|
||||
These are general settings used in recipes and templates. Default
|
||||
values are noted.
|
||||
|
||||
* `node['apache']['listen_addresses']` - Addresses that httpd should listen on. Default is any ("*").
|
||||
* `node['apache']['listen_ports']` - Ports that httpd should listen on. Default is port 80.
|
||||
* `node['apache']['contact']` - Value for ServerAdmin directive. Default "ops@example.com".
|
||||
* `node['apache']['timeout']` - Value for the Timeout directive. Default is 300.
|
||||
* `node['apache']['keepalive']` - Value for the KeepAlive directive. Default is On.
|
||||
* `node['apache']['keepaliverequests']` - Value for MaxKeepAliveRequests. Default is 100.
|
||||
* `node['apache']['keepalivetimeout']` - Value for the KeepAliveTimeout directive. Default is 5.
|
||||
* `node['apache']['default_modules']` - Array of module names. Can take "mod_FOO" or "FOO" as names, where FOO is the apache module, e.g. "`mod_status`" or "`status`".
|
||||
|
||||
The modules listed in `default_modules` will be included as recipes in `recipe[apache::default]`.
|
||||
|
||||
Prefork attributes
|
||||
------------------
|
||||
|
||||
Prefork attributes are used for tuning the Apache HTTPD prefork MPM
|
||||
configuration.
|
||||
|
||||
* `node['apache']['prefork']['startservers']` - initial number of server processes to start. Default is 16.
|
||||
* `node['apache']['prefork']['minspareservers']` - minimum number of spare server processes. Default 16.
|
||||
* `node['apache']['prefork']['maxspareservers']` - maximum number of spare server processes. Default 32.
|
||||
* `node['apache']['prefork']['serverlimit']` - upper limit on configurable server processes. Default 400.
|
||||
* `node['apache']['prefork']['maxclients']` - Maximum number of simultaneous connections.
|
||||
* `node['apache']['prefork']['maxrequestsperchild']` - Maximum number of request a child process will handle. Default 10000.
|
||||
|
||||
Worker attributes
|
||||
-----------------
|
||||
|
||||
Worker attributes are used for tuning the Apache HTTPD worker MPM
|
||||
configuration.
|
||||
|
||||
* `node['apache']['worker']['startservers']` - Initial number of server processes to start. Default 4
|
||||
* `node['apache']['worker']['serverlimit']` - upper limit on configurable server processes. Default 16.
|
||||
* `node['apache']['worker']['maxclients']` - Maximum number of simultaneous connections. Default 1024.
|
||||
* `node['apache']['worker']['minsparethreads']` - Minimum number of spare worker threads. Default 64
|
||||
* `node['apache']['worker']['maxsparethreads']` - Maximum number of spare worker threads. Default 192.
|
||||
* `node['apache']['worker']['maxrequestsperchild']` - Maximum number of requests a child process will handle.
|
||||
|
||||
mod\_auth\_openid attributes
|
||||
----------------------------
|
||||
|
||||
The following attributes are in the `attributes/mod_auth_openid.rb`
|
||||
file. Like all Chef attributes files, they are loaded as well, but
|
||||
they're logistically unrelated to the others, being specific to the
|
||||
`mod_auth_openid` recipe.
|
||||
|
||||
* `node['apache']['mod_auth_openid']['checksum']` - sha256sum of the tarball containing the source.
|
||||
* `node['apache']['mod_auth_openid']['ref']` - Any sha, tag, or branch found from https://github.com/bmuller/mod_auth_openid
|
||||
* `node['apache']['mod_auth_openid']['cache_dir']` - the cache directory is where the sqlite3 database is stored. It is separate so it can be managed as a directory resource.
|
||||
* `node['apache']['mod_auth_openid']['dblocation']` - filename of the sqlite3 database used for directive `AuthOpenIDDBLocation`, stored in the `cache_dir` by default.
|
||||
* `node['apache']['mod_auth_openid']['configure_flags']` - optional array of configure flags passed to the `./configure` step in the compilation of the module.
|
||||
|
||||
mod\_ssl attributes
|
||||
-------------------
|
||||
|
||||
* `node['apache']['mod_ssl']['cipher_suite']` - sets the
|
||||
SSLCiphersuite value to the specified string. The default is
|
||||
considered "sane" but you may need to change it for your local
|
||||
security policy, e.g. if you have PCI-DSS requirements. Additional
|
||||
commentary on the
|
||||
[original pull request](https://github.com/opscode-cookbooks/apache2/pull/15#commitcomment-1605406).
|
||||
|
||||
Recipes
|
||||
=======
|
||||
|
||||
Most of the recipes in the cookbook are for enabling Apache modules.
|
||||
Where additional configuration or behavior is used, it is documented
|
||||
below in more detail.
|
||||
|
||||
The following recipes merely enable the specified module: `mod_alias`,
|
||||
`mod_basic`, `mod_digest`, `mod_authn_file`, `mod_authnz_ldap`,
|
||||
`mod_authz_default`, `mod_authz_groupfile`, `mod_authz_host`,
|
||||
`mod_authz_user`, `mod_autoindex`, `mod_cgi`, `mod_dav_fs`,
|
||||
`mod_dav_svn`, `mod_deflate`, `mod_dir`, `mod_env`, `mod_expires`,
|
||||
`mod_headers`, `mod_ldap`, `mod_log_config`, `mod_mime`,
|
||||
`mod_negotiation`, `mod_proxy`, `mod_proxy_ajp`, `mod_proxy_balancer`,
|
||||
`mod_proxy_connect`, `mod_proxy_http`, `mod_python`, `mod_rewrite`,
|
||||
`mod_setenvif`, `mod_status`, `mod_wsgi`, `mod_xsendfile`.
|
||||
|
||||
On RHEL Family distributions, certain modules ship with a config file
|
||||
with the package. The recipes here may delete those configuration
|
||||
files to ensure they don't conflict with the settings from the
|
||||
cookbook, which will use per-module configuration in
|
||||
`/etc/httpd/mods-enabled`.
|
||||
|
||||
default
|
||||
-------
|
||||
|
||||
The default recipe does a number of things to set up Apache HTTPd. It
|
||||
also includes a number of modules based on the attribute
|
||||
`node['apache']['default_modules']` as recipes.
|
||||
|
||||
logrotate
|
||||
---------
|
||||
|
||||
Logrotate adds a logrotate entry for your apache2 logs. This recipe
|
||||
requires the `logrotate` cookbook; ensure that `recipe[logrotate]` is
|
||||
in the node's expanded run list.
|
||||
|
||||
mod\_auth\_cas
|
||||
--------------
|
||||
|
||||
This recipe installs the proper package and enables the `auth_cas`
|
||||
module. It can install from source or package. Package is the default,
|
||||
set the attribute `node['apache']['mod_auth_cas']['from_source']` to
|
||||
true to enable source installation. Modify the version to install by
|
||||
changing the attribute
|
||||
`node['apache']['mod_auth_cas']['source_revision']`. It is a version
|
||||
tag by default, but could be master, or another tag, or branch.
|
||||
|
||||
The module configuration is written out with the `CASCookiePath` set,
|
||||
otherwise an error loading the module may cause Apache to not start.
|
||||
|
||||
**Note**: This recipe does not work on EL 6 platforms unless
|
||||
epel-testing repository is enabled (outside the scope of this
|
||||
cookbook), or the package version 1.0.8.1-3.el6 or higher is otherwise
|
||||
available to the system due to this bug:
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?format=multiple&id=708550
|
||||
|
||||
mod\_auth\_openid
|
||||
-----------------
|
||||
|
||||
**Changed via COOK-915**
|
||||
|
||||
This recipe compiles the module from source. In addition to
|
||||
`build-essential`, some other packages are included for installation
|
||||
like the GNU C++ compiler and development headers.
|
||||
|
||||
To use the module in your own cookbooks to authenticate systems using
|
||||
OpenIDs, specify an array of OpenIDs that are allowed to authenticate
|
||||
with the attribute `node['apache']['allowed_openids']`. Use the
|
||||
following in a vhost to protect with OpenID authentication:
|
||||
|
||||
AuthType OpenID require user <%= node['apache']['allowed_openids'].join(' ') %>
|
||||
AuthOpenIDDBLocation <%= node['apache']['mod_auth_openid']['dblocation'] %>
|
||||
|
||||
Change the DBLocation with the attribute as required; this file is in
|
||||
a different location than previous versions, see below. It should be a
|
||||
sane default for most platforms, though, see
|
||||
`attributes/mod_auth_openid.rb`.
|
||||
|
||||
### Changes from COOK-915:
|
||||
|
||||
* `AuthType OpenID` instead of `AuthOpenIDEnabled On`.
|
||||
* `require user` instead of `AuthOpenIDUserProgram`.
|
||||
* A bug(?) in `mod_auth_openid` causes it to segfault when attempting
|
||||
to update the database file if the containing directory is not
|
||||
writable by the HTTPD process owner (e.g., www-data), even if the
|
||||
file is writable. In order to not interfere with other settings from
|
||||
the default recipe in this cookbook, the db file is moved.
|
||||
|
||||
mod\_fastcgi
|
||||
------------
|
||||
|
||||
Install the fastcgi package and enable the module.
|
||||
|
||||
Only work on Debian/Ubuntu
|
||||
|
||||
mod\_fcgid
|
||||
----------
|
||||
|
||||
Installs the fcgi package and enables the module. Requires EPEL on
|
||||
RHEL family.
|
||||
|
||||
On RHEL family, this recipe will delete the fcgid.conf and on version
|
||||
6+, create the /var/run/httpd/mod_fcgid` directory, which prevents the
|
||||
emergency error:
|
||||
|
||||
[emerg] (2)No such file or directory: mod_fcgid: Can't create shared memory for size XX bytes
|
||||
|
||||
mod\_php5
|
||||
--------
|
||||
|
||||
Simply installs the appropriate package on Debian, Ubuntu and
|
||||
ArchLinux.
|
||||
|
||||
On Red Hat family distributions including Fedora, the php.conf that
|
||||
comes with the package is removed. On RHEL platforms less than v6, the
|
||||
`php53` package is used.
|
||||
|
||||
mod\_ssl
|
||||
--------
|
||||
|
||||
Besides installing and enabling `mod_ssl`, this recipe will append
|
||||
port 443 to the `node['apache']['listen_ports']` attribute array and
|
||||
update the ports.conf.
|
||||
|
||||
god\_monitor
|
||||
------------
|
||||
|
||||
Sets up a `god` monitor for Apache. External requirements are the
|
||||
`god` and `runit` cookbooks from Opscode. When using this recipe,
|
||||
include `recipe[god]` in the node's expanded run list to ensure the
|
||||
client downloads it; `god` depends on runit so that will also be
|
||||
downloaded.
|
||||
|
||||
**Note** This recipe is not tested under test-kitchen yet and is
|
||||
pending fix in COOK-744.
|
||||
|
||||
Definitions
|
||||
===========
|
||||
|
||||
The cookbook provides a few definitions. At some point in the future
|
||||
these definitions may be refactored into lightweight resources and
|
||||
providers as suggested by
|
||||
[foodcritic rule FC015](http://acrmp.github.com/foodcritic/#FC015).
|
||||
|
||||
apache\_conf
|
||||
------------
|
||||
|
||||
Sets up configuration file for an Apache module from a template. The
|
||||
template should be in the same cookbook where the definition is used.
|
||||
This is used by the `apache_module` definition and is not often used
|
||||
directly.
|
||||
|
||||
This will use a template resource to write the module's configuration
|
||||
file in the `mods-available` under the Apache configuration directory
|
||||
(`node['apache']['dir']`). This is a platform-dependent location. See
|
||||
__apache\_module__.
|
||||
|
||||
### Parameters:
|
||||
|
||||
* `name` - Name of the template. When used from the `apache_module`,
|
||||
it will use the same name as the module.
|
||||
|
||||
### Examples:
|
||||
|
||||
Create `#{node['apache']['dir']}/mods-available/alias.conf`.
|
||||
|
||||
apache_conf "alias"
|
||||
|
||||
apache\_module
|
||||
--------------
|
||||
|
||||
Enable or disable an Apache module in
|
||||
`#{node['apache']['dir']}/mods-available` by calling `a2enmod` or
|
||||
`a2dismod` to manage the symbolic link in
|
||||
`#{node['apache']['dir']}/mods-enabled`. If the module has a
|
||||
configuration file, a template should be created in the cookbook where
|
||||
the definition is used. See __Examples__.
|
||||
|
||||
### Parameters:
|
||||
|
||||
* `name` - Name of the module enabled or disabled with the `a2enmod` or `a2dismod` scripts.
|
||||
* `enable` - Default true, which uses `a2enmod` to enable the module. If false, the module will be disabled with `a2dismod`.
|
||||
* `conf` - Default false. Set to true if the module has a config file, which will use `apache_conf` for the file.
|
||||
* `filename` - specify the full name of the file, e.g.
|
||||
|
||||
### Examples:
|
||||
|
||||
Enable the ssl module, which also has a configuration template in `templates/default/mods/ssl.conf.erb`.
|
||||
|
||||
apache_module "ssl" do
|
||||
conf true
|
||||
end
|
||||
|
||||
Enable the php5 module, which has a different filename than the module default:
|
||||
|
||||
apache_module "php5" do
|
||||
filename "libphp5.so"
|
||||
end
|
||||
|
||||
Disable a module:
|
||||
|
||||
apache_module "disabled_module" do
|
||||
enable false
|
||||
end
|
||||
|
||||
See the recipes directory for many more examples of `apache_module`.
|
||||
|
||||
apache\_site
|
||||
------------
|
||||
|
||||
Enable or disable a VirtualHost in
|
||||
`#{node['apache']['dir']}/sites-available` by calling a2ensite or
|
||||
a2dissite to manage the symbolic link in
|
||||
`#{node['apache']['dir']}/sites-enabled`.
|
||||
|
||||
The template for the site must be managed as a separate resource. To
|
||||
combine the template with enabling a site, see `web_app`.
|
||||
|
||||
### Parameters:
|
||||
|
||||
* `name` - Name of the site.
|
||||
* `enable` - Default true, which uses `a2ensite` to enable the site. If false, the site will be disabled with `a2dissite`.
|
||||
|
||||
web\_app
|
||||
--------
|
||||
|
||||
Manage a template resource for a VirtualHost site, and enable it with
|
||||
`apache_site`. This is commonly done for managing web applications
|
||||
such as Ruby on Rails, PHP or Django, and the default behavior
|
||||
reflects that. However it is flexible.
|
||||
|
||||
This definition includes some recipes to make sure the system is
|
||||
configured to have Apache and some sane default modules:
|
||||
|
||||
* `apache2`
|
||||
* `apache2::mod_rewrite`
|
||||
* `apache2::mod_deflate`
|
||||
* `apache2::mod_headers`
|
||||
|
||||
It will then configure the template (see __Parameters__ and
|
||||
__Examples__ below), and enable or disable the site per the `enable`
|
||||
parameter.
|
||||
|
||||
### Parameters:
|
||||
|
||||
Current parameters used by the definition:
|
||||
|
||||
* `name` - The name of the site. The template will be written to
|
||||
`#{node['apache']['dir']}/sites-available/#{params['name']}.conf`
|
||||
* `cookbook` - Optional. Cookbook where the source template is. If
|
||||
this is not defined, Chef will use the named template in the
|
||||
cookbook where the definition is used.
|
||||
* `template` - Default `web_app.conf.erb`, source template file.
|
||||
* `enable` - Default true. Passed to the `apache_site` definition.
|
||||
|
||||
Additional parameters can be defined when the definition is called in
|
||||
a recipe, see __Examples__.
|
||||
|
||||
### Examples:
|
||||
|
||||
All parameters are passed into the template. You can use whatever you
|
||||
like. The apache2 cookbook comes with a `web_app.conf.erb` template as
|
||||
an example. The following parameters are used in the template:
|
||||
|
||||
* `server_name` - ServerName directive.
|
||||
* `server_aliases` - ServerAlias directive. Must be an array of aliases.
|
||||
* `docroot` - DocumentRoot directive.
|
||||
* `application_name` - Used in RewriteLog directive. Will be set to the `name` parameter.
|
||||
* `directory_index` - Allow overriding the default DirectoryIndex setting, optional
|
||||
* `directory_options` - Override Options on the docroot, for example to add parameters like Includes or Indexes, optional.
|
||||
* `allow_override` - Modify the AllowOverride directive on the docroot to support apps that need .htaccess to modify configuration or require authentication.
|
||||
|
||||
To use the default web_app, for example:
|
||||
|
||||
web_app "my_site" do
|
||||
server_name node['hostname']
|
||||
server_aliases [node['fqdn'], "my-site.example.com"]
|
||||
docroot "/srv/www/my_site"
|
||||
end
|
||||
|
||||
The parameters specified will be used as:
|
||||
|
||||
* `@params[:server_name]`
|
||||
* `@params[:server_aliases]`
|
||||
* `@params[:docroot]`
|
||||
|
||||
In the template. When you write your own, the `@` is significant.
|
||||
|
||||
For more information about Definitions and parameters, see the
|
||||
[Chef Wiki](http://wiki.opscode.com/display/chef/Definitions)
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
Using this cookbook is relatively straightforward. Add the desired
|
||||
recipes to the run list of a node, or create a role. Depending on your
|
||||
environment, you may have multiple roles that use different recipes
|
||||
from this cookbook. Adjust any attributes as desired. For example, to
|
||||
create a basic role for web servers that provide both HTTP and HTTPS:
|
||||
|
||||
% cat roles/webserver.rb
|
||||
name "webserver"
|
||||
description "Systems that serve HTTP and HTTPS"
|
||||
run_list(
|
||||
"recipe[apache2]",
|
||||
"recipe[apache2::mod_ssl]"
|
||||
)
|
||||
default_attributes(
|
||||
"apache" => {
|
||||
"listen_ports" => ["80", "443"]
|
||||
}
|
||||
)
|
||||
|
||||
For examples of using the definitions in your own recipes, see their
|
||||
respective sections above.
|
||||
|
||||
License and Authors
|
||||
===================
|
||||
|
||||
* Author:: Adam Jacob <adam@opscode.com>
|
||||
* Author:: Joshua Timberman <joshua@opscode.com>
|
||||
* Author:: Bryan McLellan <bryanm@widemile.com>
|
||||
* Author:: Dave Esposito <esposito@espolinux.corpnet.local>
|
||||
* Author:: David Abdemoulaie <github@hobodave.com>
|
||||
* Author:: Edmund Haselwanter <edmund@haselwanter.com>
|
||||
* Author:: Eric Rochester <err8n@virginia.edu>
|
||||
* Author:: Jim Browne <jbrowne@42lines.net>
|
||||
* Author:: Matthew Kent <mkent@magoazul.com>
|
||||
* Author:: Nathen Harvey <nharvey@customink.com>
|
||||
* Author:: Ringo De Smet <ringo.de.smet@amplidata.com>
|
||||
* Author:: Sean OMeara <someara@opscode.com>
|
||||
* Author:: Seth Chisamore <schisamo@opscode.com>
|
||||
* Author:: Gilles Devaux <gilles@peerpong.com>
|
||||
|
||||
* Copyright:: 2009-2012, Opscode, Inc
|
||||
* Copyright:: 2011, Atriso
|
||||
* Copyright:: 2011, CustomInk, LLC.
|
||||
|
||||
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.
|
||||
@@ -0,0 +1,53 @@
|
||||
This cookbook uses a variety of testing components:
|
||||
|
||||
- Unit tests: [ChefSpec](https://github.com/acrmp/chefspec)
|
||||
- Integration tests: [Test Kitchen](https://github.com/opscode/test-kitchen)
|
||||
- Chef Style lints: [Foodcritic](https://github.com/acrmp/foodcritic)
|
||||
- Ruby Style lints: [Rubocop](https://github.com/bbatsov/rubocop)
|
||||
|
||||
|
||||
Prerequisites
|
||||
-------------
|
||||
To develop on this cookbook, you must have a sane Ruby 1.9+ environment. Given the nature of this installation process (and it's variance across multiple operating systems), we will leave this installation process to the user.
|
||||
|
||||
You must also have `bundler` installed:
|
||||
|
||||
$ gem install bundler
|
||||
|
||||
You must also have Vagrant and VirtualBox installed:
|
||||
|
||||
- [Vagrant](https://vagrantup.com)
|
||||
- [VirtualBox](https://virtualbox.org)
|
||||
|
||||
Once installed, you must install the `vagrant-berkshelf` plugin:
|
||||
|
||||
$ vagrant plugin install vagrant-berkshelf
|
||||
|
||||
|
||||
Development
|
||||
-----------
|
||||
1. Clone the git repository from GitHub:
|
||||
|
||||
$ git clone git@github.com:opscode-cookbooks/COOKBOOK.git
|
||||
|
||||
2. Install the dependencies using bundler:
|
||||
|
||||
$ bundle install
|
||||
|
||||
3. Create a branch for your changes:
|
||||
|
||||
$ git checkout -b my_bug_fix
|
||||
|
||||
4. Make any changes
|
||||
5. Write tests to support those changes. It is highly recommended you write both unit and integration tests.
|
||||
6. Run the tests:
|
||||
- `bundle exec rspec`
|
||||
- `bundle exec foodcritic .`
|
||||
- `bundle exec rubocop`
|
||||
- `bundle exec kitchen test`
|
||||
|
||||
7. Assuming the tests pass, open a Pull Request on GitHub
|
||||
8. Open a JIRA ticket for this compontent, linking the JIRA ticket to the Pull Request and visa versa.
|
||||
9. Mark the JIRA ticket as "Fix Provided"
|
||||
|
||||
For more information, see [Opscode's Contribution Guidelines](https://wiki.opscode.com/display/chef/How+to+Contribute).
|
||||
@@ -0,0 +1,177 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Attributes:: apache
|
||||
#
|
||||
# Copyright 2008-2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
default['apache']['root_group'] = 'root'
|
||||
|
||||
# Where the various parts of apache are
|
||||
case node['platform']
|
||||
when 'redhat', 'centos', 'scientific', 'fedora', 'suse', 'amazon', 'oracle'
|
||||
default['apache']['package'] = 'httpd'
|
||||
default['apache']['dir'] = '/etc/httpd'
|
||||
default['apache']['log_dir'] = '/var/log/httpd'
|
||||
default['apache']['error_log'] = 'error.log'
|
||||
default['apache']['access_log'] = 'access.log'
|
||||
default['apache']['user'] = 'apache'
|
||||
default['apache']['group'] = 'apache'
|
||||
default['apache']['binary'] = '/usr/sbin/httpd'
|
||||
default['apache']['docroot_dir'] = '/var/www/html'
|
||||
default['apache']['cgibin_dir'] = '/var/www/cgi-bin'
|
||||
default['apache']['icondir'] = '/var/www/icons'
|
||||
default['apache']['cache_dir'] = '/var/cache/httpd'
|
||||
default['apache']['pid_file'] = if node['platform_version'].to_f >= 6
|
||||
'/var/run/httpd/httpd.pid'
|
||||
else
|
||||
'/var/run/httpd.pid'
|
||||
end
|
||||
default['apache']['lib_dir'] = node['kernel']['machine'] =~ /^i[36]86$/ ? '/usr/lib/httpd' : '/usr/lib64/httpd'
|
||||
default['apache']['libexecdir'] = "#{node['apache']['lib_dir']}/modules"
|
||||
default['apache']['default_site_enabled'] = false
|
||||
when 'debian', 'ubuntu'
|
||||
default['apache']['package'] = 'apache2'
|
||||
default['apache']['dir'] = '/etc/apache2'
|
||||
default['apache']['log_dir'] = '/var/log/apache2'
|
||||
default['apache']['error_log'] = 'error.log'
|
||||
default['apache']['access_log'] = 'access.log'
|
||||
default['apache']['user'] = 'www-data'
|
||||
default['apache']['group'] = 'www-data'
|
||||
default['apache']['binary'] = '/usr/sbin/apache2'
|
||||
default['apache']['docroot_dir'] = '/var/www'
|
||||
default['apache']['cgibin_dir'] = '/usr/lib/cgi-bin'
|
||||
default['apache']['icondir'] = '/usr/share/apache2/icons'
|
||||
default['apache']['cache_dir'] = '/var/cache/apache2'
|
||||
default['apache']['pid_file'] = '/var/run/apache2.pid'
|
||||
default['apache']['lib_dir'] = '/usr/lib/apache2'
|
||||
default['apache']['libexecdir'] = "#{node['apache']['lib_dir']}/modules"
|
||||
default['apache']['default_site_enabled'] = false
|
||||
when 'arch'
|
||||
default['apache']['package'] = 'apache'
|
||||
default['apache']['dir'] = '/etc/httpd'
|
||||
default['apache']['log_dir'] = '/var/log/httpd'
|
||||
default['apache']['error_log'] = 'error.log'
|
||||
default['apache']['access_log'] = 'access.log'
|
||||
default['apache']['user'] = 'http'
|
||||
default['apache']['group'] = 'http'
|
||||
default['apache']['binary'] = '/usr/sbin/httpd'
|
||||
default['apache']['docroot_dir'] = '/srv/http'
|
||||
default['apache']['cgibin_dir'] = '/usr/share/httpd/cgi-bin'
|
||||
default['apache']['icondir'] = '/usr/share/httpd/icons'
|
||||
default['apache']['cache_dir'] = '/var/cache/httpd'
|
||||
default['apache']['pid_file'] = '/var/run/httpd/httpd.pid'
|
||||
default['apache']['lib_dir'] = '/usr/lib/httpd'
|
||||
default['apache']['libexecdir'] = "#{node['apache']['lib_dir']}/modules"
|
||||
default['apache']['default_site_enabled'] = false
|
||||
when 'freebsd'
|
||||
default['apache']['package'] = 'apache22'
|
||||
default['apache']['dir'] = '/usr/local/etc/apache22'
|
||||
default['apache']['log_dir'] = '/var/log'
|
||||
default['apache']['error_log'] = 'httpd-error.log'
|
||||
default['apache']['access_log'] = 'httpd-access.log'
|
||||
default['apache']['root_group'] = 'wheel'
|
||||
default['apache']['user'] = 'www'
|
||||
default['apache']['group'] = 'www'
|
||||
default['apache']['binary'] = '/usr/local/sbin/httpd'
|
||||
default['apache']['docroot_dir'] = '/usr/local/www/apache22/data'
|
||||
default['apache']['cgibin_dir'] = '/usr/local/www/apache22/cgi-bin'
|
||||
default['apache']['icondir'] = '/usr/local/www/apache22/icons'
|
||||
default['apache']['cache_dir'] = '/var/run/apache22'
|
||||
default['apache']['pid_file'] = '/var/run/httpd.pid'
|
||||
default['apache']['lib_dir'] = '/usr/local/libexec/apache22'
|
||||
default['apache']['libexecdir'] = node['apache']['lib_dir']
|
||||
default['apache']['default_site_enabled'] = false
|
||||
else
|
||||
default['apache']['dir'] = '/etc/apache2'
|
||||
default['apache']['log_dir'] = '/var/log/apache2'
|
||||
default['apache']['error_log'] = 'error.log'
|
||||
default['apache']['access_log'] = 'access.log'
|
||||
default['apache']['user'] = 'www-data'
|
||||
default['apache']['group'] = 'www-data'
|
||||
default['apache']['binary'] = '/usr/sbin/apache2'
|
||||
default['apache']['docroot_dir'] = '/var/www'
|
||||
default['apache']['cgibin_dir'] = '/usr/lib/cgi-bin'
|
||||
default['apache']['icondir'] = '/usr/share/apache2/icons'
|
||||
default['apache']['cache_dir'] = '/var/cache/apache2'
|
||||
default['apache']['pid_file'] = 'logs/httpd.pid'
|
||||
default['apache']['lib_dir'] = '/usr/lib/apache2'
|
||||
default['apache']['libexecdir'] = "#{node['apache']['lib_dir']}/modules"
|
||||
default['apache']['default_site_enabled'] = false
|
||||
end
|
||||
|
||||
###
|
||||
# These settings need the unless, since we want them to be tunable,
|
||||
# and we don't want to override the tunings.
|
||||
###
|
||||
|
||||
# General settings
|
||||
default['apache']['listen_addresses'] = %w[*]
|
||||
default['apache']['listen_ports'] = %w[80]
|
||||
default['apache']['contact'] = 'ops@example.com'
|
||||
default['apache']['timeout'] = 300
|
||||
default['apache']['keepalive'] = 'On'
|
||||
default['apache']['keepaliverequests'] = 100
|
||||
default['apache']['keepalivetimeout'] = 5
|
||||
|
||||
# Security
|
||||
default['apache']['servertokens'] = 'Prod'
|
||||
default['apache']['serversignature'] = 'On'
|
||||
default['apache']['traceenable'] = 'On'
|
||||
|
||||
# mod_auth_openids
|
||||
default['apache']['allowed_openids'] = []
|
||||
|
||||
# mod_status Allow list, space seprated list of allowed entries.
|
||||
default['apache']['status_allow_list'] = 'localhost ip6-localhost'
|
||||
|
||||
# mod_status ExtendedStatus, set to 'true' to enable
|
||||
default['apache']['ext_status'] = false
|
||||
|
||||
# mod_info Allow list, space seprated list of allowed entries.
|
||||
default['apache']['info_allow_list'] = 'localhost ip6-localhost'
|
||||
|
||||
# Prefork Attributes
|
||||
default['apache']['prefork']['startservers'] = 16
|
||||
default['apache']['prefork']['minspareservers'] = 16
|
||||
default['apache']['prefork']['maxspareservers'] = 32
|
||||
default['apache']['prefork']['serverlimit'] = 400
|
||||
default['apache']['prefork']['maxclients'] = 400
|
||||
default['apache']['prefork']['maxrequestsperchild'] = 10_000
|
||||
|
||||
# Worker Attributes
|
||||
default['apache']['worker']['startservers'] = 4
|
||||
default['apache']['worker']['serverlimit'] = 16
|
||||
default['apache']['worker']['maxclients'] = 1024
|
||||
default['apache']['worker']['minsparethreads'] = 64
|
||||
default['apache']['worker']['maxsparethreads'] = 192
|
||||
default['apache']['worker']['threadsperchild'] = 64
|
||||
default['apache']['worker']['maxrequestsperchild'] = 0
|
||||
|
||||
# mod_proxy settings
|
||||
default['apache']['proxy']['order'] = 'deny,allow'
|
||||
default['apache']['proxy']['deny_from'] = 'all'
|
||||
default['apache']['proxy']['allow_from'] = 'none'
|
||||
|
||||
# Default modules to enable via include_recipe
|
||||
|
||||
default['apache']['default_modules'] = %w[
|
||||
status alias auth_basic authn_file authz_default authz_groupfile authz_host authz_user autoindex
|
||||
dir env mime negotiation setenvif
|
||||
]
|
||||
|
||||
%w[log_config logio].each do |log_mod|
|
||||
default['apache']['default_modules'] << log_mod if %w[rhel fedora suse arch freebsd].include?(node['platform_family'])
|
||||
end
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Attributes:: mod_auth_cas
|
||||
#
|
||||
# Copyright 2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
default['apache']['mod_auth_cas']['from_source'] = false
|
||||
default['apache']['mod_auth_cas']['source_revision'] = 'v1.0.8.1'
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Attributes:: mod_auth_cas
|
||||
#
|
||||
# Copyright 2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
default['apache']['mod_auth_openid']['ref'] = '95043901eab868400937642d9bc55d17e9dd069f'
|
||||
default['apache']['mod_auth_openid']['source_url'] = "https://github.com/bmuller/mod_auth_openid/archive/#{node['apache']['mod_auth_openid']['ref']}.tar.gz"
|
||||
default['apache']['mod_auth_openid']['cache_dir'] = '/var/cache/mod_auth_openid'
|
||||
default['apache']['mod_auth_openid']['dblocation'] = "#{node['apache']['mod_auth_openid']['cache_dir']}/mod_auth_openid.db"
|
||||
|
||||
case node['platform_family']
|
||||
when 'freebsd'
|
||||
default['apache']['mod_auth_openid']['configure_flags'] = [
|
||||
'CPPFLAGS=-I/usr/local/include',
|
||||
'LDFLAGS=-I/usr/local/lib -lsqlite3'
|
||||
]
|
||||
else
|
||||
default['apache']['mod_auth_openid']['configure_flags'] = []
|
||||
end
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Attributes:: mod_fastcgi
|
||||
#
|
||||
# Copyright 2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
default['apache']['mod_fastcgi']['download_url'] = 'http://www.fastcgi.com/dist/mod_fastcgi-current.tar.gz'
|
||||
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Attributes:: mod_ssl
|
||||
#
|
||||
# Copyright 2012-2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
default['apache']['mod_ssl']['cipher_suite'] = 'RC4-SHA:HIGH:!ADH'
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Definition:: apache_conf
|
||||
#
|
||||
# Copyright 2008-20013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
define :apache_conf do
|
||||
template "#{node['apache']['dir']}/mods-available/#{params[:name]}.conf" do
|
||||
source "mods/#{params[:name]}.conf.erb"
|
||||
mode '0644'
|
||||
notifies :restart, 'service[apache2]'
|
||||
end
|
||||
end
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Definition:: apache_module
|
||||
#
|
||||
# Copyright 2008-2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
define :apache_module, :enable => true, :conf => false do
|
||||
include_recipe 'apache2::default'
|
||||
|
||||
params[:filename] = params[:filename] || "mod_#{params[:name]}.so"
|
||||
params[:module_path] = params[:module_path] || "#{node['apache']['libexecdir']}/#{params[:filename]}"
|
||||
|
||||
apache_conf params[:name] if params[:conf]
|
||||
|
||||
if platform_family?('rhel', 'fedora', 'arch', 'suse', 'freebsd')
|
||||
file "#{node['apache']['dir']}/mods-available/#{params[:name]}.load" do
|
||||
content "LoadModule #{params[:name]}_module #{params[:module_path]}\n"
|
||||
mode '0644'
|
||||
end
|
||||
end
|
||||
|
||||
if params[:enable]
|
||||
execute "a2enmod #{params[:name]}" do
|
||||
command "/usr/sbin/a2enmod #{params[:name]}"
|
||||
notifies :restart, 'service[apache2]'
|
||||
not_if do
|
||||
::File.symlink?("#{node['apache']['dir']}/mods-enabled/#{params[:name]}.load") &&
|
||||
(::File.exists?("#{node['apache']['dir']}/mods-available/#{params[:name]}.conf") ? ::File.symlink?("#{node['apache']['dir']}/mods-enabled/#{params[:name]}.conf") : true)
|
||||
end
|
||||
end
|
||||
else
|
||||
execute "a2dismod #{params[:name]}" do
|
||||
command "/usr/sbin/a2dismod #{params[:name]}"
|
||||
notifies :restart, 'service[apache2]'
|
||||
only_if { ::File.symlink?("#{node['apache']['dir']}/mods-enabled/#{params[:name]}.load") }
|
||||
end
|
||||
end
|
||||
end
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Definition:: apache_site
|
||||
#
|
||||
# Copyright 2008-2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
define :apache_site, :enable => true do
|
||||
include_recipe 'apache2::default'
|
||||
|
||||
if params[:enable]
|
||||
execute "a2ensite #{params[:name]}" do
|
||||
command "/usr/sbin/a2ensite #{params[:name]}"
|
||||
notifies :restart, 'service[apache2]'
|
||||
not_if do
|
||||
::File.symlink?("#{node['apache']['dir']}/sites-enabled/#{params[:name]}") ||
|
||||
::File.symlink?("#{node['apache']['dir']}/sites-enabled/000-#{params[:name]}")
|
||||
end
|
||||
only_if { ::File.exists?("#{node['apache']['dir']}/sites-available/#{params[:name]}") }
|
||||
end
|
||||
else
|
||||
execute "a2dissite #{params[:name]}" do
|
||||
command "/usr/sbin/a2dissite #{params[:name]}"
|
||||
notifies :restart, 'service[apache2]'
|
||||
only_if do
|
||||
::File.symlink?("#{node['apache']['dir']}/sites-enabled/#{params[:name]}") ||
|
||||
::File.symlink?("#{node['apache']['dir']}/sites-enabled/000-#{params[:name]}")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,48 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Definition:: web_app
|
||||
#
|
||||
# Copyright 2008-2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
define :web_app, :template => 'web_app.conf.erb', :enable => true do
|
||||
|
||||
application_name = params[:name]
|
||||
|
||||
include_recipe 'apache2::default'
|
||||
include_recipe 'apache2::mod_rewrite'
|
||||
include_recipe 'apache2::mod_deflate'
|
||||
include_recipe 'apache2::mod_headers'
|
||||
|
||||
template "#{node['apache']['dir']}/sites-available/#{application_name}.conf" do
|
||||
source params[:template]
|
||||
owner 'root'
|
||||
group node['apache']['root_group']
|
||||
mode '0644'
|
||||
cookbook params[:cookbook] if params[:cookbook]
|
||||
variables(
|
||||
:application_name => application_name,
|
||||
:params => params
|
||||
)
|
||||
if ::File.exists?("#{node['apache']['dir']}/sites-enabled/#{application_name}.conf")
|
||||
notifies :reload, 'service[apache2]'
|
||||
end
|
||||
end
|
||||
|
||||
site_enabled = params[:enable]
|
||||
apache_site "#{params[:name]}.conf" do
|
||||
enable site_enabled
|
||||
end
|
||||
end
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
=begin
|
||||
|
||||
Generates Ubuntu style module.load files.
|
||||
|
||||
./apache2_module_conf_generate.pl /usr/lib64/httpd/modules /etc/httpd/mods-available
|
||||
|
||||
ARGV[0] is the apache modules directory, ARGV[1] is where you want 'em.
|
||||
|
||||
=cut
|
||||
|
||||
use File::Find;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
die "Must have '/path/to/modules' and '/path/to/modules.load'"
|
||||
unless $ARGV[0] && $ARGV[1];
|
||||
|
||||
find(
|
||||
{
|
||||
wanted => sub {
|
||||
return 1 if $File::Find::name !~ /\.so$/;
|
||||
my $modfile = $_;
|
||||
$modfile =~ /(lib|mod_)(.+)\.so$/;
|
||||
my $modname = $2;
|
||||
my $filename = "$ARGV[1]/$modname.load";
|
||||
unless ( -f $filename ) {
|
||||
open( FILE, ">", $filename ) or die "Cannot open $filename";
|
||||
print FILE "LoadModule " . $modname . "_module $File::Find::name\n";
|
||||
close(FILE);
|
||||
}
|
||||
},
|
||||
follow => 1,
|
||||
},
|
||||
$ARGV[0]
|
||||
);
|
||||
|
||||
exit 0;
|
||||
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
require File.expand_path('../support/helpers', __FILE__)
|
||||
|
||||
describe 'apache2::default' do
|
||||
include Helpers::Apache
|
||||
|
||||
it 'installs apache' do
|
||||
package(node['apache']['package']).must_be_installed
|
||||
end
|
||||
|
||||
it 'starts apache' do
|
||||
apache_service.must_be_running
|
||||
end
|
||||
|
||||
it 'enables apache' do
|
||||
apache_service.must_be_enabled
|
||||
end
|
||||
|
||||
it 'creates the conf.d directory' do
|
||||
directory("#{node['apache']['dir']}/conf.d").must_exist.with(:mode, '755')
|
||||
end
|
||||
|
||||
it 'creates the logs directory' do
|
||||
directory(node['apache']['log_dir']).must_exist
|
||||
end
|
||||
|
||||
it 'enables the default site unless it is disabled' do
|
||||
skip unless node['apache']['default_site_enabled']
|
||||
file("#{node['apache']['dir']}/sites-enabled/000-default").must_exist
|
||||
file("#{node['apache']['dir']}/sites-available/default").must_exist
|
||||
end
|
||||
|
||||
it 'ensures the debian-style apache module scripts are present' do
|
||||
%w{a2ensite a2dissite a2enmod a2dismod}.each do |mod_script|
|
||||
file("/usr/sbin/#{mod_script}").must_exist
|
||||
end
|
||||
end
|
||||
|
||||
it 'reports server name only, not detailed version info' do
|
||||
assert_match(/^ServerTokens #{node['apache']['servertokens']} *$/, File.read("#{node['apache']['dir']}/conf.d/security"))
|
||||
end
|
||||
|
||||
it 'listens on port 80' do
|
||||
apache_configured_ports.must_include(80)
|
||||
end
|
||||
|
||||
it 'only listens on port 443 when SSL is enabled' do
|
||||
unless ran_recipe?('apache2::mod_ssl')
|
||||
apache_configured_ports.wont_include(443)
|
||||
end
|
||||
end
|
||||
|
||||
it 'reports server name only, not detailed version info' do
|
||||
file("#{node['apache']['dir']}/conf.d/security").must_match(/^ServerTokens #{node['apache']['servertokens']} *$/)
|
||||
end
|
||||
|
||||
it 'enables default_modules' do
|
||||
node['apache']['default_modules'].each do |a2mod|
|
||||
apache_enabled_modules.must_include "#{a2mod}_module"
|
||||
end
|
||||
end
|
||||
|
||||
describe 'centos' do
|
||||
it 'ensures no modules are loaded in conf.d' do
|
||||
Dir["#{node['apache']['dir']}/conf.d/*"].each do |f|
|
||||
file(f).wont_include 'LoadModule'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'configuration' do
|
||||
it { config.must_include '# Generated by Chef' }
|
||||
it { config.must_include %Q{ServerRoot "#{node['apache']['dir']}"} }
|
||||
it { config.must_include "Include #{node['apache']['dir']}/conf.d/" }
|
||||
it { apache_config_parses? }
|
||||
end
|
||||
end
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
#
|
||||
# Author:: Joshua Timberman <joshua@opscode.com>
|
||||
# Copyright:: Copyright (c) 2012, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
require File.expand_path('../support/helpers', __FILE__)
|
||||
|
||||
describe 'apache2::god_monitor' do
|
||||
include Helpers::Apache
|
||||
|
||||
it 'starts god service to supervise apache2' do
|
||||
service('god').must_be_running
|
||||
end
|
||||
|
||||
it 'creates the god service template for apache' do
|
||||
file('/etc/god/conf.d/apache2.god').must_exist
|
||||
end
|
||||
|
||||
it 'starts an apache2 service that works like a regular service' do
|
||||
# to be implemented when COOK-744 is fixed
|
||||
end
|
||||
end
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
require File.expand_path('../support/helpers', __FILE__)
|
||||
|
||||
describe 'apache2::mod_apreq2' do
|
||||
include Helpers::Apache
|
||||
|
||||
it 'enables apreq_module' do
|
||||
apache_enabled_modules.must_include 'apreq_module'
|
||||
end
|
||||
|
||||
it 'symlinks the module on EL' do
|
||||
skip unless %w[rhel fedora].include?(node['platform_family'])
|
||||
libdir = node['kernel']['machine'] == 'x86_64' ? 'lib64' : 'lib'
|
||||
link(
|
||||
"/usr/#{libdir}/httpd/modules/mod_apreq.so"
|
||||
).must_exist.with(
|
||||
:link_type, :symbolic).and(:to, "/usr/#{libdir}/httpd/modules/mod_apreq2.so"
|
||||
)
|
||||
end
|
||||
end
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
require File.expand_path('../support/helpers', __FILE__)
|
||||
|
||||
describe 'apache2::mod_auth_cas' do
|
||||
include Helpers::Apache
|
||||
|
||||
it 'enables auth_cas_module' do
|
||||
skip if %w[rhel fedora].include?(node['platform_family']) && node['platform_version'].to_f > 6.0
|
||||
apache_enabled_modules.must_include 'auth_cas_module'
|
||||
end
|
||||
end
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
require File.expand_path('../support/helpers', __FILE__)
|
||||
require 'pathname'
|
||||
|
||||
describe 'apache2::mod_auth_openid' do
|
||||
include Helpers::Apache
|
||||
|
||||
it 'installs the opekele library' do
|
||||
lib_dir = Pathname.new(node['apache']['lib_dir']).dirname.to_s
|
||||
file("#{lib_dir}/libopkele.so").must_exist
|
||||
end
|
||||
|
||||
it 'does not add the module to httpd.conf' do
|
||||
conffile = case node['platform']
|
||||
when 'debian', 'ubuntu'
|
||||
'apache2.conf'
|
||||
when 'redhat', 'centos', 'scientific', 'fedora', 'arch', 'amazon'
|
||||
'conf/httpd.conf'
|
||||
when 'freebsd'
|
||||
'httpd.conf'
|
||||
end
|
||||
httpd_config = File.read(File.join(node['apache']['dir'], conffile))
|
||||
refute_match /^LoadModule authopenid_module /, httpd_config
|
||||
end
|
||||
|
||||
it 'creates a cache directory for the module' do
|
||||
directory(node['apache']['mod_auth_openid']['cache_dir']).must_exist.with(:owner, node['apache']['user'])
|
||||
end
|
||||
|
||||
it 'ensures the db file is writable by apache' do
|
||||
file(node['apache']['mod_auth_openid']['dblocation']).must_exist.with(:owner, node['apache']['user']).and(:mode, '644')
|
||||
end
|
||||
|
||||
it 'enables authopenid_module' do
|
||||
apache_enabled_modules.must_include 'authopenid_module'
|
||||
end
|
||||
end
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
require File.expand_path('../support/helpers', __FILE__)
|
||||
|
||||
describe 'apache2::mod_cgi' do
|
||||
include Helpers::Apache
|
||||
|
||||
# the cgi module can be either cgi or cgid
|
||||
it 'enables cgi or cgid_module' do
|
||||
assert(apache_enabled_modules.include?('cgi_module') ||
|
||||
apache_enabled_modules.include?('cgid_module')
|
||||
)
|
||||
end
|
||||
end
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
require File.expand_path('../support/helpers', __FILE__)
|
||||
|
||||
describe 'apache2::mod_dav_svn' do
|
||||
include Helpers::Apache
|
||||
|
||||
it 'enables dav_svn_module' do
|
||||
apache_enabled_modules.must_include('dav_svn_module')
|
||||
end
|
||||
|
||||
it 'enables dav_module' do
|
||||
apache_enabled_modules.must_include('dav_module')
|
||||
end
|
||||
end
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
require File.expand_path('../support/helpers', __FILE__)
|
||||
|
||||
describe 'apache2::mod_fastcgi' do
|
||||
include Helpers::Apache
|
||||
|
||||
it 'enables fastcgi_module' do
|
||||
skip if %w{rhel fedora}.include?(node['platform_family'])
|
||||
apache_enabled_modules.must_include 'fastcgi_module'
|
||||
end
|
||||
end
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
require File.expand_path('../support/helpers', __FILE__)
|
||||
|
||||
describe 'apache2::mod_include' do
|
||||
include Helpers::Apache
|
||||
|
||||
it 'enables include_module' do
|
||||
apache_enabled_modules.must_include 'include_module'
|
||||
end
|
||||
|
||||
it 'drops off the include module configuration' do
|
||||
assert_match(/AddType text\/html .shtml/, File.read("#{node['apache']['dir']}/mods-enabled/include.conf"))
|
||||
assert_match(/AddOutputFilter INCLUDES .shtml/, File.read("#{node['apache']['dir']}/mods-enabled/include.conf"))
|
||||
end
|
||||
end
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
require File.expand_path('../support/helpers', __FILE__)
|
||||
|
||||
describe 'apache2::mod_perl' do
|
||||
include Helpers::Apache
|
||||
|
||||
it 'enables perl_module' do
|
||||
apache_enabled_modules.must_include('perl_module')
|
||||
end
|
||||
|
||||
it 'installs the apache request library' do
|
||||
req_pkg = case node['platform']
|
||||
when 'debian', 'ubuntu' then 'libapache2-request-perl'
|
||||
else 'perl-libapreq2'
|
||||
end
|
||||
package(req_pkg).must_be_installed
|
||||
end
|
||||
end
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
require File.expand_path('../support/helpers', __FILE__)
|
||||
|
||||
describe 'apache2::mod_php5' do
|
||||
include Helpers::Apache
|
||||
|
||||
it 'enables php5_module' do
|
||||
apache_enabled_modules.must_include('php5_module')
|
||||
end
|
||||
|
||||
it 'deletes the packaged php config if any' do
|
||||
file("#{node['apache']['dir']}/conf.d/php.conf").wont_exist
|
||||
end
|
||||
end
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
require File.expand_path('../support/helpers', __FILE__)
|
||||
|
||||
describe 'apache2::mod_python' do
|
||||
include Helpers::Apache
|
||||
|
||||
it 'enables python_module' do
|
||||
apache_enabled_modules.must_include('python_module')
|
||||
end
|
||||
end
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
require File.expand_path('../support/helpers', __FILE__)
|
||||
|
||||
describe 'apache2::mod_ssl' do
|
||||
include Helpers::Apache
|
||||
|
||||
it 'installs the mod_ssl package on RHEL distributions' do
|
||||
skip unless %w[rhel fedora].include?(node['platform_family'])
|
||||
package('mod_ssl').must_be_installed
|
||||
end
|
||||
|
||||
it 'enables ssl_module' do
|
||||
apache_enabled_modules.must_include 'ssl_module'
|
||||
end
|
||||
|
||||
it 'does not store SSL config in conf.d' do
|
||||
file("#{node['apache']['dir']}/conf.d/ssl.conf").wont_exist
|
||||
end
|
||||
|
||||
it 'is configured to listen on port 443' do
|
||||
apache_configured_ports.must_include(443)
|
||||
end
|
||||
|
||||
it 'configures SSLCiphersuit from an attribute' do
|
||||
assert_match(/^SSLCipherSuite #{node['apache']['mod_ssl']['cipher_suite']}$/,
|
||||
File.read("#{node['apache']['dir']}/mods-enabled/ssl.conf"))
|
||||
end
|
||||
end
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
module Helpers
|
||||
# MiniTest helpers
|
||||
module Apache
|
||||
require 'chef/mixin/shell_out'
|
||||
include Chef::Mixin::ShellOut
|
||||
include MiniTest::Chef::Assertions
|
||||
include MiniTest::Chef::Context
|
||||
include MiniTest::Chef::Resources
|
||||
|
||||
def apache_config_parses?
|
||||
acp = shell_out("#{node['apache']['binary']} -t")
|
||||
acp.exitstatus == 0
|
||||
end
|
||||
|
||||
def apache_configured_ports
|
||||
port_config = File.read("#{node['apache']['dir']}/ports.conf")
|
||||
port_config.scan(/^Listen ([0-9]+)/).flatten.map { |p| p.to_i }
|
||||
end
|
||||
|
||||
def apache_enabled_modules
|
||||
apache_modules = shell_out("#{node['apache']['binary']} -M")
|
||||
apache_modules.send(
|
||||
if node['platform_family'] == 'rhel' && node['platform_version'].to_f < 6.0
|
||||
:stderr
|
||||
else
|
||||
:stdout
|
||||
end
|
||||
).split.select! { |i| i =~ /_module$/ }
|
||||
end
|
||||
|
||||
def apache_service
|
||||
service(
|
||||
case node['platform']
|
||||
when 'debian', 'ubuntu' then 'apache2'
|
||||
when 'freebsd' then 'apache22'
|
||||
else 'httpd'
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
def config
|
||||
file(
|
||||
case node['platform']
|
||||
when 'debian', 'ubuntu' then "#{node['apache']['dir']}/apache2.conf"
|
||||
when 'freebsd' then "#{node['apache']['dir']}/httpd.conf"
|
||||
else "#{node['apache']['dir']}/conf/httpd.conf"
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
def ran_recipe?(recipe)
|
||||
if Chef::VERSION < '11.0'
|
||||
seen_recipes = node.run_state[:seen_recipes]
|
||||
recipes = seen_recipes.keys.each { |i| i }
|
||||
else
|
||||
recipes = run_context.loaded_recipes
|
||||
end
|
||||
if recipes.empty? && Chef::Config[:solo]
|
||||
# If you have roles listed in your run list they are NOT expanded
|
||||
recipes = node.run_list.map { |item| item.name if item.type == :recipe }
|
||||
end
|
||||
recipes.include?(recipe)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,225 @@
|
||||
name 'apache2'
|
||||
maintainer 'Opscode, Inc.'
|
||||
maintainer_email 'cookbooks@opscode.com'
|
||||
license 'Apache 2.0'
|
||||
description 'Installs and configures all aspects of apache2 using Debian style symlinks with helper definitions'
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version '1.8.5'
|
||||
recipe 'apache2', 'Main Apache configuration'
|
||||
recipe 'apache2::logrotate', 'Rotate apache2 logs. Requires logrotate cookbook'
|
||||
recipe 'apache2::mod_alias', 'Apache module "alias" with config file'
|
||||
recipe 'apache2::mod_apreq2', 'Apache module "apreq"'
|
||||
recipe 'apache2::mod_auth_basic', 'Apache module "auth_basic"'
|
||||
recipe 'apache2::mod_auth_digest', 'Apache module "auth_digest"'
|
||||
recipe 'apache2::mod_auth_openid', 'Apache module "authopenid"'
|
||||
recipe 'apache2::mod_authn_file', 'Apache module "authn_file"'
|
||||
recipe 'apache2::mod_authnz_ldap', 'Apache module "authnz_ldap"'
|
||||
recipe 'apache2::mod_authz_default', 'Apache module "authz_default"'
|
||||
recipe 'apache2::mod_authz_groupfile', 'Apache module "authz_groupfile"'
|
||||
recipe 'apache2::mod_authz_host', 'Apache module "authz_host"'
|
||||
recipe 'apache2::mod_authz_user', 'Apache module "authz_user"'
|
||||
recipe 'apache2::mod_autoindex', 'Apache module "autoindex" with config file'
|
||||
recipe 'apache2::mod_cgi', 'Apache module "cgi"'
|
||||
recipe 'apache2::mod_dav', 'Apache module "dav"'
|
||||
recipe 'apache2::mod_dav_svn', 'Apache module "dav_svn"'
|
||||
recipe 'apache2::mod_deflate', 'Apache module "deflate" with config file'
|
||||
recipe 'apache2::mod_dir', 'Apache module "dir" with config file'
|
||||
recipe 'apache2::mod_env', 'Apache module "env"'
|
||||
recipe 'apache2::mod_expires', 'Apache module "expires"'
|
||||
recipe 'apache2::mod_fcgid', 'Apache module "fcgid", package on ubuntu/debian, rhel/centos, compile source on suse; with config file'
|
||||
recipe 'apache2::mod_headers', 'Apache module "headers"'
|
||||
recipe 'apache2::mod_include', 'Apache module "include"'
|
||||
recipe 'apache2::mod_ldap', 'Apache module "ldap"'
|
||||
recipe 'apache2::mod_log_config', 'Apache module "log_config"'
|
||||
recipe 'apache2::mod_mime', 'Apache module "mime" with config file'
|
||||
recipe 'apache2::mod_negotiation', 'Apache module "negotiation" with config file'
|
||||
recipe 'apache2::mod_perl', 'Apache module "perl"'
|
||||
recipe 'apache2::mod_php5', 'Apache module "php5"'
|
||||
recipe 'apache2::mod_proxy', 'Apache module "proxy" with config file'
|
||||
recipe 'apache2::mod_proxy_ajp', 'Apache module "proxy_ajp"'
|
||||
recipe 'apache2::mod_proxy_balancer', 'Apache module "proxy_balancer"'
|
||||
recipe 'apache2::mod_proxy_connect', 'Apache module "proxy_connect"'
|
||||
recipe 'apache2::mod_proxy_http', 'Apache module "proxy_http"'
|
||||
recipe 'apache2::mod_python', 'Apache module "python"'
|
||||
recipe 'apache2::mod_rewrite', 'Apache module "rewrite"'
|
||||
recipe 'apache2::mod_setenvif', 'Apache module "setenvif" with config file'
|
||||
recipe 'apache2::mod_ssl', 'Apache module "ssl" with config file, adds port 443 to listen_ports'
|
||||
recipe 'apache2::mod_status', 'Apache module "status" with config file'
|
||||
recipe 'apache2::mod_xsendfile', 'Apache module "xsendfile"'
|
||||
|
||||
supports 'amazon'
|
||||
supports 'arch'
|
||||
supports 'centos'
|
||||
supports 'debian'
|
||||
supports 'fedora'
|
||||
supports 'freebsd'
|
||||
supports 'redhat'
|
||||
supports 'scientific'
|
||||
supports 'ubuntu'
|
||||
|
||||
attribute 'apache',
|
||||
:display_name => 'Apache Hash',
|
||||
:description => 'Hash of Apache attributes',
|
||||
:type => 'hash'
|
||||
|
||||
attribute 'apache/dir',
|
||||
:display_name => 'Apache Directory',
|
||||
:description => 'Location for Apache configuration',
|
||||
:default => '/etc/apache2'
|
||||
|
||||
attribute 'apache/log_dir',
|
||||
:display_name => 'Apache Log Directory',
|
||||
:description => 'Location for Apache logs',
|
||||
:default => '/etc/apache2'
|
||||
|
||||
attribute 'apache/user',
|
||||
:display_name => 'Apache User',
|
||||
:description => 'User Apache runs as',
|
||||
:default => 'www-data'
|
||||
|
||||
attribute 'apache/binary',
|
||||
:display_name => 'Apache Binary',
|
||||
:description => 'Apache server daemon program',
|
||||
:default => '/usr/sbin/apache2'
|
||||
|
||||
attribute 'apache/icondir',
|
||||
:display_name => 'Apache Icondir',
|
||||
:description => 'Directory location for icons',
|
||||
:default => '/usr/share/apache2/icons'
|
||||
|
||||
attribute 'apache/listen_addresses',
|
||||
:display_name => 'Apache Listen Addresses',
|
||||
:description => 'Addresses that Apache should listen on',
|
||||
:type => 'array',
|
||||
:default => %w[*]
|
||||
|
||||
attribute 'apache/listen_ports',
|
||||
:display_name => 'Apache Listen Ports',
|
||||
:description => 'Ports that Apache should listen on',
|
||||
:type => 'array',
|
||||
:default => %w[80 443]
|
||||
|
||||
attribute 'apache/contact',
|
||||
:display_name => 'Apache Contact',
|
||||
:description => 'Email address of webmaster',
|
||||
:default => 'ops@example.com'
|
||||
|
||||
attribute 'apache/timeout',
|
||||
:display_name => 'Apache Timeout',
|
||||
:description => 'Connection timeout value',
|
||||
:default => '300'
|
||||
|
||||
attribute 'apache/keepalive',
|
||||
:display_name => 'Apache Keepalive',
|
||||
:description => 'HTTP persistent connections',
|
||||
:default => 'On'
|
||||
|
||||
attribute 'apache/keepaliverequests',
|
||||
:display_name => 'Apache Keepalive Requests',
|
||||
:description => 'Number of requests allowed on a persistent connection',
|
||||
:default => '100'
|
||||
|
||||
attribute 'apache/keepalivetimeout',
|
||||
:display_name => 'Apache Keepalive Timeout',
|
||||
:description => 'Time to wait for requests on persistent connection',
|
||||
:default => '5'
|
||||
|
||||
attribute 'apache/servertokens',
|
||||
:display_name => 'Apache Server Tokens',
|
||||
:description => 'Server response header',
|
||||
:default => 'Prod'
|
||||
|
||||
attribute 'apache/serversignature',
|
||||
:display_name => 'Apache Server Signature',
|
||||
:description => 'Configure footer on server-generated documents',
|
||||
:default => 'On'
|
||||
|
||||
attribute 'apache/traceenable',
|
||||
:display_name => 'Apache Trace Enable',
|
||||
:description => 'Determine behavior of TRACE requests',
|
||||
:default => 'On'
|
||||
|
||||
attribute 'apache/allowed_openids',
|
||||
:display_name => 'Apache Allowed OpenIDs',
|
||||
:description => 'Array of OpenIDs allowed to authenticate',
|
||||
:default => ''
|
||||
|
||||
attribute 'apache/prefork',
|
||||
:display_name => 'Apache Prefork',
|
||||
:description => 'Hash of Apache prefork tuning attributes.',
|
||||
:type => 'hash'
|
||||
|
||||
attribute 'apache/prefork/startservers',
|
||||
:display_name => 'Apache Prefork MPM StartServers',
|
||||
:description => 'Number of MPM servers to start',
|
||||
:default => '16'
|
||||
|
||||
attribute 'apache/prefork/minspareservers',
|
||||
:display_name => 'Apache Prefork MPM MinSpareServers',
|
||||
:description => 'Minimum number of spare server processes',
|
||||
:default => '16'
|
||||
|
||||
attribute 'apache/prefork/maxspareservers',
|
||||
:display_name => 'Apache Prefork MPM MaxSpareServers',
|
||||
:description => 'Maximum number of spare server processes',
|
||||
:default => '32'
|
||||
|
||||
attribute 'apache/prefork/serverlimit',
|
||||
:display_name => 'Apache Prefork MPM ServerLimit',
|
||||
:description => 'Upper limit on configurable server processes',
|
||||
:default => '400'
|
||||
|
||||
attribute 'apache/prefork/maxclients',
|
||||
:display_name => 'Apache Prefork MPM MaxClients',
|
||||
:description => 'Maximum number of simultaneous connections',
|
||||
:default => '400'
|
||||
|
||||
attribute 'apache/prefork/maxrequestsperchild',
|
||||
:display_name => 'Apache Prefork MPM MaxRequestsPerChild',
|
||||
:description => 'Maximum number of request a child process will handle',
|
||||
:default => '10000'
|
||||
|
||||
attribute 'apache/worker',
|
||||
:display_name => 'Apache Worker',
|
||||
:description => 'Hash of Apache prefork tuning attributes.',
|
||||
:type => 'hash'
|
||||
|
||||
attribute 'apache/worker/startservers',
|
||||
:display_name => 'Apache Worker MPM StartServers',
|
||||
:description => 'Initial number of server processes to start',
|
||||
:default => '4'
|
||||
|
||||
attribute 'apache/worker/maxclients',
|
||||
:display_name => 'Apache Worker MPM MaxClients',
|
||||
:description => 'Maximum number of simultaneous connections',
|
||||
:default => '1024'
|
||||
|
||||
attribute 'apache/worker/minsparethreads',
|
||||
:display_name => 'Apache Worker MPM MinSpareThreads',
|
||||
:description => 'Minimum number of spare worker threads',
|
||||
:default => '64'
|
||||
|
||||
attribute 'apache/worker/maxsparethreads',
|
||||
:display_name => 'Apache Worker MPM MaxSpareThreads',
|
||||
:description => 'Maximum number of spare worker threads',
|
||||
:default => '192'
|
||||
|
||||
attribute 'apache/worker/threadsperchild',
|
||||
:display_name => 'Apache Worker MPM ThreadsPerChild',
|
||||
:description => 'Constant number of worker threads in each server process',
|
||||
:default => '64'
|
||||
|
||||
attribute 'apache/worker/maxrequestsperchild',
|
||||
:display_name => 'Apache Worker MPM MaxRequestsPerChild',
|
||||
:description => 'Maximum number of request a child process will handle',
|
||||
:default => '0'
|
||||
|
||||
attribute 'apache/default_modules',
|
||||
:display_name => 'Apache Default Modules',
|
||||
:description => 'Default modules to enable via recipes',
|
||||
:default => 'status alias auth_basic authn_file authz_default authz_groupfile authz_host authz_user autoindex dir env mime negotiation setenvif'
|
||||
|
||||
attribute 'apache/mod_ssl/cipher_suite',
|
||||
:display_name => 'Apache mod_ssl Cipher Suite',
|
||||
:description => 'String of SSL ciphers to use for SSLCipherSuite',
|
||||
:default => 'RC4-SHA:HIGH:!ADH'
|
||||
@@ -0,0 +1,212 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Recipe:: default
|
||||
#
|
||||
# Copyright 2008-2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
package 'apache2' do
|
||||
package_name node['apache']['package']
|
||||
end
|
||||
|
||||
service 'apache2' do
|
||||
case node['platform_family']
|
||||
when 'rhel', 'fedora', 'suse'
|
||||
service_name 'httpd'
|
||||
# If restarted/reloaded too quickly httpd has a habit of failing.
|
||||
# This may happen with multiple recipes notifying apache to restart - like
|
||||
# during the initial bootstrap.
|
||||
restart_command '/sbin/service httpd restart && sleep 1'
|
||||
reload_command '/sbin/service httpd reload && sleep 1'
|
||||
when 'debian'
|
||||
service_name 'apache2'
|
||||
restart_command '/usr/sbin/invoke-rc.d apache2 restart && sleep 1'
|
||||
reload_command '/usr/sbin/invoke-rc.d apache2 reload && sleep 1'
|
||||
when 'arch'
|
||||
service_name 'httpd'
|
||||
when 'freebsd'
|
||||
service_name 'apache22'
|
||||
end
|
||||
supports [:restart, :reload, :status]
|
||||
action :enable
|
||||
end
|
||||
|
||||
if platform_family?('rhel', 'fedora', 'arch', 'suse', 'freebsd')
|
||||
directory node['apache']['log_dir'] do
|
||||
mode '0755'
|
||||
end
|
||||
|
||||
package 'perl'
|
||||
|
||||
cookbook_file '/usr/local/bin/apache2_module_conf_generate.pl' do
|
||||
source 'apache2_module_conf_generate.pl'
|
||||
mode '0755'
|
||||
owner 'root'
|
||||
group node['apache']['root_group']
|
||||
end
|
||||
|
||||
%w[sites-available sites-enabled mods-available mods-enabled].each do |dir|
|
||||
directory "#{node['apache']['dir']}/#{dir}" do
|
||||
mode '0755'
|
||||
owner 'root'
|
||||
group node['apache']['root_group']
|
||||
end
|
||||
end
|
||||
|
||||
execute 'generate-module-list' do
|
||||
command "/usr/local/bin/apache2_module_conf_generate.pl #{node['apache']['lib_dir']} #{node['apache']['dir']}/mods-available"
|
||||
action :nothing
|
||||
end
|
||||
|
||||
%w[a2ensite a2dissite a2enmod a2dismod].each do |modscript|
|
||||
template "/usr/sbin/#{modscript}" do
|
||||
source "#{modscript}.erb"
|
||||
mode '0700'
|
||||
owner 'root'
|
||||
group node['apache']['root_group']
|
||||
end
|
||||
end
|
||||
|
||||
# installed by default on centos/rhel, remove in favour of mods-enabled
|
||||
%w[proxy_ajp auth_pam authz_ldap webalizer ssl welcome].each do |f|
|
||||
file "#{node['apache']['dir']}/conf.d/#{f}.conf" do
|
||||
action :delete
|
||||
backup false
|
||||
end
|
||||
end
|
||||
|
||||
# installed by default on centos/rhel, remove in favour of mods-enabled
|
||||
file "#{node['apache']['dir']}/conf.d/README" do
|
||||
action :delete
|
||||
backup false
|
||||
end
|
||||
|
||||
# enable mod_deflate for consistency across distributions
|
||||
include_recipe 'apache2::mod_deflate'
|
||||
end
|
||||
|
||||
if platform_family?('freebsd')
|
||||
file "#{node['apache']['dir']}/Includes/no-accf.conf" do
|
||||
action :delete
|
||||
backup false
|
||||
end
|
||||
|
||||
directory "#{node['apache']['dir']}/Includes" do
|
||||
action :delete
|
||||
end
|
||||
|
||||
%w[
|
||||
httpd-autoindex.conf httpd-dav.conf httpd-default.conf httpd-info.conf
|
||||
httpd-languages.conf httpd-manual.conf httpd-mpm.conf
|
||||
httpd-multilang-errordoc.conf httpd-ssl.conf httpd-userdir.conf
|
||||
httpd-vhosts.conf
|
||||
].each do |f|
|
||||
file "#{node['apache']['dir']}/extra/#{f}" do
|
||||
action :delete
|
||||
backup false
|
||||
end
|
||||
end
|
||||
|
||||
directory "#{node['apache']['dir']}/extra" do
|
||||
action :delete
|
||||
end
|
||||
end
|
||||
|
||||
%W[
|
||||
#{node['apache']['dir']}/ssl
|
||||
#{node['apache']['dir']}/conf.d
|
||||
#{node['apache']['cache_dir']}
|
||||
].each do |path|
|
||||
directory path do
|
||||
mode '0755'
|
||||
owner 'root'
|
||||
group node['apache']['root_group']
|
||||
end
|
||||
end
|
||||
|
||||
# Set the preferred execution binary - prefork or worker
|
||||
template '/etc/sysconfig/httpd' do
|
||||
source 'etc-sysconfig-httpd.erb'
|
||||
owner 'root'
|
||||
group node['apache']['root_group']
|
||||
mode '0644'
|
||||
notifies :restart, 'service[apache2]'
|
||||
only_if { platform_family?('rhel', 'fedora') }
|
||||
end
|
||||
|
||||
template 'apache2.conf' do
|
||||
case node['platform_family']
|
||||
when 'rhel', 'fedora', 'arch'
|
||||
path "#{node['apache']['dir']}/conf/httpd.conf"
|
||||
when 'debian'
|
||||
path "#{node['apache']['dir']}/apache2.conf"
|
||||
when 'freebsd'
|
||||
path "#{node['apache']['dir']}/httpd.conf"
|
||||
end
|
||||
source 'apache2.conf.erb'
|
||||
owner 'root'
|
||||
group node['apache']['root_group']
|
||||
mode '0644'
|
||||
notifies :restart, 'service[apache2]'
|
||||
end
|
||||
|
||||
template 'apache2-conf-security' do
|
||||
path "#{node['apache']['dir']}/conf.d/security.conf"
|
||||
source 'security.erb'
|
||||
owner 'root'
|
||||
group node['apache']['root_group']
|
||||
mode '0644'
|
||||
backup false
|
||||
notifies :restart, 'service[apache2]'
|
||||
end
|
||||
|
||||
template 'apache2-conf-charset' do
|
||||
path "#{node['apache']['dir']}/conf.d/charset.conf"
|
||||
source 'charset.erb'
|
||||
owner 'root'
|
||||
group node['apache']['root_group']
|
||||
mode '0644'
|
||||
backup false
|
||||
notifies :restart, 'service[apache2]'
|
||||
end
|
||||
|
||||
template "#{node['apache']['dir']}/ports.conf" do
|
||||
source 'ports.conf.erb'
|
||||
owner 'root'
|
||||
group node['apache']['root_group']
|
||||
mode '0644'
|
||||
notifies :restart, 'service[apache2]'
|
||||
end
|
||||
|
||||
template "#{node['apache']['dir']}/sites-available/default" do
|
||||
source 'default-site.erb'
|
||||
owner 'root'
|
||||
group node['apache']['root_group']
|
||||
mode '0644'
|
||||
notifies :restart, 'service[apache2]'
|
||||
end
|
||||
|
||||
node['apache']['default_modules'].each do |mod|
|
||||
module_recipe_name = mod =~ /^mod_/ ? mod : "mod_#{mod}"
|
||||
include_recipe "apache2::#{module_recipe_name}"
|
||||
end
|
||||
|
||||
apache_site 'default' do
|
||||
enable node['apache']['default_site_enabled']
|
||||
end
|
||||
|
||||
service 'apache2' do
|
||||
action :start
|
||||
end
|
||||
@@ -0,0 +1,33 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Recipe:: god_monitor
|
||||
#
|
||||
# Copyright 2008-2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
apache_service = service 'apache2' do
|
||||
action :nothing
|
||||
end
|
||||
|
||||
start_command = apache_service.start_command
|
||||
stop_command = apache_service.stop_command
|
||||
restart_command = apache_service.restart_command
|
||||
|
||||
god_monitor 'apache2' do
|
||||
config 'apache2.god.erb'
|
||||
start start_command || "/etc/init.d/#{apache_service.service_name} start"
|
||||
restart restart_command || "/etc/init.d/#{apache_service.service_name} restart"
|
||||
stop stop_command || "/etc/init.d/#{apache_service.service_name} stop"
|
||||
end
|
||||
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Recipe:: iptables
|
||||
#
|
||||
# Copyright 2012-2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
iptables_rule 'port_apache'
|
||||
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Recipe:: logrotate
|
||||
#
|
||||
# Copyright 2012, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
apache_service = service 'apache2' do
|
||||
action :nothing
|
||||
end
|
||||
|
||||
begin
|
||||
include_recipe 'logrotate'
|
||||
rescue
|
||||
Chef::Log.warn('The apache::logrotate recipe requires the logrotate cookbook. Install the cookbook with `knife cookbook site install logrotate`.')
|
||||
end
|
||||
logrotate_app apache_service.service_name do
|
||||
path node['apache']['log_dir']
|
||||
end
|
||||
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Recipe:: actions
|
||||
#
|
||||
# Copyright 2008-2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
apache_module 'actions'
|
||||
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Recipe:: alias
|
||||
#
|
||||
# Copyright 2008-2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
apache_module 'alias' do
|
||||
conf true
|
||||
end
|
||||
@@ -0,0 +1,51 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Recipe:: apreq2
|
||||
#
|
||||
# modified from the python recipe by Jeremy Bingham
|
||||
#
|
||||
# Copyright 2008-2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
include_recipe 'apache2::default'
|
||||
|
||||
case node['platform_family']
|
||||
when 'debian'
|
||||
package 'libapache2-mod-apreq2'
|
||||
when 'rhel', 'fedora'
|
||||
package 'libapreq2' do
|
||||
notifies :run, 'execute[generate-module-list]', :immediately
|
||||
end
|
||||
|
||||
# seems that the apreq lib is weirdly broken or something - it needs to be
|
||||
# loaded as 'apreq', but on RHEL & derivitatives the file needs a symbolic
|
||||
# link to mod_apreq.so.
|
||||
link '/usr/lib64/httpd/modules/mod_apreq.so' do
|
||||
to '/usr/lib64/httpd/modules/mod_apreq2.so'
|
||||
only_if 'test -f /usr/lib64/httpd/modules/mod_apreq2.so'
|
||||
end
|
||||
|
||||
link '/usr/lib/httpd/modules/mod_apreq.so' do
|
||||
to '/usr/lib/httpd/modules/mod_apreq2.so'
|
||||
only_if 'test -f /usr/lib/httpd/modules/mod_apreq2.so'
|
||||
end
|
||||
end
|
||||
|
||||
file "#{node['apache']['dir']}/conf.d/apreq.conf" do
|
||||
action :delete
|
||||
backup false
|
||||
end
|
||||
|
||||
apache_module 'apreq'
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Recipe:: auth_basic
|
||||
#
|
||||
# Copyright 2008-2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
apache_module 'auth_basic'
|
||||
@@ -0,0 +1,73 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Recipe:: auth_basic
|
||||
#
|
||||
# Copyright 2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
include_recipe 'apache2::default'
|
||||
|
||||
if node['apache']['mod_auth_cas']['from_source']
|
||||
package 'httpd-devel' do
|
||||
package_name value_for_platform_family(
|
||||
%w[rhel fedora suse] => 'httpd-devel',
|
||||
'debian' => 'apache2-dev'
|
||||
)
|
||||
end
|
||||
|
||||
git '/tmp/mod_auth_cas' do
|
||||
repository 'git://github.com/Jasig/mod_auth_cas.git'
|
||||
revision node['apache']['mod_auth_cas']['source_revision']
|
||||
notifies :run, 'execute[compile mod_auth_cas]', :immediately
|
||||
end
|
||||
|
||||
execute 'compile mod_auth_cas' do
|
||||
command './configure && make && make install'
|
||||
cwd '/tmp/mod_auth_cas'
|
||||
not_if "test -f #{node['apache']['libexecdir']}/mod_auth_cas.so"
|
||||
end
|
||||
|
||||
template "#{node['apache']['dir']}/mods-available/auth_cas.load" do
|
||||
source 'mods/auth_cas.load.erb'
|
||||
owner 'root'
|
||||
group node['apache']['root_group']
|
||||
mode '0644'
|
||||
end
|
||||
else
|
||||
case node['platform_family']
|
||||
when 'debian'
|
||||
package 'libapache2-mod-auth-cas'
|
||||
|
||||
when 'rhel', 'fedora'
|
||||
yum_package 'mod_auth_cas' do
|
||||
notifies :run, 'execute[generate-module-list]', :immediately
|
||||
end
|
||||
|
||||
file "#{node['apache']['dir']}/conf.d/auth_cas.conf" do
|
||||
action :delete
|
||||
backup false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
apache_module 'auth_cas' do
|
||||
conf true
|
||||
end
|
||||
|
||||
directory "#{node['apache']['cache_dir']}/mod_auth_cas" do
|
||||
owner node['apache']['user']
|
||||
group node['apache']['group']
|
||||
mode '0700'
|
||||
end
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Recipe:: auth_digest
|
||||
#
|
||||
# Copyright 2008-2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
apache_module 'auth_digest'
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Recipe:: mod_auth_openid
|
||||
#
|
||||
# Copyright 2008-2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
openid_dev_pkgs = value_for_platform_family(
|
||||
'debian' => %w[automake make g++ apache2-prefork-dev libopkele-dev libopkele3 libtool],
|
||||
%w[rhel fedora] => %w[gcc-c++ httpd-devel curl-devel libtidy libtidy-devel sqlite-devel pcre-devel openssl-devel make libtool],
|
||||
'arch' => %w[libopkele],
|
||||
'freebsd' => %w[libopkele pcre sqlite3]
|
||||
)
|
||||
|
||||
make_cmd = value_for_platform_family(
|
||||
'freebsd' => { 'default' => 'gmake' },
|
||||
'default' => 'make'
|
||||
)
|
||||
|
||||
case node['platform_family']
|
||||
when 'arch'
|
||||
include_recipe 'pacman::default'
|
||||
|
||||
package 'tidyhtml'
|
||||
|
||||
pacman_aur openid_dev_pkgs.first do
|
||||
action [:build, :install]
|
||||
end
|
||||
else
|
||||
openid_dev_pkgs.each do |pkg|
|
||||
package pkg
|
||||
end
|
||||
end
|
||||
|
||||
case node['platform_family']
|
||||
when 'rhel', 'fedora'
|
||||
remote_file "#{Chef::Config['file_cache_path']}/libopkele-2.0.4.tar.gz" do
|
||||
source 'http://kin.klever.net/dist/libopkele-2.0.4.tar.gz'
|
||||
mode '0644'
|
||||
checksum '57a5bc753b7e80c5ece1e5968b2051b0ce7ed9ce4329d17122c61575a9ea7648'
|
||||
end
|
||||
|
||||
bash 'install libopkele' do
|
||||
cwd Chef::Config['file_cache_path']
|
||||
# Ruby 1.8.6 does not have rpartition, unfortunately
|
||||
syslibdir = node['apache']['lib_dir'][0..node['apache']['lib_dir'].rindex('/')]
|
||||
code <<-EOH
|
||||
tar zxvf libopkele-2.0.4.tar.gz
|
||||
cd libopkele-2.0.4 && ./configure --prefix=/usr --libdir=#{syslibdir}
|
||||
#{make_cmd} && #{make_cmd} install
|
||||
EOH
|
||||
creates "#{syslibdir}/libopkele.a"
|
||||
end
|
||||
end
|
||||
|
||||
version = node['apache']['mod_auth_openid']['ref']
|
||||
configure_flags = node['apache']['mod_auth_openid']['configure_flags']
|
||||
|
||||
remote_file "#{Chef::Config['file_cache_path']}/mod_auth_openid-#{version}.tar.gz" do
|
||||
source node['apache']['mod_auth_openid']['source_url']
|
||||
mode '0644'
|
||||
action :create_if_missing
|
||||
end
|
||||
|
||||
directory node['apache']['mod_auth_openid']['cache_dir'] do
|
||||
owner node['apache']['user']
|
||||
group node['apache']['group']
|
||||
mode '0700'
|
||||
end
|
||||
|
||||
bash 'untar mod_auth_openid' do
|
||||
cwd Chef::Config['file_cache_path']
|
||||
code <<-EOH
|
||||
tar zxvf mod_auth_openid-#{version}.tar.gz
|
||||
EOH
|
||||
creates "#{Chef::Config['file_cache_path']}/mod_auth_openid-#{version}/src/types.h"
|
||||
end
|
||||
|
||||
bash 'compile mod_auth_openid' do
|
||||
cwd "#{Chef::Config['file_cache_path']}/mod_auth_openid-#{version}"
|
||||
code <<-EOH
|
||||
./autogen.sh
|
||||
./configure #{configure_flags.join(' ')}
|
||||
perl -pi -e "s/-i -a -n 'authopenid'/-i -n 'authopenid'/g" Makefile
|
||||
#{make_cmd}
|
||||
EOH
|
||||
creates "#{Chef::Config['file_cache_path']}/mod_auth_openid-#{version}/src/.libs/mod_auth_openid.so"
|
||||
notifies :run, 'bash[install-mod_auth_openid]', :immediately
|
||||
not_if "test -f #{Chef::Config['file_cache_path']}/mod_auth_openid-#{version}/src/.libs/mod_auth_openid.so"
|
||||
end
|
||||
|
||||
bash 'install-mod_auth_openid' do
|
||||
cwd "#{Chef::Config['file_cache_path']}/mod_auth_openid-#{version}"
|
||||
code <<-EOH
|
||||
#{make_cmd} install
|
||||
EOH
|
||||
creates "#{node['apache']['libexecdir']}/mod_auth_openid.so"
|
||||
notifies :restart, 'service[apache2]'
|
||||
not_if "test -f #{node['apache']['libexecdir']}/mod_auth_openid.so"
|
||||
end
|
||||
|
||||
template "#{node['apache']['dir']}/mods-available/authopenid.load" do
|
||||
source 'mods/authopenid.load.erb'
|
||||
owner 'root'
|
||||
group node['apache']['root_group']
|
||||
mode '0644'
|
||||
end
|
||||
|
||||
apache_module 'authopenid' do
|
||||
filename 'mod_auth_openid.so'
|
||||
end
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Recipe:: authn_file
|
||||
#
|
||||
# Copyright 2008-2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
apache_module 'authn_file'
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Recipe:: authnz_ldap
|
||||
#
|
||||
# Copyright 2008-2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
apache_module 'authnz_ldap'
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Recipe:: authz_default
|
||||
#
|
||||
# Copyright 2008-2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
apache_module 'authz_default'
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Recipe:: authz_groupfile
|
||||
#
|
||||
# Copyright 2008-2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
apache_module 'authz_groupfile'
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Recipe:: authz_host
|
||||
#
|
||||
# Copyright 2008-2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
apache_module 'authz_host'
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Recipe:: authz_user
|
||||
#
|
||||
# Copyright 2008-2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
apache_module 'authz_user'
|
||||
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Recipe:: autoindex
|
||||
#
|
||||
# Copyright 2008-2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
apache_module 'autoindex' do
|
||||
conf true
|
||||
end
|
||||
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Recipe:: cgi
|
||||
#
|
||||
# Copyright 2008-2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
apache_module 'cgi'
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
#
|
||||
# Cookbook Name:: apache2
|
||||
# Recipe:: cloudflare
|
||||
#
|
||||
# Copyright 2008-2013, Opscode, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
apt_repository 'cloudflare' do
|
||||
uri 'http://pkg.cloudflare.com'
|
||||
distribution node['lsb']['codename']
|
||||
components ['main']
|
||||
key 'http://pkg.cloudflare.com/pubkey.gpg'
|
||||
action :add
|
||||
end
|
||||
|
||||
package 'libapache2-mod-cloudflare' do
|
||||
notifies :restart, 'service[apache2]'
|
||||
end
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user