如何使用“qm set”弹出基于 KVM 的 VM 的 CD/DVD?

如何使用“qm set”弹出基于 KVM 的 VM 的 CD/DVD?

我正在使用 Proxmox VE 4.4,我不知道如何弹出当前配置的 CD/DVD 驱动器。假设客户虚拟机的 ID 设置为环境变量vmid

当前配置qm config $vmid|grep ^ide如下:

ide2: iso-storage:iso/SLE-12-SP2-Server-DVD-x86_64-GM-DVD1.iso,media=cdrom,size=3188M

我想“弹出”该驱动器,这样驱动器中就不再有媒体了,但它仍然作为 CD/DVD 驱动器存在于客户机中(即无需移除驱动器!)。

我怎样才能实现这一点从 shell 中Proxmox VE 机器(即主机)?

注意: qm cdrom <vmid> eject在此版本的 Proxmox VE 中不存在,但它似乎在过去存在过。


我尝试过的:

# qm set $vmid -ide2 media=cdrom
400 Parameter verification failed.
ide2: invalid format - format error
ide2.file: property is missing and it is not optional

qm set <vmid> [OPTIONS]

# qm set $vmid -ide2 media=cdrom,file=
400 Parameter verification failed.
ide2: invalid format - missing key in comma-separated list property

qm set <vmid> [OPTIONS]

# qm set $vmid -ide2 media=cdrom,file=/dev/null
update VM $vmid: -ide2 media=cdrom,file=/dev/null
volume /dev/null does not exists

答案1

我自己找到了答案。

<volume>虽然中的几乎所有值都-ide[n] [file=]<volume>失败了(参见qm(1)),但未记录价值none成功了。

   -ide[n] [file=]<volume> [,aio=<native|threads>] [,backup=<1|0>] [,bps=<bps>]
   [,bps_max_length=<seconds>] [,bps_rd=<bps>] [,bps_rd_length=<seconds>] [,bps_wr=<bps>]
   [,bps_wr_length=<seconds>] [,cache=<enum>] [,cyls=<integer>] [,detect_zeroes=<1|0>]
   [,discard=<ignore|on>] [,format=<enum>] [,heads=<integer>] [,iops=<iops>] [,iops_max=<iops>]
   [,iops_max_length=<seconds>] [,iops_rd=<iops>] [,iops_rd_length=<seconds>]
   [,iops_rd_max=<iops>] [,iops_wr=<iops>] [,iops_wr_length=<seconds>] [,iops_wr_max=<iops>]
   [,mbps=<mbps>] [,mbps_max=<mbps>] [,mbps_rd=<mbps>] [,mbps_rd_max=<mbps>] [,mbps_wr=<mbps>]
   [,mbps_wr_max=<mbps>] [,media=<cdrom|disk>] [,model=<model>] [,rerror=<ignore|report|stop>]
   [,secs=<integer>] [,serial=<serial>] [,size=<DiskSize>] [,snapshot=<1|0>]
   [,trans=<none|lba|auto>] [,werror=<enum>]
       Use volume as IDE hard disk or CD-ROM (n is 0 to 3).

我偶然发现了这一点,因为我的 PVE 集群中的一台虚拟机恰好有这个值。所以我尝试了一下,结果:

qm set $vmid -ide2 media=cdrom,file=none

成功了。

相关内容