[libvirt] Re: virsh/virt-install for dummies

Jun Koi junkoi2004 at gmail.com
Tue Aug 19 02:25:21 UTC 2008


On Mon, Aug 18, 2008 at 9:59 PM, Cole Robinson <crobinso at redhat.com> wrote:
> Jun Koi wrote:
>> On Fri, Aug 15, 2008 at 8:02 PM, Daniel P. Berrange <berrange at redhat.com> wrote:
>>
>>> On Fri, Aug 15, 2008 at 07:47:32PM +0900, Jun Koi wrote:
>>>
>>>> On Fri, Aug 15, 2008 at 7:36 PM, Daniel P. Berrange <berrange at redhat.com> wrote:
>>>>
>>>>> On Fri, Aug 15, 2008 at 07:32:48PM +0900, Jun Koi wrote:
>>>>>
>>>>>> On Fri, Aug 15, 2008 at 7:30 PM, Jun Koi <junkoi2004 at gmail.com> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I am frustrated searching for a quick-start documentation for virsh,
>>>>>>> just to no avail. Any help is greatly appreciated!
>>>>>>>
>>>>>>> Here is what I did:
>>>>>>> - Compile and install libvirt, virt-manager, virt-install and
>>>>>>> virt-viewer from source code. This is done (on Ubuntu 8.04).
>>>>>>> - Now I want to do install a new VM with QEMU or KVM. I got the below
>>>>>>> error with virt-install:
>>>>>>>
>>>>>>>
>>>>>>> # virt-install -c qemu:///system --name jeos2 --ram 500 --file
>>>>>>> img.jeos2  --cdrom jeos-8.04.1-jeos-i386.iso
>>>>>>> Fri, 15 Aug 2008 19:19:10 ERROR    virConnectOpen() failed
>>>>>>> Traceback (most recent call last):
>>>>>>>  File "/usr/bin/virt-install", line 496, in <module>
>>>>>>>    main()
>>>>>>>  File "/usr/bin/virt-install", line 345, in main
>>>>>>>    conn = cli.getConnection(options.connect)
>>>>>>>  File "/usr/lib/python2.5/site-packages/virtinst/cli.py", line 92, in
>>>>>>> getConnection
>>>>>>>    return libvirt.open(connect)
>>>>>>>  File "/usr/lib/python2.5/site-packages/libvirt.py", line 139, in open
>>>>>>>    if ret is None:raise libvirtError('virConnectOpen() failed')
>>>>>>> libvirtError: virConnectOpen() failed
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> How to fix this? Perhaps I need to run libvirtd before using virsh???
>>>>>>>
>>>>>> I tried to run libvirtd to see if that fixes the problem, but got the
>>>>>> below error:
>>>>>>
>>>>> Yes, for QEMU you need to have the libvirtd daemon up & running. Before
>>>>> attempting to connect with virt-install, make sure you can connect with
>>>>> virsh, eg as a good test run:
>>>>>
>>>>>   virsh --connect qemu:///system  capabilities
>>>>>
>>>>>
>>>
>>>> Then I believe this should be fixed: users should be able to run
>>>> libvirtd without brctl installed. I can still use QEMU/KVM before on
>>>> my machine without it, so I find no reason why it stop working now
>>>> with virt-install.
>>>>
>>> There's nothing to fix - this is simply a deployment issue - the default
>>> installation we provide sets up a 'default' virtual network which provides
>>> guests with a NAT based network connection out of the box which requires
>>> bridgeutils. If you don't  want to use that then you can remove this default
>>> config from /etc/libvirt/qemu/networks. All the QEMU network configs without
>>> use of bridge-utils are pretty crap though, hence why we setup this default
>>> networking config for people
>>>
>>>
>>>> OK, now I install bridge-utils, and run libvirtd. After that, I tried
>>>> virt-install, but still got error like below:
>>>>
>>>> How to fix this now?
>>>>
>>> Debug it with 'virsh' first to make sure the basic functionality is working
>>> and then go onto virt-install.
>>>
>>
>> Yes, virsh works well: it returns few pages of xml data.
>>
>> However, "virt-install" still has problem like below. It seems to have
>> some thing with Xen? I dont install Xen on my machine.
>>
>> Could you give some hints to fix this??
>>
>> Thanks,
>> J
>>
>>
>>
>> # LIBVIRT_DEBUG=1 virt-install -c qemu:///system --name jeos2 --ram
>> 500 --file img.jeos2  --cdrom jeos-8.04.1-jeos-i386.iso
>>
> That command line has an error, you need to use --connect for the
> URI, -c == --cdrom.
>

Yes, that was a mistake. I changed -c to --connect, and get the error
"Unsupported virtualization type" now. How can I fix it?

Thanks a lot,
J


# LIBVIRT_DEBUG=1 virt-install --connect qemu:///system --name jeos2
--ram 500 --file img.jeos2 --cdrom jeos-8.04.1-jeos-i386.iso
DEBUG: libvirt.c: virInitialize (register drivers)
DEBUG: libvirt.c: virConnectOpen (name=qemu:///system)
DEBUG: libvirt.c: do_open (name "qemu:///system" to URI components:
  scheme qemu
  opaque (null)
  authority (null)
  server (null)
  user (null)
  port 0
  path /system
)
DEBUG: libvirt.c: do_open (trying driver 0 (Test) ...)
DEBUG: libvirt.c: do_open (driver 0 Test returned DECLINED)
DEBUG: libvirt.c: do_open (trying driver 1 (QEMU) ...)
DEBUG: libvirt.c: do_open (driver 1 QEMU returned DECLINED)
DEBUG: libvirt.c: do_open (trying driver 2 (Xen) ...)
DEBUG: libvirt.c: do_open (driver 2 Xen returned DECLINED)
DEBUG: libvirt.c: do_open (trying driver 3 (OPENVZ) ...)
DEBUG: libvirt.c: do_open (driver 3 OPENVZ returned DECLINED)
DEBUG: libvirt.c: do_open (trying driver 4 (LXC) ...)
DEBUG: libvirt.c: do_open (driver 4 LXC returned DECLINED)
DEBUG: libvirt.c: do_open (trying driver 5 (remote) ...)
DEBUG: remote_internal.c: doRemoteOpen (proceeding with name = qemu:///system)
DEBUG: libvirt.c: do_open (driver 5 remote returned SUCCESS)
DEBUG: libvirt.c: do_open (network driver 0 Test returned DECLINED)
DEBUG: libvirt.c: do_open (network driver 1 QEMU returned DECLINED)
DEBUG: libvirt.c: do_open (network driver 2 remote returned SUCCESS)
DEBUG: libvirt.c: do_open (storage driver 0 Test returned DECLINED)
DEBUG: libvirt.c: do_open (storage driver 1 storage returned DECLINED)
DEBUG: libvirt.c: do_open (storage driver 2 remote returned SUCCESS)
DEBUG: libvirt.c: virConnectGetCapabilities (conn=0x851fb08)
Unsupported virtualization type
DEBUG: libvirt.c: virConnectClose (conn=0x851fb08)
DEBUG: hash.c: virUnrefConnect (unref connection 0x851fb08 qemu:///system 1)
DEBUG: hash.c: virReleaseConnect (release connection 0x851fb08 qemu:///system)



And here is the output of "virsh -c qemu:///system capabilities":

<capabilities>
  <host>
    <cpu>
      <arch>i686</arch>
    </cpu>
  </host>

  <guest>
    <os_type>hvm</os_type>
    <arch name='i686'>
      <wordsize>32</wordsize>
      <emulator>/usr/bin/qemu</emulator>
      <machine>pc</machine>
      <machine>isapc</machine>
    </arch>
    <features>
      <pae/>
      <nonpae/>
      <acpi default='on' toggle='yes'/>
      <apic default='on' toggle='no'/>
    </features>
  </guest>

  <guest>
    <os_type>hvm</os_type>
    <arch name='x86_64'>
      <wordsize>64</wordsize>
      <emulator>/usr/bin/qemu-system-x86_64</emulator>
      <machine>pc</machine>
      <machine>isapc</machine>
      <domain type='qemu'>
      </domain>
    </arch>
    <features>
      <acpi default='on' toggle='yes'/>
      <apic default='on' toggle='no'/>
    </features>
  </guest>

  <guest>
    <os_type>hvm</os_type>
    <arch name='mips'>
      <wordsize>32</wordsize>
      <emulator>/usr/bin/qemu-system-mips</emulator>
      <machine>mips</machine>
    </arch>
  </guest>

  <guest>
    <os_type>hvm</os_type>
    <arch name='mipsel'>
      <wordsize>32</wordsize>
      <emulator>/usr/bin/qemu-system-mipsel</emulator>
      <machine>mips</machine>
    </arch>
  </guest>

  <guest>
    <os_type>hvm</os_type>
    <arch name='sparc'>
      <wordsize>32</wordsize>
      <emulator>/usr/bin/qemu-system-sparc</emulator>
      <machine>sun4m</machine>
    </arch>
  </guest>

  <guest>
    <os_type>hvm</os_type>
    <arch name='ppc'>
      <wordsize>32</wordsize>
      <emulator>/usr/bin/qemu-system-ppc</emulator>
      <machine>g3bw</machine>
      <machine>mac99</machine>
      <machine>prep</machine>
    </arch>
  </guest>
</capabilities>




More information about the libvir-list mailing list