The watcher.decision_engine.model.model_root Module

The watcher.decision_engine.model.model_root Module

Openstack implementation of the cluster graph.

class watcher.decision_engine.model.model_root.BaremetalModelRoot(stale=False)[source]

Bases: networkx.classes.digraph.DiGraph, watcher.decision_engine.model.base.Model

Cluster graph for an Openstack cluster: Baremetal Cluster.

add_node(**kwargs)[source]

Add a single node node_for_adding and update node attributes.

Parameters:
  • node_for_adding (node) – A node can be any hashable Python object except None.
  • attr (keyword arguments, optional) – Set or change node attributes using key=value.

See also

add_nodes_from()

Examples

>>> G = nx.Graph()   # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> G.add_node(1)
>>> G.add_node('Hello')
>>> K3 = nx.Graph([(0, 1), (1, 2), (2, 0)])
>>> G.add_node(K3)
>>> G.number_of_nodes()
3

Use keywords set/change node attributes:

>>> G.add_node(1, size=10)
>>> G.add_node(3, weight=0.4, UTM=('13S', 382871, 3972649))

Notes

A hashable object is one that can be used as a key in a Python dictionary. This includes strings, numbers, tuples of strings and numbers, etc.

On many platforms hashable items also include mutables such as NetworkX Graphs, though one should be careful that the hash doesn’t change on mutables.

static assert_node(obj)[source]
classmethod from_xml(data)[source]
get_all_ironic_nodes(**kwargs)[source]
get_node_by_uuid(**kwargs)[source]
classmethod is_isomorphic(G1, G2)[source]
remove_node(**kwargs)[source]

Remove node n.

Removes the node n and all adjacent edges. Attempting to remove a non-existent node will raise an exception.

Parameters:n (node) – A node in the graph
Raises:NetworkXError – If n is not in the graph.

See also

remove_nodes_from()

Examples

>>> G = nx.path_graph(3)  # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> list(G.edges)
[(0, 1), (1, 2)]
>>> G.remove_node(1)
>>> list(G.edges)
[]
to_string()[source]
to_xml()[source]
class watcher.decision_engine.model.model_root.ModelRoot(stale=False)[source]

Bases: networkx.classes.digraph.DiGraph, watcher.decision_engine.model.base.Model

Cluster graph for an Openstack cluster.

add_instance(**kwargs)[source]
add_node(**kwargs)[source]

Add a single node node_for_adding and update node attributes.

Parameters:
  • node_for_adding (node) – A node can be any hashable Python object except None.
  • attr (keyword arguments, optional) – Set or change node attributes using key=value.

See also

add_nodes_from()

Examples

>>> G = nx.Graph()   # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> G.add_node(1)
>>> G.add_node('Hello')
>>> K3 = nx.Graph([(0, 1), (1, 2), (2, 0)])
>>> G.add_node(K3)
>>> G.number_of_nodes()
3

Use keywords set/change node attributes:

>>> G.add_node(1, size=10)
>>> G.add_node(3, weight=0.4, UTM=('13S', 382871, 3972649))

Notes

A hashable object is one that can be used as a key in a Python dictionary. This includes strings, numbers, tuples of strings and numbers, etc.

On many platforms hashable items also include mutables such as NetworkX Graphs, though one should be careful that the hash doesn’t change on mutables.

static assert_instance(obj)[source]
static assert_node(obj)[source]
delete_instance(instance, node=None)[source]
classmethod from_xml(data)[source]
get_all_compute_nodes(**kwargs)[source]
get_all_instances(**kwargs)[source]
get_instance_by_uuid(**kwargs)[source]
get_node_by_instance_uuid(**kwargs)[source]
get_node_by_uuid(**kwargs)[source]
get_node_instances(**kwargs)[source]
classmethod is_isomorphic(G1, G2)[source]
map_instance(**kwargs)[source]

Map a newly created instance to a node

Parameters:
migrate_instance(**kwargs)[source]

