[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]