Displaying 20 results from an estimated 23 matches for "guestfs_disk_format".
2018 Mar 21
2
[PATCH] tests: regressions: make test-big-heap use a temporary empty file
...file for qemu-img. */
+ tmpfilefd = mkstemp (tmpfile);
+ if (tmpfilefd == -1) {
+ fprintf (stderr, "%s: mkstemp failed: %m\n", argv[0]);
+ exit (EXIT_FAILURE);
+ }
+ close (tmpfilefd);
+
g = guestfs_create ();
/* Do something which forks qemu-img subprocess. */
- fmt = guestfs_disk_format (g, "/dev/null");
+ fmt = guestfs_disk_format (g, tmpfile);
+ unlink (tmpfile);
if (fmt == NULL) {
/* Test failed. */
fprintf (stderr, "%s: unexpected failure of test, see earlier messages\n",
--
2.14.3
2018 Oct 04
2
Re: [PATCH v2] lib: Use qemu-img info -U option to avoid locking error.
...s is a reasonable proxy for presence of the qemu-img -U option
since both features were added within a few months.
However the problem is that testing for this requires us to run qemu
before launch is called. That has API issues because it's unclear
what code like:
g = guestfs_create ();
guestfs_disk_format (g, "disk.img");
guestfs_set_hv (g, "my-weird-qemu");
guestfs_launch (g);
should do (granted, it is a peculiar corner case and the caller
probably gets what they deserve).
> One possible idea can be to cache the qemu_data struct in the handle,
> so the direct backend...
2018 Oct 04
1
Re: [PATCH v2] lib: Use qemu-img info -U option to avoid locking error.
...oth features were added within a few months.
> >
> > However the problem is that testing for this requires us to run qemu
> > before launch is called. That has API issues because it's unclear
> > what code like:
> >
> > g = guestfs_create ();
> > guestfs_disk_format (g, "disk.img");
> > guestfs_set_hv (g, "my-weird-qemu");
> > guestfs_launch (g);
> >
> > should do (granted, it is a peculiar corner case and the caller
> > probably gets what they deserve).
> >
> > > One possible idea can be t...
2020 Mar 09
3
Re: [PATCH] lib: Autodetect backing format and specify it explicitly.
...(guestfs_h *g, const char *filename, int64_t size,
> > }
> > }
> >
> > + /* With libvirt >= 6.0 the backing format must be specified. */
> > + if (backingfile != NULL && backingformat == NULL) {
> > + backingformat = backingformat_free = guestfs_disk_format (g, backingfile);
> > + if (!backingformat)
> > + return -1;
> > + if (STREQ (backingformat, "unknown")) {
> > + error (g, _("could not auto-detect the format of the backing file %s"),
> > + backingfile);
> > +...
2018 Mar 21
0
Re: [PATCH] tests: regressions: make test-big-heap use a temporary empty file
...file);
> + if (tmpfilefd == -1) {
> + fprintf (stderr, "%s: mkstemp failed: %m\n", argv[0]);
> + exit (EXIT_FAILURE);
> + }
> + close (tmpfilefd);
> +
> g = guestfs_create ();
>
> /* Do something which forks qemu-img subprocess. */
> - fmt = guestfs_disk_format (g, "/dev/null");
> + fmt = guestfs_disk_format (g, tmpfile);
> + unlink (tmpfile);
> if (fmt == NULL) {
> /* Test failed. */
> fprintf (stderr, "%s: unexpected failure of test, see earlier messages\n",
> --
> 2.14.3
>
> ______________...
2020 Feb 06
3
[PATCH] lib: Autodetect backing format and specify it explicitly.
...nt clustersize = -1;
@@ -302,6 +303,18 @@ disk_create_qcow2 (guestfs_h *g, const char *filename, int64_t size,
}
}
+ /* With libvirt >= 6.0 the backing format must be specified. */
+ if (backingfile != NULL && backingformat == NULL) {
+ backingformat = backingformat_free = guestfs_disk_format (g, backingfile);
+ if (!backingformat)
+ return -1;
+ if (STREQ (backingformat, "unknown")) {
+ error (g, _("could not auto-detect the format of the backing file %s"),
+ backingfile);
+ return -1;
+ }
+ }
+
/* Assemble the qemu-img comman...
2018 Oct 04
0
Re: [PATCH v2] lib: Use qemu-img info -U option to avoid locking error.
...the qemu-img -U option
> since both features were added within a few months.
>
> However the problem is that testing for this requires us to run qemu
> before launch is called. That has API issues because it's unclear
> what code like:
>
> g = guestfs_create ();
> guestfs_disk_format (g, "disk.img");
> guestfs_set_hv (g, "my-weird-qemu");
> guestfs_launch (g);
>
> should do (granted, it is a peculiar corner case and the caller
> probably gets what they deserve).
>
> > One possible idea can be to cache the qemu_data struct in the...
2016 Aug 02
0
[PATCH] launch: libvirt: Autodetect backing format for drive overlays (RHBZ#1354335).
...+ * Caller must free the returned string.
+ */
+static char *
+get_source_format_or_autodetect (guestfs_h *g, struct drive *drv)
+{
+ if (drv->src.format)
+ return safe_strdup (g, drv->src.format);
+
+ if (drv->src.protocol == drive_protocol_file) {
+ char *format;
+
+ format = guestfs_disk_format (g, drv->src.u.path);
+ if (!format)
+ return NULL;
+
+ if (STREQ (format, "unknown")) {
+ error (g, _("could not auto-detect the format.\n"
+ "If the format is known, pass the format to libguestfs, eg. using the\n"
+...
2020 Feb 06
1
Re: [PATCH v2] launch: add support for autodetection of appliance image format
...nt change in libvirt it is no longer
possible to have a backing file where libvirt will autodetect the
format. See:
https://bugzilla.redhat.com/show_bug.cgi?id=1798148#c3
Therefore the only way to actually do this now would be either for
libguestfs to detect the format (there is an API for this:
guestfs_disk_format), or else to hard code the format in the
./configure option.
In any case I will need to revert this until we can think of something
else (if you still need the feature) because it will simply break with
libvirt >= 6.0.
Rich.
> Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
&...
2020 Mar 09
2
Re: [PATCH] lib: Autodetect backing format and specify it explicitly.
...> > }
> > > > }
> > > >
> > > > + /* With libvirt >= 6.0 the backing format must be specified. */
> > > > + if (backingfile != NULL && backingformat == NULL) {
> > > > + backingformat = backingformat_free = guestfs_disk_format (g, backingfile);
> > > > + if (!backingformat)
> > > > + return -1;
> > > > + if (STREQ (backingformat, "unknown")) {
> > > > + error (g, _("could not auto-detect the format of the backing file %s"),
> > >...
2018 Apr 30
0
[PATCH 2/4] launch: libvirt: free format string
When the result guestfs_disk_format() is not known, free the string
before returning an error.
---
lib/launch-libvirt.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c
index e4961f201..844023b80 100644
--- a/lib/launch-libvirt.c
+++ b/lib/launch-libvirt.c
@@ -197,6 +197,7 @@ get_source...
2020 Mar 09
0
Re: [PATCH] lib: Autodetect backing format and specify it explicitly.
...+303,18 @@ disk_create_qcow2 (guestfs_h *g, const char *filename, int64_t size,
> }
> }
>
> + /* With libvirt >= 6.0 the backing format must be specified. */
> + if (backingfile != NULL && backingformat == NULL) {
> + backingformat = backingformat_free = guestfs_disk_format (g, backingfile);
> + if (!backingformat)
> + return -1;
> + if (STREQ (backingformat, "unknown")) {
> + error (g, _("could not auto-detect the format of the backing file %s"),
> + backingfile);
> + return -1;
> + }
> +...
2020 Mar 09
0
Re: [PATCH] lib: Autodetect backing format and specify it explicitly.
...ename, int64_t size,
> > > }
> > > }
> > >
> > > + /* With libvirt >= 6.0 the backing format must be specified. */
> > > + if (backingfile != NULL && backingformat == NULL) {
> > > + backingformat = backingformat_free = guestfs_disk_format (g, backingfile);
> > > + if (!backingformat)
> > > + return -1;
> > > + if (STREQ (backingformat, "unknown")) {
> > > + error (g, _("could not auto-detect the format of the backing file %s"),
> > > + backi...
2020 Mar 09
0
Re: [PATCH] lib: Autodetect backing format and specify it explicitly.
...t; > > > }
> > > > >
> > > > > + /* With libvirt >= 6.0 the backing format must be specified. */
> > > > > + if (backingfile != NULL && backingformat == NULL) {
> > > > > + backingformat = backingformat_free = guestfs_disk_format (g, backingfile);
> > > > > + if (!backingformat)
> > > > > + return -1;
> > > > > + if (STREQ (backingformat, "unknown")) {
> > > > > + error (g, _("could not auto-detect the format of the backing file %s&qu...
2015 Oct 14
0
[PATCH 2/2] lib: Add comment and regression test for case where main process has large heap.
...t;
+
+int
+main (int argc, char *argv[])
+{
+ guestfs_h *g = guestfs_create ();
+ char *mem, *fmt;
+
+ /* Make sure we're using > 1GB in the main process. */
+ mem = calloc (2 * 1024, 1024 * 1024);
+ assert (mem != NULL);
+
+ /* Do something which forks qemu-img subprocess. */
+ fmt = guestfs_disk_format (g, "/dev/null");
+ if (fmt == NULL) {
+ /* Test failed. */
+ fprintf (stderr, "%s: unexpected failure of test, see earlier messages\n",
+ argv[0]);
+ exit (EXIT_FAILURE);
+ }
+
+ if (STRNEQ (fmt, "raw")) {
+ /* Test failed. */
+ fprintf (...
2015 May 26
6
[PATCH 0/6] Update the way that API versions are generated for the man page.
The existing mechanism was clunky, slow and used ~ 10 MB of
local disk.
Rich.
2015 Oct 14
2
[PATCH 1/2] lib: info: Move common code for setting child rlimits.
This is almost just refactoring, but I also set the memory
limit to really 1 GB, and not 1×10⁹.
---
src/info.c | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/src/info.c b/src/info.c
index d7f45f0..616ef50 100644
--- a/src/info.c
+++ b/src/info.c
@@ -56,6 +56,7 @@ static yajl_val get_json_output (guestfs_h *g, const char *filename);
static char
2018 Sep 21
4
[PATCH v2] lib: Use qemu-img info -U option to avoid locking error.
https://bugs.launchpad.net/qemu/+bug/1740364
---
lib/guestfs-internal.h | 3 +++
lib/handle.c | 2 ++
lib/info.c | 39 +++++++++++++++++++++++++++++++++++++++
3 files changed, 44 insertions(+)
diff --git a/lib/guestfs-internal.h b/lib/guestfs-internal.h
index adeb9478a..c66c55e70 100644
--- a/lib/guestfs-internal.h
+++ b/lib/guestfs-internal.h
@@ -510,6 +510,9 @@ struct
2013 Mar 15
0
[PATCH] lib: Add direct support for the NBD (Network Block Device) protocol.
...* qemu.conf. There is no way to detect if this option is set, so we
@@ -1129,15 +1170,14 @@ construct_libvirt_xml_disk (guestfs_h *g,
* the users pass the format to libguestfs which will faithfully pass
* that to libvirt and this function won't be used.
*/
- format = guestfs_disk_format (g, drv_priv->path);
+ format = guestfs_disk_format (g, drv_priv->u.path);
if (!format)
return -1;
if (STREQ (format, "unknown")) {
- error (g, _("could not auto-detect the format of '%s'\n"
+ error (g, _("could not auto-detect...
2014 Jan 16
3
[PATCH 0/2] Don't use snapshot=on
QEMU upstream has broken snapshot=on ... again.
These two patches stop using it entirely. Instead we run
'qemu-img create' to create overlay disks as required.
Note that the libvirt and UML backends were already doing this: The
libvirt backend because <transient/> has never worked, and the UML
backend was running uml_mkcow because the UML-equivalent syntax of
snapshot=on was