From d9ffdadfec6e2e66fee6bc2a43e6758ef824dd57 Mon Sep 17 00:00:00 2001 From: Avital Pinnick Date: Tue, 21 Jun 2022 17:50:01 +0300 Subject: [PATCH] CNV-17881: Update creating VM from CLI procedure --- modules/virt-creating-vm-cli.adoc | 105 +++++++++++++++++++++ modules/virt-creating-vm.adoc | 61 ------------ virt/virtual_machines/virt-create-vms.adoc | 9 +- 3 files changed, 112 insertions(+), 63 deletions(-) create mode 100644 modules/virt-creating-vm-cli.adoc delete mode 100644 modules/virt-creating-vm.adoc diff --git a/modules/virt-creating-vm-cli.adoc b/modules/virt-creating-vm-cli.adoc new file mode 100644 index 0000000000..a5dc9458c9 --- /dev/null +++ b/modules/virt-creating-vm-cli.adoc @@ -0,0 +1,105 @@ +// Module included in the following assemblies: +// +// * virt/virtual_machines/virt-create-vms.adoc + +:_content-type: PROCEDURE +[id="virt-creating-vm-cli_{context}"] += Using the CLI to create a virtual machine + +You can create a virtual machine from a `virtualMachine` manifest. + +.Procedure + +. Edit the `VirtualMachine` manifest for your VM. For example, the following manifest configures a {op-system-base-full} VM: ++ +.Example manifest for a {op-system-base} VM +[source,yaml] +[%collapsible] +==== +---- +apiVersion: kubevirt.io/v1 +kind: VirtualMachine +metadata: + labels: + app: <1> + name: +spec: + dataVolumeTemplates: + - apiVersion: cdi.kubevirt.io/v1beta1 + kind: DataVolume + metadata: + name: + spec: + sourceRef: + kind: DataSource + name: rhel9 + namespace: openshift-virtualization-os-images + storage: + resources: + requests: + storage: 30Gi + running: false + template: + metadata: + labels: + kubevirt.io/domain: + spec: + domain: + cpu: + cores: 1 + sockets: 2 + threads: 1 + devices: + disks: + - disk: + bus: virtio + name: rootdisk + - disk: + bus: virtio + name: cloudinitdisk + interfaces: + - masquerade: {} + name: default + rng: {} + features: + smm: + enabled: true + firmware: + bootloader: + efi: {} + resources: + requests: + memory: 8Gi + evictionStrategy: LiveMigrate + networks: + - name: default + pod: {} + volumes: + - dataVolume: + name: + name: rootdisk + - cloudInitNoCloud: + userData: |- + #cloud-config + user: cloud-user + password: '' <2> + chpasswd: { expire: False } + name: cloudinitdisk +---- +<1> Specify the name of the virtual machine. +<2> Specify the password for cloud-user. +==== + +. Create a virtual machine by using the manifest file: ++ +[source,terminal] +---- +$ oc create -f .yaml +---- + +. Optional: Start the virtual machine: ++ +[source,terminal] +---- +$ virtctl start +---- diff --git a/modules/virt-creating-vm.adoc b/modules/virt-creating-vm.adoc deleted file mode 100644 index 9548d7ec62..0000000000 --- a/modules/virt-creating-vm.adoc +++ /dev/null @@ -1,61 +0,0 @@ -// Module included in the following assemblies: -// -// * virt/virtual_machines/virt-create-vms.adoc - -:_content-type: PROCEDURE -[id="virt-creating-vm_{context}"] -= Using the CLI to create a virtual machine - -.Procedure - -The `spec` object of the virtual machine configuration file references -the virtual machine settings, such as the number of cores and the amount -of memory, the disk type, and the volumes to use. - -. Attach the virtual machine disk to the virtual machine by referencing -the relevant PVC `claimName` as a volume. - -. To create a virtual machine with the {product-title} client, run this command: -+ -[source,terminal] ----- -$ oc create -f ----- - -. Since virtual machines are created in a *Stopped* state, run a virtual machine -instance by starting it. - -[NOTE] -==== -A https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/[ReplicaSet]'s purpose is often used to guarantee the availability of a specified number of identical pods. -ReplicaSet is not currently supported in {VirtProductName}. -==== - - - -[caption=] -.Domain settings -|=== -|Setting | Description - -|Cores -|The number of cores inside the virtual machine. Must be a value greater than or equal to 1. - -|Memory -|The amount of RAM that is allocated to the virtual machine by the node. Specify a value in *M* for Megabyte or *Gi* for Gigabyte. - -|Disks -|The name of the volume that is referenced. Must match the name of a volume. -|=== - -[caption=] -.Volume settings -|=== -|Setting | Description - -|Name -|The name of the volume, which must be a DNS label and unique within the virtual machine. - -|PersistentVolumeClaim -|The PVC to attach to the virtual machine. The `claimName` of the PVC must be in the same project as the virtual machine. -|=== diff --git a/virt/virtual_machines/virt-create-vms.adoc b/virt/virtual_machines/virt-create-vms.adoc index a1827559e2..78faee1e80 100644 --- a/virt/virtual_machines/virt-create-vms.adoc +++ b/virt/virtual_machines/virt-create-vms.adoc @@ -29,6 +29,7 @@ Due to differences in storage behavior, some virtual machine templates are incom ==== include::modules/virt-creating-vm-quick-start-web.adoc[leveloffset=+1] + include::modules/virt-creating-vm-wizard-web.adoc[leveloffset=+1] Refer to the virtual machine wizard fields section when running the web console wizard. @@ -39,17 +40,21 @@ include::modules/virt-vm-wizard-fields-web.adoc[leveloffset=+2] Enable the xref:../../scalability_and_performance/using-cpu-manager.adoc#using-cpu-manager[CPU Manager] to use the high-performance workload profile. include::modules/virt-networking-wizard-fields-web.adoc[leveloffset=+2] + include::modules/virt-storage-wizard-fields-web.adoc[leveloffset=+2] + include::modules/virt-cloud-init-fields-web.adoc[leveloffset=+2] To configure storage class defaults, use storage profiles. For more information, see xref:../../virt/virtual_machines/virtual_disks/virt-creating-data-volumes.adoc#virt-customizing-storage-profile_virt-creating-data-volumes[Customizing the storage profile]. -include::modules/virt-creating-vm-yaml-web.adoc[leveloffset=+1] -include::modules/virt-creating-vm.adoc[leveloffset=+1] +include::modules/virt-creating-vm-yaml-web.adoc[leveloffset=+2] + +include::modules/virt-creating-vm-cli.adoc[leveloffset=+1] :virtualmachine!: include::modules/virt-vm-storage-volume-types.adoc[leveloffset=+1] + include::modules/virt-about-runstrategies-vms.adoc[leveloffset=+1] [id="additional-resources_virt-create-vms_{context}"]