Re: Regarding KVM

2011-12-28 Thread David Mair

Hi

On 12/27/2011 03:25 AM, Ajith Adapa wrote:

Hi,

I am new to KVM stuff and had very BASIC (might be lame even) doubts
regarding KVM.

As per the various diagrams I have gone through in internet my
understanding is KVM is an hypervisor on top of which all VMs run.

In case of FULL VIRTUALIZATION .. KVM will be directly running on top
of HARDWARE and VMs will be running on top of KVM .
In that case we dont need any support of other linux modules or subsystems ?

vm1 ... vmn
--
|   KVM  |
--
Hardware


Not in my experience. kvm is drivers on a host kernel which has other 
drivers in order to function (at least to boot) and a user-space (at 
least qemu instances). kvm does provide I/O virtualization to the extent 
that host devices you only want to be used in a guest can be ignored 
without host drivers and only operated from the guest as-if a guest 
device with guest drivers but there will still be things like I/O port 
access trapping and interrupts will happen on host processors at any 
juncture so presumably quickly routed by kvm behavior to service 
routines after switching to a suitable guest context, though I'm no 
expert on the code.



Actually I am very much intrested in networking component of
virtualization. So does KVM provides any specific support for
networking in case of virtualization ?


You can take a host NIC and use it's drivers in a guest to operate it. 
You can use tap interfaces for a guest and bridge them to host 
interfaces which can include bridged physical NICs or not and/or use 
host IP stack configuration to route guest traffic from its own IP 
network to any reachable by the host. On most of my kvm hosts I have 
bridges br0, br1 and br8 to simulate the vmnet0 (bridged - physical 
network access), vmnet1 (host only - isolated guests with host 
connectivity) and vmnet8 (NAT - routing from a host only network to 
anything reachable by the host) configurations you get on many default 
vmware configurations. I tried the I/O device virtualization quite a 
while ago and it wasn't reliable enough and, although I'm sure it's much 
improved, with the configuration I use I've never needed to try again.



Sorry if there is any developer guide for KVM will be more helpful for me.


--
David.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Setting up network for KVM guests

2011-05-26 Thread David Mair

On 05/26/2011 03:40 PM, c.mo...@web.de wrote:

Hello!
I have installed KVM/QEMU on my LMDE (Linux Mint Debian Edition) system.

On this webpage I found some instructions howto setup the network:
http://www.linux-kvm.org/page/Networking

My first question is:
For a public bridge, should I configure /etc/network/interfaces in order to 
create the bridge static.
Or should I use a script to create a bridge dynamically when the virtual 
machine starts.


I doubt there's a correct answer. I create the bridges I use statically 
at boot time and create bridge taps on demand when I launch VMs 
(probably because I always found the VMWare bridges appealing). If you 
want to have physical network access for VMs or a stable routing 
environment for them at launch or host services like dhcpd/pxe/etc to 
support them then I recommend static bridges that you consider part of 
the host environment.



Second question:
I made some tests with this script that is shown in section
public bridge -  Solution 2: manual:

#!/bin/sh
set -x

switch=br0

if [ -n $1 ];then
 /usr/bin/sudo /usr/sbin/tunctl -u `whoami` -t $1
 /usr/bin/sudo /sbin/ip link set $1 up
 sleep 0.5s
 /usr/bin/sudo /usr/sbin/brctl addif $switch $1
 exit 0
else
 echo Error: no interface specified
 exit 1
fi

When I debug this script I can see that it always ends up in Error: no interface 
specified:
bash -x /usr/local/bin/networkbridge_setup.sh
+ set -x
+ switch=br0
+ '[' -n '' ']'
+ echo 'Error: no interface specified'
Error: no interface specified
+ exit 1


Why is that?


It looks like $1 must be empty because the script was run with no 
command line arguments/parameters.


--
David.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Using KVM in user mode with public bridge

2011-05-24 Thread David Mair

On 05/24/2011 07:44 AM, c.mo...@web.de wrote:

Hello!
I have installed KVM/QEMU on my LMDE (Linux Mint Debian Edition) system.

The guest should use a public bridge that I have set up with 
/etc/network/interfaces. As you can see the bridge is configured to use a 
static IP:
  s@pc1-lmde ~ $ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

auto eth1
iface eth1 inet manual

auto br1
iface br1 inet static
 address 192.168.178.11
 netmask 255.255.255.0
 gateway 192.168.178.1
 bridge_ports eth1
 bridge_stp off
 bridge_fd 0
 bridge_maxwait 0

Starting a VM with kvm command returns this error:
  s@pc1-lmde ~ $ kvm -hda 
~/.virtualmachines/aqemu/virtualdisk_converted/vm2-windowsxp-HD01-15G.qcow 
-boot c -cdrom /dev/cdrom -m 1024 -smp 1 -net nic,macaddr=00:88:4e:ad:2d:61 
-net tap
kvm: -net tap: could not configure /dev/net/tun (tap%d): Operation not permitted
kvm: -net tap: Device 'tap' could not be initialized

