Re: [PATCH] qemu: Replace deprecated short-form boolean options

2021-02-03 Thread Paolo Bonzini

On 03/02/21 09:40, Han Han wrote:



Hi Paolo,
I find there is no warning for the nolazy_refcounts option(qemu 
v5.2.0-1530-g74208cd252):

$ qemu-img create /tmp/b.qcow2 -f qcow2 10M -o nolazy_refcounts
Formatting '/tmp/b.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off 
compression_type=zlib size=10485760 lazy_refcounts=off refcount_bits=16


Could you please help to check if this short-form boolean option is 
missing in the commit "ccd3b3b811    qemu-option: warn for short-form 
boolean options"




This is indeed a slightly different path that doesn't warn yet, but I 
suggest changing it anyway.  It will work with all versions of QEMU.


Paolo



Re: [PATCH] qemu: Replace deprecated short-form boolean options

2021-02-03 Thread Han Han
On Tue, Jan 26, 2021 at 6:07 PM Paolo Bonzini  wrote:

> On 26/01/21 04:55, Han Han wrote:
> > Since the commit ccd3b3b811 of QEMU, the short-form boolean options in
> > qemu cmdline like "server", "nowait", "disable-ticketing" are
> > deprecated
>
> There are a few more:
>
> 1) -vnc password, -vnc tls, -vnc sasl:
>
>  if (graphics->data.vnc.auth.passwd || cfg->vncPassword)
>  virBufferAddLit(&opt, ",password");
>
>  if (cfg->vncTLS) {
>  qemuDomainGraphicsPrivatePtr gfxPriv =
> QEMU_DOMAIN_GRAPHICS_PRIVATE(graphics);
>  if (gfxPriv->tlsAlias) {
> ...
>  } else {
>  virBufferAddLit(&opt, ",tls");
>  ...
>  }
>  }
>
>  if (cfg->vncSASL) {
>  virBufferAddLit(&opt, ",sasl");
>
>  if (cfg->vncSASLdir)
>  virCommandAddEnvPair(cmd, "SASL_CONF_PATH", cfg->vncSASLdir);
>
>  /* TODO: Support ACLs later */
>  }
>
> "-vnc tls" is only used for old QEMU, but I think it's cleaner to change
> it as well.
>
> 2) -chardev telnet
>
>  virBufferAsprintf(&buf,
>"socket,id=%s,host=%s,port=%s%s",
>charAlias,
>dev->data.tcp.host,
>dev->data.tcp.service,
>telnet ? ",telnet" : "");
>
> 3) -fsdev readonly:
>
>  if (fs->readonly)
>  virBufferAddLit(&opt, ",readonly");
>
> 4) -spice sasl:
>
>  if (cfg->spiceSASL) {
>  virBufferAddLit(&opt, "sasl,");
>
>  if (cfg->spiceSASLdir)
>  virCommandAddEnvPair(cmd, "SASL_CONF_PATH",
>   cfg->spiceSASLdir);
>
>  /* TODO: Support ACLs later */
>  }
>
> 5) qemu-img create:
>
>  if (info->features && info->format == VIR_STORAGE_FILE_QCOW2) {
>  if (virBitmapIsBitSet(info->features,
>VIR_STORAGE_FILE_FEATURE_LAZY_REFCOUNTS)) {
>  if (STREQ_NULLABLE(info->compat, "0.10")) {
>  virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> _("lazy_refcounts not supported with
> compat"
>   " level %s"),
> info->compat);
>  return -1;
>  }
>  virBufferAddLit(&buf, "lazy_refcounts,");
>  }
>  }
>
> Hi Paolo,
I find there is no warning for the nolazy_refcounts option(qemu
v5.2.0-1530-g74208cd252):
$ qemu-img create /tmp/b.qcow2 -f qcow2 10M -o nolazy_refcounts
Formatting '/tmp/b.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off
compression_type=zlib size=10485760 lazy_refcounts=off refcount_bits=16

Could you please help to check if this short-form boolean option is missing
in the commit "ccd3b3b811qemu-option: warn for short-form boolean
options"

thanks

