Re: [Libguestfs] Fwd: virt-v2v creating image that does not install guest agent on first boot

2023-10-06 Thread Ming Xie
Hi Lee,

On Thu, Sep 28, 2023 at 10:55 PM Lee Garrett  wrote:

> (resend, as it bounced on tyan-...@redhat.com)
>
> Hi Ming,
>
> On 27.09.23 14:46, Ming Xie wrote:
> > Hi Richard,
> >
> > Sorry, I missed the email, I found out that the ova OS used by the
> customer is
> > win11 uefi, so I tried to reproduce the error today using win11-uefi
> guest
> >
> > Steps:
> > 1. Convert win10-efi with UTC-8 timezone, win11-non-efi with UTC-8
> timezone,
> > win11-efi with UTC-8 timezone, win11-efi with UTC+8 timezone,
> win2022-efi with
> > UTC-8 timezone from VMware by v2v, then check the installation status
> after
> > finishing conversion
> >
> >
> > Summary the test result as below:
> >
> >  qemu-ga
> >
> >Win10-efi-UTC-8  PASS
> >Win11-non-efi UTC-8   PASS
> >Win11-efi-UTC-8  FAIL(can't find qemu-ga log in c:\)
> >Win11-efi-UTC+8 FAIL(can't find qemu-ga log in c:\)
> >Win2022-efi-UTC-8  PASS
> >
> >Based on the above results, I think this problem is only caused by
> win11-efi
> > and has nothing to do with the time zone "UTC-8"
>
> hmm, where are you exactly setting the timezone? Within the guest, the
> scheduled
> task, or in the libvirt XML description?
>
>
The timezone is UTC-8(US Pacific Time) in third win11-efi and the
clock is UTC after v2v conversion



> The Windows 11 trial VM in question (downloaded from
> https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/
> ->
> https://aka.ms/windev_VM_vmware) comes with the timezone within the VM
> set to
> US/Pacific.
>
> If I also set the RTC clock for the VM in the libvirt XML description
> after
> conversion like this:
>
>  
>  
>  
>  
>
>
> Then qemu-ga successfully gets installed after a 2 minute delay. If I
> leave the
> default libvirt XML description at:
>
> 
>

This method does not work in my win11-efi guest, the timezone in the guest
is UTC-8(US Pacific Time) ) and changed the clock as above
configuration,restarted the guest but qemu-ga still can‘t install
successfully

Regards
Ming Xie
___
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] Some comments on the libnbd apk in Alpine

2023-10-06 Thread Richard W.M. Jones
On Fri, Oct 06, 2023 at 03:54:46PM -0400, Sean McAvoy wrote:
> Hi Richard,
> the package in Alpine (edge) has recently been updated to 1.18.0. The
> mirrors should reflect that soon

Thank you

Rich.

> 
> Thanks,
> 
> Sean
> 
> On Sat, Sep 23, 2023 at 6:11 AM Richard W.M. Jones  wrote:
> >
> > On Sat, Sep 23, 2023 at 11:39:12AM +0200, Sean McAvoy wrote:
> > > Hello Richard,
> > > I have updated the version to 1.16.0 and integrated your suggestions in 
> > > Merge
> > > Request [1].
> > > I have stared the project and will get updates when new releases are made 
> > > and
> > > will update the Alpine package soon after.
> >
> > Great thanks.  Just a note that the stable branch (1.16.4)
> > has a few fixes:
> >
> > https://download.libguestfs.org/libnbd/1.16-stable/
> >
> > Rich.
> >
> > > Thanks for making great software.
> > >
> > > Sean
> > >
> > >
> > > [1] https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/52132
> > >
> > > On Thu, Sep 21, 2023 at 6:02 PM Richard W.M. Jones  
> > > wrote:
> > >
> > > Hi Sean, the maintainers of libnbd here.  Thanks for packaging libnbd
> > > in Alpine:
> > >
> > > https://git.alpinelinux.org/aports/tree/testing/libnbd/APKBUILD
> > >
> > > I have a few comments:
> > >
> > > (1) The url field should be "https://gitlab.com/nbdkit/libnbd;
> > > (The one you are using is an old, stale mirror)
> > >
> > > (2) libxml2-dev is not listed as a dependency.
> > >
> > > We had a request from an Alpine user to add this dependency because it
> > > enables several important features in libnbd, namely NBD URI support
> > > and some utilities which require URI support.
> > >
> > > It shouldn't be too much trouble to add since it appears that libxml2
> > > is already built in Alpine.
> > >
> > > (3) libnbd 1.18 (next stable) will be released in a week or two:
> > > 
> > > https://listman.redhat.com/archives/libguestfs/2023-September/032590.html
> > >
> > > If you have any questions or comments about the package you can send
> > > them to me and/or the mailing list (without subscribing if you don't
> > > want to).
> > >
> > > Rich.
> > >
> > > --
> > > Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/
> > > ~rjones
> > > Read my programming and virtualization blog: http://rwmj.wordpress.com
> > > virt-p2v converts physical machines to virtual machines.  Boot with a
> > > live CD or over the network (PXE) and turn machines into KVM guests.
> > > http://libguestfs.org/virt-v2v
> > >
> > >
> >
> > --
> > Richard Jones, Virtualization Group, Red Hat 
> > http://people.redhat.com/~rjones
> > Read my programming and virtualization blog: http://rwmj.wordpress.com
> > virt-builder quickly builds VMs from scratch
> > http://libguestfs.org/virt-builder.1.html
> >

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org
___
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] Some comments on the libnbd apk in Alpine

