[libvirt] [PATCH 0/2] Fix a couple issues found with disk backend

Validation of https://bugzilla.redhat.com/show_bug.cgi?id=1181062 raised a couple of questions about XML format and the defaults - these patches address those questions. John Ferlan (2): docs: Adjust Disk storage rng storage: Force setting of disk format type docs/schemas/storagepool.rng | 2 +- src/storage/storage_backend_disk.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) -- 2.1.0

Currently the grammar uses "none" for a "valid" Disk Storage Pool format type; however, virStoragePoolFormatDisk uses "unknown" so virt-xml-validate will fail to validate when "unknown" is found Signed-off-by: John Ferlan <jferlan@redhat.com> --- docs/schemas/storagepool.rng | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/schemas/storagepool.rng b/docs/schemas/storagepool.rng index db6ff49..ea682a9 100644 --- a/docs/schemas/storagepool.rng +++ b/docs/schemas/storagepool.rng @@ -413,7 +413,7 @@ <element name='format'> <attribute name='type'> <choice> - <value>none</value> + <value>unknown</value> <value>dos</value> <value>dvh</value> <value>gpt</value> -- 2.1.0

On Mon, Jun 08, 2015 at 08:25:21AM -0400, John Ferlan wrote:
Currently the grammar uses "none" for a "valid" Disk Storage Pool format type; however, virStoragePoolFormatDisk uses "unknown" so virt-xml-validate will fail to validate when "unknown" is found
Signed-off-by: John Ferlan <jferlan@redhat.com> --- docs/schemas/storagepool.rng | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/schemas/storagepool.rng b/docs/schemas/storagepool.rng index db6ff49..ea682a9 100644 --- a/docs/schemas/storagepool.rng +++ b/docs/schemas/storagepool.rng @@ -413,7 +413,7 @@ <element name='format'> <attribute name='type'> <choice> - <value>none</value> + <value>unknown</value> <value>dos</value> <value>dvh</value> <value>gpt</value> -- 2.1.0
ACK Pavel
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

Commit id '832a9256' adjusted the code to recognize when the default type of "unknown" was provided as the format type and to use "dos" if found. Since the pool is built with "dos" and it could cause some confusion when formatting the XML after building by seeing "unknown" in the output, let's just adjust the pool's setting to "dos" so that subsequent formats will see the value. Signed-off-by: John Ferlan <jferlan@redhat.com> --- src/storage/storage_backend_disk.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c index c4bd6fe..b016c4f 100644 --- a/src/storage/storage_backend_disk.c +++ b/src/storage/storage_backend_disk.c @@ -472,8 +472,9 @@ virStorageBackendDiskBuildPool(virConnectPtr conn ATTRIBUTE_UNUSED, /* eg parted /dev/sda mklabel --script msdos */ int format = pool->def->source.format; const char *fmt; - if (format == VIR_STORAGE_POOL_DISK_UNKNOWN || - format == VIR_STORAGE_POOL_DISK_DOS) + if (format == VIR_STORAGE_POOL_DISK_UNKNOWN) + format = pool->def->source.format = VIR_STORAGE_POOL_DISK_DOS; + if (format == VIR_STORAGE_POOL_DISK_DOS) fmt = "msdos"; else fmt = virStoragePoolFormatDiskTypeToString(format); -- 2.1.0

On Mon, Jun 08, 2015 at 08:25:22AM -0400, John Ferlan wrote:
Commit id '832a9256' adjusted the code to recognize when the default type of "unknown" was provided as the format type and to use "dos" if found. Since the pool is built with "dos" and it could cause some confusion when formatting the XML after building by seeing "unknown" in the output, let's just adjust the pool's setting to "dos" so that subsequent formats will see the value.
Signed-off-by: John Ferlan <jferlan@redhat.com> --- src/storage/storage_backend_disk.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c index c4bd6fe..b016c4f 100644 --- a/src/storage/storage_backend_disk.c +++ b/src/storage/storage_backend_disk.c @@ -472,8 +472,9 @@ virStorageBackendDiskBuildPool(virConnectPtr conn ATTRIBUTE_UNUSED, /* eg parted /dev/sda mklabel --script msdos */ int format = pool->def->source.format; const char *fmt; - if (format == VIR_STORAGE_POOL_DISK_UNKNOWN || - format == VIR_STORAGE_POOL_DISK_DOS) + if (format == VIR_STORAGE_POOL_DISK_UNKNOWN) + format = pool->def->source.format = VIR_STORAGE_POOL_DISK_DOS; + if (format == VIR_STORAGE_POOL_DISK_DOS) fmt = "msdos"; else fmt = virStoragePoolFormatDiskTypeToString(format); -- 2.1.0
ACK Pavel
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On 06/08/2015 08:25 AM, John Ferlan wrote:
Validation of https://bugzilla.redhat.com/show_bug.cgi?id=1181062 raised a couple of questions about XML format and the defaults - these patches address those questions.
John Ferlan (2): docs: Adjust Disk storage rng storage: Force setting of disk format type
docs/schemas/storagepool.rng | 2 +- src/storage/storage_backend_disk.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-)
ping Thanks - John

On 06/08/2015 08:25 AM, John Ferlan wrote:
Validation of https://bugzilla.redhat.com/show_bug.cgi?id=1181062 raised a couple of questions about XML format and the defaults - these patches address those questions.
John Ferlan (2): docs: Adjust Disk storage rng storage: Force setting of disk format type
docs/schemas/storagepool.rng | 2 +- src/storage/storage_backend_disk.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-)
ping^2 Tks John

On 06/08/2015 08:25 AM, John Ferlan wrote:
Validation of https://bugzilla.redhat.com/show_bug.cgi?id=1181062 raised a couple of questions about XML format and the defaults - these patches address those questions.
John Ferlan (2): docs: Adjust Disk storage rng storage: Force setting of disk format type
docs/schemas/storagepool.rng | 2 +- src/storage/storage_backend_disk.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-)
Now pushed - thanks for the review John
participants (2)
-
John Ferlan
-
Pavel Hrdina