Revision e1c0be02
b/image_creator/image.py | ||
---|---|---|
33 | 33 |
# interpreted as representing official policies, either expressed |
34 | 34 |
# or implied, of GRNET S.A. |
35 | 35 |
|
36 |
from image_creator.util import FatalError |
|
36 |
from image_creator.util import FatalError, check_guestfs_version
|
|
37 | 37 |
from image_creator.gpt import GPTPartitionTable |
38 | 38 |
from image_creator.os_type import os_cls |
39 | 39 |
|
... | ... | |
64 | 64 |
# file descriptors. This can cause problems especially if the parent |
65 | 65 |
# process has opened pipes. Since the recovery process is an optional |
66 | 66 |
# feature of libguestfs, it's better to disable it. |
67 |
self.g.set_recovery_proc(0) |
|
68 |
version = self.g.version() |
|
69 |
if version['major'] > 1 or \ |
|
70 |
(version['major'] == 1 and (version['minor'] >= 18 or |
|
71 |
(version['minor'] == 17 and |
|
72 |
version['release'] >= 14))): |
|
73 |
self.g.set_recovery_proc(1) |
|
67 |
if check_guestfs_version(self.g, 1, 17, 14) >= 0: |
|
74 | 68 |
self.out.output("Enabling recovery proc") |
69 |
self.g.set_recovery_proc(1) |
|
70 |
else: |
|
71 |
self.g.set_recovery_proc(0) |
|
75 | 72 |
|
76 | 73 |
#self.g.set_trace(1) |
77 | 74 |
#self.g.set_verbose(1) |
b/image_creator/util.py | ||
---|---|---|
115 | 115 |
|
116 | 116 |
return checksum |
117 | 117 |
|
118 |
def check_guestfs_version(ghandler, major, minor, release): |
|
119 |
"""Checks if the version of the used libguestfs is smaller, equal or |
|
120 |
greater than the one specified by the major, minor and release triplet |
|
121 |
|
|
122 |
Returns: |
|
123 |
< 0 if the installed version is smaller than the specified one |
|
124 |
= 0 if they are equal |
|
125 |
> 0 if the installed one is greater than the specified one |
|
126 |
""" |
|
127 |
|
|
128 |
ver = ghandler.version() |
|
129 |
|
|
130 |
for (a, b) in (ver['major'], major), (ver['minor'], minor), \ |
|
131 |
(ver['release'], release): |
|
132 |
if a != b: |
|
133 |
return a - b |
|
134 |
|
|
135 |
return 0 |
|
136 |
|
|
118 | 137 |
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai : |
Also available in: Unified diff