2023-10-06 Thread Sean McAvoy
Hi Richard,
the package in Alpine (edge) has recently been updated to 1.18.0. The
mirrors should reflect that soon


Thanks,

Sean

On Sat, Sep 23, 2023 at 6:11 AM Richard W.M. Jones  wrote:
>
> On Sat, Sep 23, 2023 at 11:39:12AM +0200, Sean McAvoy wrote:
> > Hello Richard,
> > I have updated the version to 1.16.0 and integrated your suggestions in 
> > Merge
> > Request [1].
> > I have stared the project and will get updates when new releases are made 
> > and
> > will update the Alpine package soon after.
>
> Great thanks.  Just a note that the stable branch (1.16.4)
> has a few fixes:
>
> https://download.libguestfs.org/libnbd/1.16-stable/
>
> Rich.
>
> > Thanks for making great software.
> >
> > Sean
> >
> >
> > [1] https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/52132
> >
> > On Thu, Sep 21, 2023 at 6:02 PM Richard W.M. Jones  
> > wrote:
> >
> > Hi Sean, the maintainers of libnbd here.  Thanks for packaging libnbd
> > in Alpine:
> >
> > https://git.alpinelinux.org/aports/tree/testing/libnbd/APKBUILD
> >
> > I have a few comments:
> >
> > (1) The url field should be "https://gitlab.com/nbdkit/libnbd;
> > (The one you are using is an old, stale mirror)
> >
> > (2) libxml2-dev is not listed as a dependency.
> >
> > We had a request from an Alpine user to add this dependency because it
> > enables several important features in libnbd, namely NBD URI support
> > and some utilities which require URI support.
> >
> > It shouldn't be too much trouble to add since it appears that libxml2
> > is already built in Alpine.
> >
> > (3) libnbd 1.18 (next stable) will be released in a week or two:
> > 
> > https://listman.redhat.com/archives/libguestfs/2023-September/032590.html
> >
> > If you have any questions or comments about the package you can send
> > them to me and/or the mailing list (without subscribing if you don't
> > want to).
> >
> > Rich.
> >
> > --
> > Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/
> > ~rjones
> > Read my programming and virtualization blog: http://rwmj.wordpress.com
> > virt-p2v converts physical machines to virtual machines.  Boot with a
> > live CD or over the network (PXE) and turn machines into KVM guests.
> > http://libguestfs.org/virt-v2v
> >
> >
>
> --
> Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
> Read my programming and virtualization blog: http://rwmj.wordpress.com
> virt-builder quickly builds VMs from scratch
> http://libguestfs.org/virt-builder.1.html
>

___
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH libnbd 3/5] common: Combine human-size.h headers into one

2023-10-06 Thread Richard W.M. Jones
On Fri, Oct 06, 2023 at 09:18:31AM -0500, Eric Blake wrote:
> On Sun, Sep 03, 2023 at 04:23:23PM +0100, Richard W.M. Jones wrote:
> > Copy the human_size() function from common/utils/ into the new
> > human-size.h header in common/include/.  Remove human-size.c and
> > combine the tests into one.
> > ---
> >  common/include/human-size.h  | 51 ++
> 
> This file was created by inheriting nbdkit's weaker BSD licensing...
> 
> >  common/include/test-human-size.c | 79 +---
> >  common/utils/Makefile.am | 10 +---
> >  common/utils/human-size.c| 56 
> >  common/utils/human-size.h| 49 --
> 
> ...while this file was originally created with libnbd's LGPLv2+
> licensing.  By merging LGPLv2+ code into a file containing only a BSD
> license header, you have created an ambiguity on what license should
> be assumed when using human_size().  Could you explicitly clarify that
> the relaxing of the license was intentional, so that it is safe to
> then merge libnbd's code into nbdkit without dragging in LGPLv2+ code?

