From: Han Han <hanhanzhiyeqianke@gmail.com>
For qemu object like rng-builtin, there are no properties after id
property. We should always set comma after object id. Otherwise it will
cause trailing comma on object:
-object rng-builtin,id=ID,
Signed-off-by: Han Han <hhan@redhat.com>
---
src/util/virqemu.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/util/virqemu.c b/src/util/virqemu.c
index f3a233af..72151e43 100644
--- a/src/util/virqemu.c
+++ b/src/util/virqemu.c
@@ -239,12 +239,13 @@ virQEMUBuildObjectCommandlineFromJSONInternal(virBufferPtr buf,
return -1;
}
- virBufferAsprintf(buf, "%s,id=%s,", type, alias);
-
- if (props &&
- virQEMUBuildCommandLineJSON(props, buf,
- virQEMUBuildCommandLineJSONArrayBitmap) < 0)
- return -1;
+ virBufferAsprintf(buf, "%s,id=%s", type, alias);
+ if (props) {
+ virBufferAsprintf(buf, ",");
+ if (virQEMUBuildCommandLineJSON(props, buf,
+ virQEMUBuildCommandLineJSONArrayBitmap) < 0)
+ return -1;
+ }
return 0;
}
--
2.23.0
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Wed, Jan 01, 2020 at 13:06:32 +0800, Han Han wrote:
> From: Han Han <hanhanzhiyeqianke@gmail.com>
>
> For qemu object like rng-builtin, there are no properties after id
> property. We should always set comma after object id. Otherwise it will
> cause trailing comma on object:
> -object rng-builtin,id=ID,
>
> Signed-off-by: Han Han <hhan@redhat.com>
> ---
> src/util/virqemu.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/src/util/virqemu.c b/src/util/virqemu.c
> index f3a233af..72151e43 100644
> --- a/src/util/virqemu.c
> +++ b/src/util/virqemu.c
> @@ -239,12 +239,13 @@ virQEMUBuildObjectCommandlineFromJSONInternal(virBufferPtr buf,
> return -1;
> }
>
> - virBufferAsprintf(buf, "%s,id=%s,", type, alias);
> -
> - if (props &&
> - virQEMUBuildCommandLineJSON(props, buf,
> - virQEMUBuildCommandLineJSONArrayBitmap) < 0)
> - return -1;
> + virBufferAsprintf(buf, "%s,id=%s", type, alias);
Keep the newline here.
> + if (props) {
> + virBufferAsprintf(buf, ",");
Use vir BufferAddLit instead.
> + if (virQEMUBuildCommandLineJSON(props, buf,
> + virQEMUBuildCommandLineJSONArrayBitmap) < 0)
> + return -1;
> + }
>
> return 0;
> }
> --
> 2.23.0
>
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Mon, Jan 6, 2020 at 5:58 PM Peter Krempa <pkrempa@redhat.com> wrote:
> On Wed, Jan 01, 2020 at 13:06:32 +0800, Han Han wrote:
> > From: Han Han <hanhanzhiyeqianke@gmail.com>
> >
> > For qemu object like rng-builtin, there are no properties after id
> > property. We should always set comma after object id. Otherwise it will
> > cause trailing comma on object:
> > -object rng-builtin,id=ID,
> >
> > Signed-off-by: Han Han <hhan@redhat.com>
> > ---
> > src/util/virqemu.c | 13 +++++++------
> > 1 file changed, 7 insertions(+), 6 deletions(-)
> >
> > diff --git a/src/util/virqemu.c b/src/util/virqemu.c
> > index f3a233af..72151e43 100644
> > --- a/src/util/virqemu.c
> > +++ b/src/util/virqemu.c
> > @@ -239,12 +239,13 @@
> virQEMUBuildObjectCommandlineFromJSONInternal(virBufferPtr buf,
> > return -1;
> > }
> >
> > - virBufferAsprintf(buf, "%s,id=%s,", type, alias);
> > -
> > - if (props &&
> > - virQEMUBuildCommandLineJSON(props, buf,
> > -
> virQEMUBuildCommandLineJSONArrayBitmap) < 0)
> > - return -1;
> > + virBufferAsprintf(buf, "%s,id=%s", type, alias);
>
> Keep the newline here.
>
> > + if (props) {
> > + virBufferAsprintf(buf, ",");
>
> Use vir BufferAddLit instead.
>
virBufferAsprintf is for format strings and virBufferAddLit is for const
strings, right?
>
> > + if (virQEMUBuildCommandLineJSON(props, buf,
> > + virQEMUBuildCommandLineJSONArrayBitmap)
> < 0)
> > + return -1;
> > + }
> >
> > return 0;
> > }
> > --
> > 2.23.0
> >
> > --
> > libvir-list mailing list
> > libvir-list@redhat.com
> > https://www.redhat.com/mailman/listinfo/libvir-list
>
>
--
Best regards,
-----------------------------------
Han Han
Quality Engineer
Redhat.
Email: hhan@redhat.com
Phone: +861065339333
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2026 Red Hat, Inc.