Skip to content

Commit

Permalink
Minor fixes to create_sparse_header().
Browse files Browse the repository at this point in the history
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@redhat.com>
  • Loading branch information
Chris Lalancette authored and imcleod committed Jun 29, 2011
1 parent 43336c7 commit 6c56acb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions VMDKstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,17 @@ def __str__(self):
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
numGTEsPerGT = 512
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
Expand Down

0 comments on commit 6c56acb

Please sign in to comment.