Yes, let's use the weaker (BSD) license for this new code.  From the
git history I authored both originally.

> > +static inline char *
> > +human_size (char *buf, uint64_t bytes, bool *human)
> > +{
> > +  static const char ext[][2] = { "E", "P", "T", "G", "M", "K", "" };
> > +  size_t i;
> 
> Code motion, so this is pre-existing, but this seems rather lengthy,
> compared to a more compact:
> 
> static const char ext[] = "EPTGMK";
> 
> > +
> > +  if (buf == NULL) {
> > +buf = malloc (HUMAN_SIZE_LONGEST);
> > +if (buf == NULL)
> > +  return NULL;
> > +  }
> > +
> > +  /* Work out which extension to use, if any. */
> > +  i = 6;
> > +  if (bytes != 0) {
> > +while ((bytes & 1023) == 0) {
> > +  bytes >>= 10;
> > +  i--;
> > +}
> > +  }
> > +
> > +  /* Set the flag to true if we're going to add a human-readable 
> > extension. */
> > +  if (human)
> > +*human = ext[i][0] != '\0';
> 
> *human = ext[i] != '\0';
> 
> > +
> > +  snprintf (buf, HUMAN_SIZE_LONGEST, "%" PRIu64 "%s", bytes, ext[i]);
> 
> snprintf (buf, HUMAN_SIZE_LONGEST, "%" PRIu64 ".1s", bytes, [i]);
> 
> > +  return buf;
> > +}
> > +

Do you want to suggest / push a patch for these bits?

Thanks,

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
___
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs



[Libguestfs] [libnbd PATCH 0/2] Improve nbdinfo display of block constraints

2023-10-06 Thread Eric Blake
Based on Laszlo's approval of my idea here:
https://listman.redhat.com/archives/libguestfs/2023-September/032661.html

but as I would like to resync human-size.h back to nbdkit, I'm
reluctant to apply patch 1 this until I get Rich's consent to
relicensing (this email serves as my consent for my contribution here):
https://listman.redhat.com/archives/libguestfs/2023-October/032755.html

Eric Blake (2):
  utils: Slightly simplify human_size()
  info: Show human sizes for block_size values

 common/include/human-size.h | 14 ++
 info/show.c | 26 +++---
 2 files changed, 25 insertions(+), 15 deletions(-)

-- 
2.41.0

___
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs



[Libguestfs] [libnbd PATCH 1/2] utils: Slightly simplify human_size()

2023-10-06 Thread Eric Blake
Use an array of characters instead of strings for less .data storage.
Merge the loop conditional for fewer lines of code.

Signed-off-by: Eric Blake 
---
 common/include/human-size.h | 14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/common/include/human-size.h b/common/include/human-size.h
