Windows Cluster Development-write Microsoft Cluster Server (MSC) Resource DLL: 8) write the resource DLL commands

Source: Internet
Author: User

Compiled resource DLL commands

As long as you pay close attention to several rules and guidelines, the compiled resource DLL is actually quite simple. Most of them have been discussed above. This section summarizes the key things to remember when writing resource DLL.

  • Use Visual C ++ 4.2b or later (ensure that the latest update is installed from www.microsoft.com) and the Platform SDK to compile resource DLL and cluster management extension DLL. A highly integrated development environment makes work quite easy. Similarly, use the Visual C ++ debugger or windbg to debug the DLL.

  • Initialize global data in the startup routine of resource DLL, and initialize resource-specific data in open.

  • In resource DLL, ensure that separated threads are used to perform time-consuming operations, such as opening resources, going online, going offline, and so on. The creation of the separation thread makes the communication process with the Resource Monitor (and the cluster service on it) more efficient. For example, it takes more than 300 milliseconds for resources to come online. If a separate thread is derived to complete this operation, the entry can be returned immediately.

  • If you do not want the resource DLL to be interrupted by the cluster service status query, an event handle is returned to notify the cluster service not to call looksalive. Then, use the event handle to send status information to the cluster service.

  • Use the callback function whenever possible. The callback function allows the resource DLL to communicate with the Resource Monitor asynchronously. In typical cases, resource DLL uses the logevent and setresourcestatus functions to record Resource Event Logs and debug resources for the cluster service. Call setresourcestatus to send status information to the Resource Monitor.

  • If you require cluster events, node events, group status changes, cluster database changes, or update Event Notifications to resources, create a cluster notification port (using createclusterpolicyport) to process event notifications. Note: If you use the notification port in multiple threads, be careful when competing. For example, one thread may call closeclusternotifyport to close the notification item, while the other thread calls getclusternotify, waiting to get information from the same port. To prevent this problem, add the cluster_change_handle_close check to the thread that calls getclusternotifternotify. For more information about Event Notifications and events that generate notifications, see the Platform SDK.

  • Supports the CLUSCTL_RESOURCE_GET_PRIVATE_PROPERTIES control function so that management tools such as Cluster. Exe can set those attributes that are still not set.

  • Supports the CLUSCTL_RESOURCE_VALIDATE_PRIVATE_PROPERTIES and CLUSCTL_RESOURCE_SET_PRIVATE_PROPERTIES controls so that resource DLL can be verified before the property is stored.

  • Supports the CLUSCTL_RESOURCE_TYPE_GET_PRIVATE_PROPERTIES, CLUSCTL_RESOURCE_TYPE_VALIDATE_PRIVATE_PROPERTIES, and CLUSCTL_RESOURCE_TYPE_SET_PRIVATE_PROPERTIES control functions. If the resource type has private attributes.

  • Supports the CLUSCTL_RESOURCE_GET_REQUIRED_DEPENDENCIES and CLUSCTL_RESOURCE_TYPE_GET_REQUIRED_DEPENDENCIES control functions. If the resource needs to depend on another resource.

  • If possible, read the attribute in the Open function. If it is not possible, it should be read in the Online function.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.