[PATCH 09/15] qemuBlockStorageSourceGetFormatRawProps: format 'offset' and 'size' for slice

Peter Krempa posted 15 patches 6 years ago
There is a newer version of this series
[PATCH 09/15] qemuBlockStorageSourceGetFormatRawProps: format 'offset' and 'size' for slice
Posted by Peter Krempa 6 years ago
If we have a 'format' type slice for a raw driver we can directly format
the values.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/qemu/qemu_block.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 63116ef5f2..5fac8c17b4 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -1187,16 +1187,18 @@ qemuBlockStorageSourceGetFormatRawProps(virStorageSourcePtr src,
         secretalias = srcPriv->encinfo->s.aes.alias;
     }

-    /* currently unhandled properties for the 'raw' driver:
-     * 'offset'
-     * 'size'
-     */
-
     if (virJSONValueObjectAdd(props,
                               "s:driver", driver,
                               "S:key-secret", secretalias, NULL) < 0)
         return -1;

+    if (src->sliceFormat &&
+        virJSONValueObjectAdd(props,
+                              "p:offset", src->sliceFormat->offset,
+                              "p:size", src->sliceFormat->size,
+                              NULL) < 0)
+        return -1;
+
     return 0;
 }

-- 
2.24.1

Re: [PATCH 09/15] qemuBlockStorageSourceGetFormatRawProps: format 'offset' and 'size' for slice
Posted by Ján Tomko 6 years ago
On Thu, Feb 06, 2020 at 08:52:01AM +0100, Peter Krempa wrote:
>If we have a 'format' type slice for a raw driver we can directly format
>the values.
>
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/qemu/qemu_block.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
>diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
>index 63116ef5f2..5fac8c17b4 100644
>--- a/src/qemu/qemu_block.c
>+++ b/src/qemu/qemu_block.c
>@@ -1187,16 +1187,18 @@ qemuBlockStorageSourceGetFormatRawProps(virStorageSourcePtr src,
>         secretalias = srcPriv->encinfo->s.aes.alias;
>     }
>
>-    /* currently unhandled properties for the 'raw' driver:
>-     * 'offset'
>-     * 'size'
>-     */
>-
>     if (virJSONValueObjectAdd(props,
>                               "s:driver", driver,
>                               "S:key-secret", secretalias, NULL) < 0)
>         return -1;
>
>+    if (src->sliceFormat &&
>+        virJSONValueObjectAdd(props,
>+                              "p:offset", src->sliceFormat->offset,
>+                              "p:size", src->sliceFormat->size,

'P', these are unsigned long long

>+                              NULL) < 0)
>+        return -1;

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano
Re: [PATCH 09/15] qemuBlockStorageSourceGetFormatRawProps: format 'offset' and 'size' for slice
Posted by Peter Krempa 6 years ago
On Thu, Feb 06, 2020 at 16:39:12 +0100, Ján Tomko wrote:
> On Thu, Feb 06, 2020 at 08:52:01AM +0100, Peter Krempa wrote:
> > If we have a 'format' type slice for a raw driver we can directly format
> > the values.
> > 
> > Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> > ---
> > src/qemu/qemu_block.c | 12 +++++++-----
> > 1 file changed, 7 insertions(+), 5 deletions(-)
> > 
> > diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
> > index 63116ef5f2..5fac8c17b4 100644
> > --- a/src/qemu/qemu_block.c
> > +++ b/src/qemu/qemu_block.c
> > @@ -1187,16 +1187,18 @@ qemuBlockStorageSourceGetFormatRawProps(virStorageSourcePtr src,
> >         secretalias = srcPriv->encinfo->s.aes.alias;
> >     }
> > 
> > -    /* currently unhandled properties for the 'raw' driver:
> > -     * 'offset'
> > -     * 'size'
> > -     */
> > -
> >     if (virJSONValueObjectAdd(props,
> >                               "s:driver", driver,
> >                               "S:key-secret", secretalias, NULL) < 0)
> >         return -1;
> > 
> > +    if (src->sliceFormat &&
> > +        virJSONValueObjectAdd(props,
> > +                              "p:offset", src->sliceFormat->offset,
> > +                              "p:size", src->sliceFormat->size,
> 
> 'P', these are unsigned long long

Oops, I wanted to actually format them always. Thus I should use U.

Re: [PATCH 09/15] qemuBlockStorageSourceGetFormatRawProps: format 'offset' and 'size' for slice
Posted by Ján Tomko 6 years ago
On Thu, Feb 06, 2020 at 04:48:19PM +0100, Peter Krempa wrote:
>On Thu, Feb 06, 2020 at 16:39:12 +0100, Ján Tomko wrote:
>> On Thu, Feb 06, 2020 at 08:52:01AM +0100, Peter Krempa wrote:
>> > If we have a 'format' type slice for a raw driver we can directly format
>> > the values.
>> >
>> > Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>> > ---
>> > src/qemu/qemu_block.c | 12 +++++++-----
>> > 1 file changed, 7 insertions(+), 5 deletions(-)
>> >
>> > diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
>> > index 63116ef5f2..5fac8c17b4 100644
>> > --- a/src/qemu/qemu_block.c
>> > +++ b/src/qemu/qemu_block.c
>> > @@ -1187,16 +1187,18 @@ qemuBlockStorageSourceGetFormatRawProps(virStorageSourcePtr src,
>> >         secretalias = srcPriv->encinfo->s.aes.alias;
>> >     }
>> >
>> > -    /* currently unhandled properties for the 'raw' driver:
>> > -     * 'offset'
>> > -     * 'size'
>> > -     */
>> > -
>> >     if (virJSONValueObjectAdd(props,
>> >                               "s:driver", driver,
>> >                               "S:key-secret", secretalias, NULL) < 0)
>> >         return -1;
>> >
>> > +    if (src->sliceFormat &&
>> > +        virJSONValueObjectAdd(props,
>> > +                              "p:offset", src->sliceFormat->offset,
>> > +                              "p:size", src->sliceFormat->size,
>>
>> 'P', these are unsigned long long
>
>Oops, I wanted to actually format them always. Thus I should use U.
>

Fine-by: Ján Tomko <jtomko@redhat.com>

Jano