SlideShare une entreprise Scribd logo
1  sur  4
Télécharger pour lire hors ligne
Sem título
Manage your virtual machines
From the shell
You can manage your VMs from the shell using virsh. You can get a list of the
available commands if you type "help". Type "help command" to get additional
infos for a particular command.
Define your new VM
Before you can manage your new VM with virsh, you must define it:
$ virsh --connect qemu:///system
Connecting to uri: qemu:///system
Welcome to virsh, the virtualization interactive terminal.
Type: 'help' for help with commands
'quit' to quit
virsh # define /etc/libvirt/qemu/newvm.xml
Domain newvm defined from /etc/libvirt/qemu/newvm.xml
Note that to list newvm, you must use 'list --inactive' or 'list --all', since
list without any options will only list currently running machines.
List your VMs
Virsh allows you to list the virtual machines available on the current host:
yhamon@paris:/etc/libvirt/qemu$ virsh --connect qemu:///system
Connecting to uri: qemu:///system
Welcome to virsh, the virtualization interactive terminal.
Type: 'help' for help with commands
'quit' to quit
virsh # help list
NAME
list - list domains
SYNOPSIS
list [--inactive | --all]
DESCRIPTION
Returns list of domains.
OPTIONS
--inactive list inactive domains
--all list inactive & active domains
virsh # list
Id Name State
----------------------------------
15 mirror running
16 vm2 running
virsh # list --all
Id Name State
----------------------------------
15 mirror running
16 vm2 running
- test5 shut off
Define, undefine, start, shutdown, destroy VMs
The VMs you see with list --all are VMs that have been "defined" from an XML
file. Every VM is configured via a XML file in /etc/libvirt/qemu. If you want to
Página 1
Sem título
remove a VM from the list of VMs, you need to undefine it:
virsh # undefine test5 # WARNING: undefine will delete your XML file!
Domain test5 has been undefined
virsh # list --all
Id Name State
----------------------------------
15 mirror running
16 vm2 running
To be able to undefine a virtual machine, it needs to be shutdown first:
virsh # shutdown mirror
Domain mirror is being shutdown
This command asks for a nice shutdown (like running shutdown in command line).
Notice: Ubuntu 10.04 server doesn't have acpid installed by default. This
package needs to be installed on the guest OS before it will listen to any
requests from the host.
You can also use "destroy", the more brutal way of shutting down a VM,
equivalent of taking the power cable off:
virsh # destroy mirror
Domain mirror destroyed
If you have made a change to the XML configuration file, you need to tell KVM to
reload it before restarting the VM:
virsh # define /etc/libvirt/qemu/mirror.xml
Domain mirror defined from /etc/libvirt/qemu/mirror.xml
Then, to restart the VM:
virsh # start mirror
Domain mirror started
Suspend and resume a Virtual Machine
Virsh allows you to easily suspend and resume a virtual machine.
virsh # suspend mirror
Domain mirror suspended
virsh # resume mirror
Domain mirror resumed
Editing the attributes of a Virtual Machine
libvirt stores it's configuration as xml in '/etc/libvirt/qemu'. The xml is easy
to understand, and is similar to VMware *.vmx files. While it is possible to
edit these files in place and restart libvirt-bin for the changes to take
affect, the recommended method for modifying the attributes of a virtual machine
is via virsh (or virt-manager, if it supports changing the hardware you want to
change). The concept is simple:
export (aka 'dump') the xml of the virtual machine you want to edit
edit the xml
import (aka 'define') the xml
For example, to edit the machine named 'foo' (you can get a list of your
machines with 'virsh list --all'), do:
$ virsh dumpxml foo > /tmp/foo.xml
(edit /tmp/foo.xml as needed)
$ virsh define /tmp/foo.xml
Página 2
Sem título
Adding CPUs
KVM allows you to create SMP guests. To allocate two CPUs to a VM, dump the xml
as above, then edit your xml to have:
<domain type='kvm'>
...
<vcpu>2</vcpu>
...
</domain>
Now define the VM as above.
Adding Memory
To change the memory allocation in a VM, dump the xml as above, then edit your
xml to have:
<domain type='kvm'>
...
<memory>262144</memory>
<currentMemory>262144</currentMemory>
...
</domain>
Now define the VM as above. Keep in mind that the memory allocation is in
kilobytes, so to allocate 512MB of memory, use 512 * 1024, or 524288.
Changing the Network Card Model
kvm and qemu currently default to using the rtl8139 NIC. Supported NICs in
Ubuntu 8.04 LTS are i82551, i82557b, i82559er, ne2k_pci, pcnet, rtl8139, e1000,
and virtio. To use an alternate NIC, dump the xml as above, then edit your xml
to have:
<domain type='kvm'>
...
<interface type='network'>
...
<model type='e1000'/>
</interface>
...
</domain>
Now define the VM as above.
Adding USB Device Pass-through
Limitations
USB protocol 1.1 only
Device must be plugged in before KVM starts
Apparmor modifications needed
Apparmor Modification
In order for a software program to access the usb device correctly the apparmor
must be changed. Edit /etc/apparmor.d/abstractions/libvirt-qemu and uncomment
some lines.:
# WARNING: uncommenting these gives the guest direct access to host hardware.
# This is required for USB pass through but is a security risk. You have been
# warned.
/sys/bus/usb/devices/ r,
/sys/devices/*/*/usb[0-9]*/** r,
/dev/bus/usb/*/[0-9]* rw,
Página 3
Sem título
After making the changes apparmor must be restarted.:
$ sudo /etc/init.d/apparmor restart
Adding USB devices
First find the usb Vendor ID and Product ID.:
$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 012: ID 0a5c:2110 Broadcom Corp. Bluetooth Controller
Bus 005 Device 003: ID 0483:2016 SGS Thomson Microelectronics Fingerprint Reader
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
In the event that the Broadcom Corp. Bluetooth Controller wans to be selected
the vendor and product ids are 0a5c and 2110 respectively. These can be entered
into the xml profile. This can be done through virsh through the edit <domain>
command.:
<domain type='kvm'>
<name>windowsxp</name>
…
<devices>
…
<hostdev mode='subsystem' type='usb'>
<source>
<vendor id='0x0a5c'/>
<product id='0x2110'/>
</source>
</hostdev>
</devices>
</domain>
Página 4

