weizhouapache commented on code in PR #14320:
URL: https://github.com/apache/cloudstack/pull/14320#discussion_r4525692063


##########
scripts/vm/hypervisor/kvm/kvmha_rbd.py:
##########
@@ -0,0 +1,179 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Access to Ceph for kvmheartbeat_rbd.py and kvmvmactivity_rbd.py.
+#
+# The objects of the heartbeat and of the activity state, and the watchers of 
the
+# volumes, are read and written over one connection to the Ceph cluster with 
the
+# Python bindings of librados and librbd (the packages python3-rados and 
python3-rbd).
+# An operation which does not finish in TIMEOUT seconds fails, so that it does 
not
+# block forever if the cluster can not be reached.
+#
+# The cephx key is not an argument of the scripts, as it would be visible in 
the
+# process list: the scripts read it from the environment variable CEPH_KEY, 
and give
+# it to the bindings in their configuration.
+#
+# Nothing is written to the standard error output: the agent merges it with the
+# standard output and reads only the first line of the result, so a message of
+# librados would hide the result of the script.
+
+import os
+
+try:
+    import rados
+except ImportError:
+    rados = None
+
+try:
+    import rbd
+except ImportError:
+    rbd = None
+
+KEY_ENV = "CEPH_KEY"
+TIMEOUT = 30
+MAX_OBJECT_SIZE = 1024 * 1024
+# A heartbeat is written every <interval> seconds, but a write which starts on 
time can end up to TIMEOUT seconds
+# later when Ceph is slow, so the heartbeat of a host which is alive can be 
older than the interval.
+HEARTBEAT_SLACK = TIMEOUT

Review Comment:
   update PR to pass `heartbeat.update.timeout`, if not set, defaults to 2* 
timeout



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to