watcher.common.nova_helper
Module¶watcher.common.nova_helper.
NovaHelper
(osc=None)[source]¶Bases: object
create_image_from_instance
(instance_id, image_name, metadata={'reason': 'instance_migrate'})[source]¶This method creates a new image from a given instance.
It waits for this image to be in ‘active’ state before returning. It returns the unique UUID of the created image if successful, None otherwise.
Parameters: |
|
---|
create_instance
(node_id, inst_name='test', image_id=None, flavor_name='m1.tiny', sec_group_list=['default'], network_names_list=['demo-net'], keypair_name='mykeys', create_new_floating_ip=True, block_device_mapping_v2=None)[source]¶This method creates a new instance
It also creates, if requested, a new floating IP and associates it with the new instance It returns the unique id of the created instance.
delete_instance
(instance_id)[source]¶This method deletes a given instance.
Parameters: | instance_id – the unique id of the instance to delete. |
---|
get_network_id_from_name
(net_name='private')[source]¶This method returns the unique id of the provided network name
get_security_group_id_from_name
(group_name='default')[source]¶This method returns the security group of the provided group name
live_migrate_instance
(instance_id, dest_hostname, retry=120)[source]¶This method does a live migration of a given instance
This method uses the Nova built-in live_migrate() action to do a live migration of a given instance.
It returns True if the migration was successful, False otherwise.
Parameters: |
|
---|
resize_instance
(instance_id, flavor, retry=120)[source]¶This method resizes given instance with specified flavor.
This method uses the Nova built-in resize() action to do a resize of a given instance.
It returns True if the resize was successful, False otherwise.
Parameters: |
|
---|
stop_instance
(instance_id)[source]¶This method stops a given instance.
Parameters: | instance_id – the unique id of the instance to stop. |
---|
swap_volume
(old_volume, new_volume, retry=120, retry_interval=10)[source]¶Swap old_volume for new_volume
wait_for_instance_state
(server, state, retry, sleep)[source]¶Waits for server to be in a specific state
The state can be one of the following : active, stopped
Parameters: |
|
---|
wait_for_instance_status
(instance, status_list, retry, sleep)[source]¶Waits for instance to be in a specific status
The status can be one of the following : BUILD, ACTIVE, ERROR, VERIFY_RESIZE, SHUTOFF
Parameters: |
|
---|
wait_for_volume_status
(volume, status, timeout=60, poll_interval=1)[source]¶Wait until volume reaches given status.
Parameters: |
|
---|
watcher_non_live_migrate_instance
(instance_id, dest_hostname, keep_original_image_name=True, retry=120)[source]¶This method migrates a given instance
using an image of this instance and creating a new instance from this image. It saves some configuration information about the original instance : security group, list of networks, list of attached volumes, floating IP, … in order to apply the same settings to the new instance. At the end of the process the original instance is deleted. It returns True if the migration was successful, False otherwise.
if destination hostname not given, this method calls nova api to migrate the instance.
Parameters: |
|
---|
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.