[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[Libguestfs] Pseudo code for v2v
- From: Matthew Booth <mbooth redhat com>
- To: libguestfs redhat com
- Subject: [Libguestfs] Pseudo code for v2v
- Date: Wed, 15 Jul 2009 10:12:43 +0100
I've attached my initial thoughts on the design for the v2v tool.
--
Matthew Booth, RHCA, RHCSS
Red Hat Engineering, Virtualisation Team
M: +44 (0)7977 267231
GPG ID: D33C3490
GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490
GuestOS e.g. RHEL/Debian
enable driver
disable driver
add application
remove application
remap device names
prepare bootable
HVTarget == KVM
get command line options
handle command line option
is ready
specialize (virt-inspector)
configure (guestos, virt-inspector) # Passes through to specialized below
HVTarget::KVM == Linux
can_configure (virt-inspector)
configure-guest (guestos, virt-inspector)
configure-metadata (libvirt DOM)
HVSource e.g. XenFV::Linux XenPV::Linux VMWare::Linux
unconfigure-guest (guestos, virt-inspector)
unconfigure-metadata (libvirt DOM)
MetadataReader e.g. libvirt/libvirtxml/ovf/command line
get command line options
handle command line option
is ready
handle arguments
get libvirt DOM
NewGuest
new (metadatareader, storage)
init storage
get storage locations
init guest
get libvirt dom
create
Storage e.g. in place/snapshot/copy
get command line options
handle command line option
is_ready
get mapped location (location)
create mapped location (location)
virt-v2v \
--target kvm --no-virtio \ -- HVTarget::KVM
--with rhel5.i386.kernel=/path/to/rhel5-kernel.rpm \ -- HVTarget::KVM
--storage snapshot --snapshot-dir /tmp \ -- Storage::Snapshot
--source libvirtxml --network default \ -- MetadataSource::LibvirtXML
rhel53xen.xml rhel53kvm
# Think we'll need 2 passes on the command line options to implement this
{
hvtarget = HVTarget::KVM
storage = Storage::Snapshot
mdr = MetadataReader::LibvirtXML
hvtarget->handle_option(--no-virtio) # Just an example. Ignored below.
hvtarget->handle_option(--with rhel5.i386.kernel=/path/to/rhel5-kernel.rpm)
storage->handle_option(--snapshot-dir /tmp)
mdr->handle_option(--network default)
}
mdr->handle_arguments(qw(rhel53xen.xml rhel53kvm))
Check: hvtarget/storage/mdr->is_ready()
newguest = NewGuest->new(mdr, storage)
# Create the underlying storage for the target guest
newguest->init_storage
%desc = virt-inspector (md->get_images())
# Infer guest OS type from %desc
# Actually, don't do this, make modules do their own discovery on %desc
guestos = GuestOS::RHEL
# Infer HVsource type from %desc
# Actually, don't do this, make modules do their own discovery on %desc
hvsource = HVSource::XenFV::Linux
hvsource->unconfigure-guest(guestos, %desc)
# This looks for and removes xen specific options in the guest
# Remove pv kernels if installed
# For VMware it would also remove vmware-tools
hvsource->unconfigure-metadata(newguest->get_libvirt_dom)
# Remove anything HV specific and replace with FV equivalent
# e.g. /domain/devices/input/@bus = xen -> ps2
# Remove /domain/bootloader
#
# Don't touch:
# /domain/@type
# /domain/os
# These must be rewritten by hvtarget
# hvtarget is now a HVTarget::KVM::Linux
hvtarget->configure-guest(guestos, %desc)
# Calls self->specialize(%desc) to find a guestos specific implementation
#
# HVTarget::KVM::Linux->configure:
# Detect rhel5.i386 guest, install rhel5.i386.kernel
# Configure virtio drivers
# Remap drives in /etc/fstab
# guestos->prepare_boot
hvtarget->configure-metadata(newguest->get_libvirt_dom)
# Set /domain/@type and /domain/os
# Configure device types (virtio)
newguest->create
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]