Hi, i''m interested to "clone" a xen vm. i read an article (1) where suggest use the command "xe" for clone a vm. However, the article does not specify where get the tool. i want two vm with same software installed but different MAC address. How to achieve it? Thanks. (1)http://searchservervirtualization.techtarget.com/tip/0,289483,sid94_gci1245957,00.html http://ece.uprm.edu/~s047267 http://del.icio.us/josanabr http://blog-grid.blogspot.com
On Wed, Jun 20, 2007 at 01:20:31PM -0400, John Sanabria wrote:> Hi, > > i''m interested to "clone" a xen vm. i read an article (1) where suggest > use the command "xe" for clone a vm. However, the article does not specify > where get the tool.Sounds like its refering to XenEnterprise - a big money closed source product from XenSource.> i want two vm with same software installed but different MAC address. How > to achieve it?Copy the disk image for the machine. Then copy the config, changing the MAC address, name, UUID and path to the disk image. We have a tool pending release in a few weeks that will automate this... Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
Thanks Daniel for the answer, according to Xen Documentation (3.0), you can start a domain using: xm create <config_file> The <config_file> must be located in /etc/xen directory. However, for Xen 3.1 the configuration file is not "necessary", then, you can submit the command, virsh start <image_filename> and the domain is created. The <image_filename> must be a file located in /var/lib/xen/images directory. But, where is located the configuration file for a domain in xen 3.1? Thanks.> > Copy the disk image for the machine. Then copy the config, changing the > MAC address, name, UUID and path to the disk image. >http://ece.uprm.edu/~s047267 http://del.icio.us/josanabr http://blog-grid.blogspot.com
On Wed, Jun 20, 2007 at 02:38:13PM -0400, John Sanabria wrote:> Thanks Daniel for the answer, > > according to Xen Documentation (3.0), you can start a domain using: > > xm create <config_file> > > The <config_file> must be located in /etc/xen directory. However, for Xen > 3.1 the configuration file is not "necessary", then, you can submit the > command, > > virsh start <image_filename> > > and the domain is created. The <image_filename> must be a file located in > /var/lib/xen/images directory. But, where is located the configuration > file for a domain in xen 3.1? Thanks.Use virsh dumpxml <guest> to get it And once you''ve edited the XML, use virsh define <xmlfile> to load in the new config. Regards, Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
Thanks Daniel, i did the next: 1- use dd command to get a copy from a vm: dd if=00_16_3E_32_0F_0F of=copia-00_16_3E_32_0F_0F 2- then, ( probably big mistake :-( ) use virsh command: virsh dumpxml 00_16_3E_32_0F_0F > ~/copia-vm.cfg 3- i modify the copia-vm.cfg and change the name field and remove the mac address field, defined inside of the interface tag: --------------------- virsh dumpxml output --------------------- <domain type=''xen'' id=''-1''> <name>copia-00_16_3E_32_0F_0F</name> <uuid>dd9fe09e1155f9223779b6c28bf43488</uuid> <bootloader>/usr/bin/pygrub</bootloader> <os> <type>linux</type> </os> <memory>262144</memory> <vcpu>1</vcpu> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <interface type=''bridge''> <source bridge=''xenbr0''/> </interface> <disk type=''file'' device=''disk''> <driver name=''file''/> <source file=''/var/lib/xen/images/copia-00_16_3E_32_0F_0F''/> <target dev=''xvda''/> </disk> </devices> </domain> --------------------- virsh dumpxml output --------------------- 4- virsh define copia-00_16_3E_32_0F_0F, (am i (re-)define the domain 00_16_3E_32_0F_0F ???) 5- virsh start copia-00_16_3E_32_0F_0F (boot ok!, can get into the root account, ping google.com, works! :-D) 6- but i don''t need this domain anymore ''virsh undefine copia-00_16_3E_32_0F_0F'' 7- boot again the original vm: [root@shutdown ~]# virsh start 00_16_3E_32_0F_0F libvir: Xen Daemon error : GET operation failed: error: failed to get domain ''00_16_3E_32_0F_0F'' 8- oops! :-( 9- i try to "recreate" the xml file, a- [root@shutdown ~]# virsh dumpxml /var/lib/xen/images/00_16_3E_32_0F_0F> original-vm.cfglibvir: Xen Daemon error : GET operation failed: error: failed to get domain ''/var/lib/xen/images/00_16_3E_32_0F_0F'' b- [root@shutdown ~]# virsh dumpxml 00_16_3E_32_0F_0F > original-vm.cfg libvir: Xen Daemon error : GET operation failed: error: failed to get domain ''00_16_3E_32_0F_0F'' is possible bring to alive the domain 00_16_3E_32_0F_0F? thanks!> On Wed, Jun 20, 2007 at 02:38:13PM -0400, John Sanabria wrote: >> Thanks Daniel for the answer, >> according to Xen Documentation (3.0), you can start a domain using: xmcreate <config_file>>> The <config_file> must be located in /etc/xen directory. However, for Xen >> 3.1 the configuration file is not "necessary", then, you can submit thecommand,>> virsh start <image_filename> >> and the domain is created. The <image_filename> must be a file located in >> /var/lib/xen/images directory. But, where is located the configurationfile for a domain in xen 3.1? Thanks.> > Use virsh dumpxml <guest> to get it > > And once you''ve edited the XML, use virsh define <xmlfile> to load inthe new config.> > Regards, > Dan. > -- > |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 3922496> -=| > |=- Perl modules: http://search.cpan.org/~danberr/> -=| > |=- Projects: http://freshmeat.net/~danielpb/> -=| > |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505> -=| > > -- > Fedora-xen mailing list > Fedora-xen@redhat.com > https://www.redhat.com/mailman/listinfo/fedora-xen >http://ece.uprm.edu/~s047267 http://del.icio.us/josanabr http://blog-grid.blogspot.com
On Wed, Jun 20, 2007 at 04:00:07PM -0400, John Sanabria wrote:> Thanks Daniel, > > i did the next: > > 1- use dd command to get a copy from a vm: > dd if=00_16_3E_32_0F_0F of=copia-00_16_3E_32_0F_0F > 2- then, ( probably big mistake :-( ) use virsh command: > virsh dumpxml 00_16_3E_32_0F_0F > ~/copia-vm.cfg > 3- i modify the copia-vm.cfg and change the name field and remove the mac > address field, defined inside of the interface tag: > --------------------- virsh dumpxml output --------------------- > <domain type=''xen'' id=''-1''> > <name>copia-00_16_3E_32_0F_0F</name> > <uuid>dd9fe09e1155f9223779b6c28bf43488</uuid> > <bootloader>/usr/bin/pygrub</bootloader> > <os> > <type>linux</type> > </os> > <memory>262144</memory> > <vcpu>1</vcpu> > <on_poweroff>destroy</on_poweroff> > <on_reboot>restart</on_reboot> > <on_crash>restart</on_crash> > <devices> > <interface type=''bridge''> > <source bridge=''xenbr0''/> > </interface> > <disk type=''file'' device=''disk''> > <driver name=''file''/> > <source file=''/var/lib/xen/images/copia-00_16_3E_32_0F_0F''/> <target > dev=''xvda''/> > </disk> > </devices> > </domain> > --------------------- virsh dumpxml output --------------------- > 4- virsh define copia-00_16_3E_32_0F_0F, (am i (re-)define the domain > 00_16_3E_32_0F_0F ???) > > 5- virsh start copia-00_16_3E_32_0F_0F (boot ok!, can get into the root > account, ping google.com, works! :-D) > > 6- but i don''t need this domain anymore ''virsh undefine > copia-00_16_3E_32_0F_0F'' > > 7- boot again the original vm: > > [root@shutdown ~]# virsh start 00_16_3E_32_0F_0F > libvir: Xen Daemon error : GET operation failed: > error: failed to get domain ''00_16_3E_32_0F_0F'' > > 8- oops! :-(Did you change the <uuid> field in the XML when you cloned it ? If not that''s probably where the mistake was.> > 9- i try to "recreate" the xml file, > a- [root@shutdown ~]# virsh dumpxml /var/lib/xen/images/00_16_3E_32_0F_0F > > original-vm.cfg > libvir: Xen Daemon error : GET operation failed: > error: failed to get domain ''/var/lib/xen/images/00_16_3E_32_0F_0F'' > b- [root@shutdown ~]# virsh dumpxml 00_16_3E_32_0F_0F > original-vm.cfg > libvir: Xen Daemon error : GET operation failed: > error: failed to get domain ''00_16_3E_32_0F_0F'' > > is possible bring to alive the domain 00_16_3E_32_0F_0F?Just edit your original dump ~/copia-vm.cfg and put back the original parameters when virsh define ~/copia-vm.cfg Dan -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
Thanks ;-)> On Wed, Jun 20, 2007 at 02:38:13PM -0400, John Sanabria wrote: >> Thanks Daniel for the answer, >> >> according to Xen Documentation (3.0), you can start a domain using: >> >> xm create <config_file> >> >> The <config_file> must be located in /etc/xen directory. However, for >> Xen >> 3.1 the configuration file is not "necessary", then, you can submit the >> command, >> >> virsh start <image_filename> >> >> and the domain is created. The <image_filename> must be a file located >> in >> /var/lib/xen/images directory. But, where is located the configuration >> file for a domain in xen 3.1? Thanks. > > Use virsh dumpxml <guest> to get it > > And once you''ve edited the XML, use virsh define <xmlfile> to load in > the new config. > > Regards, > Dan. > -- > |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 > -=| > |=- Perl modules: http://search.cpan.org/~danberr/ > -=| > |=- Projects: http://freshmeat.net/~danielpb/ > -=| > |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 > -=| >http://ece.uprm.edu/~s047267 http://del.icio.us/josanabr http://blog-grid.blogspot.com
Daniel P. Berrange wrote:> Copy the disk image for the machine. Then copy the config, changing the > MAC address, name, UUID and path to the disk image.The other thing to add is that you probably shouldn''t copy the disk image if the guest is running. To be safe, completely shut the guest down before starting the copy. I have also had good results by syncing the disks on a guest, pausing it, then copying, but I guess there are cases where that might fail. Rich. -- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 03798903