diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index fa46a593410..fb8d8ec14b2 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -1712,6 +1712,11 @@ "ImportPath": "github.com/google/gofuzz", "Rev": "44d81051d367757e1c7c6a5a86423ece9afcf63c" }, + { + "ImportPath": "github.com/google/uuid", + "Comment": "0.2-15-g8c31c18", + "Rev": "8c31c18f31ede9fc8eae72290a7e7a8064e9b3e3" + }, { "ImportPath": "github.com/googleapis/gnostic/OpenAPIv2", "Rev": "0c5108395e2debce0d731cf0287ddf7242066aba" @@ -2630,93 +2635,113 @@ }, { "ImportPath": "github.com/vmware/govmomi", - "Comment": "v0.14.0-11-gb8b228c", - "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" + "Comment": "v0.16.0-5-g5f0f400", + "Rev": "5f0f4004a1f075f29e715f1b956ca0ab4b428f17" }, { "ImportPath": "github.com/vmware/govmomi/find", - "Comment": "v0.14.0-11-gb8b228c", - "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" + "Comment": "v0.16.0-5-g5f0f400", + "Rev": "5f0f4004a1f075f29e715f1b956ca0ab4b428f17" }, { "ImportPath": "github.com/vmware/govmomi/list", - "Comment": "v0.14.0-11-gb8b228c", - "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" + "Comment": "v0.16.0-5-g5f0f400", + "Rev": "5f0f4004a1f075f29e715f1b956ca0ab4b428f17" + }, + { + "ImportPath": "github.com/vmware/govmomi/nfc", + "Comment": "v0.16.0-5-g5f0f400", + "Rev": "5f0f4004a1f075f29e715f1b956ca0ab4b428f17" }, { "ImportPath": "github.com/vmware/govmomi/object", - "Comment": "v0.14.0-11-gb8b228c", - "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" + "Comment": "v0.16.0-5-g5f0f400", + "Rev": "5f0f4004a1f075f29e715f1b956ca0ab4b428f17" }, { "ImportPath": "github.com/vmware/govmomi/pbm", - "Comment": "v0.14.0-11-gb8b228c", - "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" + "Comment": "v0.16.0-5-g5f0f400", + "Rev": "5f0f4004a1f075f29e715f1b956ca0ab4b428f17" }, { "ImportPath": "github.com/vmware/govmomi/pbm/methods", - "Comment": "v0.14.0-11-gb8b228c", - "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" + "Comment": "v0.16.0-5-g5f0f400", + "Rev": "5f0f4004a1f075f29e715f1b956ca0ab4b428f17" }, { "ImportPath": "github.com/vmware/govmomi/pbm/types", - "Comment": "v0.14.0-11-gb8b228c", - "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" + "Comment": "v0.16.0-5-g5f0f400", + "Rev": "5f0f4004a1f075f29e715f1b956ca0ab4b428f17" }, { "ImportPath": "github.com/vmware/govmomi/property", - "Comment": "v0.14.0-11-gb8b228c", - "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" + "Comment": "v0.16.0-5-g5f0f400", + "Rev": "5f0f4004a1f075f29e715f1b956ca0ab4b428f17" }, { "ImportPath": "github.com/vmware/govmomi/session", - "Comment": "v0.14.0-11-gb8b228c", - "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" + "Comment": "v0.16.0-5-g5f0f400", + "Rev": "5f0f4004a1f075f29e715f1b956ca0ab4b428f17" + }, + { + "ImportPath": "github.com/vmware/govmomi/simulator", + "Comment": "v0.16.0-5-g5f0f400", + "Rev": "5f0f4004a1f075f29e715f1b956ca0ab4b428f17" + }, + { + "ImportPath": "github.com/vmware/govmomi/simulator/esx", + "Comment": "v0.16.0-5-g5f0f400", + "Rev": "5f0f4004a1f075f29e715f1b956ca0ab4b428f17" + }, + { + "ImportPath": "github.com/vmware/govmomi/simulator/vpx", + "Comment": "v0.16.0-5-g5f0f400", + "Rev": "5f0f4004a1f075f29e715f1b956ca0ab4b428f17" }, { "ImportPath": "github.com/vmware/govmomi/task", - "Comment": "v0.14.0-11-gb8b228c", - "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" + "Comment": "v0.16.0-5-g5f0f400", + "Rev": "5f0f4004a1f075f29e715f1b956ca0ab4b428f17" }, { "ImportPath": "github.com/vmware/govmomi/vim25", - "Comment": "v0.14.0-11-gb8b228c", - "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" + "Comment": "v0.16.0-5-g5f0f400", + "Rev": "5f0f4004a1f075f29e715f1b956ca0ab4b428f17" }, { "ImportPath": "github.com/vmware/govmomi/vim25/debug", - "Comment": "v0.14.0-11-gb8b228c", - "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" + "Comment": "v0.16.0-5-g5f0f400", + "Rev": "5f0f4004a1f075f29e715f1b956ca0ab4b428f17" }, { "ImportPath": "github.com/vmware/govmomi/vim25/methods", - "Comment": "v0.14.0-11-gb8b228c", - "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" + "Comment": "v0.16.0-5-g5f0f400", + "Rev": "5f0f4004a1f075f29e715f1b956ca0ab4b428f17" }, { "ImportPath": "github.com/vmware/govmomi/vim25/mo", - "Comment": "v0.14.0-11-gb8b228c", - "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" + "Comment": "v0.16.0-5-g5f0f400", + "Rev": "5f0f4004a1f075f29e715f1b956ca0ab4b428f17" }, { "ImportPath": "github.com/vmware/govmomi/vim25/progress", - "Comment": "v0.14.0-11-gb8b228c", - "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" + "Comment": "v0.16.0-5-g5f0f400", + "Rev": "5f0f4004a1f075f29e715f1b956ca0ab4b428f17" }, { "ImportPath": "github.com/vmware/govmomi/vim25/soap", - "Comment": "v0.14.0-11-gb8b228c", - "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" + "Comment": "v0.16.0-5-g5f0f400", + "Rev": "5f0f4004a1f075f29e715f1b956ca0ab4b428f17" }, { "ImportPath": "github.com/vmware/govmomi/vim25/types", - "Comment": "v0.14.0-11-gb8b228c", - "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" + "Comment": "v0.16.0-5-g5f0f400", + "Rev": "5f0f4004a1f075f29e715f1b956ca0ab4b428f17" }, { "ImportPath": "github.com/vmware/govmomi/vim25/xml", - "Comment": "v0.14.0-11-gb8b228c", - "Rev": "b8b228cfbad7f0a69ed90393ca9aee085d3c6ef1" + "Comment": "v0.16.0-5-g5f0f400", + "Rev": "5f0f4004a1f075f29e715f1b956ca0ab4b428f17" }, { "ImportPath": "github.com/vmware/photon-controller-go-sdk/SSPI", diff --git a/Godeps/LICENSES b/Godeps/LICENSES index 8021a07e90e..f4cf45fa76e 100644 --- a/Godeps/LICENSES +++ b/Godeps/LICENSES @@ -58133,6 +58133,41 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================================ +================================================================================ += vendor/github.com/google/uuid licensed under: = + +Copyright (c) 2009,2014 Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + += vendor/github.com/google/uuid/LICENSE 88073b6dd8ec00fe09da59e0b6dfded1 +================================================================================ + + ================================================================================ = vendor/github.com/googleapis/gnostic/compiler licensed under: = @@ -83473,6 +83508,216 @@ SOFTWARE. ================================================================================ +================================================================================ += vendor/github.com/vmware/govmomi/nfc licensed under: = + + + 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. + += vendor/github.com/vmware/govmomi/LICENSE.txt 3b83ef96387f14655fc854ddc3c6bd57 +================================================================================ + + ================================================================================ = vendor/github.com/vmware/govmomi/object licensed under: = @@ -84733,6 +84978,636 @@ SOFTWARE. ================================================================================ +================================================================================ += vendor/github.com/vmware/govmomi/simulator licensed under: = + + + 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. + += vendor/github.com/vmware/govmomi/LICENSE.txt 3b83ef96387f14655fc854ddc3c6bd57 +================================================================================ + + +================================================================================ += vendor/github.com/vmware/govmomi/simulator/esx licensed under: = + + + 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. + += vendor/github.com/vmware/govmomi/LICENSE.txt 3b83ef96387f14655fc854ddc3c6bd57 +================================================================================ + + +================================================================================ += vendor/github.com/vmware/govmomi/simulator/vpx licensed under: = + + + 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. + += vendor/github.com/vmware/govmomi/LICENSE.txt 3b83ef96387f14655fc854ddc3c6bd57 +================================================================================ + + ================================================================================ = vendor/github.com/vmware/govmomi/task licensed under: = diff --git a/pkg/cloudprovider/providers/vsphere/vclib/BUILD b/pkg/cloudprovider/providers/vsphere/vclib/BUILD index 6750d560e4c..42001e1e2f9 100644 --- a/pkg/cloudprovider/providers/vsphere/vclib/BUILD +++ b/pkg/cloudprovider/providers/vsphere/vclib/BUILD @@ -3,6 +3,7 @@ package(default_visibility = ["//visibility:public"]) load( "@io_bazel_rules_go//go:def.bzl", "go_library", + "go_test", ) go_library( @@ -55,3 +56,14 @@ filegroup( ], tags = ["automanaged"], ) + +go_test( + name = "go_default_test", + srcs = ["datacenter_test.go"], + embed = [":go_default_library"], + importpath = "k8s.io/kubernetes/pkg/cloudprovider/providers/vsphere/vclib", + deps = [ + "//vendor/github.com/vmware/govmomi:go_default_library", + "//vendor/github.com/vmware/govmomi/simulator:go_default_library", + ], +) diff --git a/vendor/BUILD b/vendor/BUILD index 20495c2248a..b17abcaf91f 100644 --- a/vendor/BUILD +++ b/vendor/BUILD @@ -244,6 +244,7 @@ filegroup( "//vendor/github.com/google/cadvisor/zfs:all-srcs", "//vendor/github.com/google/certificate-transparency/go:all-srcs", "//vendor/github.com/google/gofuzz:all-srcs", + "//vendor/github.com/google/uuid:all-srcs", "//vendor/github.com/googleapis/gnostic/OpenAPIv2:all-srcs", "//vendor/github.com/googleapis/gnostic/compiler:all-srcs", "//vendor/github.com/googleapis/gnostic/extensions:all-srcs", diff --git a/vendor/github.com/google/uuid/.travis.yml b/vendor/github.com/google/uuid/.travis.yml new file mode 100644 index 00000000000..d8156a60ba9 --- /dev/null +++ b/vendor/github.com/google/uuid/.travis.yml @@ -0,0 +1,9 @@ +language: go + +go: + - 1.4.3 + - 1.5.3 + - tip + +script: + - go test -v ./... diff --git a/vendor/github.com/google/uuid/BUILD b/vendor/github.com/google/uuid/BUILD new file mode 100644 index 00000000000..64c2ffc3ed3 --- /dev/null +++ b/vendor/github.com/google/uuid/BUILD @@ -0,0 +1,34 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "dce.go", + "doc.go", + "hash.go", + "marshal.go", + "node.go", + "sql.go", + "time.go", + "util.go", + "uuid.go", + "version1.go", + "version4.go", + ], + importpath = "github.com/google/uuid", + visibility = ["//visibility:public"], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/vendor/github.com/google/uuid/CONTRIBUTING.md b/vendor/github.com/google/uuid/CONTRIBUTING.md new file mode 100644 index 00000000000..04fdf09f136 --- /dev/null +++ b/vendor/github.com/google/uuid/CONTRIBUTING.md @@ -0,0 +1,10 @@ +# How to contribute + +We definitely welcome patches and contribution to this project! + +### Legal requirements + +In order to protect both you and ourselves, you will need to sign the +[Contributor License Agreement](https://cla.developers.google.com/clas). + +You may have already signed it for other Google projects. diff --git a/vendor/github.com/google/uuid/CONTRIBUTORS b/vendor/github.com/google/uuid/CONTRIBUTORS new file mode 100644 index 00000000000..b4bb97f6bcd --- /dev/null +++ b/vendor/github.com/google/uuid/CONTRIBUTORS @@ -0,0 +1,9 @@ +Paul Borman +bmatsuo +shawnps +theory +jboverfelt +dsymonds +cd1 +wallclockbuilder +dansouza diff --git a/vendor/github.com/google/uuid/LICENSE b/vendor/github.com/google/uuid/LICENSE new file mode 100644 index 00000000000..5dc68268d90 --- /dev/null +++ b/vendor/github.com/google/uuid/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009,2014 Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/google/uuid/README.md b/vendor/github.com/google/uuid/README.md new file mode 100644 index 00000000000..21205eaeb59 --- /dev/null +++ b/vendor/github.com/google/uuid/README.md @@ -0,0 +1,23 @@ +**This package is currently in development and the API may not be stable.** + +The API will become stable with v1. + +# uuid ![build status](https://travis-ci.org/google/uuid.svg?branch=master) +The uuid package generates and inspects UUIDs based on +[RFC 4122](http://tools.ietf.org/html/rfc4122) +and DCE 1.1: Authentication and Security Services. + +This package is based on the github.com/pborman/uuid package (previously named +code.google.com/p/go-uuid). It differs from these earlier packages in that +a UUID is a 16 byte array rather than a byte slice. One loss due to this +change is the ability to represent an invalid UUID (vs a NIL UUID). + +###### Install +`go get github.com/google/uuid` + +###### Documentation +[![GoDoc](https://godoc.org/github.com/google/uuid?status.svg)](http://godoc.org/github.com/google/uuid) + +Full `go doc` style documentation for the package can be viewed online without +installing this package by using the GoDoc site here: +http://godoc.org/github.com/google/uuid diff --git a/vendor/github.com/google/uuid/dce.go b/vendor/github.com/google/uuid/dce.go new file mode 100644 index 00000000000..fa820b9d309 --- /dev/null +++ b/vendor/github.com/google/uuid/dce.go @@ -0,0 +1,80 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "encoding/binary" + "fmt" + "os" +) + +// A Domain represents a Version 2 domain +type Domain byte + +// Domain constants for DCE Security (Version 2) UUIDs. +const ( + Person = Domain(0) + Group = Domain(1) + Org = Domain(2) +) + +// NewDCESecurity returns a DCE Security (Version 2) UUID. +// +// The domain should be one of Person, Group or Org. +// On a POSIX system the id should be the users UID for the Person +// domain and the users GID for the Group. The meaning of id for +// the domain Org or on non-POSIX systems is site defined. +// +// For a given domain/id pair the same token may be returned for up to +// 7 minutes and 10 seconds. +func NewDCESecurity(domain Domain, id uint32) (UUID, error) { + uuid, err := NewUUID() + if err == nil { + uuid[6] = (uuid[6] & 0x0f) | 0x20 // Version 2 + uuid[9] = byte(domain) + binary.BigEndian.PutUint32(uuid[0:], id) + } + return uuid, err +} + +// NewDCEPerson returns a DCE Security (Version 2) UUID in the person +// domain with the id returned by os.Getuid. +// +// NewDCESecurity(Person, uint32(os.Getuid())) +func NewDCEPerson() (UUID, error) { + return NewDCESecurity(Person, uint32(os.Getuid())) +} + +// NewDCEGroup returns a DCE Security (Version 2) UUID in the group +// domain with the id returned by os.Getgid. +// +// NewDCESecurity(Group, uint32(os.Getgid())) +func NewDCEGroup() (UUID, error) { + return NewDCESecurity(Group, uint32(os.Getgid())) +} + +// Domain returns the domain for a Version 2 UUID. Domains are only defined +// for Version 2 UUIDs. +func (uuid UUID) Domain() Domain { + return Domain(uuid[9]) +} + +// ID returns the id for a Version 2 UUID. IDs are only defined for Version 2 +// UUIDs. +func (uuid UUID) ID() uint32 { + return binary.BigEndian.Uint32(uuid[0:4]) +} + +func (d Domain) String() string { + switch d { + case Person: + return "Person" + case Group: + return "Group" + case Org: + return "Org" + } + return fmt.Sprintf("Domain%d", int(d)) +} diff --git a/vendor/github.com/google/uuid/doc.go b/vendor/github.com/google/uuid/doc.go new file mode 100644 index 00000000000..5b8a4b9af8c --- /dev/null +++ b/vendor/github.com/google/uuid/doc.go @@ -0,0 +1,12 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package uuid generates and inspects UUIDs. +// +// UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security +// Services. +// +// A UUID is a 16 byte (128 bit) array. UUIDs may be used as keys to +// maps or compared directly. +package uuid diff --git a/vendor/github.com/google/uuid/hash.go b/vendor/github.com/google/uuid/hash.go new file mode 100644 index 00000000000..4fc5a77df58 --- /dev/null +++ b/vendor/github.com/google/uuid/hash.go @@ -0,0 +1,53 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "crypto/md5" + "crypto/sha1" + "hash" +) + +// Well known namespace IDs and UUIDs +var ( + NameSpaceDNS = Must(Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8")) + NameSpaceURL = Must(Parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8")) + NameSpaceOID = Must(Parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8")) + NameSpaceX500 = Must(Parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8")) + Nil UUID // empty UUID, all zeros +) + +// NewHash returns a new UUID derived from the hash of space concatenated with +// data generated by h. The hash should be at least 16 byte in length. The +// first 16 bytes of the hash are used to form the UUID. The version of the +// UUID will be the lower 4 bits of version. NewHash is used to implement +// NewMD5 and NewSHA1. +func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID { + h.Reset() + h.Write(space[:]) + h.Write([]byte(data)) + s := h.Sum(nil) + var uuid UUID + copy(uuid[:], s) + uuid[6] = (uuid[6] & 0x0f) | uint8((version&0xf)<<4) + uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 4122 variant + return uuid +} + +// NewMD5 returns a new MD5 (Version 3) UUID based on the +// supplied name space and data. It is the same as calling: +// +// NewHash(md5.New(), space, data, 3) +func NewMD5(space UUID, data []byte) UUID { + return NewHash(md5.New(), space, data, 3) +} + +// NewSHA1 returns a new SHA1 (Version 5) UUID based on the +// supplied name space and data. It is the same as calling: +// +// NewHash(sha1.New(), space, data, 5) +func NewSHA1(space UUID, data []byte) UUID { + return NewHash(sha1.New(), space, data, 5) +} diff --git a/vendor/github.com/google/uuid/marshal.go b/vendor/github.com/google/uuid/marshal.go new file mode 100644 index 00000000000..84bbc5880bb --- /dev/null +++ b/vendor/github.com/google/uuid/marshal.go @@ -0,0 +1,39 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import "fmt" + +// MarshalText implements encoding.TextMarshaler. +func (uuid UUID) MarshalText() ([]byte, error) { + var js [36]byte + encodeHex(js[:], uuid) + return js[:], nil +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (uuid *UUID) UnmarshalText(data []byte) error { + // See comment in ParseBytes why we do this. + // id, err := ParseBytes(data) + id, err := ParseBytes(data) + if err == nil { + *uuid = id + } + return err +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (uuid UUID) MarshalBinary() ([]byte, error) { + return uuid[:], nil +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (uuid *UUID) UnmarshalBinary(data []byte) error { + if len(data) != 16 { + return fmt.Errorf("invalid UUID (got %d bytes)", len(data)) + } + copy(uuid[:], data) + return nil +} diff --git a/vendor/github.com/google/uuid/node.go b/vendor/github.com/google/uuid/node.go new file mode 100644 index 00000000000..f2c2765b220 --- /dev/null +++ b/vendor/github.com/google/uuid/node.go @@ -0,0 +1,100 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "net" + "sync" +) + +var ( + nodeMu sync.Mutex + interfaces []net.Interface // cached list of interfaces + ifname string // name of interface being used + nodeID [6]byte // hardware for version 1 UUIDs + zeroID [6]byte // nodeID with only 0's +) + +// NodeInterface returns the name of the interface from which the NodeID was +// derived. The interface "user" is returned if the NodeID was set by +// SetNodeID. +func NodeInterface() string { + defer nodeMu.Unlock() + nodeMu.Lock() + return ifname +} + +// SetNodeInterface selects the hardware address to be used for Version 1 UUIDs. +// If name is "" then the first usable interface found will be used or a random +// Node ID will be generated. If a named interface cannot be found then false +// is returned. +// +// SetNodeInterface never fails when name is "". +func SetNodeInterface(name string) bool { + defer nodeMu.Unlock() + nodeMu.Lock() + return setNodeInterface(name) +} + +func setNodeInterface(name string) bool { + if interfaces == nil { + var err error + interfaces, err = net.Interfaces() + if err != nil && name != "" { + return false + } + } + + for _, ifs := range interfaces { + if len(ifs.HardwareAddr) >= 6 && (name == "" || name == ifs.Name) { + copy(nodeID[:], ifs.HardwareAddr) + ifname = ifs.Name + return true + } + } + + // We found no interfaces with a valid hardware address. If name + // does not specify a specific interface generate a random Node ID + // (section 4.1.6) + if name == "" { + randomBits(nodeID[:]) + return true + } + return false +} + +// NodeID returns a slice of a copy of the current Node ID, setting the Node ID +// if not already set. +func NodeID() []byte { + defer nodeMu.Unlock() + nodeMu.Lock() + if nodeID == zeroID { + setNodeInterface("") + } + nid := nodeID + return nid[:] +} + +// SetNodeID sets the Node ID to be used for Version 1 UUIDs. The first 6 bytes +// of id are used. If id is less than 6 bytes then false is returned and the +// Node ID is not set. +func SetNodeID(id []byte) bool { + if len(id) < 6 { + return false + } + defer nodeMu.Unlock() + nodeMu.Lock() + copy(nodeID[:], id) + ifname = "user" + return true +} + +// NodeID returns the 6 byte node id encoded in uuid. It returns nil if uuid is +// not valid. The NodeID is only well defined for version 1 and 2 UUIDs. +func (uuid UUID) NodeID() []byte { + var node [6]byte + copy(node[:], uuid[10:]) + return node[:] +} diff --git a/vendor/github.com/google/uuid/sql.go b/vendor/github.com/google/uuid/sql.go new file mode 100644 index 00000000000..f326b54db37 --- /dev/null +++ b/vendor/github.com/google/uuid/sql.go @@ -0,0 +1,59 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "database/sql/driver" + "fmt" +) + +// Scan implements sql.Scanner so UUIDs can be read from databases transparently +// Currently, database types that map to string and []byte are supported. Please +// consult database-specific driver documentation for matching types. +func (uuid *UUID) Scan(src interface{}) error { + switch src := src.(type) { + case nil: + return nil + + case string: + // if an empty UUID comes from a table, we return a null UUID + if src == "" { + return nil + } + + // see Parse for required string format + u, err := Parse(src) + if err != nil { + return fmt.Errorf("Scan: %v", err) + } + + *uuid = u + + case []byte: + // if an empty UUID comes from a table, we return a null UUID + if len(src) == 0 { + return nil + } + + // assumes a simple slice of bytes if 16 bytes + // otherwise attempts to parse + if len(src) != 16 { + return uuid.Scan(string(src)) + } + copy((*uuid)[:], src) + + default: + return fmt.Errorf("Scan: unable to scan type %T into UUID", src) + } + + return nil +} + +// Value implements sql.Valuer so that UUIDs can be written to databases +// transparently. Currently, UUIDs map to strings. Please consult +// database-specific driver documentation for matching types. +func (uuid UUID) Value() (driver.Value, error) { + return uuid.String(), nil +} diff --git a/vendor/github.com/google/uuid/time.go b/vendor/github.com/google/uuid/time.go new file mode 100644 index 00000000000..fd7fe0ac46a --- /dev/null +++ b/vendor/github.com/google/uuid/time.go @@ -0,0 +1,123 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "encoding/binary" + "sync" + "time" +) + +// A Time represents a time as the number of 100's of nanoseconds since 15 Oct +// 1582. +type Time int64 + +const ( + lillian = 2299160 // Julian day of 15 Oct 1582 + unix = 2440587 // Julian day of 1 Jan 1970 + epoch = unix - lillian // Days between epochs + g1582 = epoch * 86400 // seconds between epochs + g1582ns100 = g1582 * 10000000 // 100s of a nanoseconds between epochs +) + +var ( + timeMu sync.Mutex + lasttime uint64 // last time we returned + clockSeq uint16 // clock sequence for this run + + timeNow = time.Now // for testing +) + +// UnixTime converts t the number of seconds and nanoseconds using the Unix +// epoch of 1 Jan 1970. +func (t Time) UnixTime() (sec, nsec int64) { + sec = int64(t - g1582ns100) + nsec = (sec % 10000000) * 100 + sec /= 10000000 + return sec, nsec +} + +// GetTime returns the current Time (100s of nanoseconds since 15 Oct 1582) and +// clock sequence as well as adjusting the clock sequence as needed. An error +// is returned if the current time cannot be determined. +func GetTime() (Time, uint16, error) { + defer timeMu.Unlock() + timeMu.Lock() + return getTime() +} + +func getTime() (Time, uint16, error) { + t := timeNow() + + // If we don't have a clock sequence already, set one. + if clockSeq == 0 { + setClockSequence(-1) + } + now := uint64(t.UnixNano()/100) + g1582ns100 + + // If time has gone backwards with this clock sequence then we + // increment the clock sequence + if now <= lasttime { + clockSeq = ((clockSeq + 1) & 0x3fff) | 0x8000 + } + lasttime = now + return Time(now), clockSeq, nil +} + +// ClockSequence returns the current clock sequence, generating one if not +// already set. The clock sequence is only used for Version 1 UUIDs. +// +// The uuid package does not use global static storage for the clock sequence or +// the last time a UUID was generated. Unless SetClockSequence is used, a new +// random clock sequence is generated the first time a clock sequence is +// requested by ClockSequence, GetTime, or NewUUID. (section 4.2.1.1) +func ClockSequence() int { + defer timeMu.Unlock() + timeMu.Lock() + return clockSequence() +} + +func clockSequence() int { + if clockSeq == 0 { + setClockSequence(-1) + } + return int(clockSeq & 0x3fff) +} + +// SetClockSeq sets the clock sequence to the lower 14 bits of seq. Setting to +// -1 causes a new sequence to be generated. +func SetClockSequence(seq int) { + defer timeMu.Unlock() + timeMu.Lock() + setClockSequence(seq) +} + +func setClockSequence(seq int) { + if seq == -1 { + var b [2]byte + randomBits(b[:]) // clock sequence + seq = int(b[0])<<8 | int(b[1]) + } + old_seq := clockSeq + clockSeq = uint16(seq&0x3fff) | 0x8000 // Set our variant + if old_seq != clockSeq { + lasttime = 0 + } +} + +// Time returns the time in 100s of nanoseconds since 15 Oct 1582 encoded in +// uuid. The time is only defined for version 1 and 2 UUIDs. +func (uuid UUID) Time() Time { + time := int64(binary.BigEndian.Uint32(uuid[0:4])) + time |= int64(binary.BigEndian.Uint16(uuid[4:6])) << 32 + time |= int64(binary.BigEndian.Uint16(uuid[6:8])&0xfff) << 48 + return Time(time) +} + +// ClockSequence returns the clock sequence encoded in uuid. +// The clock sequence is only well defined for version 1 and 2 UUIDs. +func (uuid UUID) ClockSequence() int { + return int(binary.BigEndian.Uint16(uuid[8:10])) & 0x3fff +} diff --git a/vendor/github.com/google/uuid/util.go b/vendor/github.com/google/uuid/util.go new file mode 100644 index 00000000000..5ea6c737806 --- /dev/null +++ b/vendor/github.com/google/uuid/util.go @@ -0,0 +1,43 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "io" +) + +// randomBits completely fills slice b with random data. +func randomBits(b []byte) { + if _, err := io.ReadFull(rander, b); err != nil { + panic(err.Error()) // rand should never fail + } +} + +// xvalues returns the value of a byte as a hexadecimal digit or 255. +var xvalues = [256]byte{ + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 255, 255, 255, 255, 255, + 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, +} + +// xtob converts hex characters x1 and x2 into a byte. +func xtob(x1, x2 byte) (byte, bool) { + b1 := xvalues[x1] + b2 := xvalues[x2] + return (b1 << 4) | b2, b1 != 255 && b2 != 255 +} diff --git a/vendor/github.com/google/uuid/uuid.go b/vendor/github.com/google/uuid/uuid.go new file mode 100644 index 00000000000..1320d60d80f --- /dev/null +++ b/vendor/github.com/google/uuid/uuid.go @@ -0,0 +1,198 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "bytes" + "crypto/rand" + "encoding/hex" + "errors" + "fmt" + "io" + "strings" +) + +// A UUID is a 128 bit (16 byte) Universal Unique IDentifier as defined in RFC +// 4122. +type UUID [16]byte + +// A Version represents a UUID's version. +type Version byte + +// A Variant represents a UUID's variant. +type Variant byte + +// Constants returned by Variant. +const ( + Invalid = Variant(iota) // Invalid UUID + RFC4122 // The variant specified in RFC4122 + Reserved // Reserved, NCS backward compatibility. + Microsoft // Reserved, Microsoft Corporation backward compatibility. + Future // Reserved for future definition. +) + +var rander = rand.Reader // random function + +// Parse decodes s into a UUID or returns an error. Both the UUID form of +// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and +// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx are decoded. +func Parse(s string) (UUID, error) { + var uuid UUID + if len(s) != 36 { + if len(s) != 36+9 { + return uuid, fmt.Errorf("invalid UUID length: %d", len(s)) + } + if strings.ToLower(s[:9]) != "urn:uuid:" { + return uuid, fmt.Errorf("invalid urn prefix: %q", s[:9]) + } + s = s[9:] + } + if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { + return uuid, errors.New("invalid UUID format") + } + for i, x := range [16]int{ + 0, 2, 4, 6, + 9, 11, + 14, 16, + 19, 21, + 24, 26, 28, 30, 32, 34} { + if v, ok := xtob(s[x], s[x+1]); !ok { + return uuid, errors.New("invalid UUID format") + } else { + uuid[i] = v + } + } + return uuid, nil +} + +// ParseBytes is like Parse, except it parses a byte slice instead of a string. +func ParseBytes(b []byte) (UUID, error) { + var uuid UUID + if len(b) != 36 { + if len(b) != 36+9 { + return uuid, fmt.Errorf("invalid UUID length: %d", len(b)) + } + if !bytes.Equal(bytes.ToLower(b[:9]), []byte("urn:uuid:")) { + return uuid, fmt.Errorf("invalid urn prefix: %q", b[:9]) + } + b = b[9:] + } + if b[8] != '-' || b[13] != '-' || b[18] != '-' || b[23] != '-' { + return uuid, errors.New("invalid UUID format") + } + for i, x := range [16]int{ + 0, 2, 4, 6, + 9, 11, + 14, 16, + 19, 21, + 24, 26, 28, 30, 32, 34} { + if v, ok := xtob(b[x], b[x+1]); !ok { + return uuid, errors.New("invalid UUID format") + } else { + uuid[i] = v + } + } + return uuid, nil +} + +// FromBytes creates a new UUID from a byte slice. Returns an error if the slice +// does not have a length of 16. The bytes are copied from the slice. +func FromBytes(b []byte) (uuid UUID, err error) { + err = uuid.UnmarshalBinary(b) + return uuid, err +} + +// Must returns uuid if err is nil and panics otherwise. +func Must(uuid UUID, err error) UUID { + if err != nil { + panic(err) + } + return uuid +} + +// String returns the string form of uuid, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx +// , or "" if uuid is invalid. +func (uuid UUID) String() string { + var buf [36]byte + encodeHex(buf[:], uuid) + return string(buf[:]) +} + +// URN returns the RFC 2141 URN form of uuid, +// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, or "" if uuid is invalid. +func (uuid UUID) URN() string { + var buf [36 + 9]byte + copy(buf[:], "urn:uuid:") + encodeHex(buf[9:], uuid) + return string(buf[:]) +} + +func encodeHex(dst []byte, uuid UUID) { + hex.Encode(dst[:], uuid[:4]) + dst[8] = '-' + hex.Encode(dst[9:13], uuid[4:6]) + dst[13] = '-' + hex.Encode(dst[14:18], uuid[6:8]) + dst[18] = '-' + hex.Encode(dst[19:23], uuid[8:10]) + dst[23] = '-' + hex.Encode(dst[24:], uuid[10:]) +} + +// Variant returns the variant encoded in uuid. +func (uuid UUID) Variant() Variant { + switch { + case (uuid[8] & 0xc0) == 0x80: + return RFC4122 + case (uuid[8] & 0xe0) == 0xc0: + return Microsoft + case (uuid[8] & 0xe0) == 0xe0: + return Future + default: + return Reserved + } +} + +// Version returns the version of uuid. +func (uuid UUID) Version() Version { + return Version(uuid[6] >> 4) +} + +func (v Version) String() string { + if v > 15 { + return fmt.Sprintf("BAD_VERSION_%d", v) + } + return fmt.Sprintf("VERSION_%d", v) +} + +func (v Variant) String() string { + switch v { + case RFC4122: + return "RFC4122" + case Reserved: + return "Reserved" + case Microsoft: + return "Microsoft" + case Future: + return "Future" + case Invalid: + return "Invalid" + } + return fmt.Sprintf("BadVariant%d", int(v)) +} + +// SetRand sets the random number generator to r, which implements io.Reader. +// If r.Read returns an error when the package requests random data then +// a panic will be issued. +// +// Calling SetRand with nil sets the random number generator to the default +// generator. +func SetRand(r io.Reader) { + if r == nil { + rander = rand.Reader + return + } + rander = r +} diff --git a/vendor/github.com/google/uuid/version1.go b/vendor/github.com/google/uuid/version1.go new file mode 100644 index 00000000000..199a1ac6540 --- /dev/null +++ b/vendor/github.com/google/uuid/version1.go @@ -0,0 +1,44 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "encoding/binary" +) + +// NewUUID returns a Version 1 UUID based on the current NodeID and clock +// sequence, and the current time. If the NodeID has not been set by SetNodeID +// or SetNodeInterface then it will be set automatically. If the NodeID cannot +// be set NewUUID returns nil. If clock sequence has not been set by +// SetClockSequence then it will be set automatically. If GetTime fails to +// return the current NewUUID returns nil and an error. +// +// In most cases, New should be used. +func NewUUID() (UUID, error) { + nodeMu.Lock() + if nodeID == zeroID { + setNodeInterface("") + } + nodeMu.Unlock() + + var uuid UUID + now, seq, err := GetTime() + if err != nil { + return uuid, err + } + + timeLow := uint32(now & 0xffffffff) + timeMid := uint16((now >> 32) & 0xffff) + timeHi := uint16((now >> 48) & 0x0fff) + timeHi |= 0x1000 // Version 1 + + binary.BigEndian.PutUint32(uuid[0:], timeLow) + binary.BigEndian.PutUint16(uuid[4:], timeMid) + binary.BigEndian.PutUint16(uuid[6:], timeHi) + binary.BigEndian.PutUint16(uuid[8:], seq) + copy(uuid[10:], nodeID[:]) + + return uuid, nil +} diff --git a/vendor/github.com/google/uuid/version4.go b/vendor/github.com/google/uuid/version4.go new file mode 100644 index 00000000000..74c4e6c9f5a --- /dev/null +++ b/vendor/github.com/google/uuid/version4.go @@ -0,0 +1,38 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import "io" + +// New creates a new random UUID or panics. New is equivalent to +// the expression +// +// uuid.Must(uuid.NewRandom()) +func New() UUID { + return Must(NewRandom()) +} + +// NewRandom returns a Random (Version 4) UUID or panics. +// +// The strength of the UUIDs is based on the strength of the crypto/rand +// package. +// +// A note about uniqueness derived from the UUID Wikipedia entry: +// +// Randomly generated UUIDs have 122 random bits. One's annual risk of being +// hit by a meteorite is estimated to be one chance in 17 billion, that +// means the probability is about 0.00000000006 (6 × 10−11), +// equivalent to the odds of creating a few tens of trillions of UUIDs in a +// year and having one duplicate. +func NewRandom() (UUID, error) { + var uuid UUID + _, err := io.ReadFull(rander, uuid[:]) + if err != nil { + return Nil, err + } + uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4 + uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10 + return uuid, nil +} diff --git a/vendor/github.com/vmware/govmomi/.drone.sec b/vendor/github.com/vmware/govmomi/.drone.sec deleted file mode 100644 index ad52e59ac87..00000000000 --- a/vendor/github.com/vmware/govmomi/.drone.sec +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkExMjhHQ00ifQ.kK6pryC8R-O1R0Gj9ydLvQuIZlcYLGze23WdW7xbpiEEKdz6nweJrMm7ysy8lgu1tM47JVo19p2_b26bNKSQshCUOETvd7Hb2UMZOjnyUnqdyAAyoi6UkIquXfUUbHTNS0iMxwSxxW9KMp2GXNq8-o6T8xQZTDirBJFKKd8ZNUasTaoa5j8U9IfdR1aCavTBuOhvk8IVs-jSbY5TVJMJiE0IOPXois7aRJ6uAiANQBk9VKLegEcZD_qAewecXHDsHi-u0jbmg3o3PPaJaK_Qv5dsPlR2M-E2kE3AGUn0-zn5zYRngoAZ8WZr2O4GvLdltJKq9i2z7jOrdOzzRcDRow.96qvwl_E1Hj15u7Q.hWs-jQ8FsqQFD7pE9N-UEP1BWQ9rsJIcCaPvQRIp8Fukm_vvlw9YEaEq0ERLrsUWsJWpd1ca8_h8x7xD6f_d5YppwRqRHIeGIsdBOTMhNs0lG8ikkQXLat-UroCpy8EC17nuUtDE2E2Kdxrk4Cdd6Bk-dKk0Ta4w3Ud0YBKa.P8zrO7xizgv0i98eVWWzEg \ No newline at end of file diff --git a/vendor/github.com/vmware/govmomi/.drone.yml b/vendor/github.com/vmware/govmomi/.drone.yml deleted file mode 100644 index dee4bf5b389..00000000000 --- a/vendor/github.com/vmware/govmomi/.drone.yml +++ /dev/null @@ -1,17 +0,0 @@ -clone: - tags: true - path: github.com/vmware/govmomi -build: - image: golang:1.7 - pull: true - environment: - - GOVC_TEST_URL=$$GOVC_TEST_URL - - GOVC_INSECURE=1 - - VCA=1 - commands: - - make all install - - git clone https://github.com/sstephenson/bats.git /tmp/bats - - /tmp/bats/install.sh /usr/local - - apt-get -qq update && apt-get install -yqq uuid-runtime bsdmainutils jq - - govc/test/images/update.sh - - bats govc/test diff --git a/vendor/github.com/vmware/govmomi/.mailmap b/vendor/github.com/vmware/govmomi/.mailmap index 31a0bd55aad..c0e235c5783 100644 --- a/vendor/github.com/vmware/govmomi/.mailmap +++ b/vendor/github.com/vmware/govmomi/.mailmap @@ -13,4 +13,7 @@ Pieter Noordhuis Takaaki Furukawa takaaki.furukawa Takaaki Furukawa tkak Vadim Egorov +Anfernee Yongkun Gui +Anfernee Yongkun Gui Yongkun Anfernee Gui +Zach Tucker Zee Yang diff --git a/vendor/github.com/vmware/govmomi/.travis.yml b/vendor/github.com/vmware/govmomi/.travis.yml index a7fba0350b8..23798f283d4 100644 --- a/vendor/github.com/vmware/govmomi/.travis.yml +++ b/vendor/github.com/vmware/govmomi/.travis.yml @@ -3,7 +3,7 @@ sudo: false language: go go: - - 1.7 + - 1.8 before_install: - make vendor diff --git a/vendor/github.com/vmware/govmomi/BUILD b/vendor/github.com/vmware/govmomi/BUILD index 58a4c6bb7c5..91de0a8391b 100644 --- a/vendor/github.com/vmware/govmomi/BUILD +++ b/vendor/github.com/vmware/govmomi/BUILD @@ -27,10 +27,12 @@ filegroup( ":package-srcs", "//vendor/github.com/vmware/govmomi/find:all-srcs", "//vendor/github.com/vmware/govmomi/list:all-srcs", + "//vendor/github.com/vmware/govmomi/nfc:all-srcs", "//vendor/github.com/vmware/govmomi/object:all-srcs", "//vendor/github.com/vmware/govmomi/pbm:all-srcs", "//vendor/github.com/vmware/govmomi/property:all-srcs", "//vendor/github.com/vmware/govmomi/session:all-srcs", + "//vendor/github.com/vmware/govmomi/simulator:all-srcs", "//vendor/github.com/vmware/govmomi/task:all-srcs", "//vendor/github.com/vmware/govmomi/vim25:all-srcs", ], diff --git a/vendor/github.com/vmware/govmomi/CHANGELOG.md b/vendor/github.com/vmware/govmomi/CHANGELOG.md index ea4dd68db02..42c7cc113bb 100644 --- a/vendor/github.com/vmware/govmomi/CHANGELOG.md +++ b/vendor/github.com/vmware/govmomi/CHANGELOG.md @@ -1,5 +1,36 @@ # changelog +### 0.16.0 (2017-11-08) + +* Add support for SOAP request operation ID header + +* Moved ovf helpers from govc import.ovf command to ovf and nfc packages + +* Added guest/toolbox (client) package + +* Added toolbox package and toolbox command + +* Added simulator package and vcsim command + +### 0.15.0 (2017-06-19) + +* WaitOptions.MaxWaitSeconds is now optional + +* Support removal of ExtraConfig entries + +* GuestPosixFileAttributes OwnerId and GroupId fields are now pointers, + rather than omitempty ints to allow chown with root uid:gid + +* Updated examples/ using view package + +* Add DatastoreFile.TailFunc method + +* Export VirtualMachine.FindSnapshot method + +* Add AuthorizationManager {Enable,Disable}Methods + +* Add PBM client + ### 0.14.0 (2017-04-08) * Add view.ContainerView type and methods diff --git a/vendor/github.com/vmware/govmomi/CONTRIBUTING.md b/vendor/github.com/vmware/govmomi/CONTRIBUTING.md index f87c6061029..f6645cbf4f1 100644 --- a/vendor/github.com/vmware/govmomi/CONTRIBUTING.md +++ b/vendor/github.com/vmware/govmomi/CONTRIBUTING.md @@ -17,6 +17,16 @@ git remote add $USER git@github.com:$USER/govmomi.git git fetch $USER ``` +## Installing from source + +Compile the govmomi libraries and install govc using: + +``` shell +go install -v github.com/vmware/govmomi/govc +``` + +Note that **govc/build.sh** is only used for building release binaries. + ## Contribution flow This is a rough outline of what a contributor's workflow looks like: diff --git a/vendor/github.com/vmware/govmomi/CONTRIBUTORS b/vendor/github.com/vmware/govmomi/CONTRIBUTORS index 6afdb9f56f0..c37dc939849 100644 --- a/vendor/github.com/vmware/govmomi/CONTRIBUTORS +++ b/vendor/github.com/vmware/govmomi/CONTRIBUTORS @@ -3,12 +3,20 @@ # This script is generated by contributors.sh # +Abhijeet Kasurde abrarshivani +Adam Shannon Alvaro Miranda +amandahla Amit Bathla +amit bezalel Andrew Chin +Anfernee Yongkun Gui +aniketGslab Arran Walker +Aryeh Weinreb Austin Parker +Balu Dontu bastienbc Bob Killen Brad Fitzpatrick @@ -35,8 +43,10 @@ gthombare Hasan Mahmood Henrik Hodne Isaac Rodman +Ivan Porto Carrero Jason Kincl Jeremy Canady +João Pereira Louie Jiang Marc Carmier Mevan Samaratunga @@ -47,7 +57,9 @@ S.ÇaÄŸlar Onur Sergey Ignatov Steve Purcell Takaaki Furukawa +tanishi Ted Zlatanov +Thibaut Ackermann Vadim Egorov Yang Yang Yuya Kusakabe diff --git a/vendor/github.com/vmware/govmomi/Makefile b/vendor/github.com/vmware/govmomi/Makefile index cbaa3624994..9886b45ceb5 100644 --- a/vendor/github.com/vmware/govmomi/Makefile +++ b/vendor/github.com/vmware/govmomi/Makefile @@ -11,13 +11,19 @@ goimports: govet: @echo checking go vet... - @go tool vet -structtags=false -methods=false . - -test: - go test -v $(TEST_OPTS) ./... + @go tool vet -structtags=false -methods=false $$(find . -mindepth 1 -maxdepth 1 -type d -not -name vendor) install: - go install github.com/vmware/govmomi/govc + go install -v github.com/vmware/govmomi/govc + go install -v github.com/vmware/govmomi/vcsim + +go-test: + go test -v $(TEST_OPTS) ./... + +govc-test: install + (cd govc/test && ./vendor/github.com/sstephenson/bats/libexec/bats -t .) + +test: go-test govc-test doc: install ./govc/usage.sh > ./govc/USAGE.md diff --git a/vendor/github.com/vmware/govmomi/README.md b/vendor/github.com/vmware/govmomi/README.md index 7ebdf1b17c8..02901ea4fba 100644 --- a/vendor/github.com/vmware/govmomi/README.md +++ b/vendor/github.com/vmware/govmomi/README.md @@ -5,14 +5,19 @@ A Go library for interacting with VMware vSphere APIs (ESXi and/or vCenter). -For `govc`, a CLI built on top of govmomi, check out the [govc](./govc) directory and [USAGE](./govc/USAGE.md) document. +In addition to the vSphere API client, this repository includes: + +* [govc](./govc) - vSphere CLI + +* [vcsim](./vcsim) - vSphere API mock framework + +* [toolbox](./toolbox) - VM guest tools framework ## Compatibility -This library is built for and tested against ESXi and vCenter 5.5, 6.0 and 6.5. +This library is built for and tested against ESXi and vCenter 6.0 and 6.5. -If you're able to use it against older versions of ESXi and/or vCenter, please -leave a note and we'll include it in this compatibility list. +It should work with versions 5.5 and 5.1, but neither are officially supported. ## Documentation @@ -23,19 +28,14 @@ The code in the `govmomi` package is a wrapper for the code that is generated fr It primarily provides convenience functions for working with the vSphere API. See [godoc.org][godoc] for documentation. -[apiref]:http://pubs.vmware.com/vsphere-60/index.jsp#com.vmware.wssdk.apiref.doc/right-pane.html +[apiref]:http://pubs.vmware.com/vsphere-6-5/index.jsp#com.vmware.wssdk.apiref.doc/right-pane.html [godoc]:http://godoc.org/github.com/vmware/govmomi -[drone]:https://drone.io -[dronesrc]:https://github.com/drone/drone -[dronecli]:http://readme.drone.io/devs/cli/ -#### Building with CI -Merges to this repository will trigger builds in both Travis and [Drone][drone]. +## Installation -To build locally with Drone: -- Ensure that you have Docker 1.6 or higher installed. -- Install the [Drone command line tools][dronecli]. -- Run `drone exec` from within the root directory of the govmomi repository. +```sh +go get -u github.com/vmware/govmomi +``` ## Discussion @@ -53,9 +53,17 @@ Refer to the [CHANGELOG](CHANGELOG.md) for version to version changes. * [Docker Machine](https://github.com/docker/machine/tree/master/drivers/vmwarevsphere) +* [Docker InfraKit](https://github.com/docker/infrakit/tree/master/pkg/provider/vsphere) + +* [Docker LinuxKit](https://github.com/linuxkit/linuxkit/tree/master/src/cmd/linuxkit) + * [Kubernetes](https://github.com/kubernetes/kubernetes/tree/master/pkg/cloudprovider/providers/vsphere) -* [Terraform](https://github.com/hashicorp/terraform/tree/master/builtin/providers/vsphere) +* [Kubernetes kops](https://github.com/kubernetes/kops/tree/master/upup/pkg/fi/cloudup/vsphere) + +* [Terraform](https://github.com/terraform-providers/terraform-provider-vsphere) + +* [Packer](https://github.com/jetbrains-infra/packer-builder-vsphere) * [VMware VIC Engine](https://github.com/vmware/vic) diff --git a/vendor/github.com/vmware/govmomi/find/recurser.go b/vendor/github.com/vmware/govmomi/find/recurser.go index b62e93a6f82..80d958a264f 100644 --- a/vendor/github.com/vmware/govmomi/find/recurser.go +++ b/vendor/github.com/vmware/govmomi/find/recurser.go @@ -20,6 +20,7 @@ import ( "context" "os" "path" + "strings" "github.com/vmware/govmomi/list" "github.com/vmware/govmomi/object" @@ -177,6 +178,7 @@ func (r recurser) List(ctx context.Context, s *spec, root list.Element, parts [] return in, nil } + all := parts pattern := parts[0] parts = parts[1:] @@ -188,6 +190,12 @@ func (r recurser) List(ctx context.Context, s *spec, root list.Element, parts [] } if !matched { + matched = strings.HasSuffix(e.Path, "/"+path.Join(all...)) + if matched { + // name contains a '/' + out = append(out, e) + } + continue } diff --git a/vendor/github.com/vmware/govmomi/nfc/BUILD b/vendor/github.com/vmware/govmomi/nfc/BUILD new file mode 100644 index 00000000000..51c8a6ea8c4 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/nfc/BUILD @@ -0,0 +1,34 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "lease.go", + "lease_updater.go", + ], + importpath = "github.com/vmware/govmomi/nfc", + visibility = ["//visibility:public"], + deps = [ + "//vendor/github.com/vmware/govmomi/property:go_default_library", + "//vendor/github.com/vmware/govmomi/vim25:go_default_library", + "//vendor/github.com/vmware/govmomi/vim25/methods:go_default_library", + "//vendor/github.com/vmware/govmomi/vim25/mo:go_default_library", + "//vendor/github.com/vmware/govmomi/vim25/progress:go_default_library", + "//vendor/github.com/vmware/govmomi/vim25/soap:go_default_library", + "//vendor/github.com/vmware/govmomi/vim25/types:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/vendor/github.com/vmware/govmomi/nfc/lease.go b/vendor/github.com/vmware/govmomi/nfc/lease.go new file mode 100644 index 00000000000..393c648353f --- /dev/null +++ b/vendor/github.com/vmware/govmomi/nfc/lease.go @@ -0,0 +1,238 @@ +/* +Copyright (c) 2015-2017 VMware, Inc. All Rights Reserved. + +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 nfc + +import ( + "context" + "errors" + "fmt" + "io" + "path" + + "github.com/vmware/govmomi/property" + "github.com/vmware/govmomi/vim25" + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/progress" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type Lease struct { + types.ManagedObjectReference + + c *vim25.Client +} + +func NewLease(c *vim25.Client, ref types.ManagedObjectReference) *Lease { + return &Lease{ref, c} +} + +// Abort wraps methods.Abort +func (l *Lease) Abort(ctx context.Context, fault *types.LocalizedMethodFault) error { + req := types.HttpNfcLeaseAbort{ + This: l.Reference(), + Fault: fault, + } + + _, err := methods.HttpNfcLeaseAbort(ctx, l.c, &req) + if err != nil { + return err + } + + return nil +} + +// Complete wraps methods.Complete +func (l *Lease) Complete(ctx context.Context) error { + req := types.HttpNfcLeaseComplete{ + This: l.Reference(), + } + + _, err := methods.HttpNfcLeaseComplete(ctx, l.c, &req) + if err != nil { + return err + } + + return nil +} + +// GetManifest wraps methods.GetManifest +func (l *Lease) GetManifest(ctx context.Context) error { + req := types.HttpNfcLeaseGetManifest{ + This: l.Reference(), + } + + _, err := methods.HttpNfcLeaseGetManifest(ctx, l.c, &req) + if err != nil { + return err + } + + return nil +} + +// Progress wraps methods.Progress +func (l *Lease) Progress(ctx context.Context, percent int32) error { + req := types.HttpNfcLeaseProgress{ + This: l.Reference(), + Percent: percent, + } + + _, err := methods.HttpNfcLeaseProgress(ctx, l.c, &req) + if err != nil { + return err + } + + return nil +} + +type LeaseInfo struct { + types.HttpNfcLeaseInfo + + Items []FileItem +} + +func (l *Lease) newLeaseInfo(li *types.HttpNfcLeaseInfo, items []types.OvfFileItem) (*LeaseInfo, error) { + info := &LeaseInfo{ + HttpNfcLeaseInfo: *li, + } + + for _, device := range li.DeviceUrl { + u, err := l.c.ParseURL(device.Url) + if err != nil { + return nil, err + } + + if device.SslThumbprint != "" { + // TODO: prefer host management IP + l.c.SetThumbprint(u.Host, device.SslThumbprint) + } + + if len(items) == 0 { + // this is an export + item := types.OvfFileItem{ + DeviceId: device.Key, + Path: device.TargetId, + Size: device.FileSize, + } + + if item.Size == 0 { + item.Size = li.TotalDiskCapacityInKB * 1024 + } + + if item.Path == "" { + item.Path = path.Base(device.Url) + } + + info.Items = append(info.Items, NewFileItem(u, item)) + + continue + } + + // this is an import + for _, item := range items { + if device.ImportKey == item.DeviceId { + info.Items = append(info.Items, NewFileItem(u, item)) + break + } + } + } + + return info, nil +} + +func (l *Lease) Wait(ctx context.Context, items []types.OvfFileItem) (*LeaseInfo, error) { + var lease mo.HttpNfcLease + + pc := property.DefaultCollector(l.c) + err := property.Wait(ctx, pc, l.Reference(), []string{"state", "info", "error"}, func(pc []types.PropertyChange) bool { + done := false + + for _, c := range pc { + if c.Val == nil { + continue + } + + switch c.Name { + case "error": + val := c.Val.(types.LocalizedMethodFault) + lease.Error = &val + done = true + case "info": + val := c.Val.(types.HttpNfcLeaseInfo) + lease.Info = &val + case "state": + lease.State = c.Val.(types.HttpNfcLeaseState) + if lease.State != types.HttpNfcLeaseStateInitializing { + done = true + } + } + } + + return done + }) + + if err != nil { + return nil, err + } + + if lease.State == types.HttpNfcLeaseStateReady { + return l.newLeaseInfo(lease.Info, items) + } + + if lease.Error != nil { + return nil, errors.New(lease.Error.LocalizedMessage) + } + + return nil, fmt.Errorf("unexpected nfc lease state: %s", lease.State) +} + +func (l *Lease) StartUpdater(ctx context.Context, info *LeaseInfo) *LeaseUpdater { + return newLeaseUpdater(ctx, l, info) +} + +func (l *Lease) Upload(ctx context.Context, item FileItem, f io.Reader, opts soap.Upload) error { + if opts.Progress == nil { + opts.Progress = item + } else { + opts.Progress = progress.Tee(item, opts.Progress) + } + + // Non-disk files (such as .iso) use the PUT method. + // Overwrite: t header is also required in this case (ovftool does the same) + if item.Create { + opts.Method = "PUT" + opts.Headers = map[string]string{ + "Overwrite": "t", + } + } else { + opts.Method = "POST" + opts.Type = "application/x-vnd.vmware-streamVmdk" + } + + return l.c.Upload(f, item.URL, &opts) +} + +func (l *Lease) DownloadFile(ctx context.Context, file string, item FileItem, opts soap.Download) error { + if opts.Progress == nil { + opts.Progress = item + } else { + opts.Progress = progress.Tee(item, opts.Progress) + } + + return l.c.DownloadFile(file, item.URL, &opts) +} diff --git a/vendor/github.com/vmware/govmomi/nfc/lease_updater.go b/vendor/github.com/vmware/govmomi/nfc/lease_updater.go new file mode 100644 index 00000000000..d3face81a4c --- /dev/null +++ b/vendor/github.com/vmware/govmomi/nfc/lease_updater.go @@ -0,0 +1,146 @@ +/* +Copyright (c) 2014-2015 VMware, Inc. All Rights Reserved. + +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 nfc + +import ( + "context" + "log" + "net/url" + "sync" + "sync/atomic" + "time" + + "github.com/vmware/govmomi/vim25/progress" + "github.com/vmware/govmomi/vim25/types" +) + +type FileItem struct { + types.OvfFileItem + URL *url.URL + + ch chan progress.Report +} + +func NewFileItem(u *url.URL, item types.OvfFileItem) FileItem { + return FileItem{ + OvfFileItem: item, + URL: u, + ch: make(chan progress.Report), + } +} + +func (o FileItem) Sink() chan<- progress.Report { + return o.ch +} + +// File converts the FileItem.OvfFileItem to an OvfFile +func (o FileItem) File() types.OvfFile { + return types.OvfFile{ + DeviceId: o.DeviceId, + Path: o.Path, + Size: o.Size, + } +} + +type LeaseUpdater struct { + lease *Lease + + pos int64 // Number of bytes + total int64 // Total number of bytes + + done chan struct{} // When lease updater should stop + + wg sync.WaitGroup // Track when update loop is done +} + +func newLeaseUpdater(ctx context.Context, lease *Lease, info *LeaseInfo) *LeaseUpdater { + l := LeaseUpdater{ + lease: lease, + + done: make(chan struct{}), + } + + for _, item := range info.Items { + l.total += item.Size + go l.waitForProgress(item) + } + + // Kickstart update loop + l.wg.Add(1) + go l.run() + + return &l +} + +func (l *LeaseUpdater) waitForProgress(item FileItem) { + var pos, total int64 + + total = item.Size + + for { + select { + case <-l.done: + return + case p, ok := <-item.ch: + // Return in case of error + if ok && p.Error() != nil { + return + } + + if !ok { + // Last element on the channel, add to total + atomic.AddInt64(&l.pos, total-pos) + return + } + + // Approximate progress in number of bytes + x := int64(float32(total) * (p.Percentage() / 100.0)) + atomic.AddInt64(&l.pos, x-pos) + pos = x + } + } +} + +func (l *LeaseUpdater) run() { + defer l.wg.Done() + + tick := time.NewTicker(2 * time.Second) + defer tick.Stop() + + for { + select { + case <-l.done: + return + case <-tick.C: + // From the vim api HttpNfcLeaseProgress(percent) doc, percent == + // "Completion status represented as an integer in the 0-100 range." + // Always report the current value of percent, as it will renew the + // lease even if the value hasn't changed or is 0. + percent := int32(float32(100*atomic.LoadInt64(&l.pos)) / float32(l.total)) + err := l.lease.Progress(context.TODO(), percent) + if err != nil { + log.Printf("NFC lease progress: %s", err) + return + } + } + } +} + +func (l *LeaseUpdater) Done() { + close(l.done) + l.wg.Wait() +} diff --git a/vendor/github.com/vmware/govmomi/object/BUILD b/vendor/github.com/vmware/govmomi/object/BUILD index cc53d9e0782..eb1b6f5f360 100644 --- a/vendor/github.com/vmware/govmomi/object/BUILD +++ b/vendor/github.com/vmware/govmomi/object/BUILD @@ -38,13 +38,11 @@ go_library( "host_virtual_nic_manager.go", "host_vsan_internal_system.go", "host_vsan_system.go", - "http_nfc_lease.go", "namespace_manager.go", "network.go", "network_reference.go", "opaque_network.go", "option_manager.go", - "ovf_manager.go", "resource_pool.go", "search_index.go", "storage_pod.go", @@ -61,6 +59,7 @@ go_library( importpath = "github.com/vmware/govmomi/object", visibility = ["//visibility:public"], deps = [ + "//vendor/github.com/vmware/govmomi/nfc:go_default_library", "//vendor/github.com/vmware/govmomi/property:go_default_library", "//vendor/github.com/vmware/govmomi/session:go_default_library", "//vendor/github.com/vmware/govmomi/task:go_default_library", diff --git a/vendor/github.com/vmware/govmomi/object/common.go b/vendor/github.com/vmware/govmomi/object/common.go index 52feeed6503..dfeee4a365e 100644 --- a/vendor/github.com/vmware/govmomi/object/common.go +++ b/vendor/github.com/vmware/govmomi/object/common.go @@ -80,17 +80,24 @@ func (c *Common) SetInventoryPath(p string) { func (c Common) ObjectName(ctx context.Context) (string, error) { var o mo.ManagedEntity - name := c.Name() - if name != "" { - return name, nil - } - err := c.Properties(ctx, c.Reference(), []string{"name"}, &o) if err != nil { return "", err } - return o.Name, nil + if o.Name != "" { + return o.Name, nil + } + + // Network has its own "name" field... + var n mo.Network + + err = c.Properties(ctx, c.Reference(), []string{"name"}, &n) + if err != nil { + return "", err + } + + return n.Name, nil } func (c Common) Properties(ctx context.Context, r types.ManagedObjectReference, ps []string, dst interface{}) error { diff --git a/vendor/github.com/vmware/govmomi/object/custom_fields_manager.go b/vendor/github.com/vmware/govmomi/object/custom_fields_manager.go index 60b78df2b4b..ef748ef2c13 100644 --- a/vendor/github.com/vmware/govmomi/object/custom_fields_manager.go +++ b/vendor/github.com/vmware/govmomi/object/custom_fields_manager.go @@ -102,7 +102,9 @@ func (m CustomFieldsManager) Set(ctx context.Context, entity types.ManagedObject return err } -func (m CustomFieldsManager) Field(ctx context.Context) ([]types.CustomFieldDef, error) { +type CustomFieldDefList []types.CustomFieldDef + +func (m CustomFieldsManager) Field(ctx context.Context) (CustomFieldDefList, error) { var fm mo.CustomFieldsManager err := m.Properties(ctx, m.Reference(), []string{"field"}, &fm) @@ -113,19 +115,19 @@ func (m CustomFieldsManager) Field(ctx context.Context) ([]types.CustomFieldDef, return fm.Field, nil } -func (m CustomFieldsManager) FindKey(ctx context.Context, key string) (int32, error) { +func (m CustomFieldsManager) FindKey(ctx context.Context, name string) (int32, error) { field, err := m.Field(ctx) if err != nil { return -1, err } for _, def := range field { - if def.Name == key { + if def.Name == name { return def.Key, nil } } - k, err := strconv.Atoi(key) + k, err := strconv.Atoi(name) if err == nil { // assume literal int key return int32(k), nil @@ -133,3 +135,12 @@ func (m CustomFieldsManager) FindKey(ctx context.Context, key string) (int32, er return -1, ErrKeyNameNotFound } + +func (l CustomFieldDefList) ByKey(key int32) *types.CustomFieldDef { + for _, def := range l { + if def.Key == key { + return &def + } + } + return nil +} diff --git a/vendor/github.com/vmware/govmomi/object/datastore_file.go b/vendor/github.com/vmware/govmomi/object/datastore_file.go index 36c95234855..a73990f12cc 100644 --- a/vendor/github.com/vmware/govmomi/object/datastore_file.go +++ b/vendor/github.com/vmware/govmomi/object/datastore_file.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2016 VMware, Inc. All Rights Reserved. +Copyright (c) 2016-2017 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ import ( "net/http" "os" "path" + "sync" "time" "github.com/vmware/govmomi/vim25/soap" @@ -232,8 +233,9 @@ func (f *DatastoreFile) get() (io.Reader, error) { return f.body, nil } -func lastIndexLines(s []byte, n *int) int64 { +func lastIndexLines(s []byte, line *int, include func(l int, m string) bool) (int64, bool) { i := len(s) - 1 + done := false for i > 0 { o := bytes.LastIndexByte(s[:i], '\n') @@ -241,18 +243,27 @@ func lastIndexLines(s []byte, n *int) int64 { break } - i = o - *n-- - if *n == 0 { + msg := string(s[o+1 : i+1]) + if !include(*line, msg) { + done = true break + } else { + i = o + *line++ } } - return int64(i) + return int64(i), done } // Tail seeks to the position of the last N lines of the file. func (f *DatastoreFile) Tail(n int) error { + return f.TailFunc(n, func(line int, _ string) bool { return n > line }) +} + +// TailFunc will seek backwards in the datastore file until it hits a line that does +// not satisfy the supplied `include` function. +func (f *DatastoreFile) TailFunc(lines int, include func(line int, message string) bool) error { // Read the file in reverse using bsize chunks const bsize = int64(1024 * 16) @@ -261,13 +272,14 @@ func (f *DatastoreFile) Tail(n int) error { return err } - if n == 0 { + if lines == 0 { return nil } chunk := int64(-1) buf := bytes.NewBuffer(make([]byte, 0, bsize)) + line := 0 for { var eof bool @@ -298,19 +310,19 @@ func (f *DatastoreFile) Tail(n int) error { } b := buf.Bytes() - idx := lastIndexLines(b, &n) + 1 + idx, done := lastIndexLines(b, &line, include) - if n == 0 { + if done { if chunk == -1 { // We found all N lines in the last chunk of the file. // The seek offset is also now at the current end of file. // Save this buffer to avoid another GET request when Read() is called. - buf.Next(int(idx)) + buf.Next(int(idx + 1)) f.buf = buf return nil } - if _, err = f.Seek(pos+idx, io.SeekStart); err != nil { + if _, err = f.Seek(pos+idx+1, io.SeekStart); err != nil { return err } @@ -336,6 +348,7 @@ type followDatastoreFile struct { r *DatastoreFile c chan struct{} i time.Duration + o sync.Once } // Read reads up to len(b) bytes from the DatastoreFile being followed. @@ -387,11 +400,15 @@ func (f *followDatastoreFile) Read(p []byte) (int, error) { // Close will stop Follow polling and close the underlying DatastoreFile. func (f *followDatastoreFile) Close() error { - close(f.c) + f.o.Do(func() { close(f.c) }) return nil } // Follow returns an io.ReadCloser to stream the file contents as data is appended. func (f *DatastoreFile) Follow(interval time.Duration) io.ReadCloser { - return &followDatastoreFile{f, make(chan struct{}), interval} + return &followDatastoreFile{ + r: f, + c: make(chan struct{}), + i: interval, + } } diff --git a/vendor/github.com/vmware/govmomi/object/datastore_file_manager.go b/vendor/github.com/vmware/govmomi/object/datastore_file_manager.go index 7164fbbed7d..e484368060e 100644 --- a/vendor/github.com/vmware/govmomi/object/datastore_file_manager.go +++ b/vendor/github.com/vmware/govmomi/object/datastore_file_manager.go @@ -97,6 +97,25 @@ func (m *DatastoreFileManager) DeleteVirtualDisk(ctx context.Context, name strin return task.Wait(ctx) } +// Move dispatches to the appropriate Move method based on file name extension +func (m *DatastoreFileManager) Move(ctx context.Context, src string, dst string) error { + srcp := m.Path(src) + dstp := m.Path(dst) + + f := m.FileManager.MoveDatastoreFile + + if srcp.IsVMDK() { + f = m.VirtualDiskManager.MoveVirtualDisk + } + + task, err := f(ctx, srcp.String(), m.Datacenter, dstp.String(), m.Datacenter, m.Force) + if err != nil { + return err + } + + return task.Wait(ctx) +} + // Path converts path name to a DatastorePath func (m *DatastoreFileManager) Path(name string) *DatastorePath { var p DatastorePath diff --git a/vendor/github.com/vmware/govmomi/object/datastore_path.go b/vendor/github.com/vmware/govmomi/object/datastore_path.go index ea152103df5..1563ee1e11d 100644 --- a/vendor/github.com/vmware/govmomi/object/datastore_path.go +++ b/vendor/github.com/vmware/govmomi/object/datastore_path.go @@ -18,6 +18,7 @@ package object import ( "fmt" + "path" "strings" ) @@ -63,3 +64,8 @@ func (p *DatastorePath) String() string { return strings.Join([]string{s, p.Path}, " ") } + +// IsVMDK returns true if Path has a ".vmdk" extension +func (p *DatastorePath) IsVMDK() bool { + return path.Ext(p.Path) == ".vmdk" +} diff --git a/vendor/github.com/vmware/govmomi/object/distributed_virtual_portgroup.go b/vendor/github.com/vmware/govmomi/object/distributed_virtual_portgroup.go index 864bb783f38..86c9fc1c7a8 100644 --- a/vendor/github.com/vmware/govmomi/object/distributed_virtual_portgroup.go +++ b/vendor/github.com/vmware/govmomi/object/distributed_virtual_portgroup.go @@ -38,7 +38,7 @@ func NewDistributedVirtualPortgroup(c *vim25.Client, ref types.ManagedObjectRefe // EthernetCardBackingInfo returns the VirtualDeviceBackingInfo for this DistributedVirtualPortgroup func (p DistributedVirtualPortgroup) EthernetCardBackingInfo(ctx context.Context) (types.BaseVirtualDeviceBackingInfo, error) { var dvp mo.DistributedVirtualPortgroup - var dvs mo.VmwareDistributedVirtualSwitch // TODO: should be mo.BaseDistributedVirtualSwitch + var dvs mo.DistributedVirtualSwitch if err := p.Properties(ctx, p.Reference(), []string{"key", "config.distributedVirtualSwitch"}, &dvp); err != nil { return nil, err diff --git a/vendor/github.com/vmware/govmomi/object/distributed_virtual_switch.go b/vendor/github.com/vmware/govmomi/object/distributed_virtual_switch.go index 29ee52d9501..7a41258799d 100644 --- a/vendor/github.com/vmware/govmomi/object/distributed_virtual_switch.go +++ b/vendor/github.com/vmware/govmomi/object/distributed_virtual_switch.go @@ -65,3 +65,15 @@ func (s DistributedVirtualSwitch) AddPortgroup(ctx context.Context, spec []types return NewTask(s.Client(), res.Returnval), nil } + +func (s DistributedVirtualSwitch) FetchDVPorts(ctx context.Context) ([]types.DistributedVirtualPort, error) { + req := &types.FetchDVPorts{ + This: s.Reference(), + } + + res, err := methods.FetchDVPorts(ctx, s.Client(), req) + if err != nil { + return nil, err + } + return res.Returnval, nil +} diff --git a/vendor/github.com/vmware/govmomi/object/host_storage_system.go b/vendor/github.com/vmware/govmomi/object/host_storage_system.go index 2a433ff2a88..6785eecdcd3 100644 --- a/vendor/github.com/vmware/govmomi/object/host_storage_system.go +++ b/vendor/github.com/vmware/govmomi/object/host_storage_system.go @@ -88,6 +88,15 @@ func (s HostStorageSystem) RescanAllHba(ctx context.Context) error { return err } +func (s HostStorageSystem) Refresh(ctx context.Context) error { + req := types.RefreshStorageSystem{ + This: s.Reference(), + } + + _, err := methods.RefreshStorageSystem(ctx, s.c, &req) + return err +} + func (s HostStorageSystem) MarkAsSsd(ctx context.Context, uuid string) (*Task, error) { req := types.MarkAsSsd_Task{ This: s.Reference(), diff --git a/vendor/github.com/vmware/govmomi/object/host_vsan_internal_system.go b/vendor/github.com/vmware/govmomi/object/host_vsan_internal_system.go index 65e4587f6c8..1430e8a8822 100644 --- a/vendor/github.com/vmware/govmomi/object/host_vsan_internal_system.go +++ b/vendor/github.com/vmware/govmomi/object/host_vsan_internal_system.go @@ -42,7 +42,7 @@ func (m HostVsanInternalSystem) QueryVsanObjectUuidsByFilter(ctx context.Context req := types.QueryVsanObjectUuidsByFilter{ This: m.Reference(), Uuids: uuids, - Limit: limit, + Limit: &limit, Version: version, } diff --git a/vendor/github.com/vmware/govmomi/object/http_nfc_lease.go b/vendor/github.com/vmware/govmomi/object/http_nfc_lease.go deleted file mode 100644 index 3ca53558b3f..00000000000 --- a/vendor/github.com/vmware/govmomi/object/http_nfc_lease.go +++ /dev/null @@ -1,143 +0,0 @@ -/* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. - -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 object - -import ( - "context" - "errors" - "fmt" - - "github.com/vmware/govmomi/property" - "github.com/vmware/govmomi/vim25" - "github.com/vmware/govmomi/vim25/methods" - "github.com/vmware/govmomi/vim25/mo" - "github.com/vmware/govmomi/vim25/types" -) - -type HttpNfcLease struct { - Common -} - -func NewHttpNfcLease(c *vim25.Client, ref types.ManagedObjectReference) *HttpNfcLease { - return &HttpNfcLease{ - Common: NewCommon(c, ref), - } -} - -// HttpNfcLeaseAbort wraps methods.HttpNfcLeaseAbort -func (o HttpNfcLease) HttpNfcLeaseAbort(ctx context.Context, fault *types.LocalizedMethodFault) error { - req := types.HttpNfcLeaseAbort{ - This: o.Reference(), - Fault: fault, - } - - _, err := methods.HttpNfcLeaseAbort(ctx, o.c, &req) - if err != nil { - return err - } - - return nil -} - -// HttpNfcLeaseComplete wraps methods.HttpNfcLeaseComplete -func (o HttpNfcLease) HttpNfcLeaseComplete(ctx context.Context) error { - req := types.HttpNfcLeaseComplete{ - This: o.Reference(), - } - - _, err := methods.HttpNfcLeaseComplete(ctx, o.c, &req) - if err != nil { - return err - } - - return nil -} - -// HttpNfcLeaseGetManifest wraps methods.HttpNfcLeaseGetManifest -func (o HttpNfcLease) HttpNfcLeaseGetManifest(ctx context.Context) error { - req := types.HttpNfcLeaseGetManifest{ - This: o.Reference(), - } - - _, err := methods.HttpNfcLeaseGetManifest(ctx, o.c, &req) - if err != nil { - return err - } - - return nil -} - -// HttpNfcLeaseProgress wraps methods.HttpNfcLeaseProgress -func (o HttpNfcLease) HttpNfcLeaseProgress(ctx context.Context, percent int32) error { - req := types.HttpNfcLeaseProgress{ - This: o.Reference(), - Percent: percent, - } - - _, err := methods.HttpNfcLeaseProgress(ctx, o.c, &req) - if err != nil { - return err - } - - return nil -} - -func (o HttpNfcLease) Wait(ctx context.Context) (*types.HttpNfcLeaseInfo, error) { - var lease mo.HttpNfcLease - - pc := property.DefaultCollector(o.c) - err := property.Wait(ctx, pc, o.Reference(), []string{"state", "info", "error"}, func(pc []types.PropertyChange) bool { - done := false - - for _, c := range pc { - if c.Val == nil { - continue - } - - switch c.Name { - case "error": - val := c.Val.(types.LocalizedMethodFault) - lease.Error = &val - done = true - case "info": - val := c.Val.(types.HttpNfcLeaseInfo) - lease.Info = &val - case "state": - lease.State = c.Val.(types.HttpNfcLeaseState) - if lease.State != types.HttpNfcLeaseStateInitializing { - done = true - } - } - } - - return done - }) - - if err != nil { - return nil, err - } - - if lease.State == types.HttpNfcLeaseStateReady { - return lease.Info, nil - } - - if lease.Error != nil { - return nil, errors.New(lease.Error.LocalizedMessage) - } - - return nil, fmt.Errorf("unexpected nfc lease state: %s", lease.State) -} diff --git a/vendor/github.com/vmware/govmomi/object/network.go b/vendor/github.com/vmware/govmomi/object/network.go index a76b17d91c2..d1dc7ce01f6 100644 --- a/vendor/github.com/vmware/govmomi/object/network.go +++ b/vendor/github.com/vmware/govmomi/object/network.go @@ -20,6 +20,7 @@ import ( "context" "github.com/vmware/govmomi/vim25" + "github.com/vmware/govmomi/vim25/mo" "github.com/vmware/govmomi/vim25/types" ) @@ -34,12 +35,20 @@ func NewNetwork(c *vim25.Client, ref types.ManagedObjectReference) *Network { } // EthernetCardBackingInfo returns the VirtualDeviceBackingInfo for this Network -func (n Network) EthernetCardBackingInfo(_ context.Context) (types.BaseVirtualDeviceBackingInfo, error) { - name := n.Name() +func (n Network) EthernetCardBackingInfo(ctx context.Context) (types.BaseVirtualDeviceBackingInfo, error) { + var e mo.Network + + // Use Network.Name rather than Common.Name as the latter does not return the complete name if it contains a '/' + // We can't use Common.ObjectName here either as we need the ManagedEntity.Name field is not set since mo.Network + // has its own Name field. + err := n.Properties(ctx, n.Reference(), []string{"name"}, &e) + if err != nil { + return nil, err + } backing := &types.VirtualEthernetCardNetworkBackingInfo{ VirtualDeviceDeviceBackingInfo: types.VirtualDeviceDeviceBackingInfo{ - DeviceName: name, + DeviceName: e.Name, }, } diff --git a/vendor/github.com/vmware/govmomi/object/ovf_manager.go b/vendor/github.com/vmware/govmomi/object/ovf_manager.go deleted file mode 100644 index 7fedf689ff3..00000000000 --- a/vendor/github.com/vmware/govmomi/object/ovf_manager.go +++ /dev/null @@ -1,104 +0,0 @@ -/* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. - -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 object - -import ( - "context" - - "github.com/vmware/govmomi/vim25" - "github.com/vmware/govmomi/vim25/methods" - "github.com/vmware/govmomi/vim25/types" -) - -type OvfManager struct { - Common -} - -func NewOvfManager(c *vim25.Client) *OvfManager { - o := OvfManager{ - Common: NewCommon(c, *c.ServiceContent.OvfManager), - } - - return &o -} - -// CreateDescriptor wraps methods.CreateDescriptor -func (o OvfManager) CreateDescriptor(ctx context.Context, obj Reference, cdp types.OvfCreateDescriptorParams) (*types.OvfCreateDescriptorResult, error) { - req := types.CreateDescriptor{ - This: o.Reference(), - Obj: obj.Reference(), - Cdp: cdp, - } - - res, err := methods.CreateDescriptor(ctx, o.c, &req) - if err != nil { - return nil, err - } - - return &res.Returnval, nil -} - -// CreateImportSpec wraps methods.CreateImportSpec -func (o OvfManager) CreateImportSpec(ctx context.Context, ovfDescriptor string, resourcePool Reference, datastore Reference, cisp types.OvfCreateImportSpecParams) (*types.OvfCreateImportSpecResult, error) { - req := types.CreateImportSpec{ - This: o.Reference(), - OvfDescriptor: ovfDescriptor, - ResourcePool: resourcePool.Reference(), - Datastore: datastore.Reference(), - Cisp: cisp, - } - - res, err := methods.CreateImportSpec(ctx, o.c, &req) - if err != nil { - return nil, err - } - - return &res.Returnval, nil -} - -// ParseDescriptor wraps methods.ParseDescriptor -func (o OvfManager) ParseDescriptor(ctx context.Context, ovfDescriptor string, pdp types.OvfParseDescriptorParams) (*types.OvfParseDescriptorResult, error) { - req := types.ParseDescriptor{ - This: o.Reference(), - OvfDescriptor: ovfDescriptor, - Pdp: pdp, - } - - res, err := methods.ParseDescriptor(ctx, o.c, &req) - if err != nil { - return nil, err - } - - return &res.Returnval, nil -} - -// ValidateHost wraps methods.ValidateHost -func (o OvfManager) ValidateHost(ctx context.Context, ovfDescriptor string, host Reference, vhp types.OvfValidateHostParams) (*types.OvfValidateHostResult, error) { - req := types.ValidateHost{ - This: o.Reference(), - OvfDescriptor: ovfDescriptor, - Host: host.Reference(), - Vhp: vhp, - } - - res, err := methods.ValidateHost(ctx, o.c, &req) - if err != nil { - return nil, err - } - - return &res.Returnval, nil -} diff --git a/vendor/github.com/vmware/govmomi/object/resource_pool.go b/vendor/github.com/vmware/govmomi/object/resource_pool.go index 791fd38229d..55c2e2b2fde 100644 --- a/vendor/github.com/vmware/govmomi/object/resource_pool.go +++ b/vendor/github.com/vmware/govmomi/object/resource_pool.go @@ -19,6 +19,7 @@ package object import ( "context" + "github.com/vmware/govmomi/nfc" "github.com/vmware/govmomi/vim25" "github.com/vmware/govmomi/vim25/methods" "github.com/vmware/govmomi/vim25/types" @@ -34,7 +35,7 @@ func NewResourcePool(c *vim25.Client, ref types.ManagedObjectReference) *Resourc } } -func (p ResourcePool) ImportVApp(ctx context.Context, spec types.BaseImportSpec, folder *Folder, host *HostSystem) (*HttpNfcLease, error) { +func (p ResourcePool) ImportVApp(ctx context.Context, spec types.BaseImportSpec, folder *Folder, host *HostSystem) (*nfc.Lease, error) { req := types.ImportVApp{ This: p.Reference(), Spec: spec, @@ -55,7 +56,7 @@ func (p ResourcePool) ImportVApp(ctx context.Context, spec types.BaseImportSpec, return nil, err } - return NewHttpNfcLease(p.c, res.Returnval), nil + return nfc.NewLease(p.c, res.Returnval), nil } func (p ResourcePool) Create(ctx context.Context, name string, spec types.ResourceConfigSpec) (*ResourcePool, error) { diff --git a/vendor/github.com/vmware/govmomi/object/task.go b/vendor/github.com/vmware/govmomi/object/task.go index 8572b4363bd..2b66aa93b7f 100644 --- a/vendor/github.com/vmware/govmomi/object/task.go +++ b/vendor/github.com/vmware/govmomi/object/task.go @@ -22,6 +22,7 @@ import ( "github.com/vmware/govmomi/property" "github.com/vmware/govmomi/task" "github.com/vmware/govmomi/vim25" + "github.com/vmware/govmomi/vim25/methods" "github.com/vmware/govmomi/vim25/progress" "github.com/vmware/govmomi/vim25/types" ) @@ -51,3 +52,11 @@ func (t *Task) WaitForResult(ctx context.Context, s progress.Sinker) (*types.Tas p := property.DefaultCollector(t.c) return task.Wait(ctx, t.Reference(), p, s) } + +func (t *Task) Cancel(ctx context.Context) error { + _, err := methods.CancelTask(ctx, t.Client(), &types.CancelTask{ + This: t.Reference(), + }) + + return err +} diff --git a/vendor/github.com/vmware/govmomi/object/virtual_device_list.go b/vendor/github.com/vmware/govmomi/object/virtual_device_list.go index 24821aa6b9c..6fe08356158 100644 --- a/vendor/github.com/vmware/govmomi/object/virtual_device_list.go +++ b/vendor/github.com/vmware/govmomi/object/virtual_device_list.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. +Copyright (c) 2015-2017 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -30,6 +30,7 @@ import ( // Type values for use in BootOrder const ( + DeviceTypeNone = "-" DeviceTypeCdrom = "cdrom" DeviceTypeDisk = "disk" DeviceTypeEthernet = "ethernet" @@ -754,6 +755,9 @@ func (l VirtualDeviceList) PrimaryMacAddress() string { // convert a BaseVirtualDevice to a BaseVirtualMachineBootOptionsBootableDevice var bootableDevices = map[string]func(device types.BaseVirtualDevice) types.BaseVirtualMachineBootOptionsBootableDevice{ + DeviceTypeNone: func(types.BaseVirtualDevice) types.BaseVirtualMachineBootOptionsBootableDevice { + return &types.VirtualMachineBootOptionsBootableDevice{} + }, DeviceTypeCdrom: func(types.BaseVirtualDevice) types.BaseVirtualMachineBootOptionsBootableDevice { return &types.VirtualMachineBootOptionsBootableCdromDevice{} }, @@ -773,17 +777,23 @@ var bootableDevices = map[string]func(device types.BaseVirtualDevice) types.Base } // BootOrder returns a list of devices which can be used to set boot order via VirtualMachine.SetBootOptions. -// The order can any of "ethernet", "cdrom", "floppy" or "disk" or by specific device name. +// The order can be any of "ethernet", "cdrom", "floppy" or "disk" or by specific device name. +// A value of "-" will clear the existing boot order on the VC/ESX side. func (l VirtualDeviceList) BootOrder(order []string) []types.BaseVirtualMachineBootOptionsBootableDevice { var devices []types.BaseVirtualMachineBootOptionsBootableDevice for _, name := range order { if kind, ok := bootableDevices[name]; ok { + if name == DeviceTypeNone { + // Not covered in the API docs, nor obvious, but this clears the boot order on the VC/ESX side. + devices = append(devices, new(types.VirtualMachineBootOptionsBootableDevice)) + continue + } + for _, device := range l { if l.Type(device) == name { devices = append(devices, kind(device)) } - } continue } diff --git a/vendor/github.com/vmware/govmomi/object/virtual_machine.go b/vendor/github.com/vmware/govmomi/object/virtual_machine.go index 8fd6a421b28..511f5572357 100644 --- a/vendor/github.com/vmware/govmomi/object/virtual_machine.go +++ b/vendor/github.com/vmware/govmomi/object/virtual_machine.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. +Copyright (c) 2015-2017 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import ( "net" "path" + "github.com/vmware/govmomi/nfc" "github.com/vmware/govmomi/property" "github.com/vmware/govmomi/vim25" "github.com/vmware/govmomi/vim25/methods" @@ -464,6 +465,20 @@ func (v VirtualMachine) Answer(ctx context.Context, id, answer string) error { return nil } +func (v VirtualMachine) AcquireTicket(ctx context.Context, kind string) (*types.VirtualMachineTicket, error) { + req := types.AcquireTicket{ + This: v.Reference(), + TicketType: kind, + } + + res, err := methods.AcquireTicket(ctx, v.c, &req) + if err != nil { + return nil, err + } + + return &res.Returnval, nil +} + // CreateSnapshot creates a new snapshot of a virtual machine. func (v VirtualMachine) CreateSnapshot(ctx context.Context, name string, description string, memory bool, quiesce bool) (*Task, error) { req := types.CreateSnapshot_Task{ @@ -497,7 +512,7 @@ func (v VirtualMachine) RemoveAllSnapshot(ctx context.Context, consolidate *bool return NewTask(v.c, res.Returnval), nil } -type snapshotMap map[string][]Reference +type snapshotMap map[string][]types.ManagedObjectReference func (m snapshotMap) add(parent string, tree []types.VirtualMachineSnapshotTree) { for i, st := range tree { @@ -511,18 +526,18 @@ func (m snapshotMap) add(parent string, tree []types.VirtualMachineSnapshotTree) } for _, name := range names { - m[name] = append(m[name], &tree[i].Snapshot) + m[name] = append(m[name], tree[i].Snapshot) } m.add(sname, st.ChildSnapshotList) } } -// findSnapshot supports snapshot lookup by name, where name can be: +// FindSnapshot supports snapshot lookup by name, where name can be: // 1) snapshot ManagedObjectReference.Value (unique) // 2) snapshot name (may not be unique) // 3) snapshot tree path (may not be unique) -func (v VirtualMachine) findSnapshot(ctx context.Context, name string) (Reference, error) { +func (v VirtualMachine) FindSnapshot(ctx context.Context, name string) (*types.ManagedObjectReference, error) { var o mo.VirtualMachine err := v.Properties(ctx, v.Reference(), []string{"snapshot"}, &o) @@ -542,7 +557,7 @@ func (v VirtualMachine) findSnapshot(ctx context.Context, name string) (Referenc case 0: return nil, fmt.Errorf("snapshot %q not found", name) case 1: - return s[0], nil + return &s[0], nil default: return nil, fmt.Errorf("%q resolves to %d snapshots", name, len(s)) } @@ -550,7 +565,7 @@ func (v VirtualMachine) findSnapshot(ctx context.Context, name string) (Referenc // RemoveSnapshot removes a named snapshot func (v VirtualMachine) RemoveSnapshot(ctx context.Context, name string, removeChildren bool, consolidate *bool) (*Task, error) { - snapshot, err := v.findSnapshot(ctx, name) + snapshot, err := v.FindSnapshot(ctx, name) if err != nil { return nil, err } @@ -586,7 +601,7 @@ func (v VirtualMachine) RevertToCurrentSnapshot(ctx context.Context, suppressPow // RevertToSnapshot reverts to a named snapshot func (v VirtualMachine) RevertToSnapshot(ctx context.Context, name string, suppressPowerOn bool) (*Task, error) { - snapshot, err := v.findSnapshot(ctx, name) + snapshot, err := v.FindSnapshot(ctx, name) if err != nil { return nil, err } @@ -757,3 +772,30 @@ func (v VirtualMachine) UpgradeTools(ctx context.Context, options string) (*Task return NewTask(v.c, res.Returnval), nil } + +func (v VirtualMachine) Export(ctx context.Context) (*nfc.Lease, error) { + req := types.ExportVm{ + This: v.Reference(), + } + + res, err := methods.ExportVm(ctx, v.Client(), &req) + if err != nil { + return nil, err + } + + return nfc.NewLease(v.c, res.Returnval), nil +} + +func (v VirtualMachine) UpgradeVM(ctx context.Context, version string) (*Task, error) { + req := types.UpgradeVM_Task{ + This: v.Reference(), + Version: version, + } + + res, err := methods.UpgradeVM_Task(ctx, v.Client(), &req) + if err != nil { + return nil, err + } + + return NewTask(v.c, res.Returnval), nil +} diff --git a/vendor/github.com/vmware/govmomi/property/collector.go b/vendor/github.com/vmware/govmomi/property/collector.go index e2059d923f9..04a9e77373f 100644 --- a/vendor/github.com/vmware/govmomi/property/collector.go +++ b/vendor/github.com/vmware/govmomi/property/collector.go @@ -30,7 +30,7 @@ import ( // Collector models the PropertyCollector managed object. // // For more information, see: -// http://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.wssdk.apiref.doc/vmodl.query.PropertyCollector.html +// http://pubs.vmware.com/vsphere-60/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc%2Fvmodl.query.PropertyCollector.html // type Collector struct { roundTripper soap.RoundTripper diff --git a/vendor/github.com/vmware/govmomi/property/filter.go b/vendor/github.com/vmware/govmomi/property/filter.go index a6fa1de9ffd..8284b0c7d82 100644 --- a/vendor/github.com/vmware/govmomi/property/filter.go +++ b/vendor/github.com/vmware/govmomi/property/filter.go @@ -18,7 +18,7 @@ package property import ( "fmt" - "path/filepath" + "path" "reflect" "strconv" "strings" @@ -103,7 +103,11 @@ func (f Filter) MatchProperty(prop types.DynamicProperty) bool { switch pval := prop.Val.(type) { case string: - m, _ := filepath.Match(match.(string), pval) + s := match.(string) + if s == "*" { + return true // TODO: path.Match fails if s contains a '/' + } + m, _ := path.Match(s, pval) return m default: return reflect.DeepEqual(match, pval) diff --git a/vendor/github.com/vmware/govmomi/property/wait.go b/vendor/github.com/vmware/govmomi/property/wait.go index 689477bfb85..fe847926ce9 100644 --- a/vendor/github.com/vmware/govmomi/property/wait.go +++ b/vendor/github.com/vmware/govmomi/property/wait.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. +Copyright (c) 2015-2017 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,7 +22,50 @@ import ( "github.com/vmware/govmomi/vim25/types" ) -// Wait waits for any of the specified properties of the specified managed +// WaitFilter provides helpers to construct a types.CreateFilter for use with property.Wait +type WaitFilter struct { + types.CreateFilter +} + +// Add a new ObjectSpec and PropertySpec to the WaitFilter +func (f *WaitFilter) Add(obj types.ManagedObjectReference, kind string, ps []string, set ...types.BaseSelectionSpec) *WaitFilter { + spec := types.ObjectSpec{ + Obj: obj, + SelectSet: set, + } + + pset := types.PropertySpec{ + Type: kind, + PathSet: ps, + } + + if len(ps) == 0 { + pset.All = types.NewBool(true) + } + + f.Spec.ObjectSet = append(f.Spec.ObjectSet, spec) + + f.Spec.PropSet = append(f.Spec.PropSet, pset) + + return f +} + +// Wait creates a new WaitFilter and calls the specified function for each ObjectUpdate via WaitForUpdates +func Wait(ctx context.Context, c *Collector, obj types.ManagedObjectReference, ps []string, f func([]types.PropertyChange) bool) error { + filter := new(WaitFilter).Add(obj, obj.Type, ps) + + return WaitForUpdates(ctx, c, filter, func(updates []types.ObjectUpdate) bool { + for _, update := range updates { + if f(update.ChangeSet) { + return true + } + } + + return false + }) +} + +// WaitForUpdates waits for any of the specified properties of the specified managed // object to change. It calls the specified function for every update it // receives. If this function returns false, it continues waiting for // subsequent updates. If this function returns true, it stops waiting and @@ -35,7 +78,7 @@ import ( // The newly created collector is destroyed before this function returns (both // in case of success or error). // -func Wait(ctx context.Context, c *Collector, obj types.ManagedObjectReference, ps []string, f func([]types.PropertyChange) bool) error { +func WaitForUpdates(ctx context.Context, c *Collector, filter *WaitFilter, f func([]types.ObjectUpdate) bool) error { p, err := c.Create(ctx) if err != nil { return err @@ -45,91 +88,13 @@ func Wait(ctx context.Context, c *Collector, obj types.ManagedObjectReference, p // specified context may have timed out or have been cancelled. defer p.Destroy(context.Background()) - req := types.CreateFilter{ - Spec: types.PropertyFilterSpec{ - ObjectSet: []types.ObjectSpec{ - { - Obj: obj, - }, - }, - PropSet: []types.PropertySpec{ - { - PathSet: ps, - Type: obj.Type, - }, - }, - }, - } - - if len(ps) == 0 { - req.Spec.PropSet[0].All = types.NewBool(true) - } - - err = p.CreateFilter(ctx, req) - if err != nil { - return err - } - return waitLoop(ctx, p, func(_ types.ManagedObjectReference, pc []types.PropertyChange) bool { - return f(pc) - }) -} - -// WaitForView waits for any of the specified properties of the managed -// objects in the View to change. It calls the specified function for every update it -// receives. If this function returns false, it continues waiting for -// subsequent updates. If this function returns true, it stops waiting and -// returns. -// -// To only receive updates for the View's specified managed objects, the function -// creates a new property collector and calls CreateFilter. A new property -// collector is required because filters can only be added, not removed. -// -// The newly created collector is destroyed before this function returns (both -// in case of success or error). -// -// The code assumes that all objects in the View are the same type -func WaitForView(ctx context.Context, c *Collector, view types.ManagedObjectReference, obj types.ManagedObjectReference, ps []string, f func(types.ManagedObjectReference, []types.PropertyChange) bool) error { - p, err := c.Create(ctx) + err = p.CreateFilter(ctx, filter.CreateFilter) if err != nil { return err } - // Attempt to destroy the collector using the background context, as the - // specified context may have timed out or have been cancelled. - defer p.Destroy(context.Background()) - - req := types.CreateFilter{ - Spec: types.PropertyFilterSpec{ - ObjectSet: []types.ObjectSpec{ - { - Obj: view, - SelectSet: []types.BaseSelectionSpec{ - &types.TraversalSpec{ - SelectionSpec: types.SelectionSpec{ - Name: "traverseEntities", - }, - Path: "view", - Type: view.Type}}, - }, - }, - PropSet: []types.PropertySpec{ - { - Type: obj.Type, - PathSet: ps, - }, - }, - }} - - err = p.CreateFilter(ctx, req) - if err != nil { - return err - } - return waitLoop(ctx, p, f) -} - -func waitLoop(ctx context.Context, c *Collector, f func(types.ManagedObjectReference, []types.PropertyChange) bool) error { for version := ""; ; { - res, err := c.WaitForUpdates(ctx, version) + res, err := p.WaitForUpdates(ctx, version) if err != nil { return err } @@ -142,12 +107,9 @@ func waitLoop(ctx context.Context, c *Collector, f func(types.ManagedObjectRefer version = res.Version for _, fs := range res.FilterSet { - for _, os := range fs.ObjectSet { - if f(os.Obj, os.ChangeSet) { - return nil - } + if f(fs.ObjectSet) { + return nil } } } - } diff --git a/vendor/github.com/vmware/govmomi/session/manager.go b/vendor/github.com/vmware/govmomi/session/manager.go index b4591c1c4dc..3cbfa938419 100644 --- a/vendor/github.com/vmware/govmomi/session/manager.go +++ b/vendor/github.com/vmware/govmomi/session/manager.go @@ -199,3 +199,31 @@ func (sm *Manager) AcquireLocalTicket(ctx context.Context, userName string) (*ty return &res.Returnval, nil } + +func (sm *Manager) AcquireCloneTicket(ctx context.Context) (string, error) { + req := types.AcquireCloneTicket{ + This: sm.Reference(), + } + + res, err := methods.AcquireCloneTicket(ctx, sm.client, &req) + if err != nil { + return "", err + } + + return res.Returnval, nil +} + +func (sm *Manager) CloneSession(ctx context.Context, ticket string) error { + req := types.CloneSession{ + This: sm.Reference(), + CloneTicket: ticket, + } + + res, err := methods.CloneSession(ctx, sm.client, &req) + if err != nil { + return err + } + + sm.userSession = &res.Returnval + return nil +} diff --git a/vendor/github.com/vmware/govmomi/simulator/BUILD b/vendor/github.com/vmware/govmomi/simulator/BUILD new file mode 100644 index 00000000000..dafff93c675 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/BUILD @@ -0,0 +1,84 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "authorization_manager.go", + "cluster_compute_resource.go", + "custom_fields_manager.go", + "datacenter.go", + "datastore.go", + "doc.go", + "dvs.go", + "entity.go", + "file_manager.go", + "folder.go", + "guest_id.go", + "host_datastore_browser.go", + "host_datastore_system.go", + "host_firewall_system.go", + "host_network_system.go", + "host_system.go", + "ip_pool_manager.go", + "license_manager.go", + "model.go", + "option_manager.go", + "os_unix.go", + "performance_manager.go", + "portgroup.go", + "property_collector.go", + "property_filter.go", + "registry.go", + "resource_pool.go", + "search_index.go", + "service_instance.go", + "session_manager.go", + "simulator.go", + "snapshot.go", + "task.go", + "task_manager.go", + "user_directory.go", + "view_manager.go", + "virtual_disk_manager.go", + "virtual_machine.go", + ] + select({ + "@io_bazel_rules_go//go/platform:windows": [ + "os_windows.go", + ], + "//conditions:default": [], + }), + importpath = "github.com/vmware/govmomi/simulator", + visibility = ["//visibility:public"], + deps = [ + "//vendor/github.com/google/uuid:go_default_library", + "//vendor/github.com/vmware/govmomi/find:go_default_library", + "//vendor/github.com/vmware/govmomi/object:go_default_library", + "//vendor/github.com/vmware/govmomi/session:go_default_library", + "//vendor/github.com/vmware/govmomi/simulator/esx:go_default_library", + "//vendor/github.com/vmware/govmomi/simulator/vpx:go_default_library", + "//vendor/github.com/vmware/govmomi/vim25:go_default_library", + "//vendor/github.com/vmware/govmomi/vim25/methods:go_default_library", + "//vendor/github.com/vmware/govmomi/vim25/mo:go_default_library", + "//vendor/github.com/vmware/govmomi/vim25/soap:go_default_library", + "//vendor/github.com/vmware/govmomi/vim25/types:go_default_library", + "//vendor/github.com/vmware/govmomi/vim25/xml:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [ + ":package-srcs", + "//vendor/github.com/vmware/govmomi/simulator/esx:all-srcs", + "//vendor/github.com/vmware/govmomi/simulator/vpx:all-srcs", + ], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/vendor/github.com/vmware/govmomi/simulator/authorization_manager.go b/vendor/github.com/vmware/govmomi/simulator/authorization_manager.go new file mode 100644 index 00000000000..b65db933e8f --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/authorization_manager.go @@ -0,0 +1,257 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "strings" + + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/simulator/esx" + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type AuthorizationManager struct { + mo.AuthorizationManager + + permissions map[types.ManagedObjectReference][]types.Permission + privileges map[string]struct{} + system []string + nextID int32 +} + +func NewAuthorizationManager(ref types.ManagedObjectReference) object.Reference { + m := &AuthorizationManager{} + m.Self = ref + m.RoleList = esx.RoleList + m.permissions = make(map[types.ManagedObjectReference][]types.Permission) + + l := object.AuthorizationRoleList(m.RoleList) + m.system = l.ByName("ReadOnly").Privilege + admin := l.ByName("Admin") + m.privileges = make(map[string]struct{}, len(admin.Privilege)) + + for _, id := range admin.Privilege { + m.privileges[id] = struct{}{} + } + + root := Map.content().RootFolder + + for _, u := range DefaultUserGroup { + m.permissions[root] = append(m.permissions[root], types.Permission{ + Entity: &root, + Principal: u.Principal, + Group: u.Group, + RoleId: admin.RoleId, + Propagate: true, + }) + } + + return m +} + +func (m *AuthorizationManager) RetrieveEntityPermissions(req *types.RetrieveEntityPermissions) soap.HasFault { + e := Map.Get(req.Entity).(mo.Entity) + + p := m.permissions[e.Reference()] + + if req.Inherited { + for { + parent := e.Entity().Parent + if parent == nil { + break + } + + e = Map.Get(parent.Reference()).(mo.Entity) + + p = append(p, m.permissions[e.Reference()]...) + } + } + + return &methods.RetrieveEntityPermissionsBody{ + Res: &types.RetrieveEntityPermissionsResponse{ + Returnval: p, + }, + } +} + +func (m *AuthorizationManager) RetrieveAllPermissions(req *types.RetrieveAllPermissions) soap.HasFault { + var p []types.Permission + + for _, v := range m.permissions { + p = append(p, v...) + } + + return &methods.RetrieveAllPermissionsBody{ + Res: &types.RetrieveAllPermissionsResponse{ + Returnval: p, + }, + } +} + +func (m *AuthorizationManager) RemoveEntityPermission(req *types.RemoveEntityPermission) soap.HasFault { + var p []types.Permission + + for _, v := range m.permissions[req.Entity] { + if v.Group == req.IsGroup && v.Principal == req.User { + continue + } + p = append(p, v) + } + + m.permissions[req.Entity] = p + + return &methods.RemoveEntityPermissionBody{ + Res: &types.RemoveEntityPermissionResponse{}, + } +} + +func (m *AuthorizationManager) SetEntityPermissions(req *types.SetEntityPermissions) soap.HasFault { + m.permissions[req.Entity] = req.Permission + + return &methods.SetEntityPermissionsBody{ + Res: &types.SetEntityPermissionsResponse{}, + } +} + +func (m *AuthorizationManager) RetrieveRolePermissions(req *types.RetrieveRolePermissions) soap.HasFault { + var p []types.Permission + + for _, set := range m.permissions { + for _, v := range set { + if v.RoleId == req.RoleId { + p = append(p, v) + } + } + } + + return &methods.RetrieveRolePermissionsBody{ + Res: &types.RetrieveRolePermissionsResponse{ + Returnval: p, + }, + } +} + +func (m *AuthorizationManager) AddAuthorizationRole(req *types.AddAuthorizationRole) soap.HasFault { + body := &methods.AddAuthorizationRoleBody{} + + for _, role := range m.RoleList { + if role.Name == req.Name { + body.Fault_ = Fault("", &types.AlreadyExists{}) + return body + } + } + + ids, err := m.privIDs(req.PrivIds) + if err != nil { + body.Fault_ = err + return body + } + + m.RoleList = append(m.RoleList, types.AuthorizationRole{ + Info: &types.Description{ + Label: req.Name, + Summary: req.Name, + }, + RoleId: m.nextID, + Privilege: ids, + Name: req.Name, + System: false, + }) + + m.nextID++ + + body.Res = &types.AddAuthorizationRoleResponse{} + + return body +} + +func (m *AuthorizationManager) UpdateAuthorizationRole(req *types.UpdateAuthorizationRole) soap.HasFault { + body := &methods.UpdateAuthorizationRoleBody{} + + for _, role := range m.RoleList { + if role.Name == req.NewName && role.RoleId != req.RoleId { + body.Fault_ = Fault("", &types.AlreadyExists{}) + return body + } + } + + for i, role := range m.RoleList { + if role.RoleId == req.RoleId { + if len(req.PrivIds) != 0 { + ids, err := m.privIDs(req.PrivIds) + if err != nil { + body.Fault_ = err + return body + } + m.RoleList[i].Privilege = ids + } + + m.RoleList[i].Name = req.NewName + + body.Res = &types.UpdateAuthorizationRoleResponse{} + return body + } + } + + body.Fault_ = Fault("", &types.NotFound{}) + + return body +} + +func (m *AuthorizationManager) RemoveAuthorizationRole(req *types.RemoveAuthorizationRole) soap.HasFault { + body := &methods.RemoveAuthorizationRoleBody{} + + for i, role := range m.RoleList { + if role.RoleId == req.RoleId { + m.RoleList = append(m.RoleList[:i], m.RoleList[i+1:]...) + + body.Res = &types.RemoveAuthorizationRoleResponse{} + return body + } + } + + body.Fault_ = Fault("", &types.NotFound{}) + + return body +} + +func (m *AuthorizationManager) privIDs(ids []string) ([]string, *soap.Fault) { + system := make(map[string]struct{}, len(m.system)) + + for _, id := range ids { + if _, ok := m.privileges[id]; !ok { + return nil, Fault("", &types.InvalidArgument{InvalidProperty: "privIds"}) + } + + if strings.HasPrefix(id, "System.") { + system[id] = struct{}{} + } + } + + for _, id := range m.system { + if _, ok := system[id]; ok { + continue + } + + ids = append(ids, id) + } + + return ids, nil +} diff --git a/vendor/github.com/vmware/govmomi/simulator/cluster_compute_resource.go b/vendor/github.com/vmware/govmomi/simulator/cluster_compute_resource.go new file mode 100644 index 00000000000..fe51ae3e7c2 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/cluster_compute_resource.go @@ -0,0 +1,98 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "github.com/vmware/govmomi/simulator/esx" + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type ClusterComputeResource struct { + mo.ClusterComputeResource +} + +type addHost struct { + *ClusterComputeResource + + req *types.AddHost_Task +} + +func (add *addHost) Run(task *Task) (types.AnyType, types.BaseMethodFault) { + spec := add.req.Spec + + if spec.HostName == "" { + return nil, &types.NoHost{} + } + + host := NewHostSystem(esx.HostSystem) + host.Summary.Config.Name = spec.HostName + host.Name = host.Summary.Config.Name + host.Runtime.ConnectionState = types.HostSystemConnectionStateDisconnected + + cr := add.ClusterComputeResource + Map.PutEntity(cr, Map.NewEntity(host)) + + cr.Host = append(cr.Host, host.Reference()) + + if add.req.AsConnected { + host.Runtime.ConnectionState = types.HostSystemConnectionStateConnected + } + + addComputeResource(add.ClusterComputeResource.Summary.GetComputeResourceSummary(), host) + + return host.Reference(), nil +} + +func (c *ClusterComputeResource) AddHostTask(add *types.AddHost_Task) soap.HasFault { + return &methods.AddHost_TaskBody{ + Res: &types.AddHost_TaskResponse{ + Returnval: NewTask(&addHost{c, add}).Run(), + }, + } +} + +func CreateClusterComputeResource(f *Folder, name string, spec types.ClusterConfigSpecEx) (*ClusterComputeResource, types.BaseMethodFault) { + if e := Map.FindByName(name, f.ChildEntity); e != nil { + return nil, &types.DuplicateName{ + Name: e.Entity().Name, + Object: e.Reference(), + } + } + + cluster := &ClusterComputeResource{} + cluster.Name = name + cluster.Summary = &types.ClusterComputeResourceSummary{ + UsageSummary: new(types.ClusterUsageSummary), + } + + config := &types.ClusterConfigInfoEx{} + cluster.ConfigurationEx = config + + config.DrsConfig.Enabled = types.NewBool(true) + + pool := NewResourcePool() + Map.PutEntity(cluster, Map.NewEntity(pool)) + cluster.ResourcePool = &pool.Self + + f.putChild(cluster) + pool.Owner = cluster.Self + + return cluster, nil +} diff --git a/vendor/github.com/vmware/govmomi/simulator/custom_fields_manager.go b/vendor/github.com/vmware/govmomi/simulator/custom_fields_manager.go new file mode 100644 index 00000000000..3ae5ef0302f --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/custom_fields_manager.go @@ -0,0 +1,111 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type CustomFieldsManager struct { + mo.CustomFieldsManager + + nextKey int32 +} + +func NewCustomFieldsManager(ref types.ManagedObjectReference) object.Reference { + m := &CustomFieldsManager{} + m.Self = ref + return m +} + +func (c *CustomFieldsManager) find(key int32) (int, *types.CustomFieldDef) { + for i, field := range c.Field { + if field.Key == key { + return i, &c.Field[i] + } + } + + return -1, nil +} + +func (c *CustomFieldsManager) AddCustomFieldDef(req *types.AddCustomFieldDef) soap.HasFault { + body := &methods.AddCustomFieldDefBody{} + + def := types.CustomFieldDef{ + Key: c.nextKey, + Name: req.Name, + ManagedObjectType: req.MoType, + Type: req.MoType, + FieldDefPrivileges: req.FieldDefPolicy, + FieldInstancePrivileges: req.FieldPolicy, + } + + c.Field = append(c.Field, def) + c.nextKey++ + + body.Res = &types.AddCustomFieldDefResponse{ + Returnval: def, + } + return body +} + +func (c *CustomFieldsManager) RemoveCustomFieldDef(req *types.RemoveCustomFieldDef) soap.HasFault { + body := &methods.RemoveCustomFieldDefBody{} + + i, field := c.find(req.Key) + if field == nil { + body.Fault_ = Fault("", &types.NotFound{}) + return body + } + + c.Field = append(c.Field[:i], c.Field[i+1:]...) + + body.Res = &types.RemoveCustomFieldDefResponse{} + return body +} + +func (c *CustomFieldsManager) RenameCustomFieldDef(req *types.RenameCustomFieldDef) soap.HasFault { + body := &methods.RenameCustomFieldDefBody{} + + _, field := c.find(req.Key) + if field == nil { + body.Fault_ = Fault("", &types.NotFound{}) + return body + } + + field.Name = req.Name + + body.Res = &types.RenameCustomFieldDefResponse{} + return body +} + +func (c *CustomFieldsManager) SetField(req *types.SetField) soap.HasFault { + body := &methods.SetFieldBody{} + + entity := Map.Get(req.Entity).(mo.Entity).Entity() + entity.CustomValue = append(entity.CustomValue, &types.CustomFieldStringValue{ + CustomFieldValue: types.CustomFieldValue{Key: req.Key}, + Value: req.Value, + }) + + body.Res = &types.SetFieldResponse{} + return body +} diff --git a/vendor/github.com/vmware/govmomi/simulator/datacenter.go b/vendor/github.com/vmware/govmomi/simulator/datacenter.go new file mode 100644 index 00000000000..15b5d432424 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/datacenter.go @@ -0,0 +1,76 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "strings" + + "github.com/vmware/govmomi/simulator/esx" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/types" +) + +// Create Datacenter Folders. +// Every Datacenter has 4 inventory Folders: Vm, Host, Datastore and Network. +// The ESX folder child types are limited to 1 type. +// The VC folders have additional child types, including nested folders. +func createDatacenterFolders(dc *mo.Datacenter, isVC bool) { + folders := []struct { + ref *types.ManagedObjectReference + name string + types []string + }{ + {&dc.VmFolder, "vm", []string{"VirtualMachine", "VirtualApp", "Folder"}}, + {&dc.HostFolder, "host", []string{"ComputeResource", "Folder"}}, + {&dc.DatastoreFolder, "datastore", []string{"Datastore", "StoragePod", "Folder"}}, + {&dc.NetworkFolder, "network", []string{"Network", "DistributedVirtualSwitch", "Folder"}}, + } + + for _, f := range folders { + folder := &Folder{} + folder.Name = f.name + + if isVC { + folder.ChildType = f.types + e := Map.PutEntity(dc, folder) + + // propagate the generated morefs to Datacenter + ref := e.Reference() + f.ref.Type = ref.Type + f.ref.Value = ref.Value + } else { + folder.ChildType = f.types[:1] + folder.Self = *f.ref + Map.PutEntity(dc, folder) + } + } + + net := Map.Get(dc.NetworkFolder).(*Folder) + + for _, ref := range esx.Datacenter.Network { + // Add VM Network by default to each Datacenter + network := &mo.Network{} + network.Self = ref + network.Name = strings.Split(ref.Value, "-")[1] + network.Entity().Name = network.Name + if isVC { + network.Self.Value = "" // we want a different moid per-DC + } + + net.putChild(network) + } +} diff --git a/vendor/github.com/vmware/govmomi/simulator/datastore.go b/vendor/github.com/vmware/govmomi/simulator/datastore.go new file mode 100644 index 00000000000..527f85dec17 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/datastore.go @@ -0,0 +1,59 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "time" + + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type Datastore struct { + mo.Datastore +} + +func parseDatastorePath(dsPath string) (*object.DatastorePath, types.BaseMethodFault) { + var p object.DatastorePath + + if p.FromString(dsPath) { + return &p, nil + } + + return nil, &types.InvalidDatastorePath{DatastorePath: dsPath} +} + +func (ds *Datastore) RefreshDatastore(*types.RefreshDatastore) soap.HasFault { + r := &methods.RefreshDatastoreBody{} + + err := ds.stat() + if err != nil { + r.Fault_ = Fault(err.Error(), &types.HostConfigFault{}) + return r + } + + info := ds.Info.GetDatastoreInfo() + + now := time.Now() + + info.Timestamp = &now + + return r +} diff --git a/vendor/github.com/vmware/govmomi/simulator/doc.go b/vendor/github.com/vmware/govmomi/simulator/doc.go new file mode 100644 index 00000000000..441e9a0e7f4 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/doc.go @@ -0,0 +1,22 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator is a mock framework for the vSphere API. + +See also: https://github.com/vmware/govmomi/blob/master/vcsim/README.md +*/ +package simulator diff --git a/vendor/github.com/vmware/govmomi/simulator/dvs.go b/vendor/github.com/vmware/govmomi/simulator/dvs.go new file mode 100644 index 00000000000..e60b5601092 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/dvs.go @@ -0,0 +1,187 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type DistributedVirtualSwitch struct { + mo.DistributedVirtualSwitch +} + +func (s *DistributedVirtualSwitch) AddDVPortgroupTask(c *types.AddDVPortgroup_Task) soap.HasFault { + task := CreateTask(s, "addDVPortgroup", func(t *Task) (types.AnyType, types.BaseMethodFault) { + f := Map.getEntityParent(s, "Folder").(*Folder) + + for _, spec := range c.Spec { + pg := &DistributedVirtualPortgroup{} + pg.Name = spec.Name + pg.Entity().Name = pg.Name + + if obj := Map.FindByName(pg.Name, f.ChildEntity); obj != nil { + return nil, &types.DuplicateName{ + Name: pg.Name, + Object: obj.Reference(), + } + } + + f.putChild(pg) + + pg.Key = pg.Self.Value + pg.Config = types.DVPortgroupConfigInfo{ + Key: pg.Key, + Name: pg.Name, + NumPorts: spec.NumPorts, + DistributedVirtualSwitch: &s.Self, + DefaultPortConfig: spec.DefaultPortConfig, + Description: spec.Description, + Type: spec.Type, + Policy: spec.Policy, + PortNameFormat: spec.PortNameFormat, + Scope: spec.Scope, + VendorSpecificConfig: spec.VendorSpecificConfig, + ConfigVersion: spec.ConfigVersion, + AutoExpand: spec.AutoExpand, + VmVnicNetworkResourcePoolKey: spec.VmVnicNetworkResourcePoolKey, + } + + s.Portgroup = append(s.Portgroup, pg.Self) + s.Summary.PortgroupName = append(s.Summary.PortgroupName, pg.Name) + + for _, h := range s.Summary.HostMember { + pg.Host = AddReference(h, pg.Host) + host := Map.Get(h).(*HostSystem) + host.Network = append(host.Network, pg.Reference()) + } + } + + return nil, nil + }) + + return &methods.AddDVPortgroup_TaskBody{ + Res: &types.AddDVPortgroup_TaskResponse{ + Returnval: task.Run(), + }, + } +} + +func (s *DistributedVirtualSwitch) ReconfigureDvsTask(req *types.ReconfigureDvs_Task) soap.HasFault { + task := CreateTask(s, "reconfigureDvs", func(t *Task) (types.AnyType, types.BaseMethodFault) { + spec := req.Spec.GetDVSConfigSpec() + + for _, member := range spec.Host { + h := Map.Get(member.Host) + if h == nil { + return nil, &types.ManagedObjectNotFound{Obj: member.Host} + } + + host := h.(*HostSystem) + + switch types.ConfigSpecOperation(member.Operation) { + case types.ConfigSpecOperationAdd: + if FindReference(host.Network, s.Self) != nil { + return nil, &types.AlreadyExists{Name: host.Name} + } + + host.Network = append(host.Network, s.Self) + host.Network = append(host.Network, s.Portgroup...) + s.Summary.HostMember = append(s.Summary.HostMember, member.Host) + + for _, ref := range s.Portgroup { + pg := Map.Get(ref).(*DistributedVirtualPortgroup) + pg.Host = AddReference(member.Host, pg.Host) + } + case types.ConfigSpecOperationRemove: + if pg := FindReference(host.Network, s.Portgroup...); pg != nil { + return nil, &types.ResourceInUse{ + Type: pg.Type, + Name: pg.Value, + } + } + + host.Network = RemoveReference(s.Self, host.Network) + s.Summary.HostMember = RemoveReference(s.Self, s.Summary.HostMember) + case types.ConfigSpecOperationEdit: + return nil, &types.NotSupported{} + } + } + + return nil, nil + }) + + return &methods.ReconfigureDvs_TaskBody{ + Res: &types.ReconfigureDvs_TaskResponse{ + Returnval: task.Run(), + }, + } +} + +func (s *DistributedVirtualSwitch) FetchDVPorts(req *types.FetchDVPorts) soap.HasFault { + body := &methods.FetchDVPortsBody{} + body.Res = &types.FetchDVPortsResponse{ + Returnval: s.dvPortgroups(req.Criteria), + } + return body +} + +func (s *DistributedVirtualSwitch) DestroyTask(req *types.Destroy_Task) soap.HasFault { + task := CreateTask(s, "destroy", func(t *Task) (types.AnyType, types.BaseMethodFault) { + f := Map.getEntityParent(s, "Folder").(*Folder) + f.removeChild(s.Reference()) + return nil, nil + }) + + return &methods.Destroy_TaskBody{ + Res: &types.Destroy_TaskResponse{ + Returnval: task.Run(), + }, + } +} + +func (s *DistributedVirtualSwitch) dvPortgroups(_ *types.DistributedVirtualSwitchPortCriteria) []types.DistributedVirtualPort { + // TODO(agui): Filter is not implemented yet + var res []types.DistributedVirtualPort + for _, ref := range s.Portgroup { + pg := Map.Get(ref).(*DistributedVirtualPortgroup) + res = append(res, types.DistributedVirtualPort{ + DvsUuid: s.Uuid, + Key: pg.Key, + Config: types.DVPortConfigInfo{ + Setting: pg.Config.DefaultPortConfig, + }, + }) + + if pg.PortKeys == nil { + continue + } + + for _, key := range pg.PortKeys { + res = append(res, types.DistributedVirtualPort{ + DvsUuid: s.Uuid, + Key: key, + Config: types.DVPortConfigInfo{ + Setting: pg.Config.DefaultPortConfig, + }, + }) + } + } + return res +} diff --git a/vendor/github.com/vmware/govmomi/simulator/entity.go b/vendor/github.com/vmware/govmomi/simulator/entity.go new file mode 100644 index 00000000000..8266c0235ec --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/entity.go @@ -0,0 +1,46 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +func RenameTask(e mo.Entity, r *types.Rename_Task) soap.HasFault { + task := CreateTask(e, "rename", func(t *Task) (types.AnyType, types.BaseMethodFault) { + obj := Map.Get(r.This).(mo.Entity).Entity() + + if parent, ok := Map.Get(*obj.Parent).(*Folder); ok { + if Map.FindByName(r.NewName, parent.ChildEntity) != nil { + return nil, &types.InvalidArgument{InvalidProperty: "name"} + } + } + + obj.Name = r.NewName + + return nil, nil + }) + + return &methods.Rename_TaskBody{ + Res: &types.Rename_TaskResponse{ + Returnval: task.Run(), + }, + } +} diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/BUILD b/vendor/github.com/vmware/govmomi/simulator/esx/BUILD new file mode 100644 index 00000000000..acfb87ca798 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/esx/BUILD @@ -0,0 +1,41 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "authorization_manager.go", + "datacenter.go", + "doc.go", + "host_config_info.go", + "host_firewall_system.go", + "host_hardware_info.go", + "host_storage_device_info.go", + "host_system.go", + "performance_manager.go", + "resource_pool.go", + "root_folder.go", + "service_content.go", + "setting.go", + "virtual_device.go", + ], + importpath = "github.com/vmware/govmomi/simulator/esx", + visibility = ["//visibility:public"], + deps = [ + "//vendor/github.com/vmware/govmomi/vim25/mo:go_default_library", + "//vendor/github.com/vmware/govmomi/vim25/types:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/authorization_manager.go b/vendor/github.com/vmware/govmomi/simulator/esx/authorization_manager.go new file mode 100644 index 00000000000..e72c06c851f --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/esx/authorization_manager.go @@ -0,0 +1,85 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 esx + +import "github.com/vmware/govmomi/vim25/types" + +// RoleList is the default template for the AuthorizationManager roleList property. +// Capture method: +// govc object.collect -s -dump AuthorizationManager:ha-authmgr roleList +var RoleList = []types.AuthorizationRole{ + { + RoleId: -6, + System: true, + Name: "NoCryptoAdmin", + Info: &types.Description{ + Label: "No cryptography administrator", + Summary: "Full access without Cryptographic operations privileges", + }, + Privilege: nil, + }, + { + RoleId: -5, + System: true, + Name: "NoAccess", + Info: &types.Description{ + Label: "No access", + Summary: "Used for restricting granted access", + }, + Privilege: nil, + }, + { + RoleId: -4, + System: true, + Name: "Anonymous", + Info: &types.Description{ + Label: "Anonymous", + Summary: "Not logged-in user (cannot be granted)", + }, + Privilege: []string{"System.Anonymous"}, + }, + { + RoleId: -3, + System: true, + Name: "View", + Info: &types.Description{ + Label: "View", + Summary: "Visibility access (cannot be granted)", + }, + Privilege: []string{"System.Anonymous", "System.View"}, + }, + { + RoleId: -2, + System: true, + Name: "ReadOnly", + Info: &types.Description{ + Label: "Read-only", + Summary: "See details of objects, but not make changes", + }, + Privilege: []string{"System.Anonymous", "System.Read", "System.View"}, + }, + { + RoleId: -1, + System: true, + Name: "Admin", + Info: &types.Description{ + Label: "Administrator", + Summary: "Full access rights", + }, + Privilege: []string{"Alarm.Acknowledge", "Alarm.Create", "Alarm.Delete", "Alarm.DisableActions", "Alarm.Edit", "Alarm.SetStatus", "Authorization.ModifyPermissions", "Authorization.ModifyRoles", "Authorization.ReassignRolePermissions", "Certificate.Manage", "Cryptographer.Access", "Cryptographer.AddDisk", "Cryptographer.Clone", "Cryptographer.Decrypt", "Cryptographer.Encrypt", "Cryptographer.EncryptNew", "Cryptographer.ManageEncryptionPolicy", "Cryptographer.ManageKeyServers", "Cryptographer.ManageKeys", "Cryptographer.Migrate", "Cryptographer.Recrypt", "Cryptographer.RegisterHost", "Cryptographer.RegisterVM", "DVPortgroup.Create", "DVPortgroup.Delete", "DVPortgroup.Modify", "DVPortgroup.PolicyOp", "DVPortgroup.ScopeOp", "DVSwitch.Create", "DVSwitch.Delete", "DVSwitch.HostOp", "DVSwitch.Modify", "DVSwitch.Move", "DVSwitch.PolicyOp", "DVSwitch.PortConfig", "DVSwitch.PortSetting", "DVSwitch.ResourceManagement", "DVSwitch.Vspan", "Datacenter.Create", "Datacenter.Delete", "Datacenter.IpPoolConfig", "Datacenter.IpPoolQueryAllocations", "Datacenter.IpPoolReleaseIp", "Datacenter.Move", "Datacenter.Reconfigure", "Datacenter.Rename", "Datastore.AllocateSpace", "Datastore.Browse", "Datastore.Config", "Datastore.Delete", "Datastore.DeleteFile", "Datastore.FileManagement", "Datastore.Move", "Datastore.Rename", "Datastore.UpdateVirtualMachineFiles", "Datastore.UpdateVirtualMachineMetadata", "EAM.Config", "EAM.Modify", "EAM.View", "Extension.Register", "Extension.Unregister", "Extension.Update", "ExternalStatsProvider.Register", "ExternalStatsProvider.Unregister", "ExternalStatsProvider.Update", "Folder.Create", "Folder.Delete", "Folder.Move", "Folder.Rename", "Global.CancelTask", "Global.CapacityPlanning", "Global.Diagnostics", "Global.DisableMethods", "Global.EnableMethods", "Global.GlobalTag", "Global.Health", "Global.Licenses", "Global.LogEvent", "Global.ManageCustomFields", "Global.Proxy", "Global.ScriptAction", "Global.ServiceManagers", "Global.SetCustomField", "Global.Settings", "Global.SystemTag", "Global.VCServer", "HealthUpdateProvider.Register", "HealthUpdateProvider.Unregister", "HealthUpdateProvider.Update", "Host.Cim.CimInteraction", "Host.Config.AdvancedConfig", "Host.Config.AuthenticationStore", "Host.Config.AutoStart", "Host.Config.Connection", "Host.Config.DateTime", "Host.Config.Firmware", "Host.Config.HyperThreading", "Host.Config.Image", "Host.Config.Maintenance", "Host.Config.Memory", "Host.Config.NetService", "Host.Config.Network", "Host.Config.Patch", "Host.Config.PciPassthru", "Host.Config.Power", "Host.Config.Quarantine", "Host.Config.Resources", "Host.Config.Settings", "Host.Config.Snmp", "Host.Config.Storage", "Host.Config.SystemManagement", "Host.Hbr.HbrManagement", "Host.Inventory.AddHostToCluster", "Host.Inventory.AddStandaloneHost", "Host.Inventory.CreateCluster", "Host.Inventory.DeleteCluster", "Host.Inventory.EditCluster", "Host.Inventory.MoveCluster", "Host.Inventory.MoveHost", "Host.Inventory.RemoveHostFromCluster", "Host.Inventory.RenameCluster", "Host.Local.CreateVM", "Host.Local.DeleteVM", "Host.Local.InstallAgent", "Host.Local.ManageUserGroups", "Host.Local.ReconfigVM", "Network.Assign", "Network.Config", "Network.Delete", "Network.Move", "Performance.ModifyIntervals", "Profile.Clear", "Profile.Create", "Profile.Delete", "Profile.Edit", "Profile.Export", "Profile.View", "Resource.ApplyRecommendation", "Resource.AssignVAppToPool", "Resource.AssignVMToPool", "Resource.ColdMigrate", "Resource.CreatePool", "Resource.DeletePool", "Resource.EditPool", "Resource.HotMigrate", "Resource.MovePool", "Resource.QueryVMotion", "Resource.RenamePool", "ScheduledTask.Create", "ScheduledTask.Delete", "ScheduledTask.Edit", "ScheduledTask.Run", "Sessions.GlobalMessage", "Sessions.ImpersonateUser", "Sessions.TerminateSession", "Sessions.ValidateSession", "StoragePod.Config", "System.Anonymous", "System.Read", "System.View", "Task.Create", "Task.Update", "VApp.ApplicationConfig", "VApp.AssignResourcePool", "VApp.AssignVApp", "VApp.AssignVM", "VApp.Clone", "VApp.Create", "VApp.Delete", "VApp.Export", "VApp.ExtractOvfEnvironment", "VApp.Import", "VApp.InstanceConfig", "VApp.ManagedByConfig", "VApp.Move", "VApp.PowerOff", "VApp.PowerOn", "VApp.Rename", "VApp.ResourceConfig", "VApp.Suspend", "VApp.Unregister", "VRMPolicy.Query", "VRMPolicy.Update", "VirtualMachine.Config.AddExistingDisk", "VirtualMachine.Config.AddNewDisk", "VirtualMachine.Config.AddRemoveDevice", "VirtualMachine.Config.AdvancedConfig", "VirtualMachine.Config.Annotation", "VirtualMachine.Config.CPUCount", "VirtualMachine.Config.ChangeTracking", "VirtualMachine.Config.DiskExtend", "VirtualMachine.Config.DiskLease", "VirtualMachine.Config.EditDevice", "VirtualMachine.Config.HostUSBDevice", "VirtualMachine.Config.ManagedBy", "VirtualMachine.Config.Memory", "VirtualMachine.Config.MksControl", "VirtualMachine.Config.QueryFTCompatibility", "VirtualMachine.Config.QueryUnownedFiles", "VirtualMachine.Config.RawDevice", "VirtualMachine.Config.ReloadFromPath", "VirtualMachine.Config.RemoveDisk", "VirtualMachine.Config.Rename", "VirtualMachine.Config.ResetGuestInfo", "VirtualMachine.Config.Resource", "VirtualMachine.Config.Settings", "VirtualMachine.Config.SwapPlacement", "VirtualMachine.Config.ToggleForkParent", "VirtualMachine.Config.Unlock", "VirtualMachine.Config.UpgradeVirtualHardware", "VirtualMachine.GuestOperations.Execute", "VirtualMachine.GuestOperations.Modify", "VirtualMachine.GuestOperations.ModifyAliases", "VirtualMachine.GuestOperations.Query", "VirtualMachine.GuestOperations.QueryAliases", "VirtualMachine.Hbr.ConfigureReplication", "VirtualMachine.Hbr.MonitorReplication", "VirtualMachine.Hbr.ReplicaManagement", "VirtualMachine.Interact.AnswerQuestion", "VirtualMachine.Interact.Backup", "VirtualMachine.Interact.ConsoleInteract", "VirtualMachine.Interact.CreateScreenshot", "VirtualMachine.Interact.CreateSecondary", "VirtualMachine.Interact.DefragmentAllDisks", "VirtualMachine.Interact.DeviceConnection", "VirtualMachine.Interact.DisableSecondary", "VirtualMachine.Interact.DnD", "VirtualMachine.Interact.EnableSecondary", "VirtualMachine.Interact.GuestControl", "VirtualMachine.Interact.MakePrimary", "VirtualMachine.Interact.Pause", "VirtualMachine.Interact.PowerOff", "VirtualMachine.Interact.PowerOn", "VirtualMachine.Interact.PutUsbScanCodes", "VirtualMachine.Interact.Record", "VirtualMachine.Interact.Replay", "VirtualMachine.Interact.Reset", "VirtualMachine.Interact.SESparseMaintenance", "VirtualMachine.Interact.SetCDMedia", "VirtualMachine.Interact.SetFloppyMedia", "VirtualMachine.Interact.Suspend", "VirtualMachine.Interact.TerminateFaultTolerantVM", "VirtualMachine.Interact.ToolsInstall", "VirtualMachine.Interact.TurnOffFaultTolerance", "VirtualMachine.Inventory.Create", "VirtualMachine.Inventory.CreateFromExisting", "VirtualMachine.Inventory.Delete", "VirtualMachine.Inventory.Move", "VirtualMachine.Inventory.Register", "VirtualMachine.Inventory.Unregister", "VirtualMachine.Namespace.Event", "VirtualMachine.Namespace.EventNotify", "VirtualMachine.Namespace.Management", "VirtualMachine.Namespace.ModifyContent", "VirtualMachine.Namespace.Query", "VirtualMachine.Namespace.ReadContent", "VirtualMachine.Provisioning.Clone", "VirtualMachine.Provisioning.CloneTemplate", "VirtualMachine.Provisioning.CreateTemplateFromVM", "VirtualMachine.Provisioning.Customize", "VirtualMachine.Provisioning.DeployTemplate", "VirtualMachine.Provisioning.DiskRandomAccess", "VirtualMachine.Provisioning.DiskRandomRead", "VirtualMachine.Provisioning.FileRandomAccess", "VirtualMachine.Provisioning.GetVmFiles", "VirtualMachine.Provisioning.MarkAsTemplate", "VirtualMachine.Provisioning.MarkAsVM", "VirtualMachine.Provisioning.ModifyCustSpecs", "VirtualMachine.Provisioning.PromoteDisks", "VirtualMachine.Provisioning.PutVmFiles", "VirtualMachine.Provisioning.ReadCustSpecs", "VirtualMachine.State.CreateSnapshot", "VirtualMachine.State.RemoveSnapshot", "VirtualMachine.State.RenameSnapshot", "VirtualMachine.State.RevertToSnapshot"}, + }, +} diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/datacenter.go b/vendor/github.com/vmware/govmomi/simulator/esx/datacenter.go new file mode 100644 index 00000000000..c0f95eff9c9 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/esx/datacenter.go @@ -0,0 +1,60 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 esx + +import ( + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/types" +) + +// Datacenter is the default template for Datacenter properties. +// Capture method: +// govc datacenter.info -dump +var Datacenter = mo.Datacenter{ + ManagedEntity: mo.ManagedEntity{ + ExtensibleManagedObject: mo.ExtensibleManagedObject{ + Self: types.ManagedObjectReference{Type: "Datacenter", Value: "ha-datacenter"}, + Value: nil, + AvailableField: nil, + }, + Parent: (*types.ManagedObjectReference)(nil), + CustomValue: nil, + OverallStatus: "", + ConfigStatus: "", + ConfigIssue: nil, + EffectiveRole: nil, + Permission: nil, + Name: "ha-datacenter", + DisabledMethod: nil, + RecentTask: nil, + DeclaredAlarmState: nil, + TriggeredAlarmState: nil, + AlarmActionsEnabled: (*bool)(nil), + Tag: nil, + }, + VmFolder: types.ManagedObjectReference{Type: "Folder", Value: "ha-folder-vm"}, + HostFolder: types.ManagedObjectReference{Type: "Folder", Value: "ha-folder-host"}, + DatastoreFolder: types.ManagedObjectReference{Type: "Folder", Value: "ha-folder-datastore"}, + NetworkFolder: types.ManagedObjectReference{Type: "Folder", Value: "ha-folder-network"}, + Datastore: []types.ManagedObjectReference{ + {Type: "Datastore", Value: "57089c25-85e3ccd4-17b6-000c29d0beb3"}, + }, + Network: []types.ManagedObjectReference{ + {Type: "Network", Value: "HaNetwork-VM Network"}, + }, + Configuration: types.DatacenterConfigInfo{}, +} diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/doc.go b/vendor/github.com/vmware/govmomi/simulator/esx/doc.go new file mode 100644 index 00000000000..50b6202fa65 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/esx/doc.go @@ -0,0 +1,20 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 esx contains SOAP responses from an ESX server, captured using `govc ... -dump`. +*/ +package esx diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/host_config_info.go b/vendor/github.com/vmware/govmomi/simulator/esx/host_config_info.go new file mode 100644 index 00000000000..3c8295a6c44 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/esx/host_config_info.go @@ -0,0 +1,1091 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 esx + +import "github.com/vmware/govmomi/vim25/types" + +// HostConfigInfo is the default template for the HostSystem config property. +// Capture method: +// govc object.collect -s -dump HostSystem:ha-host config +var HostConfigInfo = types.HostConfigInfo{ + Host: types.ManagedObjectReference{Type: "HostSystem", Value: "ha-host"}, + Product: types.AboutInfo{ + Name: "VMware ESXi", + FullName: "VMware ESXi 6.5.0 build-5969303", + Vendor: "VMware, Inc.", + Version: "6.5.0", + Build: "5969303", + LocaleVersion: "INTL", + LocaleBuild: "000", + OsType: "vmnix-x86", + ProductLineId: "embeddedEsx", + ApiType: "HostAgent", + ApiVersion: "6.5", + InstanceUuid: "", + LicenseProductName: "VMware ESX Server", + LicenseProductVersion: "6.0", + }, + DeploymentInfo: &types.HostDeploymentInfo{ + BootedFromStatelessCache: types.NewBool(false), + }, + HyperThread: &types.HostHyperThreadScheduleInfo{ + Available: false, + Active: false, + Config: true, + }, + ConsoleReservation: (*types.ServiceConsoleReservationInfo)(nil), + VirtualMachineReservation: (*types.VirtualMachineMemoryReservationInfo)(nil), + StorageDevice: &HostStorageDeviceInfo, + SystemFile: nil, + Network: &types.HostNetworkInfo{ + Vswitch: []types.HostVirtualSwitch{ + { + Name: "vSwitch0", + Key: "key-vim.host.VirtualSwitch-vSwitch0", + NumPorts: 1536, + NumPortsAvailable: 1530, + Mtu: 1500, + Portgroup: []string{"key-vim.host.PortGroup-VM Network", "key-vim.host.PortGroup-Management Network"}, + Pnic: []string{"key-vim.host.PhysicalNic-vmnic0"}, + Spec: types.HostVirtualSwitchSpec{ + NumPorts: 128, + Bridge: &types.HostVirtualSwitchBondBridge{ + HostVirtualSwitchBridge: types.HostVirtualSwitchBridge{}, + NicDevice: []string{"vmnic0"}, + Beacon: &types.HostVirtualSwitchBeaconConfig{ + Interval: 1, + }, + LinkDiscoveryProtocolConfig: &types.LinkDiscoveryProtocolConfig{ + Protocol: "cdp", + Operation: "listen", + }, + }, + Policy: &types.HostNetworkPolicy{ + Security: &types.HostNetworkSecurityPolicy{ + AllowPromiscuous: types.NewBool(false), + MacChanges: types.NewBool(true), + ForgedTransmits: types.NewBool(true), + }, + NicTeaming: &types.HostNicTeamingPolicy{ + Policy: "loadbalance_srcid", + ReversePolicy: types.NewBool(true), + NotifySwitches: types.NewBool(true), + RollingOrder: types.NewBool(false), + FailureCriteria: &types.HostNicFailureCriteria{ + CheckSpeed: "minimum", + Speed: 10, + CheckDuplex: types.NewBool(false), + FullDuplex: types.NewBool(false), + CheckErrorPercent: types.NewBool(false), + Percentage: 0, + CheckBeacon: types.NewBool(false), + }, + NicOrder: &types.HostNicOrderPolicy{ + ActiveNic: []string{"vmnic0"}, + StandbyNic: nil, + }, + }, + OffloadPolicy: &types.HostNetOffloadCapabilities{ + CsumOffload: types.NewBool(true), + TcpSegmentation: types.NewBool(true), + ZeroCopyXmit: types.NewBool(true), + }, + ShapingPolicy: &types.HostNetworkTrafficShapingPolicy{ + Enabled: types.NewBool(false), + AverageBandwidth: 0, + PeakBandwidth: 0, + BurstSize: 0, + }, + }, + Mtu: 0, + }, + }, + }, + ProxySwitch: nil, + Portgroup: []types.HostPortGroup{ + { + Key: "key-vim.host.PortGroup-VM Network", + Port: nil, + Vswitch: "key-vim.host.VirtualSwitch-vSwitch0", + ComputedPolicy: types.HostNetworkPolicy{ + Security: &types.HostNetworkSecurityPolicy{ + AllowPromiscuous: types.NewBool(false), + MacChanges: types.NewBool(true), + ForgedTransmits: types.NewBool(true), + }, + NicTeaming: &types.HostNicTeamingPolicy{ + Policy: "loadbalance_srcid", + ReversePolicy: types.NewBool(true), + NotifySwitches: types.NewBool(true), + RollingOrder: types.NewBool(false), + FailureCriteria: &types.HostNicFailureCriteria{ + CheckSpeed: "minimum", + Speed: 10, + CheckDuplex: types.NewBool(false), + FullDuplex: types.NewBool(false), + CheckErrorPercent: types.NewBool(false), + Percentage: 0, + CheckBeacon: types.NewBool(false), + }, + NicOrder: &types.HostNicOrderPolicy{ + ActiveNic: []string{"vmnic0"}, + StandbyNic: nil, + }, + }, + OffloadPolicy: &types.HostNetOffloadCapabilities{ + CsumOffload: types.NewBool(true), + TcpSegmentation: types.NewBool(true), + ZeroCopyXmit: types.NewBool(true), + }, + ShapingPolicy: &types.HostNetworkTrafficShapingPolicy{ + Enabled: types.NewBool(false), + AverageBandwidth: 0, + PeakBandwidth: 0, + BurstSize: 0, + }, + }, + Spec: types.HostPortGroupSpec{ + Name: "VM Network", + VlanId: 0, + VswitchName: "vSwitch0", + Policy: types.HostNetworkPolicy{ + Security: &types.HostNetworkSecurityPolicy{}, + NicTeaming: &types.HostNicTeamingPolicy{ + Policy: "", + ReversePolicy: (*bool)(nil), + NotifySwitches: (*bool)(nil), + RollingOrder: (*bool)(nil), + FailureCriteria: &types.HostNicFailureCriteria{}, + NicOrder: (*types.HostNicOrderPolicy)(nil), + }, + OffloadPolicy: &types.HostNetOffloadCapabilities{}, + ShapingPolicy: &types.HostNetworkTrafficShapingPolicy{}, + }, + }, + }, + { + Key: "key-vim.host.PortGroup-Management Network", + Port: []types.HostPortGroupPort{ + { + Key: "key-vim.host.PortGroup.Port-33554436", + Mac: []string{"00:0c:29:81:d8:a0"}, + Type: "host", + }, + }, + Vswitch: "key-vim.host.VirtualSwitch-vSwitch0", + ComputedPolicy: types.HostNetworkPolicy{ + Security: &types.HostNetworkSecurityPolicy{ + AllowPromiscuous: types.NewBool(false), + MacChanges: types.NewBool(true), + ForgedTransmits: types.NewBool(true), + }, + NicTeaming: &types.HostNicTeamingPolicy{ + Policy: "loadbalance_srcid", + ReversePolicy: types.NewBool(true), + NotifySwitches: types.NewBool(true), + RollingOrder: types.NewBool(false), + FailureCriteria: &types.HostNicFailureCriteria{ + CheckSpeed: "minimum", + Speed: 10, + CheckDuplex: types.NewBool(false), + FullDuplex: types.NewBool(false), + CheckErrorPercent: types.NewBool(false), + Percentage: 0, + CheckBeacon: types.NewBool(false), + }, + NicOrder: &types.HostNicOrderPolicy{ + ActiveNic: []string{"vmnic0"}, + StandbyNic: nil, + }, + }, + OffloadPolicy: &types.HostNetOffloadCapabilities{ + CsumOffload: types.NewBool(true), + TcpSegmentation: types.NewBool(true), + ZeroCopyXmit: types.NewBool(true), + }, + ShapingPolicy: &types.HostNetworkTrafficShapingPolicy{ + Enabled: types.NewBool(false), + AverageBandwidth: 0, + PeakBandwidth: 0, + BurstSize: 0, + }, + }, + Spec: types.HostPortGroupSpec{ + Name: "Management Network", + VlanId: 0, + VswitchName: "vSwitch0", + Policy: types.HostNetworkPolicy{ + Security: &types.HostNetworkSecurityPolicy{}, + NicTeaming: &types.HostNicTeamingPolicy{ + Policy: "loadbalance_srcid", + ReversePolicy: (*bool)(nil), + NotifySwitches: types.NewBool(true), + RollingOrder: types.NewBool(false), + FailureCriteria: &types.HostNicFailureCriteria{ + CheckSpeed: "", + Speed: 0, + CheckDuplex: (*bool)(nil), + FullDuplex: (*bool)(nil), + CheckErrorPercent: (*bool)(nil), + Percentage: 0, + CheckBeacon: types.NewBool(false), + }, + NicOrder: &types.HostNicOrderPolicy{ + ActiveNic: []string{"vmnic0"}, + StandbyNic: nil, + }, + }, + OffloadPolicy: &types.HostNetOffloadCapabilities{}, + ShapingPolicy: &types.HostNetworkTrafficShapingPolicy{}, + }, + }, + }, + }, + Pnic: []types.PhysicalNic{ + { + Key: "key-vim.host.PhysicalNic-vmnic0", + Device: "vmnic0", + Pci: "0000:0b:00.0", + Driver: "nvmxnet3", + LinkSpeed: &types.PhysicalNicLinkInfo{ + SpeedMb: 10000, + Duplex: true, + }, + ValidLinkSpecification: []types.PhysicalNicLinkInfo{ + { + SpeedMb: 10000, + Duplex: true, + }, + }, + Spec: types.PhysicalNicSpec{ + Ip: &types.HostIpConfig{}, + LinkSpeed: &types.PhysicalNicLinkInfo{ + SpeedMb: 10000, + Duplex: true, + }, + }, + WakeOnLanSupported: false, + Mac: "00:0c:29:81:d8:a0", + FcoeConfiguration: &types.FcoeConfig{ + PriorityClass: 3, + SourceMac: "00:0c:29:81:d8:a0", + VlanRange: []types.FcoeConfigVlanRange{ + {}, + }, + Capabilities: types.FcoeConfigFcoeCapabilities{ + PriorityClass: false, + SourceMacAddress: false, + VlanRange: true, + }, + FcoeActive: false, + }, + VmDirectPathGen2Supported: types.NewBool(false), + VmDirectPathGen2SupportedMode: "", + ResourcePoolSchedulerAllowed: types.NewBool(true), + ResourcePoolSchedulerDisallowedReason: nil, + AutoNegotiateSupported: types.NewBool(false), + }, + { + Key: "key-vim.host.PhysicalNic-vmnic1", + Device: "vmnic1", + Pci: "0000:13:00.0", + Driver: "nvmxnet3", + LinkSpeed: &types.PhysicalNicLinkInfo{ + SpeedMb: 10000, + Duplex: true, + }, + ValidLinkSpecification: []types.PhysicalNicLinkInfo{ + { + SpeedMb: 10000, + Duplex: true, + }, + }, + Spec: types.PhysicalNicSpec{ + Ip: &types.HostIpConfig{}, + LinkSpeed: &types.PhysicalNicLinkInfo{ + SpeedMb: 10000, + Duplex: true, + }, + }, + WakeOnLanSupported: false, + Mac: "00:0c:29:81:d8:aa", + FcoeConfiguration: &types.FcoeConfig{ + PriorityClass: 3, + SourceMac: "00:0c:29:81:d8:aa", + VlanRange: []types.FcoeConfigVlanRange{ + {}, + }, + Capabilities: types.FcoeConfigFcoeCapabilities{ + PriorityClass: false, + SourceMacAddress: false, + VlanRange: true, + }, + FcoeActive: false, + }, + VmDirectPathGen2Supported: types.NewBool(false), + VmDirectPathGen2SupportedMode: "", + ResourcePoolSchedulerAllowed: types.NewBool(true), + ResourcePoolSchedulerDisallowedReason: nil, + AutoNegotiateSupported: types.NewBool(false), + }, + }, + Vnic: []types.HostVirtualNic{ + { + Device: "vmk0", + Key: "key-vim.host.VirtualNic-vmk0", + Portgroup: "Management Network", + Spec: types.HostVirtualNicSpec{ + Ip: &types.HostIpConfig{ + Dhcp: true, + IpAddress: "127.0.0.1", + SubnetMask: "255.0.0.0", + IpV6Config: (*types.HostIpConfigIpV6AddressConfiguration)(nil), + }, + Mac: "00:0c:29:81:d8:a0", + DistributedVirtualPort: (*types.DistributedVirtualSwitchPortConnection)(nil), + Portgroup: "Management Network", + Mtu: 1500, + TsoEnabled: types.NewBool(true), + NetStackInstanceKey: "defaultTcpipStack", + OpaqueNetwork: (*types.HostVirtualNicOpaqueNetworkSpec)(nil), + ExternalId: "", + PinnedPnic: "", + IpRouteSpec: (*types.HostVirtualNicIpRouteSpec)(nil), + }, + Port: "key-vim.host.PortGroup.Port-33554436", + }, + }, + ConsoleVnic: nil, + DnsConfig: &types.HostDnsConfig{ + Dhcp: true, + VirtualNicDevice: "vmk0", + HostName: "localhost", + DomainName: "localdomain", + Address: []string{"8.8.8.8"}, + SearchDomain: []string{"localdomain"}, + }, + IpRouteConfig: &types.HostIpRouteConfig{ + DefaultGateway: "127.0.0.1", + GatewayDevice: "", + IpV6DefaultGateway: "", + IpV6GatewayDevice: "", + }, + ConsoleIpRouteConfig: nil, + RouteTableInfo: &types.HostIpRouteTableInfo{ + IpRoute: []types.HostIpRouteEntry{ + { + Network: "0.0.0.0", + PrefixLength: 0, + Gateway: "127.0.0.1", + DeviceName: "vmk0", + }, + { + Network: "127.0.0.0", + PrefixLength: 8, + Gateway: "0.0.0.0", + DeviceName: "vmk0", + }, + }, + Ipv6Route: nil, + }, + Dhcp: nil, + Nat: nil, + IpV6Enabled: types.NewBool(false), + AtBootIpV6Enabled: types.NewBool(false), + NetStackInstance: []types.HostNetStackInstance{ + { + Key: "vSphereProvisioning", + Name: "", + DnsConfig: &types.HostDnsConfig{}, + IpRouteConfig: &types.HostIpRouteConfig{}, + RequestedMaxNumberOfConnections: 11000, + CongestionControlAlgorithm: "newreno", + IpV6Enabled: types.NewBool(true), + RouteTableConfig: (*types.HostIpRouteTableConfig)(nil), + }, + { + Key: "vmotion", + Name: "", + DnsConfig: &types.HostDnsConfig{}, + IpRouteConfig: &types.HostIpRouteConfig{}, + RequestedMaxNumberOfConnections: 11000, + CongestionControlAlgorithm: "newreno", + IpV6Enabled: types.NewBool(true), + RouteTableConfig: (*types.HostIpRouteTableConfig)(nil), + }, + { + Key: "defaultTcpipStack", + Name: "defaultTcpipStack", + DnsConfig: &types.HostDnsConfig{ + Dhcp: true, + VirtualNicDevice: "vmk0", + HostName: "localhost", + DomainName: "localdomain", + Address: []string{"8.8.8.8"}, + SearchDomain: []string{"localdomain"}, + }, + IpRouteConfig: &types.HostIpRouteConfig{ + DefaultGateway: "127.0.0.1", + GatewayDevice: "", + IpV6DefaultGateway: "", + IpV6GatewayDevice: "", + }, + RequestedMaxNumberOfConnections: 11000, + CongestionControlAlgorithm: "newreno", + IpV6Enabled: types.NewBool(true), + RouteTableConfig: &types.HostIpRouteTableConfig{ + IpRoute: []types.HostIpRouteOp{ + { + ChangeOperation: "ignore", + Route: types.HostIpRouteEntry{ + Network: "0.0.0.0", + PrefixLength: 0, + Gateway: "127.0.0.1", + DeviceName: "vmk0", + }, + }, + { + ChangeOperation: "ignore", + Route: types.HostIpRouteEntry{ + Network: "127.0.0.0", + PrefixLength: 8, + Gateway: "0.0.0.0", + DeviceName: "vmk0", + }, + }, + }, + Ipv6Route: nil, + }, + }, + }, + OpaqueSwitch: nil, + OpaqueNetwork: nil, + }, + Vmotion: &types.HostVMotionInfo{ + NetConfig: &types.HostVMotionNetConfig{ + CandidateVnic: []types.HostVirtualNic{ + { + Device: "vmk0", + Key: "VMotionConfig.vmotion.key-vim.host.VirtualNic-vmk0", + Portgroup: "Management Network", + Spec: types.HostVirtualNicSpec{ + Ip: &types.HostIpConfig{ + Dhcp: true, + IpAddress: "127.0.0.1", + SubnetMask: "255.0.0.0", + IpV6Config: (*types.HostIpConfigIpV6AddressConfiguration)(nil), + }, + Mac: "00:0c:29:81:d8:a0", + DistributedVirtualPort: (*types.DistributedVirtualSwitchPortConnection)(nil), + Portgroup: "Management Network", + Mtu: 1500, + TsoEnabled: types.NewBool(true), + NetStackInstanceKey: "defaultTcpipStack", + OpaqueNetwork: (*types.HostVirtualNicOpaqueNetworkSpec)(nil), + ExternalId: "", + PinnedPnic: "", + IpRouteSpec: (*types.HostVirtualNicIpRouteSpec)(nil), + }, + Port: "", + }, + }, + SelectedVnic: "", + }, + IpConfig: (*types.HostIpConfig)(nil), + }, + VirtualNicManagerInfo: &types.HostVirtualNicManagerInfo{ + NetConfig: []types.VirtualNicManagerNetConfig{ + { + NicType: "faultToleranceLogging", + MultiSelectAllowed: true, + CandidateVnic: []types.HostVirtualNic{ + { + Device: "vmk0", + Key: "faultToleranceLogging.key-vim.host.VirtualNic-vmk0", + Portgroup: "Management Network", + Spec: types.HostVirtualNicSpec{ + Ip: &types.HostIpConfig{ + Dhcp: true, + IpAddress: "127.0.0.1", + SubnetMask: "255.0.0.0", + IpV6Config: (*types.HostIpConfigIpV6AddressConfiguration)(nil), + }, + Mac: "00:0c:29:81:d8:a0", + DistributedVirtualPort: (*types.DistributedVirtualSwitchPortConnection)(nil), + Portgroup: "Management Network", + Mtu: 1500, + TsoEnabled: types.NewBool(true), + NetStackInstanceKey: "defaultTcpipStack", + OpaqueNetwork: (*types.HostVirtualNicOpaqueNetworkSpec)(nil), + ExternalId: "", + PinnedPnic: "", + IpRouteSpec: (*types.HostVirtualNicIpRouteSpec)(nil), + }, + Port: "", + }, + }, + SelectedVnic: nil, + }, + { + NicType: "management", + MultiSelectAllowed: true, + CandidateVnic: []types.HostVirtualNic{ + { + Device: "vmk0", + Key: "management.key-vim.host.VirtualNic-vmk0", + Portgroup: "Management Network", + Spec: types.HostVirtualNicSpec{ + Ip: &types.HostIpConfig{ + Dhcp: true, + IpAddress: "127.0.0.1", + SubnetMask: "255.0.0.0", + IpV6Config: (*types.HostIpConfigIpV6AddressConfiguration)(nil), + }, + Mac: "00:0c:29:81:d8:a0", + DistributedVirtualPort: (*types.DistributedVirtualSwitchPortConnection)(nil), + Portgroup: "Management Network", + Mtu: 1500, + TsoEnabled: types.NewBool(true), + NetStackInstanceKey: "defaultTcpipStack", + OpaqueNetwork: (*types.HostVirtualNicOpaqueNetworkSpec)(nil), + ExternalId: "", + PinnedPnic: "", + IpRouteSpec: (*types.HostVirtualNicIpRouteSpec)(nil), + }, + Port: "", + }, + }, + SelectedVnic: []string{"management.key-vim.host.VirtualNic-vmk0"}, + }, + { + NicType: "vSphereProvisioning", + MultiSelectAllowed: true, + CandidateVnic: []types.HostVirtualNic{ + { + Device: "vmk0", + Key: "vSphereProvisioning.key-vim.host.VirtualNic-vmk0", + Portgroup: "Management Network", + Spec: types.HostVirtualNicSpec{ + Ip: &types.HostIpConfig{ + Dhcp: true, + IpAddress: "127.0.0.1", + SubnetMask: "255.0.0.0", + IpV6Config: (*types.HostIpConfigIpV6AddressConfiguration)(nil), + }, + Mac: "00:0c:29:81:d8:a0", + DistributedVirtualPort: (*types.DistributedVirtualSwitchPortConnection)(nil), + Portgroup: "Management Network", + Mtu: 1500, + TsoEnabled: types.NewBool(true), + NetStackInstanceKey: "defaultTcpipStack", + OpaqueNetwork: (*types.HostVirtualNicOpaqueNetworkSpec)(nil), + ExternalId: "", + PinnedPnic: "", + IpRouteSpec: (*types.HostVirtualNicIpRouteSpec)(nil), + }, + Port: "", + }, + }, + SelectedVnic: nil, + }, + { + NicType: "vSphereReplication", + MultiSelectAllowed: true, + CandidateVnic: []types.HostVirtualNic{ + { + Device: "vmk0", + Key: "vSphereReplication.key-vim.host.VirtualNic-vmk0", + Portgroup: "Management Network", + Spec: types.HostVirtualNicSpec{ + Ip: &types.HostIpConfig{ + Dhcp: true, + IpAddress: "127.0.0.1", + SubnetMask: "255.0.0.0", + IpV6Config: (*types.HostIpConfigIpV6AddressConfiguration)(nil), + }, + Mac: "00:0c:29:81:d8:a0", + DistributedVirtualPort: (*types.DistributedVirtualSwitchPortConnection)(nil), + Portgroup: "Management Network", + Mtu: 1500, + TsoEnabled: types.NewBool(true), + NetStackInstanceKey: "defaultTcpipStack", + OpaqueNetwork: (*types.HostVirtualNicOpaqueNetworkSpec)(nil), + ExternalId: "", + PinnedPnic: "", + IpRouteSpec: (*types.HostVirtualNicIpRouteSpec)(nil), + }, + Port: "", + }, + }, + SelectedVnic: nil, + }, + { + NicType: "vSphereReplicationNFC", + MultiSelectAllowed: true, + CandidateVnic: []types.HostVirtualNic{ + { + Device: "vmk0", + Key: "vSphereReplicationNFC.key-vim.host.VirtualNic-vmk0", + Portgroup: "Management Network", + Spec: types.HostVirtualNicSpec{ + Ip: &types.HostIpConfig{ + Dhcp: true, + IpAddress: "127.0.0.1", + SubnetMask: "255.0.0.0", + IpV6Config: (*types.HostIpConfigIpV6AddressConfiguration)(nil), + }, + Mac: "00:0c:29:81:d8:a0", + DistributedVirtualPort: (*types.DistributedVirtualSwitchPortConnection)(nil), + Portgroup: "Management Network", + Mtu: 1500, + TsoEnabled: types.NewBool(true), + NetStackInstanceKey: "defaultTcpipStack", + OpaqueNetwork: (*types.HostVirtualNicOpaqueNetworkSpec)(nil), + ExternalId: "", + PinnedPnic: "", + IpRouteSpec: (*types.HostVirtualNicIpRouteSpec)(nil), + }, + Port: "", + }, + }, + SelectedVnic: nil, + }, + { + NicType: "vmotion", + MultiSelectAllowed: true, + CandidateVnic: []types.HostVirtualNic{ + { + Device: "vmk0", + Key: "vmotion.key-vim.host.VirtualNic-vmk0", + Portgroup: "Management Network", + Spec: types.HostVirtualNicSpec{ + Ip: &types.HostIpConfig{ + Dhcp: true, + IpAddress: "127.0.0.1", + SubnetMask: "255.0.0.0", + IpV6Config: (*types.HostIpConfigIpV6AddressConfiguration)(nil), + }, + Mac: "00:0c:29:81:d8:a0", + DistributedVirtualPort: (*types.DistributedVirtualSwitchPortConnection)(nil), + Portgroup: "Management Network", + Mtu: 1500, + TsoEnabled: types.NewBool(true), + NetStackInstanceKey: "defaultTcpipStack", + OpaqueNetwork: (*types.HostVirtualNicOpaqueNetworkSpec)(nil), + ExternalId: "", + PinnedPnic: "", + IpRouteSpec: (*types.HostVirtualNicIpRouteSpec)(nil), + }, + Port: "", + }, + }, + SelectedVnic: nil, + }, + { + NicType: "vsan", + MultiSelectAllowed: true, + CandidateVnic: []types.HostVirtualNic{ + { + Device: "vmk0", + Key: "vsan.key-vim.host.VirtualNic-vmk0", + Portgroup: "Management Network", + Spec: types.HostVirtualNicSpec{ + Ip: &types.HostIpConfig{ + Dhcp: true, + IpAddress: "127.0.0.1", + SubnetMask: "255.0.0.0", + IpV6Config: (*types.HostIpConfigIpV6AddressConfiguration)(nil), + }, + Mac: "00:0c:29:81:d8:a0", + DistributedVirtualPort: (*types.DistributedVirtualSwitchPortConnection)(nil), + Portgroup: "Management Network", + Mtu: 1500, + TsoEnabled: types.NewBool(true), + NetStackInstanceKey: "defaultTcpipStack", + OpaqueNetwork: (*types.HostVirtualNicOpaqueNetworkSpec)(nil), + ExternalId: "", + PinnedPnic: "", + IpRouteSpec: (*types.HostVirtualNicIpRouteSpec)(nil), + }, + Port: "", + }, + }, + SelectedVnic: nil, + }, + { + NicType: "vsanWitness", + MultiSelectAllowed: true, + CandidateVnic: []types.HostVirtualNic{ + { + Device: "vmk0", + Key: "vsanWitness.key-vim.host.VirtualNic-vmk0", + Portgroup: "Management Network", + Spec: types.HostVirtualNicSpec{ + Ip: &types.HostIpConfig{ + Dhcp: true, + IpAddress: "127.0.0.1", + SubnetMask: "255.0.0.0", + IpV6Config: (*types.HostIpConfigIpV6AddressConfiguration)(nil), + }, + Mac: "00:0c:29:81:d8:a0", + DistributedVirtualPort: (*types.DistributedVirtualSwitchPortConnection)(nil), + Portgroup: "Management Network", + Mtu: 1500, + TsoEnabled: types.NewBool(true), + NetStackInstanceKey: "defaultTcpipStack", + OpaqueNetwork: (*types.HostVirtualNicOpaqueNetworkSpec)(nil), + ExternalId: "", + PinnedPnic: "", + IpRouteSpec: (*types.HostVirtualNicIpRouteSpec)(nil), + }, + Port: "", + }, + }, + SelectedVnic: nil, + }, + }, + }, + Capabilities: &types.HostNetCapabilities{ + CanSetPhysicalNicLinkSpeed: true, + SupportsNicTeaming: true, + NicTeamingPolicy: []string{"loadbalance_ip", "loadbalance_srcmac", "loadbalance_srcid", "failover_explicit"}, + SupportsVlan: true, + UsesServiceConsoleNic: false, + SupportsNetworkHints: true, + MaxPortGroupsPerVswitch: 0, + VswitchConfigSupported: true, + VnicConfigSupported: true, + IpRouteConfigSupported: true, + DnsConfigSupported: true, + DhcpOnVnicSupported: true, + IpV6Supported: types.NewBool(true), + }, + DatastoreCapabilities: &types.HostDatastoreSystemCapabilities{ + NfsMountCreationRequired: true, + NfsMountCreationSupported: true, + LocalDatastoreSupported: false, + VmfsExtentExpansionSupported: types.NewBool(true), + }, + OffloadCapabilities: &types.HostNetOffloadCapabilities{ + CsumOffload: types.NewBool(true), + TcpSegmentation: types.NewBool(true), + ZeroCopyXmit: types.NewBool(true), + }, + Service: &types.HostServiceInfo{ + Service: []types.HostService{ + { + Key: "DCUI", + Label: "Direct Console UI", + Required: false, + Uninstallable: false, + Running: true, + Ruleset: nil, + Policy: "on", + SourcePackage: &types.HostServiceSourcePackage{ + SourcePackageName: "esx-base", + Description: "This VIB contains all of the base functionality of vSphere ESXi.", + }, + }, + { + Key: "TSM", + Label: "ESXi Shell", + Required: false, + Uninstallable: false, + Running: false, + Ruleset: nil, + Policy: "off", + SourcePackage: &types.HostServiceSourcePackage{ + SourcePackageName: "esx-base", + Description: "This VIB contains all of the base functionality of vSphere ESXi.", + }, + }, + { + Key: "TSM-SSH", + Label: "SSH", + Required: false, + Uninstallable: false, + Running: false, + Ruleset: nil, + Policy: "off", + SourcePackage: &types.HostServiceSourcePackage{ + SourcePackageName: "esx-base", + Description: "This VIB contains all of the base functionality of vSphere ESXi.", + }, + }, + { + Key: "lbtd", + Label: "Load-Based Teaming Daemon", + Required: false, + Uninstallable: false, + Running: true, + Ruleset: nil, + Policy: "on", + SourcePackage: &types.HostServiceSourcePackage{ + SourcePackageName: "esx-base", + Description: "This VIB contains all of the base functionality of vSphere ESXi.", + }, + }, + { + Key: "lwsmd", + Label: "Active Directory Service", + Required: false, + Uninstallable: false, + Running: false, + Ruleset: nil, + Policy: "off", + SourcePackage: &types.HostServiceSourcePackage{ + SourcePackageName: "esx-base", + Description: "This VIB contains all of the base functionality of vSphere ESXi.", + }, + }, + { + Key: "ntpd", + Label: "NTP Daemon", + Required: false, + Uninstallable: false, + Running: false, + Ruleset: []string{"ntpClient"}, + Policy: "off", + SourcePackage: &types.HostServiceSourcePackage{ + SourcePackageName: "esx-base", + Description: "This VIB contains all of the base functionality of vSphere ESXi.", + }, + }, + { + Key: "pcscd", + Label: "PC/SC Smart Card Daemon", + Required: false, + Uninstallable: false, + Running: false, + Ruleset: nil, + Policy: "off", + SourcePackage: &types.HostServiceSourcePackage{ + SourcePackageName: "esx-base", + Description: "This VIB contains all of the base functionality of vSphere ESXi.", + }, + }, + { + Key: "sfcbd-watchdog", + Label: "CIM Server", + Required: false, + Uninstallable: false, + Running: false, + Ruleset: []string{"CIMHttpServer", "CIMHttpsServer"}, + Policy: "on", + SourcePackage: &types.HostServiceSourcePackage{ + SourcePackageName: "esx-base", + Description: "This VIB contains all of the base functionality of vSphere ESXi.", + }, + }, + { + Key: "snmpd", + Label: "SNMP Server", + Required: false, + Uninstallable: false, + Running: false, + Ruleset: []string{"snmp"}, + Policy: "on", + SourcePackage: &types.HostServiceSourcePackage{ + SourcePackageName: "esx-base", + Description: "This VIB contains all of the base functionality of vSphere ESXi.", + }, + }, + { + Key: "vmsyslogd", + Label: "Syslog Server", + Required: true, + Uninstallable: false, + Running: true, + Ruleset: nil, + Policy: "on", + SourcePackage: &types.HostServiceSourcePackage{ + SourcePackageName: "esx-base", + Description: "This VIB contains all of the base functionality of vSphere ESXi.", + }, + }, + { + Key: "vpxa", + Label: "VMware vCenter Agent", + Required: false, + Uninstallable: false, + Running: false, + Ruleset: []string{"vpxHeartbeats"}, + Policy: "on", + SourcePackage: &types.HostServiceSourcePackage{ + SourcePackageName: "esx-base", + Description: "This VIB contains all of the base functionality of vSphere ESXi.", + }, + }, + { + Key: "xorg", + Label: "X.Org Server", + Required: false, + Uninstallable: false, + Running: false, + Ruleset: nil, + Policy: "on", + SourcePackage: &types.HostServiceSourcePackage{ + SourcePackageName: "esx-xserver", + Description: "This VIB contains X Server used for virtual machine 3D hardware acceleration.", + }, + }, + }, + }, + Firewall: &HostFirewallInfo, + AutoStart: &types.HostAutoStartManagerConfig{ + Defaults: &types.AutoStartDefaults{ + Enabled: (*bool)(nil), + StartDelay: 120, + StopDelay: 120, + WaitForHeartbeat: types.NewBool(false), + StopAction: "PowerOff", + }, + PowerInfo: nil, + }, + ActiveDiagnosticPartition: &types.HostDiagnosticPartition{ + StorageType: "directAttached", + DiagnosticType: "singleHost", + Slots: -15, + Id: types.HostScsiDiskPartition{ + DiskName: "mpx.vmhba0:C0:T0:L0", + Partition: 9, + }, + }, + Option: nil, + OptionDef: nil, + Flags: &types.HostFlagInfo{}, + AdminDisabled: (*bool)(nil), + LockdownMode: "lockdownDisabled", + Ipmi: (*types.HostIpmiInfo)(nil), + SslThumbprintInfo: (*types.HostSslThumbprintInfo)(nil), + SslThumbprintData: nil, + Certificate: []uint8{0x31, 0x30}, + PciPassthruInfo: nil, + AuthenticationManagerInfo: &types.HostAuthenticationManagerInfo{ + AuthConfig: []types.BaseHostAuthenticationStoreInfo{ + &types.HostLocalAuthenticationInfo{ + HostAuthenticationStoreInfo: types.HostAuthenticationStoreInfo{ + Enabled: true, + }, + }, + &types.HostActiveDirectoryInfo{ + HostDirectoryStoreInfo: types.HostDirectoryStoreInfo{}, + JoinedDomain: "", + TrustedDomain: nil, + DomainMembershipStatus: "", + SmartCardAuthenticationEnabled: types.NewBool(false), + }, + }, + }, + FeatureVersion: nil, + PowerSystemCapability: &types.PowerSystemCapability{ + AvailablePolicy: []types.HostPowerPolicy{ + { + Key: 1, + Name: "PowerPolicy.static.name", + ShortName: "static", + Description: "PowerPolicy.static.description", + }, + { + Key: 2, + Name: "PowerPolicy.dynamic.name", + ShortName: "dynamic", + Description: "PowerPolicy.dynamic.description", + }, + { + Key: 3, + Name: "PowerPolicy.low.name", + ShortName: "low", + Description: "PowerPolicy.low.description", + }, + { + Key: 4, + Name: "PowerPolicy.custom.name", + ShortName: "custom", + Description: "PowerPolicy.custom.description", + }, + }, + }, + PowerSystemInfo: &types.PowerSystemInfo{ + CurrentPolicy: types.HostPowerPolicy{ + Key: 2, + Name: "PowerPolicy.dynamic.name", + ShortName: "dynamic", + Description: "PowerPolicy.dynamic.description", + }, + }, + CacheConfigurationInfo: []types.HostCacheConfigurationInfo{ + { + Key: types.ManagedObjectReference{Type: "Datastore", Value: "5980f676-21a5db76-9eef-000c2981d8a0"}, + SwapSize: 0, + }, + }, + WakeOnLanCapable: types.NewBool(false), + FeatureCapability: nil, + MaskedFeatureCapability: nil, + VFlashConfigInfo: nil, + VsanHostConfig: &types.VsanHostConfigInfo{ + Enabled: types.NewBool(false), + HostSystem: &types.ManagedObjectReference{Type: "HostSystem", Value: "ha-host"}, + ClusterInfo: &types.VsanHostConfigInfoClusterInfo{}, + StorageInfo: &types.VsanHostConfigInfoStorageInfo{ + AutoClaimStorage: types.NewBool(false), + DiskMapping: nil, + DiskMapInfo: nil, + ChecksumEnabled: (*bool)(nil), + }, + NetworkInfo: &types.VsanHostConfigInfoNetworkInfo{}, + FaultDomainInfo: &types.VsanHostFaultDomainInfo{}, + }, + DomainList: nil, + ScriptCheckSum: nil, + HostConfigCheckSum: nil, + GraphicsInfo: nil, + SharedPassthruGpuTypes: nil, + GraphicsConfig: &types.HostGraphicsConfig{ + HostDefaultGraphicsType: "shared", + SharedPassthruAssignmentPolicy: "performance", + DeviceType: nil, + }, + IoFilterInfo: []types.HostIoFilterInfo{ + { + IoFilterInfo: types.IoFilterInfo{ + Id: "VMW_spm_1.0.0", + Name: "spm", + Vendor: "VMW", + Version: "1.0.230", + Type: "datastoreIoControl", + Summary: "VMware Storage I/O Control", + ReleaseDate: "2016-07-21", + }, + Available: true, + }, + { + IoFilterInfo: types.IoFilterInfo{ + Id: "VMW_vmwarevmcrypt_1.0.0", + Name: "vmwarevmcrypt", + Vendor: "VMW", + Version: "1.0.0", + Type: "encryption", + Summary: "VMcrypt IO Filter", + ReleaseDate: "2016-07-21", + }, + Available: true, + }, + }, + SriovDevicePool: nil, +} diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/host_firewall_system.go b/vendor/github.com/vmware/govmomi/simulator/esx/host_firewall_system.go new file mode 100644 index 00000000000..11c1285aad7 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/esx/host_firewall_system.go @@ -0,0 +1,1425 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 esx + +import "github.com/vmware/govmomi/vim25/types" + +// HostFirewallInfo is the default template for the HostSystem config.firewall property. +// Capture method: +// govc object.collect -s -dump HostSystem:ha-host config.firewall +var HostFirewallInfo = types.HostFirewallInfo{ + DynamicData: types.DynamicData{}, + DefaultPolicy: types.HostFirewallDefaultPolicy{ + DynamicData: types.DynamicData{}, + IncomingBlocked: types.NewBool(true), + OutgoingBlocked: types.NewBool(true), + }, + Ruleset: []types.HostFirewallRuleset{ + { + DynamicData: types.DynamicData{}, + Key: "CIMHttpServer", + Label: "CIM Server", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 5988, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "sfcbd-watchdog", + Enabled: true, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "CIMHttpsServer", + Label: "CIM Secure Server", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 5989, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "sfcbd-watchdog", + Enabled: true, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "CIMSLP", + Label: "CIM SLP", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 427, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "udp", + }, + { + DynamicData: types.DynamicData{}, + Port: 427, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "udp", + }, + { + DynamicData: types.DynamicData{}, + Port: 427, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "tcp", + }, + { + DynamicData: types.DynamicData{}, + Port: 427, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: true, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "DHCPv6", + Label: "DHCPv6", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 547, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + { + DynamicData: types.DynamicData{}, + Port: 546, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "tcp", + }, + { + DynamicData: types.DynamicData{}, + Port: 547, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "udp", + }, + { + DynamicData: types.DynamicData{}, + Port: 546, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "udp", + }, + }, + Service: "", + Enabled: true, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "DVFilter", + Label: "DVFilter", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 2222, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: false, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "DVSSync", + Label: "DVSSync", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 8302, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "udp", + }, + { + DynamicData: types.DynamicData{}, + Port: 8301, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "udp", + }, + { + DynamicData: types.DynamicData{}, + Port: 8301, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "udp", + }, + { + DynamicData: types.DynamicData{}, + Port: 8302, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "udp", + }, + }, + Service: "", + Enabled: true, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "HBR", + Label: "HBR", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 31031, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + { + DynamicData: types.DynamicData{}, + Port: 44046, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: true, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "NFC", + Label: "NFC", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 902, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "tcp", + }, + { + DynamicData: types.DynamicData{}, + Port: 902, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: true, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "WOL", + Label: "WOL", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 9, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "udp", + }, + }, + Service: "", + Enabled: true, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "activeDirectoryAll", + Label: "Active Directory All", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 88, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "udp", + }, + { + DynamicData: types.DynamicData{}, + Port: 88, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + { + DynamicData: types.DynamicData{}, + Port: 123, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "udp", + }, + { + DynamicData: types.DynamicData{}, + Port: 137, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "udp", + }, + { + DynamicData: types.DynamicData{}, + Port: 139, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + { + DynamicData: types.DynamicData{}, + Port: 389, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + { + DynamicData: types.DynamicData{}, + Port: 389, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "udp", + }, + { + DynamicData: types.DynamicData{}, + Port: 445, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + { + DynamicData: types.DynamicData{}, + Port: 464, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "udp", + }, + { + DynamicData: types.DynamicData{}, + Port: 464, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + { + DynamicData: types.DynamicData{}, + Port: 3268, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + { + DynamicData: types.DynamicData{}, + Port: 7476, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + { + DynamicData: types.DynamicData{}, + Port: 2020, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: false, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "cmmds", + Label: "Virtual SAN Clustering Service", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 12345, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "udp", + }, + { + DynamicData: types.DynamicData{}, + Port: 23451, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "udp", + }, + { + DynamicData: types.DynamicData{}, + Port: 12345, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "udp", + }, + { + DynamicData: types.DynamicData{}, + Port: 23451, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "udp", + }, + { + DynamicData: types.DynamicData{}, + Port: 12321, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "udp", + }, + { + DynamicData: types.DynamicData{}, + Port: 12321, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "udp", + }, + }, + Service: "", + Enabled: false, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "dhcp", + Label: "DHCP Client", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 68, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "udp", + }, + { + DynamicData: types.DynamicData{}, + Port: 68, + EndPort: 0, + Direction: "outbound", + PortType: "src", + Protocol: "udp", + }, + }, + Service: "", + Enabled: true, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "dns", + Label: "DNS Client", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 53, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "udp", + }, + { + DynamicData: types.DynamicData{}, + Port: 53, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "udp", + }, + { + DynamicData: types.DynamicData{}, + Port: 53, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: true, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "esxupdate", + Label: "esxupdate", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 443, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: false, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "faultTolerance", + Label: "Fault Tolerance", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 80, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + { + DynamicData: types.DynamicData{}, + Port: 8300, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "tcp", + }, + { + DynamicData: types.DynamicData{}, + Port: 8300, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: true, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "ftpClient", + Label: "FTP Client", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 21, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + { + DynamicData: types.DynamicData{}, + Port: 20, + EndPort: 0, + Direction: "inbound", + PortType: "src", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: false, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "gdbserver", + Label: "gdbserver", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 1000, + EndPort: 9999, + Direction: "inbound", + PortType: "dst", + Protocol: "tcp", + }, + { + DynamicData: types.DynamicData{}, + Port: 50000, + EndPort: 50999, + Direction: "inbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: false, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "httpClient", + Label: "httpClient", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 80, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + { + DynamicData: types.DynamicData{}, + Port: 443, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: false, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "iSCSI", + Label: "Software iSCSI Client", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 3260, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: false, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "iofiltervp", + Label: "iofiltervp", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 9080, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: true, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "ipfam", + Label: "NSX Distributed Logical Router Service", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 6999, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "udp", + }, + { + DynamicData: types.DynamicData{}, + Port: 6999, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "udp", + }, + }, + Service: "", + Enabled: false, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "nfs41Client", + Label: "nfs41Client", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 0, + EndPort: 65535, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: false, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "nfsClient", + Label: "NFS Client", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 0, + EndPort: 65535, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: false, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "ntpClient", + Label: "NTP Client", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 123, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "udp", + }, + }, + Service: "ntpd", + Enabled: false, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "pvrdma", + Label: "pvrdma", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 28250, + EndPort: 28761, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + { + DynamicData: types.DynamicData{}, + Port: 28250, + EndPort: 28761, + Direction: "inbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: false, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "rabbitmqproxy", + Label: "rabbitmqproxy", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 5671, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: true, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "rdt", + Label: "Virtual SAN Transport", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 2233, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "tcp", + }, + { + DynamicData: types.DynamicData{}, + Port: 2233, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: false, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "remoteSerialPort", + Label: "VM serial port connected over network", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 0, + EndPort: 65535, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + { + DynamicData: types.DynamicData{}, + Port: 23, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "tcp", + }, + { + DynamicData: types.DynamicData{}, + Port: 1024, + EndPort: 65535, + Direction: "inbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: false, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "snmp", + Label: "SNMP Server", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 161, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "udp", + }, + }, + Service: "snmpd", + Enabled: true, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "sshClient", + Label: "SSH Client", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 22, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: false, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "sshServer", + Label: "SSH Server", + Required: true, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 22, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: true, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "syslog", + Label: "syslog", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 514, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "udp", + }, + { + DynamicData: types.DynamicData{}, + Port: 514, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + { + DynamicData: types.DynamicData{}, + Port: 1514, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: false, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "updateManager", + Label: "vCenter Update Manager", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 80, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + { + DynamicData: types.DynamicData{}, + Port: 9000, + EndPort: 9100, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: true, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "vMotion", + Label: "vMotion", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 8000, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "tcp", + }, + { + DynamicData: types.DynamicData{}, + Port: 8000, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: true, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "vSPC", + Label: "VM serial port connected to vSPC", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 0, + EndPort: 65535, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: false, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "vSphereClient", + Label: "vSphere Web Client", + Required: true, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 902, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "tcp", + }, + { + DynamicData: types.DynamicData{}, + Port: 443, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: true, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "vpxHeartbeats", + Label: "VMware vCenter Agent", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 902, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "udp", + }, + }, + Service: "vpxa", + Enabled: true, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "vsanEncryption", + Label: "vsanEncryption", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 0, + EndPort: 65535, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: false, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "vsanhealth-multicasttest", + Label: "vsanhealth-multicasttest", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 5001, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "udp", + }, + { + DynamicData: types.DynamicData{}, + Port: 5001, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "udp", + }, + }, + Service: "", + Enabled: false, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "vsanvp", + Label: "vsanvp", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 8080, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "tcp", + }, + { + DynamicData: types.DynamicData{}, + Port: 8080, + EndPort: 0, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: false, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "vvold", + Label: "vvold", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 0, + EndPort: 65535, + Direction: "outbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: false, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + { + DynamicData: types.DynamicData{}, + Key: "webAccess", + Label: "vSphere Web Access", + Required: false, + Rule: []types.HostFirewallRule{ + { + DynamicData: types.DynamicData{}, + Port: 80, + EndPort: 0, + Direction: "inbound", + PortType: "dst", + Protocol: "tcp", + }, + }, + Service: "", + Enabled: true, + AllowedHosts: &types.HostFirewallRulesetIpList{ + DynamicData: types.DynamicData{}, + IpAddress: nil, + IpNetwork: nil, + AllIp: true, + }, + }, + }, +} diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/host_hardware_info.go b/vendor/github.com/vmware/govmomi/simulator/esx/host_hardware_info.go new file mode 100644 index 00000000000..aa633ad34bd --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/esx/host_hardware_info.go @@ -0,0 +1,864 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 esx + +import ( + "time" + + "github.com/vmware/govmomi/vim25/types" +) + +// HostHardwareInfo is the default template for the HostSystem hardware property. +// Capture method: +// govc object.collect -s -dump HostSystem:ha-host hardware +var HostHardwareInfo = &types.HostHardwareInfo{ + SystemInfo: types.HostSystemInfo{ + Vendor: "VMware, Inc.", + Model: "VMware Virtual Platform", + Uuid: "e88d4d56-9f1e-3ea1-71fa-13a8e1a7fd70", + OtherIdentifyingInfo: []types.HostSystemIdentificationInfo{ + { + IdentifierValue: " No Asset Tag", + IdentifierType: &types.ElementDescription{ + Description: types.Description{ + Label: "Asset Tag", + Summary: "Asset tag of the system", + }, + Key: "AssetTag", + }, + }, + { + IdentifierValue: "[MS_VM_CERT/SHA1/27d66596a61c48dd3dc7216fd715126e33f59ae7]", + IdentifierType: &types.ElementDescription{ + Description: types.Description{ + Label: "OEM specific string", + Summary: "OEM specific string", + }, + Key: "OemSpecificString", + }, + }, + { + IdentifierValue: "Welcome to the Virtual Machine", + IdentifierType: &types.ElementDescription{ + Description: types.Description{ + Label: "OEM specific string", + Summary: "OEM specific string", + }, + Key: "OemSpecificString", + }, + }, + { + IdentifierValue: "VMware-56 4d 8d e8 1e 9f a1 3e-71 fa 13 a8 e1 a7 fd 70", + IdentifierType: &types.ElementDescription{ + Description: types.Description{ + Label: "Service tag", + Summary: "Service tag of the system", + }, + Key: "ServiceTag", + }, + }, + }, + }, + CpuPowerManagementInfo: &types.HostCpuPowerManagementInfo{ + CurrentPolicy: "Balanced", + HardwareSupport: "", + }, + CpuInfo: types.HostCpuInfo{ + NumCpuPackages: 2, + NumCpuCores: 2, + NumCpuThreads: 2, + Hz: 3591345000, + }, + CpuPkg: []types.HostCpuPackage{ + { + Index: 0, + Vendor: "intel", + Hz: 3591345000, + BusHz: 115849838, + Description: "Intel(R) Xeon(R) CPU E5-1620 0 @ 3.60GHz", + ThreadId: []int16{0}, + CpuFeature: []types.HostCpuIdInfo{ + { + Level: 0, + Vendor: "", + Eax: "0000:0000:0000:0000:0000:0000:0000:1101", + Ebx: "0111:0101:0110:1110:0110:0101:0100:0111", + Ecx: "0110:1100:0110:0101:0111:0100:0110:1110", + Edx: "0100:1001:0110:0101:0110:1110:0110:1001", + }, + { + Level: 1, + Vendor: "", + Eax: "0000:0000:0000:0010:0000:0110:1101:0111", + Ebx: "0000:0000:0000:0001:0000:1000:0000:0000", + Ecx: "1001:0111:1011:1010:0010:0010:0010:1011", + Edx: "0000:1111:1010:1011:1111:1011:1111:1111", + }, + { + Level: -2147483648, + Vendor: "", + Eax: "1000:0000:0000:0000:0000:0000:0000:1000", + Ebx: "0000:0000:0000:0000:0000:0000:0000:0000", + Ecx: "0000:0000:0000:0000:0000:0000:0000:0000", + Edx: "0000:0000:0000:0000:0000:0000:0000:0000", + }, + { + Level: -2147483647, + Vendor: "", + Eax: "0000:0000:0000:0000:0000:0000:0000:0000", + Ebx: "0000:0000:0000:0000:0000:0000:0000:0000", + Ecx: "0000:0000:0000:0000:0000:0000:0000:0001", + Edx: "0010:1000:0001:0000:0000:1000:0000:0000", + }, + { + Level: -2147483640, + Vendor: "", + Eax: "0000:0000:0000:0000:0011:0000:0010:1010", + Ebx: "0000:0000:0000:0000:0000:0000:0000:0000", + Ecx: "0000:0000:0000:0000:0000:0000:0000:0000", + Edx: "0000:0000:0000:0000:0000:0000:0000:0000", + }, + }, + }, + { + Index: 1, + Vendor: "intel", + Hz: 3591345000, + BusHz: 115849838, + Description: "Intel(R) Xeon(R) CPU E5-1620 0 @ 3.60GHz", + ThreadId: []int16{1}, + CpuFeature: []types.HostCpuIdInfo{ + { + Level: 0, + Vendor: "", + Eax: "0000:0000:0000:0000:0000:0000:0000:1101", + Ebx: "0111:0101:0110:1110:0110:0101:0100:0111", + Ecx: "0110:1100:0110:0101:0111:0100:0110:1110", + Edx: "0100:1001:0110:0101:0110:1110:0110:1001", + }, + { + Level: 1, + Vendor: "", + Eax: "0000:0000:0000:0010:0000:0110:1101:0111", + Ebx: "0000:0010:0000:0001:0000:1000:0000:0000", + Ecx: "1001:0111:1011:1010:0010:0010:0010:1011", + Edx: "0000:1111:1010:1011:1111:1011:1111:1111", + }, + { + Level: -2147483648, + Vendor: "", + Eax: "1000:0000:0000:0000:0000:0000:0000:1000", + Ebx: "0000:0000:0000:0000:0000:0000:0000:0000", + Ecx: "0000:0000:0000:0000:0000:0000:0000:0000", + Edx: "0000:0000:0000:0000:0000:0000:0000:0000", + }, + { + Level: -2147483647, + Vendor: "", + Eax: "0000:0000:0000:0000:0000:0000:0000:0000", + Ebx: "0000:0000:0000:0000:0000:0000:0000:0000", + Ecx: "0000:0000:0000:0000:0000:0000:0000:0001", + Edx: "0010:1000:0001:0000:0000:1000:0000:0000", + }, + { + Level: -2147483640, + Vendor: "", + Eax: "0000:0000:0000:0000:0011:0000:0010:1010", + Ebx: "0000:0000:0000:0000:0000:0000:0000:0000", + Ecx: "0000:0000:0000:0000:0000:0000:0000:0000", + Edx: "0000:0000:0000:0000:0000:0000:0000:0000", + }, + }, + }, + }, + MemorySize: 4294430720, + NumaInfo: &types.HostNumaInfo{ + Type: "NUMA", + NumNodes: 1, + NumaNode: []types.HostNumaNode{ + { + TypeId: 0x0, + CpuID: []int16{1, 0}, + MemoryRangeBegin: 4294967296, + MemoryRangeLength: 1073741824, + }, + }, + }, + SmcPresent: types.NewBool(false), + PciDevice: []types.HostPciDevice{ + { + Id: "0000:00:00.0", + ClassId: 1536, + Bus: 0x0, + Slot: 0x0, + Function: 0x0, + VendorId: -32634, + SubVendorId: 5549, + VendorName: "Intel Corporation", + DeviceId: 29072, + SubDeviceId: 6518, + ParentBridge: "", + DeviceName: "Virtual Machine Chipset", + }, + { + Id: "0000:00:01.0", + ClassId: 1540, + Bus: 0x0, + Slot: 0x1, + Function: 0x0, + VendorId: -32634, + SubVendorId: 0, + VendorName: "Intel Corporation", + DeviceId: 29073, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "440BX/ZX/DX - 82443BX/ZX/DX AGP bridge", + }, + { + Id: "0000:00:07.0", + ClassId: 1537, + Bus: 0x0, + Slot: 0x7, + Function: 0x0, + VendorId: -32634, + SubVendorId: 5549, + VendorName: "Intel Corporation", + DeviceId: 28944, + SubDeviceId: 6518, + ParentBridge: "", + DeviceName: "Virtual Machine Chipset", + }, + { + Id: "0000:00:07.1", + ClassId: 257, + Bus: 0x0, + Slot: 0x7, + Function: 0x1, + VendorId: -32634, + SubVendorId: 5549, + VendorName: "Intel Corporation", + DeviceId: 28945, + SubDeviceId: 6518, + ParentBridge: "", + DeviceName: "PIIX4 for 430TX/440BX/MX IDE Controller", + }, + { + Id: "0000:00:07.3", + ClassId: 1664, + Bus: 0x0, + Slot: 0x7, + Function: 0x3, + VendorId: -32634, + SubVendorId: 5549, + VendorName: "Intel Corporation", + DeviceId: 28947, + SubDeviceId: 6518, + ParentBridge: "", + DeviceName: "Virtual Machine Chipset", + }, + { + Id: "0000:00:07.7", + ClassId: 2176, + Bus: 0x0, + Slot: 0x7, + Function: 0x7, + VendorId: 5549, + SubVendorId: 5549, + VendorName: "VMware", + DeviceId: 1856, + SubDeviceId: 1856, + ParentBridge: "", + DeviceName: "Virtual Machine Communication Interface", + }, + { + Id: "0000:00:0f.0", + ClassId: 768, + Bus: 0x0, + Slot: 0xf, + Function: 0x0, + VendorId: 5549, + SubVendorId: 5549, + VendorName: "VMware", + DeviceId: 1029, + SubDeviceId: 1029, + ParentBridge: "", + DeviceName: "SVGA II Adapter", + }, + { + Id: "0000:00:11.0", + ClassId: 1540, + Bus: 0x0, + Slot: 0x11, + Function: 0x0, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1936, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI bridge", + }, + { + Id: "0000:00:15.0", + ClassId: 1540, + Bus: 0x0, + Slot: 0x15, + Function: 0x0, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:15.1", + ClassId: 1540, + Bus: 0x0, + Slot: 0x15, + Function: 0x1, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:15.2", + ClassId: 1540, + Bus: 0x0, + Slot: 0x15, + Function: 0x2, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:15.3", + ClassId: 1540, + Bus: 0x0, + Slot: 0x15, + Function: 0x3, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:15.4", + ClassId: 1540, + Bus: 0x0, + Slot: 0x15, + Function: 0x4, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:15.5", + ClassId: 1540, + Bus: 0x0, + Slot: 0x15, + Function: 0x5, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:15.6", + ClassId: 1540, + Bus: 0x0, + Slot: 0x15, + Function: 0x6, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:15.7", + ClassId: 1540, + Bus: 0x0, + Slot: 0x15, + Function: 0x7, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:16.0", + ClassId: 1540, + Bus: 0x0, + Slot: 0x16, + Function: 0x0, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:16.1", + ClassId: 1540, + Bus: 0x0, + Slot: 0x16, + Function: 0x1, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:16.2", + ClassId: 1540, + Bus: 0x0, + Slot: 0x16, + Function: 0x2, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:16.3", + ClassId: 1540, + Bus: 0x0, + Slot: 0x16, + Function: 0x3, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:16.4", + ClassId: 1540, + Bus: 0x0, + Slot: 0x16, + Function: 0x4, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:16.5", + ClassId: 1540, + Bus: 0x0, + Slot: 0x16, + Function: 0x5, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:16.6", + ClassId: 1540, + Bus: 0x0, + Slot: 0x16, + Function: 0x6, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:16.7", + ClassId: 1540, + Bus: 0x0, + Slot: 0x16, + Function: 0x7, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:17.0", + ClassId: 1540, + Bus: 0x0, + Slot: 0x17, + Function: 0x0, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:17.1", + ClassId: 1540, + Bus: 0x0, + Slot: 0x17, + Function: 0x1, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:17.2", + ClassId: 1540, + Bus: 0x0, + Slot: 0x17, + Function: 0x2, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:17.3", + ClassId: 1540, + Bus: 0x0, + Slot: 0x17, + Function: 0x3, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:17.4", + ClassId: 1540, + Bus: 0x0, + Slot: 0x17, + Function: 0x4, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:17.5", + ClassId: 1540, + Bus: 0x0, + Slot: 0x17, + Function: 0x5, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:17.6", + ClassId: 1540, + Bus: 0x0, + Slot: 0x17, + Function: 0x6, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:17.7", + ClassId: 1540, + Bus: 0x0, + Slot: 0x17, + Function: 0x7, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:18.0", + ClassId: 1540, + Bus: 0x0, + Slot: 0x18, + Function: 0x0, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:18.1", + ClassId: 1540, + Bus: 0x0, + Slot: 0x18, + Function: 0x1, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:18.2", + ClassId: 1540, + Bus: 0x0, + Slot: 0x18, + Function: 0x2, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:18.3", + ClassId: 1540, + Bus: 0x0, + Slot: 0x18, + Function: 0x3, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:18.4", + ClassId: 1540, + Bus: 0x0, + Slot: 0x18, + Function: 0x4, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:18.5", + ClassId: 1540, + Bus: 0x0, + Slot: 0x18, + Function: 0x5, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:18.6", + ClassId: 1540, + Bus: 0x0, + Slot: 0x18, + Function: 0x6, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:00:18.7", + ClassId: 1540, + Bus: 0x0, + Slot: 0x18, + Function: 0x7, + VendorId: 5549, + SubVendorId: 0, + VendorName: "VMware", + DeviceId: 1952, + SubDeviceId: 0, + ParentBridge: "", + DeviceName: "PCI Express Root Port", + }, + { + Id: "0000:03:00.0", + ClassId: 263, + Bus: 0x3, + Slot: 0x0, + Function: 0x0, + VendorId: 5549, + SubVendorId: 5549, + VendorName: "VMware", + DeviceId: 1984, + SubDeviceId: 1984, + ParentBridge: "0000:00:15.0", + DeviceName: "PVSCSI SCSI Controller", + }, + { + Id: "0000:0b:00.0", + ClassId: 512, + Bus: 0xb, + Slot: 0x0, + Function: 0x0, + VendorId: 5549, + SubVendorId: 5549, + VendorName: "VMware Inc.", + DeviceId: 1968, + SubDeviceId: 1968, + ParentBridge: "0000:00:16.0", + DeviceName: "vmxnet3 Virtual Ethernet Controller", + }, + { + Id: "0000:13:00.0", + ClassId: 512, + Bus: 0x13, + Slot: 0x0, + Function: 0x0, + VendorId: 5549, + SubVendorId: 5549, + VendorName: "VMware Inc.", + DeviceId: 1968, + SubDeviceId: 1968, + ParentBridge: "0000:00:17.0", + DeviceName: "vmxnet3 Virtual Ethernet Controller", + }, + }, + CpuFeature: []types.HostCpuIdInfo{ + { + Level: 0, + Vendor: "", + Eax: "0000:0000:0000:0000:0000:0000:0000:1101", + Ebx: "0111:0101:0110:1110:0110:0101:0100:0111", + Ecx: "0110:1100:0110:0101:0111:0100:0110:1110", + Edx: "0100:1001:0110:0101:0110:1110:0110:1001", + }, + { + Level: 1, + Vendor: "", + Eax: "0000:0000:0000:0010:0000:0110:1101:0111", + Ebx: "0000:0000:0000:0001:0000:1000:0000:0000", + Ecx: "1001:0111:1011:1010:0010:0010:0010:1011", + Edx: "0000:1111:1010:1011:1111:1011:1111:1111", + }, + { + Level: -2147483648, + Vendor: "", + Eax: "1000:0000:0000:0000:0000:0000:0000:1000", + Ebx: "0000:0000:0000:0000:0000:0000:0000:0000", + Ecx: "0000:0000:0000:0000:0000:0000:0000:0000", + Edx: "0000:0000:0000:0000:0000:0000:0000:0000", + }, + { + Level: -2147483647, + Vendor: "", + Eax: "0000:0000:0000:0000:0000:0000:0000:0000", + Ebx: "0000:0000:0000:0000:0000:0000:0000:0000", + Ecx: "0000:0000:0000:0000:0000:0000:0000:0001", + Edx: "0010:1000:0001:0000:0000:1000:0000:0000", + }, + { + Level: -2147483640, + Vendor: "", + Eax: "0000:0000:0000:0000:0011:0000:0010:1010", + Ebx: "0000:0000:0000:0000:0000:0000:0000:0000", + Ecx: "0000:0000:0000:0000:0000:0000:0000:0000", + Edx: "0000:0000:0000:0000:0000:0000:0000:0000", + }, + }, + BiosInfo: &types.HostBIOSInfo{ + BiosVersion: "6.00", + ReleaseDate: nil, + Vendor: "", + MajorRelease: 0, + MinorRelease: 0, + FirmwareMajorRelease: 0, + FirmwareMinorRelease: 0, + }, + ReliableMemoryInfo: &types.HostReliableMemoryInfo{}, +} + +func init() { + date, _ := time.Parse("2006-01-02", "2015-07-02") + + HostHardwareInfo.BiosInfo.ReleaseDate = &date +} diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/host_storage_device_info.go b/vendor/github.com/vmware/govmomi/simulator/esx/host_storage_device_info.go new file mode 100644 index 00000000000..9d1ae32dd40 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/esx/host_storage_device_info.go @@ -0,0 +1,346 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 esx + +import "github.com/vmware/govmomi/vim25/types" + +// HostStorageDeviceInfo is the default template for the HostSystem config.storageDevice property. +// Capture method: +// govc object.collect -s -dump HostSystem:ha-host config.storageDevice +var HostStorageDeviceInfo = types.HostStorageDeviceInfo{ + HostBusAdapter: []types.BaseHostHostBusAdapter{ + &types.HostParallelScsiHba{ + HostHostBusAdapter: types.HostHostBusAdapter{ + Key: "key-vim.host.ParallelScsiHba-vmhba0", + Device: "vmhba0", + Bus: 3, + Status: "unknown", + Model: "PVSCSI SCSI Controller", + Driver: "pvscsi", + Pci: "0000:03:00.0", + }, + }, + &types.HostBlockHba{ + HostHostBusAdapter: types.HostHostBusAdapter{ + Key: "key-vim.host.BlockHba-vmhba1", + Device: "vmhba1", + Bus: 0, + Status: "unknown", + Model: "PIIX4 for 430TX/440BX/MX IDE Controller", + Driver: "vmkata", + Pci: "0000:00:07.1", + }, + }, + &types.HostBlockHba{ + HostHostBusAdapter: types.HostHostBusAdapter{ + Key: "key-vim.host.BlockHba-vmhba64", + Device: "vmhba64", + Bus: 0, + Status: "unknown", + Model: "PIIX4 for 430TX/440BX/MX IDE Controller", + Driver: "vmkata", + Pci: "0000:00:07.1", + }, + }, + }, + ScsiLun: []types.BaseScsiLun{ + &types.ScsiLun{ + HostDevice: types.HostDevice{ + DeviceName: "/vmfs/devices/cdrom/mpx.vmhba1:C0:T0:L0", + DeviceType: "cdrom", + }, + Key: "key-vim.host.ScsiLun-0005000000766d686261313a303a30", + Uuid: "0005000000766d686261313a303a30", + Descriptor: []types.ScsiLunDescriptor{ + { + Quality: "lowQuality", + Id: "mpx.vmhba1:C0:T0:L0", + }, + { + Quality: "lowQuality", + Id: "vml.0005000000766d686261313a303a30", + }, + { + Quality: "lowQuality", + Id: "0005000000766d686261313a303a30", + }, + }, + CanonicalName: "mpx.vmhba1:C0:T0:L0", + DisplayName: "Local NECVMWar CD-ROM (mpx.vmhba1:C0:T0:L0)", + LunType: "cdrom", + Vendor: "NECVMWar", + Model: "VMware IDE CDR00", + Revision: "1.00", + ScsiLevel: 5, + SerialNumber: "unavailable", + DurableName: (*types.ScsiLunDurableName)(nil), + AlternateName: []types.ScsiLunDurableName{ + { + Namespace: "GENERIC_VPD", + NamespaceId: 0x5, + Data: []uint8{0x2d, 0x37, 0x39}, + }, + { + Namespace: "GENERIC_VPD", + NamespaceId: 0x5, + Data: []uint8{0x30}, + }, + }, + StandardInquiry: []uint8{0x30}, + QueueDepth: 0, + OperationalState: []string{"ok"}, + Capabilities: &types.ScsiLunCapabilities{}, + VStorageSupport: "vStorageUnsupported", + ProtocolEndpoint: types.NewBool(false), + }, + &types.HostScsiDisk{ + ScsiLun: types.ScsiLun{ + HostDevice: types.HostDevice{ + DeviceName: "/vmfs/devices/disks/mpx.vmhba0:C0:T0:L0", + DeviceType: "disk", + }, + Key: "key-vim.host.ScsiDisk-0000000000766d686261303a303a30", + Uuid: "0000000000766d686261303a303a30", + Descriptor: []types.ScsiLunDescriptor{ + { + Quality: "lowQuality", + Id: "mpx.vmhba0:C0:T0:L0", + }, + { + Quality: "lowQuality", + Id: "vml.0000000000766d686261303a303a30", + }, + { + Quality: "lowQuality", + Id: "0000000000766d686261303a303a30", + }, + }, + CanonicalName: "mpx.vmhba0:C0:T0:L0", + DisplayName: "Local VMware, Disk (mpx.vmhba0:C0:T0:L0)", + LunType: "disk", + Vendor: "VMware, ", + Model: "VMware Virtual S", + Revision: "1.0 ", + ScsiLevel: 2, + SerialNumber: "unavailable", + DurableName: (*types.ScsiLunDurableName)(nil), + AlternateName: []types.ScsiLunDurableName{ + { + Namespace: "GENERIC_VPD", + NamespaceId: 0x5, + Data: []uint8{0x2d, 0x37, 0x39}, + }, + { + Namespace: "GENERIC_VPD", + NamespaceId: 0x5, + Data: []uint8{0x30}, + }, + }, + StandardInquiry: []uint8{0x30}, + QueueDepth: 1024, + OperationalState: []string{"ok"}, + Capabilities: &types.ScsiLunCapabilities{}, + VStorageSupport: "vStorageUnsupported", + ProtocolEndpoint: types.NewBool(false), + }, + Capacity: types.HostDiskDimensionsLba{ + BlockSize: 512, + Block: 67108864, + }, + DevicePath: "/vmfs/devices/disks/mpx.vmhba0:C0:T0:L0", + Ssd: types.NewBool(true), + LocalDisk: types.NewBool(true), + PhysicalLocation: nil, + EmulatedDIXDIFEnabled: types.NewBool(false), + VsanDiskInfo: (*types.VsanHostVsanDiskInfo)(nil), + ScsiDiskType: "native512", + }, + }, + ScsiTopology: &types.HostScsiTopology{ + Adapter: []types.HostScsiTopologyInterface{ + { + Key: "key-vim.host.ScsiTopology.Interface-vmhba0", + Adapter: "key-vim.host.ParallelScsiHba-vmhba0", + Target: []types.HostScsiTopologyTarget{ + { + Key: "key-vim.host.ScsiTopology.Target-vmhba0:0:0", + Target: 0, + Lun: []types.HostScsiTopologyLun{ + { + Key: "key-vim.host.ScsiTopology.Lun-0000000000766d686261303a303a30", + Lun: 0, + ScsiLun: "key-vim.host.ScsiDisk-0000000000766d686261303a303a30", + }, + }, + Transport: &types.HostParallelScsiTargetTransport{}, + }, + }, + }, + { + Key: "key-vim.host.ScsiTopology.Interface-vmhba1", + Adapter: "key-vim.host.BlockHba-vmhba1", + Target: []types.HostScsiTopologyTarget{ + { + Key: "key-vim.host.ScsiTopology.Target-vmhba1:0:0", + Target: 0, + Lun: []types.HostScsiTopologyLun{ + { + Key: "key-vim.host.ScsiTopology.Lun-0005000000766d686261313a303a30", + Lun: 0, + ScsiLun: "key-vim.host.ScsiLun-0005000000766d686261313a303a30", + }, + }, + Transport: &types.HostBlockAdapterTargetTransport{}, + }, + }, + }, + { + Key: "key-vim.host.ScsiTopology.Interface-vmhba64", + Adapter: "key-vim.host.BlockHba-vmhba64", + Target: nil, + }, + }, + }, + MultipathInfo: &types.HostMultipathInfo{ + Lun: []types.HostMultipathInfoLogicalUnit{ + { + Key: "key-vim.host.MultipathInfo.LogicalUnit-0005000000766d686261313a303a30", + Id: "0005000000766d686261313a303a30", + Lun: "key-vim.host.ScsiLun-0005000000766d686261313a303a30", + Path: []types.HostMultipathInfoPath{ + { + Key: "key-vim.host.MultipathInfo.Path-vmhba1:C0:T0:L0", + Name: "vmhba1:C0:T0:L0", + PathState: "active", + State: "active", + IsWorkingPath: types.NewBool(true), + Adapter: "key-vim.host.BlockHba-vmhba1", + Lun: "key-vim.host.MultipathInfo.LogicalUnit-0005000000766d686261313a303a30", + Transport: &types.HostBlockAdapterTargetTransport{}, + }, + }, + Policy: &types.HostMultipathInfoFixedLogicalUnitPolicy{ + HostMultipathInfoLogicalUnitPolicy: types.HostMultipathInfoLogicalUnitPolicy{ + Policy: "VMW_PSP_FIXED", + }, + Prefer: "vmhba1:C0:T0:L0", + }, + StorageArrayTypePolicy: &types.HostMultipathInfoLogicalUnitStorageArrayTypePolicy{ + Policy: "VMW_SATP_LOCAL", + }, + }, + { + Key: "key-vim.host.MultipathInfo.LogicalUnit-0000000000766d686261303a303a30", + Id: "0000000000766d686261303a303a30", + Lun: "key-vim.host.ScsiDisk-0000000000766d686261303a303a30", + Path: []types.HostMultipathInfoPath{ + { + Key: "key-vim.host.MultipathInfo.Path-vmhba0:C0:T0:L0", + Name: "vmhba0:C0:T0:L0", + PathState: "active", + State: "active", + IsWorkingPath: types.NewBool(true), + Adapter: "key-vim.host.ParallelScsiHba-vmhba0", + Lun: "key-vim.host.MultipathInfo.LogicalUnit-0000000000766d686261303a303a30", + Transport: &types.HostParallelScsiTargetTransport{}, + }, + }, + Policy: &types.HostMultipathInfoFixedLogicalUnitPolicy{ + HostMultipathInfoLogicalUnitPolicy: types.HostMultipathInfoLogicalUnitPolicy{ + Policy: "VMW_PSP_FIXED", + }, + Prefer: "vmhba0:C0:T0:L0", + }, + StorageArrayTypePolicy: &types.HostMultipathInfoLogicalUnitStorageArrayTypePolicy{ + Policy: "VMW_SATP_LOCAL", + }, + }, + }, + }, + PlugStoreTopology: &types.HostPlugStoreTopology{ + Adapter: []types.HostPlugStoreTopologyAdapter{ + { + Key: "key-vim.host.PlugStoreTopology.Adapter-vmhba0", + Adapter: "key-vim.host.ParallelScsiHba-vmhba0", + Path: []string{"key-vim.host.PlugStoreTopology.Path-vmhba0:C0:T0:L0"}, + }, + { + Key: "key-vim.host.PlugStoreTopology.Adapter-vmhba1", + Adapter: "key-vim.host.BlockHba-vmhba1", + Path: []string{"key-vim.host.PlugStoreTopology.Path-vmhba1:C0:T0:L0"}, + }, + { + Key: "key-vim.host.PlugStoreTopology.Adapter-vmhba64", + Adapter: "key-vim.host.BlockHba-vmhba64", + Path: nil, + }, + }, + Path: []types.HostPlugStoreTopologyPath{ + { + Key: "key-vim.host.PlugStoreTopology.Path-vmhba0:C0:T0:L0", + Name: "vmhba0:C0:T0:L0", + ChannelNumber: 0, + TargetNumber: 0, + LunNumber: 0, + Adapter: "key-vim.host.PlugStoreTopology.Adapter-vmhba0", + Target: "key-vim.host.PlugStoreTopology.Target-pscsi.0:0", + Device: "key-vim.host.PlugStoreTopology.Device-0000000000766d686261303a303a30", + }, + { + Key: "key-vim.host.PlugStoreTopology.Path-vmhba1:C0:T0:L0", + Name: "vmhba1:C0:T0:L0", + ChannelNumber: 0, + TargetNumber: 0, + LunNumber: 0, + Adapter: "key-vim.host.PlugStoreTopology.Adapter-vmhba1", + Target: "key-vim.host.PlugStoreTopology.Target-ide.0:0", + Device: "key-vim.host.PlugStoreTopology.Device-0005000000766d686261313a303a30", + }, + }, + Target: []types.HostPlugStoreTopologyTarget{ + { + Key: "key-vim.host.PlugStoreTopology.Target-pscsi.0:0", + Transport: &types.HostParallelScsiTargetTransport{}, + }, + { + Key: "key-vim.host.PlugStoreTopology.Target-ide.0:0", + Transport: &types.HostBlockAdapterTargetTransport{}, + }, + }, + Device: []types.HostPlugStoreTopologyDevice{ + { + Key: "key-vim.host.PlugStoreTopology.Device-0005000000766d686261313a303a30", + Lun: "key-vim.host.ScsiLun-0005000000766d686261313a303a30", + Path: []string{"key-vim.host.PlugStoreTopology.Path-vmhba1:C0:T0:L0"}, + }, + { + Key: "key-vim.host.PlugStoreTopology.Device-0000000000766d686261303a303a30", + Lun: "key-vim.host.ScsiDisk-0000000000766d686261303a303a30", + Path: []string{"key-vim.host.PlugStoreTopology.Path-vmhba0:C0:T0:L0"}, + }, + }, + Plugin: []types.HostPlugStoreTopologyPlugin{ + { + Key: "key-vim.host.PlugStoreTopology.Plugin-NMP", + Name: "NMP", + Device: []string{"key-vim.host.PlugStoreTopology.Device-0005000000766d686261313a303a30", "key-vim.host.PlugStoreTopology.Device-0000000000766d686261303a303a30"}, + ClaimedPath: []string{"key-vim.host.PlugStoreTopology.Path-vmhba0:C0:T0:L0", "key-vim.host.PlugStoreTopology.Path-vmhba1:C0:T0:L0"}, + }, + }, + }, + SoftwareInternetScsiEnabled: false, +} diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/host_system.go b/vendor/github.com/vmware/govmomi/simulator/esx/host_system.go new file mode 100644 index 00000000000..13aa8b17a3e --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/esx/host_system.go @@ -0,0 +1,1791 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 esx + +import ( + "time" + + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/types" +) + +// HostSystem is the default template for HostSystem properties. +// Capture method: +// govc host.info -dump +var HostSystem = mo.HostSystem{ + ManagedEntity: mo.ManagedEntity{ + ExtensibleManagedObject: mo.ExtensibleManagedObject{ + Self: types.ManagedObjectReference{Type: "HostSystem", Value: "ha-host"}, + Value: nil, + AvailableField: nil, + }, + Parent: &types.ManagedObjectReference{Type: "ComputeResource", Value: "ha-compute-res"}, + CustomValue: nil, + OverallStatus: "", + ConfigStatus: "", + ConfigIssue: nil, + EffectiveRole: nil, + Permission: nil, + Name: "", + DisabledMethod: nil, + RecentTask: nil, + DeclaredAlarmState: nil, + TriggeredAlarmState: nil, + AlarmActionsEnabled: (*bool)(nil), + Tag: nil, + }, + Runtime: types.HostRuntimeInfo{ + DynamicData: types.DynamicData{}, + ConnectionState: "connected", + PowerState: "poweredOn", + StandbyMode: "", + InMaintenanceMode: false, + BootTime: (*time.Time)(nil), + HealthSystemRuntime: &types.HealthSystemRuntime{ + DynamicData: types.DynamicData{}, + SystemHealthInfo: &types.HostSystemHealthInfo{ + DynamicData: types.DynamicData{}, + NumericSensorInfo: []types.HostNumericSensorInfo{ + { + DynamicData: types.DynamicData{}, + Name: "VMware Rollup Health State", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "system", + }, + { + DynamicData: types.DynamicData{}, + Name: "CPU socket #0 Level-1 Cache is 16384 B", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Processors", + }, + { + DynamicData: types.DynamicData{}, + Name: "CPU socket #0 Level-2 Cache is 0 B", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Processors", + }, + { + DynamicData: types.DynamicData{}, + Name: "CPU socket #1 Level-1 Cache is 16384 B", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Processors", + }, + { + DynamicData: types.DynamicData{}, + Name: "CPU socket #1 Level-2 Cache is 0 B", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Processors", + }, + { + DynamicData: types.DynamicData{}, + Name: "Phoenix Technologies LTD System BIOS 6.00 2014-05-20 00:00:00.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware, Inc. VMware ESXi 6.0.0 build-3634798 2016-03-07 00:00:00.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware sata-ata-piix 2.12-10vmw.600.2.34.3634798 2016-03-08 07:38:41.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware lsu-lsi-mptsas-plugin 1.0.0-1vmw.600.2.34.3634798 2016-03-08 07:39:28.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware net-mlx4-core 1.9.7.0-1vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware lsu-lsi-mpt2sas-plugin 1.0.0-4vmw.600.2.34.3634798 2016-03-08 07:39:28.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware scsi-aacraid 1.1.5.1-9vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware ata-pata-via 0.3.3-2vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware scsi-qla4xxx 5.01.03.2-7vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware sata-sata-promise 2.12-3vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware scsi-megaraid-mbox 2.20.5.1-6vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware vsan 6.0.0-2.34.3563498 2016-02-17 17:18:19.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware net-e1000 8.0.3.1-5vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware ata-pata-serverworks 0.4.3-3vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware scsi-mptspi 4.23.01.00-9vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware net-nx-nic 5.0.621-5vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware block-cciss 3.6.14-10vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware net-bnx2x 1.78.80.v60.12-1vmw.600.2.34.3634798 2016-03-08 07:38:41.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware ipmi-ipmi-devintf 39.1-4vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware scsi-mptsas 4.23.01.00-9vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware scsi-megaraid2 2.00.4-9vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware nvme 1.0e.0.35-1vmw.600.2.34.3634798 2016-03-08 07:38:46.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware esx-xserver 6.0.0-2.34.3634798 2016-03-08 07:39:27.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware nmlx4-en 3.0.0.0-1vmw.600.2.34.3634798 2016-03-08 07:38:46.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware lsu-hp-hpsa-plugin 1.0.0-1vmw.600.2.34.3634798 2016-03-08 07:39:28.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware scsi-megaraid-sas 6.603.55.00-2vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware net-enic 2.1.2.38-2vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware lsi-msgpt3 06.255.12.00-8vmw.600.2.34.3634798 2016-03-08 07:38:46.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware sata-ahci 3.0-22vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware net-forcedeth 0.61-2vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware ata-pata-atiixp 0.4.6-4vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware elxnet 10.2.309.6v-1vmw.600.2.34.3634798 2016-03-08 07:38:46.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware esx-dvfilter-generic-fastpath 6.0.0-2.34.3634798 2016-03-08 07:39:28.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware uhci-usb-uhci 1.0-3vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware ata-pata-amd 0.3.10-3vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware sata-sata-sil24 1.1-1vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware ohci-usb-ohci 1.0-3vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware net-igb 5.0.5.1.1-5vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware ata-pata-pdc2027x 1.0-3vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware ehci-ehci-hcd 1.0-3vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware lsu-lsi-lsi-mr3-plugin 1.0.0-2vmw.600.2.34.3634798 2016-03-08 07:39:28.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware net-ixgbe 3.7.13.7.14iov-20vmw.600.2.34.3634798 2016-03-08 07:38:41.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware vsanhealth 6.0.0-3000000.3.0.2.34.3544323 2016-02-12 06:45:30.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware net-cnic 1.78.76.v60.13-2vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware sata-sata-svw 2.3-3vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware ipmi-ipmi-msghandler 39.1-4vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware emulex-esx-elxnetcli 10.2.309.6v-2.34.3634798 2016-03-08 07:39:28.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware scsi-aic79xx 3.1-5vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware qlnativefc 2.0.12.0-5vmw.600.2.34.3634798 2016-03-08 07:38:46.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware lsu-lsi-lsi-msgpt3-plugin 1.0.0-1vmw.600.2.34.3634798 2016-03-08 07:39:28.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware ima-qla4xxx 2.02.18-1vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware net-mlx4-en 1.9.7.0-1vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware net-e1000e 3.2.2.1-1vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware net-tg3 3.131d.v60.4-2vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware scsi-hpsa 6.0.0.44-4vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware scsi-bnx2fc 1.78.78.v60.8-1vmw.600.2.34.3634798 2016-03-08 07:38:41.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware cpu-microcode 6.0.0-2.34.3634798 2016-03-08 07:39:28.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware scsi-fnic 1.5.0.45-3vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware nmlx4-rdma 3.0.0.0-1vmw.600.2.34.3634798 2016-03-08 07:38:46.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware net-vmxnet3 1.1.3.0-3vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware lpfc 10.2.309.8-2vmw.600.2.34.3634798 2016-03-08 07:38:46.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware esx-ui 1.0.0-3617585 2016-03-03 04:52:43.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware ata-pata-cmd64x 0.2.5-3vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware lsi-mr3 6.605.08.00-7vmw.600.2.34.3634798 2016-03-08 07:38:46.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware ata-pata-hpt3x2n 0.3.4-3vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware sata-sata-nv 3.5-4vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware misc-cnic-register 1.78.75.v60.7-1vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware lsu-lsi-megaraid-sas-plugin 1.0.0-2vmw.600.2.34.3634798 2016-03-08 07:39:28.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware ata-pata-sil680 0.4.8-3vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware esx-tboot 6.0.0-2.34.3634798 2016-03-08 07:39:27.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware xhci-xhci 1.0-3vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware scsi-ips 7.12.05-4vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware scsi-adp94xx 1.0.8.12-6vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware rste 2.0.2.0088-4vmw.600.2.34.3634798 2016-03-08 07:38:46.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware ipmi-ipmi-si-drv 39.1-4vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMWARE mtip32xx-native 3.8.5-1vmw.600.2.34.3634798 2016-03-08 07:38:46.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware scsi-mpt2sas 19.00.00.00-1vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware misc-drivers 6.0.0-2.34.3634798 2016-03-08 07:38:41.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware nmlx4-core 3.0.0.0-1vmw.600.2.34.3634798 2016-03-08 07:38:46.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware sata-sata-sil 2.3-4vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware esx-base 6.0.0-2.34.3634798 2016-03-08 07:39:18.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware scsi-bnx2i 2.78.76.v60.8-1vmw.600.2.34.3634798 2016-03-08 07:38:41.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "VMware net-bnx2 2.2.4f.v60.10-1vmw.600.2.34.3634798 2016-03-08 07:38:45.000", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "e1000 driver 8.0.3.1-NAPI", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + { + DynamicData: types.DynamicData{}, + Name: "e1000 device firmware N/A", + HealthState: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Sensor is operating under normal conditions", + }, + Key: "green", + }, + CurrentReading: 0, + UnitModifier: 0, + BaseUnits: "", + RateUnits: "", + SensorType: "Software Components", + }, + }, + }, + HardwareStatusInfo: &types.HostHardwareStatusInfo{ + DynamicData: types.DynamicData{}, + MemoryStatusInfo: nil, + CpuStatusInfo: []types.BaseHostHardwareElementInfo{ + &types.HostHardwareElementInfo{ + DynamicData: types.DynamicData{}, + Name: "CPU socket #0", + Status: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Physical element is functioning as expected", + }, + Key: "Green", + }, + }, + &types.HostHardwareElementInfo{ + DynamicData: types.DynamicData{}, + Name: "CPU socket #1", + Status: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Green", + Summary: "Physical element is functioning as expected", + }, + Key: "Green", + }, + }, + }, + StorageStatusInfo: nil, + }, + }, + DasHostState: (*types.ClusterDasFdmHostState)(nil), + TpmPcrValues: nil, + VsanRuntimeInfo: &types.VsanHostRuntimeInfo{}, + NetworkRuntimeInfo: &types.HostRuntimeInfoNetworkRuntimeInfo{ + DynamicData: types.DynamicData{}, + NetStackInstanceRuntimeInfo: []types.HostRuntimeInfoNetStackInstanceRuntimeInfo{ + { + DynamicData: types.DynamicData{}, + NetStackInstanceKey: "defaultTcpipStack", + State: "active", + VmknicKeys: []string{"vmk0"}, + MaxNumberOfConnections: 11000, + CurrentIpV6Enabled: types.NewBool(true), + }, + }, + NetworkResourceRuntime: (*types.HostNetworkResourceRuntime)(nil), + }, + VFlashResourceRuntimeInfo: (*types.HostVFlashManagerVFlashResourceRunTimeInfo)(nil), + HostMaxVirtualDiskCapacity: 68169720922112, + }, + Summary: types.HostListSummary{ + DynamicData: types.DynamicData{}, + Host: &types.ManagedObjectReference{Type: "HostSystem", Value: "ha-host"}, + Hardware: &types.HostHardwareSummary{ + DynamicData: types.DynamicData{}, + Vendor: "VMware, Inc.", + Model: "VMware Virtual Platform", + Uuid: "564d2f12-8041-639b-5018-05a835b72eaf", + OtherIdentifyingInfo: []types.HostSystemIdentificationInfo{ + { + DynamicData: types.DynamicData{}, + IdentifierValue: " No Asset Tag", + IdentifierType: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Asset Tag", + Summary: "Asset tag of the system", + }, + Key: "AssetTag", + }, + }, + { + DynamicData: types.DynamicData{}, + IdentifierValue: "[MS_VM_CERT/SHA1/27d66596a61c48dd3dc7216fd715126e33f59ae7]", + IdentifierType: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "OEM specific string", + Summary: "OEM specific string", + }, + Key: "OemSpecificString", + }, + }, + { + DynamicData: types.DynamicData{}, + IdentifierValue: "Welcome to the Virtual Machine", + IdentifierType: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "OEM specific string", + Summary: "OEM specific string", + }, + Key: "OemSpecificString", + }, + }, + { + DynamicData: types.DynamicData{}, + IdentifierValue: "VMware-56 4d 2f 12 80 41 63 9b-50 18 05 a8 35 b7 2e af", + IdentifierType: &types.ElementDescription{ + Description: types.Description{ + DynamicData: types.DynamicData{}, + Label: "Service tag", + Summary: "Service tag of the system", + }, + Key: "ServiceTag", + }, + }, + }, + MemorySize: 4294430720, + CpuModel: "Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz", + CpuMhz: 2294, + NumCpuPkgs: 2, + NumCpuCores: 2, + NumCpuThreads: 2, + NumNics: 1, + NumHBAs: 3, + }, + Runtime: (*types.HostRuntimeInfo)(nil), + Config: types.HostConfigSummary{ + DynamicData: types.DynamicData{}, + Name: "localhost.localdomain", + Port: 902, + SslThumbprint: "", + Product: &HostConfigInfo.Product, + VmotionEnabled: false, + FaultToleranceEnabled: types.NewBool(true), + FeatureVersion: nil, + AgentVmDatastore: (*types.ManagedObjectReference)(nil), + AgentVmNetwork: (*types.ManagedObjectReference)(nil), + }, + QuickStats: types.HostListSummaryQuickStats{ + DynamicData: types.DynamicData{}, + OverallCpuUsage: 67, + OverallMemoryUsage: 1404, + DistributedCpuFairness: 0, + DistributedMemoryFairness: 0, + Uptime: 77229, + }, + OverallStatus: "gray", + RebootRequired: false, + CustomValue: nil, + ManagementServerIp: "", + MaxEVCModeKey: "", + CurrentEVCModeKey: "", + Gateway: (*types.HostListSummaryGatewaySummary)(nil), + }, + Hardware: (*types.HostHardwareInfo)(nil), + Capability: (*types.HostCapability)(nil), + LicensableResource: types.HostLicensableResourceInfo{}, + ConfigManager: types.HostConfigManager{ + DynamicData: types.DynamicData{}, + CpuScheduler: &types.ManagedObjectReference{Type: "HostCpuSchedulerSystem", Value: "cpuSchedulerSystem"}, + DatastoreSystem: &types.ManagedObjectReference{Type: "HostDatastoreSystem", Value: "ha-datastoresystem"}, + MemoryManager: &types.ManagedObjectReference{Type: "HostMemorySystem", Value: "memoryManagerSystem"}, + StorageSystem: &types.ManagedObjectReference{Type: "HostStorageSystem", Value: "storageSystem"}, + NetworkSystem: &types.ManagedObjectReference{Type: "HostNetworkSystem", Value: "networkSystem"}, + VmotionSystem: &types.ManagedObjectReference{Type: "HostVMotionSystem", Value: "ha-vmotion-system"}, + VirtualNicManager: &types.ManagedObjectReference{Type: "HostVirtualNicManager", Value: "ha-vnic-mgr"}, + ServiceSystem: &types.ManagedObjectReference{Type: "HostServiceSystem", Value: "serviceSystem"}, + FirewallSystem: &types.ManagedObjectReference{Type: "HostFirewallSystem", Value: "firewallSystem"}, + AdvancedOption: &types.ManagedObjectReference{Type: "OptionManager", Value: "ha-adv-options"}, + DiagnosticSystem: &types.ManagedObjectReference{Type: "HostDiagnosticSystem", Value: "diagnosticsystem"}, + AutoStartManager: &types.ManagedObjectReference{Type: "HostAutoStartManager", Value: "ha-autostart-mgr"}, + SnmpSystem: &types.ManagedObjectReference{Type: "HostSnmpSystem", Value: "ha-snmp-agent"}, + DateTimeSystem: &types.ManagedObjectReference{Type: "HostDateTimeSystem", Value: "dateTimeSystem"}, + PatchManager: &types.ManagedObjectReference{Type: "HostPatchManager", Value: "ha-host-patch-manager"}, + ImageConfigManager: &types.ManagedObjectReference{Type: "HostImageConfigManager", Value: "ha-image-config-manager"}, + BootDeviceSystem: (*types.ManagedObjectReference)(nil), + FirmwareSystem: &types.ManagedObjectReference{Type: "HostFirmwareSystem", Value: "ha-firmwareSystem"}, + HealthStatusSystem: &types.ManagedObjectReference{Type: "HostHealthStatusSystem", Value: "healthStatusSystem"}, + PciPassthruSystem: &types.ManagedObjectReference{Type: "HostPciPassthruSystem", Value: "ha-pcipassthrusystem"}, + LicenseManager: &types.ManagedObjectReference{Type: "LicenseManager", Value: "ha-license-manager"}, + KernelModuleSystem: &types.ManagedObjectReference{Type: "HostKernelModuleSystem", Value: "kernelModuleSystem"}, + AuthenticationManager: &types.ManagedObjectReference{Type: "HostAuthenticationManager", Value: "ha-auth-manager"}, + PowerSystem: &types.ManagedObjectReference{Type: "HostPowerSystem", Value: "ha-power-system"}, + CacheConfigurationManager: &types.ManagedObjectReference{Type: "HostCacheConfigurationManager", Value: "ha-cache-configuration-manager"}, + EsxAgentHostManager: (*types.ManagedObjectReference)(nil), + IscsiManager: &types.ManagedObjectReference{Type: "IscsiManager", Value: "iscsiManager"}, + VFlashManager: &types.ManagedObjectReference{Type: "HostVFlashManager", Value: "ha-vflash-manager"}, + VsanSystem: &types.ManagedObjectReference{Type: "HostVsanSystem", Value: "vsanSystem"}, + MessageBusProxy: &types.ManagedObjectReference{Type: "MessageBusProxy", Value: "messageBusProxy"}, + UserDirectory: &types.ManagedObjectReference{Type: "UserDirectory", Value: "ha-user-directory"}, + AccountManager: &types.ManagedObjectReference{Type: "HostLocalAccountManager", Value: "ha-localacctmgr"}, + HostAccessManager: &types.ManagedObjectReference{Type: "HostAccessManager", Value: "ha-host-access-manager"}, + GraphicsManager: &types.ManagedObjectReference{Type: "HostGraphicsManager", Value: "ha-graphics-manager"}, + VsanInternalSystem: &types.ManagedObjectReference{Type: "HostVsanInternalSystem", Value: "ha-vsan-internal-system"}, + CertificateManager: &types.ManagedObjectReference{Type: "HostCertificateManager", Value: "ha-certificate-manager"}, + }, + Config: &HostConfigInfo, + Vm: nil, + Datastore: nil, + Network: nil, + DatastoreBrowser: types.ManagedObjectReference{Type: "HostDatastoreBrowser", Value: "ha-host-datastorebrowser"}, + SystemResources: (*types.HostSystemResourceInfo)(nil), +} diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/performance_manager.go b/vendor/github.com/vmware/govmomi/simulator/esx/performance_manager.go new file mode 100644 index 00000000000..584e3cad373 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/esx/performance_manager.go @@ -0,0 +1,9885 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 esx + +import "github.com/vmware/govmomi/vim25/types" + +// PerfCounter is the default template for the PerformanceManager perfCounter property. +// Capture method: +// govc object.collect -s -dump PerformanceManager:ha-perfmgr perfCounter +var PerfCounter = []types.PerfCounterInfo{ + { + Key: 0, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Usage", + Summary: "CPU usage as a percentage during the interval", + }, + Key: "usage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "none", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{1, 2, 3}, + }, + { + Key: 1, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Usage", + Summary: "CPU usage as a percentage during the interval", + }, + Key: "usage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 2, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Usage", + Summary: "CPU usage as a percentage during the interval", + }, + Key: "usage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "maximum", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 3, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Usage", + Summary: "CPU usage as a percentage during the interval", + }, + Key: "usage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "minimum", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 4, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Usage in MHz", + Summary: "CPU usage in megahertz during the interval", + }, + Key: "usagemhz", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "MHz", + Summary: "Megahertz", + }, + Key: "megaHertz", + }, + RollupType: "none", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{5, 6, 7}, + }, + { + Key: 5, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Usage in MHz", + Summary: "CPU usage in megahertz during the interval", + }, + Key: "usagemhz", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "MHz", + Summary: "Megahertz", + }, + Key: "megaHertz", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 6, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Usage in MHz", + Summary: "CPU usage in megahertz during the interval", + }, + Key: "usagemhz", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "MHz", + Summary: "Megahertz", + }, + Key: "megaHertz", + }, + RollupType: "maximum", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 7, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Usage in MHz", + Summary: "CPU usage in megahertz during the interval", + }, + Key: "usagemhz", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "MHz", + Summary: "Megahertz", + }, + Key: "megaHertz", + }, + RollupType: "minimum", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 8, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Reserved capacity", + Summary: "Total CPU capacity reserved by virtual machines", + }, + Key: "reservedCapacity", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "MHz", + Summary: "Megahertz", + }, + Key: "megaHertz", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 9, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "Amount of time spent on system processes on each virtual CPU in the virtual machine", + }, + Key: "system", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 10, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Wait", + Summary: "Total CPU time spent in wait state", + }, + Key: "wait", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 11, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Ready", + Summary: "Time that the virtual machine was ready, but could not get scheduled to run on the physical CPU during last measurement interval", + }, + Key: "ready", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 12, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Used", + Summary: "Total CPU usage", + }, + Key: "used", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 13, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Idle", + Summary: "Total time that the CPU spent in an idle state", + }, + Key: "idle", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 14, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Swap wait", + Summary: "CPU time spent waiting for swap-in", + }, + Key: "swapwait", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 15, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Utilization", + Summary: "CPU utilization as a percentage during the interval (CPU usage and CPU utilization might be different due to power management technologies or hyper-threading)", + }, + Key: "utilization", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "none", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{16, 17, 18}, + }, + { + Key: 16, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Utilization", + Summary: "CPU utilization as a percentage during the interval (CPU usage and CPU utilization might be different due to power management technologies or hyper-threading)", + }, + Key: "utilization", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 17, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Utilization", + Summary: "CPU utilization as a percentage during the interval (CPU usage and CPU utilization might be different due to power management technologies or hyper-threading)", + }, + Key: "utilization", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "maximum", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 18, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Utilization", + Summary: "CPU utilization as a percentage during the interval (CPU usage and CPU utilization might be different due to power management technologies or hyper-threading)", + }, + Key: "utilization", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "minimum", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 19, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Core Utilization", + Summary: "CPU utilization of the corresponding core (if hyper-threading is enabled) as a percentage during the interval (A core is utilized if either or both of its logical CPUs are utilized)", + }, + Key: "coreUtilization", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "none", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{20, 21, 22}, + }, + { + Key: 20, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Core Utilization", + Summary: "CPU utilization of the corresponding core (if hyper-threading is enabled) as a percentage during the interval (A core is utilized if either or both of its logical CPUs are utilized)", + }, + Key: "coreUtilization", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 21, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Core Utilization", + Summary: "CPU utilization of the corresponding core (if hyper-threading is enabled) as a percentage during the interval (A core is utilized if either or both of its logical CPUs are utilized)", + }, + Key: "coreUtilization", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "maximum", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 22, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Core Utilization", + Summary: "CPU utilization of the corresponding core (if hyper-threading is enabled) as a percentage during the interval (A core is utilized if either or both of its logical CPUs are utilized)", + }, + Key: "coreUtilization", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "minimum", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 23, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Total capacity", + Summary: "Total CPU capacity reserved by and available for virtual machines", + }, + Key: "totalCapacity", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "MHz", + Summary: "Megahertz", + }, + Key: "megaHertz", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 24, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Latency", + Summary: "Percent of time the virtual machine is unable to run because it is contending for access to the physical CPU(s)", + }, + Key: "latency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 25, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Entitlement", + Summary: "CPU resources devoted by the ESX scheduler", + }, + Key: "entitlement", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "MHz", + Summary: "Megahertz", + }, + Key: "megaHertz", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 26, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Demand", + Summary: "The amount of CPU resources a virtual machine would use if there were no CPU contention or CPU limit", + }, + Key: "demand", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "MHz", + Summary: "Megahertz", + }, + Key: "megaHertz", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 27, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Co-stop", + Summary: "Time the virtual machine is ready to run, but is unable to run due to co-scheduling constraints", + }, + Key: "costop", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 28, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Max limited", + Summary: "Time the virtual machine is ready to run, but is not run due to maxing out its CPU limit setting", + }, + Key: "maxlimited", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 29, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Overlap", + Summary: "Time the virtual machine was interrupted to perform system services on behalf of itself or other virtual machines", + }, + Key: "overlap", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 30, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Run", + Summary: "Time the virtual machine is scheduled to run", + }, + Key: "run", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 31, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Demand-to-entitlement ratio", + Summary: "CPU resource entitlement to CPU demand ratio (in percents)", + }, + Key: "demandEntitlementRatio", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 32, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Readiness", + Summary: "Percentage of time that the virtual machine was ready, but could not get scheduled to run on the physical CPU", + }, + Key: "readiness", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU", + Summary: "CPU", + }, + Key: "cpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65536, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Host consumed %", + Summary: "Percentage of host physical memory that has been consumed", + }, + Key: "usage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "none", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{65537, 65538, 65539}, + }, + { + Key: 65537, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Host consumed %", + Summary: "Percentage of host physical memory that has been consumed", + }, + Key: "usage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65538, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Host consumed %", + Summary: "Percentage of host physical memory that has been consumed", + }, + Key: "usage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "maximum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65539, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Host consumed %", + Summary: "Percentage of host physical memory that has been consumed", + }, + Key: "usage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "minimum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65540, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Granted", + Summary: "Amount of host physical memory or physical memory that is mapped for a virtual machine or a host", + }, + Key: "granted", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "none", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{65541, 65542, 65543}, + }, + { + Key: 65541, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Granted", + Summary: "Amount of host physical memory or physical memory that is mapped for a virtual machine or a host", + }, + Key: "granted", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65542, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Granted", + Summary: "Amount of host physical memory or physical memory that is mapped for a virtual machine or a host", + }, + Key: "granted", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "maximum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65543, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Granted", + Summary: "Amount of host physical memory or physical memory that is mapped for a virtual machine or a host", + }, + Key: "granted", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "minimum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65544, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Active", + Summary: "Amount of guest physical memory that is being actively read or written by guest. Activeness is estimated by ESXi", + }, + Key: "active", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "none", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{65545, 65546, 65547}, + }, + { + Key: 65545, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Active", + Summary: "Amount of guest physical memory that is being actively read or written by guest. Activeness is estimated by ESXi", + }, + Key: "active", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65546, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Active", + Summary: "Amount of guest physical memory that is being actively read or written by guest. Activeness is estimated by ESXi", + }, + Key: "active", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "maximum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65547, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Active", + Summary: "Amount of guest physical memory that is being actively read or written by guest. Activeness is estimated by ESXi", + }, + Key: "active", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "minimum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65548, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Shared", + Summary: "Amount of guest physical memory that is shared within a single virtual machine or across virtual machines", + }, + Key: "shared", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "none", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{65549, 65550, 65551}, + }, + { + Key: 65549, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Shared", + Summary: "Amount of guest physical memory that is shared within a single virtual machine or across virtual machines", + }, + Key: "shared", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65550, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Shared", + Summary: "Amount of guest physical memory that is shared within a single virtual machine or across virtual machines", + }, + Key: "shared", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "maximum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65551, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Shared", + Summary: "Amount of guest physical memory that is shared within a single virtual machine or across virtual machines", + }, + Key: "shared", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "minimum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65552, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Zero pages", + Summary: "Guest physical memory pages whose content is 0x00", + }, + Key: "zero", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "none", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{65553, 65554, 65555}, + }, + { + Key: 65553, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Zero pages", + Summary: "Guest physical memory pages whose content is 0x00", + }, + Key: "zero", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65554, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Zero pages", + Summary: "Guest physical memory pages whose content is 0x00", + }, + Key: "zero", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "maximum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65555, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Zero pages", + Summary: "Guest physical memory pages whose content is 0x00", + }, + Key: "zero", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "minimum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65556, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Reservation available", + Summary: "Amount by which reservation can be raised", + }, + Key: "unreserved", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "none", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{65557, 65558, 65559}, + }, + { + Key: 65557, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Reservation available", + Summary: "Amount by which reservation can be raised", + }, + Key: "unreserved", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65558, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Reservation available", + Summary: "Amount by which reservation can be raised", + }, + Key: "unreserved", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "maximum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65559, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Reservation available", + Summary: "Amount by which reservation can be raised", + }, + Key: "unreserved", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "minimum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65560, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Swap consumed", + Summary: "Swap storage space consumed", + }, + Key: "swapused", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "none", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{65561, 65562, 65563}, + }, + { + Key: 65561, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Swap consumed", + Summary: "Swap storage space consumed", + }, + Key: "swapused", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65562, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Swap consumed", + Summary: "Swap storage space consumed", + }, + Key: "swapused", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "maximum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65563, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Swap consumed", + Summary: "Swap storage space consumed", + }, + Key: "swapused", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "minimum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65568, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Shared common", + Summary: "Amount of host physical memory that backs shared guest physical memory (Shared)", + }, + Key: "sharedcommon", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "none", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{65569, 65570, 65571}, + }, + { + Key: 65569, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Shared common", + Summary: "Amount of host physical memory that backs shared guest physical memory (Shared)", + }, + Key: "sharedcommon", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65570, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Shared common", + Summary: "Amount of host physical memory that backs shared guest physical memory (Shared)", + }, + Key: "sharedcommon", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "maximum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65571, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Shared common", + Summary: "Amount of host physical memory that backs shared guest physical memory (Shared)", + }, + Key: "sharedcommon", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "minimum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65572, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Heap", + Summary: "Virtual address space of ESXi that is dedicated to its heap", + }, + Key: "heap", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "none", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{65573, 65574, 65575}, + }, + { + Key: 65573, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Heap", + Summary: "Virtual address space of ESXi that is dedicated to its heap", + }, + Key: "heap", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65574, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Heap", + Summary: "Virtual address space of ESXi that is dedicated to its heap", + }, + Key: "heap", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "maximum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65575, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Heap", + Summary: "Virtual address space of ESXi that is dedicated to its heap", + }, + Key: "heap", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "minimum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65576, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Heap free", + Summary: "Free address space in the heap of ESXi. This is less than or equal to Heap", + }, + Key: "heapfree", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "none", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{65577, 65578, 65579}, + }, + { + Key: 65577, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Heap free", + Summary: "Free address space in the heap of ESXi. This is less than or equal to Heap", + }, + Key: "heapfree", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65578, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Heap free", + Summary: "Free address space in the heap of ESXi. This is less than or equal to Heap", + }, + Key: "heapfree", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "maximum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65579, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Heap free", + Summary: "Free address space in the heap of ESXi. This is less than or equal to Heap", + }, + Key: "heapfree", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "minimum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65580, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Free state", + Summary: "Current memory availability state of ESXi. Possible values are high, clear, soft, hard, low. The state value determines the techniques used for memory reclamation from virtual machines", + }, + Key: "state", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65581, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Ballooned memory", + Summary: "Amount of guest physical memory reclaimed from the virtual machine by the balloon driver in the guest", + }, + Key: "vmmemctl", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "none", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{65582, 65583, 65584}, + }, + { + Key: 65582, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Ballooned memory", + Summary: "Amount of guest physical memory reclaimed from the virtual machine by the balloon driver in the guest", + }, + Key: "vmmemctl", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65583, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Ballooned memory", + Summary: "Amount of guest physical memory reclaimed from the virtual machine by the balloon driver in the guest", + }, + Key: "vmmemctl", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "maximum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65584, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Ballooned memory", + Summary: "Amount of guest physical memory reclaimed from the virtual machine by the balloon driver in the guest", + }, + Key: "vmmemctl", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "minimum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65585, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Overhead consumed", + Summary: "Host physical memory consumed by ESXi data structures for running the virtual machines", + }, + Key: "overhead", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "none", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{65586, 65587, 65588}, + }, + { + Key: 65586, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Overhead consumed", + Summary: "Host physical memory consumed by ESXi data structures for running the virtual machines", + }, + Key: "overhead", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65587, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Overhead consumed", + Summary: "Host physical memory consumed by ESXi data structures for running the virtual machines", + }, + Key: "overhead", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "maximum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65588, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Overhead consumed", + Summary: "Host physical memory consumed by ESXi data structures for running the virtual machines", + }, + Key: "overhead", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "minimum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65589, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Reservation consumed", + Summary: "Memory reservation consumed by powered-on virtual machines", + }, + Key: "reservedCapacity", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "MB", + Summary: "Megabyte", + }, + Key: "megaBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65590, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Swapped", + Summary: "Amount of guest physical memory that is swapped out to the swap space", + }, + Key: "swapped", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "none", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{65591, 65592, 65593}, + }, + { + Key: 65591, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Swapped", + Summary: "Amount of guest physical memory that is swapped out to the swap space", + }, + Key: "swapped", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65592, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Swapped", + Summary: "Amount of guest physical memory that is swapped out to the swap space", + }, + Key: "swapped", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "maximum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65593, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Swapped", + Summary: "Amount of guest physical memory that is swapped out to the swap space", + }, + Key: "swapped", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "minimum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65594, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Swap target", + Summary: "Amount of memory that ESXi needs to reclaim by swapping", + }, + Key: "swaptarget", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "none", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{65595, 65596, 65597}, + }, + { + Key: 65595, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Swap target", + Summary: "Amount of memory that ESXi needs to reclaim by swapping", + }, + Key: "swaptarget", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65596, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Swap target", + Summary: "Amount of memory that ESXi needs to reclaim by swapping", + }, + Key: "swaptarget", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "maximum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65597, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Swap target", + Summary: "Amount of memory that ESXi needs to reclaim by swapping", + }, + Key: "swaptarget", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "minimum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65598, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Swap in", + Summary: "Amount of guest physical memory that is swapped in from the swap space since the virtual machine has been powered on. This value is less than or equal to the 'Swap out' counter", + }, + Key: "swapin", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "none", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{65599, 65600, 65601}, + }, + { + Key: 65599, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Swap in", + Summary: "Amount of guest physical memory that is swapped in from the swap space since the virtual machine has been powered on. This value is less than or equal to the 'Swap out' counter", + }, + Key: "swapin", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65600, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Swap in", + Summary: "Amount of guest physical memory that is swapped in from the swap space since the virtual machine has been powered on. This value is less than or equal to the 'Swap out' counter", + }, + Key: "swapin", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "maximum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65601, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Swap in", + Summary: "Amount of guest physical memory that is swapped in from the swap space since the virtual machine has been powered on. This value is less than or equal to the 'Swap out' counter", + }, + Key: "swapin", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "minimum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65602, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Swap out", + Summary: "Amount of guest physical memory that is swapped out from the virtual machine to its swap space since it has been powered on.", + }, + Key: "swapout", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "none", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{65603, 65604, 65605}, + }, + { + Key: 65603, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Swap out", + Summary: "Amount of guest physical memory that is swapped out from the virtual machine to its swap space since it has been powered on.", + }, + Key: "swapout", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65604, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Swap out", + Summary: "Amount of guest physical memory that is swapped out from the virtual machine to its swap space since it has been powered on.", + }, + Key: "swapout", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "maximum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65605, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Swap out", + Summary: "Amount of guest physical memory that is swapped out from the virtual machine to its swap space since it has been powered on.", + }, + Key: "swapout", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "minimum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65606, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Balloon target", + Summary: "Desired amount of guest physical memory the balloon driver needs to reclaim, as determined by ESXi", + }, + Key: "vmmemctltarget", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "none", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{65607, 65608, 65609}, + }, + { + Key: 65607, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Balloon target", + Summary: "Desired amount of guest physical memory the balloon driver needs to reclaim, as determined by ESXi", + }, + Key: "vmmemctltarget", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65608, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Balloon target", + Summary: "Desired amount of guest physical memory the balloon driver needs to reclaim, as determined by ESXi", + }, + Key: "vmmemctltarget", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "maximum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65609, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Balloon target", + Summary: "Desired amount of guest physical memory the balloon driver needs to reclaim, as determined by ESXi", + }, + Key: "vmmemctltarget", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "minimum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65610, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Consumed", + Summary: "Amount of host physical memory consumed for backing up guest physical memory pages", + }, + Key: "consumed", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "none", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{65611, 65612, 65613}, + }, + { + Key: 65611, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Consumed", + Summary: "Amount of host physical memory consumed for backing up guest physical memory pages", + }, + Key: "consumed", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65612, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Consumed", + Summary: "Amount of host physical memory consumed for backing up guest physical memory pages", + }, + Key: "consumed", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "maximum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65613, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Consumed", + Summary: "Amount of host physical memory consumed for backing up guest physical memory pages", + }, + Key: "consumed", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "minimum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65614, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "VMkernel consumed", + Summary: "Amount of host physical memory consumed by VMkernel", + }, + Key: "sysUsage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "none", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{65615, 65616, 65617}, + }, + { + Key: 65615, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "VMkernel consumed", + Summary: "Amount of host physical memory consumed by VMkernel", + }, + Key: "sysUsage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65616, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "VMkernel consumed", + Summary: "Amount of host physical memory consumed by VMkernel", + }, + Key: "sysUsage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "maximum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65617, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "VMkernel consumed", + Summary: "Amount of host physical memory consumed by VMkernel", + }, + Key: "sysUsage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "minimum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65618, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Swap in rate", + Summary: "Rate at which guest physical memory is swapped in from the swap space", + }, + Key: "swapinRate", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65619, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Swap out rate", + Summary: "Rate at which guest physical memory is swapped out to the swap space", + }, + Key: "swapoutRate", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65620, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Active write", + Summary: "Amount of guest physical memory that is being actively written by guest. Activeness is estimated by ESXi", + }, + Key: "activewrite", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65621, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Compressed", + Summary: "Guest physical memory pages that have undergone memory compression", + }, + Key: "compressed", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65622, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Compression rate", + Summary: "Rate of guest physical memory page compression by ESXi", + }, + Key: "compressionRate", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65623, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Decompression rate", + Summary: "Rate of guest physical memory decompression", + }, + Key: "decompressionRate", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65624, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Overhead reserved", + Summary: "Host physical memory reserved by ESXi, for its data structures, for running the virtual machine", + }, + Key: "overheadMax", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65625, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Total reservation", + Summary: "Total reservation, available and consumed, for powered-on virtual machines", + }, + Key: "totalCapacity", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "MB", + Summary: "Megabyte", + }, + Key: "megaBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65626, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Compressed", + Summary: "Amount of guest physical memory pages compressed by ESXi", + }, + Key: "zipped", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65627, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Compression saved", + Summary: "Host physical memory, reclaimed from a virtual machine, by memory compression. This value is less than the value of 'Compressed' memory", + }, + Key: "zipSaved", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65628, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Page-fault latency", + Summary: "Percentage of time the virtual machine spent waiting to swap in or decompress guest physical memory", + }, + Key: "latency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65629, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Entitlement", + Summary: "Amount of host physical memory the virtual machine deserves, as determined by ESXi", + }, + Key: "entitlement", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65630, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Reclamation threshold", + Summary: "Threshold of free host physical memory below which ESXi will begin actively reclaiming memory from virtual machines by swapping, compression and ballooning", + }, + Key: "lowfreethreshold", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65631, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Host cache consumed", + Summary: "Storage space consumed on the host swap cache for storing swapped guest physical memory pages", + }, + Key: "llSwapUsed", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "none", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{65635, 65636, 65637}, + }, + { + Key: 65632, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Host cache swap in rate", + Summary: "Rate at which guest physical memory is swapped in from the host swap cache", + }, + Key: "llSwapInRate", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65633, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Host cache swap out rate", + Summary: "Rate at which guest physical memory is swapped out to the host swap cache", + }, + Key: "llSwapOutRate", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65634, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Overhead active", + Summary: "Estimate of the host physical memory, from Overhead consumed, that is actively read or written to by ESXi", + }, + Key: "overheadTouched", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65635, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Host cache consumed", + Summary: "Storage space consumed on the host swap cache for storing swapped guest physical memory pages", + }, + Key: "llSwapUsed", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65636, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Host cache consumed", + Summary: "Storage space consumed on the host swap cache for storing swapped guest physical memory pages", + }, + Key: "llSwapUsed", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "maximum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65637, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Host cache consumed", + Summary: "Storage space consumed on the host swap cache for storing swapped guest physical memory pages", + }, + Key: "llSwapUsed", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "minimum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65638, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Host cache swap in", + Summary: "Amount of guest physical memory swapped in from host cache", + }, + Key: "llSwapIn", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "none", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{65639, 65640, 65641}, + }, + { + Key: 65639, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Host cache swap in", + Summary: "Amount of guest physical memory swapped in from host cache", + }, + Key: "llSwapIn", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65640, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Host cache swap in", + Summary: "Amount of guest physical memory swapped in from host cache", + }, + Key: "llSwapIn", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "maximum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65641, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Host cache swap in", + Summary: "Amount of guest physical memory swapped in from host cache", + }, + Key: "llSwapIn", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "minimum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65642, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Host cache swap out", + Summary: "Amount of guest physical memory swapped out to the host swap cache", + }, + Key: "llSwapOut", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "none", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{65643, 65644, 65645}, + }, + { + Key: 65643, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Host cache swap out", + Summary: "Amount of guest physical memory swapped out to the host swap cache", + }, + Key: "llSwapOut", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65644, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Host cache swap out", + Summary: "Amount of guest physical memory swapped out to the host swap cache", + }, + Key: "llSwapOut", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "maximum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65645, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Host cache swap out", + Summary: "Amount of guest physical memory swapped out to the host swap cache", + }, + Key: "llSwapOut", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "minimum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65646, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "VMFS PB Cache Size", + Summary: "Space used for holding VMFS Pointer Blocks in memory", + }, + Key: "vmfs.pbc.size", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "MB", + Summary: "Megabyte", + }, + Key: "megaBytes", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65647, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Maximum VMFS PB Cache Size", + Summary: "Maximum size the VMFS Pointer Block Cache can grow to", + }, + Key: "vmfs.pbc.sizeMax", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "MB", + Summary: "Megabyte", + }, + Key: "megaBytes", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65648, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "VMFS Working Set", + Summary: "Amount of file blocks whose addresses are cached in the VMFS PB Cache", + }, + Key: "vmfs.pbc.workingSet", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "TB", + Summary: "Terabyte", + }, + Key: "teraBytes", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65649, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Maximum VMFS Working Set", + Summary: "Maximum amount of file blocks whose addresses are cached in the VMFS PB Cache", + }, + Key: "vmfs.pbc.workingSetMax", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "TB", + Summary: "Terabyte", + }, + Key: "teraBytes", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65650, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "VMFS PB Cache Overhead", + Summary: "Amount of VMFS heap used by the VMFS PB Cache", + }, + Key: "vmfs.pbc.overhead", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 65651, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "VMFS PB Cache Capacity Miss Ratio", + Summary: "Trailing average of the ratio of capacity misses to compulsory misses for the VMFS PB Cache", + }, + Key: "vmfs.pbc.capMissRatio", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory", + Summary: "Memory", + }, + Key: "mem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131072, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Usage", + Summary: "Aggregated disk I/O rate. For hosts, this metric includes the rates for all virtual machines running on the host during the collection interval.", + }, + Key: "usage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "none", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{131073, 131074, 131075}, + }, + { + Key: 131073, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Usage", + Summary: "Aggregated disk I/O rate. For hosts, this metric includes the rates for all virtual machines running on the host during the collection interval.", + }, + Key: "usage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131074, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Usage", + Summary: "Aggregated disk I/O rate. For hosts, this metric includes the rates for all virtual machines running on the host during the collection interval.", + }, + Key: "usage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "maximum", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131075, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Usage", + Summary: "Aggregated disk I/O rate. For hosts, this metric includes the rates for all virtual machines running on the host during the collection interval.", + }, + Key: "usage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "minimum", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131076, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Read requests", + Summary: "Number of disk reads during the collection interval", + }, + Key: "numberRead", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131077, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Write requests", + Summary: "Number of disk writes during the collection interval", + }, + Key: "numberWrite", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131078, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Read rate", + Summary: "Average number of kilobytes read from the disk each second during the collection interval", + }, + Key: "read", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131079, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Write rate", + Summary: "Average number of kilobytes written to disk each second during the collection interval", + }, + Key: "write", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131080, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Commands issued", + Summary: "Number of SCSI commands issued during the collection interval", + }, + Key: "commands", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131081, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Commands aborted", + Summary: "Number of SCSI commands aborted during the collection interval", + }, + Key: "commandsAborted", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131082, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Bus resets", + Summary: "Number of SCSI-bus reset commands issued during the collection interval", + }, + Key: "busResets", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131083, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Physical device read latency", + Summary: "Average amount of time, in milliseconds, to read from the physical device", + }, + Key: "deviceReadLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131084, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Kernel read latency", + Summary: "Average amount of time, in milliseconds, spent by VMkernel to process each SCSI read command", + }, + Key: "kernelReadLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131085, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Read latency", + Summary: "Average amount of time taken during the collection interval to process a SCSI read command issued from the guest OS to the virtual machine", + }, + Key: "totalReadLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131086, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Queue read latency", + Summary: "Average amount of time spent in the VMkernel queue, per SCSI read command, during the collection interval", + }, + Key: "queueReadLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131087, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Physical device write latency", + Summary: "Average amount of time, in milliseconds, to write to the physical device", + }, + Key: "deviceWriteLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131088, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Kernel write latency", + Summary: "Average amount of time, in milliseconds, spent by VMkernel to process each SCSI write command", + }, + Key: "kernelWriteLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131089, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Write latency", + Summary: "Average amount of time taken during the collection interval to process a SCSI write command issued by the guest OS to the virtual machine", + }, + Key: "totalWriteLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131090, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Queue write latency", + Summary: "Average amount of time spent in the VMkernel queue, per SCSI write command, during the collection interval", + }, + Key: "queueWriteLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131091, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Physical device command latency", + Summary: "Average amount of time, in milliseconds, to complete a SCSI command from the physical device", + }, + Key: "deviceLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131092, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Kernel command latency", + Summary: "Average amount of time, in milliseconds, spent by VMkernel to process each SCSI command", + }, + Key: "kernelLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131093, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Command latency", + Summary: "Average amount of time taken during the collection interval to process a SCSI command issued by the guest OS to the virtual machine", + }, + Key: "totalLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131094, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Queue command latency", + Summary: "Average amount of time spent in the VMkernel queue, per SCSI command, during the collection interval", + }, + Key: "queueLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131095, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Highest latency", + Summary: "Highest latency value across all disks used by the host", + }, + Key: "maxTotalLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131096, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Maximum queue depth", + Summary: "Maximum queue depth", + }, + Key: "maxQueueDepth", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131097, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Average read requests per second", + Summary: "Average number of disk reads per second during the collection interval", + }, + Key: "numberReadAveraged", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131098, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Average write requests per second", + Summary: "Average number of disk writes per second during the collection interval", + }, + Key: "numberWriteAveraged", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 131099, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Average commands issued per second", + Summary: "Average number of SCSI commands issued per second during the collection interval", + }, + Key: "commandsAveraged", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk", + Summary: "Disk", + }, + Key: "disk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 196608, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Usage", + Summary: "Network utilization (combined transmit-rates and receive-rates) during the interval", + }, + Key: "usage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Network", + Summary: "Network", + }, + Key: "net", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "none", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{196609, 196610, 196611}, + }, + { + Key: 196609, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Usage", + Summary: "Network utilization (combined transmit-rates and receive-rates) during the interval", + }, + Key: "usage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Network", + Summary: "Network", + }, + Key: "net", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 196610, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Usage", + Summary: "Network utilization (combined transmit-rates and receive-rates) during the interval", + }, + Key: "usage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Network", + Summary: "Network", + }, + Key: "net", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "maximum", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 196611, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Usage", + Summary: "Network utilization (combined transmit-rates and receive-rates) during the interval", + }, + Key: "usage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Network", + Summary: "Network", + }, + Key: "net", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "minimum", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 196612, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Packets received", + Summary: "Number of packets received during the interval", + }, + Key: "packetsRx", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Network", + Summary: "Network", + }, + Key: "net", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 196613, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Packets transmitted", + Summary: "Number of packets transmitted during the interval", + }, + Key: "packetsTx", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Network", + Summary: "Network", + }, + Key: "net", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 196614, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Data receive rate", + Summary: "Average rate at which data was received during the interval", + }, + Key: "received", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Network", + Summary: "Network", + }, + Key: "net", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 196615, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Data transmit rate", + Summary: "Average rate at which data was transmitted during the interval", + }, + Key: "transmitted", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Network", + Summary: "Network", + }, + Key: "net", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 196616, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Receive packets dropped", + Summary: "Number of receives dropped", + }, + Key: "droppedRx", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Network", + Summary: "Network", + }, + Key: "net", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 196617, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Transmit packets dropped", + Summary: "Number of transmits dropped", + }, + Key: "droppedTx", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Network", + Summary: "Network", + }, + Key: "net", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 196618, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Data receive rate", + Summary: "Average amount of data received per second", + }, + Key: "bytesRx", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Network", + Summary: "Network", + }, + Key: "net", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 196619, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Data transmit rate", + Summary: "Average amount of data transmitted per second", + }, + Key: "bytesTx", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Network", + Summary: "Network", + }, + Key: "net", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 196620, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Broadcast receives", + Summary: "Number of broadcast packets received during the sampling interval", + }, + Key: "broadcastRx", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Network", + Summary: "Network", + }, + Key: "net", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 196621, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Broadcast transmits", + Summary: "Number of broadcast packets transmitted during the sampling interval", + }, + Key: "broadcastTx", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Network", + Summary: "Network", + }, + Key: "net", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 196622, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Multicast receives", + Summary: "Number of multicast packets received during the sampling interval", + }, + Key: "multicastRx", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Network", + Summary: "Network", + }, + Key: "net", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 196623, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Multicast transmits", + Summary: "Number of multicast packets transmitted during the sampling interval", + }, + Key: "multicastTx", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Network", + Summary: "Network", + }, + Key: "net", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 196624, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Packet receive errors", + Summary: "Number of packets with errors received during the sampling interval", + }, + Key: "errorsRx", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Network", + Summary: "Network", + }, + Key: "net", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 196625, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Packet transmit errors", + Summary: "Number of packets with errors transmitted during the sampling interval", + }, + Key: "errorsTx", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Network", + Summary: "Network", + }, + Key: "net", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 196626, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Unknown protocol frames", + Summary: "Number of frames with unknown protocol received during the sampling interval", + }, + Key: "unknownProtos", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Network", + Summary: "Network", + }, + Key: "net", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 196627, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "pnicBytesRx", + Summary: "pnicBytesRx", + }, + Key: "pnicBytesRx", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Network", + Summary: "Network", + }, + Key: "net", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 196628, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "pnicBytesTx", + Summary: "pnicBytesTx", + }, + Key: "pnicBytesTx", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Network", + Summary: "Network", + }, + Key: "net", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262144, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Uptime", + Summary: "Total time elapsed, in seconds, since last system startup", + }, + Key: "uptime", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "s", + Summary: "Second", + }, + Key: "second", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262145, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Heartbeat", + Summary: "Number of heartbeats issued per virtual machine during the interval", + }, + Key: "heartbeat", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262146, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Disk usage", + Summary: "Amount of disk space usage for each mount point", + }, + Key: "diskUsage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262147, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource CPU usage (None)", + Summary: "Amount of CPU used by the Service Console and other applications during the interval", + }, + Key: "resourceCpuUsage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "MHz", + Summary: "Megahertz", + }, + Key: "megaHertz", + }, + RollupType: "none", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{262148, 262149, 262150}, + }, + { + Key: 262148, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource CPU usage (Average)", + Summary: "Amount of CPU used by the Service Console and other applications during the interval", + }, + Key: "resourceCpuUsage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "MHz", + Summary: "Megahertz", + }, + Key: "megaHertz", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262149, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource CPU usage (Maximum)", + Summary: "Amount of CPU used by the Service Console and other applications during the interval", + }, + Key: "resourceCpuUsage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "MHz", + Summary: "Megahertz", + }, + Key: "megaHertz", + }, + RollupType: "maximum", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262150, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource CPU usage (Minimum)", + Summary: "Amount of CPU used by the Service Console and other applications during the interval", + }, + Key: "resourceCpuUsage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "MHz", + Summary: "Megahertz", + }, + Key: "megaHertz", + }, + RollupType: "minimum", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262151, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource memory touched", + Summary: "Memory touched by the system resource group", + }, + Key: "resourceMemTouched", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262152, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource memory mapped", + Summary: "Memory mapped by the system resource group", + }, + Key: "resourceMemMapped", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262153, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource memory share saved", + Summary: "Memory saved due to sharing by the system resource group", + }, + Key: "resourceMemShared", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262154, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource memory swapped", + Summary: "Memory swapped out by the system resource group", + }, + Key: "resourceMemSwapped", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262155, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource memory overhead", + Summary: "Overhead memory consumed by the system resource group", + }, + Key: "resourceMemOverhead", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262156, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource memory shared", + Summary: "Memory shared by the system resource group", + }, + Key: "resourceMemCow", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262157, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource memory zero", + Summary: "Zero filled memory used by the system resource group", + }, + Key: "resourceMemZero", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262158, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource CPU running (1 min. average)", + Summary: "CPU running average over 1 minute of the system resource group", + }, + Key: "resourceCpuRun1", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262159, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource CPU active (1 min average)", + Summary: "CPU active average over 1 minute of the system resource group", + }, + Key: "resourceCpuAct1", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262160, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource CPU maximum limited (1 min)", + Summary: "CPU maximum limited over 1 minute of the system resource group", + }, + Key: "resourceCpuMaxLimited1", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262161, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource CPU running (5 min average)", + Summary: "CPU running average over 5 minutes of the system resource group", + }, + Key: "resourceCpuRun5", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262162, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource CPU active (5 min average)", + Summary: "CPU active average over 5 minutes of the system resource group", + }, + Key: "resourceCpuAct5", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262163, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource CPU maximum limited (5 min)", + Summary: "CPU maximum limited over 5 minutes of the system resource group", + }, + Key: "resourceCpuMaxLimited5", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262164, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource CPU allocation minimum (in MHz)", + Summary: "CPU allocation reservation (in MHz) of the system resource group", + }, + Key: "resourceCpuAllocMin", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "MHz", + Summary: "Megahertz", + }, + Key: "megaHertz", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262165, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource CPU allocation maximum (in MHz)", + Summary: "CPU allocation limit (in MHz) of the system resource group", + }, + Key: "resourceCpuAllocMax", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "MHz", + Summary: "Megahertz", + }, + Key: "megaHertz", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262166, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource CPU allocation shares", + Summary: "CPU allocation shares of the system resource group", + }, + Key: "resourceCpuAllocShares", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262167, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource memory allocation minimum (in KB)", + Summary: "Memory allocation reservation (in KB) of the system resource group", + }, + Key: "resourceMemAllocMin", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262168, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource memory allocation maximum (in KB)", + Summary: "Memory allocation limit (in KB) of the system resource group", + }, + Key: "resourceMemAllocMax", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262169, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource memory allocation shares", + Summary: "Memory allocation shares of the system resource group", + }, + Key: "resourceMemAllocShares", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262170, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "OS Uptime", + Summary: "Total time elapsed, in seconds, since last operating system boot-up", + }, + Key: "osUptime", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "s", + Summary: "Second", + }, + Key: "second", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262171, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource memory consumed", + Summary: "Memory consumed by the system resource group", + }, + Key: "resourceMemConsumed", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 262172, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "File descriptors used", + Summary: "Number of file descriptors used by the system resource group", + }, + Key: "resourceFdUsage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "System", + Summary: "System", + }, + Key: "sys", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 327680, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Active (1 min average)", + Summary: "CPU active average over 1 minute", + }, + Key: "actav1", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource group CPU", + Summary: "Resource group CPU", + }, + Key: "rescpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 327681, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Active (1 min peak)", + Summary: "CPU active peak over 1 minute", + }, + Key: "actpk1", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource group CPU", + Summary: "Resource group CPU", + }, + Key: "rescpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 327682, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Running (1 min average)", + Summary: "CPU running average over 1 minute", + }, + Key: "runav1", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource group CPU", + Summary: "Resource group CPU", + }, + Key: "rescpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 327683, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Active (5 min average)", + Summary: "CPU active average over 5 minutes", + }, + Key: "actav5", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource group CPU", + Summary: "Resource group CPU", + }, + Key: "rescpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 327684, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Active (5 min peak)", + Summary: "CPU active peak over 5 minutes", + }, + Key: "actpk5", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource group CPU", + Summary: "Resource group CPU", + }, + Key: "rescpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 327685, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Running (5 min average)", + Summary: "CPU running average over 5 minutes", + }, + Key: "runav5", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource group CPU", + Summary: "Resource group CPU", + }, + Key: "rescpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 327686, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Active (15 min average)", + Summary: "CPU active average over 15 minutes", + }, + Key: "actav15", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource group CPU", + Summary: "Resource group CPU", + }, + Key: "rescpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 327687, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Active (15 min peak)", + Summary: "CPU active peak over 15 minutes", + }, + Key: "actpk15", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource group CPU", + Summary: "Resource group CPU", + }, + Key: "rescpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 327688, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Running (15 min average)", + Summary: "CPU running average over 15 minutes", + }, + Key: "runav15", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource group CPU", + Summary: "Resource group CPU", + }, + Key: "rescpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 327689, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Running (1 min peak)", + Summary: "CPU running peak over 1 minute", + }, + Key: "runpk1", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource group CPU", + Summary: "Resource group CPU", + }, + Key: "rescpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 327690, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Throttled (1 min average)", + Summary: "Amount of CPU resources over the limit that were refused, average over 1 minute", + }, + Key: "maxLimited1", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource group CPU", + Summary: "Resource group CPU", + }, + Key: "rescpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 327691, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Running (5 min peak)", + Summary: "CPU running peak over 5 minutes", + }, + Key: "runpk5", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource group CPU", + Summary: "Resource group CPU", + }, + Key: "rescpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 327692, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Throttled (5 min average)", + Summary: "Amount of CPU resources over the limit that were refused, average over 5 minutes", + }, + Key: "maxLimited5", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource group CPU", + Summary: "Resource group CPU", + }, + Key: "rescpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 327693, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Running (15 min peak)", + Summary: "CPU running peak over 15 minutes", + }, + Key: "runpk15", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource group CPU", + Summary: "Resource group CPU", + }, + Key: "rescpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 327694, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Throttled (15 min average)", + Summary: "Amount of CPU resources over the limit that were refused, average over 15 minutes", + }, + Key: "maxLimited15", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource group CPU", + Summary: "Resource group CPU", + }, + Key: "rescpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 327695, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Group CPU sample count", + Summary: "Group CPU sample count", + }, + Key: "sampleCount", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource group CPU", + Summary: "Resource group CPU", + }, + Key: "rescpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 327696, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Group CPU sample period", + Summary: "Group CPU sample period", + }, + Key: "samplePeriod", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Resource group CPU", + Summary: "Resource group CPU", + }, + Key: "rescpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 393216, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory used", + Summary: "Amount of total configured memory that is available for use", + }, + Key: "memUsed", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Management agent", + Summary: "Management agent", + }, + Key: "managementAgent", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 393217, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory swap used", + Summary: "Sum of the memory swapped by all powered-on virtual machines on the host", + }, + Key: "swapUsed", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Management agent", + Summary: "Management agent", + }, + Key: "managementAgent", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 393218, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory swap in", + Summary: "Amount of memory that is swapped in for the Service Console", + }, + Key: "swapIn", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Management agent", + Summary: "Management agent", + }, + Key: "managementAgent", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 393219, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory swap out", + Summary: "Amount of memory that is swapped out for the Service Console", + }, + Key: "swapOut", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Management agent", + Summary: "Management agent", + }, + Key: "managementAgent", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 393220, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "CPU usage", + Summary: "Amount of Service Console CPU usage", + }, + Key: "cpuUsage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Management agent", + Summary: "Management agent", + }, + Key: "managementAgent", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "MHz", + Summary: "Megahertz", + }, + Key: "megaHertz", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 458752, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Average commands issued per second", + Summary: "Average number of commands issued per second by the storage adapter during the collection interval", + }, + Key: "commandsAveraged", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage adapter", + Summary: "Storage adapter", + }, + Key: "storageAdapter", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 458753, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Average read requests per second", + Summary: "Average number of read commands issued per second by the storage adapter during the collection interval", + }, + Key: "numberReadAveraged", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage adapter", + Summary: "Storage adapter", + }, + Key: "storageAdapter", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 458754, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Average write requests per second", + Summary: "Average number of write commands issued per second by the storage adapter during the collection interval", + }, + Key: "numberWriteAveraged", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage adapter", + Summary: "Storage adapter", + }, + Key: "storageAdapter", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 458755, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Read rate", + Summary: "Rate of reading data by the storage adapter", + }, + Key: "read", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage adapter", + Summary: "Storage adapter", + }, + Key: "storageAdapter", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 458756, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Write rate", + Summary: "Rate of writing data by the storage adapter", + }, + Key: "write", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage adapter", + Summary: "Storage adapter", + }, + Key: "storageAdapter", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 458757, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Read latency", + Summary: "The average time a read by the storage adapter takes", + }, + Key: "totalReadLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage adapter", + Summary: "Storage adapter", + }, + Key: "storageAdapter", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 458758, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Write latency", + Summary: "The average time a write by the storage adapter takes", + }, + Key: "totalWriteLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage adapter", + Summary: "Storage adapter", + }, + Key: "storageAdapter", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 458759, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Highest latency", + Summary: "Highest latency value across all storage adapters used by the host", + }, + Key: "maxTotalLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage adapter", + Summary: "Storage adapter", + }, + Key: "storageAdapter", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 524288, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Average commands issued per second", + Summary: "Average number of commands issued per second on the storage path during the collection interval", + }, + Key: "commandsAveraged", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage path", + Summary: "Storage path", + }, + Key: "storagePath", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 524289, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Average read requests per second", + Summary: "Average number of read commands issued per second on the storage path during the collection interval", + }, + Key: "numberReadAveraged", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage path", + Summary: "Storage path", + }, + Key: "storagePath", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 524290, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Average write requests per second", + Summary: "Average number of write commands issued per second on the storage path during the collection interval", + }, + Key: "numberWriteAveraged", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage path", + Summary: "Storage path", + }, + Key: "storagePath", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 524291, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Read rate", + Summary: "Rate of reading data on the storage path", + }, + Key: "read", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage path", + Summary: "Storage path", + }, + Key: "storagePath", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 524292, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Write rate", + Summary: "Rate of writing data on the storage path", + }, + Key: "write", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage path", + Summary: "Storage path", + }, + Key: "storagePath", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 524293, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Read latency", + Summary: "The average time a read issued on the storage path takes", + }, + Key: "totalReadLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage path", + Summary: "Storage path", + }, + Key: "storagePath", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 524294, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Write latency", + Summary: "The average time a write issued on the storage path takes", + }, + Key: "totalWriteLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage path", + Summary: "Storage path", + }, + Key: "storagePath", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 524295, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Highest latency", + Summary: "Highest latency value across all storage paths used by the host", + }, + Key: "maxTotalLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage path", + Summary: "Storage path", + }, + Key: "storagePath", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 589824, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Average read requests per second", + Summary: "Average number of read commands issued per second to the virtual disk during the collection interval", + }, + Key: "numberReadAveraged", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Virtual disk", + Summary: "Virtual disk", + }, + Key: "virtualDisk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 589825, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Average write requests per second", + Summary: "Average number of write commands issued per second to the virtual disk during the collection interval", + }, + Key: "numberWriteAveraged", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Virtual disk", + Summary: "Virtual disk", + }, + Key: "virtualDisk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 589826, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Read rate", + Summary: "Rate of reading data from the virtual disk", + }, + Key: "read", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Virtual disk", + Summary: "Virtual disk", + }, + Key: "virtualDisk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 589827, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Write rate", + Summary: "Rate of writing data to the virtual disk", + }, + Key: "write", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Virtual disk", + Summary: "Virtual disk", + }, + Key: "virtualDisk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 589828, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Read latency", + Summary: "The average time a read from the virtual disk takes", + }, + Key: "totalReadLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Virtual disk", + Summary: "Virtual disk", + }, + Key: "virtualDisk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 589829, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Write latency", + Summary: "The average time a write to the virtual disk takes", + }, + Key: "totalWriteLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Virtual disk", + Summary: "Virtual disk", + }, + Key: "virtualDisk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 589830, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Average number of outstanding read requests", + Summary: "Average number of outstanding read requests to the virtual disk during the collection interval", + }, + Key: "readOIO", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Virtual disk", + Summary: "Virtual disk", + }, + Key: "virtualDisk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 589831, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Average number of outstanding write requests", + Summary: "Average number of outstanding write requests to the virtual disk during the collection interval", + }, + Key: "writeOIO", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Virtual disk", + Summary: "Virtual disk", + }, + Key: "virtualDisk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 589832, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Read workload metric", + Summary: "Storage DRS virtual disk metric for the read workload model", + }, + Key: "readLoadMetric", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Virtual disk", + Summary: "Virtual disk", + }, + Key: "virtualDisk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 589833, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Write workload metric", + Summary: "Storage DRS virtual disk metric for the write workload model", + }, + Key: "writeLoadMetric", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Virtual disk", + Summary: "Virtual disk", + }, + Key: "virtualDisk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 589834, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Read request size", + Summary: "Average read request size in bytes", + }, + Key: "readIOSize", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Virtual disk", + Summary: "Virtual disk", + }, + Key: "virtualDisk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 589835, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Write request size", + Summary: "Average write request size in bytes", + }, + Key: "writeIOSize", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Virtual disk", + Summary: "Virtual disk", + }, + Key: "virtualDisk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 589836, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Number of small seeks", + Summary: "Number of seeks during the interval that were less than 64 LBNs apart", + }, + Key: "smallSeeks", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Virtual disk", + Summary: "Virtual disk", + }, + Key: "virtualDisk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 589837, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Number of medium seeks", + Summary: "Number of seeks during the interval that were between 64 and 8192 LBNs apart", + }, + Key: "mediumSeeks", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Virtual disk", + Summary: "Virtual disk", + }, + Key: "virtualDisk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 589838, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Number of large seeks", + Summary: "Number of seeks during the interval that were greater than 8192 LBNs apart", + }, + Key: "largeSeeks", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Virtual disk", + Summary: "Virtual disk", + }, + Key: "virtualDisk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 589839, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Read Latency (us)", + Summary: "Read latency in microseconds", + }, + Key: "readLatencyUS", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Virtual disk", + Summary: "Virtual disk", + }, + Key: "virtualDisk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "µs", + Summary: "Microsecond", + }, + Key: "microsecond", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 589840, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Write Latency (us)", + Summary: "Write latency in microseconds", + }, + Key: "writeLatencyUS", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Virtual disk", + Summary: "Virtual disk", + }, + Key: "virtualDisk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "µs", + Summary: "Microsecond", + }, + Key: "microsecond", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 589841, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Virtual Flash Read Cache I/Os per second for the virtual disk", + Summary: "The average virtual Flash Read Cache I/Os per second value for the virtual disk", + }, + Key: "vFlashCacheIops", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Virtual disk", + Summary: "Virtual disk", + }, + Key: "virtualDisk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 589842, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Virtual Flash Read Cache latency for the virtual disk", + Summary: "The average virtual Flash Read Cache latency value for the virtual disk", + }, + Key: "vFlashCacheLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Virtual disk", + Summary: "Virtual disk", + }, + Key: "virtualDisk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "µs", + Summary: "Microsecond", + }, + Key: "microsecond", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 589843, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Virtual Flash Read Cache throughput for virtual disk", + Summary: "The average virtual Flash Read Cache throughput value for the virtual disk", + }, + Key: "vFlashCacheThroughput", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Virtual disk", + Summary: "Virtual disk", + }, + Key: "virtualDisk", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 655360, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Average read requests per second", + Summary: "Average number of read commands issued per second to the datastore during the collection interval", + }, + Key: "numberReadAveraged", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Datastore", + Summary: "Datastore", + }, + Key: "datastore", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 655361, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Average write requests per second", + Summary: "Average number of write commands issued per second to the datastore during the collection interval", + }, + Key: "numberWriteAveraged", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Datastore", + Summary: "Datastore", + }, + Key: "datastore", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 655362, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Read rate", + Summary: "Rate of reading data from the datastore", + }, + Key: "read", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Datastore", + Summary: "Datastore", + }, + Key: "datastore", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 655363, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Write rate", + Summary: "Rate of writing data to the datastore", + }, + Key: "write", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Datastore", + Summary: "Datastore", + }, + Key: "datastore", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 655364, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Read latency", + Summary: "The average time a read from the datastore takes", + }, + Key: "totalReadLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Datastore", + Summary: "Datastore", + }, + Key: "datastore", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 655365, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Write latency", + Summary: "The average time a write to the datastore takes", + }, + Key: "totalWriteLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Datastore", + Summary: "Datastore", + }, + Key: "datastore", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 655366, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage I/O Control normalized latency", + Summary: "Storage I/O Control size-normalized I/O latency", + }, + Key: "sizeNormalizedDatastoreLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Datastore", + Summary: "Datastore", + }, + Key: "datastore", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "µs", + Summary: "Microsecond", + }, + Key: "microsecond", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 655367, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage I/O Control aggregated IOPS", + Summary: "Storage I/O Control aggregated IOPS", + }, + Key: "datastoreIops", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Datastore", + Summary: "Datastore", + }, + Key: "datastore", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 655368, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage DRS datastore bytes read", + Summary: "Storage DRS datastore bytes read", + }, + Key: "datastoreReadBytes", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Datastore", + Summary: "Datastore", + }, + Key: "datastore", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 655369, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage DRS datastore bytes written", + Summary: "Storage DRS datastore bytes written", + }, + Key: "datastoreWriteBytes", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Datastore", + Summary: "Datastore", + }, + Key: "datastore", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 655370, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage DRS datastore read I/O rate", + Summary: "Storage DRS datastore read I/O rate", + }, + Key: "datastoreReadIops", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Datastore", + Summary: "Datastore", + }, + Key: "datastore", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 655371, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage DRS datastore write I/O rate", + Summary: "Storage DRS datastore write I/O rate", + }, + Key: "datastoreWriteIops", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Datastore", + Summary: "Datastore", + }, + Key: "datastore", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 655372, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage DRS datastore normalized read latency", + Summary: "Storage DRS datastore normalized read latency", + }, + Key: "datastoreNormalReadLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Datastore", + Summary: "Datastore", + }, + Key: "datastore", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 655373, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage DRS datastore normalized write latency", + Summary: "Storage DRS datastore normalized write latency", + }, + Key: "datastoreNormalWriteLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Datastore", + Summary: "Datastore", + }, + Key: "datastore", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 655374, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage DRS datastore outstanding read requests", + Summary: "Storage DRS datastore outstanding read requests", + }, + Key: "datastoreReadOIO", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Datastore", + Summary: "Datastore", + }, + Key: "datastore", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 655375, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage DRS datastore outstanding write requests", + Summary: "Storage DRS datastore outstanding write requests", + }, + Key: "datastoreWriteOIO", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Datastore", + Summary: "Datastore", + }, + Key: "datastore", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 655376, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage I/O Control datastore maximum queue depth", + Summary: "Storage I/O Control datastore maximum queue depth", + }, + Key: "datastoreMaxQueueDepth", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Datastore", + Summary: "Datastore", + }, + Key: "datastore", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 655377, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage DRS datastore read workload metric", + Summary: "Storage DRS datastore metric for read workload model", + }, + Key: "datastoreReadLoadMetric", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Datastore", + Summary: "Datastore", + }, + Key: "datastore", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 655378, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage DRS datastore write workload metric", + Summary: "Storage DRS datastore metric for write workload model", + }, + Key: "datastoreWriteLoadMetric", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Datastore", + Summary: "Datastore", + }, + Key: "datastore", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 655379, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Highest latency", + Summary: "Highest latency value across all datastores used by the host", + }, + Key: "maxTotalLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Datastore", + Summary: "Datastore", + }, + Key: "datastore", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 655380, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Storage I/O Control active time percentage", + Summary: "Percentage of time Storage I/O Control actively controlled datastore latency", + }, + Key: "siocActiveTimePercentage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Datastore", + Summary: "Datastore", + }, + Key: "datastore", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 655381, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Datastore latency observed by VMs", + Summary: "The average datastore latency as seen by virtual machines", + }, + Key: "datastoreVMObservedLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Datastore", + Summary: "Datastore", + }, + Key: "datastore", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "µs", + Summary: "Microsecond", + }, + Key: "microsecond", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 720896, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Usage", + Summary: "Current power usage", + }, + Key: "power", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Power", + Summary: "Power", + }, + Key: "power", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "W", + Summary: "Watt", + }, + Key: "watt", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 720897, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Cap", + Summary: "Maximum allowed power usage", + }, + Key: "powerCap", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Power", + Summary: "Power", + }, + Key: "power", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "W", + Summary: "Watt", + }, + Key: "watt", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 720898, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Energy usage", + Summary: "Total energy used since last stats reset", + }, + Key: "energy", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Power", + Summary: "Power", + }, + Key: "power", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "J", + Summary: "Joule", + }, + Key: "joule", + }, + RollupType: "summation", + StatsType: "delta", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 786432, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "vSphere Replication VM Count", + Summary: "Current number of replicated virtual machines", + }, + Key: "hbrNumVms", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "vSphere Replication", + Summary: "vSphere Replication", + }, + Key: "hbr", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 786433, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Replication Data Receive Rate", + Summary: "Average amount of data received per second", + }, + Key: "hbrNetRx", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "vSphere Replication", + Summary: "vSphere Replication", + }, + Key: "hbr", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 786434, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Replication Data Transmit Rate", + Summary: "Average amount of data transmitted per second", + }, + Key: "hbrNetTx", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "vSphere Replication", + Summary: "vSphere Replication", + }, + Key: "hbr", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 851968, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Number of caches controlled by the virtual flash module", + Summary: "Number of caches controlled by the virtual flash module", + }, + Key: "numActiveVMDKs", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Virtual flash", + Summary: "Virtual flash module related statistical values", + }, + Key: "vflashModule", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1245184, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Read IOPS", + Summary: "Read IOPS", + }, + Key: "readIops", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "VSAN DOM Objects", + Summary: "VSAN DOM object related statistical values", + }, + Key: "vsanDomObj", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1245185, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Read throughput", + Summary: "Read throughput in kBps", + }, + Key: "readThroughput", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "VSAN DOM Objects", + Summary: "VSAN DOM object related statistical values", + }, + Key: "vsanDomObj", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1245186, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Average read latency", + Summary: "Average read latency in ms", + }, + Key: "readAvgLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "VSAN DOM Objects", + Summary: "VSAN DOM object related statistical values", + }, + Key: "vsanDomObj", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1245187, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Max read latency", + Summary: "Max read latency in ms", + }, + Key: "readMaxLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "VSAN DOM Objects", + Summary: "VSAN DOM object related statistical values", + }, + Key: "vsanDomObj", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1245188, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Cache hit rate", + Summary: "Cache hit rate percentage", + }, + Key: "readCacheHitRate", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "VSAN DOM Objects", + Summary: "VSAN DOM object related statistical values", + }, + Key: "vsanDomObj", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1245189, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Read congestion per sampling interval", + Summary: "Read congestion", + }, + Key: "readCongestion", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "VSAN DOM Objects", + Summary: "VSAN DOM object related statistical values", + }, + Key: "vsanDomObj", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1245190, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Write IOPS", + Summary: "Write IOPS", + }, + Key: "writeIops", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "VSAN DOM Objects", + Summary: "VSAN DOM object related statistical values", + }, + Key: "vsanDomObj", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1245191, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Write throughput", + Summary: "Write throughput in kBps", + }, + Key: "writeThroughput", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "VSAN DOM Objects", + Summary: "VSAN DOM object related statistical values", + }, + Key: "vsanDomObj", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1245192, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Average write latency", + Summary: "Average write latency in ms", + }, + Key: "writeAvgLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "VSAN DOM Objects", + Summary: "VSAN DOM object related statistical values", + }, + Key: "vsanDomObj", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1245193, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Max write latency", + Summary: "Max write latency in ms", + }, + Key: "writeMaxLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "VSAN DOM Objects", + Summary: "VSAN DOM object related statistical values", + }, + Key: "vsanDomObj", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1245194, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Write congestion per sampling interval", + Summary: "Write congestion", + }, + Key: "writeCongestion", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "VSAN DOM Objects", + Summary: "VSAN DOM object related statistical values", + }, + Key: "vsanDomObj", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1245195, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Recovery write IOPS", + Summary: "Recovery write IOPS", + }, + Key: "recoveryWriteIops", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "VSAN DOM Objects", + Summary: "VSAN DOM object related statistical values", + }, + Key: "vsanDomObj", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1245196, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Recovery write through-put", + Summary: "Recovery write through-put in kBps", + }, + Key: "recoveryWriteThroughput", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "VSAN DOM Objects", + Summary: "VSAN DOM object related statistical values", + }, + Key: "vsanDomObj", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KBps", + Summary: "Kilobytes per second", + }, + Key: "kiloBytesPerSecond", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1245197, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Average recovery write latency", + Summary: "Average recovery write latency in ms", + }, + Key: "recoveryWriteAvgLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "VSAN DOM Objects", + Summary: "VSAN DOM object related statistical values", + }, + Key: "vsanDomObj", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1245198, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Max recovery write latency", + Summary: "Max recovery write latency in ms", + }, + Key: "recoveryWriteMaxLatency", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "VSAN DOM Objects", + Summary: "VSAN DOM object related statistical values", + }, + Key: "vsanDomObj", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "ms", + Summary: "Millisecond", + }, + Key: "millisecond", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1245199, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Recovery write congestion per sampling interval", + Summary: "Recovery write congestion", + }, + Key: "recoveryWriteCongestion", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "VSAN DOM Objects", + Summary: "VSAN DOM object related statistical values", + }, + Key: "vsanDomObj", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "num", + Summary: "Number", + }, + Key: "number", + }, + RollupType: "average", + StatsType: "rate", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1310720, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Utilization", + Summary: "The utilization of a GPU in percentages", + }, + Key: "utilization", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "GPU", + Summary: "GPU", + }, + Key: "gpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "none", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{1310721, 1310722, 1310723}, + }, + { + Key: 1310721, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Utilization", + Summary: "The utilization of a GPU in percentages", + }, + Key: "utilization", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "GPU", + Summary: "GPU", + }, + Key: "gpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1310722, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Utilization", + Summary: "The utilization of a GPU in percentages", + }, + Key: "utilization", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "GPU", + Summary: "GPU", + }, + Key: "gpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "maximum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1310723, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Utilization", + Summary: "The utilization of a GPU in percentages", + }, + Key: "utilization", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "GPU", + Summary: "GPU", + }, + Key: "gpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "minimum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1310724, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory used", + Summary: "The amount of GPU memory used in kilobytes", + }, + Key: "mem.used", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "GPU", + Summary: "GPU", + }, + Key: "gpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "none", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{1310725, 1310726, 1310727}, + }, + { + Key: 1310725, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory used", + Summary: "The amount of GPU memory used in kilobytes", + }, + Key: "mem.used", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "GPU", + Summary: "GPU", + }, + Key: "gpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1310726, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory used", + Summary: "The amount of GPU memory used in kilobytes", + }, + Key: "mem.used", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "GPU", + Summary: "GPU", + }, + Key: "gpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "maximum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1310727, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory used", + Summary: "The amount of GPU memory used in kilobytes", + }, + Key: "mem.used", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "GPU", + Summary: "GPU", + }, + Key: "gpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "KB", + Summary: "Kilobyte", + }, + Key: "kiloBytes", + }, + RollupType: "minimum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1310728, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory usage", + Summary: "The amount of GPU memory used in percentages of the total available", + }, + Key: "mem.usage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "GPU", + Summary: "GPU", + }, + Key: "gpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "none", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: []int32{1310729, 1310730, 1310731}, + }, + { + Key: 1310729, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory usage", + Summary: "The amount of GPU memory used in percentages of the total available", + }, + Key: "mem.usage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "GPU", + Summary: "GPU", + }, + Key: "gpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1310730, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory usage", + Summary: "The amount of GPU memory used in percentages of the total available", + }, + Key: "mem.usage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "GPU", + Summary: "GPU", + }, + Key: "gpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "maximum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1310731, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Memory usage", + Summary: "The amount of GPU memory used in percentages of the total available", + }, + Key: "mem.usage", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "GPU", + Summary: "GPU", + }, + Key: "gpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "%", + Summary: "Percentage", + }, + Key: "percent", + }, + RollupType: "minimum", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1310732, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Temperature", + Summary: "The temperature of a GPU in degrees celsius", + }, + Key: "temperature", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "GPU", + Summary: "GPU", + }, + Key: "gpu", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "℃", + Summary: "Temperature in degrees Celsius", + }, + Key: "celsius", + }, + RollupType: "average", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, + { + Key: 1376256, + NameInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "Persistent memory available reservation", + Summary: "Persistent memory available reservation on a host.", + }, + Key: "available.reservation", + }, + GroupInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "PMEM", + Summary: "PMEM", + }, + Key: "pmem", + }, + UnitInfo: &types.ElementDescription{ + Description: types.Description{ + Label: "MB", + Summary: "Megabyte", + }, + Key: "megaBytes", + }, + RollupType: "latest", + StatsType: "absolute", + Level: 0, + PerDeviceLevel: 0, + AssociatedCounterId: nil, + }, +} diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/resource_pool.go b/vendor/github.com/vmware/govmomi/simulator/esx/resource_pool.go new file mode 100644 index 00000000000..b8cb91d8d4b --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/esx/resource_pool.go @@ -0,0 +1,165 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 esx + +import ( + "time" + + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/types" +) + +// ResourcePool is the default template for ResourcePool properties. +// Capture method: +// govc pool.info "*" -dump +var ResourcePool = mo.ResourcePool{ + ManagedEntity: mo.ManagedEntity{ + ExtensibleManagedObject: mo.ExtensibleManagedObject{ + Self: types.ManagedObjectReference{Type: "ResourcePool", Value: "ha-root-pool"}, + Value: nil, + AvailableField: nil, + }, + Parent: &types.ManagedObjectReference{Type: "ComputeResource", Value: "ha-compute-res"}, + CustomValue: nil, + OverallStatus: "green", + ConfigStatus: "green", + ConfigIssue: nil, + EffectiveRole: []int32{-1}, + Permission: nil, + Name: "Resources", + DisabledMethod: []string{"CreateVApp", "CreateChildVM_Task"}, + RecentTask: nil, + DeclaredAlarmState: nil, + TriggeredAlarmState: nil, + AlarmActionsEnabled: (*bool)(nil), + Tag: nil, + }, + Summary: &types.ResourcePoolSummary{ + DynamicData: types.DynamicData{}, + Name: "Resources", + Config: types.ResourceConfigSpec{ + DynamicData: types.DynamicData{}, + Entity: &types.ManagedObjectReference{Type: "ResourcePool", Value: "ha-root-pool"}, + ChangeVersion: "", + LastModified: (*time.Time)(nil), + CpuAllocation: types.ResourceAllocationInfo{ + DynamicData: types.DynamicData{}, + Reservation: types.NewInt64(4121), + ExpandableReservation: types.NewBool(false), + Limit: types.NewInt64(4121), + Shares: &types.SharesInfo{ + DynamicData: types.DynamicData{}, + Shares: 9000, + Level: "custom", + }, + OverheadLimit: nil, + }, + MemoryAllocation: types.ResourceAllocationInfo{ + DynamicData: types.DynamicData{}, + Reservation: types.NewInt64(961), + ExpandableReservation: types.NewBool(false), + Limit: types.NewInt64(961), + Shares: &types.SharesInfo{ + DynamicData: types.DynamicData{}, + Shares: 9000, + Level: "custom", + }, + OverheadLimit: nil, + }, + }, + Runtime: types.ResourcePoolRuntimeInfo{ + DynamicData: types.DynamicData{}, + Memory: types.ResourcePoolResourceUsage{ + DynamicData: types.DynamicData{}, + ReservationUsed: 0, + ReservationUsedForVm: 0, + UnreservedForPool: 1007681536, + UnreservedForVm: 1007681536, + OverallUsage: 0, + MaxUsage: 1007681536, + }, + Cpu: types.ResourcePoolResourceUsage{ + DynamicData: types.DynamicData{}, + ReservationUsed: 0, + ReservationUsedForVm: 0, + UnreservedForPool: 4121, + UnreservedForVm: 4121, + OverallUsage: 0, + MaxUsage: 4121, + }, + OverallStatus: "green", + }, + QuickStats: (*types.ResourcePoolQuickStats)(nil), + ConfiguredMemoryMB: 0, + }, + Runtime: types.ResourcePoolRuntimeInfo{ + DynamicData: types.DynamicData{}, + Memory: types.ResourcePoolResourceUsage{ + DynamicData: types.DynamicData{}, + ReservationUsed: 0, + ReservationUsedForVm: 0, + UnreservedForPool: 1007681536, + UnreservedForVm: 1007681536, + OverallUsage: 0, + MaxUsage: 1007681536, + }, + Cpu: types.ResourcePoolResourceUsage{ + DynamicData: types.DynamicData{}, + ReservationUsed: 0, + ReservationUsedForVm: 0, + UnreservedForPool: 4121, + UnreservedForVm: 4121, + OverallUsage: 0, + MaxUsage: 4121, + }, + OverallStatus: "green", + }, + Owner: types.ManagedObjectReference{Type: "ComputeResource", Value: "ha-compute-res"}, + ResourcePool: nil, + Vm: nil, + Config: types.ResourceConfigSpec{ + DynamicData: types.DynamicData{}, + Entity: &types.ManagedObjectReference{Type: "ResourcePool", Value: "ha-root-pool"}, + ChangeVersion: "", + LastModified: (*time.Time)(nil), + CpuAllocation: types.ResourceAllocationInfo{ + DynamicData: types.DynamicData{}, + Reservation: types.NewInt64(4121), + ExpandableReservation: types.NewBool(false), + Limit: types.NewInt64(4121), + Shares: &types.SharesInfo{ + DynamicData: types.DynamicData{}, + Shares: 9000, + Level: "custom", + }, + OverheadLimit: nil, + }, + MemoryAllocation: types.ResourceAllocationInfo{ + DynamicData: types.DynamicData{}, + Reservation: types.NewInt64(961), + ExpandableReservation: types.NewBool(false), + Limit: types.NewInt64(961), + Shares: &types.SharesInfo{ + DynamicData: types.DynamicData{}, + Shares: 9000, + Level: "custom", + }, + OverheadLimit: nil, + }, + }, + ChildConfiguration: nil, +} diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/root_folder.go b/vendor/github.com/vmware/govmomi/simulator/esx/root_folder.go new file mode 100644 index 00000000000..3aefd1d812d --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/esx/root_folder.go @@ -0,0 +1,76 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 esx + +import ( + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/types" +) + +// RootFolder is the default template for the ServiceContent rootFolder property. +// Capture method: +// govc folder.info -dump / +var RootFolder = mo.Folder{ + ManagedEntity: mo.ManagedEntity{ + ExtensibleManagedObject: mo.ExtensibleManagedObject{ + Self: types.ManagedObjectReference{Type: "Folder", Value: "ha-folder-root"}, + Value: nil, + AvailableField: nil, + }, + Parent: (*types.ManagedObjectReference)(nil), + CustomValue: nil, + OverallStatus: "green", + ConfigStatus: "green", + ConfigIssue: nil, + EffectiveRole: []int32{-1}, + Permission: []types.Permission{ + { + DynamicData: types.DynamicData{}, + Entity: &types.ManagedObjectReference{Type: "Folder", Value: "ha-folder-root"}, + Principal: "vpxuser", + Group: false, + RoleId: -1, + Propagate: true, + }, + { + DynamicData: types.DynamicData{}, + Entity: &types.ManagedObjectReference{Type: "Folder", Value: "ha-folder-root"}, + Principal: "dcui", + Group: false, + RoleId: -1, + Propagate: true, + }, + { + DynamicData: types.DynamicData{}, + Entity: &types.ManagedObjectReference{Type: "Folder", Value: "ha-folder-root"}, + Principal: "root", + Group: false, + RoleId: -1, + Propagate: true, + }, + }, + Name: "ha-folder-root", + DisabledMethod: nil, + RecentTask: nil, + DeclaredAlarmState: nil, + TriggeredAlarmState: nil, + AlarmActionsEnabled: (*bool)(nil), + Tag: nil, + }, + ChildType: []string{"Datacenter"}, + ChildEntity: nil, +} diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/service_content.go b/vendor/github.com/vmware/govmomi/simulator/esx/service_content.go new file mode 100644 index 00000000000..cc8938f8782 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/esx/service_content.go @@ -0,0 +1,86 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 esx + +import "github.com/vmware/govmomi/vim25/types" + +// ServiceContent is the default template for the ServiceInstance content property. +// Capture method: +// govc object.collect -s -dump - content +var ServiceContent = types.ServiceContent{ + RootFolder: types.ManagedObjectReference{Type: "Folder", Value: "ha-folder-root"}, + PropertyCollector: types.ManagedObjectReference{Type: "PropertyCollector", Value: "ha-property-collector"}, + ViewManager: &types.ManagedObjectReference{Type: "ViewManager", Value: "ViewManager"}, + About: types.AboutInfo{ + Name: "VMware ESXi", + FullName: "VMware ESXi 6.5.0 build-5969303", + Vendor: "VMware, Inc.", + Version: "6.5.0", + Build: "5969303", + LocaleVersion: "INTL", + LocaleBuild: "000", + OsType: "vmnix-x86", + ProductLineId: "embeddedEsx", + ApiType: "HostAgent", + ApiVersion: "6.5", + InstanceUuid: "", + LicenseProductName: "VMware ESX Server", + LicenseProductVersion: "6.0", + }, + Setting: &types.ManagedObjectReference{Type: "OptionManager", Value: "HostAgentSettings"}, + UserDirectory: &types.ManagedObjectReference{Type: "UserDirectory", Value: "ha-user-directory"}, + SessionManager: &types.ManagedObjectReference{Type: "SessionManager", Value: "ha-sessionmgr"}, + AuthorizationManager: &types.ManagedObjectReference{Type: "AuthorizationManager", Value: "ha-authmgr"}, + ServiceManager: &types.ManagedObjectReference{Type: "ServiceManager", Value: "ha-servicemanager"}, + PerfManager: &types.ManagedObjectReference{Type: "PerformanceManager", Value: "ha-perfmgr"}, + ScheduledTaskManager: (*types.ManagedObjectReference)(nil), + AlarmManager: (*types.ManagedObjectReference)(nil), + EventManager: &types.ManagedObjectReference{Type: "EventManager", Value: "ha-eventmgr"}, + TaskManager: &types.ManagedObjectReference{Type: "TaskManager", Value: "ha-taskmgr"}, + ExtensionManager: (*types.ManagedObjectReference)(nil), + CustomizationSpecManager: (*types.ManagedObjectReference)(nil), + CustomFieldsManager: (*types.ManagedObjectReference)(nil), + AccountManager: &types.ManagedObjectReference{Type: "HostLocalAccountManager", Value: "ha-localacctmgr"}, + DiagnosticManager: &types.ManagedObjectReference{Type: "DiagnosticManager", Value: "ha-diagnosticmgr"}, + LicenseManager: &types.ManagedObjectReference{Type: "LicenseManager", Value: "ha-license-manager"}, + SearchIndex: &types.ManagedObjectReference{Type: "SearchIndex", Value: "ha-searchindex"}, + FileManager: &types.ManagedObjectReference{Type: "FileManager", Value: "ha-nfc-file-manager"}, + DatastoreNamespaceManager: &types.ManagedObjectReference{Type: "DatastoreNamespaceManager", Value: "ha-datastore-namespace-manager"}, + VirtualDiskManager: &types.ManagedObjectReference{Type: "VirtualDiskManager", Value: "ha-vdiskmanager"}, + VirtualizationManager: (*types.ManagedObjectReference)(nil), + SnmpSystem: (*types.ManagedObjectReference)(nil), + VmProvisioningChecker: (*types.ManagedObjectReference)(nil), + VmCompatibilityChecker: (*types.ManagedObjectReference)(nil), + OvfManager: &types.ManagedObjectReference{Type: "OvfManager", Value: "ha-ovf-manager"}, + IpPoolManager: (*types.ManagedObjectReference)(nil), + DvSwitchManager: &types.ManagedObjectReference{Type: "DistributedVirtualSwitchManager", Value: "ha-dvsmanager"}, + HostProfileManager: (*types.ManagedObjectReference)(nil), + ClusterProfileManager: (*types.ManagedObjectReference)(nil), + ComplianceManager: (*types.ManagedObjectReference)(nil), + LocalizationManager: &types.ManagedObjectReference{Type: "LocalizationManager", Value: "ha-l10n-manager"}, + StorageResourceManager: &types.ManagedObjectReference{Type: "StorageResourceManager", Value: "ha-storage-resource-manager"}, + GuestOperationsManager: &types.ManagedObjectReference{Type: "GuestOperationsManager", Value: "ha-guest-operations-manager"}, + OverheadMemoryManager: (*types.ManagedObjectReference)(nil), + CertificateManager: (*types.ManagedObjectReference)(nil), + IoFilterManager: (*types.ManagedObjectReference)(nil), + VStorageObjectManager: &types.ManagedObjectReference{Type: "HostVStorageObjectManager", Value: "ha-vstorage-object-manager"}, + HostSpecManager: (*types.ManagedObjectReference)(nil), + CryptoManager: &types.ManagedObjectReference{Type: "CryptoManager", Value: "ha-crypto-manager"}, + HealthUpdateManager: (*types.ManagedObjectReference)(nil), + FailoverClusterConfigurator: (*types.ManagedObjectReference)(nil), + FailoverClusterManager: (*types.ManagedObjectReference)(nil), +} diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/setting.go b/vendor/github.com/vmware/govmomi/simulator/esx/setting.go new file mode 100644 index 00000000000..933eaa475da --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/esx/setting.go @@ -0,0 +1,30 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 esx + +import "github.com/vmware/govmomi/vim25/types" + +// Setting is captured from ESX's HostSystem.configManager.advancedOption +// Capture method: +// govc object.collect -s -dump $(govc object.collect -s HostSystem:ha-host configManager.advancedOption) setting +var Setting = []types.BaseOptionValue{ + // This list is currently pruned to include a single option for testing + &types.OptionValue{ + Key: "Config.HostAgent.log.level", + Value: "info", + }, +} diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/virtual_device.go b/vendor/github.com/vmware/govmomi/simulator/esx/virtual_device.go new file mode 100644 index 00000000000..234113b4537 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/esx/virtual_device.go @@ -0,0 +1,242 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 esx + +import "github.com/vmware/govmomi/vim25/types" + +// VirtualDevice is the default set of VirtualDevice types created for a VirtualMachine +// Capture method: +// govc vm.create foo +// govc object.collect -s -dump vm/foo config.hardware.device +var VirtualDevice = []types.BaseVirtualDevice{ + &types.VirtualIDEController{ + VirtualController: types.VirtualController{ + VirtualDevice: types.VirtualDevice{ + DynamicData: types.DynamicData{}, + Key: 200, + DeviceInfo: &types.Description{ + DynamicData: types.DynamicData{}, + Label: "IDE 0", + Summary: "IDE 0", + }, + Backing: nil, + Connectable: (*types.VirtualDeviceConnectInfo)(nil), + SlotInfo: nil, + ControllerKey: 0, + UnitNumber: (*int32)(nil), + }, + BusNumber: 0, + Device: nil, + }, + }, + &types.VirtualIDEController{ + VirtualController: types.VirtualController{ + VirtualDevice: types.VirtualDevice{ + DynamicData: types.DynamicData{}, + Key: 201, + DeviceInfo: &types.Description{ + DynamicData: types.DynamicData{}, + Label: "IDE 1", + Summary: "IDE 1", + }, + Backing: nil, + Connectable: (*types.VirtualDeviceConnectInfo)(nil), + SlotInfo: nil, + ControllerKey: 0, + UnitNumber: (*int32)(nil), + }, + BusNumber: 1, + Device: nil, + }, + }, + &types.VirtualPS2Controller{ + VirtualController: types.VirtualController{ + VirtualDevice: types.VirtualDevice{ + DynamicData: types.DynamicData{}, + Key: 300, + DeviceInfo: &types.Description{ + DynamicData: types.DynamicData{}, + Label: "PS2 controller 0", + Summary: "PS2 controller 0", + }, + Backing: nil, + Connectable: (*types.VirtualDeviceConnectInfo)(nil), + SlotInfo: nil, + ControllerKey: 0, + UnitNumber: (*int32)(nil), + }, + BusNumber: 0, + Device: []int32{600, 700}, + }, + }, + &types.VirtualPCIController{ + VirtualController: types.VirtualController{ + VirtualDevice: types.VirtualDevice{ + DynamicData: types.DynamicData{}, + Key: 100, + DeviceInfo: &types.Description{ + DynamicData: types.DynamicData{}, + Label: "PCI controller 0", + Summary: "PCI controller 0", + }, + Backing: nil, + Connectable: (*types.VirtualDeviceConnectInfo)(nil), + SlotInfo: nil, + ControllerKey: 0, + UnitNumber: (*int32)(nil), + }, + BusNumber: 0, + Device: []int32{500, 12000}, + }, + }, + &types.VirtualSIOController{ + VirtualController: types.VirtualController{ + VirtualDevice: types.VirtualDevice{ + DynamicData: types.DynamicData{}, + Key: 400, + DeviceInfo: &types.Description{ + DynamicData: types.DynamicData{}, + Label: "SIO controller 0", + Summary: "SIO controller 0", + }, + Backing: nil, + Connectable: (*types.VirtualDeviceConnectInfo)(nil), + SlotInfo: nil, + ControllerKey: 0, + UnitNumber: (*int32)(nil), + }, + BusNumber: 0, + Device: nil, + }, + }, + &types.VirtualKeyboard{ + VirtualDevice: types.VirtualDevice{ + DynamicData: types.DynamicData{}, + Key: 600, + DeviceInfo: &types.Description{ + DynamicData: types.DynamicData{}, + Label: "Keyboard ", + Summary: "Keyboard", + }, + Backing: nil, + Connectable: (*types.VirtualDeviceConnectInfo)(nil), + SlotInfo: nil, + ControllerKey: 300, + UnitNumber: types.NewInt32(0), + }, + }, + &types.VirtualPointingDevice{ + VirtualDevice: types.VirtualDevice{ + DynamicData: types.DynamicData{}, + Key: 700, + DeviceInfo: &types.Description{ + DynamicData: types.DynamicData{}, + Label: "Pointing device", + Summary: "Pointing device; Device", + }, + Backing: &types.VirtualPointingDeviceDeviceBackingInfo{ + VirtualDeviceDeviceBackingInfo: types.VirtualDeviceDeviceBackingInfo{ + VirtualDeviceBackingInfo: types.VirtualDeviceBackingInfo{}, + DeviceName: "", + UseAutoDetect: types.NewBool(false), + }, + HostPointingDevice: "autodetect", + }, + Connectable: (*types.VirtualDeviceConnectInfo)(nil), + SlotInfo: nil, + ControllerKey: 300, + UnitNumber: types.NewInt32(1), + }, + }, + &types.VirtualMachineVideoCard{ + VirtualDevice: types.VirtualDevice{ + DynamicData: types.DynamicData{}, + Key: 500, + DeviceInfo: &types.Description{ + DynamicData: types.DynamicData{}, + Label: "Video card ", + Summary: "Video card", + }, + Backing: nil, + Connectable: (*types.VirtualDeviceConnectInfo)(nil), + SlotInfo: nil, + ControllerKey: 100, + UnitNumber: types.NewInt32(0), + }, + VideoRamSizeInKB: 4096, + NumDisplays: 1, + UseAutoDetect: types.NewBool(false), + Enable3DSupport: types.NewBool(false), + Use3dRenderer: "automatic", + GraphicsMemorySizeInKB: 262144, + }, + &types.VirtualMachineVMCIDevice{ + VirtualDevice: types.VirtualDevice{ + DynamicData: types.DynamicData{}, + Key: 12000, + DeviceInfo: &types.Description{ + DynamicData: types.DynamicData{}, + Label: "VMCI device", + Summary: "Device on the virtual machine PCI bus that provides support for the virtual machine communication interface", + }, + Backing: nil, + Connectable: (*types.VirtualDeviceConnectInfo)(nil), + SlotInfo: nil, + ControllerKey: 100, + UnitNumber: types.NewInt32(17), + }, + Id: -1, + AllowUnrestrictedCommunication: types.NewBool(false), + FilterEnable: types.NewBool(true), + FilterInfo: (*types.VirtualMachineVMCIDeviceFilterInfo)(nil), + }, +} + +// EthernetCard template for types.VirtualEthernetCard +var EthernetCard = types.VirtualE1000{ + VirtualEthernetCard: types.VirtualEthernetCard{ + VirtualDevice: types.VirtualDevice{ + DynamicData: types.DynamicData{}, + Key: 4000, + Backing: &types.VirtualEthernetCardNetworkBackingInfo{ + VirtualDeviceDeviceBackingInfo: types.VirtualDeviceDeviceBackingInfo{ + VirtualDeviceBackingInfo: types.VirtualDeviceBackingInfo{}, + DeviceName: "VM Network", + UseAutoDetect: types.NewBool(false), + }, + Network: (*types.ManagedObjectReference)(nil), + InPassthroughMode: types.NewBool(false), + }, + Connectable: &types.VirtualDeviceConnectInfo{ + DynamicData: types.DynamicData{}, + StartConnected: true, + AllowGuestControl: true, + Connected: false, + Status: "untried", + }, + SlotInfo: &types.VirtualDevicePciBusSlotInfo{ + VirtualDeviceBusSlotInfo: types.VirtualDeviceBusSlotInfo{}, + PciSlotNumber: 32, + }, + ControllerKey: 100, + UnitNumber: types.NewInt32(7), + }, + AddressType: "generated", + MacAddress: "", + WakeOnLanEnabled: types.NewBool(true), + }, +} diff --git a/vendor/github.com/vmware/govmomi/simulator/file_manager.go b/vendor/github.com/vmware/govmomi/simulator/file_manager.go new file mode 100644 index 00000000000..6e76b5fd02e --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/file_manager.go @@ -0,0 +1,251 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "io" + "os" + "path" + + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/simulator/esx" + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type FileManager struct { + mo.FileManager +} + +func NewFileManager(ref types.ManagedObjectReference) object.Reference { + m := &FileManager{} + m.Self = ref + return m +} + +func (f *FileManager) findDatastore(ref mo.Reference, name string) (*Datastore, types.BaseMethodFault) { + var refs []types.ManagedObjectReference + + switch obj := ref.(type) { + case *Folder: + refs = obj.ChildEntity + case *StoragePod: + refs = obj.ChildEntity + } + + for _, ref := range refs { + switch obj := Map.Get(ref).(type) { + case *Datastore: + if obj.Name == name { + return obj, nil + } + case *Folder, *StoragePod: + ds, _ := f.findDatastore(obj, name) + if ds != nil { + return ds, nil + } + } + } + + return nil, &types.InvalidDatastore{Name: name} +} + +func (f *FileManager) resolve(dc *types.ManagedObjectReference, name string) (string, types.BaseMethodFault) { + p, fault := parseDatastorePath(name) + if fault != nil { + return "", fault + } + + if dc == nil { + if Map.IsESX() { + dc = &esx.Datacenter.Self + } else { + return "", &types.InvalidArgument{InvalidProperty: "dc"} + } + } + + folder := Map.Get(*dc).(*mo.Datacenter).DatastoreFolder + + ds, fault := f.findDatastore(Map.Get(folder), p.Datastore) + if fault != nil { + return "", fault + } + + dir := ds.Info.GetDatastoreInfo().Url + + return path.Join(dir, p.Path), nil +} + +func (f *FileManager) fault(name string, err error, fault types.BaseFileFault) types.BaseMethodFault { + switch { + case os.IsNotExist(err): + fault = new(types.FileNotFound) + case os.IsExist(err): + fault = new(types.FileAlreadyExists) + } + + fault.GetFileFault().File = name + + return fault.(types.BaseMethodFault) +} + +func (f *FileManager) deleteDatastoreFile(req *types.DeleteDatastoreFile_Task) types.BaseMethodFault { + file, fault := f.resolve(req.Datacenter, req.Name) + if fault != nil { + return fault + } + + _, err := os.Stat(file) + if err != nil { + if os.IsNotExist(err) { + return f.fault(file, err, new(types.CannotDeleteFile)) + } + } + + err = os.RemoveAll(file) + if err != nil { + return f.fault(file, err, new(types.CannotDeleteFile)) + } + + return nil +} + +func (f *FileManager) DeleteDatastoreFileTask(req *types.DeleteDatastoreFile_Task) soap.HasFault { + task := CreateTask(f, "deleteDatastoreFile", func(*Task) (types.AnyType, types.BaseMethodFault) { + return nil, f.deleteDatastoreFile(req) + }) + + return &methods.DeleteDatastoreFile_TaskBody{ + Res: &types.DeleteDatastoreFile_TaskResponse{ + Returnval: task.Run(), + }, + } +} + +func (f *FileManager) MakeDirectory(req *types.MakeDirectory) soap.HasFault { + body := &methods.MakeDirectoryBody{} + + name, fault := f.resolve(req.Datacenter, req.Name) + if fault != nil { + body.Fault_ = Fault("", fault) + return body + } + + mkdir := os.Mkdir + + if isTrue(req.CreateParentDirectories) { + mkdir = os.MkdirAll + } + + err := mkdir(name, 0700) + if err != nil { + fault = f.fault(req.Name, err, new(types.CannotCreateFile)) + body.Fault_ = Fault(err.Error(), fault) + return body + } + + return body +} + +func (f *FileManager) moveDatastoreFile(req *types.MoveDatastoreFile_Task) types.BaseMethodFault { + src, fault := f.resolve(req.SourceDatacenter, req.SourceName) + if fault != nil { + return fault + } + + dst, fault := f.resolve(req.DestinationDatacenter, req.DestinationName) + if fault != nil { + return fault + } + + if !isTrue(req.Force) { + _, err := os.Stat(dst) + if err == nil { + return f.fault(dst, nil, new(types.FileAlreadyExistsFault)) + } + } + + err := os.Rename(src, dst) + if err != nil { + return f.fault(src, err, new(types.CannotAccessFile)) + } + + return nil +} + +func (f *FileManager) MoveDatastoreFileTask(req *types.MoveDatastoreFile_Task) soap.HasFault { + task := CreateTask(f, "moveDatastoreFile", func(*Task) (types.AnyType, types.BaseMethodFault) { + return nil, f.moveDatastoreFile(req) + }) + + return &methods.MoveDatastoreFile_TaskBody{ + Res: &types.MoveDatastoreFile_TaskResponse{ + Returnval: task.Run(), + }, + } +} + +func (f *FileManager) copyDatastoreFile(req *types.CopyDatastoreFile_Task) types.BaseMethodFault { + src, fault := f.resolve(req.SourceDatacenter, req.SourceName) + if fault != nil { + return fault + } + + dst, fault := f.resolve(req.DestinationDatacenter, req.DestinationName) + if fault != nil { + return fault + } + + if !isTrue(req.Force) { + _, err := os.Stat(dst) + if err == nil { + return f.fault(dst, nil, new(types.FileAlreadyExistsFault)) + } + } + + r, err := os.Open(src) + if err != nil { + return f.fault(dst, err, new(types.CannotAccessFile)) + } + defer r.Close() + + w, err := os.Create(dst) + if err != nil { + return f.fault(dst, err, new(types.CannotCreateFile)) + } + defer w.Close() + + if _, err = io.Copy(w, r); err != nil { + return f.fault(dst, err, new(types.CannotCreateFile)) + } + + return nil +} + +func (f *FileManager) CopyDatastoreFileTask(req *types.CopyDatastoreFile_Task) soap.HasFault { + task := CreateTask(f, "copyDatastoreFile", func(*Task) (types.AnyType, types.BaseMethodFault) { + return nil, f.copyDatastoreFile(req) + }) + + return &methods.CopyDatastoreFile_TaskBody{ + Res: &types.CopyDatastoreFile_TaskResponse{ + Returnval: task.Run(), + }, + } +} diff --git a/vendor/github.com/vmware/govmomi/simulator/folder.go b/vendor/github.com/vmware/govmomi/simulator/folder.go new file mode 100644 index 00000000000..f5dea3291e5 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/folder.go @@ -0,0 +1,471 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "fmt" + "math/rand" + "path" + "sync" + + "github.com/google/uuid" + + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type Folder struct { + mo.Folder + + m sync.Mutex +} + +// update references when objects are added/removed from a Folder +func (f *Folder) update(o mo.Reference, u func(types.ManagedObjectReference, []types.ManagedObjectReference) []types.ManagedObjectReference) { + ref := o.Reference() + + if f.Parent == nil { + return // this is the root folder + } + + switch ref.Type { + case "Datacenter", "Folder": + return // nothing to update + } + + dc := Map.getEntityDatacenter(f) + + switch ref.Type { + case "Network", "DistributedVirtualSwitch", "DistributedVirtualPortgroup": + dc.Network = u(ref, dc.Network) + case "Datastore": + dc.Datastore = u(ref, dc.Datastore) + } +} + +func networkSummary(n *mo.Network) *types.NetworkSummary { + return &types.NetworkSummary{ + Network: &n.Self, + Name: n.Name, + Accessible: true, + } +} + +func (f *Folder) putChild(o mo.Entity) { + Map.PutEntity(f, o) + + f.m.Lock() + defer f.m.Unlock() + + f.ChildEntity = AddReference(o.Reference(), f.ChildEntity) + + f.update(o, AddReference) + + switch e := o.(type) { + case *mo.Network: + e.Summary = networkSummary(e) + case *mo.OpaqueNetwork: + e.Summary = networkSummary(&e.Network) + case *DistributedVirtualPortgroup: + e.Summary = networkSummary(&e.Network) + } +} + +func (f *Folder) removeChild(o mo.Reference) { + Map.Remove(o.Reference()) + + f.m.Lock() + defer f.m.Unlock() + + f.ChildEntity = RemoveReference(o.Reference(), f.ChildEntity) + + f.update(o, RemoveReference) +} + +func (f *Folder) hasChildType(kind string) bool { + for _, t := range f.ChildType { + if t == kind { + return true + } + } + return false +} + +func (f *Folder) typeNotSupported() *soap.Fault { + return Fault(fmt.Sprintf("%s supports types: %#v", f.Self, f.ChildType), &types.NotSupported{}) +} + +type addStandaloneHost struct { + *Folder + + req *types.AddStandaloneHost_Task +} + +func (add *addStandaloneHost) Run(task *Task) (types.AnyType, types.BaseMethodFault) { + host, err := CreateStandaloneHost(add.Folder, add.req.Spec) + if err != nil { + return nil, err + } + + if add.req.AddConnected { + host.Runtime.ConnectionState = types.HostSystemConnectionStateConnected + } + + return host.Reference(), nil +} + +func (f *Folder) AddStandaloneHostTask(a *types.AddStandaloneHost_Task) soap.HasFault { + r := &methods.AddStandaloneHost_TaskBody{} + + if f.hasChildType("ComputeResource") && f.hasChildType("Folder") { + r.Res = &types.AddStandaloneHost_TaskResponse{ + Returnval: NewTask(&addStandaloneHost{f, a}).Run(), + } + } else { + r.Fault_ = f.typeNotSupported() + } + + return r +} + +func (f *Folder) CreateFolder(c *types.CreateFolder) soap.HasFault { + r := &methods.CreateFolderBody{} + + if f.hasChildType("Folder") { + folder := &Folder{} + + folder.Name = c.Name + folder.ChildType = f.ChildType + + f.putChild(folder) + + r.Res = &types.CreateFolderResponse{ + Returnval: folder.Self, + } + } else { + r.Fault_ = f.typeNotSupported() + } + + return r +} + +// StoragePod aka "Datastore Cluster" +type StoragePod struct { + mo.StoragePod +} + +func (f *Folder) CreateStoragePod(c *types.CreateStoragePod) soap.HasFault { + r := &methods.CreateStoragePodBody{} + + if f.hasChildType("StoragePod") { + pod := &StoragePod{} + + pod.Name = c.Name + pod.ChildType = []string{"Datastore"} + + f.putChild(pod) + + r.Res = &types.CreateStoragePodResponse{ + Returnval: pod.Self, + } + } else { + r.Fault_ = f.typeNotSupported() + } + + return r +} + +func (p *StoragePod) MoveIntoFolderTask(c *types.MoveIntoFolder_Task) soap.HasFault { + return (&Folder{Folder: p.Folder}).MoveIntoFolderTask(c) +} + +func (f *Folder) CreateDatacenter(c *types.CreateDatacenter) soap.HasFault { + r := &methods.CreateDatacenterBody{} + + if f.hasChildType("Datacenter") && f.hasChildType("Folder") { + dc := &mo.Datacenter{} + + dc.Name = c.Name + + f.putChild(dc) + + createDatacenterFolders(dc, true) + + r.Res = &types.CreateDatacenterResponse{ + Returnval: dc.Self, + } + } else { + r.Fault_ = f.typeNotSupported() + } + + return r +} + +func (f *Folder) CreateClusterEx(c *types.CreateClusterEx) soap.HasFault { + r := &methods.CreateClusterExBody{} + + if f.hasChildType("ComputeResource") && f.hasChildType("Folder") { + cluster, err := CreateClusterComputeResource(f, c.Name, c.Spec) + if err != nil { + r.Fault_ = Fault("", err) + return r + } + + r.Res = &types.CreateClusterExResponse{ + Returnval: cluster.Self, + } + } else { + r.Fault_ = f.typeNotSupported() + } + + return r +} + +type createVM struct { + *Folder + + req *types.CreateVM_Task + + register bool +} + +func (c *createVM) Run(task *Task) (types.AnyType, types.BaseMethodFault) { + vm, err := NewVirtualMachine(c.Folder.Self, &c.req.Config) + if err != nil { + return nil, err + } + + vm.ResourcePool = &c.req.Pool + + if c.req.Host == nil { + var hosts []types.ManagedObjectReference + + pool := Map.Get(c.req.Pool).(mo.Entity) + + switch cr := Map.getEntityComputeResource(pool).(type) { + case *mo.ComputeResource: + hosts = cr.Host + case *ClusterComputeResource: + hosts = cr.Host + } + + // Assuming for now that all hosts have access to the datastore + host := hosts[rand.Intn(len(hosts))] + vm.Runtime.Host = &host + } else { + vm.Runtime.Host = c.req.Host + } + + vm.Guest = &types.GuestInfo{ + ToolsStatus: types.VirtualMachineToolsStatusToolsNotInstalled, + ToolsVersion: "0", + } + + vm.Summary.Guest = &types.VirtualMachineGuestSummary{ + ToolsStatus: vm.Guest.ToolsStatus, + } + vm.Summary.Config.VmPathName = vm.Config.Files.VmPathName + vm.Summary.Runtime.Host = vm.Runtime.Host + + err = vm.create(&c.req.Config, c.register) + if err != nil { + return nil, err + } + + c.Folder.putChild(vm) + + host := Map.Get(*vm.Runtime.Host).(*HostSystem) + host.Vm = append(host.Vm, vm.Self) + + for i := range vm.Datastore { + ds := Map.Get(vm.Datastore[i]).(*Datastore) + ds.Vm = append(ds.Vm, vm.Self) + } + + switch rp := Map.Get(*vm.ResourcePool).(type) { + case *ResourcePool: + rp.Vm = append(rp.Vm, vm.Self) + case *VirtualApp: + rp.Vm = append(rp.Vm, vm.Self) + } + + return vm.Reference(), nil +} + +func (f *Folder) CreateVMTask(c *types.CreateVM_Task) soap.HasFault { + return &methods.CreateVM_TaskBody{ + Res: &types.CreateVM_TaskResponse{ + Returnval: NewTask(&createVM{f, c, false}).Run(), + }, + } +} + +type registerVM struct { + *Folder + + req *types.RegisterVM_Task +} + +func (c *registerVM) Run(task *Task) (types.AnyType, types.BaseMethodFault) { + host := c.req.Host + pool := c.req.Pool + + if c.req.AsTemplate { + if host == nil { + return nil, &types.InvalidArgument{InvalidProperty: "host"} + } else if pool != nil { + return nil, &types.InvalidArgument{InvalidProperty: "pool"} + } + + pool = hostParent(&Map.Get(*host).(*HostSystem).HostSystem).ResourcePool + } else { + if pool == nil { + return nil, &types.InvalidArgument{InvalidProperty: "pool"} + } + } + + if c.req.Path == "" { + return nil, &types.InvalidArgument{InvalidProperty: "path"} + } + + s := Map.SearchIndex() + r := s.FindByDatastorePath(&types.FindByDatastorePath{ + This: s.Reference(), + Path: c.req.Path, + Datacenter: Map.getEntityDatacenter(c.Folder).Reference(), + }) + + if ref := r.(*methods.FindByDatastorePathBody).Res.Returnval; ref != nil { + return nil, &types.AlreadyExists{Name: ref.Value} + } + + if c.req.Name == "" { + p, err := parseDatastorePath(c.req.Path) + if err != nil { + return nil, err + } + + c.req.Name = path.Dir(p.Path) + } + + create := NewTask(&createVM{ + Folder: c.Folder, + register: true, + req: &types.CreateVM_Task{ + This: c.Folder.Reference(), + Config: types.VirtualMachineConfigSpec{ + Name: c.req.Name, + Files: &types.VirtualMachineFileInfo{ + VmPathName: c.req.Path, + }, + }, + Pool: *pool, + Host: host, + }, + }) + + create.Run() + + if create.Info.Error != nil { + return nil, create.Info.Error.Fault + } + + return create.Info.Result, nil +} + +func (f *Folder) RegisterVMTask(c *types.RegisterVM_Task) soap.HasFault { + return &methods.RegisterVM_TaskBody{ + Res: &types.RegisterVM_TaskResponse{ + Returnval: NewTask(®isterVM{f, c}).Run(), + }, + } +} + +func (f *Folder) MoveIntoFolderTask(c *types.MoveIntoFolder_Task) soap.HasFault { + task := CreateTask(f, "moveIntoFolder", func(t *Task) (types.AnyType, types.BaseMethodFault) { + for _, ref := range c.List { + obj := Map.Get(ref).(mo.Entity) + + parent, ok := Map.Get(*(obj.Entity()).Parent).(*Folder) + + if !ok || !f.hasChildType(ref.Type) { + return nil, &types.NotSupported{} + } + + parent.removeChild(ref) + f.putChild(obj) + } + + return nil, nil + }) + + return &methods.MoveIntoFolder_TaskBody{ + Res: &types.MoveIntoFolder_TaskResponse{ + Returnval: task.Run(), + }, + } +} + +func (f *Folder) CreateDVSTask(req *types.CreateDVS_Task) soap.HasFault { + task := CreateTask(f, "createDVS", func(t *Task) (types.AnyType, types.BaseMethodFault) { + spec := req.Spec.ConfigSpec.GetDVSConfigSpec() + dvs := &DistributedVirtualSwitch{} + dvs.Name = spec.Name + dvs.Entity().Name = dvs.Name + + if Map.FindByName(dvs.Name, f.ChildEntity) != nil { + return nil, &types.InvalidArgument{InvalidProperty: "name"} + } + + dvs.Uuid = uuid.New().String() + + f.putChild(dvs) + + dvs.Summary = types.DVSSummary{ + Name: dvs.Name, + Uuid: dvs.Uuid, + NumPorts: spec.NumStandalonePorts, + ProductInfo: req.Spec.ProductInfo, + Description: spec.Description, + } + + if dvs.Summary.ProductInfo == nil { + product := Map.content().About + dvs.Summary.ProductInfo = &types.DistributedVirtualSwitchProductSpec{ + Name: "DVS", + Vendor: product.Vendor, + Version: product.Version, + Build: product.Build, + ForwardingClass: "etherswitch", + } + } + + return dvs.Reference(), nil + }) + + return &methods.CreateDVS_TaskBody{ + Res: &types.CreateDVS_TaskResponse{ + Returnval: task.Run(), + }, + } +} + +func (f *Folder) RenameTask(r *types.Rename_Task) soap.HasFault { + return RenameTask(f, r) +} diff --git a/vendor/github.com/vmware/govmomi/simulator/guest_id.go b/vendor/github.com/vmware/govmomi/simulator/guest_id.go new file mode 100644 index 00000000000..87cf4aaf835 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/guest_id.go @@ -0,0 +1,171 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import "github.com/vmware/govmomi/vim25/types" + +// GuestID is the list of valid types.VirtualMachineGuestOsIdentifier +var GuestID = []types.VirtualMachineGuestOsIdentifier{ + types.VirtualMachineGuestOsIdentifierDosGuest, + types.VirtualMachineGuestOsIdentifierWin31Guest, + types.VirtualMachineGuestOsIdentifierWin95Guest, + types.VirtualMachineGuestOsIdentifierWin98Guest, + types.VirtualMachineGuestOsIdentifierWinMeGuest, + types.VirtualMachineGuestOsIdentifierWinNTGuest, + types.VirtualMachineGuestOsIdentifierWin2000ProGuest, + types.VirtualMachineGuestOsIdentifierWin2000ServGuest, + types.VirtualMachineGuestOsIdentifierWin2000AdvServGuest, + types.VirtualMachineGuestOsIdentifierWinXPHomeGuest, + types.VirtualMachineGuestOsIdentifierWinXPProGuest, + types.VirtualMachineGuestOsIdentifierWinXPPro64Guest, + types.VirtualMachineGuestOsIdentifierWinNetWebGuest, + types.VirtualMachineGuestOsIdentifierWinNetStandardGuest, + types.VirtualMachineGuestOsIdentifierWinNetEnterpriseGuest, + types.VirtualMachineGuestOsIdentifierWinNetDatacenterGuest, + types.VirtualMachineGuestOsIdentifierWinNetBusinessGuest, + types.VirtualMachineGuestOsIdentifierWinNetStandard64Guest, + types.VirtualMachineGuestOsIdentifierWinNetEnterprise64Guest, + types.VirtualMachineGuestOsIdentifierWinLonghornGuest, + types.VirtualMachineGuestOsIdentifierWinLonghorn64Guest, + types.VirtualMachineGuestOsIdentifierWinNetDatacenter64Guest, + types.VirtualMachineGuestOsIdentifierWinVistaGuest, + types.VirtualMachineGuestOsIdentifierWinVista64Guest, + types.VirtualMachineGuestOsIdentifierWindows7Guest, + types.VirtualMachineGuestOsIdentifierWindows7_64Guest, + types.VirtualMachineGuestOsIdentifierWindows7Server64Guest, + types.VirtualMachineGuestOsIdentifierWindows8Guest, + types.VirtualMachineGuestOsIdentifierWindows8_64Guest, + types.VirtualMachineGuestOsIdentifierWindows8Server64Guest, + types.VirtualMachineGuestOsIdentifierWindows9Guest, + types.VirtualMachineGuestOsIdentifierWindows9_64Guest, + types.VirtualMachineGuestOsIdentifierWindows9Server64Guest, + types.VirtualMachineGuestOsIdentifierWindowsHyperVGuest, + types.VirtualMachineGuestOsIdentifierFreebsdGuest, + types.VirtualMachineGuestOsIdentifierFreebsd64Guest, + types.VirtualMachineGuestOsIdentifierRedhatGuest, + types.VirtualMachineGuestOsIdentifierRhel2Guest, + types.VirtualMachineGuestOsIdentifierRhel3Guest, + types.VirtualMachineGuestOsIdentifierRhel3_64Guest, + types.VirtualMachineGuestOsIdentifierRhel4Guest, + types.VirtualMachineGuestOsIdentifierRhel4_64Guest, + types.VirtualMachineGuestOsIdentifierRhel5Guest, + types.VirtualMachineGuestOsIdentifierRhel5_64Guest, + types.VirtualMachineGuestOsIdentifierRhel6Guest, + types.VirtualMachineGuestOsIdentifierRhel6_64Guest, + types.VirtualMachineGuestOsIdentifierRhel7Guest, + types.VirtualMachineGuestOsIdentifierRhel7_64Guest, + types.VirtualMachineGuestOsIdentifierCentosGuest, + types.VirtualMachineGuestOsIdentifierCentos64Guest, + types.VirtualMachineGuestOsIdentifierCentos6Guest, + types.VirtualMachineGuestOsIdentifierCentos6_64Guest, + types.VirtualMachineGuestOsIdentifierCentos7Guest, + types.VirtualMachineGuestOsIdentifierCentos7_64Guest, + types.VirtualMachineGuestOsIdentifierOracleLinuxGuest, + types.VirtualMachineGuestOsIdentifierOracleLinux64Guest, + types.VirtualMachineGuestOsIdentifierOracleLinux6Guest, + types.VirtualMachineGuestOsIdentifierOracleLinux6_64Guest, + types.VirtualMachineGuestOsIdentifierOracleLinux7Guest, + types.VirtualMachineGuestOsIdentifierOracleLinux7_64Guest, + types.VirtualMachineGuestOsIdentifierSuseGuest, + types.VirtualMachineGuestOsIdentifierSuse64Guest, + types.VirtualMachineGuestOsIdentifierSlesGuest, + types.VirtualMachineGuestOsIdentifierSles64Guest, + types.VirtualMachineGuestOsIdentifierSles10Guest, + types.VirtualMachineGuestOsIdentifierSles10_64Guest, + types.VirtualMachineGuestOsIdentifierSles11Guest, + types.VirtualMachineGuestOsIdentifierSles11_64Guest, + types.VirtualMachineGuestOsIdentifierSles12Guest, + types.VirtualMachineGuestOsIdentifierSles12_64Guest, + types.VirtualMachineGuestOsIdentifierNld9Guest, + types.VirtualMachineGuestOsIdentifierOesGuest, + types.VirtualMachineGuestOsIdentifierSjdsGuest, + types.VirtualMachineGuestOsIdentifierMandrakeGuest, + types.VirtualMachineGuestOsIdentifierMandrivaGuest, + types.VirtualMachineGuestOsIdentifierMandriva64Guest, + types.VirtualMachineGuestOsIdentifierTurboLinuxGuest, + types.VirtualMachineGuestOsIdentifierTurboLinux64Guest, + types.VirtualMachineGuestOsIdentifierUbuntuGuest, + types.VirtualMachineGuestOsIdentifierUbuntu64Guest, + types.VirtualMachineGuestOsIdentifierDebian4Guest, + types.VirtualMachineGuestOsIdentifierDebian4_64Guest, + types.VirtualMachineGuestOsIdentifierDebian5Guest, + types.VirtualMachineGuestOsIdentifierDebian5_64Guest, + types.VirtualMachineGuestOsIdentifierDebian6Guest, + types.VirtualMachineGuestOsIdentifierDebian6_64Guest, + types.VirtualMachineGuestOsIdentifierDebian7Guest, + types.VirtualMachineGuestOsIdentifierDebian7_64Guest, + types.VirtualMachineGuestOsIdentifierDebian8Guest, + types.VirtualMachineGuestOsIdentifierDebian8_64Guest, + types.VirtualMachineGuestOsIdentifierDebian9Guest, + types.VirtualMachineGuestOsIdentifierDebian9_64Guest, + types.VirtualMachineGuestOsIdentifierDebian10Guest, + types.VirtualMachineGuestOsIdentifierDebian10_64Guest, + types.VirtualMachineGuestOsIdentifierAsianux3Guest, + types.VirtualMachineGuestOsIdentifierAsianux3_64Guest, + types.VirtualMachineGuestOsIdentifierAsianux4Guest, + types.VirtualMachineGuestOsIdentifierAsianux4_64Guest, + types.VirtualMachineGuestOsIdentifierAsianux5_64Guest, + types.VirtualMachineGuestOsIdentifierAsianux7_64Guest, + types.VirtualMachineGuestOsIdentifierOpensuseGuest, + types.VirtualMachineGuestOsIdentifierOpensuse64Guest, + types.VirtualMachineGuestOsIdentifierFedoraGuest, + types.VirtualMachineGuestOsIdentifierFedora64Guest, + types.VirtualMachineGuestOsIdentifierCoreos64Guest, + types.VirtualMachineGuestOsIdentifierVmwarePhoton64Guest, + types.VirtualMachineGuestOsIdentifierOther24xLinuxGuest, + types.VirtualMachineGuestOsIdentifierOther26xLinuxGuest, + types.VirtualMachineGuestOsIdentifierOtherLinuxGuest, + types.VirtualMachineGuestOsIdentifierOther3xLinuxGuest, + types.VirtualMachineGuestOsIdentifierGenericLinuxGuest, + types.VirtualMachineGuestOsIdentifierOther24xLinux64Guest, + types.VirtualMachineGuestOsIdentifierOther26xLinux64Guest, + types.VirtualMachineGuestOsIdentifierOther3xLinux64Guest, + types.VirtualMachineGuestOsIdentifierOtherLinux64Guest, + types.VirtualMachineGuestOsIdentifierSolaris6Guest, + types.VirtualMachineGuestOsIdentifierSolaris7Guest, + types.VirtualMachineGuestOsIdentifierSolaris8Guest, + types.VirtualMachineGuestOsIdentifierSolaris9Guest, + types.VirtualMachineGuestOsIdentifierSolaris10Guest, + types.VirtualMachineGuestOsIdentifierSolaris10_64Guest, + types.VirtualMachineGuestOsIdentifierSolaris11_64Guest, + types.VirtualMachineGuestOsIdentifierOs2Guest, + types.VirtualMachineGuestOsIdentifierEComStationGuest, + types.VirtualMachineGuestOsIdentifierEComStation2Guest, + types.VirtualMachineGuestOsIdentifierNetware4Guest, + types.VirtualMachineGuestOsIdentifierNetware5Guest, + types.VirtualMachineGuestOsIdentifierNetware6Guest, + types.VirtualMachineGuestOsIdentifierOpenServer5Guest, + types.VirtualMachineGuestOsIdentifierOpenServer6Guest, + types.VirtualMachineGuestOsIdentifierUnixWare7Guest, + types.VirtualMachineGuestOsIdentifierDarwinGuest, + types.VirtualMachineGuestOsIdentifierDarwin64Guest, + types.VirtualMachineGuestOsIdentifierDarwin10Guest, + types.VirtualMachineGuestOsIdentifierDarwin10_64Guest, + types.VirtualMachineGuestOsIdentifierDarwin11Guest, + types.VirtualMachineGuestOsIdentifierDarwin11_64Guest, + types.VirtualMachineGuestOsIdentifierDarwin12_64Guest, + types.VirtualMachineGuestOsIdentifierDarwin13_64Guest, + types.VirtualMachineGuestOsIdentifierDarwin14_64Guest, + types.VirtualMachineGuestOsIdentifierDarwin15_64Guest, + types.VirtualMachineGuestOsIdentifierDarwin16_64Guest, + types.VirtualMachineGuestOsIdentifierVmkernelGuest, + types.VirtualMachineGuestOsIdentifierVmkernel5Guest, + types.VirtualMachineGuestOsIdentifierVmkernel6Guest, + types.VirtualMachineGuestOsIdentifierVmkernel65Guest, + types.VirtualMachineGuestOsIdentifierOtherGuest, + types.VirtualMachineGuestOsIdentifierOtherGuest64, +} diff --git a/vendor/github.com/vmware/govmomi/simulator/guest_id.sh b/vendor/github.com/vmware/govmomi/simulator/guest_id.sh new file mode 100755 index 00000000000..e7981633758 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/guest_id.sh @@ -0,0 +1,35 @@ +#!/bin/bash -e + +pushd "$(dirname "$0")" >/dev/null + +{ + cat < guest_id.go + +goimports -w guest_id.go diff --git a/vendor/github.com/vmware/govmomi/simulator/host_datastore_browser.go b/vendor/github.com/vmware/govmomi/simulator/host_datastore_browser.go new file mode 100644 index 00000000000..0f1ea8f4475 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/host_datastore_browser.go @@ -0,0 +1,254 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "io/ioutil" + "log" + "os" + "path" + "strings" + + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type HostDatastoreBrowser struct { + mo.HostDatastoreBrowser +} + +type searchDatastore struct { + *HostDatastoreBrowser + + DatastorePath string + SearchSpec *types.HostDatastoreBrowserSearchSpec + + res []types.HostDatastoreBrowserSearchResults + + recurse bool +} + +func (s *searchDatastore) addFile(file os.FileInfo, res *types.HostDatastoreBrowserSearchResults) { + details := s.SearchSpec.Details + if details == nil { + details = new(types.FileQueryFlags) + } + + name := file.Name() + + info := types.FileInfo{ + Path: name, + } + + var finfo types.BaseFileInfo = &info + + if details.FileSize { + info.FileSize = file.Size() + } + + if details.Modification { + mtime := file.ModTime() + info.Modification = &mtime + } + + if isTrue(details.FileOwner) { + // Assume for now this process created all files in the datastore + user := os.Getenv("USER") + + info.Owner = user + } + + if file.IsDir() { + finfo = &types.FolderFileInfo{FileInfo: info} + } else if details.FileType { + switch path.Ext(name) { + case ".img": + finfo = &types.FloppyImageFileInfo{FileInfo: info} + case ".iso": + finfo = &types.IsoImageFileInfo{FileInfo: info} + case ".log": + finfo = &types.VmLogFileInfo{FileInfo: info} + case ".nvram": + finfo = &types.VmNvramFileInfo{FileInfo: info} + case ".vmdk": + // TODO: lookup device to set other fields + finfo = &types.VmDiskFileInfo{FileInfo: info} + case ".vmx": + finfo = &types.VmConfigFileInfo{FileInfo: info} + } + } + + res.File = append(res.File, finfo) +} + +func (s *searchDatastore) queryMatch(file os.FileInfo) bool { + if len(s.SearchSpec.Query) == 0 { + return true + } + + name := file.Name() + ext := path.Ext(name) + + for _, q := range s.SearchSpec.Query { + switch q.(type) { + case *types.FileQuery: + return true + case *types.FolderFileQuery: + if file.IsDir() { + return true + } + case *types.FloppyImageFileQuery: + if ext == ".img" { + return true + } + case *types.IsoImageFileQuery: + if ext == ".iso" { + return true + } + case *types.VmConfigFileQuery: + if ext == ".vmx" { + // TODO: check Filter and Details fields + return true + } + case *types.VmDiskFileQuery: + if ext == ".vmdk" { + if strings.HasSuffix(name, "-flat.vmdk") { + // only matches the descriptor, not the backing file(s) + return false + } + // TODO: check Filter and Details fields + return true + } + case *types.VmLogFileQuery: + if ext == ".log" { + return strings.HasPrefix(name, "vmware") + } + case *types.VmNvramFileQuery: + if ext == ".nvram" { + return true + } + case *types.VmSnapshotFileQuery: + if ext == ".vmsn" { + return true + } + } + } + + return false +} + +func (s *searchDatastore) search(ds *types.ManagedObjectReference, folder string, dir string) error { + files, err := ioutil.ReadDir(dir) + if err != nil { + log.Printf("search %s: %s", dir, err) + return err + } + + res := types.HostDatastoreBrowserSearchResults{ + Datastore: ds, + FolderPath: folder, + } + + for _, file := range files { + name := file.Name() + + if s.queryMatch(file) { + for _, m := range s.SearchSpec.MatchPattern { + if ok, _ := path.Match(m, name); ok { + s.addFile(file, &res) + break + } + } + } + + if s.recurse && file.IsDir() { + _ = s.search(ds, path.Join(folder, name), path.Join(dir, name)) + } + } + + s.res = append(s.res, res) + + return nil +} + +func (s *searchDatastore) Run(Task *Task) (types.AnyType, types.BaseMethodFault) { + p, fault := parseDatastorePath(s.DatastorePath) + if fault != nil { + return nil, fault + } + + ref := Map.FindByName(p.Datastore, s.Datastore) + if ref == nil { + return nil, &types.InvalidDatastore{Name: p.Datastore} + } + + ds := ref.(*Datastore) + + dir := path.Join(ds.Info.GetDatastoreInfo().Url, p.Path) + + err := s.search(&ds.Self, s.DatastorePath, dir) + if err != nil { + ff := types.FileFault{ + File: p.Path, + } + + if os.IsNotExist(err) { + return nil, &types.FileNotFound{FileFault: ff} + } + + return nil, &types.InvalidArgument{InvalidProperty: p.Path} + } + + if s.recurse { + return types.ArrayOfHostDatastoreBrowserSearchResults{ + HostDatastoreBrowserSearchResults: s.res, + }, nil + } + + return s.res[0], nil +} + +func (b *HostDatastoreBrowser) SearchDatastoreTask(s *types.SearchDatastore_Task) soap.HasFault { + task := NewTask(&searchDatastore{ + HostDatastoreBrowser: b, + DatastorePath: s.DatastorePath, + SearchSpec: s.SearchSpec, + }) + + return &methods.SearchDatastore_TaskBody{ + Res: &types.SearchDatastore_TaskResponse{ + Returnval: task.Run(), + }, + } +} + +func (b *HostDatastoreBrowser) SearchDatastoreSubFoldersTask(s *types.SearchDatastoreSubFolders_Task) soap.HasFault { + task := NewTask(&searchDatastore{ + HostDatastoreBrowser: b, + DatastorePath: s.DatastorePath, + SearchSpec: s.SearchSpec, + recurse: true, + }) + + return &methods.SearchDatastoreSubFolders_TaskBody{ + Res: &types.SearchDatastoreSubFolders_TaskResponse{ + Returnval: task.Run(), + }, + } +} diff --git a/vendor/github.com/vmware/govmomi/simulator/host_datastore_system.go b/vendor/github.com/vmware/govmomi/simulator/host_datastore_system.go new file mode 100644 index 00000000000..ff3fce83d4a --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/host_datastore_system.go @@ -0,0 +1,161 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "os" + "path" + + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type HostDatastoreSystem struct { + mo.HostDatastoreSystem + + Host *mo.HostSystem +} + +func (dss *HostDatastoreSystem) add(ds *Datastore) *soap.Fault { + info := ds.Info.GetDatastoreInfo() + + info.Name = ds.Name + + if e := Map.FindByName(ds.Name, dss.Datastore); e != nil { + return Fault(e.Reference().Value, &types.DuplicateName{ + Name: ds.Name, + Object: e.Reference(), + }) + } + + fi, err := os.Stat(info.Url) + if err == nil && !fi.IsDir() { + err = os.ErrInvalid + } + + if err != nil { + switch { + case os.IsNotExist(err): + return Fault(err.Error(), &types.NotFound{}) + default: + return Fault(err.Error(), &types.HostConfigFault{}) + } + } + + folder := Map.getEntityFolder(dss.Host, "datastore") + ds.Self.Type = typeName(ds) + // Datastore is the only type where create methods do not include the parent (Folder in this case), + // but we need the moref to be unique per DC/datastoreFolder, but not per-HostSystem. + ds.Self.Value += "@" + folder.Self.Value + // TODO: name should be made unique in the case of Local ds type + + ds.Summary.Datastore = &ds.Self + ds.Summary.Name = ds.Name + ds.Summary.Url = info.Url + + dss.Datastore = append(dss.Datastore, ds.Self) + dss.Host.Datastore = dss.Datastore + parent := hostParent(dss.Host) + parent.Datastore = AddReference(ds.Self, parent.Datastore) + + browser := &HostDatastoreBrowser{} + browser.Datastore = dss.Datastore + ds.Browser = Map.Put(browser).Reference() + + folder.putChild(ds) + + return nil +} + +func (dss *HostDatastoreSystem) CreateLocalDatastore(c *types.CreateLocalDatastore) soap.HasFault { + r := &methods.CreateLocalDatastoreBody{} + + ds := &Datastore{} + ds.Name = c.Name + ds.Self.Value = c.Path + + ds.Info = &types.LocalDatastoreInfo{ + DatastoreInfo: types.DatastoreInfo{ + Name: c.Name, + Url: c.Path, + }, + Path: c.Path, + } + + ds.Summary.Type = "local" + + if err := dss.add(ds); err != nil { + r.Fault_ = err + return r + } + + ds.Host = append(ds.Host, types.DatastoreHostMount{ + Key: dss.Host.Reference(), + MountInfo: types.HostMountInfo{ + AccessMode: string(types.HostMountModeReadWrite), + Mounted: types.NewBool(true), + Accessible: types.NewBool(true), + }, + }) + + _ = ds.RefreshDatastore(&types.RefreshDatastore{This: ds.Self}) + + r.Res = &types.CreateLocalDatastoreResponse{ + Returnval: ds.Self, + } + + return r +} + +func (dss *HostDatastoreSystem) CreateNasDatastore(c *types.CreateNasDatastore) soap.HasFault { + r := &methods.CreateNasDatastoreBody{} + + ds := &Datastore{} + ds.Name = path.Base(c.Spec.LocalPath) + ds.Self.Value = c.Spec.RemoteHost + ":" + c.Spec.RemotePath + + ds.Info = &types.NasDatastoreInfo{ + DatastoreInfo: types.DatastoreInfo{ + Url: c.Spec.LocalPath, + }, + Nas: &types.HostNasVolume{ + HostFileSystemVolume: types.HostFileSystemVolume{ + Name: c.Spec.LocalPath, + Type: c.Spec.Type, + }, + RemoteHost: c.Spec.RemoteHost, + RemotePath: c.Spec.RemotePath, + }, + } + + ds.Summary.Type = c.Spec.Type + + if err := dss.add(ds); err != nil { + r.Fault_ = err + return r + } + + _ = ds.RefreshDatastore(&types.RefreshDatastore{This: ds.Self}) + + r.Res = &types.CreateNasDatastoreResponse{ + Returnval: ds.Self, + } + + return r +} diff --git a/vendor/github.com/vmware/govmomi/simulator/host_firewall_system.go b/vendor/github.com/vmware/govmomi/simulator/host_firewall_system.go new file mode 100644 index 00000000000..fd596386aa1 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/host_firewall_system.go @@ -0,0 +1,87 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "github.com/vmware/govmomi/simulator/esx" + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type HostFirewallSystem struct { + mo.HostFirewallSystem +} + +func NewHostFirewallSystem(_ *mo.HostSystem) *HostFirewallSystem { + info := esx.HostFirewallInfo + + return &HostFirewallSystem{ + HostFirewallSystem: mo.HostFirewallSystem{ + FirewallInfo: &info, + }, + } +} + +func DisableRuleset(info *types.HostFirewallInfo, id string) bool { + for i := range info.Ruleset { + if info.Ruleset[i].Key == id { + info.Ruleset[i].Enabled = false + return true + } + } + + return false +} + +func (s *HostFirewallSystem) DisableRuleset(req *types.DisableRuleset) soap.HasFault { + body := &methods.DisableRulesetBody{} + + if DisableRuleset(s.HostFirewallSystem.FirewallInfo, req.Id) { + body.Res = new(types.DisableRulesetResponse) + return body + } + + body.Fault_ = Fault("", &types.NotFound{}) + + return body +} + +func EnableRuleset(info *types.HostFirewallInfo, id string) bool { + for i := range info.Ruleset { + if info.Ruleset[i].Key == id { + info.Ruleset[i].Enabled = true + return true + } + } + + return false +} + +func (s *HostFirewallSystem) EnableRuleset(req *types.EnableRuleset) soap.HasFault { + body := &methods.EnableRulesetBody{} + + if EnableRuleset(s.HostFirewallSystem.FirewallInfo, req.Id) { + body.Res = new(types.EnableRulesetResponse) + return body + } + + body.Fault_ = Fault("", &types.NotFound{}) + + return body +} diff --git a/vendor/github.com/vmware/govmomi/simulator/host_network_system.go b/vendor/github.com/vmware/govmomi/simulator/host_network_system.go new file mode 100644 index 00000000000..64a2bd759c6 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/host_network_system.go @@ -0,0 +1,171 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type HostNetworkSystem struct { + mo.HostNetworkSystem + + Host *mo.HostSystem +} + +func NewHostNetworkSystem(host *mo.HostSystem) *HostNetworkSystem { + return &HostNetworkSystem{ + Host: host, + HostNetworkSystem: mo.HostNetworkSystem{ + NetworkInfo: &types.HostNetworkInfo{ + Vswitch: []types.HostVirtualSwitch{ + { + Name: "vSwitch0", + Portgroup: []string{"VM Network"}, + }, + }, + }, + }, + } +} + +func (s *HostNetworkSystem) folder() *Folder { + f := Map.getEntityDatacenter(s.Host).NetworkFolder + return Map.Get(f).(*Folder) +} + +func (s *HostNetworkSystem) AddVirtualSwitch(c *types.AddVirtualSwitch) soap.HasFault { + r := &methods.AddVirtualSwitchBody{} + + for _, vswitch := range s.NetworkInfo.Vswitch { + if vswitch.Name == c.VswitchName { + r.Fault_ = Fault("", &types.AlreadyExists{Name: c.VswitchName}) + return r + } + } + + s.NetworkInfo.Vswitch = append(s.NetworkInfo.Vswitch, types.HostVirtualSwitch{ + Name: c.VswitchName, + }) + + r.Res = &types.AddVirtualSwitchResponse{} + + return r +} + +func (s *HostNetworkSystem) RemoveVirtualSwitch(c *types.RemoveVirtualSwitch) soap.HasFault { + r := &methods.RemoveVirtualSwitchBody{} + + vs := s.NetworkInfo.Vswitch + + for i, v := range vs { + if v.Name == c.VswitchName { + s.NetworkInfo.Vswitch = append(vs[:i], vs[i+1:]...) + r.Res = &types.RemoveVirtualSwitchResponse{} + return r + } + } + + r.Fault_ = Fault("", &types.NotFound{}) + + return r +} + +func (s *HostNetworkSystem) AddPortGroup(c *types.AddPortGroup) soap.HasFault { + var vswitch *types.HostVirtualSwitch + + r := &methods.AddPortGroupBody{} + + if c.Portgrp.Name == "" { + r.Fault_ = Fault("", &types.InvalidArgument{InvalidProperty: "name"}) + return r + } + + for i := range s.NetworkInfo.Vswitch { + if s.NetworkInfo.Vswitch[i].Name == c.Portgrp.VswitchName { + vswitch = &s.NetworkInfo.Vswitch[i] + break + } + } + + if vswitch == nil { + r.Fault_ = Fault("", &types.NotFound{}) + return r + } + + network := &mo.Network{} + network.Name = c.Portgrp.Name + network.Entity().Name = network.Name + + folder := s.folder() + + if obj := Map.FindByName(c.Portgrp.Name, folder.ChildEntity); obj != nil { + r.Fault_ = Fault("", &types.DuplicateName{ + Name: c.Portgrp.Name, + Object: obj.Reference(), + }) + + return r + } + + folder.putChild(network) + + vswitch.Portgroup = append(vswitch.Portgroup, c.Portgrp.Name) + r.Res = &types.AddPortGroupResponse{} + + return r +} + +func (s *HostNetworkSystem) RemovePortGroup(c *types.RemovePortGroup) soap.HasFault { + var vswitch *types.HostVirtualSwitch + + r := &methods.RemovePortGroupBody{} + + for i, v := range s.NetworkInfo.Vswitch { + for j, pg := range v.Portgroup { + if pg == c.PgName { + vswitch = &s.NetworkInfo.Vswitch[i] + vswitch.Portgroup = append(vswitch.Portgroup[:j], vswitch.Portgroup[j+1:]...) + } + } + } + + if vswitch == nil { + r.Fault_ = Fault("", &types.NotFound{}) + return r + } + + folder := s.folder() + e := Map.FindByName(c.PgName, folder.ChildEntity) + folder.removeChild(e.Reference()) + + r.Res = &types.RemovePortGroupResponse{} + + return r +} + +func (s *HostNetworkSystem) UpdateNetworkConfig(req *types.UpdateNetworkConfig) soap.HasFault { + s.NetworkConfig = &req.Config + + return &methods.UpdateNetworkConfigBody{ + Res: &types.UpdateNetworkConfigResponse{ + Returnval: types.HostNetworkConfigResult{}, + }, + } +} diff --git a/vendor/github.com/vmware/govmomi/simulator/host_system.go b/vendor/github.com/vmware/govmomi/simulator/host_system.go new file mode 100644 index 00000000000..600dbcf3885 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/host_system.go @@ -0,0 +1,180 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "time" + + "github.com/google/uuid" + "github.com/vmware/govmomi/simulator/esx" + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type HostSystem struct { + mo.HostSystem +} + +func NewHostSystem(host mo.HostSystem) *HostSystem { + now := time.Now() + + hs := &HostSystem{ + HostSystem: host, + } + + hs.Name = hs.Summary.Config.Name + hs.Summary.Runtime = &hs.Runtime + hs.Summary.Runtime.BootTime = &now + + id := uuid.New().String() + + hardware := *host.Summary.Hardware + hs.Summary.Hardware = &hardware + hs.Summary.Hardware.Uuid = id + + info := *esx.HostHardwareInfo + info.SystemInfo.Uuid = id + hs.Hardware = &info + + config := []struct { + ref **types.ManagedObjectReference + obj mo.Reference + }{ + {&hs.ConfigManager.DatastoreSystem, &HostDatastoreSystem{Host: &hs.HostSystem}}, + {&hs.ConfigManager.NetworkSystem, NewHostNetworkSystem(&hs.HostSystem)}, + {&hs.ConfigManager.AdvancedOption, NewOptionManager(nil, esx.Setting)}, + {&hs.ConfigManager.FirewallSystem, NewHostFirewallSystem(&hs.HostSystem)}, + } + + for _, c := range config { + ref := Map.Put(c.obj).Reference() + + *c.ref = &ref + } + + return hs +} + +func hostParent(host *mo.HostSystem) *mo.ComputeResource { + switch parent := Map.Get(*host.Parent).(type) { + case *mo.ComputeResource: + return parent + case *ClusterComputeResource: + return &parent.ComputeResource + default: + return nil + } +} + +func addComputeResource(s *types.ComputeResourceSummary, h *HostSystem) { + s.TotalCpu += h.Summary.Hardware.CpuMhz + s.TotalMemory += h.Summary.Hardware.MemorySize + s.NumCpuCores += h.Summary.Hardware.NumCpuCores + s.NumCpuThreads += h.Summary.Hardware.NumCpuThreads + s.EffectiveCpu += h.Summary.Hardware.CpuMhz + s.EffectiveMemory += h.Summary.Hardware.MemorySize + s.NumHosts++ + s.NumEffectiveHosts++ + s.OverallStatus = types.ManagedEntityStatusGreen +} + +// CreateDefaultESX creates a standalone ESX +// Adds objects of type: Datacenter, Network, ComputeResource, ResourcePool and HostSystem +func CreateDefaultESX(f *Folder) { + dc := &esx.Datacenter + f.putChild(dc) + createDatacenterFolders(dc, false) + + host := NewHostSystem(esx.HostSystem) + + summary := new(types.ComputeResourceSummary) + addComputeResource(summary, host) + + cr := &mo.ComputeResource{Summary: summary} + cr.Self = *host.Parent + cr.Name = host.Name + cr.Host = append(cr.Host, host.Reference()) + Map.PutEntity(cr, host) + + pool := NewResourcePool() + cr.ResourcePool = &pool.Self + Map.PutEntity(cr, pool) + pool.Owner = cr.Self + + Map.Get(dc.HostFolder).(*Folder).putChild(cr) +} + +// CreateStandaloneHost uses esx.HostSystem as a template, applying the given spec +// and creating the ComputeResource parent and ResourcePool sibling. +func CreateStandaloneHost(f *Folder, spec types.HostConnectSpec) (*HostSystem, types.BaseMethodFault) { + if spec.HostName == "" { + return nil, &types.NoHost{} + } + + pool := NewResourcePool() + host := NewHostSystem(esx.HostSystem) + + host.Summary.Config.Name = spec.HostName + host.Name = host.Summary.Config.Name + host.Runtime.ConnectionState = types.HostSystemConnectionStateDisconnected + + summary := new(types.ComputeResourceSummary) + addComputeResource(summary, host) + + cr := &mo.ComputeResource{Summary: summary} + + Map.PutEntity(cr, Map.NewEntity(host)) + + Map.PutEntity(cr, Map.NewEntity(pool)) + + cr.Name = host.Name + cr.Host = append(cr.Host, host.Reference()) + cr.ResourcePool = &pool.Self + + f.putChild(cr) + pool.Owner = cr.Self + + return host, nil +} + +func (h *HostSystem) EnterMaintenanceModeTask(spec *types.EnterMaintenanceMode_Task) soap.HasFault { + task := CreateTask(h, "enterMaintenanceMode", func(t *Task) (types.AnyType, types.BaseMethodFault) { + h.Runtime.InMaintenanceMode = true + return nil, nil + }) + + return &methods.EnterMaintenanceMode_TaskBody{ + Res: &types.EnterMaintenanceMode_TaskResponse{ + Returnval: task.Run(), + }, + } +} + +func (h *HostSystem) ExitMaintenanceModeTask(spec *types.ExitMaintenanceMode_Task) soap.HasFault { + task := CreateTask(h, "exitMaintenanceMode", func(t *Task) (types.AnyType, types.BaseMethodFault) { + h.Runtime.InMaintenanceMode = false + return nil, nil + }) + + return &methods.ExitMaintenanceMode_TaskBody{ + Res: &types.ExitMaintenanceMode_TaskResponse{ + Returnval: task.Run(), + }, + } +} diff --git a/vendor/github.com/vmware/govmomi/simulator/ip_pool_manager.go b/vendor/github.com/vmware/govmomi/simulator/ip_pool_manager.go new file mode 100644 index 00000000000..af8104a659f --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/ip_pool_manager.go @@ -0,0 +1,392 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "errors" + "fmt" + "net" + "strconv" + "strings" + + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +var ipPool = MustNewIpPool(&types.IpPool{ + Id: 1, + Name: "ip-pool", + AvailableIpv4Addresses: 250, + AvailableIpv6Addresses: 250, + AllocatedIpv6Addresses: 0, + AllocatedIpv4Addresses: 0, + Ipv4Config: &types.IpPoolIpPoolConfigInfo{ + Netmask: "10.10.10.255", + Gateway: "10.10.10.1", + SubnetAddress: "10.10.10.0", + Range: "10.10.10.2#250", + }, + Ipv6Config: &types.IpPoolIpPoolConfigInfo{ + Netmask: "2001:4860:0:2001::ff", + Gateway: "2001:4860:0:2001::1", + SubnetAddress: "2001:4860:0:2001::0", + Range: "2001:4860:0:2001::2#250", + }, +}) + +// IpPoolManager implements a simple IP Pool manager in which all pools are shared +// across different datacenters. +type IpPoolManager struct { + mo.IpPoolManager + + pools map[int32]*IpPool + nextPoolId int32 +} + +func NewIpPoolManager(ref types.ManagedObjectReference) *IpPoolManager { + m := &IpPoolManager{} + m.Self = ref + + m.pools = map[int32]*IpPool{ + 1: ipPool, + } + m.nextPoolId = 2 + + return m +} + +func (m *IpPoolManager) CreateIpPool(req *types.CreateIpPool) soap.HasFault { + body := &methods.CreateIpPoolBody{} + id := m.nextPoolId + + var err error + m.pools[id], err = NewIpPool(&req.Pool) + if err != nil { + body.Fault_ = Fault("", &types.RuntimeFault{}) + return body + } + + m.nextPoolId++ + + body.Res = &types.CreateIpPoolResponse{ + Returnval: id, + } + + return body +} + +func (m *IpPoolManager) DestroyIpPool(req *types.DestroyIpPool) soap.HasFault { + delete(m.pools, req.Id) + + return &methods.DestroyIpPoolBody{ + Res: &types.DestroyIpPoolResponse{}, + } +} + +func (m *IpPoolManager) QueryIpPools(req *types.QueryIpPools) soap.HasFault { + pools := []types.IpPool{} + + for i := int32(1); i < m.nextPoolId; i++ { + if p, ok := m.pools[i]; ok { + pools = append(pools, *p.config) + } + } + + return &methods.QueryIpPoolsBody{ + Res: &types.QueryIpPoolsResponse{ + Returnval: pools, + }, + } +} + +func (m *IpPoolManager) UpdateIpPool(req *types.UpdateIpPool) soap.HasFault { + body := &methods.UpdateIpPoolBody{} + + var pool *IpPool + var err error + var ok bool + + if pool, ok = m.pools[req.Pool.Id]; !ok { + body.Fault_ = Fault("", &types.NotFoundFault{}) + return body + } + + if pool.config.AllocatedIpv4Addresses+pool.config.AllocatedIpv6Addresses != 0 { + body.Fault_ = Fault("update a pool has been used is not supported", &types.RuntimeFault{}) + return body + } + + m.pools[req.Pool.Id], err = NewIpPool(&req.Pool) + if err != nil { + body.Fault_ = Fault(err.Error(), &types.RuntimeFault{}) + return body + } + + body.Res = &types.UpdateIpPoolResponse{} + + return body +} + +func (m *IpPoolManager) AllocateIpv4Address(req *types.AllocateIpv4Address) soap.HasFault { + body := &methods.AllocateIpv4AddressBody{} + + pool, ok := m.pools[req.PoolId] + if !ok { + body.Fault_ = Fault("", &types.InvalidArgument{}) + return body + } + + ip, err := pool.AllocateIPv4(req.AllocationId) + if err != nil { + body.Fault_ = Fault(err.Error(), &types.RuntimeFault{}) + return body + } + + body.Res = &types.AllocateIpv4AddressResponse{ + Returnval: ip, + } + + return body +} + +func (m *IpPoolManager) AllocateIpv6Address(req *types.AllocateIpv6Address) soap.HasFault { + body := &methods.AllocateIpv6AddressBody{} + + pool, ok := m.pools[req.PoolId] + if !ok { + body.Fault_ = Fault("", &types.InvalidArgument{}) + return body + } + + ip, err := pool.AllocateIpv6(req.AllocationId) + if err != nil { + body.Fault_ = Fault(err.Error(), &types.RuntimeFault{}) + return body + } + + body.Res = &types.AllocateIpv6AddressResponse{ + Returnval: ip, + } + + return body +} + +func (m *IpPoolManager) ReleaseIpAllocation(req *types.ReleaseIpAllocation) soap.HasFault { + body := &methods.ReleaseIpAllocationBody{} + + pool, ok := m.pools[req.PoolId] + if !ok { + body.Fault_ = Fault("", &types.InvalidArgument{}) + return body + } + + pool.ReleaseIpv4(req.AllocationId) + pool.ReleaseIpv6(req.AllocationId) + + body.Res = &types.ReleaseIpAllocationResponse{} + + return body +} + +func (m *IpPoolManager) QueryIPAllocations(req *types.QueryIPAllocations) soap.HasFault { + body := &methods.QueryIPAllocationsBody{} + + pool, ok := m.pools[req.PoolId] + if !ok { + body.Fault_ = Fault("", &types.InvalidArgument{}) + return body + } + + body.Res = &types.QueryIPAllocationsResponse{} + + ipv4, ok := pool.ipv4Allocation[req.ExtensionKey] + if ok { + body.Res.Returnval = append(body.Res.Returnval, types.IpPoolManagerIpAllocation{ + IpAddress: ipv4, + AllocationId: req.ExtensionKey, + }) + } + + ipv6, ok := pool.ipv6Allocation[req.ExtensionKey] + if ok { + body.Res.Returnval = append(body.Res.Returnval, types.IpPoolManagerIpAllocation{ + IpAddress: ipv6, + AllocationId: req.ExtensionKey, + }) + } + + return body +} + +var ( + errNoIpAvailable = errors.New("no ip address available") + errInvalidAllocation = errors.New("allocation id not recognized") +) + +type IpPool struct { + config *types.IpPool + ipv4Allocation map[string]string + ipv6Allocation map[string]string + ipv4Pool []string + ipv6Pool []string +} + +func MustNewIpPool(config *types.IpPool) *IpPool { + pool, err := NewIpPool(config) + if err != nil { + panic(err) + } + + return pool +} + +func NewIpPool(config *types.IpPool) (*IpPool, error) { + pool := &IpPool{ + config: config, + ipv4Allocation: make(map[string]string), + ipv6Allocation: make(map[string]string), + } + + return pool, pool.init() +} + +func (p *IpPool) init() error { + // IPv4 range + if p.config.Ipv4Config != nil { + ranges := strings.Split(p.config.Ipv4Config.Range, ",") + for _, r := range ranges { + sp := strings.Split(r, "#") + if len(sp) != 2 { + return fmt.Errorf("format of range should be ip#number; got %q", r) + } + + ip := net.ParseIP(strings.TrimSpace(sp[0])).To4() + if ip == nil { + return fmt.Errorf("bad ip format: %q", sp[0]) + } + + length, err := strconv.Atoi(sp[1]) + if err != nil { + return err + } + + for i := 0; i < length; i++ { + p.ipv4Pool = append(p.ipv4Pool, net.IPv4(ip[0], ip[1], ip[2], ip[3]+byte(i)).String()) + } + } + } + + // IPv6 range + if p.config.Ipv6Config != nil { + ranges := strings.Split(p.config.Ipv6Config.Range, ",") + for _, r := range ranges { + sp := strings.Split(r, "#") + if len(sp) != 2 { + return fmt.Errorf("format of range should be ip#number; got %q", r) + } + + ip := net.ParseIP(strings.TrimSpace(sp[0])).To16() + if ip == nil { + return fmt.Errorf("bad ip format: %q", sp[0]) + } + + length, err := strconv.Atoi(sp[1]) + if err != nil { + return err + } + + for i := 0; i < length; i++ { + var ipv6 [16]byte + copy(ipv6[:], ip) + ipv6[15] += byte(i) + p.ipv6Pool = append(p.ipv6Pool, net.IP(ipv6[:]).String()) + } + } + } + + return nil +} + +func (p *IpPool) AllocateIPv4(allocation string) (string, error) { + if ip, ok := p.ipv4Allocation[allocation]; ok { + return ip, nil + } + + l := len(p.ipv4Pool) + if l == 0 { + return "", errNoIpAvailable + } + + ip := p.ipv4Pool[l-1] + + p.config.AvailableIpv4Addresses-- + p.config.AllocatedIpv4Addresses++ + p.ipv4Pool = p.ipv4Pool[:l-1] + p.ipv4Allocation[allocation] = ip + + return ip, nil +} + +func (p *IpPool) ReleaseIpv4(allocation string) error { + ip, ok := p.ipv4Allocation[allocation] + if !ok { + return errInvalidAllocation + } + + delete(p.ipv4Allocation, allocation) + p.config.AvailableIpv4Addresses++ + p.config.AllocatedIpv4Addresses-- + p.ipv4Pool = append(p.ipv4Pool, ip) + + return nil +} + +func (p *IpPool) AllocateIpv6(allocation string) (string, error) { + if ip, ok := p.ipv6Allocation[allocation]; ok { + return ip, nil + } + + l := len(p.ipv6Pool) + if l == 0 { + return "", errNoIpAvailable + } + + ip := p.ipv6Pool[l-1] + + p.config.AvailableIpv6Addresses-- + p.config.AllocatedIpv6Addresses++ + p.ipv6Pool = p.ipv6Pool[:l-1] + p.ipv6Allocation[allocation] = ip + + return ip, nil +} + +func (p *IpPool) ReleaseIpv6(allocation string) error { + ip, ok := p.ipv6Allocation[allocation] + if !ok { + return errInvalidAllocation + } + + delete(p.ipv6Allocation, allocation) + p.config.AvailableIpv6Addresses++ + p.config.AllocatedIpv6Addresses-- + p.ipv6Pool = append(p.ipv6Pool, ip) + + return nil +} diff --git a/vendor/github.com/vmware/govmomi/simulator/license_manager.go b/vendor/github.com/vmware/govmomi/simulator/license_manager.go new file mode 100644 index 00000000000..13565d32ef1 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/license_manager.go @@ -0,0 +1,156 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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. +*/ +// Copyright 2017 VMware, Inc. All Rights Reserved. +// +// 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 simulator + +import ( + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +// EvalLicense is the default license +var EvalLicense = types.LicenseManagerLicenseInfo{ + LicenseKey: "00000-00000-00000-00000-00000", + EditionKey: "eval", + Name: "Evaluation Mode", + Properties: []types.KeyAnyValue{ + { + Key: "feature", + Value: types.KeyValue{ + Key: "serialuri:2", + Value: "Remote virtual Serial Port Concentrator", + }, + }, + { + Key: "feature", + Value: types.KeyValue{ + Key: "dvs", + Value: "vSphere Distributed Switch", + }, + }, + }, +} + +type LicenseManager struct { + mo.LicenseManager +} + +func NewLicenseManager(ref types.ManagedObjectReference) object.Reference { + m := &LicenseManager{} + m.Self = ref + m.Licenses = []types.LicenseManagerLicenseInfo{EvalLicense} + + if Map.IsVPX() { + am := Map.Put(&LicenseAssignmentManager{}).Reference() + m.LicenseAssignmentManager = &am + } + + return m +} + +func (m *LicenseManager) AddLicense(req *types.AddLicense) soap.HasFault { + body := &methods.AddLicenseBody{ + Res: &types.AddLicenseResponse{}, + } + + for _, license := range m.Licenses { + if license.LicenseKey == req.LicenseKey { + body.Res.Returnval = licenseInfo(license.LicenseKey, license.Labels) + return body + } + } + + m.Licenses = append(m.Licenses, types.LicenseManagerLicenseInfo{ + LicenseKey: req.LicenseKey, + Labels: req.Labels, + }) + + body.Res.Returnval = licenseInfo(req.LicenseKey, req.Labels) + + return body +} + +func (m *LicenseManager) RemoveLicense(req *types.RemoveLicense) soap.HasFault { + body := &methods.RemoveLicenseBody{ + Res: &types.RemoveLicenseResponse{}, + } + + for i, license := range m.Licenses { + if req.LicenseKey == license.LicenseKey { + m.Licenses = append(m.Licenses[:i], m.Licenses[i+1:]...) + return body + } + } + return body +} + +type LicenseAssignmentManager struct { + mo.LicenseAssignmentManager +} + +func (m *LicenseAssignmentManager) QueryAssignedLicenses(req *types.QueryAssignedLicenses) soap.HasFault { + body := &methods.QueryAssignedLicensesBody{ + Res: &types.QueryAssignedLicensesResponse{}, + } + + // EntityId can be a HostSystem or the vCenter InstanceUuid + if req.EntityId != "" { + if req.EntityId != Map.content().About.InstanceUuid { + id := types.ManagedObjectReference{ + Type: "HostSystem", + Value: req.EntityId, + } + + if Map.Get(id) == nil { + return body + } + } + } + + body.Res.Returnval = []types.LicenseAssignmentManagerLicenseAssignment{ + { + EntityId: req.EntityId, + AssignedLicense: EvalLicense, + }, + } + + return body +} + +func licenseInfo(key string, labels []types.KeyValue) types.LicenseManagerLicenseInfo { + info := EvalLicense + + info.LicenseKey = key + info.Labels = labels + + return info +} diff --git a/vendor/github.com/vmware/govmomi/simulator/model.go b/vendor/github.com/vmware/govmomi/simulator/model.go new file mode 100644 index 00000000000..4bc26f9793f --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/model.go @@ -0,0 +1,484 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "context" + "fmt" + "io/ioutil" + "os" + "path" + + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/simulator/esx" + "github.com/vmware/govmomi/simulator/vpx" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/types" +) + +// Model is used to populate a Model with an initial set of managed entities. +// This is a simple helper for tests running against a simulator, to populate an inventory +// with commonly used models. +type Model struct { + Service *Service + + ServiceContent types.ServiceContent + RootFolder mo.Folder + + // Autostart will power on Model created VMs when true + Autostart bool + + // Datacenter specifies the number of Datacenter entities to create + Datacenter int + + // Portgroup specifies the number of DistributedVirtualPortgroup entities to create per Datacenter + Portgroup int + + // Host specifies the number of standalone HostSystems entities to create per Datacenter + Host int + + // Cluster specifies the number of ClusterComputeResource entities to create per Datacenter + Cluster int + + // ClusterHost specifies the number of HostSystems entities to create within a Cluster + ClusterHost int + + // Pool specifies the number of ResourcePool entities to create per Cluster + Pool int + + // Datastore specifies the number of Datastore entities to create + // Each Datastore will have temporary local file storage and will be mounted + // on every HostSystem created by the ModelConfig + Datastore int + + // Machine specifies the number of VirtualMachine entities to create per ResourcePool + Machine int + + // Folder specifies the number of Datacenter to place within a Folder. + // This includes a folder for the Datacenter itself and its host, vm, network and datastore folders. + // All resources for the Datacenter are placed within these folders, rather than the top-level folders. + Folder int + + // App specifies the number of VirtualApp to create per Cluster + App int + + // Pod specifies the number of StoragePod to create per Cluster + Pod int + + // total number of inventory objects, set by Count() + total int + + dirs []string +} + +// ESX is the default Model for a standalone ESX instance +func ESX() *Model { + return &Model{ + ServiceContent: esx.ServiceContent, + RootFolder: esx.RootFolder, + Autostart: true, + Datastore: 1, + Machine: 2, + } +} + +// VPX is the default Model for a vCenter instance +func VPX() *Model { + return &Model{ + ServiceContent: vpx.ServiceContent, + RootFolder: vpx.RootFolder, + Autostart: true, + Datacenter: 1, + Portgroup: 1, + Host: 1, + Cluster: 1, + ClusterHost: 3, + Datastore: 1, + Machine: 2, + } +} + +// Count returns a Model with total number of each existing type +func (m *Model) Count() Model { + count := Model{} + + for ref, obj := range Map.objects { + if _, ok := obj.(mo.Entity); !ok { + continue + } + + count.total++ + + switch ref.Type { + case "Datacenter": + count.Datacenter++ + case "DistributedVirtualPortgroup": + count.Portgroup++ + case "ClusterComputeResource": + count.Cluster++ + case "Datastore": + count.Datastore++ + case "HostSystem": + count.Host++ + case "VirtualMachine": + count.Machine++ + case "ResourcePool": + count.Pool++ + case "VirtualApp": + count.App++ + case "Folder": + count.Folder++ + case "StoragePod": + count.Pod++ + } + } + + return count +} + +func (*Model) fmtName(prefix string, num int) string { + return fmt.Sprintf("%s%d", prefix, num) +} + +// Create populates the Model with the given ModelConfig +func (m *Model) Create() error { + m.Service = New(NewServiceInstance(m.ServiceContent, m.RootFolder)) + + ctx := context.Background() + client := m.Service.client + root := object.NewRootFolder(client) + + // After all hosts are created, this var is used to mount the host datastores. + var hosts []*object.HostSystem + // We need to defer VM creation until after the datastores are created. + var vms []func() error + // 1 DVS per DC, added to all hosts + var dvs *object.DistributedVirtualSwitch + // 1 NIC per VM, backed by a DVPG if Model.Portgroup > 0 + vmnet := esx.EthernetCard.Backing + + // addHost adds a cluster host or a stanalone host. + addHost := func(name string, f func(types.HostConnectSpec) (*object.Task, error)) (*object.HostSystem, error) { + spec := types.HostConnectSpec{ + HostName: name, + } + + task, err := f(spec) + if err != nil { + return nil, err + } + + info, err := task.WaitForResult(context.Background(), nil) + if err != nil { + return nil, err + } + + host := object.NewHostSystem(client, info.Result.(types.ManagedObjectReference)) + hosts = append(hosts, host) + + if dvs != nil { + config := &types.DVSConfigSpec{ + Host: []types.DistributedVirtualSwitchHostMemberConfigSpec{{ + Operation: string(types.ConfigSpecOperationAdd), + Host: host.Reference(), + }}, + } + + _, _ = dvs.Reconfigure(ctx, config) + } + + return host, nil + } + + // addMachine returns a func to create a VM. + addMachine := func(prefix string, host *object.HostSystem, pool *object.ResourcePool, folders *object.DatacenterFolders) { + nic := esx.EthernetCard + nic.Backing = vmnet + ds := types.ManagedObjectReference{} + + f := func() error { + for i := 0; i < m.Machine; i++ { + name := m.fmtName(prefix+"_VM", i) + + config := types.VirtualMachineConfigSpec{ + Name: name, + GuestId: string(types.VirtualMachineGuestOsIdentifierOtherGuest), + Files: &types.VirtualMachineFileInfo{ + VmPathName: "[LocalDS_0]", + }, + } + + if pool == nil { + pool, _ = host.ResourcePool(ctx) + } + + var devices object.VirtualDeviceList + + scsi, _ := devices.CreateSCSIController("pvscsi") + ide, _ := devices.CreateIDEController() + cdrom, _ := devices.CreateCdrom(ide.(*types.VirtualIDEController)) + disk := devices.CreateDisk(scsi.(types.BaseVirtualController), ds, + config.Files.VmPathName+" "+path.Join(name, "disk1.vmdk")) + + devices = append(devices, scsi, cdrom, disk, &nic) + + config.DeviceChange, _ = devices.ConfigSpec(types.VirtualDeviceConfigSpecOperationAdd) + + task, err := folders.VmFolder.CreateVM(ctx, config, pool, host) + if err != nil { + return err + } + + info, err := task.WaitForResult(ctx, nil) + if err != nil { + return err + } + + vm := object.NewVirtualMachine(client, info.Result.(types.ManagedObjectReference)) + + if m.Autostart { + _, _ = vm.PowerOn(ctx) + } + } + + return nil + } + + vms = append(vms, f) + } + + nfolder := 0 + + for ndc := 0; ndc < m.Datacenter; ndc++ { + dcName := m.fmtName("DC", ndc) + folder := root + fName := m.fmtName("F", nfolder) + + // If Datacenter > Folder, don't create folders for the first N DCs. + if nfolder < m.Folder && ndc >= (m.Datacenter-m.Folder) { + f, err := folder.CreateFolder(ctx, fName) + if err != nil { + return err + } + folder = f + } + + dc, err := folder.CreateDatacenter(ctx, dcName) + if err != nil { + return err + } + + folders, err := dc.Folders(ctx) + if err != nil { + return err + } + + if m.Pod > 0 { + for pod := 0; pod < m.Pod; pod++ { + _, _ = folders.DatastoreFolder.CreateStoragePod(ctx, m.fmtName(dcName+"_POD", pod)) + } + } + + if folder != root { + // Create sub-folders and use them to create any resources that follow + subs := []**object.Folder{&folders.DatastoreFolder, &folders.HostFolder, &folders.NetworkFolder, &folders.VmFolder} + + for _, sub := range subs { + f, err := (*sub).CreateFolder(ctx, fName) + if err != nil { + return err + } + + *sub = f + } + + nfolder++ + } + + if m.Portgroup > 0 { + var spec types.DVSCreateSpec + spec.ConfigSpec = &types.VMwareDVSConfigSpec{} + spec.ConfigSpec.GetDVSConfigSpec().Name = m.fmtName("DVS", 0) + + task, err := folders.NetworkFolder.CreateDVS(ctx, spec) + if err != nil { + return err + } + + info, err := task.WaitForResult(ctx, nil) + if err != nil { + return err + } + + dvs = object.NewDistributedVirtualSwitch(client, info.Result.(types.ManagedObjectReference)) + + for npg := 0; npg < m.Portgroup; npg++ { + name := m.fmtName(dcName+"_DVPG", npg) + + task, err = dvs.AddPortgroup(ctx, []types.DVPortgroupConfigSpec{{Name: name}}) + if err != nil { + return err + } + + err = task.Wait(ctx) + if err != nil { + return err + } + + // Use the 1st DVPG for the VMs eth0 backing + if npg == 0 { + // AddPortgroup_Task does not return the moid, so we look it up by name + net := Map.Get(folders.NetworkFolder.Reference()).(*Folder) + pg := Map.FindByName(name, net.ChildEntity) + + vmnet, _ = object.NewDistributedVirtualPortgroup(client, pg.Reference()).EthernetCardBackingInfo(ctx) + } + } + } + + for nhost := 0; nhost < m.Host; nhost++ { + name := m.fmtName(dcName+"_H", nhost) + + host, err := addHost(name, func(spec types.HostConnectSpec) (*object.Task, error) { + return folders.HostFolder.AddStandaloneHost(ctx, spec, true, nil, nil) + }) + if err != nil { + return err + } + + addMachine(name, host, nil, folders) + } + + for ncluster := 0; ncluster < m.Cluster; ncluster++ { + clusterName := m.fmtName(dcName+"_C", ncluster) + + cluster, err := folders.HostFolder.CreateCluster(ctx, clusterName, types.ClusterConfigSpecEx{}) + if err != nil { + return err + } + + for nhost := 0; nhost < m.ClusterHost; nhost++ { + name := m.fmtName(clusterName+"_H", nhost) + + _, err = addHost(name, func(spec types.HostConnectSpec) (*object.Task, error) { + return cluster.AddHost(ctx, spec, true, nil, nil) + }) + if err != nil { + return err + } + } + + pool, err := cluster.ResourcePool(ctx) + if err != nil { + return err + } + + prefix := clusterName + "_RP" + + addMachine(prefix+"0", nil, pool, folders) + + for npool := 1; npool <= m.Pool; npool++ { + spec := types.DefaultResourceConfigSpec() + + _, err = pool.Create(ctx, m.fmtName(prefix, npool), spec) + if err != nil { + return err + } + } + + prefix = clusterName + "_APP" + + for napp := 0; napp < m.App; napp++ { + rspec := types.DefaultResourceConfigSpec() + vspec := NewVAppConfigSpec() + name := m.fmtName(prefix, napp) + + vapp, err := pool.CreateVApp(ctx, name, rspec, vspec, nil) + if err != nil { + return err + } + + addMachine(name, nil, vapp.ResourcePool, folders) + } + } + } + + if m.ServiceContent.RootFolder == esx.RootFolder.Reference() { + // ESX model + host := object.NewHostSystem(client, esx.HostSystem.Reference()) + hosts = append(hosts, host) + + dc := object.NewDatacenter(client, esx.Datacenter.Reference()) + folders, err := dc.Folders(ctx) + if err != nil { + return err + } + + addMachine(host.Reference().Value, host, nil, folders) + } + + for i := 0; i < m.Datastore; i++ { + err := m.createLocalDatastore(m.fmtName("LocalDS_", i), hosts) + if err != nil { + return err + } + } + + for _, createVM := range vms { + err := createVM() + if err != nil { + return err + } + } + + return nil +} + +var tempDir = func() (string, error) { + return ioutil.TempDir("", "govcsim-") +} + +func (m *Model) createLocalDatastore(name string, hosts []*object.HostSystem) error { + ctx := context.Background() + dir, err := tempDir() + if err != nil { + return err + } + + m.dirs = append(m.dirs, dir) + + for _, host := range hosts { + dss, err := host.ConfigManager().DatastoreSystem(ctx) + if err != nil { + return err + } + + _, err = dss.CreateLocalDatastore(ctx, name, dir) + if err != nil { + return err + } + } + + return nil +} + +// Remove cleans up items created by the Model, such as local datastore directories +func (m *Model) Remove() { + for _, dir := range m.dirs { + _ = os.RemoveAll(dir) + } +} diff --git a/vendor/github.com/vmware/govmomi/simulator/option_manager.go b/vendor/github.com/vmware/govmomi/simulator/option_manager.go new file mode 100644 index 00000000000..4615882c364 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/option_manager.go @@ -0,0 +1,59 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "strings" + + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type OptionManager struct { + mo.OptionManager +} + +func NewOptionManager(ref *types.ManagedObjectReference, setting []types.BaseOptionValue) object.Reference { + s := &OptionManager{} + if ref != nil { + s.Self = *ref + } + s.Setting = setting + return s +} + +func (m *OptionManager) QueryOptions(req *types.QueryOptions) soap.HasFault { + body := &methods.QueryOptionsBody{} + res := &types.QueryOptionsResponse{} + + for _, opt := range m.Setting { + if strings.HasPrefix(opt.GetOptionValue().Key, req.Name) { + res.Returnval = append(res.Returnval, opt) + } + } + + if len(res.Returnval) == 0 { + body.Fault_ = Fault("", &types.InvalidName{Name: req.Name}) + } else { + body.Res = res + } + + return body +} diff --git a/vendor/github.com/vmware/govmomi/simulator/os_unix.go b/vendor/github.com/vmware/govmomi/simulator/os_unix.go new file mode 100644 index 00000000000..63c15621ace --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/os_unix.go @@ -0,0 +1,38 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import "syscall" + +func (ds *Datastore) stat() error { + info := ds.Info.GetDatastoreInfo() + var stat syscall.Statfs_t + + err := syscall.Statfs(info.Url, &stat) + if err != nil { + return err + } + + bsize := uint64(stat.Bsize) / 512 + + info.FreeSpace = int64(stat.Bfree*bsize) >> 1 + + ds.Summary.FreeSpace = info.FreeSpace + ds.Summary.Capacity = int64(stat.Blocks*bsize) >> 1 + + return nil +} diff --git a/vendor/github.com/vmware/govmomi/simulator/os_windows.go b/vendor/github.com/vmware/govmomi/simulator/os_windows.go new file mode 100644 index 00000000000..55cf2ab07ef --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/os_windows.go @@ -0,0 +1,26 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import "os" + +func (ds *Datastore) stat() error { + info := ds.Info.GetDatastoreInfo() + + _, err := os.Stat(info.Url) + return err +} diff --git a/vendor/github.com/vmware/govmomi/simulator/performance_manager.go b/vendor/github.com/vmware/govmomi/simulator/performance_manager.go new file mode 100644 index 00000000000..e6a70efc0a7 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/performance_manager.go @@ -0,0 +1,35 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/simulator/esx" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/types" +) + +type PerformanceManager struct { + mo.PerformanceManager +} + +func NewPerformanceManager(ref types.ManagedObjectReference) object.Reference { + m := &PerformanceManager{} + m.Self = ref + m.PerfCounter = esx.PerfCounter + return m +} diff --git a/vendor/github.com/vmware/govmomi/simulator/portgroup.go b/vendor/github.com/vmware/govmomi/simulator/portgroup.go new file mode 100644 index 00000000000..434f5fd4728 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/portgroup.go @@ -0,0 +1,82 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type DistributedVirtualPortgroup struct { + mo.DistributedVirtualPortgroup +} + +func (s *DistributedVirtualPortgroup) ReconfigureDVPortgroupTask(req *types.ReconfigureDVPortgroup_Task) soap.HasFault { + task := CreateTask(s, "reconfigureDvPortgroup", func(t *Task) (types.AnyType, types.BaseMethodFault) { + s.Config.DefaultPortConfig = req.Spec.DefaultPortConfig + s.Config.NumPorts = req.Spec.NumPorts + s.Config.AutoExpand = req.Spec.AutoExpand + s.Config.Type = req.Spec.Type + s.Config.Description = req.Spec.Description + s.Config.DynamicData = req.Spec.DynamicData + s.Config.Name = req.Spec.Name + s.Config.Policy = req.Spec.Policy + s.Config.PortNameFormat = req.Spec.PortNameFormat + s.Config.VmVnicNetworkResourcePoolKey = req.Spec.VmVnicNetworkResourcePoolKey + + return nil, nil + }) + + return &methods.ReconfigureDVPortgroup_TaskBody{ + Res: &types.ReconfigureDVPortgroup_TaskResponse{ + Returnval: task.Run(), + }, + } +} + +func (s *DistributedVirtualPortgroup) DestroyTask(req *types.Destroy_Task) soap.HasFault { + task := CreateTask(s, "destroy", func(t *Task) (types.AnyType, types.BaseMethodFault) { + vswitch := Map.Get(*s.Config.DistributedVirtualSwitch).(*DistributedVirtualSwitch) + for i, pg := range vswitch.Portgroup { + if pg.Reference() == s.Reference() { + vswitch.Portgroup = append(vswitch.Portgroup[:i], vswitch.Portgroup[i+1:]...) + break + } + } + + f := Map.getEntityParent(vswitch, "Folder").(*Folder) + f.removeChild(s.Reference()) + + for i, name := range vswitch.Summary.PortgroupName { + if name == s.Name { + vswitch.Summary.PortgroupName = append(vswitch.Summary.PortgroupName[:i], + vswitch.Summary.PortgroupName[i+1:]...) + } + } + + return nil, nil + }) + + return &methods.Destroy_TaskBody{ + Res: &types.Destroy_TaskResponse{ + Returnval: task.Run(), + }, + } + +} diff --git a/vendor/github.com/vmware/govmomi/simulator/property_collector.go b/vendor/github.com/vmware/govmomi/simulator/property_collector.go new file mode 100644 index 00000000000..8ef7898d84d --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/property_collector.go @@ -0,0 +1,548 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "errors" + "log" + "path" + "reflect" + "strings" + + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type PropertyCollector struct { + mo.PropertyCollector +} + +func NewPropertyCollector(ref types.ManagedObjectReference) object.Reference { + s := &PropertyCollector{} + s.Self = ref + return s +} + +var errMissingField = errors.New("missing field") +var errEmptyField = errors.New("empty field") + +func getObject(ref types.ManagedObjectReference) (reflect.Value, bool) { + obj := Map.Get(ref) + if obj == nil { + return reflect.Value{}, false + } + + rval := reflect.ValueOf(obj).Elem() + rtype := rval.Type() + + // PropertyCollector is for Managed Object types only (package mo). + // If the registry object is not in the mo package, assume it is a wrapper + // type where the first field is an embedded mo type. + // We need to dig out the mo type for PropSet.All to work properly and + // for the case where the type has a field of the same name, for example: + // mo.ResourcePool.ResourcePool + for { + if path.Base(rtype.PkgPath()) != "mo" { + if rtype.Kind() != reflect.Struct || rtype.NumField() == 0 { + log.Printf("%#v does not have an embedded mo type", ref) + return reflect.Value{}, false + } + rval = rval.Field(0) + rtype = rval.Type() + } else { + break + } + } + + return rval, true +} + +func fieldValueInterface(f reflect.StructField, rval reflect.Value) interface{} { + if rval.Kind() == reflect.Ptr { + rval = rval.Elem() + } + + pval := rval.Interface() + + if rval.Kind() == reflect.Slice { + // Convert slice to types.ArrayOf* + switch v := pval.(type) { + case []string: + pval = &types.ArrayOfString{ + String: v, + } + case []int32: + pval = &types.ArrayOfInt{ + Int: v, + } + default: + kind := f.Type.Elem().Name() + // Remove govmomi interface prefix name + if strings.HasPrefix(kind, "Base") { + kind = kind[4:] + } + akind, _ := typeFunc("ArrayOf" + kind) + a := reflect.New(akind) + a.Elem().FieldByName(kind).Set(rval) + pval = a.Interface() + } + } + + return pval +} + +func fieldValue(rval reflect.Value, p string) (interface{}, error) { + var value interface{} + + fields := strings.Split(p, ".") + + for i, name := range fields { + kind := rval.Type().Kind() + + if kind == reflect.Interface { + if rval.IsNil() { + continue + } + rval = rval.Elem() + kind = rval.Type().Kind() + } + + if kind == reflect.Ptr { + if rval.IsNil() { + continue + } + rval = rval.Elem() + } + + x := ucFirst(name) + val := rval.FieldByName(x) + if !val.IsValid() { + return nil, errMissingField + } + + if isEmpty(val) { + return nil, errEmptyField + } + + if i == len(fields)-1 { + ftype, _ := rval.Type().FieldByName(x) + value = fieldValueInterface(ftype, val) + break + } + + rval = val + } + + return value, nil +} + +func fieldRefs(f interface{}) []types.ManagedObjectReference { + switch fv := f.(type) { + case types.ManagedObjectReference: + return []types.ManagedObjectReference{fv} + case *types.ArrayOfManagedObjectReference: + return fv.ManagedObjectReference + case nil: + // empty field + } + + return nil +} + +func isEmpty(rval reflect.Value) bool { + switch rval.Kind() { + case reflect.Ptr: + return rval.IsNil() + case reflect.String, reflect.Slice: + return rval.Len() == 0 + } + + return false +} + +func isTrue(v *bool) bool { + return v != nil && *v +} + +func isFalse(v *bool) bool { + return v == nil || *v == false +} + +func lcFirst(s string) string { + return strings.ToLower(s[:1]) + s[1:] +} + +func ucFirst(s string) string { + return strings.ToUpper(s[:1]) + s[1:] +} + +type retrieveResult struct { + *types.RetrieveResult + req *types.RetrievePropertiesEx + collected map[types.ManagedObjectReference]bool + specs map[string]*types.TraversalSpec +} + +func (rr *retrieveResult) collectAll(rval reflect.Value, rtype reflect.Type, content *types.ObjectContent) { + for i := 0; i < rval.NumField(); i++ { + val := rval.Field(i) + + f := rtype.Field(i) + + if isEmpty(val) || f.Name == "Self" { + continue + } + + if f.Anonymous { + // recurse into embedded field + rr.collectAll(val, f.Type, content) + continue + } + + content.PropSet = append(content.PropSet, types.DynamicProperty{ + Name: lcFirst(f.Name), + Val: fieldValueInterface(f, val), + }) + } +} + +func (rr *retrieveResult) collectFields(rval reflect.Value, fields []string, content *types.ObjectContent) { + seen := make(map[string]bool) + + for i := range content.PropSet { + seen[content.PropSet[i].Name] = true // mark any already collected via embedded field + } + + for _, name := range fields { + if seen[name] { + // rvc 'ls' includes the "name" property twice, then fails with no error message or stack trace + // in RbVmomi::VIM::ObjectContent.to_hash_uncached when it sees the 2nd "name" property. + continue + } + seen[name] = true + + val, err := fieldValue(rval, name) + if err == nil { + prop := types.DynamicProperty{ + Name: name, + Val: val, + } + + content.PropSet = append(content.PropSet, prop) + continue + } + + switch err { + case errEmptyField: + // ok + case errMissingField: + content.MissingSet = append(content.MissingSet, types.MissingProperty{ + Path: name, + Fault: types.LocalizedMethodFault{Fault: &types.InvalidProperty{ + Name: name, + }}, + }) + } + } +} + +func (rr *retrieveResult) collect(ref types.ManagedObjectReference) { + if rr.collected[ref] { + return + } + + content := types.ObjectContent{ + Obj: ref, + } + + rval, ok := getObject(ref) + if !ok { + // Possible if a test uses Map.Remove instead of Destroy_Task + log.Printf("object %s no longer exists", ref) + return + } + + rtype := rval.Type() + + for _, spec := range rr.req.SpecSet { + for _, p := range spec.PropSet { + if p.Type != ref.Type { + // e.g. ManagedEntity, ComputeResource + field, ok := rtype.FieldByName(p.Type) + + if !(ok && field.Anonymous) { + continue + } + } + + if isTrue(p.All) { + rr.collectAll(rval, rtype, &content) + continue + } + + rr.collectFields(rval, p.PathSet, &content) + } + } + + if len(content.PropSet) != 0 || len(content.MissingSet) != 0 { + rr.Objects = append(rr.Objects, content) + } + + rr.collected[ref] = true +} + +func (rr *retrieveResult) selectSet(obj reflect.Value, s []types.BaseSelectionSpec, refs *[]types.ManagedObjectReference) types.BaseMethodFault { + for _, ss := range s { + ts, ok := ss.(*types.TraversalSpec) + + if ok { + if ts.Name != "" { + rr.specs[ts.Name] = ts + } + } + } + + for _, ss := range s { + ts, ok := ss.(*types.TraversalSpec) + if !ok { + ts = rr.specs[ss.GetSelectionSpec().Name] + if ts == nil { + return &types.InvalidArgument{InvalidProperty: "undefined TraversalSpec name"} + } + } + + f, _ := fieldValue(obj, ts.Path) + + for _, ref := range fieldRefs(f) { + if isFalse(ts.Skip) { + *refs = append(*refs, ref) + } + + rval, ok := getObject(ref) + if ok { + if err := rr.selectSet(rval, ts.SelectSet, refs); err != nil { + return err + } + } + } + } + + return nil +} + +func (pc *PropertyCollector) collect(r *types.RetrievePropertiesEx) (*types.RetrieveResult, types.BaseMethodFault) { + var refs []types.ManagedObjectReference + + rr := &retrieveResult{ + RetrieveResult: &types.RetrieveResult{}, + req: r, + collected: make(map[types.ManagedObjectReference]bool), + specs: make(map[string]*types.TraversalSpec), + } + + // Select object references + for _, spec := range r.SpecSet { + for _, o := range spec.ObjectSet { + rval, ok := getObject(o.Obj) + + if !ok { + if isFalse(spec.ReportMissingObjectsInResults) { + return nil, &types.ManagedObjectNotFound{Obj: o.Obj} + } + continue + } + + if o.SelectSet == nil || isFalse(o.Skip) { + refs = append(refs, o.Obj) + } + + if err := rr.selectSet(rval, o.SelectSet, &refs); err != nil { + return nil, err + } + } + } + + for _, ref := range refs { + rr.collect(ref) + } + + return rr.RetrieveResult, nil +} + +func (pc *PropertyCollector) CreateFilter(c *types.CreateFilter) soap.HasFault { + body := &methods.CreateFilterBody{} + + filter := &PropertyFilter{pc: pc} + filter.PartialUpdates = c.PartialUpdates + filter.Spec = c.Spec + + pc.Filter = append(pc.Filter, Map.Put(filter).Reference()) + + body.Res = &types.CreateFilterResponse{ + Returnval: filter.Self, + } + + return body +} + +func (pc *PropertyCollector) CreatePropertyCollector(c *types.CreatePropertyCollector) soap.HasFault { + body := &methods.CreatePropertyCollectorBody{} + + cpc := &PropertyCollector{} + + body.Res = &types.CreatePropertyCollectorResponse{ + Returnval: Map.Put(cpc).Reference(), + } + + return body +} + +func (pc *PropertyCollector) DestroyPropertyCollector(c *types.DestroyPropertyCollector) soap.HasFault { + body := &methods.DestroyPropertyCollectorBody{} + + for _, ref := range pc.Filter { + filter := Map.Get(ref).(*PropertyFilter) + filter.DestroyPropertyFilter(&types.DestroyPropertyFilter{This: ref}) + } + + Map.Remove(c.This) + + body.Res = &types.DestroyPropertyCollectorResponse{} + + return body +} + +func (pc *PropertyCollector) RetrievePropertiesEx(r *types.RetrievePropertiesEx) soap.HasFault { + body := &methods.RetrievePropertiesExBody{} + + res, fault := pc.collect(r) + + if fault != nil { + body.Fault_ = Fault("", fault) + } else { + body.Res = &types.RetrievePropertiesExResponse{ + Returnval: res, + } + } + + return body +} + +// RetrieveProperties is deprecated, but govmomi is still using it at the moment. +func (pc *PropertyCollector) RetrieveProperties(r *types.RetrieveProperties) soap.HasFault { + body := &methods.RetrievePropertiesBody{} + + res := pc.RetrievePropertiesEx(&types.RetrievePropertiesEx{ + This: r.This, + SpecSet: r.SpecSet, + }) + + if res.Fault() != nil { + body.Fault_ = res.Fault() + } else { + body.Res = &types.RetrievePropertiesResponse{ + Returnval: res.(*methods.RetrievePropertiesExBody).Res.Returnval.Objects, + } + } + + return body +} + +func (pc *PropertyCollector) CancelWaitForUpdates(r *types.CancelWaitForUpdates) soap.HasFault { + return &methods.CancelWaitForUpdatesBody{Res: new(types.CancelWaitForUpdatesResponse)} +} + +func (pc *PropertyCollector) WaitForUpdatesEx(r *types.WaitForUpdatesEx) soap.HasFault { + body := &methods.WaitForUpdatesExBody{} + + // At the moment we need to support Task completion. Handlers can simply set the Task + // state before returning and the non-incremental update is enough for the client. + // We can wait for incremental updates to simulate timeouts, etc. + if r.Version != "" { + body.Fault_ = Fault("incremental updates not supported yet", &types.NotSupported{}) + return body + } + + update := &types.UpdateSet{ + Version: "-", + } + + for _, ref := range pc.Filter { + filter := Map.Get(ref).(*PropertyFilter) + + r := &types.RetrievePropertiesEx{} + r.SpecSet = append(r.SpecSet, filter.Spec) + + res, fault := pc.collect(r) + if fault != nil { + body.Fault_ = Fault("", fault) + return body + } + + fu := types.PropertyFilterUpdate{ + Filter: ref, + } + + for _, o := range res.Objects { + ou := types.ObjectUpdate{ + Obj: o.Obj, + Kind: types.ObjectUpdateKindEnter, + } + + for _, p := range o.PropSet { + ou.ChangeSet = append(ou.ChangeSet, types.PropertyChange{ + Op: types.PropertyChangeOpAssign, + Name: p.Name, + Val: p.Val, + }) + } + + fu.ObjectSet = append(fu.ObjectSet, ou) + } + + update.FilterSet = append(update.FilterSet, fu) + } + + body.Res = &types.WaitForUpdatesExResponse{ + Returnval: update, + } + + return body +} + +// WaitForUpdates is deprecated, but pyvmomi is still using it at the moment. +func (pc *PropertyCollector) WaitForUpdates(r *types.WaitForUpdates) soap.HasFault { + body := &methods.WaitForUpdatesBody{} + + res := pc.WaitForUpdatesEx(&types.WaitForUpdatesEx{ + This: r.This, + Version: r.Version, + }) + + if res.Fault() != nil { + body.Fault_ = res.Fault() + } else { + body.Res = &types.WaitForUpdatesResponse{ + Returnval: *res.(*methods.WaitForUpdatesExBody).Res.Returnval, + } + } + + return body +} diff --git a/vendor/github.com/vmware/govmomi/simulator/property_filter.go b/vendor/github.com/vmware/govmomi/simulator/property_filter.go new file mode 100644 index 00000000000..0d7d9a38daf --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/property_filter.go @@ -0,0 +1,42 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type PropertyFilter struct { + mo.PropertyFilter + + pc *PropertyCollector +} + +func (f *PropertyFilter) DestroyPropertyFilter(c *types.DestroyPropertyFilter) soap.HasFault { + body := &methods.DestroyPropertyFilterBody{} + + f.pc.Filter = RemoveReference(c.This, f.pc.Filter) + + Map.Remove(c.This) + + body.Res = &types.DestroyPropertyFilterResponse{} + + return body +} diff --git a/vendor/github.com/vmware/govmomi/simulator/registry.go b/vendor/github.com/vmware/govmomi/simulator/registry.go new file mode 100644 index 00000000000..2fdc55f10ea --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/registry.go @@ -0,0 +1,338 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "fmt" + "reflect" + "strings" + "sync" + + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/types" +) + +// This is a map from a reference type name to a reference value name prefix. +// It's a convention that VirtualCenter follows. The map is not complete, but +// it should cover the most popular objects. +var refValueMap = map[string]string{ + "DistributedVirtualPortgroup": "dvportgroup", + "EnvironmentBrowser": "envbrowser", + "HostSystem": "host", + "ResourcePool": "resgroup", + "VirtualMachine": "vm", + "VirtualMachineSnapshot": "snapshot", + "VmwareDistributedVirtualSwitch": "dvs", +} + +// Map is the default Registry instance. +var Map = NewRegistry() + +// RegisterObject interface supports callbacks when objects are added and removed from the Registry +type RegisterObject interface { + mo.Reference + PutObject(mo.Reference) + RemoveObject(types.ManagedObjectReference) +} + +// Registry manages a map of mo.Reference objects +type Registry struct { + m sync.Mutex + objects map[types.ManagedObjectReference]mo.Reference + handlers map[types.ManagedObjectReference]RegisterObject + counter int +} + +// NewRegistry creates a new instances of Registry +func NewRegistry() *Registry { + r := &Registry{ + objects: make(map[types.ManagedObjectReference]mo.Reference), + handlers: make(map[types.ManagedObjectReference]RegisterObject), + } + + return r +} + +// typeName returns the type of the given object. +func typeName(item mo.Reference) string { + return reflect.TypeOf(item).Elem().Name() +} + +// valuePrefix returns the value name prefix of a given object +func valuePrefix(typeName string) string { + if v, ok := refValueMap[typeName]; ok { + return v + } + + return strings.ToLower(typeName) +} + +// newReference returns a new MOR, where Type defaults to type of the given item +// and Value defaults to a unique id for the given type. +func (r *Registry) newReference(item mo.Reference) types.ManagedObjectReference { + ref := item.Reference() + + if ref.Type == "" { + ref.Type = typeName(item) + } + + if ref.Value == "" { + r.counter++ + ref.Value = fmt.Sprintf("%s-%d", valuePrefix(ref.Type), r.counter) + } + + return ref +} + +// AddHandler adds a RegisterObject handler to the Registry. +func (r *Registry) AddHandler(h RegisterObject) { + r.handlers[h.Reference()] = h +} + +// NewEntity sets Entity().Self with a new, unique Value. +// Useful for creating object instances from templates. +func (r *Registry) NewEntity(item mo.Entity) mo.Entity { + e := item.Entity() + e.Self.Value = "" + e.Self = r.newReference(item) + return item +} + +// PutEntity sets item.Parent to that of parent.Self before adding item to the Registry. +func (r *Registry) PutEntity(parent mo.Entity, item mo.Entity) mo.Entity { + e := item.Entity() + + if parent != nil { + e.Parent = &parent.Entity().Self + } + + r.Put(item) + + return item +} + +// Get returns the object for the given reference. +func (r *Registry) Get(ref types.ManagedObjectReference) mo.Reference { + r.m.Lock() + defer r.m.Unlock() + + return r.objects[ref] +} + +// Any returns the first instance of entity type specified by kind. +func (r *Registry) Any(kind string) mo.Entity { + r.m.Lock() + defer r.m.Unlock() + + for ref, val := range r.objects { + if ref.Type == kind { + return val.(mo.Entity) + } + } + + return nil +} + +// Put adds a new object to Registry, generating a ManagedObjectReference if not already set. +func (r *Registry) Put(item mo.Reference) mo.Reference { + r.m.Lock() + defer r.m.Unlock() + + ref := item.Reference() + if ref.Type == "" || ref.Value == "" { + ref = r.newReference(item) + // mo.Reference() returns a value, not a pointer so use reflect to set the Self field + reflect.ValueOf(item).Elem().FieldByName("Self").Set(reflect.ValueOf(ref)) + } + + if me, ok := item.(mo.Entity); ok { + me.Entity().ConfigStatus = types.ManagedEntityStatusGreen + me.Entity().OverallStatus = types.ManagedEntityStatusGreen + me.Entity().EffectiveRole = []int32{-1} // Admin + } + + r.objects[ref] = item + + for _, h := range r.handlers { + h.PutObject(item) + } + + return item +} + +// Remove removes an object from the Registry. +func (r *Registry) Remove(item types.ManagedObjectReference) { + r.m.Lock() + defer r.m.Unlock() + + for _, h := range r.handlers { + h.RemoveObject(item) + } + + delete(r.objects, item) + delete(r.handlers, item) +} + +// getEntityParent traverses up the inventory and returns the first object of type kind. +// If no object of type kind is found, the method will panic when it reaches the +// inventory root Folder where the Parent field is nil. +func (r *Registry) getEntityParent(item mo.Entity, kind string) mo.Entity { + for { + parent := item.Entity().Parent + + item = r.Get(*parent).(mo.Entity) + + if item.Reference().Type == kind { + return item + } + } +} + +// getEntityDatacenter returns the Datacenter containing the given item +func (r *Registry) getEntityDatacenter(item mo.Entity) *mo.Datacenter { + return r.getEntityParent(item, "Datacenter").(*mo.Datacenter) +} + +func (r *Registry) getEntityFolder(item mo.Entity, kind string) *Folder { + dc := Map.getEntityDatacenter(item) + + var ref types.ManagedObjectReference + + switch kind { + case "datastore": + ref = dc.DatastoreFolder + } + + folder := r.Get(ref).(*Folder) + + // If Model was created with Folder option, use that Folder; else use top-level folder + for _, child := range folder.ChildEntity { + if child.Type == "Folder" { + folder = Map.Get(child).(*Folder) + break + } + } + + return folder +} + +// getEntityComputeResource returns the ComputeResource parent for the given item. +// A ResourcePool for example may have N Parents of type ResourcePool, but the top +// most Parent pool is always a ComputeResource child. +func (r *Registry) getEntityComputeResource(item mo.Entity) mo.Entity { + for { + parent := item.Entity().Parent + + item = r.Get(*parent).(mo.Entity) + + switch item.Reference().Type { + case "ComputeResource": + return item + case "ClusterComputeResource": + return item + } + } +} + +// FindByName returns the first mo.Entity of the given refs whose Name field is equal to the given name. +// If there is no match, nil is returned. +// This method is useful for cases where objects are required to have a unique name, such as Datastore with +// a HostStorageSystem or HostSystem within a ClusterComputeResource. +func (r *Registry) FindByName(name string, refs []types.ManagedObjectReference) mo.Entity { + for _, ref := range refs { + if e, ok := r.Get(ref).(mo.Entity); ok { + if name == e.Entity().Name { + return e + } + } + } + + return nil +} + +// FindReference returns the 1st match found in refs, or nil if not found. +func FindReference(refs []types.ManagedObjectReference, match ...types.ManagedObjectReference) *types.ManagedObjectReference { + for _, ref := range refs { + for _, m := range match { + if ref == m { + return &ref + } + } + } + + return nil +} + +// RemoveReference returns a slice with ref removed from refs +func RemoveReference(ref types.ManagedObjectReference, refs []types.ManagedObjectReference) []types.ManagedObjectReference { + var result []types.ManagedObjectReference + + for i, r := range refs { + if r == ref { + result = append(result, refs[i+1:]...) + break + } + + result = append(result, r) + } + + return result +} + +// AddReference returns a slice with ref appended if not already in refs. +func AddReference(ref types.ManagedObjectReference, refs []types.ManagedObjectReference) []types.ManagedObjectReference { + if FindReference(refs, ref) == nil { + return append(refs, ref) + } + + return refs +} + +func (r *Registry) content() types.ServiceContent { + return r.Get(methods.ServiceInstance).(*ServiceInstance).Content +} + +// IsESX returns true if this Registry maps an ESX model +func (r *Registry) IsESX() bool { + return r.content().About.ApiType == "HostAgent" +} + +// IsVPX returns true if this Registry maps a VPX model +func (r *Registry) IsVPX() bool { + return !r.IsESX() +} + +// SearchIndex returns the SearchIndex singleton +func (r *Registry) SearchIndex() *SearchIndex { + return r.Get(r.content().SearchIndex.Reference()).(*SearchIndex) +} + +// FileManager returns the FileManager singleton +func (r *Registry) FileManager() *FileManager { + return r.Get(r.content().FileManager.Reference()).(*FileManager) +} + +// VirtualDiskManager returns the VirtualDiskManager singleton +func (r *Registry) VirtualDiskManager() *VirtualDiskManager { + return r.Get(r.content().VirtualDiskManager.Reference()).(*VirtualDiskManager) +} + +// ViewManager returns the ViewManager singleton +func (r *Registry) ViewManager() *ViewManager { + return r.Get(r.content().ViewManager.Reference()).(*ViewManager) +} diff --git a/vendor/github.com/vmware/govmomi/simulator/resource_pool.go b/vendor/github.com/vmware/govmomi/simulator/resource_pool.go new file mode 100644 index 00000000000..604f7b44dbd --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/resource_pool.go @@ -0,0 +1,312 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "fmt" + "strings" + + "github.com/vmware/govmomi/simulator/esx" + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type ResourcePool struct { + mo.ResourcePool +} + +func NewResourcePool() *ResourcePool { + pool := &ResourcePool{ + ResourcePool: esx.ResourcePool, + } + + if Map.IsVPX() { + pool.DisabledMethod = nil // Enable VApp methods for VC + } + + return pool +} + +func allResourceFieldsSet(info *types.ResourceAllocationInfo) bool { + return info.Reservation != nil && + info.Limit != nil && + info.ExpandableReservation != nil && + info.Shares != nil +} + +func allResourceFieldsValid(info *types.ResourceAllocationInfo) bool { + if info.Reservation != nil { + if *info.Reservation < 0 { + return false + } + } + + if info.Limit != nil { + if *info.Limit < -1 { + return false + } + } + + if info.Shares != nil { + if info.Shares.Level == types.SharesLevelCustom { + if info.Shares.Shares < 0 { + return false + } + } + } + + if info.OverheadLimit != nil { + return false + } + + return true +} + +func (p *ResourcePool) createChild(name string, spec types.ResourceConfigSpec) (*ResourcePool, *soap.Fault) { + if e := Map.FindByName(name, p.ResourcePool.ResourcePool); e != nil { + return nil, Fault("", &types.DuplicateName{ + Name: e.Entity().Name, + Object: e.Reference(), + }) + } + + if !(allResourceFieldsSet(&spec.CpuAllocation) && allResourceFieldsValid(&spec.CpuAllocation)) { + return nil, Fault("", &types.InvalidArgument{ + InvalidProperty: "spec.cpuAllocation", + }) + } + + if !(allResourceFieldsSet(&spec.MemoryAllocation) && allResourceFieldsValid(&spec.MemoryAllocation)) { + return nil, Fault("", &types.InvalidArgument{ + InvalidProperty: "spec.memoryAllocation", + }) + } + + child := NewResourcePool() + + child.Name = name + child.Owner = p.Owner + child.Summary.GetResourcePoolSummary().Name = name + child.Config.CpuAllocation = spec.CpuAllocation + child.Config.MemoryAllocation = spec.MemoryAllocation + child.Config.Entity = spec.Entity + + return child, nil +} + +func (p *ResourcePool) CreateResourcePool(c *types.CreateResourcePool) soap.HasFault { + body := &methods.CreateResourcePoolBody{} + + child, err := p.createChild(c.Name, c.Spec) + if err != nil { + body.Fault_ = err + return body + } + + Map.PutEntity(p, Map.NewEntity(child)) + + p.ResourcePool.ResourcePool = append(p.ResourcePool.ResourcePool, child.Reference()) + + body.Res = &types.CreateResourcePoolResponse{ + Returnval: child.Reference(), + } + + return body +} + +func updateResourceAllocation(kind string, src, dst *types.ResourceAllocationInfo) types.BaseMethodFault { + if !allResourceFieldsValid(src) { + return &types.InvalidArgument{ + InvalidProperty: fmt.Sprintf("spec.%sAllocation", kind), + } + } + + if src.Reservation != nil { + dst.Reservation = src.Reservation + } + + if src.Limit != nil { + dst.Limit = src.Limit + } + + if src.Shares != nil { + dst.Shares = src.Shares + } + + return nil +} + +func (p *ResourcePool) UpdateConfig(c *types.UpdateConfig) soap.HasFault { + body := &methods.UpdateConfigBody{} + + if c.Name != "" { + if e := Map.FindByName(c.Name, p.ResourcePool.ResourcePool); e != nil { + body.Fault_ = Fault("", &types.DuplicateName{ + Name: e.Entity().Name, + Object: e.Reference(), + }) + return body + } + + p.Name = c.Name + } + + spec := c.Config + + if spec != nil { + if err := updateResourceAllocation("memory", &spec.MemoryAllocation, &p.Config.MemoryAllocation); err != nil { + body.Fault_ = Fault("", err) + return body + } + + if err := updateResourceAllocation("cpu", &spec.CpuAllocation, &p.Config.CpuAllocation); err != nil { + body.Fault_ = Fault("", err) + return body + } + } + + body.Res = &types.UpdateConfigResponse{} + + return body +} + +type VirtualApp struct { + mo.VirtualApp +} + +func NewVAppConfigSpec() types.VAppConfigSpec { + spec := types.VAppConfigSpec{ + Annotation: "vcsim", + VmConfigSpec: types.VmConfigSpec{ + Product: []types.VAppProductSpec{ + { + Info: &types.VAppProductInfo{ + Name: "vcsim", + Vendor: "VMware", + VendorUrl: "http://www.vmware.com/", + Version: "0.1", + }, + ArrayUpdateSpec: types.ArrayUpdateSpec{ + Operation: types.ArrayUpdateOperationAdd, + }, + }, + }, + }, + } + + return spec +} + +func (p *ResourcePool) CreateVApp(req *types.CreateVApp) soap.HasFault { + body := &methods.CreateVAppBody{} + + pool, err := p.createChild(req.Name, req.ResSpec) + if err != nil { + body.Fault_ = err + return body + } + + child := &VirtualApp{} + child.ResourcePool = pool.ResourcePool + child.Self.Type = "VirtualApp" + child.ParentFolder = req.VmFolder + + if child.ParentFolder == nil { + folder := Map.getEntityDatacenter(p).VmFolder + child.ParentFolder = &folder + } + + child.VAppConfig = &types.VAppConfigInfo{ + VmConfigInfo: types.VmConfigInfo{}, + Annotation: req.ConfigSpec.Annotation, + } + + for _, product := range req.ConfigSpec.Product { + child.VAppConfig.Product = append(child.VAppConfig.Product, *product.Info) + } + + Map.PutEntity(p, Map.NewEntity(child)) + + p.ResourcePool.ResourcePool = append(p.ResourcePool.ResourcePool, child.Reference()) + + body.Res = &types.CreateVAppResponse{ + Returnval: child.Reference(), + } + + return body +} + +func (a *VirtualApp) CreateChildVMTask(req *types.CreateChildVM_Task) soap.HasFault { + body := &methods.CreateChildVM_TaskBody{} + + folder := Map.Get(*a.ParentFolder).(*Folder) + + res := folder.CreateVMTask(&types.CreateVM_Task{ + This: folder.Self, + Config: req.Config, + Host: req.Host, + Pool: req.This, + }) + + body.Res = &types.CreateChildVM_TaskResponse{ + Returnval: res.(*methods.CreateVM_TaskBody).Res.Returnval, + } + + return body +} + +func (a *VirtualApp) DestroyTask(req *types.Destroy_Task) soap.HasFault { + return (&ResourcePool{ResourcePool: a.ResourcePool}).DestroyTask(req) +} + +func (p *ResourcePool) DestroyTask(req *types.Destroy_Task) soap.HasFault { + task := CreateTask(p, "destroy", func(t *Task) (types.AnyType, types.BaseMethodFault) { + if strings.HasSuffix(p.Parent.Type, "ComputeResource") { + // Can't destroy the root pool + return nil, &types.InvalidArgument{} + } + + pp := Map.Get(*p.Parent).(*ResourcePool) + + parent := &pp.ResourcePool + // Remove child reference from rp + parent.ResourcePool = RemoveReference(req.This, parent.ResourcePool) + + // The grandchildren become children of the parent (rp) + parent.ResourcePool = append(parent.ResourcePool, p.ResourcePool.ResourcePool...) + + // And VMs move to the parent + vms := p.ResourcePool.Vm + for _, vm := range vms { + Map.Get(vm).(*VirtualMachine).ResourcePool = &parent.Self + } + + parent.Vm = append(parent.Vm, vms...) + + Map.Remove(req.This) + + return nil, nil + }) + + return &methods.Destroy_TaskBody{ + Res: &types.Destroy_TaskResponse{ + Returnval: task.Run(), + }, + } +} diff --git a/vendor/github.com/vmware/govmomi/simulator/search_index.go b/vendor/github.com/vmware/govmomi/simulator/search_index.go new file mode 100644 index 00000000000..c56dff2cba7 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/search_index.go @@ -0,0 +1,155 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "strings" + + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type SearchIndex struct { + mo.SearchIndex +} + +func NewSearchIndex(ref types.ManagedObjectReference) object.Reference { + m := &SearchIndex{} + m.Self = ref + return m +} + +func (s *SearchIndex) FindByDatastorePath(r *types.FindByDatastorePath) soap.HasFault { + res := &methods.FindByDatastorePathBody{Res: new(types.FindByDatastorePathResponse)} + + for ref, obj := range Map.objects { + vm, ok := obj.(*VirtualMachine) + if !ok { + continue + } + + if vm.Config.Files.VmPathName == r.Path { + res.Res.Returnval = &ref + break + } + } + + return res +} + +func (s *SearchIndex) FindByInventoryPath(req *types.FindByInventoryPath) soap.HasFault { + body := &methods.FindByInventoryPathBody{Res: new(types.FindByInventoryPathResponse)} + + path := strings.Split(req.InventoryPath, "/") + if len(path) <= 1 { + return body + } + + root := Map.content().RootFolder + o := &root + + for _, name := range path[1:] { + f := s.FindChild(&types.FindChild{Entity: *o, Name: name}) + + o = f.(*methods.FindChildBody).Res.Returnval + if o == nil { + break + } + } + + body.Res.Returnval = o + + return body +} + +func (s *SearchIndex) FindChild(req *types.FindChild) soap.HasFault { + body := &methods.FindChildBody{} + + obj := Map.Get(req.Entity) + + if obj == nil { + body.Fault_ = Fault("", &types.ManagedObjectNotFound{Obj: req.Entity}) + return body + } + + body.Res = new(types.FindChildResponse) + + var children []types.ManagedObjectReference + + switch e := obj.(type) { + case *mo.Datacenter: + children = []types.ManagedObjectReference{e.VmFolder, e.HostFolder, e.DatastoreFolder, e.NetworkFolder} + case *Folder: + children = e.ChildEntity + case *mo.ComputeResource: + children = e.Host + children = append(children, *e.ResourcePool) + case *ClusterComputeResource: + children = e.Host + children = append(children, *e.ResourcePool) + case *ResourcePool: + children = e.ResourcePool.ResourcePool + children = append(children, e.Vm...) + case *VirtualApp: + children = e.ResourcePool.ResourcePool + children = append(children, e.Vm...) + } + + match := Map.FindByName(req.Name, children) + + if match != nil { + ref := match.Reference() + body.Res.Returnval = &ref + } + + return body +} + +func (s *SearchIndex) FindByUuid(req *types.FindByUuid) soap.HasFault { + body := &methods.FindByUuidBody{Res: new(types.FindByUuidResponse)} + + if req.VmSearch { + // Find Virtual Machine using UUID + for ref, obj := range Map.objects { + vm, ok := obj.(*VirtualMachine) + if !ok { + continue + } + if vm.Config.Uuid == req.Uuid { + body.Res.Returnval = &ref + break + } + } + } else { + // Find Host System using UUID + for ref, obj := range Map.objects { + host, ok := obj.(*HostSystem) + if !ok { + continue + } + if host.Summary.Hardware.Uuid == req.Uuid { + body.Res.Returnval = &ref + break + } + } + } + + return body +} diff --git a/vendor/github.com/vmware/govmomi/simulator/service_instance.go b/vendor/github.com/vmware/govmomi/simulator/service_instance.go new file mode 100644 index 00000000000..4f6a3bbe7db --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/service_instance.go @@ -0,0 +1,99 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "time" + + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/simulator/vpx" + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type ServiceInstance struct { + mo.ServiceInstance +} + +func NewServiceInstance(content types.ServiceContent, folder mo.Folder) *ServiceInstance { + Map = NewRegistry() + + s := &ServiceInstance{} + + s.Self = methods.ServiceInstance + s.Content = content + + Map.Put(s) + + f := &Folder{Folder: folder} + Map.Put(f) + + var setting []types.BaseOptionValue + + if content.About.ApiType == "HostAgent" { + CreateDefaultESX(f) + } else { + setting = vpx.Setting + } + + objects := []object.Reference{ + NewSessionManager(*s.Content.SessionManager), + NewAuthorizationManager(*s.Content.AuthorizationManager), + NewPerformanceManager(*s.Content.PerfManager), + NewPropertyCollector(s.Content.PropertyCollector), + NewFileManager(*s.Content.FileManager), + NewVirtualDiskManager(*s.Content.VirtualDiskManager), + NewLicenseManager(*s.Content.LicenseManager), + NewSearchIndex(*s.Content.SearchIndex), + NewViewManager(*s.Content.ViewManager), + NewTaskManager(*s.Content.TaskManager), + NewUserDirectory(*s.Content.UserDirectory), + NewOptionManager(s.Content.Setting, setting), + } + + if s.Content.CustomFieldsManager != nil { + objects = append(objects, NewCustomFieldsManager(*s.Content.CustomFieldsManager)) + } + + if s.Content.IpPoolManager != nil { + objects = append(objects, NewIpPoolManager(*s.Content.IpPoolManager)) + } + + for _, o := range objects { + Map.Put(o) + } + + return s +} + +func (s *ServiceInstance) RetrieveServiceContent(*types.RetrieveServiceContent) soap.HasFault { + return &methods.RetrieveServiceContentBody{ + Res: &types.RetrieveServiceContentResponse{ + Returnval: s.Content, + }, + } +} + +func (*ServiceInstance) CurrentTime(*types.CurrentTime) soap.HasFault { + return &methods.CurrentTimeBody{ + Res: &types.CurrentTimeResponse{ + Returnval: time.Now(), + }, + } +} diff --git a/vendor/github.com/vmware/govmomi/simulator/session_manager.go b/vendor/github.com/vmware/govmomi/simulator/session_manager.go new file mode 100644 index 00000000000..92a8f9b0941 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/session_manager.go @@ -0,0 +1,83 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "time" + + "github.com/google/uuid" + + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/session" + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type SessionManager struct { + mo.SessionManager + + ServiceHostName string +} + +func NewSessionManager(ref types.ManagedObjectReference) object.Reference { + s := &SessionManager{} + s.Self = ref + return s +} + +func (s *SessionManager) Login(login *types.Login) soap.HasFault { + body := &methods.LoginBody{} + + if login.Locale == "" { + login.Locale = session.Locale + } + + if login.UserName == "" || login.Password == "" { + body.Fault_ = Fault("Login failure", &types.InvalidLogin{}) + } else { + body.Res = &types.LoginResponse{ + Returnval: types.UserSession{ + Key: uuid.New().String(), + UserName: login.UserName, + FullName: login.UserName, + LoginTime: time.Now(), + LastActiveTime: time.Now(), + Locale: login.Locale, + MessageLocale: login.Locale, + }, + } + } + + return body +} + +func (s *SessionManager) Logout(*types.Logout) soap.HasFault { + return &methods.LogoutBody{Res: new(types.LogoutResponse)} +} + +func (s *SessionManager) AcquireGenericServiceTicket(ticket *types.AcquireGenericServiceTicket) soap.HasFault { + return &methods.AcquireGenericServiceTicketBody{ + Res: &types.AcquireGenericServiceTicketResponse{ + Returnval: types.SessionManagerGenericServiceTicket{ + Id: uuid.New().String(), + HostName: s.ServiceHostName, + }, + }, + } +} diff --git a/vendor/github.com/vmware/govmomi/simulator/simulator.go b/vendor/github.com/vmware/govmomi/simulator/simulator.go new file mode 100644 index 00000000000..9a9cf0194bf --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/simulator.go @@ -0,0 +1,551 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "bytes" + "context" + "crypto/tls" + "crypto/x509" + "encoding/json" + "encoding/pem" + "flag" + "fmt" + "io" + "io/ioutil" + "log" + "net/http" + "net/http/httptest" + "net/url" + "os" + "path" + "reflect" + "sort" + "strings" + + "github.com/vmware/govmomi/find" + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/vim25" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" + "github.com/vmware/govmomi/vim25/xml" +) + +// Trace when set to true, writes SOAP traffic to stderr +var Trace = false + +// Method encapsulates a decoded SOAP client request +type Method struct { + Name string + This types.ManagedObjectReference + Body types.AnyType +} + +// Service decodes incoming requests and dispatches to a Handler +type Service struct { + client *vim25.Client + + readAll func(io.Reader) ([]byte, error) + + TLS *tls.Config +} + +// Server provides a simulator Service over HTTP +type Server struct { + *httptest.Server + URL *url.URL + + caFile string +} + +// New returns an initialized simulator Service instance +func New(instance *ServiceInstance) *Service { + s := &Service{ + readAll: ioutil.ReadAll, + } + + s.client, _ = vim25.NewClient(context.Background(), s) + + return s +} + +type serverFaultBody struct { + Reason *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *serverFaultBody) Fault() *soap.Fault { return b.Reason } + +func serverFault(msg string) soap.HasFault { + return &serverFaultBody{Reason: Fault(msg, &types.InvalidRequest{})} +} + +// Fault wraps the given message and fault in a soap.Fault +func Fault(msg string, fault types.BaseMethodFault) *soap.Fault { + f := &soap.Fault{ + Code: "ServerFaultCode", + String: msg, + } + + f.Detail.Fault = fault + + return f +} + +func (s *Service) call(method *Method) soap.HasFault { + handler := Map.Get(method.This) + + if handler == nil { + msg := fmt.Sprintf("managed object not found: %s", method.This) + log.Print(msg) + fault := &types.ManagedObjectNotFound{Obj: method.This} + return &serverFaultBody{Reason: Fault(msg, fault)} + } + + name := method.Name + + if strings.HasSuffix(name, vTaskSuffix) { + // Make golint happy renaming "Foo_Task" -> "FooTask" + name = name[:len(name)-len(vTaskSuffix)] + sTaskSuffix + } + + m := reflect.ValueOf(handler).MethodByName(name) + if !m.IsValid() { + msg := fmt.Sprintf("%s does not implement: %s", method.This, method.Name) + log.Print(msg) + fault := &types.MethodNotFound{Receiver: method.This, Method: method.Name} + return &serverFaultBody{Reason: Fault(msg, fault)} + } + + if e, ok := handler.(mo.Entity); ok { + for _, dm := range e.Entity().DisabledMethod { + if name == dm { + msg := fmt.Sprintf("%s method is disabled: %s", method.This, method.Name) + fault := &types.MethodDisabled{} + return &serverFaultBody{Reason: Fault(msg, fault)} + } + } + } + + res := m.Call([]reflect.Value{reflect.ValueOf(method.Body)}) + + return res[0].Interface().(soap.HasFault) +} + +// RoundTrip implements the soap.RoundTripper interface in process. +// Rather than encode/decode SOAP over HTTP, this implementation uses reflection. +func (s *Service) RoundTrip(ctx context.Context, request, response soap.HasFault) error { + field := func(r soap.HasFault, name string) reflect.Value { + return reflect.ValueOf(r).Elem().FieldByName(name) + } + + // Every struct passed to soap.RoundTrip has "Req" and "Res" fields + req := field(request, "Req") + + // Every request has a "This" field. + this := req.Elem().FieldByName("This") + + method := &Method{ + Name: req.Elem().Type().Name(), + This: this.Interface().(types.ManagedObjectReference), + Body: req.Interface(), + } + + res := s.call(method) + + if err := res.Fault(); err != nil { + return soap.WrapSoapFault(err) + } + + field(response, "Res").Set(field(res, "Res")) + + return nil +} + +// soapEnvelope is a copy of soap.Envelope, with namespace changed to "soapenv", +// and additional namespace attributes required by some client libraries. +// Go still has issues decoding with such a namespace, but encoding is ok. +type soapEnvelope struct { + XMLName xml.Name `xml:"soapenv:Envelope"` + Enc string `xml:"xmlns:soapenc,attr"` + Env string `xml:"xmlns:soapenv,attr"` + XSD string `xml:"xmlns:xsd,attr"` + XSI string `xml:"xmlns:xsi,attr"` + Body interface{} `xml:"soapenv:Body"` +} + +// soapFault is a copy of soap.Fault, with the same changes as soapEnvelope +type soapFault struct { + XMLName xml.Name `xml:"soapenv:Fault"` + Code string `xml:"faultcode"` + String string `xml:"faultstring"` + Detail struct { + Fault types.AnyType `xml:",any,typeattr"` + } `xml:"detail"` +} + +// About generates some info about the simulator. +func (s *Service) About(w http.ResponseWriter, r *http.Request) { + var about struct { + Methods []string + Types []string + } + + seen := make(map[string]bool) + + f := reflect.TypeOf((*soap.HasFault)(nil)).Elem() + + for _, obj := range Map.objects { + kind := obj.Reference().Type + if seen[kind] { + continue + } + seen[kind] = true + + about.Types = append(about.Types, kind) + + t := reflect.TypeOf(obj) + for i := 0; i < t.NumMethod(); i++ { + m := t.Method(i) + if seen[m.Name] { + continue + } + seen[m.Name] = true + + if m.Type.NumIn() != 2 || m.Type.NumOut() != 1 || m.Type.Out(0) != f { + continue + } + + about.Methods = append(about.Methods, strings.Replace(m.Name, "Task", "_Task", 1)) + } + } + + sort.Strings(about.Methods) + sort.Strings(about.Types) + + w.Header().Set("Content-Type", "application/json") + enc := json.NewEncoder(w) + enc.SetIndent("", " ") + _ = enc.Encode(&about) +} + +// ServeSDK implements the http.Handler interface +func (s *Service) ServeSDK(w http.ResponseWriter, r *http.Request) { + if r.Method != "POST" { + w.WriteHeader(http.StatusMethodNotAllowed) + return + } + + body, err := s.readAll(r.Body) + _ = r.Body.Close() + if err != nil { + log.Printf("error reading body: %s", err) + w.WriteHeader(http.StatusBadRequest) + return + } + + if Trace { + fmt.Fprintf(os.Stderr, "Request: %s\n", string(body)) + } + + var res soap.HasFault + var soapBody interface{} + + method, err := UnmarshalBody(body) + if err != nil { + res = serverFault(err.Error()) + } else { + res = s.call(method) + } + + if f := res.Fault(); f != nil { + w.WriteHeader(http.StatusInternalServerError) + + // the generated method/*Body structs use the '*soap.Fault' type, + // so we need our own Body type to use the modified '*soapFault' type. + soapBody = struct { + Fault *soapFault + }{ + &soapFault{ + Code: f.Code, + String: f.String, + Detail: f.Detail, + }, + } + } else { + w.WriteHeader(http.StatusOK) + + soapBody = res + } + + var out bytes.Buffer + + fmt.Fprint(&out, xml.Header) + e := xml.NewEncoder(&out) + err = e.Encode(&soapEnvelope{ + Enc: "http://schemas.xmlsoap.org/soap/encoding/", + Env: "http://schemas.xmlsoap.org/soap/envelope/", + XSD: "http://www.w3.org/2001/XMLSchema", + XSI: "http://www.w3.org/2001/XMLSchema-instance", + Body: soapBody, + }) + if err == nil { + err = e.Flush() + } + + if err != nil { + log.Printf("error encoding %s response: %s", method.Name, err) + return + } + + if Trace { + fmt.Fprintf(os.Stderr, "Response: %s\n", out.String()) + } + + _, _ = w.Write(out.Bytes()) +} + +func (s *Service) findDatastore(query url.Values) (*Datastore, error) { + ctx := context.Background() + + finder := find.NewFinder(s.client, false) + dc, err := finder.DatacenterOrDefault(ctx, query.Get("dcName")) + if err != nil { + return nil, err + } + + finder.SetDatacenter(dc) + + ds, err := finder.DatastoreOrDefault(ctx, query.Get("dsName")) + if err != nil { + return nil, err + } + + return Map.Get(ds.Reference()).(*Datastore), nil +} + +const folderPrefix = "/folder/" + +// ServeDatastore handler for Datastore access via /folder path. +func (s *Service) ServeDatastore(w http.ResponseWriter, r *http.Request) { + ds, ferr := s.findDatastore(r.URL.Query()) + if ferr != nil { + log.Printf("failed to locate datastore with query params: %s", r.URL.RawQuery) + w.WriteHeader(http.StatusNotFound) + return + } + + file := strings.TrimPrefix(r.URL.Path, folderPrefix) + p := path.Join(ds.Info.GetDatastoreInfo().Url, file) + + switch r.Method { + case "GET": + f, err := os.Open(p) + if err != nil { + log.Printf("failed to %s '%s': %s", r.Method, p, err) + w.WriteHeader(http.StatusNotFound) + return + } + defer f.Close() + + _, _ = io.Copy(w, f) + case "POST": + _, err := os.Stat(p) + if err == nil { + // File exists + w.WriteHeader(http.StatusConflict) + return + } + + // File does not exist, fallthrough to create via PUT logic + fallthrough + case "PUT": + f, err := os.Create(p) + if err != nil { + log.Printf("failed to %s '%s': %s", r.Method, p, err) + w.WriteHeader(http.StatusInternalServerError) + return + } + defer f.Close() + + _, _ = io.Copy(f, r.Body) + default: + w.WriteHeader(http.StatusMethodNotAllowed) + } +} + +// ServiceVersions handler for the /sdk/vimServiceVersions.xml path. +func (*Service) ServiceVersions(w http.ResponseWriter, r *http.Request) { + // pyvmomi depends on this + + const versions = xml.Header + ` + + urn:vim25 + 6.5 + + 6.0 + 5.5 + + + +` + fmt.Fprint(w, versions) +} + +// NewServer returns an http Server instance for the given service +func (s *Service) NewServer() *Server { + mux := http.NewServeMux() + path := "/sdk" + + mux.HandleFunc(path, s.ServeSDK) + mux.HandleFunc(path+"/vimServiceVersions.xml", s.ServiceVersions) + mux.HandleFunc(folderPrefix, s.ServeDatastore) + mux.HandleFunc("/about", s.About) + + // Using NewUnstartedServer() instead of NewServer(), + // for use in main.go, where Start() blocks, we can still set ServiceHostName + ts := httptest.NewUnstartedServer(mux) + + u := &url.URL{ + Scheme: "http", + Host: ts.Listener.Addr().String(), + Path: path, + User: url.UserPassword("user", "pass"), + } + + // Redirect clients to this http server, rather than HostSystem.Name + Map.Get(*s.client.ServiceContent.SessionManager).(*SessionManager).ServiceHostName = u.Host + + if f := flag.Lookup("httptest.serve"); f != nil { + // Avoid the blocking behaviour of httptest.Server.Start() when this flag is set + _ = f.Value.Set("") + } + + if s.TLS == nil { + ts.Start() + } else { + ts.TLS = s.TLS + ts.StartTLS() + u.Scheme += "s" + } + + return &Server{ + Server: ts, + URL: u, + } +} + +// Certificate returns the TLS certificate for the Server if started with TLS enabled. +// This method will panic if TLS is not enabled for the server. +func (s *Server) Certificate() *x509.Certificate { + // By default httptest.StartTLS uses http/internal.LocalhostCert, which we can access here: + cert, _ := x509.ParseCertificate(s.TLS.Certificates[0].Certificate[0]) + return cert +} + +// CertificateInfo returns Server.Certificate() as object.HostCertificateInfo +func (s *Server) CertificateInfo() *object.HostCertificateInfo { + info := new(object.HostCertificateInfo) + info.FromCertificate(s.Certificate()) + return info +} + +// CertificateFile returns a file name, where the file contains the PEM encoded Server.Certificate. +// The temporary file is removed when Server.Close() is called. +func (s *Server) CertificateFile() (string, error) { + if s.caFile != "" { + return s.caFile, nil + } + + f, err := ioutil.TempFile("", "vcsim-") + if err != nil { + return "", err + } + defer f.Close() + + s.caFile = f.Name() + cert := s.Certificate() + return s.caFile, pem.Encode(f, &pem.Block{Type: "CERTIFICATE", Bytes: cert.Raw}) +} + +// Close shuts down the server and blocks until all outstanding +// requests on this server have completed. +func (s *Server) Close() { + s.Server.Close() + if s.caFile != "" { + _ = os.Remove(s.caFile) + } +} + +var typeFunc = types.TypeFunc() + +// UnmarshalBody extracts the Body from a soap.Envelope and unmarshals to the corresponding govmomi type +func UnmarshalBody(data []byte) (*Method, error) { + body := struct { + Content string `xml:",innerxml"` + }{} + + req := soap.Envelope{ + Body: &body, + } + + err := xml.Unmarshal(data, &req) + if err != nil { + return nil, fmt.Errorf("xml.Unmarshal: %s", err) + } + + decoder := xml.NewDecoder(bytes.NewReader([]byte(body.Content))) + decoder.TypeFunc = typeFunc // required to decode interface types + + var start *xml.StartElement + + for { + tok, derr := decoder.Token() + if derr != nil { + return nil, fmt.Errorf("decoding body: %s", err) + } + if t, ok := tok.(xml.StartElement); ok { + start = &t + break + } + } + + kind := start.Name.Local + + rtype, ok := typeFunc(kind) + if !ok { + return nil, fmt.Errorf("no vmomi type defined for '%s'", kind) + } + + var val interface{} + if rtype != nil { + val = reflect.New(rtype).Interface() + } + + err = decoder.DecodeElement(val, start) + if err != nil { + return nil, fmt.Errorf("decoding %s: %s", kind, err) + } + + method := &Method{Name: kind, Body: val} + + field := reflect.ValueOf(val).Elem().FieldByName("This") + + method.This = field.Interface().(types.ManagedObjectReference) + + return method, nil +} diff --git a/vendor/github.com/vmware/govmomi/simulator/snapshot.go b/vendor/github.com/vmware/govmomi/simulator/snapshot.go new file mode 100644 index 00000000000..ad98fbf3c42 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/snapshot.go @@ -0,0 +1,68 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type VirtualMachineSnapshot struct { + mo.VirtualMachineSnapshot +} + +func (v *VirtualMachineSnapshot) RemoveSnapshotTask(req *types.RemoveSnapshot_Task) soap.HasFault { + task := CreateTask(v, "removeSnapshot", func(t *Task) (types.AnyType, types.BaseMethodFault) { + Map.Remove(req.This) + + vm := Map.Get(v.Vm).(*VirtualMachine) + + if vm.Snapshot.CurrentSnapshot != nil && *vm.Snapshot.CurrentSnapshot == req.This { + parent := findParentSnapshotInTree(vm.Snapshot.RootSnapshotList, req.This) + vm.Snapshot.CurrentSnapshot = parent + } + + vm.Snapshot.RootSnapshotList = removeSnapshotInTree(vm.Snapshot.RootSnapshotList, req.This, req.RemoveChildren) + + return nil, nil + }) + + return &methods.RemoveSnapshot_TaskBody{ + Res: &types.RemoveSnapshot_TaskResponse{ + Returnval: task.Run(), + }, + } +} + +func (v *VirtualMachineSnapshot) RevertToSnapshotTask(req *types.RevertToSnapshot_Task) soap.HasFault { + task := CreateTask(v, "revertToSnapshot", func(t *Task) (types.AnyType, types.BaseMethodFault) { + vm := Map.Get(v.Vm).(*VirtualMachine) + + ref := v.Reference() + vm.Snapshot.CurrentSnapshot = &ref + + return nil, nil + }) + + return &methods.RevertToSnapshot_TaskBody{ + Res: &types.RevertToSnapshot_TaskResponse{ + Returnval: task.Run(), + }, + } +} diff --git a/vendor/github.com/vmware/govmomi/simulator/task.go b/vendor/github.com/vmware/govmomi/simulator/task.go new file mode 100644 index 00000000000..d6dd5bc415f --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/task.go @@ -0,0 +1,102 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "fmt" + "reflect" + "strings" + "time" + + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/types" +) + +const vTaskSuffix = "_Task" // vmomi suffix +const sTaskSuffix = "Task" // simulator suffix (avoiding golint warning) + +type Task struct { + mo.Task + + Execute func(*Task) (types.AnyType, types.BaseMethodFault) +} + +func NewTask(runner TaskRunner) *Task { + ref := runner.Reference() + name := reflect.TypeOf(runner).Elem().Name() + name = strings.Replace(name, "VM", "Vm", 1) // "VM" for the type to make go-lint happy, but "Vm" for the vmodl ID + return CreateTask(ref, name, runner.Run) +} + +func CreateTask(e mo.Reference, name string, run func(*Task) (types.AnyType, types.BaseMethodFault)) *Task { + ref := e.Reference() + id := name + + if strings.HasSuffix(id, sTaskSuffix) { + id = id[:len(id)-len(sTaskSuffix)] + name = id + vTaskSuffix + } + + task := &Task{ + Execute: run, + } + + Map.Put(task) + + task.Info.Key = task.Self.Value + task.Info.Task = task.Self + task.Info.Name = ucFirst(name) + task.Info.DescriptionId = fmt.Sprintf("%s.%s", ref.Type, id) + task.Info.Entity = &ref + task.Info.EntityName = ref.Value + + task.Info.QueueTime = time.Now() + task.Info.State = types.TaskInfoStateQueued + + return task +} + +type TaskRunner interface { + mo.Reference + + Run(*Task) (types.AnyType, types.BaseMethodFault) +} + +func (t *Task) Run() types.ManagedObjectReference { + now := time.Now() + t.Info.StartTime = &now + + t.Info.State = types.TaskInfoStateRunning + + res, err := t.Execute(t) + + now = time.Now() + t.Info.CompleteTime = &now + + if err != nil { + t.Info.State = types.TaskInfoStateError + t.Info.Error = &types.LocalizedMethodFault{ + Fault: err, + LocalizedMessage: fmt.Sprintf("%T", err), + } + } else { + t.Info.Result = res + t.Info.State = types.TaskInfoStateSuccess + } + + return t.Self +} diff --git a/vendor/github.com/vmware/govmomi/simulator/task_manager.go b/vendor/github.com/vmware/govmomi/simulator/task_manager.go new file mode 100644 index 00000000000..df271082596 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/task_manager.go @@ -0,0 +1,52 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/types" +) + +var recentTaskMax = 200 // the VC limit + +type TaskManager struct { + mo.TaskManager +} + +func NewTaskManager(ref types.ManagedObjectReference) object.Reference { + s := &TaskManager{} + s.Self = ref + Map.AddHandler(s) + return s +} + +func (m *TaskManager) PutObject(obj mo.Reference) { + ref := obj.Reference() + if ref.Type != "Task" { + return + } + + m.RecentTask = append(m.RecentTask, ref) + + if len(m.RecentTask) > recentTaskMax { + m.RecentTask = m.RecentTask[1:] + } +} + +func (m *TaskManager) RemoveObject(_ types.ManagedObjectReference) { +} diff --git a/vendor/github.com/vmware/govmomi/simulator/user_directory.go b/vendor/github.com/vmware/govmomi/simulator/user_directory.go new file mode 100644 index 00000000000..2a2f0a3aabc --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/user_directory.go @@ -0,0 +1,78 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "strings" + + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +var DefaultUserGroup = []*types.UserSearchResult{ + {FullName: "root", Group: true, Principal: "root"}, + {FullName: "root", Group: false, Principal: "root"}, + {FullName: "administrator", Group: false, Principal: "admin"}, +} + +type UserDirectory struct { + mo.UserDirectory + + userGroup []*types.UserSearchResult +} + +func NewUserDirectory(ref types.ManagedObjectReference) object.Reference { + u := &UserDirectory{} + + u.Self = ref + u.userGroup = DefaultUserGroup + + return u +} + +func (u *UserDirectory) RetrieveUserGroups(req *types.RetrieveUserGroups) soap.HasFault { + compare := compareFunc(req.SearchStr, req.ExactMatch) + + var res []types.BaseUserSearchResult + for _, ug := range u.userGroup { + if req.FindUsers && !ug.Group || req.FindGroups && ug.Group { + if compare(ug.Principal) { + res = append(res, ug) + } + } + } + + body := &methods.RetrieveUserGroupsBody{ + Res: &types.RetrieveUserGroupsResponse{ + Returnval: res, + }, + } + + return body +} + +func compareFunc(compared string, exactly bool) func(string) bool { + return func(s string) bool { + if exactly { + return s == compared + } + return strings.Contains(strings.ToLower(s), strings.ToLower(compared)) + } +} diff --git a/vendor/github.com/vmware/govmomi/simulator/view_manager.go b/vendor/github.com/vmware/govmomi/simulator/view_manager.go new file mode 100644 index 00000000000..959f22847b9 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/view_manager.go @@ -0,0 +1,184 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "reflect" + + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type ViewManager struct { + mo.ViewManager + + entities map[string]bool +} + +var entities = []struct { + Type reflect.Type + Container bool +}{ + {reflect.TypeOf((*mo.ManagedEntity)(nil)).Elem(), true}, + {reflect.TypeOf((*mo.Folder)(nil)).Elem(), true}, + {reflect.TypeOf((*mo.StoragePod)(nil)).Elem(), true}, + {reflect.TypeOf((*mo.Datacenter)(nil)).Elem(), true}, + {reflect.TypeOf((*mo.ComputeResource)(nil)).Elem(), true}, + {reflect.TypeOf((*mo.ClusterComputeResource)(nil)).Elem(), true}, + {reflect.TypeOf((*mo.HostSystem)(nil)).Elem(), true}, + {reflect.TypeOf((*mo.ResourcePool)(nil)).Elem(), true}, + {reflect.TypeOf((*mo.VirtualApp)(nil)).Elem(), true}, + {reflect.TypeOf((*mo.VirtualMachine)(nil)).Elem(), false}, + {reflect.TypeOf((*mo.Datastore)(nil)).Elem(), false}, + {reflect.TypeOf((*mo.Network)(nil)).Elem(), false}, + {reflect.TypeOf((*mo.OpaqueNetwork)(nil)).Elem(), false}, + {reflect.TypeOf((*mo.DistributedVirtualPortgroup)(nil)).Elem(), false}, + {reflect.TypeOf((*mo.DistributedVirtualSwitch)(nil)).Elem(), false}, + {reflect.TypeOf((*mo.VmwareDistributedVirtualSwitch)(nil)).Elem(), false}, +} + +func NewViewManager(ref types.ManagedObjectReference) object.Reference { + s := &ViewManager{ + entities: make(map[string]bool), + } + + s.Self = ref + + for _, e := range entities { + s.entities[e.Type.Name()] = e.Container + } + + return s +} + +func destroyView(ref types.ManagedObjectReference) soap.HasFault { + m := Map.ViewManager() + + m.ViewList = RemoveReference(ref, m.ViewList) + + return &methods.DestroyViewBody{ + Res: &types.DestroyViewResponse{}, + } +} + +func (m *ViewManager) CreateContainerView(req *types.CreateContainerView) soap.HasFault { + body := &methods.CreateContainerViewBody{} + + root := Map.Get(req.Container) + if root == nil { + body.Fault_ = Fault("", &types.ManagedObjectNotFound{Obj: req.Container}) + return body + } + + if m.entities[root.Reference().Type] != true { + body.Fault_ = Fault("", &types.InvalidArgument{InvalidProperty: "container"}) + return body + } + + container := &ContainerView{ + mo.ContainerView{ + Container: root.Reference(), + Recursive: req.Recursive, + Type: req.Type, + }, + make(map[string]bool), + } + + for _, ctype := range container.Type { + if _, ok := m.entities[ctype]; !ok { + body.Fault_ = Fault("", &types.InvalidArgument{InvalidProperty: "type"}) + return body + } + + container.types[ctype] = true + + for _, e := range entities { + // Check for embedded types + if f, ok := e.Type.FieldByName(ctype); ok && f.Anonymous { + container.types[e.Type.Name()] = true + } + } + } + + Map.Put(container) + + m.ViewList = append(m.ViewList, container.Reference()) + + body.Res = &types.CreateContainerViewResponse{ + Returnval: container.Self, + } + + container.add(root) + + return body +} + +type ContainerView struct { + mo.ContainerView + + types map[string]bool +} + +func (v *ContainerView) DestroyView(c *types.DestroyView) soap.HasFault { + return destroyView(c.This) +} + +func (v *ContainerView) include(o types.ManagedObjectReference) bool { + if len(v.types) == 0 { + return true + } + + return v.types[o.Type] +} + +func (v *ContainerView) add(root mo.Reference) { + var children []types.ManagedObjectReference + + switch e := root.(type) { + case *mo.Datacenter: + children = []types.ManagedObjectReference{e.VmFolder, e.HostFolder, e.DatastoreFolder, e.NetworkFolder} + case *Folder: + children = e.ChildEntity + case *mo.ComputeResource: + children = e.Host + children = append(children, *e.ResourcePool) + case *ClusterComputeResource: + children = e.Host + children = append(children, *e.ResourcePool) + case *ResourcePool: + children = e.ResourcePool.ResourcePool + children = append(children, e.Vm...) + case *VirtualApp: + children = e.ResourcePool.ResourcePool + children = append(children, e.Vm...) + case *HostSystem: + children = e.Vm + } + + for _, child := range children { + if v.include(child) { + v.View = AddReference(child, v.View) + } + + if v.Recursive { + v.add(Map.Get(child)) + } + } +} diff --git a/vendor/github.com/vmware/govmomi/simulator/virtual_disk_manager.go b/vendor/github.com/vmware/govmomi/simulator/virtual_disk_manager.go new file mode 100644 index 00000000000..ba37e42ed6b --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/virtual_disk_manager.go @@ -0,0 +1,193 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "os" + "strings" + + "github.com/google/uuid" + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type VirtualDiskManager struct { + mo.VirtualDiskManager +} + +func NewVirtualDiskManager(ref types.ManagedObjectReference) object.Reference { + m := &VirtualDiskManager{} + m.Self = ref + return m +} + +func (m *VirtualDiskManager) names(name string) []string { + return []string{ + strings.Replace(name, ".vmdk", "-flat.vmdk", 1), + name, + } +} + +func (m *VirtualDiskManager) createVirtualDisk(req *types.CreateVirtualDisk_Task) types.BaseMethodFault { + fm := Map.FileManager() + + file, fault := fm.resolve(req.Datacenter, req.Name) + if fault != nil { + return fault + } + + for _, name := range m.names(file) { + _, err := os.Stat(name) + if err == nil { + return fm.fault(name, nil, new(types.FileAlreadyExists)) + } + + f, err := os.Create(name) + if err != nil { + return fm.fault(name, err, new(types.CannotCreateFile)) + } + + _ = f.Close() + } + + return nil +} + +func (m *VirtualDiskManager) CreateVirtualDiskTask(req *types.CreateVirtualDisk_Task) soap.HasFault { + task := CreateTask(m, "createVirtualDisk", func(*Task) (types.AnyType, types.BaseMethodFault) { + return nil, m.createVirtualDisk(req) + }) + + return &methods.CreateVirtualDisk_TaskBody{ + Res: &types.CreateVirtualDisk_TaskResponse{ + Returnval: task.Run(), + }, + } +} + +func (m *VirtualDiskManager) DeleteVirtualDiskTask(req *types.DeleteVirtualDisk_Task) soap.HasFault { + task := CreateTask(m, "deleteVirtualDisk", func(*Task) (types.AnyType, types.BaseMethodFault) { + fm := Map.FileManager() + + for _, name := range m.names(req.Name) { + err := fm.deleteDatastoreFile(&types.DeleteDatastoreFile_Task{ + Name: name, + Datacenter: req.Datacenter, + }) + + if err != nil { + return nil, err + } + } + + return nil, nil + }) + + return &methods.DeleteVirtualDisk_TaskBody{ + Res: &types.DeleteVirtualDisk_TaskResponse{ + Returnval: task.Run(), + }, + } +} + +func (m *VirtualDiskManager) MoveVirtualDiskTask(req *types.MoveVirtualDisk_Task) soap.HasFault { + task := CreateTask(m, "moveVirtualDisk", func(*Task) (types.AnyType, types.BaseMethodFault) { + fm := Map.FileManager() + + dest := m.names(req.DestName) + + for i, name := range m.names(req.SourceName) { + err := fm.moveDatastoreFile(&types.MoveDatastoreFile_Task{ + SourceName: name, + SourceDatacenter: req.SourceDatacenter, + DestinationName: dest[i], + DestinationDatacenter: req.DestDatacenter, + Force: req.Force, + }) + + if err != nil { + return nil, err + } + } + + return nil, nil + }) + + return &methods.MoveVirtualDisk_TaskBody{ + Res: &types.MoveVirtualDisk_TaskResponse{ + Returnval: task.Run(), + }, + } +} + +func (m *VirtualDiskManager) CopyVirtualDiskTask(req *types.CopyVirtualDisk_Task) soap.HasFault { + task := CreateTask(m, "copyVirtualDisk", func(*Task) (types.AnyType, types.BaseMethodFault) { + fm := Map.FileManager() + + dest := m.names(req.DestName) + + for i, name := range m.names(req.SourceName) { + err := fm.copyDatastoreFile(&types.CopyDatastoreFile_Task{ + SourceName: name, + SourceDatacenter: req.SourceDatacenter, + DestinationName: dest[i], + DestinationDatacenter: req.DestDatacenter, + Force: req.Force, + }) + + if err != nil { + return nil, err + } + } + + return nil, nil + }) + + return &methods.CopyVirtualDisk_TaskBody{ + Res: &types.CopyVirtualDisk_TaskResponse{ + Returnval: task.Run(), + }, + } +} + +func (m *VirtualDiskManager) QueryVirtualDiskUuid(req *types.QueryVirtualDiskUuid) soap.HasFault { + body := new(methods.QueryVirtualDiskUuidBody) + + fm := Map.FileManager() + + file, fault := fm.resolve(req.Datacenter, req.Name) + if fault != nil { + body.Fault_ = Fault("", fault) + return body + } + + _, err := os.Stat(file) + if err != nil { + fault = fm.fault(file, err, new(types.CannotAccessFile)) + body.Fault_ = Fault("", fault) + return body + } + + body.Res = &types.QueryVirtualDiskUuidResponse{ + Returnval: uuid.NewSHA1(uuid.NameSpaceOID, []byte(file)).String(), + } + + return body +} diff --git a/vendor/github.com/vmware/govmomi/simulator/virtual_machine.go b/vendor/github.com/vmware/govmomi/simulator/virtual_machine.go new file mode 100644 index 00000000000..640a280dc58 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/virtual_machine.go @@ -0,0 +1,885 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 simulator + +import ( + "fmt" + "io" + "log" + "net" + "os" + "path" + "strings" + "sync/atomic" + "time" + + "github.com/google/uuid" + + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/simulator/esx" + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type VirtualMachine struct { + mo.VirtualMachine + + log *log.Logger + out io.Closer + sid int32 +} + +func NewVirtualMachine(parent types.ManagedObjectReference, spec *types.VirtualMachineConfigSpec) (*VirtualMachine, types.BaseMethodFault) { + vm := &VirtualMachine{} + vm.Parent = &parent + + if spec.Name == "" { + return nil, &types.InvalidVmConfig{Property: "configSpec.name"} + } + + if spec.Files == nil || spec.Files.VmPathName == "" { + return nil, &types.InvalidVmConfig{Property: "configSpec.files.vmPathName"} + } + + rspec := types.DefaultResourceConfigSpec() + vm.Config = &types.VirtualMachineConfigInfo{ + ExtraConfig: []types.BaseOptionValue{&types.OptionValue{Key: "govcsim", Value: "TRUE"}}, + Tools: &types.ToolsConfigInfo{}, + MemoryAllocation: &rspec.MemoryAllocation, + CpuAllocation: &rspec.CpuAllocation, + } + vm.Summary.Guest = &types.VirtualMachineGuestSummary{} + vm.Summary.Storage = &types.VirtualMachineStorageSummary{} + vm.Summary.Vm = &vm.Self + + // Append VM Name as the directory name if not specified + if strings.HasSuffix(spec.Files.VmPathName, "]") { // e.g. "[datastore1]" + spec.Files.VmPathName += " " + spec.Name + } + + if !strings.HasSuffix(spec.Files.VmPathName, ".vmx") { + spec.Files.VmPathName = path.Join(spec.Files.VmPathName, spec.Name+".vmx") + } + + dsPath := path.Dir(spec.Files.VmPathName) + + defaults := types.VirtualMachineConfigSpec{ + NumCPUs: 1, + NumCoresPerSocket: 1, + MemoryMB: 32, + Uuid: uuid.New().String(), + Version: "vmx-11", + Files: &types.VirtualMachineFileInfo{ + SnapshotDirectory: dsPath, + SuspendDirectory: dsPath, + LogDirectory: dsPath, + }, + } + + // Add the default devices + defaults.DeviceChange, _ = object.VirtualDeviceList(esx.VirtualDevice).ConfigSpec(types.VirtualDeviceConfigSpecOperationAdd) + + err := vm.configure(&defaults) + if err != nil { + return nil, err + } + + vm.Runtime.PowerState = types.VirtualMachinePowerStatePoweredOff + vm.Runtime.ConnectionState = types.VirtualMachineConnectionStateConnected + vm.Summary.Runtime = vm.Runtime + + vm.Summary.QuickStats.GuestHeartbeatStatus = types.ManagedEntityStatusGray + vm.Summary.OverallStatus = types.ManagedEntityStatusGreen + vm.ConfigStatus = types.ManagedEntityStatusGreen + + return vm, nil +} + +func (vm *VirtualMachine) apply(spec *types.VirtualMachineConfigSpec) { + if spec.Files == nil { + spec.Files = new(types.VirtualMachineFileInfo) + } + + apply := []struct { + src string + dst *string + }{ + {spec.Name, &vm.Name}, + {spec.Name, &vm.Config.Name}, + {spec.Name, &vm.Summary.Config.Name}, + {spec.GuestId, &vm.Config.GuestId}, + {spec.GuestId, &vm.Config.GuestFullName}, + {spec.GuestId, &vm.Summary.Guest.GuestId}, + {spec.GuestId, &vm.Summary.Config.GuestId}, + {spec.GuestId, &vm.Summary.Config.GuestFullName}, + {spec.Uuid, &vm.Config.Uuid}, + {spec.Version, &vm.Config.Version}, + {spec.Files.VmPathName, &vm.Config.Files.VmPathName}, + {spec.Files.VmPathName, &vm.Summary.Config.VmPathName}, + {spec.Files.SnapshotDirectory, &vm.Config.Files.SnapshotDirectory}, + {spec.Files.LogDirectory, &vm.Config.Files.LogDirectory}, + } + + for _, f := range apply { + if f.src != "" { + *f.dst = f.src + } + } + + if spec.MemoryMB != 0 { + vm.Config.Hardware.MemoryMB = int32(spec.MemoryMB) + vm.Summary.Config.MemorySizeMB = vm.Config.Hardware.MemoryMB + } + + if spec.NumCPUs != 0 { + vm.Config.Hardware.NumCPU = spec.NumCPUs + vm.Summary.Config.NumCpu = vm.Config.Hardware.NumCPU + } + + vm.Config.ExtraConfig = append(vm.Config.ExtraConfig, spec.ExtraConfig...) + + vm.Config.Modified = time.Now() + + vm.Summary.Config.Uuid = vm.Config.Uuid +} + +func validateGuestID(id string) types.BaseMethodFault { + for _, x := range GuestID { + if id == string(x) { + return nil + } + } + + return &types.InvalidArgument{InvalidProperty: "configSpec.guestId"} +} + +func (vm *VirtualMachine) configure(spec *types.VirtualMachineConfigSpec) types.BaseMethodFault { + vm.apply(spec) + + if spec.MemoryAllocation != nil { + if err := updateResourceAllocation("memory", spec.MemoryAllocation, vm.Config.MemoryAllocation); err != nil { + return err + } + } + + if spec.CpuAllocation != nil { + if err := updateResourceAllocation("cpu", spec.CpuAllocation, vm.Config.CpuAllocation); err != nil { + return err + } + } + + if spec.GuestId != "" { + if err := validateGuestID(spec.GuestId); err != nil { + return err + } + } + + return vm.configureDevices(spec) +} + +func (vm *VirtualMachine) useDatastore(name string) *Datastore { + host := Map.Get(*vm.Runtime.Host).(*HostSystem) + + ds := Map.FindByName(name, host.Datastore).(*Datastore) + + vm.Datastore = AddReference(ds.Self, vm.Datastore) + + return ds +} + +func (vm *VirtualMachine) setLog(w io.WriteCloser) { + vm.out = w + vm.log = log.New(w, "vmx ", log.Flags()) +} + +func (vm *VirtualMachine) createFile(spec string, name string, register bool) (*os.File, types.BaseMethodFault) { + p, fault := parseDatastorePath(spec) + if fault != nil { + return nil, fault + } + + ds := vm.useDatastore(p.Datastore) + + file := path.Join(ds.Info.GetDatastoreInfo().Url, p.Path) + + if name != "" { + if path.Ext(file) != "" { + file = path.Dir(file) + } + + file = path.Join(file, name) + } + + if register { + f, err := os.Open(file) + if err != nil { + log.Printf("register %s: %s", vm.Reference(), err) + if os.IsNotExist(err) { + return nil, &types.NotFound{} + } + + return nil, &types.InvalidArgument{} + } + + return f, nil + } + + dir := path.Dir(file) + + _ = os.MkdirAll(dir, 0700) + + _, err := os.Stat(file) + if err == nil { + return nil, &types.FileAlreadyExists{ + FileFault: types.FileFault{ + File: file, + }, + } + } + + f, err := os.Create(file) + if err != nil { + return nil, &types.FileFault{ + File: file, + } + } + + return f, nil +} + +func (vm *VirtualMachine) create(spec *types.VirtualMachineConfigSpec, register bool) types.BaseMethodFault { + vm.apply(spec) + + files := []struct { + spec string + name string + use func(w io.WriteCloser) + }{ + {vm.Config.Files.VmPathName, "", nil}, + {vm.Config.Files.VmPathName, fmt.Sprintf("%s.nvram", vm.Name), nil}, + {vm.Config.Files.LogDirectory, "vmware.log", vm.setLog}, + } + + for _, file := range files { + f, err := vm.createFile(file.spec, file.name, register) + if err != nil { + return err + } + + if file.use != nil { + file.use(f) + } else { + _ = f.Close() + } + } + + vm.log.Print("created") + + return vm.configureDevices(spec) +} + +var vmwOUI = net.HardwareAddr([]byte{0x0, 0xc, 0x29}) + +// From http://pubs.vmware.com/vsphere-60/index.jsp?topic=%2Fcom.vmware.vsphere.networking.doc%2FGUID-DC7478FF-DC44-4625-9AD7-38208C56A552.html +// "The host generates generateMAC addresses that consists of the VMware OUI 00:0C:29 and the last three octets in hexadecimal +// format of the virtual machine UUID. The virtual machine UUID is based on a hash calculated by using the UUID of the +// ESXi physical machine and the path to the configuration file (.vmx) of the virtual machine." +func (vm *VirtualMachine) generateMAC() string { + id := uuid.New() // Random is fine for now. + + offset := len(id) - len(vmwOUI) + + mac := append(vmwOUI, id[offset:]...) + + return mac.String() +} + +func (vm *VirtualMachine) configureDevice(devices object.VirtualDeviceList, device types.BaseVirtualDevice) types.BaseMethodFault { + d := device.GetVirtualDevice() + var controller types.BaseVirtualController + + if d.Key < 0 { + // Choose a unique key + if d.Key == -1 { + d.Key = devices.NewKey() + } + + d.Key *= -1 + + for { + if devices.FindByKey(d.Key) == nil { + break + } + d.Key++ + } + } + + label := devices.Name(device) + summary := label + dc := Map.getEntityDatacenter(Map.Get(*vm.Parent).(mo.Entity)) + dm := Map.VirtualDiskManager() + + switch x := device.(type) { + case types.BaseVirtualEthernetCard: + controller = devices.PickController((*types.VirtualPCIController)(nil)) + var net types.ManagedObjectReference + + switch b := d.Backing.(type) { + case *types.VirtualEthernetCardNetworkBackingInfo: + summary = b.DeviceName + net = Map.FindByName(b.DeviceName, dc.Network).Reference() + b.Network = &net + case *types.VirtualEthernetCardDistributedVirtualPortBackingInfo: + summary = fmt.Sprintf("DVSwitch: %s", b.Port.SwitchUuid) + net.Type = "DistributedVirtualPortgroup" + net.Value = b.Port.PortgroupKey + } + + vm.Network = append(vm.Network, net) + + c := x.GetVirtualEthernetCard() + if c.MacAddress == "" { + c.MacAddress = vm.generateMAC() + } + case *types.VirtualDisk: + switch b := d.Backing.(type) { + case types.BaseVirtualDeviceFileBackingInfo: + info := b.GetVirtualDeviceFileBackingInfo() + + if info.FileName == "" { + filename, err := vm.genVmdkPath() + if err != nil { + return err + } + + info.FileName = filename + } + + err := dm.createVirtualDisk(&types.CreateVirtualDisk_Task{ + Datacenter: &dc.Self, + Name: info.FileName, + }) + if err != nil { + return err + } + + p, _ := parseDatastorePath(info.FileName) + + info.Datastore = &types.ManagedObjectReference{ + Type: "Datastore", + Value: p.Datastore, + } + } + } + + if d.UnitNumber == nil && controller != nil { + devices.AssignController(device, controller) + } + + if d.DeviceInfo == nil { + d.DeviceInfo = &types.Description{ + Label: label, + Summary: summary, + } + } + + return nil +} + +func removeDevice(devices object.VirtualDeviceList, device types.BaseVirtualDevice) object.VirtualDeviceList { + var result object.VirtualDeviceList + + for i, d := range devices { + if d.GetVirtualDevice().Key == device.GetVirtualDevice().Key { + result = append(result, devices[i+1:]...) + break + } + + result = append(result, d) + } + + return result +} + +func (vm *VirtualMachine) genVmdkPath() (string, types.BaseMethodFault) { + vmdir := path.Dir(vm.Config.Files.VmPathName) + + index := 0 + for { + var filename string + if index == 0 { + filename = fmt.Sprintf("%s.vmdk", vm.Config.Name) + } else { + filename = fmt.Sprintf("%s_%d.vmdk", vm.Config.Name, index) + } + + f, err := vm.createFile(vmdir, filename, false) + if err != nil { + switch err.(type) { + case *types.FileAlreadyExists: + index++ + continue + default: + return "", err + } + } + + _ = f.Close() + _ = os.Remove(f.Name()) + + return path.Join(vmdir, filename), nil + } +} + +func (vm *VirtualMachine) configureDevices(spec *types.VirtualMachineConfigSpec) types.BaseMethodFault { + devices := object.VirtualDeviceList(vm.Config.Hardware.Device) + + for i, change := range spec.DeviceChange { + dspec := change.GetVirtualDeviceConfigSpec() + device := dspec.Device.GetVirtualDevice() + invalid := &types.InvalidDeviceSpec{DeviceIndex: int32(i)} + + switch dspec.Operation { + case types.VirtualDeviceConfigSpecOperationAdd: + if devices.FindByKey(device.Key) != nil { + if vm.Self.Value != "" { // moid isn't set until CreateVM is done + return invalid + } + + // In this case, the CreateVM() spec included one of the default devices + devices = removeDevice(devices, device) + } + + err := vm.configureDevice(devices, dspec.Device) + if err != nil { + return err + } + + devices = append(devices, dspec.Device) + case types.VirtualDeviceConfigSpecOperationRemove: + devices = removeDevice(devices, dspec.Device) + } + } + + vm.Config.Hardware.Device = []types.BaseVirtualDevice(devices) + + return nil +} + +type powerVMTask struct { + *VirtualMachine + + state types.VirtualMachinePowerState +} + +func (c *powerVMTask) Run(task *Task) (types.AnyType, types.BaseMethodFault) { + c.log.Printf("running power task: requesting %s, existing %s", + c.state, c.VirtualMachine.Runtime.PowerState) + + if c.VirtualMachine.Runtime.PowerState == c.state { + return nil, &types.InvalidPowerState{ + RequestedState: c.state, + ExistingState: c.VirtualMachine.Runtime.PowerState, + } + } + + c.VirtualMachine.Runtime.PowerState = c.state + c.VirtualMachine.Summary.Runtime.PowerState = c.state + + bt := &c.VirtualMachine.Summary.Runtime.BootTime + if c.state == types.VirtualMachinePowerStatePoweredOn { + now := time.Now() + *bt = &now + } else { + *bt = nil + } + + return nil, nil +} + +func (vm *VirtualMachine) PowerOnVMTask(c *types.PowerOnVM_Task) soap.HasFault { + runner := &powerVMTask{vm, types.VirtualMachinePowerStatePoweredOn} + task := CreateTask(runner.Reference(), "powerOn", runner.Run) + + return &methods.PowerOnVM_TaskBody{ + Res: &types.PowerOnVM_TaskResponse{ + Returnval: task.Run(), + }, + } +} + +func (vm *VirtualMachine) PowerOffVMTask(c *types.PowerOffVM_Task) soap.HasFault { + runner := &powerVMTask{vm, types.VirtualMachinePowerStatePoweredOff} + task := CreateTask(runner.Reference(), "powerOff", runner.Run) + + return &methods.PowerOffVM_TaskBody{ + Res: &types.PowerOffVM_TaskResponse{ + Returnval: task.Run(), + }, + } +} + +func (vm *VirtualMachine) ReconfigVMTask(req *types.ReconfigVM_Task) soap.HasFault { + task := CreateTask(vm, "reconfigVm", func(t *Task) (types.AnyType, types.BaseMethodFault) { + err := vm.configure(&req.Spec) + if err != nil { + return nil, err + } + + return nil, nil + }) + + return &methods.ReconfigVM_TaskBody{ + Res: &types.ReconfigVM_TaskResponse{ + Returnval: task.Run(), + }, + } +} + +func (vm *VirtualMachine) DestroyTask(req *types.Destroy_Task) soap.HasFault { + task := CreateTask(vm, "destroy", func(t *Task) (types.AnyType, types.BaseMethodFault) { + r := vm.UnregisterVM(&types.UnregisterVM{ + This: req.This, + }) + + if r.Fault() != nil { + return nil, r.Fault().VimFault().(types.BaseMethodFault) + } + + // Delete VM files from the datastore (ignoring result for now) + m := Map.FileManager() + dc := Map.getEntityDatacenter(vm).Reference() + + _ = m.DeleteDatastoreFileTask(&types.DeleteDatastoreFile_Task{ + This: m.Reference(), + Name: vm.Config.Files.LogDirectory, + Datacenter: &dc, + }) + + return nil, nil + }) + + return &methods.Destroy_TaskBody{ + Res: &types.Destroy_TaskResponse{ + Returnval: task.Run(), + }, + } +} + +func (vm *VirtualMachine) UnregisterVM(c *types.UnregisterVM) soap.HasFault { + r := &methods.UnregisterVMBody{} + + if vm.Runtime.PowerState == types.VirtualMachinePowerStatePoweredOn { + r.Fault_ = Fault("", &types.InvalidPowerState{ + RequestedState: types.VirtualMachinePowerStatePoweredOff, + ExistingState: vm.Runtime.PowerState, + }) + + return r + } + + _ = vm.out.Close() // Close log fd + + Map.getEntityParent(vm, "Folder").(*Folder).removeChild(c.This) + + host := Map.Get(*vm.Runtime.Host).(*HostSystem) + host.Vm = RemoveReference(vm.Self, host.Vm) + + switch pool := Map.Get(*vm.ResourcePool).(type) { + case *ResourcePool: + pool.Vm = RemoveReference(vm.Self, pool.Vm) + case *VirtualApp: + pool.Vm = RemoveReference(vm.Self, pool.Vm) + } + + for i := range vm.Datastore { + ds := Map.Get(vm.Datastore[i]).(*Datastore) + ds.Vm = RemoveReference(vm.Self, ds.Vm) + } + + r.Res = new(types.UnregisterVMResponse) + + return r +} + +func (vm *VirtualMachine) CloneVMTask(req *types.CloneVM_Task) soap.HasFault { + task := CreateTask(vm, "cloneVm", func(t *Task) (types.AnyType, types.BaseMethodFault) { + folder := Map.Get(req.Folder).(*Folder) + + config := types.VirtualMachineConfigSpec{ + Name: req.Name, + GuestId: vm.Config.GuestId, + Files: &types.VirtualMachineFileInfo{ + VmPathName: strings.Replace(vm.Config.Files.VmPathName, vm.Name, req.Name, -1), + }, + } + + res := folder.CreateVMTask(&types.CreateVM_Task{ + This: folder.Self, + Config: config, + Pool: *vm.ResourcePool, + }) + + ctask := Map.Get(res.(*methods.CreateVM_TaskBody).Res.Returnval).(*Task) + if ctask.Info.Error != nil { + return nil, ctask.Info.Error.Fault + } + + return ctask.Info.Result.(types.ManagedObjectReference), nil + }) + + return &methods.CloneVM_TaskBody{ + Res: &types.CloneVM_TaskResponse{ + Returnval: task.Run(), + }, + } +} + +func (vm *VirtualMachine) RelocateVMTask(req *types.RelocateVM_Task) soap.HasFault { + task := CreateTask(vm, "relocateVm", func(t *Task) (types.AnyType, types.BaseMethodFault) { + if ref := req.Spec.Datastore; ref != nil { + ds := Map.Get(*ref).(*Datastore) + ds.Vm = RemoveReference(*ref, ds.Vm) + + vm.Datastore = []types.ManagedObjectReference{*ref} + + // TODO: migrate vm.Config.Files (and vm.Summary.Config.VmPathName) + } + + if ref := req.Spec.Pool; ref != nil { + pool := Map.Get(*ref).(*ResourcePool) + pool.Vm = RemoveReference(*ref, pool.Vm) + + vm.ResourcePool = ref + } + + if ref := req.Spec.Host; ref != nil { + host := Map.Get(*ref).(*HostSystem) + host.Vm = RemoveReference(*ref, host.Vm) + + vm.Runtime.Host = ref + } + + return nil, nil + }) + + return &methods.RelocateVM_TaskBody{ + Res: &types.RelocateVM_TaskResponse{ + Returnval: task.Run(), + }, + } +} + +func (vm *VirtualMachine) CreateSnapshotTask(req *types.CreateSnapshot_Task) soap.HasFault { + task := CreateTask(vm, "createSnapshot", func(t *Task) (types.AnyType, types.BaseMethodFault) { + if vm.Snapshot == nil { + vm.Snapshot = &types.VirtualMachineSnapshotInfo{} + } + + snapshot := &VirtualMachineSnapshot{} + snapshot.Vm = vm.Reference() + snapshot.Config = *vm.Config + + Map.Put(snapshot) + + treeItem := types.VirtualMachineSnapshotTree{ + Snapshot: snapshot.Self, + Vm: snapshot.Vm, + Name: req.Name, + Description: req.Description, + Id: atomic.AddInt32(&vm.sid, 1), + CreateTime: time.Now(), + State: vm.Runtime.PowerState, + Quiesced: req.Quiesce, + BackupManifest: "", + ReplaySupported: types.NewBool(false), + } + + cur := vm.Snapshot.CurrentSnapshot + if cur != nil { + parent := Map.Get(*cur).(*VirtualMachineSnapshot) + parent.ChildSnapshot = append(parent.ChildSnapshot, snapshot.Self) + + ss := findSnapshotInTree(vm.Snapshot.RootSnapshotList, *cur) + ss.ChildSnapshotList = append(ss.ChildSnapshotList, treeItem) + } else { + vm.Snapshot.RootSnapshotList = append(vm.Snapshot.RootSnapshotList, treeItem) + } + + vm.Snapshot.CurrentSnapshot = &snapshot.Self + + return nil, nil + }) + + return &methods.CreateSnapshot_TaskBody{ + Res: &types.CreateSnapshot_TaskResponse{ + Returnval: task.Run(), + }, + } +} + +func (vm *VirtualMachine) RevertToCurrentSnapshotTask(req *types.RevertToCurrentSnapshot_Task) soap.HasFault { + body := &methods.RevertToCurrentSnapshot_TaskBody{} + + if vm.Snapshot == nil || vm.Snapshot.CurrentSnapshot == nil { + body.Fault_ = Fault("snapshot not found", &types.NotFound{}) + + return body + } + + task := CreateTask(vm, "revertSnapshot", func(t *Task) (types.AnyType, types.BaseMethodFault) { + return nil, nil + }) + + body.Res = &types.RevertToCurrentSnapshot_TaskResponse{ + Returnval: task.Run(), + } + + return body +} + +func (vm *VirtualMachine) RemoveAllSnapshotsTask(req *types.RemoveAllSnapshots_Task) soap.HasFault { + task := CreateTask(vm, "RemoveAllSnapshots", func(t *Task) (types.AnyType, types.BaseMethodFault) { + if vm.Snapshot == nil { + return nil, nil + } + + refs := allSnapshotsInTree(vm.Snapshot.RootSnapshotList) + + vm.Snapshot.CurrentSnapshot = nil + vm.Snapshot.RootSnapshotList = nil + + for _, ref := range refs { + Map.Remove(ref) + } + + return nil, nil + }) + + return &methods.RemoveAllSnapshots_TaskBody{ + Res: &types.RemoveAllSnapshots_TaskResponse{ + Returnval: task.Run(), + }, + } +} + +func (vm *VirtualMachine) ShutdownGuest(c *types.ShutdownGuest) soap.HasFault { + r := &methods.ShutdownGuestBody{} + // should be poweron + if vm.Runtime.PowerState == types.VirtualMachinePowerStatePoweredOff { + r.Fault_ = Fault("", &types.InvalidPowerState{ + RequestedState: types.VirtualMachinePowerStatePoweredOn, + ExistingState: vm.Runtime.PowerState, + }) + + return r + } + // change state + vm.Runtime.PowerState = types.VirtualMachinePowerStatePoweredOff + vm.Summary.Runtime.PowerState = types.VirtualMachinePowerStatePoweredOff + + r.Res = new(types.ShutdownGuestResponse) + + return r +} + +func findSnapshotInTree(tree []types.VirtualMachineSnapshotTree, ref types.ManagedObjectReference) *types.VirtualMachineSnapshotTree { + if tree == nil { + return nil + } + + for i, ss := range tree { + if ss.Snapshot == ref { + return &tree[i] + } + + target := findSnapshotInTree(ss.ChildSnapshotList, ref) + if target != nil { + return target + } + } + + return nil +} + +func findParentSnapshot(tree types.VirtualMachineSnapshotTree, ref types.ManagedObjectReference) *types.ManagedObjectReference { + for _, ss := range tree.ChildSnapshotList { + if ss.Snapshot == ref { + return &tree.Snapshot + } + + res := findParentSnapshot(ss, ref) + if res != nil { + return res + } + } + + return nil +} + +func findParentSnapshotInTree(tree []types.VirtualMachineSnapshotTree, ref types.ManagedObjectReference) *types.ManagedObjectReference { + if tree == nil { + return nil + } + + for _, ss := range tree { + res := findParentSnapshot(ss, ref) + if res != nil { + return res + } + } + + return nil +} + +func removeSnapshotInTree(tree []types.VirtualMachineSnapshotTree, ref types.ManagedObjectReference, removeChildren bool) []types.VirtualMachineSnapshotTree { + if tree == nil { + return tree + } + + var result []types.VirtualMachineSnapshotTree + + for _, ss := range tree { + if ss.Snapshot == ref { + if !removeChildren { + result = append(result, ss.ChildSnapshotList...) + } + } else { + ss.ChildSnapshotList = removeSnapshotInTree(ss.ChildSnapshotList, ref, removeChildren) + result = append(result, ss) + } + } + + return result +} + +func allSnapshotsInTree(tree []types.VirtualMachineSnapshotTree) []types.ManagedObjectReference { + var result []types.ManagedObjectReference + + if tree == nil { + return result + } + + for _, ss := range tree { + result = append(result, ss.Snapshot) + result = append(result, allSnapshotsInTree(ss.ChildSnapshotList)...) + } + + return result +} diff --git a/vendor/github.com/vmware/govmomi/simulator/vpx/BUILD b/vendor/github.com/vmware/govmomi/simulator/vpx/BUILD new file mode 100644 index 00000000000..86abe7b5b42 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/vpx/BUILD @@ -0,0 +1,31 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "doc.go", + "root_folder.go", + "service_content.go", + "setting.go", + ], + importpath = "github.com/vmware/govmomi/simulator/vpx", + visibility = ["//visibility:public"], + deps = [ + "//vendor/github.com/vmware/govmomi/vim25/mo:go_default_library", + "//vendor/github.com/vmware/govmomi/vim25/types:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/vendor/github.com/vmware/govmomi/simulator/vpx/doc.go b/vendor/github.com/vmware/govmomi/simulator/vpx/doc.go new file mode 100644 index 00000000000..1765887029a --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/vpx/doc.go @@ -0,0 +1,20 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 vpx contains SOAP responses from a vCenter server, captured using `govc ... -dump`. +*/ +package vpx diff --git a/vendor/github.com/vmware/govmomi/simulator/vpx/root_folder.go b/vendor/github.com/vmware/govmomi/simulator/vpx/root_folder.go new file mode 100644 index 00000000000..a1cce0d8d94 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/vpx/root_folder.go @@ -0,0 +1,64 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 vpx + +import ( + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/types" +) + +var RootFolder = mo.Folder{ + ManagedEntity: mo.ManagedEntity{ + ExtensibleManagedObject: mo.ExtensibleManagedObject{ + Self: types.ManagedObjectReference{Type: "Folder", Value: "group-d1"}, + Value: nil, + AvailableField: nil, + }, + Parent: (*types.ManagedObjectReference)(nil), + CustomValue: nil, + OverallStatus: "green", + ConfigStatus: "green", + ConfigIssue: nil, + EffectiveRole: []int32{-1}, + Permission: []types.Permission{ + { + DynamicData: types.DynamicData{}, + Entity: &types.ManagedObjectReference{Type: "Folder", Value: "group-d1"}, + Principal: "VSPHERE.LOCAL\\Administrator", + Group: false, + RoleId: -1, + Propagate: true, + }, + { + DynamicData: types.DynamicData{}, + Entity: &types.ManagedObjectReference{Type: "Folder", Value: "group-d1"}, + Principal: "VSPHERE.LOCAL\\Administrators", + Group: true, + RoleId: -1, + Propagate: true, + }, + }, + Name: "Datacenters", + DisabledMethod: nil, + RecentTask: nil, + DeclaredAlarmState: nil, + AlarmActionsEnabled: (*bool)(nil), + Tag: nil, + }, + ChildType: []string{"Folder", "Datacenter"}, + ChildEntity: nil, +} diff --git a/vendor/github.com/vmware/govmomi/simulator/vpx/service_content.go b/vendor/github.com/vmware/govmomi/simulator/vpx/service_content.go new file mode 100644 index 00000000000..90b93cc147e --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/vpx/service_content.go @@ -0,0 +1,86 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 vpx + +import "github.com/vmware/govmomi/vim25/types" + +// ServiceContent is the default template for the ServiceInstance content property. +// Capture method: +// govc object.collect -s -dump - content +var ServiceContent = types.ServiceContent{ + RootFolder: types.ManagedObjectReference{Type: "Folder", Value: "group-d1"}, + PropertyCollector: types.ManagedObjectReference{Type: "PropertyCollector", Value: "propertyCollector"}, + ViewManager: &types.ManagedObjectReference{Type: "ViewManager", Value: "ViewManager"}, + About: types.AboutInfo{ + Name: "VMware vCenter Server", + FullName: "VMware vCenter Server 6.5.0 build-5973321", + Vendor: "VMware, Inc.", + Version: "6.5.0", + Build: "5973321", + LocaleVersion: "INTL", + LocaleBuild: "000", + OsType: "linux-x64", + ProductLineId: "vpx", + ApiType: "VirtualCenter", + ApiVersion: "6.5", + InstanceUuid: "dbed6e0c-bd88-4ef6-b594-21283e1c677f", + LicenseProductName: "VMware VirtualCenter Server", + LicenseProductVersion: "6.0", + }, + Setting: &types.ManagedObjectReference{Type: "OptionManager", Value: "VpxSettings"}, + UserDirectory: &types.ManagedObjectReference{Type: "UserDirectory", Value: "UserDirectory"}, + SessionManager: &types.ManagedObjectReference{Type: "SessionManager", Value: "SessionManager"}, + AuthorizationManager: &types.ManagedObjectReference{Type: "AuthorizationManager", Value: "AuthorizationManager"}, + ServiceManager: &types.ManagedObjectReference{Type: "ServiceManager", Value: "ServiceMgr"}, + PerfManager: &types.ManagedObjectReference{Type: "PerformanceManager", Value: "PerfMgr"}, + ScheduledTaskManager: &types.ManagedObjectReference{Type: "ScheduledTaskManager", Value: "ScheduledTaskManager"}, + AlarmManager: &types.ManagedObjectReference{Type: "AlarmManager", Value: "AlarmManager"}, + EventManager: &types.ManagedObjectReference{Type: "EventManager", Value: "EventManager"}, + TaskManager: &types.ManagedObjectReference{Type: "TaskManager", Value: "TaskManager"}, + ExtensionManager: &types.ManagedObjectReference{Type: "ExtensionManager", Value: "ExtensionManager"}, + CustomizationSpecManager: &types.ManagedObjectReference{Type: "CustomizationSpecManager", Value: "CustomizationSpecManager"}, + CustomFieldsManager: &types.ManagedObjectReference{Type: "CustomFieldsManager", Value: "CustomFieldsManager"}, + AccountManager: (*types.ManagedObjectReference)(nil), + DiagnosticManager: &types.ManagedObjectReference{Type: "DiagnosticManager", Value: "DiagMgr"}, + LicenseManager: &types.ManagedObjectReference{Type: "LicenseManager", Value: "LicenseManager"}, + SearchIndex: &types.ManagedObjectReference{Type: "SearchIndex", Value: "SearchIndex"}, + FileManager: &types.ManagedObjectReference{Type: "FileManager", Value: "FileManager"}, + DatastoreNamespaceManager: &types.ManagedObjectReference{Type: "DatastoreNamespaceManager", Value: "DatastoreNamespaceManager"}, + VirtualDiskManager: &types.ManagedObjectReference{Type: "VirtualDiskManager", Value: "virtualDiskManager"}, + VirtualizationManager: (*types.ManagedObjectReference)(nil), + SnmpSystem: &types.ManagedObjectReference{Type: "HostSnmpSystem", Value: "SnmpSystem"}, + VmProvisioningChecker: &types.ManagedObjectReference{Type: "VirtualMachineProvisioningChecker", Value: "ProvChecker"}, + VmCompatibilityChecker: &types.ManagedObjectReference{Type: "VirtualMachineCompatibilityChecker", Value: "CompatChecker"}, + OvfManager: &types.ManagedObjectReference{Type: "OvfManager", Value: "OvfManager"}, + IpPoolManager: &types.ManagedObjectReference{Type: "IpPoolManager", Value: "IpPoolManager"}, + DvSwitchManager: &types.ManagedObjectReference{Type: "DistributedVirtualSwitchManager", Value: "DVSManager"}, + HostProfileManager: &types.ManagedObjectReference{Type: "HostProfileManager", Value: "HostProfileManager"}, + ClusterProfileManager: &types.ManagedObjectReference{Type: "ClusterProfileManager", Value: "ClusterProfileManager"}, + ComplianceManager: &types.ManagedObjectReference{Type: "ProfileComplianceManager", Value: "MoComplianceManager"}, + LocalizationManager: &types.ManagedObjectReference{Type: "LocalizationManager", Value: "LocalizationManager"}, + StorageResourceManager: &types.ManagedObjectReference{Type: "StorageResourceManager", Value: "StorageResourceManager"}, + GuestOperationsManager: &types.ManagedObjectReference{Type: "GuestOperationsManager", Value: "guestOperationsManager"}, + OverheadMemoryManager: &types.ManagedObjectReference{Type: "OverheadMemoryManager", Value: "OverheadMemoryManager"}, + CertificateManager: &types.ManagedObjectReference{Type: "CertificateManager", Value: "certificateManager"}, + IoFilterManager: &types.ManagedObjectReference{Type: "IoFilterManager", Value: "IoFilterManager"}, + VStorageObjectManager: &types.ManagedObjectReference{Type: "VcenterVStorageObjectManager", Value: "VStorageObjectManager"}, + HostSpecManager: &types.ManagedObjectReference{Type: "HostSpecificationManager", Value: "HostSpecificationManager"}, + CryptoManager: &types.ManagedObjectReference{Type: "CryptoManagerKmip", Value: "CryptoManager"}, + HealthUpdateManager: &types.ManagedObjectReference{Type: "HealthUpdateManager", Value: "HealthUpdateManager"}, + FailoverClusterConfigurator: &types.ManagedObjectReference{Type: "FailoverClusterConfigurator", Value: "FailoverClusterConfigurator"}, + FailoverClusterManager: &types.ManagedObjectReference{Type: "FailoverClusterManager", Value: "FailoverClusterManager"}, +} diff --git a/vendor/github.com/vmware/govmomi/simulator/vpx/setting.go b/vendor/github.com/vmware/govmomi/simulator/vpx/setting.go new file mode 100644 index 00000000000..dfbb28b7ab4 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/simulator/vpx/setting.go @@ -0,0 +1,60 @@ +/* +Copyright (c) 2017 VMware, Inc. All Rights Reserved. + +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 vpx + +import "github.com/vmware/govmomi/vim25/types" + +// Setting is captured from VC's ServiceContent.OptionManager.setting +var Setting = []types.BaseOptionValue{ + // This list is currently pruned to include sso options only with sso.enabled set to false + &types.OptionValue{ + Key: "config.vpxd.sso.sts.uri", + Value: "https://127.0.0.1/sts/STSService/vsphere.local", + }, + &types.OptionValue{ + Key: "config.vpxd.sso.solutionUser.privateKey", + Value: "/etc/vmware-vpx/ssl/vcsoluser.key", + }, + &types.OptionValue{ + Key: "config.vpxd.sso.solutionUser.name", + Value: "vpxd-b643d01c-928f-469b-96a5-d571d762a78e@vsphere.local", + }, + &types.OptionValue{ + Key: "config.vpxd.sso.solutionUser.certificate", + Value: "/etc/vmware-vpx/ssl/vcsoluser.crt", + }, + &types.OptionValue{ + Key: "config.vpxd.sso.groupcheck.uri", + Value: "https://127.0.0.1/sso-adminserver/sdk/vsphere.local", + }, + &types.OptionValue{ + Key: "config.vpxd.sso.enabled", + Value: "false", + }, + &types.OptionValue{ + Key: "config.vpxd.sso.default.isGroup", + Value: "false", + }, + &types.OptionValue{ + Key: "config.vpxd.sso.default.admin", + Value: "Administrator@vsphere.local", + }, + &types.OptionValue{ + Key: "config.vpxd.sso.admin.uri", + Value: "https://127.0.0.1/sso-adminserver/sdk/vsphere.local", + }, +} diff --git a/vendor/github.com/vmware/govmomi/vim25/methods/BUILD b/vendor/github.com/vmware/govmomi/vim25/methods/BUILD index 0f2bb367b78..c8e9b028a19 100644 --- a/vendor/github.com/vmware/govmomi/vim25/methods/BUILD +++ b/vendor/github.com/vmware/govmomi/vim25/methods/BUILD @@ -3,7 +3,6 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = [ - "internal.go", "methods.go", "service_content.go", ], diff --git a/vendor/github.com/vmware/govmomi/vim25/methods/internal.go b/vendor/github.com/vmware/govmomi/vim25/methods/internal.go deleted file mode 100644 index a79adf3a874..00000000000 --- a/vendor/github.com/vmware/govmomi/vim25/methods/internal.go +++ /dev/null @@ -1,124 +0,0 @@ -/* -Copyright (c) 2014-2015 VMware, Inc. All Rights Reserved. - -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 methods - -import ( - "context" - - "github.com/vmware/govmomi/vim25/soap" - "github.com/vmware/govmomi/vim25/types" -) - -type RetrieveDynamicTypeManagerBody struct { - Req *types.RetrieveDynamicTypeManager `xml:"urn:vim25 RetrieveDynamicTypeManager"` - Res *types.RetrieveDynamicTypeManagerResponse `xml:"urn:vim25 RetrieveDynamicTypeManagerResponse"` - Fault_ *soap.Fault -} - -func (b *RetrieveDynamicTypeManagerBody) Fault() *soap.Fault { return b.Fault_ } - -func RetrieveDynamicTypeManager(ctx context.Context, r soap.RoundTripper, req *types.RetrieveDynamicTypeManager) (*types.RetrieveDynamicTypeManagerResponse, error) { - var reqBody, resBody RetrieveDynamicTypeManagerBody - - reqBody.Req = req - - if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { - return nil, err - } - - return resBody.Res, nil -} - -type RetrieveManagedMethodExecuterBody struct { - Req *types.RetrieveManagedMethodExecuter `xml:"urn:vim25 RetrieveManagedMethodExecuter"` - Res *types.RetrieveManagedMethodExecuterResponse `xml:"urn:vim25 RetrieveManagedMethodExecuterResponse"` - Fault_ *soap.Fault -} - -func (b *RetrieveManagedMethodExecuterBody) Fault() *soap.Fault { return b.Fault_ } - -func RetrieveManagedMethodExecuter(ctx context.Context, r soap.RoundTripper, req *types.RetrieveManagedMethodExecuter) (*types.RetrieveManagedMethodExecuterResponse, error) { - var reqBody, resBody RetrieveManagedMethodExecuterBody - - reqBody.Req = req - - if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { - return nil, err - } - - return resBody.Res, nil -} - -type DynamicTypeMgrQueryMoInstancesBody struct { - Req *types.DynamicTypeMgrQueryMoInstances `xml:"urn:vim25 DynamicTypeMgrQueryMoInstances"` - Res *types.DynamicTypeMgrQueryMoInstancesResponse `xml:"urn:vim25 DynamicTypeMgrQueryMoInstancesResponse"` - Fault_ *soap.Fault -} - -func (b *DynamicTypeMgrQueryMoInstancesBody) Fault() *soap.Fault { return b.Fault_ } - -func DynamicTypeMgrQueryMoInstances(ctx context.Context, r soap.RoundTripper, req *types.DynamicTypeMgrQueryMoInstances) (*types.DynamicTypeMgrQueryMoInstancesResponse, error) { - var reqBody, resBody DynamicTypeMgrQueryMoInstancesBody - - reqBody.Req = req - - if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { - return nil, err - } - - return resBody.Res, nil -} - -type DynamicTypeMgrQueryTypeInfoBody struct { - Req *types.DynamicTypeMgrQueryTypeInfo `xml:"urn:vim25 DynamicTypeMgrQueryTypeInfo"` - Res *types.DynamicTypeMgrQueryTypeInfoResponse `xml:"urn:vim25 DynamicTypeMgrQueryTypeInfoResponse"` - Fault_ *soap.Fault -} - -func (b *DynamicTypeMgrQueryTypeInfoBody) Fault() *soap.Fault { return b.Fault_ } - -func DynamicTypeMgrQueryTypeInfo(ctx context.Context, r soap.RoundTripper, req *types.DynamicTypeMgrQueryTypeInfo) (*types.DynamicTypeMgrQueryTypeInfoResponse, error) { - var reqBody, resBody DynamicTypeMgrQueryTypeInfoBody - - reqBody.Req = req - - if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { - return nil, err - } - - return resBody.Res, nil -} - -type ExecuteSoapBody struct { - Req *types.ExecuteSoap `xml:"urn:vim25 ExecuteSoap"` - Res *types.ExecuteSoapResponse `xml:"urn:vim25 ExecuteSoapResponse"` - Fault_ *soap.Fault -} - -func (b *ExecuteSoapBody) Fault() *soap.Fault { return b.Fault_ } - -func ExecuteSoap(ctx context.Context, r soap.RoundTripper, req *types.ExecuteSoap) (*types.ExecuteSoapResponse, error) { - var reqBody, resBody ExecuteSoapBody - - reqBody.Req = req - - if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { - return nil, err - } - - return resBody.Res, nil -} diff --git a/vendor/github.com/vmware/govmomi/vim25/soap/client.go b/vendor/github.com/vmware/govmomi/vim25/soap/client.go index 9ac3cc4d6d9..4c05a6c6297 100644 --- a/vendor/github.com/vmware/govmomi/vim25/soap/client.go +++ b/vendor/github.com/vmware/govmomi/vim25/soap/client.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2014-2015 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2017 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -60,6 +60,7 @@ const ( type header struct { Cookie string `xml:"vcSessionCookie,omitempty"` + ID string `xml:"operationID,omitempty"` } type Client struct { @@ -78,7 +79,7 @@ type Client struct { Version string // Vim version UserAgent string - header *header + cookie string } var schemeMatch = regexp.MustCompile(`^\w+://`) @@ -168,10 +169,7 @@ func (c *Client) NewServiceClient(path string, namespace string) *Client { // Set SOAP Header cookie for _, cookie := range client.Jar.Cookies(u) { if cookie.Name == "vmware_soap_session" { - client.header = &header{ - Cookie: cookie.Value, - } - + client.cookie = cookie.Value break } } @@ -433,7 +431,15 @@ func (c *Client) RoundTrip(ctx context.Context, reqBody, resBody HasFault) error reqEnv := Envelope{Body: reqBody} resEnv := Envelope{Body: resBody} - reqEnv.Header = c.header + h := &header{ + Cookie: c.cookie, + } + + if id, ok := ctx.Value(types.ID{}).(string); ok { + h.ID = id + } + + reqEnv.Header = h // Create debugging context for this round trip d := c.d.newRoundTrip() @@ -614,6 +620,7 @@ type Download struct { Headers map[string]string Ticket *http.Cookie Progress progress.Sinker + Writer io.Writer } var DefaultDownload = Download{ @@ -655,7 +662,46 @@ func (c *Client) Download(u *url.URL, param *Download) (io.ReadCloser, int64, er return nil, 0, err } - return res.Body, res.ContentLength, nil + r := res.Body + + return r, res.ContentLength, nil +} + +func (c *Client) WriteFile(file string, src io.Reader, size int64, s progress.Sinker, w io.Writer) error { + var err error + + r := src + + fh, err := os.Create(file) + if err != nil { + return err + } + + if s != nil { + pr := progress.NewReader(s, src, size) + src = pr + + // Mark progress reader as done when returning from this function. + defer func() { + pr.Done(err) + }() + } + + if w == nil { + w = fh + } else { + w = io.MultiWriter(w, fh) + } + + _, err = io.Copy(w, r) + + cerr := fh.Close() + + if err == nil { + err = cerr + } + + return err } // DownloadFile GETs the given URL to a local file @@ -669,37 +715,6 @@ func (c *Client) DownloadFile(file string, u *url.URL, param *Download) error { if err != nil { return err } - defer rc.Close() - var r io.Reader = rc - - fh, err := os.Create(file) - if err != nil { - return err - } - defer fh.Close() - - if param.Progress != nil { - pr := progress.NewReader(param.Progress, r, contentLength) - r = pr - - // Mark progress reader as done when returning from this function. - defer func() { - pr.Done(err) - }() - } - - _, err = io.Copy(fh, r) - if err != nil { - return err - } - - // Assign error before returning so that it gets picked up by the deferred - // function marking the progress reader as done. - err = fh.Close() - if err != nil { - return err - } - - return nil + return c.WriteFile(file, rc, contentLength, param.Progress, param.Writer) } diff --git a/vendor/github.com/vmware/govmomi/vim25/types/BUILD b/vendor/github.com/vmware/govmomi/vim25/types/BUILD index 2f45f97c702..a3208849389 100644 --- a/vendor/github.com/vmware/govmomi/vim25/types/BUILD +++ b/vendor/github.com/vmware/govmomi/vim25/types/BUILD @@ -8,7 +8,6 @@ go_library( "fault.go", "helpers.go", "if.go", - "internal.go", "registry.go", "types.go", ], diff --git a/vendor/github.com/vmware/govmomi/vim25/types/helpers.go b/vendor/github.com/vmware/govmomi/vim25/types/helpers.go index 2364ed4213c..dd5f049fa80 100644 --- a/vendor/github.com/vmware/govmomi/vim25/types/helpers.go +++ b/vendor/github.com/vmware/govmomi/vim25/types/helpers.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. +Copyright (c) 2015-2017 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -16,12 +16,27 @@ limitations under the License. package types -import "strings" +import ( + "strings" + "time" +) func NewBool(v bool) *bool { return &v } +func NewInt32(v int32) *int32 { + return &v +} + +func NewInt64(v int64) *int64 { + return &v +} + +func NewTime(v time.Time) *time.Time { + return &v +} + func NewReference(r ManagedObjectReference) *ManagedObjectReference { return &r } @@ -50,3 +65,24 @@ func (r *ManagedObjectReference) FromString(o string) bool { func (c *PerfCounterInfo) Name() string { return c.GroupInfo.GetElementDescription().Key + "." + c.NameInfo.GetElementDescription().Key + "." + string(c.RollupType) } + +func defaultResourceAllocationInfo() ResourceAllocationInfo { + return ResourceAllocationInfo{ + Reservation: NewInt64(0), + ExpandableReservation: NewBool(true), + Limit: NewInt64(-1), + Shares: &SharesInfo{ + Level: SharesLevelNormal, + }, + } +} + +// DefaultResourceConfigSpec returns a ResourceConfigSpec populated with the same default field values as vCenter. +// Note that the wsdl marks these fields as optional, but they are required to be set when creating a resource pool. +// They are only optional when updating a resource pool. +func DefaultResourceConfigSpec() ResourceConfigSpec { + return ResourceConfigSpec{ + CpuAllocation: defaultResourceAllocationInfo(), + MemoryAllocation: defaultResourceAllocationInfo(), + } +} diff --git a/vendor/github.com/vmware/govmomi/vim25/types/if.go b/vendor/github.com/vmware/govmomi/vim25/types/if.go index dbf594cfc0a..5b93cb433f1 100644 --- a/vendor/github.com/vmware/govmomi/vim25/types/if.go +++ b/vendor/github.com/vmware/govmomi/vim25/types/if.go @@ -2360,16 +2360,6 @@ func init() { t["BaseReplicationVmFault"] = reflect.TypeOf((*ReplicationVmFault)(nil)).Elem() } -func (b *ResourceAllocationInfo) GetResourceAllocationInfo() *ResourceAllocationInfo { return b } - -type BaseResourceAllocationInfo interface { - GetResourceAllocationInfo() *ResourceAllocationInfo -} - -func init() { - t["BaseResourceAllocationInfo"] = reflect.TypeOf((*ResourceAllocationInfo)(nil)).Elem() -} - func (b *ResourceInUse) GetResourceInUse() *ResourceInUse { return b } type BaseResourceInUse interface { diff --git a/vendor/github.com/vmware/govmomi/vim25/types/internal.go b/vendor/github.com/vmware/govmomi/vim25/types/internal.go deleted file mode 100644 index 0c2693499b6..00000000000 --- a/vendor/github.com/vmware/govmomi/vim25/types/internal.go +++ /dev/null @@ -1,266 +0,0 @@ -/* -Copyright (c) 2014 VMware, Inc. All Rights Reserved. - -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 types - -import "reflect" - -type DynamicTypeMgrQueryMoInstances struct { - This ManagedObjectReference `xml:"_this"` - FilterSpec BaseDynamicTypeMgrFilterSpec `xml:"filterSpec,omitempty,typeattr"` -} - -type DynamicTypeMgrQueryMoInstancesResponse struct { - Returnval []DynamicTypeMgrMoInstance `xml:"urn:vim25 returnval"` -} - -type DynamicTypeEnumTypeInfo struct { - DynamicData - - Name string `xml:"name"` - WsdlName string `xml:"wsdlName"` - Version string `xml:"version"` - Value []string `xml:"value,omitempty"` - Annotation []DynamicTypeMgrAnnotation `xml:"annotation,omitempty"` -} - -func init() { - t["DynamicTypeEnumTypeInfo"] = reflect.TypeOf((*DynamicTypeEnumTypeInfo)(nil)).Elem() -} - -type DynamicTypeMgrAllTypeInfo struct { - DynamicData - - ManagedTypeInfo []DynamicTypeMgrManagedTypeInfo `xml:"managedTypeInfo,omitempty"` - EnumTypeInfo []DynamicTypeEnumTypeInfo `xml:"enumTypeInfo,omitempty"` - DataTypeInfo []DynamicTypeMgrDataTypeInfo `xml:"dataTypeInfo,omitempty"` -} - -func init() { - t["DynamicTypeMgrAllTypeInfo"] = reflect.TypeOf((*DynamicTypeMgrAllTypeInfo)(nil)).Elem() -} - -type DynamicTypeMgrAnnotation struct { - DynamicData - - Name string `xml:"name"` - Parameter []string `xml:"parameter,omitempty"` -} - -func init() { - t["DynamicTypeMgrAnnotation"] = reflect.TypeOf((*DynamicTypeMgrAnnotation)(nil)).Elem() -} - -type DynamicTypeMgrDataTypeInfo struct { - DynamicData - - Name string `xml:"name"` - WsdlName string `xml:"wsdlName"` - Version string `xml:"version"` - Base []string `xml:"base,omitempty"` - Property []DynamicTypeMgrPropertyTypeInfo `xml:"property,omitempty"` - Annotation []DynamicTypeMgrAnnotation `xml:"annotation,omitempty"` -} - -func init() { - t["DynamicTypeMgrDataTypeInfo"] = reflect.TypeOf((*DynamicTypeMgrDataTypeInfo)(nil)).Elem() -} - -func (b *DynamicTypeMgrFilterSpec) GetDynamicTypeMgrFilterSpec() *DynamicTypeMgrFilterSpec { return b } - -type BaseDynamicTypeMgrFilterSpec interface { - GetDynamicTypeMgrFilterSpec() *DynamicTypeMgrFilterSpec -} - -type DynamicTypeMgrFilterSpec struct { - DynamicData -} - -func init() { - t["DynamicTypeMgrFilterSpec"] = reflect.TypeOf((*DynamicTypeMgrFilterSpec)(nil)).Elem() -} - -type DynamicTypeMgrManagedTypeInfo struct { - DynamicData - - Name string `xml:"name"` - WsdlName string `xml:"wsdlName"` - Version string `xml:"version"` - Base []string `xml:"base,omitempty"` - Property []DynamicTypeMgrPropertyTypeInfo `xml:"property,omitempty"` - Method []DynamicTypeMgrMethodTypeInfo `xml:"method,omitempty"` - Annotation []DynamicTypeMgrAnnotation `xml:"annotation,omitempty"` -} - -func init() { - t["DynamicTypeMgrManagedTypeInfo"] = reflect.TypeOf((*DynamicTypeMgrManagedTypeInfo)(nil)).Elem() -} - -type DynamicTypeMgrMethodTypeInfo struct { - DynamicData - - Name string `xml:"name"` - WsdlName string `xml:"wsdlName"` - Version string `xml:"version"` - ParamTypeInfo []DynamicTypeMgrParamTypeInfo `xml:"paramTypeInfo,omitempty"` - ReturnTypeInfo *DynamicTypeMgrParamTypeInfo `xml:"returnTypeInfo,omitempty"` - Fault []string `xml:"fault,omitempty"` - PrivId string `xml:"privId,omitempty"` - Annotation []DynamicTypeMgrAnnotation `xml:"annotation,omitempty"` -} - -func init() { - t["DynamicTypeMgrMethodTypeInfo"] = reflect.TypeOf((*DynamicTypeMgrMethodTypeInfo)(nil)).Elem() -} - -type DynamicTypeMgrMoFilterSpec struct { - DynamicTypeMgrFilterSpec - - Id string `xml:"id,omitempty"` - TypeSubstr string `xml:"typeSubstr,omitempty"` -} - -func init() { - t["DynamicTypeMgrMoFilterSpec"] = reflect.TypeOf((*DynamicTypeMgrMoFilterSpec)(nil)).Elem() -} - -type DynamicTypeMgrMoInstance struct { - DynamicData - - Id string `xml:"id"` - MoType string `xml:"moType"` -} - -func init() { - t["DynamicTypeMgrMoInstance"] = reflect.TypeOf((*DynamicTypeMgrMoInstance)(nil)).Elem() -} - -type DynamicTypeMgrParamTypeInfo struct { - DynamicData - - Name string `xml:"name"` - Version string `xml:"version"` - Type string `xml:"type"` - PrivId string `xml:"privId,omitempty"` - Annotation []DynamicTypeMgrAnnotation `xml:"annotation,omitempty"` -} - -func init() { - t["DynamicTypeMgrParamTypeInfo"] = reflect.TypeOf((*DynamicTypeMgrParamTypeInfo)(nil)).Elem() -} - -type DynamicTypeMgrPropertyTypeInfo struct { - DynamicData - - Name string `xml:"name"` - Version string `xml:"version"` - Type string `xml:"type"` - PrivId string `xml:"privId,omitempty"` - MsgIdFormat string `xml:"msgIdFormat,omitempty"` - Annotation []DynamicTypeMgrAnnotation `xml:"annotation,omitempty"` -} - -type DynamicTypeMgrQueryTypeInfo struct { - This ManagedObjectReference `xml:"_this"` - FilterSpec BaseDynamicTypeMgrFilterSpec `xml:"filterSpec,omitempty,typeattr"` -} - -type DynamicTypeMgrQueryTypeInfoResponse struct { - Returnval DynamicTypeMgrAllTypeInfo `xml:"urn:vim25 returnval"` -} - -func init() { - t["DynamicTypeMgrPropertyTypeInfo"] = reflect.TypeOf((*DynamicTypeMgrPropertyTypeInfo)(nil)).Elem() -} - -type DynamicTypeMgrTypeFilterSpec struct { - DynamicTypeMgrFilterSpec - - TypeSubstr string `xml:"typeSubstr,omitempty"` -} - -func init() { - t["DynamicTypeMgrTypeFilterSpec"] = reflect.TypeOf((*DynamicTypeMgrTypeFilterSpec)(nil)).Elem() -} - -type ReflectManagedMethodExecuterSoapArgument struct { - DynamicData - - Name string `xml:"name"` - Val string `xml:"val"` -} - -func init() { - t["ReflectManagedMethodExecuterSoapArgument"] = reflect.TypeOf((*ReflectManagedMethodExecuterSoapArgument)(nil)).Elem() -} - -type ReflectManagedMethodExecuterSoapFault struct { - DynamicData - - FaultMsg string `xml:"faultMsg"` - FaultDetail string `xml:"faultDetail,omitempty"` -} - -func init() { - t["ReflectManagedMethodExecuterSoapFault"] = reflect.TypeOf((*ReflectManagedMethodExecuterSoapFault)(nil)).Elem() -} - -type ReflectManagedMethodExecuterSoapResult struct { - DynamicData - - Response string `xml:"response,omitempty"` - Fault *ReflectManagedMethodExecuterSoapFault `xml:"fault,omitempty"` -} - -type RetrieveDynamicTypeManager struct { - This ManagedObjectReference `xml:"_this"` -} - -type RetrieveDynamicTypeManagerResponse struct { - Returnval *InternalDynamicTypeManager `xml:"urn:vim25 returnval"` -} - -type RetrieveManagedMethodExecuter struct { - This ManagedObjectReference `xml:"_this"` -} - -func init() { - t["RetrieveManagedMethodExecuter"] = reflect.TypeOf((*RetrieveManagedMethodExecuter)(nil)).Elem() -} - -type RetrieveManagedMethodExecuterResponse struct { - Returnval *ReflectManagedMethodExecuter `xml:"urn:vim25 returnval"` -} - -type InternalDynamicTypeManager struct { - ManagedObjectReference -} - -type ReflectManagedMethodExecuter struct { - ManagedObjectReference -} - -type ExecuteSoap struct { - This ManagedObjectReference `xml:"_this"` - Moid string `xml:"moid"` - Version string `xml:"version"` - Method string `xml:"method"` - Argument []ReflectManagedMethodExecuterSoapArgument `xml:"argument,omitempty"` -} - -type ExecuteSoapResponse struct { - Returnval *ReflectManagedMethodExecuterSoapResult `xml:"urn:vim25 returnval"` -} diff --git a/vendor/github.com/vmware/govmomi/vim25/types/types.go b/vendor/github.com/vmware/govmomi/vim25/types/types.go index fa62c01815d..50cad1b6051 100644 --- a/vendor/github.com/vmware/govmomi/vim25/types/types.go +++ b/vendor/github.com/vmware/govmomi/vim25/types/types.go @@ -11331,7 +11331,7 @@ func init() { type DVSNetworkResourcePoolAllocationInfo struct { DynamicData - Limit int64 `xml:"limit,omitempty"` + Limit *int64 `xml:"limit"` Shares *SharesInfo `xml:"shares,omitempty"` PriorityTag int32 `xml:"priorityTag,omitempty"` } @@ -14165,9 +14165,9 @@ func init() { type DvsHostInfrastructureTrafficResourceAllocation struct { DynamicData - Limit int64 `xml:"limit,omitempty"` + Limit *int64 `xml:"limit"` Shares *SharesInfo `xml:"shares,omitempty"` - Reservation int64 `xml:"reservation,omitempty"` + Reservation *int64 `xml:"reservation"` } func init() { @@ -14846,7 +14846,7 @@ type DvsVnicAllocatedResource struct { Vm ManagedObjectReference `xml:"vm"` VnicKey string `xml:"vnicKey"` - Reservation int64 `xml:"reservation,omitempty"` + Reservation *int64 `xml:"reservation"` } func init() { @@ -18341,9 +18341,9 @@ func init() { type GuestPosixFileAttributes struct { GuestFileAttributes - OwnerId int32 `xml:"ownerId,omitempty"` - GroupId int32 `xml:"groupId,omitempty"` - Permissions int64 `xml:"permissions,omitempty"` + OwnerId *int32 `xml:"ownerId"` + GroupId *int32 `xml:"groupId"` + Permissions int64 `xml:"permissions,omitempty"` } func init() { @@ -22589,7 +22589,7 @@ type HostPlacedVirtualNicIdentifier struct { Vm ManagedObjectReference `xml:"vm"` VnicKey string `xml:"vnicKey"` - Reservation int32 `xml:"reservation,omitempty"` + Reservation *int32 `xml:"reservation"` } func init() { @@ -27456,7 +27456,7 @@ type LimitExceeded struct { VimFault Property string `xml:"property,omitempty"` - Limit int32 `xml:"limit,omitempty"` + Limit *int32 `xml:"limit"` } func init() { @@ -27624,7 +27624,7 @@ func init() { type ListKeysRequestType struct { This ManagedObjectReference `xml:"_this"` - Limit int32 `xml:"limit,omitempty"` + Limit *int32 `xml:"limit"` } func init() { @@ -27643,7 +27643,7 @@ func init() { type ListKmipServersRequestType struct { This ManagedObjectReference `xml:"_this"` - Limit int32 `xml:"limit,omitempty"` + Limit *int32 `xml:"limit"` } func init() { @@ -28546,7 +28546,7 @@ func init() { type MethodActionArgument struct { DynamicData - Value AnyType `xml:"value,omitempty,typeattr"` + Value AnyType `xml:"value,typeattr"` } func init() { @@ -29452,7 +29452,7 @@ func init() { type NamespaceLimitReached struct { VimFault - Limit int32 `xml:"limit,omitempty"` + Limit *int32 `xml:"limit"` } func init() { @@ -31074,7 +31074,7 @@ type OptionValue struct { DynamicData Key string `xml:"key"` - Value AnyType `xml:"value,omitempty,typeattr"` + Value AnyType `xml:"value,typeattr"` } func init() { @@ -34231,7 +34231,7 @@ type PropertyChange struct { Name string `xml:"name"` Op PropertyChangeOp `xml:"op"` - Val AnyType `xml:"val,omitempty,typeattr"` + Val AnyType `xml:"val,typeattr"` } func init() { @@ -36332,7 +36332,7 @@ func init() { type QueryVsanObjectUuidsByFilterRequestType struct { This ManagedObjectReference `xml:"_this"` Uuids []string `xml:"uuids,omitempty"` - Limit int32 `xml:"limit,omitempty"` + Limit *int32 `xml:"limit"` Version int32 `xml:"version,omitempty"` } @@ -39065,11 +39065,11 @@ type ResolveMultipleUnresolvedVmfsVolumesResponse struct { type ResourceAllocationInfo struct { DynamicData - Reservation int64 `xml:"reservation,omitempty"` + Reservation *int64 `xml:"reservation"` ExpandableReservation *bool `xml:"expandableReservation"` - Limit int64 `xml:"limit,omitempty"` + Limit *int64 `xml:"limit"` Shares *SharesInfo `xml:"shares,omitempty"` - OverheadLimit int64 `xml:"overheadLimit,omitempty"` + OverheadLimit *int64 `xml:"overheadLimit"` } func init() { @@ -39100,11 +39100,11 @@ func init() { type ResourceConfigSpec struct { DynamicData - Entity *ManagedObjectReference `xml:"entity,omitempty"` - ChangeVersion string `xml:"changeVersion,omitempty"` - LastModified *time.Time `xml:"lastModified"` - CpuAllocation BaseResourceAllocationInfo `xml:"cpuAllocation,typeattr"` - MemoryAllocation BaseResourceAllocationInfo `xml:"memoryAllocation,typeattr"` + Entity *ManagedObjectReference `xml:"entity,omitempty"` + ChangeVersion string `xml:"changeVersion,omitempty"` + LastModified *time.Time `xml:"lastModified"` + CpuAllocation ResourceAllocationInfo `xml:"cpuAllocation"` + MemoryAllocation ResourceAllocationInfo `xml:"memoryAllocation"` } func init() { @@ -42322,9 +42322,9 @@ func init() { type StorageIOAllocationInfo struct { DynamicData - Limit int64 `xml:"limit,omitempty"` + Limit *int64 `xml:"limit"` Shares *SharesInfo `xml:"shares,omitempty"` - Reservation int32 `xml:"reservation,omitempty"` + Reservation *int32 `xml:"reservation"` } func init() { @@ -47957,9 +47957,9 @@ func init() { type VirtualEthernetCardResourceAllocation struct { DynamicData - Reservation int64 `xml:"reservation,omitempty"` + Reservation *int64 `xml:"reservation"` Share SharesInfo `xml:"share"` - Limit int64 `xml:"limit,omitempty"` + Limit *int64 `xml:"limit"` } func init() { @@ -48356,8 +48356,8 @@ type VirtualMachineConfigInfo struct { ConsolePreferences *VirtualMachineConsolePreferences `xml:"consolePreferences,omitempty"` DefaultPowerOps VirtualMachineDefaultPowerOpInfo `xml:"defaultPowerOps"` Hardware VirtualHardware `xml:"hardware"` - CpuAllocation BaseResourceAllocationInfo `xml:"cpuAllocation,omitempty,typeattr"` - MemoryAllocation BaseResourceAllocationInfo `xml:"memoryAllocation,omitempty,typeattr"` + CpuAllocation *ResourceAllocationInfo `xml:"cpuAllocation,omitempty"` + MemoryAllocation *ResourceAllocationInfo `xml:"memoryAllocation,omitempty"` LatencySensitivity *LatencySensitivity `xml:"latencySensitivity,omitempty"` MemoryHotAddEnabled *bool `xml:"memoryHotAddEnabled"` CpuHotAddEnabled *bool `xml:"cpuHotAddEnabled"` @@ -48493,8 +48493,8 @@ type VirtualMachineConfigSpec struct { VirtualICH7MPresent *bool `xml:"virtualICH7MPresent"` VirtualSMCPresent *bool `xml:"virtualSMCPresent"` DeviceChange []BaseVirtualDeviceConfigSpec `xml:"deviceChange,omitempty,typeattr"` - CpuAllocation BaseResourceAllocationInfo `xml:"cpuAllocation,omitempty,typeattr"` - MemoryAllocation BaseResourceAllocationInfo `xml:"memoryAllocation,omitempty,typeattr"` + CpuAllocation *ResourceAllocationInfo `xml:"cpuAllocation,omitempty"` + MemoryAllocation *ResourceAllocationInfo `xml:"memoryAllocation,omitempty"` LatencySensitivity *LatencySensitivity `xml:"latencySensitivity,omitempty"` CpuAffinity *VirtualMachineAffinityInfo `xml:"cpuAffinity,omitempty"` MemoryAffinity *VirtualMachineAffinityInfo `xml:"memoryAffinity,omitempty"` @@ -53154,8 +53154,8 @@ type WaitForUpdatesResponse struct { type WaitOptions struct { DynamicData - MaxWaitSeconds int32 `xml:"maxWaitSeconds,omitempty"` - MaxObjectUpdates int32 `xml:"maxObjectUpdates,omitempty"` + MaxWaitSeconds *int32 `xml:"maxWaitSeconds"` + MaxObjectUpdates int32 `xml:"maxObjectUpdates,omitempty"` } func init() {