Contenu connexe

Tendances

Androidx86 Installation For Virtualbox
Androidx86 Installation For VirtualboxAndroidx86 Installation For Virtualbox
Androidx86 Installation For Virtualbox
PingLun Liao
 
Lecture 20 presentation
Lecture 20 presentationLecture 20 presentation
Lecture 20 presentation
Asif
 

Tendances (20)

Project ACRN Device Passthrough Introduction
Project ACRN Device Passthrough IntroductionProject ACRN Device Passthrough Introduction
Project ACRN Device Passthrough Introduction
 
Linux : Booting and runlevels
Linux : Booting and runlevelsLinux : Booting and runlevels
Linux : Booting and runlevels
 
Linux: Hardware Settings
Linux: Hardware SettingsLinux: Hardware Settings
Linux: Hardware Settings
 
How to assign unowned disk in the netapp cluster 8.3
How to assign unowned disk in the netapp cluster 8.3 How to assign unowned disk in the netapp cluster 8.3
How to assign unowned disk in the netapp cluster 8.3
 
XPDS13: HVM Dom0 - Any unmodified OS as Dom0 - Will Auld, Intel
XPDS13: HVM Dom0 - Any unmodified OS as Dom0 - Will Auld, IntelXPDS13: HVM Dom0 - Any unmodified OS as Dom0 - Will Auld, Intel
XPDS13: HVM Dom0 - Any unmodified OS as Dom0 - Will Auld, Intel
 
Androidx86 Installation For Virtualbox
Androidx86 Installation For VirtualboxAndroidx86 Installation For Virtualbox
Androidx86 Installation For Virtualbox
 
Cd rom on solaris
Cd rom  on solarisCd rom  on solaris
Cd rom on solaris
 
Linux Run Level
Linux Run LevelLinux Run Level
Linux Run Level
 
Linux-without-a-bootloader
Linux-without-a-bootloaderLinux-without-a-bootloader
Linux-without-a-bootloader
 
2014.08.30 Virtual Machine Threat 세미나
2014.08.30 Virtual Machine Threat 세미나2014.08.30 Virtual Machine Threat 세미나
2014.08.30 Virtual Machine Threat 세미나
 
Bootstrap process of u boot (NDS32 RISC CPU)
Bootstrap process of u boot (NDS32 RISC CPU)Bootstrap process of u boot (NDS32 RISC CPU)
Bootstrap process of u boot (NDS32 RISC CPU)
 
Embedding Linux On The Encore Simputer
Embedding Linux On The Encore SimputerEmbedding Linux On The Encore Simputer
Embedding Linux On The Encore Simputer
 
Building
BuildingBuilding
Building
 
ACRN vMeet-Up EU 2021 - hypervisor new platform enabling
ACRN vMeet-Up EU 2021 - hypervisor new platform enablingACRN vMeet-Up EU 2021 - hypervisor new platform enabling
ACRN vMeet-Up EU 2021 - hypervisor new platform enabling
 
Lecture 20 presentation
Lecture 20 presentationLecture 20 presentation
Lecture 20 presentation
 
5 kvm arm
5 kvm arm5 kvm arm
5 kvm arm
 
Comando kvm terminal
Comando kvm terminalComando kvm terminal
Comando kvm terminal
 
Basic about-router
Basic about-routerBasic about-router
Basic about-router
 
ACRN vMeet-Up EU 2021 - Boot Process and Secure Boot
ACRN vMeet-Up EU 2021 - Boot Process and Secure BootACRN vMeet-Up EU 2021 - Boot Process and Secure Boot
ACRN vMeet-Up EU 2021 - Boot Process and Secure Boot
 
Embedded Systems Conference 2014 Presentation
Embedded Systems Conference 2014 PresentationEmbedded Systems Conference 2014 Presentation
Embedded Systems Conference 2014 Presentation
 

En vedette

En vedette (8)

Startup guide for kvm on cent os 6
Startup guide for kvm on cent os 6Startup guide for kvm on cent os 6
Startup guide for kvm on cent os 6
 
Heart
HeartHeart
Heart
 
Cardiovascular system
Cardiovascular systemCardiovascular system
Cardiovascular system
 
Client Orientation
Client OrientationClient Orientation
Client Orientation
 
Final proyect
Final proyectFinal proyect
Final proyect
 
Cardiovascular system
Cardiovascular systemCardiovascular system
Cardiovascular system
 
Ingles autobigrafia2
Ingles autobigrafia2Ingles autobigrafia2
Ingles autobigrafia2
 
Instalando e configurando o serviço snmpd no red hat 5.3 cent_os
Instalando e configurando o serviço snmpd no red hat 5.3   cent_osInstalando e configurando o serviço snmpd no red hat 5.3   cent_os
Instalando e configurando o serviço snmpd no red hat 5.3 cent_os
 

Similaire à Alterar memória kvm virtual machine

Vmware Command Line
Vmware   Command LineVmware   Command Line
Vmware Command Line
lifeit
 
Vm ware server-tips-tricks
Vm ware server-tips-tricksVm ware server-tips-tricks
Vm ware server-tips-tricks
unixadminrasheed
 
Ansible automation tool with modules
Ansible automation tool with modulesAnsible automation tool with modules
Ansible automation tool with modules
mohamedmoharam
 

Similaire à Alterar memória kvm virtual machine (20)

KVM tools and enterprise usage
KVM tools and enterprise usageKVM tools and enterprise usage
KVM tools and enterprise usage
 
Vmware Command Line
Vmware   Command LineVmware   Command Line
Vmware Command Line
 
Kvm setup
Kvm setupKvm setup
Kvm setup
 
Virtualization with Xen and openQRM 5.1 on Debian Wheezy
Virtualization with Xen and openQRM 5.1 on Debian WheezyVirtualization with Xen and openQRM 5.1 on Debian Wheezy
Virtualization with Xen and openQRM 5.1 on Debian Wheezy
 
Vm ware server-tips-tricks
Vm ware server-tips-tricksVm ware server-tips-tricks
Vm ware server-tips-tricks
 
Vmwareserver tips-tricks-110218231744-phpapp01
Vmwareserver tips-tricks-110218231744-phpapp01Vmwareserver tips-tricks-110218231744-phpapp01
Vmwareserver tips-tricks-110218231744-phpapp01
 
Virtual Infrastructure
Virtual InfrastructureVirtual Infrastructure
Virtual Infrastructure
 
Krenel Based Virtual Machine In Centos7
Krenel Based Virtual Machine In Centos7Krenel Based Virtual Machine In Centos7
Krenel Based Virtual Machine In Centos7
 
Esxi troubleshooting
Esxi troubleshootingEsxi troubleshooting
Esxi troubleshooting
 
Dev ops
Dev opsDev ops
Dev ops
 
Alta disponibilidad en GNU/Linux
Alta disponibilidad en GNU/LinuxAlta disponibilidad en GNU/Linux
Alta disponibilidad en GNU/Linux
 
Installing Lamp Stack on Ubuntu Instance
Installing Lamp Stack on Ubuntu InstanceInstalling Lamp Stack on Ubuntu Instance
Installing Lamp Stack on Ubuntu Instance
 
Linux
LinuxLinux
Linux
 
Quick & Easy Dev Environments with Vagrant
Quick & Easy Dev Environments with VagrantQuick & Easy Dev Environments with Vagrant
Quick & Easy Dev Environments with Vagrant
 
Oracle VM3: Virtuelle Maschinen per Script erstellen
Oracle VM3: Virtuelle Maschinen per Script erstellenOracle VM3: Virtuelle Maschinen per Script erstellen
Oracle VM3: Virtuelle Maschinen per Script erstellen
 
Fedora Atomic Workshop handout for Fudcon Pune 2015
Fedora Atomic Workshop handout for Fudcon Pune  2015Fedora Atomic Workshop handout for Fudcon Pune  2015
Fedora Atomic Workshop handout for Fudcon Pune 2015
 
3. configuring a compute node for nfv
3. configuring a compute node for nfv3. configuring a compute node for nfv
3. configuring a compute node for nfv
 
Pursue container architecture with mincs
Pursue container architecture with mincsPursue container architecture with mincs
Pursue container architecture with mincs
 
Varnish Configuration Step by Step
Varnish Configuration Step by StepVarnish Configuration Step by Step
Varnish Configuration Step by Step
 
Ansible automation tool with modules
Ansible automation tool with modulesAnsible automation tool with modules
Ansible automation tool with modules
 

Plus de Carlos Eduardo

Criando plugin para o Nagios em Shell Script _ Nagios
Criando plugin para o Nagios em Shell Script _ NagiosCriando plugin para o Nagios em Shell Script _ Nagios
Criando plugin para o Nagios em Shell Script _ Nagios
Carlos Eduardo
 
Iptables bridging and firewalling
Iptables bridging and firewallingIptables bridging and firewalling
Iptables bridging and firewalling
Carlos Eduardo
 
Alterar nome do_domínio–rendom_win-2008_e_2003
Alterar nome do_domínio–rendom_win-2008_e_2003Alterar nome do_domínio–rendom_win-2008_e_2003
Alterar nome do_domínio–rendom_win-2008_e_2003
Carlos Eduardo
 
Configuração dns memorial descritivo
Configuração dns   memorial descritivoConfiguração dns   memorial descritivo
Configuração dns memorial descritivo
Carlos Eduardo
 
Additional resources repositories_rpm_forge - centos wiki
Additional resources repositories_rpm_forge - centos wikiAdditional resources repositories_rpm_forge - centos wiki
Additional resources repositories_rpm_forge - centos wiki
Carlos Eduardo
 
Postfix amavisd connect to 127.0.0.1[127.0.0.1]-10024_ connection refused _...
Postfix amavisd   connect to 127.0.0.1[127.0.0.1]-10024_ connection refused _...Postfix amavisd   connect to 127.0.0.1[127.0.0.1]-10024_ connection refused _...
Postfix amavisd connect to 127.0.0.1[127.0.0.1]-10024_ connection refused _...
Carlos Eduardo
 
Migrate linux user password to postfix vmail database
Migrate linux user password to postfix vmail databaseMigrate linux user password to postfix vmail database
Migrate linux user password to postfix vmail database
Carlos Eduardo
 
