给虚拟机重命名

Posted 运维工匠实战(如果发现有错误请大家把正确的方法发送给我,方便

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了给虚拟机重命名相关的知识,希望对你有一定的参考价值。

 

[[email protected] qemu]# virsh list
 Id    Name                           State
----------------------------------------------------
 2     tiny                           running
 4     win7                           running

[[email protected] 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

[[email protected] 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
[[email protected] qemu]# pwd
/etc/libvirt/qemu
[[email protected] qemu]# virsh dumpxml centos01 >ng.xml
[[email protected] qemu]# vi ng.xml 
[[email protected] qemu]# grep ng ng.xml 
  <name>ng</name>
[[email protected] qemu]# grep source ng.xml 
      <source file=‘/home/virhost/ng.img‘/>
      <source bridge=‘br0‘/>
[[email protected] qemu]# mv /home/virhost/centos01.img /home/virhost/ng.img
[[email protected] qemu]# virsh undefine centos01
Domain centos01 has been undefined

[[email protected] qemu]# virsh define ng.xml
Domain ng defined from ng.xml
[[email protected] qemu]# virsh start ng
Domain ng started

[[email protected] qemu]# virsh list
 Id    Name                           State
----------------------------------------------------
 2     tiny                           running
 4     win7                           paused
 13    ng                             running

 

以上是关于给虚拟机重命名的主要内容,如果未能解决你的问题,请参考以下文章

KVM虚拟机重命名

openstack基础云虚拟机重装报错处理过程

Android Studio安装虚拟机步骤

kvm系列之二:kvm日常管理

有没有办法关闭代码片段中的命名建议?

VM虚拟机装好系统后进不了系统?如何解决