Checking the permissions of file /dev/net/tun:
  s@pc1-lmde ~ $ ls -l /dev/net/tun
crw-rw-rw- 1 root root 10, 200 21. Mai 09:52 /dev/net/tun
  Starting kvm as root by means of using sudo works. Then all processes runs 
as root.
Can you advice how to troubleshoot this problem? Why do I have to be root for 
starting KVM?
I thought the group assignment is correct:
  s@pc1-lmde ~ $ groups
sudo kvm libvirt

I would prefer to run kvm in user mode, means not as root.
I assume I have to initiate the TUN/TAP interface before the VM is started.
How can I do this using a script? Is there a Howto available providing 
instructions?


That's pretty much how I do it and have the following sudo configuration 
(paths from my environment):


myuserid ALL = NOPASSWD: \
/bin/tunctl -u myuserid -t kvmtap*, \
/bin/tunctl -d kvmtap*, \
/sbin/ifconfig kvmtap* up 0.0.0.0 promisc, \
/sbin/ifconfig kvmtap* down, \
/sbin/brctl addif * kvmtap*, \
/sbin/brctl delif * kvmtap*, \

Note that there is no qemu option in my sudoers. Then, my order of use 
is as follows but I use a script to avoid having to come up with the 
referenced random digits on demand:


sudo /bin/tunctl -u myuserid -t kvmtapfour random digits
That creates a tap interface
sudo /sbin/ifconfig kvmtapsame digits as in tunctl up 0.0.0.0 promisc
That brings the tap interface up with no configuration
sudo /sbin/brctl addif br1 kvmtapsame digits as in tunctl
That adds the tap to the bridge
qemu-system-x86_64 qemu args -net nic,vlan=0,model=your 
choice,macaddr=random mac generated when config was created -net 
tap,ifname=kvmtapsame digits as in tunctl,script=no,vlan=0

Delay while you use the VM until you shut it down and the
qemu proc exits, then:
sudo /sbin/brctl delif br1 kvmtapsame digits as in tunctl
That removes the tap from the bridge
sudo /sbin/ifconfig kvmtapsame digits as in tunctl down
That brings the tap interface down
sudo /bin/tunctl -d kvmtapsame digits as in tunctl
That deletes the tap interface

I load the kvm drivers as root but as far as I can tell qemu doesn't run 
as root. So, a real world example would look like this:


sudo /bin/tunctl -u myuserid -t kvmtap1981
sudo /sbin/ifconfig kvmtap1981 up 0.0.0.0 promisc
sudo /sbin/brctl addif br1 kvmtap1981
qemu-system-x86_64 -smp 1 -m 512 -usb -localtime etc -net 
nic,vlan=0,model=e1000,macaddr=ac:de:48:6c:5c:a3 -net 
tap,ifname=kvmtap1981,script=no,vlan=0 more etc

sudo /sbin/brctl delif br1 kvmtap1981
sudo /sbin/ifconfig kvmtap1981 down
sudo /bin/tunctl -d kvmtap1981

A repeat of the same script might do this the very next time:

sudo /bin/tunctl -u myuserid -t kvmtap8358
sudo /sbin/ifconfig kvmtap8358 up 0.0.0.0 promisc
sudo /sbin/brctl addif br8 kvmtap8358
qemu-system-x86_64 -smp 1 -m 512 -usb -localtime etc -net 
nic,vlan=0,model=e1000,macaddr=ac:de:48:6c:5c:a3 -net 
tap,ifname=kvmtap8358,script=no,vlan=0 more etc

sudo /sbin/brctl delif br8 kvmtap8358
sudo /sbin/ifconfig kvmtap8358 down
sudo /bin/tunctl -d kvmtap8358

Note that the MAC address doesn't change and if you were to check, it 
should be a legitimate IEEE 802.3 private MAC address, it was generated 
when the VM was created by the same script and is stored in a 
configuration file the script uses to launch VMs. My own br1 has no host 
physical NICs connected and has no routing but I also have a br8 with 
NAT routing via netfilter/iptables and a br0 that has my physical NIC 
connected so that I can do VMs that appear on the real network. I run 
the ISC dhcp server with configuration for br1 and br8. IOW, pretty much 
a copy of the default VMWare network installation.


Hopefully that saves you repeating some of the effort I had picking out 
the tunctl/brctl operation. Best of luck.


--
David.
--
To unsubscribe from this list: 

Re: NAT networking from guest not working

2011-03-30 Thread David Mair

Hi Marc,

On 03/30/2011 08:46 AM, Marc Boorshtein wrote:

I apologize if this is the wrong list.  I have just installed Fedora
14 and gotten KVM up and running.  I installed a Windows 7 guest
without issue using NAT for networking.  The guest can ping the
default gateway, but can't reach the internet or the rest of the
network.  Here's the really odd thing, DNS resolution works.  I've had
no issues with VMWare images so I don't think its an issue with my
networking infrastructure.  Here's my uname:

Linux r2d2.tremolo.lan 2.6.38-1.fc15.x86_64 #1 SMP Tue Mar 15 05:29:00
UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