Poppassd setup howto for rhel cent os 5 ‹‹ linux mail server setup and howto ...
Poppassd setup howto for rhel cent os 5 ‹‹ linux mail server setup and howto ...Poppassd setup howto for rhel cent os 5 ‹‹ linux mail server setup and howto ...
Poppassd setup howto for rhel cent os 5 ‹‹ linux mail server setup and howto ...
Carlos Eduardo
 
Samsung r440 com wireless broadcom bcm4313 no ubuntu 11.10
Samsung r440 com wireless broadcom bcm4313 no ubuntu 11.10Samsung r440 com wireless broadcom bcm4313 no ubuntu 11.10
Samsung r440 com wireless broadcom bcm4313 no ubuntu 11.10
Carlos Eduardo
 
Exploit access root to kernel 2.6.32 2.6.36 privilege escalation exploit
Exploit access root to kernel 2.6.32 2.6.36   privilege escalation exploitExploit access root to kernel 2.6.32 2.6.36   privilege escalation exploit
Exploit access root to kernel 2.6.32 2.6.36 privilege escalation exploit
Carlos Eduardo
 
How to root phones or tablets running android 2.3 gingerbread jailbreak an...
How to root phones or tablets running android 2.3 gingerbread    jailbreak an...How to root phones or tablets running android 2.3 gingerbread    jailbreak an...
How to root phones or tablets running android 2.3 gingerbread jailbreak an...
Carlos Eduardo
 
Compartilhamento no samba com permissão de grupo
Compartilhamento no samba com permissão de grupoCompartilhamento no samba com permissão de grupo
Compartilhamento no samba com permissão de grupo
Carlos Eduardo
 
Converting parallels or vm ware to virtual box
Converting parallels or vm ware to virtual boxConverting parallels or vm ware to virtual box
Converting parallels or vm ware to virtual box
Carlos Eduardo
 
Instalando Cacti no CentOS 5
Instalando Cacti no CentOS 5Instalando Cacti no CentOS 5
Instalando Cacti no CentOS 5
Carlos Eduardo
 
Instalando rrd tool-no-centos-5-usando-yum
Instalando rrd tool-no-centos-5-usando-yumInstalando rrd tool-no-centos-5-usando-yum
Instalando rrd tool-no-centos-5-usando-yum
Carlos Eduardo
 
Como criar um repositório Ubuntu
Como criar um repositório UbuntuComo criar um repositório Ubuntu
Como criar um repositório Ubuntu
Carlos Eduardo
 

Plus de Carlos Eduardo (20)

Criando plugin para o Nagios em Shell Script _ Nagios
Criando plugin para o Nagios em Shell Script _ NagiosCriando plugin para o Nagios em Shell Script _ Nagios
Criando plugin para o Nagios em Shell Script _ Nagios
 
Iptables bridging and firewalling
Iptables bridging and firewallingIptables bridging and firewalling
Iptables bridging and firewalling
 
Alterar nome do_domínio–rendom_win-2008_e_2003
Alterar nome do_domínio–rendom_win-2008_e_2003Alterar nome do_domínio–rendom_win-2008_e_2003
Alterar nome do_domínio–rendom_win-2008_e_2003
 
Configuração dns memorial descritivo
Configuração dns   memorial descritivoConfiguração dns   memorial descritivo
Configuração dns memorial descritivo
 
Additional resources repositories_rpm_forge - centos wiki
Additional resources repositories_rpm_forge - centos wikiAdditional resources repositories_rpm_forge - centos wiki
Additional resources repositories_rpm_forge - centos wiki
 
Postfix amavisd connect to 127.0.0.1[127.0.0.1]-10024_ connection refused _...
Postfix amavisd   connect to 127.0.0.1[127.0.0.1]-10024_ connection refused _...Postfix amavisd   connect to 127.0.0.1[127.0.0.1]-10024_ connection refused _...
Postfix amavisd connect to 127.0.0.1[127.0.0.1]-10024_ connection refused _...
 
Migrate linux user password to postfix vmail database
Migrate linux user password to postfix vmail databaseMigrate linux user password to postfix vmail database
Migrate linux user password to postfix vmail database
 
