from arcapix.fs.gpfs.policy import PlacementPolicy
from arcapix.fs.gpfs.rule import MigrateRule

# load placement policy for mmfs1
policy = PlacementPolicy('mmfs1')

# create a new migrate rule for 'sata1'
r = MigrateRule(source='sata1', threshold=(90, 50))

# add rule to start of the policy
policy.rules.insert(r, 0)

# save changes
policy.save()

[((5, 9, 5, 33), 'arcapix.fs.gpfs.policy.PlacementPolicy', 'PlacementPolicy', ({(5, 25, 5, 32): '"""mmfs1"""'}, {}), "('mmfs1')", False, 'from arcapix.fs.gpfs.policy import PlacementPolicy\n'), ((8, 4, 8, 51), 'arcapix.fs.gpfs.rule.MigrateRule', 'MigrateRule', (), '', False, 'from arcapix.fs.gpfs.rule import MigrateRule\n')]