> > diff --git a/src/libxl/xen_common.c b/src/libxl/xen_common.c
> > index 2d1f5ea5f5..97954bcc37 100644
> > --- a/src/libxl/xen_common.c
> > +++ b/src/libxl/xen_common.c
> > @@ -872,7 +872,7 @@ xenParseSxprChar(const char *value,
> >  else
> >  def->source->data.tcp.service = g_strdup(offset);
> >
> > -if (offset2 && strstr(offset2, ",server"))
> > +if (offset2 && strstr(offset2, ",server=on"))
> >  def->source->data.tcp.listen = true;
> >  }
> >  break;
> > @@ -924,7 +924,7 @@ xenParseSxprChar(const char *value,
> >  def->source->data.nix.path = g_strdup(value);
> >
> >  if (offset != NULL &&
> > -strstr(offset, ",server") != NULL)
> > +strstr(offset, ",server=on") != NULL)
> >  def->source->data.nix.listen = true;
> >  }
> >  break;
>
> As far as I understand it, it is valid to start a domain with "xl" and
> inspect it with "virsh dumpxml".  So I wouldn't change this, as it
> depends on whatever xl has placed in the value you are parsing.
>
> Thanks,
>
> Paolo
>
>


Re: [PATCH] qemu: Replace deprecated short-form boolean options

2021-01-29 Thread Han Han
On Tue, Jan 26, 2021 at 6:04 PM Peter Krempa  wrote:

> On Tue, Jan 26, 2021 at 11:55:25 +0800, Han Han wrote:
> > Since the commit ccd3b3b811 of QEMU, the short-form boolean options in
> > qemu cmdline like "server", "nowait", "disable-ticketing" are deprecated:
> >
> > qemu-system-x86_64: -chardev socket,id=charmonitor,fd=38,server,nowait:
> warning: short-form boolean option 'server' deprecated
> > Please use server=on instead
> > qemu-system-x86_64: -chardev socket,id=charmonitor,fd=38,server,nowait:
> warning: short-form boolean option 'nowait' deprecated
> > Please use wait=off instead
> > qemu-system-x86_64: -spice
> port=5900,addr=127.0.0.1,disable-ticketing,plaintext-channel=main,plaintext-channel=inputs,image-compression=auto_glz,jpeg-wan-compression=auto,zlib-glz-wan-compression=auto,playback-compression=on,streaming-video=filter,disable-copy-paste,disable-agent-file-xfer,seamless-migration=on:
> warning: short-form boolean option 'disable-ticketing' deprecated
> > Please use disable-ticketing=on instead
> >
> > Use normal form boolean options with value "on" or "off".
> >
> > Signed-off-by: Han Han 
> > ---
>
> [...]
>
> >  mode change 12 => 100644
> tests/qemuxml2argvdata/aarch64-gic-default-both.args
> >  mode change 12 => 100644
> tests/qemuxml2argvdata/aarch64-gic-default-v2.args
> >  mode change 12 => 100644
> tests/qemuxml2argvdata/aarch64-gic-default-v3.args
> >  mode change 12 => 100644
> tests/qemuxml2argvdata/aarch64-gic-default.args
> >  mode change 12 => 100644
> tests/qemuxml2argvdata/aarch64-gic-none-both.args
> >  mode change 12 => 100644
> tests/qemuxml2argvdata/aarch64-gic-none-v2.args
> >  mode change 12 => 100644
> tests/qemuxml2argvdata/aarch64-gic-none-v3.args
> >  mode change 12 => 100644
> tests/qemuxml2argvdata/aarch64-gic-none.args
> >  mode change 12 => 100644 tests/qemuxml2argvdata/cpu-check-full.args
> >  mode change 12 => 100644
> tests/qemuxml2argvdata/cpu-check-partial.args
> >  mode change 12 => 100644
> tests/qemuxml2argvdata/disk-backing-chains-index.x86_64-2.12.0.args
> >  mode change 12 => 100644
> tests/qemuxml2argvdata/disk-backing-chains-index.x86_64-latest.args
> >  mode change 12 => 100644
> tests/qemuxml2argvdata/mach-virt-console-native.args
> >  mode change 12 => 100644
> tests/qemuxml2argvdata/mach-virt-serial+console-native.args
> >  mode change 12 => 100644
> tests/qemuxml2argvdata/mach-virt-serial-compat.args
> >  mode change 12 => 100644
> tests/qemuxml2argvdata/pci-rom-disabled-invalid.args
> >  mode change 12 => 100644
> tests/qemuxml2argvdata/pseries-console-native.args
> >  mode change 12 => 100644
> tests/qemuxml2argvdata/pseries-serial+console-native.args
> >  mode change 12 => 100644
> tests/qemuxml2argvdata/pseries-serial-compat.args
> >  mode change 12 => 100644 tests/qemuxml2argvdata/user-aliases2.args
>
> These files are expanded from a symlink to a full file. Did you use a
> script/sed to do the changes? Preferably unless necessary don't expand
>
yes

