当前位置: 首页>>代码示例>>Python>>正文


Python Workspace.get_node_info_in_workspace方法代码示例

本文整理汇总了Python中infrasim.workspace.Workspace.get_node_info_in_workspace方法的典型用法代码示例。如果您正苦于以下问题:Python Workspace.get_node_info_in_workspace方法的具体用法?Python Workspace.get_node_info_in_workspace怎么用?Python Workspace.get_node_info_in_workspace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在infrasim.workspace.Workspace的用法示例。


在下文中一共展示了Workspace.get_node_info_in_workspace方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: check_node_start_workspace

# 需要导入模块: from infrasim.workspace import Workspace [as 别名]
# 或者: from infrasim.workspace.Workspace import get_node_info_in_workspace [as 别名]
def check_node_start_workspace(node_name):

    conf = Workspace.get_node_info_in_workspace(node_name)
    node_root = os.path.join(config.infrasim_home, conf["name"])

    # Check node data folder and files exist
    node_type = conf["type"]
    data_folder = os.path.join(node_root, "data")
    node_emu = os.path.join(data_folder, "{}.emu".format(node_type))
    node_bios = os.path.join(data_folder, "{}_smbios.bin".format(node_type))
    assert os.path.exists(data_folder) is True
    assert os.path.exists(node_emu) is True
    assert os.path.exists(node_bios) is True

    # Check node script folder and files exist
    script_folder = os.path.join(node_root, "scripts")
    script_chassiscontrol = os.path.join(script_folder, "chassiscontrol")
    script_lancontrol = os.path.join(script_folder, "lancontrol")
    script_startcmd = os.path.join(script_folder, "startcmd")
    script_stopcmd = os.path.join(script_folder, "stopcmd")
    script_resetcmd = os.path.join(script_folder, "resetcmd")
    assert os.path.exists(script_folder) is True
    assert os.path.exists(script_chassiscontrol) is True
    assert os.path.exists(script_lancontrol) is True
    assert os.path.exists(script_startcmd) is True
    assert os.path.exists(script_stopcmd) is True
    assert os.path.exists(script_resetcmd) is True

    # Check etc folder and files exist
    etc_folder = os.path.join(node_root, "etc")
    etc_infrasim_yml = os.path.join(etc_folder, "infrasim.yml")
    etc_vbmc_conf = os.path.join(etc_folder, "vbmc.conf")
    assert os.path.exists(etc_folder) is True
    assert os.path.exists(etc_infrasim_yml) is True
    assert os.path.exists(etc_vbmc_conf) is True

    # Check disk image exist
    node_name = conf["name"]
    node_drive = conf['compute']['storage_backend'][0]['drives']

    # set drive 'file'
    for i in range(1, len(node_drive) + 1):
        disk_file = os.path.join(node_root, "sd{0}.img".format(chr(96 + i)))
        assert os.path.exists(disk_file) is True

    # Check serial device exist
    serial_dev = os.path.join(node_root, ".pty0_{}".format(node_name))
    assert os.path.exists(serial_dev) is True

    # Check unix socket file
    serial = os.path.join(node_root, ".serial")
    assert os.path.exists(serial) is True

    # Check node runtime pid file exist
    node_socat = os.path.join(node_root, ".{}-socat.pid".format(node_name))
    node_ipmi = os.path.join(node_root, ".{}-bmc.pid".format(node_name))
    node_qemu = os.path.join(node_root, ".{}-node.pid".format(node_name))
    assert os.path.exists(node_socat) is True
    assert os.path.exists(node_ipmi) is True
    assert os.path.exists(node_qemu) is True
开发者ID:InfraSIM,项目名称:infrasim-compute,代码行数:62,代码来源:test_start_stop.py

示例2: destroy

# 需要导入模块: from infrasim.workspace import Workspace [as 别名]
# 或者: from infrasim.workspace.Workspace import get_node_info_in_workspace [as 别名]
 def destroy(self, node_name):
     if Workspace.check_workspace_exists(node_name):
         try:
             node_info = Workspace.get_node_info_in_workspace(node_name)
         except InfraSimError, e:
             print e.value
             logger_cmd.error("cmd res: {}".format(e.value))
             return
开发者ID:turtle-fly,项目名称:infrasim-compute,代码行数:10,代码来源:cli.py

示例3: status

# 需要导入模块: from infrasim.workspace import Workspace [as 别名]
# 或者: from infrasim.workspace.Workspace import get_node_info_in_workspace [as 别名]
 def status(self, node_name):
     try:
         node_info = Workspace.get_node_info_in_workspace(node_name)
         node = model.CNode(node_info)
         self._node_preinit(node, ignore_check=True)
         node.status()
         logger_cmd.info("cmd res: get node {} status OK".format(node_name))
     except InfraSimError, e:
         print e.value
         logger_cmd.error("cmd res: {}".format(e.value))
开发者ID:turtle-fly,项目名称:infrasim-compute,代码行数:12,代码来源:cli.py

示例4: start

# 需要导入模块: from infrasim.workspace import Workspace [as 别名]
# 或者: from infrasim.workspace.Workspace import get_node_info_in_workspace [as 别名]
    def start(self, node_name):
        try:
            if Workspace.check_workspace_exists(node_name):
                node_info = Workspace.get_node_info_in_workspace(node_name)
            else:
                node_info = nm.get_node_info(node_name)
            node = model.CNode(node_info)
            self._node_preinit(node)

        except InfraSimError, e:
            print e.value
            logger_cmd.error("cmd res: {}".format(e.value))
            return
