[libvirt] [RFC PATCH 4/4] powerpc: Remove incompatible command line options from qemu startup

Daniel P. Berrange berrange at redhat.com
Mon Oct 10 10:02:08 UTC 2011


On Sat, Oct 08, 2011 at 12:19:11AM +0530, Prerna Saxena wrote:
> This patch is a hack at the moment and would need code refactoring to
> split-out the defaults for x86 and powerpc.  Libvirt chooses a set of
> default options such as disk controller, network specific options, etc
> which are suitable for a x86 host.  These defaults are arch specific
> and hence libvirt needs a runtime switch to setup defaults based on
> host architecture.  Libvirt should have this routine split per-arch at
> the right level with minimal code duplication.
> 
> ---
>  src/qemu/qemu_command.c |   30 +++++++++++++++++++++++++++++-
>  1 files changed, 29 insertions(+), 1 deletions(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 0adc56a..3040f6a 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -1385,6 +1385,8 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
>           * When QEMU grows support for > 1 PCI domain, then pci.0 change
>           * to pciNN.0  where NN is the domain number
>           */
> +/* Prerna hack : remove PCI reference in command line */
> +#if 0
>          if (qemuCapsGet(qemuCaps, QEMU_CAPS_PCI_MULTIBUS))
>              virBufferAsprintf(buf, ",bus=pci.0");
>          else
> @@ -1394,6 +1396,7 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
>                                info->addr.pci.slot, info->addr.pci.function);
>          else
>              virBufferAsprintf(buf, ",addr=0x%x", info->addr.pci.slot);
> +#endif
>      } else if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB) {
>          virBufferAsprintf(buf, ",bus=");
>          qemuUsbId(buf, info->addr.usb.bus);
> @@ -1565,14 +1568,22 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
>              virBufferAsprintf(&opt, "file=%s,", disk->src);
>          }
>      }
> +
> +/* Prerna hack : force 'if=scsi' for powerKVM cmd line */
> +#if 0
>      if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
>          virBufferAddLit(&opt, "if=none");
>      else
> -        virBufferAsprintf(&opt, "if=%s", bus);
> +#endif
> + /* force 'if=scsi' for qemu command line output */
> +    virBufferAsprintf(&opt, "if=%s", bus);
> +
>  
>      if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
>          virBufferAddLit(&opt, ",media=cdrom");
>  
> +/* Prerna Hack : remove 'id=drive-scsi0-0-0' */
> +#if 0
>      if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
>          virBufferAsprintf(&opt, ",id=%s%s", QEMU_DRIVE_HOST_PREFIX, disk->info.alias);
>      } else {
> @@ -1586,6 +1597,8 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
>                  virBufferAsprintf(&opt, ",unit=%d", unitid);
>          }
>      }
> +#endif
> +
>      if (bootable &&
>          qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE_BOOT) &&
>          disk->device == VIR_DOMAIN_DISK_DEVICE_DISK &&
> @@ -3380,6 +3393,8 @@ qemuBuildCommandLine(virConnectPtr conn,
>      if (!def->graphics)
>          virCommandAddArg(cmd, "-nographic");
>  
> +/* Prerna hack : remove unnecesary options */
> +#if 0
>      if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
>          if (qemuCapsGet(qemuCaps, QEMU_CAPS_NODEFCONFIG))
>              virCommandAddArg(cmd,
> @@ -3387,6 +3402,7 @@ qemuBuildCommandLine(virConnectPtr conn,
>          virCommandAddArg(cmd,
>                           "-nodefaults");  /* Disable default guest devices */
>      }
> +#endif
>  
>      /* Serial graphics adapter */
>      if (def->os.bios.useserial == VIR_DOMAIN_BIOS_USESERIAL_YES) {
> @@ -3692,6 +3708,8 @@ qemuBuildCommandLine(virConnectPtr conn,
>                  }
>                  usblegacy = true;
>              } else {
> +/* Prerna hack : remove invocation for -drive lsi */
> +#if 0
>                  virCommandAddArg(cmd, "-device");
>  
>                  char *devstr;
> @@ -3701,6 +3719,7 @@ qemuBuildCommandLine(virConnectPtr conn,
>  
>                  virCommandAddArg(cmd, devstr);
>                  VIR_FREE(devstr);
> +#endif
>              }
>          }
>      }
> @@ -3833,6 +3852,8 @@ qemuBuildCommandLine(virConnectPtr conn,
>                                                 bootindex);
>                      }
>                  } else {
> +/* Prerna hack: Remove -device string */
> +#if 0
>                      virCommandAddArg(cmd, "-device");
>  
>                      if (!(optstr = qemuBuildDriveDevStr(disk, bootindex,
> @@ -3840,6 +3861,7 @@ qemuBuildCommandLine(virConnectPtr conn,
>                          goto error;
>                      virCommandAddArg(cmd, optstr);
>                      VIR_FREE(optstr);
> +#endif
>                  }
>              }
>          }
> @@ -4250,9 +4272,12 @@ qemuBuildCommandLine(virConnectPtr conn,
>                  virCommandAddArg(cmd, devstr);
>                  VIR_FREE(devstr);
>  
> +/* Prerna hack : remove 'isa-serial' device */
> +#if 0
>                  virCommandAddArg(cmd, "-device");
>                  virCommandAddArgFormat(cmd, "isa-serial,chardev=char%s,id=%s",
>                                         serial->info.alias, serial->info.alias);
> +#endif
>              } else {
>                  virCommandAddArg(cmd, "-serial");
>                  if (!(devstr = qemuBuildChrArgStr(&serial->source, NULL)))
> @@ -5089,6 +5114,8 @@ qemuBuildCommandLine(virConnectPtr conn,
>       * NB: Earlier we declared that VirtIO balloon will always be in
>       * slot 0x3 on bus 0x0
>       */
> +/* Prerna Hack : Remove all virtio-balloon devices */
> +#if 0
>      if ((def->memballoon) &&
>          (def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_NONE)) {
>          if (def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) {
> @@ -5110,6 +5137,7 @@ qemuBuildCommandLine(virConnectPtr conn,
>              virCommandAddArgList(cmd, "-balloon", "virtio", NULL);
>          }
>      }
> +#endif
>  
>      if (snapshot)
>          virCommandAddArgList(cmd, "-loadvm", snapshot->def->name, NULL);

I have a rough idea of why you need most of these changes, but to just
clarify things, could you show us the following data from a PPC QEMU
guest after you have this patch applied.

 - XML configuration file
 - The QEMU ARGV from /var/log/libvirt/qemu/$GUESTNAME.log
 - The output of

     $ virsh qemu-monitor-command --hmp $GUESTNAME 'info qtree'
     $ virsh qemu-monitor-command --hmp $GUESTNAME 'info pci'
     $ virsh qemu-monitor-command --hmp $GUESTNAME 'info block'

 - The output of $ qemu-kvm -device '?'

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list