Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Factory:Rebuild
open-vmdk
open-vmdk-0.3.6.0.obscpio
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File open-vmdk-0.3.6.0.obscpio of Package open-vmdk
07070100000000000041ED0000000000000000000000026553B88900000000000000000000000000000000000000000000001A00000000open-vmdk-0.3.6.0/.github07070100000001000041ED0000000000000000000000026553B88900000000000000000000000000000000000000000000002400000000open-vmdk-0.3.6.0/.github/workflows07070100000002000081A40000000000000000000000016553B88900000359000000000000000000000000000000000000003000000000open-vmdk-0.3.6.0/.github/workflows/pytest.yamlname: open-vmdk pytests on: [pull_request, push, workflow_dispatch] jobs: pytests: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: install build deps run: sudo apt-get -y install zlib1g-dev - name: build working-directory: ${{ github.workspace }} run: make - name: install working-directory: ${{ github.workspace }} run: sudo make install - name: set up python 3 uses: actions/setup-python@v4 with: python-version: '3.x' - name: install pytest run: pip install pytest PyYAML lxml xmltodict - name: run tests working-directory: ${{ github.workspace }} run: pytest pytest/ 07070100000003000081A40000000000000000000000016553B8890000001A000000000000000000000000000000000000001D00000000open-vmdk-0.3.6.0/.gitignore/build/ ._* __pycache__/ 07070100000004000081A40000000000000000000000016553B88900002C5E000000000000000000000000000000000000001A00000000open-vmdk-0.3.6.0/LICENSE 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. 07070100000005000081A40000000000000000000000016553B8890000042E000000000000000000000000000000000000001B00000000open-vmdk-0.3.6.0/Makefile# ================================================================================ # Copyright (c) 2014-2023 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. # ================================================================================ DIRS := vmdk ova ova-compose templates default:: all install all: for x in $(DIRS); do $(MAKE) -C $$x $@; done clean: rm -rf build .PHONY: default all clean 07070100000006000081A40000000000000000000000016553B88900003AD5000000000000000000000000000000000000001C00000000open-vmdk-0.3.6.0/README.md# Introduction Open VMDK is an assistant tool for creating [Open Virtual Appliance (OVA)](https://en.wikipedia.org/wiki/Virtual_appliance). An OVA is a tar archive file with [Open Virtualization Format (OVF)](https://en.wikipedia.org/wiki/Open_Virtualization_Format) files inside, which is composed of an OVF descriptor with extension `.ovf`, one or more virtual machine disk image files with extension `.vmdk`, and a manifest file with extension `.mf`. This tool consists of two parts: ## vmdk-convert OVA files require stream optimized disk image files (`.vmdk`) so that they can be easily streamed over a network link. `vmdk-convert` can convert raw disk images, and flat or sparse vmdk images to the stream optimized disk image format. ## ova-compose The OVF file that will be embedded can be generated using `ova-compose` from a simple yaml config file. `ova-compose` will then create the final OVA from the OVF file, the vmdk images and a manifest (a file that contains checksums of the other files). There is also the legacy tool `mkova.sh` that generates OVF files from templates. ## Specifications The VMDK format specification can be downloaded at https://www.vmware.com/app/vmdk/?src=vmdk (pdf). The OVF/OVA specification can be found at https://www.dmtf.org/standards/ovf # Getting Started ## Installation Clone the repository, like `git clone https://github.com/vmware/open-vmdk`. Alternatively, download and extract it: ``` curl -O https://github.com/vmware/open-vmdk/archive/master.tar.gz tar zxf master.tar.gz ``` or if you prefer `wget` and `zip`: ``` $ wget https://github.com/vmware/open-vmdk/archive/master.zip $ unzip master.zip ``` Run below commands to build and install: ``` $ cd open-vmdk-master $ make $ make install ``` You can change the prefix with `PREXIX` (default is `usr`) or the installation directory with `DESTDIR` for packaging, for example: ``` $ make DESTDIR=/tmp/open-vmdk install ``` ## Usage `open-vmdk` basically has two parts: * `vmdk-convert` to convert raw disk image files to `vmdk` format (and back) * `ova-compose` to create an OVA (or OVF) file from a `vmdk` and a configuration file describing a VM There is also a legacy tool `mkova.sh` that uses OVF templates. This is less flexible than `ova-compose` and will be deprecated. ### New VM `vmdk-convert` can process raw disk images to streamable `vmdk` images. For example (as root): ``` dd if=/dev/zero of=testvm.img bs=1M count=4096 LOOP_DEVICE=$(losetup --show -f testvm.img) ... format disk to loop device and install OS into image ... losetup -d $LOOP_DEVICE vmdk-convert testvm.img testvm.vmdk ``` ### Set the VMware Tools version Set the VMware Tools version installed in your VM disk by adding the `-t` option. The tools version is a number calculated from the version string `x.y.z` using the formulae `1024*x + 32*y + z`. So for example for the version `12.1.5` the number would be `1024 * 12 + 1 * 32 + 5` = `12325`. ``` $ vmdk-convert -t 12325 testvm-flat.vmdk disk1.vmdk ``` This will set `ddb.toolsVersion` to 12325 in the metadata of disk1.vmdk. By default, the `ddb.toolsVersion` will be set to 2147483647 (MAXINT, or `2^31-1`). See https://packages.vmware.com/tools/versions for all released VMware Tools versions. See https://kb.vmware.com/s/article/83068 for instructions to add `ddb.toolsVersion` to an exiting OVF/OVA template. ### Existing VM Below example shows how to create an [Open Virtual Appliance (OVA)](https://en.wikipedia.org/wiki/Virtual_appliance) from vSphere virtual machine. Presume the virtual machine's name is `testvm`, and virtual machine files include: ``` testvm-312d29db.hlog testvm-flat.vmdk testvm.nvram testvm.vmdk testvm.vmsd testvm.vmx vmware.log ``` 1. Copy `testvm` folder to `TESTSVM_PATH` on the machine where you have `open-vmdk` installed. 2. Convert vmfs raw data extent file of the VM to OVF streaming format. ``` $ cd $TESTSVM_PATH $ vmdk-convert testvm-flat.vmdk ``` After converting, a new vmdk file `dst.vmdk` will be created under `$TESTSVM_PATH` folder. Or, you can specify the new vmdk file name by running ``` $ vmdk-convert testvm-flat.vmdk disk1.vmdk ``` ### Create an OVA with ova-compose #### Config File ``` system: name: example type: vmx-17 os_vmw: other4xLinux64Guest firmware: efi secure_boot: true default_configuration: grande networks: vm_network: name: "VM Network" description: "The VM Network network" hardware: cpus: 2 memory: 2048 sata1: type: sata_controller scsi1: type: scsi_controller cdrom1: type: cd_drive parent: sata1 rootdisk: type: hard_disk parent: scsi1 disk_image: example.vmdk usb1: type: usb_controller ethernet1: type: ethernet subtype: VmxNet3 network: vm_network videocard1: type: video_card vmci1: type: vmci configurations: tall: label: Tall description: too little for the money grande: label: Grande description: just right venti: label: Venti description: too much environment: transports: - com.vmware.guestInfo - iso categories: email: Email Settings properties: guestinfo.admin.email: value: admin@company.org user_configurable: true type: string description: "The Admin's email address" label: "Email Address" category: email extra_configs: feature.enabled: required: false value: true log.rotateSize: value: 2048000 product: product: An Example VM vendor: A Company Inc. annotation: text: the password is top secret eula: file: eula.txt ``` The config file has 3 mandatory and 4 optional sections. `system`, `networks` and `hardware` are mandatory. * `system` describes basic properties of the whole system, like name, hardware compatibility version and others. * `networks` describes the network used. Each entry is a unique id. Each of these entries needs a `name` and a `description`. * `hardware` describes the hardware components. Every entry is a unique id that can be any name, except the reserved ids `cpus` and `memory`. Each components except `cpus` and `memory` must have a `type`. The type can be one of the values described below. The reserved ids: * `cpus`: set to the number of CPUs * `memory`: set to the memory size in megabytes The other ids can have these types: * `scsi_controller`, `sata_controller` or `ide_controller`: a controller. Each controller can have 0 or more other devices attached. * `scsi_controller` can have a `subtype` set to one of `VirtualSCSI` (aka "pvscsi") or `lsilogic`. * `cd_drive`: a CD drive, optionally with an ISO image set with `image`. The file will be packed within the OVA. The controller to attach to must be set with `parent` to the id of the controller. Set `connected = true` to have the image connected on startup (default is `false`) * `floppy`: a floppy device. Very similar to `cd_drive`, but does not need to be connected to a controller. * `hard_disk`: a hard disk. This can be set to an image in streamable vmdk format with `disk_image`. The file will be packed within the OVA. Alternatively, if `disk_capacity` is set, an empty disk will be created. * `ethernet`: an ethernet device. The network must be set with `network` to one of the networks defined in the main `networks` section. Set `connected = false` to have the device disconnected on startup (default is `true`) * `usb_controller`, `video_card` and `vmci`: USB controller, video card and VMCI device. Optionally, each `hardware` item can have ` configuration` setting. If set, the hardware item will be present only for that particular `configuration`. This is useful to have different memory sizes, number of CPUs perconfiguration, or make hardware items only present for a particular configuration. * `cpus` can be set as a hardware type. In this case, the field `number` sets the number of CPUs. This is useful for different configurations. * `memory` can also be set as a hardware type. The size is specified with `size`. These sections are optional: * `product` describes the product. It has the fields `info`, `product`, `vendor`, `version` and `full_version`. * `configurations` describes different OVF configurations that can be selected at deployment time. It is a map with the configuration id as key, and the fields `label`, `description` and optionally `default`: ``` configurations: tall: label: Tall description: too little for the money grande: default: true label: Grande description: just right ``` The default can also be set with `default_configuration` in the `system` section. * `environment` is for setting OVF properties. Variables are added under the new `environment` section as a `properties` map. The key is the name of the variable. Each variable has a mandatory `type`. `value`, `user_configurable` (default: `false`), `qualifiers`, `password` (default `false`),`label`, `description` are optional. Additionally, `transports` can be set in a list. Valid values are `iso` and `com.vmware.guestInfo`. Note that at least one of them must be set to make the properties visible inside the guest. Optionally, categories are set with `categories` to a map with an id as key and a description as value. Each property can have a `category` set to a category id. * `extra_configs` is a map of settings with the fields `value` and optionally the boolean `required`. * `annotation` has the fields `info`, `text` and `file`. `text` and `file` are mutually exclusive - `text` is text inline, `file` can be set to a text file that will be filled in. The annotation text will appear for example as a comment in VMware Fusion. * `eula` also has the fields `info`, `text` and `file`. It contains the EULA agreement the user has to agree to when deploying the VM. #### Parameters Values can be filled in with parameters from the command line. This makes the yaml file reusable for different VMs. For example, the hard disk can be set via command line: ``` rootdisk: type: hard_disk parent: scsi1 disk_image: !param rootdisk ``` When invoking `ova-compose` (see below) the value can be set with `--param rootdisk=example.vmdk`. Default values can also be set in case `ova-compose` is invoked without the parameter. Example: ``` hardware: cpus: !param cpus=2 memory: !param memory=2048 ``` In this case, setting the parameters `cpus` and `memory` will be optional. If `ova-compose` is invoked without setting a parameter for which no default is set, it will throw an error. #### Usage `ova-compose -i|--input_file <input_file> -o|--output_file <output_file> [ --format <format> ] [[--param <key=value>] ...] [-q]` Options: * `-i|--input_file <input_file>` : the config file to use * `-o|--output_file <output_file>`: the output file or directory * `--format <format>` : the format, one of: `ova`, `ovf` or `dir`. If not set, the format will be guessed from the output file extension if it is `ova` or `ovf` * `ova` to create an OVA file * `ovf` to create just the OVF file * `dir` to create a directory containing the OVF file, the manifest and the files used for the cdrom and harddisk devices. * `--param <key=value>`: set parameter `<key>` to `<value>`. Example: ``` $ ova-compose.py -i minimal.yaml -o minimal.ova creating 'minimal.ova' with format 'ova' from 'minimal.yaml' done. ``` ### Create an OVA - Legacy (mkova.sh) #### Hardware Options By default, the OVA will be created with 2 CPUs and 1024 MB memory. For VMs with hardware version 11 or later, the default OVA firmware is `efi`. These defaults can be changed with options to `mkova.sh`: * `--num-cpus`: The number of CPUs of the OVA template. Default value is `2`. * `--mem-size`: The memory size in MB of the OVA template. Default value is `1024`. * `--firmware`: The firmare of the OVA template (`efi` or `bios`). Default value is `efi`. These settings can also be set with the environment variables `NUM_CPUS`, `MEM_SIZE` and `FIRMWARE`, for example in the configuration file (see below). For hardware versions 7 and 10 only `bios` is supported as firmware. #### Selecting the Template The template is an OVF file with place holders and provides settings for a pre-configured VM. It will be used to create the final OVF. The template file can be selected in two ways - either directly with the `--template` option, or by using the `--hw` option to specify the hardware version. By default, the latest available template will be used. Example: run `mkova.sh` to create OVA with specific hardware version (20): ``` $ mkova.sh --num-cpus 4 --mem-size 4096 --firmware bios --hw 20 ova_name disk1.vmdk ``` Note that templates do not exist for every possible hardware version. Example: run `mkova.sh` to create OVA with a specific template: ``` $ mkova.sh --num-cpus 4 --mem-size 4096 --firmware bios --template /usr/share/open-vmdk/template-hw20.ovf ova_name disk1.vmdk ``` Where, * _ova_name_ is your OVA name without .ova suffix. * _dst.vmdk_ is the new vmdk file converted in step 2. * _path_to_ovf_template_ is the path to .ovf template file. Below .ovf templates files can be used. * `templates/template-hw7.ovf` is the template for a VM with BIOS firmware with hardware version 7. * `templates/template-hw10.ovf` is the template for a VM with BIOS firmware with hardware version 10. * `templates/template-hw11.ovf` is the template for hardware version 11. * `templates/template-hw13.ovf` is the template for hardware version 13. * `templates/template-hw14.ovf` is the template for hardware version 14. * `templates/template-hw15.ovf` is the template for hardware version 15. * `templates/template-hw17.ovf` is the template for hardware version 17. * `templates/template-hw18.ovf` is the template for hardware version 18. * `templates/template-hw19.ovf` is the template for hardware version 19. * `templates/template-hw20.ovf` is the template for hardware version 20. #### Create OVF File in Directory Optionally, when the `--ovf` option is used, `mkova.sh` skips creating the OVA file and just creates a directory with the files that would be have been packed into the OVA. The directory will be created in the current directory with the supplied OVA name. #### Multiple Disks You can add multiple disks by adding them to the command line, for example: ``` $ mkova.sh ova_name path_to_ovf_template disk1.vmdk disk2.vmdk disk3.vmdk ``` Multiple disks are only supported to be attached to one SCSI controller, and at most 15 disks can be added in one OVA. When `mkova.sh` completes, you should see the final OVA under the current directory. #### Configuration File `mkova.sh` will look for a configuration file at `/etc/open-vmdk.conf`. This is a simple shell script that can be used to set default values. 07070100000007000041ED0000000000000000000000026553B88900000000000000000000000000000000000000000000001600000000open-vmdk-0.3.6.0/ova07070100000008000041ED0000000000000000000000026553B88900000000000000000000000000000000000000000000001E00000000open-vmdk-0.3.6.0/ova-compose07070100000009000081A40000000000000000000000016553B8890000039C000000000000000000000000000000000000002700000000open-vmdk-0.3.6.0/ova-compose/Makefile# ================================================================================ # Copyright (c) 2014-2023 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. # ================================================================================ EXE=ova-compose PREFIX ?= /usr all: install: mkdir -p $(DESTDIR)/$(PREFIX)/bin && cp $(EXE).py $(DESTDIR)/$(PREFIX)/bin/$(EXE) 0707010000000A000081A40000000000000000000000016553B889000003E0000000000000000000000000000000000000002B00000000open-vmdk-0.3.6.0/ova-compose/example.yamlsystem: name: example type: vmx-17 os_vmw: !param os=other4xLinux64Guest firmware: !param firmware=efi secure_boot: !param secure-boot=true networks: vm_network: name: "VM Network" description: "The VM Network network" hardware: cpus: !param cpus=2 memory: !param memory=2048 sata1: type: sata_controller scsi1: type: scsi_controller cdrom1: type: cd_drive parent: sata1 floppy1: type: floppy image: floppy.img connected: true rootdisk: type: hard_disk parent: scsi1 disk_image: !param rootdisk usb1: type: usb_controller ethernet1: type: ethernet subtype: VmxNet3 network: vm_network videocard1: type: video_card vmci1: type: vmci product: product: An Example VM vendor: A Company Inc. annotation: text: the password is top secret eula: file: !param eulafile0707010000000B000081ED0000000000000000000000016553B889000097A2000000000000000000000000000000000000002D00000000open-vmdk-0.3.6.0/ova-compose/ova-compose.py#!/usr/bin/env python3 # Copyright (c) 2023 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. import sys import os import subprocess import getopt import datetime import yaml import json from lxml import etree as ET import hashlib import tempfile import shutil APP_NAME = "ova-compose" NS_CIM = "http://schemas.dmtf.org/wbem/wscim/1/common" NS_OVF = "http://schemas.dmtf.org/ovf/envelope/1" NS_RASD = "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" NS_VMW = "http://www.vmware.com/schema/ovf" NS_VSSD = "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" NS_XSI = "http://www.w3.org/2001/XMLSchema-instance" NS_MAP = { "cim" : NS_CIM, "ovf" : NS_OVF, "rasd" : NS_RASD, "vmw" : NS_VMW, "vssd" : NS_VSSD, "xsi" : NS_XSI } def xml_indent(elem, level=0): i = "\n" + level*" " if len(elem): if not elem.text or not elem.text.strip(): elem.text = i + " " if not elem.tail or not elem.tail.strip(): elem.tail = i for elem in elem: xml_indent(elem, level+1) if not elem.tail or not elem.tail.strip(): elem.tail = i def xml_text_element(tag, value): elem = ET.Element(tag) elem.text = value return elem def xml_config(key, val): return ET.Element('{%s}Config' % NS_VMW, { '{%s}required' % NS_OVF: 'false', '{%s}key' % NS_VMW: key, '{%s}value' % NS_VMW: val}) class ValidationError(Exception): pass class VirtualHardware(object): pass class VssdSystem(VirtualHardware): def __init__(self, identifier, type): self.identifier = identifier self.type = type @classmethod def from_dict(cls, d): system = d['system'] return cls(system['name'], system['type']) def new_text_element(self, tag, value): elem = ET.Element(tag) elem.text = value return elem def xml_element(self, tag, value): return self.new_text_element("{%s}%s" % (NS_VSSD, tag), str(value)) def xml_item(self, element_name): attrs = {} item = ET.Element('{%s}System' % NS_OVF, attrs) item.append(self.xml_element('ElementName', element_name)) item.append(self.xml_element('InstanceID', 0)) item.append(self.xml_element('VirtualSystemIdentifier', self.identifier)) item.append(self.xml_element('VirtualSystemType', self.type)) return item class RasdItem(VirtualHardware): last_instance_id = 0 description = "Virtual Hardware Item" config = {} connectable = False configuration = None def __init__(self, subtype=None): RasdItem.last_instance_id += 1 self.instance_id = RasdItem.last_instance_id @classmethod def from_dict(cls, d): return cls() def connect(self, ovf): pass def xml_references(self): return None def xml_disks(self): return None def new_text_element(self, tag, value): elem = ET.Element(tag) elem.text = value return elem def xml_element(self, tag, value): return self.new_text_element("{%s}%s" % (NS_RASD, tag), str(value)) def xml_item(self, required, element_name): attrs = {} if not required: attrs["{%s}required" % NS_OVF] = 'false' if self.configuration: attrs["{%s}configuration" % NS_OVF] = self.configuration item = ET.Element('{%s}Item' % NS_OVF, attrs) item.append(self.xml_element('ResourceType', self.resource_type)) item.append(self.xml_element('InstanceID', self.instance_id)) item.append(self.xml_element('Description', self.description)) item.append(self.xml_element('ElementName', element_name)) for key, val in sorted(self.config.items()): item.append(xml_config(key, val)) if self.connectable: item.append(self.xml_element('AutomaticAllocation', "true" if self.connected else "false")) return item class RasdCpus(RasdItem): resource_type = 3 description = "Virtual CPUs" def __init__(self, num): super().__init__() self.num = int(num) @classmethod def from_dict(cls, d): if type(d) is int: item = cls(d) else: item = cls(d['number']) return item def xml_item(self, required, element_name): item = super().xml_item(required, element_name) item.append(self.xml_element('AllocationUnits', 'hertz * 10^6')) item.append(self.xml_element('VirtualQuantity', self.num)) return item class RasdMemory(RasdItem): resource_type = 4 description = "Virtual Memory" def __init__(self, size): super().__init__() self.size = int(size) @classmethod def from_dict(cls, d): if type(d) is int: item = cls(d) else: item = cls(d['size']) return item def xml_item(self, required, element_name): item = super().xml_item(required, element_name) item.append(self.xml_element('AllocationUnits', 'byte * 2^20')) item.append(self.xml_element('VirtualQuantity', self.size)) return item class RasdController(RasdItem): def __init__(self, subtype): super().__init__() self.next_child_address = 0 self.subtype = subtype @classmethod def from_dict(cls, d): item = cls(d.get('subtype', None)) return item def add_child(self, child): child.address_on_parent = self.next_child_address self.next_child_address += 1 class RasdScsiController(RasdController): resource_type = 6 description = "SCSI Controller" def __init__(self, subtype): super().__init__(subtype) self.next_child_address = 0 # TODO: maintain valid settings in a structure instead of code: if self.subtype is None: self.subtype = 'VirtualSCSI' elif self.subtype.lower() in ['virtualscsi', 'lsilogic']: self.subtype = subtype else: raise Exception(f"invalid SCSI subtype '{self.subtype}'") def xml_item(self, required, element_name): item = super().xml_item(required, element_name) item.append(self.xml_element('ResourceSubType', self.subtype)) return item class RasdSataController(RasdController): resource_type = 20 description = "SATA Controller" def xml_item(self, required, element_name): item = super().xml_item(required, element_name) item.append(self.xml_element('ResourceSubType', 'vmware.sata.ahci')) return item class RasdIdeController(RasdController): resource_type = 5 description = "IDE Controller" class RasdControllerItem(RasdItem): def __init__(self, parent_id): super().__init__() self.parent_id = parent_id self.rasd_parent = None @classmethod def from_dict(cls, d): item = cls(d['parent']) return item def connect(self, ovf): self.rasd_parent = ovf.rasd_items[self.parent_id] self.rasd_parent.add_child(self) def xml_item(self, required, element_name): item = super().xml_item(required, element_name) item.append(self.xml_element('Parent', self.rasd_parent.instance_id)) item.append(self.xml_element('AddressOnParent', self.address_on_parent)) return item class RasdCdDrive(RasdControllerItem): resource_type = 15 description = "CD Drive" DEFAULT_CONFIG = { "connectable.allowGuestControl":"true" } connectable = True def __init__(self, parent_id, image, connected=False): super().__init__(parent_id) self.image = image self.config = self.DEFAULT_CONFIG.copy() self.connected = connected @classmethod def from_dict(cls, d): item = cls(d['parent'], d.get('image', None), d.get('connected', False)) return item def xml_item(self, required, element_name): item = super().xml_item(required, element_name) item.append(self.xml_element('ResourceSubType', 'vmware.cdrom.remotepassthrough')) if self.image is not None: item.append(self.xml_element('HostResource', self.image.host_resource())) return item class RasdUsbController(RasdItem): resource_type = 23 description = "USB Controller" def xml_item(self, required, element_name): item = super().xml_item(required, element_name) item.append(self.xml_element('ResourceSubType', 'vmware.usb.ehci')) item.append(xml_config('ehciEnabled', 'true')) return item class RasdVmci(RasdItem): resource_type = 1 description = "VMCI" def xml_item(self, required, element_name): item = super().xml_item(required, element_name) item.append(self.xml_element('ResourceSubType', 'vmware.vmci')) return item class RasdFloppy(RasdItem): resource_type = 14 description = "Floppy Drive" DEFAULT_CONFIG = { "connectable.allowGuestControl":"true" } connectable = True def __init__(self, image, connected=False): super().__init__() self.image = image self.config = self.DEFAULT_CONFIG.copy() self.connected = connected @classmethod def from_dict(cls, d): item = cls(d.get('image', None), d.get('connected', False)) return item def xml_item(self, required, element_name): item = super().xml_item(required, element_name) if self.image is not None: item.append(self.xml_element('HostResource', self.image.host_resource())) return item class RasdVideoCard(RasdItem): resource_type = 24 description = "Video Card" DEFAULT_CONFIG = { "useAutoDetect" : "false", "videoRamSizeInKB" : "4096", "enable3DSupport" : "false", "use3dRenderer" : "automatic" } connectable = True connected = False def __init__(self): super().__init__() self.config = RasdVideoCard.DEFAULT_CONFIG.copy() def xml_item(self, required, element_name): item = super().xml_item(required, element_name) return item class RasdHardDisk(RasdControllerItem): resource_type = 17 description = "Hard Disk" def __init__(self, parent_id, disk): super().__init__(parent_id) self.disk = disk @classmethod def from_dict(cls, d): item = cls(d['parent'], d['disk']) return item def xml_item(self, required, element_name): item = super().xml_item(required, element_name) item.append(self.xml_element('HostResource', self.disk.host_resource())) return item class RasdEthernet(RasdItem): resource_type = 10 description = "Ethernet Adapter" DEFAULT_CONFIG = { "wakeOnLanEnabled":"false", "connectable.allowGuestControl":"true" } connectable = True def __init__(self, network_id, subtype, connected=True): super().__init__() self.config = RasdEthernet.DEFAULT_CONFIG.copy() self.network_id = network_id self.subtype = subtype self.connected = connected @classmethod def from_dict(cls, d): item = cls(d['network'], d['subtype'], d.get('connected', True)) return item def connect(self, ovf): self.network = ovf.networks[self.network_id] def xml_item(self, required, element_name): item = super().xml_item(required, element_name) item.append(self.xml_element('ResourceSubType', self.subtype)) item.append(self.xml_element('Connection', self.network.name)) return item class OVFNetwork(object): def __init__(self, name, description): self.name = name @classmethod def from_dict(cls, d): item = cls(d['name'], d['description']) return item def xml_item(self): item = ET.Element('{%s}Network' % NS_OVF, {'{%s}name' % NS_OVF : self.name}) item_desc = ET.Element('{%s}Description' % NS_OVF) item_desc.text = f"The {self.name} Network" item.append(item_desc) return item class OVFFile(object): next_id = 0 def __init__(self, path): self.id = f"file{OVFFile.next_id}" OVFFile.next_id += 1 self.path = os.path.abspath(path) self.size = os.path.getsize(self.path) def host_resource(self): return f"ovf:/file/{self.id}" def xml_item(self): return ET.Element('{%s}File' % NS_OVF, { '{%s}href' % NS_OVF: os.path.basename(self.path), '{%s}id' % NS_OVF: self.id, '{%s}size' % NS_OVF: str(self.size) }) class OVFDisk(object): next_id = 0 def __init__(self, path): self.id = f"vmdisk{OVFDisk.next_id}" OVFDisk.next_id += 1 self.file = OVFFile(path) disk_info = OVF._disk_info(path) self.capacity = disk_info['capacity'] self.used = disk_info['used'] def host_resource(self): return f"ovf:/disk/{self.id}" def xml_item(self): return ET.Element('{%s}Disk' % NS_OVF, { '{%s}capacity' % NS_OVF: str(self.capacity), '{%s}capacityAllocationUnits' % NS_OVF: 'byte', '{%s}diskId' % NS_OVF: self.id, '{%s}fileRef' % NS_OVF: self.file.id, '{%s}populatedSize' % NS_OVF: str(self.used), '{%s}format' % NS_OVF: 'http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized' }) class OVFEmptyDisk(OVFDisk): def __init__(self, capacity, units="MB"): self.id = f"vmdisk{OVFDisk.next_id}" OVFDisk.next_id += 1 self.capacity = capacity if units == "KB": units = "byte * 2^10" elif units == "MB": units = "byte * 2^20" elif units == "GB": units = "byte * 2^30" elif units == "TB": units = "byte * 2^30" self.units = units def xml_item(self): return ET.Element('{%s}Disk' % NS_OVF, { '{%s}capacity' % NS_OVF: str(self.capacity), '{%s}capacityAllocationUnits' % NS_OVF: self.units, '{%s}diskId' % NS_OVF: self.id, '{%s}format' % NS_OVF: 'http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized' }) def to_camel_case(snake_str): return ''.join(x.title() for x in snake_str.split('_')) class OVFProperty(object): def __init__(self, key, type, password = False, value=None, user_configurable=False, qualifiers=None, label=None, description=None, category=None): self.key = key self.type = type self.password = False self.value = value self.user_configurable = user_configurable self.qualifiers = qualifiers self.label = label self.description = description self.category = category @classmethod def from_dict(cls, key, type, d): item = cls(key, type, **d) return item def xml_item(self): xml_attrs = { '{%s}key' % NS_OVF: self.key, '{%s}type' % NS_OVF: self.type } if self.value is not None: xml_attrs['{%s}value' % NS_OVF] = str(self.value) if self.qualifiers is not None: xml_attrs['{%s}qualifiers' % NS_OVF] = self.qualifiers if self.user_configurable: xml_attrs['{%s}userConfigurable' % NS_OVF] = "true" if self.password: xml_attrs['{%s}password' % NS_OVF] = "true" xml_property = ET.Element('{%s}Property' % NS_OVF, xml_attrs) if self.label is not None: xml_property.append(xml_text_element('{%s}Label' % NS_OVF, self.label)) if self.description is not None: xml_property.append(xml_text_element('{%s}Description' % NS_OVF, self.description)) return xml_property class OVFProduct(object): # snake case will be converted to camel case in XML keys = ['info', 'product', 'vendor', 'version', 'full_version'] def __init__(self, **kwargs): self.info = "Information about the installed software" self.__dict__.update((k, v) for k, v in kwargs.items() if k in self.keys) self.properties = [] if 'properties' in kwargs: props = kwargs['properties'] for k, v in props.items(): self.properties.append(OVFProperty(k, **v)) self.transports = kwargs.get('transports', []) self.categories = kwargs.get('categories', {}) # if a property references a non-existing category it will be dropped for prop in self.properties: assert prop.category is None or prop.category in self.categories,\ f"property '{prop.key}' references unknown category '{prop.category}'" @classmethod def from_dict(cls, d): item = cls(**d) return item def xml_item(self): xml_product = ET.Element('{%s}ProductSection' % NS_OVF) for k in self.keys: if hasattr(self, k) and getattr(self, k) is not None: xml_name = to_camel_case(k) xml_product.append(xml_text_element('{%s}%s' % (NS_OVF, xml_name), getattr(self, k))) # append category-less properties first for prop in self.properties: if prop.category is None: xml_product.append(prop.xml_item()) # then go through all categories, and append matching props for cat_id, cat_name in self.categories.items(): xml_product.append(xml_text_element('{%s}Category' % NS_OVF, cat_name)) for prop in self.properties: if prop.category == cat_id: xml_product.append(prop.xml_item()) return xml_product # abstract base class for OVFAnnotation and OVFEula class OVFTextBlock(object): # snake case will be converted to camel case in XML keys = ['info', 'text', 'file'] info_text = "" xml_name = "TextBlock" xml_text_name = "TextBlock" def __init__(self, **kwargs): self.info = "Information about the installed software" self.__dict__.update((k, v) for k, v in kwargs.items() if k in self.keys) if hasattr(self, 'file'): file_name = self.file with open(file_name, 'rt') as f: self.text = f.read() self.file = None @classmethod def from_dict(cls, d): item = cls(**d) return item def _xml_element(self): return ET.Element('{%s}%s' % (NS_OVF, self.xml_name)) def xml_item(self): item = self._xml_element() for k in self.keys: if hasattr(self, k): if k == 'text': xml_name = self.xml_text_name item.append(xml_text_element('{%s}%s' % (NS_OVF, xml_name), getattr(self, k))) elif getattr(self, k) is not None: xml_name = to_camel_case(k) item.append(xml_text_element('{%s}%s' % (NS_OVF, xml_name), getattr(self, k))) return item class OVFAnnotation(OVFTextBlock): info = "Description of the Product" xml_name = "AnnotationSection" xml_text_name = "Annotation" class OVFEula(OVFTextBlock): info = "End User License Agreement" xml_name = "EulaSection" xml_text_name = "License" def _xml_element(self): return ET.Element('{%s}%s' % (NS_OVF, self.xml_name), { '{%s}msgid' % NS_OVF: "eula"}) class OVFConfiguration(object): keys = ['label', 'description', 'default'] def __init__(self, id, **kwargs): self.id = id self.default = False self.info = "Information about the installed software" self.__dict__.update((k, v) for k, v in kwargs.items() if k in self.keys) @classmethod def from_dict(cls, d): item = cls(**d) return item def xml_item(self): attrs = {'{%s}id' % NS_OVF: self.id} if self.default: attrs['{%s}default' % NS_OVF] = "true" elem = ET.Element('{%s}Configuration' % NS_OVF, attrs) elem.append(xml_text_element('{%s}%s' % (NS_OVF, 'Label'), getattr(self, 'label'))) elem.append(xml_text_element('{%s}%s' % (NS_OVF, 'Description'), getattr(self, 'description'))) return elem class VmwExtraConfigItem(object): def __init__(self, key, value, required=None): self.key = key self.value = value self.required = required @classmethod def from_dict(cls, d): item = cls(**d) return item def xml_item(self): value = self.value if type(value) is bool: value = "true" if value else "false" elif type(value) is not str: value = str(value) attrs = {'{%s}key' % NS_VMW: self.key, '{%s}value' % NS_VMW: value} if self.required is not None: attrs['{%s}required' % NS_VMW] = "true" if self.required else "false" elem = ET.Element('{%s}ExtraConfig' % NS_VMW, attrs) return elem class OVF(object): CONFIG_DEFAULTS = { "cpuHotAddEnabled": "false", "cpuHotRemoveEnabled": "false", "memoryHotAddEnabled": "false", "firmware": "bios", "tools.syncTimeWithHost": "false", "tools.afterPowerOn": "true", "tools.afterResume": "true", "tools.beforeGuestShutdown": "true", "tools.beforeGuestStandby": "true", "tools.toolsUpgradePolicy": "manual", "powerOpInfo.powerOffType": "soft", "powerOpInfo.resetType": "soft", "powerOpInfo.suspendType": "hard", "nestedHVEnabled": "false", "virtualICH7MPresent": "false", "virtualSMCPresent": "false", "flags.vvtdEnabled": "false", "flags.vbsEnabled": "false", "bootOptions.efiSecureBootEnabled": "false", "powerOpInfo.standbyAction": "checkpoint" } def __init__(self, system, files, disks, networks, vssd_system, rasd_items, extra_configs, product, annotation, eula, configurations): self.hardware_config = {} if not system.get('no_default_configs', False): self.hardware_config.update(OVF.CONFIG_DEFAULTS) self.name = system['name'] self.os_cim = system.get('os_cim', 100) self.os_vmw = system.get('os_vmw', "other4xLinux64Guest") if 'firmware' in system: if system['firmware'] not in ['bios','efi']: raise ValidationError("os.firmware must be 'bios' or 'efi'") self.hardware_config['firmware'] = system['firmware'] if 'secure_boot' in system: if type(system['secure_boot']) is not bool: raise ValidationError("os.secure_boot must be boolean") self.hardware_config['bootOptions.efiSecureBootEnabled'] = "true" if system['secure_boot'] else "false" self.files = files self.disks = disks self.networks = networks self.vssd_system = vssd_system self.rasd_items = rasd_items self.extra_configs = extra_configs self.product = product self.annotation = annotation self.eula = eula self.configurations = configurations if 'default_configuration' in system: dflt_cfg = system['default_configuration'] self.configurations[dflt_cfg].default = True self.connect() @classmethod def from_dict(cls, config): # search for files and disks in hardware config: files = [] disks = [] product = None annotation = None eula = None assert 'hardware' in config, "config needs a 'hardware' section" hardware = config['hardware'] for hw_id, hw in hardware.items(): if isinstance(hw, dict): if 'image' in hw: file = OVFFile(hw['image']) files.append(file) hw['image'] = file elif 'disk_image' in hw: disk = OVFDisk(hw['disk_image']) disks.append(disk) files.append(disk.file) hw['disk'] = disk elif 'disk_capacity' in hw: disk = OVFEmptyDisk(hw['disk_capacity']) disks.append(disk) hw['disk'] = disk networks = {} if 'networks' in config: for nw_id, nw in config['networks'].items(): network = OVFNetwork.from_dict(nw) networks[nw_id] = network vssd_system = VssdSystem.from_dict(config) rasd_items = cls.rasd_items_from_dict(config) extra_configs = cls.vmw_extra_config_items_from_dict(config) # we want properties in their own section ('environment') # but in OVF they are part of the ProductSection, so copy it if 'environment' in config: env = config['environment'] if 'product' not in config: config['product'] = {} for cfg in ['transports', 'properties', 'categories']: if cfg in env: config['product'][cfg] = env[cfg] if 'product' in config: product = OVFProduct.from_dict(config['product']) if 'annotation' in config: annotation = OVFAnnotation.from_dict(config['annotation']) if 'eula' in config: eula = OVFEula.from_dict(config['eula']) configurations = {} if 'configurations' in config: for k, v in config['configurations'].items(): configurations[k] = OVFConfiguration(k, **v) ovf = cls(config['system'], files, disks, networks, vssd_system, rasd_items, extra_configs, product, annotation, eula, configurations) return ovf @classmethod def rasd_items_from_dict(cls, config): rasd_items = {} hardware = config['hardware'] for hw_id, hw_config in hardware.items(): if hw_id == 'memory': cl_name = "RasdMemory" elif hw_id == 'cpus': cl_name = "RasdCpus" else: hw_type = hw_config['type'] cl_name = "Rasd" + hw_type.title().replace("_", "") try: cl = getattr(sys.modules[__name__], cl_name) rasd_item = cl.from_dict(hw_config) if type(hw_config) is dict: rasd_item.configuration = hw_config.get('configuration', None) rasd_items[hw_id] = rasd_item except AttributeError: print(f"no class {cl_name}") return rasd_items @classmethod def vmw_extra_config_items_from_dict(cls, config): xtra_cfgs = [] xconfigs = config.get('extra_configs', None) if xconfigs is None: return [] for key, cfg in xconfigs.items(): cfg['key'] = key xtra_cfg_item = VmwExtraConfigItem.from_dict(cfg) xtra_cfgs.append(xtra_cfg_item) return xtra_cfgs def connect(self): for hw_id, rasd_item in self.rasd_items.items(): rasd_item.connect(self) @staticmethod def _disk_info(filename): out = subprocess.check_output(["vmdk-convert", "-i", filename]).decode("UTF-8") return json.loads(out) def to_xml(self): envelope = ET.Element('{%s}Envelope' % NS_OVF, nsmap=NS_MAP) # References (files) references = ET.Element('{%s}References' % NS_OVF) for file in self.files: references.append(file.xml_item()) envelope.append(references) # DiskSection disk_section = ET.Element('{%s}DiskSection' % NS_OVF) disk_section.append(xml_text_element('{%s}Info' % NS_OVF, "Virtual disk information")) for disk in self.disks: disk_section.append(disk.xml_item()) envelope.append(disk_section) if self.configurations: dos = ET.Element('{%s}DeploymentOptionSection' % NS_OVF) dos.append(xml_text_element('{%s}Info' % NS_OVF, "List of profiles")) for id, config in self.configurations.items(): dos.append(config.xml_item()) envelope.append(dos) # NetworkSection network_section = ET.Element('{%s}NetworkSection' % NS_OVF) network_section.append(xml_text_element('{%s}Info' % NS_OVF, "Virtual Networks")) for nw_id, nw in self.networks.items(): network_section.append(nw.xml_item()) envelope.append(network_section) # VirtualSystem virtual_system = ET.Element('{%s}VirtualSystem' % NS_OVF, { '{%s}id' % NS_OVF: 'vm' }) virtual_system.append(xml_text_element('{%s}Info' % NS_OVF, "Virtual System")) envelope.append(virtual_system) virtual_system.append(xml_text_element('{%s}Name' % NS_OVF, self.vssd_system.identifier)) oss = ET.Element('{%s}OperatingSystemSection' % NS_OVF, { '{%s}id' % NS_OVF: str(self.os_cim), '{%s}osType' % NS_VMW: self.os_vmw }) oss.append(xml_text_element('{%s}Info' % NS_OVF, "Operating System")) virtual_system.append(oss) if self.product and self.product.transports: transports = " ".join(self.product.transports) hw_attrs = {'{%s}transport' % NS_OVF: transports} else: hw_attrs = None hw = ET.Element('{%s}VirtualHardwareSection' % NS_OVF, hw_attrs) hw.append(xml_text_element('{%s}Info' % NS_OVF, "Virtual Hardware")) virtual_system.append(hw) hw.append(self.vssd_system.xml_item("Virtual Hardware Family")) for hw_id, rasd_item in self.rasd_items.items(): xml_item = rasd_item.xml_item(True, hw_id) # sort rasd elements by tag: xml_item[:] = sorted(xml_item, key=lambda child: child.tag) hw.append(xml_item) for xcfg in self.extra_configs: hw.append(xcfg.xml_item()) for key, val in sorted(self.hardware_config.items()): hw.append(xml_config(key, val)) if self.product: virtual_system.append(self.product.xml_item()) if self.annotation: virtual_system.append(self.annotation.xml_item()) if self.eula: virtual_system.append(self.eula.xml_item()) xml_indent(envelope) doc = ET.ElementTree(envelope) ET.cleanup_namespaces(doc) return doc def write_xml(self, ovf_file=None): if ovf_file == None: ovf_file = f"{self.name}.ovf" doc = self.to_xml() with open(ovf_file, "wb") as f: doc.write(f, pretty_print=True, exclusive=True, xml_declaration=True, encoding="UTF-8") # if you know an easier way to produce a time stamp with the local tz, please fix: timestamp = datetime.datetime.now( datetime.datetime.now(datetime.timezone.utc).astimezone().tzinfo).strftime("%d-%m-%Y %H:%M:%S %z") # ugly hack to insert a comment (there should be a better way) with open(ovf_file, "rt") as f: with open(f"{ovf_file}.tmp", "wt") as fout: line = f.readline() fout.write(line) fout.write(f"<!-- Generated by {APP_NAME} {timestamp} -->\n") for line in f.readlines(): fout.write(line) os.rename(f"{ovf_file}.tmp", ovf_file) @staticmethod def _get_hash(filename, hash_type): hash = hashlib.new(hash_type) with open(filename, "rb") as f: hash.update(f.read()) return hash.hexdigest() def write_manifest(self, ovf_file=None, mf_file=None, hash_type="sha512"): if ovf_file == None: ovf_file = f"{self.name}.ovf" if mf_file == None: mf_file = f"{self.name}.mf" filenames = [ovf_file] for file in self.files: filenames.append(file.path) with open(mf_file, "wt") as f: for fname in filenames: hash = OVF._get_hash(fname, hash_type) fname = os.path.basename(fname) f.write(f"{hash_type.upper()}({fname})= {hash}\n") def usage(): print(f"Usage: {sys.argv[0]} -i|--input-file <input file> -o|--output-file <output file> [--format ova|ovf|dir] [-q] [-h]") print("") print("Options:") print(" -i, --input-file <file> input file") print(" -o, --output-file <file> output file or directory name") print(" -f, --format ova|ovf|dir output format") print(" -m, --manifest create manifest file along with ovf (default true for output formats ova and dir)") print(" --checksum-type sha256|sha512 set the checksum type for the manifest. Must be sha256 or sha512.") print(" -q quiet mode") print(" -h print help") print("") print("Output formats:") print(" ova: create an OVA file") print(" ovf: create OVF file only") print(" dir: create a directory with the OVF file, the manifest and symlinks to the referenced files (hard disk(s) and iso image(s))") print("") print("Specifying the format is optional if the output file name ends with '.ovf' or '.ova'") print("") print("Example usage:") print(f" {sys.argv[0]} -i photon.yaml -o photon.ova") def yaml_param(loader, node): params = loader.app_params default = None key = node.value assert type(key) is str, f"param name must be a string" if '=' in key: key, default = [t.strip() for t in key.split('=', maxsplit=1)] default = yaml.safe_load(default) value = params.get(key, default) assert value is not None, f"no param set for '{key}', and there is no default" return value def main(): config_file = None output_file = None output_format = None basename = None do_quiet = False do_manifest = False params = {} checksum_type = "sha512" try: opts, args = getopt.getopt(sys.argv[1:], 'f:hi:mo:q', longopts=['format=', 'input-file=', 'manifest', 'output-file=', 'param=', 'checksum-type=']) except: print ("invalid option") sys.exit(2) for o, a in opts: if o in ['-i', '--input-file']: config_file = a elif o in ['-o', '--output-file']: output_file = a elif o in ['-f', '--format']: output_format = a elif o in ['-m', '--manifest']: do_manifest = True elif o in ['--checksum-type']: checksum_type = a elif o in ['--param']: k,v = a.split('=', maxsplit=1) params[k] = yaml.safe_load(v) elif o in ['-q']: do_quiet = True elif o in ['-h']: usage() sys.exit(0) else: assert False, f"unhandled option {o}" assert config_file != None, "no input file specified" assert output_file != None, "no output file/directory specified" assert checksum_type in ["sha512", "sha256"], f"checksum-type '{checksum_type}' is invalid" if config_file != None: f = open(config_file, 'r') yaml_loader = yaml.SafeLoader yaml_loader.app_params = params yaml.add_constructor("!param", yaml_param, Loader=yaml_loader) config = yaml.load(f, Loader=yaml_loader) if f != sys.stdin: f.close() ovf = OVF.from_dict(config) if output_format is None: if output_file.endswith(".ova"): # create an ova file output_format = "ova" elif output_file.endswith(".ovf"): # create just ovf (and maybe mf) file output_format = "ovf" assert output_format != None, "no output format specified" assert output_format in ['ova', 'ovf', 'dir'], f"invalid output_format '{output_format}'" if not do_quiet: print (f"creating '{output_file}' with format '{output_format}' from '{config_file}'") if output_format != "dir": basename = os.path.basename(output_file)[:-4] else: basename = os.path.basename(output_file) mf_file = f"{basename}.mf" if output_format == "ovf": ovf_file = output_file ovf.write_xml(ovf_file=ovf_file) if do_manifest: ovf.write_manifest(ovf_file=ovf_file, mf_file=mf_file, hash_type=checksum_type) elif output_format == "ova" or output_format == "dir": pwd = os.getcwd() tmpdir = tempfile.mkdtemp(prefix=f"{basename}-", dir=pwd) try: os.chdir(tmpdir) ovf_file = f"{basename}.ovf" ovf.write_xml(ovf_file=ovf_file) all_files = [ovf_file, mf_file] for file in ovf.files: dst = os.path.basename(file.path) os.symlink(os.path.join(pwd, file.path), dst) all_files.append(dst) ovf.write_manifest(ovf_file=ovf_file, mf_file=mf_file, hash_type=checksum_type) if output_format == "ova": ret = subprocess.check_call(["tar", "--format=ustar", "-h", "--owner=0", "--group=0", "--mode=0644", "-cf", os.path.join(pwd, output_file)] + all_files) os.chdir(pwd) shutil.rmtree(tmpdir) else: os.chdir(pwd) shutil.move(tmpdir, output_file) except Exception as e: os.chdir(pwd) if os.path.isdir(tmpdir): shutil.rmtree(tmpdir) raise e if not do_quiet: print ("done.") if __name__ == "__main__": main() 0707010000000C000081A40000000000000000000000016553B8890000040D000000000000000000000000000000000000001F00000000open-vmdk-0.3.6.0/ova/Makefile# ================================================================================ # Copyright (c) 2014-2023 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. # ================================================================================ EXE=mkova.sh PREFIX ?= /usr all: install: mkdir -p $(DESTDIR)/$(PREFIX)/bin && cp $(EXE) $(DESTDIR)/$(PREFIX)/bin/ [ -f $(DESTDIR)/etc/open-vmdk.conf ] || mkdir -p $(DESTDIR)/etc/ && echo "PREFIX=${PREFIX}" > $(DESTDIR)/etc/open-vmdk.conf 0707010000000D000081ED0000000000000000000000016553B88900001C0D000000000000000000000000000000000000001F00000000open-vmdk-0.3.6.0/ova/mkova.sh#!/bin/bash # ================================================================================ # Copyright (c) 2014-2023 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. # ================================================================================ [ -f /etc/open-vmdk.conf ] && . /etc/open-vmdk.conf [ ! -n "$PREFIX" ] && PREFIX=/usr [ ! -n "$DATADIR" ] && DATADIR=${PREFIX}/share/open-vmdk # default template should be the latest: [ ! -n "$OVFTEMPL" ] && OVFTEMPL=${DATADIR}/template-hw20.ovf [ ! -n "$NUM_CPUS" ] && NUM_CPUS=2 [ ! -n "$MEM_SIZE" ] && MEM_SIZE=1024 [ ! -n "$FIRMWARE" ] && FIRMWARE="efi" usage() { echo "Usage: $0" echo " [-n|--num-cpus <num_cpus>]" echo " [-m|--mem-size <mem_size>]" echo " [-f|--firmware efi|bios]" echo " [--hw <version>]" echo " [--template <path_to_template>]" echo " [--ovf]" echo " ova_name disk1.vmdk [disk2.vmdk [...]]" echo "" echo "Create an OVA template from VMDK files" echo "" echo "Environment variables can be used to change OVA settings:" echo "* NUM_CPUS: The CPU numbers of the OVA template. Default value is 2." echo "* MEM_SIZE: The memory size in MB of the OVA template. Default value is 1024." echo "* FIRMWARE: The firmware of the OVA template: efi or bios. Default value is efi." } OPTS=$(getopt -o n:m:f: --long num-cpus:,mem-size:,firmware:,hw:,template:,ovf -n $0 -- "$@") if [ $? != 0 ] ; then usage echo "Terminating." >&2 exit 1 fi eval set -- "$OPTS" ovftempl=${OVFTEMPL} ovf=false while true; do case "$1" in -n | --num-cpus) NUM_CPUS=${2} ; shift 2 ;; -m | --mem-size) MEM_SIZE=${2} ; shift 2 ;; -f | --firmware) FIRMWARE=${2} ; shift 2 ;; --hw) ovftempl=${DATADIR}/template-hw${2}.ovf ; shift 2 ;; --template) ovftempl=${2} ; shift 2 ;; --ovf) ovf="true" ; shift ;; --) shift; break ;; *) break ;; esac done if [ "$#" -lt 2 ] ; then echo "need at least 2 arguments" >&2 usage echo "Terminating." >&2 exit 1 fi name=$1 shift # for backwards compatibility: if [ "${1: -4}" == ".ovf" ] ; then echo "Specifying the template as an argument is deprecated. Please use the --template or the --hw option." ovftempl=$1 shift fi vmdks=$@ vmdks_num=$# echo "Starting to create ${name}.ova with ${vmdks_num} disk(s) with template ${ovftempl}" echo "Number of CPUs: ${NUM_CPUS}" echo "Memory in MB: ${MEM_SIZE}" echo "Firmware Type: ${FIRMWARE}" for vmdk in $vmdks; do if [ ! -f "$vmdk" ] ; then echo "$vmdk not found" exit 2 fi done if [ ! -f "$ovftempl" ] ; then echo "$ovftempl not found" exit 2 fi hw_version=$(grep "<vssd:VirtualSystemType>" $ovftempl | sed 's#</*vssd:VirtualSystemType>##g' | cut -d '-' -f 2) if [ $hw_version -le 12 ]; then sha_alg=1 elif [ $hw_version -eq 13 ] || [ $hw_version -eq 14 ]; then sha_alg=256 elif [ $hw_version -gt 14 ]; then sha_alg=512 fi # If there are more than one vmdk, we need to know what is the next available instance id for other disks max_id=0 for id in `grep InstanceID $ovftempl | sed 's/[^0-9]*//g'`; do if [ $id -gt $max_id ]; then max_id=$id fi done next_id=$((max_id+1)) # Get vmdk parent id disk_parent_id=`sed -n '/Hard Disk 1/,+3p' $ovftempl | grep Parent | sed 's/[^0-9]*//g'` TMPDIR=$(mktemp -p . -d XXXXXXXX) index=1 for vmdk in $vmdks; do vmdk_name="${name}-disk${index}.vmdk" echo "Adding $vmdk as ${vmdk_name}" cp "$vmdk" $TMPDIR/"${vmdk_name}" vmdk_file_size=$(du -b $TMPDIR/"${vmdk_name}" | cut -f1) echo "$vmdk file size is $vmdk_file_size bytes" vmdk_capacity=$(vmdk-convert -i "$vmdk" | cut -d ',' -f 1 | awk '{print $NF}') echo "$vmdk capacity is $vmdk_capacity bytes" if [ $index -eq 1 ]; then sed ${ovftempl} \ -e "s/@@NAME@@/${name}/g" \ -e "s/@@VMDK_FILE_SIZE@@/$vmdk_file_size/g" \ -e "s/@@VMDK_CAPACITY@@/$vmdk_capacity/g" \ -e "s/@@NUM_CPUS@@/$NUM_CPUS/g" \ -e "s/@@MEM_SIZE@@/$MEM_SIZE/g" \ -e "s/@@FIRMWARE@@/$FIRMWARE/g" \ > $TMPDIR/${name}.ovf else # Insert disk file information for Hard Disk 2, 3, 4, etc last_index=$((index-1)) sed -i \ -e "/${name}-disk${last_index}.vmdk/a \ <File ovf:href=\"${vmdk_name}\" ovf:id=\"file${index}\" ovf:size=\"${vmdk_file_size}\"/>" \ -e "/ovf:fileRef=\"file${last_index}\"/a \ <Disk ovf:capacity=\"${vmdk_capacity}\" ovf:capacityAllocationUnits=\"byte\" ovf:diskId=\"vmdisk${index}\" ovf:fileRef=\"file${index}\" ovf:format=\"http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized\" ovf:populatedSize=\"0\"/>" \ $TMPDIR/"${name}".ovf # Insert hardware item information for Hard Disk 2, 3, 4, etc insert_after=`grep -n '</Item>' $TMPDIR/"${name}".ovf | tail -n 1 | cut -d: -f 1` # There is no scsi0:7, so we need to skip it. if [ $last_index -lt 7 ]; then address_on_parent=$last_index else address_on_parent=$((last_index+1)) fi sed -i -e "${insert_after}a \ <Item>\n\ <rasd:AddressOnParent>${address_on_parent}</rasd:AddressOnParent>\n\ <rasd:ElementName>Hard Disk $index</rasd:ElementName>\n\ <rasd:HostResource>ovf:/disk/vmdisk$index</rasd:HostResource>\n\ <rasd:InstanceID>${next_id}</rasd:InstanceID>\n\ <rasd:Parent>$disk_parent_id</rasd:Parent>\n\ <rasd:ResourceType>17</rasd:ResourceType>\n\ <vmw:Config ovf:required=\"false\" vmw:key=\"backing.writeThrough\" vmw:value=\"false\"/>\n\ </Item>" \ $TMPDIR/"${name}".ovf next_id=$((next_id+1)) fi index=$((index+1)) # Get the sha checksum of the vmdk file echo "SHA${sha_alg}($vmdk_name)= $(sha${sha_alg}sum $TMPDIR/${vmdk_name} | cut -d' ' -f1)" >> $TMPDIR/${name}.mf done # Get the sha checksum of the ovf file echo "SHA${sha_alg}(${name}.ovf)= $(sha${sha_alg}sum $TMPDIR/${name}.ovf | cut -d' ' -f1)" >> $TMPDIR/${name}.mf if [ ${ovf} == "true" ] ; then if [ -d ${name} ] ; then echo "directory ${name} exists" >&2 echo "Terminating." >&2 exit 3 fi mv $TMPDIR ${name} echo "Completed to create ovf files in directory ${name}" else pushd $TMPDIR tar --format=ustar -cf ../${name}.ova *.ovf *.mf *.vmdk popd echo "Completed to create ${name}.ova" rm -rf $TMPDIR fi 0707010000000E000041ED0000000000000000000000026553B88900000000000000000000000000000000000000000000001600000000open-vmdk-0.3.6.0/ovf0707010000000F000081ED0000000000000000000000016553B889000038E0000000000000000000000000000000000000001F00000000open-vmdk-0.3.6.0/ovf/mkovf.py#! /usr/bin/python3 # Copyright (c) 2014-2023 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. import json import os.path import subprocess import sys import xml.etree.ElementTree class VMConfig: def __init__(self, dirname): self.dirname = dirname self.config = dict() def getString(self, default, name): return self.config.get(name.lower(), default) def get(self, name): return self.getString(None, name) def getBool(self, default, name): v = self.get(name) if v is not None: v = v.lower() if v in ["", "t", "true", "y", "yes", "on", "1"]: return True if v in ["f", "false", "n", "no", "off", "0"]: return False return default def getInt(self, default, name): v = self.get(name) if v is not None: try: return int(v) except: pass return default def dump(self): for k, v in self.config.items(): print("%s => %s" % (k, v)) def getPath(self, path): if os.path.isabs(path): return path return os.path.join(self.dirname, path) def unescape(value): ret = bytearray() state = None for c in bytearray(value, 'utf-8'): if state is None: if c == ord('|'): state = bytearray() else: ret.append(c) continue state.append(c) if c not in b"0123456789ABCDEFabcdef": ret += "|" ret += state state = None continue if len(state) < 2: continue ret.append(int(state, 16)) state = None if state is not None: ret.append(ord('|')) ret += state return ret.decode("utf-8") def parseLine(line): name = '' value = '' state = 0 for c in line: if state == 0: if c in [' ', '\t']: continue state = 1 if state == 1: if c not in [' ', '\t', '#', '=', '\n', '\r']: name += c continue if not name: return None state = 2 if state == 2: if c in [' ', '\t']: continue if c not in ['=']: return None state = 4 continue if state == 4: if c in [' ', '\t']: continue if c == '"': state = 105 continue else: state = 5 if state == 5: if c not in [' ', '\t', '#', '\n', '\r']: value += c continue state = 6 if state == 6: if c in [' ', '\t']: continue if c not in ['#', '\r', '\n']: return None state = 7 break if state == 105: if c != '"': value += c continue state = 6 continue return None # State will be 4 for 'xxx = ' # State will be 5 for 'xxx = yyy' # State will be 6 for 'xxx = yyy ' # State will be 7 for 'xxx = yyy #' if state not in [ 4, 5, 6, 7 ]: return None return [ name, unescape(value) ] def parseConfig(dirname, f): vmc = VMConfig(dirname) for line in f.readlines(): r = parseLine(line) if r is not None: vmc.config[r[0].lower()] = r[1] return vmc class Disks: def __init__(self, vmc): self.vmc = vmc self.disks = dict() self.getDisks() def dump(self): for k, v in self.disks.items(): print("%s => %s" % (k, v)) def getDisksDisk(self, device): if self.vmc.getBool(False, "%s.present" % device): self.disks[device] = [ self.vmc.get("%s.fileName" % device), None, None, None ] def getDisksAdapter(self, adapter, maxDevice): if self.vmc.getBool(False, "%s.present" % adapter): for i in range(0, maxDevice): self.getDisksDisk("%s:%u" % (adapter, i)) def getDisksAdapters(self, adapter, maxAdapter, maxDevice): for i in range(0, maxAdapter): self.getDisksAdapter("%s%u" % (adapter, i), maxDevice) def getDisks(self): self.getDisksAdapters("scsi", 4, 256) self.getDisksAdapters("ide", 2, 2) self.getDisksAdapters("sata", 4, 30) ''' static int writeXML(FILE *f, const char *v) { const char *p = v; int c; while ((c = *v) != 0) { const char *spec; switch (c) { case '&': spec = "&"; break; case '"': spec = """; break; case '\'': spec = "'"; break; case '<': spec = "<"; break; case '>': spec = ">"; break; default: spec = NULL; break; } if (spec) { if (p != v) { if (fwrite(p, 1, v - p, f) != v - p) { return -1; } p = v + 1; } if (fwrite(spec, 1, strlen(spec), f) != strlen(spec)) { return -1; } } v++; } if (p != v) { if (fwrite(p, 1, v - p, f) != v - p) { return -1; } } return 0; } ''' NS_CIM = "http://schemas.dmtf.org/wbem/wscim/1/common" NS_OVF = "http://schemas.dmtf.org/ovf/envelope/1" NS_RASD = "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" NS_VMW = "http://www.vmware.com/schema/ovf" NS_VSSD = "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" NS_XSI = "http://www.w3.org/2001/XMLSchema-instance" def indent(elem, level=0): i = "\n" + level*" " if len(elem): if not elem.text or not elem.text.strip(): elem.text = i + " " if not elem.tail or not elem.tail.strip(): elem.tail = i for elem in elem: indent(elem, level+1) if not elem.tail or not elem.tail.strip(): elem.tail = i def newTextElement(tag, value): elem = xml.etree.ElementTree.Element(tag) elem.text = value return elem def rasdElement(item, tag, value): item.append(newTextElement("{%s}%s" % (NS_RASD, tag), str(value))) def addConfigVal(vmc, hw, ovfKey, val): if val is not None: el = xml.etree.ElementTree.Element('{%s}Config' % NS_VMW, { '{%s}required' % NS_OVF: 'false', '{%s}key' % NS_VMW: ovfKey, '{%s}value' % NS_VMW: val}) hw.append(el) def addConfig(vmc, hw, ovfKey, vmxKey): addConfigVal(vmc, hw, ovfKey, vmc.getString(None, vmxKey)) instanceId = 0 def addItem(parent, required, elementName, resourceType): global instanceId attrs = {} if not required: attrs["{%s}required" % NS_OVF] = 'false' item = xml.etree.ElementTree.Element('{%s}Item' % NS_OVF, attrs) rasdElement(item, 'ResourceType', resourceType) instanceId += 1 rasdElement(item, 'InstanceID', instanceId) rasdElement(item, 'ElementName', elementName) parent.append(item) return item def writeXMLFile(f, vmc, disks): xml.etree.ElementTree.register_namespace("cim", NS_CIM) xml.etree.ElementTree.register_namespace("ovf", NS_OVF) xml.etree.ElementTree.register_namespace("rasd", NS_RASD) xml.etree.ElementTree.register_namespace("vmw", NS_VMW) xml.etree.ElementTree.register_namespace("vssd", NS_VSSD) xml.etree.ElementTree.register_namespace("xsi", NS_XSI) envelope = xml.etree.ElementTree.Element('{%s}Envelope' % NS_OVF) files = [] for disk in disks.disks.values(): files.append(xml.etree.ElementTree.Element('{%s}File' % NS_OVF, { '{%s}href' % NS_OVF: disk[1], '{%s}id' % NS_OVF: disk[2], '{%s}size' % NS_OVF: str(os.stat(disk[1]).st_size) })) if files: references = xml.etree.ElementTree.Element('{%s}References' % NS_OVF) references.extend(files) envelope.append(references) dsk = [] for disk in disks.disks.values(): dsk.append(xml.etree.ElementTree.Element('{%s}Disk' % NS_OVF, { '{%s}capacity' % NS_OVF: str(disk[3]["capacity"] // 512), '{%s}capacityAllocationUnits' % NS_OVF: 'byte * 2^9', '{%s}diskId' % NS_OVF: disk[2], '{%s}fileRef' % NS_OVF: disk[2], '{%s}format' % NS_OVF: 'http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized', '{%s}populatedSize' % NS_OVF: str(disk[3]["used"]) })) if dsk: diskSection = xml.etree.ElementTree.Element('{%s}DiskSection' % NS_OVF) diskSection.extend(dsk) envelope.append(diskSection) virtualSystem = xml.etree.ElementTree.Element('{%s}VirtualSystem' % NS_OVF, { '{%s}id' % NS_OVF: 'vm' }) envelope.append(virtualSystem) virtualSystem.append(newTextElement('{%s}Name' % NS_OVF, vmc.getString('Unknown', 'displayName'))) oss = xml.etree.ElementTree.Element('{%s}OperatingSystemSection' % NS_OVF, { '{%s}id' % NS_OVF: 'os', '{%s}osType' % NS_VMW: '*other26xLinux64Guest' }) virtualSystem.append(oss) hw = xml.etree.ElementTree.Element('{%s}VirtualHardwareSection' % NS_OVF) virtualSystem.append(hw) system = xml.etree.ElementTree.Element('{%s}System' % NS_OVF) system.append(newTextElement('{%s}ElementName' % NS_VSSD, 'Virtual Hardware Family')) system.append(newTextElement('{%s}InstanceID' % NS_VSSD, '0')) system.append(newTextElement('{%s}VirtualSystemIdentifier' % NS_VSSD, vmc.getString('Unknown', 'displayName'))) system.append(newTextElement('{%s}VirtualSystemType' % NS_VSSD, 'vmx-%02u' % vmc.getInt(4, 'virtualHW.version'))) hw.append(system) cpus = addItem(hw, True, 'cpu', 3) cpus.append(newTextElement('{%s}AllocationUnits' % NS_RASD, 'hertz * 10^6')) cpus.append(newTextElement('{%s}VirtualQuantity' % NS_RASD, "%s" % vmc.getInt(1, 'numvcpus'))) memory = addItem(hw, True, 'memory', 4) rasdElement(memory, 'AllocationUnits', 'byte * 2^20') rasdElement(memory, 'VirtualQuantity', vmc.getInt(4, 'memsize')) if (vmc.getBool(False, 'usb.present')): # Note that this serialization is incorrect, but that is what OVFTool does... usb = addItem(hw, False, 'usb', 23) rasdElement(usb, 'Address', 0) rasdElement(usb, 'ResourceSubType', 'vmware.usb.ehci') addConfigVal(vmc, usb, 'ehciEnabled', 'true') for i in range(0, 4): aname = "scsi%u" % i if vmc.getBool(False, "%s.present" % aname): ctlr = addItem(hw, True, aname, 6) ctlrId = instanceId rasdElement(ctlr, 'Address', i) rasdElement(ctlr, 'ResourceSubType', 'VirtualSCSI') for d in range(0, 256): dname = "%s:%u" % (aname, d) if vmc.getBool(False, "%s.present" % dname): dd = disks.disks[dname] dsk = addItem(hw, True, dname, 17) rasdElement(dsk, 'AddressOnParent', d) rasdElement(dsk, 'HostResource', "ovf:/disk/%s" % dd[2]) rasdElement(dsk, 'Parent', ctlrId) if vmc.getBool(False, "vmci0.present"): vmci = addItem(hw, False, 'vmci', 1) rasdElement(vmci, 'AutomaticAllocation', 'false') rasdElement(vmci, 'ResourceSubType', 'vmware.vmci') nets = {} for i in range(0, 10): aname = "ethernet%u" % i if vmc.getBool(False, "%s.present" % aname): nname = vmc.getString(None, "%s.dvs.switchId" % aname) if nname is None: nname = vmc.getString(None, "%s.networkName" % aname) if nname is None: nname = vmc.getString(None, "%s.connectionType" % aname) if nname is None: cname = "dummy" else: cname = "C%s" % nname.lower() else: cname = "N%s" % nname.lower() else: cname = "D%s" % nname.lower() network = nets.get(cname) if network is None: ovfname = "net%u" % len(nets) net = xml.etree.ElementTree.Element('{%s}Network' % NS_OVF, { '{%s}name' % NS_OVF: ovfname }) net.append(newTextElement('{%s}Description' % NS_OVF, nname)) network = [ ovfname, net ] nets[cname] = network nic = addItem(hw, True, aname, 10) rasdElement(nic, 'AddressOnParent', i + 2) rasdElement(nic, 'AutomaticAllocation', 'true') rasdElement(nic, 'Connection', network[0]) rasdElement(nic, 'ResourceSubType', 'VmxNet3') if nets: ns = xml.etree.ElementTree.Element('{%s}NetworkSection' % NS_OVF) for x in nets.values(): ns.append(x[1]) hw.append(ns) svga = addItem(hw, False, 'video', 24) rasdElement(svga, 'AutomaticAllocation', 'false') addConfig(vmc, hw, 'powerOpInfo.powerOffType', 'powerType.powerOff') addConfig(vmc, hw, 'powerOpInfo.resetType', 'powerType.reset') addConfig(vmc, hw, 'powerOpInfo.suspendType', 'powerType.suspend') indent(envelope) doc = xml.etree.ElementTree.ElementTree(envelope) doc.write(f, "unicode", True, "http://schemas.dmtf.org/ovf/envelope/1", "xml") def convertDisks(disks): seq = 0 for k, v in disks.disks.items(): src = disks.vmc.getPath(v[0]) dst = "disk%u.vmdk" % seq v[1] = dst v[2] = "file%u" % seq subprocess.check_call(["../build/vmdk/mkdisk", src, dst]) out = subprocess.check_output(["../build/vmdk/mkdisk", "-i", src]).decode("UTF-8") if out.startswith("//OK"): v[3] = json.loads(out[4:]) seq += 1 def main(): with open(sys.argv[1], "r") as f: vmc = parseConfig(os.path.dirname(sys.argv[1]), f) disks = Disks(vmc) #vmc.dump() #disks.dump() convertDisks(disks) writeXMLFile(sys.stdout, vmc, disks) main() 07070100000010000041ED0000000000000000000000026553B88900000000000000000000000000000000000000000000001900000000open-vmdk-0.3.6.0/pytest07070100000011000041ED0000000000000000000000026553B88900000000000000000000000000000000000000000000002100000000open-vmdk-0.3.6.0/pytest/configs07070100000012000081A40000000000000000000000016553B8890000027F000000000000000000000000000000000000002C00000000open-vmdk-0.3.6.0/pytest/configs/basic.yamlsystem: name: minimal type: vmx-14 vmx-20 os_vmw: vmw.vmwarePhoton64Guest networks: vm_network: name: "None" description: "The None network" hardware: cpus: 2 memory: type: memory size: 4096 sata1: type: sata_controller cdrom1: type: cd_drive parent: sata1 rootdisk: type: hard_disk parent: sata1 disk_image: dummy.vmdk usb1: type: usb_controller ethernet1: type: ethernet subtype: VmxNet3 network: vm_network videocard1: type: video_card vmci1: type: vmci 07070100000013000081A40000000000000000000000016553B889000001C8000000000000000000000000000000000000003700000000open-vmdk-0.3.6.0/pytest/configs/basic_no_network.yamlsystem: name: minimal type: vmx-14 vmx-20 os_vmw: vmwarePhoton64Guest hardware: cpus: 2 memory: type: memory size: 4096 sata1: type: sata_controller cdrom1: type: cd_drive parent: sata1 rootdisk: type: hard_disk parent: sata1 disk_image: dummy.vmdk usb1: type: usb_controller videocard1: type: video_card vmci1: type: vmci 07070100000014000081A40000000000000000000000016553B889000005BE000000000000000000000000000000000000003400000000open-vmdk-0.3.6.0/pytest/configs/configuration.yamlsystem: name: minimal type: vmx-14 vmx-20 os_vmw: vmwarePhoton64Guest default_configuration: grande networks: vm_network: name: "None" description: "The None network" hardware: cpus: 2 memory_tall: type: memory size: 2048 configuration: tall memory_grande: type: memory size: 4096 configuration: grande memory_venti: type: memory size: 8192 configuration: venti sata1: type: sata_controller cdrom1: type: cd_drive parent: sata1 rootdisk: type: hard_disk parent: sata1 disk_image: dummy.vmdk homedisk_tall: type: hard_disk parent: sata1 disk_capacity: 10000 configuration: tall homedisk_grande: type: hard_disk parent: sata1 disk_capacity: 20000 configuration: grande homedisk_venti: type: hard_disk parent: sata1 disk_capacity: 40000 configuration: venti usb1: type: usb_controller ethernet1: type: ethernet subtype: VmxNet3 network: vm_network videocard1: type: video_card vmci1: type: vmci configurations: tall: label: Tall description: too little for the money grande: label: Grande description: just right venti: label: Venti description: too much07070100000015000081A40000000000000000000000016553B889000004A4000000000000000000000000000000000000003200000000open-vmdk-0.3.6.0/pytest/configs/environment.yamlsystem: name: minimal type: vmx-14 vmx-20 os_vmw: vmwarePhoton64Guest networks: vm_network: name: "None" description: "The None network" hardware: cpus: 2 memory: type: memory size: 4096 sata1: type: sata_controller cdrom1: type: cd_drive parent: sata1 rootdisk: type: hard_disk parent: sata1 disk_image: dummy.vmdk usb1: type: usb_controller ethernet1: type: ethernet subtype: VmxNet3 network: vm_network videocard1: type: video_card vmci1: type: vmci environment: transports: - iso - com.vmware.guestInfo categories: some: Some Properties properties: prop.int: user_configurable: true type: uint16 value: '50000' description: "an unsigned integer" label: "integer" category: some prop.string: user_configurable: true type: string value: 'a string' description: "a string, yo" label: "string" category: some 07070100000016000081A40000000000000000000000016553B889000003AE000000000000000000000000000000000000003400000000open-vmdk-0.3.6.0/pytest/configs/extra_configs.yamlsystem: name: minimal type: vmx-14 vmx-20 os_vmw: vmwarePhoton64Guest networks: vm_network: name: "None" description: "The None network" hardware: cpus: 2 memory: type: memory size: 4096 sata1: type: sata_controller cdrom1: type: cd_drive parent: sata1 rootdisk: type: hard_disk parent: sata1 disk_image: dummy.vmdk usb1: type: usb_controller ethernet1: type: ethernet subtype: VmxNet3 network: vm_network videocard1: type: video_card vmci1: type: vmci extra_configs: type.boolean: required: false value: true type.int: value: 2048000 type.string: value: "foo bar" is_required: value: 1 required: true not_required: value: 2 required: false no_required: value: 3 07070100000017000081A40000000000000000000000016553B889000002BB000000000000000000000000000000000000002E00000000open-vmdk-0.3.6.0/pytest/configs/product.yamlsystem: name: minimal type: vmx-14 vmx-20 os_vmw: vmwarePhoton64Guest networks: vm_network: name: "None" description: "The None network" hardware: cpus: 2 memory: type: memory size: 4096 sata1: type: sata_controller cdrom1: type: cd_drive parent: sata1 rootdisk: type: hard_disk parent: sata1 disk_image: dummy.vmdk usb1: type: usb_controller ethernet1: type: ethernet subtype: VmxNet3 network: vm_network videocard1: type: video_card vmci1: type: vmci product: product: An Example VM vendor: A Company Inc. 07070100000018000081A40000000000000000000000016553B88900000B18000000000000000000000000000000000000002900000000open-vmdk-0.3.6.0/pytest/test_configs.py# Copyright (c) 2023 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. import glob import os import pytest import shutil import subprocess import yaml import xmltodict THIS_DIR = os.path.dirname(os.path.abspath(__file__)) OVA_COMPOSE = os.path.join(THIS_DIR, "..", "ova-compose", "ova-compose.py") VMDK_CONVERT=os.path.join(THIS_DIR, "..", "build", "vmdk", "vmdk-convert") CONFIG_DIR=os.path.join(THIS_DIR, "configs") WORK_DIR=os.path.join(os.getcwd(), "pytest-tmp") @pytest.fixture(scope='module', autouse=True) def setup_test(): os.makedirs(WORK_DIR, exist_ok=True) process = subprocess.run(["dd", "if=/dev/zero", "of=dummy.img", "bs=1024", "count=1024"], cwd=WORK_DIR) assert process.returncode == 0 process = subprocess.run([VMDK_CONVERT, "dummy.img", "dummy.vmdk"], cwd=WORK_DIR) assert process.returncode == 0 yield shutil.rmtree(WORK_DIR) @pytest.mark.parametrize("in_yaml", glob.glob(os.path.join(CONFIG_DIR, "*.yaml"))) def test_configs(in_yaml): basename = os.path.basename(in_yaml.rsplit(".", 1)[0]) out_ovf = os.path.join(WORK_DIR, f"{basename}.ovf") process = subprocess.run([OVA_COMPOSE, "-i", in_yaml, "-o", out_ovf], cwd=WORK_DIR) assert process.returncode == 0 with open(in_yaml) as f: yaml_loader = yaml.SafeLoader config = yaml.load(f, Loader=yaml_loader) with open(out_ovf) as f: ovf = xmltodict.parse(f.read()) cfg_system = config['system'] assert cfg_system['name'] == ovf['ovf:Envelope']['ovf:VirtualSystem']['ovf:Name'] assert cfg_system['os_vmw'] == ovf['ovf:Envelope']['ovf:VirtualSystem']['ovf:OperatingSystemSection']['@vmw:osType'] assert cfg_system['type'] == ovf['ovf:Envelope']['ovf:VirtualSystem']['ovf:VirtualHardwareSection']['ovf:System']['vssd:VirtualSystemType'] vmw_configs = ovf['ovf:Envelope']['ovf:VirtualSystem']['ovf:VirtualHardwareSection']['vmw:Config'] # TODO: check if default is set to bios unless no_default_configs is set if 'firmware' in cfg_system: firmware = None if type(vmw_configs) == list: for vmw_config in vmw_configs: if vmw_config['@vmw:key'] == "firmware": firmware = vmw_config['@vmw:value'] assert cfg_system['firmware'] == firmware 07070100000019000081A40000000000000000000000016553B88900000E85000000000000000000000000000000000000002A00000000open-vmdk-0.3.6.0/pytest/test_manifest.py# Copyright (c) 2023 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. import glob import hashlib import os import pytest import shutil import subprocess import yaml import xmltodict THIS_DIR = os.path.dirname(os.path.abspath(__file__)) OVA_COMPOSE = os.path.join(THIS_DIR, "..", "ova-compose", "ova-compose.py") VMDK_CONVERT=os.path.join(THIS_DIR, "..", "build", "vmdk", "vmdk-convert") CONFIG_DIR=os.path.join(THIS_DIR, "configs") WORK_DIR=os.path.join(os.getcwd(), "pytest-tmp") @pytest.fixture(scope='module', autouse=True) def setup_test(): os.makedirs(WORK_DIR, exist_ok=True) process = subprocess.run(["dd", "if=/dev/zero", "of=dummy.img", "bs=1024", "count=1024"], cwd=WORK_DIR) assert process.returncode == 0 process = subprocess.run([VMDK_CONVERT, "dummy.img", "dummy.vmdk"], cwd=WORK_DIR) assert process.returncode == 0 yield shutil.rmtree(WORK_DIR) def check_mf(mf_path, hash_type, work_dir=WORK_DIR): with open(mf_path, "rt") as f: for line in f: left, hash_mf = line.split("=") hash_mf = hash_mf.strip() assert left.startswith(hash_type.upper()) filename = left[len(hash_type):].strip("()") hash = hashlib.new(hash_type) with open(os.path.join(work_dir, filename), "rb") as f: hash.update(f.read()) assert hash.hexdigest() == hash_mf @pytest.mark.parametrize("hash_type", [None, "sha256", "sha512"]) def test_ovf_manifest(hash_type): in_yaml = os.path.join(CONFIG_DIR, "basic.yaml") basename = os.path.basename(in_yaml.rsplit(".", 1)[0]) out_ovf = os.path.join(WORK_DIR, f"{basename}.ovf") out_mf = os.path.join(WORK_DIR, f"{basename}.mf") args = [OVA_COMPOSE, "-i", in_yaml, "-o", out_ovf, "-m"] if hash_type is not None: args += ["--checksum-type", hash_type] else: hash_type = "sha512" process = subprocess.run(args, cwd=WORK_DIR) assert process.returncode == 0 assert os.path.isfile(out_mf) check_mf(out_mf, hash_type) @pytest.mark.parametrize("hash_type", [None, "sha256", "sha512"]) def test_ova_manifest(hash_type): in_yaml = os.path.join(CONFIG_DIR, "basic.yaml") basename = os.path.basename(in_yaml.rsplit(".", 1)[0]) out_ova = os.path.join(WORK_DIR, f"{basename}.ova") out_mf = os.path.join(WORK_DIR, f"{basename}.mf") args = [OVA_COMPOSE, "-i", in_yaml, "-o", out_ova] if hash_type is not None: args += ["--checksum-type", hash_type] else: hash_type = "sha512" process = subprocess.run(args, cwd=WORK_DIR) assert process.returncode == 0 subprocess.run(["tar", "xf", out_ova], cwd=WORK_DIR) check_mf(out_mf, hash_type) def test_manifest_invalid_checksum_type(): in_yaml = os.path.join(CONFIG_DIR, "basic.yaml") basename = os.path.basename(in_yaml.rsplit(".", 1)[0]) out_ovf = os.path.join(WORK_DIR, f"{basename}.ovf") out_mf = os.path.join(WORK_DIR, f"{basename}.mf") args = [OVA_COMPOSE, "-i", in_yaml, "-o", out_ovf, "-m", "--checksum-type", "foobar"] process = subprocess.run(args, cwd=WORK_DIR) assert process.returncode != 0 0707010000001A000041ED0000000000000000000000026553B88900000000000000000000000000000000000000000000001C00000000open-vmdk-0.3.6.0/templates0707010000001B000081A40000000000000000000000016553B8890000039F000000000000000000000000000000000000002500000000open-vmdk-0.3.6.0/templates/Makefile# ================================================================================ # Copyright (c) 2014-2023 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. # ================================================================================ PREFIX ?= /usr DATADIR ?= $(PREFIX)/share/open-vmdk all: install: mkdir -p $(DESTDIR)/$(DATADIR)/ && cp *.ovf $(DESTDIR)/$(DATADIR) 0707010000001C000081A40000000000000000000000016553B889000023C3000000000000000000000000000000000000002E00000000open-vmdk-0.3.6.0/templates/template-hw10.ovf<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (c) 2018-2023 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. --> <!--Generated by VMware ESX Server, User: root, UTC time: 2014-12-01T17:32:47.473957Z--> <Envelope vmw:buildId="build-1474528" xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <References> <File ovf:href="@@NAME@@-disk1.vmdk" ovf:id="file1" ovf:size="@@VMDK_FILE_SIZE@@"/> </References> <DiskSection> <Info>Virtual disk information</Info> <Disk ovf:capacity="@@VMDK_CAPACITY@@" ovf:capacityAllocationUnits="byte" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" ovf:populatedSize="0"/> </DiskSection> <NetworkSection> <Info>The list of logical networks</Info> <Network ovf:name="VM Network"> <Description>The VM Network network</Description> </Network> </NetworkSection> <VirtualSystem ovf:id="@@NAME@@"> <Info>A virtual machine</Info> <Name>@@NAME@@</Name> <OperatingSystemSection ovf:id="100" vmw:osType="other3xLinux64Guest"> <Info>The kind of installed guest operating system</Info> </OperatingSystemSection> <VirtualHardwareSection> <Info>Virtual hardware requirements</Info> <System> <vssd:ElementName>Virtual Hardware Family</vssd:ElementName> <vssd:InstanceID>0</vssd:InstanceID> <vssd:VirtualSystemIdentifier>@@NAME@@</vssd:VirtualSystemIdentifier> <vssd:VirtualSystemType>vmx-10</vssd:VirtualSystemType> </System> <Item> <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits> <rasd:Description>Number of Virtual CPUs</rasd:Description> <rasd:ElementName>@@NUM_CPUS@@ virtual CPU(s)</rasd:ElementName> <rasd:InstanceID>1</rasd:InstanceID> <rasd:ResourceType>3</rasd:ResourceType> <rasd:VirtualQuantity>@@NUM_CPUS@@</rasd:VirtualQuantity> </Item> <Item> <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits> <rasd:Description>Memory Size</rasd:Description> <rasd:ElementName>@@MEM_SIZE@@MB of memory</rasd:ElementName> <rasd:InstanceID>2</rasd:InstanceID> <rasd:ResourceType>4</rasd:ResourceType> <rasd:VirtualQuantity>@@MEM_SIZE@@</rasd:VirtualQuantity> </Item> <Item> <rasd:Address>0</rasd:Address> <rasd:Description>SCSI Controller</rasd:Description> <rasd:ElementName>SCSI Controller 0</rasd:ElementName> <rasd:InstanceID>3</rasd:InstanceID> <rasd:ResourceSubType>VirtualSCSI</rasd:ResourceSubType> <rasd:ResourceType>6</rasd:ResourceType> </Item> <Item> <rasd:Address>1</rasd:Address> <rasd:Description>IDE Controller</rasd:Description> <rasd:ElementName>VirtualIDEController 1</rasd:ElementName> <rasd:InstanceID>4</rasd:InstanceID> <rasd:ResourceType>5</rasd:ResourceType> </Item> <Item> <rasd:Address>0</rasd:Address> <rasd:Description>IDE Controller</rasd:Description> <rasd:ElementName>VirtualIDEController 0</rasd:ElementName> <rasd:InstanceID>5</rasd:InstanceID> <rasd:ResourceType>5</rasd:ResourceType> </Item> <Item ovf:required="false"> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>VirtualVideoCard</rasd:ElementName> <rasd:InstanceID>6</rasd:InstanceID> <rasd:ResourceType>24</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="enable3DSupport" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="enableMPTSupport" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="use3dRenderer" vmw:value="automatic"/> <vmw:Config ovf:required="false" vmw:key="useAutoDetect" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="videoRamSizeInKB" vmw:value="4096"/> </Item> <Item ovf:required="false"> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>VirtualVMCIDevice</rasd:ElementName> <rasd:InstanceID>7</rasd:InstanceID> <rasd:ResourceSubType>vmware.vmci</rasd:ResourceSubType> <rasd:ResourceType>1</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="allowUnrestrictedCommunication" vmw:value="false"/> </Item> <Item ovf:required="false"> <rasd:AddressOnParent>0</rasd:AddressOnParent> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>CD-ROM 1</rasd:ElementName> <rasd:InstanceID>8</rasd:InstanceID> <rasd:Parent>4</rasd:Parent> <rasd:ResourceSubType>vmware.cdrom.remotepassthrough</rasd:ResourceSubType> <rasd:ResourceType>15</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="backing.exclusive" vmw:value="false"/> </Item> <Item> <rasd:AddressOnParent>0</rasd:AddressOnParent> <rasd:ElementName>Hard Disk 1</rasd:ElementName> <rasd:HostResource>ovf:/disk/vmdisk1</rasd:HostResource> <rasd:InstanceID>9</rasd:InstanceID> <rasd:Parent>3</rasd:Parent> <rasd:ResourceType>17</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="backing.writeThrough" vmw:value="false"/> </Item> <Item ovf:required="false"> <rasd:AddressOnParent>0</rasd:AddressOnParent> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:Description>Floppy Drive</rasd:Description> <rasd:ElementName>Floppy 1</rasd:ElementName> <rasd:InstanceID>10</rasd:InstanceID> <rasd:ResourceSubType>vmware.floppy.remotedevice</rasd:ResourceSubType> <rasd:ResourceType>14</rasd:ResourceType> </Item> <Item> <rasd:AddressOnParent>7</rasd:AddressOnParent> <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation> <rasd:Connection>VM Network</rasd:Connection> <rasd:Description>VmxNet3 ethernet adapter on "VM Network"</rasd:Description> <rasd:ElementName>Ethernet 1</rasd:ElementName> <rasd:InstanceID>11</rasd:InstanceID> <rasd:ResourceSubType>VmxNet3</rasd:ResourceSubType> <rasd:ResourceType>10</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="wakeOnLanEnabled" vmw:value="true"/> </Item> <vmw:Config ovf:required="false" vmw:key="cpuHotAddEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="cpuHotRemoveEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="firmware" vmw:value="bios"/> <vmw:Config ovf:required="false" vmw:key="virtualICH7MPresent" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="virtualSMCPresent" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="memoryHotAddEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="nestedHVEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.powerOffType" vmw:value="preset"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.resetType" vmw:value="preset"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.standbyAction" vmw:value="checkpoint"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.suspendType" vmw:value="preset"/> <vmw:Config ovf:required="false" vmw:key="tools.afterPowerOn" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.afterResume" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestShutdown" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestStandby" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.syncTimeWithHost" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="tools.toolsUpgradePolicy" vmw:value="manual"/> </VirtualHardwareSection> </VirtualSystem> </Envelope> 0707010000001D000081A40000000000000000000000016553B88900002277000000000000000000000000000000000000002E00000000open-vmdk-0.3.6.0/templates/template-hw11.ovf<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (c) 2018-2023 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. --> <!--Generated by VMware ESX Server, User: root, UTC time: 2018-03-27T06:17:57.910741Z--> <Envelope vmw:buildId="build-2494585" xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <References> <File ovf:href="@@NAME@@-disk1.vmdk" ovf:id="file1" ovf:size="@@VMDK_FILE_SIZE@@"/> </References> <DiskSection> <Info>Virtual disk information</Info> <Disk ovf:capacity="@@VMDK_CAPACITY@@" ovf:capacityAllocationUnits="byte" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" ovf:populatedSize="0"/> </DiskSection> <NetworkSection> <Info>The list of logical networks</Info> <Network ovf:name="VM Network"> <Description>The VM Network network</Description> </Network> </NetworkSection> <VirtualSystem ovf:id="@@NAME@@"> <Info>A virtual machine</Info> <Name>@@NAME@@</Name> <OperatingSystemSection ovf:id="100" vmw:osType="other3xLinux64Guest"> <Info>The kind of installed guest operating system</Info> </OperatingSystemSection> <VirtualHardwareSection> <Info>Virtual hardware requirements</Info> <System> <vssd:ElementName>Virtual Hardware Family</vssd:ElementName> <vssd:InstanceID>0</vssd:InstanceID> <vssd:VirtualSystemIdentifier>@@NAME@@</vssd:VirtualSystemIdentifier> <vssd:VirtualSystemType>vmx-11</vssd:VirtualSystemType> </System> <Item> <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits> <rasd:Description>Number of Virtual CPUs</rasd:Description> <rasd:ElementName>@@NUM_CPUS@@ virtual CPU(s)</rasd:ElementName> <rasd:InstanceID>1</rasd:InstanceID> <rasd:ResourceType>3</rasd:ResourceType> <rasd:VirtualQuantity>@@NUM_CPUS@@</rasd:VirtualQuantity> </Item> <Item> <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits> <rasd:Description>Memory Size</rasd:Description> <rasd:ElementName>@@MEM_SIZE@@MB of memory</rasd:ElementName> <rasd:InstanceID>2</rasd:InstanceID> <rasd:ResourceType>4</rasd:ResourceType> <rasd:VirtualQuantity>@@MEM_SIZE@@</rasd:VirtualQuantity> </Item> <Item> <rasd:Address>0</rasd:Address> <rasd:Description>SCSI Controller</rasd:Description> <rasd:ElementName>SCSI Controller 0</rasd:ElementName> <rasd:InstanceID>3</rasd:InstanceID> <rasd:ResourceSubType>VirtualSCSI</rasd:ResourceSubType> <rasd:ResourceType>6</rasd:ResourceType> </Item> <Item> <rasd:Address>1</rasd:Address> <rasd:Description>IDE Controller</rasd:Description> <rasd:ElementName>VirtualIDEController 1</rasd:ElementName> <rasd:InstanceID>4</rasd:InstanceID> <rasd:ResourceType>5</rasd:ResourceType> </Item> <Item> <rasd:Address>0</rasd:Address> <rasd:Description>IDE Controller</rasd:Description> <rasd:ElementName>VirtualIDEController 0</rasd:ElementName> <rasd:InstanceID>5</rasd:InstanceID> <rasd:ResourceType>5</rasd:ResourceType> </Item> <Item ovf:required="false"> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>VirtualVideoCard</rasd:ElementName> <rasd:InstanceID>6</rasd:InstanceID> <rasd:ResourceType>24</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="enable3DSupport" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="enableMPTSupport" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="use3dRenderer" vmw:value="automatic"/> <vmw:Config ovf:required="false" vmw:key="useAutoDetect" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="videoRamSizeInKB" vmw:value="4096"/> </Item> <Item ovf:required="false"> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>VirtualVMCIDevice</rasd:ElementName> <rasd:InstanceID>7</rasd:InstanceID> <rasd:ResourceSubType>vmware.vmci</rasd:ResourceSubType> <rasd:ResourceType>1</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="allowUnrestrictedCommunication" vmw:value="false"/> </Item> <Item ovf:required="false"> <rasd:AddressOnParent>0</rasd:AddressOnParent> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>CD-ROM 1</rasd:ElementName> <rasd:InstanceID>8</rasd:InstanceID> <rasd:Parent>4</rasd:Parent> <rasd:ResourceSubType>vmware.cdrom.remotepassthrough</rasd:ResourceSubType> <rasd:ResourceType>15</rasd:ResourceType> </Item> <Item> <rasd:AddressOnParent>0</rasd:AddressOnParent> <rasd:ElementName>Hard Disk 1</rasd:ElementName> <rasd:HostResource>ovf:/disk/vmdisk1</rasd:HostResource> <rasd:InstanceID>9</rasd:InstanceID> <rasd:Parent>3</rasd:Parent> <rasd:ResourceType>17</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="backing.writeThrough" vmw:value="false"/> </Item> <Item ovf:required="false"> <rasd:AddressOnParent>0</rasd:AddressOnParent> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:Description>Floppy Drive</rasd:Description> <rasd:ElementName>Floppy 1</rasd:ElementName> <rasd:InstanceID>10</rasd:InstanceID> <rasd:ResourceSubType>vmware.floppy.remotedevice</rasd:ResourceSubType> <rasd:ResourceType>14</rasd:ResourceType> </Item> <Item> <rasd:AddressOnParent>7</rasd:AddressOnParent> <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation> <rasd:Connection>VM Network</rasd:Connection> <rasd:Description>VmxNet3 ethernet adapter on "VM Network"</rasd:Description> <rasd:ElementName>Ethernet 1</rasd:ElementName> <rasd:InstanceID>11</rasd:InstanceID> <rasd:ResourceSubType>VmxNet3</rasd:ResourceSubType> <rasd:ResourceType>10</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="wakeOnLanEnabled" vmw:value="true"/> </Item> <vmw:Config ovf:required="false" vmw:key="cpuHotAddEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="cpuHotRemoveEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="firmware" vmw:value="@@FIRMWARE@@"/> <vmw:Config ovf:required="false" vmw:key="virtualICH7MPresent" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="virtualSMCPresent" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="memoryHotAddEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="nestedHVEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.powerOffType" vmw:value="preset"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.resetType" vmw:value="preset"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.standbyAction" vmw:value="checkpoint"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.suspendType" vmw:value="preset"/> <vmw:Config ovf:required="false" vmw:key="tools.afterPowerOn" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.afterResume" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestShutdown" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestStandby" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.syncTimeWithHost" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="tools.toolsUpgradePolicy" vmw:value="manual"/> </VirtualHardwareSection> </VirtualSystem> </Envelope> 0707010000001E000081A40000000000000000000000016553B8890000222B000000000000000000000000000000000000002E00000000open-vmdk-0.3.6.0/templates/template-hw13.ovf<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (c) 2018-2023 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. --> <Envelope vmw:buildId="build-4564106" xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <References> <File ovf:href="@@NAME@@-disk1.vmdk" ovf:id="file1" ovf:size="@@VMDK_FILE_SIZE@@"/> </References> <DiskSection> <Info>Virtual disk information</Info> <Disk ovf:capacity="@@VMDK_CAPACITY@@" ovf:capacityAllocationUnits="byte" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" ovf:populatedSize="0"/> </DiskSection> <NetworkSection> <Info>The list of logical networks</Info> <Network ovf:name="VM Network"> <Description>The VM Network network</Description> </Network> </NetworkSection> <VirtualSystem ovf:id="@@NAME@@"> <Info>A virtual machine</Info> <Name>@@NAME@@</Name> <OperatingSystemSection ovf:id="100" vmw:osType="other3xLinux64Guest"> <Info>The kind of installed guest operating system</Info> </OperatingSystemSection> <VirtualHardwareSection> <Info>Virtual hardware requirements</Info> <System> <vssd:ElementName>Virtual Hardware Family</vssd:ElementName> <vssd:InstanceID>0</vssd:InstanceID> <vssd:VirtualSystemIdentifier>@@NAME@@</vssd:VirtualSystemIdentifier> <vssd:VirtualSystemType>vmx-13</vssd:VirtualSystemType> </System> <Item> <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits> <rasd:Description>Number of Virtual CPUs</rasd:Description> <rasd:ElementName>@@NUM_CPUS@@ virtual CPU(s)</rasd:ElementName> <rasd:InstanceID>1</rasd:InstanceID> <rasd:ResourceType>3</rasd:ResourceType> <rasd:VirtualQuantity>@@NUM_CPUS@@</rasd:VirtualQuantity> </Item> <Item> <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits> <rasd:Description>Memory Size</rasd:Description> <rasd:ElementName>@@MEM_SIZE@@MB of memory</rasd:ElementName> <rasd:InstanceID>2</rasd:InstanceID> <rasd:ResourceType>4</rasd:ResourceType> <rasd:VirtualQuantity>@@MEM_SIZE@@</rasd:VirtualQuantity> </Item> <Item> <rasd:Address>0</rasd:Address> <rasd:Description>SCSI Controller</rasd:Description> <rasd:ElementName>SCSI Controller 0</rasd:ElementName> <rasd:InstanceID>3</rasd:InstanceID> <rasd:ResourceSubType>VirtualSCSI</rasd:ResourceSubType> <rasd:ResourceType>6</rasd:ResourceType> </Item> <Item> <rasd:Address>1</rasd:Address> <rasd:Description>IDE Controller</rasd:Description> <rasd:ElementName>VirtualIDEController 1</rasd:ElementName> <rasd:InstanceID>4</rasd:InstanceID> <rasd:ResourceType>5</rasd:ResourceType> </Item> <Item> <rasd:Address>0</rasd:Address> <rasd:Description>IDE Controller</rasd:Description> <rasd:ElementName>VirtualIDEController 0</rasd:ElementName> <rasd:InstanceID>5</rasd:InstanceID> <rasd:ResourceType>5</rasd:ResourceType> </Item> <Item ovf:required="false"> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>VirtualVideoCard</rasd:ElementName> <rasd:InstanceID>6</rasd:InstanceID> <rasd:ResourceType>24</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="enable3DSupport" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="use3dRenderer" vmw:value="automatic"/> <vmw:Config ovf:required="false" vmw:key="useAutoDetect" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="videoRamSizeInKB" vmw:value="4096"/> </Item> <Item ovf:required="false"> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>VirtualVMCIDevice</rasd:ElementName> <rasd:InstanceID>7</rasd:InstanceID> <rasd:ResourceSubType>vmware.vmci</rasd:ResourceSubType> <rasd:ResourceType>1</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="allowUnrestrictedCommunication" vmw:value="false"/> </Item> <Item ovf:required="false"> <rasd:AddressOnParent>0</rasd:AddressOnParent> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>CD-ROM 1</rasd:ElementName> <rasd:InstanceID>8</rasd:InstanceID> <rasd:Parent>4</rasd:Parent> <rasd:ResourceSubType>vmware.cdrom.remotepassthrough</rasd:ResourceSubType> <rasd:ResourceType>15</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="backing.exclusive" vmw:value="false"/> </Item> <Item> <rasd:AddressOnParent>0</rasd:AddressOnParent> <rasd:ElementName>Hard Disk 1</rasd:ElementName> <rasd:HostResource>ovf:/disk/vmdisk1</rasd:HostResource> <rasd:InstanceID>9</rasd:InstanceID> <rasd:Parent>3</rasd:Parent> <rasd:ResourceType>17</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="backing.writeThrough" vmw:value="false"/> </Item> <Item ovf:required="false"> <rasd:AddressOnParent>0</rasd:AddressOnParent> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:Description>Floppy Drive</rasd:Description> <rasd:ElementName>Floppy 1</rasd:ElementName> <rasd:InstanceID>10</rasd:InstanceID> <rasd:ResourceSubType>vmware.floppy.remotedevice</rasd:ResourceSubType> <rasd:ResourceType>14</rasd:ResourceType> </Item> <Item> <rasd:AddressOnParent>7</rasd:AddressOnParent> <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation> <rasd:Connection>VM Network</rasd:Connection> <rasd:Description>VmxNet3 ethernet adapter on "VM Network"</rasd:Description> <rasd:ElementName>Ethernet 1</rasd:ElementName> <rasd:InstanceID>11</rasd:InstanceID> <rasd:ResourceSubType>VmxNet3</rasd:ResourceSubType> <rasd:ResourceType>10</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="wakeOnLanEnabled" vmw:value="true"/> </Item> <vmw:Config ovf:required="false" vmw:key="cpuHotAddEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="cpuHotRemoveEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="firmware" vmw:value="@@FIRMWARE@@"/> <vmw:Config ovf:required="false" vmw:key="virtualICH7MPresent" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="virtualSMCPresent" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="memoryHotAddEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="nestedHVEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.powerOffType" vmw:value="soft"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.resetType" vmw:value="soft"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.standbyAction" vmw:value="checkpoint"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.suspendType" vmw:value="hard"/> <vmw:Config ovf:required="false" vmw:key="tools.afterPowerOn" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.afterResume" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestShutdown" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestStandby" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.syncTimeWithHost" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="tools.toolsUpgradePolicy" vmw:value="manual"/> </VirtualHardwareSection> </VirtualSystem> </Envelope> 0707010000001F000081A40000000000000000000000016553B8890000223C000000000000000000000000000000000000002E00000000open-vmdk-0.3.6.0/templates/template-hw14.ovf<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (c) 2018-2023 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. --> <Envelope vmw:buildId="build-8169922" xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <References> <File ovf:href="@@NAME@@-disk1.vmdk" ovf:id="file1" ovf:size="@@VMDK_FILE_SIZE@@"/> </References> <DiskSection> <Info>Virtual disk information</Info> <Disk ovf:capacity="@@VMDK_CAPACITY@@" ovf:capacityAllocationUnits="byte" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" ovf:populatedSize="0"/> </DiskSection> <NetworkSection> <Info>The list of logical networks</Info> <Network ovf:name="VM Network"> <Description>The VM Network network</Description> </Network> </NetworkSection> <VirtualSystem ovf:id="@@NAME@@"> <Info>A virtual machine</Info> <Name>@@NAME@@</Name> <OperatingSystemSection ovf:id="100" vmw:osType="other4xLinux64Guest"> <Info>The kind of installed guest operating system</Info> </OperatingSystemSection> <VirtualHardwareSection> <Info>Virtual hardware requirements</Info> <System> <vssd:ElementName>Virtual Hardware Family</vssd:ElementName> <vssd:InstanceID>0</vssd:InstanceID> <vssd:VirtualSystemIdentifier>@@NAME@@</vssd:VirtualSystemIdentifier> <vssd:VirtualSystemType>vmx-14</vssd:VirtualSystemType> </System> <Item> <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits> <rasd:Description>Number of Virtual CPUs</rasd:Description> <rasd:ElementName>@@NUM_CPUS@@ virtual CPU(s)</rasd:ElementName> <rasd:InstanceID>1</rasd:InstanceID> <rasd:ResourceType>3</rasd:ResourceType> <rasd:VirtualQuantity>@@NUM_CPUS@@</rasd:VirtualQuantity> </Item> <Item> <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits> <rasd:Description>Memory Size</rasd:Description> <rasd:ElementName>@@MEM_SIZE@@MB of memory</rasd:ElementName> <rasd:InstanceID>2</rasd:InstanceID> <rasd:ResourceType>4</rasd:ResourceType> <rasd:VirtualQuantity>@@MEM_SIZE@@</rasd:VirtualQuantity> </Item> <Item> <rasd:Address>0</rasd:Address> <rasd:Description>SCSI Controller</rasd:Description> <rasd:ElementName>SCSI Controller 0</rasd:ElementName> <rasd:InstanceID>3</rasd:InstanceID> <rasd:ResourceSubType>VirtualSCSI</rasd:ResourceSubType> <rasd:ResourceType>6</rasd:ResourceType> </Item> <Item> <rasd:Address>1</rasd:Address> <rasd:Description>IDE Controller</rasd:Description> <rasd:ElementName>VirtualIDEController 1</rasd:ElementName> <rasd:InstanceID>4</rasd:InstanceID> <rasd:ResourceType>5</rasd:ResourceType> </Item> <Item> <rasd:Address>0</rasd:Address> <rasd:Description>IDE Controller</rasd:Description> <rasd:ElementName>VirtualIDEController 0</rasd:ElementName> <rasd:InstanceID>5</rasd:InstanceID> <rasd:ResourceType>5</rasd:ResourceType> </Item> <Item ovf:required="false"> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>VirtualVideoCard</rasd:ElementName> <rasd:InstanceID>6</rasd:InstanceID> <rasd:ResourceType>24</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="useAutoDetect" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="videoRamSizeInKB" vmw:value="4096"/> <vmw:Config ovf:required="false" vmw:key="enable3DSupport" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="use3dRenderer" vmw:value="automatic"/> </Item> <Item ovf:required="false"> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>VirtualVMCIDevice</rasd:ElementName> <rasd:InstanceID>7</rasd:InstanceID> <rasd:ResourceSubType>vmware.vmci</rasd:ResourceSubType> <rasd:ResourceType>1</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="allowUnrestrictedCommunication" vmw:value="false"/> </Item> <Item ovf:required="false"> <rasd:AddressOnParent>0</rasd:AddressOnParent> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>CD-ROM 1</rasd:ElementName> <rasd:InstanceID>8</rasd:InstanceID> <rasd:Parent>5</rasd:Parent> <rasd:ResourceSubType>vmware.cdrom.remotepassthrough</rasd:ResourceSubType> <rasd:ResourceType>15</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="backing.exclusive" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="connectable.allowGuestControl" vmw:value="true"/> </Item> <Item> <rasd:AddressOnParent>0</rasd:AddressOnParent> <rasd:ElementName>Hard Disk 1</rasd:ElementName> <rasd:HostResource>ovf:/disk/vmdisk1</rasd:HostResource> <rasd:InstanceID>9</rasd:InstanceID> <rasd:Parent>3</rasd:Parent> <rasd:ResourceType>17</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="backing.writeThrough" vmw:value="false"/> </Item> <Item> <rasd:AddressOnParent>7</rasd:AddressOnParent> <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation> <rasd:Connection>VM Network</rasd:Connection> <rasd:Description>VmxNet3 ethernet adapter on "VM Network"</rasd:Description> <rasd:ElementName>Ethernet 1</rasd:ElementName> <rasd:InstanceID>10</rasd:InstanceID> <rasd:ResourceSubType>VmxNet3</rasd:ResourceSubType> <rasd:ResourceType>10</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="wakeOnLanEnabled" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="connectable.allowGuestControl" vmw:value="true"/> </Item> <vmw:Config ovf:required="false" vmw:key="cpuHotAddEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="cpuHotRemoveEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="memoryHotAddEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="firmware" vmw:value="@@FIRMWARE@@"/> <vmw:Config ovf:required="false" vmw:key="tools.syncTimeWithHost" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="tools.afterPowerOn" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.afterResume" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestShutdown" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestStandby" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.toolsUpgradePolicy" vmw:value="manual"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.powerOffType" vmw:value="soft"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.resetType" vmw:value="soft"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.suspendType" vmw:value="hard"/> <vmw:Config ovf:required="false" vmw:key="nestedHVEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="virtualICH7MPresent" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="virtualSMCPresent" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="flags.vvtdEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="flags.vbsEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="bootOptions.efiSecureBootEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.standbyAction" vmw:value="checkpoint"/> </VirtualHardwareSection> </VirtualSystem> </Envelope> 07070100000020000081A40000000000000000000000016553B88900002241000000000000000000000000000000000000002E00000000open-vmdk-0.3.6.0/templates/template-hw15.ovf<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (c) 2023 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. --> <Envelope xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <References> <File ovf:href="@@NAME@@-disk1.vmdk" ovf:id="file1" ovf:size="@@VMDK_FILE_SIZE@@"/> </References> <DiskSection> <Info>Virtual disk information</Info> <Disk ovf:capacity="@@VMDK_CAPACITY@@" ovf:capacityAllocationUnits="byte" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized"/> </DiskSection> <NetworkSection> <Info>The list of logical networks</Info> <Network ovf:name="VM Network"> <Description>The VM Network network</Description> </Network> </NetworkSection> <VirtualSystem ovf:id="@@NAME@@"> <Info>A virtual machine</Info> <Name>@@NAME@@</Name> <OperatingSystemSection ovf:id="1" vmw:osType="other4xLinux64Guest"> <Info>The kind of installed guest operating system</Info> </OperatingSystemSection> <VirtualHardwareSection> <Info>Virtual hardware requirements</Info> <System> <vssd:ElementName>Virtual Hardware Family</vssd:ElementName> <vssd:InstanceID>0</vssd:InstanceID> <vssd:VirtualSystemIdentifier>@@NAME@@</vssd:VirtualSystemIdentifier> <vssd:VirtualSystemType>vmx-15</vssd:VirtualSystemType> </System> <Item> <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits> <rasd:Description>Number of Virtual CPUs</rasd:Description> <rasd:ElementName>@@NUM_CPUS@@ virtual CPU(s)</rasd:ElementName> <rasd:InstanceID>1</rasd:InstanceID> <rasd:ResourceType>3</rasd:ResourceType> <rasd:VirtualQuantity>@@NUM_CPUS@@</rasd:VirtualQuantity> </Item> <Item> <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits> <rasd:Description>Memory Size</rasd:Description> <rasd:ElementName>@@MEM_SIZE@@MB of memory</rasd:ElementName> <rasd:InstanceID>2</rasd:InstanceID> <rasd:ResourceType>4</rasd:ResourceType> <rasd:VirtualQuantity>@@MEM_SIZE@@</rasd:VirtualQuantity> </Item> <Item> <rasd:Address>0</rasd:Address> <rasd:Description>SCSI Controller</rasd:Description> <rasd:ElementName>SCSI controller 0</rasd:ElementName> <rasd:InstanceID>3</rasd:InstanceID> <rasd:ResourceSubType>VirtualSCSI</rasd:ResourceSubType> <rasd:ResourceType>6</rasd:ResourceType> </Item> <Item> <rasd:Address>1</rasd:Address> <rasd:Description>IDE Controller</rasd:Description> <rasd:ElementName>IDE 1</rasd:ElementName> <rasd:InstanceID>4</rasd:InstanceID> <rasd:ResourceType>5</rasd:ResourceType> </Item> <Item> <rasd:Address>0</rasd:Address> <rasd:Description>IDE Controller</rasd:Description> <rasd:ElementName>IDE 0</rasd:ElementName> <rasd:InstanceID>5</rasd:InstanceID> <rasd:ResourceType>5</rasd:ResourceType> </Item> <Item ovf:required="false"> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>Video card</rasd:ElementName> <rasd:InstanceID>6</rasd:InstanceID> <rasd:ResourceType>24</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="useAutoDetect" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="videoRamSizeInKB" vmw:value="4096"/> <vmw:Config ovf:required="false" vmw:key="enable3DSupport" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="use3dRenderer" vmw:value="automatic"/> <vmw:Config ovf:required="false" vmw:key="graphicsMemorySizeInKB" vmw:value="262144"/> </Item> <Item ovf:required="false"> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>VMCI device</rasd:ElementName> <rasd:InstanceID>7</rasd:InstanceID> <rasd:ResourceSubType>vmware.vmci</rasd:ResourceSubType> <rasd:ResourceType>1</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="allowUnrestrictedCommunication" vmw:value="false"/> </Item> <Item ovf:required="false"> <rasd:AddressOnParent>0</rasd:AddressOnParent> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>CD/DVD drive 1</rasd:ElementName> <rasd:InstanceID>8</rasd:InstanceID> <rasd:Parent>5</rasd:Parent> <rasd:ResourceSubType>vmware.cdrom.remotepassthrough</rasd:ResourceSubType> <rasd:ResourceType>15</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="backing.exclusive" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="connectable.allowGuestControl" vmw:value="true"/> </Item> <Item> <rasd:AddressOnParent>0</rasd:AddressOnParent> <rasd:ElementName>Hard disk 1</rasd:ElementName> <rasd:HostResource>ovf:/disk/vmdisk1</rasd:HostResource> <rasd:InstanceID>9</rasd:InstanceID> <rasd:Parent>3</rasd:Parent> <rasd:ResourceType>17</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="backing.writeThrough" vmw:value="false"/> </Item> <Item> <rasd:AddressOnParent>7</rasd:AddressOnParent> <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation> <rasd:Connection>VM Network</rasd:Connection> <rasd:Description>VmxNet3 ethernet adapter on "VM Network"</rasd:Description> <rasd:ElementName>Network adapter 1</rasd:ElementName> <rasd:InstanceID>10</rasd:InstanceID> <rasd:ResourceSubType>VmxNet3</rasd:ResourceSubType> <rasd:ResourceType>10</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="wakeOnLanEnabled" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="connectable.allowGuestControl" vmw:value="true"/> </Item> <vmw:Config ovf:required="false" vmw:key="cpuHotAddEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="cpuHotRemoveEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="memoryHotAddEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="firmware" vmw:value="@@FIRMWARE@@"/> <vmw:Config ovf:required="false" vmw:key="tools.syncTimeWithHost" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="tools.afterPowerOn" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.afterResume" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestShutdown" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestStandby" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.toolsUpgradePolicy" vmw:value="manual"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.powerOffType" vmw:value="soft"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.resetType" vmw:value="soft"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.suspendType" vmw:value="hard"/> <vmw:Config ovf:required="false" vmw:key="nestedHVEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="virtualICH7MPresent" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="virtualSMCPresent" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="flags.vvtdEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="flags.vbsEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="bootOptions.efiSecureBootEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.standbyAction" vmw:value="checkpoint"/> </VirtualHardwareSection> </VirtualSystem> </Envelope> 07070100000021000081A40000000000000000000000016553B88900002292000000000000000000000000000000000000002E00000000open-vmdk-0.3.6.0/templates/template-hw17.ovf<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (c) 2023 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. --> <Envelope xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <References> <File ovf:href="@@NAME@@-disk1.vmdk" ovf:id="file1" ovf:size="@@VMDK_FILE_SIZE@@"/> </References> <DiskSection> <Info>Virtual disk information</Info> <Disk ovf:capacity="@@VMDK_CAPACITY@@" ovf:capacityAllocationUnits="byte" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized"/> </DiskSection> <NetworkSection> <Info>The list of logical networks</Info> <Network ovf:name="VM Network"> <Description>The VM Network network</Description> </Network> </NetworkSection> <VirtualSystem ovf:id="@@NAME@@"> <Info>A virtual machine</Info> <Name>@@NAME@@</Name> <OperatingSystemSection ovf:id="1" vmw:osType="other4xLinux64Guest"> <Info>The kind of installed guest operating system</Info> </OperatingSystemSection> <VirtualHardwareSection> <Info>Virtual hardware requirements</Info> <System> <vssd:ElementName>Virtual Hardware Family</vssd:ElementName> <vssd:InstanceID>0</vssd:InstanceID> <vssd:VirtualSystemIdentifier>@@NAME@@</vssd:VirtualSystemIdentifier> <vssd:VirtualSystemType>vmx-17</vssd:VirtualSystemType> </System> <Item> <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits> <rasd:Description>Number of Virtual CPUs</rasd:Description> <rasd:ElementName>@@NUM_CPUS@@ virtual CPU(s)</rasd:ElementName> <rasd:InstanceID>1</rasd:InstanceID> <rasd:ResourceType>3</rasd:ResourceType> <rasd:VirtualQuantity>@@NUM_CPUS@@</rasd:VirtualQuantity> </Item> <Item> <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits> <rasd:Description>Memory Size</rasd:Description> <rasd:ElementName>@@MEM_SIZE@@MB of memory</rasd:ElementName> <rasd:InstanceID>2</rasd:InstanceID> <rasd:ResourceType>4</rasd:ResourceType> <rasd:VirtualQuantity>@@MEM_SIZE@@</rasd:VirtualQuantity> </Item> <Item> <rasd:Address>0</rasd:Address> <rasd:Description>SCSI Controller</rasd:Description> <rasd:ElementName>SCSI controller 0</rasd:ElementName> <rasd:InstanceID>3</rasd:InstanceID> <rasd:ResourceSubType>VirtualSCSI</rasd:ResourceSubType> <rasd:ResourceType>6</rasd:ResourceType> </Item> <Item> <rasd:Address>1</rasd:Address> <rasd:Description>IDE Controller</rasd:Description> <rasd:ElementName>IDE 1</rasd:ElementName> <rasd:InstanceID>4</rasd:InstanceID> <rasd:ResourceType>5</rasd:ResourceType> </Item> <Item> <rasd:Address>0</rasd:Address> <rasd:Description>IDE Controller</rasd:Description> <rasd:ElementName>IDE 0</rasd:ElementName> <rasd:InstanceID>5</rasd:InstanceID> <rasd:ResourceType>5</rasd:ResourceType> </Item> <Item ovf:required="false"> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>Video card</rasd:ElementName> <rasd:InstanceID>6</rasd:InstanceID> <rasd:ResourceType>24</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="useAutoDetect" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="videoRamSizeInKB" vmw:value="4096"/> <vmw:Config ovf:required="false" vmw:key="enable3DSupport" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="use3dRenderer" vmw:value="automatic"/> <vmw:Config ovf:required="false" vmw:key="graphicsMemorySizeInKB" vmw:value="262144"/> </Item> <Item ovf:required="false"> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>VMCI device</rasd:ElementName> <rasd:InstanceID>7</rasd:InstanceID> <rasd:ResourceSubType>vmware.vmci</rasd:ResourceSubType> <rasd:ResourceType>1</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="allowUnrestrictedCommunication" vmw:value="false"/> </Item> <Item ovf:required="false"> <rasd:AddressOnParent>0</rasd:AddressOnParent> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>CD/DVD drive 1</rasd:ElementName> <rasd:InstanceID>8</rasd:InstanceID> <rasd:Parent>5</rasd:Parent> <rasd:ResourceSubType>vmware.cdrom.remotepassthrough</rasd:ResourceSubType> <rasd:ResourceType>15</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="backing.exclusive" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="connectable.allowGuestControl" vmw:value="true"/> </Item> <Item> <rasd:AddressOnParent>0</rasd:AddressOnParent> <rasd:ElementName>Hard disk 1</rasd:ElementName> <rasd:HostResource>ovf:/disk/vmdisk1</rasd:HostResource> <rasd:InstanceID>9</rasd:InstanceID> <rasd:Parent>3</rasd:Parent> <rasd:ResourceType>17</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="backing.writeThrough" vmw:value="false"/> </Item> <Item> <rasd:AddressOnParent>7</rasd:AddressOnParent> <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation> <rasd:Connection>VM Network</rasd:Connection> <rasd:Description>VmxNet3 ethernet adapter on "VM Network"</rasd:Description> <rasd:ElementName>Network adapter 1</rasd:ElementName> <rasd:InstanceID>10</rasd:InstanceID> <rasd:ResourceSubType>VmxNet3</rasd:ResourceSubType> <rasd:ResourceType>10</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="wakeOnLanEnabled" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="connectable.allowGuestControl" vmw:value="true"/> </Item> <vmw:Config ovf:required="false" vmw:key="cpuHotAddEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="cpuHotRemoveEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="memoryHotAddEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="firmware" vmw:value="@@FIRMWARE@@"/> <vmw:Config ovf:required="false" vmw:key="tools.syncTimeWithHost" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="tools.afterPowerOn" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.afterResume" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestShutdown" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestStandby" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.toolsUpgradePolicy" vmw:value="manual"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.powerOffType" vmw:value="soft"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.resetType" vmw:value="soft"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.suspendType" vmw:value="hard"/> <vmw:Config ovf:required="false" vmw:key="nestedHVEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="vPMCEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="virtualICH7MPresent" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="virtualSMCPresent" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="flags.vvtdEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="flags.vbsEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="bootOptions.efiSecureBootEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.standbyAction" vmw:value="checkpoint"/> </VirtualHardwareSection> </VirtualSystem> </Envelope> 07070100000022000081A40000000000000000000000016553B88900002292000000000000000000000000000000000000002E00000000open-vmdk-0.3.6.0/templates/template-hw18.ovf<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (c) 2023 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. --> <Envelope xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <References> <File ovf:href="@@NAME@@-disk1.vmdk" ovf:id="file1" ovf:size="@@VMDK_FILE_SIZE@@"/> </References> <DiskSection> <Info>Virtual disk information</Info> <Disk ovf:capacity="@@VMDK_CAPACITY@@" ovf:capacityAllocationUnits="byte" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized"/> </DiskSection> <NetworkSection> <Info>The list of logical networks</Info> <Network ovf:name="VM Network"> <Description>The VM Network network</Description> </Network> </NetworkSection> <VirtualSystem ovf:id="@@NAME@@"> <Info>A virtual machine</Info> <Name>@@NAME@@</Name> <OperatingSystemSection ovf:id="1" vmw:osType="other4xLinux64Guest"> <Info>The kind of installed guest operating system</Info> </OperatingSystemSection> <VirtualHardwareSection> <Info>Virtual hardware requirements</Info> <System> <vssd:ElementName>Virtual Hardware Family</vssd:ElementName> <vssd:InstanceID>0</vssd:InstanceID> <vssd:VirtualSystemIdentifier>@@NAME@@</vssd:VirtualSystemIdentifier> <vssd:VirtualSystemType>vmx-18</vssd:VirtualSystemType> </System> <Item> <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits> <rasd:Description>Number of Virtual CPUs</rasd:Description> <rasd:ElementName>@@NUM_CPUS@@ virtual CPU(s)</rasd:ElementName> <rasd:InstanceID>1</rasd:InstanceID> <rasd:ResourceType>3</rasd:ResourceType> <rasd:VirtualQuantity>@@NUM_CPUS@@</rasd:VirtualQuantity> </Item> <Item> <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits> <rasd:Description>Memory Size</rasd:Description> <rasd:ElementName>@@MEM_SIZE@@MB of memory</rasd:ElementName> <rasd:InstanceID>2</rasd:InstanceID> <rasd:ResourceType>4</rasd:ResourceType> <rasd:VirtualQuantity>@@MEM_SIZE@@</rasd:VirtualQuantity> </Item> <Item> <rasd:Address>0</rasd:Address> <rasd:Description>SCSI Controller</rasd:Description> <rasd:ElementName>SCSI controller 0</rasd:ElementName> <rasd:InstanceID>3</rasd:InstanceID> <rasd:ResourceSubType>VirtualSCSI</rasd:ResourceSubType> <rasd:ResourceType>6</rasd:ResourceType> </Item> <Item> <rasd:Address>1</rasd:Address> <rasd:Description>IDE Controller</rasd:Description> <rasd:ElementName>IDE 1</rasd:ElementName> <rasd:InstanceID>4</rasd:InstanceID> <rasd:ResourceType>5</rasd:ResourceType> </Item> <Item> <rasd:Address>0</rasd:Address> <rasd:Description>IDE Controller</rasd:Description> <rasd:ElementName>IDE 0</rasd:ElementName> <rasd:InstanceID>5</rasd:InstanceID> <rasd:ResourceType>5</rasd:ResourceType> </Item> <Item ovf:required="false"> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>Video card</rasd:ElementName> <rasd:InstanceID>6</rasd:InstanceID> <rasd:ResourceType>24</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="useAutoDetect" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="videoRamSizeInKB" vmw:value="4096"/> <vmw:Config ovf:required="false" vmw:key="enable3DSupport" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="use3dRenderer" vmw:value="automatic"/> <vmw:Config ovf:required="false" vmw:key="graphicsMemorySizeInKB" vmw:value="262144"/> </Item> <Item ovf:required="false"> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>VMCI device</rasd:ElementName> <rasd:InstanceID>7</rasd:InstanceID> <rasd:ResourceSubType>vmware.vmci</rasd:ResourceSubType> <rasd:ResourceType>1</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="allowUnrestrictedCommunication" vmw:value="false"/> </Item> <Item ovf:required="false"> <rasd:AddressOnParent>0</rasd:AddressOnParent> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>CD/DVD drive 1</rasd:ElementName> <rasd:InstanceID>8</rasd:InstanceID> <rasd:Parent>5</rasd:Parent> <rasd:ResourceSubType>vmware.cdrom.remotepassthrough</rasd:ResourceSubType> <rasd:ResourceType>15</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="backing.exclusive" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="connectable.allowGuestControl" vmw:value="true"/> </Item> <Item> <rasd:AddressOnParent>0</rasd:AddressOnParent> <rasd:ElementName>Hard disk 1</rasd:ElementName> <rasd:HostResource>ovf:/disk/vmdisk1</rasd:HostResource> <rasd:InstanceID>9</rasd:InstanceID> <rasd:Parent>3</rasd:Parent> <rasd:ResourceType>17</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="backing.writeThrough" vmw:value="false"/> </Item> <Item> <rasd:AddressOnParent>7</rasd:AddressOnParent> <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation> <rasd:Connection>VM Network</rasd:Connection> <rasd:Description>VmxNet3 ethernet adapter on "VM Network"</rasd:Description> <rasd:ElementName>Network adapter 1</rasd:ElementName> <rasd:InstanceID>10</rasd:InstanceID> <rasd:ResourceSubType>VmxNet3</rasd:ResourceSubType> <rasd:ResourceType>10</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="wakeOnLanEnabled" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="connectable.allowGuestControl" vmw:value="true"/> </Item> <vmw:Config ovf:required="false" vmw:key="cpuHotAddEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="cpuHotRemoveEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="memoryHotAddEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="firmware" vmw:value="@@FIRMWARE@@"/> <vmw:Config ovf:required="false" vmw:key="tools.syncTimeWithHost" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="tools.afterPowerOn" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.afterResume" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestShutdown" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestStandby" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.toolsUpgradePolicy" vmw:value="manual"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.powerOffType" vmw:value="soft"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.resetType" vmw:value="soft"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.suspendType" vmw:value="hard"/> <vmw:Config ovf:required="false" vmw:key="nestedHVEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="vPMCEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="virtualICH7MPresent" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="virtualSMCPresent" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="flags.vvtdEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="flags.vbsEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="bootOptions.efiSecureBootEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.standbyAction" vmw:value="checkpoint"/> </VirtualHardwareSection> </VirtualSystem> </Envelope> 07070100000023000081A40000000000000000000000016553B88900002292000000000000000000000000000000000000002E00000000open-vmdk-0.3.6.0/templates/template-hw19.ovf<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (c) 2023 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. --> <Envelope xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <References> <File ovf:href="@@NAME@@-disk1.vmdk" ovf:id="file1" ovf:size="@@VMDK_FILE_SIZE@@"/> </References> <DiskSection> <Info>Virtual disk information</Info> <Disk ovf:capacity="@@VMDK_CAPACITY@@" ovf:capacityAllocationUnits="byte" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized"/> </DiskSection> <NetworkSection> <Info>The list of logical networks</Info> <Network ovf:name="VM Network"> <Description>The VM Network network</Description> </Network> </NetworkSection> <VirtualSystem ovf:id="@@NAME@@"> <Info>A virtual machine</Info> <Name>@@NAME@@</Name> <OperatingSystemSection ovf:id="1" vmw:osType="other4xLinux64Guest"> <Info>The kind of installed guest operating system</Info> </OperatingSystemSection> <VirtualHardwareSection> <Info>Virtual hardware requirements</Info> <System> <vssd:ElementName>Virtual Hardware Family</vssd:ElementName> <vssd:InstanceID>0</vssd:InstanceID> <vssd:VirtualSystemIdentifier>@@NAME@@</vssd:VirtualSystemIdentifier> <vssd:VirtualSystemType>vmx-19</vssd:VirtualSystemType> </System> <Item> <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits> <rasd:Description>Number of Virtual CPUs</rasd:Description> <rasd:ElementName>@@NUM_CPUS@@ virtual CPU(s)</rasd:ElementName> <rasd:InstanceID>1</rasd:InstanceID> <rasd:ResourceType>3</rasd:ResourceType> <rasd:VirtualQuantity>@@NUM_CPUS@@</rasd:VirtualQuantity> </Item> <Item> <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits> <rasd:Description>Memory Size</rasd:Description> <rasd:ElementName>@@MEM_SIZE@@MB of memory</rasd:ElementName> <rasd:InstanceID>2</rasd:InstanceID> <rasd:ResourceType>4</rasd:ResourceType> <rasd:VirtualQuantity>@@MEM_SIZE@@</rasd:VirtualQuantity> </Item> <Item> <rasd:Address>0</rasd:Address> <rasd:Description>SCSI Controller</rasd:Description> <rasd:ElementName>SCSI controller 0</rasd:ElementName> <rasd:InstanceID>3</rasd:InstanceID> <rasd:ResourceSubType>VirtualSCSI</rasd:ResourceSubType> <rasd:ResourceType>6</rasd:ResourceType> </Item> <Item> <rasd:Address>1</rasd:Address> <rasd:Description>IDE Controller</rasd:Description> <rasd:ElementName>IDE 1</rasd:ElementName> <rasd:InstanceID>4</rasd:InstanceID> <rasd:ResourceType>5</rasd:ResourceType> </Item> <Item> <rasd:Address>0</rasd:Address> <rasd:Description>IDE Controller</rasd:Description> <rasd:ElementName>IDE 0</rasd:ElementName> <rasd:InstanceID>5</rasd:InstanceID> <rasd:ResourceType>5</rasd:ResourceType> </Item> <Item ovf:required="false"> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>Video card</rasd:ElementName> <rasd:InstanceID>6</rasd:InstanceID> <rasd:ResourceType>24</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="useAutoDetect" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="videoRamSizeInKB" vmw:value="4096"/> <vmw:Config ovf:required="false" vmw:key="enable3DSupport" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="use3dRenderer" vmw:value="automatic"/> <vmw:Config ovf:required="false" vmw:key="graphicsMemorySizeInKB" vmw:value="262144"/> </Item> <Item ovf:required="false"> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>VMCI device</rasd:ElementName> <rasd:InstanceID>7</rasd:InstanceID> <rasd:ResourceSubType>vmware.vmci</rasd:ResourceSubType> <rasd:ResourceType>1</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="allowUnrestrictedCommunication" vmw:value="false"/> </Item> <Item ovf:required="false"> <rasd:AddressOnParent>0</rasd:AddressOnParent> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>CD/DVD drive 1</rasd:ElementName> <rasd:InstanceID>8</rasd:InstanceID> <rasd:Parent>5</rasd:Parent> <rasd:ResourceSubType>vmware.cdrom.remotepassthrough</rasd:ResourceSubType> <rasd:ResourceType>15</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="backing.exclusive" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="connectable.allowGuestControl" vmw:value="true"/> </Item> <Item> <rasd:AddressOnParent>0</rasd:AddressOnParent> <rasd:ElementName>Hard disk 1</rasd:ElementName> <rasd:HostResource>ovf:/disk/vmdisk1</rasd:HostResource> <rasd:InstanceID>9</rasd:InstanceID> <rasd:Parent>3</rasd:Parent> <rasd:ResourceType>17</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="backing.writeThrough" vmw:value="false"/> </Item> <Item> <rasd:AddressOnParent>7</rasd:AddressOnParent> <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation> <rasd:Connection>VM Network</rasd:Connection> <rasd:Description>VmxNet3 ethernet adapter on "VM Network"</rasd:Description> <rasd:ElementName>Network adapter 1</rasd:ElementName> <rasd:InstanceID>10</rasd:InstanceID> <rasd:ResourceSubType>VmxNet3</rasd:ResourceSubType> <rasd:ResourceType>10</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="wakeOnLanEnabled" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="connectable.allowGuestControl" vmw:value="true"/> </Item> <vmw:Config ovf:required="false" vmw:key="cpuHotAddEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="cpuHotRemoveEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="memoryHotAddEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="firmware" vmw:value="@@FIRMWARE@@"/> <vmw:Config ovf:required="false" vmw:key="tools.syncTimeWithHost" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="tools.afterPowerOn" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.afterResume" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestShutdown" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestStandby" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.toolsUpgradePolicy" vmw:value="manual"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.powerOffType" vmw:value="soft"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.resetType" vmw:value="soft"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.suspendType" vmw:value="hard"/> <vmw:Config ovf:required="false" vmw:key="nestedHVEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="vPMCEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="virtualICH7MPresent" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="virtualSMCPresent" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="flags.vvtdEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="flags.vbsEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="bootOptions.efiSecureBootEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.standbyAction" vmw:value="checkpoint"/> </VirtualHardwareSection> </VirtualSystem> </Envelope> 07070100000024000081A40000000000000000000000016553B88900002292000000000000000000000000000000000000002E00000000open-vmdk-0.3.6.0/templates/template-hw20.ovf<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (c) 2023 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. --> <Envelope xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <References> <File ovf:href="@@NAME@@-disk1.vmdk" ovf:id="file1" ovf:size="@@VMDK_FILE_SIZE@@"/> </References> <DiskSection> <Info>Virtual disk information</Info> <Disk ovf:capacity="@@VMDK_CAPACITY@@" ovf:capacityAllocationUnits="byte" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized"/> </DiskSection> <NetworkSection> <Info>The list of logical networks</Info> <Network ovf:name="VM Network"> <Description>The VM Network network</Description> </Network> </NetworkSection> <VirtualSystem ovf:id="@@NAME@@"> <Info>A virtual machine</Info> <Name>@@NAME@@</Name> <OperatingSystemSection ovf:id="1" vmw:osType="other4xLinux64Guest"> <Info>The kind of installed guest operating system</Info> </OperatingSystemSection> <VirtualHardwareSection> <Info>Virtual hardware requirements</Info> <System> <vssd:ElementName>Virtual Hardware Family</vssd:ElementName> <vssd:InstanceID>0</vssd:InstanceID> <vssd:VirtualSystemIdentifier>@@NAME@@</vssd:VirtualSystemIdentifier> <vssd:VirtualSystemType>vmx-20</vssd:VirtualSystemType> </System> <Item> <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits> <rasd:Description>Number of Virtual CPUs</rasd:Description> <rasd:ElementName>@@NUM_CPUS@@ virtual CPU(s)</rasd:ElementName> <rasd:InstanceID>1</rasd:InstanceID> <rasd:ResourceType>3</rasd:ResourceType> <rasd:VirtualQuantity>@@NUM_CPUS@@</rasd:VirtualQuantity> </Item> <Item> <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits> <rasd:Description>Memory Size</rasd:Description> <rasd:ElementName>@@MEM_SIZE@@MB of memory</rasd:ElementName> <rasd:InstanceID>2</rasd:InstanceID> <rasd:ResourceType>4</rasd:ResourceType> <rasd:VirtualQuantity>@@MEM_SIZE@@</rasd:VirtualQuantity> </Item> <Item> <rasd:Address>0</rasd:Address> <rasd:Description>SCSI Controller</rasd:Description> <rasd:ElementName>SCSI controller 0</rasd:ElementName> <rasd:InstanceID>3</rasd:InstanceID> <rasd:ResourceSubType>VirtualSCSI</rasd:ResourceSubType> <rasd:ResourceType>6</rasd:ResourceType> </Item> <Item> <rasd:Address>1</rasd:Address> <rasd:Description>IDE Controller</rasd:Description> <rasd:ElementName>IDE 1</rasd:ElementName> <rasd:InstanceID>4</rasd:InstanceID> <rasd:ResourceType>5</rasd:ResourceType> </Item> <Item> <rasd:Address>0</rasd:Address> <rasd:Description>IDE Controller</rasd:Description> <rasd:ElementName>IDE 0</rasd:ElementName> <rasd:InstanceID>5</rasd:InstanceID> <rasd:ResourceType>5</rasd:ResourceType> </Item> <Item ovf:required="false"> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>Video card</rasd:ElementName> <rasd:InstanceID>6</rasd:InstanceID> <rasd:ResourceType>24</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="useAutoDetect" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="videoRamSizeInKB" vmw:value="4096"/> <vmw:Config ovf:required="false" vmw:key="enable3DSupport" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="use3dRenderer" vmw:value="automatic"/> <vmw:Config ovf:required="false" vmw:key="graphicsMemorySizeInKB" vmw:value="262144"/> </Item> <Item ovf:required="false"> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>VMCI device</rasd:ElementName> <rasd:InstanceID>7</rasd:InstanceID> <rasd:ResourceSubType>vmware.vmci</rasd:ResourceSubType> <rasd:ResourceType>1</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="allowUnrestrictedCommunication" vmw:value="false"/> </Item> <Item ovf:required="false"> <rasd:AddressOnParent>0</rasd:AddressOnParent> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>CD/DVD drive 1</rasd:ElementName> <rasd:InstanceID>8</rasd:InstanceID> <rasd:Parent>5</rasd:Parent> <rasd:ResourceSubType>vmware.cdrom.remotepassthrough</rasd:ResourceSubType> <rasd:ResourceType>15</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="backing.exclusive" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="connectable.allowGuestControl" vmw:value="true"/> </Item> <Item> <rasd:AddressOnParent>0</rasd:AddressOnParent> <rasd:ElementName>Hard disk 1</rasd:ElementName> <rasd:HostResource>ovf:/disk/vmdisk1</rasd:HostResource> <rasd:InstanceID>9</rasd:InstanceID> <rasd:Parent>3</rasd:Parent> <rasd:ResourceType>17</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="backing.writeThrough" vmw:value="false"/> </Item> <Item> <rasd:AddressOnParent>7</rasd:AddressOnParent> <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation> <rasd:Connection>VM Network</rasd:Connection> <rasd:Description>VmxNet3 ethernet adapter on "VM Network"</rasd:Description> <rasd:ElementName>Network adapter 1</rasd:ElementName> <rasd:InstanceID>10</rasd:InstanceID> <rasd:ResourceSubType>VmxNet3</rasd:ResourceSubType> <rasd:ResourceType>10</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="wakeOnLanEnabled" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="connectable.allowGuestControl" vmw:value="true"/> </Item> <vmw:Config ovf:required="false" vmw:key="cpuHotAddEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="cpuHotRemoveEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="memoryHotAddEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="firmware" vmw:value="@@FIRMWARE@@"/> <vmw:Config ovf:required="false" vmw:key="tools.syncTimeWithHost" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="tools.afterPowerOn" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.afterResume" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestShutdown" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestStandby" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.toolsUpgradePolicy" vmw:value="manual"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.powerOffType" vmw:value="soft"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.resetType" vmw:value="soft"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.suspendType" vmw:value="hard"/> <vmw:Config ovf:required="false" vmw:key="nestedHVEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="vPMCEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="virtualICH7MPresent" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="virtualSMCPresent" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="flags.vvtdEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="flags.vbsEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="bootOptions.efiSecureBootEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.standbyAction" vmw:value="checkpoint"/> </VirtualHardwareSection> </VirtualSystem> </Envelope> 07070100000025000081A40000000000000000000000016553B88900002292000000000000000000000000000000000000002E00000000open-vmdk-0.3.6.0/templates/template-hw21.ovf<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (c) 2023 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. --> <Envelope xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <References> <File ovf:href="@@NAME@@-disk1.vmdk" ovf:id="file1" ovf:size="@@VMDK_FILE_SIZE@@"/> </References> <DiskSection> <Info>Virtual disk information</Info> <Disk ovf:capacity="@@VMDK_CAPACITY@@" ovf:capacityAllocationUnits="byte" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized"/> </DiskSection> <NetworkSection> <Info>The list of logical networks</Info> <Network ovf:name="VM Network"> <Description>The VM Network network</Description> </Network> </NetworkSection> <VirtualSystem ovf:id="@@NAME@@"> <Info>A virtual machine</Info> <Name>@@NAME@@</Name> <OperatingSystemSection ovf:id="1" vmw:osType="other4xLinux64Guest"> <Info>The kind of installed guest operating system</Info> </OperatingSystemSection> <VirtualHardwareSection> <Info>Virtual hardware requirements</Info> <System> <vssd:ElementName>Virtual Hardware Family</vssd:ElementName> <vssd:InstanceID>0</vssd:InstanceID> <vssd:VirtualSystemIdentifier>@@NAME@@</vssd:VirtualSystemIdentifier> <vssd:VirtualSystemType>vmx-21</vssd:VirtualSystemType> </System> <Item> <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits> <rasd:Description>Number of Virtual CPUs</rasd:Description> <rasd:ElementName>@@NUM_CPUS@@ virtual CPU(s)</rasd:ElementName> <rasd:InstanceID>1</rasd:InstanceID> <rasd:ResourceType>3</rasd:ResourceType> <rasd:VirtualQuantity>@@NUM_CPUS@@</rasd:VirtualQuantity> </Item> <Item> <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits> <rasd:Description>Memory Size</rasd:Description> <rasd:ElementName>@@MEM_SIZE@@MB of memory</rasd:ElementName> <rasd:InstanceID>2</rasd:InstanceID> <rasd:ResourceType>4</rasd:ResourceType> <rasd:VirtualQuantity>@@MEM_SIZE@@</rasd:VirtualQuantity> </Item> <Item> <rasd:Address>0</rasd:Address> <rasd:Description>SCSI Controller</rasd:Description> <rasd:ElementName>SCSI controller 0</rasd:ElementName> <rasd:InstanceID>3</rasd:InstanceID> <rasd:ResourceSubType>VirtualSCSI</rasd:ResourceSubType> <rasd:ResourceType>6</rasd:ResourceType> </Item> <Item> <rasd:Address>1</rasd:Address> <rasd:Description>IDE Controller</rasd:Description> <rasd:ElementName>IDE 1</rasd:ElementName> <rasd:InstanceID>4</rasd:InstanceID> <rasd:ResourceType>5</rasd:ResourceType> </Item> <Item> <rasd:Address>0</rasd:Address> <rasd:Description>IDE Controller</rasd:Description> <rasd:ElementName>IDE 0</rasd:ElementName> <rasd:InstanceID>5</rasd:InstanceID> <rasd:ResourceType>5</rasd:ResourceType> </Item> <Item ovf:required="false"> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>Video card</rasd:ElementName> <rasd:InstanceID>6</rasd:InstanceID> <rasd:ResourceType>24</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="useAutoDetect" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="videoRamSizeInKB" vmw:value="4096"/> <vmw:Config ovf:required="false" vmw:key="enable3DSupport" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="use3dRenderer" vmw:value="automatic"/> <vmw:Config ovf:required="false" vmw:key="graphicsMemorySizeInKB" vmw:value="262144"/> </Item> <Item ovf:required="false"> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>VMCI device</rasd:ElementName> <rasd:InstanceID>7</rasd:InstanceID> <rasd:ResourceSubType>vmware.vmci</rasd:ResourceSubType> <rasd:ResourceType>1</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="allowUnrestrictedCommunication" vmw:value="false"/> </Item> <Item ovf:required="false"> <rasd:AddressOnParent>0</rasd:AddressOnParent> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>CD/DVD drive 1</rasd:ElementName> <rasd:InstanceID>8</rasd:InstanceID> <rasd:Parent>5</rasd:Parent> <rasd:ResourceSubType>vmware.cdrom.remotepassthrough</rasd:ResourceSubType> <rasd:ResourceType>15</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="backing.exclusive" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="connectable.allowGuestControl" vmw:value="true"/> </Item> <Item> <rasd:AddressOnParent>0</rasd:AddressOnParent> <rasd:ElementName>Hard disk 1</rasd:ElementName> <rasd:HostResource>ovf:/disk/vmdisk1</rasd:HostResource> <rasd:InstanceID>9</rasd:InstanceID> <rasd:Parent>3</rasd:Parent> <rasd:ResourceType>17</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="backing.writeThrough" vmw:value="false"/> </Item> <Item> <rasd:AddressOnParent>7</rasd:AddressOnParent> <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation> <rasd:Connection>VM Network</rasd:Connection> <rasd:Description>VmxNet3 ethernet adapter on "VM Network"</rasd:Description> <rasd:ElementName>Network adapter 1</rasd:ElementName> <rasd:InstanceID>10</rasd:InstanceID> <rasd:ResourceSubType>VmxNet3</rasd:ResourceSubType> <rasd:ResourceType>10</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="wakeOnLanEnabled" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="connectable.allowGuestControl" vmw:value="true"/> </Item> <vmw:Config ovf:required="false" vmw:key="cpuHotAddEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="cpuHotRemoveEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="memoryHotAddEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="firmware" vmw:value="@@FIRMWARE@@"/> <vmw:Config ovf:required="false" vmw:key="tools.syncTimeWithHost" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="tools.afterPowerOn" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.afterResume" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestShutdown" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestStandby" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.toolsUpgradePolicy" vmw:value="manual"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.powerOffType" vmw:value="soft"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.resetType" vmw:value="soft"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.suspendType" vmw:value="hard"/> <vmw:Config ovf:required="false" vmw:key="nestedHVEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="vPMCEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="virtualICH7MPresent" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="virtualSMCPresent" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="flags.vvtdEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="flags.vbsEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="bootOptions.efiSecureBootEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.standbyAction" vmw:value="checkpoint"/> </VirtualHardwareSection> </VirtualSystem> </Envelope> 07070100000026000081A40000000000000000000000016553B88900002472000000000000000000000000000000000000002D00000000open-vmdk-0.3.6.0/templates/template-hw7.ovf<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (c) 2018-2023 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. --> <!--Generated by VMware ESX Server, User: root, UTC time: 2014-12-01T17:32:47.473957Z--> <Envelope vmw:buildId="build-1474528" xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <References> <File ovf:href="@@NAME@@-disk1.vmdk" ovf:id="file1" ovf:size="@@VMDK_FILE_SIZE@@"/> </References> <DiskSection> <Info>Virtual disk information</Info> <Disk ovf:capacity="@@VMDK_CAPACITY@@" ovf:capacityAllocationUnits="byte" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" ovf:populatedSize="0"/> </DiskSection> <NetworkSection> <Info>The list of logical networks</Info> <Network ovf:name="VM Network"> <Description>The VM Network network</Description> </Network> </NetworkSection> <VirtualSystem ovf:id="@@NAME@@"> <Info>A virtual machine</Info> <Name>@@NAME@@</Name> <OperatingSystemSection ovf:id="100" vmw:osType="other26xLinux64Guest"> <Info>The kind of installed guest operating system</Info> </OperatingSystemSection> <VirtualHardwareSection> <Info>Virtual hardware requirements</Info> <System> <vssd:ElementName>Virtual Hardware Family</vssd:ElementName> <vssd:InstanceID>0</vssd:InstanceID> <vssd:VirtualSystemIdentifier>@@NAME@@</vssd:VirtualSystemIdentifier> <vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType> </System> <Item> <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits> <rasd:Description>Number of Virtual CPUs</rasd:Description> <rasd:ElementName>@@NUM_CPUS@@ virtual CPU(s)</rasd:ElementName> <rasd:InstanceID>1</rasd:InstanceID> <rasd:ResourceType>3</rasd:ResourceType> <rasd:VirtualQuantity>@@NUM_CPUS@@</rasd:VirtualQuantity> </Item> <Item> <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits> <rasd:Description>Memory Size</rasd:Description> <rasd:ElementName>@@MEM_SIZE@@MB of memory</rasd:ElementName> <rasd:InstanceID>2</rasd:InstanceID> <rasd:ResourceType>4</rasd:ResourceType> <rasd:VirtualQuantity>@@MEM_SIZE@@</rasd:VirtualQuantity> </Item> <Item> <rasd:Address>0</rasd:Address> <rasd:Description>SCSI Controller</rasd:Description> <rasd:ElementName>SCSI Controller 0</rasd:ElementName> <rasd:InstanceID>3</rasd:InstanceID> <rasd:ResourceSubType>VirtualSCSI</rasd:ResourceSubType> <rasd:ResourceType>6</rasd:ResourceType> </Item> <Item> <rasd:Address>1</rasd:Address> <rasd:Description>IDE Controller</rasd:Description> <rasd:ElementName>VirtualIDEController 1</rasd:ElementName> <rasd:InstanceID>4</rasd:InstanceID> <rasd:ResourceType>5</rasd:ResourceType> </Item> <Item> <rasd:Address>0</rasd:Address> <rasd:Description>IDE Controller</rasd:Description> <rasd:ElementName>VirtualIDEController 0</rasd:ElementName> <rasd:InstanceID>5</rasd:InstanceID> <rasd:ResourceType>5</rasd:ResourceType> </Item> <Item ovf:required="false"> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>VirtualVideoCard</rasd:ElementName> <rasd:InstanceID>6</rasd:InstanceID> <rasd:ResourceType>24</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="enable3DSupport" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="enableMPTSupport" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="use3dRenderer" vmw:value="automatic"/> <vmw:Config ovf:required="false" vmw:key="useAutoDetect" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="videoRamSizeInKB" vmw:value="4096"/> </Item> <Item ovf:required="false"> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>VirtualVMCIDevice</rasd:ElementName> <rasd:InstanceID>7</rasd:InstanceID> <rasd:ResourceSubType>vmware.vmci</rasd:ResourceSubType> <rasd:ResourceType>1</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="allowUnrestrictedCommunication" vmw:value="false"/> </Item> <Item ovf:required="false"> <rasd:AddressOnParent>0</rasd:AddressOnParent> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:ElementName>CD-ROM 1</rasd:ElementName> <rasd:InstanceID>8</rasd:InstanceID> <rasd:Parent>4</rasd:Parent> <rasd:ResourceSubType>vmware.cdrom.remotepassthrough</rasd:ResourceSubType> <rasd:ResourceType>15</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="backing.exclusive" vmw:value="false"/> </Item> <Item> <rasd:AddressOnParent>0</rasd:AddressOnParent> <rasd:ElementName>Hard Disk 1</rasd:ElementName> <rasd:HostResource>ovf:/disk/vmdisk1</rasd:HostResource> <rasd:InstanceID>9</rasd:InstanceID> <rasd:Parent>3</rasd:Parent> <rasd:ResourceType>17</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="backing.writeThrough" vmw:value="false"/> </Item> <Item ovf:required="false"> <rasd:AddressOnParent>0</rasd:AddressOnParent> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:Description>Floppy Drive</rasd:Description> <rasd:ElementName>Floppy 1</rasd:ElementName> <rasd:InstanceID>10</rasd:InstanceID> <rasd:ResourceSubType>vmware.floppy.remotedevice</rasd:ResourceSubType> <rasd:ResourceType>14</rasd:ResourceType> </Item> <Item> <rasd:AddressOnParent>7</rasd:AddressOnParent> <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation> <rasd:Connection>VM Network</rasd:Connection> <rasd:Description>VmxNet3 ethernet adapter on "VM Network"</rasd:Description> <rasd:ElementName>Ethernet 1</rasd:ElementName> <rasd:InstanceID>11</rasd:InstanceID> <rasd:ResourceSubType>VmxNet3</rasd:ResourceSubType> <rasd:ResourceType>10</rasd:ResourceType> <vmw:Config ovf:required="false" vmw:key="wakeOnLanEnabled" vmw:value="true"/> </Item> <vmw:Config ovf:required="false" vmw:key="cpuHotAddEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="cpuHotRemoveEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="firmware" vmw:value="bios"/> <vmw:Config ovf:required="false" vmw:key="virtualICH7MPresent" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="virtualSMCPresent" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="memoryHotAddEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="nestedHVEnabled" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.powerOffType" vmw:value="preset"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.resetType" vmw:value="preset"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.standbyAction" vmw:value="checkpoint"/> <vmw:Config ovf:required="false" vmw:key="powerOpInfo.suspendType" vmw:value="preset"/> <vmw:Config ovf:required="false" vmw:key="tools.afterPowerOn" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.afterResume" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestShutdown" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestStandby" vmw:value="true"/> <vmw:Config ovf:required="false" vmw:key="tools.syncTimeWithHost" vmw:value="false"/> <vmw:Config ovf:required="false" vmw:key="tools.toolsUpgradePolicy" vmw:value="manual"/> </VirtualHardwareSection> </VirtualSystem> </Envelope> 07070100000027000041ED0000000000000000000000026553B88900000000000000000000000000000000000000000000001700000000open-vmdk-0.3.6.0/vmdk07070100000028000081A40000000000000000000000016553B889000005DB000000000000000000000000000000000000002000000000open-vmdk-0.3.6.0/vmdk/Makefile# ================================================================================ # Copyright (c) 2014-2023 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. # ================================================================================ SRC := flat.c sparse.c mkdisk.c OUTPUTDIR := ../build/vmdk EXE := $(OUTPUTDIR)/vmdk-convert PREFIX ?= /usr CC := gcc CFLAGS := -W -Wall -O2 -g LDFLAGS := -g -lz OBJS := $(addprefix $(OUTPUTDIR)/, $(SRC:%.c=%.o)) default: all all: $(EXE) $(EXE): $(OBJS) $(OUTPUTDIR) $(CC) -o $@ $(OBJS) $(LDFLAGS) $(OUTPUTDIR)/%.o: %.c | $(OUTPUTDIR) $(CC) $(CFLAGS) -c -o $@ $< $(OUTPUTDIR): mkdir -p $(OUTPUTDIR) $(addprefix $(OUTPUTDIR)/,mkdisk.o flat.o sparse.o): diskinfo.h $(addprefix $(OUTPUTDIR)/,sparse.o): vmware_vmdk.h check: sparse -Wsparse-all -I/usr/include/x86_64-linux-gnu $(SRC) install: mkdir -p $(DESTDIR)/$(PREFIX)/bin && cp $(EXE) $(DESTDIR)/$(PREFIX)/bin/ clean: rm -rf $(OUTPUTDIR) 07070100000029000081A40000000000000000000000016553B88900000665000000000000000000000000000000000000002200000000open-vmdk-0.3.6.0/vmdk/diskinfo.h/* ******************************************************************************** * Copyright (c) 2014-2023 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. * *********************************************************************************/ #ifndef _DISKINFO_H_ #define _DISKINFO_H_ #include <stdint.h> #include <stdbool.h> #include <unistd.h> typedef struct DiskInfo DiskInfo; typedef struct { off_t (*getCapacity)(DiskInfo *self); ssize_t (*pread)(DiskInfo *self, void *buf, size_t len, off_t pos); ssize_t (*pwrite)(DiskInfo *self, const void *buf, size_t len, off_t pos); int (*nextData)(DiskInfo *self, off_t *pos, off_t *end); int (*close)(DiskInfo *self); int (*abort)(DiskInfo *self); } DiskInfoVMT; struct DiskInfo { const DiskInfoVMT *vmt; }; extern char *toolsVersion; /* toolsVersion in metadata */ DiskInfo *Flat_Open(const char *fileName); DiskInfo *Flat_Create(const char *fileName, off_t capacity); DiskInfo *Sparse_Open(const char *fileName); DiskInfo *StreamOptimized_Create(const char *fileName, off_t capacity); #endif /* _DISKINFO_H_ */ 0707010000002A000081A40000000000000000000000016553B88900000D17000000000000000000000000000000000000001E00000000open-vmdk-0.3.6.0/vmdk/flat.c/* ******************************************************************************* * Copyright (c) 2014-2023 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. * *********************************************************************************/ #define _GNU_SOURCE #include "diskinfo.h" #include <sys/stat.h> #include <stdlib.h> #include <fcntl.h> #include <errno.h> typedef struct { DiskInfo hdr; int fd; uint64_t capacity; } FlatDiskInfo; static inline FlatDiskInfo * getFDI(DiskInfo *self) { return (FlatDiskInfo *)self; } static off_t FlatGetCapacity(DiskInfo *self) { FlatDiskInfo *fdi = getFDI(self); return fdi->capacity; } static ssize_t FlatPread(DiskInfo *self, void *buf, size_t len, off_t pos) { FlatDiskInfo *fdi = getFDI(self); return pread(fdi->fd, buf, len, pos); } static ssize_t FlatPwrite(DiskInfo *self, const void *buf, size_t len, off_t pos) { FlatDiskInfo *fdi = getFDI(self); /* * Should we do some zero detection here to generate sparse file? */ return pwrite(fdi->fd, buf, len, pos); } static int FlatClose(DiskInfo *self) { FlatDiskInfo *fdi = getFDI(self); int fd = fdi->fd; free(fdi); return close(fd); } static int FlatNextData(DiskInfo *self, off_t *pos, off_t *end) { FlatDiskInfo *fdi = getFDI(self); off_t dataOff = lseek(fdi->fd, *end, SEEK_DATA); off_t holeOff; if (dataOff == -1) { if (errno == ENXIO) { return -1; } dataOff = *end; holeOff = fdi->capacity; if (dataOff >= holeOff) { errno = ENXIO; return -1; } } else { holeOff = lseek(fdi->fd, dataOff, SEEK_HOLE); if (holeOff == -1) { holeOff = fdi->capacity; } } *pos = dataOff; *end = holeOff; return 0; } static DiskInfoVMT flatDiskInfoVMT = { .getCapacity = FlatGetCapacity, .pread = FlatPread, .pwrite = FlatPwrite, .nextData = FlatNextData, .close = FlatClose, .abort = FlatClose }; DiskInfo * Flat_Open(const char *fileName) { int fd = open(fileName, O_RDONLY); struct stat stb; FlatDiskInfo *fdi; if (fd == -1) { return NULL; } if (fstat(fd, &stb)) { goto errClose; } fdi = malloc(sizeof *fdi); if (!fdi) { goto errClose; } fdi->hdr.vmt = &flatDiskInfoVMT; fdi->fd = fd; fdi->capacity = stb.st_size; return &fdi->hdr; errClose: close(fd); return NULL; } DiskInfo * Flat_Create(const char *fileName, off_t capacity) { int fd = open(fileName, O_RDWR | O_CREAT | O_TRUNC, 0666); FlatDiskInfo *fdi; if (fd == -1) { return NULL; } if (ftruncate(fd, capacity)) { goto errClose; } fdi = malloc(sizeof *fdi); if (!fdi) { goto errClose; } fdi->hdr.vmt = &flatDiskInfoVMT; fdi->fd = fd; fdi->capacity = capacity; return &fdi->hdr; errClose: close(fd); return NULL; } 0707010000002B000081A40000000000000000000000016553B88900001151000000000000000000000000000000000000002000000000open-vmdk-0.3.6.0/vmdk/mkdisk.c/* ******************************************************************************* * Copyright (c) 2014-2023 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. * *********************************************************************************/ #define _GNU_SOURCE #include "diskinfo.h" #include <sys/time.h> #include <errno.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <getopt.h> /* toolsVersion in metadata - default is 2^31-1 (unknown) */ char *toolsVersion = "2147483647"; static int copyData(DiskInfo *dst, off_t dstOffset, DiskInfo *src, off_t srcOffset, uint64_t length) { char buf[65536]; while (length > 0) { size_t readLen; readLen = sizeof buf; if (length < readLen) { readLen = length; length = 0; } else { length -= readLen; } if (src->vmt->pread(src, buf, readLen, srcOffset) != (ssize_t)readLen) { return -1; } if (dst->vmt->pwrite(dst, buf, readLen, dstOffset) != (ssize_t)readLen) { return -1; } srcOffset += readLen; dstOffset += readLen; } return 0; } static bool copyDisk(DiskInfo *src, DiskInfo *dst) { off_t end; off_t pos; end = 0; while (src->vmt->nextData(src, &pos, &end) == 0) { if (copyData(dst, pos, src, pos, end - pos)) { goto failAll; } } if (errno != ENXIO) { goto failAll; } if (dst->vmt->close(dst)) { return false; } return true; failAll: dst->vmt->abort(dst); return false; } /* Displays the usage message. */ static int printUsage(char *cmd) { printf("Usage:\n"); printf("%s -i src.vmdk: displays information for specified virtual disk\n", cmd); printf("%s [-t toolsVersion] src.vmdk dst.vmdk: converts source disk to destination disk with given tools version\n\n", cmd); return 1; } /* Check a string is number */ static bool isNumber(char *text) { int j; j = strlen(text); while(j--) { if(text[j] >= '0' && text[j] <= '9') continue; return false; } return true; } int main(int argc, char *argv[]) { struct timeval tv; DiskInfo *di; const char *src; int opt; bool doInfo = false; bool doConvert = false; gettimeofday(&tv, NULL); srand48(tv.tv_sec ^ tv.tv_usec); while ((opt = getopt(argc, argv, "it:")) != -1) { switch (opt) { case 'i': doInfo = true; break; case 't': doConvert = true; toolsVersion = optarg; if (!isNumber(toolsVersion)){ fprintf(stderr, "Invalid tools version: %s\n", toolsVersion); exit(1); } break; case '?': printUsage(argv[0]); exit(1); } } if (doInfo && doConvert) { printUsage(argv[0]); exit(1); } if (optind >= argc) { src = "src.vmdk"; } else { src = argv[optind++]; } di = Sparse_Open(src); if (di == NULL) { di = Flat_Open(src); } if (di == NULL) { fprintf(stderr, "Cannot open source disk %s: %s\n", src, strerror(errno)); } else { if (doInfo) { off_t capacity = di->vmt->getCapacity(di); off_t end = 0; off_t pos; off_t usedSpace = 0; while (di->vmt->nextData(di, &pos, &end) == 0) { usedSpace += end - pos; } printf("{ \"capacity\": %llu, \"used\": %llu }\n", (unsigned long long)capacity, (unsigned long long)usedSpace); } else { const char *filename; DiskInfo *tgt; off_t capacity; if (optind >= argc) { filename = "dst.vmdk"; } else { filename = argv[optind++]; } capacity = di->vmt->getCapacity(di); if (strcmp(&(filename[strlen(filename) - 5]), ".vmdk") == 0) tgt = StreamOptimized_Create(filename, capacity); else tgt = Flat_Create(filename, capacity); if (tgt == NULL) { fprintf(stderr, "Cannot open target disk %s: %s\n", filename, strerror(errno)); } else { printf("Starting to convert %s to %s...\n", src, filename); if (copyDisk(di, tgt)) { printf("Success\n"); } else { fprintf(stderr, "Failure!\n"); } } } di->vmt->close(di); } return 0; } 0707010000002C000081A40000000000000000000000016553B889000065BA000000000000000000000000000000000000002000000000open-vmdk-0.3.6.0/vmdk/sparse.c/* ******************************************************************************** * Copyright (c) 2014-2023 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. * *********************************************************************************/ #define _GNU_SOURCE #include "vmware_vmdk.h" #include "diskinfo.h" #include <errno.h> #include <fcntl.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <zlib.h> #define CEILING(x, y) (((x) + (y) - 1) / (y)) #define VMDK_SECTOR_SIZE 512ULL static uint16_t getUnalignedLE16(const __le16 *src) { const uint8_t *b = (const uint8_t *)src; return (b[1] << 8) | b[0]; } static uint64_t getUnalignedLE64(const __le64 *src) { __le64 b; memcpy(&b, src, sizeof b); return __le64_to_cpu(b); } static void setUnalignedLE16(__le16 *dst, uint16_t src) { uint8_t *b = (uint8_t *)dst; b[0] = src; b[1] = src >> 8; } static void setUnalignedLE64(__le64 *dst, uint64_t src) { uint64_t tmp = __cpu_to_le64(src); memcpy(dst, &tmp, sizeof *dst); } static bool checkSparseExtentHeader(const SparseExtentHeaderOnDisk *src) { return src->magicNumber == __cpu_to_le32(SPARSE_MAGICNUMBER); } static bool getSparseExtentHeader(SparseExtentHeader *dst, const SparseExtentHeaderOnDisk *src) { if (src->magicNumber != __cpu_to_le32(SPARSE_MAGICNUMBER)) { return false; } dst->version = __le32_to_cpu(src->version); if (dst->version > SPARSE_VERSION_INCOMPAT_FLAGS) { return false; } dst->flags = __le32_to_cpu(src->flags); if (dst->flags & (SPARSEFLAG_INCOMPAT_FLAGS & ~SPARSEFLAG_COMPRESSED & ~SPARSEFLAG_EMBEDDED_LBA)) { return false; } if (dst->flags & SPARSEFLAG_VALID_NEWLINE_DETECTOR) { if (src->singleEndLineChar != SPARSE_SINGLE_END_LINE_CHAR || src->nonEndLineChar != SPARSE_NON_END_LINE_CHAR || src->doubleEndLineChar1 != SPARSE_DOUBLE_END_LINE_CHAR1 || src->doubleEndLineChar2 != SPARSE_DOUBLE_END_LINE_CHAR2) { return false; } } /* Embedded LBA is allowed with compressed flag only. */ if (dst->flags & SPARSEFLAG_EMBEDDED_LBA) { if (!(dst->flags & SPARSEFLAG_COMPRESSED)) { return false; } } dst->compressAlgorithm = getUnalignedLE16(&src->compressAlgorithm); dst->uncleanShutdown = src->uncleanShutdown; dst->reserved = 0; dst->capacity = getUnalignedLE64(&src->capacity); dst->grainSize = getUnalignedLE64(&src->grainSize); dst->descriptorOffset = getUnalignedLE64(&src->descriptorOffset); dst->descriptorSize = getUnalignedLE64(&src->descriptorSize); dst->numGTEsPerGT = __le32_to_cpu(src->numGTEsPerGT); dst->rgdOffset = __le64_to_cpu(src->rgdOffset); dst->gdOffset = __le64_to_cpu(src->gdOffset); dst->overHead = __le64_to_cpu(src->overHead); return true; } static void setSparseExtentHeader(SparseExtentHeaderOnDisk *dst, const SparseExtentHeader *src, bool temporary) { memset(dst, 0, sizeof *dst); /* Use lowercase 'vmdk' signature for temporary stuff. */ if (temporary) { dst->magicNumber = __cpu_to_le32(SPARSE_MAGICNUMBER ^ 0x20202020); } else { dst->magicNumber = __cpu_to_le32(SPARSE_MAGICNUMBER); } dst->version = __cpu_to_le32(src->version); dst->flags = __cpu_to_le32(src->flags); dst->singleEndLineChar = SPARSE_SINGLE_END_LINE_CHAR; dst->nonEndLineChar = SPARSE_NON_END_LINE_CHAR; dst->doubleEndLineChar1 = SPARSE_DOUBLE_END_LINE_CHAR1; dst->doubleEndLineChar2 = SPARSE_DOUBLE_END_LINE_CHAR2; setUnalignedLE16(&dst->compressAlgorithm, src->compressAlgorithm); dst->uncleanShutdown = src->uncleanShutdown; setUnalignedLE64(&dst->capacity, src->capacity); setUnalignedLE64(&dst->grainSize, src->grainSize); setUnalignedLE64(&dst->descriptorOffset, src->descriptorOffset); setUnalignedLE64(&dst->descriptorSize, src->descriptorSize); dst->numGTEsPerGT = __cpu_to_le32(src->numGTEsPerGT); dst->rgdOffset = __cpu_to_le64(src->rgdOffset); dst->gdOffset = __cpu_to_le64(src->gdOffset); dst->overHead = __cpu_to_le64(src->overHead); } static char * makeDiskDescriptorFile(const char *fileName, uint64_t capacity, uint32_t cid) { static const char ddfTemplate[] = "# Disk DescriptorFile\n" "version=1\n" "encoding=\"UTF-8\"\n" "CID=%08x\n" "parentCID=ffffffff\n" "createType=\"streamOptimized\"\n" "\n" "# Extent description\n" "RW %llu SPARSE \"%s\"\n" "\n" "# The Disk Data Base\n" "#DDB\n" "\n" "ddb.longContentID = \"%08x%08x%08x%08x\"\n" "ddb.virtualHWVersion = \"4\"\n" /* This field is obsolete, used by ESX3.x and older only. */ "ddb.geometry.cylinders = \"%u\"\n" "ddb.geometry.heads = \"255\"\n" /* 255/63 is good for anything bigger than 4GB. */ "ddb.geometry.sectors = \"63\"\n" "ddb.adapterType = \"lsilogic\"\n" "ddb.toolsInstallType = \"4\"\n" /* unmanaged (open-vm-tools) */ "ddb.toolsVersion = \"%s\""; /* open-vm-tools version */ unsigned int cylinders; char *ret; if (capacity > 65535 * 255 * 63) { cylinders = 65535; } else { cylinders = CEILING(capacity, 255 * 63); } if (asprintf(&ret, ddfTemplate, cid, (long long int)capacity, fileName, (uint32_t)mrand48(), (uint32_t)mrand48(), (uint32_t)mrand48(), cid, cylinders, toolsVersion) == -1) { return NULL; } return ret; } typedef union { SparseGrainLBAHeaderOnDisk *grainHdr; SparseSpecialLBAHeaderOnDisk *specialHdr; uint8_t *data; } ZLibBuffer; typedef struct { uint64_t GTEs; uint32_t GTs; uint32_t GDsectors; uint32_t GTsectors; uint64_t lastGrainNr; uint32_t lastGrainSize; __le32 *gd; __le32 *gt; } SparseGTInfo; typedef struct { SparseGTInfo gtInfo; off_t gdOffset; off_t gtOffset; off_t rgdOffset; off_t rgtOffset; uint32_t curSP; ZLibBuffer zlibBuffer; size_t zlibBufferSize; z_stream zstream; int fd; char *fileName; uint8_t *grainBuffer; uint64_t grainBufferNr; uint32_t grainBufferValidStart; uint32_t grainBufferValidEnd; } SparseVmdkWriter; typedef struct { DiskInfo hdr; SparseVmdkWriter writer; SparseExtentHeader diskHdr; } StreamOptimizedDiskInfo; static StreamOptimizedDiskInfo * getSODI(DiskInfo *self) { return (StreamOptimizedDiskInfo *)self; } static bool isPow2(uint64_t val) { return (val & (val - 1)) == 0; } static bool getGDGT(SparseGTInfo *gtInfo, const SparseExtentHeader *hdr) { if (hdr->grainSize < 1 || hdr->grainSize > 128 || !isPow2(hdr->grainSize)) { return false; } /* disklib supports only 512 GTEs per GT (=> 4KB GT size). Streaming is more flexible. */ if (hdr->numGTEsPerGT < VMDK_SECTOR_SIZE / sizeof(uint32_t) || !isPow2(hdr->numGTEsPerGT)) { return false; } gtInfo->lastGrainNr = hdr->capacity / hdr->grainSize; gtInfo->lastGrainSize = (hdr->capacity & (hdr->grainSize - 1)) * VMDK_SECTOR_SIZE; { uint64_t GTEs = gtInfo->lastGrainNr + (gtInfo->lastGrainSize != 0); /* Number of GTEs must be less than 2^32. Actually capacity must be less than 2^32 (2TB) for everything except streamOptimized format... */ uint32_t GTs = CEILING(GTEs, hdr->numGTEsPerGT); uint32_t GDsectors = CEILING(GTs * sizeof(uint32_t), VMDK_SECTOR_SIZE); uint32_t GTsectors = CEILING(hdr->numGTEsPerGT * sizeof(uint32_t), VMDK_SECTOR_SIZE); uint32_t *gd = calloc(GDsectors + GTsectors * GTs, VMDK_SECTOR_SIZE); uint32_t *gt; if (!gd) { return false; } gt = gd + GDsectors * VMDK_SECTOR_SIZE / sizeof(uint32_t); gtInfo->GTEs = GTEs; gtInfo->GTs = GTs; gtInfo->GDsectors = GDsectors; gtInfo->gd = gd; gtInfo->GTsectors = GTsectors; gtInfo->gt = gt; } return true; } static SectorType prefillGD(SparseGTInfo *gtInfo, SectorType gtBase) { uint32_t i; for (i = 0; i < gtInfo->GTs; i++) { gtInfo->gd[i] = __cpu_to_le32(gtBase); gtBase += gtInfo->GTsectors; } return gtBase; } static bool safeWrite(int fd, const void *buf, size_t len) { ssize_t written = write(fd, buf, len); if (written == -1) { fprintf(stderr, "Write failed: %s\n", strerror(errno)); return false; } if ((size_t)written != len) { fprintf(stderr, "Short write. Disk full?\n"); return false; } return true; } static bool safePread(int fd, void *buf, size_t len, off_t pos) { ssize_t rd = pread(fd, buf, len, pos); if (rd == -1) { fprintf(stderr, "Read failed: %s\n", strerror(errno)); return false; } if ((size_t)rd != len) { fprintf(stderr, "Short read, %zu instead of %zu\n", rd, len); return false; } return true; } static bool isZeroed(const void *data, size_t len) { const uint64_t *data64 = data; len = len >> 3; while (len--) { if (*data64++ != 0) { return false; } } return true; } static int fillGrain(StreamOptimizedDiskInfo *sodi) { size_t lenBytes; if (sodi->writer.grainBufferNr < sodi->writer.gtInfo.lastGrainNr) { lenBytes = sodi->diskHdr.grainSize * VMDK_SECTOR_SIZE; } else if (sodi->writer.grainBufferNr == sodi->writer.gtInfo.lastGrainNr) { lenBytes = sodi->writer.gtInfo.lastGrainSize; } else { lenBytes = 0; } if (sodi->writer.grainBufferValidStart == 0 && sodi->writer.grainBufferValidEnd >= lenBytes) { return 0; } if (sodi->writer.gtInfo.gt[sodi->writer.grainBufferNr] != __cpu_to_le32(0)) { fprintf(stderr, "Unimplemented read-modify-write.\n"); return -1; } if (sodi->writer.grainBufferValidStart != 0) { memset(sodi->writer.grainBuffer, 0, sodi->writer.grainBufferValidStart); sodi->writer.grainBufferValidStart = 0; } if (sodi->writer.grainBufferValidEnd < lenBytes) { memset(sodi->writer.grainBuffer + sodi->writer.grainBufferValidEnd, 0, lenBytes - sodi->writer.grainBufferValidEnd); sodi->writer.grainBufferValidEnd = lenBytes; } return 0; } static int flushGrain(StreamOptimizedDiskInfo *sodi) { int ret; uint32_t oldLoc; if (sodi->writer.grainBufferNr == ~0ULL) { return 0; } if (sodi->writer.grainBufferValidEnd == 0) { return 0; } ret = fillGrain(sodi); if (ret) { return ret; } oldLoc = __le32_to_cpu(sodi->writer.gtInfo.gt[sodi->writer.grainBufferNr]); if (oldLoc != 0) { fprintf(stderr, "Cannot update already written grain\n"); return -1; } if (!isZeroed(sodi->writer.grainBuffer, sodi->writer.grainBufferValidEnd)) { size_t dataLen; uint32_t rem; SparseGrainLBAHeaderOnDisk *grainHdr = sodi->writer.zlibBuffer.grainHdr; sodi->writer.gtInfo.gt[sodi->writer.grainBufferNr] = __cpu_to_le32(sodi->writer.curSP); if (deflateReset(&sodi->writer.zstream) != Z_OK) { fprintf(stderr, "DeflateReset failed\n"); return -1; } sodi->writer.zstream.next_in = sodi->writer.grainBuffer; sodi->writer.zstream.avail_in = sodi->writer.grainBufferValidEnd; sodi->writer.zstream.next_out = sodi->writer.zlibBuffer.data + sizeof *grainHdr; sodi->writer.zstream.avail_out = sodi->writer.zlibBufferSize - sizeof *grainHdr; if (deflate(&sodi->writer.zstream, Z_FINISH) != Z_STREAM_END) { fprintf(stderr, "Deflate failed\n"); return -1; } dataLen = sodi->writer.zstream.next_out - sodi->writer.zlibBuffer.data; grainHdr->lba = sodi->writer.grainBufferNr * sodi->diskHdr.grainSize; grainHdr->cmpSize = __cpu_to_le32(dataLen - sizeof *grainHdr); rem = dataLen & (VMDK_SECTOR_SIZE - 1); if (rem != 0) { rem = VMDK_SECTOR_SIZE - rem; memset(sodi->writer.zstream.next_out, 0, rem); dataLen += rem; } if (!safeWrite(sodi->writer.fd, grainHdr, dataLen)) { return -1; } sodi->writer.curSP += dataLen / VMDK_SECTOR_SIZE; } return 0; } static int prepareGrain(StreamOptimizedDiskInfo *sodi, uint64_t grainNr) { if (grainNr != sodi->writer.grainBufferNr) { int ret; ret = flushGrain(sodi); if (ret < 0) { return ret; } sodi->writer.grainBufferNr = grainNr; sodi->writer.grainBufferValidStart = 0; sodi->writer.grainBufferValidEnd = 0; } return 0; } static ssize_t StreamOptimizedPwrite(DiskInfo *self, const void *buf, size_t length, off_t pos) { const uint8_t *buf8 = buf; StreamOptimizedDiskInfo *sodi = getSODI(self); SparseVmdkWriter *writer = &sodi->writer; SparseExtentHeader *hdr = &sodi->diskHdr; uint64_t grainNr = pos / (hdr->grainSize * VMDK_SECTOR_SIZE); uint32_t updateStart = pos & (hdr->grainSize * VMDK_SECTOR_SIZE - 1); while (length > 0) { uint32_t updateLen; uint32_t updateEnd; if (prepareGrain(sodi, grainNr)) { return -1; } updateLen = hdr->grainSize * VMDK_SECTOR_SIZE - updateStart; if (length < updateLen) { updateLen = length; length = 0; } else { length -= updateLen; } updateEnd = updateStart + updateLen; if (writer->grainBufferValidEnd == 0) { ; } else if (updateEnd < writer->grainBufferValidStart || updateStart > writer->grainBufferValidEnd) { if (fillGrain(sodi)) { return -1; } } memcpy(writer->grainBuffer + updateStart, buf8, updateLen); if (updateStart < writer->grainBufferValidStart || writer->grainBufferValidEnd == 0) { writer->grainBufferValidStart = updateStart; } if (updateEnd > writer->grainBufferValidEnd) { writer->grainBufferValidEnd = updateEnd; } buf8 += updateLen; grainNr++; updateStart = 0; } return buf8 - (const uint8_t *)buf; } static bool writeSpecial(SparseVmdkWriter *writer, uint32_t marker, SectorType length) { SparseSpecialLBAHeaderOnDisk *specialHdr = writer->zlibBuffer.specialHdr; memset(writer->zlibBuffer.data, 0, VMDK_SECTOR_SIZE); specialHdr->lba = __cpu_to_le64(length); specialHdr->type = __cpu_to_le32(marker); return safeWrite(writer->fd, specialHdr, VMDK_SECTOR_SIZE); } static bool writeEOS(SparseVmdkWriter *writer) { return writeSpecial(writer, GRAIN_MARKER_EOS, 0); } static int StreamOptimizedFinalize(StreamOptimizedDiskInfo *sodi) { int ret; ret = close(sodi->writer.fd); deflateEnd(&sodi->writer.zstream); free(sodi->writer.gtInfo.gd); free(sodi->writer.grainBuffer); free(sodi->writer.zlibBuffer.data); free(sodi->writer.fileName); free(sodi); return ret; } static int StreamOptimizedAbort(DiskInfo *self) { StreamOptimizedDiskInfo *sodi = getSODI(self); return StreamOptimizedFinalize(sodi); } static int StreamOptimizedClose(DiskInfo *self) { StreamOptimizedDiskInfo *sodi = getSODI(self); uint32_t cid; char *descFile; SparseExtentHeaderOnDisk onDisk; if (flushGrain(sodi)) { goto failAll; } writeEOS(&sodi->writer); if (lseek(sodi->writer.fd, sodi->writer.gdOffset * VMDK_SECTOR_SIZE, SEEK_SET) == -1) { goto failAll; } if (!safeWrite(sodi->writer.fd, sodi->writer.gtInfo.gd, (sodi->writer.gtInfo.GDsectors + sodi->writer.gtInfo.GTsectors * sodi->writer.gtInfo.GTs) * VMDK_SECTOR_SIZE)) { goto failAll; } do { cid = mrand48(); /* * Do not accept 0xFFFFFFFF and 0xFFFFFFFE. They may be interpreted by * some software as no parent, or disk full of zeroes. */ } while (cid == 0xFFFFFFFFU || cid == 0xFFFFFFFEU); descFile = makeDiskDescriptorFile(sodi->writer.fileName, sodi->diskHdr.capacity, cid); if (pwrite(sodi->writer.fd, descFile, strlen(descFile), sodi->diskHdr.descriptorOffset * VMDK_SECTOR_SIZE) != (ssize_t)strlen(descFile)) { free(descFile); goto failAll; } free(descFile); /* * Write everything out as it should be, except that file signature is * vmdk, rather than VMDK. Then flush everything to the media, and finally * rewrite header with proper VMDK signature. */ setSparseExtentHeader(&onDisk, &sodi->diskHdr, true); if (pwrite(sodi->writer.fd, &onDisk, sizeof onDisk, 0) != sizeof onDisk) { goto failAll; } if (fsync(sodi->writer.fd) != 0) { goto failAll; } setSparseExtentHeader(&onDisk, &sodi->diskHdr, false); if (pwrite(sodi->writer.fd, &onDisk, sizeof onDisk, 0) != sizeof onDisk) { goto failAll; } if (fsync(sodi->writer.fd) != 0) { goto failAll; } return StreamOptimizedFinalize(sodi); failAll: StreamOptimizedAbort(&sodi->hdr); return -1; } static DiskInfoVMT streamOptimizedVMT = { .pwrite = StreamOptimizedPwrite, .close = StreamOptimizedClose, .abort = StreamOptimizedAbort }; DiskInfo * StreamOptimized_Create(const char *fileName, off_t capacity) { StreamOptimizedDiskInfo *sodi; size_t maxOutSize; sodi = malloc(sizeof *sodi); if (!sodi) { goto fail; } memset(sodi, 0, sizeof *sodi); sodi->writer.fileName = strdup(fileName); if (!sodi->writer.fileName) { goto failSODI; } sodi->hdr.vmt = &streamOptimizedVMT; sodi->diskHdr.version = SPARSE_VERSION_INCOMPAT_FLAGS; sodi->diskHdr.flags = SPARSEFLAG_VALID_NEWLINE_DETECTOR | SPARSEFLAG_COMPRESSED | SPARSEFLAG_EMBEDDED_LBA; sodi->diskHdr.numGTEsPerGT = 512; sodi->diskHdr.compressAlgorithm = SPARSE_COMPRESSALGORITHM_DEFLATE; sodi->diskHdr.grainSize = 128; sodi->diskHdr.overHead = 1; sodi->diskHdr.capacity = CEILING(capacity, VMDK_SECTOR_SIZE); if (!getGDGT(&sodi->writer.gtInfo, &sodi->diskHdr)) { goto failFileName; } sodi->writer.fd = open(fileName, O_RDWR | O_CREAT | O_TRUNC, 0666); if (sodi->writer.fd == -1) { goto failGDGT; } sodi->diskHdr.descriptorOffset = sodi->diskHdr.overHead; sodi->diskHdr.descriptorSize = 20; sodi->diskHdr.overHead = sodi->diskHdr.overHead + sodi->diskHdr.descriptorSize; sodi->writer.gdOffset = sodi->diskHdr.overHead; sodi->diskHdr.gdOffset = sodi->writer.gdOffset; sodi->diskHdr.overHead += sodi->writer.gtInfo.GDsectors; sodi->writer.gtOffset = sodi->diskHdr.overHead; sodi->diskHdr.overHead = prefillGD(&sodi->writer.gtInfo, sodi->diskHdr.overHead); sodi->writer.curSP = sodi->diskHdr.overHead; sodi->writer.grainBuffer = malloc(sodi->diskHdr.grainSize * VMDK_SECTOR_SIZE); if (!sodi->writer.grainBuffer) { goto failFD; } sodi->writer.grainBufferNr = ~0ULL; sodi->writer.zstream.zalloc = NULL; sodi->writer.zstream.zfree = NULL; sodi->writer.zstream.opaque = &sodi->writer; if (deflateInit(&sodi->writer.zstream, Z_BEST_COMPRESSION) != Z_OK) { goto failGrainBuffer; } maxOutSize = deflateBound(&sodi->writer.zstream, sodi->diskHdr.grainSize * VMDK_SECTOR_SIZE) + sizeof(SparseGrainLBAHeaderOnDisk); maxOutSize = (maxOutSize + VMDK_SECTOR_SIZE - 1) & ~(VMDK_SECTOR_SIZE - 1); sodi->writer.zlibBufferSize = maxOutSize; sodi->writer.zlibBuffer.data = malloc(maxOutSize); if (!sodi->writer.zlibBuffer.data) { goto failDeflate; } if (lseek(sodi->writer.fd, sodi->writer.curSP * VMDK_SECTOR_SIZE, SEEK_SET) == -1) { goto failAll; } return &sodi->hdr; failAll: free(sodi->writer.zlibBuffer.data); failDeflate: deflateEnd(&sodi->writer.zstream); failGrainBuffer: free(sodi->writer.grainBuffer); failFD: close(sodi->writer.fd); failGDGT: free(sodi->writer.gtInfo.gd); failFileName: free(sodi->writer.fileName); failSODI: free(sodi); fail: return NULL; } typedef struct { DiskInfo hdr; SparseExtentHeader diskHdr; SparseGTInfo gtInfo; uint8_t *readBuffer; uint8_t *grainBuffer; size_t readBufferSize; z_stream zstream; int fd; } SparseDiskInfo; typedef struct { off_t pos; uint8_t *buf; size_t len; int fd; } CoalescedPreader; static void CoalescedPreaderInit(CoalescedPreader *p, int fd) { p->fd = fd; p->len = 0; } static int CoalescedPreaderExec(CoalescedPreader *p) { return p->len ? safePread(p->fd, p->buf, p->len, p->pos) ? 0 : -1 : 0; } static int CoalescedPreaderPread(CoalescedPreader *p, void *buf, size_t len, off_t pos) { if (len != 0) { if (0 == p->pos + p->len - pos && buf == p->buf + p->len) { p->len += len; return 0; } if (CoalescedPreaderExec(p)) { return -1; } } p->buf = buf; p->len = len; p->pos = pos; return 0; } static SparseDiskInfo * getSDI(DiskInfo *self) { return (SparseDiskInfo *)self; } static off_t SparseGetCapacity(DiskInfo *self) { SparseDiskInfo *sdi = getSDI(self); return sdi->diskHdr.capacity * VMDK_SECTOR_SIZE; } static int SparseNextData(DiskInfo *self, off_t *pos, off_t *end) { SparseDiskInfo *sdi = getSDI(self); off_t p = *end; uint32_t grainNr = p / (sdi->diskHdr.grainSize * VMDK_SECTOR_SIZE); uint32_t skip = p & (sdi->diskHdr.grainSize * VMDK_SECTOR_SIZE - 1); bool want = false; while (grainNr < sdi->gtInfo.GTEs) { bool empty = sdi->gtInfo.gt[grainNr] == __cpu_to_le32(0); if (empty == want) { if (want) { *end = grainNr * (sdi->diskHdr.grainSize * VMDK_SECTOR_SIZE); return 0; } *pos = grainNr * (sdi->diskHdr.grainSize * VMDK_SECTOR_SIZE) | skip; want = true; } skip = 0; grainNr++; } if (want) { *end = sdi->gtInfo.lastGrainNr * (sdi->diskHdr.grainSize * VMDK_SECTOR_SIZE) + sdi->gtInfo.lastGrainSize; return 0; } errno = ENXIO; return -1; } static ssize_t SparsePread(DiskInfo *self, void *buf, size_t len, off_t pos) { SparseDiskInfo *sdi = getSDI(self); uint8_t *buf8 = buf; uint32_t grainNr = pos / (sdi->diskHdr.grainSize * VMDK_SECTOR_SIZE); uint32_t readSkip = pos & (sdi->diskHdr.grainSize * VMDK_SECTOR_SIZE - 1); while (len > 0) { uint32_t readLen; uint32_t sect; uint32_t grainSize; if (grainNr < sdi->gtInfo.lastGrainNr) { grainSize = sdi->diskHdr.grainSize * VMDK_SECTOR_SIZE; } else if (grainNr == sdi->gtInfo.lastGrainNr) { grainSize = sdi->gtInfo.lastGrainSize; } else { grainSize = 0; } if (readSkip >= grainSize) { break; } readLen = grainSize - readSkip; sect = __le32_to_cpu(sdi->gtInfo.gt[grainNr]); if (sect == 0) { /* Read from parent... No parent for us... */ memset(buf8, 0, readLen); } else if (sect == 1) { memset(buf8, 0, readLen); } else { if (sdi->diskHdr.flags & SPARSEFLAG_COMPRESSED) { uint32_t hdrlen; uint32_t cmpSize; if (!safePread(sdi->fd, sdi->readBuffer, VMDK_SECTOR_SIZE, sect * VMDK_SECTOR_SIZE)) { return -1; } if (sdi->diskHdr.flags & SPARSEFLAG_EMBEDDED_LBA) { SparseGrainLBAHeaderOnDisk *hdr = (SparseGrainLBAHeaderOnDisk *)sdi->readBuffer; if (__le64_to_cpu(hdr->lba) != grainNr * sdi->diskHdr.grainSize) { return -1; } cmpSize = __le32_to_cpu(hdr->cmpSize); hdrlen = 12; } else { cmpSize = __le32_to_cpu(*(__le32*)sdi->readBuffer); hdrlen = 4; } if (cmpSize > sdi->readBufferSize - hdrlen) { return -1; } if (cmpSize + hdrlen > VMDK_SECTOR_SIZE) { size_t remainingLength = (cmpSize + hdrlen - VMDK_SECTOR_SIZE + VMDK_SECTOR_SIZE - 1) & ~(VMDK_SECTOR_SIZE - 1); if (!safePread(sdi->fd, sdi->readBuffer + VMDK_SECTOR_SIZE, remainingLength, (sect + 1) * VMDK_SECTOR_SIZE)) { return -1; } } if (inflateReset(&sdi->zstream) != Z_OK) { return -1; } sdi->zstream.next_in = sdi->readBuffer + hdrlen; sdi->zstream.avail_in = cmpSize; sdi->zstream.next_out = sdi->grainBuffer; sdi->zstream.avail_out = sdi->diskHdr.grainSize * VMDK_SECTOR_SIZE; if (inflate(&sdi->zstream, Z_FINISH) != Z_STREAM_END) { return -1; } if (sdi->diskHdr.grainSize * VMDK_SECTOR_SIZE - sdi->zstream.avail_out < grainSize) { return -1; } memcpy(buf8, sdi->grainBuffer + readSkip, readLen); } else { if (!safePread(sdi->fd, buf8, readLen, sect * VMDK_SECTOR_SIZE + readSkip)) { return -1; } } } buf8 += readLen; len -= readLen; grainNr++; readSkip = 0; } return buf8 - (uint8_t *)buf; } static int SparseClose(DiskInfo *self) { SparseDiskInfo *sdi = getSDI(self); int fd; if (sdi->readBuffer) { inflateEnd(&sdi->zstream); free(sdi->readBuffer); } free(sdi->gtInfo.gd); fd = sdi->fd; free(sdi); return close(fd); } static DiskInfoVMT sparseVMT = { .getCapacity = SparseGetCapacity, .nextData = SparseNextData, .pread = SparsePread, .close = SparseClose, .abort = SparseClose, }; DiskInfo * Sparse_Open(const char *fileName) { SparseDiskInfo *sdi; int fd; SparseExtentHeaderOnDisk onDisk; uint32_t i; uint32_t *gt; CoalescedPreader cp = {0}; fd = open(fileName, O_RDONLY); if (fd == -1) { goto fail; } if (read(fd, &onDisk, sizeof onDisk) != sizeof onDisk) { goto failFd; } if (!checkSparseExtentHeader(&onDisk)) { goto failFd; } sdi = malloc(sizeof *sdi); if (!sdi) { goto failFd; } memset(sdi, 0, sizeof *sdi); sdi->fd = fd; if (!getSparseExtentHeader(&sdi->diskHdr, &onDisk)) { goto failSdi; } sdi->hdr.vmt = &sparseVMT; if (!getGDGT(&sdi->gtInfo, &sdi->diskHdr)) { goto failSdi; } if (sdi->diskHdr.flags & SPARSEFLAG_COMPRESSED) { sdi->readBuffer = malloc((sdi->diskHdr.grainSize * 2 + 1) * VMDK_SECTOR_SIZE); if (sdi->readBuffer == NULL) { goto failGDGT; } sdi->readBufferSize = (sdi->diskHdr.grainSize + 1) * VMDK_SECTOR_SIZE; sdi->grainBuffer = sdi->readBuffer + sdi->readBufferSize; sdi->zstream.zalloc = NULL; sdi->zstream.zfree = NULL; sdi->zstream.opaque = sdi; if (inflateInit(&sdi->zstream) != Z_OK) { goto failRB; } } if (!safePread(fd, sdi->gtInfo.gd, sdi->gtInfo.GDsectors * VMDK_SECTOR_SIZE, sdi->diskHdr.gdOffset * VMDK_SECTOR_SIZE)) { goto failDF; } CoalescedPreaderInit(&cp, fd); gt = sdi->gtInfo.gt; for (i = 0; i < sdi->gtInfo.GTs; i++) { uint32_t loc = __le32_to_cpu(sdi->gtInfo.gd[i]); if (loc != 0) { if (CoalescedPreaderPread(&cp, gt, sdi->gtInfo.GTsectors * VMDK_SECTOR_SIZE, loc * VMDK_SECTOR_SIZE)) { goto failDF; } } gt += sdi->diskHdr.numGTEsPerGT; } if (CoalescedPreaderExec(&cp)) { goto failDF; } return &sdi->hdr; failDF: if (sdi->readBuffer) { inflateEnd(&sdi->zstream); } failRB: free(sdi->readBuffer); failGDGT: free(sdi->gtInfo.gd); failSdi: free(sdi); failFd: close(fd); fail: return NULL; } 0707010000002D000081A40000000000000000000000016553B88900000BCC000000000000000000000000000000000000002500000000open-vmdk-0.3.6.0/vmdk/vmware_vmdk.h/* ******************************************************************************** * Copyright (c) 2014-2023 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. * *********************************************************************************/ #ifndef _VMWARE_VMDK_H_ #define _VMWARE_VMDK_H_ #include <asm/byteorder.h> #include <stdint.h> #include <stdbool.h> #pragma pack(push, 1) typedef struct { __le32 magicNumber; __le32 version; __le32 flags; __le64 capacity; /* UA */ __le64 grainSize; /* UA */ __le64 descriptorOffset; /* UA */ __le64 descriptorSize; /* UA */ __le32 numGTEsPerGT; __le64 rgdOffset; __le64 gdOffset; __le64 overHead; uint8_t uncleanShutdown; char singleEndLineChar; char nonEndLineChar; char doubleEndLineChar1; char doubleEndLineChar2; __le16 compressAlgorithm; /* UA */ uint8_t pad[433]; } SparseExtentHeaderOnDisk; #pragma pack(pop) #define SPARSE_MAGICNUMBER 0x564d444b /* VMDK */ #define SPARSE_VERSION_INCOMPAT_FLAGS 3 #define SPARSE_GTE_EMPTY 0x00000000 #define SPARSE_GD_AT_END 0xFFFFFFFFFFFFFFFFULL #define SPARSE_SINGLE_END_LINE_CHAR '\n' #define SPARSE_NON_END_LINE_CHAR ' ' #define SPARSE_DOUBLE_END_LINE_CHAR1 '\r' #define SPARSE_DOUBLE_END_LINE_CHAR2 '\n' #define SPARSEFLAG_COMPAT_FLAGS 0x0000FFFFU #define SPARSEFLAG_VALID_NEWLINE_DETECTOR (1 << 0) #define SPARSEFLAG_USE_REDUNDANT (1 << 1) #define SPARSEFLAG_MAGIC_GTE (1 << 2) #define SPARSEFLAG_INCOMPAT_FLAGS 0xFFFF0000U #define SPARSEFLAG_COMPRESSED (1 << 16) #define SPARSEFLAG_EMBEDDED_LBA (1 << 17) #define SPARSE_COMPRESSALGORITHM_NONE 0x0000 #define SPARSE_COMPRESSALGORITHM_DEFLATE 0x0001 #pragma pack(push, 1) typedef struct { __le64 lba; __le32 cmpSize; } SparseGrainLBAHeaderOnDisk; #pragma pack(pop) #pragma pack(push, 1) typedef struct { __le64 lba; __le32 cmpSize; __le32 type; } SparseSpecialLBAHeaderOnDisk; #pragma pack(pop) #define GRAIN_MARKER_EOS 0 #define GRAIN_MARKER_GRAIN_TABLE 1 #define GRAIN_MARKER_GRAIN_DIRECTORY 2 #define GRAIN_MARKER_FOOTER 3 #define GRAIN_MARKER_PROGRESS 4 typedef uint64_t SectorType; typedef struct { uint32_t version; uint32_t flags; uint32_t numGTEsPerGT; uint16_t compressAlgorithm; uint8_t uncleanShutdown; uint8_t reserved; SectorType capacity; SectorType grainSize; SectorType descriptorOffset; SectorType descriptorSize; SectorType rgdOffset; SectorType gdOffset; SectorType overHead; } SparseExtentHeader; #endif /* _VMWARE_VMDK_H_ */ 07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!488 blocks
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor