示例#1
0
 def setup(self):
     self.cluster = "bravo"
     self.name = "b010"
     self.inventory = Inventory()
     self.inventory.clear()
     self.inventory.generate()
     print("GENERATION COMPLETE")
示例#2
0
 def pbs_service(self, rack_name=None):
     config = cm_config()
     username = config.get("cloudmesh.hpc.username")
     pbs = PBS(username, "india.futuregrid.org")
     dict_pbs_info = pbs.pbsnodes()
     dict_data = {}
     inventory = Inventory()
     racks = inventory.get_clusters()
     for rack in racks:
         rack_name = rack["cm_cluster"]
         dict_data[rack_name] = {}
         hosts = rack["cm_value"]
         for host in hosts:
             (hid, hlabel) = inventory.get_host_id_label(host, "public")
             utype = "unknown"
             if hlabel in dict_pbs_info:
                 server = dict_pbs_info[hlabel]
                 if "note" in server.keys():
                     note_value = server["note"]
                     # to compatible with the future change
                     if type(note_value) is dict:
                         utype = note_value["service"]
                     else:   # currently is a literal string for note
                         utype = note_value
             dict_data[rack_name][hid] = utype
     return dict_data
示例#3
0
 def _connect_to_inventory(self):
     """connects to the inventory and prints an error if not successfull"""
     self.inventory_name = "test"
     try:
         # TODO: port number is missing
         # TODO: should be imported from cloudmesh_server.yaml
         # db = connect(self.inventory_name)
         self.inventory = Inventory()
     except:
         self.Inventory = None
         raise Exception("ERROR: connection to inventory failed")
    def activate_cm_shell_inventory(self):
        self.register_command_topic('cloud', 'inventory')
        #
        # BUG this needs to be done not in activate
        #
        self.inventory_name = "test"
        # port number is missing
        # should be imported from cloudmesh_server.yaml
        db = connect(self.inventory_name)

        self.inventory = Inventory()
        pass
示例#5
0
from cloudmesh_common.tables import table_printer
from cloudmesh_common.util import cond_decorator
from cloudmesh.config.cm_config import cm_config_server

from flask.ext.principal import Permission, RoleNeed

from cloudmesh_base.logger import LOGGER
from pprint import pprint

log = LOGGER(__file__)

admin_permission = Permission(RoleNeed('admin'))

import hostlist

inventory = Inventory()
# inventory.clear()
# inventory.generate()


@inventory_module.route('/inventory/')
@login_required
@admin_permission.require(http_exception=403)
def display_inventory():
    time_now = datetime.now().strftime("%Y-%m-%d %H:%M")

    # inventory.refresh()

    clusters = ["bravo", "india", "delta", "echo"]

    return render_template('mesh/inventory/mesh_inventory.html',
示例#6
0
def inventory():
    mesh_inventory = Inventory()
    mesh_inventory.clear()
    mesh_inventory.generate()
    mesh_inventory.info()
示例#7
0
 def __init__(self):
     self.inventory = Inventory()
示例#8
0
 def __init__(self):
     self.config_server = cm_config_server().get(
         "cloudmesh.server.clusters")
     self.inventory = Inventory()
示例#9
0
 def __init__(self, user, host):
     self.username = user
     self.hostname = host
     self.inventory = Inventory()
     self.fetch_pbs_nodes_info()
示例#10
0
 def __init__(self, valid_time=1800):
     self.data_valid_time = valid_time
     self.inventory = Inventory()