index 47729c3c..8b1e0132 100644
--- a/common/include/human-size.h
+++ b/common/include/human-size.h
@@ -159,7 +159,7 @@ human_size_parse (const char *str,
 static inline char *
 human_size (char *buf, uint64_t bytes, bool *human)
 {
-  static const char ext[][2] = { "E", "P", "T", "G", "M", "K", "" };
+  static const char ext[] = "EPTGMK";
   size_t i;

   if (buf == NULL) {
@@ -170,18 +170,16 @@ human_size (char *buf, uint64_t bytes, bool *human)

   /* Work out which extension to use, if any. */
   i = 6;
-  if (bytes != 0) {
-while ((bytes & 1023) == 0) {
-  bytes >>= 10;
-  i--;
-}
+  while (bytes && (bytes & 1023) == 0) {
+bytes >>= 10;
+i--;
   }

   /* Set the flag to true if we're going to add a human-readable extension. */
   if (human)
-*human = ext[i][0] != '\0';
+*human = ext[i] != '\0';

-  snprintf (buf, HUMAN_SIZE_LONGEST, "%" PRIu64 "%s", bytes, ext[i]);
+  snprintf (buf, HUMAN_SIZE_LONGEST, "%" PRIu64 "%.1s", bytes, [i]);
   return buf;
 }

-- 
2.41.0

___
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs



[Libguestfs] [libnbd PATCH 2/2] info: Show human sizes for block_size values

2023-10-06 Thread Eric Blake
Adding a human-readable size for block constraints is useful.  For:

$ ./run nbdinfo -- [ nbdkit memory \
   --filter=blocksize-policy blocksize-preferred=32k 1M ] | grep pref

this changes pre-patch:
block_size_preferred: 32768
to post-patch:
block_size_preferred: 32768 (32K)

Signed-off-by: Eric Blake 
---
 info/show.c | 26 +++---
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/info/show.c b/info/show.c
index 6aeffb54..ac483f34 100644
--- a/info/show.c
+++ b/info/show.c
@@ -35,6 +35,7 @@
 #include "nbdinfo.h"

 static void show_boolean (const char *name, bool cond);
+static void show_size (const char *name, int64_t size);
 static int collect_context (void *opaque, const char *name);
 static char *get_content (struct nbd_handle *, int64_t size);

@@ -181,13 +182,9 @@ show_one_export (struct nbd_handle *nbd, const char *desc,
   show_boolean ("can_trim", can_trim);
 if (can_zero >= 0)
   show_boolean ("can_zero", can_zero);
-if (block_minimum > 0)
-  fprintf (fp, "\t%s: %" PRId64 "\n", "block_size_minimum", block_minimum);
-if (block_preferred > 0)
-  fprintf (fp, "\t%s: %" PRId64 "\n", "block_size_preferred",
-   block_preferred);
-if (block_maximum > 0)
-  fprintf (fp, "\t%s: %" PRId64 "\n", "block_size_maximum", block_maximum);
+show_size ("block_size_minimum", block_minimum);
+show_size ("block_size_preferred", block_preferred);
+show_size ("block_size_maximum", block_maximum);
   }
   else {
 if (first)
@@ -304,6 +301,21 @@ show_boolean (const char *name, bool cond)
   ansi_restore (fp);
 }

+/* Used for displaying sizes in non-JSON output. */
+void show_size (const char *name, int64_t size)
+{
+  char size_str[HUMAN_SIZE_LONGEST];
+  bool human_size_flag = false;
+
+  if (size > 0) {
+human_size (size_str, size, _size_flag);
+if (human_size_flag)
+  fprintf (fp, "\t%s: %" PRId64 " (%s)\n", name, size, size_str);
+else
+  fprintf (fp, "\t%s: %" PRId64 "\n", name, size);
+  }
+}
+
 static int
 collect_context (void *opaque, const char *name)
 {
-- 
2.41.0

___
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs



Re: [Libguestfs] [PATCH libnbd 3/5] common: Combine human-size.h headers into one

2023-10-06 Thread Eric Blake
On Sun, Sep 03, 2023 at 04:23:23PM +0100, Richard W.M. Jones wrote:
> Copy the human_size() function from common/utils/ into the new
> human-size.h header in common/include/.  Remove human-size.c and
> combine the tests into one.
> ---
>  common/include/human-size.h  | 51 ++

This file was created by inheriting nbdkit's weaker BSD licensing...

>  common/include/test-human-size.c | 79 +---
>  common/utils/Makefile.am | 10 +---
>  common/utils/human-size.c| 56 
>  common/utils/human-size.h| 49 --

...while this file was originally created with libnbd's LGPLv2+
licensing.  By merging LGPLv2+ code into a file containing only a BSD
license header, you have created an ambiguity on what license should
be assumed when using human_size().  Could you explicitly clarify that
the relaxing of the license was intentional, so that it is safe to
then merge libnbd's code into nbdkit without dragging in LGPLv2+ code?

> +static inline char *
> +human_size (char *buf, uint64_t bytes, bool *human)
> +{
> +  static const char ext[][2] = { "E", "P", "T", "G", "M", "K", "" };
> +  size_t i;

Code motion, so this is pre-existing, but this seems rather lengthy,
compared to a more compact:

static const char ext[] = "EPTGMK";

> +
> +  if (buf == NULL) {
> +buf = malloc (HUMAN_SIZE_LONGEST);
> +if (buf == NULL)
> +  return NULL;
> +  }
> +
> +  /* Work out which extension to use, if any. */
> +  i = 6;
> +  if (bytes != 0) {
> +while ((bytes & 1023) == 0) {
> +  bytes >>= 10;
> +  i--;
> +}
> +  }
> +
> +  /* Set the flag to true if we're going to add a human-readable extension. 
> */
> +  if (human)
> +*human = ext[i][0] != '\0';

*human = ext[i] != '\0';

> +
> +  snprintf (buf, HUMAN_SIZE_LONGEST, "%" PRIu64 "%s", bytes, ext[i]);

snprintf (buf, HUMAN_SIZE_LONGEST, "%" PRIu64 ".1s", bytes, [i]);

> +  return buf;
> +}
> +

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org
___
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs