Re: Can VM be copied to another PC

2010-01-31 Thread Kashyap Chamarthy
On Mon, Feb 1, 2010 at 9:32 AM,   wrote:
> Hi folks,
>
> Host – Fedora 12 64bit
> KVM – virtualization software
>
>
> I have 8 VMs on this virtual machine running different OS. Can VMs be
> moved/copied to another PC of similar hardware config running Fedora 12
> (64bit) as host and KVM

The below worked for me between two Fedora 12 hosts. I used
virsh(comes with libvirt-client)

1) 'virsh dumpxml  '(this will dump the  guest
machine info. into XML)
2) copy your qcow2(or whatever format) image files from host1 to
host2(which of similar config as host1)
3) 'virsh define '  for the dumped xml  files from step 1)
(for each of the guests)
4) Now you should be good to start/run the guests on your host2 running KVM

Your milage may vary. See virsh manpages for more.
>
> If Yes, whether copying following files,
>
> e.g. copying following files and paste them on the same /path/to/directory
>
> # ls -l /etc/libvirt/qemu/
> total 52
> ...
> -rw--- 1 root root 1293 2010-01-14 22:48 vm01.xml
> -rw--- 1 root root 1293 2010-01-11 17:19 vm02.xml
> -rw--- 1 root root 1302 2010-01-11 19:11 vm03_ub9164.xml
> -rw--- 1 root root 1273 2010-01-12 02:09 vm04_f1264.xml
> -rw--- 1 root root 1193 2010-01-23 02:21 vm05_wser08.xml
> -rw--- 1 root root 1368 2010-01-25 22:44 vm06_wser08.xml
> -rw--- 1 root root 1389 2010-01-27 11:04 vm07_wser0832.xml
> -rw--- 1 root root 1370 2010-01-27 22:23 vm08_vista32.xml
> ...
>
>
> # ls -l /home/satimis/ | grep vm
> -rwxr-xr-x 1 root root 12884901888 2010-01-22 07:56 vm03_9164.qcow2
>
>
> # ls -l /home/satimis/VM/ | grep vm
> -rwxr-xr-x 1 root root 12884901888 2010-01-23 08:19 vm01.qcow2
> -rwxr-xr-x 1 root root 12884901888 2010-01-23 08:16 vm02.qcow2
> -rwxr-xr-x 1 root root 12884901888 2010-01-26 22:33 vm04_f1264.qcow2
>
> # ls -l /home/satimis/VM/VMWIN/ | grep vm
> -rwxr-xr-x 1 root root 32212254720 2010-01-23 06:55 vm05_wser08.qcow2
> -rwxr-xr-x 1 root root 32212254720 2010-01-27 23:07 vm06_wser08.qcow2
> -rwxr-xr-x 1 root root 32212254720 2010-01-27 12:45 vm07_wser0832.qcow2
> -rwxr-xr-x 1 root root 32212254720 2010-01-28 00:14 vm08_vista32.qcow2
>
>
> What about if the host is running different OS, say Debian etc. can it also
> work?

haven't tried this.

/kashyap

>
> TIA
>
>
> B.R.
> Stephen L
>
> --
> 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
>
--
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: How to edit *.qcow2

2010-01-31 Thread Terry
you need nbd-client and qemu-nbd to access qcow2 file.

sati...@pacific.net.hk wrote:
> Hi folks,
> 
> KVM
> host – Debian 5.0
> 
> I need to mount kvm/qemu *.qcow2 image amending/reading its content. I
> can't figure out the type of file "-t"
> 
>1. mount -t mke2fs -o loop VM/vm30.qcow2 /mnt
>2. mount -t e2fs -o loop VM/vm30.qcow2 /mnt
>3. mount -o loop VM/vm30.qcow2 /mnt
>4. mount -t ext3 -o loop VM/vm30.qcow2 /mnt
>5. mount -t ext2 -o loop VM/vm30.qcow2 /mnt
> 
> None of them can work. Please help TIA  Pointer would be appreciated.
> 
> 
> B.R.
> Stephen L
> 
> -- 
> 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
> 

--
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


How to edit *.qcow2

2010-01-31 Thread satimis

Hi folks,

KVM
host – Debian 5.0

I need to mount kvm/qemu *.qcow2 image amending/reading its content. I  
can't figure out the type of file "-t"


   1. mount -t mke2fs -o loop VM/vm30.qcow2 /mnt
   2. mount -t e2fs -o loop VM/vm30.qcow2 /mnt
   3. mount -o loop VM/vm30.qcow2 /mnt
   4. mount -t ext3 -o loop VM/vm30.qcow2 /mnt
   5. mount -t ext2 -o loop VM/vm30.qcow2 /mnt

None of them can work. Please help TIA  Pointer would be appreciated.


B.R.
Stephen L

--
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


Can VM be copied to another PC

2010-01-31 Thread satimis

Hi folks,

Host – Fedora 12 64bit
KVM – virtualization software


I have 8 VMs on this virtual machine running different OS. Can VMs be  
moved/copied to another PC of similar hardware config running Fedora  
12 (64bit) as host and KVM


If Yes, whether copying following files,

e.g. copying following files and paste them on the same /path/to/directory

# ls -l /etc/libvirt/qemu/
total 52
...
-rw--- 1 root root 1293 2010-01-14 22:48 vm01.xml
-rw--- 1 root root 1293 2010-01-11 17:19 vm02.xml
-rw--- 1 root root 1302 2010-01-11 19:11 vm03_ub9164.xml
-rw--- 1 root root 1273 2010-01-12 02:09 vm04_f1264.xml
-rw--- 1 root root 1193 2010-01-23 02:21 vm05_wser08.xml
-rw--- 1 root root 1368 2010-01-25 22:44 vm06_wser08.xml
-rw--- 1 root root 1389 2010-01-27 11:04 vm07_wser0832.xml
-rw--- 1 root root 1370 2010-01-27 22:23 vm08_vista32.xml
...


# ls -l /home/satimis/ | grep vm
-rwxr-xr-x 1 root root 12884901888 2010-01-22 07:56 vm03_9164.qcow2


# ls -l /home/satimis/VM/ | grep vm
-rwxr-xr-x 1 root root 12884901888 2010-01-23 08:19 vm01.qcow2
-rwxr-xr-x 1 root root 12884901888 2010-01-23 08:16 vm02.qcow2
-rwxr-xr-x 1 root root 12884901888 2010-01-26 22:33 vm04_f1264.qcow2

# ls -l /home/satimis/VM/VMWIN/ | grep vm
-rwxr-xr-x 1 root root 32212254720 2010-01-23 06:55 vm05_wser08.qcow2
-rwxr-xr-x 1 root root 32212254720 2010-01-27 23:07 vm06_wser08.qcow2
-rwxr-xr-x 1 root root 32212254720 2010-01-27 12:45 vm07_wser0832.qcow2
-rwxr-xr-x 1 root root 32212254720 2010-01-28 00:14 vm08_vista32.qcow2


What about if the host is running different OS, say Debian etc. can it  
also work?


TIA


B.R.
Stephen L

--
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


Install NetBSD 5.0.1/Sparc64 on Qemu falied

2010-01-31 Thread dixlor name
# wget ftp://iso.netbsd.org/pub/NetBSD/iso/5.0.1/sparc64cd-5.0.1.iso
# qemu-img create -f qcow2 NETBSD.qcow2 12G;
# qemu-system-sparc64 -hda ./NETBSD.qcow2 -cdrom sparc64cd-5.0.1.iso;

In QEMU:

0 > boot cdrom

NetBSD IEEE 1275 Bootblock
Invalid superblock magic

byte-load: exception caught!

ok

0 >


That's all :(
--
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


Install NetBSD 5.0.1/Sparc64 on Qemu falied

2010-01-31 Thread dixlor name
# wget ftp://iso.netbsd.org/pub/NetBSD/iso/5.0.1/sparc64cd-5.0.1.iso
# qemu-img create -f qcow2 NETBSD.qcow2 12G;
# qemu-system-sparc64 -hda ./NETBSD.qcow2 -cdrom sparc64cd-5.0.1.iso;

In QEMU say:

0 > boot cdrom

NetBSD IEEE 1275 Bootblock
Invalid superblock magic

byte-load: exception caught!

ok

0 >

That's all :(
--
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


[ kvm-Bugs-2941282 ] Ubuntu 10.04 installer fails due to I/O errors with virtio

2010-01-31 Thread SourceForge.net
Bugs item #2941282, was opened at 2010-01-28 00:19
Message generated for change (Comment added) made by intgr
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=893831&aid=2941282&group_id=180599

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 7
Private: No
Submitted By: Marti Raudsepp (intgr)
Assigned to: Nobody/Anonymous (nobody)
Summary: Ubuntu 10.04 installer fails due to I/O errors with virtio

Initial Comment:
I tried installing Ubuntu 10.04 and Fedora 12 in a KVM virtual machine using 
virtio, on a 8G raw file-backed disk. Both installers failed half-way due to 
I/O errors. So I tried reproducing it and managed to repeat it 6 times. The bug 
doesn't occur with IDE emulation. The bug happens fairly quickly with -smp 4 -- 
usually within 5 minutes -- but is much rarer with -smp 1.

Ubuntu installer has kernel 2.6.32-11-generic
Fedora 12 has kernel 2.6.31.5-127.fc12.x86_64
Host has kernel 2.6.32.6 (Arch Linux) and QEMU 0.12.2

When testing with -smp 1, it also produced a kernel oops from 
"block/blk-core.c:245". This line warns when the function is called with 
interrupts enabled:
void blk_start_queue(struct request_queue *q)
{
WARN_ON(!irqs_disabled());

queue_flag_clear(QUEUE_FLAG_STOPPED, q);
__blk_run_queue(q);
}


--- host machine ---

[ma...@newn]% qemu-kvm --version
QEMU PC emulator version 0.12.2 (qemu-kvm-0.12.2), Copyright (c) 2003-2008 
Fabrice Bellard
[ma...@newn]% ps aux |grep crash
root 16283 31.4  7.1 427020 289960 ?   Sl   22:44   8:37 
/usr/bin/qemu-kvm -S -M pc-0.11 -enable-kvm -m 256 -smp 1 -name 
ubuntu-crashtest -uuid 0d7d4f2d-5589-160b-1f1b-75d46e293a2c -chardev 
socket,id=monitor,path=/var/lib/libvirt/qemu/ubuntu-crashtest.monitor,server,nowait
 -monitor chardev:monitor -boot d -drive 