开发者ID:turtle-fly,项目名称:infrasim-compute,代码行数:15,代码来源:cli.py

示例5: get_node_status

# 需要导入模块: from infrasim.workspace import Workspace [as 别名]
# 或者: from infrasim.workspace.Workspace import get_node_info_in_workspace [as 别名]
 def get_node_status(self):
     self.__node_info = Workspace.get_node_info_in_workspace(self.__node_name)
     self.netns = self.__node_info.get("namespace", None)
     base_path = os.path.join(infrasim_home, self.__node_name)
     task_name = ['socat', 'bmc', 'node', 'racadm', 'ipmi_console']
     task_list = {}
     for task in task_name:
         if task is 'ipmi_console':
             pid_file = os.path.join(base_path, '.ipmi_console.pid')
         else:
             pid_file = os.path.join(base_path, ".{}-{}.pid".format(self.__node_name, task))
         if os.path.exists(pid_file):
             task_pid = get_task_pid(pid_file)
             if not os.path.exists("/proc/{}".format(task_pid)):
                 os.remove(pid_file)
             elif task_pid > 0:
                 task_list[task] = "{:<6}".format(task_pid)
     return task_list
开发者ID:InfraSIM,项目名称:infrasim-compute,代码行数:20,代码来源:global_status.py

示例6: check_node_stop_workspace

# 需要导入模块: from infrasim.workspace import Workspace [as 别名]
# 或者: from infrasim.workspace.Workspace import get_node_info_in_workspace [as 别名]
def check_node_stop_workspace(node_name):

    conf = Workspace.get_node_info_in_workspace(node_name)
    node_root = os.path.join(config.infrasim_home, conf["name"])

    # Check node data folder and files exist
    node_type = conf["type"]
    data_folder = os.path.join(node_root, "data")
    node_emu = os.path.join(data_folder, "{}.emu".format(node_type))
    node_bios = os.path.join(data_folder, "{}_smbios.bin".format(node_type))
    assert os.path.exists(data_folder) is True
    assert os.path.exists(node_emu) is True
    assert os.path.exists(node_bios) is True

    # Check node script folder and files exist
    script_folder = os.path.join(node_root, "scripts")
    script_chassiscontrol = os.path.join(script_folder, "chassiscontrol")
    script_lancontrol = os.path.join(script_folder, "lancontrol")
    script_startcmd = os.path.join(script_folder, "startcmd")
    script_stopcmd = os.path.join(script_folder, "stopcmd")
    script_resetcmd = os.path.join(script_folder, "resetcmd")
    assert os.path.exists(script_folder) is True
    assert os.path.exists(script_chassiscontrol) is True
    assert os.path.exists(script_lancontrol) is True
    assert os.path.exists(script_startcmd) is True
    assert os.path.exists(script_stopcmd) is True
    assert os.path.exists(script_resetcmd) is True

    # Check etc folder and files exist
    etc_folder = os.path.join(node_root, "etc")
    etc_infrasim_yml = os.path.join(etc_folder, "infrasim.yml")
    etc_vbmc_conf = os.path.join(etc_folder, "vbmc.conf")
    assert os.path.exists(etc_folder) is True
    assert os.path.exists(etc_infrasim_yml) is True
    assert os.path.exists(etc_vbmc_conf) is True

    # Check disk image exist
    node_name = conf["name"]
    node_stor = conf['compute']['storage_backend']
    disk_index = 0
    for stor_control in node_stor:
        for drive in stor_control["drives"]:
            disk_file = os.path.join(node_root, "sd{0}.img".format(chr(97 + disk_index)))
            disk_index += 1
            assert os.path.exists(disk_file) is True

    # Check serial device exist
    serial_dev = os.path.join(node_root, ".pty0")
    assert os.path.exists(serial_dev) is False

    # should __NOT__ check .serial, since it will not be removed automatically
    # Check unix socket file
    # serial = os.path.join(node_root, ".serial")
    # assert os.path.exists(serial) is False

    # Check node runtime pid file don't exist
    node_socat = os.path.join(node_root, ".{}-socat.pid".format(node_name))
    node_ipmi = os.path.join(node_root, ".{}-bmc.pid".format(node_name))
    node_qemu = os.path.join(node_root, ".{}-node.pid".format(node_name))
    assert os.path.exists(node_socat) is False
    assert os.path.exists(node_ipmi) is False
    assert os.path.exists(node_qemu) is False
开发者ID:InfraSIM,项目名称:infrasim-compute,代码行数:64,代码来源:test_start_stop.py

示例7: get

# 需要导入模块: from infrasim.workspace import Workspace [as 别名]
# 或者: from infrasim.workspace.Workspace import get_node_info_in_workspace [as 别名]
 def get(self, nodename):
     """
     Show workspace details on this InfraSIM host
     """
     node_info = Workspace.get_node_info_in_workspace(nodename)
     return node_info, 200
开发者ID:JuneZhou19,项目名称:infrasim-compute,代码行数:8,代码来源:admin.py


注:本文中的infrasim.workspace.Workspace.get_node_info_in_workspace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。