简体   繁体   English

将参数传递给使用qcow2创建的虚拟机

[英]Passing parameters to a virtual machine created using qcow2

I am used to creating virtual machines using OVF format for VMware hypervisor. 我习惯于为VMware虚拟机管理程序使用OVF格式创建虚拟机。 In OVF file, I can add custom XML tags which are made available as parameters to the guest when guest boots up. 在OVF文件中,我可以添加自定义XML标记,当来宾启动时,这些自定义XML标记可用作来宾的参数。 They are available as a device to the guest and guest software can mount and read the parameters. 它们可作为来宾设备使用,来宾软件可以安装和读取参数。

Is it possible to do the same using KVM and QCOW2 format? 是否可以使用KVM和QCOW2格式执行相同操作?

Openstack provide metadata service. Openstack提供元数据服务。 Instances can retrieve user data (passed as the user_data parameter in the API call or by the --user_data flag in the nova boot command) through the metadata service, by making a GET request. 实例可以通过发出GET请求,通过元数据服务来检索用户数据(在API调用中作为user_data参数传递或在nova boot命令中通过--user_data标志传递)。

OpenStack can be configured to write metadata to a special configuration drive that will be attached to the instance when it boots. 可以配置OpenStack将元数据写入特殊配置驱动器,该驱动器在启动时将附加到实例。 The instance can retrieve any information that would normally be available through the metadata service by mounting this disk and reading files from it. 通过安装该磁盘并从中读取文件,该实例可以检索通常可通过元数据服务获得的任何信息。 See about config-drive: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux_OpenStack_Platform/5/html/End_User_Guide/config-drive.html 有关配置驱动器的信息,请参见: https : //access.redhat.com/documentation/zh-CN/Red_Hat_Enterprise_Linux_OpenStack_Platform/5/html/End_User_Guide/config-drive.html

Without openstack: I found blog post about Creating a cloud-init config disk for non-cloud boots . 没有openstack:我找到了有关为非云启动创建cloud-init配置磁盘的博客文章。 I didn't test it. 我没有测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM