Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Ramdisk Verständnisfrage für KVM Gäste und Host
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German)
View previous topic :: View next topic  
Author Message
LinuxTom
l33t
l33t


Joined: 26 Mar 2006
Posts: 798

PostPosted: Tue Sep 24, 2013 5:05 pm    Post subject: Ramdisk Verständnisfrage für KVM Gäste und Host Reply with quote

Hi Leute,

bevor ich mein System jetzt zig Mal abschieße vorher eine Frage, da Google mir die nicht wirklich beantworten kann.

Ich habe in meinem Server 24GB Ram. Von denen habe ich eine 12GB /tmp/ Partition gebildet (tmpfs). Alles gut. Bisher habe ich auf dieser meine vielen Gentoo-Clients vorkompilieren lassen (PORTAGE_TMPDIR). In seperaten CHROOT's. Alles gut. Nun haben sich jedoch so langsam (in den letzten 13 Jahren) die ganzen CPU's so unterschiedlich entwickelt, dass ich immer einen gemeinsamen Nenner zwischen Server (der alles bildet) und Client finden musste. Also wurden die Clients ausgebremst. Also Schwenk auf KVM und QEMU. Alles fein. Nun will ich jedoch den Gast-KVM's auch eine RAMDISK als /tmp/ zur Verfügung stellen. Hat jemand von Euch eine Idee, wie ich das machen kann? So dass ggf eine zu klein definierte RAMDISK auf SWAP ausgelagert wird innerhalb der VM? Und dass sich alle Gäste und der Server vielleicht insgesamt eine maximal festgelegte Größe teilen und dann auf SWAP auslagern?

Auf Festplatte dauert bspw. ein GCC 40 Minuten. Auf RAMDISK nur noch 10 Minuten.
Back to top
View user's profile Send private message
bell
Guru
Guru


Joined: 27 Nov 2007
Posts: 508

PostPosted: Tue Sep 24, 2013 5:40 pm    Post subject: Reply with quote

Also ich setze bei ramfs immer den Parameter "size=100%" Dadurch kann die ramfs den kompletten RAM belegen. Da eine ramfs nur soviel RAM tatsächlich belegt wie sie voll ist, machen auch 3x ramfs je 100% RAM nichts aus. Wenn der Platz knapp wird, wird natürlich geswappt, auch Teile aus der ramfs.

Hm, wie würde ich es in eine KVM einbinden: Ich würde eine (oder mehrere) ramfs auf dem Host anlegen und diese dann über 9p_virtio den VM's zur Verfügung stellen http://www.linux-kvm.org/page/9p_virtio
(ungetestet)
Back to top
View user's profile Send private message
Christian99
Veteran
Veteran


Joined: 28 May 2009
Posts: 1668

PostPosted: Tue Sep 24, 2013 6:35 pm    Post subject: Reply with quote

nicht direkt zur frage über ramdiks und virtuellen maschinen, aber hast du schon mal was von ROOT und PORTAGE_CONFIGROOT gehört?
damit kannst du zb mit dem kompiler auf deinem system für andere systeme optimiert bauen. Schau dir mal am besten https://www.gentoo.org/proj/en/base/embedded/handbook/?part=1&chap=3 an. ich glaube damit kannst du dir die virtuellen maschinen sparen.
Back to top
View user's profile Send private message
LinuxTom
l33t
l33t


Joined: 26 Mar 2006
Posts: 798

PostPosted: Tue Sep 24, 2013 6:46 pm    Post subject: Reply with quote

@bell:
Danke, genau das habe ich gesucht. Da ich jedoch in meinen Kernels das nicht aktiviert habe, bieten mir das weder qemu noch der virt-manager an. Ich werde es anschalten und aktivieren. Dann sehe ich weiter und berichte.
Back to top
View user's profile Send private message
LinuxTom
l33t
l33t


Joined: 26 Mar 2006
Posts: 798

PostPosted: Tue Sep 24, 2013 7:13 pm    Post subject: Reply with quote

