예제 #1
0
    def __init__(self):
        self._sites = {}
        self.compute_host_manager = ComputeHostManager(self)

        # create fake data
        # NOTE(saggi) replace with DAL access when available
        self.create_site("Fake01")
        self.create_site("Fake02")
예제 #2
0
class _SiteManager(object):
    def __init__(self):
        self._sites = {}
        self.compute_host_manager = ComputeHostManager(self)

        # create fake data
        # NOTE(saggi) replace with DAL access when available
        self.create_site("Fake01")
        self.create_site("Fake02")

    def create_site(self, site_name):
        """creates a fake site, in reality the information about available
        sites should be pulled from the DAL and not created at will.
        """
        # TODO(saggi): thread safty
        if site_name in self._sites:
            raise RuntimeError("Site already exists in site map")

        self._sites[site_name] = Site(site_name)
        self.compute_host_manager.create_host_adapter(site_name)

    def get_site(self, site_name):
        return self._sites[site_name]