libvirtd and libvirtd-guests are both running.  Any help (including
where I should take this query if this isn't the right place) would be
greatly appreciated.


You'd need to provide more information but to be fair kvm provides no 
part of any nat implementation I'm aware of that can be used by kvm 
hosted vms. That's usually done by qemu or iptables on the host. Which 
case is defined by qemu command line so at the very least, your problem 
probably also exists with a qemu command line that includes -no-kvm and 
in that case you'd be better asking on a qemu list.


--
David Mair.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Converting QEMU Harddisk to native Partition

2011-02-15 Thread David Mair


On 02/15/2011 10:06 AM, Erik Rull wrote:

Hi all,

I have currently virtualized two partitions (/dev/sda2 and /dev/sda3)
that are exposed as QEMU Harddisks to the Windows XP Guest (Drive C and
D there).
Are there possibilities to convert or adapt those to native partitions
or native disks so that I could theoretically boot the Windows that is
placed in the virtual disk natively?

Thanks!


Anything that works on real hardware is likely to work if run in a 
guest. At the very least, one of several similar and equivalent methods 
would be, create another virtual disk a bit bigger than the Windows 
partition you want to make native and attach it to a VM with the Windows 
partition you want to make native and boot a linux rescue disk. Put a 
linux file system on the new disk and mount it (say at /mnt/workspace) 
then, assuming the Windows partition you want to make native is hda1:


# dd if=/dev/sda2 of=/mnt/workspace/windowsCdrive.img bs=1M
# dd if=/dev/sda3 of=/mnt/workspace/windowsDdrive.img bs=1M
# scp /mnt/workspace/windows*img user@vmhost:~/

I'm assuming you get how that would give you a block copy of the guest 
partitions as files on the host, which you could then lay down on a real 
disk via dd and a USB device for example.


--
David.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Converting QEMU Harddisk to native Partition

2011-02-15 Thread David Mair

On 02/15/2011 01:54 PM, Erik Rull wrote:

David Mair wrote:



I have currently virtualized two partitions (/dev/sda2 and /dev/sda3)
that are exposed as QEMU Harddisks to the Windows XP Guest (Drive C and
D there).
Are there possibilities to convert or adapt those to native partitions
or native disks so that I could theoretically boot the Windows that is
placed in the virtual disk natively?


Anything that works on real hardware is likely to work if run in a
guest. At the very least, one of several similar and equivalent methods
would be, create another virtual disk a bit bigger than the Windows
partition you want to make native and attach it to a VM with the Windows
partition you want to make native and boot a linux rescue disk. Put a
linux file system on the new disk and mount it (say at /mnt/workspace)
then, assuming the Windows partition you want to make native is hda1:

# dd if=/dev/sda2 of=/mnt/workspace/windowsCdrive.img bs=1M
# dd if=/dev/sda3 of=/mnt/workspace/windowsDdrive.img bs=1M
# scp /mnt/workspace/windows*img user@vmhost:~/

I'm assuming you get how that would give you a block copy of the guest
partitions as files on the host, which you could then lay down on a real
disk via dd and a USB device for example.



Yeah, I thought about a similar approach already but it looked too
complex to me :-) I assume that my hardware resources might be too
limited for such an operation, but I will give it a try. For saving
space I could try to do a .gz or .tgz out of it right (using dd |
tar...)?
Are there other possibilities from the host side to handle that? I heard
about the qemu-img tool but it doesn't seem to match my usecase.
Or have I just missed some parameters?


qemu-nbd (see man qemu-nbd) might be what you are looking for, booting 
a guest with it attached seems simpler to me so I admit I haven't tried 
qemu-nbd.


If it's a simple block image you can mount it on the host via the loop 
device like any unencoded disk image in a file.


You could go directly to a USB disk in a guest just by using USB 
pass-thru of a physical disk, I'd boot a linux rescue disk and use dd.


--
David Mair.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] qemu-kvm: Switch to upstream -enable-kvm semantics

2011-01-02 Thread David Mair

On 01/02/2011 03:18 AM, Avi Kivity wrote:

On 01/02/2011 12:15 PM, Jan Kiszka wrote:

Does any qemu-kvm user rely on the automatic fallback to TCG if KVM
initialization fails?


We don't know...


Speaking as an actual user of the behaviour - I wouldn't say I became 
reliant on it when I had distro kernel updates that stopped my 
hand-built kvm modules from loading and I didn't notice, but in truth I 
was taking advantage of it on powerful enough hardware 4x3GHz/8GB. On my 
2x2.3GHz/3GB laptop it was easier just to boot my 1x600MHz/2GB laptop 
with a copy of XP rather than try a Win7 or XP VM without kvm.



If not, then just set kvm_allowed to 1 in qemu-kvm
and leave the rest as upstream provides it. This fallback is really
annoying, specifically as the only point of qemu-kvm is, well, running
over KVM.


I agree, upstream's behaviour is better, and the proposed -accel is even
better. But we can't just change behaviour randomly, even if it's an
improvement.



