Skip to content

Commit 3dba689

Browse files
miguelaferreiranvazquez
authored andcommitted
Add helper method to migrate router vms
1 parent 88774a9 commit 3dba689

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

tools/marvin/marvin/lib/common.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,17 @@
5656
listVirtualRouterElements,
5757
listNetworkOfferings,
5858
listResourceLimits,
59-
listVPCOfferings)
59+
listVPCOfferings,
60+
migrateSystemVm)
6061
from marvin.sshClient import SshClient
6162
from marvin.codes import (PASS, FAILED, ISOLATED_NETWORK, VPC_NETWORK,
6263
BASIC_ZONE, FAIL, NAT_RULE, STATIC_NAT_RULE,
6364
RESOURCE_PRIMARY_STORAGE, RESOURCE_SECONDARY_STORAGE,
6465
RESOURCE_CPU, RESOURCE_MEMORY, PUBLIC_TRAFFIC,
6566
GUEST_TRAFFIC, MANAGEMENT_TRAFFIC, STORAGE_TRAFFIC,
6667
VMWAREDVS)
67-
from marvin.lib.utils import (validateList,
68-
xsplit,
68+
from marvin.lib.utils import (validateList,
69+
xsplit,
6970
get_process_status,
7071
random_gen,
7172
format_volume_to_ext3)
@@ -1419,13 +1420,13 @@ def isNetworkDeleted(apiclient, networkid, timeout=600):
14191420
return networkDeleted
14201421

14211422

1422-
def createChecksum(service=None,
1423-
virtual_machine=None,
1424-
disk=None,
1423+
def createChecksum(service=None,
1424+
virtual_machine=None,
1425+
disk=None,
14251426
disk_type=None):
14261427

14271428
""" Calculate the MD5 checksum of the disk by writing \
1428-
data on the disk where disk_type is either root disk or data disk
1429+
data on the disk where disk_type is either root disk or data disk
14291430
@return: returns the calculated checksum"""
14301431

14311432
random_data_0 = random_gen(size=100)
@@ -1440,7 +1441,7 @@ def createChecksum(service=None,
14401441
virtual_machine.username,
14411442
virtual_machine.password
14421443
)
1443-
except Exception:
1444+
except Exception:
14441445
raise Exception("SSH access failed for server with IP address: %s" %
14451446
virtual_machine.ssh_ip)
14461447

@@ -1898,3 +1899,10 @@ def verifyVCenterPortGroups(
18981899
except Exception as e:
18991900
return [FAIL, e]
19001901
return [PASS, None]
1902+
1903+
def migrate_router(apiclient, router_id, host_id):
1904+
cmd = migrateSystemVm.migrateSystemVmCmd()
1905+
cmd.hostid = host_id
1906+
cmd.virtualmachineid = router_id
1907+
1908+
apiclient.migrateSystemVm(cmd)

0 commit comments

Comments
 (0)