Poppassd setup howto for rhel cent os 5 ‹‹ linux mail server setup and howto ...
Poppassd setup howto for rhel cent os 5 ‹‹ linux mail server setup and howto ...Poppassd setup howto for rhel cent os 5 ‹‹ linux mail server setup and howto ...
Poppassd setup howto for rhel cent os 5 ‹‹ linux mail server setup and howto ...
 
Samsung r440 com wireless broadcom bcm4313 no ubuntu 11.10
Samsung r440 com wireless broadcom bcm4313 no ubuntu 11.10Samsung r440 com wireless broadcom bcm4313 no ubuntu 11.10
Samsung r440 com wireless broadcom bcm4313 no ubuntu 11.10
 
Exploit access root to kernel 2.6.32 2.6.36 privilege escalation exploit
Exploit access root to kernel 2.6.32 2.6.36   privilege escalation exploitExploit access root to kernel 2.6.32 2.6.36   privilege escalation exploit
Exploit access root to kernel 2.6.32 2.6.36 privilege escalation exploit
 
How to root phones or tablets running android 2.3 gingerbread jailbreak an...
How to root phones or tablets running android 2.3 gingerbread    jailbreak an...How to root phones or tablets running android 2.3 gingerbread    jailbreak an...
How to root phones or tablets running android 2.3 gingerbread jailbreak an...
 
Compartilhamento no samba com permissão de grupo
Compartilhamento no samba com permissão de grupoCompartilhamento no samba com permissão de grupo
Compartilhamento no samba com permissão de grupo
 
Canivete shell
Canivete shellCanivete shell
Canivete shell
 
Lsof
LsofLsof
Lsof
 
Converting parallels or vm ware to virtual box
Converting parallels or vm ware to virtual boxConverting parallels or vm ware to virtual box
Converting parallels or vm ware to virtual box
 
Instalação geo ip
Instalação geo ipInstalação geo ip
Instalação geo ip
 
Otimizando seu Squid
Otimizando seu SquidOtimizando seu Squid
Otimizando seu Squid
 
Instalando Cacti no CentOS 5
Instalando Cacti no CentOS 5Instalando Cacti no CentOS 5
Instalando Cacti no CentOS 5
 
Instalando rrd tool-no-centos-5-usando-yum
Instalando rrd tool-no-centos-5-usando-yumInstalando rrd tool-no-centos-5-usando-yum
Instalando rrd tool-no-centos-5-usando-yum
 
Como criar um repositório Ubuntu
Como criar um repositório UbuntuComo criar um repositório Ubuntu
Como criar um repositório Ubuntu
 

Dernier

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 

