Switching to the latest Jail Config format has performance benefits and enables features that have been introduced in libioc.
As usual, libioc treats operations that modify existing jails with caution. As precaution a snapshot is automatically created before migrating a jail, so that jails are never left in a defect state.
Note: Jails that have been migrated might no longer been seen by iocage_legacy.
ioc migrate my-jail
The programmatic migration of jails can be achieved by changing a jails configuration format and renaming its dataset.
While the [implementation of the ioc CLI tool] is a great reference for migration with the Python Module, a simplified procedure can be broken down to
import ioc
jail = ioc.Jail("0BAD1DEA") # short UUID
jail.rename(jail.tag)
jail.config_type = "json"
jail.save()