]> xenbits.xensource.com Git - xcp/xen-api.git/commitdiff
Call /opt/xensource/sm/mpathcount.py after xapi started if root disk is multipathed
authorAlex Zeffertt <alex.zeffertt@eu.citrix.com>
Wed, 26 Jan 2011 17:39:04 +0000 (17:39 +0000)
committerAlex Zeffertt <alex.zeffertt@eu.citrix.com>
Wed, 26 Jan 2011 17:39:04 +0000 (17:39 +0000)
mpathcount.py now updates the host object when the root disk is multipathed as well
as updating pbd objects.  (It writes values into other-config to show XenCenter
how many paths are active and how many are failed.)

Normally it is multipathd  that calls mpathcount.py, but in the case of the root
disk the /dev/mapper node is created by the initrd before multipathd is started.

Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
scripts/init.d-xapi

index ccdc038966a2648703c64e3378b45d30c403fc65..a237a73922fb402de3cb41afd88dacea89f4b3f9 100755 (executable)
@@ -91,6 +91,15 @@ start() {
                        fi
                fi
 
+               # If running on multipath root we need to update
+               # the multipath info on the Host object
+               ROOT_PART_MAJOR=$(stat --format=%t /dev/root)
+               DEVICE_MAPPER_MAJOR=$(sed -ne 's/^\([0-9]\+\) device-mapper$/\1/p' /proc/devices)
+               DEVICE_MAPPER_MAJOR_HEX=$(printf "%x" ${DEVICE_MAPPER_MAJOR})
+               if [ "$ROOT_PART_MAJOR" == "$DEVICE_MAPPER_MAJOR_HEX" ] ; then
+                   /opt/xensource/sm/mpathcount.py
+               fi
+
                if [ -e ${XAPI_STARTUP_COOKIE} ]; then
                        touch /var/lock/subsys/xapi
                        echo -n $"start-of-day complete."