Revision 643d7283

b/snf-image-host/Makefile.am
1
if PITHOSIMGSUPPORT
2
pithos_backend_support=yes
3
else
4
pithos_backend_support=no
5
endif
6

  
7 1
if NETWORKIMGSUPPORT
8 2
network_backend_support=yes
9 3
else
......
16 10
variantsdir=${sysconfdir}/ganeti/snf-image/variants
17 11

  
18 12
dist_os_SCRIPTS = ${srcdir}/create ${srcdir}/import ${srcdir}/export \
19
			${srcdir}/rename ${srcdir}/verify
20
if PITHOSIMGSUPPORT
21
dist_os_SCRIPTS += ${srcdir}/pithcat
22
endif
23
	
13
			${srcdir}/rename ${srcdir}/verify ${srcdir}/pithcat
14

  
24 15
dist_os_DATA = ${srcdir}/ganeti_api_version ${srcdir}/parameters.list \
25 16
               ${srcdir}/variants.list
26 17

  
......
49 40
	   -e 's|@PROGRESS_MONITOR[@]|$(PROGRESS_MONITOR)|g' \
50 41
	   -e 's|@UNATTEND[@]|$(UNATTEND)|g' \
51 42
	   -e 's|@progress_monitor_support[@]|$(progress_monitor_support)|g' \
52
	   -e 's|@pithos_backend_support[@]|$(pithos_backend_support)|g' \
53 43
	   -e 's|@network_backend_support[@]|$(network_backend_support)|g'
54 44

  
55 45
%:%.in Makefile
b/snf-image-host/common.sh.in
26 26
CURL="curl"
27 27

  
28 28

  
29
pithos_backend_support="@pithos_backend_support@"
30 29
network_backend_support="@network_backend_support@"
31 30

  
32 31
CLEANUP=( )
......
193 192
    local id=$1
194 193

  
195 194
    if [[ "$id" =~ ^pithos: ]]; then
196
        if [ "$pithos_backend_support" = "yes" ]; then
197
            echo "pithos"
198
        else
199
            log_error "Retrieving images from pithos is not supported"
200
            exit 1
201
        fi
195
        echo "pithos"
202 196
    elif [[ "$id" =~ ^(http|ftp)s?: ]]; then
203 197
        if [ "$network_backend_support" = "yes" ]; then
204 198
            echo "network";
......
303 297
            # before we give up with an error. This is needed for kpartx when
304 298
            # dealing with ntfs partitions mounted through fuse. umount is not
305 299
            # synchronous and may return while the partition is still busy. A
306
            # premature attempt to delete partition mappings through kpartx on a
307
            # device that hosts previously mounted ntfs partition may fail with
308
            # an  `device-mapper: remove ioctl failed: Device or resource busy'
309
            # error. A sensible workaround for this is to wait for a while and
310
            # then try again.
300
            # premature attempt to delete partition mappings through kpartx on
301
            # a device that hosts previously mounted ntfs partition may fail
302
            # with errors like this one:
303
            # `device-mapper: remove ioctl failed: Device or resource busy'
304
            # A sensible workaround for this is to wait for a while and then
305
            # retry it.
311 306
            local cmd=${CLEANUP[$i]}
312 307
            $cmd || for interval in 0.25 0.5 1 2 4; do
313 308
            echo "Command $cmd failed!"
b/snf-image-host/configure.ac
7 7
AM_INIT_AUTOMAKE([1.9 foreign tar-ustar -Wall -Wno-portability])
8 8
AM_INIT_AUTOMAKE([subdir-objects])
9 9

  
10
AC_ARG_ENABLE([pithos_backend],
11
   AS_HELP_STRING([--enable-pithos-backend],
12
    [enable support for pithos-hosted images])
13
)
14
AS_IF([test "x$enable_pithos_backend" = "xyes"],,
15
    [AC_MSG_NOTICE(pithos backend support not enabled)])
16
AM_CONDITIONAL(PITHOSIMGSUPPORT, [test "x$enable_pithos_backend" = "xyes"])
17

  
18 10
AC_ARG_ENABLE([network_backend],
19 11
   AS_HELP_STRING([--enable-network-backend],
20 12
    [enable support for network-hosted images
b/snf-image-host/pithcat
26 26
"""
27 27

  
28 28
from optparse import OptionParser
29
from sys import exit, stdout
29
from sys import exit, stdout, stderr
30 30

  
31
from pithos.backends.modular import ModularBackend
31
try:
32
    from pithos.backends.modular import ModularBackend
33
except ImportError:
34
    stderr.write("Pithos backend was not found.\n")
35
    exit(2)
32 36

  
33 37

  
34 38
parser = OptionParser(usage='%prog [options] <URL>')

Also available in: Unified diff