简体   繁体   English

通过vmware perl sdk使用现有的vmdk文件部署新的VM

[英]deploy a new VM using an existing vmdk file via vmware perl sdk

I want to deploy a new VM with my vmdk file in vcenter environment from CLI. 我想通过CLI在vcenter环境中使用vmdk文件部署新的VM。 So ssh to esx server is not an option. 因此,不能使用SSH到esx服务器。 Is there any way I can do this .I know there is some vmware perl sdk but I could not find exactly what I need to get this working. 有什么办法可以做到这一点。我知道有一些vmware perl sdk,但是我找不到要使它正常工作的确切条件。 I know The same operation is possible from GUI, but I need to make it automated and also scale up so gui is not an option for me. 我知道可以从GUI进行相同的操作,但是我需要使其自动化并进行扩展,因此gui对我来说不是一个选择。

Can you please be more specific? 您能更具体一点吗? This for a Linux or Windows CLI? 这是用于Linux还是Windows CLI?

The simplest way to do this is via PowerCLI: https://my.vmware.com/web/vmware/details?downloadGroup=PCLI550&productId=352 最简单的方法是通过PowerCLI: https ://my.vmware.com/web/vmware/details ? downloadGroup = PCLI550 & productId = 352

To clone from an existing VM, the command would be: 要从现有VM克隆,命令将是:

$vm2 = New-VM -Name VM2 -VM VM1 -Datastore $datastore -VMHost $host $ vm2 =新建VM-名称VM2 -VM VM1-数据存储$ datastore -VMHost $ host

Also, when you say you want to create from VMDK, is the VMDK already on the target datastore? 另外,当您说要从VMDK创建时,VMDK是否已在目标数据存储上? Do you need to import the VMDK first? 您是否需要首先导入VMDK?

Normally, when you create a VM, you can either create a new "blank" VM or you can clone from an existing VM. 通常,创建虚拟机时,可以创建新的“空白”虚拟机,也可以从现有虚拟机克隆。 If you have a VMDK you want to use, you would create an empty VM and then attach the VMDK. 如果您要使用VMDK,则将创建一个空VM,然后附加该VMDK。 This assumes that you already have the VMDK in question loaded into a datastore that the host can access. 假设您已经将问题VMDK加载到主机可以访问的数据存储中。

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

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