Scroll to navigation

virt-v2v-output-local(1) Virtualization Support virt-v2v-output-local(1)

НАЗВА

virt-v2v-output-local - Using virt-v2v to convert guests to local files or libvirt

КОРОТКИЙ ОПИС

 virt-v2v [-i* options] [-o libvirt] -os POOL
 virt-v2v [-i* options] -o local -os DIRECTORY
 virt-v2v [-i* options] -o qemu -os DIRECTORY [--qemu-boot]
 virt-v2v [-i* options] -o json -os DIRECTORY
                        [-oo json-disks-pattern=PATTERN]
 virt-v2v [-i* options] -o null

ОПИС

This page documents how to use virt-v2v(1) to convert guests to local files or to a locally running libvirt instance. There are four output modes you can select on the virt-v2v command line:

This converts the guest to a libvirt directory pool call "POOL", and instantiates the guest in libvirt (but does not start it running). See "OUTPUT TO LIBVIRT" below.

-o libvirt is the default if no -o option is given, so you can omit it.

This converts the guest to files in "DIRECTORY". A libvirt XML file is also created, but unlike -o libvirt the guest is not instantiated in libvirt, only files are created.

The files will be called:

 NAME-sda, NAME-sdb, etc.      Guest disk(s).
 NAME.xml                      Libvirt XML.
    

where "NAME" is the guest name.

This converts the guest to files in "DIRECTORY". Unlike -o local above, a shell script is created which contains the raw qemu command you would need to boot the guest. However the shell script is not run, unless you also add the --qemu-boot option.
This converts the guest to files in "DIRECTORY". The metadata produced is a JSON file containing the majority of the data virt-v2v gathers during the conversion. See "OUTPUT TO JSON" below.
The guest is converted, but the final result is thrown away and no metadata is created. This is mainly useful for testing.

ВИВЕДЕННЯ ДО LIBVIRT

За допомогою параметра -o libvirt ви можете вивантажувати перетворені гостьові системи на основу систему під керуванням libvirt. Існує декілька обмежень:

  • Ви можете використовувати лише локальне з'єднання libvirt [див. нижче способи обійти це обмеження].
  • Параметр -os pool має вказувати на буфер-каталог, а не щось екзотичніше, наприклад iSCSI [втім, див. нижче].
  • Вивантаження можливе лише до гіпервізору KVM.

Workaround for output to a remote libvirt instance and/or a non-directory storage pool

1.
Скористайтеся virt-v2v у режимі -o local для перетворення дисків і метаданих гостьової системи до локального тимчасового каталогу:

 virt-v2v [...] -o local -os /var/tmp
    

Ця команда створює два (або більше) файли у /var/tmp із такими назвами:

 /var/tmp/НАЗВА.xml     # XML libvirt (метадані)
 /var/tmp/НАЗВА-sda     # перший диск гостьової системи
    

(замість слова "НАЗВА" має бути назва гостьової системи).

2.
Вивантаження перетворених дисків до буфера сховища із назвою "POOL":

 size=$(stat -c%s /var/tmp/НАЗВА-sda)
 virsh vol-create-as POOL НАЗВА-sda $size --format raw
 virsh vol-upload --pool POOL НАЗВА-sda /var/tmp/НАЗВА-sda
    
3.
Внесіть зміни до /var/tmp/НАЗВА.xml, щоб замінити /var/tmp/НАЗВА-sda на назву буфера. Іншими словами, знайдіть такий фрагмент у XML:

 <disk type='file' device='disk'>
   <driver name='qemu' type='raw' />
   <source file='/var/tmp/NAME-sda' />
   <target dev='hda' bus='ide' />
 </disk>
    

і змініть дві речі: атрибут "type='file'" слід замінити на "type='volume'", а елемент "<source>" слід змінити так, щоб у ньому були атрибути "pool" і "volume":

 <disk type='volume' device='disk'>
   ...
   <source pool='POOL' volume='NAME-sda' />
   ...
 </disk>
    
4.
Визначте остаточну гостьову систему у libvirt:

 virsh define /var/tmp/NAME.xml
    

OUTPUT TO JSON

The -o json option produces the following files by default:

 NAME.json                     JSON metadata.
 NAME-sda, NAME-sdb, etc.      Guest disk(s).

where "NAME" is the guest name.

It is possible to change the pattern of the disks using the -oo json-disks-pattern=... option: it allows parameters in form of "%{...}" variables, for example:

 -oo json-disks-pattern=disk%{DiskNo}.img

Recognized variables are:

"%{DiskNo}"
The index of the disk, starting from 1.
"%{DiskDeviceName}"
The destination device of the disk, e.g. "sda", "sdb", etc.
"%{GuestName}"
The name of the guest.

Using a pattern it is possible use subdirectories for the disks, even with names depending on variables; for example:

 -oo json-disks-pattern=%{GuestName}-%{DiskNo}/disk.img

The default pattern is "%{GuestName}-%{DiskDeviceName}".

If the literal "%{...}" text is needed, it is possible to avoid the escape it with a leading "%"; for example, "%%{GuestName}-%{DiskNo}.img" will create file names for the disks like "%%{GuestName}-1.img", "%%{GuestName}-2.img", etc.

ТАКОЖ ПЕРЕГЛЯНЬТЕ

virt-v2v(1).

АВТОР

Richard W.M. Jones

АВТОРСЬКІ ПРАВА

Copyright (C) 2009-2020 Red Hat Inc.

LICENSE

BUGS

To get a list of bugs against libguestfs, use this link: https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools

To report a new bug against libguestfs, use this link: https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools

When reporting a bug, please supply:

  • The version of libguestfs.
  • Where you got libguestfs (eg. which Linux distro, compiled from source, etc)
  • Describe the bug accurately and give a way to reproduce it.
  • Run libguestfs-test-tool(1) and paste the complete, unedited output into the bug report.
2021-11-24 virt-v2v-1.44.2