Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

21.9.3. virt-inspector 실행

다음 예와 같이 모든 디스크 이미지 또는 libvirt 게스트 가상 머신에 대해 virt-inspector 를 실행할 수 있습니다.
$ virt-inspector -a disk.img > report.xml
예를 들면 다음과 같습니다.
$ virt-inspector -d GuestName > report.xml
결과는 XML 보고서(report.xml)입니다. XML 파일의 주요 구성 요소는 다음과 유사하게 일반적으로 단일 <operatingsystem> 요소를 포함하는 최상위 <operatingsytems> 요소입니다.
 <operatingsystems>
   <operatingsystem>

     <!-- the type of operating system and Linux distribution -->
     <name>linux</name>
     <distro>rhel</distro>
     <!-- the name, version and architecture -->
     <product_name>Red Hat Enterprise Linux Server release 6.4 </product_name>
     <major_version>6</major_version>
     <minor_version>4</minor_version>
     <package_format>rpm</package_format>
     <package_management>yum</package_management>
     <root>/dev/VolGroup/lv_root</root> 
     <!-- how the filesystems would be mounted when live -->
     <mountpoints>
       <mountpoint dev="/dev/VolGroup/lv_root">/</mountpoint>
       <mountpoint dev="/dev/sda1">/boot</mountpoint>
       <mountpoint dev="/dev/VolGroup/lv_swap">swap</mountpoint>
     </mountpoints>

    < !-- filesystems-->
      <filesystem dev="/dev/VolGroup/lv_root">
        <label></label>
        <uuid>b24d9161-5613-4ab8-8649-f27a8a8068d3</uuid>
        <type>ext4</type>
        <content>linux-root</content>
        <spec>/dev/mapper/VolGroup-lv_root</spec>
      </filesystem>
      <filesystem dev="/dev/VolGroup/lv_swap">
        <type>swap</type>
        <spec>/dev/mapper/VolGroup-lv_swap</spec>
      </filesystem>
     <!-- packages installed -->
     <applications>
       <application>
         <name>firefox</name>
         <version>3.5.5</version>
         <release>1.fc12</release>
       </application>
     </applications>

   </operatingsystem>
 </operatingsystems>
이러한 보고서를 처리하는 것은 W3C 표준 EgressIP 쿼리를 사용하여 가장 잘 수행됩니다. Red Hat Enterprise Linux 7에는 간단한 인스턴스에 사용할 수 있는 xpath 명령줄 프로그램이 포함되어 있습니다. 그러나 장기 사용 및 고급 사용의 경우 원하는 프로그래밍 언어와 함께 etcdctl 라이브러리를 사용하는 것이 좋습니다.
예를 들어 다음 EgressIP 쿼리를 사용하여 모든 파일 시스템 장치를 나열할 수 있습니다.
$ virt-inspector GuestName | xpath //filesystem/@dev
 Found 3 nodes:
 -- NODE --
 dev="/dev/sda1"
 -- NODE --
 dev="/dev/vg_f12x64/lv_root"
 -- NODE --
 dev="/dev/vg_f12x64/lv_swap"
또는 다음을 입력하여 설치된 모든 애플리케이션의 이름을 나열하십시오.
$ virt-inspector GuestName | xpath //application/name
 [...long list...]