Xen : Memo commande xm create

 Memo  Commentaires fermés
avr 112008
 

Memo des paramètres de la commande xm create , simple copier coller de la sortie de l’option help.

 xm create —help_config Values: vncviewer=no|yes Spawn a vncviewer listening for a vnc server in the domain. The address of the vncviewer is passed to the domain on the kernel command line using 'VNC_SERVER=<host>:<port>'. The port used by vnc is 5500 + DISPLAY. A display value with a free port is chosen if possible. Only valid when vnc=1. vncconsole=no|yes Spawn a vncviewer process for the domain's graphical console. Only valid when vnc=1. name=NAME Domain name. Must be unique. bootloader=FILE Path to bootloader. bootargs=NAME Arguments to pass to boot loader bootentry=NAME DEPRECATED. Entry to boot via boot loader. Use bootargs. kernel=FILE Path to kernel image. ramdisk=FILE Path to ramdisk. features=FEATURES Features to enable in guest kernel builder=FUNCTION Function to use to build the domain. memory=MEMORY Domain memory in MB. maxmem=MEMORY Maximum domain memory in MB. shadow_memory=MEMORY Domain shadow memory in MB. cpu=CPU CPU to run the VCPU0 on. cpus=CPUS CPUS to run the domain on. pae=PAE Disable or enable PAE of HVM domain. acpi=ACPI Disable or enable ACPI of HVM domain. apic=APIC Disable or enable APIC of HVM domain. vcpus=VCPUS # of Virtual CPUS in domain. cpu_weight=WEIGHT Set the new domain's cpu weight. WEIGHT is a float that controls the domain's share of the cpu. restart=onreboot|always|never Deprecated. Use on_poweroff, on_reboot, and on_crash instead. Whether the domain should be restarted on exit. - onreboot: restart on exit with shutdown code reboot - always: always restart on exit, ignore exit code - never: never restart on exit, ignore exit code on_poweroff=destroy|restart|preserve|rename-restart Behaviour when a domain exits with reason 'poweroff'. - destroy: the domain is cleaned up as normal; - restart: a new domain is started in place of the old one; - preserve: no clean-up is done until the domain is manually destroyed (using xm destroy, for example); - rename-restart: the old domain is not cleaned up, but is renamed and a new domain started in its place. on_reboot=destroy|restart|preserve|rename-restart Behaviour when a domain exits with reason 'reboot'. - destroy: the domain is cleaned up as normal; - restart: a new domain is started in place of the old one; - preserve: no clean-up is done until the domain is manually destroyed (using xm destroy, for example); - rename-restart: the old domain is not cleaned up, but is renamed and a new domain started in its place. on_crash=destroy|restart|preserve|rename-restart Behaviour when a domain exits with reason 'crash'. - destroy: the domain is cleaned up as normal; - restart: a new domain is started in place of the old one; - preserve: no clean-up is done until the domain is manually destroyed (using xm destroy, for example); - rename-restart: the old domain is not cleaned up, but is renamed and a new domain started in its place. blkif=no|yes Make the domain a block device backend. netif=no|yes Make the domain a network interface backend. tpmif=no|yes Make the domain a TPM interface backend. disk=phy:DEV,VDEV,MODE[,DOM] Add a disk device to a domain. The physical device is DEV, which is exported to the domain as VDEV. The disk is read-only if MODE is 'r', read-write if MODE is 'w'. If DOM is specified it defines the backend driver domain to use for the disk. The option may be repeated to add more than one disk. pci=BUS:DEV.FUNC Add a PCI device to a domain, using given params (in hex). For example 'pci=c0:02.1a'. The option may be repeated to add more than one pci device. ioports=FROM[-TO] Add a legacy I/O range to a domain, using given params (in hex). For example 'ioports=02f8-02ff'. The option may be repeated to add more than one i/o range. irq=IRQ Add an IRQ (interrupt line) to a domain. For example 'irq=7'. This option may be repeated to add more than one IRQ. usbport=PATH Add a physical USB port to a domain, as specified by the path to that port. This option may be repeated to add more than one port. vif=type=TYPE,mac=MAC,bridge=BRIDGE,ip=IPADDR,script=SCRIPT,backend=DOM,vifname=NAME Add a network interface with the given MAC address and bridge. The vif is configured by calling the given configuration script. If type is not specified, default is netfront not ioemu device. If mac is not specified a random MAC address is used. If not specified then the network backend chooses it's own MAC address. If bridge is not specified the first bridge found is used. If script is not specified the default script is used. If backend is not specified the default backend driver domain is used. If vifname is not specified the backend virtual interface will have name vifD.N where D is the domain id and N is the interface id. This option may be repeated to add more than one vif. Specifying vifs will increase the number of interfaces as needed. vtpm=instance=INSTANCE,backend=DOM Add a TPM interface. On the backend side use the given instance as virtual TPM instance. The given number is merely the preferred instance number. The hotplug script will determine which instance number will actually be assigned to the domain. The associtation between virtual machine and the TPM instance number can be found in /etc/xen/vtpm.db. Use the backend in the given domain. access_control=policy=POLICY,label=LABEL Add a security label and the security policy reference that defines it. The local ssid reference is calculated when starting/resuming the domain. At this time, the policy is checked against the active policy as well. This way, migrating through save/restore is covered and local labels are automatically created correctly on the system where a domain is started / resumed. nics=NUM DEPRECATED. Use empty vif entries instead. Set the number of network interfaces. Use the vif option to define interface parameters, otherwise defaults are used. Specifying vifs will increase the number of interfaces as needed. root=DEVICE Set the root= parameter on the kernel command line. Use a device, e.g. /dev/sda1, or /dev/nfs for NFS root. extra=ARGS Set extra arguments to append to the kernel command line. ip=IPADDR Set the kernel IP interface address. gateway=IPADDR Set the kernel IP gateway. netmask=MASK Set the kernel IP netmask. hostname=NAME Set the kernel IP hostname. interface=INTF Set the kernel IP interface name. dhcp=off|dhcp Set the kernel dhcp option. nfs_server=IPADDR Set the address of the NFS server for NFS root. nfs_root=PATH Set the path of the root NFS directory. device_model=FILE Path to device model program. fda=FILE Path to fda fdb=FILE Path to fdb serial=FILE Path to serial or pty or vc localtime=no|yes Is RTC set to localtime? usb=no|yes Emulate USB devices? usbdevice=NAME Name of USB device to add? stdvga=no|yes Use std vga or cirrhus logic graphics isa=no|yes Simulate an ISA only system? boot=a|b|c|d Default boot device nographic=no|yes Should device models use graphics? soundhw=audiodev Should device models enable audio device? vnc Should the device model use VNC? vncdisplay VNC display to use vnclisten Address for VNC server to listen on. vncunused Try to find an unused port for the VNC server. Only valid when vnc=1. sdl Should the device model use SDL? display=DISPLAY X11 display to use xauthority=XAUTHORITY X11 Authority to use uuid xenstore UUID (universally unique identifier) to use. One will be randomly generated if this option is not set, just like MAC addresses for virtual network interfaces. This must be a unique value across the entire cluster. 
 

