[PATCH v2] launch: add support for autodetection of appliance image format
by Pavel Butsykin
This feature allows you to use different image formats for the fixed
appliance. The raw format is used by default.
Signed-off-by: Pavel Butsykin <pbutsykin(a)virtuozzo.com>
---
lib/launch-direct.c | 2 ++
lib/launch-libvirt.c | 19 ++++++++++++-------
m4/guestfs_appliance.m4 | 11 +++++++++++
3 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/lib/launch-direct.c b/lib/launch-direct.c
index 0be662e25..b9b54857a 100644
--- a/lib/launch-direct.c
+++ b/lib/launch-direct.c
@@ -592,7 +592,9 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
append_list ("id=appliance");
append_list ("cache=unsafe");
append_list ("if=none");
+#ifndef APPLIANCE_FMT_AUTO
append_list ("format=raw");
+#endif
} end_list ();
start_list ("-device") {
append_list ("scsi-hd");
diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c
index 4adb2cfb3..030ea6911 100644
--- a/lib/launch-libvirt.c
+++ b/lib/launch-libvirt.c
@@ -212,9 +212,10 @@ get_source_format_or_autodetect (guestfs_h *g, struct drive *drv)
/**
* Create a qcow2 format overlay, with the given C<backing_drive>
- * (file). The C<format> parameter, which must be non-NULL, is the
- * backing file format. This is used to create the appliance overlay,
- * and also for read-only drives.
+ * (file). The C<format> parameter is the backing file format.
+ * The C<format> parameter can be NULL, in this case the backing
+ * format will be determined automatically. This is used to create
+ * the appliance overlay, and also for read-only drives.
*/
static char *
make_qcow2_overlay (guestfs_h *g, const char *backing_drive,
@@ -223,8 +224,6 @@ make_qcow2_overlay (guestfs_h *g, const char *backing_drive,
char *overlay;
struct guestfs_disk_create_argv optargs;
- assert (format != NULL);
-
if (guestfs_int_lazy_make_tmpdir (g) == -1)
return NULL;
@@ -232,8 +231,10 @@ make_qcow2_overlay (guestfs_h *g, const char *backing_drive,
optargs.bitmask = GUESTFS_DISK_CREATE_BACKINGFILE_BITMASK;
optargs.backingfile = backing_drive;
- optargs.bitmask |= GUESTFS_DISK_CREATE_BACKINGFORMAT_BITMASK;
- optargs.backingformat = format;
+ if (format) {
+ optargs.bitmask |= GUESTFS_DISK_CREATE_BACKINGFORMAT_BITMASK;
+ optargs.backingformat = format;
+ }
if (guestfs_disk_create_argv (g, overlay, "qcow2", -1, &optargs) == -1) {
free (overlay);
@@ -461,7 +462,11 @@ launch_libvirt (guestfs_h *g, void *datav, const char *libvirt_uri)
/* Note that appliance can be NULL if using the old-style appliance. */
if (appliance) {
+#ifdef APPLIANCE_FMT_AUTO
+ params.appliance_overlay = make_qcow2_overlay (g, appliance, NULL);
+#else
params.appliance_overlay = make_qcow2_overlay (g, appliance, "raw");
+#endif
if (!params.appliance_overlay)
goto cleanup;
}
diff --git a/m4/guestfs_appliance.m4 b/m4/guestfs_appliance.m4
index 81c43879f..4e1ec8135 100644
--- a/m4/guestfs_appliance.m4
+++ b/m4/guestfs_appliance.m4
@@ -139,3 +139,14 @@ AC_SUBST([GUESTFS_DEFAULT_PATH])
AC_DEFINE_UNQUOTED([GUESTFS_DEFAULT_PATH], ["$GUESTFS_DEFAULT_PATH"],
[Define guestfs default path.])
+
+AC_ARG_ENABLE([appliance-fmt-auto],
+ [AS_HELP_STRING([--enable-appliance-fmt-auto],
+ [enable autodetection of appliance image format @<:@default=no@:>@])],
+ [ENABLE_APPLIANCE_FMT_AUTO="$enableval"],
+ [ENABLE_APPLIANCE_FMT_AUTO=no])
+
+if test "x$ENABLE_APPLIANCE_FMT_AUTO" = "xyes"; then
+ AC_DEFINE([APPLIANCE_FMT_AUTO], [1],
+ [Define to 1 if enabled autodetection of appliance image format.])
+fi
--
2.13.0
4 years, 10 months
1.39 proposal: Let's split up the libguestfs git repo and tarballs
by Richard W.M. Jones
My contention is that the libguestfs git repository is too large and
unwieldy. There are too many separate, unrelated projects and as a
result of that the source has too many dependencies and takes too long
to build and test.
The project divides (sort of) naturally into layers -- the library,
the bindings, the various virt tools -- and could be split along those
lines into separate projects which can then be released and evolve at
their own pace.
My suggested split would be something like this:
* libguestfs: The library, daemon and appliance. That would include
the following directories in a single project:
appliance
bash
contrib
daemon
docs
examples
gnulib
lib
logo
test-tool
tmp
utils
website
* 1 project for each language binding:
csharp
erlang
gobject
golang
haskell
java
lua
ocaml
php
perl
python
ruby
* virt-customize and related tools, we'd probably call this subproject
"virt-builder". It would include virt-builder, virt-customize and
virt-sysprep, since they share a lot of common code.
* 1 project for each of the following items:
small tools written in C
(virt-cat, virt-filesystems, virt-log, virt-ls, virt-tail,
virt-diff, virt-edit, virt-format, guestmount, virt-inspector,
virt-make-fs, virt-rescue)
guestfish
virt-alignment-scan and virt-df
virt-dib
virt-get-kernel
virt-resize
virt-sparsify
virt-v2v and virt-p2v
virt-win-reg
* I'd be inclined to drop the legacy Perl tools virt-tar,
virt-list-filesystems, virt-list-partitions unless someone
especially wished to step forward to maintain them.
* common code and generator: Off to the side we'd somehow need to
package up the common code and the generator for use by all of the
above projects. It wouldn't be a separate project for downstream
packagers, but instead the code would be included (ie. duplicated)
in tarballs and upstream available as a side git repo that you'd
need to include when building (git submodule?). This is somewhat
unspecified.
M4, PO, and tests would be split between the projects as appropriate.
My proposal would be to do this incrementally, rather than all at
once, moving the easier things out first.
Thoughts?
Rich.
--
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
5 years
[PATCH] v2v: rhv-upload-plugin: Optimize only direct upload
by Nir Soffer
The optimization to start the transfer on the local host makes sense
only when using the rhv-direct=true option. When using a proxy, let the
engine choose a host.
---
v2v/rhv-upload-plugin.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py
index 8805e3552..1404ed1f5 100644
--- a/v2v/rhv-upload-plugin.py
+++ b/v2v/rhv-upload-plugin.py
@@ -143,8 +143,8 @@ def open(readonly):
# Get a reference to the transfer service.
transfers_service = system_service.image_transfers_service()
- # Create a new image transfer.
- host = find_host(connection)
+ # Create a new image transfer, using the local host is possible.
+ host = find_host(connection) if params['rhv_direct'] else None
transfer = transfers_service.add(
types.ImageTransfer(
disk = types.Disk(id = disk.id),
--
2.17.1
6 years, 6 months
[PATCH] v2v: rhv-upload-plugin: Improve error handling
by Nir Soffer
When optimizing the connection using unix socket, we handle these cases:
- The local host is not an oVirt host (no /etc/vdsm/vdsm.id).
- The local host is an oVirt host, but is not registered with engine.
- Creating UnixHTTPConnection() fails. Unlikely and probably a bug in
the plugin, but we can recover by using the https connection.
The current code handle these cases silently, making it harder to
understand why the unix socket optimization did no happen. Add debug
message to make this clear.
Also comment in the error handler why we take this path instead of
failing the operation.
---
v2v/rhv-upload-plugin.py | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py
index f404bd758..8e4052048 100644
--- a/v2v/rhv-upload-plugin.py
+++ b/v2v/rhv-upload-plugin.py
@@ -63,7 +63,10 @@ def find_host(connection):
with builtins.open("/etc/vdsm/vdsm.id") as f:
vdsm_id = f.readline().strip()
except Exception as e:
+ # This is most likely not an oVirt host.
+ debug("cannot read /etc/vdsm/vdsm.id, using any host: %s" % e)
return None
+
debug("hw_id = %r" % vdsm_id)
hosts_service = connection.system_service().hosts_service()
@@ -72,6 +75,8 @@ def find_host(connection):
case_sensitive=False,
)
if len(hosts) == 0:
+ # This oVirt host is not registered with engine.
+ debug("cannot find host with hw_id=%r, using any host" % vdsm_id)
return None
host = hosts[0]
@@ -233,9 +238,12 @@ def open(readonly):
if host is not None and unix_socket is not None:
try:
http = UnixHTTPConnection(unix_socket)
+ except Exception as e:
+ # Very unlikely failure, but we can recover by using the https
+ # connection.
+ debug("cannot create unix socket connection, using https: %s" % e)
+ else:
debug("optimizing connection using unix socket %r" % unix_socket)
- except:
- pass
# Save everything we need to make requests in the handle.
return {
--
2.17.1
6 years, 6 months
[PATCH] v2v: rhv-upload-plugin: Remove unneeded auth
by Nir Soffer
Old imageio proxy was using Authorization header for GET and PUT
requests. Remove unneeded authorization when sending OPTIONS request.
Remove unneeded duplicated comments about authorization for old
imageio, and replace them with a comment when we set needs_auth.
---
v2v/rhv-upload-plugin.py | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py
index 8805e3552..f404bd758 100644
--- a/v2v/rhv-upload-plugin.py
+++ b/v2v/rhv-upload-plugin.py
@@ -191,16 +191,17 @@ def open(readonly):
)
# The first request is to fetch the features of the server.
+
+ # Authentication was needed only for GET and PUT requests when
+ # communicating with old imageio-proxy.
needs_auth = not params['rhv_direct']
+
can_flush = False
can_trim = False
can_zero = False
unix_socket = None
- http.putrequest("OPTIONS", destination_url.path)
- http.putheader("Authorization", transfer.signed_ticket)
- http.endheaders()
-
+ http.request("OPTIONS", destination_url.path)
r = http.getresponse()
data = r.read()
@@ -298,7 +299,6 @@ def pread(h, count, offset):
transfer = h['transfer']
headers = {"Range", "bytes=%d-%d" % (offset, offset+count-1)}
- # Authorization is only needed for old imageio.
if h['needs_auth']:
headers["Authorization"] = transfer.signed_ticket
@@ -321,7 +321,6 @@ def pwrite(h, buf, offset):
h['highestwrite'] = max(h['highestwrite'], offset+count)
http.putrequest("PUT", h['path'] + "?flush=n")
- # Authorization is only needed for old imageio.
if h['needs_auth']:
http.putheader("Authorization", transfer.signed_ticket)
# The oVirt server only uses the first part of the range, and the
@@ -378,7 +377,6 @@ def emulate_zero(h, count, offset):
# After that we must emulate them with writes.
if offset+count < h['highestwrite']:
http.putrequest("PUT", h['path'])
- # Authorization is only needed for old imageio.
if h['needs_auth']:
http.putheader("Authorization", transfer.signed_ticket)
http.putheader("Content-Range",
--
2.17.1
6 years, 6 months
[PATCH 0/3] test-tool: small options-related improvements
by Pino Toscano
*** BLURB HERE ***
Pino Toscano (3):
test-tool: implement --short-options & --long-options
test-tool: add a documentation test
bash: add a completion script for libguestfs-test-tool
.gitignore | 1 +
bash/Makefile.am | 3 ++-
bash/virt-v2v-copy-to-local | 6 +++++
test-tool/Makefile.am | 17 ++++++++++++--
test-tool/libguestfs-test-tool.pod | 8 +++----
test-tool/test-libguestfs-test-tool-docs.sh | 25 +++++++++++++++++++++
test-tool/test-tool.c | 9 +++++++-
7 files changed, 61 insertions(+), 8 deletions(-)
create mode 100755 test-tool/test-libguestfs-test-tool-docs.sh
--
2.17.1
6 years, 6 months
guestmount only
by Pascal
hello,
I would only like to have guestmount in my toolkit to read-only vhd/vhdx
images, so I try to compile libguestfs with a minimum of dependencies.
I downloaded the 1.38-stable sources, installed the necessary dependencies
and compiled them with the command :
./configure --disable-ocaml --disable-perl --disable-ruby --disable-haskell
--disable-php --disable-erlang --disable-lua --disable-golang
--disable-gobject --disable-appliance --disable-daemon
--with-distro=ARCHLINUX --disable-libvirt
...
Thank you for downloading libguestfs 1.38.2
This is how we have configured the optional components for you today:
Daemon .............................. no
Appliance ........................... no
QEMU ................................ /bin/qemu-system-x86_64
guestfish and C-based virt tools .... yes
FUSE filesystem ..................... yes
Default backend ..................... direct
GNU gettext for i18n ................ yes
virt-p2v ............................ yes
OCaml bindings ...................... no
OCaml-based virt tools .............. no
Perl bindings ....................... no
Perl-based virt tools ............... no
Python bindings ..................... yes
Ruby bindings ....................... no
Java bindings ....................... no
Haskell bindings .................... no
PHP bindings ........................ no
Erlang bindings ..................... no
Lua bindings ........................ no
Go bindings ......................... no
gobject bindings .................... no
gobject introspection ............... no
bash completion ..................... yes
compilation goes well :
make
...
mv podwrapper.1-t podwrapper.1
make[2]: Leaving directory '/tmp/libguestfs-1.38.2'
make[1]: Leaving directory '/tmp/libguestfs-1.38.2'
but installation does not install guestmout (or even guestunmount) and ends
in an error :
make DESTDIR="/tmp/test/" install
...
make[4]: Entering directory '/tmp/libguestfs-1.38.2/po'
make[4]: *** No rule to make target '../builder/index-parse.c', needed by
'libguestfs.pot'. Stop.
make[4]: Leaving directory '/tmp/libguestfs-1.38.2/po'
make[3]: *** [Makefile:1818: install-data-am] Error 2
make[3]: Leaving directory '/tmp/libguestfs-1.38.2/po'
make[2]: *** [Makefile:1769: install-am] Error 2
make[2]: Leaving directory '/tmp/libguestfs-1.38.2/po'
make[1]: *** [Makefile:2216: install-recursive] Error 1
make[1]: Leaving directory '/tmp/libguestfs-1.38.2'
make: *** [Makefile:2873: install] Error 2
what the problem is or could be ?
is there any other way outside libguestfs to access the contents of the
virtual machine vhd/vhdx disk ?
regards, lacsaP.
6 years, 6 months
[PATCH] v2v: improve -os documentation for rhv-upload
by Pino Toscano
Thanks to: Ming Xie
---
v2v/virt-v2v.pod | 3 +++
1 file changed, 3 insertions(+)
diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod
index ff25f98d4..a533e95da 100644
--- a/v2v/virt-v2v.pod
+++ b/v2v/virt-v2v.pod
@@ -766,6 +766,9 @@ For I<-o libvirt>, this is a libvirt directory pool
For I<-o local> and I<-o qemu>, this is a directory name. The
directory must exist.
+For I<-o rhv-upload>, this is the name of the destination Storage
+Domain.
+
For I<-o rhv>, this can be an NFS path of the Export Storage Domain
of the form C<E<lt>hostE<gt>:E<lt>pathE<gt>>, eg:
--
2.17.1
6 years, 6 months
[nbdkit PATCH] main: More idiomatic use of getopt_long
by Eric Blake
Prefer named constants over magic numbers in the 'struct option'
list, and expand the list of enums for long-only options so that
the call to getopt_long() can switch directly to every option,
rather than needing a lengthy if/else chain that grows for every
new long option.
Patch best viewed with whitespace changes ignored.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/main.c | 191 ++++++++++++++++++++++++++++++++-----------------------------
1 file changed, 100 insertions(+), 91 deletions(-)
diff --git a/src/main.c b/src/main.c
index d2e5674..6be0991 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,5 +1,5 @@
/* nbdkit
- * Copyright (C) 2013-2017 Red Hat Inc.
+ * Copyright (C) 2013-2018 Red Hat Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -109,44 +109,55 @@ struct backend *backend;
static char *random_fifo_dir = NULL;
static char *random_fifo = NULL;
-enum { HELP_OPTION = CHAR_MAX + 1 };
+enum {
+ HELP_OPTION = CHAR_MAX + 1,
+ DUMP_CONFIG_OPTION,
+ DUMP_PLUGIN_OPTION,
+ EXIT_WITH_PARENT_OPTION,
+ FILTER_OPTION,
+ RUN_OPTION,
+ SELINUX_LABEL_OPTION,
+ TLS_OPTION,
+ TLS_CERTIFICATES_OPTION,
+ TLS_VERIFY_PEER_OPTION,
+};
static const char *short_options = "e:fg:i:nop:P:rst:u:U:vV";
static const struct option long_options[] = {
- { "help", 0, NULL, HELP_OPTION },
- { "dump-config",0, NULL, 0 },
- { "dump-plugin",0, NULL, 0 },
- { "exit-with-parent", 0, NULL, 0 },
- { "export", 1, NULL, 'e' },
- { "export-name",1, NULL, 'e' },
- { "exportname", 1, NULL, 'e' },
- { "filter", 1, NULL, 0 },
- { "foreground", 0, NULL, 'f' },
- { "no-fork", 0, NULL, 'f' },
- { "group", 1, NULL, 'g' },
- { "ip-addr", 1, NULL, 'i' },
- { "ipaddr", 1, NULL, 'i' },
- { "new-style", 0, NULL, 'n' },
- { "newstyle", 0, NULL, 'n' },
- { "old-style", 0, NULL, 'o' },
- { "oldstyle", 0, NULL, 'o' },
- { "pid-file", 1, NULL, 'P' },
- { "pidfile", 1, NULL, 'P' },
- { "port", 1, NULL, 'p' },
- { "read-only", 0, NULL, 'r' },
- { "readonly", 0, NULL, 'r' },
- { "run", 1, NULL, 0 },
- { "selinux-label", 1, NULL, 0 },
- { "single", 0, NULL, 's' },
- { "stdin", 0, NULL, 's' },
- { "threads", 1, NULL, 't' },
- { "tls", 1, NULL, 0 },
- { "tls-certificates", 1, NULL, 0 },
- { "tls-verify-peer", 0, NULL, 0 },
- { "unix", 1, NULL, 'U' },
- { "user", 1, NULL, 'u' },
- { "verbose", 0, NULL, 'v' },
- { "version", 0, NULL, 'V' },
+ { "help", no_argument, NULL, HELP_OPTION },
+ { "dump-config", no_argument, NULL, DUMP_CONFIG_OPTION },
+ { "dump-plugin", no_argument, NULL, DUMP_PLUGIN_OPTION },
+ { "exit-with-parent", no_argument, NULL, EXIT_WITH_PARENT_OPTION },
+ { "export", required_argument, NULL, 'e' },
+ { "export-name", required_argument, NULL, 'e' },
+ { "exportname", required_argument, NULL, 'e' },
+ { "filter", required_argument, NULL, FILTER_OPTION },
+ { "foreground", no_argument, NULL, 'f' },
+ { "no-fork", no_argument, NULL, 'f' },
+ { "group", required_argument, NULL, 'g' },
+ { "ip-addr", required_argument, NULL, 'i' },
+ { "ipaddr", required_argument, NULL, 'i' },
+ { "new-style", no_argument, NULL, 'n' },
+ { "newstyle", no_argument, NULL, 'n' },
+ { "old-style", no_argument, NULL, 'o' },
+ { "oldstyle", no_argument, NULL, 'o' },
+ { "pid-file", required_argument, NULL, 'P' },
+ { "pidfile", required_argument, NULL, 'P' },
+ { "port", required_argument, NULL, 'p' },
+ { "read-only", no_argument, NULL, 'r' },
+ { "readonly", no_argument, NULL, 'r' },
+ { "run", required_argument, NULL, RUN_OPTION },
+ { "selinux-label", required_argument, NULL, SELINUX_LABEL_OPTION },
+ { "single", no_argument, NULL, 's' },
+ { "stdin", no_argument, NULL, 's' },
+ { "threads", required_argument, NULL, 't' },
+ { "tls", required_argument, NULL, TLS_OPTION },
+ { "tls-certificates", required_argument, NULL, TLS_CERTIFICATES_OPTION },
+ { "tls-verify-peer", no_argument, NULL, TLS_VERIFY_PEER_OPTION },
+ { "unix", required_argument, NULL, 'U' },
+ { "user", required_argument, NULL, 'u' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "version", no_argument, NULL, 'V' },
{ NULL },
};
@@ -233,25 +244,27 @@ main (int argc, char *argv[])
break;
switch (c) {
- case 0: /* options which are long only */
- if (strcmp (long_options[option_index].name, "dump-config") == 0) {
- dump_config ();
- exit (EXIT_SUCCESS);
- }
- else if (strcmp (long_options[option_index].name, "dump-plugin") == 0) {
- dump_plugin = 1;
- }
- else if (strcmp (long_options[option_index].name, "exit-with-parent") == 0) {
+ case DUMP_CONFIG_OPTION:
+ dump_config ();
+ exit (EXIT_SUCCESS);
+
+ case DUMP_PLUGIN_OPTION:
+ dump_plugin = 1;
+ break;
+
+ case EXIT_WITH_PARENT_OPTION:
#ifdef PR_SET_PDEATHSIG
- exit_with_parent = 1;
- foreground = 1;
+ exit_with_parent = 1;
+ foreground = 1;
+ break;
#else
- fprintf (stderr, "%s: --exit-with-parent is not implemented for this operating system\n",
- program_name);
- exit (EXIT_FAILURE);
+ fprintf (stderr, "%s: --exit-with-parent is not implemented for this operating system\n",
+ program_name);
+ exit (EXIT_FAILURE);
#endif
- }
- else if (strcmp (long_options[option_index].name, "filter") == 0) {
+
+ case FILTER_OPTION:
+ {
struct filter_filename *t;
t = malloc (sizeof *t);
@@ -263,51 +276,47 @@ main (int argc, char *argv[])
t->filename = optarg;
filter_filenames = t;
}
- else if (strcmp (long_options[option_index].name, "run") == 0) {
- if (socket_activation) {
- fprintf (stderr, "%s: cannot use socket activation with --run flag\n",
- program_name);
- exit (EXIT_FAILURE);
- }
- run = optarg;
- foreground = 1;
- }
- else if (strcmp (long_options[option_index].name, "selinux-label") == 0) {
- selinux_label = optarg;
- break;
- }
- else if (strcmp (long_options[option_index].name, "tls") == 0) {
- tls_set_on_cli = 1;
- if (strcmp (optarg, "off") == 0 || strcmp (optarg, "0") == 0)
- tls = 0;
- else if (strcmp (optarg, "on") == 0 || strcmp (optarg, "1") == 0)
- tls = 1;
- else if (strcmp (optarg, "require") == 0 ||
- strcmp (optarg, "required") == 0 ||
- strcmp (optarg, "force") == 0)
- tls = 2;
- else {
- fprintf (stderr, "%s: --tls flag must be off|on|require\n",
- program_name);
- exit (EXIT_FAILURE);
- }
- break;
- }
- else if (strcmp (long_options[option_index].name, "tls-certificates") == 0) {
- tls_certificates_dir = optarg;
- break;
- }
- else if (strcmp (long_options[option_index].name, "tls-verify-peer") == 0) {
- tls_verify_peer = 1;
- break;
+ break;
+
+ case RUN_OPTION:
+ if (socket_activation) {
+ fprintf (stderr, "%s: cannot use socket activation with --run flag\n",
+ program_name);
+ exit (EXIT_FAILURE);
}
+ run = optarg;
+ foreground = 1;
+ break;
+
+ case SELINUX_LABEL_OPTION:
+ selinux_label = optarg;
+ break;
+
+ case TLS_OPTION:
+ tls_set_on_cli = 1;
+ if (strcmp (optarg, "off") == 0 || strcmp (optarg, "0") == 0)
+ tls = 0;
+ else if (strcmp (optarg, "on") == 0 || strcmp (optarg, "1") == 0)
+ tls = 1;
+ else if (strcmp (optarg, "require") == 0 ||
+ strcmp (optarg, "required") == 0 ||
+ strcmp (optarg, "force") == 0)
+ tls = 2;
else {
- fprintf (stderr, "%s: unknown long option: %s (%d)\n",
- program_name, long_options[option_index].name, option_index);
+ fprintf (stderr, "%s: --tls flag must be off|on|require\n",
+ program_name);
exit (EXIT_FAILURE);
}
break;
+ case TLS_CERTIFICATES_OPTION:
+ tls_certificates_dir = optarg;
+ break;
+
+ case TLS_VERIFY_PEER_OPTION:
+ tls_verify_peer = 1;
+ break;
+
case 'e':
exportname = optarg;
newstyle = 1;
--
2.14.4
6 years, 6 months