Installing a VM
You can create a VM using an ISO file or a template.
Prerequisites
- VM ISO files have been saved to a local server and the VM operating system version and prerequisites for the installation have been determined.
- The FTP client has been installed in the local server.
- The FTP server and storage system network are accessible.
Context
Command outputs in this document are for reference only. They may vary with device versions and models.
Creating a VM Using an ISO File
- Go to the CLI.
- Create a VM.
Run the create virtual_machine general command to create a VM and use parameters name, owner_container_id, memory, vcpu_count, and sys_disk_size to specify the name, owner container ID, memory size, CPU quantity, and system disk size of the VM.
- Run the show vm_container general command to show the relationship between the owner container and controller as well as memory usage. By default, owner_container_id=0 and owner_container_id=1 belong to controller A and controller B respectively.
- For versions earlier than V500R007C70SPC200, up to three VMs can be created for each controller. For V500R007C70SPC200 and later versions, up to four VMs can be created for each controller.
For example, create VM test that belongs to controller A.
admin:/>show vm_container general VM Container ID Owner Controller ID Health Status Total Memory Free Memory CPU Isolate Enable CPU Counts Available CPU Counts --------------- ------------------- ------------- ------------ ----------- ------------------ ---------- -------------------- 0 0A Normal 32.000GB 26.000GB Yes 8 6 1 0B Normal 32.000GB 26.000GB Yes 8 6 admin:/>create virtual_machine general name=test owner_container_id=0 memory=512MB vcpu_count=2 sys_disk_size=70GB Command executed successfully.
- Import the ISO file of the operating system.
- Run the show vm_file transference_path command to view the directory for storing ISO files.
admin:/>show vm_file transference_path File Path: /opt/images_store/iso
In this example, ISO files are stored in /opt/images_store/iso.
- Use the SFTP client to log in to the file directory of the storage system. Navigate to /opt/images_store/iso and upload the ISO file to the directory.
- The storage system only supports SFTP-based file uploading.
- The ISO file must reside in the /opt/images_store/iso SFTP directory on the controller where the VM resides. If the ISO file resides in another directory, the system will be restarted. Only the super administrator can upload files to the SFTP directory. Administrators and read-only users cannot access the SFTP directory.
If the ISO file resides on the peer controller, run the change vm_file transference command to transfer it to the controller where the VM resides. The following shows an example of transferring the ISO file from file system 0 on controller A to file system 1 on controller B.
admin:/>change vm_file transference file_type=ISO file_name=XXX.iso src_vm_fs_id=0 des_vm_fs_id=1 Command send successfully.
- Run the show vm_file transference_path command to view the directory for storing ISO files.
- Load the ISO file to the created VM.
- Set the VM startup mode.
Run the change virtual_machine general command to change the VM startup mode and use parameters vm_id and first_start_mode to specify ID of the VM and the VM startup mode.
For example, set the VM startup mode to CDROM.
admin:/>change virtual_machine general vm_id=1 first_start_mode=CDROM Command executed successfully.
- Load the ISO file to the VM.
Run the add virtual_machine vm_iso command to add the ISO file and use parameters vm_id, iso_name, to specify ID of the VM, and the ISO file name.
Run the show virtual_machine general command to view the VM ID.
For example, add the ISO file in Step 3 to the VM created in Step 2.
admin:/>show virtual_machine general ID Name Owner Container ID Health Status Running Status First Start Mode ----- -------- ------------------ ------------- -------------- ---------------- 1 test 0 Normal Powered Off CDROM 2 test1 0 Normal Powered Off HD 65537 vm_test 1 Normal Powered Off HD 65538 vm_test1 1 Normal Powered Off CDROM admin:/>add virtual_machine vm_iso vm_id=1 iso_name=XXXXXXXXX.iso Command executed successfully.
- Set the VM startup mode.
- Log in to DeviceManager.
- Power on the VM.
- Choose
VM >
VM.
The VM management page is displayed.
- Select the desired VM and click Power On.
In the dialog box that is displayed, click Close after the VM is powered on.
- Choose
- Select the desired VM and click Open Console.
The VNC Viewer page is displayed.
- Install an operating system for the VM as prompted by VNC Viewer.
After the operating system is installed, run the remove virtual_machine vm_iso vm_id=? command to remove the ISO file.
If installing CentOS 7.6 for a VM is required, see How Can I Install CentOS 7.6 for a VM?.
- Power off the VM, and set the startup mode of the VM to HD.
Run change virtual_machine general to change the first start mode. Use parameters vm_id and first_start_mode to specify the ID and first start mode of the VM.
Example:
admin:/>change virtual_machine general vm_id=1 first_start_mode=HD Command executed successfully.
- Start the VM. For details, see Step 6.
- Configure the IP address of the management network port on the VM.
Use VNC Viewer to connect to the VM and configure the IP address of the management network port on the VM to use Secure Shell (SSH) (in Linux) to remotely manage the VM.
For security purpose, periodically change the password for the VM operating system.
Creating a VM Using a Template
The storage system allows you to create a template using a deployed VM and create a VM using the template. The following describes how to create a VM using a template. Other VM configurations are the same as those when a VM is created using an ISO file.
- (Optional) Run the create vm_template general command to create a template using a deployed VM and use parameters vm_id and name to set the VM ID for creating the template and the name of the generated VM template file.
- When creating a template, ensure that the VM is in the Powered Off state.
- If you want to use a VM template that is not in the storage system, use the FTP Client tool to upload the VM template file to the FTP path. The storage system only supports SFTP-based file uploading. You can run the show vm_file transference_path command to view the FTP path.
- If you want to use a VM template existing in the storage system, proceed to Step 2. You can run the show vm_template general command to view template information.
- The template file contains only the data within the VM OS. The number of vCPUs, memory size, data disks, and network ports need to be manually configured.
For example, export VM 1 on controller A as a template.
admin:/>create vm_template general vm_id=1 name=test.img Command is executable now.
- Run the create virtual_machine general command to create a VM. Use parameters name, owner_container_id, memory, vcpu_count, and template_name to set the VM name, owner container, VM memory size, VM CPU quantity, and used template.
- A VM template can only be used in the local controller. To use a template of the remote controller, run the change vm_file transference command to transfer the template to the local controller.
- If the VM is in the Installing state, the VM is being installed. If the VM is in the Powered Off state, the VM has been installed.
For example, use the template of Step 1 to create a VM on controller B.
admin:/>change vm_file transference file_type=vm_template file_name=test.img src_vm_fs_id=0 des_vm_fs_id=1 Command executed successfully. admin:/>create virtual_machine general name=test02 owner_container_id=1 memory=4GB vcpu_count=1 template_name=test.img Command executed successfully.