Hello community, here is the log from the commit of package kiwi for openSUSE:Factory checked in at 2011-11-14 11:55:42 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kiwi (Old) and /work/SRC/openSUSE:Factory/.kiwi.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kiwi", Maintainer is "m...@suse.com" Changes: -------- --- /work/SRC/openSUSE:Factory/kiwi/kiwi.changes 2011-11-10 15:48:28.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.kiwi.new/kiwi.changes 2011-11-14 11:55:46.000000000 +0100 @@ -1,0 +2,19 @@ +Fri Nov 11 14:15:50 CET 2011 - m...@suse.de + +- renamed image format vpc to vhd. vhd seems to be the well + known name for Microsoft HyperV images (bnc #729857) + +------------------------------------------------------------------- +Fri Nov 11 10:12:53 CET 2011 - m...@suse.de + +- fixed creation of initial aligned partition table in KIWIBoot.pm + In SuSE studio the loop device which is normally the target for + parted is relinked behind the scene to a virtio device. As result + parted now sees a real disk geometry and that induced the bug in + kiwi which is not visible if it operates on the file mapped loop + device only. Looking at that partition code has turned out that + the alignment is broken which in the end broke the repartition + process in the first boot of an oem install image. The code is + now fixed to work properly on any storage device (bnc #729636) + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kiwi.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/.revision new/kiwi/.revision --- old/kiwi/.revision 2011-11-10 11:26:01.000000000 +0100 +++ new/kiwi/.revision 2011-11-10 11:26:01.000000000 +0100 @@ -1 +1 @@ -20b09a54a5a2e7194e0bf5e062b7f44819d46e1a +a5383995be60605e247a6c829f7bfef791130471 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/modules/KIWIBoot.pm new/kiwi/modules/KIWIBoot.pm --- old/kiwi/modules/KIWIBoot.pm 2011-11-10 11:26:05.000000000 +0100 +++ new/kiwi/modules/KIWIBoot.pm 2011-11-11 14:21:23.000000000 +0100 @@ -4180,12 +4180,12 @@ } #========================================== -# getCylinderSizeAndCount +# getGeometry #------------------------------------------ -sub getCylinderSizeAndCount { +sub getGeometry { # ... - # obtain cylinder size and count for the specified disk. - # The function returns the size in kB (10^3 B) or zero on error + # obtain number of sectors from the given + # disk device and return it # --- my $this = shift; my $disk = shift; @@ -4207,9 +4207,9 @@ $kiwi -> loginfo ($status); return 0; } - $parted = "$parted_exec -m $disk unit cyl print"; + $parted = "$parted_exec -m $disk unit s print"; $status = qxx ( - "$parted | head -n 3 | tail -n 1 | cut -f4 -d: | tr -d 'kB;'" + "$parted | head -n 3 | tail -n 1 | cut -f2 -d:" ); $result = $? >> 8; if ($result != 0) { @@ -4217,109 +4217,93 @@ return 0; } chomp $status; - $this->{pDiskCylinderSize} = $status; - $status = qxx ( - "$parted | head -n 3 | tail -n 1 | cut -f1 -d:" - ); - $result = $? >> 8; - if ($result != 0) { - $kiwi -> loginfo ($status); - return 0; - } - chomp $status; - $this->{pDiskCylinders} = $status; + $status =~ s/s//; + $status --; + $this->{pDiskSectors} = $status; $kiwi -> loginfo ( - "Disk Cylinder size is: $this->{pDiskCylinderSize} kB\n" - ); - $kiwi -> loginfo ( - "Disk Cylinder count is: $this->{pDiskCylinders}\n" + "Disk Sector count is: $this->{pDiskSectors}\n" ); return $status; } #========================================== -# getCylinder +# getSector #------------------------------------------ -sub getCylinder { +sub getSector { # ... - # given a size in MB this function calculates the - # aligned cylinder count according to the used disk - # if no size is given the maximum value is used - # --- + # turn the given size in MB to the number of + # required sectors + # ---- my $this = shift; my $size = shift; - my $csize = $this->{pDiskCylinderSize}; - my $count = $this->{pDiskCylinders}; - my $cyls; - if (! defined $csize) { - return 0; - } + my $count = $this->{pDiskSectors}; + my $secsz = 512; + my $sectors; if ($size =~ /\+(.*)M$/) { - $cyls = sprintf ("%.0f",($size * 1048576) / ($csize * 1000)); + $sectors = sprintf ("%.0f",($size * 1048576) / $secsz); + if ($sectors == 0) { + $sectors = 8; + } } else { - $cyls = $count; + $sectors = $count; } - return $cyls; + return $sectors; } #========================================== -# resetCylinder +# resetGeometry #------------------------------------------ -sub resetCylinder { +sub resetGeometry { # ... - # reset global cylinder size and count + # reset global disk geometry information # --- my $this = shift; - undef $this->{pDiskCylinders}; - undef $this->{pDiskCylinderSize}; + undef $this->{pDiskSectors}; undef $this->{pStart}; undef $this->{pStopp}; return $this; } #========================================== -# initCylinders +# initGeometry #------------------------------------------ -sub initCylinders { +sub initGeometry { # ... - # calculate cylinder size and count for parted to create - # the appropriate partition. On success the cylinder count - # will be returned, on error zero is returned + # setup start sector and stop cylinder for the given size at + # first invocation the start cylinder is set to the default + # value from the global space or to the value specified on + # the commandline. On any subsequent call the start sector is + # calculated from the end sector of the previos partition + # and the new value gets aligned to be modulo 8 clean. The + # function returns the number of sectors which represents + # the given size # --- my $this = shift; my $device = shift; my $size = shift; my $kiwi = $this->{kiwi}; my $cmdL = $this->{cmdL}; - my $cylsize= $this->{pDiskCylinderSize}; - my $secsize= 512; - my $cyls = 0; - my $status; - my $result; - if (! defined $this->{pDiskCylinders}) { - my $cylcount = $this -> getCylinderSizeAndCount($device); - if ($cylcount == 0) { - return 0; - } - $cylsize= $this->{pDiskCylinderSize}; - } - $cyls = $this -> getCylinder ($size); - if ($cyls == 0) { - return 0; - } + my $locator= new KIWILocator($kiwi); if (! defined $this->{pStart}) { - $cylsize *= 1024; - $this->{pStart} = sprintf ( - "%.0f",(($cmdL->getDiskStartSector() * $secsize) / $cylsize) - ); + $this->{pStart} = $cmdL->getDiskStartSector(); } else { - $this->{pStart} = $this->{pStopp}; - } - $this->{pStopp} = $this->{pStart} + $cyls; - if ($this->{pStopp} > $this->{pDiskCylinders}) { - $this->{pStopp} = $this->{pDiskCylinders} + my $parted_exec = $locator -> getExecPath("parted"); + my $parted = "$parted_exec -m $device unit s print"; + my $status = qxx ( + "$parted | grep :$this->{pStart} | cut -f3 -d:" + ); + $status=~ s/s//; + $status = int ($status / 8); + $status*= 8; + $status+= 8; + $this->{pStart} = $status; + } + my $sector = $this -> getSector ($size); + $this->{pStopp} = $this->{pStart} + $sector; + if ($this->{pStopp} > $this->{pDiskSectors}) { + $this->{pStopp} = $this->{pDiskSectors} } - return $cyls; + return $sector; } #========================================== @@ -4410,44 +4394,32 @@ # parted #------------------------------------------ /^parted/ && do { - my @p_cmd = (); - $this -> resetCylinder(); + my $p_cmd = (); + $this -> resetGeometry(); + $this -> getGeometry ($device); for (my $count=0;$count<@commands;$count++) { my $cmd = $commands[$count]; if ($cmd eq "n") { my $size = $commands[$count+4]; - $this -> initCylinders ($device,$size); - push (@p_cmd, - "mkpart primary $this->{pStart} $this->{pStopp}" - ); + $this -> initGeometry ($device,$size); + $p_cmd = "mkpart primary $this->{pStart} $this->{pStopp}"; + $kiwi -> loginfo ("PARTED input: $device [$p_cmd]\n"); + qxx ("$parted_exec -s $device unit s $p_cmd 2>&1"); } if ($cmd eq "t") { my $index= $commands[$count+1]; my $type = $commands[$count+2]; - push (@p_cmd,"set $index type 0x$type"); + $p_cmd = "set $index type 0x$type"; + $kiwi -> loginfo ("PARTED input: $device [$p_cmd]\n"); + qxx ("$parted_exec -s $device unit s $p_cmd 2>&1"); } if ($cmd eq "a") { my $index= $commands[$count+1]; - push (@p_cmd,"set $index boot on"); + $p_cmd = "set $index boot on"; + $kiwi -> loginfo ("PARTED input: $device [$p_cmd]\n"); + qxx ("$parted_exec -s $device unit s $p_cmd 2>&1"); } } - $kiwi -> loginfo ( - "PARTED input: $device [@p_cmd]\n" - ); - my $align=""; - $status = qxx ("$parted_exec --help | grep -q align="); - $result = $? >> 8; - if ($result == 0) { - $align="-a cyl"; - } - foreach my $p_cmd (@p_cmd) { - $status= qxx ( - "$parted_exec $align -s $device unit cyl $p_cmd 2>&1" - ); - $result= $? >> 8; - $kiwi -> loginfo ($status); - sleep (1); - } last SWITCH; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/modules/KIWIImageFormat.pm new/kiwi/modules/KIWIImageFormat.pm --- old/kiwi/modules/KIWIImageFormat.pm 2011-11-10 11:26:01.000000000 +0100 +++ new/kiwi/modules/KIWIImageFormat.pm 2011-11-11 14:21:23.000000000 +0100 @@ -155,9 +155,9 @@ if ($format eq "vmdk") { $kiwi -> info ("Starting raw => $format conversion\n"); return $this -> createVMDK(); - } elsif ($format eq "vpc") { + } elsif ($format eq "vhd") { $kiwi -> info ("Starting raw => $format conversion\n"); - return $this -> createVPC(); + return $this -> createVHD(); } elsif ($format eq "ovf") { $kiwi -> info ("Starting raw => $format conversion\n"); return $this -> createOVF(); @@ -322,11 +322,30 @@ } #========================================== -# createVPC +# createVHD #------------------------------------------ -sub createVPC { +sub createVHD { my $this = shift; - return $this -> createVMDK(); + my $kiwi = $this->{kiwi}; + my %vmwc = %{$this->{vmwref}}; + my $source = $this->{image}; + my $target = $source; + my $convert; + my $status; + my $result; + $kiwi -> info ("Creating vhd image..."); + $target =~ s/\.raw$/\.vhd/; + $convert = "convert -f raw $source -O vpc"; + $status = qxx ("qemu-img $convert $target 2>&1"); + $result = $? >> 8; + if ($result != 0) { + $kiwi -> failed (); + $kiwi -> error ("Couldn't create vhd image: $status"); + $kiwi -> failed (); + return undef; + } + $kiwi -> done (); + return $target; } #========================================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/modules/KIWISchema.rnc new/kiwi/modules/KIWISchema.rnc --- old/kiwi/modules/KIWISchema.rnc 2011-11-10 11:26:01.000000000 +0100 +++ new/kiwi/modules/KIWISchema.rnc 2011-11-11 14:21:23.000000000 +0100 @@ -1490,7 +1490,7 @@ k.type.format.attribute = ## Specifies the format of the virtual disk. attribute format { - "ec2" | "ovf" | "qcow2" | "vmdk" | "vpc" + "ec2" | "ovf" | "qcow2" | "vmdk" | "vhd" } k.type.fsnocheck.attribute = ## Turn off periodic filesystem checks on ext2/3/4. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/modules/KIWISchema.rng new/kiwi/modules/KIWISchema.rng --- old/kiwi/modules/KIWISchema.rng 2011-11-10 11:26:01.000000000 +0100 +++ new/kiwi/modules/KIWISchema.rng 2011-11-11 14:21:23.000000000 +0100 @@ -2013,7 +2013,7 @@ <value>ovf</value> <value>qcow2</value> <value>vmdk</value> - <value>vpc</value> + <value>vhd</value> </choice> </attribute> </define> -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org