oVirt VM (CentOS) template & clone

Using Templates

Now that you know how to create a virtual machine, you can save its settings into a template. This template will retain the original virtual machine's configurations, including virtual disk and network interface settings, operating systems and applications. You can use this template to rapidly create replicas of the original virtual machine.

Create a Fedora Template

To make a Fedora virtual machine template, use the virtual machine you created in Section 4.1.1, “Create a Fedora Virtual Machine” as a basis. Before it can be used, it has to be sealed. This ensures that machine-specific settings are not propagated through the template.

To prepare a Fedora virtual machine for use as a template

连接到一个已经存在的虚拟机, 需要配置一下, 然后关机才能作为模板使用. 例如touch一个重新配置文件, 删除ssh host key.

1. Connect to the Fedora virtual machine to be used as a template. Flag the system for re-configuration by running the following command as root:

   # touch /.unconfigured

2. Remove ssh host keys. Run:

   # rm -rf /etc/ssh/ssh_host_*

3. Shut down the virtual machine. Run:

   # poweroff

4. The virtual machine has now been sealed, and is ready to be used as a template for Linux virtual machines.

关闭虚拟机后, 创建模板

To create a template from a Fedora virtual machine

1. In the administration portal, click the Virtual Machines tab. Select the sealed Red Hat Enterprise Linux 6 virtual machine. Ensure that it has a status of Down.

2. Click Make Template. The New Virtual Machine Template displays.

oVirt VM (CentOS) template  clone - 德哥@Digoal - PostgreSQL research
 
Figure 15. Make new virtual machine template
Enter information into the following fields:
  • Name: Name of the new template
  • Description: Description of the new template
  • Host Cluster: The Host Cluster for the virtual machines using this template.
  • Make Private: If you tick this checkbox, the template will only be available to the template's creator and the administrative user. Nobody else can use this template unless they are given permissions by the existing permitted users.

3. Click OK. The virtual machine displays a status of "Image Locked" while the template is being created. The template is created and added to the Templates tab. During this time, the action buttons for the template remain disabled. Once created, the action buttons are enabled and the template is ready for use.

Clone a Red Hat Enterprise Linux Virtual Machine

In the previous section, you created a Fedora template complete with pre-configured storage, networking and operating system settings. Now, you will use this template to deploy a pre-installed virtual machine.

To clone a Fedora virtual machine from a template

新建虚拟机, 选择基于模板.

1. Navigate to the Tree pane and click Expand All. Click the VMs icon under the Default cluster. On the Virtual Machines tab, click New Server.

oVirt VM (CentOS) template  clone - 德哥@Digoal - PostgreSQL research
 
Figure 16. Create virtual machine based on Linux template


  • On the General tab, select the existing Linux template from the Based on Template list.
  • Enter a suitable Name and appropriate Description, then accept the default values inherited from the template in the rest of the fields. You can change them if needed.
  • Click the Resource Allocation tab. On the Provisioning field, click the drop down menu and select the Clone option.
  • 注意使用Clone选项.
oVirt VM (CentOS) template  clone - 德哥@Digoal - PostgreSQL research
 
Figure 17. Set the provisioning to Clone

2. Retain all other default settings and click OK to create the virtual machine. The virtual machine displays in the Virtual Machines list.


[参考]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值