Managing Image Instances

Under Administrator > Virtualization > Images > Image Instance, the list shows the image instances of the selected cluster with their status, and each row offers Update Display Name, Update Default Specification, Re-import and Delete. Click a name to open its details: the import source, the import DataVolume, the claim, the phase, the progress and the reason of a failure. Image instances of a namespace are managed the same way from the namespace; see Image Instances in a Namespace.

Status

StatusMeaning
AvailableThe image instance can be used to create virtual machines.
ImportingCDI is filling the volume; the progress is shown. The storage of this image instance was deleted and is being imported again means the claim was deleted while the import DataVolume remained, so CDI recreates it.
Import errorThe import keeps failing and CDI retries it; the reason below tells why.
FailedThe import failed for good (for example a checksum mismatch); re-import or delete the image instance.
IncompleteNeither the import DataVolume nor the claim exists any more. Re-import or delete the image instance.
Waiting for the source digestAn image instance managed by a DataImportCron that has not yet found the image to import.
UnavailableNone of the above applies; check the DataSource conditions.

During a re-import, Re-importing (with progress) or Re-import error is shown next to the status.

An import error or failure is shown with a reason and CDI's original message:

ReasonTypical cause
Checksum mismatchThe downloaded image does not match the Checksum.
Image not foundWrong URL or image tag.
Authentication failedThe credential is wrong or missing.
Credential Secret incompleteThe Secret lacks accessKeyId or secretKey.
Certificate not trustedThe server certificate is self-signed or from a private CA and no matching CA Certificate was given.
Certificate does not match the addressThe host of the image address is not in the certificate's Subject Alternative Names.
Size smaller than the imageInstance Size is smaller than the virtual size of the image.
Quota exceededThe namespace's storage quota is used up.
Storage class not usableThe storage class does not exist or cannot provision the requested modes.
Import pod cannot startThe importer pod cannot be scheduled or started.
Origin in useA clone from a disk has not started because the disk is in use (CDI reports CloneSourceInUse); stop the virtual machine using the disk.
Import failedAny other import failure.

Only image instances that are Available — and, for those backed by a claim, whose claim is bound and whose import succeeded — are offered when creating a virtual machine.

Re-import

Re-import imports the image again from the same address with the same import settings (CA certificate, request headers, checksum, pull method, credential), for example after the image on the server was updated. A disk or volume snapshot is cloned again.

  1. Click ⋮ > Re-import on the image instance.
  2. Confirm. The dialog shows the address that will be imported.

The new import runs in a new DataVolume beside the current one. An Available image instance keeps its current image until the new import succeeds; it then switches to the new volume, and the previous DataVolume is deleted once no clone still reads from it. If the new import fails, the image instance stays on its current image and shows Re-import error.

Re-import is refused when the CA certificate ConfigMap of the image instance has been deleted (CA ConfigMap … is missing); delete the image instance and add it again with its CA certificate.

Default specification

An image instance can declare the instance type and preference virtual machines created from it should use. They are stored as four labels on its DataSource:

LabelValue
instancetype.kubevirt.io/default-instancetypeThe name of the instance type
instancetype.kubevirt.io/default-instancetype-kindVirtualMachineClusterInstancetype
instancetype.kubevirt.io/default-preferenceThe name of the preference
instancetype.kubevirt.io/default-preference-kindVirtualMachineClusterPreference

An image instance added from an image source takes these labels from the image source (see Adding Image Sources); an image imported from a registry may also carry them in the image itself. When you create a virtual machine from the image instance, they are preselected in the Model area.

Update the default specification

  1. Click ⋮ > Update Default Specification on the image instance.
  2. Select a Default Instancetype and a Default Preference of the cluster, or clear a field to remove it. Preferences named after the operating system of the image instance are marked Suggested and listed first.
  3. Click Update.

CDI copies these labels onto the DataSource from the objects behind it — the claim and the import DataVolume, a volume snapshot, or a DataImportCron — and, when the DataVolume carries none of them, from the volume it was cloned from. So the console writes your choice on those objects as well. A cleared field loses its name label but keeps its kind label: virtual machines and the console read a default only from the name label, and the remaining kind label stops CDI from copying the value of the cloned volume back. A re-import keeps your choice, cleared fields included; only a default that a registry image declares in the image itself is set again for a cleared field by the re-import — clear it again afterwards.

The same with kubectl — label the claim and the import DataVolume first, then the DataSource:

CLAIM=$(kubectl get datasource centos-7 -n kube-public -o jsonpath='{.spec.source.pvc.name}')
for obj in pvc/$CLAIM datavolume/$CLAIM datasource/centos-7; do
  kubectl label -n kube-public "$obj" --overwrite \
    instancetype.kubevirt.io/default-instancetype=u1.medium \
    instancetype.kubevirt.io/default-instancetype-kind=VirtualMachineClusterInstancetype \
    instancetype.kubevirt.io/default-preference=centos.stream9 \
    instancetype.kubevirt.io/default-preference-kind=VirtualMachineClusterPreference
done

To clear the default preference, remove its name label and keep its kind label on the same objects:

for obj in pvc/$CLAIM datavolume/$CLAIM datasource/centos-7; do
  kubectl label -n kube-public "$obj" --overwrite \
    instancetype.kubevirt.io/default-preference- \
    instancetype.kubevirt.io/default-preference-kind=VirtualMachineClusterPreference
done

Changing the default specification affects virtual machines created afterwards; existing virtual machines keep what they were created with.

Update the display name

Click ⋮ > Update Display Name. The display name is stored in the cpaas.io/display-name annotation of the DataSource.

Delete

  1. Click ⋮ > Delete on the image instance.
  2. The dialog lists the readers of the image instance: virtual machines whose system disk would no longer be re-creatable from it, virtual machine pools that could no longer create members, and clones still reading from it, which will not complete. Disks already created from the image instance are not affected.
  3. Enter the name of the image instance and confirm.

What is deleted depends on how the image instance was created:

Image instanceDeleted
Added in the console (with an import DataVolume)The DataSource; the import DataVolume, its claim and the CA certificate ConfigMap follow through their owner references.
Managed by a DataImportCronThe DataImportCron, which removes what it manages.
Published from an existing volumeThe DataSource; tick Delete storage to delete that volume as well.

With kubectl, delete the DataSource of an image instance added in the console; the rest follows:

kubectl delete datasource centos-7 -n kube-public