2 def __init__(self
, name
, id=None, flavor
=None, image
=None, command
=None, nw_list
=None):
5 self
.template_name
= None
9 self
.port_names
= list()
11 self
.son_emu_command
= None
12 self
.emulator_compute
= None
14 def compare_attributes(self
, other
):
16 Compares only class attributes like name and flavor but not the list of ports with the other server.
18 :param other: The second server to compare with.
19 :type other: :class:`heat.resources.server`
20 :return: * *True*: If all attributes are alike.
24 if self
.name
== other
.name
and self
.full_name
== other
.full_name
and \
25 self
.flavor
== other
.flavor
and \
26 self
.image
== other
.image
and \
27 self
.command
== other
.command
:
31 def __eq__(self
, other
):
32 if self
.name
== other
.name
and self
.full_name
== other
.full_name
and \
33 self
.flavor
== other
.flavor
and \
34 self
.image
== other
.image
and \
35 self
.command
== other
.command
and \
36 len(self
.port_names
) == len(other
.port_names
) and \
37 set(self
.port_names
) == set(other
.port_names
):
41 def create_server_dict(self
, compute
=None):
43 Creates the server description dictionary.
45 :param compute: The compute resource for further status information.
46 :type compute: :class:`heat.compute`
47 :return: Server description dictionary.
51 server_dict
['name'] = self
.name
52 server_dict
['full_name'] = self
.full_name
53 server_dict
['id'] = self
.id
54 server_dict
['template_name'] = self
.template_name
55 server_dict
['flavor'] = self
.flavor
56 server_dict
['image'] = self
.image
57 if self
.son_emu_command
is not None:
58 server_dict
['command'] = self
.son_emu_command
60 server_dict
['command'] = self
.command
62 if compute
is not None:
63 server_dict
['status'] = 'ACTIVE'
64 server_dict
['OS-EXT-STS:power_state'] = 1
65 server_dict
["OS-EXT-STS:task_state"] = None