Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 940786 Details for
Bug 1141145
virt-v2v fails to convert xen pv guests.
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
test-broken-grub.pl
test-broken-grub.pl (text/plain), 3.50 KB, created by
Richard W.M. Jones
on 2014-09-24 14:03:00 UTC
(
hide
)
Description:
test-broken-grub.pl
Filename:
MIME Type:
Creator:
Richard W.M. Jones
Created:
2014-09-24 14:03:00 UTC
Size:
3.50 KB
patch
obsolete
>#!/usr/bin/perl -w ># Test broken grub-legacy installations. ># https://bugzilla.redhat.com/show_bug.cgi?id=1141145#c26 ># https://bugzilla.redhat.com/show_bug.cgi?id=1141145#c27 ># ># You can run this script (non-destructively) against most RHEL <= 6 or ># (ancient) Fedora VM disk images. ># ># Only supports grub-legacy at the moment, NOT grub2, although that ># could be added by someone with the patience to work out how the ># grub2 blocklist is encoded in the disk image. > >use strict; > >use Sys::Guestfs; > >die "usage: $0 disk.img\n" if @ARGV < 1; >my $disk = $ARGV[0]; > >my $g = Sys::Guestfs->new (); > ># readonly=>1 adds an overlay so that the underlying disk image won't ># be touched. >$g->add_drive_opts ($disk, readonly => 1); > >$g->launch (); > ># Find out what the guest is. >my @roots = $g->inspect_os (); >die "$0: no operating system was found in the disk image\n" if @roots == 0; >my $root = $roots[0]; > >my $type = $g->inspect_get_type ($root); >die "$0: not a Linux disk image\n" if $type ne "linux"; > >my $product_name = $g->inspect_get_product_name ($root); >my $distro = $g->inspect_get_distro ($root); > >printf "Product name: %s\n", $product_name; >printf "Type/distro: %s/%s\n", $type, $distro; > ># Mount up the disks so we can see if it uses grub-legacy or grub2. >my %mps = $g->inspect_get_mountpoints ($root); >my @mps = sort { length $a <=> length $b } (keys %mps); >my ($bootdev, $bootvfstype); >for my $mp (@mps) { > eval { > $g->mount ($mps{$mp}, $mp); > if ($mp eq "/boot") { > $bootdev = $mps{$mp}; > $bootvfstype = $g->vfs_type ($mps{$mp}); > } > }; > if ($@) { > print "$@ (ignored)\n" > } >} > >die "$0: cannot find /boot filesystem: it might not be a separate mountpoint, or this could be an EFI guest" unless defined $bootdev; >printf "Boot dev: %s\n", $bootdev; >printf "Boot fs: %s\n", $bootvfstype; > >my $grub_type; >if ($g->is_dir ("/boot/grub2")) { > $grub_type = "grub2" >} elsif ($g->is_dir ("/boot/grub")) { > $grub_type = "grub-legacy" >} else { > die "$0: cannot detect grub type (legacy or grub2) used by this guest" >} > >printf "Grub: %s\n", $grub_type; > >die "$0: we don't support grub2 yet" if $grub_type ne "grub-legacy"; > >sub get_stage2_from_mbr >{ > # Grab the MBR. > my $mbr = $g->pread_device ("/dev/sda", 512, 0); > > # For grub-legacy we expect a 32 bit little-endian sector number > # pointing to stage2 at a particular offset. > my $offset = unpack ("V", substr ($mbr, 0x44, 4)) * 512; > > # Check that the data on the disk at that offset matches the > # contents of the stage2 file. Only the first few bytes. > my $stage2data = $g->pread_device ("/dev/sda", 200, $offset); > > return $stage2data; >} > >sub get_stage2_file >{ > my $stage2file = $g->pread ("/boot/grub/stage2", 200, 0); > return $stage2file; >} > >my $stage2file = get_stage2_file (); > >my $stage2data = get_stage2_from_mbr (); > ># It might be that the guest really isn't bootable, but it's ># more likely that we've screwed up the calculations. >die "$0: internal error: \$stage2data != \$stage2file" > if $stage2data ne $stage2file; > ># Now zero free space in the boot partition. >$g->zero_free_space ("/boot"); > ># We need to sync, and drop caches in the appliance, otherwise ># we're just re-reading the cached /dev/sda again. >$g->sync (); >$g->drop_caches (3); > ># Now check if the guest would still be bootable. >$stage2data = get_stage2_from_mbr (); > >die "BROKEN GUEST: grub configuration points to a deleted stage2 file!\n" > if $stage2data ne $stage2file; > >printf "OK: grub configuration in this guest is fine\n"
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1141145
:
937871
|
938311
|
938755
|
939863
| 940786