[libvirt] [PATCH 2/5] Add partition type

Daniel P. Berrange berrange at redhat.com
Thu Jun 25 09:21:56 UTC 2009


On Wed, Jun 24, 2009 at 11:14:29AM +0200, Henrik Persson wrote:
> This patch add the partition type (primary, extended, logical) in internal libvirt data structure.
> This is important when deciding what kind of partition should be created.

> --- libvirt-0.6.4.org/src/storage_conf.h	2009-06-23 16:18:48.576828000 +0200
> +++ libvirt-0.6.4/src/storage_conf.h	2009-06-23 16:37:19.497435000 +0200
> @@ -74,6 +74,7 @@ struct _virStorageVolTarget {
>      char *path;
>      int format;
>      virStoragePerms perms;
> +    int type; /* only used by disk backend for partition type */
>  };
>  
>  
> @@ -444,6 +445,12 @@ enum virStorageVolFormatDisk {
>  };
>  VIR_ENUM_DECL(virStorageVolFormatDisk)
>  
> -
> +enum virStorageVolTypeDisk {
> +    VIR_STORAGE_VOL_DISK_TYPE_NONE = 0,
> +    VIR_STORAGE_VOL_DISK_TYPE_PRIMARY,
> +    VIR_STORAGE_VOL_DISK_TYPE_LOGICAL,
> +    VIR_STORAGE_VOL_DISK_TYPE_EXTENDED,
> +    VIR_STORAGE_VOL_DISK_TYPE_LAST,
> +};
>  
>  #endif /* __VIR_STORAGE_CONF_H__ */
> --- libvirt-0.6.4.org/src/storage_backend_disk.c	2009-06-23 16:18:48.595802000 +0200
> +++ libvirt-0.6.4/src/storage_backend_disk.c	2009-06-23 16:43:35.653066000 +0200
> @@ -158,6 +158,16 @@ virStorageBackendDiskMakeDataVol(virConn
>      /* virStorageBackendUpdateVolInfo sets format incorrect for partitions */
>      vol->target.format = virStorageBackendDiskMapPartitionType(groups[6]);
>  
> +    /* set partition type */
> +    if(STREQ(groups[1], "normal"))
> +       vol->target.type = VIR_STORAGE_VOL_DISK_TYPE_PRIMARY;
> +    else if(STREQ(groups[1], "logical"))
> +       vol->target.type = VIR_STORAGE_VOL_DISK_TYPE_LOGICAL;
> +    else if(STREQ(groups[1], "extended"))
> +       vol->target.type = VIR_STORAGE_VOL_DISK_TYPE_EXTENDED;
> +    else
> +       vol->target.type = VIR_STORAGE_VOL_DISK_TYPE_NONE;
> +
>      vol->type = VIR_STORAGE_VOL_BLOCK;
>  
>      /* The above gets allocation wrong for

ACK


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list