Christian99 wrote:
damit kannst du zb mit dem kompiler auf deinem system für andere systeme optimiert bauen.

Ja. Distcc, chroot, cross-compile usw. Alles schon durch. Nicht sicher genug, wenn der Client 300km weit weg steht und dann doch ein Programm fehl schlägt. Man kann wirklich nur mit qemu den Prozessor des Zielsystem nachbilden und die Programme auch richtig testen. Unterm Strich erspart mir QEMU/KVM viel Fummelei und Unsicherheit, wenn das Host-System ein Update braucht. Erst recht, weil mein Host gleichzeitig mein VDR-Server ist. Wehe, die Lieblingsserie kann nicht geschaut werden, dann ist der Frieden zu hause aus. Darum wandert jetzt alles in entsprechende KVM-VM's. Als erstes mein VDR.
Back to top
View user's profile Send private message
Christian99
Veteran
Veteran


Joined: 28 May 2009
Posts: 1668

PostPosted: Tue Sep 24, 2013 7:29 pm    Post subject: Reply with quote

ok, wenn du testen willst wirds natürlich schwierig :)
Back to top
View user's profile Send private message
LinuxTom
l33t
l33t


Joined: 26 Mar 2006
Posts: 798

PostPosted: Wed Sep 25, 2013 12:41 pm    Post subject: Reply with quote

Vielleicht kann mir jemand helfen, da der virt-manager mir den Punkt, ein Filesystem als Gerät hinzuzufügen, nicht anbietet.

Die 9P-Sachen habe ich den Kernel des Hosts und des Gastes fest einkompiliert. Leider funktioniert es nicht. Auch wenn ich die Einträge manuell in die XML der Domain eintrage, werden die nicht als Parameter für qemu übergeben. Siehe hier.

Vielleicht hat jemand eine Idee, wieso, wenn ich die Konfiguration hier schreibe. *hoff*

Code:
[I] app-emulation/qemu-kvm
Installed versions:  0.15.1-r1!t(12:39:15 25.09.2013)(aio alsa bluetooth jpeg ncurses png qemu_softmmu_targets_i386 qemu_softmmu_targets_x86_64 qemu_user_targets_i386 qemu_user_targets_x86_64 sasl sdl spice ssl threads vhost-net xattr -brltty -curl -debug -esd -fdt -hardened -nss -pulseaudio -qemu-ifup -qemu_softmmu_targets_arm -qemu_softmmu_targets_cris -qemu_softmmu_targets_m68k -qemu_softmmu_targets_microblaze -qemu_softmmu_targets_mips -qemu_softmmu_targets_mips64 -qemu_softmmu_targets_mips64el -qemu_softmmu_targets_mipsel -qemu_softmmu_targets_ppc -qemu_softmmu_targets_ppc64 -qemu_softmmu_targets_ppcemb -qemu_softmmu_targets_sh4 -qemu_softmmu_targets_sh4eb -qemu_softmmu_targets_sparc -qemu_softmmu_targets_sparc64 -qemu_user_targets_alpha -qemu_user_targets_arm -qemu_user_targets_armeb -qemu_user_targets_cris -qemu_user_targets_m68k -qemu_user_targets_microblaze -qemu_user_targets_mips -qemu_user_targets_mipsel -qemu_user_targets_ppc -qemu_user_targets_ppc64 -qemu_user_targets_ppc64abi32 -qemu_user_targets_sh4 -qemu_user_targets_sh4eb -qemu_user_targets_sparc -qemu_user_targets_sparc32plus -qemu_user_targets_sparc64 -rbd -vde -xen)


