[Libvir] [for discussion only] virDomainBlockPeek preliminary implementation

Daniel P. Berrange berrange at redhat.com
Tue Oct 16 15:27:50 UTC 2007


On Tue, Oct 16, 2007 at 03:42:50PM +0100, Richard W.M. Jones wrote:
> The attached patch (for discussion only) adds a virDomainBlockPeek call, 
> allowing callers to peek into the block devices of domains.
> 
> +/**
> + * virDomainBlockPeek:
> + * @dom: pointer to the domain object
> + * @path: path to the block device
> + * @offset: offset within block device
> + * @size: size to read
> + * @buffer: return buffer (must be at least size bytes)
> + *
> + * This function allows you to read the contents of a domain's
> + * disk device.
> + *
> + * Typical uses for this are to determine if the domain has
> + * written a Master Boot Record (indicating that the domain
> + * has completed installation), or to try to work out the state
> + * of the domain's filesystems.

IMHO, if we had storage management APIs this use case could be better
handled by simply having a piece of metadata associated with the volume.
eg, you could just run    virVolumeDumpXML()  and look for an element

  <parttable type='mbr'/>

Lack of such an element would indicate it was not partitioned. It
could also return 'gpt' for the new fangled EFI bios partitioning
scheme, or whatever format BSD/Solaris/Sun uses. This would avoid 
the ned for every application caller to repeat the magic for sniffing
partition table types.

Regards,
Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 




More information about the libvir-list mailing list