首页 > 其他 > 详细

[理] virsh 命令

时间:2016-05-18 17:38:59      阅读:470      评论:0      收藏:0      [点我收藏+]

整理的部分命令

1. 往虚拟机添加 iso 文件

1 # virsh attach-disk virsh-VM /home/yb/visio.iso hda --type cdrom --mode readonly

  批注:

  1. ‘virsh-VM‘ 为创建的,并且已经运行的虚拟机名称

  2. ‘/home/yb/visio.iso‘ 为要添加的 ISO 文件

  3. ‘hda‘ 为创建虚拟机(virsh define)时定义的镜像文件 iso 时定义的 <target dev=‘hda‘ />

  4. 指定 type 类型为 cdrom

  5. 指定读写权限为 readonly

  6. cdrom 不能进行 detach-disk 的操作,会提示:

Operation not supported: disk device type cdrom cannot be detached

  可以进入虚拟机进行手动弹出,暂未找到其他合适的方法。

  7. 创建 ‘hdX‘ 的 XML 参考模板

 1 <disk type=‘file‘ device=‘cdrom‘>
 2   <driver name=‘qemu‘ type=‘raw‘/>
 3   <source file=‘/home/yb/visio.iso‘/>
 4   <target dev=‘hda‘ bus=‘ide‘/>
 5   <readonly/>
 6   <address type=‘drive‘ controller=‘0‘ bus=‘0‘ target=‘0‘ unit=‘0‘/>
 7 </disk>
 8 <disk type=‘file‘ device=‘cdrom‘>
 9   <driver name=‘qemu‘ type=‘raw‘/>
10   <target dev=‘hdb‘ bus=‘ide‘/>
11   <readonly/>
12   <address type=‘drive‘ controller=‘0‘ bus=‘1‘ target=‘0‘ unit=‘0‘/>
13 </disk>

  8. 创建镜像文件参考 Linux mkisofs

  

[理] virsh 命令

原文:http://www.cnblogs.com/YBhello/p/5505885.html

(1)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!