> those and use VIR_TEST_REGENERATE_OUTPUT=1  to generate them, that
> doesn't expand symlinks.
>
> Thank you. I'll fix that in the next version


Re: [PATCH] qemu: Replace deprecated short-form boolean options

2021-01-26 Thread Han Han
On Tue, Jan 26, 2021 at 6:07 PM Paolo Bonzini  wrote:

> On 26/01/21 04:55, Han Han wrote:
> > Since the commit ccd3b3b811 of QEMU, the short-form boolean options in
> > qemu cmdline like "server", "nowait", "disable-ticketing" are
> > deprecated
>
> There are a few more:
>
> Thank you for mentioning the missing parameters :)

> 1) -vnc password, -vnc tls, -vnc sasl:
>
>  if (graphics->data.vnc.auth.passwd || cfg->vncPassword)
>  virBufferAddLit(&opt, ",password");
>
>  if (cfg->vncTLS) {
>  qemuDomainGraphicsPrivatePtr gfxPriv =
> QEMU_DOMAIN_GRAPHICS_PRIVATE(graphics);
>  if (gfxPriv->tlsAlias) {
> ...
>  } else {
>  virBufferAddLit(&opt, ",tls");
>  ...
>  }
>  }
>
>  if (cfg->vncSASL) {
>  virBufferAddLit(&opt, ",sasl");
>
>  if (cfg->vncSASLdir)
>  virCommandAddEnvPair(cmd, "SASL_CONF_PATH", cfg->vncSASLdir);
>
>  /* TODO: Support ACLs later */
>  }
>
> "-vnc tls" is only used for old QEMU, but I think it's cleaner to change
> it as well.
>
> 2) -chardev telnet
>
>  virBufferAsprintf(&buf,
>"socket,id=%s,host=%s,port=%s%s",
>charAlias,
>dev->data.tcp.host,
>dev->data.tcp.service,
>telnet ? ",telnet" : "");
>
> 3) -fsdev readonly:
>
>  if (fs->readonly)
>  virBufferAddLit(&opt, ",readonly");
>
> 4) -spice sasl:
>
>  if (cfg->spiceSASL) {
>  virBufferAddLit(&opt, "sasl,");
>
>  if (cfg->spiceSASLdir)
>  virCommandAddEnvPair(cmd, "SASL_CONF_PATH",
>   cfg->spiceSASLdir);
>
>  /* TODO: Support ACLs later */
>  }
>
> 5) qemu-img create:
>
>  if (info->features && info->format == VIR_STORAGE_FILE_QCOW2) {
>  if (virBitmapIsBitSet(info->features,
>VIR_STORAGE_FILE_FEATURE_LAZY_REFCOUNTS)) {
>  if (STREQ_NULLABLE(info->compat, "0.10")) {
>  virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> _("lazy_refcounts not supported with
> compat"
>   " level %s"),
> info->compat);
>  return -1;
>  }
>  virBufferAddLit(&buf, "lazy_refcounts,");
>  }
>  }
>
> > diff --git a/src/libxl/xen_common.c b/src/libxl/xen_common.c
> > index 2d1f5ea5f5..97954bcc37 100644
> > --- a/src/libxl/xen_common.c
> > +++ b/src/libxl/xen_common.c
> > @@ -872,7 +872,7 @@ xenParseSxprChar(const char *value,
> >  else
> >  def->source->data.tcp.service = g_strdup(offset);
> >
> > -if (offset2 && strstr(offset2, ",server"))
> > +if (offset2 && strstr(offset2, ",server=on"))
> >  def->source->data.tcp.listen = true;
> >  }
> >  break;
> > @@ -924,7 +924,7 @@ xenParseSxprChar(const char *value,
> >  def->source->data.nix.path = g_strdup(value);
> >
> >  if (offset != NULL &&
> > -strstr(offset, ",server") != NULL)
> > +strstr(offset, ",server=on") != NULL)
> >  def->source->data.nix.listen = true;
> >  }
> >  break;
>
> As far as I understand it, it is valid to start a domain with "xl" and
> inspect it with "virsh dumpxml".  So I wouldn't change this, as it
> depends on whatever xl has placed in the value you are parsing.
>
> Thanks,
>
> Paolo
>
>


