[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] Fail to import available VM image



Hi Jun,
The log is very clear, you need a virtual network 'default' for libvirt default bridge virbr0, 
it should be your complication issue, the default case is 'virsh' locates in /usr/bin/virsh, 
and 'libvirtd' locates in /usr/sbin/libvirtd, if your 'virsh' and 'libvirtd' are put other 
location, I guess you haven't used --prefix=/usr when run ./configure, or you also haven't 
directly used ./autogen.sh --system, if so, your 'default' virtual network probably doesn't work.
so at first, you should make sure virtual network 'default' works well, you may check it by
ifconfig and virsh net-list, for example:

# ifconfig virbr0
virbr0    Link encap:Ethernet  HWaddr 52:54:00:38:FF:C4  
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:436 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1080 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:56435 (55.1 KiB)  TX bytes:127958 (124.9 KiB)

# virsh net-list
Name                 State      Autostart
-----------------------------------------
default              active     yes     

# virsh net-dumpxml default
<network>
  <name>default</name>
  <uuid>40447e3e-4b09-44db-bc70-decef1189044</uuid>
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0' />
  <mac address='52:54:00:38:FF:C4'/>
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254' />
    </dhcp>
  </ip>
</network>

At present, you may try to manually define and active 'default' virtual network,
and paste the above xml into /etc/libvirt/qemu/networks/default.xml then
virsh net-define /etc/libvirt/qemu/networks/default.xml and virsh net-create default,
if everything is okay you will see a active default network by virsh net-list, and
you also see a network bridge named 'virbr0' on host by ifconfig.

Finally, if virtual work works well, then you may try previous operations.

Good Luck!
Alex
----- Original Message -----
From: "Jun Koi" <junkoi2004 gmail com>
To: "Alex Jia" <ajia redhat com>
Cc: libvir-list redhat com
Sent: Wednesday, February 15, 2012 12:01:58 AM
Subject: Re: [libvirt] Fail to import available VM image

On Tue, Feb 14, 2012 at 11:47 PM, Alex Jia <ajia redhat com> wrote:
> Hi Jun,
> I assume you haven't changed libvirt default URI, it may be a issue,
> I want to know whether it works for you if you explicitly specify
> --connect qemu:///system with virt-install? I think a root reason
> probably is your disk image location, the log said it can't find
> storage volume, if you put img.winp under the /var/lib/libvirt/images,
> then give a disk absolute path to virt-install, Does it work for you?

ok, i change the command a bit, and it went further.
here is how i did:

(1) compiled everything from source, then install (make install) to my Ubuntu

(2) start libvirtd on commandline
# libvirtd -d

(3) import my KVM image to libvirt

$ virt-install --connect qemu:///system -n winxp -r 800 --accelerate
--vnc -v --noautoconsole --import -f /home/jun/img/img.winxp

it failed, and the log is like below:

....
[Tue, 14 Feb 2012 23:51:49 virt-install 3831] DEBUG (cli:326)
Requesting libvirt URI qemu:///system
[Tue, 14 Feb 2012 23:51:51 virt-install 3831] DEBUG (cli:328) Received
libvirt URI qemu:///system
[Tue, 14 Feb 2012 23:51:52 virt-install 3831] DEBUG (virt-install:259)
Requesting virt method 'hvm', hv type 'default'.
[Tue, 14 Feb 2012 23:51:52 virt-install 3831] DEBUG (virt-install:469)
Received virt method 'hvm'
[Tue, 14 Feb 2012 23:51:52 virt-install 3831] DEBUG (virt-install:470)
Hypervisor name is 'kvm'
[Tue, 14 Feb 2012 23:51:52 virt-install 3831] ERROR (cli:439) Error in
network device parameters: Virtual network 'default' has not been
started.
[Tue, 14 Feb 2012 23:51:52 virt-install 3831] DEBUG (cli:440)
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/virtinst/cli.py", line
884, in get_networks
    dev = parse_network(guest, netstr, mac=mac)
  File "/usr/local/lib/python2.6/dist-packages/virtinst/cli.py", line
1642, in parse_network
    bridge=opts.get("bridge"))
  File "/usr/local/lib/python2.6/dist-packages/virtinst/VirtualNetworkInterface.py",
line 153, in __init__
    self.network = network
  File "/usr/local/lib/python2.6/dist-packages/virtinst/XMLBuilderDomain.py",
line 309, in new_setter
    fset(self, val, *args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/virtinst/VirtualNetworkInterface.py",
line 257, in set_network
    "started.") % newnet)
ValueError: Virtual network 'default' has not been started.



i guess perhaps just starting "libvirtd -d" on commandline is not
enough. do i need a script to configure and start libvirtd properly
for me?
and it seems i must configure the virtual network somehow?

currently, the output of brtctl is like below:

$ brctl show
bridge name	bridge id		STP enabled	interfaces
pan0		8000.000000000000	no		



thanks,
Jun


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]