If the behaviour was as described by Jan I would have been forced to put 
the effort into re-building kvm modules against my updated kernel sooner 
or intentionally adjust my qemu command line to disable kvm. You also 
make a good point but I would say in response that I was encouraged to 
tolerate a reduction in utility by the current behaviour rather than 
deal with what's really my own configuration error on my hosts and I 
think then it's an improvement for qemu-kvm with kvm_allowed != 0 to 
fail to load when kvm is not present. Your point comes down to the guy 
with hosted services on VMs that he guarantees to always be running 
(and is dependent on the current behaviour for it). He will think 
differently from me and be especially mad if he doesn't read the 
release-notes when he updates but it's not like he couldn't adjust the 
scripts he already starts qemu-kvm with to check for the error and retry 
with -no-kvm if appropriate...presumably upstream has an equally usable 
though non-specific error code to what happens in Markus's patch.


--
David.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Networkconfiguration with KVM

2010-04-05 Thread David Mair

On 04/05/2010 08:35 AM, Dan Johansson wrote:

On Monday 05 April 2010 13.34:26 mathias dufresne wrote:

Hi,

For networks 1 and 2 (respectively 192.168.1.0/24 and 192.168.2.0/24, I'll
acll also network 3 for the last one) you'll have to use bridges.
For network 3 you can use vde which is quite simply to use and gives
possibility to add new virtual networks without the need of physical
interface.

For bridges configuration:
brctl addbr ${brname}
brctl setfd ${brname} 0
brctl sethello ${brname} 1
brctl stp ${brname} off
brct addif ${brname} ${physical_if}

Here you can add an IP to you're bridge interface if needed for the host
  has access to this network. Host's IP must by set up on bridge interface
  with configuration, if IP is set up on physical interface it is not
  working. I'm wondering why, my network knowledge is not much :/

Then when you'll run qemu to set up a new VM you'll have to use a tap
  device for the VM

One important thing when use several networks in the same host is then vlan
ID you'll use for networks. These vlans aren't (from my understanding : )
802.1Q vlans but pure qemu/kvm concepts. If you don't set up each VM's
interface on the right kvm's vlan they will all be set up on vlan number 0,
which means packets from all networks will appear everywhere (tcpdump on
192.168.1.0/24 card will see traffic for others networks).

Here is the command I use to launch a VM with two bridged interfaces and
  one other on some vde network:
screen -d -m qemu-system-x86_64 -m 64 \
-net tap,vlan=0,ifname=tap0,script=/path/to/scripts/kvm-ifup.br0 \
-net nic,vlan=0,model=e1000,macaddr=52:54:00:01:ab:cd \
-net tap,vlan=3,ifname=tap1,script=/path/to/scripts/kvm-ifup.br1 \
-net nic,vlan=3,model=e1000,macaddr=52:54:00:03:ab:cd \
-net vde,vlan=2,sock=/var/vde/switches/vdelan0 \
-net nic,vlan=2,model=e1000,macaddr=52:54:00:02:ab:cd \
-hda /path/to/disks/vm.vmdk \
-nographic

Note the vlan=X option set on both -net arguments for each interface.

For VDE switchs:
/usr/bin/vde_switch -m 770 -g qemu -daemon -n 8 -t dummy10 -s
/var/vde/switches/vdelan0 -M /var/vde/management/vdelan0

