给虚拟机重命名

 

[root@ok qemu]# virsh list
 Id    Name                           State
----------------------------------------------------
 2     tiny                           running
 4     win7                           running

[root@ok qemu]# virsh list  --all
 Id    Name                           State
----------------------------------------------------
 2     tiny                           running
 4     win7                           running
 -     centos01                       shut off
 -     centos02                       shut off
 -     centos03                       shut off
 -     centos04                       shut off
 -     centos05                       shut off
 -     centos06                       shut off
 -     centos07                       shut off
 -     centos08                       shut off
 -     centos09                       shut off
 -     win2003                        shut off

[root@ok qemu]# ls
centos01.xml  centos04.xml  centos07.xml  networks   tiny.xml
centos02.xml  centos05.xml  centos08.xml  nginx.xml  win2003.xml
centos03.xml  centos06.xml  centos09.xml  ng.xml     win7.xml
[root@ok qemu]# pwd
/etc/libvirt/qemu
[root@ok qemu]# virsh dumpxml centos01 >ng.xml
[root@ok qemu]# vi ng.xml 
[root@ok qemu]# grep ng ng.xml 
  <name>ng</name>
[root@ok qemu]# grep source ng.xml 
      <source file='/home/virhost/ng.img'/>
      <source bridge='br0'/>
[root@ok qemu]# mv /home/virhost/centos01.img /home/virhost/ng.img
[root@ok qemu]# virsh undefine centos01
Domain centos01 has been undefined

[root@ok qemu]# virsh define ng.xml(注意目录/etc/libvirt/qemu)
Domain ng defined from ng.xml
[root@ok qemu]# virsh start ng
Domain ng started

[root@ok qemu]# virsh list
 Id    Name                           State
----------------------------------------------------
 2     tiny                           running
 4     win7                           paused
 13    ng                             running

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值