Travaillant sur un Mac Book sous Mac OS X j’utilise le terminal fournit avec mon OS pour me connecter en ssh sur tout mes serveurs debian. Dans la tas j’ai un serveur d’hébergement xen ou j’utilise les xen tools, forcement. Or comment sur le clavier d’un portable Mac sortir de la console ouverte sur un DomU avec xen tools ? hein ?

Mac OS X Terminal

On ouvre une console comme ceci


xm console Nom-du-serveur-virtuel

Sur Pc on en sort avec la séquence de touche :


Ctrl+]

Or pour avoir ] sur une clavier de Mac il faut faire la séquence de touche :


Alt+Shift+)
PNG - 5.5 ko
Extrait Man de Xm

Et bien après avoir tenté différente solution j’ai trouvé que sur un clavier Mac c’est la séquence de touche qui fonctionne :


Ctrl+6
 

Note : LVM est plus recommander pour fournir le support disque des machines virtuel Xen

Créé une fichier « disque » temporaire

<span style="color: #c20cb9; font-weight: bold;">dd</span> <span style="color: #007800;">if=</span><span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>zero <span style="color: #007800;">of=</span><span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>temp_expand <span style="color: #007800;">bs=</span>1024k <span style="color: #007800;">count=</span><span style="color: #000000;">1000</span>

Stopper votre machine virtuel, c’est obligatoire.

xm shutdown youki

Sauvegarder votre serveur

<span style="color: #c20cb9; font-weight: bold;">cp</span> -a <span style="color: #000000; font-weight: bold;">/</span>xen-images<span style="color: #000000; font-weight: bold;">/</span>youki.img <span style="color: #000000; font-weight: bold;">/</span>xen-images<span style="color: #000000; font-weight: bold;">/</span>youki.img.back

Ajouter le ficher disque temporaire au fichier disque du serveur virtuel. ATTENTION un double > est nécessaire, un simple > écraserait totalement et définitivement le disque de votre serveur virtuel. Une chose que vous ne voulez certainement pas.

<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>temp_expand <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>xen-images<span style="color: #000000; font-weight: bold;">/</span>youki.img

Prendre en compte le changement de taille.

resize2fs -f <span style="color: #000000; font-weight: bold;">/</span>xen-images<span style="color: #000000; font-weight: bold;">/</span>youki.img

Redémarrer le serveur virtuel

xm create -c <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>xen<span style="color: #000000; font-weight: bold;">/</span>vm_youki.config.sxp