Re: [PATCH] qemu: Replace deprecated short-form boolean options

2021-01-26 Thread Ján Tomko

On a Tuesday in 2021, Han Han wrote:

Since the commit ccd3b3b811 of QEMU, the short-form boolean options in
qemu cmdline like "server", "nowait", "disable-ticketing" are deprecated:



Please separate the changes for chardevs (server and nowait
usually occur on the same line in the tests anyway) from the spice
changes.

Jano


qemu-system-x86_64: -chardev socket,id=charmonitor,fd=38,server,nowait: 
warning: short-form boolean option 'server' deprecated
Please use server=on instead
qemu-system-x86_64: -chardev socket,id=charmonitor,fd=38,server,nowait: 
warning: short-form boolean option 'nowait' deprecated
Please use wait=off instead
qemu-system-x86_64: -spice 
port=5900,addr=127.0.0.1,disable-ticketing,plaintext-channel=main,plaintext-channel=inputs,image-compression=auto_glz,jpeg-wan-compression=auto,zlib-glz-wan-compression=auto,playback-compression=on,streaming-video=filter,disable-copy-paste,disable-agent-file-xfer,seamless-migration=on:
 warning: short-form boolean option 'disable-ticketing' deprecated
Please use disable-ticketing=on instead

Use normal form boolean options with value "on" or "off".



signature.asc
Description: PGP signature


Re: [PATCH] qemu: Replace deprecated short-form boolean options

2021-01-26 Thread Paolo Bonzini

On 26/01/21 04:55, Han Han wrote:
Since the commit ccd3b3b811 of QEMU, the short-form boolean options in 
qemu cmdline like "server", "nowait", "disable-ticketing" are 
deprecated


There are a few more:

1) -vnc password, -vnc tls, -vnc sasl:

if (graphics->data.vnc.auth.passwd || cfg->vncPassword)
virBufferAddLit(&opt, ",password");

if (cfg->vncTLS) {
qemuDomainGraphicsPrivatePtr gfxPriv = 
QEMU_DOMAIN_GRAPHICS_PRIVATE(graphics);

if (gfxPriv->tlsAlias) {
...
} else {
virBufferAddLit(&opt, ",tls");
...
}
}

if (cfg->vncSASL) {
virBufferAddLit(&opt, ",sasl");

if (cfg->vncSASLdir)
virCommandAddEnvPair(cmd, "SASL_CONF_PATH", cfg->vncSASLdir);

/* TODO: Support ACLs later */
}

"-vnc tls" is only used for old QEMU, but I think it's cleaner to change 
it as well.


2) -chardev telnet

virBufferAsprintf(&buf,
  "socket,id=%s,host=%s,port=%s%s",
  charAlias,
  dev->data.tcp.host,
  dev->data.tcp.service,
  telnet ? ",telnet" : "");

3) -fsdev readonly:

if (fs->readonly)
virBufferAddLit(&opt, ",readonly");

4) -spice sasl:

if (cfg->spiceSASL) {
virBufferAddLit(&opt, "sasl,");

if (cfg->spiceSASLdir)
virCommandAddEnvPair(cmd, "SASL_CONF_PATH",
 cfg->spiceSASLdir);

/* TODO: Support ACLs later */
}

5) qemu-img create:

if (info->features && info->format == VIR_STORAGE_FILE_QCOW2) {
if (virBitmapIsBitSet(info->features,
  VIR_STORAGE_FILE_FEATURE_LAZY_REFCOUNTS)) {
if (STREQ_NULLABLE(info->compat, "0.10")) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
   _("lazy_refcounts not supported with compat"
 " level %s"),
   info->compat);
return -1;
}
virBufferAddLit(&buf, "lazy_refcounts,");
}
}


diff --git a/src/libxl/xen_common.c b/src/libxl/xen_common.c
index 2d1f5ea5f5..97954bcc37 100644
--- a/src/libxl/xen_common.c
+++ b/src/libxl/xen_common.c
@@ -872,7 +872,7 @@ xenParseSxprChar(const char *value,
 else
 def->source->data.tcp.service = g_strdup(offset);
 
-if (offset2 && strstr(offset2, ",server"))

+if (offset2 && strstr(offset2, ",server=on"))
 def->source->data.tcp.listen = true;
 }
 break;