Code:
Install prefix    /usr
BIOS directory    /usr/share/qemu
binary directory  /usr/bin
library directory /usr/lib
config directory  /etc
Manual directory  /usr/share/man
ELF interp prefix /usr/gnemul/qemu-%M
Source path       /tmp/portage/app-emulation/qemu-kvm-0.15.1-r1/work/qemu-kvm-0.15.1
C compiler        x86_64-pc-linux-gnu-gcc
Host C compiler   x86_64-pc-linux-gnu-gcc
CFLAGS            -O2 -g -march=core2 -mcx16 -msahf -mpopcnt -msse4.2 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=256 -mtune=core2 -O2 -pipe
QEMU_CFLAGS       -m64 -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing  -fstack-protector-all -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -I/usr/include/libpng15   -I/usr/include/spice-server -I/usr/include/pixman-1 -I/usr/kerberos/include -I/usr/include/spice-1 
LDFLAGS           -Wl,--warn-common -m64 -g -Wl,-z,execheap -Wl,-O1 -Wl,--as-needed
make              make
install           install
python            python
smbd              /usr/sbin/smbd
host CPU          x86_64
host big endian   no
target list        i386-softmmu x86_64-softmmu  i386-linux-user x86_64-linux-user
tcg debug enabled no
Mon debug enabled no
gprof enabled     no
sparse enabled    no
strip binaries    no
profiler          no
static build      no
-Werror enabled   no
SDL support       yes
curses support    yes
curl support      no
check support     no
mingw32 support   no
Audio drivers     sdl alsa oss
Extra audio cards ac97 es1370 sb16 hda
Block whitelist   
Mixer emulation   no
VNC support       yes
VNC TLS support   yes
VNC SASL support  yes
VNC JPEG support  yes
VNC PNG support   yes
VNC thread        yes
xen support       no
CPU emulation     yes
brlapi support    no
bluez  support    yes
Documentation     yes
NPTL support      yes
GUEST_BASE        yes
PIE user targets  no
vde support       no
IO thread         yes
Linux AIO support yes
ATTR/XATTR support yes
Install blobs     yes
KVM support       yes
KVM PIT support   yes
KVM device assig. yes
fdt support       no
preadv support    yes
fdatasync         yes
madvise           yes
posix_madvise     yes
uuid support      yes
vhost-net support yes
Trace backend     nop
Trace output file trace-<pid>
spice support     yes
rbd support       no
xfsctl support    yes
nss used          no
usb net redir     no
OpenGL support    yes
build guest agent yes



Code:
[I] app-emulation/libvirt
Installed versions:  0.9.8(12:41:19 25.09.2013)(avahi caps elibc_glibc json libvirtd lvm lxc nfs nls numa parted pcap policykit python qemu sasl udev uml virt-network -debug -iscsi -macvtap -openvz -phyp -selinux -virtualbox -xen)


Code:
configure: Configuration summary
configure: =====================
configure:
configure: Drivers
configure:
configure:      Xen: no
configure:     QEMU: yes
configure:      UML: yes
configure:   OpenVZ: no
configure:   VMware: yes
configure:     VBox: no
configure:   XenAPI: no
configure: xenlight: no
configure:      LXC: yes
configure:     PHYP: no
configure:      ESX: yes
configure:  Hyper-V: no
configure:     Test: yes
configure:   Remote: yes
configure:  Network: yes
configure: Libvirtd: yes
configure:    netcf: no
configure:  macvtap: no
configure: virtport: no
configure:
configure: Storage Drivers
configure:
configure:      Dir: yes
configure:       FS: yes
configure:    NetFS: yes
configure:      LVM: yes
configure:    iSCSI: no
configure:     SCSI: yes
configure:    mpath: yes
configure:     Disk: yes
configure:
configure: Security Drivers
configure:
configure:  SELinux: no
configure: AppArmor: no
configure:
configure: Driver Loadable Modules
configure:
configure:   dlopen: no
configure:
configure: Libraries
configure:
configure:   libxml: -I/usr/include/libxml2   -lxml2 
configure:   dlopen: -ldl
configure:  libcurl: -DCURL_DISABLE_TYPECHECK   -lcurl 
configure: openwsman: no
configure:  libssh2: 
configure:   gnutls:   -lgnutls   -lgcrypt
configure:     sasl:   -lsasl2
configure:     yajl:   -lyajl
configure:  sanlock: no
configure:    avahi: -D_REENTRANT   -lavahi-common -lavahi-client 
configure:   polkit: /usr/bin/pkcheck (version 1)
configure:    audit: no
configure:  selinux: no
configure: apparmor: no
configure:  numactl:  -lnuma
configure:    capng:  -lcap-ng
configure:      xen: no
configure:   xenapi: no
configure: xenlight: no
configure:      hal: no
configure:     udev:   -ludev -lrt     -lpciaccess 
configure:    netcf: no
configure:     pcap: -I/usr/include -L/usr/lib64 -Wl,-rpath,/usr/lib64 -lpcap
configure:       nl:   -lnl 
configure:    mscom: no
configure:      xdr:
configure:
configure: Test suite
configure:
configure:    Coverage: no
configure:   Alloc OOM: no
Back to top
View user's profile Send private message
LinuxTom
l33t
l33t


