CLI의 핵심 원리는 명령이 실행되는 컨텍스트입니다. 컨텍스트는 어떤 시스템 요소를 관리할 수 있고 어떤 명령을 사용할 수 있는지 결정합니다. 컨텍스트에는 컨텍스트 자체에 중첩된 컨텍스트가 포함되는 트리 구조와 일반적으로 BUI 보기의 구조를 미러링하는 구조가 있습니다.
로그인 시 처음으로 표시되는 컨텍스트가 루트 컨텍스트입니다. 이는 모든 컨텍스트의 부모 또는 상위 항목 역할을 합니다. 컨텍스트로 이동하려면 컨텍스트 이름을 명령으로 실행합니다. 예를 들어, 브라우저의 Chapter 4, 네트워크 구성 보기에서 사용 가능한 기능을 CLI의 configuration 컨텍스트에서 사용할 수 있습니다. 루트 컨텍스트에서 직접 입력하여 기능에 액세스할 수 있습니다.
dory:> configuration dory:configuration>
프롬프트는 컨텍스트가 반영되도록 변경되며, 컨텍스트는 프롬프트에서 콜론과 초과 기호 사이에 제공됩니다.
show 명령을 실행하면 자식 컨텍스트가 표시됩니다. 예를 들어, configuration 컨텍스트에서 실행하면 다음이 표시됩니다.
dory:configuration> show Children: net => Configure networking services => Configure services version => Display system version users => Configure administrative users roles => Configure administrative roles preferences => Configure user preferences alerts => Configure alerts storage => Configure Storage
이러한 자식 컨텍스트는 Chapter 4, 네트워크 구성, Chapter 11, ZFSSA 서비스, Chapter 7, 사용자 구성, 환경 설정, Chapter 8, ZFSSA 환경 설정 등을 비롯하여 브라우저의 Chapter 6, SAN(Storage Area Network) 구성 보기 아래에 제공되는 보기에 해당합니다. 이러한 자식 컨텍스트 중 하나를 선택하려면 해당 이름을 입력합니다.
dory:configuration> preferences dory:configuration preferences>
중간 컨텍스트를 지정(공백으로 구분)하면 상위 컨텍스트에서 종속 컨텍스트로 바로 이동할 수 있습니다. 예를 들어, 루트 컨텍스트에서 configuration preferences로 바로 이동하려면 해당 명령을 입력하기만 하면 됩니다.
dory:> configuration preferences dory:configuration preferences>
일부 자식 컨텍스트는 브라우저의 고정 보기 대신 사용자나 시스템이 만든 동적 엔티티에 해당한다는 점에서 동적입니다. 이러한 컨텍스트로 이동하려면 select 명령, 동적 컨텍스트의 이름을 차례로 사용합니다. list 명령을 사용하면 특정 컨텍스트 내에 포함된 동적 컨텍스트의 이름이 표시됩니다. 예를 들어, users 컨텍스트는 정적 컨텍스트이지만 각 사용자가 자체 동적 컨텍스트입니다.
dory:> configuration users dory:configuration users> list NAME USERNAME UID TYPE John Doe bmc 12345 Dir Super-User root 0 Loc
이름이 bmc인 사용자를 선택하려면 select bmc 명령을 실행합니다.
dory:configuration users> select bmc dory:configuration users bmc>
또는 컨텍스트에 따라 select 및 destroy를 사용하여 해당 등록 정보를 기반으로 엔티티를 선택할 수 있습니다. 예를 들어, 다음 명령을 실행하여 maintenance logs system 컨텍스트에 있는 reboot 모듈에 의해 실행된 로그 항목을 선택할 수 있습니다.
dory:maintenance logs system> select module=reboot dory:maintenance logs system entry-034> show Properties: timestamp = 2010-8-14 06:24:41 module = reboot priority = crit text = initiated by root on /dev/console syslogd: going down on signal 15
다른 명령에서와 마찬가지로 select를 컨텍스트 변경 명령에 추가할 수 있습니다. 예를 들어, 루트 컨텍스트에서 이름이 bmc인 사용자를 선택하려면 다음과 같이 입력합니다.
dory:> configuration users select bmc dory:configuration users bmc>
last 명령을 사용하여 이전에 선택하거나 만든 컨텍스트로 이동할 수 있습니다. 현재 이 명령은 복제 작업 컨텍스트에서만 구현됩니다.
다음 예에서는 복제 작업을 만든 다음 last 및 get id 명령을 사용하여 복제 작업 ID를 검색합니다. 그러면 다른 작업이 선택되고 last 및 get id 명령을 통해 마지막으로 확인된 복제 작업의 ID가 검색됩니다.
dory:shares p1/share replication> list TARGET STATUS NEXT action-000 oakmeal idle Sync now action-001 dory idle Sync now dory:shares p1/share replication> create dory:shares p1/share action (uncommitted)> set target=dory target = dory (uncommitted) dory:shares p1/share action (uncommitted)> set pool=p0 pool = p0 (uncommitted) dory:shares p1/share action (uncommitted)> commit dory:shares p1/share replication> last dory:shares p1/share action-002> get id id = 7034367a-d4d8-e26f-fa93-c3b454e3b595 dory:shares p1/share action-002> done dory:shares p1/share replication> select action-000 dory:shares p1/share action-000> get id id = 9895d9f4-7b23-ebe1-faf2-d85a581e3dff dory:shares p1/share action-000> done dory:shares p1/share replication> last get id id = 9895d9f4-7b23-ebe1-faf2-d85a581e3dff dory:shares p1/share replication>