Greg Padgett has uploaded a new change for review. Change subject: env: fix path to glusterfs storage domains ......................................................................
env: fix path to glusterfs storage domains If the hosted engine config specifies a GlusterFS storage domain, look in the appropriate path on the mounted domain to find it. The agent will now use the existing env.path module to get pathnames rather than having its own (duplicated) code for this. Change-Id: I7838e373d1cbe0682bfbffa697e6cd5eff819308 Bug-Url: https://bugzilla.redhat.com/1023965 Signed-off-by: Greg Padgett <[email protected]> --- M ovirt_hosted_engine_ha/agent/hosted_engine.py M ovirt_hosted_engine_ha/env/config.py M ovirt_hosted_engine_ha/env/path.py 3 files changed, 7 insertions(+), 16 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-ha refs/changes/31/20631/1 diff --git a/ovirt_hosted_engine_ha/agent/hosted_engine.py b/ovirt_hosted_engine_ha/agent/hosted_engine.py index 89d3d53..1fc0382 100644 --- a/ovirt_hosted_engine_ha/agent/hosted_engine.py +++ b/ovirt_hosted_engine_ha/agent/hosted_engine.py @@ -28,6 +28,7 @@ from . import constants from ..env import config +from ..env import path as env_path from ..lib import brokerlink from ..lib import exceptions as ex from ..lib import log_filter @@ -329,7 +330,7 @@ raise Exception("Failed trying to connect storage") # Update to the current mount path for the domain - self._sd_path = self._get_domain_path() + self._sd_path = env_path.get_domain_path(self._config) self._log.debug("Path to storage domain is %s", self._sd_path) def _cond_start_service(self, service_name): @@ -352,25 +353,11 @@ raise Exception("Could not start {0}: {1}" .format(service_name, res[1])) - def _get_domain_path(self): - """ - Return path of storage domain holding engine vm - """ - sd_uuid = self._config.get(config.ENGINE, config.SD_UUID) - parent = constants.SD_MOUNT_PARENT - for dname in os.listdir(parent): - path = os.path.join(parent, dname, sd_uuid) - if os.access(path, os.F_OK): - return path - raise Exception("path to storage domain {0} not found in {1}" - .format(sd_uuid, parent)) - def _initialize_sanlock(self): self._cond_start_service('sanlock') host_id = self._rinfo['host-id'] - self._metadata_dir = os.path.join(self._sd_path, - constants.SD_METADATA_DIR) + self._metadata_dir = env_path.get_metadata_path(self._config) lease_file = os.path.join(self._metadata_dir, constants.SERVICE_TYPE + '.lockspace') if not self._sanlock_initialized: diff --git a/ovirt_hosted_engine_ha/env/config.py b/ovirt_hosted_engine_ha/env/config.py index 2919a5b..8e9cbf1 100644 --- a/ovirt_hosted_engine_ha/env/config.py +++ b/ovirt_hosted_engine_ha/env/config.py @@ -21,6 +21,7 @@ # constants for hosted-engine.conf options ENGINE = 'engine' +DOMAIN_TYPE = 'domainType' ENGINE_FQDN = 'fqdn' GATEWAY_ADDR = 'gateway' HOST_ID = 'host_id' diff --git a/ovirt_hosted_engine_ha/env/path.py b/ovirt_hosted_engine_ha/env/path.py index 7ee0904..cbb6a05 100644 --- a/ovirt_hosted_engine_ha/env/path.py +++ b/ovirt_hosted_engine_ha/env/path.py @@ -28,7 +28,10 @@ Return path of storage domain holding engine vm """ sd_uuid = config_.get(config.ENGINE, config.SD_UUID) + dom_type = config_.get(config.ENGINE, config.DOMAIN_TYPE) parent = constants.SD_MOUNT_PARENT + if dom_type == 'glusterfs': + parent = os.path.join(parent, 'glusterSD') for dname in os.listdir(parent): path = os.path.join(parent, dname, sd_uuid) if os.access(path, os.F_OK): -- To view, visit http://gerrit.ovirt.org/20631 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7838e373d1cbe0682bfbffa697e6cd5eff819308 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-hosted-engine-ha Gerrit-Branch: master Gerrit-Owner: Greg Padgett <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
