Revision f198cf91

b/lib/cmdlib/instance.py
1408 1408
                                                  self.op.src_node_uuid,
1409 1409
                                                  self.pnode.uuid,
1410 1410
                                                  self.pnode.secondary_ip,
1411
                                                  constants.IEC_NONE,
1411 1412
                                                  iobj, transfers)
1412 1413
          if not compat.all(import_result):
1413 1414
            self.LogWarning("Some disks for instance %s on node %s were not"
......
1838 1839
                                            source_node.uuid,
1839 1840
                                            target_node.uuid,
1840 1841
                                            target_node.secondary_ip,
1842
                                            self.op.compress,
1841 1843
                                            self.instance, transfers)
1842 1844
    if not compat.all(import_result):
1843 1845
      errs.append("Failed to transfer instance data")
b/lib/ht.py
540 540
TEvacMode = TElemOf(constants.NODE_EVAC_MODES)
541 541
TIAllocatorTestDir = TElemOf(constants.VALID_IALLOCATOR_DIRECTIONS)
542 542
TIAllocatorMode = TElemOf(constants.VALID_IALLOCATOR_MODES)
543
TImportExportCompression = TElemOf(constants.IEC_ALL)
543 544

  
544 545

  
545 546
def TSetParamsMods(fn):
b/lib/masterd/instance.py
1007 1007

  
1008 1008

  
1009 1009
def TransferInstanceData(lu, feedback_fn, src_node_uuid, dest_node_uuid,
1010
                         dest_ip, instance, all_transfers):
1010
                         dest_ip, compress, instance, all_transfers):
1011 1011
  """Transfers an instance's data from one node to another.
1012 1012

  
1013 1013
  @param lu: Logical unit instance
......
1018 1018
  @param dest_node_uuid: Destination node UUID
1019 1019
  @type dest_ip: string
1020 1020
  @param dest_ip: IP address of destination node
1021
  @type compress: string
1022
  @param compress: one of L{constants.IEC_ALL}
1021 1023
  @type instance: L{objects.Instance}
1022 1024
  @param instance: Instance object
1023 1025
  @type all_transfers: list of L{DiskTransfer} instances
......
1027 1029
           each transfer
1028 1030

  
1029 1031
  """
1030
  # Disable compression for all moves as these are all within the same cluster
1031
  compress = constants.IEC_NONE
1032

  
1033 1032
  src_node_name = lu.cfg.GetNodeName(src_node_uuid)
1034 1033
  dest_node_name = lu.cfg.GetNodeName(dest_node_uuid)
1035 1034

  
......
1254 1253
    dresults = TransferInstanceData(self._lu, self._feedback_fn,
1255 1254
                                    src_node_uuid, dest_node.uuid,
1256 1255
                                    dest_node.secondary_ip,
1256
                                    constants.IEC_NONE,
1257 1257
                                    instance, transfers)
1258 1258

  
1259 1259
    assert len(dresults) == len(instance.disks)
b/src/Ganeti/HsConstants.hs
544 544
-- * Import/export transport compression
545 545

  
546 546
iecGzip :: String
547
iecGzip = "gzip"
547
iecGzip = Types.importExportCompressionToRaw GZip
548 548

  
549 549
iecNone :: String
550
iecNone = "none"
550
iecNone = Types.importExportCompressionToRaw None
551 551

  
552
iecAll :: [String]
553
iecAll = [iecGzip, iecNone]
552
iecAll :: FrozenSet String
553
iecAll =
554
  ConstantUtils.mkSet $ map Types.importExportCompressionToRaw [minBound..]
554 555

  
555 556
ieCustomSize :: String
556 557
ieCustomSize = "fd"
b/src/Ganeti/OpCodes.hs
576 576
     , pIgnoreIpolicy
577 577
     , pMoveTargetNode
578 578
     , pMoveTargetNodeUuid
579
     , pMoveCompress
579 580
     , pIgnoreConsistency
580 581
     ],
581 582
     "instance_name")
b/src/Ganeti/OpParams.hs
83 83
  , pMigrationTargetNodeUuid
84 84
  , pMoveTargetNode
85 85
  , pMoveTargetNodeUuid
86
  , pMoveCompress
86 87
  , pStartupPaused
87 88
  , pVerbose
88 89
  , pDebugSimulateErrors
......
1241 1242
  renameField "MoveTargetNodeUuid" . optionalField $
1242 1243
  simpleField "target_node_uuid" [t| NonEmptyString |]
1243 1244

  
1245
pMoveCompress :: Field
1246
pMoveCompress =
1247
  withDoc "Compression mode to use during instance moves" .
1248
  defaultField [| None |] $
1249
  simpleField "compress" [t| ImportExportCompression |]
1250

  
1244 1251
pIgnoreDiskSize :: Field
1245 1252
pIgnoreDiskSize =
1246 1253
  withDoc "Whether to ignore recorded disk size" $
b/src/Ganeti/Types.hs
152 152
  , RpcTimeout(..)
153 153
  , rpcTimeoutFromRaw -- FIXME: no used anywhere
154 154
  , rpcTimeoutToRaw
155
  , ImportExportCompression(..)
156
  , importExportCompressionToRaw
155 157
  ) where
156 158

  
157 159
import Control.Monad (liftM)
......
834 836
  , ("FourHours", 4 * 3600) -- 4 hours
835 837
  , ("OneDay",    86400)    -- 1 day
836 838
  ])
839

  
840
$(THH.declareLADT ''String "ImportExportCompression"
841
  [ -- No compression
842
    ("None", "none")
843
    -- gzip compression
844
  , ("GZip", "gzip")
845
  ])
846
$(THH.makeJSONInstance ''ImportExportCompression)
847

  
848
instance THH.PyValue ImportExportCompression where
849
  showValue = THH.showValue . importExportCompressionToRaw
b/test/hs/Test/Ganeti/OpCodes.hs
80 80

  
81 81
$(genArbitrary ''DiskAccess)
82 82

  
83
$(genArbitrary ''ImportExportCompression)
84

  
83 85
instance Arbitrary OpCodes.DiskIndex where
84 86
  arbitrary = choose (0, C.maxDisks - 1) >>= OpCodes.mkDiskIndex
85 87

  
......
265 267
      "OP_INSTANCE_MOVE" ->
266 268
        OpCodes.OpInstanceMove <$> genFQDN <*> return Nothing <*>
267 269
          arbitrary <*> arbitrary <*> genNodeNameNE <*> return Nothing <*>
268
          arbitrary
270
          arbitrary <*> arbitrary
269 271
      "OP_INSTANCE_CONSOLE" -> OpCodes.OpInstanceConsole <$> genFQDN <*>
270 272
          return Nothing
271 273
      "OP_INSTANCE_ACTIVATE_DISKS" ->

Also available in: Unified diff