Alterar memória kvm virtual machine

  • 1. Sem título Manage your virtual machines From the shell You can manage your VMs from the shell using virsh. You can get a list of the available commands if you type "help". Type "help command" to get additional infos for a particular command. Define your new VM Before you can manage your new VM with virsh, you must define it: $ virsh --connect qemu:///system Connecting to uri: qemu:///system Welcome to virsh, the virtualization interactive terminal. Type: 'help' for help with commands 'quit' to quit virsh # define /etc/libvirt/qemu/newvm.xml Domain newvm defined from /etc/libvirt/qemu/newvm.xml Note that to list newvm, you must use 'list --inactive' or 'list --all', since list without any options will only list currently running machines. List your VMs Virsh allows you to list the virtual machines available on the current host: yhamon@paris:/etc/libvirt/qemu$ virsh --connect qemu:///system Connecting to uri: qemu:///system Welcome to virsh, the virtualization interactive terminal. Type: 'help' for help with commands 'quit' to quit virsh # help list NAME list - list domains SYNOPSIS list [--inactive | --all] DESCRIPTION Returns list of domains. OPTIONS --inactive list inactive domains --all list inactive & active domains virsh # list Id Name State ---------------------------------- 15 mirror running 16 vm2 running virsh # list --all Id Name State ---------------------------------- 15 mirror running 16 vm2 running - test5 shut off Define, undefine, start, shutdown, destroy VMs The VMs you see with list --all are VMs that have been "defined" from an XML file. Every VM is configured via a XML file in /etc/libvirt/qemu. If you want to Página 1
  • 2. Sem título remove a VM from the list of VMs, you need to undefine it: virsh # undefine test5 # WARNING: undefine will delete your XML file! Domain test5 has been undefined virsh # list --all Id Name State ---------------------------------- 15 mirror running 16 vm2 running To be able to undefine a virtual machine, it needs to be shutdown first: virsh # shutdown mirror Domain mirror is being shutdown This command asks for a nice shutdown (like running shutdown in command line). Notice: Ubuntu 10.04 server doesn't have acpid installed by default. This package needs to be installed on the guest OS before it will listen to any requests from the host. You can also use "destroy", the more brutal way of shutting down a VM, equivalent of taking the power cable off: virsh # destroy mirror Domain mirror destroyed If you have made a change to the XML configuration file, you need to tell KVM to reload it before restarting the VM: virsh # define /etc/libvirt/qemu/mirror.xml Domain mirror defined from /etc/libvirt/qemu/mirror.xml Then, to restart the VM: virsh # start mirror Domain mirror started Suspend and resume a Virtual Machine Virsh allows you to easily suspend and resume a virtual machine. virsh # suspend mirror Domain mirror suspended virsh # resume mirror Domain mirror resumed Editing the attributes of a Virtual Machine libvirt stores it's configuration as xml in '/etc/libvirt/qemu'. The xml is easy to understand, and is similar to VMware *.vmx files. While it is possible to edit these files in place and restart libvirt-bin for the changes to take affect, the recommended method for modifying the attributes of a virtual machine is via virsh (or virt-manager, if it supports changing the hardware you want to change). The concept is simple: export (aka 'dump') the xml of the virtual machine you want to edit edit the xml import (aka 'define') the xml For example, to edit the machine named 'foo' (you can get a list of your machines with 'virsh list --all'), do: $ virsh dumpxml foo > /tmp/foo.xml (edit /tmp/foo.xml as needed) $ virsh define /tmp/foo.xml Página 2
  • 3. Sem título Adding CPUs KVM allows you to create SMP guests. To allocate two CPUs to a VM, dump the xml as above, then edit your xml to have: <domain type='kvm'> ... <vcpu>2</vcpu> ... </domain> Now define the VM as above. Adding Memory To change the memory allocation in a VM, dump the xml as above, then edit your xml to have: <domain type='kvm'> ... <memory>262144</memory> <currentMemory>262144</currentMemory> ... </domain> Now define the VM as above. Keep in mind that the memory allocation is in kilobytes, so to allocate 512MB of memory, use 512 * 1024, or 524288. Changing the Network Card Model kvm and qemu currently default to using the rtl8139 NIC. Supported NICs in Ubuntu 8.04 LTS are i82551, i82557b, i82559er, ne2k_pci, pcnet, rtl8139, e1000, and virtio. To use an alternate NIC, dump the xml as above, then edit your xml to have: <domain type='kvm'> ... <interface type='network'> ... <model type='e1000'/> </interface> ... </domain> Now define the VM as above. Adding USB Device Pass-through Limitations USB protocol 1.1 only Device must be plugged in before KVM starts Apparmor modifications needed Apparmor Modification In order for a software program to access the usb device correctly the apparmor must be changed. Edit /etc/apparmor.d/abstractions/libvirt-qemu and uncomment some lines.: # WARNING: uncommenting these gives the guest direct access to host hardware. # This is required for USB pass through but is a security risk. You have been # warned. /sys/bus/usb/devices/ r, /sys/devices/*/*/usb[0-9]*/** r, /dev/bus/usb/*/[0-9]* rw, Página 3
  • 4. Sem título After making the changes apparmor must be restarted.: $ sudo /etc/init.d/apparmor restart Adding USB devices First find the usb Vendor ID and Product ID.: $ lsusb Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 005 Device 012: ID 0a5c:2110 Broadcom Corp. Bluetooth Controller Bus 005 Device 003: ID 0483:2016 SGS Thomson Microelectronics Fingerprint Reader Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub In the event that the Broadcom Corp. Bluetooth Controller wans to be selected the vendor and product ids are 0a5c and 2110 respectively. These can be entered into the xml profile. This can be done through virsh through the edit <domain> command.: <domain type='kvm'> <name>windowsxp</name> … <devices> … <hostdev mode='subsystem' type='usb'> <source> <vendor id='0x0a5c'/> <product id='0x2110'/> </source> </hostdev> </devices> </domain> Página 4