Migrate single instance from source_node to destination_node

Parameters:
  • instance
  • source_node
  • destination_node
Returns:

remove_instance(**kwargs)[source]
remove_node(**kwargs)[source]

Remove node n.

Removes the node n and all adjacent edges. Attempting to remove a non-existent node will raise an exception.

Parameters:n (node) – A node in the graph
Raises:NetworkXError – If n is not in the graph.

See also

remove_nodes_from()

Examples

>>> G = nx.path_graph(3)  # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> list(G.edges)
[(0, 1), (1, 2)]
>>> G.remove_node(1)
>>> list(G.edges)
[]
to_string()[source]
to_xml()[source]
unmap_instance(**kwargs)[source]
class watcher.decision_engine.model.model_root.StorageModelRoot(stale=False)[source]

Bases: networkx.classes.digraph.DiGraph, watcher.decision_engine.model.base.Model

Cluster graph for an Openstack cluster.

add_node(**kwargs)[source]

Add a single node node_for_adding and update node attributes.

Parameters:
  • node_for_adding (node) – A node can be any hashable Python object except None.
  • attr (keyword arguments, optional) – Set or change node attributes using key=value.

See also

add_nodes_from()

Examples

>>> G = nx.Graph()   # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> G.add_node(1)
>>> G.add_node('Hello')
>>> K3 = nx.Graph([(0, 1), (1, 2), (2, 0)])
>>> G.add_node(K3)
>>> G.number_of_nodes()
3

Use keywords set/change node attributes:

>>> G.add_node(1, size=10)
>>> G.add_node(3, weight=0.4, UTM=('13S', 382871, 3972649))

Notes

A hashable object is one that can be used as a key in a Python dictionary. This includes strings, numbers, tuples of strings and numbers, etc.

On many platforms hashable items also include mutables such as NetworkX Graphs, though one should be careful that the hash doesn’t change on mutables.

add_pool(**kwargs)[source]
add_volume(**kwargs)[source]
static assert_node(obj)[source]
static assert_pool(obj)[source]
static assert_volume(obj)[source]
delete_volume(volume)[source]
classmethod from_xml(data)[source]
get_all_storage_nodes(**kwargs)[source]
get_all_volumes(**kwargs)[source]
get_node_by_name(**kwargs)[source]

Get a node by node name

Parameters:nodeStorageNode object or node name
get_node_by_pool_name(**kwargs)[source]
get_node_pools(**kwargs)[source]
get_pool_by_pool_name(**kwargs)[source]
get_pool_by_volume(**kwargs)[source]
get_pool_volumes(**kwargs)[source]
get_volume_by_uuid(**kwargs)[source]
classmethod is_isomorphic(G1, G2)[source]
map_pool(**kwargs)[source]

Map a newly created pool to a node

Parameters:
  • poolPool object or pool name
  • nodeStorageNode object or node host
map_volume(**kwargs)[source]

Map a newly created volume to a pool

Parameters:
  • volumeVolume object or volume UUID
  • poolPool object or pool name
remove_node(**kwargs)[source]

Remove node n.

Removes the node n and all adjacent edges. Attempting to remove a non-existent node will raise an exception.

Parameters:n (node) – A node in the graph
Raises:NetworkXError – If n is not in the graph.

See also

remove_nodes_from()

Examples

>>> G = nx.path_graph(3)  # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> list(G.edges)
[(0, 1), (1, 2)]
>>> G.remove_node(1)
>>> list(G.edges)
[]
remove_pool(**kwargs)[source]
remove_volume(**kwargs)[source]
to_string()[source]
to_xml()[source]
unmap_pool(**kwargs)[source]

Unmap a pool from a node

Parameters:
  • poolPool object or pool name
  • nodeStorageNode object or node name
unmap_volume(**kwargs)[source]

Unmap a volume from a pool

Parameters:
  • volumeVolume object or volume UUID
  • poolPool object or pool name
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.