Date formats were previously undefined in RHEV's OVF output. They are now
defined as: 'yyyy/mm/dd hh:mm:ss'.
This change updates dates output by virt-v2v to use the new format.
---
lib/Sys/VirtV2V/Target/RHEV.pm | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/lib/Sys/VirtV2V/Target/RHEV.pm b/lib/Sys/VirtV2V/Target/RHEV.pm
index 911e5c6..f14c54f 100644
--- a/lib/Sys/VirtV2V/Target/RHEV.pm
+++ b/lib/Sys/VirtV2V/Target/RHEV.pm
@@ -543,10 +543,7 @@ sub create_guest
$memsize = int($memsize / 1024);
# Generate a creation date
- my $now = gmtime();
- my $vmcreation = sprintf("%02d/%02d/%d %02d:%02d:%02d",
- $now->mday(), $now->mon() + 1, $now->year() +
1900,
- $now->hour(), $now->min(), $now->sec());
+ my $vmcreation = _format_time(gmtime());
my $osuuid = Sys::VirtV2V::Target::RHEV::UUIDHelper::get_uuid();
@@ -651,6 +648,14 @@ EOF
$nfs->check_exit();
}
+sub _format_time
+{
+ my ($time) = @_;
+ return sprintf("%04d/%02d/%02d %02d:%02d:%02d",
+ $time->year() + 1900, $time->mon() + 1, $time->mday(),
+ $time->hour(), $time->min(), $time->sec());
+}
+
sub _disks
{
my $self = shift;
@@ -756,11 +761,7 @@ sub _disks
$e->addText('00000000-0000-0000-0000-000000000000');
$item->appendChild($e);
- my $volcreation = gmtime($vol->_get_creation());
- my $voldate = sprintf("%02d/%02d/%d %02d:%02d:%02d",
- $volcreation->mday(), $volcreation->mon() + 1,
- $volcreation->year() + 1900, $volcreation->hour(),
- $volcreation->min(), $volcreation->sec());
+ my $voldate = _format_time(gmtime($vol->_get_creation()));
$e = $ovf->createElement('rasd:CreationDate');
$e->addText($voldate);
--
1.6.6.1