qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	Glauber Costa <glommer@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 22/22] machine: introduce -machine-def option to define a machine via config
Date: Fri, 11 Jun 2010 14:03:03 +0100	[thread overview]
Message-ID: <20100611130303.GG16782@redhat.com> (raw)
In-Reply-To: <20100610174842.GF17543@redhat.com>

On Thu, Jun 10, 2010 at 06:48:42PM +0100, Daniel P. Berrange wrote:
> On Mon, Jun 07, 2010 at 07:50:14PM -0500, Anthony Liguori wrote:
> > On 06/07/2010 06:52 PM, Anthony Liguori wrote:
> > >Since we have MachineCore and can represent a machine entirely via default
> > >options, we can introduce a new option that let's us dynamically register a
> > >machine based on those options.
> > >
> > >For instance, we could add the following to target-x86_64.conf:
> > >
> > >[machine-def]
> > >  name = "pc-0.11"
> > >  desc = "Standard PC"
> > >  acpi = "on"
> > >  pci = "on"
> > >  cpu = "qemu64"
> > >  max_cpus = "255"
> > >  virtio-blk-pci.vectors = "0"
> > >  virtio-serial-pci.max_nr_ports = "1"
> > >  virtio-serial-pci.vectors = "0"
> > >  ide-drive.ver = "0.11"
> > >  scsi-disk.ver = "0.11"
> > >  PCI.rombar = "0"
> > >
> > >What's really exciting, is that a user can then define their own machines
> > >that better suite their desires:
> > >
> > >[kvmpc]
> > >  name = "kvmpc"
> > >  accel = "kvm|tcg"
> > >  ram_size = "512M"
> > >  max_cpus = "64"
> > >  sockets = "16"
> > >  default_drive = "virtio"
> > >
> > >I'd eventually like to move all PC compatibility machines to the default
> > >config but for now, I wanted to keep this simple.
> > >
> > >Signed-off-by: Anthony Liguori<aliguori@us.ibm.com>
> > >   
> > 
> > From the perspective of a tool like libvirt, I think there are a couple 
> > ways it could handle something like this and I think it's worth 
> > discussing the options.
> > 
> > Assume we move all the compat machine definitions into a config file, 
> > since libvirt presumably uses -nodefconfig today, it could simply 
> > include it's own machine definitions for each qemu version based on the 
> > definitions we ship.  That makes sure that the definition is always 
> > static for libvirt.
> 
> Due to a screwup on my part, we don't currently use -nodefconfig
> but we should be. I had originally thought '-nodefaults' turned off
> all defaults, but I see it only does defaults hardware, but not
> default configs. 
> 
> > Another option would be for libvirt to not use -nodefconfig, and instead 
> > to let the user's global configs be read.  libvirt would then read the 
> > config file from the running qemu instance to sync it's state up.
> 
> The tricky thing I'm seeing here is the scope of the stuff you can 
> put in the configuration files. 
> 
> On the one had there are config options that effectively provide new 
> capabilities to the QEMU binary eg new machine types, new CPU definitions.
> These don't cause any trouble, since that are a complete no-op unless you
> launch a guest that actually requests to make use of them eg by adding a
> -M mycustommachine or  a  -cpu mycustomCPUmodel flag. A '-M pc-010' guest
> will never be impacted by fact that you added some new machine types in
> the global config.
> 
> On the other hand there are config options that immediately change the 
> virtual hardware in all guests launched, eg if I edit the 
> /etc/qemu/target-i386.conf and add
> 
>   [drive]
>     if = "ide"
>     file = "foo.iso"
> 
> then every single guest gets a new piece of hardware, which is what we
> tried to avoid with the '-nodefaults' flag already.
> 
> > The later option is a bit more work up front but longer term, I think it 
> > addresses a couple things nicely.  It provides a way for a user 
> > specified config to co-exist with libvirt.  It also let's tools tweak 
> > power config options in a way that's compatible with libvirt.
> > 
> > If libvirt can embed the qemu config description in its own XML, then 
> > there is no problem for libvirt to recreate the system on a different 
> > box even if the global configuration is different.
> 
> If the global config is just adding new capabilities (machine types,
> cpu types, etc) I see no problem with having these loaded by default
> for any libvirt guest.
> 
> When the global config can add extra hardware (eg drives) this becomes
> very tricky to re-concile, which is exactly why we had '-nodefaults'
> to turn off extra global hardware. 
> 
> We want all hardware libvirt knows about to be visible in the XML. 
> eg, if the default config contained a [drive] section, you'd expect 
> that to appear as a <disk> in libvirt XML. So if we parsed the default 
> global config to sync it to the libvirt XML, when we come to launch the
> guest, we have even more fun figuring out which of the disks in the XML
> config needs a '-drive' on the ARGV, and which don't need any arg because
> they're in the global config. To make that practical we'd need to read 
> the global config, turn it into libvirt XML, and then launch the guest
> with -nodefconfig and just use -drive as normal for everything. But then
> we loose useful things like new machine types & cpu types :-(
> 
> Is it practical to a way to separate the global config into two global
> configs. One config that is used to define extra capabilities (machine
> types, cpu types, etc) that on their own are guarenteed to never impact
> any existing guest config. One that is used to add default hardware 
> (disks nics, etc) which clearly does impact every guest.
> 
> Then, we could let the global capabilities config be in effect at all 
> times, QEMU wouldn't even need a way to turn that off. The global
> hardware config could be enabled/disable as per the needs of the mgmt
> app, reconciled with their config as required.

Actually thinking about it some more, it doesn't require a separation of
global configs. Instead we're just use my capabilities patches to query
the desired CPU & machine definitions from the global, and write them out 
to a new config and then use -nodefconfig to turn off the global config,
and -readconfig re-add just the bits of the global config we wanted.


Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

  reply	other threads:[~2010-06-11 13:03 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-07 23:51 [Qemu-devel] [PATCH 0/22] Refactor machine support Anthony Liguori
2010-06-07 23:51 ` [Qemu-devel] [PATCH 01/22] QemuOpts: fix a bug in QemuOpts when setting an option twice Anthony Liguori
2010-06-08  7:51   ` Gerd Hoffmann
2010-06-08 10:32     ` [Qemu-devel] " Paolo Bonzini
2010-06-08 13:07       ` Anthony Liguori
2010-06-08 13:44         ` Gerd Hoffmann
2010-06-08 15:17           ` Anthony Liguori
2010-06-08 15:37             ` Gerd Hoffmann
2010-06-08 16:04               ` Anthony Liguori
2010-06-09  7:01                 ` Gerd Hoffmann
2010-06-08 14:38         ` Paul Brook
2010-06-08 15:14           ` Anthony Liguori
2010-06-07 23:51 ` [Qemu-devel] [PATCH 02/22] QemuOpts: make qemu_opts_validate() store the description list for later use Anthony Liguori
2010-06-07 23:51 ` [Qemu-devel] [PATCH 03/22] QemuOpts: add function to set QemuOpts from defaults Anthony Liguori
2010-06-07 23:51 ` [Qemu-devel] [PATCH 04/22] machine: package all init arguments into a QemuOpts (v2) Anthony Liguori
2010-06-07 23:51 ` [Qemu-devel] [PATCH 05/22] machine: pass all init options as a single QemuOpts Anthony Liguori
2010-06-08  7:58   ` Gerd Hoffmann
2010-06-07 23:51 ` [Qemu-devel] [PATCH 06/22] Make -acpi-enable a machine specific option Anthony Liguori
2010-06-07 23:51 ` [Qemu-devel] [PATCH 07/22] machine: introduce -machine option Anthony Liguori
2010-06-07 23:51 ` [Qemu-devel] [PATCH 08/22] machine: implement -kernel/-append/-initrd options in term of -machine Anthony Liguori
2010-06-07 23:51 ` [Qemu-devel] [PATCH 09/22] machine: implement -m in terms " Anthony Liguori
2010-06-07 23:51 ` [Qemu-devel] [PATCH 10/22] machine: allow boards to specify default values and use it in isapc Anthony Liguori
2010-06-08  8:03   ` Gerd Hoffmann
2010-06-08 13:09     ` Anthony Liguori
2010-06-08 13:29       ` Gerd Hoffmann
2010-06-07 23:51 ` [Qemu-devel] [PATCH 11/22] machine: replace compat_props with opts_default Anthony Liguori
2010-06-07 23:52 ` [Qemu-devel] [PATCH 12/22] machine: some sugary macros to simplify machine default options Anthony Liguori
2010-06-07 23:52 ` [Qemu-devel] [PATCH 13/22] machine: get rid of global default QEMUMachine members Anthony Liguori
2010-06-07 23:52 ` [Qemu-devel] [PATCH 14/22] machine: replace QEMUMachine.use_scsi with -machine default_drive Anthony Liguori
2010-06-07 23:52 ` [Qemu-devel] [PATCH 15/22] machine: make max_cpus a -machine option Anthony Liguori
2010-06-08  1:01   ` Paul Brook
2010-06-08  1:56     ` Anthony Liguori
2010-06-08  2:56       ` Paul Brook
2010-06-09  7:44       ` Jes Sorensen
2010-06-09  7:47   ` Jes Sorensen
2010-06-07 23:52 ` [Qemu-devel] [PATCH 16/22] machine: move default machine out of machine definitions Anthony Liguori
2010-06-07 23:52 ` [Qemu-devel] [PATCH 17/22] machine: kill machine->alias Anthony Liguori
2010-06-07 23:52 ` [Qemu-devel] [PATCH 18/22] machine: final conversion to pure QemuOpts Anthony Liguori
2010-06-07 23:52 ` [Qemu-devel] [PATCH 19/22] machine: introduce accel option to allow selection of kvm or tcg Anthony Liguori
2010-06-07 23:52 ` [Qemu-devel] [PATCH 20/22] machine: introduce machine core and split qemu_register_machine Anthony Liguori
2010-06-07 23:52 ` [Qemu-devel] [PATCH 21/22] machine: convert pc machines to split core vs machine API Anthony Liguori
2010-06-09  7:51   ` Jes Sorensen
2010-06-07 23:52 ` [Qemu-devel] [PATCH 22/22] machine: introduce -machine-def option to define a machine via config Anthony Liguori
2010-06-08  0:50   ` Anthony Liguori
2010-06-10 17:48     ` Daniel P. Berrange
2010-06-11 13:03       ` Daniel P. Berrange [this message]
2010-06-08  3:12 ` [Qemu-devel] [PATCH 0/22] Refactor machine support Paul Brook
2010-06-08 10:24   ` [Qemu-devel] " Paolo Bonzini
2010-06-08 14:30     ` Paul Brook
2010-06-08 15:28       ` Anthony Liguori
2010-06-08 15:36         ` Paul Brook
2010-06-08 15:58           ` Paolo Bonzini
2010-06-08 16:15             ` Anthony Liguori
2010-06-08 21:05               ` Alexander Graf
2010-06-08 21:16                 ` Anthony Liguori
2010-06-08 17:23             ` Anthony Liguori
2010-06-09  2:11             ` Paul Brook
2010-06-09 13:55               ` Anthony Liguori
2010-06-09 14:30                 ` Paul Brook
2010-06-09 20:47                   ` Blue Swirl
2010-06-09 20:52                     ` Anthony Liguori
2010-06-09 21:09                       ` Blue Swirl
2010-06-09 22:26                       ` Paul Brook
2010-06-08 14:04   ` [Qemu-devel] " Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100611130303.GG16782@redhat.com \
    --to=berrange@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=anthony@codemonkey.ws \
    --cc=glommer@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).