I use dummy interface on host to set up vde networks because the host
mustn't have access on these networks.
-s directory where VDE's unix sockets will be store for this network
-M management socket (I haven't yet understood how to use them :p)
-n number of port on the switch
other options are quite easy to understand.

Finally my scripts to set up bridged interface are the following:
--
#!/bin/sh
#set -x
switch=`echo $0 | awk -F\. '{ print $NF}'`
if [ -n $1 ];then
 #/usr/bin/tunctl -u `whoami` -t $1
 /sbin/ip link set $1 up
 sleep 0.5s
 /sbin/brctl addif $switch $1
 exit 0
else
 echo Error: no interface specified
 exit 1
fi
--
I use one script per bridge named kvm-ifup.${brname} because the script's
name define the bridge on which the interface will be attached
  (kvm-ifup.br0 -  br0 and kvm-ifup.br1 -  br1).

I use VDE switch for networks on which host isn't plugged because they are
simpler to use for me but it is not the only way to proceed.



A last thing, I have a physical card on which is plugged my modem. As I
don't want to expose the host on Internet I use a VM to act as a firewall.
As I just can't give this VM direct access on the physical card dedicated
  to Internet I use a bridge:

modem --- physical card - bridge - tap  VM's internal card

The modem knows only one MAC address: the one from physical interface but
this physical interface as no IP. The bridge has same MAC address as
physical interface but has no more IP. The card with an IP is the VM's
internal card so for packets pass through all these interface without IP I
use ebtables to nat MAC address between physical interface and VM's
internal card:
ebtables -t nat -A PREROUTING -i $PHYS_DEV_NAME -d $PHYS_DEV_MAC -j dnat
--to-destination $VIRT_DEV_MAC
ebtables -t nat -A POSTROUTING -o $VIRT_DEV_NAME -s $VIRT_DEV_MAC -j snat
--to-source $PHYS_DEV_MAC

Finally there are some interesting links:
forum's thread related to vlan issues
http://serverfault.com/questions/101477/issue-with-multiple-bridging-for-kv
m-hosts

something about bridges:
http://www.savelono.com/linux/using-multiple-interfaces-with-kvm-and-xen.ht
ml

different method to build networks using qemu/kvm:
http://people.gnome.org/~markmc/qemu-networking.htmlhttp://people.gnome.or
g/%7Emarkmc/qemu-networking.html

Hoping this helps.

Kindly regards,

mathias

2010/4/5 Dan Johanssonk...@dmj.nu


On Sunday 04 April 2010 22.23:28 Held Bernhard wrote:

Am 04.04.2010 20:02, schrieb Dan Johansson:

On Sunday 04 April 2010 15.00:26 sudhir kumar wrote:

On Sun, Apr 4, 2010 at 5:47 PM, Dan Johanssonk...@dmj.nu  wrote:

Hi,

I am new to this list and to KVM (and qemu) so please be gentle
with me. Up until now I have been running my virtualizing  using
VMWare-Server. Now I want to try KVM due to some issues with 

Re: howto control VM from outside (shutdown...)

2009-01-19 Thread David Mair

Paolo Pedaletti wrote:

Ciao,

the question was posted here:
http://www.linux-kvm.com/content/daemonize-vs-monitor-commands

The original post asked about gracefully shutting down KVM guest using
scripts

When I shutdown the host machine, I want to
hibernate/shutdown/screendump/savevm/senkeys/system_powerdown(/migrate?)
also all the VM running (without using libvirt)

I could ssh to each VM and halt it, but does exist a better/cleaner
solution?

How can I communicate to kvm console?


Take a look at the qemu -monitor option. You can use it to re-direct the 
monitor console to a large number of character devices, including 
sockets. The settings are the same as for the -serial option. I've used 
it to access the monitor console from a telnet client.


--
David.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Detect guest panic

2008-11-18 Thread David Mair

Emmanuel Lacour wrote:

Dear users/developers,

i have a guest which freeze 2 or 3 times per weeks (nothin in the logs,
blank vnc screen). I'm going to try to fix this by testing upgrade to
more recnt kernel/kvm, but I would like in the meantime to make a script
which restart the guest domain in case it freezes.

Is there a way to detect that the VM is in this kind of panic?
  
If the guest has a reachable IP address the simplest way might be to 
ping the guest from the host every so often and, if it stops responding 
for long enough to make you believe it has frozen, kill the qemu process 
and run it again. I suppose you could also expose the qemu console via a 
socket or other host file descriptor then you can have the pinging 
program on the host try to reset the guest without killing the qemu process.


--
David.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Is ntpd in guest necessary?

2008-11-13 Thread David Mair

Michael Tokarev wrote:

A question that I asked on irc many times,
but got no answer..

Giving guest linux with CONFIG_KVM_TIME set,
is it necessary to run ntpd in it for accurate
time, or ntpd on host is sufficient?

And the same, but without CONFIG_KVM_TIME ?


What was your experience when you tested with each config?

--
David.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Can several guests run simultaneously on KVM

2008-08-01 Thread David Mair

Stephen Liu wrote:

Hi folks,


Can I run serveral guests on KVM at the same time similar to VMware
hypervisor?


Yes.

--
David.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: networking setup problem

2008-07-21 Thread David Mair

Lynn Kerby wrote:


On Jul 20, 2008, at 10:07 PM, David Mair wrote:


Paolo Pedaletti wrote:

Ciao Uri:

Does using a different ifname help ?
PROXY:  ifname=tap2 and dmz2
WEBAPP: ifname=tap1 and dmz1
DB: ifname=tap0 and dmz0

no, it doesn't.
always
destination host unreachable

Also check route on guests.

yes, they are correct, the default to external network eth0 while all
eth1 10.0.2.0/24 internal
nothing. :-(
someone has tried a working setup for 2 network connections, one
public and one private ?


Yes. On this host I have equivalents for all the VMware default 
networks (vmnet0, vmnet1 and vmnet8). Each of them is built with host 
tools (brctl, tunctl, host IP stack, ISC dhcpd).


It looks like the -net user and socket listen/connect options do not 
create shared virtual cabling between more than one and two guests 
respectively. The documentation implies that because it says that the 
-net socket mcast option does create a virtual cabling bus you can 
connect more than two guests to. This might work for you:


kvm -name PROXY
-net nic,vlan=0,macaddr=00:18:BE:EF:17:2A,model=rtl8139
-net tap,vlan=0,ifname=tap0,script=./qemu-ifup.sh
-net nic,vlan=1,macaddr=00:18:BE:EF:17:2B,model=rtl8139
-net socket,vlan=1,mcast=230.0.0.1:1234
-drive index=0,media=disk,if=scsi,file=./ubuntu-server.PROXY.root,boot=on
-drive index=1,media=disk,if=scsi,file=./ubuntu-server.PROXY.home
-drive index=2,media=disk,if=scsi,file=./ubuntu-server.PROXY.swap

kvm -name WEBAPP
-net nic,vlan=0,macaddr=00:18:BE:EF:17:1A,model=rtl8139
-net tap,vlan=0,ifname=tap0,script=./qemu-ifup.sh
-net nic,vlan=1,macaddr=00:18:BE:EF:17:1B,model=rtl8139
-net socket,vlan=1,mcast=230.0.0.1:1234
-drive index=0,media=disk,if=scsi,file=./ubuntu-server.WEB.root,boot=on
-drive index=1,media=disk,if=scsi,file=./ubuntu-server.WEB.home
-drive index=2,media=disk,if=scsi,file=./ubuntu-server.WEB.swap

kvm -name DB
-net nic,vlan=0,macaddr=00:18:BE:EF:17:0A,model=rtl8139
-net tap,vlan=0,ifname=tap0,script=./qemu-ifup.sh
-net nic,vlan=1,macaddr=00:18:BE:EF:17:0B,model=rtl8139
-net socket,vlan=1,mcast=230.0.0.1:1234
-drive index=0,media=disk,if=scsi,file=./ubuntu-server.DB.root,boot=on
-drive index=1,media=disk,if=scsi,file=./ubuntu-server.DB.home
-drive index=2,media=disk,if=scsi,file=./ubuntu-server.DB.swap

That's suitable for testing but not for production use IMO. The guest 
to guest traffic on the vlan=1 NICs may be visible on host public 
interfaces (tunneled in UDP multicast traffic of course). There will 
be no DHCP server on the vlan=1 guest NICs unless you install one. For 
a production environment you'll have to do more work.


I just noticed in David's post (and went back to yours also) that you 
are specifying ifname=tap0 for each of the guests.  You will need to 
assign each guest it's *own* tap interface and attach that to the 
appropriate bridge(s) for this to work.


I'm not familiar with the '-net socket' stuff here, so I don't know what 
that does for you.


It should allow for private guest to guest [virtual] cabling without needing any 
host configuration. FWIW, I do it the way you do...with a host bridge and a tap for 
each guest.


--
David.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: networking setup problem

2008-07-20 Thread David Mair

Paolo Pedaletti wrote:

Ciao Uri:


Does using a different ifname help ?
PROXY:  ifname=tap2 and dmz2
WEBAPP: ifname=tap1 and dmz1
DB: ifname=tap0 and dmz0


no, it doesn't.

always
destination host unreachable


Also check route on guests.


yes, they are correct, the default to external network eth0 while all
eth1 10.0.2.0/24 internal

nothing. :-(

someone has tried a working setup for 2 network connections, one
public and one private ?


Yes. On this host I have equivalents for all the VMware default networks 
(vmnet0, vmnet1 and vmnet8). Each of them is built with host tools 
(brctl, tunctl, host IP stack, ISC dhcpd).


It looks like the -net user and socket listen/connect options do not 
create shared virtual cabling between more than one and two guests 
respectively. The documentation implies that because it says that the 
-net socket mcast option does create a virtual cabling bus you can 
connect more than two guests to. This might work for you:


kvm -name PROXY
-net nic,vlan=0,macaddr=00:18:BE:EF:17:2A,model=rtl8139
-net tap,vlan=0,ifname=tap0,script=./qemu-ifup.sh
-net nic,vlan=1,macaddr=00:18:BE:EF:17:2B,model=rtl8139
-net socket,vlan=1,mcast=230.0.0.1:1234
-drive index=0,media=disk,if=scsi,file=./ubuntu-server.PROXY.root,boot=on
-drive index=1,media=disk,if=scsi,file=./ubuntu-server.PROXY.home
-drive index=2,media=disk,if=scsi,file=./ubuntu-server.PROXY.swap

kvm -name WEBAPP
-net nic,vlan=0,macaddr=00:18:BE:EF:17:1A,model=rtl8139
-net tap,vlan=0,ifname=tap0,script=./qemu-ifup.sh
-net nic,vlan=1,macaddr=00:18:BE:EF:17:1B,model=rtl8139
-net socket,vlan=1,mcast=230.0.0.1:1234
-drive index=0,media=disk,if=scsi,file=./ubuntu-server.WEB.root,boot=on
-drive index=1,media=disk,if=scsi,file=./ubuntu-server.WEB.home
-drive index=2,media=disk,if=scsi,file=./ubuntu-server.WEB.swap

kvm -name DB
-net nic,vlan=0,macaddr=00:18:BE:EF:17:0A,model=rtl8139
-net tap,vlan=0,ifname=tap0,script=./qemu-ifup.sh
-net nic,vlan=1,macaddr=00:18:BE:EF:17:0B,model=rtl8139
-net socket,vlan=1,mcast=230.0.0.1:1234
-drive index=0,media=disk,if=scsi,file=./ubuntu-server.DB.root,boot=on
-drive index=1,media=disk,if=scsi,file=./ubuntu-server.DB.home
-drive index=2,media=disk,if=scsi,file=./ubuntu-server.DB.swap

That's suitable for testing but not for production use IMO. The guest to 
guest traffic on the vlan=1 NICs may be visible on host public 
interfaces (tunneled in UDP multicast traffic of course). There will be 
no DHCP server on the vlan=1 guest NICs unless you install one. For a 
production environment you'll have to do more work.


--
David.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: networking setup problem

2008-07-16 Thread David Mair

paolo pedaletti wrote:

Hi,
I hope this is the right ml to submit my problem.

Abstract: I can't setup 2 different network inside my VMs, one public 
and one private.


Scheme:

  eth0 -
 -| proxy |---eth1
 |-  |
H|   |
O|   eth0 -  |
S|| web   |--|eth1
T|-  |
 |   |
 |   eth0 -  |
 || db|---eth1
  -


this is a classic LAMP, sparse on 3 VM

1) front end, proxy (apache2 in reverse with mod-security)
2) application server, web (apache2 + php5)
3) database (mysql5)

