15.7. 명령줄을 사용하여 가상 머신에서 PCI 장치 제거
VM(가상 머신)에서 PCI 장치를 제거하려면 VM의 XML 구성에서 장치 정보를 제거합니다.
프로세스
PCI 장치가 연결된 VM의 XML 구성에서 장치의 설정을 사용하여 <
hostdev> 섹션에서 <address domain> 행을 찾습니다.# virsh dumpxml <VM-name> [...] <hostdev mode='subsystem' type='pci' managed='yes'> <source> <address domain='0x0000' bus='0x65' slot='0x00' function='0x0'/> </source> <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/> </hostdev> [...]virsh detach-device명령을--hostdev옵션과 장치 주소와 함께 사용합니다.예를 들어 다음 명령은 이전 단계에 있는 장치를 영구적으로 제거합니다.
# virsh detach-device <VM-name> --hostdev 0000:65:00.0 --config Domain 'VM-name' defined successfully.참고실행 중인 VM에서 PCI 장치를 제거하려면
--live인수를 이전 명령에 추가합니다.선택 사항: PCI 장치를 호스트에 다시 연결합니다. 예를 들어 다음 명령은 이전 단계에서 VM에서 제거된 장치를 다시 연결합니다.
# virsh nodedev-reattach pci_0000_65_00_0 Device pci_0000_65_00_0 re-attached
검증
VM의 XML 구성을 다시 표시하고 장치의 <
hostdev> 섹션이 더 이상 나타나지 않는지 확인합니다.# virsh dumpxml <VM-name>