[libvirt-users] pool assumed to have 512B sector

Daniel P. Berrange berrange at redhat.com
Tue Aug 23 14:25:08 UTC 2011


On Tue, Aug 23, 2011 at 12:49:41PM +0300, David Cohen wrote:
> Hi,
> 
> 
> The xml file used to create the pool :
> 
> <pool type='disk'>
> <name>guest_images_disk</name>
> <source>
> <device path='/dev/sdb'/>
> <format type='gpt'/>
> </source>
> <target>
> <path>/dev</path>
> </target>
> </pool>

Ok, it is a disk partition based pool. It appears that our parted
code is assuming 512 byte sectors as you thought. I reckon that
this change should fix it


diff --git a/src/storage/parthelper.c b/src/storage/parthelper.c
index acc9171..964aa78 100644
--- a/src/storage/parthelper.c
+++ b/src/storage/parthelper.c
@@ -157,17 +157,17 @@ int main(int argc, char **argv)
                    part->num, '\0',
                    type, '\0',
                    content, '\0',
-                   part->geom.start * 512llu, '\0',
-                   (part->geom.end + 1 ) * 512llu, '\0',
-                   part->geom.length * 512llu, '\0');
+                   part->geom.start * dev->sector_size, '\0',
+                   (part->geom.end + 1 ) * dev->sector_size, '\0',
+                   part->geom.length * dev->sector_size, '\0');
         } else {
             printf("%s%c%s%c%s%c%llu%c%llu%c%llu%c",
                    "-", '\0',
                    type, '\0',
                    content, '\0',
-                   part->geom.start * 512llu, '\0',
-                   (part->geom.end + 1 ) * 512llu, '\0',
-                   part->geom.length * 512llu, '\0');
+                   part->geom.start * dev->sector_size, '\0',
+                   (part->geom.end + 1 ) * dev->sector_size, '\0',
+                   part->geom.length * dev->sector_size, '\0');
         }
         part = ped_disk_next_partition(disk, part);
     }


but I don't have any way to test this myself

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvirt-users mailing list