Joined: 26 Mar 2006
Posts: 798

PostPosted: Wed Sep 25, 2013 2:13 pm    Post subject: Reply with quote

Der normale Satz, wer lesen kann ist klar im Vorteil, funktioniert hier leider nicht:
Im QEMU-Wiki steht als Beispiel:
Quote:
<filesystem type='mount' accessmode='$security_model'>
<source dir='$hostpath'/>
<target dir='$mount_tag'/>
</filesystem>

Auch in LibVirt steht, dass der Parameter driver Optional ist:
Quote:
driver
The optional driver element allows specifying further details related to the hypervisor driver used to provide the filesystem. Since 1.0.6

If the hypervisor supports multiple backend drivers, then the type attribute selects the primary backend driver name, while the format attribute provides the format type. For example, LXC supports a type of "loop", with a format of "raw" or "nbd" with any format. QEMU supports a type of "path" or "handle", but no formats.

Wenn ich jedoch den Parameter setze, funktioniert es:
Quote:
<filesystem type='mount' accessmode='mapped'>
<driver type='path'/>
<source dir='/tmp/kvm'/>
<target dir='tmpkvm'/>
</filesystem>

Da meine qemu-kvm und libvirt - Versionen vielleicht doch etwas alt sind, kommt in meinem Gast der Fehler, egal was ich für Kompinationen der Einstellungen nehme. So funktioniert auch der driver=handle nicht:
Quote:
fsdev: fstype handle not found

Ich werde wohl erst einmal das gesamte System aktualisieren und so lange die längeren Kompilierzeiten in kauf nehmen.
Quote:
>>> Emerging (1 of 3) sys-devel/binutils-2.22-r1
[Errno 1] Operation not permitted: '/tmp/kvm/portage/.sys-devel.portage_lockfile': chown('/tmp/kvm/portage/.sys-devel.portage_lockfile', -1, 250)
Cannot chown a lockfile: '/tmp/kvm/portage/.sys-devel.portage_lockfile'
Group IDs of current user: 0 1 2 3 4 6 10 11 20 26 27
[Errno 1] Operation not permitted: '/tmp/kvm/portage/sys-devel/.binutils-2.22-r1.portage_lockfile': chown('/tmp/kvm/portage/sys-devel/.binutils-2.22-r1.portage_lockfile', -1, 250)
Cannot chown a lockfile: '/tmp/kvm/portage/sys-devel/.binutils-2.22-r1.portage_lockfile'
Group IDs of current user: 0 1 2 3 4 6 10 11 20 26 27
Operation Not Permitted: chown('/tmp/kvm/portage/sys-devel/binutils-2.22-r1', 250, 250)
* binutils-2.22.tar.bz2 SHA256 SHA512 WHIRLPOOL size ;-) ... [ ok ]
* binutils-2.22-patches-1.5.tar.bz2 SHA256 SHA512 WHIRLPOOL size ;-) ... [ ok ]

Zumal auch der virt-manager diese manuelle Konfiguration nicht auslesen kann. Fehleranfällig!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum