4
0

amfnode.c 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /** @file amfnode.c
  2. *
  3. * Copyright (c) 2006 Ericsson AB.
  4. * Author: Anders Eriksson
  5. *
  6. * All rights reserved.
  7. *
  8. *
  9. * This software licensed under BSD license, the text of which follows:
  10. *
  11. * Redistribution and use in source and binary forms, with or without
  12. * modification, are permitted provided that the following conditions are met:
  13. *
  14. * - Redistributions of source code must retain the above copyright notice,
  15. * this list of conditions and the following disclaimer.
  16. * - Redistributions in binary form must reproduce the above copyright notice,
  17. * this list of conditions and the following disclaimer in the documentation
  18. * and/or other materials provided with the distribution.
  19. * - Neither the name of the MontaVista Software, Inc. nor the names of its
  20. * contributors may be used to endorse or promote products derived from this
  21. * software without specific prior written permission.
  22. *
  23. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  24. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  25. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  26. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  27. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  28. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  29. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  30. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  31. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  32. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  33. * THE POSSIBILITY OF SUCH DAMAGE.
  34. *
  35. * AMF Node Class Implementation
  36. *
  37. * This file contains functions for handling AMF nodes. It can be
  38. * viewed as the implementation of the AMF Node class (called NODE)
  39. * as described in SAI-Overview-B.02.01. The SA Forum specification
  40. * SAI-AIS-AMF-B.02.01 has been used as specification of the behaviour
  41. * and is referred to as 'the spec' below.
  42. *
  43. * The functions in this file are responsible for:
  44. * - controlling the instantiation of the SUs hosted on current node and
  45. * controlling the assigning of workload to them when a node joins the
  46. * cluster (cluster start is controlled by the Cluster Class)
  47. * - controlling node level recovery and repair functions
  48. * - implementing error escallation level 2 and 3 (paragraph 3.12.2.2 and
  49. * 3.12.2.3 in the spec)
  50. * - handling run time attributes of the AMF NODE; cached
  51. * attributes are stored as variables and sent to the IMM service (future)
  52. * upon the changes described in the specification
  53. *
  54. * The node class contains the following state machines:
  55. * - administrative state machine (ADSM)
  56. * - operational state machine (OPSM)
  57. * - availability control state machine (ACSM)
  58. *
  59. * The administrative state machine will be implemented in the future.
  60. *
  61. * The operational state machine is primarily used to report status of the
  62. * node.
  63. *
  64. * The availability control state machine is used for control purposes.
  65. * ACSM contains three states of which two are composite.
  66. * Being a composite state means that the state contains substates.
  67. * ACSM states are:
  68. * - REPAIR_NEEDED
  69. * - ESCALLATION_LEVEL (LEVEL_0, LEVEL_2 and LEVEL_3)
  70. * - MANAGING_HOSTED_SERVICE_UNITS (
  71. * . FAILING_FAST (REBOOTING_NODE and ACTIVATING_STANDBY_NODE)
  72. * . FAILING_GRACEFULLY (SWITCHING_OVER, FAILING_OVER and REBOOTING_NODE)
  73. * . LEAVING_SPONTANEOUSLY (DEACTIVATE_DEPENDENT and
  74. * WAITING_FOR_NODE_TO_JOIN)
  75. * . JOINING (STARTING_SERVICE_UNITS, ASSIGNING_ACTIVE_WORKLOAD and
  76. * ASSIGNING_STANDBY_WORKLOAD)
  77. *
  78. * REPAIR_NEEDED indicates the node needs a manual repair and this state will
  79. * maintained until the administrative command REPAIRED is entered
  80. * (implemented in the future)
  81. *
  82. * ESCALLATION_LEVEL is a kind of idle state where no actions are performed
  83. * and used only to remember the escallation level. Substate LEVEL_0 indicates
  84. * no escallation. LEVEL_2 indicates that so many component restarts have been
  85. * executed recently that a new component restart request will escalate
  86. * to service unit restart action. Node will request a service unit restart
  87. * from SU.
  88. * LEVEL_3 will be entered if either there are too many service unit restarts
  89. * been made or a component failover recovery action is requested. On level 3
  90. * the recovery action performed is service unit failover (paragraph 3.12.1.3).
  91. *
  92. * FAILING_FAST state executes a node re-boot and waits for the node to join
  93. * the cluster again.
  94. *
  95. * FAILING_GRACEFULLY state requests all SGs which have SUs hosted on current
  96. * node to switch or failover according to the procedures described in
  97. * paragraphs 3.12.1.3 before re-boot is executed. Then the confirmation is
  98. * awaited from all concerned SGs and finally a node re-boot is executed as
  99. * the repair action (see paragraph 2.12.1.4).
  100. *
  101. * LEAVING_SPONTANEOUSLY state handles the spontaneous leave of a node.
  102. *
  103. * JOINING state handles the start of a node in all cases except cluster start,
  104. * which is handled by the CLUSTER class.
  105. *
  106. */