|
|
e9bfca |
From a3b29ff1114ffe50a09e9505b377697999751a84 Mon Sep 17 00:00:00 2001
|
|
|
151578 |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
151578 |
Date: Mon, 29 Jul 2013 14:47:56 +0100
|
|
|
151578 |
Subject: [PATCH] RHEL 7: Disable unsupported remote drive protocols
|
|
|
151578 |
(RHBZ#962113).
|
|
|
151578 |
|
|
|
151578 |
This disables support for unsupported remote drive protocols:
|
|
|
151578 |
|
|
|
151578 |
* ftp
|
|
|
151578 |
* ftps
|
|
|
151578 |
* http
|
|
|
151578 |
* https
|
|
|
151578 |
* tftp
|
|
|
151578 |
* gluster
|
|
|
151578 |
* iscsi
|
|
|
151578 |
* sheepdog
|
|
|
151578 |
* ssh
|
|
|
151578 |
|
|
|
151578 |
Note 'nbd' is not disabled, and of course 'file' works.
|
|
|
151578 |
|
|
|
151578 |
We hope to gradually add some of these back over the lifetime of RHEL 7.
|
|
|
151578 |
|
|
|
151578 |
In RHEL 7.2: rbd (Ceph) support was enabled.
|
|
|
151578 |
---
|
|
|
e9bfca |
docs/guestfs-testing.pod | 20 -----
|
|
|
e9bfca |
fish/guestfish.pod | 66 ++--------------
|
|
|
e9bfca |
fish/test-add-uri.sh | 32 --------
|
|
|
e9bfca |
generator/actions_core.ml | 50 +------------
|
|
|
e9bfca |
lib/drives.c | 8 ++
|
|
|
e9bfca |
lib/guestfs.pod | 100 -------------------------
|
|
|
e9bfca |
tests/disks/test-qemu-drive-libvirt.sh | 28 -------
|
|
|
e9bfca |
tests/disks/test-qemu-drive.sh | 60 ---------------
|
|
|
151578 |
8 files changed, 16 insertions(+), 348 deletions(-)
|
|
|
151578 |
|
|
|
151578 |
diff --git a/docs/guestfs-testing.pod b/docs/guestfs-testing.pod
|
|
|
e9bfca |
index f558964bf..8f264ed17 100644
|
|
|
151578 |
--- a/docs/guestfs-testing.pod
|
|
|
151578 |
+++ b/docs/guestfs-testing.pod
|
|
|
e9bfca |
@@ -109,26 +109,6 @@ image. To exit, type C<exit>.
|
|
|
151578 |
If you get an error, try enabling debugging (add C<-v> to the command
|
|
|
151578 |
line). Also make sure that L<libguestfs-test-tool(1)> succeeds.
|
|
|
151578 |
|
|
|
151578 |
-=head2 Try to open a remote guest image with guestfish.
|
|
|
151578 |
-
|
|
|
151578 |
-You may also have to disable libvirt by setting this:
|
|
|
151578 |
-
|
|
|
151578 |
- export LIBGUESTFS_BACKEND=direct
|
|
|
151578 |
-
|
|
|
151578 |
-If you have a disk image available over HTTP/FTP, try to open it.
|
|
|
151578 |
-
|
|
|
151578 |
- guestfish --ro -i --format=raw -a http://www.example.com/disk.img
|
|
|
151578 |
-
|
|
|
151578 |
-For SSH you will need to make sure that ssh-agent is set up so you
|
|
|
151578 |
-don't need a password to log in to the remote machine. Then a command
|
|
|
151578 |
-similar to this should work:
|
|
|
151578 |
-
|
|
|
151578 |
- guestfish --ro -i --format=raw \
|
|
|
151578 |
- -a ssh://remote.example.com/path/to/disk.img
|
|
|
151578 |
-
|
|
|
151578 |
-If you get an error, try enabling debugging (add C<-v> to the command
|
|
|
151578 |
-line). Also make sure that L<libguestfs-test-tool(1)> succeeds.
|
|
|
151578 |
-
|
|
|
151578 |
=head2 Run virt-alignment-scan on all your guests.
|
|
|
151578 |
|
|
|
151578 |
Run L<virt-alignment-scan(1)> on guests or disk images:
|
|
|
151578 |
diff --git a/fish/guestfish.pod b/fish/guestfish.pod
|
|
|
e9bfca |
index bbf43aad5..f4762f929 100644
|
|
|
151578 |
--- a/fish/guestfish.pod
|
|
|
151578 |
+++ b/fish/guestfish.pod
|
|
|
151578 |
@@ -131,9 +131,9 @@ To list what is available do:
|
|
|
151578 |
|
|
|
151578 |
=head2 Remote drives
|
|
|
151578 |
|
|
|
151578 |
-Access a remote disk using ssh:
|
|
|
151578 |
+Access a remote disk using NBD:
|
|
|
151578 |
|
|
|
151578 |
- guestfish -a ssh://example.com/path/to/disk.img
|
|
|
151578 |
+ guestfish -a nbd://example.com
|
|
|
151578 |
|
|
|
151578 |
=head2 Remote control
|
|
|
151578 |
|
|
|
e9bfca |
@@ -1127,12 +1127,12 @@ L<guestfs(3)/REMOTE STORAGE>>.
|
|
|
151578 |
On the command line, you can use the I<-a> option to add network
|
|
|
151578 |
block devices using a URI-style format, for example:
|
|
|
151578 |
|
|
|
151578 |
- guestfish -a ssh://root@example.com/disk.img
|
|
|
151578 |
+ guestfish -a nbd://example.com
|
|
|
151578 |
|
|
|
151578 |
URIs I<cannot> be used with the L</add> command. The equivalent
|
|
|
151578 |
command using the API directly is:
|
|
|
151578 |
|
|
|
151578 |
- ><fs> add /disk.img protocol:ssh server:tcp:example.com username:root
|
|
|
151578 |
+ ><fs> add /disk.img protocol:nbd server:tcp:example.com
|
|
|
151578 |
|
|
|
151578 |
The possible I<-a URI> formats are described below.
|
|
|
151578 |
|
|
|
e9bfca |
@@ -1142,40 +1142,6 @@ The possible I<-a URI> formats are described below.
|
|
|
151578 |
|
|
|
151578 |
Add the local disk image (or device) called F<disk.img>.
|
|
|
151578 |
|
|
|
151578 |
-=head2 B<-a ftp://[user@]example.com[:port]/disk.img>
|
|
|
151578 |
-
|
|
|
151578 |
-=head2 B<-a ftps://[user@]example.com[:port]/disk.img>
|
|
|
151578 |
-
|
|
|
151578 |
-=head2 B<-a http://[user@]example.com[:port]/disk.img>
|
|
|
151578 |
-
|
|
|
151578 |
-=head2 B<-a https://[user@]example.com[:port]/disk.img>
|
|
|
151578 |
-
|
|
|
151578 |
-=head2 B<-a tftp://[user@]example.com[:port]/disk.img>
|
|
|
151578 |
-
|
|
|
151578 |
-Add a disk located on a remote FTP, HTTP or TFTP server.
|
|
|
151578 |
-
|
|
|
151578 |
-The equivalent API command would be:
|
|
|
151578 |
-
|
|
|
151578 |
- ><fs> add /disk.img protocol:(ftp|...) server:tcp:example.com
|
|
|
151578 |
-
|
|
|
151578 |
-=head2 B<-a gluster://example.com[:port]/volname/image>
|
|
|
151578 |
-
|
|
|
151578 |
-Add a disk image located on GlusterFS storage.
|
|
|
151578 |
-
|
|
|
151578 |
-The server is the one running C<glusterd>, and may be C<localhost>.
|
|
|
151578 |
-
|
|
|
151578 |
-The equivalent API command would be:
|
|
|
151578 |
-
|
|
|
151578 |
- ><fs> add volname/image protocol:gluster server:tcp:example.com
|
|
|
151578 |
-
|
|
|
151578 |
-=head2 B<-a iscsi://example.com[:port]/target-iqn-name[/lun]>
|
|
|
151578 |
-
|
|
|
151578 |
-Add a disk located on an iSCSI server.
|
|
|
151578 |
-
|
|
|
151578 |
-The equivalent API command would be:
|
|
|
151578 |
-
|
|
|
151578 |
- ><fs> add target-iqn-name/lun protocol:iscsi server:tcp:example.com
|
|
|
151578 |
-
|
|
|
151578 |
=head2 B<-a nbd://example.com[:port]>
|
|
|
151578 |
|
|
|
151578 |
=head2 B<-a nbd://example.com[:port]/exportname>
|
|
|
e9bfca |
@@ -1210,35 +1176,13 @@ The equivalent API command would be:
|
|
|
151578 |
|
|
|
151578 |
><fs> add pool/disk protocol:rbd server:tcp:example.com:port
|
|
|
151578 |
|
|
|
151578 |
-=head2 B<-a sheepdog://[example.com[:port]]/volume/image>
|
|
|
151578 |
-
|
|
|
151578 |
-Add a disk image located on a Sheepdog volume.
|
|
|
151578 |
-
|
|
|
151578 |
-The server name is optional. Although libguestfs and Sheepdog
|
|
|
151578 |
-supports multiple servers, only at most one server can be specified
|
|
|
151578 |
-when using this URI syntax.
|
|
|
151578 |
-
|
|
|
151578 |
-The equivalent API command would be:
|
|
|
151578 |
-
|
|
|
151578 |
- ><fs> add volume protocol:sheepdog [server:tcp:example.com]
|
|
|
151578 |
-
|
|
|
151578 |
-=head2 B<-a ssh://[user@]example.com[:port]/disk.img>
|
|
|
151578 |
-
|
|
|
151578 |
-Add a disk image located on a remote server, accessed using the Secure
|
|
|
151578 |
-Shell (ssh) SFTP protocol. SFTP is supported out of the box by all
|
|
|
151578 |
-major SSH servers.
|
|
|
151578 |
-
|
|
|
151578 |
-The equivalent API command would be:
|
|
|
151578 |
-
|
|
|
151578 |
- ><fs> add /disk protocol:ssh server:tcp:example.com [username:user]
|
|
|
151578 |
-
|
|
|
151578 |
Note that the URIs follow the syntax of
|
|
|
151578 |
L<RFC 3986|https://tools.ietf.org/html/rfc3986>: in particular, there
|
|
|
151578 |
are restrictions on the allowed characters for the various components
|
|
|
151578 |
of the URI. Characters such as C<:>, C<@>, and C B<must> be
|
|
|
151578 |
percent-encoded:
|
|
|
151578 |
|
|
|
151578 |
- $ guestfish -a ssh://user:pass%40word@example.com/disk.img
|
|
|
151578 |
+ $ guestfish -a rbd://user:pass%40word@example.com[:port]/pool/disk
|
|
|
151578 |
|
|
|
151578 |
In this case, the password is C<pass@word>.
|
|
|
151578 |
|
|
|
151578 |
diff --git a/fish/test-add-uri.sh b/fish/test-add-uri.sh
|
|
|
151578 |
index 756df997b..8f84fd31b 100755
|
|
|
151578 |
--- a/fish/test-add-uri.sh
|
|
|
151578 |
+++ b/fish/test-add-uri.sh
|
|
|
151578 |
@@ -40,14 +40,6 @@ function fail ()
|
|
|
151578 |
$VG guestfish -x -a file://$abs_builddir/test-add-uri.img </dev/null >test-add-uri.out 2>&1
|
|
|
151578 |
grep -sq 'add_drive ".*/test-add-uri.img"' test-add-uri.out || fail
|
|
|
151578 |
|
|
|
151578 |
-# curl
|
|
|
151578 |
-$VG guestfish -x -a ftp://user@example.com/disk.img </dev/null >test-add-uri.out 2>&1
|
|
|
151578 |
-grep -sq 'add_drive "/disk.img" "protocol:ftp" "server:tcp:example.com" "username:user"' test-add-uri.out || fail
|
|
|
151578 |
-
|
|
|
151578 |
-# gluster
|
|
|
151578 |
-$VG guestfish -x -a gluster://example.com/disk </dev/null >test-add-uri.out 2>&1
|
|
|
151578 |
-grep -sq 'add_drive "disk" "protocol:gluster" "server:tcp:example.com"' test-add-uri.out || fail
|
|
|
151578 |
-
|
|
|
151578 |
# NBD
|
|
|
151578 |
$VG guestfish -x -a nbd://example.com </dev/null >test-add-uri.out 2>&1
|
|
|
151578 |
grep -sq 'add_drive "" "protocol:nbd" "server:tcp:example.com"' test-add-uri.out || fail
|
|
|
151578 |
@@ -67,29 +59,5 @@ grep -sq 'add_drive "pool/disk" "protocol:rbd" "server:tcp:example.com:6789"' te
|
|
|
151578 |
$VG guestfish -x -a rbd:///pool/disk </dev/null >test-add-uri.out 2>&1
|
|
|
151578 |
grep -sq 'add_drive "pool/disk" "protocol:rbd"' test-add-uri.out || fail
|
|
|
151578 |
|
|
|
151578 |
-# sheepdog
|
|
|
151578 |
-$VG guestfish -x -a sheepdog:///volume/image </dev/null >test-add-uri.out 2>&1
|
|
|
151578 |
-grep -sq 'add_drive "volume/image" "protocol:sheepdog"' test-add-uri.out || fail
|
|
|
151578 |
-
|
|
|
151578 |
-$VG guestfish -x -a sheepdog://example.com:3000/volume/image </dev/null >test-add-uri.out 2>&1
|
|
|
151578 |
-grep -sq 'add_drive "volume/image" "protocol:sheepdog" "server:tcp:example.com:3000"' test-add-uri.out || fail
|
|
|
151578 |
-
|
|
|
151578 |
-# ssh
|
|
|
151578 |
-$VG guestfish -x -a ssh://example.com/disk.img </dev/null >test-add-uri.out 2>&1
|
|
|
151578 |
-grep -sq 'add_drive "/disk.img" "protocol:ssh" "server:tcp:example.com"' test-add-uri.out || fail
|
|
|
151578 |
-
|
|
|
151578 |
-$VG guestfish -x -a ssh://user@example.com/disk.img </dev/null >test-add-uri.out 2>&1
|
|
|
151578 |
-grep -sq 'add_drive "/disk.img" "protocol:ssh" "server:tcp:example.com" "username:user"' test-add-uri.out || fail
|
|
|
151578 |
-
|
|
|
151578 |
-$VG guestfish -x -a ssh://user@example.com:2000/disk.img </dev/null >test-add-uri.out 2>&1
|
|
|
151578 |
-grep -sq 'add_drive "/disk.img" "protocol:ssh" "server:tcp:example.com:2000" "username:user"' test-add-uri.out || fail
|
|
|
151578 |
-
|
|
|
151578 |
-# iSCSI
|
|
|
151578 |
-$VG guestfish -x -a iscsi://example.com/iqn.2015-12.com.libguestfs:test1/0 </dev/null >test-add-uri.out 2>&1
|
|
|
151578 |
-grep -sq 'add_drive "iqn.2015-12.com.libguestfs:test1/0" "protocol:iscsi" "server:tcp:example.com"' test-add-uri.out || fail
|
|
|
151578 |
-
|
|
|
151578 |
-$VG guestfish -x -a iscsi://user:password@example.com/iqn.2015-12.com.libguestfs:test2/0 </dev/null >test-add-uri.out 2>&1
|
|
|
151578 |
-grep -sq 'add_drive "iqn.2015-12.com.libguestfs:test2/0" "protocol:iscsi" "server:tcp:example.com" "username:user" "secret:password"' test-add-uri.out || fail
|
|
|
151578 |
-
|
|
|
151578 |
rm test-add-uri.out
|
|
|
151578 |
rm test-add-uri.img
|
|
|
151578 |
diff --git a/generator/actions_core.ml b/generator/actions_core.ml
|
|
|
e9bfca |
index 237edafce..aca5b1f43 100644
|
|
|
151578 |
--- a/generator/actions_core.ml
|
|
|
151578 |
+++ b/generator/actions_core.ml
|
|
|
e9bfca |
@@ -297,29 +297,6 @@ F<filename> is interpreted as a local file or device.
|
|
|
151578 |
This is the default if the optional protocol parameter
|
|
|
151578 |
is omitted.
|
|
|
151578 |
|
|
|
151578 |
-=item C<protocol = \"ftp\"|\"ftps\"|\"http\"|\"https\"|\"tftp\">
|
|
|
151578 |
-
|
|
|
151578 |
-Connect to a remote FTP, HTTP or TFTP server.
|
|
|
151578 |
-The C<server> parameter must also be supplied - see below.
|
|
|
151578 |
-
|
|
|
151578 |
-See also: L<guestfs(3)/FTP, HTTP AND TFTP>
|
|
|
151578 |
-
|
|
|
151578 |
-=item C<protocol = \"gluster\">
|
|
|
151578 |
-
|
|
|
151578 |
-Connect to the GlusterFS server.
|
|
|
151578 |
-The C<server> parameter must also be supplied - see below.
|
|
|
151578 |
-
|
|
|
151578 |
-See also: L<guestfs(3)/GLUSTER>
|
|
|
151578 |
-
|
|
|
151578 |
-=item C<protocol = \"iscsi\">
|
|
|
151578 |
-
|
|
|
151578 |
-Connect to the iSCSI server.
|
|
|
151578 |
-The C<server> parameter must also be supplied - see below.
|
|
|
151578 |
-The C<username> parameter may be supplied. See below.
|
|
|
151578 |
-The C<secret> parameter may be supplied. See below.
|
|
|
151578 |
-
|
|
|
151578 |
-See also: L<guestfs(3)/ISCSI>.
|
|
|
151578 |
-
|
|
|
151578 |
=item C<protocol = \"nbd\">
|
|
|
151578 |
|
|
|
151578 |
Connect to the Network Block Device server.
|
|
|
e9bfca |
@@ -336,22 +313,6 @@ The C<secret> parameter may be supplied. See below.
|
|
|
151578 |
|
|
|
151578 |
See also: L<guestfs(3)/CEPH>.
|
|
|
151578 |
|
|
|
151578 |
-=item C<protocol = \"sheepdog\">
|
|
|
151578 |
-
|
|
|
151578 |
-Connect to the Sheepdog server.
|
|
|
151578 |
-The C<server> parameter may also be supplied - see below.
|
|
|
151578 |
-
|
|
|
151578 |
-See also: L<guestfs(3)/SHEEPDOG>.
|
|
|
151578 |
-
|
|
|
151578 |
-=item C<protocol = \"ssh\">
|
|
|
151578 |
-
|
|
|
151578 |
-Connect to the Secure Shell (ssh) server.
|
|
|
151578 |
-
|
|
|
151578 |
-The C<server> parameter must be supplied.
|
|
|
151578 |
-The C<username> parameter may be supplied. See below.
|
|
|
151578 |
-
|
|
|
151578 |
-See also: L<guestfs(3)/SSH>.
|
|
|
151578 |
-
|
|
|
151578 |
=back
|
|
|
151578 |
|
|
|
151578 |
=item C<server>
|
|
|
e9bfca |
@@ -362,13 +323,8 @@ is a list of server(s).
|
|
|
151578 |
Protocol Number of servers required
|
|
|
151578 |
-------- --------------------------
|
|
|
151578 |
file List must be empty or param not used at all
|
|
|
151578 |
- ftp|ftps|http|https|tftp Exactly one
|
|
|
151578 |
- gluster Exactly one
|
|
|
151578 |
- iscsi Exactly one
|
|
|
151578 |
nbd Exactly one
|
|
|
151578 |
rbd Zero or more
|
|
|
151578 |
- sheepdog Zero or more
|
|
|
151578 |
- ssh Exactly one
|
|
|
151578 |
|
|
|
151578 |
Each list element is a string specifying a server. The string must be
|
|
|
151578 |
in one of the following formats:
|
|
|
e9bfca |
@@ -384,10 +340,10 @@ for the protocol is used (see F</etc/services>).
|
|
|
151578 |
|
|
|
151578 |
=item C<username>
|
|
|
151578 |
|
|
|
151578 |
-For the C<ftp>, C<ftps>, C<http>, C<https>, C<iscsi>, C<rbd>, C<ssh>
|
|
|
151578 |
-and C<tftp> protocols, this specifies the remote username.
|
|
|
151578 |
+For the C<rbd>
|
|
|
151578 |
+protocol, this specifies the remote username.
|
|
|
151578 |
|
|
|
151578 |
-If not given, then the local username is used for C<ssh>, and no authentication
|
|
|
151578 |
+If not given, then no authentication
|
|
|
151578 |
is attempted for ceph. But note this sometimes may give unexpected results, for
|
|
|
151578 |
example if using the libvirt backend and if the libvirt backend is configured to
|
|
|
151578 |
start the qemu appliance as a special user such as C<qemu.qemu>. If in doubt,
|
|
|
151578 |
diff --git a/lib/drives.c b/lib/drives.c
|
|
|
e9bfca |
index 82ef30093..ba5d07ed0 100644
|
|
|
151578 |
--- a/lib/drives.c
|
|
|
151578 |
+++ b/lib/drives.c
|
|
|
151578 |
@@ -165,6 +165,7 @@ create_drive_non_file (guestfs_h *g,
|
|
|
151578 |
return drv;
|
|
|
151578 |
}
|
|
|
151578 |
|
|
|
151578 |
+#if 0 /* DISABLED IN RHEL 7 */
|
|
|
151578 |
static struct drive *
|
|
|
151578 |
create_drive_curl (guestfs_h *g,
|
|
|
151578 |
const struct drive_create_data *data)
|
|
|
151578 |
@@ -223,6 +224,7 @@ create_drive_gluster (guestfs_h *g,
|
|
|
151578 |
|
|
|
151578 |
return create_drive_non_file (g, data);
|
|
|
151578 |
}
|
|
|
151578 |
+#endif /* DISABLED IN RHEL 7 */
|
|
|
151578 |
|
|
|
151578 |
static int
|
|
|
151578 |
nbd_port (void)
|
|
|
151578 |
@@ -291,6 +293,7 @@ create_drive_rbd (guestfs_h *g,
|
|
|
151578 |
return create_drive_non_file (g, data);
|
|
|
151578 |
}
|
|
|
151578 |
|
|
|
151578 |
+#if 0 /* DISABLED IN RHEL 7 */
|
|
|
151578 |
static struct drive *
|
|
|
151578 |
create_drive_sheepdog (guestfs_h *g,
|
|
|
151578 |
const struct drive_create_data *data)
|
|
|
151578 |
@@ -391,6 +394,7 @@ create_drive_iscsi (guestfs_h *g,
|
|
|
151578 |
|
|
|
151578 |
return create_drive_non_file (g, data);
|
|
|
151578 |
}
|
|
|
151578 |
+#endif /* DISABLED IN RHEL 7 */
|
|
|
151578 |
|
|
|
151578 |
/**
|
|
|
151578 |
* Create the special F</dev/null> drive.
|
|
|
151578 |
@@ -826,6 +830,7 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename,
|
|
|
151578 |
drv = create_drive_file (g, &data);
|
|
|
151578 |
}
|
|
|
151578 |
}
|
|
|
151578 |
+#if 0 /* DISABLED IN RHEL 7 */
|
|
|
151578 |
else if (STREQ (protocol, "ftp")) {
|
|
|
151578 |
data.protocol = drive_protocol_ftp;
|
|
|
151578 |
drv = create_drive_curl (g, &data);
|
|
|
151578 |
@@ -850,6 +855,7 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename,
|
|
|
151578 |
data.protocol = drive_protocol_iscsi;
|
|
|
151578 |
drv = create_drive_iscsi (g, &data);
|
|
|
151578 |
}
|
|
|
151578 |
+#endif /* DISABLED IN RHEL 7 */
|
|
|
151578 |
else if (STREQ (protocol, "nbd")) {
|
|
|
151578 |
data.protocol = drive_protocol_nbd;
|
|
|
151578 |
drv = create_drive_nbd (g, &data);
|
|
|
151578 |
@@ -858,6 +864,7 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename,
|
|
|
151578 |
data.protocol = drive_protocol_rbd;
|
|
|
151578 |
drv = create_drive_rbd (g, &data);
|
|
|
151578 |
}
|
|
|
151578 |
+#if 0 /* DISABLED IN RHEL 7 */
|
|
|
151578 |
else if (STREQ (protocol, "sheepdog")) {
|
|
|
151578 |
data.protocol = drive_protocol_sheepdog;
|
|
|
151578 |
drv = create_drive_sheepdog (g, &data);
|
|
|
151578 |
@@ -870,6 +877,7 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename,
|
|
|
151578 |
data.protocol = drive_protocol_tftp;
|
|
|
151578 |
drv = create_drive_curl (g, &data);
|
|
|
151578 |
}
|
|
|
151578 |
+#endif /* DISABLED IN RHEL 7 */
|
|
|
151578 |
else {
|
|
|
e9bfca |
error (g, _("unknown protocol ‘%s’"), protocol);
|
|
|
151578 |
drv = NULL; /*FALLTHROUGH*/
|
|
|
151578 |
diff --git a/lib/guestfs.pod b/lib/guestfs.pod
|
|
|
e9bfca |
index d5a0e81e7..684f8dc6c 100644
|
|
|
151578 |
--- a/lib/guestfs.pod
|
|
|
151578 |
+++ b/lib/guestfs.pod
|
|
|
151578 |
@@ -714,70 +714,6 @@ servers. The server string is documented in
|
|
|
151578 |
L</guestfs_add_drive_opts>. The C<username> and C<secret> parameters are
|
|
|
151578 |
also optional, and if not given, then no authentication will be used.
|
|
|
151578 |
|
|
|
151578 |
-=head3 FTP, HTTP AND TFTP
|
|
|
151578 |
-
|
|
|
151578 |
-Libguestfs can access remote disks over FTP, FTPS, HTTP, HTTPS
|
|
|
151578 |
-or TFTP protocols.
|
|
|
151578 |
-
|
|
|
151578 |
-To do this, set the optional C<protocol> and C<server> parameters of
|
|
|
151578 |
-L</guestfs_add_drive_opts> like this:
|
|
|
151578 |
-
|
|
|
151578 |
- char **servers = { "www.example.org", NULL };
|
|
|
151578 |
- guestfs_add_drive_opts (g, "/disk.img",
|
|
|
151578 |
- GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",
|
|
|
151578 |
- GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "http",
|
|
|
151578 |
- GUESTFS_ADD_DRIVE_OPTS_SERVER, servers,
|
|
|
151578 |
- -1);
|
|
|
151578 |
-
|
|
|
151578 |
-The C<protocol> can be one of C<"ftp">, C<"ftps">, C<"http">,
|
|
|
151578 |
-C<"https"> or C<"tftp">.
|
|
|
151578 |
-
|
|
|
151578 |
-C<servers> (the C<server> parameter) is a list which must have a
|
|
|
151578 |
-single element. The single element is a string defining the web,
|
|
|
151578 |
-FTP or TFTP server. The format of this string is documented in
|
|
|
151578 |
-L</guestfs_add_drive_opts>.
|
|
|
151578 |
-
|
|
|
151578 |
-=head3 GLUSTER
|
|
|
151578 |
-
|
|
|
151578 |
-Libguestfs can access Gluster disks.
|
|
|
151578 |
-
|
|
|
151578 |
-To do this, set the optional C<protocol> and C<server> parameters of
|
|
|
151578 |
-L</guestfs_add_drive_opts> like this:
|
|
|
151578 |
-
|
|
|
151578 |
- char **servers = { "gluster.example.org:24007", NULL };
|
|
|
151578 |
- guestfs_add_drive_opts (g, "volname/image",
|
|
|
151578 |
- GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",
|
|
|
151578 |
- GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "gluster",
|
|
|
151578 |
- GUESTFS_ADD_DRIVE_OPTS_SERVER, servers,
|
|
|
151578 |
- -1);
|
|
|
151578 |
-
|
|
|
151578 |
-C<servers> (the C<server> parameter) is a list which must have a
|
|
|
151578 |
-single element. The single element is a string defining the Gluster
|
|
|
151578 |
-server. The format of this string is documented in
|
|
|
151578 |
-L</guestfs_add_drive_opts>.
|
|
|
151578 |
-
|
|
|
151578 |
-Note that gluster usually requires the client process (ie. libguestfs)
|
|
|
151578 |
-to run as B<root> and will give unfathomable errors if it is not
|
|
|
151578 |
-(eg. "No data available").
|
|
|
151578 |
-
|
|
|
151578 |
-=head3 ISCSI
|
|
|
151578 |
-
|
|
|
151578 |
-Libguestfs can access iSCSI disks remotely.
|
|
|
151578 |
-
|
|
|
151578 |
-To do this, set the optional C<protocol> and C<server> parameters like
|
|
|
151578 |
-this:
|
|
|
151578 |
-
|
|
|
151578 |
- char **server = { "iscsi.example.org:3000", NULL };
|
|
|
151578 |
- guestfs_add_drive_opts (g, "target-iqn-name/lun",
|
|
|
151578 |
- GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",
|
|
|
151578 |
- GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "iscsi",
|
|
|
151578 |
- GUESTFS_ADD_DRIVE_OPTS_SERVER, server,
|
|
|
151578 |
- -1);
|
|
|
151578 |
-
|
|
|
151578 |
-The C<server> parameter is a list which must have a single element.
|
|
|
151578 |
-The single element is a string defining the iSCSI server. The format
|
|
|
151578 |
-of this string is documented in L</guestfs_add_drive_opts>.
|
|
|
151578 |
-
|
|
|
151578 |
=head3 NETWORK BLOCK DEVICE
|
|
|
151578 |
|
|
|
151578 |
Libguestfs can access Network Block Device (NBD) disks remotely.
|
|
|
151578 |
@@ -840,42 +776,6 @@ L<https://bugs.launchpad.net/qemu/+bug/1155677>
|
|
|
151578 |
|
|
|
151578 |
=back
|
|
|
151578 |
|
|
|
151578 |
-=head3 SHEEPDOG
|
|
|
151578 |
-
|
|
|
151578 |
-Libguestfs can access Sheepdog disks.
|
|
|
151578 |
-
|
|
|
151578 |
-To do this, set the optional C<protocol> and C<server> parameters of
|
|
|
151578 |
-L</guestfs_add_drive_opts> like this:
|
|
|
151578 |
-
|
|
|
151578 |
- char **servers = { /* optional servers ... */ NULL };
|
|
|
151578 |
- guestfs_add_drive_opts (g, "volume",
|
|
|
151578 |
- GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",
|
|
|
151578 |
- GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "sheepdog",
|
|
|
151578 |
- GUESTFS_ADD_DRIVE_OPTS_SERVER, servers,
|
|
|
151578 |
- -1);
|
|
|
151578 |
-
|
|
|
151578 |
-The optional list of C<servers> may be zero or more server addresses
|
|
|
151578 |
-(C<"hostname:port">). The format of the server strings is documented
|
|
|
151578 |
-in L</guestfs_add_drive_opts>.
|
|
|
151578 |
-
|
|
|
151578 |
-=head3 SSH
|
|
|
151578 |
-
|
|
|
151578 |
-Libguestfs can access disks over a Secure Shell (SSH) connection.
|
|
|
151578 |
-
|
|
|
151578 |
-To do this, set the C<protocol> and C<server> and (optionally)
|
|
|
151578 |
-C<username> parameters of L</guestfs_add_drive_opts> like this:
|
|
|
151578 |
-
|
|
|
151578 |
- char **server = { "remote.example.com", NULL };
|
|
|
151578 |
- guestfs_add_drive_opts (g, "/path/to/disk.img",
|
|
|
151578 |
- GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",
|
|
|
151578 |
- GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "ssh",
|
|
|
151578 |
- GUESTFS_ADD_DRIVE_OPTS_SERVER, server,
|
|
|
151578 |
- GUESTFS_ADD_DRIVE_OPTS_USERNAME, "remoteuser",
|
|
|
151578 |
- -1);
|
|
|
151578 |
-
|
|
|
151578 |
-The format of the server string is documented in
|
|
|
151578 |
-L</guestfs_add_drive_opts>.
|
|
|
151578 |
-
|
|
|
151578 |
=head2 INSPECTION
|
|
|
151578 |
|
|
|
151578 |
Libguestfs has APIs for inspecting an unknown disk image to find out
|
|
|
151578 |
diff --git a/tests/disks/test-qemu-drive-libvirt.sh b/tests/disks/test-qemu-drive-libvirt.sh
|
|
|
e9bfca |
index ab8052de1..ad22b2fbb 100755
|
|
|
151578 |
--- a/tests/disks/test-qemu-drive-libvirt.sh
|
|
|
151578 |
+++ b/tests/disks/test-qemu-drive-libvirt.sh
|
|
|
151578 |
@@ -64,34 +64,6 @@ check_output
|
|
|
151578 |
grep -sq -- '-drive file=rbd:abc-def/ghi-jkl:auth_supported=none,' "$DEBUG_QEMU_FILE" || fail ceph2
|
|
|
151578 |
rm "$DEBUG_QEMU_FILE"
|
|
|
151578 |
|
|
|
151578 |
-# Gluster.
|
|
|
151578 |
-
|
|
|
151578 |
-$guestfish -d gluster run ||:
|
|
|
151578 |
-check_output
|
|
|
151578 |
-grep -sq -- '-drive file=gluster://1.2.3.4:1234/volname/image,' "$DEBUG_QEMU_FILE" || fail gluster
|
|
|
151578 |
-rm "$DEBUG_QEMU_FILE"
|
|
|
151578 |
-
|
|
|
151578 |
-# iSCSI.
|
|
|
151578 |
-
|
|
|
151578 |
-$guestfish -d iscsi run ||:
|
|
|
151578 |
-check_output
|
|
|
151578 |
-grep -sq -- '-drive file=iscsi://1.2.3.4:1234/iqn.2003-01.org.linux-iscsi.fedora' "$DEBUG_QEMU_FILE" || fail iscsi
|
|
|
151578 |
-rm "$DEBUG_QEMU_FILE"
|
|
|
151578 |
-
|
|
|
151578 |
-# NBD.
|
|
|
151578 |
-
|
|
|
151578 |
-$guestfish -d nbd run ||:
|
|
|
151578 |
-check_output
|
|
|
151578 |
-grep -sq -- '-drive file=nbd:1.2.3.4:1234,' "$DEBUG_QEMU_FILE" || fail nbd
|
|
|
151578 |
-rm "$DEBUG_QEMU_FILE"
|
|
|
151578 |
-
|
|
|
151578 |
-# Sheepdog.
|
|
|
151578 |
-
|
|
|
151578 |
-$guestfish -d sheepdog run ||:
|
|
|
151578 |
-check_output
|
|
|
151578 |
-grep -sq -- '-drive file=sheepdog:volume,' "$DEBUG_QEMU_FILE" || fail sheepdog
|
|
|
151578 |
-rm "$DEBUG_QEMU_FILE"
|
|
|
151578 |
-
|
|
|
151578 |
# Local, stored in a pool.
|
|
|
151578 |
|
|
|
151578 |
$guestfish -d pool1 run ||:
|
|
|
151578 |
diff --git a/tests/disks/test-qemu-drive.sh b/tests/disks/test-qemu-drive.sh
|
|
|
151578 |
index 19dd60a2f..583e031bd 100755
|
|
|
151578 |
--- a/tests/disks/test-qemu-drive.sh
|
|
|
151578 |
+++ b/tests/disks/test-qemu-drive.sh
|
|
|
151578 |
@@ -62,45 +62,6 @@ check_output
|
|
|
151578 |
grep -sq -- '-drive file=rbd:abc-def/ghi-jkl:auth_supported=none,' "$DEBUG_QEMU_FILE" || fail
|
|
|
151578 |
rm "$DEBUG_QEMU_FILE"
|
|
|
151578 |
|
|
|
151578 |
-# HTTP.
|
|
|
151578 |
-
|
|
|
151578 |
-guestfish <
|
|
|
151578 |
- add "/disk.img" "format:raw" "protocol:http" "server:www.example.com"
|
|
|
151578 |
- run
|
|
|
151578 |
-EOF
|
|
|
151578 |
-check_output
|
|
|
151578 |
-grep -sq -- '-drive file=http://www.example.com/disk.img,' "$DEBUG_QEMU_FILE" || fail
|
|
|
151578 |
-rm "$DEBUG_QEMU_FILE"
|
|
|
151578 |
-
|
|
|
151578 |
-# Gluster.
|
|
|
151578 |
-
|
|
|
151578 |
-guestfish <
|
|
|
151578 |
- add "volname/image" "format:raw" "protocol:gluster" "server:www.example.com:24007"
|
|
|
151578 |
- run
|
|
|
151578 |
-EOF
|
|
|
151578 |
-check_output
|
|
|
151578 |
-grep -sq -- '-drive file=gluster://www.example.com:24007/volname/image,' "$DEBUG_QEMU_FILE" || fail
|
|
|
151578 |
-rm "$DEBUG_QEMU_FILE"
|
|
|
151578 |
-
|
|
|
151578 |
-# iSCSI.
|
|
|
151578 |
-
|
|
|
151578 |
-guestfish <
|
|
|
151578 |
- add "target-iqn-name/lun" "format:raw" "protocol:iscsi" "server:www.example.com:3000"
|
|
|
151578 |
- run
|
|
|
151578 |
-EOF
|
|
|
151578 |
-check_output
|
|
|
151578 |
-grep -sq -- '-drive file=iscsi://www.example.com:3000/target-iqn-name/lun,' "$DEBUG_QEMU_FILE" || fail
|
|
|
151578 |
-rm "$DEBUG_QEMU_FILE"
|
|
|
151578 |
-
|
|
|
151578 |
-guestfish <
|
|
|
151578 |
- add "target-iqn-name/lun" "format:raw" "protocol:iscsi" "server:www.example.com:3000" \
|
|
|
151578 |
- "username:user" "secret:pass"
|
|
|
151578 |
- run
|
|
|
151578 |
-EOF
|
|
|
151578 |
-check_output
|
|
|
151578 |
-grep -sq -- '-drive file=iscsi://user%pass@www.example.com:3000/target-iqn-name/lun,' "$DEBUG_QEMU_FILE" || fail
|
|
|
151578 |
-rm "$DEBUG_QEMU_FILE"
|
|
|
151578 |
-
|
|
|
151578 |
# NBD.
|
|
|
151578 |
|
|
|
151578 |
guestfish <
|
|
|
151578 |
@@ -118,24 +79,3 @@ EOF
|
|
|
151578 |
check_output
|
|
|
151578 |
grep -sq -- '-drive file=nbd:unix:/socket,' "$DEBUG_QEMU_FILE" || fail
|
|
|
151578 |
rm "$DEBUG_QEMU_FILE"
|
|
|
151578 |
-
|
|
|
151578 |
-# Sheepdog.
|
|
|
151578 |
-
|
|
|
151578 |
-guestfish <
|
|
|
151578 |
- add "volume" "format:raw" "protocol:sheepdog"
|
|
|
151578 |
- run
|
|
|
151578 |
-EOF
|
|
|
151578 |
-check_output
|
|
|
151578 |
-grep -sq -- '-drive file=sheepdog:volume,' "$DEBUG_QEMU_FILE" || fail
|
|
|
151578 |
-rm "$DEBUG_QEMU_FILE"
|
|
|
151578 |
-
|
|
|
151578 |
-# SSH.
|
|
|
151578 |
-
|
|
|
151578 |
-guestfish <
|
|
|
151578 |
- add "/disk.img" "format:raw" "protocol:ssh" "server:example.com" \
|
|
|
151578 |
- "username:rich"
|
|
|
151578 |
- run
|
|
|
151578 |
-EOF
|
|
|
151578 |
-check_output
|
|
|
151578 |
-grep -sq -- '-drive file=ssh://rich@example.com/disk.img,' "$DEBUG_QEMU_FILE" || fail
|
|
|
151578 |
-rm "$DEBUG_QEMU_FILE"
|
|
|
151578 |
--
|
|
|
3d5c2a |
2.17.2
|
|
|
151578 |
|