@@ -924,7 +924,7 @@ xenParseSxprChar(const char *value,
 def->source->data.nix.path = g_strdup(value);
 
 if (offset != NULL &&

-strstr(offset, ",server") != NULL)
+strstr(offset, ",server=on") != NULL)
 def->source->data.nix.listen = true;
 }
 break;


As far as I understand it, it is valid to start a domain with "xl" and 
inspect it with "virsh dumpxml".  So I wouldn't change this, as it 
depends on whatever xl has placed in the value you are parsing.


Thanks,

Paolo



Re: [PATCH] qemu: Replace deprecated short-form boolean options

2021-01-26 Thread Peter Krempa
On Tue, Jan 26, 2021 at 11:55:25 +0800, Han Han wrote:
> Since the commit ccd3b3b811 of QEMU, the short-form boolean options in
> qemu cmdline like "server", "nowait", "disable-ticketing" are deprecated:
> 
> qemu-system-x86_64: -chardev socket,id=charmonitor,fd=38,server,nowait: 
> warning: short-form boolean option 'server' deprecated
> Please use server=on instead
> qemu-system-x86_64: -chardev socket,id=charmonitor,fd=38,server,nowait: 
> warning: short-form boolean option 'nowait' deprecated
> Please use wait=off instead
> qemu-system-x86_64: -spice 
> port=5900,addr=127.0.0.1,disable-ticketing,plaintext-channel=main,plaintext-channel=inputs,image-compression=auto_glz,jpeg-wan-compression=auto,zlib-glz-wan-compression=auto,playback-compression=on,streaming-video=filter,disable-copy-paste,disable-agent-file-xfer,seamless-migration=on:
>  warning: short-form boolean option 'disable-ticketing' deprecated
> Please use disable-ticketing=on instead
> 
> Use normal form boolean options with value "on" or "off".
> 
> Signed-off-by: Han Han 
> ---

[...]

>  mode change 12 => 100644 
> tests/qemuxml2argvdata/aarch64-gic-default-both.args
>  mode change 12 => 100644 
> tests/qemuxml2argvdata/aarch64-gic-default-v2.args
>  mode change 12 => 100644 
> tests/qemuxml2argvdata/aarch64-gic-default-v3.args
>  mode change 12 => 100644 tests/qemuxml2argvdata/aarch64-gic-default.args
>  mode change 12 => 100644 
> tests/qemuxml2argvdata/aarch64-gic-none-both.args
>  mode change 12 => 100644 tests/qemuxml2argvdata/aarch64-gic-none-v2.args
>  mode change 12 => 100644 tests/qemuxml2argvdata/aarch64-gic-none-v3.args
>  mode change 12 => 100644 tests/qemuxml2argvdata/aarch64-gic-none.args
>  mode change 12 => 100644 tests/qemuxml2argvdata/cpu-check-full.args
>  mode change 12 => 100644 tests/qemuxml2argvdata/cpu-check-partial.args
>  mode change 12 => 100644 
> tests/qemuxml2argvdata/disk-backing-chains-index.x86_64-2.12.0.args
>  mode change 12 => 100644 
> tests/qemuxml2argvdata/disk-backing-chains-index.x86_64-latest.args
>  mode change 12 => 100644 
> tests/qemuxml2argvdata/mach-virt-console-native.args
>  mode change 12 => 100644 
> tests/qemuxml2argvdata/mach-virt-serial+console-native.args
>  mode change 12 => 100644 
> tests/qemuxml2argvdata/mach-virt-serial-compat.args
>  mode change 12 => 100644 
> tests/qemuxml2argvdata/pci-rom-disabled-invalid.args
>  mode change 12 => 100644 
> tests/qemuxml2argvdata/pseries-console-native.args
>  mode change 12 => 100644 
> tests/qemuxml2argvdata/pseries-serial+console-native.args
>  mode change 12 => 100644 
> tests/qemuxml2argvdata/pseries-serial-compat.args
>  mode change 12 => 100644 tests/qemuxml2argvdata/user-aliases2.args

These files are expanded from a symlink to a full file. Did you use a
script/sed to do the changes? Preferably unless necessary don't expand
those and use VIR_TEST_REGENERATE_OUTPUT=1  to generate them, that
doesn't expand symlinks.