virt-p2v(1)
๐ virt-p2v(1) ๐
โจ NAME โจ
virt-p2v โ convert a physical machine to use KVM
๐ธ SYNOPSIS ๐ธ
virt-p2v
virt-p2v.iso
๐ DESCRIPTION ๐
Okay so virt-p2v converts a physical machine to run virtualized on KVM, managed by libvirt, OpenStack, oVirt, Red Hat Virtualisation (RHV), or one of the other targets supported by virt-v2v(1). It's giving "glow-up for your whole server," no cap.
Normally you don't run the virt-p2v program directly. Instead you have to boot the physical machine using the bootable CD-ROM, ISO or PXE image. This bootable image contains the virt-p2v binary and runs it automatically. Booting from a CD-ROM/etc is required because the disks which are being converted must be quiescent. It is not safe to try to convert a running physical machine where other programs may be modifying the disk content at the same time. ๐
Bestie, do not try to convert a live machine while other stuff is writing to the disk. The disks have to be quiet. That's the whole vibe check.
This manual page documents running the virt-p2v program. To create the bootable image you should look at virt-p2v-make-disk(1) or virt-p2v-make-kickstart(1).
๐ฆ NETWORK SETUP ๐ฆ
virt-p2v runs on the physical machine which you want to convert. It has to talk to another server called the "conversion server" which must have virt-v2v(1) installed on it. It always talks to the conversion server over SSH:
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ virt-p2v โ โ virt-v2v โ
โ (physical โ ssh connection โ (conversion โ
โ server) โโโโโโโโโโโโโโโโโโโโโโโโถ server) โ
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
The virt-v2v program on the conversion server does the actual conversion (physical to virtual, and virtual to virtual conversions are sufficiently similar that we use the same program to do both). Iconic reuse, honestly. ๐
The SSH connection is always initiated from the physical server. All data is transferred over the SSH connection. In terms of firewall and network configuration, you only need to ensure that the physical server has access to a port (usually TCP port 22) on the conversion server. Note that the physical machine may reconnect several times during the conversion process.
The reverse port forwarding feature of ssh (ie.ssh -R) is required byvirt-p2v, and it will not work if this is disabled on the conversion server. (AllowTcpForwardingmust beyesin thesshd_config(5)file on the conversion server). Do not skip this, bestie โ it's not optional. ๐ซถ
The scp (secure copy) feature of ssh is required by virt-p2v so it can send over small files (this is not the method by which disks are copied). Important distinction: small files, not the big disk data. โจ
The conversion server does not need to be a physical machine. It could be a virtual machine, as long as it has sufficient memory and disk space to do the conversion, and as long as the physical machine can connect directly to its SSH port. (See also "Resource requirements" in virt-v2v(1).)
Because all of the data on the physical server's hard drive(s) has to be copied over the network, the speed of conversion is largely determined by the speed of the network between the two machines. So yeah โ network go brrr, conversion go brrr. ๐
๐ GUI INTERACTIVE CONFIGURATION ๐
When you start virt-p2v, you'll see a graphical configuration dialog that walks you through connection to the conversion server, asks for the password, which local hard disks you want to convert, and other things like the name of the guest to create and the number of virtual CPUs to give it.
๐ SSH CONFIGURATION DIALOG ๐
When virt-p2v starts up in GUI mode, the first dialog looks like this:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ virt-p2v โ
โ โ
โ Conversion server: [____________________________] : [22___] โ
โ โ
โ User name: [root__________________________________] โ
โ โ
โ Password: [______________________________________] โ
โ โ
โ SSH Identity URL: [______________________________________] โ
โ โ
In the fields above, you must enter the details of the conversion server: the hostname, SSH port number, remote user name, and either the password or SSH identity (private key) URL. The conversion server must have an up to date version of virt-v2v.
Normally you must log in to the conversion server as root, but if you check the following box:
โ โ
โ [ ] Use sudo when running virt-v2v โ
โ โ
then you can log in as another user, and virt-p2v will use the sudo(8) command to elevate privileges to root. Note that sudo must not require a password. Like, zero password prompts, bestie. ๐
It is also possible to run virt-v2v on the conversion server entirely as non-root, but output modes may be limited. Consult the virt-v2v(1) manual page for details.
At the bottom of the dialog are these buttons:
โ โ
โ [ Test connection ] โ
โ โ
โ [ Configure network ] [ XTerm ] [ About virt-p2v ] [ Next ] โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
You must press the Test connection button first to test the SSH connection to the conversion server. If that is successful (ie. you have supplied the correct server name, user name, password, etc., and a suitable version of virt-v2v is available remotely) then press the Next button to move to the next dialog. No skipping ahead before the connection test passes, okay? ๐
You can use the Configure network button if you need to assign a static IP address to the physical machine, or use Wifi, bonding or other network features.
The XTerm button opens a shell which can be used for diagnostics, manual network configuration, and so on.
๐ฝ DISK AND NETWORK CONFIGURATION DIALOG ๐ฝ
The second configuration dialog lets you configure the details of conversion, including what to convert and where to send the guest.
In the left hand column, starting at the top, the target properties let you select the name of the guest (ie. after conversion) and how many virtual CPUs and how much RAM to give it. The defaults come from the physical machine, and you can usually leave them unchanged:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ
โ Target properties:
โ
โ Name: [hostname______________]
โ
โ # vCPUs: [4_____________________]
โ
โ Memory (MB): [16384_________________]
โ
The second panel on the left controls the virt-v2v output options. To understand these options it is a really good idea to read the virt-v2v(1) manual page. You can leave the options at the default to create a guest as a disk image plus libvirt XML file located in /var/tmp on the conversion host. This is a good idea if you are a first-time virt-p2v user.
โ
โ Virt-v2v output options:
โ
โ Output to (-o): [local โผ]
โ
โ Output conn. (-oc): [___________________]
โ
โ Output storage (-os): [/var/tmp___________]
โ
โ Output format (-of): [___________________]
โ
โ Output allocation (-oa): [sparse โผ]
โ
โ Misc. options (-oo): [___________________]
โ
All output options and paths are relative to the conversion server (not to the physical server). So yeah, /var/tmp means /var/tmp over there, not on the physical machine. ๐
Note that the Misc. options text entry behaves differently from the other text entries -- its format is identical to that of the p2v.output.misc kernel command line option. Namely, the text entry contains a comma-separated list of miscellaneous, output-specific options. (Do not put spaces around the commas!) Each element in the list is of the form OPTION=VALUE, and each element is passed to virt-v2v as a standalone -oo OPTION=VALUE option.
Finally in the left hand column is an information box giving the version of virt-p2v (on the physical server) and virt-v2v (on the conversion server). You should supply this information when reporting bugs. Future you will thank present you for writing it down. โจ
In the right hand column are three panels which control what hard disks, removable media devices, and network interfaces, will be created in the output guest. Normally leaving these at the default settings is fine.
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Fixed hard disks โ
โ
Convert Device โ
[โ] sda โ
1024G HITACHI โ
s/n 12345 โ
[โ] sdb โ
119G HITACHI โ
s/n 12346 โ
โ
Normally you would want to convert all hard disks. If you want virt-p2v to completely ignore a local hard disk, uncheck it. The hard disk that contains the operating system must be selected. If a hard disk is part of a RAID array or LVM volume group (VG), then either all hard disks in that array/VG must be selected, or none of them. This is a "all or nothing" situation, bestie โ no half-selected RAID arrays. ๐
โ
Removable media โ
โ
Convert Device โ
[โ] sr0 โ
โ
If the physical machine has CD or DVD drives, then you can use the Removable media panel to create corresponding drives on the guest after conversion. Note that any data CDs/DVDs which are mounted in the drives are not copied over.
So at the very bottom of that dialog there's a "Refresh disks" button, and it tells virt-p2v to re-enumerate the fixed hard disks and the removable media drives, bestie โจ (heads up though โ the button also resets the currently active selections in both of those panels, so don't be shocked when your picks vanish ๐). It's genuinely so useful when you pair it with the "XTerm" button over on the "SSH CONFIGURATION DIALOG": in that XTerm window you can expose further block devices to the kernel (think LUNs from iSCSI targets, iykyk), and then "Refresh disks" lets virt-p2v learn about all the block devices again. Teamwork ๐
โ
Network interfaces โ
โ
Convert Device Connect to virtual network โ
[โ] em1 [default________________________] โ
[ ] wlp3s0 [default________________________] โ
โ
Now the Network interfaces panel ๐ฆ โ this is where you pick which network interfaces should be created in the guest after conversion. You can also connect these to target hypervisor networks (for the full tea on that feature, go read "Networks and bridges" in virt-v2v(1) ๐).
On supported hardware, left-clicking on the device name (like em1 in the example above) causes a light to start flashing on the physical interface โ literally a little beacon so the operator can identify which cable is which ๐ iconic.
When you're ready to actually begin the conversion, hit the "Start conversion" button:
[ Back ] [ Refresh disks ] [ Start conversion ] โ
โ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ CONVERSION RUNNING DIALOG ๐
When conversion is running you'll be looking at this:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ virt-p2v โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โฒโ โ
โ โ โ โ
โ โ โ โ
โผ โผ โผ โผ
โ โ โ โ
โ โ โ โ
โ โ โผโ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ Log files ... to /tmp/virt-p2v-xxx โ
โ โ
โ Doing conversion ... โ
โ โ
โ [ Cancel conversion ] โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
In the main scrolling area you get to watch messages stream in from the virt-v2v process โ it's giving live commentary, lowkey hypnotic ๐ญ
Below the main area, virt-p2v shows you the location of the directory on the conversion server that contains log files and other debugging information. Below that is the current status plus a button for cancelling conversion, so you always know what's up ๐ซถ
Once conversion has finished, you should shut down the physical machine.
โ ๏ธ If conversion is successful, you should never reboot it. Not once. Not "just to check". Nope ๐๐
๐ง KERNEL COMMAND LINE CONFIGURATION ๐ง
Okay so bestie, if you're sitting there like "the GUI is cute but I have forty machines to convert" โ same. There's another way: you can configure everything through the kernel command line instead. This is especially convenient if you are converting a lot of physical machines which are booted using PXE. It's giving automation, it's giving scale, it's giving "I refuse to click Next forty times". ๐
Where exactly you set command line arguments depends on your PXE implementation, but for pxelinux you put them in the "APPEND" field in the pxelinux.cfg file. For example:
DEFAULT p2v
TIMEOUT 20
PROMPT 0
LABEL p2v
KERNEL vmlinuz0
APPEND initrd=initrd0.img [....] p2v.server=conv.example.com p2v.password=secret p2v.o=libvirt
You have to set some or all of the following command line arguments: โฌ๏ธ
p2v.remote.server=SERVER,p2v.server=SERVERโ The name or IP address of the conversion server. ๐
This is always required if you are using the kernel configuration method. If virt-p2v does not find this on the kernel command line then it switches to the GUI (interactive) configuration method. (So like, it'll bail to the clicky-clicky version โ no drama, just noting it.)
p2v.remote.port=PORT,p2v.port=PORTโ The SSH port number on the conversion server (default:22).p2v.auth.username=USERNAME,p2v.username=USERNAMEโ The SSH username that we log in as on the conversion server (default:"root").p2v.auth.password=PASSWORD,p2v.password=PASSWORDโ The SSH password that we use to log in to the conversion server. ๐
The default is to try with no password. If this fails then virt-p2v will ask the user to type the password (probably several times during conversion). ๐ญ
This setting is ignored if "p2v.auth.identity.url" is present.
p2v.auth.identity.url=URL,p2v.identity=URLโ Provide a URL pointing to an SSH identity (private key) file. The URL is interpreted bycurl(1)so any URL that curl supports can be used here, including"https://"and"file://". For more information on using SSH identities, see"SSH IDENTITIES"below. ๐๏ธโจ
If "p2v.auth.identity.url" is present, it overrides "p2v.auth.password". There is no fallback. Like, none. Zero. Don't @ me.
p2v.auth.sudo,p2v.sudoโ Use"p2v.sudo"to tell virt-p2v to usesudo(8)to gain root privileges on the conversion server after logging in as a non-root user (default: do not use sudo). ๐p2v.guestname=GUESTNAME,p2v.name=GUESTNAMEโ The name of the guest that is created. The default is to try to derive a name from the physical machine's hostname (if possible) else use a randomly generated name. ๐p2v.vcpu.phys_topoโ Copy the physical machine's complete CPU topology (sockets, cores and threads) to the guest. Disabled by default. If disabled, the"p2v.vcpu.cores"setting takes effect. ๐งp2v.vcpu.cores=Nโ This setting is ignored if"p2v.vcpu.phys_topo"is enabled. Otherwise, it specifies the flat number of vCPU cores to give to the guest (placing all of those cores into a single socket, and exposing one thread per core). The default value is the number of online logical processors on the physical machine. โกp2v.memory=n(M|G)โ The size of the guest memory. You must specify the unit such as megabytes or gigabytes by using for example"p2v.memory=1024M"or"p2v.memory=1G". ๐
The default is to use the same amount of RAM as on the physical machine.
p2v.cpu.vendor=VENDORโ The vCPU vendor, eg."Intel"or"AMD". The default is to use the same CPU vendor as the physical machine. ๐ปp2v.cpu.model=MODELโ The vCPU model, eg."IvyBridge". The default is to use the same CPU model as the physical machine.p2v.cpu.acpiโ Whether to enable ACPI in the remote virtual machine. The default is to use the same as the physical machine.p2v.cpu.apicโ Whether to enable APIC in the remote virtual machine. The default is to use the same as the physical machine.p2v.cpu.paeโ Whether to enable PAE in the remote virtual machine. The default is to use the same as the physical machine.p2v.rtc.basis=(unknown|utc|localtime)โ Set the basis of the Real Time Clock in the virtual machine. The default is to try to detect this setting from the physical machine. โฐp2v.rtc.offset=[+|-]HOURSโ The offset of the Real Time Clock from UTC. The default is to try to detect this setting from the physical machine.p2v.disks=sda,sdb,...โ A list of physical hard disks to convert, for example:
p2v.disks=sda,sdc
The default is to convert all local hard disks that are found. ๐พ
p2v.removable=sra,srb,...โ A list of removable media to convert. The default is to create virtual removable devices for every physical removable device found. Note that the content of removable media is never copied over. (Yeah, the device shows up, the stuff inside does not. Don't ask, it's just how it is. ๐)p2v.interfaces=em1,...โ A list of network interfaces to convert. The default is to create virtual network interfaces for every physical network interface found. ๐ฆp2v.network_map=interface:target,...,p2v.network=interface:target,...โ Controls how network interfaces are connected to virtual networks on the target hypervisor. The default is to connect all network interfaces to the target"default"network.
You give a comma-separated list of "interface:target" pairs, plus optionally a default target. For example:
p2v.network=em1:ovirtmgmt
maps interface "em1" to target network "ovirtmgmt".
p2v.network=em1:ovirtmgmt,em2:management,other
maps interface "em1" to "ovirtmgmt", and "em2" to "management", and any other interface that is found to "other". ๐
p2v.output.type=(libvirt|local|...),p2v.o=(libvirt|local|...)โ Set the output mode. This is the same as thevirt-v2v-ooption. See"OPTIONS"invirt-v2v(1).
If not specified, the default is "local", and the converted guest is written to /var/tmp. ๐
p2v.output.allocation=(none|sparse|preallocated),p2v.oa=(none|sparse|preallocated)โ Set the output allocation mode. This is the same as thevirt-v2v-oaoption. See"OPTIONS"invirt-v2v(1).p2v.output.connection=URI,p2v.oc=URIโ Set the output connection libvirt URI. This is the same as thevirt-v2v-ocoption. See"OPTIONS"invirt-v2v(1)andhttp://libvirt.org/uri.html๐p2v.output.format=(raw|qcow2|...),p2v.of=(raw|qcow2|...)โ Set the output format. This is the same as thevirt-v2v-ofoption. See"OPTIONS"invirt-v2v(1).p2v.output.storage=STORAGE,p2v.os=STORAGEโ Set the output storage. This is the same as thevirt-v2v-osoption. See"OPTIONS"invirt-v2v(1).
If not specified, the default is /var/tmp (on the conversion server).
p2v.output.misc=OPTION=VALUE,...,p2v.oo=OPTION=VALUE,...โ Set miscellaneous output option(s) related to the selected output mode. This is the same as thevirt-v2v-oooption; each"OPTION=VALUE"element in the list will be turned into a separate-oo OPTION=VALUEoption on the virt-v2v command line. See"OPTIONS"invirt-v2v(1). ๐๏ธp2v.pre=COMMAND,p2v.pre="COMMAND ARG ..."โ Select a pre-conversion command to run. Any command or script can be specified here. If the command contains spaces, you must quote the whole command with double quotes. The default is not to run any command. ๐โโ๏ธp2v.post=poweroff,p2v.post=reboot,p2v.post=COMMAND,p2v.post="COMMAND ARG ..."โ Select a post-conversion command to run if conversion is successful. This can be any command or script. If the command contains spaces, you must quote the whole command with double quotes.
If virt-p2v is running as root, and the command line was set from /proc/cmdline (not --cmdline), then the default is to run the poweroff(8) command. Otherwise the default is not to run any command. ๐
p2v.fail=COMMAND,p2v.fail="COMMAND ARG ..."โ Select a post-conversion command to run if conversion fails. Any command or script can be specified here. If the command contains spaces, you must quote the whole command with double quotes. The default is not to run any command. ๐ญip=dhcpโ Use DHCP for configuring the network interface (this is the default). ๐ก
๐ SSH IDENTITIES ๐
Okay bestie, so if passwords give you the ick, there's a glow-up option: use an SSH identity (that's a private key, iykyk) to log in instead. Way more secure, way more slay. ๐
First things first, you gotta make a key pair. It must have an empty passphrase โ like, no passphrase at all, periodt:
ssh-keygen -t rsa -N '' -f id_rsa
This gives you a private key (id_rsa) and a public key (id_rsa.pub). Cute little matched set. ๐
Now the public key should get appended to the authorized_keys file on the virt-v2v conversion server โ usually that's /root/.ssh/authorized_keys.
And now for the private key, there are four whole scenarios, ranked from least secure to most secure. Buckle up. ๐ฆ
- Not using SSH identities at all, aka password authentication.
Anyone who can sniff the PXE boot parameters off the network, or just observe the password some other way, can log in to the virt-v2v conversion server. Yikes. ๐
- SSH identity embedded in the virt-p2v ISO or disk image. In the GUI, you'd do:
โ Password: [ <leave this field blank> ] โ
โ โ
โ SSH Identity URL: [file:///var/tmp/id_rsa_____________] โ
or on the kernel command line:
p2v.identity=file:///var/tmp/id_rsa
Heads up though โ the SSH private key can still be sniffed from the network if you're on standard PXE. ๐ญ
- SSH identity downloaded from a website. In the GUI, use:
โ Password: [ <leave this field blank> ] โ
โ โ
โ SSH Identity URL: [https://internal.example.com/id_rsa] โ
or on the kernel command line:
p2v.identity=https://internal.example.com/id_rsa
So technically anyone could still download that private key and use it to log in to the virt-v2v conversion server ๐ฌ โ but you can add some extra security by configuring the web server so it only allows connections from P2V machines. Clever, no cap.
Okay this next bit is the classic gotcha:ssh-keygen(1)creates theid_rsa(private key) file with mode 0600. If you just copy the file to a webserver, the webserver will not serve it โ it'll reply with403 Forbiddenerrors instead. Iconic behaviour tbh. You will need to change the mode of the file to make it publicly readable, for example:chmod 0644 id_rsa
- SSH identity embedded in the virt-p2v ISO or disk image (like scenario 2), plus use of secure PXE, PXE over a separate physical network, or sneakernet to get virt-p2v onto the physical machine. This is the final boss of security. ๐
Both virt-p2v-make-disk(1) and virt-p2v-make-kickstart(1) have the same option --inject-ssh-identity for injecting the private key into the virt-p2v disk image / ISO. See also these manual sections:
"ADDING AN SSH IDENTITY"invirt-p2v-make-disk(1)"ADDING AN SSH IDENTITY"invirt-p2v-make-kickstart(1)
๐พ ACCESSING ISCSI DEVICES ๐พ
So like, what if the disk holding the operating system โ or other disks you wanna convert โ are LUNs of remote iSCSI targets? ๐ซถ No stress. Just follow these steps so virt-p2v can learn about said disks. Note that this procedure depends on the use of the GUI.
The guide below is roughly based on the RHEL9 product documentation, for the record. ๐
- Open a shell in an XTerm window, using the
"XTerm"button of the"SSH CONFIGURATION DIALOG".
(Note that the XTerm window(s) persist while you advance to further dialogs in virt-p2v, therefore it's unnecessary to jump back and forth between virt-p2v dialogs just for entering additional shell commands in the XTerm window(s). We love efficiency. โจ)
- Using
"vi"or another text editor, set the iSCSI initiator name in/etc/iscsi/initiatorname.iscsi, for example:
InitiatorName=iqn.1994-05.com.redhat:846e82c634
If the file does not exist, create it. (Remember that this file is part of the virt-p2v Live environment, therefore saving it does not modify any hard disks. Everything stays in vibes-only mode. ๐)
- Configure any further iSCSI initiator details completely that are required by the iSCSI target that you intend to log in to โ that is, before you issue the first
"iscsiadm"command below. This includes the CHAP user name and password if the target authenticates the initiator with CHAP, and the reverse direction CHAP user name and password too, if you want to ascertain the identity of the target on the initiator as well (this is called"mutual authentication").
Getting the configuration done at this stage is important because the first"iscsiadm"command will start up the"iscsid"service, and configuration changes with that service already running will not (or may not) take effect until/unless you restart the service using"systemctl". So like, do it now, not later. ๐
- Discover the iSCSI targets offered by the desired host:
iscsiadm -m discovery -t st -p IP_ADDRESS
The command should respond with a two-column list of targets. The symbolic target names are in the right hand side column, for example:
10.64.24.179:3260,1 iqn.2006-04.example:444
- Picking an appropriate target from the right hand side column of the previous step's output, log in to the target:
iscsiadm -m node -T TARGET -l
This command will inform you whether the login attempt was successful. ๐ฏ
- In case the login succeeds, a scan for LUNs on the iSCSI target will commence at once. There are two pitfalls here. One, dependent on network characteristics, the scan may take several (tens of) seconds. Two, even if the login succeeds, ACLs on the target may silently prevent the initiator from seeing particular LUNs โ meaning that no new
/dev/sdXnodes will appear. This is why it is important to get the initiator name (and, potentially, CHAP authentication) correct at the very beginning of this procedure. ๐ญ
Verify the results of the target scan with the "dmesg" command, and/or with:
ls -l /dev/disk/by-path/ip-*-iscsi-*-lun-*
If these symlinks exist, containing the IP_ADDRESS from step 4 and the TARGET name from step 5 in their filenames, then the target scan has successfully found the corresponding LUNs. Slay. ๐
- Once the remote LUNs have been successfully enumerated, click the
"Refresh disks"button in the"DISK AND NETWORK CONFIGURATION DIALOG".
๐ญ COMMON PROBLEMS ๐ญ
โฐ Timeouts
As described below (see "HOW VIRT-P2V WORKS") virt-p2v makes several long-lived ssh connections to the conversion server. If these connections time out, then virt-p2v will fail. Like, just give up on you. ๐
To test if a timeout might be causing problems, open an XTerm on the virt-p2v machine, run "ssh root@conversion-server", and leave it for at least an hour. If the session disconnects without you doing anything, then there is a timeout which you should turn off. (Not you doing anything wrong โ the session just ghosted you. ๐ฅ)
Timeouts happen because:
"TIMEOUT"or"TMOUT"environment variable
Check if one of these environment variables is set in the root shell on the conversion server.
- sshd
"ClientAlive*"setting
Check for "ClientAlive*" settings in "/etc/ssh/sshd_config" on the conversion server.
- Firewall or NAT settings
Check if there is a firewall or NAT box between virt-p2v and the conversion server, and if this firewall drops idle connections after a too-short time.
virt-p2v โฅ 1.36 attempts to work around firewall timeouts by sending ssh keepalive messages every 5 minutes. Little "hey bestie u still there" pings. ๐ซถ
โจ OPTIONS โจ
--helpโ Displays help. Your literal bestie when you're lost.--cmdline=CMDLINEโ This is used for debugging. Instead of parsing the kernel command line from/proc/cmdline, it parses the string parameterCMDLINEinstead. Fancy. ๐ฅ--colors,--coloursโ Use ANSI colour sequences to colourize messages. This is the default when the output is a tty. If the output of the program is redirected to a file, ANSI colour sequences are disabled unless you use this option. (Both spellings work, we're inclusive here. ๐)--isoโ This flag is passed to virt-p2v when it is launched inside the virt-p2v ISO environment, ie. when it is running on a real physical machine (and thus not when testing). It enables various dangerous features such as the Shutdown popup button. โ ๏ธ--test-disk=/PATH/TO/DISK.IMGโ For testing or debugging purposes, replace/dev/sdawith a local file. You must use an absolute path. Note that the"Refresh disks"button will be disabled in the"DISK AND NETWORK CONFIGURATION DIALOG"of the GUI. ๐งช-v,--verboseโ In libguestfs โฅ 1.33.41, debugging is always enabled on the conversion server, and this option does nothing. Rip, honestly. ๐-V,--versionโ Display version number and exit. ๐
โจ HOW VIRT-P2V WORKS โจ
Okay so heads up bestie: this section is not normative. We may change how virt-p2v works at any time in the future. It's the vibe tour, not the contract ๐
As described above, virt-p2v runs on a physical machine, interrogates the user or the kernel command line for configuration, and then establishes one or more ssh connections to the virt-v2v conversion server. Those ssh connections are interactive shell sessions to the remote host, but the commands sent are generated entirely by virt-p2v itself, not by the user. For data transfer, virt-p2v will use the reverse port forward feature of ssh (ie. "ssh -R"). Periodt.
It will first make one or more test connections, which are used to query the remote version of virt-v2v and its features. The test connections are closed before conversion begins.
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ virt-p2v โ โ virt-v2v โ
โ (physical โ control connection โ (conversion โ
โ server) โโโโโโโโโโโโโโโโโโโโโโโโโโโโถ server) โ
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
Once virt-p2v is ready to start conversion, it will open a single ssh control connection. It first sends a mkdir command to create a temporary directory on the conversion server. The directory name is randomly chosen and is displayed in the GUI. It has the form:
/tmp/virt-p2v-YYYYMMDD-XXXXXXXX
where "YYYYMMDD" is the current date, and the โXโs are random characters.
Into this directory are written various files which include:
dmesg,lscpu,lspci,lsscsi,lsusbโ (before conversion)
The output of the corresponding commands (ie. dmesg(1), lscpu(1) etc) on the physical machine.
The dmesg output is useful for detecting problems such as missing device drivers or firmware on the virt-p2v ISO. The others are useful for debugging novel hardware configurations. ๐ต๏ธโโ๏ธ
environmentโ (before conversion)
The content of the environment where virt-v2v(1) will run.
nameโ (before conversion)
The name (usually the hostname) of the physical machine.
physical.xmlโ (before conversion)
Libvirt XML describing the physical machine. It is used to pass data about the physical source host to virt-v2v(1) via the -i libvirtxml option.
Note this is not "real" libvirt XML (and must never be loaded into libvirt, which would reject it anyhow). Also it is not the same as the libvirt XML which virt-v2v generates in certain output modes. So like... don't be weird about it ๐ซถ
p2v-version,v2v-versionโ (before conversion)
The versions of virt-p2v and virt-v2v respectively.
statusโ (after conversion)
The final status of the conversion. 0 if the conversion was successful. Non-zero if the conversion failed. ๐
timeโ (before conversion)
The start date/time of conversion.
virt-v2v-conversion-log.txtโ (during/after conversion)
The conversion log. This is just the output of the virt-v2v command on the conversion server. If conversion fails, you should examine this log file, and you may be asked to supply the complete, unedited log file in any bug reports or support tickets. No editing it down to the cute parts, okay? ๐ญ
virt-v2v-wrapper.shโ (before conversion)
This is the wrapper script which is used when running virt-v2v. For interest only, do not attempt to run this script yourself.
Before conversion actually begins, virt-p2v then makes one or more further ssh connections to the server for data transfer.
The transfer protocol used currently is NBD (Network Block Device), which is proxied over ssh. The NBD server is nbdkit(1), with nbdkit-file-plugin(1) and socket activation. Obsessed with her honestly ๐ธ
There is one ssh connection per physical hard disk on the source machine (the common case โ a single hard disk โ is shown below):
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ virt-p2v โ โ virt-v2v โ
โ (physical โ control connection โ (conversion โ
โ server) โโโโโโโโโโโโโโโโโโโโโโโโโโโโถ server) โ
โ โ โ โ
โ โ data connection โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโถ โ
โ nbdkit โ โโ โ โโโ โ NBD โ
โ /dev/sda โ โ requests โ
โผ โผ โผ โผ
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
Okay this next bit is giving plot twist energy: although the ssh data connection is originated from the physical server and terminates on the conversion server, in fact NBD requests flow in the opposite direction. This is because the reverse port forward feature of ssh ("ssh -R") is used to open a port on the loopback interface of the conversion server which is proxied back by ssh to nbdkit running on the physical machine. The effect is that virt-v2v via libguestfs can open nbd connections which directly read the hard disk(s) of the physical server. Iconic behaviour, no notes ๐ฅ
Two layers of protection are used to ensure that there are no writes to the hard disks: Firstly, the nbdkit -r (readonly) option is used. Secondly libguestfs creates an overlay on top of the NBD connection which stores writes in a temporary file on the conversion file.
The long "virt-v2v -i libvirtxml physical.xml ..." command is wrapped inside a wrapper script and uploaded to the conversion server. The final step is to run this wrapper script, in turn running the virt-v2v command. The virt-v2v command references the physical.xml file (see above), which in turn references the NBD listening port(s) of the data connection(s).
Output from the virt-v2v command (messages, debugging etc) is saved in the log file on the conversion server. Only informational messages are sent back over the control connection to be displayed in the graphical UI. The rest stays on the server doing its little job ๐
๐ SEE ALSO ๐
virt-p2v-make-disk(1), virt-p2v-make-kickstart(1), virt-p2v-make-kiwi(1), virt-v2v(1), nbdkit(1), nbdkit-file-plugin(1), ssh(1), sshd(8), sshd_config(5), http://libguestfs.org/.
๐ AUTHORS ๐
- Matthew Booth
- John Eckersberg
- Richard W.M. Jones
http://people.redhat.com/~rjones/ - Mike Latimer
- Pino Toscano
- Tingting Zheng
๐ COPYRIGHT ๐
Copyright (C) 2009-2019 Red Hat Inc.
๐ LICENSE ๐
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
๐ฆ BUGS ๐ฆ
To get a list of bugs against libguestfs (which include virt-p2v), 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 virt-p2v.
- Where you got virt-p2v (eg. which Linux distro, compiled from source, etc)
- Describe the bug accurately and give a way to reproduce it.
okay that's the whole page bestie, you ate that ๐
โจ this one's the virt-p2v(1) manual page, source/version virt-p2v-1.42.4, dated 2024-11-05 โ go forth and convert, ily ๐ซถ๐
๐ฆ where this page comes from
- centos-stream 9: virt-p2v 1:1.42.4-1.el9 ยท GPL-2.0-or-later AND LGPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms