1) descriptorOffset is never set by callers, so just
hard-code it to 1 in the create_sparse_header method.
2) inFileSectors and descriptorSize are both required
for create_sparse_header to operate properly. If a
caller forgot one of them, None would be used and then
the struct.pack at the end would fail anyway. Just make
them required arguments.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
VMDKstream.py | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/VMDKstream.py b/VMDKstream.py
index 5b2fd8a..36a03ba 100755
--- a/VMDKstream.py
+++ b/VMDKstream.py
@@ -79,8 +79,8 @@ ddb.longContentID = "8f15b3d0009d9a3f456ff7b28d324d2a"
ddb.virtualHWVersion = "7"'''
-def create_sparse_header(inFileSectors = None, descriptorOffset = 1,
- descriptorSize = None, gdOffset = 0xFFFFFFFFFFFFFFFF):
+def create_sparse_header(inFileSectors, descriptorSize,
+ gdOffset = 0xFFFFFFFFFFFFFFFF):
# While theoretically variable we set these based on current VMWare
# convention
grainSize = 128
@@ -88,6 +88,8 @@ def create_sparse_header(inFileSectors = None, descriptorOffset = 1,
overHead = 128
formatVersion = 3 # NOTE: Conflicts with VMWare docs - determined by trial/error
+ descriptorOffset = 1
+
# The following are always fixed in the "stream-optimized" format we are
# creating
compressAlgorithm = 1
--
1.7.4.4