Is zerofree or resize2fs applicable to ext4?
by Yufang Zhang
Hi all,
Can I ask if zerofree or resize2fs could also be applicable to ext4? Guestfish help of these two commands indicates that they are applicable to ext2/3. But ext4 is not covered in the help. However, I have tested these two commands in my Fedora 12 laptop, and it seems that both commands work well with ext4. So I don't quite understand why the help of these two commands only mention ext2/3. Is it a supported feature that these two commands work with ext4? Thanks.
Best Regards.
--Yufang
14 years, 5 months
[PATCH] RHEV: Pad disk sizes up to a multiple of 1024 bytes
by Matthew Booth
Fixes RHBZ#585144
---
lib/Sys/VirtV2V/Target/RHEV.pm | 27 +++++++++++++++++++++++----
1 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/lib/Sys/VirtV2V/Target/RHEV.pm b/lib/Sys/VirtV2V/Target/RHEV.pm
index 9dd9013..6841afc 100644
--- a/lib/Sys/VirtV2V/Target/RHEV.pm
+++ b/lib/Sys/VirtV2V/Target/RHEV.pm
@@ -171,12 +171,16 @@ our %vols_by_path;
sub _new
{
my $class = shift;
- my ($mountdir, $domainuuid, $size) = @_;
+ my ($mountdir, $domainuuid, $insize) = @_;
my $self = {};
bless($self, $class);
- $self->{size} = $size;
+ $self->{insize} = $insize;
+ # RHEV needs disks to be a multiple of 512 in size. Additionally, SIZE in
+ # the disk meta file has units of kilobytes. To ensure everything matches up
+ # exactly, we will pad to to a 1024 byte boundary.
+ $self->{outsize} = ceil($insize/1024) * 1024;
my $imageuuid = Sys::VirtV2V::Target::RHEV::UUIDHelper::get_uuid();
my $voluuid = Sys::VirtV2V::Target::RHEV::UUIDHelper::get_uuid();
@@ -206,7 +210,7 @@ sub _get_size
{
my $self = shift;
- return $self->{size};
+ return $self->{outsize};
}
sub _get_imageuuid
@@ -256,6 +260,7 @@ sub open
my $self = shift;
my $now = $self->{creation};
+ $self->{written} = 0;
$self->{writer} = Sys::VirtV2V::Target::RHEV::NFSHelper->new(sub {
my $dir = $self->{dir};
@@ -283,7 +288,7 @@ sub open
print $meta "LEGALITY=LEGAL\n";
print $meta "MTIME=$now\n";
print $meta "POOL_UUID=00000000-0000-0000-0000-000000000000\n";
- print $meta "SIZE=".ceil($self->{size}/1024)."\n";
+ print $meta "SIZE=".($self->{outsize} / 1024)."\n";
print $meta "TYPE=SPARSE\n";
print $meta "DESCRIPTION=Exported by virt-v2v\n";
print $meta "EOF\n";
@@ -316,12 +321,25 @@ sub write
# die() explicitly in case the above didn't
die("Error writing to helper: $!");
}
+
+ $self->{written} += length($data);
}
sub close
{
my $self = shift;
+ # Check we wrote the full file
+ die(user_message(__x("Didn't write full volume. Expected {expected} ".
+ "bytes, wrote {actual} bytes.",
+ expected => $self->{insize},
+ actual => $self->{written})))
+ unless ($self->{written} == $self->{insize});
+
+ # Pad the output up to outsize
+ my $pad = $self->{outsize} - $self->{insize};
+ $self->write("\0" x $pad) if ($pad);
+
# Close the writer pipe, which will cause the child to exit
close($self->{writer}->{tochild})
or die("Error closing tochild pipe");
@@ -330,6 +348,7 @@ sub close
$self->{writer}->check_exit();
delete($self->{writer});
+ delete($self->{written});
}
package Sys::VirtV2V::Target::RHEV;
--
1.7.0.1
14 years, 5 months
[PATCH] RHEV: OVF must have the same name as the OS UUID
by Matthew Booth
ovf:Envelope/Content/Section[xsi:type='ovf:OperatingSystemSection_Type']/@ovf:id
is actually the canonical UUID of the guest, and must correspond to the
filename. If it doesn't, the VM cannot be deleted from the export domain.
Fixes RHBZ#583536
---
lib/Sys/VirtV2V/Target/RHEV.pm | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/lib/Sys/VirtV2V/Target/RHEV.pm b/lib/Sys/VirtV2V/Target/RHEV.pm
index 867923b..9dd9013 100644
--- a/lib/Sys/VirtV2V/Target/RHEV.pm
+++ b/lib/Sys/VirtV2V/Target/RHEV.pm
@@ -562,7 +562,7 @@ sub create_guest
# Generate a creation date
my $vmcreation = _format_time(gmtime());
- my $osuuid = Sys::VirtV2V::Target::RHEV::UUIDHelper::get_uuid();
+ my $vmuuid = Sys::VirtV2V::Target::RHEV::UUIDHelper::get_uuid();
my $ovf = new XML::DOM::Parser->parse(<<EOF);
<ovf:Envelope
@@ -597,7 +597,7 @@ sub create_guest
<VmType>1</VmType>
<DefaultDisplayType>0</DefaultDisplayType>
- <Section ovf:id="$osuuid" ovf:required="false" xsi:type="ovf:OperatingSystemSection_Type">
+ <Section ovf:id="$vmuuid" ovf:required="false" xsi:type="ovf:OperatingSystemSection_Type">
<Info>Guest Operating System</Info>
<Description>Unassigned</Description>
</Section>
@@ -644,8 +644,6 @@ EOF
my $mountdir = $self->{mountdir};
my $domainuuid = $self->{domainuuid};
- my $vmuuid = Sys::VirtV2V::Target::RHEV::UUIDHelper::get_uuid();
-
my $dir = $mountdir.'/'.$domainuuid.'/master/vms/'.$vmuuid;
mkdir($dir)
or die(user_message(__x("Failed to create directory {dir}: {error}",
--
1.7.0.1
14 years, 5 months