(it's a test/backup environment)

each VM must have 2 network card:
eth0 on the local network, in bridge with the host physical eth0
eth1 on the virtual private network, for internal communications between 
them


saying that, ... it doesn't work :-(
(linux ubuntu 8.04 2.6.24-19-generic, kvm-62)

these are the command lines:

kvm -name PROXY
-net nic,vlan=0,macaddr=00:18:BE:EF:17:2A,model=rtl8139
-net tap,vlan=0,ifname=tap0,script=./qemu-ifup.sh
-net nic,vlan=1,macaddr=00:18:BE:EF:17:2B,model=rtl8139
-net user,vlan=1,ifname=dmz0,script=./qemu-ifup.sh
-drive index=0,media=disk,if=scsi,file=./ubuntu-server.PROXY.root,boot=on
-drive index=1,media=disk,if=scsi,file=./ubuntu-server.PROXY.home
-drive index=2,media=disk,if=scsi,file=./ubuntu-server.PROXY.swap

kvm -name WEBAPP
-net nic,vlan=0,macaddr=00:18:BE:EF:17:1A,model=rtl8139
-net tap,vlan=0,ifname=tap0,script=./qemu-ifup.sh
-net nic,vlan=1,macaddr=00:18:BE:EF:17:1B,model=rtl8139
-net user,vlan=1,ifname=dmz0,script=./qemu-ifup.sh
-drive index=0,media=disk,if=scsi,file=./ubuntu-server.WEB.root,boot=on
-drive index=1,media=disk,if=scsi,file=./ubuntu-server.WEB.home
-drive index=2,media=disk,if=scsi,file=./ubuntu-server.WEB.swap

kvm -name DB
-net nic,vlan=0,macaddr=00:18:BE:EF:17:0A,model=rtl8139
-net tap,vlan=0,ifname=tap0,script=./qemu-ifup.sh
-net nic,vlan=1,macaddr=00:18:BE:EF:17:0B,model=rtl8139
-net user,vlan=1,ifname=dmz0,script=./qemu-ifup.sh
-drive index=0,media=disk,if=scsi,file=./ubuntu-server.DB.root,boot=on
-drive index=1,media=disk,if=scsi,file=./ubuntu-server.DB.home
-drive index=2,media=disk,if=scsi,file=./ubuntu-server.DB.swap


$ cat /etc/qemu-ifup
-8-88--
#!/bin/sh
set -x

echo Executing $0

case $1 in
tap*)echo tun network
 BRIDGE=br0
