[英]Obtain storagecontroller from virtualbox
im doing a shell script to automate vagrant boxes creation and im trying to obtain the boxes storagecontroller for work with the disk without errors. 我正在执行一个shell脚本来自动创建无用的盒子,并且试图获得没有磁盘错误的盒子storagecontroller。 The debian machines have SATA Controller as disk controller but CentOS uses IDE controller. debian机器使用SATA Controller作为磁盘控制器,但CentOS使用IDE控制器。 I need to grep the virtualbox virtual machines storagecontroller for use it as a variable in the script. 我需要grep virtualbox虚拟机storagecontroller,以将其用作脚本中的变量。 I have tried using: 我试过使用:
cat <virtualmachinename>.vbox | grep -i storagecontroller
But i get a extended version of information and i only need the storagecontroller. 但是我得到了信息的扩展版本,我只需要storagecontroller。 This commands show the information in this way. 此命令以这种方式显示信息。
<StorageControllers>
<StorageController name="SATA Controller" type="AHCI" PortCount="1" useHostIOCache="true" Bootable="true" IDE0MasterEmulationPort="0" IDE0SlaveEmulationPort="1" IDE1MasterEmulationPort="2" IDE1SlaveEmulationPort="3"></StorageController>
<StorageController name="Floppy Controller Controller" type="I82078" PortCount="1" useHostIOCache="true" Bootable="true"/>
</StorageControllers>
In this case i need to grep "Sata Controller". 在这种情况下,我需要grep“ Sata Controller”。
Thank you 谢谢
最后,我已经使用以下命令完成了:
VBoxManage showvminfo <machine-name> --machinereadable | grep storagecontrollername0 | cut -d '=' -f 2 | sed 's/\"//g'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.