Export and import images using CLI
The powervc-image CLI allows you to export or import images. After exporting an image, you can import it to PowerVC and into various storage providers, and then deploy it as a virtual machine.
Exporting an image
The powervc-image CLI can be used to export an image into an OVA package. The command uses the PowerVC management server to copy image volumes. Hence it requires the PowerVC management node to have Fibre Channel connectivity for the registered storage providers participating in export or import operation.
When images are exported into an OVA package, the volumes in the image are copied into a file system default /var/opt/ibm/powervc/imgstaging on the PowerVC management server. Therefore, sufficient space must be available to copy all of the volumes to files in the file system and then create an uncompressed OVA package from the volumes. The final created OVA is then copied to /var/opt/ibm/powervc/ova default location. You can view and configure these paths using powervc-image config command for temp_staging_parent_dir and default_ova_export_dir parameters. Generating the OVA package requires additional space of approximately 5 K plus 1 K per volume. For example, if you are exporting an image with three volumes of capacities 10 GiB, 15 GiB, and 25 GiB, and the exported OVA is on the same file system as the temporary staging (download) directory, then you need 100.000016 GiB of free space to perform the export. That number is double the capacity for the volumes plus some overhead for the descriptor.
After the OVA package is created, the files that were used to create the OVA package are removed.
The resulting OVA package is compressed through pigz if the --compress option was
supplied to the export command. It also uses fast compression pigz level 9 if
–fast option is supplied. A temporary storage provider and template for that
provider is registered, but then deleted when the action is complete. You might notice that the
temporary provider appears in the list of providers. You can ignore this provider.
- Use the
powervc-image listcommand to view the available images. This command must be run as the root user. It returns only the images that are owned by the project that the command is run from. Add the --project argument to specify a project other thanibm-default.# powervc-image list +-----------------+--------------------------------------+--------+---------+------+-------------------+--------------+-----------+------------+ | Name | ID | Status | Volumes | Size | Description | Architecture | OS Distro | Exportable | +-----------------+--------------------------------------+--------+---------+------+-------------------+--------------+-----------+------------+ | MyDemoImage | a918cfc2-14e2-4653-863f-40448e7c1c5d | active | 1 | 10 | | ppc64le | ubuntu | True | | MyDemoImage-001 | 38ce9da6-b93c-4940-a930-43a9fb2a2a9d | active | 1 | 10 | Image-description | ppc64le | ubuntu | True | +-----------------+--------------------------------------+--------+---------+------+-------------------+--------------+-----------+------------+ 2 managed images returned. - Export an image:
powervc-image export --image MyDemoImage - By default, the resulting OVA package is in the /var/opt/ibm/powervc/ova folder.
Run powervc-image export -h for more information about this command.
Exporting an image from VIOS connected storage
You can export an image from VIOS connected storage when you are using shared storage pool or when you have a volume and not an image to download. For instructions, see Manually importing and exporting volumes.
Importing an image
You can import an image from an OVA package, a TAR image package, or a RAW image volume. Each of these import archive types must be uncompressed.
Run the powervc-image import command. When importing an OVA or a TAR package,
the archive file is automatically extracted to a temporary staging directory. The default directory
is /var/opt/ibm/powervc/imgstaging. The extracted files take up as much space as
the original volumes (one file per volume), but are removed when the import process is complete.
Because the OVA package is not compressed, the files
take up about the same amount of space as the OVA package.
-
The OVA package must contain a valid OVF descriptor that has sufficient information to describe the image for PowerVC. An OVF might also contain detailed deployment information. However, PowerVC does not import the deployment information. It only imports information such as the following:
- Image name and description
- Architecture
- Operating system type
- Volumes' names and data
- Whether a volume is in the boot set
A temporary storage provider and template for that provider is created, but is typically deleted when the action is complete. You might notice that the temporary provider appear in the list of providers, but you can ignore it.
A temporary volume is created for each volume in the imported image. If these volumes persist in the Data Volumes or Boot Volumes table after the import completes, you can ignore them or refresh the table to remove the entries.
- Example:
-
- Start with an uncompressed OVA package to import. The file name must end with .ova or ova.gz.
- Find the storage template ID that you want to import the image into. The storage template must
be for a supported storage provider and the volumes must be attachable to the PowerVC server instance.
- In PowerVC, navigate to .
- Open the template that you want to use and copy the ID value from the information table.
- Run the
importcommand to import the image into the storage provider using the pool and properties described in the storage template:powervc-image import -p <path_to_ova> -t <storage_template_id>You must run the command as the root user. You can use command line arguments to override the image name and description, as well as import different volumes into different storage providers. Run
powervc-image import -hfor details.