libguestfs on Ubuntu
by Richard W.M. Jones
So I got a lot further building libguestfs on Ubuntu, up to the point
where I can boot the appliance and run some simple commands. We need
to push some patches upstream, and there are still some things in
Ubuntu itself which are broken. This documents how far I've got.
(1) libguestfs from git, Ubuntu 9.10, all updated to the latest
versions. You will of course also need to read the README file and
install the long list of dependencies, all of which are in the Ubuntu
repositories.
http://git.annexia.org/?p=libguestfs.git;a=summary
http://libguestfs.org/README.txt
(2) I'm going to post patches as follow-ups to this email, of which
most/all will be required.
(3) You will need debirf 0.25. I installed it from:
http://gb.archive.ubuntu.com/ubuntu/pool/universe/d/debirf/
(4) This is how I'm configuring:
./autogen.sh \
--with-readline \
--with-repo=karmic \
--with-mirror=http://gb.archive.ubuntu.com/ubuntu/ \
--enable-debug-command
(5) make
(6) 'make check' fails during the Gnulib tests.
(7) After building you can do a quick sanity check:
$ ./fish/guestfish alloc /tmp/test.img 10M : run : list-devices
/dev/sda
If it doesn't work, add the '-v' option and post the full output here.
I was able to run some basic guestfish commands, but I didn't yet test
it extensively.
Rich.
----------------------------------------------------------------------
$ ./fish/guestfish
Welcome to guestfish, the libguestfs filesystem interactive shell for
editing virtual machine filesystems.
Type: 'help' for help with commands
'quit' to quit the shell
><fs> alloc /tmp/test.img
use 'alloc file size' to create an image
><fs> alloc /tmp/test.img 10M
><fs> run
open /dev/kvm: No such file or directory
Could not initialize KVM, will disable KVM support
><fs> list-devices
/dev/sda
><fs> help part-disk
NAME
part-disk - partition whole disk with a single primary partition
SYNOPSIS
part-disk device parttype
DESCRIPTION
This command is simply a combination of "part_init" followed by
"part_add" to create a single primary partition covering the whole disk.
"parttype" is the partition table type, usually "mbr" or "gpt", but
other possible values are described in "part_init".
This command is dangerous. Without careful use you can easily destroy
all your data.
><fs> part-disk /dev/sda mbr
><fs> mkfs ext3 /dev/sda1
><fs> mount /dev/sda1 /
><fs> touch /hello
><fs> umount-all
><fs> list-partitions
/dev/sda1
><fs> sync
><fs>
$ strings /tmp/test.img
lost+found
hello
lost+found
hello
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
14 years, 10 months
[PATCH] Converter: Blacklist ACPI for RHEL 3 x86_64
by Matthew Booth
---
lib/Sys/VirtV2V/Converter.pm | 13 +++++++++++--
lib/Sys/VirtV2V/Converter/Linux.pm | 16 ++++++++++++++++
2 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/lib/Sys/VirtV2V/Converter.pm b/lib/Sys/VirtV2V/Converter.pm
index 3b0500b..a6eba45 100644
--- a/lib/Sys/VirtV2V/Converter.pm
+++ b/lib/Sys/VirtV2V/Converter.pm
@@ -319,10 +319,19 @@ sub _configure_capabilities
}
foreach my $feature ($dom->findnodes('/domain/features/*')) {
- if (!exists($features{$feature->getNodeName()})) {
+ my $name = $feature->getNodeName();
+
+ if (!exists($features{$name})) {
print STDERR user_message
(__x("The connected hypervisor does not support ".
- "feature {feature}", feature => $feature->getNodeName()));
+ "feature {feature}", feature => $name));
+ $feature->getParentNode()->removeChild($feature);
+ }
+
+ if ($name eq 'acpi' && !$guestcaps->{acpi}) {
+ print STDERR user_message
+ (__"The target guest does not support acpi under KVM. ACPI ".
+ "will be disabled.");
$feature->getParentNode()->removeChild($feature);
}
}
diff --git a/lib/Sys/VirtV2V/Converter/Linux.pm b/lib/Sys/VirtV2V/Converter/Linux.pm
index db7a1ed..057ef45 100644
--- a/lib/Sys/VirtV2V/Converter/Linux.pm
+++ b/lib/Sys/VirtV2V/Converter/Linux.pm
@@ -105,6 +105,7 @@ sub convert
$guestcaps{virtio} = $virtio;
$guestcaps{arch} = _get_os_arch($desc);
+ $guestcaps{acpi} = _supports_acpi($desc, $guestcaps{arch});
return \%guestcaps;
}
@@ -495,6 +496,21 @@ sub _find_xen_kernel_modules
return @modules;
}
+# Return 1 if the guest supports ACPI, 0 otherwise
+sub _supports_acpi
+{
+ my ($desc, $arch) = @_;
+
+ # Blacklist configurations which are known to fail
+ # RHEL 3, x86_64
+ if ($desc->{distro} eq 'rhel' && $desc->{major_version} == 3 &&
+ $arch eq 'x86_64') {
+ return 0;
+ }
+
+ return 1;
+}
+
=back
=head1 COPYRIGHT
--
1.6.5.2
14 years, 11 months
Refactor virt-v2v to be more like a 'big script'
by Matthew Booth
These patches combine HVSource and HVTarget into a single Converter. This should
make it more obvious where to hack without losing any practical flexibility.
GuestOS remains separate. GuestOS is now a misnomer, because it's really only a
Linux distro abstraction. It will be useless for Windows, for example. Functions
which you'd expect to be different on a non-RH distro should live in GuestOS.
By this measure it's currently too fat. I'll gradually move non-distro specific
things out of it as I touch them.
Matt
14 years, 11 months
[PATCH] po: Include fr.po in MANIFEST
by Matthew Booth
---
MANIFEST | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/MANIFEST b/MANIFEST
index 13897af..3489ff1 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -18,6 +18,7 @@ MANIFEST This list of files
MANIFEST.SKIP
META.yml
po/es.po
+po/fr.po
po/it.po
po/Makefile
po/PACKAGE
--
1.6.5.2
14 years, 11 months
[PATCH] snapshot: Explicitly remove unused disk source attribute
by Matthew Booth
This fixes a regression introduced by 9e3d1160. Snapshot was leaving both dev
and file attributes specified. The result was that the v2v would actually
operate on the underlying storage rather than the snapshot.
---
snapshot/v2v-snapshot.pl | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/snapshot/v2v-snapshot.pl b/snapshot/v2v-snapshot.pl
index f089a77..e2cc33c 100755
--- a/snapshot/v2v-snapshot.pl
+++ b/snapshot/v2v-snapshot.pl
@@ -529,8 +529,10 @@ sub _commit_guest
# Update the domain XML with the location of the backing store
if($backing_type == Sys::Virt::StorageVol::TYPE_BLOCK) {
$source->setAttribute('dev', $backing_path);
+ $source->removeAttribute('file');
} else {
$source->setAttribute('file', $backing_path);
+ $source->removeAttribute('dev');
}
# Update the domain XML with with a driver appropriate to the backing
@@ -647,6 +649,9 @@ sub _snapshot_guest
# Update the source to be a "file" with the new path
$source->setAttribute("file", $vol->get_path());
+ # Remove the dev attribute in case it was set
+ $source->removeAttribute("dev");
+
# Also update the disk element to be a "file"
$source->getParentNode()->setAttribute('type', 'file');
--
1.6.5.2
14 years, 11 months
some thoughts about virt-v2v (including matt's reply)
by Osier Yang
From matt :
Osier,
Comments inline below.
On 18/12/09 07:39, Osier Yang wrote:
> and another point.
>
> the messages printed to stdout or stderr are not with "message level".
> such as
> [root@dhcp-66-70-131 image]# virt-v2v -i libvirtxml demo1.xml
> virt-v2v: The connected hypervisor does not support a machine type of pc.
> virt-v2v: demo1 configured with virtio drivers
>
> The user won't known whether "virt-v2v: The connected hypervisor does
> not support a machine type of pc." is a warning or error. :)
Yup, that could be improved.
>
> Osier Yang wrote:
>> hi, mbooth.
>>
>> just some thoughts about virt-v2v, hope it's not invalid. :)
>>
>> 1. when we convert a guest on xen. we should do as following:
>> 1> dump the guest xml
>> 2> copy the guest xml and image to the the machine on which virt-v2v
>> will run.
>> 3> mv the guest image to "/var/lib/libvirt/images"
>> 4> change the path of guest image "<source
>> file="/var/lib/xen/images/guest.img">" into "<source
>> file="/var/lib/libvirt/images/guest.img">"
>>
>> what I think is could we add an option of virt-v2v so that the user
>> can specify the new path of the guest image, add the script help the
>> user do
>> the replacement, such as:
>> # virt-v2v -i libvirtxml guest.xml --image=/tmp/guest.img
>>
>> Think it's more convenient.
Yes, I definitely need to do something much cleverer with storage
changing path. With the addition of support for VMWare guests I'm going
to have to sort pulling storage from a remote server, so I will have to
address this.
>> 2. seems virt-v2v doesn't generate any log.
>> when do the testing, sometime we want to see the log to see what
>> happened. it's important somehow. libvirt provides an ENV variable
>> "LIBVIRT_DEBUG", with setting the value "1", "2", "3", "4". diffrent
>> level messages are logged.
>> may be we can take it as a reference.
I haven't considered this before. Definitely desirable.
>> 3. when the conversion done, there is no prompt string to tell the
>> user whether it's successfull or failed.
>> think it's better if given freindly prompt string, such as :
>> # virt-v2v -i libvirtxml guest.xml --image=/tmp/guest.img
>> ........... messages ................
>> congratulations, the guest was migrated successfully, try to start it
>> using "virsh start guestname"
Related to your point about clearer output messages, I think. I agree
this would be a good idea.
>> Of course, these are just my own thoughts without deep knownledge of
>> virt-v2v, may be some of them are not reasonable, or invalid, or it's
>> already in the process of
>> implementing, if it is, just skip them. :-)
They're all good. Storage migration is a priority, but it's going to
have to wait for VMWare. After this I'd say the change log was most
important. Clearer output messages are highly desirable, but bottom of
the pile for the moment.
In general it's probably best to send this to the libguestfs mailing
list. Your points are extremely well made, and may prompt others to
offer more.
Thanks,
Matt
15 years
[PATCH] HVTarget: trivial NFC code cleanup
by Matthew Booth
---
lib/Sys/VirtV2V/HVTarget/Linux.pm | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/Sys/VirtV2V/HVTarget/Linux.pm b/lib/Sys/VirtV2V/HVTarget/Linux.pm
index 53784ea..dc546de 100644
--- a/lib/Sys/VirtV2V/HVTarget/Linux.pm
+++ b/lib/Sys/VirtV2V/HVTarget/Linux.pm
@@ -349,7 +349,7 @@ sub _configure_kernel
}
# If we didn't install a new kernel, pick the default kernel
- $boot_kernel = $guestos->get_default_kernel() if(!defined($boot_kernel));
+ $boot_kernel ||= $guestos->get_default_kernel();
return $boot_kernel;
}
--
1.6.5.2
15 years
[PATCH] GuestOS: Fix [aliases] not parsed unless [deps] is specified
by Matthew Booth
A cut/paste error in GuestOS.pm meant that aliases specified in the config file
would be ignored unless the config file also had a [deps] section.
---
lib/Sys/VirtV2V/GuestOS.pm | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/Sys/VirtV2V/GuestOS.pm b/lib/Sys/VirtV2V/GuestOS.pm
index 60d62ed..1db7590 100644
--- a/lib/Sys/VirtV2V/GuestOS.pm
+++ b/lib/Sys/VirtV2V/GuestOS.pm
@@ -188,7 +188,7 @@ sub configure
# Populate aliases from the [aliases] config section
my $aliases_conf = $config->{aliases};
- if(defined($deps_conf)) {
+ if(defined($aliases_conf)) {
# Copy the aliases_conf hash into %aliases
foreach my $label (keys(%$aliases_conf)) {
$aliases{$label} = $aliases_conf->{$label};
--
1.6.5.2
15 years