file=/store/iso/lucid-desktop-amd64.iso,if=ide,media=cdrom,index=2,format=raw 
-drive file=/store/virt/ubuntu-crashtest.img,if=virtio,index=0,format=raw -net 
nic,macaddr=52:54:00:45:e7:19,vlan=0,name=nic.0 -net 
tap,fd=43,vlan=0,name=tap.0 -serial none -parallel none -usb -usbdevice tablet 
-vnc 127.0.0.1:1 -k en-us -vga cirrus -soundhw es1370 -balloon virtio
marti17700  0.0  0.0   8360   968 pts/4S+   23:11   0:00 grep crash
[ma...@newn]% stat /store/virt/ubuntu-crashtest.img
  File: `/store/virt/ubuntu-crashtest.img'
  Size: 8589934592  Blocks: 5615368IO Block: 4096   regular file
Device: fe01h/65025dInode: 4718596 Links: 1
Access: (0600/-rw---)  Uid: (0/root)   Gid: (0/root)
Access: 2010-01-27 22:43:45.128113080 +0200
Modify: 2010-01-27 23:09:11.523577452 +0200
Change: 2010-01-27 23:09:11.523577452 +0200
[ma...@newn]% uname -a
Linux newn 2.6.32-ARCH #1 SMP PREEMPT Mon Jan 25 20:33:50 CET 2010 x86_64 AMD 
Phenom(tm) II X4 940 Processor AuthenticAMD GNU/Linux
[ma...@newn]% cat /proc/cpuinfo
processor   : 0
vendor_id   : AuthenticAMD
cpu family  : 16
model   : 4
model name  : AMD Phenom(tm) II X4 940 Processor
stepping: 2
cpu MHz : 800.000
cache size  : 512 KB
physical id : 0
siblings: 4
core id : 0
cpu cores   : 4
apicid  : 0
initial apicid  : 0
fpu : yes
fpu_exception   : yes
cpuid level : 5
wp  : yes
flags   : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov 
pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb 
rdtscp lm 3dnowext 3dnow constant_tsc rep_good nonstop_tsc extd_apicid pni 
monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a 
misalignsse 3dnowprefetch osvw ibs skinit wdt
bogomips: 6028.69
TLB size: 1024 4K pages
clflush size: 64
cache_alignment : 64
address sizes   : 48 bits physical, 48 bits virtual
power management: ts ttp tm stc 100mhzsteps hwpstate

*snip* three more CPU cores

--- Ubuntu guest VM ---

ubu...@ubuntu:/tmp$ uname -a
Linux ubuntu 2.6.32-11-generic #15-Ubuntu SMP Tue Jan 19 20:38:41 UTC 2010 
x86_64 GNU/Linux
ubu...@ubuntu:/tmp$ cat /sys/block/vda/stat
   7388948289  1661218   39497026765   947851  6284676  9459960
0   987890  9893220
ubu...@ubuntu:/tmp$ dmesg
[0.00] Initializing cgroup subsys cpuset
[0.00] Initializing cgroup subsys cpu
[0.00] Linux version 2.6.32-11-generic (bui...@crested) (gcc version 
4.4.3 20100116 (prerelease) (Ubuntu 4.4.2-9ubuntu4) ) #15-Ubuntu SMP Tue Jan 19 
20:38:41 UTC 2010 (Ubuntu 2.6.32-11.15-generic)
[0.00] Command line: BOOT_IMAGE=/casper/vmlinuz 
file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity 
initrd=/casper/initrd.lz quiet splash --
[0.00] KERNEL supported cpus:
[0.00]   Intel GenuineIntel
[0.00]   AMD AuthenticAMD
[0.00]   Centaur CentaurHauls
[0.00] BIOS-provided p

Re: [PATCH v2] qemu-img: Fix qemu-img can't create qcow image based on read-only image

2010-01-31 Thread Naphtali Sprei
Sheng Yang wrote:
> Commit 03cbdac7 "Disable fall-back to read-only when cannot open drive's
> file for read-write" result in read-only image can't be used as backed
> image in qemu-img.
> 
> Cc: Naphtali Sprei 
> Signed-off-by: Sheng Yang 

Acked-by: Naphtali Sprei 

Unfortunately, I see there are still problems with using the resulting images.
Investigating it, will send patches.

  Naphtali

--
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


[PATCH] Add cpu model configuration support..

2010-01-31 Thread john cooper
This is a reimplementation of prior versions which adds
the ability to define cpu models for contemporary processors.
The added models are likewise selected via -cpu ,
and are intended to displace the existing convention
of "-cpu qemu64" augmented with a series of feature flags.

A primary motivation was determination of a least common
denominator within a given processor class to simplify guest
migration.  It is still possible to modify an arbitrary model
via additional feature flags however the goal here was to
make doing so unnecessary in typical usage.  The other
consideration was providing models names reflective of
current processors.  Both AMD and Intel have reviewed the
models in terms of balancing generality of migration vs.
excessive feature downgrade relative to released silicon. 

This version of the patch replaces the prior hard wired
definitions with a configuration file approach for new
models.  Existing models are thus far left as-is but may
easily be transitioned to (or may be overridden by) the
configuration file representation.

Proposed new model definitions are provided here for current
AMD and Intel processors.  Each model consists of a name
used to select it on the command line (-cpu ), and a
model_id which corresponds to a least common denominator
commercial instance of the processor class.

A table of names/model_ids may be queried via "-cpu ?model":

:
x86   Opteron_G3  AMD Opteron 23xx (Gen 3 Class Opteron)  
x86   Opteron_G2  AMD Opteron 22xx (Gen 2 Class Opteron)  
x86   Opteron_G1  AMD Opteron 240 (Gen 1 Class Opteron)   
x86  Nehalem  Intel Core i7 9xx (Nehalem Class Core i7)   
x86   Penryn  Intel Core 2 Duo P9xxx (Penryn Class Core 2)
x86   Conroe  Intel Celeron_4x0 (Conroe/Merom Class Core 2)
: 

Also added is "-cpu ?dump" which exhaustively outputs all config
data for all defined models, and "-cpu ?cpuid" which enumerates
all qemu recognized CPUID feature flags.

The pseudo cpuid flag 'check' when added to the feature flag list
will warn when feature flags (either implicit in a cpu model or
explicit on the command line) would have otherwise been quietly
unavailable to a guest:

# qemu-system-x86_64 ... -cpu Nehalem,check
warning: host cpuid _0001 lacks requested flag 'sse4.2|sse4_2' 
[0x0010]
warning: host cpuid _0001 lacks requested flag 'popcnt' [0x0080]

A similar 'enforce' pseudo flag exists which in addition
to the above causes qemu to error exit if requested flags are
unavailable.

Configuration data for a cpu model resides in the target config
file which by default will be installed as:

/usr/local/etc/qemu/target-.conf

The format of this file should be self explanatory given the
definitions for the above six models and essentially mimics
the structure of the static x86_def_t x86_defs.

Encoding of cpuid flags names now allows aliases for both the
configuration file and the command line which reconciles some
Intel/AMD/Linux/Qemu naming differences.

This patch was tested relative to qemu.git.

Signed-off-by: john cooper 
---

diff --git a/Makefile b/Makefile
index 3848627..b7fa6ef 100644
--- a/Makefile
+++ b/Makefile
@@ -191,7 +191,11 @@ ifdef CONFIG_POSIX
$(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
 endif
 
-install: all $(if $(BUILD_DOCS),install-doc)
+install-sysconfig:
+   $(INSTALL_DIR) "$(sysconfdir)/qemu"
+   $(INSTALL_DATA) sysconfigs/target/target-x86_64.conf 
"$(sysconfdir)/qemu"
+
+install: all $(if $(BUILD_DOCS),install-doc) install-sysconfig
$(INSTALL_DIR) "$(DESTDIR)$(bindir)"
 ifneq ($(TOOLS),)
$(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) "$(DESTDIR)$(bindir)"
diff --git a/qemu-config.c b/qemu-config.c
index c3203c8..246fae6 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -242,6 +242,54 @@ QemuOptsList qemu_mon_opts = {
 },
 };
 
+QemuOptsList qemu_cpudef_opts = {
+.name = "cpudef",
+.head = QTAILQ_HEAD_INITIALIZER(qemu_cpudef_opts.head),
+.desc = {
+{
+.name = "name",
+.type = QEMU_OPT_STRING,
+},{
+.name = "level",
+.type = QEMU_OPT_NUMBER,
+},{
+.name = "vendor",
+.type = QEMU_OPT_STRING,
+},{
+.name = "family",
+.type = QEMU_OPT_NUMBER,
+},{
+.name = "model",
+.type = QEMU_OPT_NUMBER,
+},{
+.name = "stepping",
+.type = QEMU_OPT_NUMBER,
+},{
+.name = "feature_edx",  /* cpuid _0001.edx */
+.type = QEMU_OPT_STRING,
+},{
+.name = "feature_ecx",  /* cpuid _0001.ecx */
+.type = QEMU_OPT_STRING,
+},{
+.name = "extfeature_edx",   /* cpuid 8000_0001.edx */
+.type = QEMU_OPT_STRING,
+},{
+.name = "extfeature_ecx",   /* cpuid 8000_0001.ecx *