if [ -z $(ifconfig $BRIDGE) ] ; then
/usr/sbin/brctl addbr $BRIDGE
dhclient $BRIDGE
fi
/usr/sbin/tunctl -u `whoami` -t $1
echo Bringing up $1 for bridged mode...
/sbin/ifconfig $1 0.0.0.0 promisc up
/sbin/ip link set $1 up
sleep 0.5s
echo Adding $1 to br0...
/usr/sbin/brctl addif $BRIDGE $1
;;

dmz*)echo dmz network
 BRIDGE=br1
if [ -z $(ifconfig $BRIDGE) ] ; then
/usr/sbin/brctl addbr $BRIDGE
dhclient $BRIDGE
fi
/usr/sbin/tunctl -u `whoami` -t $1
echo Bringing up $1 for bridged mode...
/sbin/ifconfig $1 0.0.0.0 promisc up
/sbin/ip link set $1 up
sleep 0.5s
echo Adding $1 to $BRIDGE...
/usr/sbin/brctl addif $BRIDGE $1
;;

*)   echo Error: no interface specified or interface '$1' invalid
exit 1
esac
-8-88--



eth0 works for all the VM, eth1 doesn't.

constrain: no dhcp, all static ip

any suggestion?



AFAIK, -net user does not need an ifname or script argument - there's no host 
interface for the user mode stack. Try these:


kvm -name PROXY
-net nic,vlan=0,macaddr=00:18:BE:EF:17:2A,model=rtl8139
-net tap,vlan=0,ifname=tap0,script=./qemu-ifup.sh
-net nic,vlan=1,macaddr=00:18:BE:EF:17:2B,model=rtl8139
-net user,vlan=1
-drive index=0,media=disk,if=scsi,file=./ubuntu-server.PROXY.root,boot=on
-drive index=1,media=disk,if=scsi,file=./ubuntu-server.PROXY.home
-drive index=2,media=disk,if=scsi,file=./ubuntu-server.PROXY.swap

kvm -name WEBAPP
-net nic,vlan=0,macaddr=00:18:BE:EF:17:1A,model=rtl8139
-net tap,vlan=0,ifname=tap0,script=./qemu-ifup.sh
-net nic,vlan=1,macaddr=00:18:BE:EF:17:1B,model=rtl8139
-net user,vlan=1
-drive index=0,media=disk,if=scsi,file=./ubuntu-server.WEB.root,boot=on
-drive index=1,media=disk,if=scsi,file=./ubuntu-server.WEB.home
-drive index=2,media=disk,if=scsi,file=./ubuntu-server.WEB.swap

kvm -name DB
-net nic,vlan=0,macaddr=00:18:BE:EF:17:0A,model=rtl8139
-net tap,vlan=0,ifname=tap0,script=./qemu-ifup.sh
-net nic,vlan=1,macaddr=00:18:BE:EF:17:0B,model=rtl8139
-net user,vlan=1
-drive index=0,media=disk,if=scsi,file=./ubuntu-server.DB.root,boot=on
-drive index=1,media=disk,if=scsi,file=./ubuntu-server.DB.home
-drive index=2,media=disk,if=scsi,file=./ubuntu-server.DB.swap

--
David.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Live migration without SDL

2008-07-10 Thread David Mair

Ty! Boyack wrote:
 Folks,

 I'm afraid I'm missing something very basic here.  I'm looking to try
 out the live migration facility, and all the documentation I'm seeing
 shows to initiate the migration by going to the qemu monitor from the
 SDL windows (alt-ctrl-2).  However, I'd like to run my VMs with a VNC
 head, so I'm not sure where the interface is to initiate the migration
 without the SDL layer in place.

I have no trouble switching to the monitor for a VM with a VNC head: alt-ctrl-2 
works as expected in the VNC client.


 Is the qemu monitor available through some other mechanism?

You can configure qemu to expose the monitor console via any of the serial port 
configuration types. That lets you make the monitor available at a udp or tcp port, 
e.g.:


# qemu-system-x86_64 other options -monitor tcp::

The double colon is intended. There are lots of additional features beyond that 
example.

 This would be most helpful if the mechanism was reachable (and
 scriptable) from the HOST os, so that the HOST (in cooperation with
 another HOST) could initiate a migration of one or more GUEST VMs.

That would be the monitor command line option then.

snip

--
David.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: KVM status and dynamic mem/cpu question.

2008-07-09 Thread David Mair

jd wrote:

hi

1.   It there away to know various states of a VM via console (or any other 
means?) ?
   -- Running
   -- Paused
   -- Booting/Shutting down
   -- crashed
  etc ?
I cant find any console command that can tell that. If this is not 
available, is there a plan to add it ?


I don't think booting and shutting down have any meaning to qemu. It's just a 
physical PC for these purposes. Booting and shutting down are runtime that only 
means something to the software running on the PC. As far as the PC is concerned it 
feels pretty much either on or off.


The same is almost true for crashed IMO. Crashed is a runtime state for the software 
running on the PC, not a state of the hardware - except for a small number of cases.


That leaves you with running or paused. I can't find a way to tell those states from 
the console.



2. Is there a way to shrink/expand memory or VCPUs for a running VM ?



I've never tried it but in the qemu console:

(qemu) help
.
.
.
cpu_set cpu [online|offline] -- change cpu state
.
.
.

As described, it won't let you add CPUs above what you specified on the command line 
that started the VM but it will let you do effectively the same thing as removing 
and adding CPUs from/to the guest.


---
David.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Question regarding KVM and smart card reader support.

2008-07-05 Thread David Mair

Justin Piszcz wrote:

Hello,

By utilizing a local smart card reader and regular Windows XP/etc one 
can utilize the smart card remotely.


If I take a smart card reader (USB) and attach it to Linux assuming the 
drivers recognized it OK is there anyway to make or have this device 
pass-through to the KVM (Windows) on Linux?


I did not see any kvm smart card options in qemu-system-x86_64 -h output.


The -usbdevice option can pass-through host devices identified by bus 
address or vendor:product ID without the need for device class specific 
options.


To attach the device at usb bus address 5.3 (bus 5, device 3):

# qemu-system-x86_64 other options -usb -usbdevice host:5.3


To add the device with vendor ID 0c5b and product ID 4201:

# qemu-system-x86_64 other options -usb -usbdevice host:0c5b:4201

You need to have usbdevfs mounted at /proc/bus/usb for it to work. You 
can attach devices on the qemu command line and attach or detach devices 
via the qemu console while the VM is running (help usb_add; help usb_del).


---
David.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html