logger vous et vérifier la bonne prise en compte de l’espace disque (df -h)

jan 032008
 

4gb seg fixup

Message d’erreur « 4gb seg fixup » sur un serveur virtuel domU dans /var/log/syslog. Pour le résoudre pensé à supprimer /lib/tls :

<span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>tls <span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>tls.disabled reboot

Sur un système 32bits [1]vous pouvez même pousser jusqu’a :

apt-get <span style="color: #c20cb9; font-weight: bold;">install</span> ibc6-xen reboot

Notes

[1] inutile sur 64bits, d’ailleurs le paquet n’existe pas

 

Support Physique a la machine virtuel

Il y à trois support physique à un DomU : Un fichier image, une partition LVM, une Partition Physique

  1. Un fichier image est ce est le plus rapide à configuré. La contre partie sont de pauvre performance I/O. La taille du fichier image représentant le disque du serveur virtuel est modifiable mais au prix de quelque manipulation laborieuse. Par contre un fichier image est facilement manipulable, copiable, déplacèable
  2. LVM est ce qui est le plus largement utilisé en production. Les partitions peuvent être re-tailler à volonté, facilement, sans (trop) d’intéruption de service. C’est l’idéal pour constituer un hébergement xen. Les performances I/O sont bien meilleur de fait comparé à un fichier image. Par contre en cas de soucis cela ce déplace bien moins facilelement qu’un fichier image.
  3. La partition physique est ce qu’il y à de mieux pour les performances IO. Mais c’est difficilement administrable et pas vraiment flexible.

Disque virtuel dans un fichier image.

C’est mon choix de production, la partition sur la quelle je stock ces fichiers images étant sur un SAN j’ai limité le soucis des I/O tout en ayant la possibilité de transférer mes machine virtuel sur une autre serveur d’hebergement facilement et rapidement.

<span style="color: #c20cb9; font-weight: bold;">mkdir</span> -p <span style="color: #000000; font-weight: bold;">/</span>xens<span style="color: #000000; font-weight: bold;">/</span>burkesys<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #c20cb9; font-weight: bold;">dd</span> <span style="color: #007800;">if=</span><span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>zero <span style="color: #007800;">of=</span><span style="color: #000000; font-weight: bold;">/</span>xens<span style="color: #000000; font-weight: bold;">/</span>burkesys<span style="color: #000000; font-weight: bold;">/</span>diskimage.img <span style="color: #007800;">bs=</span>1024k <span style="color: #007800;">count=</span><span style="color: #000000;">5000</span> <span style="color: #c20cb9; font-weight: bold;">dd</span> <span style="color: #007800;">if=</span><span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>zero <span style="color: #007800;">of=</span><span style="color: #000000; font-weight: bold;">/</span>xens<span style="color: #000000; font-weight: bold;">/</span>burkesys<span style="color: #000000; font-weight: bold;">/</span>swapimage.img <span style="color: #007800;">bs=</span>1024k <span style="color: #007800;">count=</span><span style="color: #000000;">512</span> &nbsp; mkfs.ext3 <span style="color: #000000; font-weight: bold;">/</span>xens<span style="color: #000000; font-weight: bold;">/</span>burkesys<span style="color: #000000; font-weight: bold;">/</span>diskimage.img mkswap <span style="color: #000000; font-weight: bold;">/</span>xens<span style="color: #000000; font-weight: bold;">/</span>burkesys<span style="color: #000000; font-weight: bold;">/</span>swapimage.img &nbsp; <span style="color: #c20cb9; font-weight: bold;">mount</span> -o loop <span style="color: #000000; font-weight: bold;">/</span>xens<span style="color: #000000; font-weight: bold;">/</span>burkesys<span style="color: #000000; font-weight: bold;">/</span>diskimage.img <span style="color: #000000; font-weight: bold;">/</span>mnt

Disque Virtuel dans une volume LVM

lvcreate -n twister --<span style="color: #c20cb9; font-weight: bold;">size</span> 2g main-vol2 lvcreate -n twisterswp --<span style="color: #c20cb9; font-weight: bold;">size</span> 512m main-vol2 &nbsp; mkfs.ext3 <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>main-vol2<span style="color: #000000; font-weight: bold;">/</span>twister mkswap <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>main-vol2<span style="color: #000000; font-weight: bold;">/</span>twisterswp &nbsp; <span style="color: #c20cb9; font-weight: bold;">mount</span> -o loop <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>main-vol2<span style="color: #000000; font-weight: bold;">/</span>twister <span style="color: #000000; font-weight: bold;">/</span>mnt

Un nouvel OS avec Debootstrap

Créé avec Debootstrap un nouveau système sur le disque virtuel

