Repository URL to install this package:
|
Version:
5.2.8.26 ▾
|
import json
from jsonschema import validate
migration_options = \
{
'target': 'openstack',
'migration_type': 'warm',
'power_off_vm_post_migrate': False,
'openstack': {
'instances':
[
{
'id': '6da5223d-6865-4c76-8551-e52f03dcca19', # identifies the VMware VM
'name': 'migrated', # new name for the migrated instance
'include': True, # False if you want to exclude this instance from
'image_source': "ab6a7f2e-c72b-4c8a-a5c2-ddda28973107",
'power': { # the order in which we need to poweron the vm
'sequence': 1,
},
'use_cinder_boot_volume': True,
# if flavor exists, reuse the flavor or
# create a new flavor
'flavor': { # flavor of the vm. If migration flow finds a
# flavor that matches these attributes, it uses
# the flavor id.
'vcpus': 1,
'ram': 8, # otherwise it creates new flavor, depends on the
'disk': 20, # permissions of the user
'ephemeral': True,
'swap': 8,
},
# First try attaching to the following network.
# Each network is keyed of the mac address of the original VM.
# if there is no mention of mac address, then it tries to
# migrate the VM to the original network. Otherwise it
# tries to find the new network from the networks_mapping
# stanza. If it can't find a network, migration fails
'nics': [
{
"mac_address": "fa:16:3e:3b:e8:dc",
'network': {
"id": "ab6a7f2e-c72b-4c8a-a5c2-ddda28973107",
'subnet': {
"id": "bf4efb22-a40f-4a29-a830-a3ed899c7560",
},
},
},
{
"mac_address": "fa:16:3e:1a:fa:b8",
'network': {
"id": "9455c1f9-15b1-45cd-bdef-b47b14b075cb",
'subnet': {
"id": "47b53ea3-0377-413c-ad11-4c4eaba41d8b",
},
},
},
],
},
],
'networks_mapping': {
# We only need private networking
'private': [
{
# private
'vmware_network': {
'id': 'd9bd4be8-2488-4bdd-8c01-e05e576228a8',
'subnet': {
"id": "9cd0b99f-6553-4707-8910-3fe345377a96",
},
},
# OpenStack tenant-network
'target_network': {
'id': 'ab6a7f2e-c72b-4c8a-a5c2-ddda28973107',
'subnet': {
"id": "bf4efb22-a40f-4a29-a830-a3ed899c7560",
},
},
},
{
# private1
'vmware_network': {
'id': '6f22610c-c299-40bb-a7dd-bbeb20fbd210',
'subnet': {
"id": "c7e4904f-4806-4a37-b44d-57e52b7a7828",
},
},
# OpenStack tenant network
'target_network': {
'id': '9455c1f9-15b1-45cd-bdef-b47b14b075cb.bak',
'subnet': {
"id": "47b53ea3-0377-413c-ad11-4c4eaba41d8b",
},
},
},
],
},
'storage_mapping': [
{
'VMware_datastore1': {
'name': 'datastore1'
},
'storage_type1': {
'name': 'type1'
},
},
],
},
}
with open("migration-options.json.schema", "r") as f:
schema = json.load(f)
validate(instance=migration_options, schema=schema)