def storagepool_start_stop_job(obj, host, pool_obj, status):
    _iscsi_job = None

    if status == 'start':
        pool_info = pool_obj.get_info()
        if pool_info['type'].lower() == "iscsi":
            _cmd = dict2command(
                "%s/%s" % (karesansui.config['application.bin.dir'], ISCSI_COMMAND_START),
                {"iqn" : pool_info['source']['dev_path']})
            cmdname = "Start iSCSI"
            _iscsi_job = Job('%s command' % cmdname, 0, _cmd)

        _cmd = dict2command(
            "%s/%s" % (karesansui.config['application.bin.dir'], VIRT_COMMAND_START_STORAGE_POOL),
            {"name" : pool_obj.get_storage_name()})
        cmdname = "Start Storage Pool"
    else:
        _cmd = dict2command(
            "%s/%s" % (karesansui.config['application.bin.dir'], VIRT_COMMAND_DESTROY_STORAGE_POOL),
            {"name" : pool_obj.get_storage_name()})
        cmdname = "Stop Storage Pool"

    _jobgroup = JobGroup(cmdname, karesansui.sheconf['env.uniqkey'])

    if _iscsi_job:
        _jobgroup.jobs.append(_iscsi_job)
        _job = Job('%s command' % cmdname, 1, _cmd)
    else:
        _job = Job('%s command' % cmdname, 0, _cmd)

    _jobgroup.jobs.append(_job)

    _machine2jobgroup = m2j_new(machine=host,
                                jobgroup_id=-1,
                                uniq_key=karesansui.sheconf['env.uniqkey'],
                                created_user=obj.me,
                                modified_user=obj.me,
                                )

    save_job_collaboration(obj.orm,
                           obj.pysilhouette.orm,
                           _machine2jobgroup,
                           _jobgroup,
                           )
dataset/ETHPy150Open karesansui/karesansui/karesansui/gadget/hostby1storagepoolby1status.py/storagepool_start_stop_job/original