debootstrap --<span style="color: #c20cb9; font-weight: bold;">arch</span> i386 sarge <span style="color: #000000; font-weight: bold;">/</span>mnt http:<span style="color: #000000; font-weight: bold;">//</span><span style="color: #c20cb9; font-weight: bold;">ftp</span>.de.debian.org<span style="color: #000000; font-weight: bold;">/</span>debian<span style="color: #000000; font-weight: bold;">/</span> &nbsp; <span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>tls <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>tls.disabled &nbsp; <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apt<span style="color: #000000; font-weight: bold;">/</span>sources.list <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apt<span style="color: #000000; font-weight: bold;">/</span> vi <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apt<span style="color: #000000; font-weight: bold;">/</span>sources.list &nbsp; <span style="color: #c20cb9; font-weight: bold;">cp</span> -a <span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>modules<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2.6</span><span style="color: #000000;">.16</span><span style="color: #000000;">-1</span>-xen-k7<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>modules<span style="color: #000000; font-weight: bold;">/</span> &nbsp; <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>resolve.conf <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span> &nbsp; <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>network<span style="color: #000000; font-weight: bold;">/</span>interfaces <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>network<span style="color: #000000; font-weight: bold;">/</span> vi <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>network<span style="color: #000000; font-weight: bold;">/</span>interfaces &nbsp; <span style="color: #808080; font-style: italic;">#To use Specific IP address - edit the /mnt/etc/network/interfaces manually.</span> <span style="color: #808080; font-style: italic;">#To use DHCP, edit and include the following:</span> <span style="color: #808080; font-style: italic;"># The loopback network interface</span> auto lo iface lo inet loopback <span style="color: #808080; font-style: italic;"># The primary network interface</span> auto eth0 iface eth0 inet dhcp &nbsp; vi <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">hostname</span> &nbsp; vi <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>fstab proc <span style="color: #000000; font-weight: bold;">/</span>proc proc defaults <span style="color: #000000;">0</span> <span style="color: #000000;">0</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda1 <span style="color: #000000; font-weight: bold;">/</span> ext3 defaults,<span style="color: #007800;">errors=</span>remount-ro <span style="color: #000000;">0</span> <span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda2 none swap sw <span style="color: #000000;">0</span> <span style="color: #000000;">0</span>

Configurer le serveur virtuel domU

<span style="color: #c20cb9; font-weight: bold;">umount</span> <span style="color: #000000; font-weight: bold;">/</span>mnt &nbsp; vi <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>xen<span style="color: #000000; font-weight: bold;">/</span>burkesys kernel = <span style="color: #ff0000;">&quot;/boot/vmlinuz-2.6.16-1-xen-k7&quot;</span> ramdisk = <span style="color: #ff0000;">&quot;/boot/initrd.img-2.6.16-1-xen-k7&quot;</span> memory = <span style="color: #000000;">192</span> name = <span style="color: #ff0000;">&quot;burkesys&quot;</span> vif = <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">'bridge=xenbr0'</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #808080; font-style: italic;">#File Based:# disk = ['file:/xens/burkesys/diskimage.img,sda1,w','file:/xens/burkesys/swapimage.img,sda2,w']</span> <span style="color: #808080; font-style: italic;">#LVM Based:# disk = ['phy:/dev/main-vol2/twister,sda1,w', 'phy:/dev/main-vol2/twister,sda2,w']</span> <span style="color: #808080; font-style: italic;">#DHCP - remove the ip, gateway and netmask lines, and include:# dhcp = &quot;dhcp&quot;</span> ip = <span style="color: #ff0000;">&quot;ip add&quot;</span> gateway = <span style="color: #ff0000;">&quot;ip add&quot;</span> netmask = <span style="color: #ff0000;">&quot;255.255.0.0&quot;</span> root = <span style="color: #ff0000;">&quot;/dev/sda1 ro&quot;</span> extra = <span style="color: #ff0000;">'4'</span> &nbsp; <span style="color: #c20cb9; font-weight: bold;">ln</span> -s <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>xen<span style="color: #000000; font-weight: bold;">/</span>burkesys <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>xen<span style="color: #000000; font-weight: bold;">/</span>auto<span style="color: #000000; font-weight: bold;">/</span>burkesys <span style="color: #000000; font-weight: bold;">//</span><span style="color: #c20cb9; font-weight: bold;">link</span> <span style="color: #000000; font-weight: bold;">in</span> the config <span style="color: #c20cb9; font-weight: bold;">file</span> so that the Virtal Machine starts on Bootup of Dom0

Lancer et mettre à jour le serveur virtuel DomU

xm create burkesys -c

Vous allez voir votre serveur virtuel booter. Logger vous en suite et faire une mise à jour.

<span style="color: #c20cb9; font-weight: bold;">passwd</span> &nbsp; apt-get update apt-get upgrade
© 2012 Karlesnine Suffusion theme by Sayontan Sinha